/* Grad Prep — "the page is the object": the test's answer sheet, printed in oxblood on grey paper.
   Direction dealt by tasteskill v2 (page-is-the-object, seed 1068551543). Square corners, filled
   surfaces, one ink and one accent; no outlines, shadows or gradients. */

@font-face { font-family: "Erode"; src: url("assets/fonts/erode-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Erode"; src: url("assets/fonts/erode-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Erode"; src: url("assets/fonts/erode-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #e2e2e2;          /* paper */
  --surface: #d6d6d6;     /* one tone step: the ground the paper sits on, filled bars */
  --surface-2: #c9c9c9;   /* a second step for pressed and filled states */
  --ink: #7d0c14;         /* oxblood */
  --muted: #7a4a4e;
  --accent: #7d0c14;
  --accent-ink: #e2e2e2;
  --field: #7d0c14;
  --field-ink: #e2e2e2;
  --ok: #7d0c14;
  --wrong: #4d4d4d;
  --font: "Erode", Georgia, "Times New Roman", serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --margin: clamp(16px, 2.2vw, 32px);
  --gap-section: clamp(96px, 12vw, 200px);
  --bar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #2a1d1e;
  --surface: #1e1415;
  --surface-2: #3a2a2b;
  --ink: #ece2e2;
  --muted: #c4aeb0;
  --accent: #e2747b;
  --accent-ink: #1e1415;
  --field: #5e0a10;
  --field-ink: #f0e6e6;
  --ok: #e2747b;
  --wrong: #8e8283;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] body { font-weight: 400; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.025em; line-height: 0.98; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--ink); color: var(--bg); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--margin); top: 8px; z-index: 99; background: var(--ink); color: var(--bg); padding: 8px 14px; }

/* ─── Buttons and links ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: var(--step-body);
  transition: transform .18s var(--ease), background-color .18s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }
.btn.quiet { background: var(--surface); color: var(--ink); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: var(--step-small); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; font-weight: 500; }
.link:hover { text-decoration-thickness: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.row.center { justify-content: center; }
.hint { color: var(--muted); font-size: var(--step-small); }

/* ─── Bar ───────────────────────────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: clamp(12px, 2vw, 32px);
  height: var(--bar-h); padding: 0 var(--margin);
  background: var(--bg);
}
.wordmark { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; }
.bar-links { display: flex; gap: clamp(12px, 2vw, 28px); margin-left: auto; }
.bar-links button, .bar-theme { font-weight: 500; color: var(--ink); padding: 8px 0; position: relative; }
.bar-links button::after, .bar-theme::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 3px; background: var(--ink);
  transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease);
}
.bar-links button:hover::after, .bar-links button.active::after, .bar-theme:hover::after { transform: scaleX(1); }
.bar .btn { min-height: 44px; }

/* ─── Home: hero ────────────────────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
  padding: 12px; background: var(--surface);
}
.hero-photo {
  grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--bar-h) + 12px);
  height: calc(100svh - var(--bar-h) - 24px); overflow: hidden; background: var(--surface-2);
}
.hero-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 30%;
  filter: grayscale(1) contrast(1.05); opacity: 0; transition: opacity 1.6s ease;
}
.hero-photo img.on { opacity: 1; }
.hero-col { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 12px; }
.sheet { background: var(--bg); color: var(--ink); }
.hero-card {
  min-height: calc(82svh - var(--bar-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 0 clamp(24px, 4vw, 64px) 40px; position: relative;
}
.timing { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; overflow: hidden; }
.timing span { flex: 0 0 28px; height: 100%; }
.timing span:nth-child(odd) { background: var(--ink); }
.sheet-mark { font-size: clamp(3rem, 7vw, 6.5rem); font-weight: 600; letter-spacing: -0.045em; line-height: 0.9; margin: 120px 0 36px; }
.hero-title { font-size: var(--step-head); max-width: 14ch; font-weight: 500; }
.hero-sub { font-size: var(--step-body); max-width: 36ch; margin: 24px 0 32px; }
.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; margin-top: auto; padding-top: 48px; font-size: var(--step-small); }
.hero-links button { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; font-weight: 500; }

/* the tear-off stub: the live question */
.stub { padding: clamp(28px, 4vw, 56px); position: relative; }
.stub::before {
  content: ""; position: absolute; top: -9px; left: 0; right: 0; height: 6px;
  border-top: 6px dotted var(--surface); /* perforation: round dots, not a hairline */
}
.stub-title { font-size: var(--step-head); }
.stub-src { color: var(--muted); font-size: var(--step-small); margin-top: 12px; }
.stub-q { font-size: var(--step-lead); line-height: 1.3; margin: 24px 0; max-width: 32ch; white-space: pre-line; }
.bubbles { display: grid; gap: 8px; }
.bubble {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 8px 16px 8px 8px;
  background: var(--surface); text-align: left; transition: background-color .15s, transform .15s var(--ease);
}
.bubble:hover:not(:disabled) { background: var(--surface-2); transform: translateX(4px); }
.bubble:disabled { cursor: default; }
.bubble .dot {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); font-weight: 600; font-size: var(--step-small);
}
.bubble.correct { background: var(--field); color: var(--field-ink); }
.bubble.correct .dot { background: var(--field-ink); color: var(--field); }
.bubble.wrong { background: var(--surface-2); text-decoration: line-through; text-decoration-thickness: 2px; }
.bubble.wrong .dot { background: var(--wrong); color: var(--bg); }
.stub-result { margin-top: 20px; }
.stub-result p + p { margin-top: 8px; }
.stub-result .verdict { font-weight: 600; font-size: var(--step-lead); }
#try-next { margin-top: 20px; }

/* ─── Home: tests list ──────────────────────────────────────────────────── */
.tests { padding: var(--gap-section) var(--margin); background: var(--bg); }
.tests-col { max-width: 720px; margin: 0 auto; container-type: inline-size; }
.giant { font-size: 38cqw; line-height: 0.8; font-weight: 600; letter-spacing: -0.05em; text-transform: uppercase; margin-left: -0.04em; }
.bars { display: grid; gap: 6px; margin-top: 20px; }
.bar-item { background: var(--surface); }
.bar-item > summary, .bar-row {
  display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 0 18px;
  font-weight: 500; list-style: none; cursor: pointer;
}
.bar-item > summary::-webkit-details-marker { display: none; }
.bar-item > summary .count { margin-left: auto; color: var(--muted); }
.bar-item > summary .plus { width: 20px; text-align: center; font-size: 1.4rem; line-height: 1; transition: transform .25s var(--ease); }
.bar-item[open] > summary .plus { transform: rotate(45deg); }
.bar-item > summary:hover { background: var(--surface-2); }
.bar-panel { padding: 4px 18px 24px; }
.bar-panel p.desc { margin-bottom: 16px; max-width: 52ch; }
.items { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 14px; }
.items li { display: flex; gap: 12px; align-items: baseline; }
.items li i { flex: 1; border-bottom: 4px dotted var(--surface-2); transform: translateY(-4px); }
.items li span:last-child { font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--surface-2); margin: 8px 0 4px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .6s var(--ease); }
.bar-panel .row { margin-top: 20px; }
.bar-panel .btn.quiet, .q-sheet .btn.quiet { background: var(--bg); }
.q-sheet .btn.quiet:hover { background: var(--surface-2); }
.bar-panel .items { margin-bottom: 8px; }

/* ─── Home: showcase ────────────────────────────────────────────────────── */
.show { position: relative; height: 96svh; min-height: 640px; overflow: hidden; background: #222; }
.show-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%;
  filter: grayscale(1) brightness(.85); transform: scale(1.06); transition: transform 12s linear;
}
.show.inview .show-photo { transform: scale(1); }
.show-text { position: absolute; left: 18%; top: 10%; max-width: 30ch; padding: 20px 24px; background: rgba(0, 0, 0, .55); color: #ededed; }
.show-lead { font-size: var(--step-lead); line-height: 1.3; }
.show-lead + .show-lead { margin-top: 16px; }
.show-lead strong { font-weight: 600; }
.slips { position: absolute; left: 12px; right: 12px; bottom: 0; display: flex; gap: 12px; align-items: flex-end; }
.slip { background: var(--bg); color: var(--ink); }
.slips .slip { flex: 1 1 0; min-width: 0; padding: 18px 18px 0; font-size: var(--step-small); line-height: 1.45; overflow: hidden; }
.slips .slip b { display: block; font-weight: 600; margin-bottom: 6px; }
.slips .slip .cut { color: var(--muted); letter-spacing: 2px; overflow: hidden; white-space: nowrap; margin-bottom: 6px; }
.slips .slip:nth-child(2) { transform: rotate(-1.5deg); transform-origin: bottom center; }
.slips .slip:nth-child(5) { transform: rotate(1.2deg); transform-origin: bottom center; }

/* ─── Home: how a paper runs ────────────────────────────────────────────── */
.how {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px;
  padding: var(--gap-section) var(--margin); background: var(--field); color: var(--field-ink);
}
.how-text { grid-column: 1 / 6; }
.how-text p { margin-top: 24px; max-width: 30ch; }
.sec-title { font-size: var(--step-head); }
.sec-title.sm { font-size: var(--step-lead); margin: 48px 0 12px; }
.how .receipt { grid-column: 7 / 12; max-width: 480px; }
.receipt {
  padding: 28px 28px 48px; font-size: var(--step-body);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), 96% 100%, 92% calc(100% - 14px), 88% 100%, 84% calc(100% - 14px), 80% 100%, 76% calc(100% - 14px), 72% 100%, 68% calc(100% - 14px), 64% 100%, 60% calc(100% - 14px), 56% 100%, 52% calc(100% - 14px), 48% 100%, 44% calc(100% - 14px), 40% 100%, 36% calc(100% - 14px), 32% 100%, 28% calc(100% - 14px), 24% 100%, 20% calc(100% - 14px), 16% 100%, 12% calc(100% - 14px), 8% 100%, 4% calc(100% - 14px), 0 100%);
}
.receipt.wide { max-width: 720px; }
.r-group { font-weight: 600; margin-top: 28px; }
.r-group:first-child { margin-top: 0; }
.r-row { display: flex; gap: 10px; align-items: baseline; margin-top: 10px; }
.r-row i { flex: 1; min-width: 16px; border-bottom: 4px dotted var(--surface-2); transform: translateY(-4px); }
.r-row span:last-child { text-align: right; white-space: nowrap; }
.r-total {
  display: flex; justify-content: space-between; gap: 12px; margin: 28px -28px 0; padding: 0 28px;
  min-height: 44px; align-items: center; background: var(--ink); color: var(--bg); font-weight: 600;
}

/* ─── Home: stacking colour sheets ──────────────────────────────────────── */
.sheets { padding: var(--gap-section) 0 0; background: var(--bg); }
.sheets > .sec-title { padding: 0 var(--margin); margin-bottom: 48px; }
.csheet {
  position: sticky; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 72px minmax(0, 1fr);
  column-gap: 24px; height: 62svh; min-height: 460px; padding: 0 0 0 var(--margin);
}
/* heights step down by the band offset so the stack leaves the screen together and no title is covered */
.csheet.c1 { top: var(--bar-h); background: var(--surface); height: calc(62svh + 144px); min-height: 604px; }
.csheet.c2 { top: calc(var(--bar-h) + 72px); background: var(--field); color: var(--field-ink); height: calc(62svh + 72px); min-height: 532px; }
.csheet.c3 { top: calc(var(--bar-h) + 144px); background: var(--surface-2); }
.csheet h3 { grid-column: 1 / 7; grid-row: 1; align-self: center; font-size: var(--step-lead); }
.csheet p { grid-column: 1 / 6; grid-row: 2; align-self: start; max-width: 34ch; padding: 8px 0 48px; }
.csheet img { grid-column: 7 / 13; grid-row: 2; width: 100%; height: 100%; min-height: 0; object-fit: cover; filter: grayscale(1); }

/* ─── Home: stats ───────────────────────────────────────────────────────── */
.stats {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px;
  padding: var(--gap-section) var(--margin); background: var(--surface);
}
.stats-left { grid-column: 1 / 7; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.stats-left p { margin-top: 16px; max-width: 36ch; }
.total { font-size: clamp(6rem, 18vw, 18.75rem); line-height: 0.8; font-weight: 500; letter-spacing: -0.05em; }
.total-cap { margin-top: 20px; }
.stats .receipt { grid-column: 8 / 12; align-self: start; max-width: 440px; }

/* ─── Footer: the back of the card ──────────────────────────────────────── */
.foot { background: var(--field); color: var(--ink); padding: 120px var(--margin) 48px; }
.postcard {
  position: relative; max-width: 1120px; margin: 0 auto; min-height: 420px; padding: 56px clamp(24px, 4vw, 56px) 32px;
  background: var(--bg); display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
}
.postcard::before {
  /* scallops: twelve filled half-discs along the top edge */
  content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 20px; background: var(--bg);
  clip-path: polygon(0 100%, 0 60%, 2% 20%, 4.2% 0, 6.3% 20%, 8.3% 60%, 8.4% 100%, 8.5% 60%, 10.5% 20%, 12.6% 0, 14.6% 20%, 16.6% 60%, 16.7% 100%, 16.8% 60%, 18.8% 20%, 20.9% 0, 22.9% 20%, 25% 60%, 25.1% 100%, 25.2% 60%, 27.2% 20%, 29.2% 0, 31.2% 20%, 33.3% 60%, 33.4% 100%, 33.5% 60%, 35.5% 20%, 37.5% 0, 39.5% 20%, 41.6% 60%, 41.7% 100%, 41.8% 60%, 43.8% 20%, 45.8% 0, 47.8% 20%, 50% 60%, 50.1% 100%, 50.2% 60%, 52.2% 20%, 54.2% 0, 56.2% 20%, 58.3% 60%, 58.4% 100%, 58.5% 60%, 60.5% 20%, 62.5% 0, 64.5% 20%, 66.6% 60%, 66.7% 100%, 66.8% 60%, 68.8% 20%, 70.8% 0, 72.8% 20%, 75% 60%, 75.1% 100%, 75.2% 60%, 77.2% 20%, 79.2% 0, 81.2% 20%, 83.3% 60%, 83.4% 100%, 83.5% 60%, 85.5% 20%, 87.5% 0, 89.5% 20%, 91.6% 60%, 91.7% 100%, 91.8% 60%, 93.8% 20%, 95.8% 0, 97.8% 20%, 100% 60%, 100% 100%);
}
.pc-sign { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.02em; margin-bottom: 16px; }
.pc-msg p:not(.pc-sign) { max-width: 36ch; }
.pc-addr { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 104px; position: relative; }
.stamp { position: absolute; top: 0; right: 0; width: 88px; aspect-ratio: 3 / 4; object-fit: cover; padding: 6px; background: var(--surface); filter: grayscale(1); }
.imprint { grid-column: 1 / -1; align-self: end; justify-self: center; max-width: 72ch; text-align: center; font-size: var(--step-small); color: var(--muted); }
body.in-quiz .foot { display: none; }

/* ─── App pages ─────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }
.page { max-width: 960px; margin: 0 auto; padding: 48px var(--margin) var(--gap-section); }
.page-title { font-size: var(--step-head); }
.page-lead { font-size: var(--step-lead); line-height: 1.35; margin-top: 16px; max-width: 46ch; }
.back { color: var(--muted); font-weight: 500; margin-bottom: 24px; }
.back:hover { color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.fact { background: var(--surface); padding: 14px 18px; min-width: 140px; }
.fact b { display: block; font-size: var(--step-lead); font-weight: 600; }
.fact span { font-size: var(--step-small); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface); padding: 8px 14px; font-size: var(--step-small); font-weight: 500; transition: background-color .15s; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip .n { margin-left: 6px; opacity: .7; }
.modes { display: grid; gap: 6px; }
.mode {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 18px; text-align: left;
  background: var(--surface); transition: background-color .15s, transform .15s var(--ease);
}
.mode:hover { background: var(--surface-2); transform: translateX(4px); }
.mode-title { font-weight: 600; }
.mode-sub { color: var(--muted); font-size: var(--step-small); }
.mode-time { margin-left: auto; font-weight: 600; white-space: nowrap; }
.panel { background: var(--surface); padding: 24px 28px 32px; margin-top: 24px; }
.panel .sec-title.sm { margin-top: 0; }
.panel p { max-width: 62ch; }
.field { display: grid; gap: 6px; margin-top: 20px; font-weight: 500; }
.field input, .tutor-input input {
  min-height: 48px; padding: 0 14px; background: var(--bg); border: 0; border-bottom: 3px solid var(--ink);
}
.check { display: flex; gap: 10px; align-items: center; margin-top: 16px; font-size: var(--step-small); }
.seg { display: inline-flex; gap: 6px; }
.seg-btn { background: var(--bg); padding: 10px 18px; font-weight: 500; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.prose h2 { font-size: var(--step-lead); margin: 40px 0 12px; }
.prose p, .prose li { max-width: 66ch; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: 8px; }
.bar-row { background: var(--surface); }
.bar-row .count { margin-left: auto; color: var(--muted); white-space: nowrap; }
.bar-row:hover { background: var(--surface-2); }
.prog-row { background: var(--surface); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: baseline; }
.prog-row .meter { grid-column: 1 / -1; }
.prog-row .sub { color: var(--muted); font-size: var(--step-small); }

/* ─── Quiz ──────────────────────────────────────────────────────────────── */
.quiz { padding-top: 24px; }
.quiz-bar {
  position: sticky; top: var(--bar-h); z-index: 5; background: var(--bg);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 0;
}
.q-counter { font-weight: 600; }
.prog { flex: 1 1 160px; height: 8px; background: var(--surface); }
.prog-fill { height: 100%; width: 0; background: var(--ink); transition: width .3s var(--ease); }
.tally { display: flex; gap: 14px; font-size: var(--step-small); color: var(--muted); }
.tally b { color: var(--ink); font-weight: 600; }
.timer { font-weight: 600; font-size: var(--step-lead); }
.timer.warn { background: var(--ink); color: var(--bg); padding: 0 8px; }
.q-sheet { margin-top: 12px; padding: clamp(20px, 4vw, 48px); background: var(--surface); }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--step-small); color: var(--muted); margin-bottom: 20px; }
.q-meta #q-tag { color: var(--ink); font-weight: 600; }
.passage { background: var(--bg); margin-bottom: 24px; }
.passage summary { padding: 14px 18px; font-weight: 600; cursor: pointer; }
.passage-body { padding: 0 18px 20px; white-space: pre-line; max-height: 50vh; overflow: auto; line-height: 1.65; }
.passage-body p + p, .passage-body p + .data-scroll, .data-scroll + p { margin-top: 12px; }
.data-scroll { overflow-x: auto; }
.data-table { border-collapse: collapse; font-variant-numeric: tabular-nums; line-height: 1.3; white-space: normal; }
.data-table th, .data-table td { padding: 8px 16px 8px 0; text-align: left; vertical-align: top; }
.data-table th { font-weight: 600; }
.data-table tbody tr { border-top: 1px solid var(--surface-2); }
.q-text { font-size: var(--step-lead); line-height: 1.3; font-weight: 500; letter-spacing: -0.01em; white-space: pre-line; margin-bottom: 24px; }
.q-figure { margin: 0 0 24px; background: #fff; padding: 12px; }
.q-figure img { margin: 0 auto; max-height: 480px; object-fit: contain; cursor: zoom-in; }
.q-figure figcaption { margin-top: 8px; font-size: var(--step-small); color: #555; text-align: center; }
.q-figure .link { color: #5a0a0f; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 8px 16px 8px 8px;
  background: var(--bg); text-align: left; transition: background-color .15s, transform .15s var(--ease);
}
.opt:hover:not(:disabled) { background: var(--surface-2); transform: translateX(4px); }
.opt:disabled { cursor: default; }
.opt-key { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); font-weight: 600; font-size: var(--step-small); }
.opt-txt { padding: 6px 0; }
.opt.correct { background: var(--field); color: var(--field-ink); }
.opt.correct .opt-key { background: var(--field-ink); color: var(--field); }
.opt.wrong { background: var(--surface-2); }
.opt.wrong .opt-txt { text-decoration: line-through; text-decoration-thickness: 2px; }
.opt.wrong .opt-key { background: var(--wrong); color: var(--bg); }
.exp { margin-top: 24px; padding: 24px 24px 44px; }
.exp-head { font-size: var(--step-lead); font-weight: 600; }
.exp-body { margin-top: 12px; white-space: pre-line; }
.exp-answer { font-weight: 600; margin-bottom: 8px; }
.exp-note { margin-top: 16px; padding: 14px 16px; background: var(--surface); }
.exp { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), 96% 100%, 92% calc(100% - 14px), 88% 100%, 84% calc(100% - 14px), 80% 100%, 76% calc(100% - 14px), 72% 100%, 68% calc(100% - 14px), 64% 100%, 60% calc(100% - 14px), 56% 100%, 52% calc(100% - 14px), 48% 100%, 44% calc(100% - 14px), 40% 100%, 36% calc(100% - 14px), 32% 100%, 28% calc(100% - 14px), 24% 100%, 20% calc(100% - 14px), 16% 100%, 12% calc(100% - 14px), 8% 100%, 4% calc(100% - 14px), 0 100%); }
.tutor { margin-top: 24px; }
.tutor-panel { margin-top: 12px; background: var(--bg); }
.tutor-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface-2); }
.tutor-title { font-weight: 600; }
.tutor-model { font-size: var(--step-small); color: var(--muted); margin-right: auto; }
.tutor-msgs { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 18px; }
.msg { max-width: 88%; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); }
.msg.assistant { align-self: flex-start; background: var(--surface); }
.msg.system { align-self: stretch; max-width: none; background: var(--surface-2); font-size: var(--step-small); }
.msg.thinking { align-self: flex-start; color: var(--muted); font-style: italic; }
.tutor-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.tutor-input { display: flex; gap: 8px; padding: 0 18px 18px; }
.tutor-input input { flex: 1; min-width: 0; }
.tutor-key { display: grid; gap: 10px; padding: 16px; background: var(--surface); }
.tutor-key input { min-height: 44px; padding: 0 12px; background: var(--bg); border: 0; border-bottom: 3px solid var(--ink); }
.q-nav { display: flex; gap: 8px; margin-top: 16px; }
.q-nav #btn-next { margin-left: auto; }
.navigator { margin-top: 16px; background: var(--surface); padding: 14px 18px; }
.navigator summary { font-weight: 600; cursor: pointer; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.dot-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--bg); font-size: var(--step-small); font-weight: 600; }
.dot-btn.current { background: var(--ink); color: var(--bg); }
.dot-btn.ok { background: var(--field); color: var(--field-ink); }
.dot-btn.err { background: var(--wrong); color: var(--bg); }
.dot-btn.skipped { background: var(--surface-2); }

/* ─── Result ────────────────────────────────────────────────────────────── */
.result-head { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: end; margin-bottom: 48px; }
.result-head .total { font-size: clamp(5rem, 14vw, 11rem); }
.bd-meter { height: 8px; background: var(--surface-2); margin: 6px 0 14px; }
.bd-meter > span { display: block; height: 100%; background: var(--ink); }


/* ─── Essay test ────────────────────────────────────────────────────────── */
.essay-topic { text-align: left; min-height: 72px; padding: 12px 18px; }
.essay-topic[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.essay-topic[aria-pressed="true"] .mode-sub { color: var(--bg); opacity: .8; }
#essay-pick .check { margin-top: 20px; }
.essay-prompt { margin-top: 12px; padding: 24px 28px; font-size: var(--step-lead); line-height: 1.35; }
.essay-label { display: block; margin: 24px 0 8px; font-weight: 600; }
.essay-text {
  display: block; width: 100%; min-height: 55vh; padding: 20px 24px; resize: vertical;
  font: inherit; line-height: 1.7; color: var(--ink); background: var(--surface); border: 0; border-bottom: 3px solid var(--ink);
}
.essay-text:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.essay-text[readonly] { opacity: .7; }
#essay-feedback .panel h2.sec-title.sm { margin: 0 0 12px; }
.essay-h { font-size: var(--step-body); font-weight: 600; letter-spacing: 0; line-height: 1.3; margin: 20px 0 6px; }
.essay-p { margin-top: 10px; }
.rewrite { padding: 16px 18px; background: var(--bg); }
.essay-body { white-space: pre-wrap; line-height: 1.7; }
.essay-body mark { background: var(--surface-2); color: var(--ink); text-decoration: underline wavy var(--accent); text-underline-offset: 4px; cursor: help; }
.fixes { padding-left: 1.4em; }
.fixes li + li { margin-top: 10px; }
.fixes s { text-decoration-thickness: 2px; color: var(--muted); }
#essay-feedback > * + * { margin-top: 16px; }

/* ─── Assessment centre ─────────────────────────────────────────────────── */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 32px 0 24px; }
.tab { background: var(--surface); padding: 10px 16px; font-weight: 500; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.ac-note { padding: 18px 20px; background: var(--surface); margin-bottom: 20px; }
.fw-step, .ac-rule { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 18px 0; }
.fw-num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 600; }
.fw-step h3, .ac-rule h3 { font-size: var(--step-lead); margin-bottom: 6px; line-height: 1.15; }
.fw-step p, .ac-rule p { max-width: 62ch; }
.ac-case { background: var(--surface); padding: 28px; margin-bottom: 12px; }
.ac-case h3 { font-size: var(--step-lead); margin: 8px 0 14px; line-height: 1.15; }
.ac-case p + p { margin-top: 10px; }
.ac-case-tag { font-size: var(--step-small); color: var(--muted); }
.ac-data { width: 100%; border-collapse: collapse; margin: 16px 0; }
.ac-data td { padding: 8px 10px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
.ac-data td:first-child { font-weight: 600; width: 40%; }
.ac-task { font-weight: 600; margin-top: 12px; }
.ac-h { margin: 24px 0 10px; font-weight: 600; font-size: var(--step-lead); }
.ac-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-chips span { padding: 6px 12px; background: var(--bg); font-size: var(--step-small); }
.ac-quote { padding: 12px 16px; margin: 8px 0; background: var(--bg); }
.ac-case details, .ac-q { margin-top: 12px; background: var(--bg); }
.ac-case summary, .ac-q summary { padding: 14px 18px; font-weight: 600; cursor: pointer; }
.ac-ans, .ac-q-body { padding: 0 18px 18px; }
.ac-ans h4 { margin: 16px 0 4px; font-weight: 600; }
.ac-opt { display: grid; gap: 2px; padding: 8px 0; }
.ac-list { padding-left: 1.2em; }
.ac-list li + li { margin-top: 6px; }
.ac-cmp { display: inline-block; margin: 6px 0 10px; font-weight: 600; }
.ac-avoid { padding: 12px 14px; background: var(--surface); }

/* ─── Overlays (they float, so they may sit on a scrim) ─────────────────── */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(20, 8, 9, .6); }
.modal { width: min(440px, 100%); padding: 32px; background: var(--bg); text-align: center; }
.modal h2 { font-size: var(--step-head); margin-bottom: 12px; }
.modal-time { font-size: var(--step-head); font-weight: 600; margin: 12px 0; }
.modal .btn { margin-top: 20px; }
.overlay.zoom { cursor: zoom-out; }
.overlay.zoom img { max-width: 96vw; max-height: 92vh; background: #fff; }

/* ─── Motion: entrances (content stays visible without script) ──────────── */
.js .rise { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0ms); }
.js .rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .rise { opacity: 1; transform: none; transition: none; }
  .hero-photo img { transition: none; }
  .show-photo { transform: none; transition: none; }
  .btn, .opt, .bubble, .mode { transition: none; }
}

/* ─── Phone and tablet ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .slips .slip:nth-child(n+4) { display: none; }
  .slips .slip { font-size: var(--step-body); }
  .how { padding-top: calc(var(--gap-section) + 48px); }
  .bar-links { display: none; }
  .bar .btn { margin-left: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-photo { grid-column: 1; grid-row: 1; position: relative; top: 0; height: 48svh; }
  .hero-col { grid-row: 2; margin-top: -36px; position: relative; }
  .hero-card { min-height: 0; padding-bottom: 32px; }
  .timing { height: 40px; }
  .sheet-mark { margin: 84px 0 24px; width: 56%; font-size: 13vw; }
  .hero-title { font-size: 8vw; }
  .how, .stats { grid-template-columns: minmax(0, 1fr); }
  .how-text, .how .receipt, .stats-left, .stats .receipt { grid-column: 1; max-width: none; }
  .csheet, .csheet.c1, .csheet.c2 { height: auto; }
  .csheet { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px auto auto; min-height: 70svh; padding: 0; }
  .csheet.c1 { min-height: calc(70svh + 104px); }
  .csheet.c2 { top: calc(var(--bar-h) + 52px); min-height: calc(70svh + 52px); }
  .csheet.c3 { top: calc(var(--bar-h) + 104px); }
  .csheet h3 { grid-column: 1; padding: 0 var(--margin); font-size: 22px; }
  .csheet img { grid-column: 1; grid-row: 2; aspect-ratio: 4 / 3; height: auto; }
  .csheet p { grid-column: 1; grid-row: 3; padding: 20px var(--margin) 32px; font-size: 17px; }
  .postcard { grid-template-columns: minmax(0, 1fr); }
  .pc-addr { padding-top: 0; }
  .stamp { position: static; width: 64px; align-self: flex-end; order: -1; }
}
@media (max-width: 640px) {
  .bar-theme { display: none; }
  .wordmark { font-size: 1.25rem; }
  .bar .btn { padding: 0 14px; font-size: var(--step-small); }
  .show { height: 100svh; }
  .show-text { left: var(--margin); right: var(--margin); top: 6%; padding: 18px; }
  .show-lead { font-size: 22px; }
  .slips .slip:nth-child(n+4) { display: none; }
  .slips .slip { padding: 14px 12px 0; }
  .result-head { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .q-nav { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
  .q-nav .btn { flex: 1; padding: 0 8px; }
  .tally { width: 100%; }
}
