@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
  --bg:           #0F0F23;
  --card:         #1A1830;
  --primary:      #7C3AED;
  --primary-dim:  rgba(124, 58, 237, 0.25);
  --primary-glow: rgba(124, 58, 237, 0.45);
  --secondary:    #A78BFA;
  --accent:       #F43F5E;
  --accent-glow:  rgba(244, 63, 94, 0.4);
  --cyan:         #22D3EE;
  --text:         #E2E8F0;
  --muted:        #64748B;
  --border:       rgba(124, 58, 237, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
  cursor: pointer;
  overflow: hidden;
}

/* Scanlines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.04) 0px,
    rgba(0,0,0,0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 999;
}

/* ── Canvases ─────────────────────────────────────────────────────────── */
#spaceCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

canvas:not(#spaceCanvas) {
  position: relative;
  z-index: 1;
}

/* ── Overlay base ─────────────────────────────────────────────────────── */
#instructions {
  display: none;
  position: relative;
  z-index: 10;
}

#results,
body:hover #instructions {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(124,58,237,0.07) 0%, rgba(15,15,35,0.88) 65%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 10;
}

#results { display: none; cursor: default; }

/* ── Panel card ───────────────────────────────────────────────────────── */
#results .content,
#instructions .content {
  position: relative;
  width: min(360px, 92vw);
  padding: 48px 40px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(124,58,237,0.08),
    0 0 60px rgba(124,58,237,0.12),
    0 24px 48px rgba(0,0,0,0.5);
}

/* HUD corner — top-left purple */
#results .content::before,
#instructions .content::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 20px; height: 20px;
  border-top: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
}

/* HUD corner — bottom-right accent */
#results .content::after,
#instructions .content::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 20px; height: 20px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}

/* ── Panel title ──────────────────────────────────────────────────────── */
.panel-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.2rem;
  letter-spacing: 0.14em;
  line-height: 1;
  margin: 0 0 4px;
  color: #fff;
  text-shadow:
    0 0 12px var(--primary-glow),
    0 0 36px var(--primary-dim);
}

.panel-title.danger {
  color: var(--accent);
  text-shadow:
    0 0 12px var(--accent-glow),
    0 0 36px rgba(244,63,94,0.2);
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 16px auto;
}

/* ── Panel text ───────────────────────────────────────────────────────── */
#instructions .content p,
#results .content p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 4px 0;
}

#instructions .content p strong,
#results .content p strong {
  color: var(--secondary);
  font-weight: 600;
}

/* ── CTA button ───────────────────────────────────────────────────────── */
.cta {
  display: inline-block;
  margin-top: 24px;
  padding: 11px 28px;
  border: 1px solid var(--primary);
  border-radius: 2px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  color: var(--secondary);
  background: rgba(124,58,237,0.08);
  box-shadow:
    0 0 16px var(--primary-dim),
    inset 0 0 16px rgba(124,58,237,0.04);
  transition: box-shadow 0.2s, background 0.2s;
  cursor: pointer;
}

.cta:hover {
  background: rgba(124,58,237,0.16);
  box-shadow:
    0 0 24px var(--primary-glow),
    inset 0 0 20px rgba(124,58,237,0.08);
}

/* ── Score ────────────────────────────────────────────────────────────── */
#score-wrap {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 10;
  text-align: right;
  pointer-events: none;
}

#score-label {
  display: block;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

#score {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4.5rem;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 10px var(--primary-glow),
    0 0 30px var(--primary-dim),
    0 0 60px rgba(124,58,237,0.15);
}

/* ── Mode badge ───────────────────────────────────────────────────────── */
#mode-badge {
  position: fixed;
  top: 28px;
  left: 28px;
  z-index: 10;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  color: var(--primary);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: rgba(124,58,237,0.07);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* ── Key hint ─────────────────────────────────────────────────────────── */
#key-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.7;
}

#key-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: rgba(124,58,237,0.08);
  font-family: inherit;
  font-size: inherit;
  color: var(--secondary);
}
