/* The look (2026-11-03): violet and mint, for 14-19 year olds. Violet is the
   app's own colour (buttons, the current place, links); mint means right and
   earned; coral means a mark lost; amber means getting there. Sora for
   headings, Plus Jakarta Sans for everything else. Every screen takes its
   colours from these tokens, so a change here restyles the whole app. */
:root {
  --bg: #f6f4ff;
  --surface: #ffffff;
  --surface-2: #efebff;
  --border: #e6e0fa;
  --text: #1b1534;
  --muted: #6b6488;
  --accent: #6d4aff;
  --accent-2: #4a2fd6;
  --accent-soft: #ebe5ff;
  --mint: #3ee0a8;
  --warn: #8a5b00;
  --warn-soft: #fff1cc;
  --good: #0b7a59;
  --good-soft: #d3f5e8;
  --bad: #b3362b;
  --bad-soft: #ffe2de;
  --streak: #ff8a3d;
  --hero: linear-gradient(140deg, #5233f0 0%, #7b5cff 60%, #9a7dff 100%);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(27, 21, 52, .05), 0 10px 30px -18px rgba(27, 21, 52, .28);
  --shadow-lg: 0 2px 4px rgba(27, 21, 52, .06), 0 24px 48px -20px rgba(27, 21, 52, .35);
  /* Share of the marks, none to all: one hue, light to dark. */
  --heat-0: #f3f0ff; --heat-1: #ddd3ff; --heat-2: #bfaeff;
  --heat-3: #9d87ff; --heat-4: #7b5cff; --heat-5: #5233f0;
  --heat-ink-dark: #1b1534;
  --heat-ink-5: #fff;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100c20;
    --surface: #1a1532;
    --surface-2: #231d42;
    --border: #2d2650;
    --text: #efebff;
    --muted: #a59dc9;
    --accent: #9d87ff;
    --accent-2: #c4b6ff;
    --accent-soft: #2b2260;
    --mint: #3ee0a8;
    --warn: #ffc96a;
    --warn-soft: #3a2d10;
    --good: #5fe6b5;
    --good-soft: #123a30;
    --bad: #ffa79d;
    --bad-soft: #3e1d22;
    --streak: #ff9a5a;
    --hero: linear-gradient(140deg, #34248f 0%, #5a40d6 70%, #6f55e8 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px -18px rgba(0, 0, 0, .7);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 48px -20px rgba(0, 0, 0, .75);
    --heat-0: #231d42; --heat-1: #34286e; --heat-2: #4a3a9e;
    --heat-3: #6650d0; --heat-4: #8b73ff; --heat-5: #b3a2ff;
    --heat-ink-dark: #efebff;
    --heat-ink-5: #100c20;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #100c20;
  --surface: #1a1532;
  --surface-2: #231d42;
  --border: #2d2650;
  --text: #efebff;
  --muted: #a59dc9;
  --accent: #9d87ff;
  --accent-2: #c4b6ff;
  --accent-soft: #2b2260;
  --mint: #3ee0a8;
  --warn: #ffc96a;
  --warn-soft: #3a2d10;
  --good: #5fe6b5;
  --good-soft: #123a30;
  --bad: #ffa79d;
  --bad-soft: #3e1d22;
  --streak: #ff9a5a;
  --hero: linear-gradient(140deg, #34248f 0%, #5a40d6 70%, #6f55e8 100%);
  --heat-0: #231d42; --heat-1: #34286e; --heat-2: #4a3a9e;
  --heat-3: #6650d0; --heat-4: #8b73ff; --heat-5: #b3a2ff;
  --heat-ink-dark: #efebff;
  --heat-ink-5: #100c20;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 620;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.subject-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: .01em;
}

/* The qualification switch wears the chip it replaced, so the header reads
   the same whether there is one syllabus or several. */
.subject-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  font-family: inherit;
  cursor: pointer;
  padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 10px top 50%, right 6px top 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.subject-select:hover { border-color: var(--accent); }

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

.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 9px;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  padding: 6px 15px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.badge.is-zero { background: var(--good-soft); color: var(--good); }

.topbar-stats {
  margin-left: auto;
  display: flex;
  gap: 20px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-stats b {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- views */

main {
  flex: 1;
  min-height: 0;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  min-height: 0;
}

.view.is-active { display: flex; }

#view-browse { flex-direction: row; }

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  width: 310px;
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  padding: 10px 0 40px;
}

.sec {
  border-bottom: 1px solid var(--border);
}

.sec-head {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sec-head:hover { background: var(--surface-2); }

.sec-num {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
  min-width: 18px;
}

.sec-name { font-weight: 570; font-size: 13.5px; flex: 1; }

.sec-level {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}

.sec-body { display: none; padding-bottom: 6px; }
.sec.is-open .sec-body { display: block; }
.sec.is-open .sec-head { background: var(--surface-2); }

.sub {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px 7px 34px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.sub:hover { background: var(--surface-2); color: var(--text); }

.sub.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 560;
}

.sub-code {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  min-width: 30px;
  color: var(--muted);
}

.sub-name { flex: 1; }

.sub-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.sub-flag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
  padding: 0 6px;
}

/* ------------------------------------------------------------------- panel */

.panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 26px 30px 60px;
}

.panel-head { margin-bottom: 22px; max-width: 760px; }

.crumb {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
}

.panel-head h1 {
  font-size: 22px;
  letter-spacing: -.015em;
  margin: 0 0 4px;
}

.metrics {
  display: flex;
  gap: 26px;
  margin: 16px 0 6px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 760px;
}

.metric span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.metric b {
  font-size: 19px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}

.block { margin: 24px 0; max-width: 760px; }

.block h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 9px;
}

.obj-list, .note-list { margin: 0; padding-left: 18px; }
.obj-list li, .note-list li { margin-bottom: 5px; }
.note-list { color: var(--muted); font-size: 13.5px; }
/* A guidance note can carry its own list ("Including:" then one item per
   line), as the syllabus prints it. */
.note-list li { white-space: pre-line; }

/* A numbered syllabus (2210) prints a code beside each objective, so the
   code takes the bullet's place rather than sitting next to one. */
.obj-list li:has(> .obj-code) { list-style: none; margin-left: -18px; }
.obj-code {
  display: inline-block;
  min-width: 4.6em;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted);
}
.obj-items {
  margin: 3px 0 2px calc(4.6em + 6px);
  padding-left: 2em;
}
.obj-items li { margin-bottom: 1px; }
.obj-items li::marker { content: "(" counter(list-item, lower-alpha) ")  "; }

.group-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 6px;
}

/* --------------------------------------------------------------- questions */

.q-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.q-toolbar label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.q-list { display: flex; flex-direction: column; gap: 8px; }

.q-item {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: block;
}

.q-item:hover { border-color: var(--accent); }
.q-item.is-active { border-color: var(--accent); background: var(--accent-soft); }

.q-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.q-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text);
}

.pill {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  letter-spacing: .01em;
}

.pill-marks { background: var(--surface-2); color: var(--muted); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-none { background: var(--surface-2); color: var(--muted); }

.q-text {
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------ detail panel */

.detail {
  width: 420px;
  flex: none;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  padding: 20px 22px 60px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.detail h2 { font-size: 16px; margin: 0 0 2px; }

.icon-btn {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 5px 9px;
}

.icon-btn:hover { color: var(--text); border-color: var(--accent); }

.detail section { margin-bottom: 20px; }

.detail h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 7px;
}

.prose {
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.prose.is-empty { color: var(--muted); font-style: italic; }

.topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.topic-row.is-primary { border-color: var(--accent); background: var(--accent-soft); }
.topic-row .score { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ review */

.review-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px 80px;
}

.review-head { max-width: 720px; margin-bottom: 22px; }
.review-head h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.015em; }
.review-head p { color: var(--muted); margin: 0 0 10px; font-size: 14px; }

.review-progress { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

#review-cards { display: flex; flex-direction: column; gap: 14px; max-width: 980px; }

.rcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.rcard.is-done { opacity: .5; }

.rcard-q { font-size: 14px; line-height: 1.55; margin: 6px 0 12px; }

.rcard-ms {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 13px;
  max-height: 110px;
  overflow: auto;
  white-space: pre-wrap;
}

.rcard-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.08); }

select.topic-select {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 340px;
}

.review-more { display: flex; justify-content: center; margin-top: 20px; }

/* ------------------------------------------------------------------ search */

.search-wrap { flex: 1; overflow-y: auto; padding: 26px 30px 80px; }

.search-form {
  display: flex;
  gap: 9px;
  max-width: 680px;
  margin-bottom: 20px;
}

#search-input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 9px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

#search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

#search-results { display: flex; flex-direction: column; gap: 8px; max-width: 980px; }

/* ------------------------------------------------------------------ misc */

.loading, .empty {
  color: var(--muted);
  padding: 22px 16px;
  font-size: 14px;
}

.empty h2 { color: var(--text); font-size: 18px; margin: 0 0 6px; }
.empty p { margin: 0; max-width: 420px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 560;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
}

/* ------------------------------------------------------- narrow / mobile */

@media (max-width: 900px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .topbar-stats { display: none; }
  .subject-chip { display: none; }
  .subject-select { display: inline-block; }

  /* Keep the mark but drop the wordmark, so all three tabs stay reachable
     at phone width rather than overflowing off the right edge. */
  .brand span { display: none; }
  .tabs { margin-left: auto; }
  .tab { padding: 6px 12px; }

  #view-browse { flex-direction: column; }

  .sidebar {
    width: 100%;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .panel { padding: 18px 16px 50px; }

  .detail {
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 40;
    padding: 18px 16px 50px;
  }

  .review-wrap, .search-wrap { padding: 18px 16px 60px; }
  .metrics { gap: 18px; flex-wrap: wrap; }
}

/* ----------------------------------------------------------------- grading */

.answer { border-top: 1px solid var(--border); padding-top: 16px; }

.answer-box {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
  margin-bottom: 10px;
}

.answer-box:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.notice {
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 12px;
  border-radius: 8px;
  margin: 8px 0 12px;
}

.notice-warn { background: var(--warn-soft); color: var(--warn); }

.pill-bad { background: #fde8e8; color: #b42318; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-bad { background: #3a1a1a; color: #f08b8b; }
}

:root[data-theme="dark"] .pill-bad { background: #3a1a1a; color: #f08b8b; }

.grade-result { margin-top: 14px; }

.grade-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.grade-score { font-size: 15px; color: var(--muted); }

.grade-score b {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.grade-block { margin: 16px 0; }

.claim, .mpoint {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 7px;
  background: var(--surface);
}

.claim-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.claim-quote {
  margin: 4px 0 6px;
  padding-left: 10px;
  border-left: 3px solid var(--border);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}

.claim-note, .mpoint-reason { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.mpoint-reason { color: var(--text); margin-top: 3px; }

.mpoint-ref { font-size: 12.5px; font-weight: 560; }

.fb { margin-bottom: 9px; font-size: 13.5px; line-height: 1.55; }

.fb b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }

.attempts { margin-top: 14px; }

.attempt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  margin-bottom: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.attempt:hover { border-color: var(--accent); }
.attempt > span:first-child { font-weight: 640; font-variant-numeric: tabular-nums; min-width: 40px; }

/* ------------------------------------------------------------ topic picker */

.picker { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 11px; }

.picker-alts {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.picker-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }

.chip {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip b { font-weight: 640; }

.chip-score {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.picker-search { position: relative; max-width: 520px; }

.picker-input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.picker-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.picker-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.picker-item {
  appearance: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 8px 11px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--accent-soft); }
.picker-item b { font-weight: 640; }

.picker-section { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.picker-empty { padding: 9px 11px; font-size: 12.5px; color: var(--muted); }

/* =====================================================================
   Practice - the student's screen.

   The three-pane layout behind the Browse tab is a curation tool for the
   parent. This is the screen a student sits in front of every evening, so
   it is a single centred column holding one question and nothing else:
   no topic scores, no review flags, and no mark scheme until they have
   submitted an answer.
   ===================================================================== */

#view-practice.is-active {
  display: block;
  overflow-y: auto;
  padding: 34px 24px 90px;
}

.practice-start,
.practice-done {
  max-width: 900px;
  margin: 0 auto;
}

.practice-start h1,
.practice-done h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 4px 0 8px;
}

.lede {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 62ch;
  margin: 0 0 26px;
}

.start-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 30px 0 12px;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.set-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}

.set-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.set-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.set-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.set-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.set-level {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.set-mixed {
  display: block;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 20px;
  margin-bottom: 4px;
}

.set-mixed .set-name { font-size: 19px; display: block; }
.set-mixed .set-sub  { color: rgba(255, 255, 255, .88); display: block; margin-top: 2px; }
.set-mixed:hover     { border-color: var(--accent); filter: brightness(1.06); }

/* --------------------------------------------------------- the session */

.practice-run {
  max-width: 1182px;   /* the card at 840 plus the side panel */
  margin: 0 auto;
}

.run-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.run-where {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.run-dots {
  display: flex;
  gap: 5px;
  margin-left: auto;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.dot-now  { background: var(--accent); transform: scale(1.3); }
.dot-full { background: var(--good); }
.dot-part { background: var(--warn); }
.dot-none { background: #d64545; }
.dot-skip { background: var(--muted); opacity: .4; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--text); }

.qcard {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 30px 26px;
  box-shadow: var(--shadow);
}

.qcard-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.qcard-count {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.qcard-topic {
  font-size: 14px;
  font-weight: 600;
  margin-top: 3px;
}

.qcard-marks {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface-2);
}

.qcard-marks b    { font-size: 18px; }
.qcard-marks span { font-size: 12px; color: var(--muted); }

.qcard-stem {
  background: var(--surface-2);
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.stem-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.qcard-stem p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* The question is the largest text on the page, by design. */
.qcard-q {
  font-size: 19px;
  line-height: 1.55;
  margin: 0 0 22px;
  white-space: pre-wrap;
}

.qcard-answer {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.qcard-answer:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.qcard-answer:disabled { opacity: .72; }

.qcard-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 2px 0;
}

.qcard-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.qcard-status {
  font-size: 13px;
  color: var(--muted);
}

.btn-lg {
  padding: 11px 22px;
  font-size: 15px;
}

/* ---------------------------------------------------------- the marking */

.result-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  margin-bottom: 22px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.result-banner.is-full { background: var(--good-soft); border-color: var(--good); }
.result-banner.is-part { background: var(--warn-soft); border-color: var(--warn); }
.result-banner.is-none { background: var(--surface-2); border-color: #d64545; }

.result-score {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.result-score b    { font-size: 34px; line-height: 1; }
.result-score span { font-size: 17px; color: var(--muted); }

.result-word { font-size: 16px; font-weight: 700; }

.result-ref {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.fb-block {
  border-left: 3px solid var(--border);
  padding: 2px 0 2px 16px;
  margin-bottom: 18px;
}

.fb-block h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.fb-block p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
}

.fb-good { border-left-color: var(--good); }
.fb-warn { border-left-color: var(--warn); }
.fb-next { border-left-color: var(--accent); }

/* Detail on demand: closed by default, so the feedback is what gets read. */
.disc {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.disc summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
}

.disc summary::-webkit-details-marker { display: none; }

.disc summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1;
}

.disc[open] summary { color: var(--text); }
.disc[open] summary::before { content: "\2212"; }

.disc-body { padding: 14px 0 4px 27px; }

/* --------------------------------------------------------- the summary */

.done-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr auto;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
}

.bar-name { font-size: 13.5px; }

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.is-full { background: var(--good); }
.bar-fill.is-part { background: var(--warn); }
.bar-fill.is-none { background: #d64545; }

.bar-pct {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Review is the parent's curation queue, not part of studying. */
.tab-admin { margin-left: 8px; opacity: .72; }
.tab-admin.is-active { opacity: 1; }

@media (max-width: 900px) {
  #view-practice.is-active { padding: 20px 14px 70px; }
  .qcard { padding: 20px 18px; border-radius: 12px; }
  .qcard-q { font-size: 17px; }
  .set-grid { grid-template-columns: 1fr 1fr; }
  .done-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; }
  .run-where { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

body[data-view="practice"] .topbar-stats { display: none; }

/* Rehearsal mode. Loud on purpose: a score that came from counting words
   must never be read as a mark, so the warning is not dismissible and does
   not scroll away with the result. */
.rehearsal-bar {
  padding: 9px 20px;
  font-size: 13px;
  line-height: 1.5;
  background: #fde8e8;
  color: #b42318;
  border-bottom: 1px solid rgba(180, 35, 24, .25);
}

.rehearsal-bar code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(180, 35, 24, .12);
}

.notice-bad {
  background: #fde8e8;
  color: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rehearsal-bar,
  :root:not([data-theme="light"]) .notice-bad { background: #3a1a1a; color: #f08b8b; }
  :root:not([data-theme="light"]) .rehearsal-bar code { background: rgba(240, 139, 139, .16); }
}

:root[data-theme="dark"] .rehearsal-bar,
:root[data-theme="dark"] .notice-bad { background: #3a1a1a; color: #f08b8b; }
:root[data-theme="dark"] .rehearsal-bar code { background: rgba(240, 139, 139, .16); }

.result-banner.is-rehearsal { background: #fde8e8; border-color: #b42318; }

/* =====================================================================
   Notes - revision notes filed against syllabus topics.
   ===================================================================== */

.notes-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 26px 30px 80px;
}

.note-group { max-width: 980px; }
.note-group .start-heading { margin-top: 26px; }

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.note-links { display: flex; flex-direction: column; gap: 8px; }

.note-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 14px 16px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}

.note-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.note-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.note-card-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.note-card-sub   { font-size: 13px; color: var(--muted); line-height: 1.5; }
.note-card-topic { font-size: 12px; font-weight: 600; color: var(--accent); }

.note-reader {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.note-back { margin: 0 0 14px; padding-left: 0; }

.note-reader h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 4px 0 10px;
  line-height: 1.25;
}

.note-meta { margin-bottom: 14px; }

.note-reader .lede { margin-bottom: 18px; }

/* Rendered markdown, shared by the reader and the practice disclosure. */
.md { font-size: 15px; line-height: 1.65; }
.md p { margin: 0 0 12px; }
.md h2 { font-size: 17px; margin: 26px 0 8px; letter-spacing: -0.01em; }
.md h3 { font-size: 15px; margin: 20px 0 6px; }
.md ol, .md ul { margin: 0 0 14px; padding-left: 24px; }
.md li { margin-bottom: 6px; }
.md li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.md ol li::marker { font-weight: 600; color: var(--accent); }
.md strong { font-weight: 650; }
.md code {
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
}
.md a { color: var(--accent); }
.md-code {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow-x: auto;
}
.md-code code { padding: 0; background: none; font-size: 13px; line-height: 1.5; white-space: pre; }
.md-table-wrap { margin: 0 0 14px; overflow-x: auto; }
.md-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md-table th, .md-table td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
.md-table th { background: var(--surface-2); font-weight: 650; }

.note-sources {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}
.note-sources h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0 0 6px;
}
.note-sources ul { margin: 0; padding-left: 18px; }
.note-sources li { margin-bottom: 4px; line-height: 1.5; }
.note-sources a { color: var(--accent); }

/* Inside a practice result: one note after another, compact. */
.note-stack { display: flex; flex-direction: column; gap: 18px; }
.note-inline h4 { font-size: 15px; margin: 0; }
.note-inline .md { font-size: 14px; margin-top: 8px; }
.note-inline .md h2 { font-size: 14.5px; margin-top: 16px; }

@media (max-width: 900px) {
  .notes-wrap { padding: 18px 16px 60px; }
  .note-grid { grid-template-columns: 1fr; }
  .note-reader h1 { font-size: 22px; }
  /* Five tabs at phone width: let the strip scroll instead of wrapping. */
  .tabs { overflow-x: auto; scrollbar-width: none; flex-shrink: 1; min-width: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
}

/* =====================================================================
   Step animations embedded in notes (see animations.js).
   ===================================================================== */

.anim {
  margin: 18px 0 22px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
}
.anim:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.anim-stage svg {
  display: block;
  width: 100%;
  height: auto;
  --lp-ink: var(--text);
  --lp-faint: var(--border);
  --lp-hot: var(--warn);
  --lp-toner: #2a2f36;
  --lp-charge: var(--accent);
  --lp-paper: #ffffff;
  font: 12px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.anim-caption { margin: 12px 2px 0; }
.anim-where {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}
.anim-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  min-height: 2.9em;
}

.anim-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.anim-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.anim-btn:hover:not(:disabled) { border-color: var(--accent); }
.anim-btn:disabled { opacity: .45; cursor: default; }
.anim-play { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 74px; }
.anim-play:hover { filter: brightness(1.08); }

.anim-dots { display: flex; gap: 5px; margin-left: auto; }
.anim-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.anim-dot.is-done { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.anim-dot.is-now  { background: var(--accent); border-color: var(--accent); color: #fff; }

.anim-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- laser printer schematic ---------------------------------------- */

.lp text { fill: var(--muted); text-anchor: middle; font-size: 12px; font-weight: 600; }
.lp .lp-label-out { font-size: 11.5px; }
.lp-part { transition: opacity .4s; }
.lp-part rect, .lp-part path, .lp-part circle, .lp-part polygon {
  fill: var(--surface-2);
  stroke: var(--lp-faint);
  stroke-width: 1.6;
  transition: fill .4s, stroke .4s, opacity .4s;
}
.lp-drum circle { fill: var(--surface); stroke: var(--lp-ink); stroke-width: 2; }
.lp-drum .lp-drum-core { fill: var(--lp-faint); stroke: none; }
.lp-drum text { fill: var(--muted); }

/* Continuous motion: the mirror spins. */
.lp-mirror-spin { transform-box: fill-box; transform-origin: center; animation: lp-spin 2.4s linear infinite; }
@keyframes lp-spin { to { transform: rotate(360deg); } }

/* The beam: on for step 1 only. */
.lp-beam line { stroke: #e11d48; stroke-width: 2; stroke-linecap: round; opacity: 0; transition: opacity .35s; }
.lp[data-step="1"] .lp-beam line { opacity: 1; animation: lp-flicker 1s ease-in-out infinite; }
@keyframes lp-flicker { 50% { opacity: .55; } }

/* The image, charge and toner on the drum travel round together. */
.lp-image-group {
  transform-box: view-box;
  transform-origin: 320px 190px;
  transform: rotate(0deg);
  transition: transform 1.1s cubic-bezier(.4, 0, .2, 1);
}
.lp[data-step="3"] .lp-image-group { transform: rotate(135deg); }
.lp[data-step="4"] .lp-image-group,
.lp[data-step="5"] .lp-image-group,
.lp[data-step="6"] .lp-image-group { transform: rotate(225deg); }
.lp[data-step="7"] .lp-image-group { transform: rotate(315deg); }

.lp-image {
  fill: none;
  stroke: var(--lp-charge);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  opacity: 0;
  transition: stroke-dashoffset .9s ease-out .2s, opacity .3s;
}
.lp[data-step="1"] .lp-image,
.lp[data-step="2"] .lp-image { opacity: 1; stroke-dashoffset: 0; }
.lp[data-step="3"] .lp-image,
.lp[data-step="4"] .lp-image { opacity: .35; stroke-dashoffset: 0; }

.lp-plus { fill: var(--lp-charge) !important; font-size: 13px !important; font-weight: 800 !important; opacity: 0; transition: opacity .4s; }
.lp[data-step="2"] .lp-plus, .lp[data-step="3"] .lp-plus { opacity: 1; }
.lp[data-step="4"] .lp-plus { opacity: .5; }

.lp-toner-drum circle { fill: var(--lp-toner); opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; transition: opacity .35s, transform .35s; }
.lp[data-step="3"] .lp-toner-drum circle,
.lp[data-step="4"] .lp-toner-drum circle { opacity: 1; transform: scale(1); }
.lp[data-step="3"] .lp-toner-drum circle:nth-child(1) { transition-delay: .5s; }
.lp[data-step="3"] .lp-toner-drum circle:nth-child(2) { transition-delay: .65s; }
.lp[data-step="3"] .lp-toner-drum circle:nth-child(3) { transition-delay: .8s; }
.lp[data-step="3"] .lp-toner-drum circle:nth-child(4) { transition-delay: .95s; }
.lp[data-step="3"] .lp-toner-drum circle:nth-child(5) { transition-delay: 1.1s; }
/* A little always stays behind, for the cleaner to collect. */
.lp[data-step="5"] .lp-toner-drum circle:nth-child(2),
.lp[data-step="6"] .lp-toner-drum circle:nth-child(2),
.lp[data-step="5"] .lp-toner-drum circle:nth-child(4),
.lp[data-step="6"] .lp-toner-drum circle:nth-child(4) { opacity: .7; transform: scale(.7); }

/* Toner hopper */
.lp-hopper-dots circle { fill: var(--lp-toner); stroke: none; }
.lp-toner .lp-arrow { fill: none; stroke: var(--lp-ink); stroke-width: 1.8; stroke-linecap: round; opacity: 0; transition: opacity .3s; }
.lp[data-step="3"] .lp-toner .lp-arrow { opacity: 1; }

/* Cleaner */
.lp-tray-dots circle { fill: var(--lp-toner); stroke: none; opacity: 0; transition: opacity .4s .6s; }
.lp[data-step="7"] .lp-tray-dots circle { opacity: 1; }
.lp[data-step="7"] .lp-toner-drum circle { opacity: 0; transform: translate(-14px, 18px) scale(.5); transition-delay: .3s; }
.lp[data-step="7"] .lp-plus { opacity: 0; }

/* Fuser */
.lp-fuser .lp-roller { fill: var(--surface-2); stroke: var(--lp-ink); stroke-width: 1.8; }
.lp-fuser .lp-glow { fill: var(--lp-hot); stroke: none; opacity: 0; transition: opacity .5s; }
.lp[data-step="6"] .lp-fuser .lp-glow { opacity: .28; animation: lp-pulse 1.4s ease-in-out infinite; }
.lp[data-step="6"] .lp-fuser .lp-roller { fill: var(--warn-soft); stroke: var(--lp-hot); }
@keyframes lp-pulse { 50% { opacity: .42; } }

/* Paper */
.lp-path { stroke: var(--lp-faint); stroke-width: 1.4; stroke-dasharray: 4 5; }
.lp-paper {
  transform: translateX(40px);
  transition: transform 1.3s cubic-bezier(.4, 0, .2, 1);
}
.lp[data-step="4"] .lp-paper,
.lp[data-step="5"] .lp-paper { transform: translateX(275px); }
.lp[data-step="6"] .lp-paper { transform: translateX(455px); }
.lp[data-step="7"] .lp-paper { transform: translateX(545px); }
.lp-sheet { fill: var(--lp-paper); stroke: var(--lp-ink); stroke-width: 1.4; }
.lp-paper-charge text { fill: var(--lp-charge); font-size: 12px; font-weight: 800; opacity: 0; transition: opacity .35s; }
.lp[data-step="4"] .lp-paper-charge text { opacity: 1; }
.lp[data-step="5"] .lp-paper-charge text { opacity: 0; transition-delay: 1.2s; }
.lp-pdot { fill: var(--lp-toner); opacity: 0; transition: opacity .35s .5s; }
.lp[data-step="5"] .lp-pdot { opacity: 1; }
.lp-pline { fill: var(--lp-toner); opacity: 0; transition: opacity .5s .6s; }
.lp[data-step="6"] .lp-pline, .lp[data-step="7"] .lp-pline { opacity: 1; }

/* The active part label picks up the accent. */
.lp[data-step="1"] .lp-laser text, .lp[data-step="1"] .lp-mirror text,
.lp[data-step="2"] .lp-drum text,
.lp[data-step="3"] .lp-toner text,
.lp[data-step="4"] .lp-tray-label, .lp[data-step="5"] .lp-tray-label,
.lp[data-step="6"] .lp-fuser text,
.lp[data-step="7"] .lp-cleaner text { fill: var(--accent); }
.lp[data-step="1"] .lp-laser rect, .lp[data-step="1"] .lp-mirror polygon,
.lp[data-step="3"] .lp-toner > path,
.lp[data-step="6"] .lp-fuser .lp-roller,
.lp[data-step="7"] .lp-cleaner rect, .lp[data-step="7"] .lp-cleaner > path { stroke: var(--accent); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .anim-stage svg { --lp-toner: #cfd6df; --lp-paper: #eef1f5; }
}
:root[data-theme="dark"] .anim-stage svg { --lp-toner: #cfd6df; --lp-paper: #eef1f5; }

@media (prefers-reduced-motion: reduce) {
  .lp-mirror-spin, .lp-beam line, .lp-fuser .lp-glow { animation: none !important; }
  .lp *, .lp-paper, .lp-image-group { transition-duration: .01s !important; transition-delay: 0s !important; }

  /* The card still turns, because which face is showing is the whole
     interface, but it turns at once instead of sweeping. */
  .flashcard-inner { transition-duration: .01s !important; }
}

@media (max-width: 900px) {
  .anim { padding: 10px; }
  .anim-dots { margin-left: 0; width: 100%; }
  .anim-text { font-size: 14px; }
}

/* Labels are drawn in viewBox units, so at phone width they shrink with the
   figure; scale them up there so they stay readable. */
@media (max-width: 900px) {
  .lp text { font-size: 19px; }
  .lp .lp-label-out { font-size: 18px; }
  .lp-plus { font-size: 20px !important; }
  .lp-paper-charge text { font-size: 18px; }
}

/* Gap-fill questions: the paragraph is the answer sheet. */
.qcard-gaps { line-height: 2.15; }
.gap { display: inline-flex; align-items: baseline; gap: 3px; margin: 0 2px; vertical-align: baseline; }
.gap-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.6;
}
.gap-input {
  font: inherit;
  font-size: 16px;
  padding: 1px 8px 2px;
  border: 0;
  border-bottom: 2px solid var(--accent);
  border-radius: 6px 6px 0 0;
  background: var(--accent-soft);
  color: var(--text);
  min-width: 110px;
  max-width: 100%;
}
.gap-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.gap-input:disabled { opacity: .8; }

/* The question as printed on the paper. Paper stays white in dark mode; the
   border keeps it from floating. */
.qcard-paper { margin: 4px 0 16px; }
.paper-stem { margin-bottom: 10px; }
.paper-stem .stem-label { margin-bottom: 6px; }
.paper-img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.detail .paper-img { border-radius: 6px; }

/* =====================================================================
   The question body: prose, code, tables and figures.

   Sized mobile-first. The old page crops were 1025px wide and shrank to
   30% on a 375px phone, which put the question at about 6.6px. Everything
   here reflows instead, so the same question is readable at 375px and at
   1400px without zooming.
   ===================================================================== */

.qbody { margin-bottom: 20px; }

.q-prose {
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 14px;
}

.q-prose:last-child { margin-bottom: 0; }

/* Code and pseudocode keep the paper's indentation, so they cannot reflow.
   They scroll sideways inside their own box rather than stretching the
   page, which keeps the rest of the question readable on a phone. */
.q-code {
  margin: 0 0 16px;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.q-code code {
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}

/* A table is a table: it can be read down a column, and the blank cells are
   the ones the student fills in. */
.q-table-wrap {
  margin: 0 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.q-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.q-table th,
.q-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.q-table th {
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}

.q-table tr:first-child th:first-child,
.q-table tr:first-child td:first-child { border-top-left-radius: 7px; }

.cell-input {
  width: 100%;
  min-width: 72px;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-bottom: 2px solid var(--accent);
  border-radius: 4px 4px 0 0;
  background: var(--accent-soft);
  color: var(--text);
}

.cell-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.cell-input:disabled { opacity: .7; }

/* Only a genuine diagram is a picture, cropped to the artwork alone so it
   gets the full width of a phone instead of being a thumbnail of a page. */
.q-figure {
  margin: 0 0 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: zoom-in;
  text-align: center;
}

.q-figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Diagrams are black line art on white, so they keep a white card in dark
   mode rather than becoming invisible. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .q-figure { background: #f7f7f8; }
}
:root[data-theme="dark"] .q-figure { background: #f7f7f8; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 12, 16, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
  overflow: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}

/* ------------------------------------------------- shaped answer boxes */

.answer-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.slot-label {
  flex: none;
  min-width: 22px;
  padding-top: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.slot-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.slot-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.answer-note {
  font-size: 14px;
  color: var(--muted);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .q-prose { font-size: 16px; }
  .q-code { padding: 10px 11px; }
  .q-code code { font-size: 12.5px; }
  /* A figure is the one thing worth letting run to the edges of a phone. */
  .q-figure {
    margin-left: -18px;
    margin-right: -18px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 10px;
  }
  .q-table { font-size: 13px; }
  .q-table th, .q-table td { padding: 7px 8px; }
  .slot-label { min-width: 18px; }
}

/* =====================================================================
   Phone layout.

   Five tabs no longer fit along the top of a 375px screen, and the one
   button that matters in Practice sat below a question the student has to
   scroll past. So on a phone the navigation moves to the bottom, where a
   thumb reaches it, and the submit button sticks above it.
   ===================================================================== */

.tab-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;              /* desktop keeps the plain text tabs */
}

@media (max-width: 760px) {
  /* ---- top bar: title only ---- */
  .topbar {
    height: 52px;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top);
    height: calc(52px + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .brand span { display: inline; font-size: 15px; }
  .subject-chip { display: none; }
  .subject-select { display: inline-block; }
  .topbar-stats { display: none; }

  /* ---- navigation along the bottom, within thumb reach ---- */
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    margin: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 12px rgba(16, 24, 40, .06);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 54px;          /* a comfortable tap target */
    padding: 7px 2px 6px;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 10.5px;
    line-height: 1.2;
    color: var(--muted);
    position: relative;
  }

  .tab-icon { display: block; }
  .tab.is-active { color: var(--accent); background: none; }
  .tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22%;
    right: 22%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--accent);
  }
  .tab-admin { margin-left: 0; opacity: 1; }

  .tab .badge {
    position: absolute;
    top: 4px;
    left: 54%;
    font-size: 9.5px;
    padding: 1px 5px;
    line-height: 1.4;
  }
  .tab .badge.is-zero { display: none; }

  /* Every scrolling surface needs room for the bar that now sits over it. */
  #view-practice.is-active,
  .panel,
  .review-wrap,
  .search-wrap,
  .notes-wrap { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

  .detail { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

  /* ---- the rehearsal warning, shortened so it does not eat the screen ---- */
  .rehearsal-bar {
    padding: 7px 14px;
    font-size: 12px;
    line-height: 1.45;
  }
  .rehearsal-bar .on-desktop { display: none; }

  /* ---- Practice: a full-width action at the end of the card ----
     This was sticky at first, floating above the bottom bar. On a question
     whose answer is a table it then sat on top of the cells the student
     still had to fill in, which is worse than the scrolling it saved. The
     answer control is the last thing on the card anyway, so by the time
     anyone has finished answering, the button is already in view. */
  .qcard-actions {
    margin: 18px -18px -20px;
    padding: 14px 18px calc(16px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    gap: 12px;
  }

  .qcard-actions .btn-lg {
    flex: 1;
    min-height: 46px;
    justify-content: center;
  }

  .qcard-status {
    flex-basis: 100%;
    order: 3;
  }

  /* The run bar reads as a strip, not a row of competing controls. On a
     phone a forty-question set puts more dots in that row than will fit,
     and they squeeze the topic name down to one letter and wrap "End
     session" onto two lines. The dots take a row of their own instead. */
  .run-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 12px;
  }
  .run-where {
    grid-area: 1 / 1;
    font-size: 12px;
    max-width: none;
  }
  .run-bar .link-btn {
    grid-area: 1 / 2;
    white-space: nowrap;
  }
  .run-dots {
    grid-area: 2 / 1 / 3 / 3;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 0;
  }
  .dot { width: 7px; height: 7px; }

  /* Typing areas want a 16px font, or iOS Safari zooms the page in on
     focus and the student is left scrolled sideways. */
  .qcard-answer,
  .slot-input,
  .cell-input,
  .gap-input,
  #search-input { font-size: 16px; }
}

@media (max-width: 420px) {
  .tab span:not(.badge) { font-size: 10px; }
  .qcard { padding: 16px 14px; }
  .qcard-actions { margin-left: -14px; margin-right: -14px; padding: 11px 14px; }
  .q-figure { margin-left: -14px; margin-right: -14px; }
}

/* How many questions a set holds. A choice, not a property of the bank. */
.set-size {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 4px;
}

.set-size-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.seg button {
  font: inherit;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  padding: 7px 16px;
  min-height: 36px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--accent); color: #fff; font-weight: 600; }

@media (max-width: 760px) {
  .set-size { margin-top: 18px; }
  .seg button { padding: 8px 18px; min-height: 42px; }
}

/* An authored practice question, marked as such wherever it appears. A
   student has to know whether they are answering a real Cambridge question. */
.authored-tag {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 6px;
  padding: 5px 9px;
  display: inline-block;
}

.set-concept {
  display: block;
  background: var(--warn-soft);
  border-color: var(--warn);
  margin-bottom: 4px;
}

.set-concept .set-name { display: block; font-size: 17px; color: var(--warn); }
.set-concept .set-sub  { display: block; margin-top: 2px; }

/* Practice aimed at measured weaknesses. Disabled until something has been
   marked, because there is nothing honest to aim at before then. */
.set-weak {
  display: block;
  background: var(--good-soft);
  border-color: var(--good);
  margin-bottom: 10px;
}

.set-weak .set-name { display: block; font-size: 17px; color: var(--good); }
.set-weak .set-sub  { display: block; margin-top: 2px; }

.set-weak:disabled {
  background: var(--surface-2);
  border-color: var(--border);
  cursor: default;
  transform: none;
  box-shadow: none;
}

.set-weak:disabled .set-name { color: var(--muted); }

/* =====================================================================
   Flashcards. The front is a line an examiner wrote with the credited
   term removed, so it is set in the same reading type as a question
   rather than as a label.
   ===================================================================== */

#view-cards.is-active {
  display: block;
  overflow-y: auto;
  padding: 34px 24px 90px;
}

.cards-wrap { max-width: 820px; margin: 0 auto; }

.cards-start h1,
.cards-done h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 4px 0 8px;
}

/* The card is two faces of one object, not a panel that grows a second
   half. Both faces sit in the same grid cell, so the card is as tall as
   the taller of the two and nothing jumps when it turns. */
.flashcard {
  perspective: 1600px;
}

.flashcard-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.2, .8, .25, 1);
}

.flashcard-inner.is-flipped { transform: rotateY(180deg); }

.card-face {
  grid-area: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 30px 26px;
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

/* Both faces are as tall as the taller one, so the card does not change
   size halfway through turning. The spare room goes above and below the
   question rather than all below it, and the buttons stay at the foot of
   both faces, so "Show the answer" and "Got it" land under the same
   pixel and working through a pack needs no aiming. */
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-face-back {
  transform: rotateY(180deg);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

/* A card turns when it is clicked anywhere, which is how a card behaves.
   The button stays, because a target the size of a word is easier to hit
   than one the size of a paragraph and says what will happen. */
.card-face-front { cursor: pointer; }

.card-face-front:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* The next card is dealt in by app.js rather than by a class here, and it
   animates the scene, never .flashcard-inner. An animation on the inner
   would win the cascade over .is-flipped and pin the card face up: a
   keyframe holds its transform whenever it is running or filling, so one
   that stalls (a backgrounded tab is enough) stops the card turning at
   all. The scene cannot collide with the flip. */

.card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.card-count {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.card-topic { font-size: 14px; font-weight: 600; }

.card-origin {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 10px;
}

.card-front {
  font-size: 20px;
  line-height: 1.6;
  margin: 0;
}

/* The blank is the point of the card, so it is drawn rather than implied. */
.card-front::first-line { font-kerning: normal; }

.card-back {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px;
}

/* The back repeats the examiner's sentence with the blank filled in, so
   the word is read in the phrasing that earns the mark rather than on its
   own. */
.card-filled {
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 20px;
}

.card-fill {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 650;
  border-radius: 4px;
  padding: 1px 5px;
}

.card-answer {
  font-size: 24px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.card-note {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* The shortcut has to be said somewhere or it may as well not exist.
   Hidden on a phone, where there is no keyboard to press. */
.card-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.btn-got, .btn-miss {
  padding: 11px 22px;
  font-size: 15px;
  flex: 1;
  justify-content: center;
}

.btn-got  { background: var(--good); border-color: var(--good); color: #fff; }
.btn-miss { background: var(--surface-2); }
.btn-got:hover  { filter: brightness(1.07); }
.btn-miss:hover { border-color: var(--warn); color: var(--warn); }

.miss-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.miss-row b { font-size: 15px; }

@media (max-width: 900px) {
  #view-cards.is-active { padding: 20px 14px 70px; }
  .card-face { padding: 20px 18px; border-radius: 12px; }
  .card-front { font-size: 18px; }
  .card-filled { font-size: 15px; }
  .card-answer { font-size: 21px; }
  .card-origin { margin-left: 0; }
  .card-hint { display: none; }
}

@media (max-width: 760px) {
  #view-cards.is-active { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------------- feedback
 *
 * The owner's "report a problem" panel sits beside the question on a wide
 * screen, always open, and drops under it on a phone. */

.qcard-layout {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}
.qcard-layout .qcard { flex: 1 1 auto; min-width: 0; max-width: 840px; }

.side-panel {
  width: 320px;
  flex: none;
  position: sticky;
  top: 16px;
}
.side-panel:empty { display: none; }

.feedback {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 14px;
}
.feedback h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 12px;
}
.feedback-reasons { display: grid; gap: 8px; margin: 0 0 12px; }
.feedback-reason {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}
.feedback-reason input { margin: 3px 0 0; flex: none; }
.feedback-comment {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.feedback .rcard-actions { margin-top: 10px; }
.feedback-line {
  padding: 8px 0 2px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.feedback-line.is-resolved { color: var(--muted); }

/* Browse: the detail column widens into two columns when there is room. */
.detail.has-side {
  width: 760px;
  display: flex;
  align-items: flex-start;
  gap: 22px;
}
.detail-main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 1400px) {
  .detail.has-side { width: 420px; display: block; }
  .detail.has-side .side-panel { width: auto; position: static; margin-top: 20px; }
}
@media (max-width: 1100px) {
  .qcard-layout { flex-direction: column; }
  .side-panel { width: auto; position: static; }
}

/* ---------------------------------------------------------- tick boxes */

.q-choice { display: grid; gap: 8px; margin: 4px 0 16px; }
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
}
.q-option:hover { background: var(--surface-2); }
.q-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.q-option:has(input:disabled:not(:checked)) { opacity: .55; cursor: default; }
.q-option input { margin: 0; flex: none; width: 18px; height: 18px; }
.q-option-letter { font-weight: 700; min-width: 1.2em; }

/* The shared stem, laid out, inside "Read this first". */
.qbody-stem { margin-bottom: 0; }
.qbody-stem .q-prose { font-size: 15px; line-height: 1.6; margin-bottom: 10px; }
.qbody-stem .q-prose:last-child { margin-bottom: 0; }
.qbody-stem .q-code { background: var(--surface); }

/* The marking procedure's output: demand, model answer, other points. */
.fb-demand { border-left-color: var(--muted); }
.fb-model  { border-left-color: var(--good); background: var(--good-soft); }
.fb-other  { border-left-color: var(--accent); }
.fb-other ul { margin: 4px 0 0; padding-left: 1.2em; display: grid; gap: 3px; }
.mpoint-fullmark { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--good); }
.mpoint-fullmark b { font-weight: 650; }

/* =====================================================================
   Visual refresh and the three roles (student, teacher, parent).
   The teacher's class dashboard and the parent's page are built by
   school.js; the student screens keep their structure and take the new
   look from the tokens at the top and the overrides here.
   ===================================================================== */

/* ---------------------------------------------------------------- header */

.topbar { height: 60px; gap: 18px; box-shadow: 0 1px 0 var(--border); border-bottom: 0; }

.brand { font-weight: 700; font-size: 15.5px; letter-spacing: -.015em; }

.brand-mark {
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: 9px;
  stroke: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.role-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  flex: none;
}

.role-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.role-switch button:hover { color: var(--text); }

.role-switch button.is-active {
  background: var(--text);
  color: var(--surface);
}

.role-switch button:focus-visible,
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tabs { border-radius: 11px; }
.tab { border-radius: 8px; }
.tab[hidden] { display: none; }
.tab.is-active { color: var(--accent); }

/* Question-bank counts are the teacher's business, not the student's. */
body:not([data-role="teacher"]) .topbar-stats { display: none; }
/* Rehearsal marking only affects practice, which a parent never does. */
body[data-role="parent"] .rehearsal-bar { display: none; }
/* Reporting a problem with a question is the teacher's job, not the student's. */
body:not([data-role="teacher"]) #qcard-side { display: none; }
@media (max-width: 1500px) { .topbar-stats { display: none; } }

.rehearsal-bar { font-size: 12.5px; }

/* --------------------------------------------------- student: start page */

.practice-start h1, .practice-done h1 { font-size: 34px; letter-spacing: -.025em; }

.set-card { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }

.set-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.set-mixed {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  padding: 24px 24px 22px;
  box-shadow: 0 10px 30px rgba(37, 87, 214, .25);
}

.set-mixed .set-name { font-size: 21px; letter-spacing: -.01em; }

.set-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  margin-bottom: 6px;
}

.start-heading { font-size: 11.5px; font-weight: 700; }

/* The three ways to start, side by side as equals. */
.start-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.start-options .set-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 20px;
  min-height: 150px;
}

.start-options .set-name { font-size: 18px; }

.set-icon {
  width: 38px;
  height: 38px;
  padding: 8px;
  margin-bottom: 10px;
  border-radius: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  background: rgba(255, 255, 255, .18);
}

.set-weak .set-icon { color: var(--good); background: var(--surface); }
.set-concept .set-icon { color: var(--warn); background: var(--surface); }
.set-weak:disabled .set-icon { color: var(--muted); }
.set-mixed .set-icon { color: #fff; }

@media (max-width: 760px) {
  .start-options { grid-template-columns: 1fr; }
  .start-options .set-card { min-height: 0; }
}

.qcard { border-radius: var(--radius); box-shadow: var(--shadow); }

.btn { border-radius: 10px; }
.btn-sm { font-size: 12.5px; padding: 6px 12px; text-decoration: none; display: inline-block; }
a.btn { color: var(--text); }
a.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }

.toast { border-radius: 12px; padding: 11px 18px; }

/* ------------------------------------------------------- dashboard frame */

#view-teacher.is-active,
#view-mytests.is-active,
#view-carddrafts.is-active,
#view-parent.is-active { display: block; overflow-y: auto; }

.dash {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 28px 90px;
}

.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.dash-head h1 { font-size: 30px; letter-spacing: -.025em; margin: 2px 0 0; line-height: 1.2; }
.dash-head .lede { margin: 8px 0 0; }

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.person-head { justify-content: flex-start; align-items: center; }
.person-head .band { margin-left: auto; }

.dash-select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* The teacher's navigation bar, campus buttons and question buttons (2026-10-27). */
.tnav { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 16px; }
.tnav-crumbs { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-size: 14px; }
.tnav-crumb { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent); padding: 4px 2px; cursor: pointer; }
.tnav-crumb:hover { text-decoration: underline; }
.tnav-crumb.is-here { color: var(--text); cursor: default; text-decoration: none; }
.tnav-sep { color: var(--muted); }
.tnav-pick { display: flex; align-items: center; gap: 8px; }
.tnav-campus small { opacity: .75; margin-left: 2px; font-size: 11.5px; }
.qstrip { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0 0 18px; }
.qchips { display: flex; gap: 6px; flex-wrap: wrap; }
.qchip {
  appearance: none; font: inherit; font-size: 13px; font-weight: 700; display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 11px; min-height: 34px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer;
}
.qchip small { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.qchip:hover { border-color: var(--accent); }
.qchip-good { box-shadow: inset 0 -3px 0 var(--good); }
.qchip-mid { box-shadow: inset 0 -3px 0 var(--warn); }
.qchip-bad { box-shadow: inset 0 -3px 0 var(--bad); }
.qchip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.qchip.is-on small { color: #fff; opacity: .85; }
.rr-test + .rr-test { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.rr-top { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rr-top .btn { margin-left: auto; }
.rr-test .qstrip { margin-bottom: 4px; }
.heat-q { appearance: none; border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; padding: 0; }
.heat-q:hover { text-decoration: underline; }
.heat-cell.is-link { cursor: pointer; }
.heat-cell.is-link:hover, .heat-cell.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cq-card.is-focus { box-shadow: 0 0 0 3px var(--accent); }

.back-link {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0;
  margin-bottom: 14px;
  cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

.muted { color: var(--muted); }

/* KPI tiles: the headline numbers. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }

.kpi-value {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.kpi-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kpi-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-good .kpi-value { color: var(--good); }

/* Two columns: the main story and the side panels. */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.dash-main, .dash-side { display: grid; gap: 18px; min-width: 0; }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  min-width: 0;
}

.pc-head { margin-bottom: 14px; }
.pc-head h2 { font-size: 17px; letter-spacing: -.01em; margin: 0; }
.pc-head p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }

.dash-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
}

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* ----------------------------------------------------------- roster table */

.roster { width: 100%; border-collapse: collapse; font-size: 14px; }

.roster th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
}

.roster td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.roster tr:last-child td { border-bottom: 0; }
.roster tr.is-link { cursor: pointer; }
.roster tr.is-link:hover td { background: var(--surface-2); }
.roster tr.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.roster .num { text-align: right; width: 1%; }
.roster td:nth-child(2) { width: 34%; }

.who { display: flex; align-items: center; gap: 11px; }
.who b { display: block; font-weight: 650; }
.who small { color: var(--muted); font-size: 12px; }

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.avatar-lg { width: 56px; height: 56px; font-size: 19px; }

.topic-tag {
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.dpill {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-soft);
}

/* --------------------------------------------------------- score bars */

.score-cell { display: flex; align-items: center; gap: 10px; }
.score-cell .sbar { flex: 1; }

.score-num {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sbar {
  position: relative;
  height: 8px;
  min-width: 60px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.sbar-fill, .sbar-lenient { position: absolute; top: 0; bottom: 0; left: 0; }
.sbar-fill { background: var(--accent); border-radius: 999px; }

.sbar-lenient {
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 45%, transparent) 0 3px,
    color-mix(in srgb, var(--accent) 20%, transparent) 3px 6px);
  border-left: 2px solid var(--surface);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 12px;
}

.legend > span { display: inline-flex; align-items: center; gap: 6px; }

.sw { display: inline-block; width: 18px; height: 8px; border-radius: 999px; }
.sw-fill { background: var(--accent); }
.sw-lenient {
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 45%, transparent) 0 3px,
    color-mix(in srgb, var(--accent) 20%, transparent) 3px 6px);
}
.sw-flag { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }

/* Status bands always carry an icon and a word, never colour alone. */
.band {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  white-space: nowrap;
}

.band-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 10px;
  color: #fff;
}

.band-mastered    { color: var(--good); background: var(--good-soft); }
.band-mastered .band-icon { background: var(--good); }
.band-solid       { color: var(--accent); background: var(--accent-soft); }
.band-solid .band-icon { background: var(--accent); }
.band-partial     { color: var(--warn); background: var(--warn-soft); }
.band-partial .band-icon { background: var(--warn); }
.band-not_grasped { color: var(--bad); background: var(--bad-soft); }
.band-not_grasped .band-icon { background: var(--bad); }

/* ----------------------------------------------------------- topic rows */

.trows { display: grid; gap: 4px; }

.trow {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(90px, 1fr) auto 120px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.trow:last-child { border-bottom: 0; }
.trow-name { font-size: 14px; font-weight: 600; }
.trow-code { color: var(--accent); font-weight: 750; margin-right: 8px; font-variant-numeric: tabular-nums; }
.trow .band { justify-self: start; }

/* ------------------------------------------------------- hardest questions */

.hard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hard-list li { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.hard-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.hard-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.hard-top .muted { font-size: 12.5px; }
.hard-pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.hard-q { font-size: 13.5px; margin: 8px 0 4px; }
.hard-miss { font-size: 13px; color: var(--muted); margin: 0; }
.hard-miss b { color: var(--warn); }

/* ------------------------------------------------------------- decisions */

.dec-list { display: grid; gap: 12px; }

.decision {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--surface);
}

.dec-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.dec-part { color: var(--muted); }

.dec-range {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.dec-flag { font-size: 13.5px; margin: 8px 0; }

.dec-more { font-size: 13px; margin-bottom: 10px; }
.dec-more summary { color: var(--accent); cursor: pointer; font-weight: 600; }
.dec-more p { margin: 6px 0; }
.dec-q { white-space: pre-line; color: var(--muted); }

.dec-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 14px 0 4px !important;
}

.panel-card blockquote {
  margin: 0;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  white-space: pre-line;
  font-size: 13.5px;
}

.panel-card blockquote.model {
  background: var(--good-soft);
  border-left: 3px solid var(--good);
}

.dec-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.mark-pick { display: flex; gap: 6px; }

.mark-opt {
  appearance: none;
  display: grid;
  justify-items: center;
  min-width: 52px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  line-height: 1.2;
}

.mark-opt b { font-size: 16px; }
.mark-opt small { font-size: 10.5px; color: var(--muted); }
.mark-opt:hover { border-color: var(--accent); }
.mark-opt.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------------------------------------------------------------- tests */

.test-list { display: grid; gap: 10px; }

.test-card {
  appearance: none;
  display: grid;
  gap: 6px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}

.test-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.test-card .muted { font-size: 12.5px; }
.test-card .go { font-size: 12.5px; font-weight: 650; color: var(--accent); }

/* ------------------------------------------- the class grid for one test */

.heat { border-collapse: separate; border-spacing: 3px; font-size: 13px; min-width: 100%; }

.heat th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 6px;
  white-space: nowrap;
  text-align: center;
}

.heat th small { display: block; font-weight: 500; font-size: 10.5px; }
.heat .heat-name { text-align: left; color: var(--text); font-size: 13.5px; font-weight: 600; padding-right: 12px; }
.heat .heat-name .link-btn { color: var(--text); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.heat .heat-name .link-btn:hover { color: var(--accent); text-decoration: underline; }

.heat-cell {
  position: relative;
  min-width: 46px;
  height: 38px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 7px;
  color: var(--heat-ink-dark);
}

.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); color: #fff; }
.heat-4 { background: var(--heat-4); color: #fff; }
.heat-5 { background: var(--heat-5); color: var(--heat-ink-5); }
.heat-cell.heat-0 { box-shadow: inset 0 0 0 1px var(--border); }

.heat-cell.is-flag::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px var(--surface);
}

.heat-total { font-weight: 750; text-align: center; padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.heat-avg td { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 6px; }
.heat-avg th { color: var(--muted) !important; font-size: 12px !important; }

.heat-scale { display: inline-flex; gap: 2px; }
.heat-scale i { display: inline-block; width: 16px; height: 12px; border-radius: 3px; }
.heat-scale .heat-0 { box-shadow: inset 0 0 0 1px var(--border); }

/* ------------------------------------------------ question by question */

.dq-list, .ans-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.dash-main > *, .dash-side > *, .dq-list > *, .ans-list > * { min-width: 0; }

.dq-item, .ans {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.dq-item summary, .ans summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
}

.dq-item summary::-webkit-details-marker, .ans summary::-webkit-details-marker { display: none; }
.dq-item[open] summary, .ans[open] summary { border-bottom: 1px solid var(--border); }
.dq-item summary:hover, .ans summary:hover { background: var(--surface-2); border-radius: 12px; }

.dq-num {
  flex: none;
  min-width: 64px;
  font-weight: 750;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.dq-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dq-pct { font-weight: 700; font-variant-numeric: tabular-nums; }

.dq-body, .ans-body { padding: 4px 16px 16px; font-size: 14px; }
.dq-body p, .ans-body p { margin: 8px 0; }
.dq-full { white-space: pre-line; }

.mark {
  flex: none;
  font-size: 12.5px;
  font-weight: 750;
  border-radius: 999px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mark-good { color: var(--good); background: var(--good-soft); }
.mark-mid  { color: var(--warn); background: var(--warn-soft); }
.mark-bad  { color: var(--bad);  background: var(--bad-soft); }
.ans-good { border-left: 3px solid var(--good); }
.ans-mid  { border-left: 3px solid var(--warn); }
.ans-bad  { border-left: 3px solid var(--bad); }

.missed { margin: 4px 0 8px; padding-left: 20px; }
.missed li { margin: 6px 0; }
.fullmark { display: block; color: var(--good); margin-top: 3px; }

.guidance {
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.flag-note { padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); font-size: 13.5px; }

.script-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.script-actions .muted { font-size: 12.5px; }

.steps { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.steps p { margin: 3px 0 0; font-size: 13.5px; }

/* ------------------------------------------------------------ parent hero */

.viewing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 18px;
}

.viewing small { font-weight: 500; font-size: 12px; }

.hero-card {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 24px 26px;
  margin-bottom: 26px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 36px rgba(37, 87, 214, .25);
}

.hero-card h2 { font-size: 21px; letter-spacing: -.015em; margin: 0 0 6px; line-height: 1.35; }
.hero-card p { margin: 0; color: rgba(255, 255, 255, .9); font-size: 14.5px; }

/* A ring to the strict share, and a faint run on to the lenient one. */
.hero-ring {
  flex: none;
  position: relative;
  display: grid;
  place-content: center;
  text-align: center;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
}

.hero-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .5) 0 calc(var(--pl) * 1%),
                             rgba(255, 255, 255, .2) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
}

.hero-ring span { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.hero-ring small { font-size: 11px; opacity: .9; margin-top: 4px; }

/* ------------------------------------------------------- student: my tests */

.my-score { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.my-score b { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.my-score small { color: var(--muted); font-size: 13px; }

/* One test: question cards on the left, the model answer box on the right. */
.mt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 22px;
  align-items: start;
}

.mt-cards { display: grid; gap: 14px; min-width: 0; }

.mt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.mt-card-good { border-left-color: var(--good); }
.mt-card-mid  { border-left-color: var(--warn); }
.mt-card-bad  { border-left-color: var(--bad); }
.mt-card.is-current { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-lg); }

.mt-head { display: flex; align-items: center; gap: 10px; }
.mt-num { font-weight: 800; font-size: 16px; color: var(--accent); margin-right: auto; }

.mt-dots { display: inline-flex; gap: 4px; }
.mt-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.mt-dots i.on { background: var(--good); }

.mt-q { margin: 8px 0 12px; font-size: 14px; color: var(--muted); white-space: pre-line; }

.mt-claims { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mt-claim { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.45; }
.mt-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  margin-top: 1px;
}
/* Each kind of statement has its own look: icon colour and text style. */
.mt-claim-got   .mt-mark { color: var(--good); background: var(--good-soft); }
.mt-claim-wrong .mt-mark,
.mt-claim-blank .mt-mark { color: var(--bad); background: var(--bad-soft); }
.mt-claim-none  .mt-mark { color: var(--muted); background: var(--surface-2); }

.mt-label { font-weight: 700; color: var(--text); }
.mt-words { border-radius: 4px; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mt-words-got { background: var(--good-soft); color: var(--text); }
.mt-words-wrong { background: var(--bad-soft); color: var(--text); }
.mt-words-short { color: var(--text); }
.mt-claim-short .mt-mark { color: var(--warn); background: var(--warn-soft); }
.mt-strike {
  color: var(--bad);
  text-decoration: line-through;
  text-decoration-color: var(--bad);
  text-decoration-thickness: 2px;
}
.mt-point { border-bottom: 2px solid var(--good); padding: 0 1px; }
.mt-point-lost { border-bottom-color: var(--warn); }
.mt-pnum { font-size: 0.78em; font-weight: 800; color: var(--good); margin-right: 1px; }
.mt-point-lost .mt-pnum { color: var(--warn); }
.mt-points { list-style: none; margin: 6px 0 2px; padding: 0; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.mt-points b { color: var(--text); }
.mt-cmark {
  margin-left: auto; align-self: start; flex: none; min-width: 20px; text-align: center;
  font-size: 12px; font-weight: 800; border-radius: 6px; padding: 1px 6px;
}
.mt-cmark-got  { color: var(--good); background: var(--good-soft); }
.mt-cmark-lost { color: var(--bad);  background: var(--bad-soft); }
.mt-words-blank { color: var(--muted); font-style: italic; }
.mt-words-none  { color: var(--muted); }

/* The key above the cards. */
.mt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}
.mt-key { display: inline-flex; align-items: center; gap: 7px; }
.mt-key .mt-mark { width: 20px; height: 20px; font-size: 12px; margin: 0; }

/* Feedback popup: each statement that lost a mark, with the fix under it. */
.mt-fixes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mt-fix {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}
.mt-fix.mt-claim-wrong, .mt-fix.mt-claim-blank { border-left: 4px solid var(--bad); }
.mt-fix.mt-claim-short { border-left: 4px solid var(--warn); }
.mt-fix.mt-claim-none  { border-left: 4px solid var(--border); }
.mt-fix.mt-claim-got   { border-left: 4px solid var(--good); }
.mt-fix-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mt-fix-top .mt-mark { margin: 0; }
.mt-chip { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.mt-claim-wrong .mt-chip, .mt-claim-blank .mt-chip { color: var(--bad); }
.mt-claim-short .mt-chip { color: var(--warn); }
.mt-claim-none  .mt-chip { color: var(--muted); }
.mt-fix-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.mt-wrote { line-height: 1.5; }
.mt-instead {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--good-soft);
  line-height: 1.5;
}
.mt-instead .mt-fix-label { color: var(--good); }
.mt-why { margin: 9px 0 0; font-size: 13.5px; color: var(--muted); }
/* Partial answer: the mark is given, but the answer says what, not how. */
.mt-partial {
  flex: none;
  align-self: center;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
}
.btn-partial { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); color: var(--warn); }
.mt-fix.mt-claim-partial { border-left: 4px solid var(--warn); }
.mt-claim-partial .mt-mark { color: var(--good); background: var(--good-soft); }
.mt-claim-partial .mt-chip { color: var(--warn); }

.mt-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn-feedback { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); color: var(--bad); }
.btn-feedback:hover { border-color: var(--bad); }
.mt-full { font-size: 13px; font-weight: 700; color: var(--good); }
.btn-model { display: none; }

.mt-model {
  position: sticky;
  top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--good);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}
.mt-model-kicker { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--good); }
.mt-model-text { white-space: pre-line; margin: 10px 0 0; font-size: 14.5px; line-height: 1.55; }
.mt-model-also { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13.5px; }
.mt-model-also ul { margin: 6px 0 0; padding-left: 18px; }
.mt-model-also li { margin: 4px 0; }

/* The feedback and model-answer popup. */
.mt-pop {
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.mt-pop::backdrop { background: rgba(10, 15, 25, .45); }
.mt-pop-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mt-pop-head h2 { font-size: 17px; margin: 0; flex: 1; }
.mt-pop-x {
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.mt-pop-body { padding: 6px 18px 18px; font-size: 14.5px; }
.mt-pop-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 10px; }
.mt-ask { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.mt-pop .guidance { margin-top: 16px; }

@media (max-width: 1000px) {
  .mt-layout { grid-template-columns: minmax(0, 1fr); }
  .mt-model { display: none; }
  .btn-model { display: inline-flex; }
}

/* --------------------------------------------------------- card drafts */

.cd-file { margin-bottom: 34px; }
.cd-file-title { font-size: 20px; margin: 0 0 14px; }
.cd-set { margin-bottom: 26px; }
.cd-set-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cd-set-head h3 { font-size: 16px; margin: 0; }
.cd-progress { font-size: 13px; color: var(--muted); font-weight: 600; }
.cd-list { display: grid; gap: 14px; }

.cd-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cd-card.is-right  { border-left-color: var(--good); }
.cd-card.is-change { border-left-color: var(--warn); }
.cd-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800;
}

.cd-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.cd-preview {
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
}
.cd-front { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.cd-flip { margin-bottom: 4px; }
.cd-back { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.cd-answer { margin: 0 0 8px; line-height: 1.55; }
.cd-note { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); font-style: italic; }
.cd-words { margin: 10px 0; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-chip {
  font-size: 12.5px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--good);
  background: var(--good-soft);
}
.cd-tips {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-soft);
}
.cd-tips .cd-label { color: var(--warn); }
.cd-tips ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.cd-tips li { margin: 4px 0; }

.cd-review { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; min-width: 0; }
.cd-ask { padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); }
.cd-ask .cd-label { color: var(--warn); }
.cd-ask p { margin: 0; }
.cd-src summary { cursor: pointer; font-weight: 650; color: var(--muted); }
.cd-src p { margin: 6px 0 0; color: var(--muted); }
.cd-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cd-said { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.cd-when { font-size: 12px; color: var(--muted); }
.cd-pill { font-size: 11.5px; font-weight: 750; padding: 2px 8px; border-radius: 999px; }
.cd-pill-right { color: var(--good); background: var(--good-soft); }
.cd-pill-change { color: var(--warn); background: var(--warn-soft); }
.cd-pill-note { color: var(--accent); background: var(--accent-soft); }

.cd-verdicts { display: flex; gap: 8px; flex-wrap: wrap; }
.cd-verdict {
  font: inherit;
  font-weight: 650;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.cd-ok.is-on { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.cd-ch.is-on { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.cd-text, .cd-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.cd-actions { display: flex; justify-content: flex-end; }

.cd-new {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.cd-new h3 { margin: 0; font-size: 15px; }

.cd-file-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cd-file-head .cd-file-title { margin: 0; }
.cd-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
ul.cd-points { margin: 0 0 8px; padding-left: 20px; text-align: left; }
ul.cd-points li { margin: 5px 0; padding-left: 2px; }
ul.cd-points li::marker { color: var(--accent); }

/* Marked examples on a card: real answers, no names, three symbols. */
.cd-examples { margin-top: 12px; text-align: left; }
.cd-ex-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.cd-ex-key > span { display: inline-flex; align-items: center; gap: 5px; }
.cd-ex-key .mt-mark { width: 18px; height: 18px; font-size: 11px; margin: 0; }
.cd-ex-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cd-ex {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
}
.cd-ex.cd-ex-right   { border-left: 4px solid var(--good); }
.cd-ex.cd-ex-partial { border-left: 4px solid var(--warn); }
.cd-ex.cd-ex-wrong   { border-left: 4px solid var(--bad); }
.cd-ex-right .mt-mark   { color: var(--good); background: var(--good-soft); }
.cd-ex-partial .mt-mark { color: var(--warn); background: var(--warn-soft); }
.cd-ex-wrong .mt-mark   { color: var(--bad);  background: var(--bad-soft); }
.cd-ex-verdict { display: block; font-size: 11.5px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.cd-ex-answer { margin: 3px 0 0; font-size: 14px; line-height: 1.5; }
.cd-ex-fb { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.cd-ex-better { margin: 6px 0 0; font-size: 13px; padding: 6px 9px; border-radius: 8px; background: var(--good-soft); }

/* The card player: the pack dealt one card at a time over the page. */
.deck {
  width: min(1240px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 18px 22px 20px;
  border: 0;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(10, 15, 25, .35);
  overflow-x: hidden;
}
.deck::backdrop { background: rgba(10, 15, 25, .55); backdrop-filter: blur(3px); }
.deck-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.deck-topic { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.deck-where { font-size: 14px; font-weight: 650; }
.deck-dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.deck-stage { touch-action: pan-y; user-select: none; }
.deck-stage .card-face { min-height: 330px; }
.deck-q { font-size: 15px; font-weight: 700; color: var(--muted); margin: 0 0 12px; }
.deck-answer { font-size: 17px; line-height: 1.55; }
.deck-back { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 4px 32px; align-items: start; }
.deck-back > :not(.deck-col) { grid-column: 1 / -1; }
.deck-col { min-width: 0; }
.deck-col .cd-words:first-child { margin-top: 0; }
#carddrafts-root.dash { max-width: 1600px; }
.deck-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.deck-keys { font-size: 12px; color: var(--muted); text-align: center; }
.deck-nav:disabled { opacity: .4; cursor: default; }

/* On the turned card the key words pop in one after another. Only the
   chips animate, never .flashcard-inner, so the flip cannot be pinned. */
.deck .is-flipped .cd-chip {
  animation: chip-in .32s cubic-bezier(.2, .8, .25, 1) both;
  animation-delay: calc(.38s + var(--i, 0) * 55ms);
}
.deck .is-flipped .cd-tips { animation: tips-in .4s ease-out .5s both; }
@keyframes chip-in { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes tips-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.deck-done { text-align: center; padding: 34px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.deck-done-mark {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; font-weight: 800;
  color: var(--good); background: var(--good-soft);
}
.deck-done h3 { margin: 0 0 6px; font-size: 20px; }
.deck-done p { margin: 0 auto 16px; max-width: 420px; color: var(--muted); }
.deck-done-actions { display: flex; justify-content: center; gap: 10px; }

@media (prefers-reduced-motion: reduce) {
  .deck .is-flipped .cd-chip, .deck .is-flipped .cd-tips { animation: none; }
}

@media (max-width: 900px) {
  .deck-back { grid-template-columns: minmax(0, 1fr); }
  .cd-card { grid-template-columns: minmax(0, 1fr); }
  .cd-num { display: none; }
  .deck { padding: 14px 14px 16px; }
  .deck-keys { display: none; }
  .deck-stage .card-face { min-height: 280px; }
}

/* ------------------------------------------------------- concept notes */

/* A phrase with a concept note: dotted underline; hover or tap explains it. */
.concept {
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: help;
  border-radius: 3px;
}
.concept:hover, .concept:focus-visible { background: var(--accent-soft); outline: none; }
/* Inside a struck-out wrong answer, keep the strike and add the dots. */
.mt-strike .concept { text-decoration: line-through underline dotted; text-decoration-color: var(--bad); }

.concept-pop {
  position: fixed;
  z-index: 1000;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  line-height: 1.5;
  text-align: left;
  font-style: normal;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.concept-pop b { display: block; font-size: 14px; margin-bottom: 6px; color: var(--accent); }
.concept-pop p { margin: 0 0 7px; }
.concept-pop .concept-write { margin: 8px 0 0; padding: 7px 9px; border-radius: 8px; background: var(--good-soft); }
.concept-pop .concept-write span { font-weight: 700; color: var(--good); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .role-switch button { padding: 5px 9px; font-size: 12px; }
  .dash { padding: 22px 16px 90px; }
  .dash-head h1 { font-size: 24px; }
  .trow { grid-template-columns: 1fr auto; }
  .trow .sbar { grid-column: 1 / -1; grid-row: 2; }
  .trow .band { display: none; }
  .hide-sm { display: none; }
}

/* On a phone the tabs sit along the bottom (see the 760px block above), so
   the header holds the brand and syllabus on one row and the role switch
   on a second. */
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; row-gap: 8px; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .brand { min-width: 0; flex: 1; }
  .subject-select { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .role-switch { width: 100%; }
  .role-switch button { flex: 1; }
}

@media (max-width: 600px) {
  .brand > span { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 21px; }
  .hero-card { flex-direction: column; align-items: flex-start; padding: 20px; }
  .roster td:nth-child(2) { width: auto; }
  .person-head .band { margin-left: 0; }
}

/* ----------------------------------------------- class, one question */
/* Every student's answer to one question beside the scheme and the
 * grammar it was graded against (school.js, teacherQuestion). */
.cq-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
/* On a phone the question head must not run off the screen (2026-10-27). */
.dash-head > div { min-width: 0; max-width: 100%; }
.dash-head .kicker { overflow-wrap: anywhere; }
@media (max-width: 600px) { .cq-select { flex-basis: 100%; order: -1; } }
.cq-select {
  flex: 1 1 320px; min-width: 0; max-width: 640px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px;
}
.dash-actions { margin-top: 12px; }
.cq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 18px; align-items: start; }
.cq-main { min-width: 0; display: grid; gap: 14px; }
.cq-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; display: grid; gap: 14px; }
.cq-list { display: grid; gap: 12px; }
.cq-card .mt-head { flex-wrap: wrap; }
.cq-name { font-weight: 600; font-size: 15px; margin-right: auto; }
.cq-cmark {
  margin-left: auto; align-self: start; flex: none; min-width: 18px; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 0 4px;
}
.cq-disc { background: var(--warn-soft); color: var(--warn); }
.cq-why { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.cq-why > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.cq-why blockquote { margin: 8px 0; white-space: pre-wrap; }
.cq-scheme, .cq-grammar {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 10px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  color: var(--text);
}
.cq-gsec { margin: 6px 0; }
.cq-gsec > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.cq-gsec > summary small { color: var(--muted); font-weight: 400; }
@media (max-width: 1000px) {
  .cq-grid { grid-template-columns: minmax(0, 1fr); }
  .cq-side { position: static; max-height: none; }
}

/* The strict / lenient switch above the teacher's class pages. */
.mode-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.mode-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mode-note { font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .mode-note { flex-basis: 100%; } }

/* A program answer marked line by line: student's code beside the corrected code. */
.mk-key { font-size: .85rem; color: var(--muted, #5a6573); margin: 0 0 6px; }
.mk-grid { display: grid; grid-template-columns: 1fr 16px 1fr; font-family: ui-monospace, "Courier Prime", Consolas, monospace;
  font-size: .85rem; border-radius: 6px; overflow: hidden; }
.mk-hd { font-size: .78rem; font-weight: 700; padding: 4px 8px; opacity: .75; background: rgba(127,127,127,.12); }
.mk-c { padding: 1px 8px; white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.mk-l { background: rgba(127,127,127,.08); }
.mk-r { border-inline: 1px solid rgba(127,127,127,.25); }
.mk-g, .mk-yes { color: #1b7f2a; font-weight: 700; }
.mk-o { color: #d35f00; font-weight: 700; }
.mk-no { color: #c62828; }
.mk-gut { text-align: center; font-weight: 700; font-size: .75rem; }
.mk-gut.mk-g { color: #1b7f2a; } .mk-gut.mk-o { color: #d35f00; }
.mk-tg { background: rgba(27,127,42,.13); } .mk-to { background: rgba(211,95,0,.13); }
.mk-x { opacity: .55; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mk-chip { font-size: .8rem; border: 1px solid currentColor; border-radius: 12px; padding: 1px 8px; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.mk-g, .mk-yes, .mk-gut.mk-g) { color: #6fdc7f; }
  :root:not([data-theme="light"]) :is(.mk-o, .mk-gut.mk-o) { color: #ffa040; }
  :root:not([data-theme="light"]) .mk-no { color: #ef5350; }
}
:root[data-theme="dark"] :is(.mk-g, .mk-yes, .mk-gut.mk-g) { color: #6fdc7f; }
:root[data-theme="dark"] :is(.mk-o, .mk-gut.mk-o) { color: #ffa040; }
:root[data-theme="dark"] .mk-no { color: #ef5350; }
@media (max-width: 560px) { .mk-grid { font-size: .72rem; } }

/* ------------------------------------------------------------ signing in
 * The first screen anyone sees, in the new look (violet and mint, Sora and
 * Plus Jakarta Sans) ahead of the rest of the app moving to it. */
body.signed-out > header, body.signed-out > main, body.signed-out > .rehearsal-bar { display: none; }
.signin {
  --si-violet: #6d4aff; --si-violet-ink: #4a2fd6; --si-mint: #3ee0a8; --si-ink: #1b1534;
  --si-muted: #6b6488; --si-line: #e6e0fa; --si-card: #ffffff; --si-bg: #f6f4ff; --si-bad: #b3362b; --si-bad-soft: #ffe2de;
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(60rem 40rem at 110% -10%, rgba(109, 74, 255, .28), transparent 60%),
    radial-gradient(40rem 30rem at -10% 110%, rgba(62, 224, 168, .22), transparent 60%),
    var(--si-bg);
  color: var(--si-ink);
  font-family: "Plus Jakarta Sans", var(--font);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signin {
    --si-violet: #9d87ff; --si-violet-ink: #c4b6ff; --si-ink: #efebff; --si-muted: #a59dc9;
    --si-line: #2d2650; --si-card: #1a1532; --si-bg: #100c20; --si-bad: #ffa79d; --si-bad-soft: #3e1d22;
  }
}
:root[data-theme="dark"] .signin {
  --si-violet: #9d87ff; --si-violet-ink: #c4b6ff; --si-ink: #efebff; --si-muted: #a59dc9;
  --si-line: #2d2650; --si-card: #1a1532; --si-bg: #100c20; --si-bad: #ffa79d; --si-bad-soft: #3e1d22;
}
.signin-card {
  width: 100%; max-width: 400px; background: var(--si-card); border: 1px solid var(--si-line);
  border-radius: 24px; padding: 32px 28px; box-shadow: 0 30px 60px -30px rgba(27, 21, 52, .45);
  display: grid; gap: 18px;
}
.signin-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(140deg, #5233f0, #9a7dff); color: #fff;
}
.signin-mark svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.signin form { display: grid; gap: 8px; }
.signin h1 { margin: 0 0 2px; font: 700 1.6rem/1.2 "Sora", var(--font); letter-spacing: -.01em; }
.signin-lede { margin: 0 0 10px; color: var(--si-muted); }
.signin label { font-size: .82rem; font-weight: 700; margin-top: 6px; }
.signin input {
  font: inherit; color: var(--si-ink); background: var(--si-bg); border: 1px solid var(--si-line);
  border-radius: 12px; padding: 12px 14px; width: 100%;
}
.signin input:focus { outline: 2px solid var(--si-violet); outline-offset: 1px; border-color: transparent; }
.signin-hint, .signin-help { margin: 0; font-size: .8rem; color: var(--si-muted); }
.signin-help { margin-top: 10px; text-align: center; }
.signin-error { margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--si-bad-soft); color: var(--si-bad); font-size: .88rem; font-weight: 600; }
.signin-btn {
  margin-top: 14px; border: 0; border-radius: 999px; padding: 13px 18px; cursor: pointer;
  font: 700 1rem "Plus Jakarta Sans", var(--font); background: var(--si-violet); color: #fff;
}
.signin-btn:hover { filter: brightness(1.06); }
.signin-btn:focus-visible { outline: 3px solid var(--si-mint); outline-offset: 2px; }
.signin-link { border: 0; background: none; color: var(--si-violet-ink); font: 700 .9rem "Plus Jakarta Sans", var(--font); cursor: pointer; padding: 8px; }

/* Only the admin can switch roles (to preview); everyone else has one. */
body:not([data-admin="1"]) .role-switch { display: none; }

/* Who is signed in, top right. */
.account { position: relative; margin-left: 12px; flex: none; }
.topbar-stats:empty + .account, body:not([data-role="teacher"]) .account { margin-left: auto; }
.account-btn {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; color: var(--text);
}
.account-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #6d4aff; color: #fff; font: 700 12px "Sora", var(--font);
}
.account-name { font-size: 13px; font-weight: 600; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 8px; display: grid; gap: 2px;
}
.account-who { margin: 4px 8px 8px; font-size: 12.5px; color: var(--muted); }
.account-menu > button {
  border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 9px;
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.account-menu > button:hover { background: var(--surface-2); }
.account-setting {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  padding: 10px; margin-bottom: 4px; border-radius: 10px; background: var(--surface-2); cursor: pointer;
}
.account-setting input { margin-top: 3px; accent-color: #6d4aff; width: 16px; height: 16px; }
.account-setting b { display: block; font-size: 13.5px; }
.account-setting small { color: var(--muted); font-size: 12px; line-height: 1.4; }
@media (max-width: 720px) { .account-name { display: none; } .account-btn { padding: 3px; } }

/* These set their own display, which would otherwise beat the hidden attribute. */
.signin[hidden], .signin form[hidden], .signin-error[hidden], .signin-link[hidden],
.account[hidden], .account-menu[hidden], .account-setting[hidden] { display: none; }

/* "Continue with Google" on the sign-in card. */
.signin-google { display: grid; gap: 12px; justify-items: center; margin: 4px 0 2px; }
.signin-google[hidden], .signin input[hidden], .signin label[hidden] { display: none; }
#google-button { min-height: 44px; }
.signin-newrole { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center; font-size: .82rem; color: var(--si-muted); }
.signin-newrole legend { float: left; margin-right: 4px; padding: 0; }
.signin .signin-newrole label { margin: 0; font-weight: 600; color: var(--si-ink); display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.signin-newrole input { width: auto; accent-color: var(--si-violet); }
.signin-or { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; color: var(--si-muted); font-size: .8rem; }
.signin-or::before, .signin-or::after { content: ""; height: 1px; background: var(--si-line); }

/* =====================================================================
   The app shell (step 2, 2026-11-03).

   On a computer the header becomes a slim column on the left: brand and
   syllabus at the top, the five places in the middle, the account at the
   foot. On a phone (760px and under) the earlier layout stays: a short top
   bar and the places along the bottom, within thumb reach.
   ===================================================================== */

h1, h2, h3, .brand, .set-name, .kpi-value, .dash-head h1 { font-family: var(--display); letter-spacing: -.015em; }

@media (min-width: 761px) {
  body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .topbar {
    grid-column: 1;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: 16px;
    padding: 20px 14px 16px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    box-shadow: none;
    overflow-y: auto;
  }
  .rehearsal-bar { grid-column: 2; grid-row: 1; }
  main { grid-column: 2; grid-row: 2; }

  .brand { flex-wrap: wrap; padding: 0 6px; gap: 10px; font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; padding: 6px; border-radius: 11px; background: var(--hero); }
  .subject-switch { width: 100%; }
  .subject-switch .subject-chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

  .role-switch { width: 100%; }
  .role-switch button { flex: 1; padding: 6px 4px; }

  .tabs { flex-direction: column; gap: 2px; background: none; padding: 0; border-radius: 0; margin: 0; width: 100%; }
  .tab {
    width: 100%;
    padding: 10px 12px;
    font-size: 14.5px;
    font-weight: 600;
    gap: 12px;
    border-radius: 12px;
    justify-content: flex-start;
  }
  .tab-icon { display: block; width: 21px; height: 21px; }
  .tab:hover { background: var(--surface-2); color: var(--text); }
  .tab.is-active { background: var(--accent-soft); color: var(--accent-2); box-shadow: none; }
  .tab-admin { margin-left: 0; opacity: 1; }
  .tab .badge { margin-left: auto; }

  .topbar-stats { display: none !important; }

  .account { margin: auto 0 0 !important; }
  .account-btn { width: 100%; padding: 6px 12px 6px 6px; border-radius: 14px; }
  .account-name { max-width: none; flex: 1; text-align: left; }
  .account-menu { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
}

/* Phone top bar: keep the account button at the right. */
@media (max-width: 760px) {
  .account { margin-left: auto; }
  .role-switch { display: none; }
  body[data-admin="1"] .role-switch { display: flex; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 51; box-shadow: var(--shadow-lg); }
  #view-home.is-active, #view-mytests.is-active, #view-parent.is-active, #view-teacher.is-active {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* =====================================================================
   Student home
   ===================================================================== */

#view-home { overflow-y: auto; }
#view-home.is-active { display: block; }
.hm {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px max(20px, env(safe-area-inset-right, 0px)) 48px max(20px, env(safe-area-inset-left, 0px));
  display: grid;
  gap: 18px;
}
.hm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.hm-head h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; }
.hm-sub { margin: 4px 0 0; color: var(--muted); }
.hm-preview { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.hm-pick { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; max-width: 220px; }

.hm-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.hm-span12 { grid-column: span 12; }
.hm-span7 { grid-column: span 7; }
.hm-span5 { grid-column: span 5; }
.hm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  box-shadow: var(--shadow);
}
.hm-card h3 { margin: 0; font-size: 1.05rem; }
.hm-label { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.hm-small { margin: 2px 0 0; font-size: .84rem; color: var(--muted); }
.hm-big { display: block; font: 700 1.9rem/1.1 var(--display); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }

.hm-hero { background: var(--hero); border: 0; color: #fff; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 20px; }
.hm-hero .hm-label { color: rgba(255, 255, 255, .8); }
.hm-hero h2 { margin: 4px 0 6px; font-size: 1.35rem; line-height: 1.25; }
.hm-hero p { margin: 0; color: rgba(255, 255, 255, .85); font-size: .92rem; }
.hm-hero-empty { grid-column: 1 / -1; }
.hm-sure { display: inline-block; margin-top: 10px; font-size: .76rem; font-weight: 700; background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 4px 11px; }
.hm-dial svg { display: block; }

.hm-habit { grid-template-columns: 1fr 1fr; }
.hm-dots { display: flex; gap: 6px; }
.hm-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); }
.hm-dots i.on { background: var(--streak); }
.hm-days { display: flex; gap: 6px; margin-top: 4px; font-size: .62rem; color: var(--muted); }
.hm-days span { width: 16px; text-align: center; }
.hm-meter { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hm-meter i { display: block; height: 100%; border-radius: inherit; background: var(--mint); }

.hm-next { grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.hm-next h3 { margin: 4px 0 2px; font-size: 1.15rem; }
.hm-go { border: 0; border-radius: 999px; padding: 11px 24px; font: 700 .95rem var(--font); background: var(--accent); color: #fff; cursor: pointer; }
.hm-go:hover { filter: brightness(1.07); }
.hm-go:focus-visible, .hm-link:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

.hm-map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.hm-tile { border-radius: 12px; padding: 9px 8px; min-height: 76px; display: grid; align-content: space-between; gap: 2px; font-size: .7rem; line-height: 1.2; }
.hm-tile b { font: 700 .95rem var(--display); }
.hm-tile small { font-weight: 700; font-variant-numeric: tabular-nums; }
.hm-t-good { background: var(--good-soft); color: var(--good); }
.hm-t-ok { background: var(--accent-soft); color: var(--accent-2); }
.hm-t-mid { background: var(--warn-soft); color: var(--warn); }
.hm-t-bad { background: var(--bad-soft); color: var(--bad); }
.hm-t-none { background: var(--surface-2); color: var(--muted); }
.hm-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .72rem; color: var(--muted); }
.hm-key span { display: inline-flex; align-items: center; gap: 5px; }
.hm-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.hm-rows { display: grid; gap: 4px; }
.hm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.hm-row b { display: block; font-size: .92rem; }
.hm-up { color: var(--good); font: 700 1rem var(--display); }
.hm-down { color: var(--bad); font: 700 1rem var(--display); }

.hm-band-label { margin: 0; font: 700 1.3rem var(--display); }
.hm-band { position: relative; height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--bad-soft), var(--warn-soft), var(--good-soft)); }
.hm-band i { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); transform: translate(-50%, -50%); }
.hm-bandlab { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }

.hm-chart svg { width: 100%; height: auto; display: block; }
.hm-legend { display: flex; gap: 16px; font-size: .78rem; color: var(--muted); }
.hm-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.hm-legend i.me { background: var(--accent); }
.hm-legend i.avg { background: var(--muted); }
.hm-pair { display: grid; gap: 10px; }
.hm-pair > div { display: grid; grid-template-columns: 110px minmax(0, 1fr) 48px; gap: 10px; align-items: center; }
.hm-pair-lab { font-size: .85rem; color: var(--muted); }
.hm-pair-bar { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hm-pair-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hm-pair-bar.hm-avg i { background: var(--muted); opacity: .6; }
.hm-pair b { font: 700 .95rem var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.hm-link { justify-self: start; border: 0; background: none; padding: 0; color: var(--accent-2); font: 700 .9rem var(--font); cursor: pointer; }

@media (max-width: 900px) {
  .hm-span7, .hm-span5 { grid-column: span 12; }
}
@media (max-width: 520px) {
  .hm { padding-top: 18px; }
  .hm-hero { grid-template-columns: 1fr; justify-items: start; }
  .hm-habit { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hm-map { gap: 5px; }
  .hm-tile { min-height: 66px; padding: 7px 5px; font-size: .62rem; }
  .hm-tile span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hm-next { grid-template-columns: 1fr; }
  .hm-pair > div { grid-template-columns: 90px minmax(0, 1fr) 42px; }
}

/* =====================================================================
   Hand in (step 3), and the switches inside places that hold two views
   ===================================================================== */

#view-handin { overflow-y: auto; }
#view-handin.is-active { display: block; }

.pair-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); margin: 0 0 16px; }
.pair-switch button { border: 0; background: none; font: 600 13px var(--font); color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.pair-switch button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
body[data-role="parent"] .pair-student { display: none; }
#browse-panel > .pair-switch { margin: 0 0 12px; }

.hi-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.hi-steps li { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.hi-steps b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 .8rem var(--display); background: var(--surface-2); }
.hi-steps li.on { color: var(--text); }
.hi-steps li.on b { background: var(--accent); color: #fff; }
.hi-steps li.done b { background: var(--mint); color: #05301f; }

.hi-card { gap: 14px; }
.hi-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hi-choice { border: 1px solid var(--border); border-radius: 16px; padding: 4px; display: grid; gap: 8px; background: var(--surface); }
.hi-choice.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hi-choice-btn { border: 0; background: none; text-align: left; padding: 12px; border-radius: 12px; display: grid; gap: 4px; cursor: pointer; font: inherit; color: var(--text); }
.hi-choice-btn b { font: 700 1rem var(--display); }
.hi-choice-btn span { font-size: .84rem; color: var(--muted); }
.hi-choice > .hi-input { margin: 0 8px 10px; width: calc(100% - 16px); }
.hi-input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0; }
.hi-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.hi-typed { min-height: 240px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.hi-note { min-height: 64px; resize: vertical; }
.hi-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hi-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 10px 18px; font: 700 .92rem var(--font); cursor: pointer; justify-self: start; }
.hi-ghost:hover { background: var(--surface-2); }
.hm-go:disabled, .hi-ghost:disabled { opacity: .55; cursor: default; }
.hi-small-go { padding: 8px 16px; font-size: .86rem; }

.hi-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; justify-self: start; }
.hi-tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; font: 600 .88rem var(--font); color: var(--muted); cursor: pointer; }
.hi-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.hi-drop { border: 2px dashed var(--border); border-radius: 18px; padding: 28px 16px; display: grid; gap: 8px; justify-items: center; text-align: center; background: var(--surface-2); cursor: pointer; }
.hi-drop:hover, .hi-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.hi-drop-ico svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.hi-types { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hi-types i { font-style: normal; font-size: .7rem; font-weight: 700; background: var(--surface); color: var(--muted); border-radius: 6px; padding: 2px 7px; }

.hi-files { display: grid; gap: 8px; }
.hi-file { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.hi-file b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-ftype { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font: 700 .62rem var(--display); background: var(--accent); color: #fff; }
.hi-who { max-width: 240px; padding: 7px 10px; }
.hi-warn { margin: 0; font-size: .86rem; font-weight: 600; color: var(--warn); }

.hi-timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.hi-timeline li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; position: relative; }
.hi-timeline li::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.hi-timeline li:last-child::before { display: none; }
.hi-timeline i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 .8rem var(--display); font-style: normal; background: var(--surface-2); color: var(--muted); }
.hi-timeline li.done i { background: var(--mint); color: #05301f; }
.hi-timeline li.now i { background: var(--accent); color: #fff; }
.hi-timeline b { display: block; }

.hi-list { display: grid; gap: 6px; }
.hi-item { border-radius: 14px; background: var(--surface-2); }
.hi-item summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; }
.hi-item summary::-webkit-details-marker { display: none; }
.hi-item summary b { display: block; }
.hi-item-body { padding: 4px 14px 14px; display: grid; gap: 10px; }
.hi-filelinks { display: flex; flex-wrap: wrap; gap: 8px; }
.hi-filelinks a { font-size: .84rem; font-weight: 600; color: var(--accent-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; text-decoration: none; }
.hi-cancel { color: var(--bad); }
.hi-score { font: 700 1rem var(--display); font-variant-numeric: tabular-nums; }
.hi-stage { font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.hi-work { background: var(--accent-soft); color: var(--accent-2); }
.hi-check { background: var(--warn-soft); color: var(--warn); }
.hi-ready { background: var(--good-soft); color: var(--good); }
.hi-bad { background: var(--bad-soft); color: var(--bad); }

.hi-waiting { border-color: transparent; background: var(--warn-soft); box-shadow: none; }
.hi-waiting-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.hi-approve { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface); }
.hi-approve b { display: block; }

@media (max-width: 900px) {
  .hi-choices { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hi-file { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .hi-file .hi-who { grid-column: 1 / -1; max-width: none; }
  .hi-approve { grid-template-columns: 1fr 1fr; }
  .hi-approve > div { grid-column: 1 / -1; }
}

/* On a phone, Hand in is the raised button in the middle of the bar. */
@media (max-width: 760px) {
  .tab-handin .tab-icon { width: 24px; height: 24px; padding: 0; }
  .tab-handin::after { content: none; }
  .tab.tab-handin { margin-top: -18px; }
  .tab.tab-handin .tab-icon {
    box-sizing: content-box; width: 22px; height: 22px; padding: 13px; border-radius: 17px;
    background: var(--accent); color: #fff; stroke: #fff; box-shadow: 0 10px 20px -10px var(--accent);
  }
  .tab.tab-handin.is-active::before { display: none; }
  #view-handin.is-active { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* =====================================================================
   Teacher and parent pages (step 4)
   ===================================================================== */

/* The summary row on the class page. */
.tks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.tk { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: grid; gap: 4px;
  text-align: left; font: inherit; color: var(--text); box-shadow: var(--shadow); align-content: start; }
button.tk { cursor: pointer; }
button.tk:hover { border-color: var(--accent); }
.tk-value { font: 700 1.8rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.tk-warn { background: var(--warn-soft); border-color: transparent; }
.tk-good .tk-value { color: var(--good); }
.t-sections { margin: 0 0 16px; flex-wrap: wrap; }
.t-find { max-width: 320px; margin-bottom: 4px; }
.hm-card .hard-list { margin: 0; }

/* Predicted grade chips. */
.gchip { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 8px; border-radius: 8px;
  font: 700 .82rem var(--display); background: var(--accent-soft); color: var(--accent-2); font-variant-numeric: tabular-nums; }
.gchip.g-hi { background: var(--good-soft); color: var(--good); }
.gchip.g-mid { background: var(--warn-soft); color: var(--warn); }
.gchip.g-lo { background: var(--bad-soft); color: var(--bad); }

/* The strict / lenient control: small, at the top of every class page. */
.mode-bar { font-size: 12.5px; padding: 6px 0; gap: 8px; }
.mode-bar .mode-note { display: none; }
.mode-bar .seg button { padding: 4px 10px; font-size: 12px; }

/* The parent's page. */
#view-parent .dash, #view-teacher .dash { max-width: 1120px; margin: 0 auto; }
.p-pick { margin-bottom: 8px; }
.p-overview { display: grid; gap: 18px; }
.p-detail { margin-top: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.p-detail > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.p-detail > summary::-webkit-details-marker { display: none; }
.p-detail > summary > span:first-child { font: 700 1.05rem var(--display); }
.p-detail > summary::after { content: "Show"; margin-left: auto; font: 700 .85rem var(--font); color: var(--accent-2); }
.p-detail[open] > summary::after { content: "Hide"; }
.p-detail-body { padding: 0 18px 18px; }

@media (max-width: 900px) {
  .tks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Step 5: progress over time, and the marks switch for every role. */
.hm-span6 { grid-column: span 6; }
@media (max-width: 900px) { .hm-span6 { grid-column: span 12; } }
.hm-row-btn { width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.hm-row-btn:hover { background: var(--accent-soft); }
.hm-legend i.mint { background: var(--mint); }
.cmp { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.cmp:first-of-type { border-top: 0; }
.reading-switch { padding: 0; }
.hm-head .reading-switch { margin-left: auto; }
#mytests-root > .reading-switch, #parent-root > .reading-switch { margin: 0 0 10px; }

/* Two columns on the Tests page, as in the two-column report (tools/two_column.py) */
.tc { margin: 4px 0 10px; }
.tc-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; font-size: 14px; line-height: 1.55; }
.tc-grid .tc-hd { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: var(--accent-soft); padding: 6px 12px; }
.tc-grid .c { padding: 8px 12px; white-space: pre-line; word-break: break-word; border-top: 1px solid var(--border); }
.tc-grid .c.r { background: color-mix(in srgb, var(--good-soft) 35%, transparent); border-left: 1px solid var(--border); }
.tc-grid .c.rmg { background: var(--good-soft); } .tc-grid .c.rmo { background: var(--warn-soft); }
.tc-code .c { font-family: ui-monospace, "Courier Prime", Consolas, monospace; font-size: 13px; white-space: pre-wrap; }
.tc-grid .g, .tc-grid-inline.g { color: var(--good); font-weight: 700; }
.tc-grid .o, .tc-grid-inline.o { color: #c25700; font-weight: 700; }
.tc-grid s.x, .tc-grid-inline.x { color: var(--bad); text-decoration-thickness: 2px; }
.tc-grid .i, .tc-grid-inline.i { color: var(--muted); }
.tc-grid .tag { color: var(--muted); font-size: 12px; font-style: italic; }
.tc-grid .sp { text-decoration: underline wavy var(--bad); text-underline-offset: 3px; }
.tc-grid .fig { display: block; max-width: 100%; height: auto; } .tc-grid .fig svg { max-width: 100%; height: auto; }
.tc-grid .figcap { font-size: 12px; color: var(--muted); }
.tc-why { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 14px; }
.tc-why li { display: flex; gap: 8px; align-items: baseline; }
.tc-chip { flex: none; display: inline-block; min-width: 34px; text-align: center; border-radius: 999px; padding: 0 8px;
  font-weight: 700; font-size: 13px; border: 1.5px solid; }
.tc-chip.tc-yes { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.tc-chip.tc-no { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.tc-note { margin: 8px 0 0; font-size: 13.5px; background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; }
.tc-key { flex-wrap: wrap; gap: 6px 18px; }
.mt-understand { margin: 8px 0 0; font-size: 14px; line-height: 1.55; }
.mt-understand + .mt-model-kicker { margin-top: 14px; }
.mt-model-text.is-code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: pre-wrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.tc-grid .o, .tc-grid-inline.o) { color: #ffa040; } }
:root[data-theme="dark"] :is(.tc-grid .o, .tc-grid-inline.o) { color: #ffa040; }
@media (max-width: 640px) {
  .tc-grid { grid-template-columns: 1fr; }
  .tc-grid .tc-hd:nth-child(2) { display: none; }
  .tc-grid .c.r { border-left: 0; border-top: 1px dashed var(--border); }
  .tc-grid .c.l::before { content: "Your answer"; display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .tc-grid .c.r::before { content: "Corrected"; display: block; font-size: 11px; font-weight: 700; color: var(--good); text-transform: uppercase; }
}

/* Public mode (the cloud copy): the workbench tools do not exist there, so their tabs are not shown (app/mode.py). */
body[data-mode="public"] [data-workbench] { display: none !important; }
.dec-note { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }

/* The website's one page for students (owner, 2026-12-04): only the hand-in screen, under the name Home. */
body[data-mode="public"][data-role="student"] .tab[data-view="home"],
body[data-mode="public"][data-role="student"] .tab[data-view="mytests"] { display: none !important; }
.hi-subjects { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.hi-subject { border: 2px solid var(--border); background: var(--surface); color: var(--text); border-radius: 14px;
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.hi-subject small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.hi-subject.on { border-color: var(--accent); background: var(--accent-soft); }
.hi-confirm { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bad-soft); }
.hi-confirm p { margin: 0; font-size: 14px; }

/* =====================================================================
   The website's student page (owner, 2026-12-05): dark band at the top,
   light working cards below. Only when handin.js sets body.one-page
   (public mode, a student). No left column: there is only one page.
   ===================================================================== */
body.one-page { display: block; background: #f6f4ff; }
body.one-page .tabs, body.one-page .subject-switch, body.one-page .role-switch,
body.one-page .topbar-stats, body.one-page .rehearsal-bar { display: none !important; }
body.one-page .topbar {
  position: absolute; inset: 0 0 auto; z-index: 20; height: 76px; padding: 0 max(28px, calc((100vw - 1040px) / 2));
  display: flex; flex-direction: row; align-items: center; background: transparent; border: 0; box-shadow: none; overflow: visible;
}
body.one-page .brand { color: #fff; font-size: 19px; padding: 0; flex-wrap: nowrap; }
body.one-page .brand-mark { width: 36px; height: 36px; padding: 7px; border-radius: 11px; background: #6d4aff;
  stroke: #fff; box-shadow: 0 6px 20px rgba(109, 74, 255, .55); }
body.one-page .account { margin: 0 0 0 auto !important; }
body.one-page .account-btn { width: auto; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
  color: #fff; border-radius: 999px; padding: 5px 14px 5px 5px; }
body.one-page .account-btn:hover { background: rgba(255, 255, 255, .14); }
body.one-page .account-menu { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; }
body.one-page main { display: block; }
body.one-page #view-handin.is-active { display: block; overflow: visible; }
body.one-page #handin-root.hm { max-width: none; padding: 0; display: block; }

.op-hero { position: relative; overflow: hidden; isolation: isolate; background: #100c20; color: #fff;
  padding: 128px max(28px, calc((100vw - 1040px) / 2)) 132px; }
.op-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, #000 20%, transparent 95%); }
.op-glow::before, .op-glow::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(90px); }
.op-glow::before { width: 620px; height: 620px; left: -180px; top: -260px;
  background: radial-gradient(circle, rgba(109, 74, 255, .8), transparent 65%); animation: op-drift 16s ease-in-out infinite alternate; }
.op-glow::after { width: 520px; height: 520px; right: -140px; bottom: -300px;
  background: radial-gradient(circle, rgba(62, 224, 168, .35), transparent 65%); animation: op-drift 19s ease-in-out infinite alternate-reverse; }
@keyframes op-drift { to { transform: translate(70px, 40px) scale(1.08); } }
.op-inner { max-width: 1040px; margin: 0 auto; }
.op-kicker { margin: 0 0 10px; font: 700 12.5px var(--display); letter-spacing: .16em; text-transform: uppercase; color: #3ee0a8; }
.op-hero h1 { margin: 0; font: 800 clamp(34px, 5vw, 54px)/1.05 var(--display); letter-spacing: -.025em;
  background: linear-gradient(100deg, #fff 30%, #c9bcff 70%, #8ff0cc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.op-lead { margin: 14px 0 30px; max-width: 560px; font-size: 17.5px; line-height: 1.6; color: rgba(255, 255, 255, .7); }
.op-subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 300px)); gap: 14px; }
.op-subject { position: relative; text-align: left; font: inherit; color: #fff; cursor: pointer; display: grid; gap: 2px;
  padding: 18px 20px; border-radius: 18px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px); transition: transform .2s, background .2s, border-color .2s, box-shadow .2s; }
.op-subject:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .09); }
.op-subject.on { background: linear-gradient(140deg, rgba(109, 74, 255, .55), rgba(109, 74, 255, .25));
  border-color: rgba(157, 135, 255, .9); box-shadow: 0 16px 40px -12px rgba(109, 74, 255, .7); }
.op-subject:focus-visible { outline: 3px solid #3ee0a8; outline-offset: 3px; }
.op-code { font: 700 11.5px var(--display); letter-spacing: .12em; color: rgba(255, 255, 255, .55); }
.op-subject b { font: 700 19px var(--display); letter-spacing: -.01em; }
.op-subject small { color: rgba(255, 255, 255, .6); font-size: 13px; }
.op-tick { position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #3ee0a8; color: #05301f; font: 800 13px var(--display); font-style: normal; }

.op-work { position: relative; z-index: 1; max-width: 1040px; margin: -76px auto 0; padding: 0 20px 64px; display: grid; gap: 18px; }
.op-work > .hi-steps { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 10px 18px;
  justify-self: start; box-shadow: var(--shadow-lg); }
body.one-page .hm-card { border-radius: 22px; padding: 24px; box-shadow: 0 1px 2px rgba(27, 21, 52, .04), 0 18px 50px -24px rgba(27, 21, 52, .3); }
body.one-page .hm-card h3 { font-size: 18px; }
body.one-page .hi-choice { border-radius: 16px; transition: border-color .2s, box-shadow .2s, transform .2s; }
body.one-page .hi-choice:hover { transform: translateY(-2px); }
body.one-page .hm-go { border-radius: 999px; padding: 12px 26px; background: linear-gradient(135deg, #6d4aff, #5233f0);
  box-shadow: 0 10px 26px -10px rgba(109, 74, 255, .8); }
body.one-page .hi-drop { border-radius: 18px; background: linear-gradient(180deg, #faf8ff, #f3f0ff); }

@media (max-width: 760px) {
  body.one-page .topbar { height: 64px; padding: 0 16px; }
  body.one-page .account-name { display: none; }
  body.one-page .account-btn { padding: 4px; }
  .op-hero { padding: 96px 20px 110px; }
  .op-subjects { grid-template-columns: 1fr; }
  .op-work { padding: 0 14px 40px; margin-top: -64px; }
  body.one-page .tabs { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { .op-glow::before, .op-glow::after { animation: none; } }
body.one-page .hi-choices { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 760px) {
  .op-work > .hi-steps { flex-wrap: nowrap; gap: 10px; padding: 8px 12px; font-size: .8rem; justify-self: stretch; justify-content: space-between; }
  .op-work > .hi-steps b { width: 24px; height: 24px; }
}
/* staff previewing the student page keep the role switch, to get back */
body.one-page[data-admin="1"] .role-switch { display: flex !important; }
body.one-page .role-switch { position: static; transform: none; width: auto; margin-left: auto; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16); box-shadow: none; }
body.one-page .role-switch button { color: rgba(255, 255, 255, .75); flex: none; padding: 6px 14px; }
body.one-page .role-switch button.is-active { background: #fff; color: #100c20; }
body.one-page[data-admin="1"] .account { margin-left: 12px !important; }

/* ---- side bar and pages (owner, 2026-12-05) ---- */
.op-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.op-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 26px;
  padding: 22px 16px 20px; background: #0b0817; border-right: 1px solid rgba(255, 255, 255, .06); color: #fff; z-index: 25; }
.op-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; font: 700 19px var(--display); letter-spacing: -.01em; }
.op-brand svg { width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: #6d4aff; fill: none; stroke: #fff;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; box-shadow: 0 6px 20px rgba(109, 74, 255, .55); }
.op-navs { display: grid; gap: 4px; }
.op-nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 12px;
  background: transparent; color: rgba(255, 255, 255, .68); font: 600 15px var(--font); text-align: left; cursor: pointer;
  transition: background .2s, color .2s; }
.op-nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.op-nav.on { background: linear-gradient(135deg, rgba(109, 74, 255, .9), rgba(82, 51, 240, .75)); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(109, 74, 255, .9); }
.op-nav:focus-visible { outline: 2px solid #3ee0a8; outline-offset: 2px; }
.op-ico { display: grid; place-items: center; width: 22px; height: 22px; flex: none; }
.op-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.op-group.has-on > .op-nav-group { color: #fff; }
.op-caret { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s; opacity: .7; }
.op-group.open .op-caret { transform: rotate(45deg); }
.op-sub { display: grid; gap: 2px; margin: 4px 0 6px 22px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .12); }
.op-sub .op-nav { padding: 9px 12px; font-size: 14.5px; }
.op-side-note { margin: auto 8px 0; font-size: 12.5px; line-height: 1.5; color: rgba(255, 255, 255, .45); }
.op-main { min-width: 0; }

body.one-page .topbar { left: 264px; padding: 0 40px; justify-content: flex-end; }
body.one-page .topbar .brand { display: none; }
.op-hero { padding: 120px 48px 132px; }
.op-hero.short { padding: 104px 48px 112px; }
.op-hero.short h1 { font-size: clamp(30px, 4vw, 44px); }
.op-hero.short .op-lead { margin-bottom: 22px; }
.op-subjects.small { grid-template-columns: repeat(auto-fit, minmax(190px, 230px)); gap: 10px; }
.op-subjects.small .op-subject { padding: 12px 16px; border-radius: 14px; }
.op-subjects.small .op-subject b { font-size: 16px; }
.op-subjects.small .op-tick { top: 50%; transform: translateY(-50%); width: 22px; height: 22px; font-size: 11px; }
.op-work { padding: 0 32px 64px; }

.op-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.op-tile { position: relative; display: grid; gap: 6px; align-content: start; text-align: left; font: inherit; cursor: pointer;
  padding: 22px 22px 24px; border-radius: 22px; background: #fff; border: 1px solid var(--border); color: var(--text);
  box-shadow: 0 1px 2px rgba(27, 21, 52, .04), 0 18px 50px -24px rgba(27, 21, 52, .3); transition: transform .25s, box-shadow .25s, border-color .25s; }
.op-tile:hover { transform: translateY(-4px); border-color: #c9bcff; box-shadow: 0 24px 50px -20px rgba(109, 74, 255, .35); }
.op-tile .op-ico { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, #efeaff, #e3fbf2); margin-bottom: 10px; }
.op-tile .op-ico svg { stroke: #6d4aff; width: 24px; height: 24px; }
.op-tile b { font: 700 18px var(--display); }
.op-tile span { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.op-arrow { position: absolute; top: 22px; right: 22px; font-style: normal; color: #6d4aff; font-weight: 700; transition: transform .25s; }
.op-tile:hover .op-arrow { transform: translateX(4px); }
.op-cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.op-which { display: grid; gap: 6px; padding-bottom: 6px; }
.op-empty { margin: 0; padding: 14px 16px; border-radius: 14px; background: #fff8ec; color: #6b4d12; font-size: 14.5px; }

@media (max-width: 900px) {
  .op-shell { grid-template-columns: 1fr; }
  .op-side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .op-brand span, .op-side-note { display: none; }
  .op-brand { padding: 0; }
  .op-brand svg { width: 34px; height: 34px; padding: 7px; }
  .op-navs { display: flex; gap: 4px; }
  .op-nav { white-space: nowrap; padding: 9px 12px; font-size: 14px; width: auto; }
  .op-nav .op-ico { display: none; }
  .op-group { display: flex; gap: 4px; }
  .op-sub { display: flex; margin: 0; padding: 0 0 0 4px; border-left: 1px solid rgba(255, 255, 255, .15); }
  body.one-page .topbar { position: absolute; top: 56px; left: 0; height: 52px; padding: 0 16px; }
  .op-hero, .op-hero.short { padding: 72px 20px 100px; }
  .op-tiles { grid-template-columns: 1fr; }
  .op-work { padding: 0 14px 40px; }
}
@media (max-width: 900px) {
  .op-shell { align-content: start; min-height: 0; }
  body.one-page .topbar { top: 58px; height: 48px; }
  body.one-page .role-switch button { padding: 5px 10px; font-size: 12px; }
}

/* past paper in three choices: year, session, paper and variant */
.op-picker { display: grid; gap: 18px; padding-bottom: 8px; }
.op-pickrow.off { opacity: .55; }
.op-pickhead { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font: 700 14.5px var(--display); color: var(--text); }
.op-pickhead i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--display);
  font-style: normal; background: #efeaff; color: #6d4aff; }
.op-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.op-chip { display: grid; gap: 1px; justify-items: start; padding: 10px 18px; border-radius: 14px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); font: 700 15px var(--display); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.op-chip small { font: 500 12px var(--font); color: var(--muted); }
.op-chip:hover { border-color: #b9a8ff; transform: translateY(-1px); }
.op-chip.on { border-color: #6d4aff; background: #6d4aff; color: #fff; box-shadow: 0 8px 20px -10px rgba(109, 74, 255, .9); }
.op-chip.on small { color: rgba(255, 255, 255, .8); }
.op-chip:focus-visible { outline: 3px solid #3ee0a8; outline-offset: 2px; }
.op-chosen { margin: 0; padding: 12px 16px; border-radius: 14px; background: #e3fbf2; color: #0b5c44; font-size: 14.5px; }

/* lighter working area (owner, 2026-12-06: the raised white boxes looked heavy): the cards sit below the dark
   band, flat, with a hairline border and no shadow; the tips column has no box at all */
.op-hero, .op-hero.short { padding-bottom: 56px; }
.op-work { margin-top: 0; padding-top: 36px; }
body.one-page .hm-card, .op-tile { box-shadow: none; border: 1px solid #ebe7f8; border-radius: 18px; }
body.one-page .hm-card.hm-span5 { background: transparent; border: 0; padding: 8px 4px; }
body.one-page .hm-span5 .hm-row { background: transparent; border: 0; border-left: 3px solid #d9d0ff; border-radius: 0; padding: 4px 0 4px 14px; }
.op-tile:hover { box-shadow: none; border-color: #c9bcff; }
.op-chip { border-width: 1px; }
.op-chip:disabled { opacity: .38; cursor: not-allowed; transform: none; border-style: dashed; }
.op-chip.on { box-shadow: none; }
.op-years { display: flex; align-items: center; gap: 8px; }
.op-yearchips { flex-wrap: nowrap; }
.op-yearchips .op-chip { min-width: 74px; justify-items: center; }
.op-yarrow { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid #ebe7f8; background: #fff; color: #6d4aff;
  font: 700 22px/1 var(--display); cursor: pointer; display: grid; place-items: center; padding-bottom: 3px; }
.op-yarrow:hover:not(:disabled) { border-color: #6d4aff; }
.op-yarrow:disabled { opacity: .3; cursor: default; }
@media (max-width: 900px) {
  .op-work { padding-top: 24px; }
  .op-yearchips { overflow-x: auto; }
  .op-yearchips .op-chip { min-width: 0; padding: 9px 12px; }
}

/* the student pages scroll as a normal web page (owner, 2026-12-06: half the page could not be reached), and use
   the full width beside the side bar: band and cards share one left edge, up to 1240px wide */
html:has(body.one-page), body.one-page { height: auto; min-height: 100%; overflow: visible; }
body.one-page main, body.one-page #view-handin.is-active { height: auto; min-height: 0; overflow: visible; }
.op-inner { max-width: 1240px; margin: 0; }
.op-work { max-width: 1240px; margin-left: 0; margin-right: 0; padding-left: 48px; padding-right: 48px; }
body.one-page .hm-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 32px; }
body.one-page .hm-grid > .hm-span7, body.one-page .hm-grid > .hm-span5 { grid-column: auto; }
@media (max-width: 900px) {
  .op-work { padding-left: 14px; padding-right: 14px; }
  body.one-page .hm-grid { grid-template-columns: 1fr; }
}
.op-pdf { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; justify-self: start; }
.op-pdf::before { content: "PDF"; font: 800 10.5px var(--display); letter-spacing: .06em; padding: 3px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .22); }
