:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0e1524;
  --panel-2: #121b2d;
  --panel-3: #182238;
  --text: #f3f6fb;
  --muted: #98a6ba;
  --line: #24314a;
  --accent: #50d7c6;
  --accent-2: #77a6ff;
  --good: #62d89c;
  --bad: #ff7f88;
  --warn: #f0c76a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; background-image: radial-gradient(circle at 15% -10%, rgba(80,215,198,.10), transparent 34%), radial-gradient(circle at 90% 0%, rgba(119,166,255,.08), transparent 30%); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(80,215,198,.45); outline-offset: 2px; }
.app-shell { width: min(1240px, calc(100% - 36px)); margin: 0 auto; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.07); gap: 24px; }
.brand { border: 0; background: transparent; display: flex; gap: 11px; align-items: center; cursor: pointer; text-align: left; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #07101a; font-weight: 900; font-size: 20px; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand small { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; margin-top: 2px; }
.navlinks { display: flex; gap: 6px; flex-wrap: wrap; }
.navbtn { border: 0; background: transparent; color: var(--muted); padding: 10px 13px; border-radius: 10px; cursor: pointer; }
.navbtn:hover, .navbtn.active { color: var(--text); background: rgba(255,255,255,.06); }
.main { padding: 48px 0 80px; }
.hero { display: grid; grid-template-columns: 1.5fr .8fr; gap: 44px; align-items: end; padding: 34px 0 44px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(36px, 5.8vw, 66px); line-height: .99; letter-spacing: -.055em; max-width: 900px; margin-bottom: 20px; }
h2 { letter-spacing: -.025em; }
.hero-copy, .page-intro p { max-width: 790px; color: var(--muted); font-size: 18px; line-height: 1.65; margin-bottom: 0; }
.hero-stat-panel { background: linear-gradient(180deg, rgba(18,27,45,.92), rgba(14,21,36,.92)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-stat-panel > div { display: flex; align-items: baseline; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); gap: 12px; }
.hero-stat-panel > div:last-child { border: 0; }
.hero-stat-panel strong { font-size: 23px; }
.hero-stat-panel span { color: var(--muted); font-size: 13px; }
.controls-panel { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.search { min-width: 240px; flex: 0 1 300px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; }
.chip.active, .chip:hover { color: var(--text); border-color: rgba(80,215,198,.6); background: rgba(80,215,198,.08); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 42px 0 18px; }
.section-head h2 { margin: 0; font-size: 28px; }
.muted { color: var(--muted); }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.game-card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(18,27,45,.84), rgba(12,18,31,.94)); border-radius: var(--radius); padding: 20px; min-height: 270px; display: flex; flex-direction: column; transition: transform .15s ease, border-color .15s ease; }
.game-card:hover { transform: translateY(-2px); border-color: #344660; }
.game-card-top { display: flex; justify-content: space-between; align-items: center; }
.game-icon { width: 45px; height: 45px; border-radius: 12px; display: inline-grid; place-items: center; background: rgba(80,215,198,.09); border: 1px solid rgba(80,215,198,.22); color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: -.03em; }
.game-card h3 { font-size: 21px; margin: 18px 0 8px; }
.game-card p { color: var(--muted); line-height: 1.5; font-size: 14px; flex: 1; }
.pill { display: inline-flex; border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.03); border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.skill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.skill-row span { border-radius: 7px; background: rgba(119,166,255,.08); color: #b8ccff; padding: 5px 7px; font-size: 10px; }
.skill-row.large span { padding: 8px 10px; font-size: 12px; }
.primary, .secondary { border-radius: 11px; min-height: 42px; padding: 10px 15px; font-weight: 800; cursor: pointer; border: 1px solid transparent; }
.primary { background: var(--accent); color: #071312; }
.primary:hover { filter: brightness(1.05); }
.secondary { background: transparent; border-color: var(--line); color: var(--text); }
.secondary:hover { background: rgba(255,255,255,.05); }
.primary.full { width: 100%; }
.primary.large, .secondary.large { min-height: 50px; padding: 12px 20px; }
.secondary.small { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.recent { margin-top: 62px; }
.recent-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.session-row { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: rgba(14,21,36,.72); }
.session-row:last-child { border: 0; }
.session-row div { display: flex; flex-direction: column; gap: 3px; }
.session-row span { color: var(--muted); font-size: 12px; }
.session-row div:last-child { text-align: right; }
.page-intro { padding: 34px 0 28px; }
.page-intro.narrow { max-width: 840px; }
.page-intro h1 { font-size: clamp(38px, 5vw, 58px); }
.mock-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mock-card, .mock-review, .results-card, .review-card, .callout { background: rgba(14,21,36,.82); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.mock-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.mock-card h2 { margin: 20px 0 10px; font-size: 25px; }
.mock-card > p { color: var(--muted); line-height: 1.55; }
.mock-card ol { list-style: none; padding: 0; margin: 22px 0; border-top: 1px solid var(--line); }
.mock-card li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.mock-card li small { color: var(--muted); }
.back, .skip { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; }
.back:hover, .skip:hover { color: var(--text); }
.mock-review { max-width: 860px; }
.mock-review h2 { margin-bottom: 16px; }
.mock-section-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mock-section-row .num { width: 28px; height: 28px; border-radius: 8px; background: var(--panel-3); display: grid; place-items: center; color: var(--accent); font-weight: 900; }
.mock-section-row div { display: flex; flex-direction: column; gap: 4px; }
.mock-section-row small { color: var(--muted); }
.callout { margin: 22px 0; border-color: rgba(80,215,198,.25); background: rgba(80,215,198,.05); }
.callout strong { color: var(--accent); }
.callout p { color: var(--muted); line-height: 1.55; margin: 8px 0 0; }
.callout.wide { margin-top: 38px; max-width: 900px; }
.progress-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.progress-summary > div { padding: 22px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: rgba(14,21,36,.72); }
.progress-summary > div:last-child { border: 0; }
.progress-summary strong { font-size: 30px; }
.progress-summary span { color: var(--muted); font-size: 12px; }
.progress-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.progress-card { display: grid; grid-template-columns: 46px 1fr 66px auto; align-items: center; gap: 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 15px; padding: 14px; }
.progress-card h3 { margin: 0 0 3px; font-size: 16px; }
.progress-card p { color: var(--muted); margin: 0; font-size: 12px; }
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--panel-3) 0); position: relative; }
.ring::after { content: ''; position: absolute; inset: 5px; background: var(--panel); border-radius: 50%; }
.ring span { z-index: 1; font-size: 11px; font-weight: 900; }
.empty { padding: 70px 0; text-align: center; }
.empty p { color: var(--muted); }
.danger-zone { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.text-danger { background: transparent; border: 0; color: var(--bad); cursor: pointer; }
.steps { max-width: 920px; display: grid; gap: 12px; }
.steps article { display: grid; grid-template-columns: 64px 1fr; gap: 18px; border-bottom: 1px solid var(--line); padding: 22px 0; }
.steps article > span { color: var(--accent); font-weight: 900; font-size: 14px; }
.steps h2 { margin-bottom: 8px; }
.steps p { color: var(--muted); line-height: 1.6; margin-bottom: 0; }

.game-shell { min-height: 100vh; background: var(--bg); }
.game-header { min-height: 70px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 max(18px, calc((100vw - 1180px)/2)); gap: 16px; }
.game-header > div { justify-self: center; display: flex; align-items: center; gap: 10px; }
.game-header > :last-child { justify-self: end; }
.live-header .live-stats { display: flex; gap: 18px; align-items: center; justify-self: end; color: var(--muted); }
.live-header .live-stats strong { color: var(--text); font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.tutorial-wrap, .results-wrap { width: min(1080px, calc(100% - 36px)); margin: 0 auto; padding: 54px 0 80px; }
.tutorial-hero { display: grid; grid-template-columns: 72px 1fr; gap: 22px; align-items: start; margin-bottom: 34px; }
.tutorial-hero .game-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 16px; }
.tutorial-hero h1 { font-size: clamp(38px, 6vw, 64px); margin-bottom: 10px; }
.tutorial-hero p:last-child { color: var(--muted); font-size: 18px; }
.tutorial-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tutorial-grid article { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 24px; }
.tutorial-grid article.wide { grid-column: 1 / -1; }
.tutorial-grid h2 { margin: 16px 0 10px; }
.tutorial-grid p, .tutorial-grid li { color: var(--muted); line-height: 1.6; }
.tutorial-grid ul { margin: 0; padding-left: 20px; }
.step-badge { width: 27px; height: 27px; border-radius: 8px; background: rgba(80,215,198,.1); color: var(--accent); display: grid; place-items: center; font-weight: 900; font-size: 12px; }
.start-panel { margin-top: 16px; border: 1px solid rgba(80,215,198,.25); background: linear-gradient(135deg, rgba(80,215,198,.08), rgba(119,166,255,.05)); border-radius: var(--radius); padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 22px; }
.start-panel h2 { margin-bottom: 6px; }
.start-panel p { color: var(--muted); margin: 0; }
.start-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.play-area { width: min(980px, calc(100% - 36px)); margin: 0 auto; padding: 56px 0 90px; }
.game-stage { min-height: 530px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(18,27,45,.92), rgba(10,16,28,.96)); border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: clamp(24px, 5vw, 54px); box-shadow: var(--shadow); }
.question-label { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; text-align: center; margin-bottom: 24px; }
.math-question, .sequence-question { font-variant-numeric: tabular-nums; font-size: clamp(42px, 8vw, 82px); font-weight: 800; letter-spacing: -.045em; text-align: center; margin-bottom: 32px; }
.sequence-question { font-size: clamp(34px, 6vw, 62px); }
.word-question { max-width: 760px; text-align: center; font-size: clamp(24px, 4vw, 38px); font-weight: 650; line-height: 1.35; margin-bottom: 30px; letter-spacing: -.02em; }
.word-question.compact { font-size: 22px; margin-top: 24px; }
.answer-hint { color: var(--muted); margin: -14px 0 20px; }
.answer-form { display: flex; gap: 10px; width: min(520px, 100%); }
.answer-form input { flex: 1; min-width: 0; background: #080d18; color: var(--text); border: 1px solid #33425e; border-radius: 12px; padding: 14px 16px; font-size: 21px; text-align: center; }
.answer-form.wide-input { width: min(680px, 100%); }
.skip { margin-top: 12px; }
.feedback { height: 44px; display: grid; place-items: center; opacity: 0; margin-top: 14px; font-weight: 800; transition: opacity .12s ease; }
.feedback.show { opacity: 1; }
.feedback.ok { color: var(--good); }
.feedback.bad { color: var(--bad); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(170px, 1fr)); gap: 12px; width: min(680px, 100%); }
.choice { min-height: 62px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-3); font-size: 18px; font-weight: 800; cursor: pointer; }
.choice:hover { border-color: var(--accent); background: rgba(80,215,198,.08); }
.code-reference { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(34px, 6vw, 60px); letter-spacing: .12em; margin-bottom: 30px; }
.data-table { border-collapse: collapse; width: min(620px, 100%); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 14px 16px; text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-size: 12px; background: var(--panel-3); }
.shape-svg { width: 88px; height: 88px; fill: var(--text); }
.visual-sequence { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; margin-bottom: 28px; }
.visual-sequence .shape-svg { width: 72px; height: 72px; }
.seq-arrow { color: var(--muted); }
.missing-cell { width: 72px; height: 72px; border: 1px dashed #435472; border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 24px; }
.visual-options { display: grid; grid-template-columns: repeat(4, 1fr); width: min(620px, 100%); gap: 12px; }
.visual-choice { border: 1px solid var(--line); background: var(--panel-3); border-radius: 14px; min-height: 110px; display: grid; place-items: center; cursor: pointer; }
.visual-choice:hover { border-color: var(--accent); }
.visual-choice small { color: var(--muted); margin-top: -10px; }
.visual-options.large .visual-choice { min-height: 130px; }
.matrix-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 7px; margin-bottom: 26px; }
.matrix-grid > div { width: 96px; height: 96px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); }
.matrix-grid .shape-svg { width: 70px; height: 70px; }
.matrix-q { color: var(--muted); font-size: 26px; }
.memory-digits { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(48px, 9vw, 92px); letter-spacing: .14em; font-weight: 800; text-align: center; }
.centre { text-align: center; }
.memory-entry input { letter-spacing: .18em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.memory-grid { --grid: 4; display: grid; grid-template-columns: repeat(var(--grid), minmax(44px, 72px)); gap: 7px; margin: 4px auto 24px; }
.grid-cell { aspect-ratio: 1; border-radius: 10px; border: 1px solid #34435e; background: #111a2c; cursor: pointer; font-weight: 900; }
.grid-cell.target { background: var(--accent-2); border-color: var(--accent-2); }
.grid-cell.decoy { background: var(--bad); border-color: var(--bad); }
.grid-cell.selected { background: rgba(80,215,198,.2); border-color: var(--accent); color: var(--accent); }
.grid-actions { width: min(420px, 100%); display: flex; justify-content: space-between; align-items: center; gap: 14px; color: var(--muted); }
.grid-status { color: var(--muted); }
.nback-letter { width: 190px; height: 190px; border-radius: 28px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--line); font-size: 90px; font-weight: 900; transition: .1s ease; }
.nback-letter.hit, .go-symbol.hit { border-color: var(--good); box-shadow: inset 0 0 0 3px rgba(98,216,156,.18); }
.nback-letter.miss, .go-symbol.miss { border-color: var(--bad); }
.go-symbol { width: 210px; height: 210px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 28px; background: var(--panel-3); }
.go-symbol .shape-svg { width: 140px; height: 140px; }
.switch-cue { color: var(--accent); font-weight: 900; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 18px; }
.switch-stim { width: 260px; height: 210px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 24px; margin-bottom: 22px; }
.switch-stim .shape-svg { width: 150px; height: 150px; }
.dual-stim { display: flex; align-items: center; gap: 44px; font-size: 74px; font-weight: 900; }
.indicator-track { position: relative; width: min(760px, 100%); height: 24px; border-radius: 999px; background: #172238; border: 1px solid #2d3c57; margin: 42px 0; }
.indicator-target { position: absolute; top: -10px; bottom: -10px; background: rgba(98,216,156,.25); border: 1px solid var(--good); border-radius: 9px; }
.indicator-marker { position: absolute; top: -17px; width: 5px; height: 56px; border-radius: 999px; background: var(--text); transform: translateX(-50%); }
.grill-lanes { width: min(720px, 100%); display: grid; gap: 16px; }
.grill-lane { display: grid; grid-template-columns: 80px 1fr; gap: 14px; align-items: center; min-height: 62px; border: 1px solid var(--line); background: var(--panel-3); border-radius: 14px; padding: 12px 14px; cursor: pointer; text-align: left; }
.grill-lane.done { border-color: var(--good); }
.grill-lane.expired { opacity: .45; }
.grill-track { position: relative; height: 15px; background: #0b1120; border-radius: 99px; overflow: hidden; }
.grill-track b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-2); }
.ready-zone { position: absolute; left: 72%; width: 18%; top: 0; bottom: 0; background: rgba(98,216,156,.35); z-index: 2; }
.mastermind-history { width: min(520px, 100%); min-height: 180px; margin-bottom: 20px; }
.mastermind-history > div { display: grid; grid-template-columns: 1fr 1fr; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mastermind-history > div span { color: var(--muted); text-align: right; }
.perm-row { display: flex; gap: 22px; align-items: center; font-size: clamp(28px, 6vw, 52px); font-family: ui-monospace, monospace; margin-bottom: 24px; }
.perm-row > div { border: 1px solid var(--line); background: var(--panel-3); padding: 16px 20px; border-radius: 14px; }
.rule-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 18px; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.numberbox-target { font-size: 76px; font-weight: 900; color: var(--accent); margin-bottom: 18px; }
.numberbox-numbers { display: flex; gap: 12px; margin-bottom: 30px; }
.numberbox-numbers span { width: 64px; height: 64px; border: 1px solid var(--line); background: var(--panel-3); border-radius: 14px; display: grid; place-items: center; font-size: 28px; font-weight: 900; }
.tower-board { display: grid; grid-template-columns: repeat(3, 1fr); width: min(760px, 100%); gap: 10px; margin-bottom: 22px; }
.peg { position: relative; min-height: 300px; border: 1px solid var(--line); background: rgba(255,255,255,.02); border-radius: 16px; cursor: pointer; overflow: hidden; }
.peg.selected { border-color: var(--accent); background: rgba(80,215,198,.05); }
.peg .pole { position: absolute; width: 6px; height: 190px; left: calc(50% - 3px); bottom: 46px; background: #41506a; }
.peg .discs { position: absolute; left: 8%; right: 8%; bottom: 48px; display: flex; flex-direction: column; align-items: center; }
.peg .discs i { width: var(--w); height: 28px; border-radius: 9px; background: linear-gradient(90deg, var(--accent-2), #9ab9ff); border: 1px solid rgba(255,255,255,.25); }
.peg small { position: absolute; bottom: 15px; left: 0; right: 0; color: var(--muted); }
.sliding-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 8px; }
.tile { width: 96px; height: 96px; border: 1px solid #3a4a68; border-radius: 14px; background: var(--panel-3); color: var(--text); font-size: 30px; font-weight: 900; cursor: pointer; }
.tile.blank { background: transparent; border-style: dashed; }
.rotation-reference { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; }
.rotation-reference .shape-svg { width: 130px; height: 130px; }
.rotation-reference span { color: var(--muted); font-size: 12px; }
.balloon-wrap { min-height: 220px; display: grid; place-items: center; }
.balloon { width: var(--size); height: var(--size); border-radius: 50% 50% 45% 45%; background: linear-gradient(145deg, #77a6ff, #6f77ff); position: relative; box-shadow: inset -18px -18px 32px rgba(0,0,0,.18); transition: width .15s ease, height .15s ease; }
.balloon::after { content: ''; position: absolute; width: 14px; height: 16px; background: #6f77ff; bottom: -9px; left: calc(50% - 7px); transform: rotate(45deg); }
.balloon-stats { display: flex; gap: 36px; margin: 22px 0; }
.balloon-stats div { display: flex; flex-direction: column; align-items: center; }
.balloon-stats span { color: var(--muted); font-size: 11px; }
.balloon-stats strong { font-size: 24px; }
.balloon-actions { display: flex; gap: 10px; }
.results-wrap { max-width: 920px; }
.results-hero { text-align: center; padding: 28px 0 34px; }
.results-hero h1 { margin-left: auto; margin-right: auto; font-size: clamp(38px, 6vw, 60px); }
.results-hero p:last-child { color: var(--muted); }
.big-score { font-size: clamp(74px, 14vw, 126px); line-height: .9; font-weight: 900; letter-spacing: -.07em; color: var(--accent); }
.big-score span { font-size: .3em; margin-left: 5px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.metrics-grid article { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 18px; }
.metrics-grid span { color: var(--muted); font-size: 11px; display: block; margin-bottom: 6px; }
.metrics-grid strong { font-size: 23px; }
.review-card p { color: var(--muted); line-height: 1.6; margin: 0; }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.metric-row { display: grid; grid-template-columns: 1fr 70px 80px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.metric-row small { color: var(--muted); text-align: right; }
.mock-transition { max-width: 760px; margin: 80px auto; padding: 50px 0; text-align: center; }
.mock-transition h1 { margin-left: auto; margin-right: auto; }
.mock-transition p { color: var(--muted); font-size: 18px; margin-bottom: 24px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mock-grid, .progress-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .game-header { grid-template-columns: auto 1fr auto; padding: 0 14px; }
  .game-header > div { justify-self: start; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 22px, 1240px); }
  .topbar { align-items: flex-start; padding: 14px 0; flex-direction: column; }
  .navlinks { width: 100%; }
  .navbtn { flex: 1; padding-left: 6px; padding-right: 6px; font-size: 12px; }
  .main { padding-top: 26px; }
  .hero { padding-top: 12px; gap: 24px; }
  h1 { font-size: 40px; }
  .game-grid { grid-template-columns: 1fr; }
  .controls-panel { align-items: stretch; }
  .search { flex-basis: 100%; min-width: 0; width: 100%; }
  .tutorial-grid { grid-template-columns: 1fr; }
  .tutorial-grid article.wide { grid-column: auto; }
  .start-panel { flex-direction: column; align-items: stretch; }
  .game-header .muted { display: none; }
  .game-header { min-height: 62px; }
  .live-header > div:nth-child(2) strong { display: none; }
  .play-area { width: min(100% - 22px, 980px); padding-top: 28px; }
  .game-stage { min-height: 470px; padding: 22px 14px; border-radius: 18px; }
  .answer-form { flex-direction: column; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .visual-options { grid-template-columns: repeat(2, 1fr); }
  .matrix-grid { grid-template-columns: repeat(3, minmax(70px, 88px)); }
  .matrix-grid > div { width: auto; height: 82px; }
  .progress-summary { grid-template-columns: 1fr; }
  .progress-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .progress-card { grid-template-columns: 46px 1fr auto; }
  .progress-card .ring { display: none; }
  .tower-board { gap: 5px; }
  .peg { min-height: 220px; }
  .peg .pole { height: 130px; }
  .sliding-grid { grid-template-columns: repeat(3, 78px); }
  .tile { width: 78px; height: 78px; }
  .balloon-stats { gap: 18px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .mock-section-row { grid-template-columns: 32px 1fr; }
  .mock-section-row > span:last-child { grid-column: 2; color: var(--muted); font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.digit-options { display: grid; grid-template-columns: repeat(4, 72px); gap: 12px; }
.digit-tile { width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-3); color: var(--text); font-size: 28px; font-weight: 900; cursor: pointer; }
.digit-tile:hover { border-color: var(--accent); background: rgba(80,215,198,.08); }
.logic-box { width: min(720px, 100%); border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); padding: 22px; margin-bottom: 24px; }
.logic-box p { margin: 0 0 10px; color: var(--muted); line-height: 1.55; }
.logic-box hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.logic-box strong { display: block; font-size: 21px; line-height: 1.45; }
.logic-choices { grid-template-columns: repeat(3, 1fr); }
.tracking-arena { position: relative; width: min(760px, 100%); height: 390px; border: 1px solid var(--line); border-radius: 18px; background: radial-gradient(circle at 50% 50%, rgba(119,166,255,.06), transparent 65%), #0a1020; overflow: hidden; margin-bottom: 18px; }
.track-dot { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #d8e1ef; background: #d8e1ef; transform: translate(-50%, -50%); padding: 0; cursor: pointer; }
.track-dot.target { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 7px rgba(80,215,198,.12); }
.track-dot.selected { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 0 6px rgba(119,166,255,.13); }
.node-field { position: relative; width: min(720px, 100%); min-height: 360px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-content: center; }
.node { min-height: 74px; border-radius: 50%; aspect-ratio: 1; max-width: 74px; justify-self: center; border: 1px solid #405271; background: var(--panel-3); color: var(--text); font-weight: 900; font-size: 18px; cursor: pointer; }
.node:hover { border-color: var(--accent); }
.node.selected, .node:disabled { background: rgba(80,215,198,.18); border-color: var(--accent); color: var(--accent); cursor: default; }
@media (max-width: 640px) {
  .digit-options { grid-template-columns: repeat(4, 58px); }
  .digit-tile { width: 58px; height: 58px; }
  .logic-choices { grid-template-columns: 1fr; }
  .tracking-arena { height: 330px; }
  .node-field { grid-template-columns: repeat(4, 1fr); gap: 8px; min-height: 300px; }
  .node { max-width: 60px; min-height: 60px; }
}

/* planning-state comparison */
.tower-pair { width: min(760px, 100%); display: grid; gap: 18px; }
.tower-pair .tower-board { width: 100%; margin-bottom: 0; }
.goal-peg { cursor: default; opacity: .82; }
.goal-peg:hover { border-color: var(--line); }

/* v1.0 production polish */
.primary:disabled, .secondary:disabled, #track-submit:disabled {
  opacity: .48;
  cursor: not-allowed;
  filter: none;
}
.input-help { margin-top: 12px; margin-bottom: 0; }
.progress-tools {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(14,21,36,.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.progress-tools > div:first-child { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.progress-tools > div:first-child span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.progress-tools > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .progress-tools { align-items: stretch; flex-direction: column; }
  .progress-tools > div:last-child { justify-content: stretch; }
  .progress-tools > div:last-child .secondary { flex: 1; }
}

/* v1.1 mixed-difficulty tutorials + phone/PWA polish */
html { -webkit-text-size-adjust: 100%; }
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}
button { touch-action: manipulation; }
.tutorial-note {
  margin-top: 12px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: var(--muted) !important;
}
.tutorial-grid ol { margin: 0; padding-left: 23px; }
.tutorial-grid ol li { padding-left: 5px; margin: 0 0 10px; color: var(--text); line-height: 1.58; }
.tutorial-grid ol li:last-child { margin-bottom: 0; }
.algorithm-card { border-color: rgba(80,215,198,.28) !important; background: linear-gradient(135deg, rgba(80,215,198,.055), rgba(119,166,255,.035)) !important; }
.install-grid { max-width: 920px; margin-top: 38px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.install-grid .callout { margin: 0; }
.touch-controls { width: min(520px, 100%); display: none; justify-content: center; gap: 12px; margin-top: 18px; }
.touch-controls.split .touch-action { flex: 1; }
.touch-controls.single .touch-action { min-width: 170px; }
.touch-action { min-height: 50px; padding: 12px 22px; font-size: 16px; }

@media (hover: none), (pointer: coarse) {
  .touch-controls { display: flex; }
  .game-card:hover { transform: none; }
  .primary:hover { filter: none; }
  .secondary:hover, .choice:hover, .visual-choice:hover, .chip:hover, .navbtn:hover { background: inherit; }
}

@media (max-width: 640px) {
  body { padding-top: env(safe-area-inset-top); }
  .touch-controls { display: flex; }
  .app-shell { width: min(100% - 18px, 1240px); }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .hero-copy, .page-intro p { font-size: 16px; line-height: 1.58; }
  .game-card { min-height: 242px; padding: 18px; }
  .primary, .secondary, .navbtn, .chip, .back, .skip { min-height: 44px; }
  .chip { min-width: 44px; }
  .tutorial-wrap { width: min(100% - 18px, 1020px); }
  .tutorial-hero { gap: 14px; }
  .tutorial-hero .game-icon { flex: 0 0 auto; }
  .tutorial-grid article { padding: 19px; }
  .install-grid { grid-template-columns: 1fr; gap: 10px; }
  .start-buttons .primary, .start-buttons .secondary { width: 100%; }
  .play-area { width: min(100% - 14px, 980px); padding-top: 20px; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .game-stage { min-height: 430px; padding: 24px 12px; border-radius: 17px; }
  .math-question { font-size: clamp(38px, 13vw, 62px); overflow-wrap: anywhere; }
  .sequence-question { font-size: clamp(28px, 9vw, 48px); line-height: 1.2; overflow-wrap: anywhere; }
  .word-question { font-size: clamp(22px, 7vw, 31px); }
  .answer-form input { font-size: 20px; min-height: 52px; }
  .answer-form .primary { min-height: 50px; }
  .memory-grid { width: min(100%, 340px); grid-template-columns: repeat(var(--grid), minmax(0, 1fr)); gap: 6px; }
  .grid-cell { min-width: 0; min-height: 44px; border-radius: 8px; }
  .grid-actions { flex-wrap: wrap; justify-content: center; }
  .nback-letter { width: 160px; height: 160px; font-size: 76px; }
  .go-symbol { width: 178px; height: 178px; }
  .go-symbol .shape-svg { width: 118px; height: 118px; }
  .switch-stim { width: min(240px, 100%); height: 180px; }
  .switch-stim .shape-svg { width: 125px; height: 125px; }
  .dual-stim { gap: 26px; font-size: 58px; }
  .touch-controls { width: min(100%, 420px); margin-top: 16px; }
  .touch-controls .touch-action { min-height: 56px; font-size: 17px; }
  .indicator-track { height: 30px; margin: 34px 0; }
  .indicator-marker { top: -15px; height: 58px; width: 6px; }
  .tracking-arena { height: 300px; }
  .track-dot { width: 34px; height: 34px; }
  .grill-lane { grid-template-columns: 66px 1fr; min-height: 66px; }
  .perm-row { gap: 10px; width: 100%; justify-content: center; }
  .perm-row > div { padding: 12px 13px; }
  .rule-legend { grid-template-columns: 1fr; width: min(100%, 420px); }
  .numberbox-target { font-size: 64px; }
  .numberbox-numbers { gap: 8px; flex-wrap: wrap; justify-content: center; }
  .numberbox-numbers span { width: 58px; height: 58px; }
  .tower-pair { gap: 12px; }
  .peg { min-height: 205px; }
  .peg .pole { height: 118px; bottom: 40px; }
  .peg .discs { bottom: 42px; }
  .peg .discs i { height: 24px; }
}

@media (max-width: 380px) {
  .navbtn { font-size: 11px; }
  .brand small { display: none; }
  .matrix-grid { grid-template-columns: repeat(3, minmax(62px, 1fr)); width: min(100%, 270px); }
  .matrix-grid > div { height: auto; aspect-ratio: 1; }
  .choice-grid { grid-template-columns: 1fr; }
  .visual-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .digit-options { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .digit-tile { width: 100%; height: auto; aspect-ratio: 1; min-height: 54px; }
}
