:root {
  --ink: #14213d;
  --paper: #fff8e8;
  --cream: #f4e8ca;
  --orange: #ff6b35;
  --yellow: #ffd23f;
  --mint: #7ae7c7;
  --blue: #4d7cff;
  --red: #ef476f;
  --line: rgba(20, 33, 61, 0.18);
  --shadow: 8px 8px 0 var(--ink);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 210, 63, 0.33), transparent 24rem),
    radial-gradient(circle at 88% 75%, rgba(122, 231, 199, 0.28), transparent 26rem),
    var(--paper);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
}

button, select, input { font: inherit; }
button { color: inherit; }

.paper-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 13px 13px 13px 4px;
  transform: rotate(-3deg);
}

.pilot-chip, .badge-chip {
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shell { width: min(1120px, calc(100% - 40px)); margin: 28px auto 72px; }
.shell.narrow { width: min(820px, calc(100% - 32px)); }

.welcome {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(36px, 8vw, 100px);
  min-height: calc(100vh - 170px);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.16em;
}

h1, h2, p { margin-top: 0; }

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.hero-copy h1 { max-width: 700px; margin-bottom: 24px; font-size: clamp(3.4rem, 7.4vw, 7.4rem); }
.hero-copy h1 em { color: var(--orange); font-weight: 400; }
.lede { max-width: 650px; color: rgba(20, 33, 61, 0.78); font-size: 1.1rem; line-height: 1.65; }

.mini-route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.mini-route span { padding: 8px 12px; border: 2px solid var(--ink); background: white; font-size: 0.78rem; font-weight: 900; transform: rotate(-1deg); }
.mini-route span:nth-of-type(even) { background: var(--yellow); transform: rotate(1deg); }

.setup-card, .question-card, .lab-card, .parent-card {
  position: relative;
  padding: clamp(24px, 5vw, 46px);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.setup-card h2 { margin-bottom: 22px; font-size: 2rem; }
.card-number { position: absolute; top: -20px; right: 28px; display: grid; width: 48px; height: 48px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); font-weight: 950; }

.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.player-option { position: relative; }
.player-option input { position: absolute; opacity: 0; }
.player-option span { display: block; min-height: 88px; padding: 15px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease; }
.player-option strong, .player-option small { display: block; }
.player-option strong { margin-bottom: 4px; }
.player-option small { color: rgba(20, 33, 61, 0.65); }
.player-option input:checked + span { background: var(--mint); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.player-option input:focus-visible + span, .world-choice input:focus-visible + span { outline: 4px solid rgba(77, 124, 255, 0.35); outline-offset: 2px; }

fieldset { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
legend, .select-label { display: block; margin-bottom: 10px; font-size: 0.78rem; font-weight: 950; letter-spacing: 0.08em; text-transform: uppercase; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.world-choice { position: relative; }
.world-choice input { position: absolute; opacity: 0; }
.world-choice span { display: block; min-height: 78px; padding: 13px; border: 2px solid var(--ink); border-radius: 12px; cursor: pointer; }
.world-choice strong, .world-choice small { display: block; }
.world-choice small { margin-top: 4px; color: rgba(20, 33, 61, 0.62); font-size: 0.7rem; }
.world-choice input:checked + span { color: white; background: var(--ink); }

select { width: 100%; margin-bottom: 18px; padding: 14px; border: 2px solid var(--ink); border-radius: 10px; background: white; font-weight: 800; }

.primary-button, .secondary-button, .text-button {
  border: 0;
  cursor: pointer;
  font-weight: 950;
}
.primary-button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 17px 20px; color: white; border: 3px solid var(--ink); border-radius: 12px; background: var(--orange); box-shadow: 4px 4px 0 var(--ink); transition: transform 140ms ease, box-shadow 140ms ease; }
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.primary-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.secondary-button { padding: 13px 18px; border: 2px solid var(--ink); border-radius: 10px; background: var(--yellow); }
.full-button { width: 100%; margin-top: 14px; }
.compact-button { width: auto; min-width: 230px; }
.text-button { padding: 8px; background: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.privacy-note { margin: 16px 0 0; color: rgba(20, 33, 61, 0.58); font-size: 0.75rem; text-align: center; }

.mission-hud, .lab-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.mission-hud { display: grid; grid-template-columns: 1fr auto auto; }
.hud-stat { min-width: 88px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 12px; background: white; text-align: center; }
.hud-stat small, .hud-stat strong { display: block; }
.hud-stat small { font-size: 0.6rem; font-weight: 900; letter-spacing: 0.12em; }

.progress-track { height: 14px; margin-bottom: 24px; overflow: hidden; border: 2px solid var(--ink); border-radius: 99px; background: white; }
.progress-track div { width: 0; height: 100%; background: repeating-linear-gradient(135deg, var(--yellow), var(--yellow) 10px, var(--orange) 10px, var(--orange) 20px); transition: width 350ms ease; }

.question-card { min-height: 540px; overflow: hidden; }
.question-card::after { content: "?"; position: absolute; right: -20px; bottom: -100px; z-index: 0; color: rgba(77, 124, 255, 0.07); font-family: Georgia, serif; font-size: 26rem; font-weight: 900; pointer-events: none; }
.gate-label { position: relative; z-index: 1; display: inline-block; padding: 7px 11px; border: 2px solid var(--ink); border-radius: 999px; background: var(--mint); font-size: 0.72rem; font-weight: 950; text-transform: uppercase; }
.question-scene { position: relative; z-index: 1; margin: 28px 0 16px; font-size: clamp(3rem, 9vw, 5rem); letter-spacing: 0.1em; }
.question-card h1 { position: relative; z-index: 1; max-width: 680px; margin-bottom: 30px; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.05; }
.answer-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-button { min-height: 64px; padding: 14px; border: 2px solid var(--ink); border-radius: 12px; background: white; cursor: pointer; font-weight: 900; text-align: left; box-shadow: 3px 3px 0 var(--ink); transition: transform 120ms ease; }
.answer-button:hover, .answer-button:focus-visible { background: var(--yellow); transform: translate(-1px, -1px); }
.answer-button.locked { color: white; background: var(--blue); }
.diagnostic-note { position: relative; z-index: 1; margin: 28px 0 0; color: rgba(20, 33, 61, 0.6); font-size: 0.75rem; }

.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin: 60px 0 34px; }
.results-heading h1 { margin-bottom: 12px; font-size: clamp(3rem, 7vw, 6rem); }
.xp-medallion { display: grid; flex: 0 0 140px; height: 140px; place-content: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 6px 6px 0 var(--ink); text-align: center; transform: rotate(3deg); }
.xp-medallion small, .xp-medallion strong, .xp-medallion span { display: block; }
.xp-medallion small { font-size: 0.55rem; font-weight: 900; }
.xp-medallion strong { font-family: Georgia, serif; font-size: 2.8rem; line-height: 1; }
.xp-medallion span { font-weight: 950; }

.power-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.power-tile { position: relative; min-height: 180px; padding: 20px; overflow: hidden; border: 3px solid var(--ink); border-radius: 18px; background: white; box-shadow: 4px 4px 0 var(--ink); }
.power-tile::after { content: attr(data-icon); position: absolute; right: -5px; bottom: -15px; font-size: 5rem; opacity: 0.16; }
.power-tile h3 { margin: 16px 0 8px; font-family: Georgia, serif; font-size: 1.35rem; }
.power-tile p { margin: 0; color: rgba(20, 33, 61, 0.68); font-size: 0.82rem; }
.status { display: inline-block; padding: 5px 8px; border: 2px solid var(--ink); border-radius: 999px; font-size: 0.62rem; font-weight: 950; text-transform: uppercase; }
.status.ready { background: var(--mint); }
.status.practising { background: var(--yellow); }
.status.bridge { color: white; background: var(--red); }

.next-mission-card { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 28px; margin-top: 32px; padding: 30px; border: 3px solid var(--ink); border-radius: var(--radius); background: var(--cream); }
.next-mission-card h2 { margin-bottom: 8px; font-size: 2rem; }
.next-mission-card p { margin-bottom: 0; }
.next-mission-card .primary-button { width: 250px; }
.result-actions { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 28px; }

.practice-setup > .text-button { margin-bottom: 28px; }
.practice-intro { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 28px; margin: 20px 0 34px; }
.practice-intro h1, .practice-summary h1 { max-width: 820px; margin-bottom: 18px; font-size: clamp(3.2rem, 8vw, 7rem); }
.practice-intro h1 em { color: var(--blue); font-weight: 400; }
.level-token { display: grid; width: 150px; height: 150px; place-content: center; border: 3px solid var(--ink); border-radius: 30% 50% 42% 48%; background: var(--mint); box-shadow: 6px 6px 0 var(--ink); text-align: center; transform: rotate(3deg); }
.level-token small, .level-token strong, .level-token span { display: block; }
.level-token small { font-size: .58rem; font-weight: 950; letter-spacing: .08em; }
.level-token strong { font-family: Georgia, serif; font-size: 3.4rem; line-height: 1; }
.level-token span { font-size: .72rem; font-weight: 900; }
.arena-setup-card { padding: clamp(24px, 5vw, 44px); border: 3px solid var(--ink); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.arena-setup-card fieldset + fieldset { margin-top: 30px; }
.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mode-choice { position: relative; }
.mode-choice.table-mode { grid-column: 1 / -1; }
.mode-choice input, .time-grid input { position: absolute; opacity: 0; }
.mode-choice span { display: grid; min-height: 138px; padding: 16px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); cursor: pointer; transition: transform 140ms ease, box-shadow 140ms ease; }
.mode-choice b { font-family: Georgia, serif; font-size: 2.4rem; line-height: 1; }
.mode-choice strong, .mode-choice small { display: block; }
.mode-choice strong { margin-top: auto; }
.mode-choice small { margin-top: 4px; color: rgba(20,33,61,.62); font-size: .72rem; }
.mode-choice input:checked + span { color: white; background: var(--blue); box-shadow: 5px 5px 0 var(--ink); transform: translate(-2px,-2px) rotate(-1deg); }
.mode-choice input:checked + span small { color: rgba(255,255,255,.8); }
.mode-choice input:focus-visible + span, .time-grid input:focus-visible + span { outline: 4px solid rgba(77,124,255,.3); outline-offset: 3px; }
.time-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.time-grid label { position: relative; }
.time-grid span { display: block; padding: 13px 8px; border: 2px solid var(--ink); border-radius: 99px; background: white; cursor: pointer; font-weight: 900; text-align: center; }
.time-grid input:checked + span { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.practice-rule { margin: 18px 0 0; color: rgba(20,33,61,.6); font-size: .78rem; text-align: center; }
.table-lab { margin: 30px 0; padding: 24px; border: 3px dashed var(--ink); border-radius: 18px; background: var(--cream); }
.table-lab-heading { display: flex; justify-content: space-between; gap: 18px; }
.table-lab-heading h2 { margin-bottom: 16px; font-size: 2rem; }
.table-lab-heading > strong { white-space: nowrap; }
.table-picker { display: grid; grid-template-columns: repeat(10, 1fr); gap: 7px; }
.table-picker button { aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 9px; background: white; cursor: pointer; font-weight: 950; }
.table-picker button:hover, .table-picker button.is-selected { color: white; background: var(--ink); }
.table-picker button.is-mastered::after { content: "★"; display: block; color: var(--yellow); font-size: .55rem; }
.table-strip { display: flex; gap: 8px; margin-top: 18px; padding: 14px; overflow-x: auto; border: 2px solid var(--ink); border-radius: 12px; background: white; scrollbar-color: var(--orange) var(--cream); }
.table-fact { flex: 0 0 auto; padding: 8px 10px; border-radius: 8px; background: var(--paper); font-weight: 900; }
.practice-hud { display: grid; grid-template-columns: 1fr repeat(3, auto); gap: 10px; align-items: center; margin: 22px 0 18px; }
.practice-card { position: relative; min-height: 520px; padding: clamp(26px, 6vw, 58px); overflow: hidden; border: 3px solid var(--ink); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.practice-card::before { content: ""; position: absolute; inset: auto -80px -120px auto; width: 300px; height: 300px; border: 55px solid rgba(122,231,199,.22); border-radius: 50%; }
.difficulty-ribbon { position: absolute; top: 22px; right: -42px; width: 180px; padding: 8px; color: white; background: var(--ink); font-size: .65rem; font-weight: 950; letter-spacing: .1em; text-align: center; transform: rotate(35deg); }
.practice-equation { position: relative; z-index: 1; margin: 58px 0 38px; font-family: Georgia, serif; font-size: clamp(4rem, 13vw, 8rem); font-weight: 900; line-height: 1; text-align: center; }
.answer-entry { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0,1fr) 180px; gap: 12px; width: min(600px,100%); margin: 0 auto; }
.answer-entry label { grid-column: 1 / -1; font-size: .72rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.answer-entry input { width: 100%; min-width: 0; padding: 14px 18px; border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); font-family: Georgia, serif; font-size: 2rem; font-weight: 900; text-align: center; }
.answer-feedback { position: relative; z-index: 1; min-height: 70px; width: min(600px,100%); margin: 20px auto 0; padding: 14px 18px; border-radius: 12px; font-weight: 850; line-height: 1.45; text-align: center; }
.answer-feedback.correct { border: 2px solid var(--ink); background: var(--mint); }
.answer-feedback.wrong { border: 2px solid var(--ink); background: var(--yellow); }
.answer-feedback .continue-button { display: block; margin: 10px auto 0; padding: 8px 16px; border: 2px solid var(--ink); border-radius: 8px; background: white; cursor: pointer; font-weight: 950; }
.arena-progress { position: relative; z-index: 1; display: flex; justify-content: space-between; width: min(600px,100%); margin: 24px auto 0; padding-top: 16px; border-top: 2px dashed var(--line); font-weight: 900; }
.practice-summary { padding-top: 52px; text-align: center; }
.practice-summary h1 { margin-inline: auto; }
.summary-scorecard { display: grid; grid-template-columns: repeat(4,1fr); margin: 38px 0 24px; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; background: white; box-shadow: var(--shadow); }
.summary-scorecard div { padding: 24px 12px; border-right: 2px solid var(--ink); }
.summary-scorecard div:last-child { border-right: 0; }
.summary-scorecard small, .summary-scorecard strong { display: block; }
.summary-scorecard small { font-size: .62rem; font-weight: 950; letter-spacing: .08em; }
.summary-scorecard strong { margin-top: 7px; font-family: Georgia, serif; font-size: 2.7rem; }
.summary-message { margin: 28px 0; padding: 20px; border: 3px solid var(--ink); border-radius: 16px; background: var(--mint); font-weight: 850; line-height: 1.5; }
.summary-home { margin-top: 20px; }

.topic-index > .text-button, .fraction-path > .text-button { margin: 10px 0 30px; }
.topic-index-heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 30px; margin-bottom: 34px; }
.topic-index-heading h1 { margin-bottom: 14px; font-size: clamp(3.5rem, 8vw, 7rem); }
.index-stamp { padding: 18px; border: 4px double var(--ink); border-radius: 50%; background: var(--yellow); font-family: Georgia, serif; font-weight: 900; line-height: 1.1; text-align: center; transform: rotate(7deg); }
.topic-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.topic-card { position: relative; display: flex; min-height: 250px; flex-direction: column; padding: 22px; overflow: hidden; border: 3px solid var(--ink); border-radius: 18px; background: white; box-shadow: 4px 4px 0 var(--ink); }
.topic-card.is-available:nth-child(3n+1) { background: var(--mint); }
.topic-card.is-available:nth-child(3n+2) { background: var(--yellow); }
.topic-card.is-available:nth-child(3n) { background: #ffe0d5; }
.topic-card.is-planned { opacity: .66; background: var(--cream); box-shadow: none; }
.topic-number { font-size: .66rem; font-weight: 950; letter-spacing: .12em; }
.topic-icon { position: absolute; top: 12px; right: 18px; font-family: Georgia, serif; font-size: 3rem; opacity: .32; }
.topic-card h2 { margin: auto 0 8px; font-size: 2rem; }
.topic-card p { min-height: 48px; margin-bottom: 18px; color: rgba(20,33,61,.72); font-size: .82rem; line-height: 1.45; }
.topic-action { align-self: flex-start; padding: 9px 12px; border: 2px solid var(--ink); border-radius: 8px; color: white; background: var(--ink); cursor: pointer; font-weight: 950; }
.topic-action.planned { color: var(--ink); background: transparent; cursor: default; }
.index-note { max-width: 680px; margin: 28px auto 0; color: rgba(20,33,61,.62); font-size: .82rem; line-height: 1.5; text-align: center; }

.fraction-hero { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: clamp(30px,7vw,90px); min-height: 480px; }
.fraction-hero h1 { margin-bottom: 20px; font-size: clamp(3.5rem,8vw,7rem); }
.fraction-hero h1 em { color: var(--orange); font-weight: 400; }
.fraction-demo { display: grid; min-height: 330px; place-content: center; padding: 30px; border: 3px solid var(--ink); border-radius: 48% 44% 50% 42%; background: var(--yellow); box-shadow: 10px 10px 0 var(--ink); text-align: center; transform: rotate(2deg); }
.fraction-demo strong, .fraction-demo span, .fraction-demo b { display: block; }
.fraction-demo strong { font-size: 1rem; }
.fraction-demo span { margin: 28px 0; font-size: clamp(3.4rem,8vw,5.6rem); }
.fraction-demo b { font-family: Georgia, serif; font-size: 2.2rem; }
.fraction-target { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; margin: 30px 0; padding: 24px; border: 3px solid var(--ink); border-radius: 16px; background: var(--mint); }
.fraction-target span { grid-row: 1 / 3; align-self: center; max-width: 130px; font-size: .66rem; font-weight: 950; letter-spacing: .12em; }
.fraction-target strong { font-family: Georgia, serif; font-size: 1.6rem; }
.fraction-target p { margin: 0; color: rgba(20,33,61,.72); }
.mastery-ladder { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin: 0; padding: 0; counter-reset: none; list-style: none; }
.mastery-ladder li { position: relative; min-height: 180px; padding: 22px; border: 3px solid var(--ink); border-radius: 16px; background: white; }
.mastery-ladder li.is-built { background: var(--yellow); box-shadow: 5px 5px 0 var(--ink); }
.mastery-ladder li.is-target { color: white; background: var(--blue); }
.mastery-ladder li > span { font-size: .64rem; font-weight: 950; letter-spacing: .13em; }
.mastery-ladder h2 { margin: 28px 0 8px; font-size: 1.8rem; }
.mastery-ladder p { margin: 0 0 16px; color: rgba(20,33,61,.66); font-size: .82rem; }
.mastery-ladder .is-target p { color: rgba(255,255,255,.78); }
.mastery-ladder li > strong { position: absolute; top: 18px; right: 18px; padding: 5px 8px; border: 2px solid currentColor; border-radius: 99px; font-size: .58rem; text-transform: uppercase; }

.lab-card h1, .parent-card h1 { margin-bottom: 18px; font-size: clamp(2.7rem, 7vw, 5rem); }
.apple-bank { display: grid; width: 100%; margin: 28px 0; padding: 20px; border: 3px dashed var(--ink); border-radius: 18px; background: var(--yellow); cursor: pointer; text-align: center; }
.apple-bank:disabled { cursor: default; opacity: 0.58; }
.apple-stack { font-size: 3.8rem; }
.apple-bank strong, .apple-bank small { display: block; }
.apple-bank small { margin-top: 4px; font-weight: 900; text-transform: uppercase; }
.plates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.plate { min-height: 126px; padding: 12px; border: 3px solid var(--ink); border-radius: 50% 50% 42% 42%; background: #fff; text-align: center; box-shadow: inset 0 0 0 7px var(--cream); }
.plate strong { display: block; margin-bottom: 8px; font-size: 0.75rem; }
.plate-pieces { min-height: 48px; font-size: 1.35rem; line-height: 1.25; }
.lab-question { margin-top: 30px; padding-top: 26px; border-top: 3px dashed var(--line); }
.answer-grid.compact { grid-template-columns: repeat(3, 1fr); }
.celebration { position: relative; margin-top: 30px; padding: 28px; overflow: hidden; border: 3px solid var(--ink); border-radius: 18px; background: var(--mint); text-align: center; }
.celebration .burst { position: absolute; top: -40px; right: -10px; color: var(--yellow); font-size: 9rem; text-shadow: 3px 3px 0 var(--ink); animation: spin-in 700ms ease both; }
.celebration h2 { margin-bottom: 12px; font-size: 2.6rem; }
.celebration .primary-button { width: min(330px, 100%); margin: 20px auto 0; }
.is-hidden { display: none !important; }

.parent-card { margin-top: 40px; }
.parent-summary { display: grid; gap: 10px; margin: 28px 0; }
.parent-row { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 14px 0; border-bottom: 2px solid var(--line); }
.parent-row strong:last-child { text-align: right; }
.parent-principle { margin: 30px 0; padding: 18px; border-left: 6px solid var(--orange); background: var(--paper); }
.parent-principle p { margin: 6px 0 0; line-height: 1.5; }

body[data-theme="comics"] { --orange: #ef476f; --yellow: #ffe66d; --mint: #6de5ff; --blue: #6c5ce7; }
body[data-theme="comics"] .question-card { background-image: radial-gradient(rgba(20,33,61,.14) 1px, transparent 1px); background-size: 9px 9px; }

@keyframes spin-in { from { opacity: 0; transform: rotate(-90deg) scale(0.2); } to { opacity: 1; transform: rotate(8deg) scale(1); } }

@media (max-width: 760px) {
  .topbar { padding: 16px 18px; }
  .pilot-chip { display: none; }
  .shell { width: min(100% - 24px, 680px); margin-top: 14px; }
  .welcome { grid-template-columns: 1fr; min-height: auto; }
  .hero-copy h1 { font-size: clamp(3.2rem, 16vw, 5.4rem); }
  .setup-card, .question-card, .lab-card, .parent-card { padding: 22px; box-shadow: 5px 5px 0 var(--ink); }
  .player-grid, .choice-row, .answer-grid, .power-map { grid-template-columns: 1fr; }
  .answer-grid.compact { grid-template-columns: repeat(3, 1fr); }
  .results-heading { align-items: center; }
  .xp-medallion { flex-basis: 100px; width: 100px; height: 100px; }
  .power-map { gap: 12px; }
  .power-tile { min-height: 135px; }
  .next-mission-card { grid-template-columns: 1fr; }
  .next-mission-card .primary-button { width: 100%; }
  .plates { grid-template-columns: 1fr 1fr; }
  .practice-intro { grid-template-columns: 1fr; align-items: start; }
  .level-token { width: 120px; height: 120px; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-choice.table-mode { grid-column: 1 / -1; }
  .time-grid { grid-template-columns: repeat(2,1fr); }
  .table-picker { grid-template-columns: repeat(5,1fr); }
  .table-lab-heading { display: block; }
  .practice-hud { grid-template-columns: repeat(3,1fr); }
  .practice-hud > .text-button { grid-column: 1 / -1; justify-self: start; }
  .practice-card { min-height: 500px; padding: 24px 18px; }
  .practice-equation { margin-top: 76px; }
  .answer-entry { grid-template-columns: 1fr; }
  .answer-entry label { grid-column: 1; }
  .summary-scorecard { grid-template-columns: 1fr 1fr; }
  .summary-scorecard div:nth-child(2) { border-right: 0; }
  .summary-scorecard div:nth-child(-n+2) { border-bottom: 2px solid var(--ink); }
  .result-actions { flex-direction: column; }
  .topic-index-heading, .fraction-hero { grid-template-columns: 1fr; }
  .topic-grid, .mastery-ladder { grid-template-columns: 1fr; }
  .index-stamp { justify-self: start; }
  .fraction-demo { min-height: 260px; }
  .fraction-target { grid-template-columns: 1fr; }
  .fraction-target span { grid-row: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
