/* examprep: same design system as the rest of theotoolecloud (system type,
   quiet grey surfaces, one blue for actions), with teal as examprep's own
   colour. Light and dark. Tokens first; everything else uses them. */

:root {
  color-scheme: light dark;
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #F2F2F7;
  --glass: rgba(245, 245, 247, 0.78);
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #6F6F74;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.16);
  --control: #8E8E93;               /* form control edges, 3:1 on white */
  --accent: #0066CC;                /* links and outlines */
  --accent-hover: #0058B0;
  --accent-fill: #0066CC;           /* button fills under white text, >= 4.5:1 */
  --accent-fill-hover: #0058B0;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --k: #30B0C7;                     /* examprep teal: tiles, dots, progress */
  --k-ink: #0A6E7A;                 /* teal that passes 4.5:1 as text */
  --k-soft: rgba(48, 176, 199, 0.12);
  --good: #177334; --good-soft: rgba(30, 142, 62, 0.10);
  --bad: #D70015;  --bad-soft: rgba(215, 0, 21, 0.08);
  --warn: #A05A00; --warn-soft: rgba(255, 159, 10, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.14);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.05), 0 18px 40px -16px rgba(0, 0, 0, 0.22);
  --card-edge: transparent;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r-ctl: 12px;
  --r-row: 14px;
  --r-card: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --max: 1024px;
  --gutter: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1C1C1E; --surface-2: #2C2C2E; --glass: rgba(22, 22, 24, 0.78);
    --ink: #F5F5F7; --ink-2: #A1A1A6; --ink-3: #8E8E93;
    --line: rgba(255, 255, 255, 0.10); --line-2: rgba(255, 255, 255, 0.20); --control: #7C7C82;
    --accent: #0A84FF; --accent-hover: #409CFF; --accent-fill: #0071E3; --accent-fill-hover: #0062CC; --accent-soft: rgba(10, 132, 255, 0.18);
    --k: #40C8E0; --k-ink: #6ED6E8; --k-soft: rgba(64, 200, 224, 0.16);
    --good: #30D158; --good-soft: rgba(48, 209, 88, 0.14);
    --bad: #FF6961; --bad-soft: rgba(255, 69, 58, 0.14);
    --warn: #FFB340; --warn-soft: rgba(255, 179, 64, 0.14);
    --shadow: none; --shadow-hover: none; --card-edge: var(--line);
  }
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-padding-top: 72px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.47 var(--sans); letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); color: var(--ink); margin: 0 0 0.5rem; font-weight: 700; }
h1 { font-size: clamp(34px, 5.5vw, 48px); line-height: 1.08; letter-spacing: -0.035em; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.025em; }
h3 { font-size: 19px; line-height: 1.3; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0 0 1rem; }
code, pre, kbd { font-family: var(--mono); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 70; padding: 10px 16px; border-radius: 999px; background: var(--accent-fill); color: #fff; }
.skip:focus { left: 12px; }
.muted { color: var(--ink-2); }
.lead { font-size: clamp(19px, 2.4vw, 21px); line-height: 1.42; color: var(--ink-2); letter-spacing: -0.022em; max-width: 40rem; }
.label { display: inline-block; font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.005em; }
.label-accent { color: var(--k-ink); }

/* ---- header: one glass bar -------------------------------------------------- */
.bar { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 8px; }
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; color: var(--ink); font: 600 18px var(--display); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--k); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a, .linkbtn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px;
  font-size: 14px; color: var(--ink); opacity: 0.8; background: none; border: 0; cursor: pointer;
}
.site-nav a:hover, .linkbtn:hover { opacity: 1; background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { opacity: 1; font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.nav-actions form { margin: 0; }
.nav-actions .btn-small { min-height: 32px; }

/* ---- layout ---------------------------------------------------------------- */
.page { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 32px var(--gutter) 64px; }
.narrow { max-width: 46rem; margin-inline: auto; }
.page-head { margin: 8px 0 24px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lead { margin: 0; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }
.section-title { margin: 48px 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.site-footer { margin-top: auto; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.site-footer .bar { justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding-top: 20px; padding-bottom: 28px; }
.site-footer a { color: var(--ink-2); }

/* ---- home ------------------------------------------------------------------- */
.hero { text-align: center; padding: clamp(40px, 9vw, 88px) 0 8px; }
.hero h1 { font-size: clamp(44px, 9vw, 80px); line-height: 1.03; letter-spacing: -0.045em; margin: 10px 0 18px; }
.hero .lead { margin: 0 auto; text-wrap: balance; }
.hero .actions { justify-content: center; margin-top: 30px; }
.eyebrow { display: inline-block; font-size: 15px; font-weight: 600; color: var(--k-ink); }
.facts { list-style: none; margin: 48px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-radius: var(--r-card); overflow: hidden; background: var(--line); box-shadow: var(--shadow); }
.facts li { display: grid; gap: 2px; padding: 20px 22px; background: var(--surface); text-align: center; }
.facts strong { font: 700 28px/1.1 var(--display); letter-spacing: -0.03em; }
.facts span { font-size: 14px; color: var(--ink-2); }
.subjects { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.subject-card h2, .subject-card h3 { font-size: 21px; margin: 14px 0 2px; }
.subject-card p { margin: 0; font-size: 15px; }
.tile { width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--k); color: #fff; display: grid; place-items: center; }
.tile svg { width: 26px; height: 26px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.steps li { padding: 24px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--card-edge); }
.steps h3 { margin: 12px 0 6px; }
.steps p { margin: 0; font-size: 16px; }
.step-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--k-soft); color: var(--k-ink); font-weight: 700; }
.home-cards { margin-bottom: 8px; }
.home-cards .card { display: flex; flex-direction: column; }
.home-cards .actions { margin-top: auto; padding-top: 16px; }
.list-plain { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; }
.big-num { font: 700 clamp(40px, 7vw, 56px)/1 var(--display); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; margin: 8px 0 6px; }
.big-num small { font-size: 0.42em; font-weight: 600; color: var(--ink-2); letter-spacing: -0.02em; }

/* ---- cards ------------------------------------------------------------------ */
.card { position: relative; padding: 24px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); border: 1px solid var(--card-edge); }
.card > :last-child { margin-bottom: 0; }
.card-link { display: block; color: var(--ink); padding-right: 44px; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.card-link:hover { color: var(--ink); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card-link:active { transform: scale(0.98); }
.card-link::after { content: "\203A"; position: absolute; right: 20px; top: 50%; translate: 0 -50%; font-size: 26px; line-height: 1; color: var(--ink-3); }
.card-narrow { max-width: 440px; margin: 24px auto 0; padding: 32px; }
.card-narrow h1 { font-size: 32px; }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state p { max-width: 28rem; margin-inline: auto; }
.empty-state .actions { justify-content: center; }

/* ---- buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 0;
  background: var(--accent-fill); color: #fff; font-size: 17px; font-weight: 500; line-height: 1.2;
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, transform 80ms var(--ease);
}
.btn:hover { background: var(--accent-fill-hover); color: #fff; text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-outline { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn-outline:hover { background: var(--accent-fill); color: #fff; }
.btn-small { min-height: 34px; padding: 6px 16px; font-size: 15px; }
.btn-large { min-height: 52px; padding: 14px 28px; font-size: 18px; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

/* ---- forms ----------------------------------------------------------------- */
.form { display: grid; gap: 16px; margin: 20px 0 0; }
.form label, .field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 16px; }
.form .btn { justify-self: start; }
.card-narrow .form .btn { justify-self: stretch; }
.hint { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.alt { margin: 4px 0 0; text-align: center; font-size: 15px; color: var(--ink-2); }
.alt a { text-decoration: underline; text-underline-offset: 0.2em; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--control); background: var(--surface); color: var(--ink); font-size: 17px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.5; }

/* ---- messages ----------------------------------------------------------------- */
.flash { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--r-row); background: var(--accent-soft); font-size: 15px; }
.flash-error { background: var(--bad-soft); color: var(--bad); font-weight: 500; }
.callout { margin: 16px 0; padding: 12px 16px; border-radius: var(--r-row); background: var(--surface-2); font-size: 15px; }
.callout.info { background: var(--k-soft); }
.callout.warn { background: var(--warn-soft); }
.callout.good { background: var(--good-soft); }

/* ---- small bits ------------------------------------------------------------------ */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.status { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.chip-accent { background: var(--k-soft); color: var(--k-ink); }

/* ---- lists of rows (history, exams, topics) ------------------------------------- */
.cells { list-style: none; margin: 0 0 24px; padding: 0; background: var(--surface); border-radius: var(--r-row); box-shadow: var(--shadow); border: 1px solid var(--card-edge); overflow: hidden; }
.cells li + li { border-top: 1px solid var(--line); }
.cell { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 12px 18px; color: var(--ink); }
a.cell { position: relative; padding-right: 40px; transition: background-color 0.15s; }
a.cell:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
a.cell::after { content: "\203A"; position: absolute; right: 16px; top: 50%; translate: 0 -50%; font-size: 22px; color: var(--ink-3); }
.cell-main { display: grid; gap: 2px; min-width: 0; }
.cell-title { font-weight: 500; overflow-wrap: anywhere; }
.cell-sub { font-size: 14px; color: var(--ink-2); }
.cell-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px; text-align: right; }
.cell-end form { margin: 0; }

/* ---- topic picker ------------------------------------------------------------------ */
.subject-head { display: flex; align-items: center; gap: 18px; }
.subject-head .tile { width: 64px; height: 64px; border-radius: 16px; }
.subject-head .tile svg { width: 34px; height: 34px; }
.topic-search { margin: 0 0 16px; }
.topic-search input { border-radius: 999px; padding-left: 18px; background: var(--surface); }
details.paper { margin-top: 12px; }
details.paper > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 18px; border-radius: var(--r-row); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--card-edge);
  font: 600 19px var(--display); letter-spacing: -0.02em;
}
details.paper > summary::-webkit-details-marker { display: none; }
details.paper > summary::after { content: "\203A"; font-size: 24px; color: var(--ink-3); transition: transform 0.2s var(--ease); }
details.paper[open] > summary::after { transform: rotate(90deg); }
.paper-count { margin-left: auto; font: 400 14px var(--sans); color: var(--ink-2); }
details.paper[open] { padding-bottom: 12px; }
.chapter-title { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); }
.topic-list { margin-bottom: 0; }

/* ---- quiz -------------------------------------------------------------------- */
.quiz fieldset, .review fieldset {
  min-width: 0; margin: 0 0 16px; padding: 24px;
  background: var(--surface); border: 1px solid var(--card-edge); border-radius: var(--r-card); box-shadow: var(--shadow);
}
.quiz legend, .review legend { float: left; width: 100%; padding: 0; margin: 0; }
.quiz legend + *, .review legend + * { clear: both; }
.q-num { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.prompt { margin-top: 14px; font-size: 19px; line-height: 1.45; font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }
.code { margin: 14px 0; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--surface-2); font: 14px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt.code { font-weight: 400; }
.choices { display: grid; gap: 8px; margin-top: 16px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; border-radius: var(--r-row); border: 1px solid var(--line-2); cursor: pointer; transition: background-color 0.15s, border-color 0.15s, transform 80ms var(--ease); }
.choice:hover { background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:active { transform: scale(0.99); }
.choice input[type="radio"] { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 50%; border: 2px solid var(--control); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.choice input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.12s var(--ease); }
.choice input[type="radio"]:checked { border-color: var(--accent); }
.choice input[type="radio"]:checked::before { transform: scale(1); }
.answer-label { display: block; margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.quiz textarea { margin-top: 6px; min-height: 9rem; }
.submit-bar {
  position: sticky; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 24px; padding: 10px 10px 10px 22px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px -12px rgba(0, 0, 0, 0.3);
}

/* ---- results -------------------------------------------------------------------- */
.score-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px; margin-bottom: 24px; }
.stat .big-num { margin: 4px 0 0; }
.stat.grow { flex: 1 1 15rem; }
.progress-line { margin: 0 0 8px; font-size: 15px; }
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--k); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--k); border-radius: 999px; }
.verdict { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.verdict.ok { color: var(--good); background: var(--good-soft); }
.verdict.no { color: var(--bad); background: var(--bad-soft); }
.answer-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.answer-list li { padding: 12px 16px; border-radius: var(--r-row); }
.answer-list li.right { background: var(--good-soft); }
.answer-list li.wrong { background: var(--bad-soft); }
.answer-list li > span[aria-hidden] { font-weight: 700; margin-right: 6px; }
.answer-list li.right > span[aria-hidden] { color: var(--good); }
.answer-list li.wrong > span[aria-hidden] { color: var(--bad); }
.your-answer { margin-top: 16px; }
.your-answer pre { margin: 6px 0 0; padding: 12px 16px; border-radius: var(--r-ctl); background: var(--surface-2); font: 16px/1.5 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-mark { margin-top: 16px; padding: 16px 18px; border-radius: var(--r-row); background: var(--good-soft); }
.ai-mark .mark { margin: 0; font: 700 19px var(--display); color: var(--good); }
.ai-mark p { margin: 6px 0 0; }
.ai-mark ul { margin: 6px 0 0; padding-left: 20px; }
.marking { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-row); background: var(--k-soft); }
.marking::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--k-soft); border-top-color: var(--k); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mark-scheme, .model-answer { margin-top: 16px; padding: 16px 18px; border-radius: var(--r-row); background: var(--surface-2); }
.model-answer { background: var(--k-soft); }
.mark-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.mark-list li::marker { color: var(--k-ink); }
.mark-key { margin: 10px 0 0; font-size: 13px; }
.explanation { margin: 6px 0 0; white-space: pre-line; }
.tip { margin: 14px 0 0; color: var(--k-ink); }
details.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
details.more summary { cursor: pointer; display: flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 15px; color: var(--accent); }
.selfmark { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 16px; }
.selfmark label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.selfmark input { width: 8rem; }
.review fieldset { scroll-margin-top: 80px; }

/* ---- exams ------------------------------------------------------------------- */
.countdown { margin-bottom: 24px; }
.countdown-figures { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 2px; }
.countdown-unit { display: inline-flex; align-items: baseline; gap: 8px; }
.countdown-unit .label { font-size: 21px; color: var(--ink); font-weight: 500; }
.countdown-num { font: 700 clamp(52px, 10vw, 72px)/0.95 var(--display); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; color: var(--k-ink); }
.countdown-exam { margin: 6px 0 0; font-size: 19px; font-weight: 500; }
.sub-h { margin: 32px 0 12px; font-size: 21px; }
#add-exam h2 { font-size: 21px; }

/* ---- tables (admin) --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.card .table { margin: -8px 0; }

/* ---- 404 --------------------------------------------------------------------- */
.notfound { text-align: center; padding: 64px 0; }
.notfound .big-num { font-size: clamp(80px, 16vw, 120px); color: var(--ink-3); }
.notfound .actions { justify-content: center; }

.katex { color: inherit; font-size: 1.08em; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

/* ---- phones ------------------------------------------------------------------ */
@media (max-width: 700px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .page { padding-top: 20px; }
  .site-nav a, .linkbtn { padding: 0 10px; }
  .nav-actions .btn-small { padding: 6px 14px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .grid, .subjects { grid-template-columns: 1fr; gap: 12px; }
  .subject-card { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; padding: 16px 44px 16px 16px; }
  .subject-card .tile { grid-row: span 2; width: 44px; height: 44px; }
  .subject-card h2, .subject-card h3 { margin: 0; font-size: 18px; }
  .subject-card .tag { grid-column: 2; justify-self: start; }
  .card, .quiz fieldset, .review fieldset { padding: 18px; }
  .card-narrow { padding: 24px; }
  .prompt { font-size: 17px; }
  .submit-bar { border-radius: 20px; }
  .cell { padding: 12px 14px; }
  .subject-head .tile { width: 52px; height: 52px; }
  /* Signed in: the section links move to a tab bar along the bottom. */
  body.has-tabs { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.has-tabs .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  body.has-tabs .site-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  body.has-tabs .site-nav a { flex: 1; justify-content: center; font-size: 13px; padding: 0 4px; border-radius: 12px; }
  body.has-tabs .site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  body.has-tabs .submit-bar { bottom: calc(72px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  body:not(.has-tabs) .site-nav { display: none; }
}

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

/* ---- practice papers, multiple-choice links, paper timer -------------------- */
.section-h { margin: 28px 0 6px; font-size: 22px; }
.practice-papers { margin-bottom: 8px; }
.cells li.has-mcq { display: flex; align-items: stretch; }
.cells li.has-mcq > a.cell { flex: 1; min-width: 0; }
.mcq-link { display: flex; align-items: center; padding: 0 18px; border-left: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.mcq-link:hover { background: var(--surface-2); text-decoration: none; }
.mcq-inline { margin-left: 10px; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: -0.005em; }
.mcq-part { margin: 8px 4px 0; font-size: 15px; }
.section-title { margin: 32px 0 8px; font-size: 20px; }
.paper-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 24px; }
.paper-timer strong { font-variant-numeric: tabular-nums; font-size: 22px; }
.paper-timer strong.over { color: var(--bad); }
@media (max-width: 560px) { .mcq-link { padding: 0 12px; font-size: 13px; } }
