:root {
  --bg: #060606;
  --bit-cool: rgba(120, 220, 255, 0.95);
  --bit-warm: rgba(180, 255, 200, 1);
  --ink: #e8e6e0;
  --ink-dim: rgba(232, 230, 224, 0.5);
  --ink-faint: rgba(232, 230, 224, 0.15);
  --red: #ff2a18;
  --red-glow: rgba(255, 42, 24, 0.55);
  --accent: #c8ff5a;
  --warn: #ff9500;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: var(--font-sans); color: var(--ink); }

#starfield { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.vignette { position: fixed; inset: 0; z-index: 1; background: radial-gradient(ellipse at center, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.45) 60%, rgba(0,0,0,0.85) 100%); pointer-events: none; }

.stage { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; padding: 24px; transition: opacity 0.6s ease; }
.stage.gone { opacity: 0; pointer-events: none; }

.title { font-family: var(--font-mono); font-size: clamp(20px, 4.2vw, 48px); letter-spacing: 0.35em; color: var(--ink); text-shadow: 0 0 8px rgba(255,255,255,0.4), 0 0 22px rgba(120, 220, 255, 0.25); margin-bottom: 14px; user-select: none; }
.title .accent { color: var(--bit-warm); text-shadow: 0 0 10px rgba(180, 255, 200, 0.7), 0 0 28px rgba(180, 255, 200, 0.4); }
.subtitle { font-family: var(--font-mono); font-size: clamp(11px, 1.3vw, 14px); letter-spacing: 0.4em; color: rgba(232, 230, 224, 0.6); margin-bottom: 50px; text-transform: uppercase; user-select: none; }
.countdown { font-family: var(--font-mono); font-weight: 700; font-size: clamp(96px, 18vw, 220px); line-height: 1; color: var(--red); text-shadow: 0 0 16px var(--red-glow), 0 0 36px var(--red-glow), 0 0 80px rgba(255, 42, 24, 0.25); letter-spacing: -0.02em; transform-origin: center; }
.countdown.pulse { animation: pulse 1s ease-in-out; }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0; } 35% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1.0); opacity: 1; } }

.footer { position: fixed; bottom: 22px; left: 0; right: 0; z-index: 2; text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5em; color: rgba(232, 230, 224, 0.30); text-transform: uppercase; user-select: none; transition: opacity 0.4s; }
.footer.gone { opacity: 0; }

.skip { position: fixed; top: 18px; right: 18px; z-index: 5; pointer-events: auto; background: rgba(0,0,0,0.5); border: 1px solid rgba(232,230,224,0.2); color: rgba(232,230,224,0.7); padding: 6px 12px; border-radius: 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; opacity: 0; transition: opacity 0.4s; }
.skip.visible { opacity: 1; }
.skip:hover { color: var(--ink); border-color: rgba(232,230,224,0.5); }

.legal-gate { position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
.legal-gate.show { opacity: 1; pointer-events: auto; }
.legal-card { width: 100%; max-width: 620px; background: rgba(10, 10, 10, 0.88); border: 1px solid rgba(255, 149, 0, 0.35); border-radius: 10px; padding: 28px 32px; backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.legal-flag { display: inline-block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--warn); background: rgba(255, 149, 0, 0.12); border: 1px solid rgba(255, 149, 0, 0.45); padding: 4px 10px; border-radius: 3px; text-transform: uppercase; margin-bottom: 16px; }
.legal-title { font-family: var(--font-mono); font-size: 14px; letter-spacing: 2.5px; color: var(--ink); text-transform: uppercase; margin-bottom: 14px; }
.legal-body { font-size: 13px; line-height: 1.6; color: rgba(232, 230, 224, 0.85); margin-bottom: 20px; }
.legal-body strong { color: var(--ink); }
.legal-body p { margin-bottom: 10px; }
.legal-body p:last-child { margin-bottom: 0; }
.legal-agree-row { display: flex; align-items: flex-start; gap: 10px; padding: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--ink-faint); border-radius: 6px; margin-bottom: 18px; cursor: pointer; user-select: none; transition: border-color 0.15s; }
.legal-agree-row:hover { border-color: rgba(232,230,224,0.35); }
.legal-agree-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 1px; flex-shrink: 0; cursor: pointer; }
.legal-agree-row label { font-size: 13px; color: var(--ink); line-height: 1.5; cursor: pointer; flex: 1; }
.legal-actions { display: flex; gap: 10px; }
.legal-btn { flex: 1; padding: 12px 18px; border-radius: 6px; font-family: var(--font-sans); font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; min-height: 44px; }
.legal-btn.primary { background: var(--accent); color: #060606; border-color: var(--accent); }
.legal-btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.legal-btn.primary:disabled { opacity: 0.35; cursor: not-allowed; background: rgba(200, 255, 90, 0.12); color: rgba(200, 255, 90, 0.5); border-color: rgba(200, 255, 90, 0.2); }
.legal-btn.ghost { background: transparent; color: var(--ink-dim); border-color: var(--ink-faint); flex: 0 0 auto; min-width: 100px; }
.legal-btn.ghost:hover { color: var(--ink); border-color: var(--ink); }

.narration { position: fixed; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 28px 80px; opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
.narration.show { opacity: 1; pointer-events: auto; }
.beat-card { width: 100%; max-width: 760px; background: rgba(10, 10, 10, 0.78); border: 1px solid rgba(120, 220, 255, 0.18); border-radius: 10px; padding: 36px 40px; backdrop-filter: blur(8px); box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.beat-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; color: var(--bit-warm); text-transform: uppercase; margin-bottom: 14px; }
.beat-text { font-size: clamp(15px, 1.6vw, 19px); line-height: 1.65; color: var(--ink); }
.beat-text.fade { animation: beatfade 0.5s ease-out; }
@keyframes beatfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.beat-progress { height: 2px; background: rgba(255,255,255,0.06); border-radius: 1px; margin: 24px 0 18px; overflow: hidden; }
.beat-progress .fill { height: 100%; background: linear-gradient(90deg, var(--bit-cool), var(--bit-warm)); width: 0%; transition: width 0.05s linear; }
.beat-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.beat-dots { display: flex; gap: 6px; flex: 1; }
.beat-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(232,230,224,0.18); transition: background 0.2s; }
.beat-dot.active { background: var(--bit-warm); }
.beat-dot.done { background: rgba(180, 255, 200, 0.5); }
.beat-btn { padding: 10px 20px; border-radius: 6px; font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--ink-faint); background: transparent; color: var(--ink-dim); transition: all 0.15s; }
.beat-btn:hover { color: var(--ink); border-color: var(--ink); }
.beat-btn.primary { background: var(--accent); color: #060606; border-color: var(--accent); }
.beat-btn.primary:hover { filter: brightness(1.08); }


/* =============================================================
 * Bug-bash patches (2026-05-01)
 * ============================================================= */
/* Bug 4 — give the legal/narration card a near-opaque backdrop AND
   darken the entire viewport when the modal is up so the matrix
   rain stops showing through. */
.legal-card,
.beat-card {
  background: rgba(8, 9, 12, 0.97) !important;
}
.legal-gate.show {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.narration.show {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Bug 3 — hide the narration card from the DOM tree until it's
   actually used so screen readers + tab nav don't see ghost buttons. */
#narration[style*="display: none"] { pointer-events: none; }

/* Slight z-index bump on the legal/narration cards so we are clearly
   above the canvas (#starfield z-index:0) and vignette (z-index:1). */
.legal-gate, .narration { z-index: 50 !important; }
.skip { z-index: 60 !important; }
