/* 1600 Study Hall · theme.css
   Direction: "Lobby", a game-lobby look for the iPad generation. Dark slate surfaces,
   condensed uppercase headings, chunky press-down buttons, XP-style progress bars,
   a quest path, and an original pixel font for numbers and badges. Load after base.css.
   Fonts live in ./fonts: Lobby Display (renamed subset of Anton) and Lobby Sans
   (renamed subset of DM Sans), both SIL OFL 1.1; Lobby Pixel is original to this
   course. Study Sans stays as the fallback for math symbols. See fonts/FONT-LICENSES.txt. */

@font-face { font-family: "Lobby Display"; src: url("fonts/lobby-display.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lobby Sans"; src: url("fonts/lobby-sans.woff") format("woff"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Lobby Sans"; src: url("fonts/lobby-sans-italic.woff") format("woff"); font-weight: 100 1000; font-style: italic; font-display: swap; }
@font-face { font-family: "Lobby Pixel"; src: url("fonts/lobby-pixel.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Study Sans"; src: url("fonts/study-sans.woff") format("woff"); font-weight: 200 900; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --paper: #0d1520;
  --surface: #172334;
  --surface-2: #1e2d42;
  --surface-3: #283a54;
  --well: #0a111a;
  --line: #2c3f58;
  --line-strong: #4f6886;
  --ink: #eef3f8;
  --ink-2: #c5d0dc;
  --ink-3: #93a4b8;
  /* play green: the main action on every screen */
  --go: #3ddc72;
  --go-hi: #7dff9f;
  --go-lip: #1f9a4a;
  --on-go: #06230f;
  /* cyan: links, selection, the thing you're pointing at */
  --accent: #5cc8ff;
  --accent-press: #93dcff;
  --accent-soft: #15324a;
  --accent-line: #2f6c96;
  --on-accent: #04192a;
  /* gold: rewards, finished steps, scores */
  --gold: #ffc93c;
  --gold-lip: #c48a0c;
  --on-gold: #2a1d00;
  /* red: test mode and the heading tick */
  --red: #ff4b5c;
  /* meaning: always paired with a word and an icon */
  --good: #49e38a;
  --good-soft: #10301f;
  --good-line: #23744a;
  --bad: #ff7a85;
  --bad-soft: #3a141a;
  --bad-line: #8a2d38;
  --warn: #ffc93c;
  --warn-soft: #33270a;
  --warn-line: #7d6118;
  --focus: #ffd75e;
  /* type */
  --font-ui: "Lobby Sans", "Study Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Lobby Display", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-pixel: "Lobby Pixel", ui-monospace, Menlo, Consolas, monospace;
  --fs-13: .8125rem;
  --fs-15: .9375rem;
  --fs-17: 1.0625rem;
  --fs-19: 1.1875rem;
  --fs-22: 1.375rem;
  --fs-28: 1.75rem;
  --fs-display: clamp(2.5rem, 1.7rem + 2.8vw, 3.75rem);
  /* space: 4px grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r1: 10px; --r2: 14px; --r3: 22px; --pill: 999px;
  --lip: 5px;
  --shadow-float: 0 14px 34px rgb(0 0 0 / .45), 0 3px 10px rgb(0 0 0 / .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 120ms;
  --t: 200ms;
  --measure: 68ch;
  --page: 1160px;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 450 var(--fs-17)/1.6 var(--font-ui);
  font-optical-sizing: auto;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 88% -8%, rgb(92 200 255 / .10), transparent 62%),
    radial-gradient(760px 480px at -6% 4%, rgb(169 130 255 / .08), transparent 60%),
    linear-gradient(rgb(255 255 255 / .018) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgb(255 255 255 / .018) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--paper);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: rgb(92 200 255 / .45); }
a:hover { color: var(--accent-press); text-decoration-color: currentColor; }
::selection { background: rgb(92 200 255 / .35); color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
strong, b { font-weight: 750; }

h1, h2, h3 { color: var(--ink); text-wrap: balance; }
h1, h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .012em; line-height: 1.02; }
h1 { font-size: var(--fs-display); max-width: 22ch; margin: 0 0 var(--s5); }
h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 6px;
  margin-top: 14px;
  background: var(--red);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
h2 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem); margin: 0 0 var(--s3); }
h3 { font: 800 var(--fs-19)/1.3 var(--font-ui); letter-spacing: -0.01em; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s4); max-width: var(--measure); text-wrap: pretty; }
.lede { font-size: var(--fs-19); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.meta { font-size: var(--fs-15); color: var(--ink-3); }
.eyebrow {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 6px 16px 5px 12px;
  margin: 0 0 var(--s4);
  font: 400 15px/1 var(--font-pixel);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgb(92 200 255 / .12);
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--s1); }
li::marker { color: var(--ink-3); }
hr { border: 0; border-top: 2px solid var(--line); margin: var(--s6) 0; }

/* ---------- Header ---------- */
.shell {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
  flex-wrap: wrap;
  min-height: 68px;
  padding: var(--s2) max(var(--s5), calc((100% - var(--page)) / 2));
  background: rgb(13 21 32 / .94);
  border-bottom: 2px solid var(--line);
  box-shadow: 0 6px 18px rgb(0 0 0 / .25);
}
/* The logo: a green "1600" key set into a dark socket in the header, beside the stacked STUDY HALL
   wordmark. The key has a lit top face and a darker front face; pressing it sinks it into the socket. */
.brand {
  --key-w: 78px;
  --key-h: 40px;
  position: relative;
  isolation: isolate;
  display: inline-grid;
  grid-template-columns: auto min-content;
  align-items: center;
  column-gap: 14px;
  min-height: 52px;
  padding-left: 6px;
  font: 400 1.32rem/.9 var(--font-display);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink);
  text-decoration: none;
  white-space: normal;
}
.brand::before {
  content: "1600";
  display: grid;
  place-items: center;
  width: var(--key-w);
  height: var(--key-h);
  box-sizing: border-box;
  padding-bottom: 4px;
  border-radius: 9px;
  font: 400 25px/1 var(--font-display);
  letter-spacing: 0;
  color: var(--on-go);
  text-shadow: 0 1px 0 rgb(255 255 255 / .35);
  background: linear-gradient(180deg, #8dffad 0%, #4be37f 32%, #34cc68 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .75), inset 0 -4px 0 var(--go-lip), inset 0 -5px 0 rgb(0 0 0 / .18), 0 0 0 1px #0a3a1b, 0 3px 4px rgb(0 0 0 / .6);
  transition: filter var(--t-fast) var(--ease);
}
.brand::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  top: 50%;
  width: calc(var(--key-w) + 12px);
  height: calc(var(--key-h) + 12px);
  transform: translateY(-50%);
  border-radius: 14px;
  background: linear-gradient(180deg, #010306 0%, #070c13 100%);
  box-shadow: inset 0 3px 5px rgb(0 0 0 / .9), inset 0 -1px 0 rgb(255 255 255 / .08), 0 1px 0 rgb(255 255 255 / .11), 0 -1px 0 rgb(0 0 0 / .55);
}
.brand:hover { color: var(--ink); }
.brand:hover::before { filter: brightness(1.07); }
.brand:active::before { height: calc(var(--key-h) - 3px); padding-bottom: 1px; transform: translateY(1.5px); box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), inset 0 -1px 0 var(--go-lip), inset 0 -2px 0 rgb(0 0 0 / .18), 0 0 0 1px #0a3a1b, 0 1px 1px rgb(0 0 0 / .7); }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1); }
nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font: 800 13.5px/1 var(--font-ui);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  border: 0;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
nav a:hover { background: var(--surface-2); color: var(--ink); }
nav [aria-current] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); border: 0; }

/* ---------- Page ---------- */
main { flex: 1 0 auto; width: min(var(--page), calc(100% - 2 * var(--s5))); margin: var(--s7) auto var(--s8); min-height: 60vh; }
main:focus { outline: none; }
.readable { max-width: 800px; }
.group { margin-top: var(--s7); }
.stack { display: grid; gap: var(--s4); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--s4); align-items: stretch; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin-bottom: var(--s4);
  font: 800 var(--fs-13)/1 var(--font-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-3);
}
.crumb:hover { color: var(--accent); }

/* ---------- Study plan hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
  align-items: stretch;
  gap: var(--s6);
  padding: clamp(24px, 4vw, 44px);
  background:
    repeating-linear-gradient(135deg, rgb(255 255 255 / .022) 0 14px, transparent 14px 28px),
    linear-gradient(140deg, #1d2f48, #142133 62%);
  border: 2px solid var(--line);
  border-radius: var(--r3);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 8px 0 rgb(0 0 0 / .25), var(--shadow-float);
  overflow: hidden;
}
.hero h1 { max-width: 16ch; }
.hero .lede { margin-bottom: var(--s5); }
.hero .button { min-height: 58px; padding: 14px 30px; font-size: 1.125rem; }
.hero .button::after { content: ""; width: 0; height: 0; margin-left: 4px; border-left: 11px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.overview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s5);
  background: rgb(5 10 16 / .45);
  border: 2px solid var(--line);
  border-radius: var(--r2);
  box-shadow: inset 0 2px 0 rgb(0 0 0 / .3);
}
.overview strong {
  display: block;
  font: 400 clamp(2.5rem, 2rem + 2vw, 3.5rem)/1 var(--font-pixel);
  color: var(--gold);
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgb(0 0 0 / .35);
}
.overview strong small { font: 400 20px/1 var(--font-pixel) !important; color: var(--ink-3); letter-spacing: 0; }
.overview p { margin: 0; color: var(--ink-2); font-weight: 650; }

/* ---------- Progress: an XP bar ---------- */
progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 18px;
  border: 2px solid #050a10;
  border-radius: 8px;
  background: var(--well);
  color: var(--go);
  overflow: hidden;
  box-shadow: 0 2px 0 rgb(255 255 255 / .05);
}
progress::-webkit-progress-bar { background: var(--well); border-radius: 6px; box-shadow: inset 0 3px 0 rgb(0 0 0 / .45); }
progress::-webkit-progress-value {
  background:
    repeating-linear-gradient(90deg, transparent 0 16px, rgb(0 0 0 / .2) 16px 18px),
    linear-gradient(180deg, var(--go-hi), var(--go) 45%, var(--go-lip));
  border-radius: 5px;
  transition: width var(--t) var(--ease);
}
progress::-moz-progress-bar {
  background:
    repeating-linear-gradient(90deg, transparent 0 16px, rgb(0 0 0 / .2) 16px 18px),
    linear-gradient(180deg, var(--go-hi), var(--go) 45%, var(--go-lip));
  border-radius: 5px;
}

/* ---------- Cards and panels ---------- */
.card, .panel {
  min-width: 0;
  padding: clamp(20px, 2.6vw, 28px);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 70%);
  border: 2px solid var(--line);
  border-radius: var(--r2);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 6px 0 rgb(0 0 0 / .28);
}
.card { display: flex; flex-direction: column; align-items: flex-start; transition: transform var(--t) var(--bounce), border-color var(--t-fast) var(--ease); }
.card:hover { transform: translateY(-3px); border-color: var(--accent-line); }
.card > :last-child { margin-top: auto; }
.card h2, .panel h2 { font: 800 var(--fs-22)/1.2 var(--font-ui); text-transform: none; letter-spacing: -0.01em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); text-decoration: underline; }
.card p, .panel p { color: var(--ink-2); }

/* ---------- Buttons and tabs: chunky, with a lip that presses down ---------- */
.actions, .tabs { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin: var(--s5) 0 0; }
.button, button {
  font: 850 var(--fs-17)/1.1 var(--font-ui);
  letter-spacing: .05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 52px;
  padding: 12px 24px;
  border-radius: 12px;
  border: 0;
  background: var(--go);
  color: var(--on-go);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .35), 0 var(--lip) 0 var(--go-lip), 0 calc(var(--lip) + 6px) 14px rgb(0 0 0 / .35);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.button:hover, button:hover { background: var(--go); color: var(--on-go); filter: brightness(1.08); text-decoration: none; }
.button:active, button:active { transform: translateY(var(--lip)); box-shadow: inset 0 2px 0 rgb(255 255 255 / .25), 0 0 0 var(--go-lip), 0 2px 6px rgb(0 0 0 / .3); }
.secondary, .button.secondary, button.secondary {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .09), 0 var(--lip) 0 #0a121c, 0 calc(var(--lip) + 6px) 14px rgb(0 0 0 / .3);
}
.secondary:hover, .button.secondary:hover, button.secondary:hover { background: #33496a; color: var(--ink); filter: none; }
.secondary:active, .button.secondary:active, button.secondary:active { box-shadow: inset 0 2px 0 rgb(255 255 255 / .06), 0 0 0 #0a121c, 0 2px 6px rgb(0 0 0 / .3); }
button:disabled, .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.4); }
.tabs { gap: var(--s2); }
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s4);
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font: 800 13.5px/1 var(--font-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 3px 0 rgb(0 0 0 / .3);
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tabs a:hover { border-color: var(--accent-line); color: var(--ink); }
.tabs a:active { transform: translateY(3px); box-shadow: none; }
.tabs [aria-current] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-line); }

/* ---------- Questions ---------- */
.prompt {
  font: 450 var(--fs-19)/1.65 var(--font-ui);
  color: var(--ink);
  max-width: 70ch;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-variant-numeric: lining-nums;
}
.prose { white-space: pre-line; overflow-wrap: anywhere; }
figure { margin: var(--s5) 0; }
.diagram {
  display: block;
  max-width: 100%;
  max-height: 440px;
  height: auto;
  padding: var(--s3);
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--r1);
}
fieldset { min-width: 0; margin: var(--s5) 0; padding: 0; border: 0; counter-reset: choice; }
legend { padding: 0; margin-bottom: var(--s3); font: 800 var(--fs-13)/1.3 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.choice {
  counter-increment: choice;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  min-height: 60px;
  margin: var(--s3) 0;
  padding: 13px var(--s4);
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: var(--r2);
  cursor: pointer;
  line-height: 1.5;
  box-shadow: 0 4px 0 rgb(0 0 0 / .3);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.choice::before {
  content: counter(choice, upper-alpha);
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding-top: 3px;
  box-sizing: border-box;
  margin-top: -3px;
  border: 0;
  border-radius: 9px;
  font: 400 20px/1 var(--font-pixel);
  color: var(--ink);
  background: var(--surface-3);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / .35), inset 0 2px 0 rgb(255 255 255 / .08);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice > span { position: relative; padding-top: 2px; }
.choice:hover { border-color: var(--accent-line); background: #22354f; }
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 rgb(0 0 0 / .3); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 4px 0 var(--accent-line), 0 0 0 4px rgb(92 200 255 / .14); }
.choice:has(input:checked)::before { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 -4px 0 var(--accent-line); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
input[type=radio], input[type=checkbox] { accent-color: var(--go); }

.field { display: block; margin: var(--s4) 0; font-weight: 750; color: var(--ink-2); }
.field input, .field select, .field textarea { display: block; margin-top: var(--s2); font-weight: 450; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  font: 500 var(--fs-19)/1.4 var(--font-ui);
  width: min(100%, 32rem);
  min-height: 52px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--well);
  border: 2px solid var(--line-strong);
  border-radius: var(--r1);
  box-shadow: inset 0 3px 0 rgb(0 0 0 / .35);
  font-variant-numeric: tabular-nums;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
textarea { min-height: 96px; line-height: 1.5; }
input:not([type=radio]):not([type=checkbox]):hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:not([type=radio]):not([type=checkbox]):focus, select:focus, textarea:focus {
  outline: 2px solid transparent;   /* invisible normally, drawn in Windows high-contrast mode */
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow: inset 0 3px 0 rgb(0 0 0 / .35), 0 0 0 4px rgb(92 200 255 / .22);
}
::placeholder { color: var(--ink-3); opacity: 1; }

/* Pretest: test mode gets the red tag and a focused column */
main:has(form[data-type="diagnostic"]) .readable { max-width: 820px; margin-inline: auto; }
main:has(form[data-type="diagnostic"]) h1 { font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.5rem); margin-bottom: var(--s4); }
main:has(form[data-type="diagnostic"]) .eyebrow { color: var(--red); background: rgb(255 75 92 / .14); }
main:has(form[data-type="diagnostic"]) .panel { padding: clamp(20px, 3.4vw, 36px); border-radius: var(--r3); border-top: 4px solid var(--red); }
main:has(form[data-type="diagnostic"]) .panel + .meta { margin-top: var(--s3); max-width: none; }

/* ---------- Feedback and callouts ---------- */
.feedback, .callout {
  position: relative;
  margin: var(--s4) 0;
  padding: var(--s4) var(--s5) var(--s4) 64px;
  background: var(--good-soft);
  border: 2px solid var(--good-line);
  border-radius: var(--r2);
  color: var(--ink);
  box-shadow: 0 5px 0 rgb(0 0 0 / .28);
}
.feedback::before, .callout::before {
  content: "\2713" / "";
  position: absolute;
  left: var(--s4);
  top: var(--s4);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding-top: 3px;
  box-sizing: border-box;
  border-radius: 9px;
  font: 400 20px/1 var(--font-pixel);
  background: var(--good);
  color: #052010;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / .3);
}
.feedback > strong:first-child, .callout > strong:first-child { display: block; font: 400 20px/1.3 var(--font-pixel); color: var(--good); margin-bottom: var(--s2); }
.feedback p:last-child, .callout p:last-child { margin-bottom: 0; }
.callout { background: var(--accent-soft); border-color: var(--accent-line); }
.callout::before { content: "i" / ""; background: var(--accent); color: var(--on-accent); }
.callout > strong:first-child { color: var(--accent); }
.review, .feedback.review, .callout.review { background: var(--warn-soft); border-color: var(--warn-line); }
.review::before, .feedback.review::before, .callout.review::before { content: "!" / ""; background: var(--warn); color: var(--on-gold); }
.review > strong:first-child { color: var(--warn); }
.feedback { animation: feedback-in var(--t) var(--bounce) both; }
@keyframes feedback-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Lists, rows, disclosure ---------- */
.rows { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.rows li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s5);
  margin: 0;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 3px 0 rgb(0 0 0 / .25);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.rows li:last-child { border-bottom: 2px solid var(--line); }
.rows li:hover { background: var(--surface-2); border-color: var(--accent-line); }
.rows a { font-weight: 750; color: var(--ink); text-decoration: none; }
.rows a:hover { color: var(--accent); text-decoration: underline; }
.rows small {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px 3px;
  border-radius: 8px;
  background: var(--well);
  border: 2px solid var(--line);
  color: var(--gold);
  font: 400 15px/1 var(--font-pixel);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.rows li span small { background: transparent; border: 0; padding: 0; min-height: 0; color: var(--ink-3); font: 500 var(--fs-15)/1.4 var(--font-ui); text-transform: none; letter-spacing: 0; }
details { margin: var(--s3) 0; }
details.panel { padding-block: var(--s3); }
summary {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin: 0 6px 0 2px;
  border-right: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform var(--t-fast) var(--ease);
}
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { color: var(--accent); }

/* ---------- Media ---------- */
video {
  display: block;
  width: 100%;
  max-height: 68vh;
  background: #05090e;
  border: 2px solid var(--line);
  border-radius: var(--r2);
  box-shadow: 0 6px 0 rgb(0 0 0 / .3);
}
.lesson-player + .lesson-player { margin-top: var(--s5); }
.chapter-jump:not([hidden]) {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  margin-top: var(--s3);
}
.chapter-jump label { flex: 1 1 16rem; min-width: 0; max-width: 32rem; }
.chapter-jump select { display: block; width: 100%; margin-top: var(--s1); }

/* ---------- Study path: a quest map (ol.path > li[data-state]) ---------- */
.path { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 0; }
.path li { counter-increment: step; position: relative; margin: 0; padding: 4px 0 var(--s5) 74px; min-height: 68px; }
.path li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center;
  width: 54px; height: 54px;
  padding-top: 4px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 0;
  background: var(--surface-3);
  font: 400 20px/1 var(--font-pixel);
  color: var(--ink-3);
  box-shadow: inset 0 -5px 0 rgb(0 0 0 / .35), 0 0 0 4px var(--surface);
}
.path li::after { content: ""; position: absolute; left: 25px; top: 60px; bottom: 6px; width: 5px; border-radius: 3px; background: repeating-linear-gradient(180deg, var(--line) 0 8px, transparent 8px 14px); }
.path li:last-child::after { display: none; }
.path li[data-state="done"]::before { content: "\2713" / ""; background: var(--gold); color: var(--on-gold); box-shadow: inset 0 -5px 0 var(--gold-lip), 0 0 0 4px var(--surface); }
.path li[data-state="done"]::after { background: var(--gold); }
.path li[data-state="current"]::before { background: var(--go); color: var(--on-go); box-shadow: inset 0 -5px 0 var(--go-lip), 0 0 0 4px var(--surface), 0 0 0 9px rgb(61 220 114 / .22); animation: quest-pulse 1.8s ease-in-out infinite; }
@keyframes quest-pulse { 50% { box-shadow: inset 0 -5px 0 var(--go-lip), 0 0 0 4px var(--surface), 0 0 0 14px rgb(61 220 114 / .06); } }
.path li strong { display: block; font-size: var(--fs-19); font-weight: 800; }
.path li small { color: var(--ink-3); font-size: var(--fs-15); }

/* ---------- Notices and footer ---------- */
#notice:not(:empty) {
  position: sticky;
  top: 68px;
  z-index: 15;
  padding: var(--s3) max(var(--s5), calc((100% - var(--page)) / 2));
  background: #2a2008;
  border-bottom: 2px solid var(--gold);
  color: var(--ink);
  font-weight: 700;
}
#notice:not(:empty)::before { content: "!"; display: inline-grid; place-items: center; width: 24px; height: 24px; padding-top: 2px; box-sizing: border-box; margin-right: 10px; border-radius: 6px; vertical-align: -5px; font: 400 20px/1 var(--font-pixel); color: var(--on-gold); background: var(--gold); }
footer {
  padding: var(--s6) var(--s5);
  border-top: 2px solid var(--line);
  background: rgb(8 13 20 / .7);
  color: var(--ink-3);
  font-size: var(--fs-15);
  text-align: center;
}
.skip { position: absolute; left: -10000px; }
.skip:focus { left: var(--s2); top: var(--s2); z-index: 50; padding: var(--s2) var(--s3); background: var(--surface); color: var(--accent); border-radius: var(--r1); box-shadow: var(--shadow-float); }

/* ---------- Voice (used by voice.js) ---------- */
button.voice-toggle {
  min-height: 44px;
  padding: 0 var(--s3) 0 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: 800 13px/1 var(--font-ui);
  letter-spacing: .06em;
  gap: 8px;
  box-shadow: 0 3px 0 rgb(0 0 0 / .3);
}
button.voice-toggle:hover { background: var(--surface-2); color: var(--ink); filter: none; }
button.voice-toggle:active { transform: translateY(3px); box-shadow: none; }
button.voice-toggle[aria-pressed="true"] { color: var(--go); border-color: var(--go-lip); background: var(--good-soft); }
.voice-bars { display: inline-flex; align-items: flex-end; gap: 2px; width: 14px; height: 14px; }
.voice-bars i { display: block; width: 3px; height: 40%; border-radius: 1px; background: currentColor; }
.voice-bars i:nth-child(2) { height: 75%; }
.voice-bars i:nth-child(3) { height: 55%; }
.voice-toggle[aria-pressed="false"] .voice-bars i { height: 20%; opacity: .6; }
.is-speaking .voice-bars i { animation: voice-bar .9s var(--ease) infinite alternate; }
.is-speaking .voice-bars i:nth-child(2) { animation-delay: .15s; }
.is-speaking .voice-bars i:nth-child(3) { animation-delay: .3s; }
@keyframes voice-bar { from { height: 25%; } to { height: 100%; } }
.voice-caption {
  position: fixed;
  left: 50%;
  bottom: max(var(--s5), env(safe-area-inset-bottom));
  z-index: 30;
  width: min(640px, calc(100% - 2 * var(--s4)));
  transform: translateX(-50%);
  padding: var(--s3) var(--s4);
  border-radius: 12px;
  background: rgb(3 7 12 / .92);
  border: 2px solid var(--line);
  color: #ffffff;
  font-size: var(--fs-17);
  font-weight: 600;
  line-height: 1.45;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.voice-caption.is-visible { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------- Study Room components that depend on saved progress ---------- */
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.study-path .path { margin: var(--s5) 0 var(--s2); }
.path strong a { color: var(--ink); text-decoration: none; }
.path strong a:hover { color: var(--accent); text-decoration: underline; }
.question-progress { margin: 0 0 var(--s5); }
.feedback.incorrect { background: var(--bad-soft); border-color: var(--bad-line); animation: feedback-in var(--t) var(--bounce) both, nudge .35s var(--ease) .05s 1; }
@keyframes nudge { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.feedback.incorrect::before { content: "\00D7" / ""; background: var(--bad); color: #2a070c; }
.feedback.incorrect > strong:first-child { color: var(--bad); }
.feedback.review:not(.incorrect) > strong:first-child { color: var(--warn); }
table { border-collapse: separate; border-spacing: 0; }
thead th { background: var(--surface-3); color: var(--ink); font-weight: 800; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 12px; }
.voice-settings { max-width: 24rem; margin: var(--s4) auto 0; text-align: left; }
.voice-settings label { display: flex; justify-content: space-between; color: var(--ink); }
.voice-settings input[type="range"] { width: 100%; min-height: 44px; padding: 0; accent-color: var(--go); box-shadow: none; background: transparent; border: 0; }
.shell .voice-toggle { flex: 0 0 auto; }

/* ---------- Tablets in portrait and phones: a bottom tab bar ---------- */
@media (max-width: 900px) {
  .shell { position: sticky; top: 0; min-height: 60px; padding: var(--s2) var(--s4); gap: var(--s2); flex-wrap: nowrap; }
  .brand { --key-w: 68px; --key-h: 36px; font-size: 1.12rem; column-gap: 11px; min-height: 48px; }
  .brand::before { font-size: 22px; border-radius: 8px; }
  .brand::after { border-radius: 12px; }
  .shell nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    background: rgb(12 20 30 / .97);
    border-top: 2px solid var(--line);
    box-shadow: 0 -8px 22px rgb(0 0 0 / .35);
  }
  .shell nav a {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-height: 58px;
    padding: 6px 2px 4px;
    border-radius: 12px;
    font: 800 10.5px/1.1 var(--font-ui);
    letter-spacing: .02em;
    text-transform: none;
    text-align: center;
    white-space: normal;
  }
  .shell nav a::before {
    content: "";
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
  }
  .shell nav a[href="#home"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 0h4v2h-4zM8 2h8v2h-8zM6 4h12v2h-12zM4 6h16v2h-16zM2 8h20v2h-20zM0 10h24v2h-24zM2 12h20v2h-20zM2 14h6v2h-6zM16 14h6v2h-6zM2 16h6v2h-6zM16 16h6v2h-6zM2 18h6v2h-6zM16 18h6v2h-6zM2 20h6v2h-6zM16 20h6v2h-6zM2 22h6v2h-6zM16 22h6v2h-6z'/%3E%3C/svg%3E"); }
  .shell nav a[href="#diagnostic"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 0h8v2h-8zM4 2h4v2h-4zM16 2h4v2h-4zM2 4h2v2h-2zM20 4h2v2h-2zM2 6h2v2h-2zM8 6h8v2h-8zM20 6h2v2h-2zM0 8h2v2h-2zM6 8h2v2h-2zM16 8h2v2h-2zM22 8h2v2h-2zM0 10h2v2h-2zM6 10h2v2h-2zM10 10h4v2h-4zM16 10h2v2h-2zM22 10h2v2h-2zM0 12h2v2h-2zM6 12h2v2h-2zM10 12h4v2h-4zM16 12h2v2h-2zM22 12h2v2h-2zM0 14h2v2h-2zM6 14h2v2h-2zM16 14h2v2h-2zM22 14h2v2h-2zM2 16h2v2h-2zM8 16h8v2h-8zM20 16h2v2h-2zM2 18h2v2h-2zM20 18h2v2h-2zM4 20h4v2h-4zM16 20h4v2h-4zM8 22h8v2h-8z'/%3E%3C/svg%3E"); }
  .shell nav a[href="#library"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 2h8v2h-8zM14 2h8v2h-8zM0 4h2v2h-2zM10 4h4v2h-4zM22 4h2v2h-2zM0 6h2v2h-2zM4 6h4v2h-4zM10 6h4v2h-4zM16 6h4v2h-4zM22 6h2v2h-2zM0 8h2v2h-2zM10 8h4v2h-4zM22 8h2v2h-2zM0 10h2v2h-2zM4 10h4v2h-4zM10 10h4v2h-4zM16 10h4v2h-4zM22 10h2v2h-2zM0 12h2v2h-2zM10 12h4v2h-4zM22 12h2v2h-2zM0 14h2v2h-2zM4 14h4v2h-4zM10 14h4v2h-4zM16 14h4v2h-4zM22 14h2v2h-2zM0 16h2v2h-2zM10 16h4v2h-4zM22 16h2v2h-2zM0 18h2v2h-2zM10 18h4v2h-4zM22 18h2v2h-2zM2 20h8v2h-8zM14 20h8v2h-8z'/%3E%3C/svg%3E"); }
  .shell nav a[href="#bank"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0h8v2h-8zM10 2h8v2h-8zM8 4h8v2h-8zM6 6h8v2h-8zM4 8h16v2h-16zM2 10h18v2h-18zM12 12h6v2h-6zM10 14h6v2h-6zM8 16h6v2h-6zM6 18h6v2h-6zM4 20h4v2h-4zM2 22h2v2h-2z'/%3E%3C/svg%3E"); }
  .shell nav a[href="#guide"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 0h4v2h-4zM8 2h8v2h-8zM8 4h8v2h-8zM6 6h4v2h-4zM14 6h4v2h-4zM4 8h4v2h-4zM16 8h4v2h-4zM0 10h6v2h-6zM10 10h4v2h-4zM18 10h6v2h-6zM0 12h6v2h-6zM10 12h4v2h-4zM18 12h6v2h-6zM4 14h4v2h-4zM16 14h4v2h-4zM6 16h4v2h-4zM14 16h4v2h-4zM8 18h8v2h-8zM8 20h8v2h-8zM10 22h4v2h-4z'/%3E%3C/svg%3E"); }
  .shell nav a[href="#account"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 0h8v2h-8zM6 2h12v2h-12zM6 4h12v2h-12zM6 6h12v2h-12zM8 8h8v2h-8zM4 12h16v2h-16zM2 14h20v2h-20zM0 16h24v2h-24zM0 18h24v2h-24zM0 20h24v2h-24z'/%3E%3C/svg%3E"); }
  .shell nav [aria-current] { color: var(--go); background: var(--surface-2); box-shadow: inset 0 -3px 0 var(--go); }
  main { margin-bottom: calc(var(--s7) + 76px); }
  footer { padding-bottom: calc(var(--s6) + 80px); }
  .voice-caption { bottom: calc(86px + env(safe-area-inset-bottom)); }
  #notice:not(:empty) { top: 60px; padding: var(--s3) var(--s4); }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  body { font-size: var(--fs-17); }
  main { width: calc(100% - 2 * var(--s4)); margin-top: var(--s5); }
  .hero { grid-template-columns: 1fr; gap: var(--s5); padding: var(--s5); border-radius: var(--r2); }
  .group { margin-top: var(--s6); }
  .rows li { display: grid; gap: var(--s2); justify-items: start; }
  .actions .button, .actions button, form > button, .panel > button { width: 100%; }
  .actions { gap: var(--s3); }
  .prompt { font-size: var(--fs-17); }
  .feedback, .callout { padding: var(--s4) var(--s4) var(--s4) 60px; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .shell nav a { font-size: 10px; }
}
@media (max-width: 360px) {
  .shell nav a { font-size: 9px; letter-spacing: 0; }
}

/* ---------- Readability and touch pass ----------
   Keeps long reading to a comfortable line length, makes the phone tab labels larger,
   and gives stand-alone links and list links a full-size touch area on touch screens. */
.readable p, .readable li, .prose { max-width: 72ch; }
@media (max-width: 900px) {
  .shell nav a { font-size: 12px; min-height: 62px; gap: 4px; }
  main { margin-bottom: calc(var(--s7) + 84px); }
}
@media (max-width: 720px) { .shell nav a { font-size: 12px; } }
@media (max-width: 360px) { .shell nav a { font-size: 11px; letter-spacing: 0; } }
@media (max-width: 360px) { .brand { --key-w: 64px; } .brand::before { font-size: 21px; } }
@media (pointer: coarse) {
  .rows li > a:first-child { display: block; padding-block: 9px; }
  p > a:only-child, li > a:only-child, section > a:not([class]), .panel > a:not([class]) { display: inline-block; padding-block: 11px; }
  .crumb { min-height: 44px; }
  .crumb { display: inline-flex; align-items: center; }
}

/* ---------- Preferences and modes ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}
@media (prefers-contrast: more) {
  :root { --line: #6f89a8; --ink-3: #c9d5e2; --ink-2: #e3eaf2; }
}
@media (forced-colors: active) {
  .choice, .card, .panel, .feedback, .callout, .hero, .overview, .tabs a, nav a, .rows li { border: 1px solid CanvasText; }
  .choice:has(input:checked) { outline: 3px solid Highlight; }
  progress { border: 1px solid CanvasText; }
  .shell nav a::before { background: CanvasText; }
  .brand::before { border: 2px solid CanvasText; }
}
@media print {
  .shell nav, .voice-toggle, .voice-caption, .actions, footer { display: none !important; }
  body { background: #fff; color: #000; }
  h1, h2, h3, p, li { color: #000; }
  .card, .panel, .hero, .rows li { border-color: #999; background: #fff; box-shadow: none; }
}


/* Lesson rows: the whole row opens the lesson, including the "Start here" tag. */
.rows li { position: relative; }
.rows li > a:first-child::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
