@font-face {
  font-family: 'OpenDyslexic';
  src: url('fonts/OpenDyslexic-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'OpenDyslexic';
  src: url('fonts/OpenDyslexic-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #0a0a14; --bg-card: #141428; --border: #2a2a4a;
  --neon-cyan: #4ECDC4; --neon-gold: #FFD700; --neon-pink: #FF6B9D; --neon-orange: #FF6B35;
  --text: #eaeaf5; --text-dim: #8a8aa8;
  --color-error: #E74C3C; --color-warning: #F39C12; --color-success: #2ECC71;
  --color-primary: var(--neon-cyan);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #14142e 0%, var(--bg) 60%);
  color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
#particle-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#app { width: min(680px, 94vw); padding: 24px; text-align: center; position: relative; z-index: 11; }
.screen { animation: fadein .4s ease; }
.hidden { display: none !important; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
h1 { font-size: clamp(2.2rem, 8vw, 4rem); letter-spacing: .08em; line-height: 1.1; }
h2 { font-size: clamp(1.3rem, 5vw, 2rem); margin-bottom: 16px; }
.glow { color: var(--neon-cyan); text-shadow: 0 0 18px rgba(78,205,196,.55), 0 0 60px rgba(78,205,196,.25); }
.tagline { color: var(--text-dim); margin: 18px 0 30px; line-height: 1.6; }
.small { color: var(--text-dim); font-size: .9rem; margin: 10px 0; line-height: 1.5; }
.blurb { margin: 14px auto 26px; max-width: 46ch; line-height: 1.65; }
.btn {
  font: inherit; cursor: pointer; border-radius: 12px; padding: 14px 26px; margin: 8px;
  border: 2px solid var(--border); background: var(--bg-card); color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(78,205,196,.35); }
.btn-secondary { border-color: var(--neon-gold); }
.btn-ghost { border-color: transparent; color: var(--text-dim); }
.btn-energy { font-size: 1.1rem; min-width: 130px; }
.btn-energy.active { border-color: var(--neon-gold); box-shadow: 0 0 14px rgba(255,215,0,.4); }
.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.input {
  font: inherit; width: min(340px, 90%); margin: 8px auto; display: block;
  padding: 12px 16px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg-card); color: var(--text); text-align: center;
}
.input:focus { outline: none; border-color: var(--neon-cyan); }
.hud { display: flex; justify-content: space-between; align-items: center;
  font-size: 1.2rem; margin-bottom: 18px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(20,20,40,.6); }
/* Anchor for absolutely-positioned chamber layers (vault canvas + UI overlay).
   Without this the vault's canvas resolves against the viewport and paints
   opaque black over the entire page. */
#game-content { position: relative; }
/* The boss chamber's children are all position:absolute, so the container
   collapses to 0 height — which also gives the WebGL renderer a 0-pixel
   buffer. Only the boss needs an explicit stage height. */
#game-content.boss-arena { height: min(60vh, 480px); }
#hud-timer { color: var(--neon-gold); font-variant-numeric: tabular-nums; }
.feedback { min-height: 1.6em; margin-top: 14px; font-size: 1.1rem; font-weight: 600; }
.feedback.success { color: var(--color-success); }
.feedback.error { color: var(--color-error); }
.feedback.warning { color: var(--color-warning); }
.fork-card { border: 1px solid var(--border); border-radius: 16px; padding: 28px;
  background: var(--bg-card); box-shadow: 0 0 30px rgba(0,0,0,.5); }
#fork-prompt { font-size: 1.15rem; line-height: 1.7; margin-bottom: 22px; }
.reveal-emoji { font-size: 5rem; margin: 16px 0; }
.pattern-grid { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px;
  justify-content: center; margin: 22px auto; }
.pattern-item { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; background: var(--bg-card); border: 2px solid var(--border);
  border-radius: 12px; cursor: pointer; user-select: none; transition: transform .1s; }
.pattern-item:hover { transform: scale(1.06); border-color: var(--neon-cyan); }
.color-sequence { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 22px 0; }
.color-box { width: 62px; height: 62px; border-radius: 12px; cursor: pointer;
  transition: transform .15s, opacity .15s; }
.math-problem { font-size: 2.4rem; margin: 24px 0; color: var(--neon-gold);
  font-variant-numeric: tabular-nums; min-height: 1.3em; }
.vault-grid { display: grid; grid-template-columns: repeat(3, 92px); gap: 12px;
  justify-content: center; margin: 26px auto; }
.vault-tile { width: 92px; height: 92px; font-size: 2.6rem; display: flex; align-items: center;
  justify-content: center; border-radius: 14px; border: 2px solid var(--border);
  background: var(--bg-card); cursor: pointer; transition: transform .12s, box-shadow .2s; }
.vault-tile.lit { border-color: var(--neon-gold); box-shadow: 0 0 16px rgba(255,215,0,.5);
  background: rgba(255,215,0,.12); }
.vault-tile:hover { transform: scale(1.05); }
.vault-reset { font-size: 1.6rem; background: none; border: none; cursor: pointer; opacity: .5; }
.vault-reset:hover { opacity: 1; }
.font-od, .font-od * { font-family: 'OpenDyslexic', 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif !important; letter-spacing: .02em; }
.hud-mute { background: none; border: none; cursor: pointer; font-size: 1.1rem; opacity: .6; padding: 2px 6px; }
.hud-mute:hover { opacity: 1; }
/* ── v3 entrance hero (spec §3a) ── */
@keyframes bootWordIn { from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
                        to   { opacity: 1; transform: none; filter: none; } }
@keyframes bootFadeUp { from { opacity: 0; transform: translateY(10px); }
                        to   { opacity: 1; transform: none; } }
body.boot-playing .boot-word        { opacity: 0; animation: bootWordIn 0.6s ease forwards; }
body.boot-playing .tagline          { opacity: 0; animation: bootFadeUp 0.45s ease forwards; }
body.boot-playing .boot-actions > * { opacity: 0; animation: bootFadeUp 0.35s ease forwards; }
@media (prefers-reduced-motion: reduce) {
  body.boot-playing .boot-word, body.boot-playing .tagline, body.boot-playing .boot-actions > * {
    animation-duration: 0.01s !important; animation-delay: 0s !important;
  }
}
/* ── v3 momentum HUD (spec §3d) ── */
.hud-streak { color: var(--neon-orange); font-variant-numeric: tabular-nums; min-width: 3ch; }
@keyframes coinPulse { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
#hud-coins.pulse { animation: coinPulse .35s ease; display: inline-block; }
@media (prefers-reduced-motion: reduce) { #hud-coins.pulse { animation: none; } }
/* ── v3 vault door — mobile-fit glyph lock ── */
.vault-slots {
  display: flex; justify-content: center; align-items: center;
  gap: clamp(8px, 3vw, 20px);
  width: 100%; max-width: 340px;
  margin: clamp(28px, 8vh, 90px) auto 0;
}
.vault-slot {
  flex: 1 1 0; min-width: 0; max-width: 74px; margin: 0; padding: 0;
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: clamp(1.35rem, 7vw, 2rem);
}
/* ── v3 chamber interstitial (spec §3c) ── */
.interstitial-icon { font-size: 4rem; margin-bottom: 12px; animation: bootFadeUp .3s ease; }
.interstitial-card h2 { animation: bootFadeUp .35s ease; }
@media (prefers-reduced-motion: reduce) {
  .interstitial-icon, .interstitial-card h2 { animation: none; }
}
