/* punchcard: one stylesheet for every page.
   0. fonts  1. tokens  2. base  3. site chrome  4. home + course pages  5. punch card game */

/* ---------- 0. fonts ----------
   Self-hosted (no third-party requests). Variable WOFF2 files from Google Fonts, SIL OFL 1.1
   (fonts/OFL-next.txt, fonts/OFL-mono.txt). One file per subset covers every weight used. */
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 1. tokens ---------- */
:root {
  color-scheme: light;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --rule: #d8dce3;
  --rule-strong: #aeb5c1;
  --ink: #161d2b;
  --ink-soft: #46505f;
  --ink-faint: #5e6878;
  --accent: #1f4ea6;
  --accent-ink: #ffffff;
  --accent-soft: #e5ecf8;
  --gold: #e1a21b;
  --gold-ink: #7f5300;
  --good: #1d7443;
  --good-soft: #e3f2e9;
  --bad: #b1291f;
  --bad-soft: #fbe8e6;
  --stock: #f4ebd2;
  --stock-2: #ebdfbd;
  --stock-edge: #d4c290;
  --stock-print: #6f5d30;
  --hole: #1b2130;
  --shadow: 0 1px 2px rgb(22 29 43 / .06), 0 4px 14px rgb(22 29 43 / .07);
  --shadow-lift: 0 2px 4px rgb(22 29 43 / .08), 0 10px 24px rgb(22 29 43 / .10);

  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* type scale (1.2 ratio, 16px base) */
  --fs-xs: .8125rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2rem, 6vw, 2.75rem);

  /* spacing (4px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f131a;
    --surface: #171c25;
    --rule: #2a313d;
    --rule-strong: #485263;
    --ink: #e9ecf1;
    --ink-soft: #b0b8c5;
    --ink-faint: #949dab;
    --accent: #8db0f6;
    --accent-ink: #0c1424;
    --accent-soft: #1b2841;
    --gold: #f0b94c;
    --gold-ink: #f0b94c;
    --good: #6fcf98;
    --good-soft: #15291f;
    --bad: #ff8b7d;
    --bad-soft: #33191a;
    --stock: #29251a;
    --stock-2: #332d1e;
    --stock-edge: #4d4329;
    --stock-print: #c6b585;
    --hole: #05070a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 14px rgb(0 0 0 / .25);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / .35), 0 10px 24px rgb(0 0 0 / .35);
  }
}

/* ---------- 2. base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: 1.55;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 3px; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.skip {
  position: absolute; left: var(--s4); top: -100px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
}
.skip:focus { top: var(--s3); }

/* shared progress meter */
.meter { display: block; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.meter > span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; }

/* shared buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm);
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.linkbtn {
  border: 0; background: none; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px;
  font-size: var(--fs-sm); padding: 10px 4px; min-height: 44px;
}
.linkbtn:not(:disabled):hover { color: var(--ink); }
.linkbtn:disabled { opacity: .55; }

/* ---------- 3. site chrome ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.site-header-in {
  max-width: 960px; margin: 0 auto; padding: var(--s3) var(--s4);
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; min-height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
  font-family: var(--mono); font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.02em;
}
.brand:hover { color: var(--accent); }
.brand-tag {
  font-family: var(--sans); font-weight: 400; font-size: var(--fs-sm); letter-spacing: 0;
  color: var(--ink-soft); margin-left: 2px;
}
.brand-mark { width: 30px; height: 18px; flex: none; }
.brand-mark rect { fill: var(--ink); }
.brand-mark rect.open { fill: none; stroke: var(--rule-strong); stroke-width: 1.5; stroke-dasharray: 2 2; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); font-size: var(--fs-sm); color: var(--ink-soft); }
.crumbs li + li::before { content: "/"; margin-right: var(--s2); color: var(--rule-strong); }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; }

.page { max-width: 960px; margin: 0 auto; padding: var(--s7) var(--s4) var(--s8); }
.page-head { margin-bottom: var(--s6); }
.page-head h1 { font-size: var(--fs-3xl); letter-spacing: -.025em; margin: 0 0 var(--s3); }
.page-head h1 .sub { display: block; font-size: var(--fs-xl); font-weight: 500; letter-spacing: -.01em; color: var(--ink-soft); margin-top: var(--s2); }
.lede { margin: 0; max-width: 58ch; font-size: var(--fs-lg); color: var(--ink-soft); }
.section-title { font-size: var(--fs-lg); margin: 0 0 var(--s4); }
.site-foot { max-width: 960px; margin: 0 auto; padding: 0 var(--s4) var(--s6); font-size: var(--fs-xs); color: var(--ink-faint); }
.notice { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); max-width: 60ch; }
.notice h1 { font-size: var(--fs-xl); margin: 0 0 var(--s2); }
.notice p { margin: 0 0 var(--s4); color: var(--ink-soft); }

/* ---------- 4. home + course pages ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); grid-template-columns: 1fr; }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile {
  position: relative; height: 100%;
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s5); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
  transition: transform .2s var(--ease-out);
}
a.tile:hover, .era:hover, .special:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
a.tile:focus-visible { outline-offset: 3px; border-radius: var(--radius); }
h3.tile-code { margin: 0; }
.tile-code { font-family: var(--mono); font-weight: 700; font-size: var(--fs-2xl); letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-name { font-weight: 700; font-size: var(--fs-lg); line-height: 1.3; margin: 0; }
.tile-text { font-size: var(--fs-sm); color: var(--ink-soft); margin: 0; }
.tile-foot { margin-top: auto; padding-top: var(--s3); display: grid; gap: var(--s2); }
.tile-stat { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tile-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent); }
a.tile:hover .tile-go .icon { transform: translateX(3px); }
.tile-go .icon { transition: transform .2s var(--ease-out); }
.tag {
  align-self: flex-start; font-size: var(--fs-xs); font-weight: 700; line-height: 1;
  padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.tile-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s3); }

/* coming soon: muted, not interactive */
.tile.is-soon { background: transparent; border-style: dashed; border-color: var(--rule-strong); color: var(--ink-faint); cursor: not-allowed; }
.tile.is-soon .tile-text { color: var(--ink-faint); }
.tile.is-soon .tag { background: var(--rule); color: var(--ink-soft); }

a.tile .tile-top { flex-wrap: nowrap; }
.tile-top > .icon { width: 22px; height: 22px; color: var(--accent); margin-top: 4px; transition: transform .2s var(--ease-out); }
a.tile:hover .tile-top > .icon { transform: translateX(3px); }

/* featured study mode */
.tiles > .wide { grid-column: 1 / -1; }
.tile.is-featured { border: 2px solid var(--accent); padding: var(--s6); box-shadow: var(--shadow); }
.tile.is-featured .tile-name { font-size: var(--fs-2xl); letter-spacing: -.02em; }
.tile.is-featured .tile-text { font-size: var(--fs-md); max-width: 60ch; }
.tile.is-featured .tile-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s5); }
.tile.is-featured .tile-go { background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: var(--radius-sm); min-height: 44px; }
.tile-mark { width: 44px; height: 26px; }
@media (max-width: 560px) {
  .page { padding: var(--s6) var(--s4) var(--s7); }
  .tile.is-featured { padding: var(--s5); }
  .tile.is-featured .tile-foot { grid-template-columns: 1fr; }
  .tile.is-featured .tile-go { justify-content: center; }
}

/* ---------- 5. punch card game ---------- */
.game { max-width: 960px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); }

/* the punch card: cream stock, clipped corner */
.card {
  position: relative; background: var(--stock); color: var(--ink);
  border: 1px solid var(--stock-edge); border-radius: var(--radius-sm);
  clip-path: polygon(24px 0, 100% 0, 100% 100%, 0 100%, 0 24px);
  padding: var(--s4) var(--s5) var(--s5);
}
.cardhead {
  display: flex; justify-content: space-between; gap: var(--s3);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--stock-print);
  padding-left: var(--s4); margin-bottom: var(--s3); font-variant-numeric: tabular-nums;
}

.top h1 { font-size: var(--fs-3xl); letter-spacing: -.025em; margin: 0 0 var(--s3); }
.top p { margin: 0 0 var(--s5); max-width: 60ch; color: var(--ink-soft); font-size: var(--fs-lg); }

.holes { display: grid; grid-template-columns: repeat(auto-fill, minmax(11px, 1fr)); gap: 7px 5px; padding: var(--s1) var(--s1) var(--s3); }
.holes i { display: block; height: 17px; border-radius: 3px; border: 1.5px dashed color-mix(in srgb, var(--stock-print) 55%, transparent); }
.holes i.p { background: var(--hole); border: 1.5px solid var(--hole); }
.cardfoot {
  display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap;
  font-family: var(--mono); font-size: var(--fs-sm); color: var(--stock-print);
  border-top: 1px dashed var(--stock-edge); padding-top: var(--s3); font-variant-numeric: tabular-nums;
}
.card .meter { background: var(--stock-2); margin: 0 0 var(--s3); }
.card .meter > span { background: var(--hole); }

.controls { display: flex; gap: var(--s3); align-items: stretch; flex-wrap: wrap; margin: var(--s5) 0 var(--s2); }
.seg { display: flex; flex: 1; min-width: 260px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 6px; padding: 8px 10px; min-height: 44px;
  font-weight: 700; display: flex; flex-direction: column; align-items: center; line-height: 1.25;
}
.seg button small { font-weight: 400; font-size: var(--fs-xs); color: var(--ink-soft); }
.seg button:not([aria-pressed="true"]):hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button[aria-pressed="true"] small { color: inherit; }
.snd { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 16px; min-height: 44px; font-size: var(--fs-sm); font-weight: 700; display: inline-flex; align-items: center; gap: var(--s2); }
.snd:hover { border-color: var(--rule-strong); }
.note { font-size: var(--fs-sm); color: var(--ink-soft); margin: var(--s2) 0 0; }
.sec { font-size: var(--fs-lg); margin: var(--s7) 0 var(--s4); }

.eras { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); }
.era {
  display: flex; gap: var(--s4); align-items: stretch; text-align: left;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s4); transition: transform .2s var(--ease-out);
}
.yr { font-family: var(--mono); font-weight: 700; font-size: var(--fs-xl); color: var(--accent); min-width: 4ch; display: flex; align-items: center; font-variant-numeric: tabular-nums; }
.eb { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.et { font-weight: 700; font-size: var(--fs-md); }
.es { font-size: var(--fs-sm); color: var(--ink-soft); }
.em { display: flex; gap: var(--s3); align-items: center; font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.em .meter { flex: 1; height: 4px; }

.stars { display: inline-flex; gap: 4px; }
.star { --s: 12px; width: var(--s); height: var(--s); border-radius: 50%; border: 1.5px dashed var(--rule-strong); display: inline-block; }
.star.on { background: var(--gold); border: 1.5px solid var(--gold); }
.bigstars .star { --s: 44px; }

.specials { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); }
.special {
  text-align: left; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius);
  padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s1);
  transition: transform .2s var(--ease-out);
}
.special.boss { border: 2px solid var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.special.boss:hover { border-color: var(--gold); }
.sp-t { font-weight: 700; font-size: var(--fs-xl); display: flex; align-items: center; gap: var(--s2); }
.special.boss .sp-t .icon { color: var(--gold-ink); }
.sp-s { font-size: var(--fs-sm); color: var(--ink-soft); }
.sp-m { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); margin-top: var(--s1); font-variant-numeric: tabular-nums; }
.special.boss .sp-m { color: var(--gold-ink); font-weight: 700; }
.reset { text-align: center; margin-top: var(--s7); }

/* play */
.hud { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.back {
  border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-sm);
  padding: 6px 12px 6px 8px; min-height: 44px; font-size: var(--fs-sm); font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
}
.back:hover { border-color: var(--rule-strong); }
.hud-t { flex: 1; margin: 0; font-size: var(--fs-md); font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-y { font-family: var(--mono); color: var(--accent); margin-right: var(--s2); }
.hud-n { display: flex; align-items: center; gap: var(--s3); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sc { font-weight: 700; font-size: var(--fs-lg); }
.mult { font-size: var(--fs-sm); color: var(--ink-soft); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0 8px; }
.mult.hot { background: var(--gold); border-color: var(--gold); color: #241800; }
.lives { display: inline-flex; gap: 4px; }
.lives i { width: 12px; height: 16px; border-radius: 2px; border: 1.5px dashed var(--bad); }
.lives i.on { background: var(--bad); border-style: solid; }

.runbar { display: flex; align-items: center; gap: var(--s3); margin: 0 0 var(--s4); }
.strip { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.strip i { width: 10px; height: 14px; border-radius: 2px; border: 1.5px dashed var(--rule-strong); }
.strip i.p { background: var(--hole); border: 1.5px solid var(--hole); }
.strip i.p2 { background: var(--good); border: 1.5px solid var(--good); }
.strip i.x { background: var(--bad); border: 1.5px solid var(--bad); }
.strip i.now { outline: 2px solid var(--accent); outline-offset: 1px; }
.runcount { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

.qcard { min-height: 170px; }
.qtext { font-size: clamp(1.2rem, 3.6vw, 1.5rem); line-height: 1.4; margin: var(--s1) 0 var(--s2); padding-left: var(--s4); padding-right: 40px; max-width: 42ch; font-weight: 500; }
.punchspot { position: absolute; right: var(--s5); top: 40px; width: 22px; height: 30px; border-radius: 4px; transform: scale(0); }
.punchspot.go { background: var(--hole); animation: punch .28s var(--ease-out) forwards; }
@keyframes punch { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.timer { height: 6px; background: var(--stock-2); border-radius: 3px; margin: var(--s3) 0 0 var(--s4); overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; transition: transform .1s linear; }
.timer span.low { background: var(--bad); }

.ans { display: flex; gap: var(--s2); margin: var(--s4) 0 var(--s1); }
.ans input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--mono); font-size: var(--fs-lg);
  padding: 12px 14px; border-radius: var(--radius-sm); border: 2px solid var(--rule-strong);
  background: var(--surface); color: var(--ink); caret-color: var(--accent);
}
.ans input::placeholder { color: var(--ink-faint); }
.ans input:focus-visible { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.ans input:disabled { opacity: .7; }
.go, .next { border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm); padding: 10px 20px; min-height: 48px; font-weight: 700; }
.go:not(:disabled):hover, .next:hover { filter: brightness(1.08); }
.go:disabled { opacity: .55; }
.next.alt { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.next.alt:hover { filter: none; border-color: var(--ink-soft); }
.aux { display: flex; gap: var(--s4); flex-wrap: wrap; }
.hintline { font-family: var(--mono); font-size: var(--fs-lg); letter-spacing: .06em; margin: var(--s1) 0; color: var(--accent); white-space: pre-wrap; min-height: 1em; overflow-wrap: anywhere; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin: var(--s4) 0; }
.opt {
  text-align: left; border: 2px solid var(--rule); background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 52px; display: flex; gap: var(--s3); align-items: baseline;
}
.opt .k { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-soft); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 0 5px; }
.opt:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.opt:disabled { color: var(--ink); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrongpick { border-color: var(--bad); background: var(--bad-soft); }

/* feedback panel */
.fb { margin-top: var(--s4); border-radius: var(--radius); padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.fb.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.fb.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); }
.fb.model { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.fb-top { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.verdict { font-weight: 700; font-size: var(--fs-lg); display: inline-flex; align-items: center; gap: var(--s2); }
.verdict .icon { width: 1.1em; height: 1.1em; stroke-width: 2.5; }
.fb.ok .verdict { color: var(--good); } .fb.no .verdict { color: var(--bad); } .fb.model .verdict { color: var(--accent); }
.fb.ok { animation: settle .35s var(--ease-out); }
@keyframes settle { from { transform: translateY(4px); } to { transform: none; } }
.plus { font-family: var(--mono); color: var(--good); font-weight: 700; }
.streak { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 700; background: var(--gold); color: #241800; border-radius: 999px; padding: 2px 10px; }
.term { font-size: var(--fs-xl); font-weight: 700; margin: var(--s2) 0 2px; }
.expl { margin: var(--s1) 0 var(--s2); max-width: 62ch; }
.you { font-family: var(--mono); font-size: var(--fs-sm); color: var(--ink-soft); margin: var(--s1) 0; overflow-wrap: anywhere; }
.again { font-size: var(--fs-sm); color: var(--ink-soft); margin: var(--s1) 0; }
.fb-act { display: flex; justify-content: flex-end; align-items: center; gap: var(--s4); margin-top: var(--s3); flex-wrap: wrap; }

.jot { display: block; width: 100%; margin-top: var(--s4); font: inherit; padding: 12px 14px; border-radius: var(--radius-sm); border: 2px solid var(--rule-strong); background: var(--surface); color: var(--ink); resize: vertical; }
.jot::placeholder { color: var(--ink-faint); }
.jot:focus-visible { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.gradeq { margin: var(--s4) 0 var(--s2); font-weight: 700; }
.grade { display: flex; gap: var(--s2); flex-wrap: wrap; }
.grade button { flex: 1; min-width: 110px; min-height: 48px; border: 2px solid var(--rule-strong); background: var(--surface); border-radius: var(--radius-sm); padding: 10px; font-weight: 700; }
.grade button[data-g="100"] { border-color: var(--good); } .grade button[data-g="0"] { border-color: var(--bad); }
.grade button:hover { background: var(--accent-soft); }

/* results */
.end { text-align: center; padding-bottom: var(--s6); }
.end .endtitle { font-size: clamp(1.6rem, 6vw, 2.25rem); margin: var(--s3) 0 var(--s1); letter-spacing: -.02em; }
.endsub { color: var(--ink-soft); margin: 0 0 var(--s4); }
.bigstars { margin-top: var(--s2); }
.bigstars .stars { gap: 14px; }
.bigstars .star.on { animation: pop .45s var(--ease-out) backwards; }
.bigstars .star.on:nth-child(2) { animation-delay: .12s; }
.bigstars .star.on:nth-child(3) { animation-delay: .24s; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.endnums { display: flex; justify-content: center; gap: var(--s6); flex-wrap: wrap; }
.endnums b { display: block; font-family: var(--mono); font-size: var(--fs-2xl); font-variant-numeric: tabular-nums; }
.endnums span { font-size: var(--fs-sm); color: var(--stock-print); }
.newbest { font-weight: 700; color: var(--gold-ink); }
.card .newbest { color: var(--stock-print); }
.missedbox { margin: var(--s5) 0; }
.missedbox h3 { margin: 0 0 var(--s3); font-size: var(--fs-lg); }
.missed { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.missed li { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: 2px; }
.missed li span { font-size: var(--fs-sm); color: var(--ink-soft); }
.missed li .mq { font-style: italic; }
.perfect { text-align: center; color: var(--ink-soft); }
.endact { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: center; }

/* level-up confetti: punched-out chads, few and brief */
.chads { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.chads i { position: absolute; top: -20px; width: 8px; height: 11px; border-radius: 2px; background: var(--hole); animation: fall linear forwards; }
.chads i:nth-child(3n) { background: var(--gold); }
.chads i:nth-child(4n) { background: var(--accent); }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }

/* term explainer */
.deep { display: grid; gap: var(--s3); margin: var(--s3) 0 var(--s1); padding-top: var(--s3); border-top: 1px dashed var(--rule-strong); }
.dp p { margin: 2px 0 0; max-width: 64ch; font-size: var(--fs-md); }
.dl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-soft); text-transform: none; }
.dl::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--ink-faint); }
.dp.spot .dl { color: var(--accent); } .dp.spot .dl::before { background: var(--accent); }
.dp.mix .dl { color: var(--gold-ink); } .dp.mix .dl::before { background: var(--gold); }
.deep.compact { margin-top: var(--s2); gap: var(--s2); }
.deep.compact p { font-size: var(--fs-sm); color: var(--ink); }

@media (max-width: 560px) {
  .game { padding: var(--s5) var(--s3) var(--s7); }
  .card { padding: var(--s3) var(--s3) var(--s4); clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%, 0 18px); }
  .qtext { padding-left: var(--s2); }
  .cardhead { padding-left: var(--s4); }
  .hud-n .mult { display: none; }
  .opts { grid-template-columns: 1fr; }
  .eras, .specials { grid-template-columns: 1fr; }
  .ans { flex-wrap: wrap; }
  .ans input { flex-basis: 100%; }
  .ans .go { flex: 1; }
  .fb { padding: var(--s4); }
  .fb-act .next { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .punchspot.go { transform: scale(1); }
  .tile:hover, .era:hover, .special:hover { transform: none; }
}
