/* ---------------------------------------------------------------------------
   Colloqui (cut from TSC Prep). A study desk: zinc greys, a deep blue bar on top, one blue
   accent for whatever you can act on, mint badges. The faces (Titillium Web
   headings, Open Sans text) are the Memoria • Foglio docs'; the green is
   this app's own.
--------------------------------------------------------------------------- */

:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --sunk: #e6efec;
  --ink: #18181b;
  --muted: #70707a;
  --line: #e4e4e7;
  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --brand: #16305a;
  --badge: #d6e4fb;
  --badge-ink: #1f4f8f;
  --accent-wash: color-mix(in srgb, var(--accent) 12%, transparent);
  --warn: #b86e00;
  --danger: #c3352c;

  --display: "Titillium Web", system-ui, sans-serif;
  --body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: Consolas, SFMono-Regular, ui-monospace, monospace;

  --gutter: 20px;
  --measure: 44rem;
  --tap: 44px;
}

/* Dark follows the system unless you chose Light or Dark in the menu
   (data-theme on <html>, set by the script in base.html). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412;
    --surface: #151e1b;
    --sunk: #1b2622;
    --ink: #e3ecec;
    --muted: #94a49d;
    --line: #2a3833;
    --accent: #7fb0ff;
    --accent-ink: #0e1412;
    --brand: #10223f;
    --badge: #16284a;
    --badge-ink: #a9c8ff;
    --warn: #f0a83a;
    --danger: #f06a5e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412;
  --surface: #151e1b;
  --sunk: #1b2622;
  --ink: #e3ecec;
  --muted: #94a49d;
  --line: #2a3833;
  --accent: #7fb0ff;
  --accent-ink: #0e1412;
  --brand: #10223f;
  --badge: #16284a;
  --badge-ink: #a9c8ff;
  --warn: #f0a83a;
  --danger: #f06a5e;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
  padding-top: env(safe-area-inset-top, 0px);
}

/* --- top bar --------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  color: #fff;
  position: relative;
  z-index: 10; /* above the page, so the side menu covers it */
}
/* The blue bar runs the full width of the window, while its contents stay
   in the page column. */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  background: var(--brand);
  z-index: -1;
}
body { overflow-x: clip; }
.wordmark {
  font: 800 1.15rem/1 var(--display);
  font-stretch: 112%;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark b { color: #a9c8ff; } /* light blue on the blue bar, in both themes */
.topnav { display: flex; gap: 4px; margin-right: auto; }
.topnav a {
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 600;
}
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.14); }
.topbar .linkish { color: rgba(255, 255, 255, 0.74); }
.topbar :focus-visible { outline-color: #fff; }
.topbar form { margin: 0; }

/* The menu: in the bar on a desktop, a panel from the side on a phone. */
.menu { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.menu .topnav { margin-right: auto; }
.menu-toggle, .menu-head, .menu-backdrop { display: none; }
.theme-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 8px; overflow: hidden; }
.theme-switch button { font: 600 0.82rem/1 var(--body); padding: 7px 10px; min-height: 32px; border: 0; background: transparent; color: rgba(255, 255, 255, 0.74); cursor: pointer; }
.theme-switch button + button { border-left: 1px solid rgba(255, 255, 255, 0.28); }
.theme-switch button:hover { color: #fff; }
.theme-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.18); color: #fff; }

@media (max-width: 760px) {
  .menu-toggle {
    display: inline-grid; place-items: center; margin-left: auto;
    width: var(--tap); height: var(--tap); border: 0; border-radius: 8px;
    background: transparent; color: #fff; font-size: 1.5rem; cursor: pointer;
  }
  .menu {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(82vw, 320px);
    flex-direction: column; align-items: stretch; gap: 20px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); color: var(--ink); overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.28);
    transform: translateX(100%); visibility: hidden;
    transition: transform 0.22s ease, visibility 0.22s;
    z-index: 2;
  }
  .menu.open { transform: none; visibility: visible; }
  .menu-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
  .menu-head .wordmark b { color: var(--accent); }
  .menu-close {
    width: var(--tap); height: var(--tap); border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 1.8rem; line-height: 1; cursor: pointer;
  }
  .menu .topnav { flex-direction: column; gap: 2px; margin: 0; }
  .menu .topnav a { color: var(--ink); padding: 12px; font-size: 1.05rem; }
  .menu .topnav a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
  .menu .theme-switch { align-self: flex-start; border-color: var(--line); }
  .menu .theme-switch button { color: var(--muted); padding: 9px 14px; min-height: 40px; }
  .menu .theme-switch button + button { border-left-color: var(--line); }
  .menu .theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
  .menu .linkish { color: var(--muted); padding: 8px 12px; }
  .menu :focus-visible { outline-color: var(--accent); }
  .menu-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1; }
}
@media (prefers-reduced-motion: reduce) { .menu { transition: none; } }
.topbar > .wordmark:only-child { margin-right: auto; }

.linkish {
  background: none;
  border: 0;
  padding: 10px 4px;
  min-height: var(--tap);
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--ink); }

/* --- type ------------------------------------------------------------------ */
.page { padding-top: 32px; display: grid; gap: 20px; }
h1, h2 { font-family: var(--display); text-wrap: balance; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 820; font-stretch: 116%; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 760; font-stretch: 108%; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
p { margin: 0; max-width: 66ch; }
.lede { color: var(--muted); font-size: 1.1rem; }
.count { font: 600 0.85rem/1 var(--body); color: var(--muted); }
.hint { color: var(--muted); font-size: 0.95rem; }
.block { display: grid; gap: 14px; padding-top: 12px; }

/* --- controls -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 700 1rem/1 var(--body);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { color: var(--danger); }
.controls { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- forms ----------------------------------------------------------------- */
.form { display: grid; gap: 22px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
label, legend { font-weight: 700; padding: 0; }
input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
.error { color: var(--danger); font-weight: 600; }

.choices { display: grid; gap: 8px; }
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.choice input { margin-top: 5px; accent-color: var(--accent); }
.choice-hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.92rem; }

.danger { border-top: 1px solid var(--line); padding-top: 14px; }
.danger summary { cursor: pointer; color: var(--muted); padding: 10px 0; }
.danger form { display: grid; gap: 10px; justify-items: start; }

/* --- login ----------------------------------------------------------------- */
.gate { padding-top: 56px; display: grid; gap: 24px; max-width: 24rem; }
.gate h1 b { color: var(--accent); }
.gate form { display: grid; gap: 16px; }

/* --- home ------------------------------------------------------------------ */
.sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.section a, .section-soon { display: grid; gap: 4px; padding: 16px 18px; text-decoration: none; }
.section a:hover { background: var(--accent-wash); border-radius: 12px; }
.section-name { font: 760 1.1rem/1.2 var(--display); font-stretch: 106%; }
.section-note { color: var(--muted); }
.section-soon { opacity: 0.62; border-style: dashed; }

/* --- story bank ------------------------------------------------------------ */
.story-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.story-list a {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}
.story-list a:hover { border-color: var(--accent); }
.story-title { font: 760 1.05rem/1.25 var(--display); font-stretch: 106%; }
.story-metric { color: var(--muted); }
.story-tail { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font: 600 0.78rem/1 var(--body);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--badge);
  color: var(--badge-ink);
}
.tag-open { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.story-list a:active, .map-stories a:active, .filter-row a:active { background: var(--sunk); }
.story-head { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.story-head .story-title { min-width: 0; overflow-wrap: anywhere; }

.filters { display: grid; gap: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-row a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-weight: 600; font-size: 0.92rem; text-decoration: none;
}
.filter-row a:hover { color: var(--ink); border-color: var(--accent); }
.filter-row a[aria-current="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
/* Eight sections wrap to half a phone screen: one row that scrolls instead. */
@media (max-width: 560px) {
  .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .filter-row a { flex: none; white-space: nowrap; }
}

.map-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.map-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.map-question { min-width: 0; overflow-wrap: anywhere; }
.map-stories { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.map-stories a {
  display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); padding: 0 12px;
  border-radius: 8px; background: var(--accent-wash); color: var(--accent); font-weight: 600; text-decoration: none;
}
@media (max-width: 520px) {
  .map-list li { grid-template-columns: 1fr; }
  .map-stories { justify-content: flex-start; }
}

.star { margin: 0; display: grid; gap: 10px; }
.star-part {
  display: grid; gap: 6px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.star-part dt { display: flex; gap: 10px; align-items: baseline; font-weight: 700; }
.star-letter { font: 820 1.2rem/1 var(--display); font-stretch: 112%; color: var(--accent); }
.star-part dd { margin: 0; max-width: 66ch; line-height: 1.5; overflow-wrap: anywhere; }
.star-part code { font-size: 0.9em; padding: 1px 5px; border-radius: 5px; background: var(--sunk); }
/* A blank still to fill: reads as open, like the "to fill" tag. */
mark.placeholder {
  color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent);
  padding: 0 3px; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.star-compact .star-part { padding: 10px 14px; }
.guide > .star { padding: 0 12px 12px; }

/* --- rehearsal ---------------------------------------------------------------- */
.recorder { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.recorder .btn:active, .controls .btn:active { filter: brightness(0.94); }
.mic { margin: 0; display: inline-flex; align-items: center; gap: 8px; color: var(--danger); font-weight: 600; }
.mic-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .mic-dot { animation: none; } }
.record-status { display: grid; gap: 6px; }
.record-status p { margin: 0; }
.record-label { font-weight: 600; }
.big-sep { color: var(--muted); margin: 0 2px; }
.fix { margin: 0; font-size: 1.1rem; font-weight: 600; max-width: 60ch; }
.plain-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; max-width: 66ch; }
.transcript { white-space: pre-wrap; }
.star-part dt .tag { margin-left: auto; }
.recorder-wrap { display: grid; gap: 8px; }
.recorder-wrap > .hint { margin: 0; }

/* --- today and the mock round ------------------------------------------------ */
.section-today { border-color: var(--accent); }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.today-step a, .today-empty {
  display: grid; gap: 6px; padding: 14px 16px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none;
}
.today-step a:hover { border-color: var(--accent); }
.today-step a:active { background: var(--sunk); }
.today-step.is-done a, .today-step.is-done .today-empty { opacity: 0.7; }
.today-empty { color: var(--muted); }
.choice-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; cursor: pointer;
}
.choice-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
.choice-line { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.choice-pill input, .choice-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.mock-question { font-size: 1.15rem; line-height: 1.35; }
.mock-told { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mock-item { border-top: 1px solid var(--line); padding-top: 18px; }
.end-early { margin: 0; }
.end-early .linkish { min-height: var(--tap); }

/* --- practice: think-aloud, time-up and the review ------------------------- */
.reveal { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--warn); font-weight: 600; }
.think-aloud-body { display: grid; gap: 10px; padding: 0 16px 14px; }
.think-aloud-body > .hint { margin: 0; }
.followup label { font-weight: 600; line-height: 1.4; }
.review p { margin: 0; }

.story-fits { color: var(--muted); margin: 0; }
.story-fits .eyebrow { margin-right: 6px; }

/* --- technical practice ----------------------------------------------------- */
.mono, code, pre, .code-input { font-family: var(--mono); }
.eyebrow { font: 600 0.78rem/1 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.big { font: 820 1.7rem/1 var(--display); font-stretch: 112%; color: var(--ink); }

.progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.progress > div {
  display: grid; gap: 4px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--muted); font-size: 0.9rem;
}
.progress .is-warn .big { color: var(--warn); }
@media (max-width: 520px) { .progress { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.note-good { color: var(--accent); font-weight: 600; }

.exercise-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.exercise-list a {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-decoration: none; min-height: var(--tap);
}
.exercise-list a:hover { border-color: var(--accent); }
.ex-number { color: var(--muted); font-weight: 700; }
.ex-title { font-weight: 600; overflow-wrap: anywhere; }

.status {
  font: 600 0.76rem/1 var(--body); padding: 5px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--sunk); color: var(--muted);
}
.status-solid { background: var(--accent-wash); color: var(--accent); }
.status-review { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.status-attempted { background: var(--sunk); color: var(--ink); }

.guide { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.guide > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; min-height: var(--tap); display: flex; align-items: center; gap: 10px; }
.guide > .prose, .guide > .attempts { padding: 0 16px 14px; }

.ex-head { display: grid; gap: 10px; justify-items: start; }

/* The Markdown comes out as prose, code blocks and lists. */
.prose { display: grid; gap: 12px; max-width: 66ch; }
.prose > * { margin: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; display: grid; gap: 6px; }
.prose code {
  font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: var(--sunk);
}
.prose pre, pre.mine {
  margin: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--sunk); overflow-x: auto; font-size: 0.88rem; line-height: 1.5; tab-size: 2;
}
.prose pre code, pre.mine code { padding: 0; background: none; font-size: inherit; white-space: pre; }
.prompt { padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); max-width: none; }
.prompt > * { max-width: 66ch; }
.prompt pre { max-width: none; }
.solution { padding-top: 2px; max-width: none; }
.solution > * { max-width: 66ch; }
.solution pre { max-width: none; }

.code-input { font-size: 0.92rem; line-height: 1.5; tab-size: 2; white-space: pre; overflow-x: auto; }

.timer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.timer-face { font: 800 1.9rem/1 var(--display); font-stretch: 112%; min-width: 4.2ch; }
.timer.is-over .timer-face { color: var(--warn); }
.timer-over { color: var(--warn); font-weight: 600; }

.rating { display: flex; flex-wrap: wrap; gap: 10px; }
.attempts { list-style: none; margin: 0; display: grid; gap: 12px; }
.attempts li { display: grid; gap: 6px; justify-items: start; }
.pager { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); }
.pager a { padding: 12px 4px; font-weight: 700; text-decoration: none; color: var(--muted); }
.pager a:hover { color: var(--ink); }

/* --- topics and flashcards ---------------------------------------------------- */
.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.topic-list a {
  display: grid; gap: 8px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none;
}
.topic-list a:hover { border-color: var(--accent); }
.topic-summary { color: var(--muted); font-size: 0.95rem; }
.tag-quiet { background: var(--sunk); color: var(--muted); }

/* The notes and the guides are long-form: headings get air, tables scroll inside themselves. */
.topic-body, .guide-body { max-width: none; }
.topic-body > *, .guide-body > * { max-width: 66ch; }
.topic-body h2, .guide-body h2 { font-size: 1.35rem; padding-top: 18px; }
.topic-body h3 { font: 760 1.05rem/1.25 var(--display); font-stretch: 106%; padding-top: 6px; }
.topic-body hr, .guide-body hr { border: 0; border-top: 1px solid var(--line); width: 100%; max-width: none; }
.topic-body pre { max-width: none; }
.guide-body table { max-width: none; }
.prose table {
  display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.95rem;
}
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); min-width: 9rem; }
.prose td:last-child { min-width: 15rem; }
.prose th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.prose a { color: var(--accent); text-underline-offset: 3px; }

.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card-list summary { justify-content: space-between; }
.card-q { font-weight: 600; }

.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.review-counts { display: flex; gap: 14px; color: var(--muted); font-weight: 600; }
.flashcard {
  display: grid; gap: 14px; padding: 22px 20px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); min-height: 9rem;
}
.card-question { font: 700 1.2rem/1.35 var(--display); font-stretch: 104%; }
.card-question code { font-family: var(--mono); font-weight: 600; }
.card-rule { border: 0; border-top: 1px dashed var(--line); margin: 0; width: 100%; }
.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grade { flex-direction: column; gap: 4px; padding: 10px 6px; min-height: 60px; }
.grade-when { font: 600 0.8rem/1 var(--body); opacity: 0.8; }
.grade-again { color: var(--danger); }
@media (max-width: 420px) { .grades { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Wide screens: use the room instead of a phone-width column. Running text
   keeps its 66ch measure; lists of cards go two to a row. */
@media (min-width: 1100px) {
  :root { --measure: 72rem; }
  .story-list, .exercise-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The pitch read aloud, above the blocks. */
.listen-list { display: grid; gap: .5rem; margin: 1rem 0 1.25rem; }
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; padding: .5rem .75rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.listen > span { font-weight: 600; font-size: .9rem; color: var(--muted); }
.listen audio { flex: 1 1 16rem; min-width: 0; height: 2.25rem; }

/* --- candidature ------------------------------------------------------------- */
.app-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.app-list a {
  display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: inherit; text-decoration: none;
}
.app-list a:hover { border-color: var(--accent); }
.app-list .is-closed a { opacity: 0.65; }
.app-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.app-company { font: 700 1.1rem/1.2 var(--display); }
.app-role { color: var(--muted); }
.app-note { font-size: 0.95rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 10px 18px; margin: 0; }
.facts dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts dd { margin: 2px 0 0; }
.event-form { grid-template-columns: 11rem 1fr auto; align-items: end; }
@media (max-width: 760px) { .event-form { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 7rem 1fr auto; gap: 10px; align-items: baseline;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.timeline-day { color: var(--muted); }
.timeline form { margin: 0; }
