/* The OMR sheet: white paper, pink drop-out ink, pencil-graphite fills. See DESIGN.md. */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url('/vendor/archivo/archivo-latin-standard-normal.woff2') format('woff2-variations');
}

:root {
  --paper: #ffffff;
  --ink: #d63d6e;          /* OMR drop-out pink */
  --ink-d: #a92a54;
  --ink-tint: #fcebf1;
  --ink-line: #f2b9cc;
  --graphite: #24272d;     /* HB pencil */
  --graphite-2: #646973;
  --graphite-3: #9ba0a8;
  --ok: #1f8a5b;
  --ok-tint: #e3f3ea;
  --bad: #c8343c;
  --bad-tint: #fbe6e7;
  --mark: #6a4bc4;
  --warn: #b76a00;
  --font: 'Archivo', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --r: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  background: var(--paper); color: var(--graphite);
  font: 450 17px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 800; font-stretch: 125%; line-height: 1.05; margin: 0 0 .4em; letter-spacing: -0.015em; }
h1 { font-size: 34px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
.mono, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--graphite-2); }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.center { text-align: center; }
.err { color: var(--bad); font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px; padding: 12px 22px; border-radius: 999px; border: 2px solid transparent;
  font: 700 17px/1.1 var(--font); font-stretch: 112%; text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .08s ease, background-color .15s ease; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible, .pal-btn:focus-visible, .node:focus-visible, .icon-btn:focus-visible, .opt:has(input:focus-visible), .account:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-primary { background: var(--graphite); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: var(--paper); color: var(--graphite); border-color: var(--graphite); }
.btn-teal { background: var(--ok); color: #fff; }
.btn-coral { background: var(--ink); color: #fff; }
.btn-violet { background: var(--paper); color: var(--mark); border-color: var(--mark); }
.btn-white { background: var(--paper); color: var(--graphite); border-color: #d7d9dd; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-xl { min-height: 62px; font-size: 20px; width: 100%; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--graphite-2); font: 600 16px var(--font); cursor: pointer; padding: 12px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; padding-bottom: 14px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 17px var(--font); font-stretch: 125%; color: var(--graphite); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: var(--graphite); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); font-size: 0; margin-left: 4px; }
.brand::after { content: 'ReviseMBA'; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink-line); background: var(--paper); color: var(--graphite); display: grid; place-items: center; cursor: pointer; font: 700 18px var(--font); text-decoration: none; flex: 0 0 auto; }
.account { font: 600 15px var(--font); color: var(--graphite-2); background: none; border: 0; cursor: pointer; min-height: 44px; padding: 0 4px; }
.account b { color: var(--graphite); }
.sample-banner { background: var(--ink-tint); color: var(--ink-d); text-align: center; font: 700 13px/1.3 var(--font); padding: 7px 16px; border-bottom: 2px solid var(--ink-line); }
.foot { padding: 28px 0 36px; text-align: center; font-size: 13px; color: var(--graphite-3); }
.foot a { color: var(--graphite-2); }

/* ---------- Landing ---------- */
.home { min-height: calc(100dvh - 68px - 90px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; text-align: left; padding-top: 8px; padding-bottom: 24px; }
.home .omr-row { display: flex; gap: 14px; margin-bottom: 28px; padding: 0; list-style: none; }
.home .omr-row li { width: 54px; height: 54px; border-radius: 50%; border: 2.5px solid var(--ink); color: var(--ink); display: grid; place-items: center; font: 700 21px var(--font); }
.home .omr-row .fill { animation: fill-in .5s .55s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes fill-in { from { background: transparent; border-color: var(--ink); color: var(--ink); transform: scale(1); } 60% { transform: scale(1.08); } to { background: var(--graphite); border-color: var(--graphite); color: transparent; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .home .omr-row .fill { animation: none; background: var(--graphite); border-color: var(--graphite); color: transparent; } }
.home h1 { font-size: 48px; line-height: 1; margin: 0 0 32px; text-wrap: balance; }
.home .actions-col { width: 100%; display: grid; gap: 12px; }
.home .meta-line { font: 600 16px var(--font); color: var(--ok); margin: -18px 0 18px; }
.home .meta-line:empty { display: none; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 26px; padding: 0; list-style: none; }
.chip { font: 600 15px var(--font); padding: 7px 12px; border-radius: 999px; background: var(--ink-tint); color: var(--ink-d); }

/* ---------- Bottom sheet ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(36, 39, 45, .45); z-index: 80; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-height: 90dvh; overflow-y: auto; background: var(--paper); border-radius: 20px 20px 0 0; border-top: 3px solid var(--ink); padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--ink-line); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
.sheet .close { background: none; border: 0; color: var(--graphite-2); font-size: 30px; line-height: 1; width: 44px; height: 44px; cursor: pointer; }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 520px; transform: translateX(-50%); bottom: 24px; border-radius: 20px; border: 2px solid var(--ink); } }
.rules { list-style: none; padding: 0; margin: 0; display: grid; }
.rules li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1.5px solid var(--ink-line); font-size: 16px; }
.rules li:last-child { border-bottom: 0; }
.rules li b { white-space: nowrap; }

/* ---------- Auth ---------- */
.auth { display: grid; gap: 14px; }
.auth input[type=email], .auth input[type=tel], .auth input.code { width: 100%; font: 500 18px var(--font); padding: 14px 16px; border-radius: var(--r); border: 2px solid var(--ink-line); background: var(--paper); color: var(--graphite); min-height: 54px; }
.auth input:focus { outline: none; border-color: var(--ink); }
.auth input.code { font-weight: 700; font-size: 28px; letter-spacing: .35em; text-align: center; }
.auth .or { display: flex; align-items: center; gap: 10px; color: var(--graphite-2); font-size: 14px; }
.auth .or::before, .auth .or::after { content: ''; flex: 1; height: 1.5px; background: var(--ink-line); }
.auth .consent { font-size: 13px; color: var(--graphite-2); text-align: center; margin: 0; }
.auth .consent a { color: var(--graphite-2); }
.dev-code { font: 700 15px var(--font); color: var(--ok); background: var(--ok-tint); border-radius: var(--r); padding: 8px 12px; text-align: center; }
#google-btn { display: flex; justify-content: center; min-height: 44px; }

/* ---------- Mock list: rows on the sheet, not cards ---------- */
.slot-list { display: grid; margin: 4px 0 24px; border-top: 2px solid var(--ink); }
.slot { display: flex; align-items: center; gap: 14px; padding: 16px 2px; border-bottom: 1.5px solid var(--ink-line); }
.slot .badge { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--font); font-stretch: 110%; background: var(--graphite); color: var(--paper); }
.slot .info { flex: 1; min-width: 0; }
.slot h3 { margin: 0 0 2px; font-size: 19px; }
.slot .meta { font: 500 14px var(--font); color: var(--graphite-2); }
.slot .btn { min-height: 44px; padding: 8px 18px; }
.slot.soon .badge { background: var(--paper); color: var(--ink); border: 2px dashed var(--ink); }
.slot.soon h3 { color: var(--graphite-3); }
.pill { display: inline-block; font: 600 13px var(--font); padding: 5px 10px; border-radius: 999px; background: var(--ink-tint); color: var(--ink-d); }

/* ---------- Series path: one OMR column ---------- */
.series-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.ring { flex: 0 0 60px; position: relative; width: 60px; height: 60px; }
.ring svg { width: 60px; height: 60px; transform: rotate(-90deg); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 15px var(--font); }
.series-head .txt { flex: 1; min-width: 0; }
.series-head .txt b { display: block; font-size: 21px; font-weight: 800; font-stretch: 125%; }
.streak { display: inline-flex; align-items: center; gap: 6px; font: 600 15px var(--font); color: var(--ink-d); }
.path { position: relative; list-style: none; margin: 26px 0 30px; padding: 0; display: grid; }
.path::before { content: ''; position: absolute; left: 35px; top: 30px; bottom: 30px; border-left: 2px dashed var(--ink-line); }
.path li { position: relative; display: flex; align-items: center; gap: 18px; padding: 9px 0; transform: none !important; }
.node { position: relative; flex: 0 0 72px; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font: 800 24px var(--font); text-decoration: none; background: var(--paper); color: var(--ink); border: 2.5px solid var(--ink); }
.node svg { width: 30px; height: 30px; }
.node:active { transform: scale(.96); }
.node[data-status="done"] { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }
.node[data-status="open"] { background: var(--ink); border-color: var(--ink); color: var(--paper); animation: ring-pulse 1.8s ease-out infinite; }
.node[data-status="locked"] { border-style: dashed; }
.node[data-status="locked"] svg { width: 24px; height: 24px; }
.node[data-status="soon"] { border-color: var(--ink-line); color: var(--ink-line); cursor: default; }
.node-label { font: 600 16px var(--font); color: var(--graphite-2); display: flex; flex-direction: column; line-height: 1.25; }
.node-label b { color: var(--graphite); font-size: 19px; font-weight: 800; }
.path li:has([data-status="soon"]) .node-label, .path li:has([data-status="soon"]) .node-label b { color: var(--graphite-3); }
.path li:has([data-status="open"]) .node-label::after { content: 'Tap to start'; color: var(--ink); font-weight: 700; font-size: 15px; margin-top: 2px; }
.start-tag { display: none; }
@keyframes ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(214, 61, 110, .45); } 100% { box-shadow: 0 0 0 16px rgba(214, 61, 110, 0); } }
@media (prefers-reduced-motion: reduce) { .node[data-status="open"] { animation: none; box-shadow: 0 0 0 5px var(--ink-tint); } }
.chart-card { border: 2px solid var(--ink-line); border-radius: var(--r); padding: 12px; margin: 6px 0 16px; }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--graphite-2); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 8px 0 20px; border-top: 2px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { padding: 10px 8px; text-align: left; border-bottom: 1.5px solid var(--ink-line); white-space: nowrap; }
table.data th { font-size: 13px; color: var(--graphite-2); font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; }
#trend th.num, table.data td.heat { text-align: center; }
table.data td.heat { font-size: 14px; font-weight: 600; }
.st { font: 700 13px var(--font); padding: 3px 9px; border-radius: 999px; }
.st-correct { background: var(--ok-tint); color: var(--ok); }
.st-wrong { background: var(--bad-tint); color: var(--bad); }
.st-unattempted { background: #eef0f2; color: var(--graphite-2); }
.slow { color: var(--warn); }

/* ---------- Results: the score is the headline ---------- */
.score-card { text-align: left; padding: 10px 0 8px; }
.score-card #r-title { font-size: 17px !important; font-stretch: 100%; font-weight: 600; color: var(--graphite-2); margin-bottom: 6px; }
.score-ring { position: relative; margin: 0 0 14px; }
.score-ring svg { display: none; }
.score-ring .val { display: flex; align-items: baseline; gap: 12px; }
.score-ring .big { font: 800 96px/0.9 var(--font); font-stretch: 125%; color: var(--graphite); letter-spacing: -0.03em; }
.score-ring .of { font: 600 21px var(--font); color: var(--graphite-2); }
.kpis { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; margin: 8px 0 24px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.kpi { padding: 12px 4px; text-align: left; }
.kpi + .kpi { border-left: 1.5px solid var(--ink-line); padding-left: 14px; }
.kpi b { display: block; font: 800 24px/1.2 var(--font); font-stretch: 115%; }
.kpi small { font-size: 14px; color: var(--graphite-2); }
.kpi.est small::after { content: ' (est.)'; }
.unlock { background: var(--ink-tint); border-radius: 14px; padding: 18px; margin: 4px 0 18px; }
.unlock h2 { margin-bottom: 12px; }
.unlock ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.unlock li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.unlock li svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--ink); }
.stack { display: grid; gap: 12px; }
.card { border: 2px solid var(--ink-line); border-radius: 14px; padding: 16px; }
.phone-row { display: flex; gap: 8px; }
.phone-row input { flex: 1; min-width: 0; }
.phone-row .btn { min-height: 54px; }
details.sol { border-top: 2px solid var(--ink-line); }
details.sol:last-child { border-bottom: 2px solid var(--ink-line); }
details.sol summary { cursor: pointer; padding: 14px 2px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; list-style: none; min-height: 52px; }
details.sol summary::-webkit-details-marker { display: none; }
details.sol .sol-body { padding: 0 2px 18px; }
.solution { margin-top: 14px; padding-top: 12px; border-top: 1.5px dashed var(--ink-line); }
.solution h4 { margin: 0 0 6px; font-size: 15px; color: var(--ok); }
.ans-line { font-size: 15px; margin: 10px 0 0; color: var(--graphite-2); }

/* ---------------- Test player ---------------- */
body.player { padding-bottom: 150px; }
.t-head { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 2px solid var(--ink); }
.t-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; padding-bottom: 8px; max-width: 1040px; }
.t-title { min-width: 0; }
.t-title b { display: block; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-title small { color: var(--graphite-2); font-size: 13px; }
.t-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.timer { flex: 0 0 auto; text-align: right; }
.timer small { display: block; font-size: 11px; color: var(--graphite-2); }
.timer b { font-size: 23px; font-weight: 800; color: var(--graphite); }
.timer.low b { color: var(--bad); }
.btn-submit-top { min-height: 40px; padding: 8px 16px; font-size: 15px; background: var(--ink); color: #fff; }
.btn-submit-top.ready { animation: ring-pulse 1.6s ease-out infinite; }
@media (prefers-reduced-motion: reduce) { .btn-submit-top.ready { animation: none; } }
.t-body { display: grid; grid-template-columns: 1fr; gap: 16px; padding-top: 14px; max-width: 1040px; }
.q-card { background: var(--paper); color: var(--graphite); padding: 2px 0 16px; min-width: 0; }
.q-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1.5px solid var(--ink-line); }
.q-no { font: 800 19px var(--font); font-stretch: 120%; }
.q-type { font: 700 12px var(--font); background: var(--ink-tint); color: var(--ink-d); padding: 4px 9px; border-radius: 999px; }
.pal-toggle { font: 700 15px var(--font); background: var(--paper); color: var(--graphite); border: 2px solid var(--graphite); border-radius: 999px; min-height: 42px; padding: 6px 14px; cursor: pointer; }
.stem { font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; max-width: 68ch; }
.stem p { margin: 0 0 .8em; }
.stem blockquote { margin: 0 0 .8em; padding-left: 12px; border-left: 3px solid var(--ink-line); }
.stem .katex-display, .solution .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
/* Options are an OMR row: the bubble fills with graphite when chosen. */
.opts { list-style: none; margin: 16px 0 0; padding: 0; display: grid; border-top: 1.5px solid var(--ink-line); }
.opt { display: flex; align-items: flex-start; gap: 14px; padding: 13px 4px; border-bottom: 1.5px solid var(--ink-line); background: var(--paper); cursor: pointer; min-height: 58px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .o-num { flex: 0 0 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); color: var(--ink); display: grid; place-items: center; font: 700 15px var(--font); }
.opt .o-text { padding-top: 5px; overflow-wrap: anywhere; min-width: 0; }
.opt.sel .o-num { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }
.opt.sel .o-text { font-weight: 600; }
.opt.correct { background: var(--ok-tint); }
.opt.correct .o-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.chosen-wrong { background: var(--bad-tint); }
.opt.chosen-wrong .o-num { background: var(--bad); border-color: var(--bad); color: #fff; }
details.sol .opt { cursor: default; }
.tita { margin-top: 16px; }
.tita label { display: block; font-weight: 700; margin-bottom: 6px; }
.tita input { width: 100%; max-width: 300px; font: 700 24px var(--font); padding: 10px 12px; border: 2px solid var(--ink); border-radius: var(--r); background: var(--paper); color: var(--graphite); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 300px; margin-top: 10px; }
.keypad button { min-height: 48px; border-radius: var(--r); border: 1.5px solid var(--ink-line); background: var(--paper); font: 700 19px var(--font); color: var(--graphite); cursor: pointer; }
.keypad button:active { background: var(--ink-tint); }
.keypad button.wide { grid-column: span 2; font-size: 15px; }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--paper); border-top: 2px solid var(--ink); padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); }
.actions .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 1040px; }
.actions .btn { min-height: 48px; padding: 8px 10px; font-size: 15px; font-stretch: 100%; }
.actions .save { grid-column: 1 / -1; }

/* CAT's palette semantics are kept: green answered, red not answered, purple marked. */
.palette { background: var(--paper); padding: 14px; border: 2px solid var(--ink-line); border-radius: 14px; }
.palette h2 { font-size: 18px; margin: 0; }
.legend { list-style: none; padding: 0; margin: 12px 0 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; font-size: 14px; color: var(--graphite-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .pal-btn { width: 30px; height: 30px; min-height: 0; font-size: 12px; cursor: default; }
.pal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.pal-btn { position: relative; display: grid; place-items: center; padding: 0; height: 46px; border-radius: 8px; border: 0; font: 700 15px var(--font); cursor: pointer; color: #fff; background: var(--graphite-3); }
.pal-btn[data-state="not-visited"] { background: var(--paper); color: var(--graphite); box-shadow: inset 0 0 0 1.5px #c9ccd1; }
.pal-btn[data-state="not-answered"] { background: var(--bad); border-radius: 8px 8px 22px 22px; }
.pal-btn[data-state="answered"] { background: var(--ok); border-radius: 22px 22px 8px 8px; }
.pal-btn[data-state="marked"], .pal-btn[data-state="answered-marked"] { background: var(--mark); border-radius: 50%; }
.pal-btn[data-state="answered-marked"]::after { content: ''; position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); border: 2px solid var(--paper); }
.pal-btn.current { outline: 3px solid var(--ink); outline-offset: 2px; }
.palette .btn { width: 100%; }
.pal-head { display: flex; align-items: center; justify-content: space-between; }
.close-pal { display: none; background: none; border: 0; color: var(--graphite-2); font-size: 30px; line-height: 1; min-width: 44px; min-height: 44px; cursor: pointer; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(36, 39, 45, .45); z-index: 30; }
@media (max-width: 899px) {
  .palette { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 82vh; overflow-y: auto; border: 0; border-top: 3px solid var(--ink); border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .2s ease; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .palette.open { transform: none; }
  .palette .close-pal { display: inline-flex; }
}
@media (min-width: 900px) {
  .t-body { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .palette { position: sticky; top: 80px; }
  .pal-toggle, .close-pal, .drawer-backdrop { display: none !important; }
  .actions .wrap { grid-template-columns: auto auto 1fr; }
  .actions .save { grid-column: auto; justify-self: end; min-width: 200px; }
}

.intro { min-height: calc(100dvh - 68px); display: flex; align-items: stretch; flex-direction: column; justify-content: center; text-align: left; padding-bottom: 40px; }
.intro h1 { font-size: 52px; margin-bottom: 4px; }
.intro .lock-note { background: var(--ink-tint); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(36, 39, 45, .5); padding: 16px; }
.modal-box { width: 100%; max-width: 420px; background: var(--paper); border-radius: 16px; padding: 20px; border-top: 4px solid var(--ink); }
.modal-box table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 16px; }
.modal-box td { padding: 8px 0; border-bottom: 1.5px solid var(--ink-line); }
.modal-box td:last-child { text-align: right; font-weight: 800; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.warn { color: var(--warn); font-weight: 600; margin: 0 0 6px; }
.toast { position: fixed; left: 50%; bottom: 160px; transform: translateX(-50%); background: var(--graphite); color: var(--paper); font-weight: 600; padding: 12px 18px; border-radius: 999px; z-index: 90; max-width: calc(100% - 32px); text-align: center; }

/* ---------- Admin / static pages ---------- */
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.stat { border: 2px solid var(--ink-line); border-radius: 14px; padding: 12px; }
.stat span { display: block; font: 800 24px/1.1 var(--font); }
.stat small { color: var(--graphite-2); font-size: 13px; }
.admin-links li { margin: 8px 0; }
.prose { font-size: 16px; color: var(--graphite); max-width: 68ch; }
.prose li { margin-bottom: 6px; }

/* ---------- On-screen calculator (CAT basic) ---------- */
.calc-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; min-width: 40px; padding: 0 10px; border-radius: 999px; border: 2px solid var(--ink-line); background: var(--paper); color: var(--graphite); font: 700 15px var(--font); cursor: pointer; }
.calc-toggle svg { width: 20px; height: 20px; flex: 0 0 20px; }
.calc-toggle.on { border-color: var(--ink); background: var(--ink-tint); color: var(--ink-d); }
.calc-toggle .calc-label { display: none; }
.calc { position: fixed; z-index: 45; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); width: 300px; top: 84px; right: 24px; box-shadow: 0 10px 30px rgba(36, 39, 45, .18); touch-action: none; }
.calc-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 2px solid var(--ink-line); cursor: move; user-select: none; }
.calc-head b { font-weight: 800; font-stretch: 112%; font-size: 15px; flex: 1; }
.calc-head .close { background: none; border: 0; color: var(--graphite-2); font-size: 26px; line-height: 1; width: 40px; height: 40px; cursor: pointer; }
.calc-m { font: 700 12px var(--font); color: var(--ink-d); background: var(--ink-tint); border-radius: 999px; padding: 2px 8px; }
.calc-screen { margin: 10px 10px 8px; border: 2px solid var(--ink-line); border-radius: var(--r); padding: 6px 10px; text-align: right; background: var(--paper); }
.calc-expr { font-size: 13px; color: var(--graphite-2); min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-display { display: block; font: 800 28px/1.15 var(--font); color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc.err .calc-display { font-size: 17px; color: var(--bad); padding: 6px 0; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0 10px 10px; }
.calc-keys button { min-height: 44px; border-radius: var(--r); border: 1.5px solid var(--ink-line); background: var(--paper); color: var(--graphite); font: 700 17px var(--font); cursor: pointer; padding: 0; }
.calc-keys button:active { background: var(--ink-tint); }
.calc-keys button:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.calc-keys .k-mem, .calc-keys .k-fn { font-size: 14px; color: var(--graphite-2); }
.calc-keys .k-op { color: var(--ink-d); font-size: 20px; }
.calc-keys .k-eq { grid-row: span 2; background: var(--graphite); color: var(--paper); border-color: var(--graphite); font-size: 22px; }
.calc-keys .k-zero { grid-column: span 2; }
@media (max-width: 899px) {
  /* Bottom sheet above the action bar; the sticky header (timer) stays visible. */
  .calc { left: 0; right: 0; top: auto; bottom: 0; width: auto; border-width: 3px 0 0; border-radius: 16px 16px 0 0; overflow-y: auto; box-shadow: 0 -8px 24px rgba(36, 39, 45, .14); }
  .calc-head { cursor: default; }
  body.calc-open { padding-bottom: 600px; }
  .calc-keys { gap: 5px; }
  .calc-keys button { min-height: 44px; }
}
@media (min-width: 900px) { .calc-toggle .calc-label { display: inline; } }

/* ---------- RC passages and DILR sets ---------- */
.psg-toggle { display: flex; gap: 0; position: sticky; top: var(--head-h, 64px); z-index: 15; background: var(--paper); padding: 6px 0 8px; }
.psg-toggle button { flex: 1; min-height: 44px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink-d); font: 700 15px var(--font); font-stretch: 112%; cursor: pointer; }
.psg-toggle button:first-child { border-radius: 999px 0 0 999px; }
.psg-toggle [role=tab]:nth-of-type(2) { border-radius: 0 999px 999px 0; border-left-width: 0; }
.psg-toggle button[aria-selected="true"] { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }
.psg-toggle button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.passage { min-width: 0; }
.psg-body { max-height: var(--psg-h, 60vh); overflow-y: auto; overscroll-behavior: contain; border: 2px solid var(--ink-line); border-radius: var(--r); padding: 14px 16px; background: var(--paper); }
.psg-body:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.psg-title { font-size: 17px; margin: 0 0 2px; }
.psg-meta { font-size: 13px; color: var(--graphite-2); margin: 0 0 10px; }
.psg-text { font-size: 16.5px; line-height: 1.65; }
@media (max-width: 899px) {
  .t-body.with-passage.view-question .passage { display: none; }
  .t-body.with-passage.view-passage .q-card { display: none; }
}
.psg-toggle .psg-pal { flex: 0 0 auto; margin-left: 8px; border-radius: 999px !important; border-width: 2px !important; padding: 0 14px; color: var(--graphite); border-color: var(--graphite); }
@media (min-width: 900px) {
  .psg-toggle { display: none !important; }
  .t-body.with-passage { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) 300px; max-width: 1400px; }
  .t-body.with-passage .passage, .t-body.with-passage .q-card { display: block; }
  .passage { position: sticky; top: calc(var(--head-h, 64px) + 12px); }
  .psg-body { max-height: var(--psg-h-desk, 70vh); }
}

/* GFM tables (DILR sets lean on them): scroll sideways inside the box, never the page. */
.tbl-scroll { overflow-x: auto; max-width: 100%; margin: 10px 0 14px; border: 1.5px solid var(--ink-line); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
.tbl-scroll:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.tbl-scroll table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.tbl-scroll th, .tbl-scroll td { padding: 8px 12px; border-bottom: 1px solid var(--ink-line); border-right: 1px solid var(--ink-line); text-align: left; white-space: nowrap; }
.tbl-scroll th { background: var(--ink-tint); color: var(--ink-d); font-weight: 700; }
.tbl-scroll tr:last-child td { border-bottom: 0; }
.tbl-scroll th:last-child, .tbl-scroll td:last-child { border-right: 0; }

/* Para-jumble / odd-sentence TITA keypad: sentence numbers only */
.keypad[data-mode="order"] { grid-template-columns: repeat(5, 1fr); }
.keypad[data-mode="order"] button.wide { grid-column: span 3; }
.keypad[data-mode="order"] button[data-k="back"] { grid-column: span 2; }

/* Results: one passage per set, above its questions */
details.set-psg { border: 2px solid var(--ink-line); border-radius: var(--r); margin: 18px 0 10px; padding: 0 14px; }
details.set-psg summary { cursor: pointer; padding: 12px 0; font-weight: 800; font-stretch: 112%; list-style: none; display: flex; justify-content: space-between; gap: 8px; min-height: 48px; align-items: center; }
details.set-psg summary::-webkit-details-marker { display: none; }
details.set-psg summary span { font-weight: 500; font-size: 13px; color: var(--graphite-2); font-stretch: 100%; }
details.set-psg .psg-text { padding-bottom: 14px; }
.set-group { border-left: 3px solid var(--ink-line); padding-left: 10px; margin-bottom: 14px; }

.wide-only { display: none; }
@media (min-width: 640px) { .wide-only { display: inline; } }
@media (min-width: 900px) { body.wide-test .t-head .wrap, body.wide-test .actions .wrap { max-width: 1400px; } }

/* ---------- Section tabs (Series / Mock / Practice) ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 2px solid var(--ink-line); margin-bottom: 18px; }
.tabs a { position: relative; padding: 10px 0 12px; font: 700 16px var(--font); font-stretch: 112%; color: var(--graphite-2); text-decoration: none; min-height: 44px; }
.tabs a[aria-current="page"] { color: var(--graphite); }
.tabs a[aria-current="page"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--ink); border-radius: 2px; }
.quiet-link { justify-self: center; padding: 12px; min-height: 44px; font: 600 16px var(--font); color: var(--graphite-2); text-decoration: underline; text-underline-offset: 4px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.page-head h1 { margin: 0; }

/* ---------- Practice skill map: sub-topics as OMR bubbles filled by mastery ---------- */
.skill-map section { margin: 18px 0 26px; }
.skill-map h2 { font-size: 21px; margin: 0 0 4px; }
.skill-map h3 { font-size: 15px; font-weight: 700; font-stretch: 100%; color: var(--graphite-2); margin: 16px 0 10px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px 10px; list-style: none; margin: 0; padding: 0; }
.skill { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; background: none; border: 0; padding: 4px 2px; cursor: pointer; font: inherit; color: inherit; min-height: 44px; }
.skill:disabled { cursor: default; }
.skill .bub { --m: 0; position: relative; width: 58px; height: 58px; border-radius: 50%; border: 2.5px solid var(--ink); background: conic-gradient(var(--graphite) calc(var(--m) * 1%), transparent 0); display: grid; place-items: center; }
.skill .bub::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--paper); }
.skill .bub b { position: relative; z-index: 1; font: 800 14px var(--font); }
.skill[data-state="mastered"] .bub { background: var(--graphite); border-color: var(--graphite); }
.skill[data-state="mastered"] .bub::after { background: var(--graphite); }
.skill[data-state="mastered"] .bub b { color: var(--paper); }
.skill[data-state="soon"] .bub { border-style: dashed; border-color: var(--ink-line); background: none; }
.skill .lbl { font-size: 13px; line-height: 1.25; color: var(--graphite); max-width: 110px; }
.skill[data-state="soon"] .lbl { color: var(--graphite-3); }
.skill .lbl small { display: block; color: var(--graphite-3); font-size: 12px; }
.skill:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 12px; }
.levels { list-style: none; margin: 0 0 6px; padding: 0; }
.levels li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1.5px solid var(--ink-line); }
.levels li:last-child { border-bottom: 0; }
.levels .lv { flex: 0 0 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--ink); color: var(--ink); display: grid; place-items: center; font: 800 16px var(--font); }
.levels li[data-status="done"] .lv { background: var(--graphite); border-color: var(--graphite); color: var(--paper); }
.levels li[data-status="locked"] .lv, .levels li[data-status="soon"] .lv { border-style: dashed; border-color: var(--ink-line); color: var(--graphite-3); }
.levels .lv-txt { flex: 1; min-width: 0; }
.levels .lv-txt b { display: block; }
.levels .lv-txt small { color: var(--graphite-2); font-size: 13px; }
.levels .btn { min-height: 44px; padding: 8px 18px; font-size: 15px; }

/* ---------- Practice player (learn mode) ---------- */
.feedback { margin-top: 16px; border: 2px solid var(--ink-line); border-radius: var(--r); padding: 12px 14px; }
.feedback .verdict { font: 800 18px var(--font); font-stretch: 112%; margin: 0 0 4px; }
.feedback.ok { border-color: var(--ok); background: var(--ok-tint); }
.feedback.ok .verdict { color: var(--ok); }
.feedback.bad { border-color: var(--bad); background: var(--bad-tint); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .solution { border-top-color: rgba(36, 39, 45, .2); }
body.practice .opt.locked { cursor: default; }
body.practice .legend { display: none; }
.pal-btn[data-state="correct"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.pal-btn[data-state="wrong"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.pal-btn[data-state="skipped"] { background: var(--paper); border: 2px dashed var(--graphite-3); color: var(--graphite-2); }
.levels .lv svg { width: 18px; height: 18px; }
.pr-only { display: none; }
body.practice .pr-only:not(.hidden) { display: inline-flex; }
body.practice #mark-next, body.practice #clear, body.practice #save-next { display: none; }
body.practice .actions .wrap { grid-template-columns: 1fr 1fr; }
body.practice #next-q { grid-column: 1 / -1; }
@media (min-width: 900px) { body.practice .actions .wrap { grid-template-columns: auto 1fr; } body.practice #check, body.practice #next-q { justify-self: end; min-width: 200px; grid-column: auto; } }

/* ---------- Mock analysis ---------- */
.analysis { margin: 6px 0 22px; }
.analysis > h2 { margin: 8px 0 12px; }
.an-card { border: 2px solid var(--ink-line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.an-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.an-head h3 { margin: 0; font-size: 17px; font-weight: 800; font-stretch: 112%; }
.an-aside { font-size: 13px; color: var(--graphite-2); }
.an-card h4 { margin: 14px 0 6px; font-size: 14px; color: var(--graphite-2); }
.an-none { margin: 0; }
.an-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: center; }
@media (min-width: 640px) { .an-split { grid-template-columns: 260px 1fr; } }
.an-scatter { width: 100%; max-width: 300px; height: auto; }
.an-scatter text { font: 500 10px var(--font); fill: var(--graphite-2); }
.an-scatter .an-axis { font-size: 11px; fill: var(--graphite); }
.an-grid { stroke: var(--ink-line); }
.an-band { fill: var(--ok-tint); stroke: var(--ok); stroke-dasharray: 4 3; }
.an-dot circle { fill: var(--graphite); stroke: var(--paper); stroke-width: 2; }
.an-dot text { font-weight: 700; fill: var(--graphite); }
.an-legend { font-size: 13px; color: var(--graphite-2); margin: 6px 0 0; line-height: 1.8; }
.an-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 6px -1px 0; }
.an-key-band { background: var(--ok-tint); border: 1.5px dashed var(--ok); }
.an-key-dot { background: var(--graphite); border-radius: 50% !important; }
.k-ok { background: var(--ok); } .k-bad { background: var(--bad); } .k-skip { background: var(--graphite-3); margin-left: 10px !important; }
.an-legend .k-bad { margin-left: 10px; }
.an-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.an-bars li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.an-bars li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar { height: 10px; border-radius: 5px; background: var(--ink-tint); overflow: hidden; }
.an-bar i { display: block; height: 100%; background: var(--graphite); }
.an-bars b { font-size: 13px; min-width: 44px; text-align: right; }
.an-list { list-style: none; margin: 0; padding: 0; }
.an-list li { border-top: 1.5px solid var(--ink-line); }
.an-list li:first-child { border-top: 0; }
.an-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 0; min-height: 48px; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.an-row:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.an-q { flex: 0 0 auto; font-weight: 800; min-width: 38px; }
.an-topic { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.an-topic small { display: block; color: var(--graphite-2); font-size: 12px; }
.an-time { font-size: 13px; text-align: right; white-space: nowrap; }
.an-time small { display: block; color: var(--graphite-3); font-size: 11px; }
.an-lost { font-weight: 800; color: var(--bad); font-size: 13px; white-space: nowrap; }
.an-why { font-size: 13px; color: var(--bad); font-weight: 600; white-space: nowrap; }
.an-next { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.an-next .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; flex: 0 0 auto; }
.an-strip-wrap { overflow-x: auto; padding-bottom: 4px; }
.an-strip text { font: 600 9px var(--font); fill: var(--graphite-2); }
.an-strip .s-correct { fill: var(--ok); } .an-strip .s-wrong { fill: var(--bad); } .an-strip .s-unattempted { fill: var(--graphite-3); }

/* ---------- Today ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.today { padding-bottom: 30px; }
.next-card { border: 2.5px solid var(--ink); border-radius: 14px; padding: 22px 18px 18px; margin: 6px 0 22px; }
.next-card .omr-row { display: flex; gap: 10px; list-style: none; margin: 0 0 18px; padding: 0; }
.next-card .omr-row li { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); }
.next-card .omr-row .fill { background: var(--graphite); border-color: var(--graphite); }
.next-kicker { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--ink-d); }
.next-card h2 { font-size: 34px; margin: 0 0 6px; text-wrap: balance; }
.next-sub { margin: 0 0 20px; color: var(--graphite-2); }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.week-head h3 { margin: 0; font-size: 17px; }
.week .streak { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--warn); }
.week .streak svg { width: 18px; height: 18px; }
.week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.week-row li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-row .b { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink-line); }
.week-row li.on .b { background: var(--graphite); border-color: var(--graphite); }
.week-row li.now .b { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.week-row small { font-size: 12px; color: var(--graphite-2); font-weight: 700; }

/* ---------- Report an issue ---------- */
.report-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 2px; min-height: 40px; background: none; border: 0; color: var(--graphite-2); font: 600 13px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.report-link:hover { color: var(--ink-d); }
.report-form fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.radio-row { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1.5px solid var(--ink-line); cursor: pointer; }
.radio-row input { width: 22px; height: 22px; accent-color: var(--graphite); }
.report-form .note { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.report-form textarea { font: 400 16px var(--font); padding: 10px; border: 2px solid var(--ink-line); border-radius: var(--r); resize: vertical; }
.report-form textarea:focus { outline: none; border-color: var(--ink); }
.report-thanks { font-weight: 700; color: var(--ok); margin: 8px 0 16px; }
