/* v16 Game IQ Checkup: a clinic for your football brain. Two materials: clinic paper (white, navy ink, one
   clinical blue) and x-ray film (blue-black, glowing pale blue). Mint = clear, coral = needs work. */
:root {
  --paper: #f2f6fa;
  --paper2: #e5edf5;
  --card: #ffffff;
  --ink: #0b2340;
  --ink2: #4a6585;
  --ink3: #7d93ab;
  --line: #d3dfeb;
  --film: #050e1a;
  --film2: #0b1d33;
  --film3: #13304f;
  --xray: #7fc8ff;
  --glow: #dff3ff;
  --blue: #1668e3;
  --blue2: #0f4fb3;
  --mint: #12b981;
  --mint-soft: #dff7ee;
  --coral: #f2554d;
  --coral-soft: #fde7e5;
  --amber: #f5a524;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --gut: 16px;
  --r: 18px;
  --f-ui: 'Avenir Next', 'Helvetica Neue', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-num: 'DIN Alternate', 'DIN Condensed', Bahnschrift, 'Avenir Next Condensed', 'Arial Narrow', sans-serif;
  --f-mono: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--film); color: var(--ink); overflow: hidden; }
body { font: 500 16px/1.4 var(--f-ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
b, strong { font-weight: 700; }
.num { font-family: var(--f-num); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- the stage (the engine's 3D) ---------- */
.stage { position: fixed; inset: 0; z-index: 0; }
body[data-phase="boot"] .stage, body[data-phase="intro"] .stage, body[data-phase="between"] .stage,
body[data-phase="gate"] .stage, body[data-phase="results"] .stage { visibility: hidden; }

/* ---------- pages ---------- */
.screen { position: fixed; inset: 0; z-index: 10; overflow-x: clip; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen[hidden] { display: none; }
.screen.is-paper { background: var(--paper); color: var(--ink); }
.screen.is-film { background: radial-gradient(120% 70% at 50% 30%, var(--film3) 0%, var(--film2) 38%, var(--film) 80%); color: var(--glow); }
.screen.is-clear { background: transparent; overflow: hidden; }
.screen.is-over { background: transparent; pointer-events: none; overflow: hidden; }
.screen.is-over > * { pointer-events: auto; }
.pg { min-height: 100%; display: flex; flex-direction: column; overflow-x: clip; }

/* the header: clinic logo + the 5-step journey */
.top { flex: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: calc(12px + var(--sat)) var(--gut) 6px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding-right: 110px; font-size: 14px; letter-spacing: .01em; white-space: nowrap; }
.brand b { font-weight: 700; }
.logo { width: 24px; height: 24px; flex: none; }
.logo rect { fill: var(--blue); }
.logo path { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.is-film .logo rect, .is-clear .logo rect { fill: var(--xray); }
.is-film .logo path, .is-clear .logo path { stroke: var(--film); }
.is-clear .brand, .is-film .brand { color: #fff; }

/* the patient pathway: 5 steps, check-in done from the first tap */
.jr { list-style: none; margin: 0; padding: 0; display: flex; gap: 5px; }
.jr li { flex: 1 1 0; min-width: 0; display: grid; gap: 5px; }
.jr li i { height: 5px; border-radius: 3px; background: var(--line); display: block; transition: background .4s; }
.jr li span { font: 600 10.5px/1 var(--f-ui); color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-film .jr li i { background: rgba(127, 200, 255, .16); }
.is-film .jr li span { color: rgba(223, 243, 255, .45); }
.jr li.ok i { background: var(--mint); }
.jr li.ok span { color: var(--ink2); }
.is-film .jr li.ok span { color: rgba(223, 243, 255, .75); }
.jr li.now i { background: var(--blue); animation: jr-now 1.4s ease-in-out infinite; }
.jr li.now span { color: var(--blue); font-weight: 700; }
.is-film .jr li.now i { background: var(--xray); }
.is-film .jr li.now span { color: var(--xray); }
@media (min-width: 900px) {
  .top { grid-template-columns: auto minmax(0, 520px); justify-content: space-between; align-items: center; padding: 18px 150px 10px 32px; }
  .brand { padding-right: 0; font-size: 15px; }
}
@keyframes jr-now { 50% { opacity: .45; } }

/* ---------- buttons ---------- */
.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 0 24px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--blue); color: #fff; font: 700 18px/1.1 var(--f-ui); letter-spacing: .005em;
  box-shadow: 0 10px 24px -10px rgba(22, 104, 227, .7), inset 0 -3px 0 rgba(0, 0, 0, .16);
  transition: transform .15s, background .2s, opacity .3s, box-shadow .2s; }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn.ready:not(:disabled) { animation: btn-in .45s cubic-bezier(.3,1.5,.5,1); }
.btn:not(:disabled):active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--xray); outline-offset: 3px; }
.is-film .btn, .is-clear .btn { background: var(--xray); color: var(--film); box-shadow: 0 0 0 6px rgba(127, 200, 255, .12), 0 14px 30px -12px rgba(127, 200, 255, .8); }
.btn-big { min-height: 64px; font-size: 19px; }
.arr { width: 18px; height: 18px; flex: none; position: relative; }
.arr::before { content: ''; position: absolute; left: 1px; right: 3px; top: 8px; height: 2.5px; border-radius: 2px; background: currentColor; }
.arr::after { content: ''; position: absolute; right: 2px; top: 4px; width: 9px; height: 9px; border: solid currentColor; border-width: 2.5px 2.5px 0 0; transform: rotate(45deg); border-radius: 1px; }
.btn.ready:not(:disabled) .arr { animation: arr-nudge 1.6s ease-in-out infinite 1s; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes btn-in { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes arr-nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateX(4px); } }

/* sound */
.sound { position: fixed; z-index: 40; top: calc(10px + var(--sat)); right: var(--gut); height: 40px; min-width: 96px; padding: 0 12px 0 10px;
  display: inline-flex; align-items: center; gap: 7px; border-radius: 20px; border: 1px solid rgba(127, 200, 255, .35);
  background: rgba(5, 14, 26, .72); color: var(--glow); font: 600 13px/1 var(--f-ui); cursor: pointer; }
.sound[hidden] { display: none; }
.sound i { width: 16px; height: 14px; position: relative; flex: none;
  background: linear-gradient(currentColor, currentColor) 0 4px / 5px 6px no-repeat; }
.sound i::before { content: ''; position: absolute; left: 3px; top: 0; border: 7px solid transparent; border-right-color: currentColor; border-left-width: 0; }
.sound.off { opacity: .7; }
.sound.off i::after { content: ''; position: absolute; left: -2px; top: 6px; width: 20px; height: 2px; background: var(--coral); transform: rotate(-40deg); }
body[data-phase="intro"] .sound, body[data-phase="gate"] .sound, body[data-phase="results"] .sound { background: #fff; color: var(--ink2); border-color: var(--line); }
body[data-phase="results"] .sound { display: none; }

/* ---------- the x-ray film + the brain ---------- */
.film { position: relative; border-radius: var(--r); background:
  radial-gradient(90% 80% at 50% 45%, rgba(127, 200, 255, .16) 0%, rgba(127, 200, 255, 0) 70%),
  linear-gradient(180deg, #0a1a2e, #050e1a); color: var(--glow);
  box-shadow: inset 0 0 0 1px rgba(127, 200, 255, .16), inset 0 0 60px rgba(0, 0, 0, .6); overflow: hidden; }
.film::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.film-tag { position: absolute; left: 12px; top: 10px; font: 600 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(223, 243, 255, .55); z-index: 1; }

.brain { display: block; width: 100%; height: auto; overflow: visible; }
.brain .br-base { fill: #0c2238; }
.brain .br-cereb { fill: #0e2741; stroke: rgba(127, 200, 255, .35); stroke-width: 1; }
.brain .br-stem { fill: #0c2238; stroke: rgba(127, 200, 255, .25); stroke-width: 1; }
.brain .br-edge { fill: none; stroke: rgba(191, 228, 255, .75); stroke-width: 1.6; }
.brain .br-glow { fill: none; stroke: rgba(127, 200, 255, .7); stroke-width: 4; }
.brain .br-folds path { fill: none; stroke: rgba(223, 243, 255, .32); stroke-width: 1.4; stroke-linecap: round; }
.brain .rg-fill { opacity: 0; transition: opacity .8s; }
.brain .rg[data-s="on"] .rg-fill, .brain .rg[data-s="weak"] .rg-fill { opacity: var(--a); }
.brain .rg[data-s="scan"] .rg-fill { animation: rg-scan 1.5s ease-in-out infinite; }
@keyframes rg-scan { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.brain .bl { font: 600 11px/1 var(--f-ui); fill: rgba(223, 243, 255, .45); letter-spacing: .02em; }
.brain .bl[data-s="on"] { fill: var(--glow); }
.brain .bl[data-s="weak"] { fill: #ffb3ad; }
.brain .bl[data-s="scan"] { fill: var(--xray); }
.brain .bl-v { font: 700 14px/1 var(--f-num); }
.brain.developing .rg[data-s="on"] .rg-fill, .brain.developing .rg[data-s="weak"] .rg-fill { animation: develop 1.4s cubic-bezier(.3,.1,.3,1) .2s backwards; }
.brain.developing { animation: film-in 1.1s ease-out backwards; }
@keyframes develop { 0% { opacity: 0; } 40% { opacity: calc(var(--a) * .3); } 100% { opacity: var(--a); } }
@keyframes film-in { 0% { filter: blur(6px) brightness(.4); } 100% { filter: none; } }

.eyebrow { font: 700 12px/1.2 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.is-film .eyebrow, .is-clear .eyebrow { color: var(--xray); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--mint); }
.dot.weak { background: var(--coral); }

.oops { align-items: center; justify-content: center; padding: 24px; }
.oops-box { max-width: 420px; display: grid; gap: 14px; text-align: center; }
.oops-box h2 { font-size: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
