/* loop.css — A* loop screens (paper, marking, results, dashboard, repair tutor).
   Uses the app's design tokens from styles.css. */

/* ---------- shared ---------- */
/* Domain chips carry quiet, palette-disciplined colour so a Pure / Mechanics /
   Statistics / Synoptic question is recognisable at a glance — examiner-adjacent
   hues, never a rainbow, all AA on cream. One chip system across paper, the
   dashboard queue, results and repair. Pure→examiner red, Mechanics→slate-blue,
   Statistics→amber, Synoptic→deep ink. */
.loop-chip {
  display: inline-block; padding: 0.14rem 0.5rem; border-radius: 5px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: #434a5e; background: rgba(86, 93, 114, 0.08);
  border: 1px solid rgba(86, 93, 114, 0.30);
}
.loop-chip-pure       { color: #821e28; background: rgba(130, 30, 40, 0.07); border-color: rgba(130, 30, 40, 0.28); }
.loop-chip-mechanics  { color: #2c5377; background: rgba(55, 110, 166, 0.09); border-color: rgba(55, 110, 166, 0.30); }
.loop-chip-statistics { color: #7a4f12; background: rgba(155, 107, 22, 0.10); border-color: rgba(155, 107, 22, 0.30); }
.loop-chip-mixed      { color: #2a2f3a; background: rgba(33, 35, 31, 0.07); border-color: rgba(33, 35, 31, 0.26); }

.loop-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.4rem 1.6rem; box-shadow: var(--shadow);
}
.loop-lede { color: var(--muted); max-width: 64ch; }
.loop-next-row { display: flex; gap: 0.8rem; align-items: center; margin: 2rem 0 1rem; flex-wrap: wrap; }
.loop-figure { margin: 0.9rem 0; text-align: center; }
.loop-figure img { max-width: min(480px, 100%); height: auto; background: var(--plate, #fff); /* diagrams stay paper-white in dark mode */ border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.loop-locked { opacity: 0.75; }
.loop-none { color: var(--muted); }

/* ---------- sit the paper ---------- */
.loop-paper-page { max-width: 1080px; margin: 0 auto; }
.loop-paper-bar {
  position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.7rem 1rem; margin: 0 0 1.2rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px;
}
.loop-paper-meta { margin: 0; color: var(--muted); font-size: 0.92rem; }
.loop-paper-bar-right { display: flex; align-items: center; gap: 0.8rem; }

/* ---------- paper timer in the nav bar ---------- */
/* Paper mode turns the nav bar into the exam-hall instrument: a labelled
   clock readout seated dead-centre of the bar (its own full-width row on
   small screens), with the depleting red line running along the bar's
   bottom crease — the crease itself (theme-pure.css) is the track it
   drains across. Injected by mountPaperTimer() in loop-screens.js and
   scoped by body.paper-mode so every other screen's nav bar is untouched. */
.loop-timer-wrap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: baseline; gap: 0.6rem; padding: 0.2rem 0.9rem;
}
.loop-timer-label {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.loop-timer {
  /* Hanken Grotesk's default figures are uniform-width in the self-hosted
     subsets (verified with fontTools), so the readout never jitters as it
     ticks; tabular-nums/tnum is declared for fallback faces that need it. */
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-weight: 700; font-size: 1.5rem; line-height: 1; letter-spacing: 0.01em;
  color: var(--ink);
}
.loop-timer-low { color: var(--danger); animation: loopTimerLow 2s ease-in-out infinite; }
.loop-timer-wrap:has(.loop-timer-low) .loop-timer-label { color: var(--danger); }
@keyframes loopTimerLow { 0%, 100% { opacity: 1; } 50% { opacity: 0.62; } }
/* paused: the clock holds its breath — greyed digits, no pulse */
.loop-timer-paused { color: var(--muted); animation: none; }
.loop-timer-wrap:has(.loop-timer-paused) .loop-timer-label { color: var(--muted); }

/* pause/reset — quiet ghost affordances built into the instrument. Pausing is
   allowed, not encouraged: tiny, muted, but honest 44px-ish tap targets. */
.loop-timer-controls { display: inline-flex; gap: 0.15rem; margin-left: 0.35rem; }
.loop-timer-ctrl {
  border: 0; background: none; cursor: pointer; padding: 0.45rem 0.45rem;
  font: inherit; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
  border-radius: 6px; transition: color 0.15s ease;
}
.loop-timer-ctrl:hover { color: var(--accent); }
.loop-timer-ctrl:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.loop-timer-note { margin: 0.3rem 0 0; color: var(--accent-strong); font-size: 0.88rem; line-height: 1.45; }

.loop-timer-progress {
  position: absolute;
  left: 0; bottom: -2px;           /* drawn across the nav bar's bottom crease */
  height: 3px; width: 100%;
  background: var(--accent);       /* Tuscan dark red var(--accent) (theme-pure.css) */
  border-radius: 0 2px 2px 0;      /* pen-stroke right-hand tip */
  transform-origin: left center;
  transition: width 1s linear;     /* smooth depletion between ticks */
  pointer-events: none; z-index: 41;
}
/* .topbar is already position:sticky, so the absolutely-positioned line anchors
   to it and spans the full nav-bar (viewport) width. */
.loop-timer-progress-low { background: var(--danger); }

/* Small screens: the clock gets its own full-width row beneath the brand/nav
   row — designed as part of the instrument, not squeezed beside the buttons. */
@media (max-width: 860px) {
  body.paper-mode .topbar { flex-wrap: wrap; }
  .loop-timer-wrap {
    position: static; transform: none; order: 3;
    width: 100%; justify-content: center;
    margin-top: 0.45rem; padding: 0.5rem 0 0.15rem;
    border-top: 1px dashed var(--line);
  }
  .loop-timer { font-size: 1.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .loop-timer-low { animation: none; }
  .loop-timer-progress { transition: none; }
}

/* The sheet reads as warm paper, not white: a hair-warmer fill than the cream
   page, one fine ink edge, a soft lift — never a stark card. */
.loop-paper-sheet {
  background: #FBF4E4; border: 1px solid rgba(23, 32, 31, 0.12); border-radius: 4px;
  padding: clamp(1.6rem, 3.5vw, 3rem) clamp(1.4rem, 5vw, 4rem);
  box-shadow: 0 1px 0 rgba(23, 32, 31, 0.05), 0 18px 40px -28px rgba(23, 32, 31, 0.28);
}
/* Exam front sheet: title block left, a labelled Instructions block right —
   composed so neither side leaves a void. */
.loop-sheet-head {
  display: grid; grid-template-columns: 1fr auto; gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
  border-bottom: 2.5px solid var(--ink); padding-bottom: 1.3rem; margin-bottom: 1.9rem;
}
/* The title block sits as one centred group against the taller instructions —
   any leftover height splits top + bottom instead of pooling into one gap. A
   hand-drawn red pen underline gives the title weight and the page its colour. */
.loop-sheet-title { display: flex; flex-direction: column; align-items: flex-start; }
.loop-sheet-title h1 { margin: 0; font-size: clamp(2rem, 3.6vw, 2.9rem); line-height: 1.05; letter-spacing: -0.015em; }
.loop-sheet-underline { display: block; width: min(22rem, 94%); height: 0.5rem; margin: -0.1rem 0 0.5rem; color: var(--accent); overflow: visible; }
.loop-sheet-sub { margin: 0; color: var(--ink); font-weight: 500; }
.loop-sheet-stat { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.loop-sheet-instructions { min-width: 17rem; max-width: 24rem; }
.loop-sheet-instr-label {
  margin: 0 0 0.4rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
}
.loop-sheet-instructions ul { margin: 0; padding: 0; list-style: none; font-size: 0.9rem; color: var(--ink-soft, var(--ink)); }
.loop-sheet-instructions li { margin: 0.28rem 0; padding-left: 0.95rem; position: relative; line-height: 1.45; }
.loop-sheet-instructions li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong, #c9bfa6); }
/* The one instruction that's ours, not the exam hall's: a quiet red tick. */
.loop-y12-note { color: var(--ink); }
.loop-y12-note::before { background: var(--accent) !important; width: 5px !important; height: 5px !important; }

/* "You may use the … formula booklet" — front-sheet furniture pointing at the
   board's official booklet. Like the AS note it's ours, so it takes the red
   tick; the link is inked and underlined. */
.loop-sheet-formula { color: var(--ink); }
.loop-sheet-formula::before { background: var(--accent) !important; width: 5px !important; height: 5px !important; }
.loop-sheet-formula a, .exam-formula a {
  color: var(--accent); font-weight: 600; text-decoration: underline;
  text-underline-offset: 0.14em; text-decoration-thickness: 1px;
}
.loop-sheet-formula a:hover, .exam-formula a:hover { text-decoration-thickness: 2px; }
.loop-ext { font-size: 0.82em; }
.loop-formula-link { display: inline-flex; align-items: center; gap: 0.38em; }

/* Diagnostic paper front sheet (app.js .exam-head): same message, paragraph form. */
.exam-formula { margin: 0.6rem 0 0; font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft, var(--ink)); }

/* Printed front sheets can't be clicked — spell the URL out so a student working
   off paper can still reach the booklet. The action-bar link is no-print. */
@media print {
  .loop-sheet-formula a, .exam-formula a { text-decoration: none; color: inherit; }
  .loop-sheet-formula a::after, .exam-formula a::after {
    content: " (" attr(href) ")"; font-size: 0.82em; word-break: break-all;
  }
}

.loop-q { padding: 1.7rem 0; border-bottom: 1px solid rgba(23, 32, 31, 0.08); }
.loop-q:last-child { border-bottom: 0; }
.loop-q-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.7rem; }
/* Question folios: a hand-drawn examiner-pen ring (not a cold geometric circle —
   that read corporate/imperial) round a Fraunces numeral. The ring is the
   product's signature red pen mark; the number is ink. */
.loop-q-folio { position: relative; display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex-shrink: 0; }
.loop-q-ring { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--accent); overflow: visible; }
.loop-q-number {
  position: relative; color: var(--accent);
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.05rem;
  font-variant-numeric: tabular-nums; line-height: 1;
}
/* The folio (ring + numeral) carries the question's domain colour — the same
   hue as its stamp chip: Pure red, Mechanics slate-blue, Statistics amber,
   Synoptic ink. The whole header reads as one colour-coded mark. */
.loop-q-pure .loop-q-ring, .loop-q-pure .loop-q-number { color: #821e28; }
.loop-q-mechanics .loop-q-ring, .loop-q-mechanics .loop-q-number { color: #2c5377; }
.loop-q-statistics .loop-q-ring, .loop-q-statistics .loop-q-number { color: #7a4f12; }
.loop-q-mixed .loop-q-ring, .loop-q-mixed .loop-q-number { color: #2a2f3a; }
.loop-q-marks { margin-left: auto; font-size: 0.82rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.loop-q-context { color: var(--ink); }
.loop-q-banner { color: var(--muted); font-style: italic; }
.loop-q-stem { font-weight: 500; }
.loop-parts { list-style: none; margin: 0.7rem 0 0; padding: 0; }
.loop-part { padding: 0.5rem 0; }
.loop-part-row { display: grid; grid-template-columns: 2.6rem 1fr 3rem; gap: 0.5rem; align-items: start; }
.loop-part-label { font-weight: 700; }
.loop-part-body p { margin: 0; }
/* Bulleted stem/context/part lines (loopFlowText) — same visual language as
   structuredContent's .mr-list, distinct class so it doesn't collide with the
   unrelated top-level .loop-q-list (repair-list UI). */
.loop-q-bullets { list-style: none; margin: 0.3rem 0; padding-left: 1.1rem; }
.loop-q-bullets li { position: relative; padding: 0.15rem 0; line-height: 1.55; }
.loop-q-bullets li::before { content: "–"; position: absolute; left: -1.1rem; color: var(--accent); font-weight: 700; }
/* Marks column: right-aligned on a fixed measure, brackets toned down so the
   number reads, all tabular so they stack into a clean column. */
.loop-part-marks { color: var(--muted); font-weight: 600; font-size: 0.9rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loop-part-marks i { font-style: normal; color: var(--line-strong, #c9bfa6); }

/* The paper is a paper: question text fills the sheet column like a real exam
   script (and like our own print output), not a narrow 60%-width block. The
   marks column still bounds each part's body via the grid. */
@media (min-width: 900px) {
  .loop-q-context, .loop-q-banner, .loop-q-stem, .loop-part-body { max-width: 92ch; }
}

/* ── Upload phase container ──────────────────────────────────────────────── */
.loop-upload {
  margin: 1.8rem 0 3rem;
  background: var(--surface, #FCFAF3);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: clamp(1.5rem, 4vw, 2.2rem);
  box-shadow: 0 22px 50px -34px rgba(33,7,6,0.5);
}

/* Two-column upload paths: phone QR + device dropzone side-by-side */
.loop-upload-paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
  align-items: stretch;
}
/* When QR not yet shown, device path fills the full width */
.loop-upload-paths:has(.loop-upload-path:only-child),
.loop-upload-paths .loop-device-path:only-child { grid-column: 1 / -1; }

.loop-upload-path {
  display: flex;
  flex-direction: column;
}

/* Dropzone */
.loop-dropzone {
  display: grid; place-items: center; min-height: 100%; cursor: pointer;
  background: var(--surface-soft, #faf4e4);
  border: 1.5px dashed var(--line-strong); border-radius: 14px;
  color: var(--muted); text-align: center;
  padding: 1.5rem 1.2rem;
  transition: border-color 0.18s ease, background 0.18s ease;
  flex: 1;
}
.loop-dropzone.drag, .loop-dropzone:hover {
  border-color: var(--accent);
  background: rgba(137,29,26,0.05);
}
.loop-dropzone-label { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; pointer-events: none; font-size: 0.95rem; color: var(--ink-soft); }
.loop-dropzone-label strong { color: var(--ink); font-weight: 700; }
.loop-dropzone-icon {
  width: 46px; height: 46px; padding: 11px; border-radius: 50%; box-sizing: border-box;
  background: rgba(137,29,26,0.08); color: var(--accent); flex-shrink: 0;
}

/* Gallery header — count badge shown once at least one page is uploaded */
.loop-gallery-header {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0.4rem 0 0.85rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.loop-page-count {
  font-size: 0.73rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
}

/* Upload list: tidy gallery grid */
.loop-upload-list {
  list-style: none; padding: 0; margin: 0 0 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}
.loop-upload-list:empty { margin: 0; display: none; }

/* Individual upload item card */
.loop-upload-item {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface-soft, #faf4e4);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem 0.5rem 0.5rem;
  gap: 0.4rem; position: relative; font-size: 0.8rem;
  text-align: center; overflow: hidden;
  box-shadow: 0 8px 20px -16px rgba(33,7,6,0.5);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.loop-upload-item--done { border-color: var(--line); }
.loop-upload-item--uploading { opacity: 0.7; }

/* Thumbnail area */
.loop-upload-thumb {
  width: 100%; aspect-ratio: 3/4; border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface, #FCFAF3); flex-shrink: 0;
}
.loop-upload-thumb--img { cursor: zoom-in; transition: box-shadow 0.15s; }
.loop-upload-thumb--img:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.loop-upload-thumb--img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.loop-upload-thumb--file {
  color: var(--muted);
  border: 1px dashed var(--line);
}

.loop-upload-name {
  font-size: 0.74rem; font-weight: 600; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; letter-spacing: 0.01em;
}

/* Spinner for in-progress uploads */
.loop-upload-spinner {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: loop-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .loop-upload-spinner { animation: none; opacity: 0.5; }
}
@keyframes loop-spin { to { transform: rotate(360deg); } }

.loop-remove {
  border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1;
  color: var(--muted); padding: 0 2px;
  transition: color 0.12s;
}
.loop-remove:hover { color: var(--accent); }

/* Message / error */
.loop-upload .form-message:empty { margin: 0; display: none; }

/* Submit row */
.loop-submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.2rem; }
.loop-submit { flex-shrink: 0; }
.admin-skip { /* keep existing style, just make it secondary-feeling in context */ }

.loop-microcopy { color: var(--muted); font-size: 0.83rem; margin-top: 0.75rem; line-height: 1.55; max-width: 60ch; }

@media print {
  @page { margin: 12mm 14mm; }

  .no-print, .topbar, .topnav, footer { display: none !important; }
  .loop-paper-sheet { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.35; }

  /* Compact the paper header; keep it on page 1, but let questions flow after it. */
  .loop-sheet-head { padding-bottom: 0.55rem; margin-bottom: 0.9rem; gap: 1.4rem; }
  .loop-sheet-head h1 { font-size: 1.4rem; }
  .loop-sheet-instructions { font-size: 0.8rem; }
  .loop-q-ring, .loop-q-number { color: #000 !important; }
  .loop-sheet-underline { display: none; }
  .loop-chip { border-color: #999 !important; }

  /* Questions flow continuously down the page (no whole-question break-inside). */
  .loop-q { padding: 0.7rem 0; }
  .loop-q:first-of-type { padding-top: 0; }
  .loop-q-head { margin-bottom: 0.35rem; }
  /* Keep the number/marks header with the start of the question, never orphaned. */
  .loop-q-head { break-after: avoid; break-inside: avoid; }
  .loop-q-context, .loop-q-banner, .loop-q-stem { break-after: avoid; }
  .loop-parts { margin-top: 0.35rem; }

  /* Protect individual parts from splitting, but allow a long question's
     parts to break across pages. */
  .loop-part { padding: 0.3rem 0; break-inside: avoid; }

  /* Don't strand a figure on its own. */
  .loop-figure { break-inside: avoid; }
}

/* ---------- paper skeleton (shown instantly while the paper loads) ---------- */
.loop-skel {
  display: inline-block; vertical-align: middle; height: 0.85em; max-width: 100%;
  border-radius: 6px; background: var(--line);
  background-image: linear-gradient(90deg, var(--line) 25%, var(--surface-soft) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: loopShimmer 1.3s linear infinite;
}
@keyframes loopShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.loop-paper-loading .loop-q-number { background: var(--line); animation: loopShimmer 1.3s linear infinite; }
.loop-paper-loading h1 .loop-skel { height: 1.4rem; }
@media (prefers-reduced-motion: reduce) {
  .loop-skel, .loop-paper-loading .loop-q-number { animation: none; }
}

/* ---------- marking ---------- */
/* "Your examiner is marking…" — the original beating dot (owner-approved;
   do not redesign this screen). */
/* Marking wait: deliberately bare — the beating dot (owner-loved, never
   redesigned) and one headline, large, centred in the viewport. No progress
   bar, step list or timer; the page is a calm pause, not a dashboard. */
.loop-marking { display: grid; place-items: center; min-height: calc(100vh - 140px); }
.loop-marking-card { text-align: center; }
.loop-marking-card h1 { font-size: clamp(2.4rem, 6vw, 3.9rem); margin: clamp(2.4rem, 5vw, 3.4rem) 0 0; letter-spacing: -0.01em; }
.loop-marking-pulse {
  width: clamp(120px, 14vw, 168px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: var(--accent); opacity: 0.85; animation: loopPulse 1.6s ease-in-out infinite;
}
@keyframes loopPulse { 0%,100% { transform: scale(0.85); opacity: 0.55; } 50% { transform: scale(1.05); opacity: 0.95; } }
/* The sweep bar + one cross-fading phase line — character, not a dashboard. */
.loop-marking-track {
  position: relative; height: 4px; margin: clamp(2rem, 4vw, 2.9rem) auto 1.3rem; max-width: 340px;
  border-radius: 999px; background: var(--line); overflow: hidden;
}
.loop-marking-track-glow {
  position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loopTrackGlow 2s ease-in-out infinite;
}
@keyframes loopTrackGlow { from { left: -42%; } to { left: 102%; } }
.loop-marking-phase {
  color: var(--muted); font-size: 1.08rem; margin: 0; min-height: 1.5em;
  transition: opacity 0.32s ease;
}
.loop-marking-phase.is-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .loop-marking-pulse, .loop-marking-track-glow { animation: none; }
  .loop-marking-track-glow { left: 0; width: 100%; opacity: 0.5; }
  .loop-marking-phase { transition: none; }
}

/* ---------- unmarkable submission ("this wasn't a maths script") ---------- */
.loop-unmarkable-page { max-width: 660px; margin: 0 auto; padding-top: clamp(1rem, 5vh, 3rem); }
.loop-unmarkable { padding: clamp(1.4rem, 4.5vw, 2.6rem); }
.loop-unmarkable-head { display: flex; gap: 1.1rem; align-items: flex-start; }
.loop-unmarkable-head h1 { margin: 0 0 0.5rem; font-size: clamp(1.45rem, 4.6vw, 1.9rem); line-height: 1.15; }
.loop-unmarkable-icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: 14px; background: var(--accent-wash); color: var(--accent);
}
.loop-unmarkable-icon svg { width: 26px; height: 26px; }
.loop-unmarkable-lede { margin: 0; color: var(--muted); line-height: 1.55; }
.loop-unmarkable-sub {
  margin: 1.6rem 0 0.2rem; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.loop-checklist { list-style: none; margin: 0; padding: 0; }
.loop-checklist li {
  display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.85rem 0;
  border-bottom: 1px dashed var(--line);
}
.loop-checklist li:last-child { border-bottom: 0; }
.loop-checklist-icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px;
  margin-top: 0.1rem; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-soft); color: var(--accent);
}
.loop-checklist-icon svg { width: 18px; height: 18px; }
.loop-checklist strong { display: block; color: var(--ink); margin-bottom: 0.1rem; }
.loop-checklist li > div > span { color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.loop-unmarkable-actions { margin: 1.8rem 0 0.2rem; align-items: center; }
.loop-support-link { color: var(--muted); font-size: 0.92rem; text-decoration: underline; text-underline-offset: 3px; }
.loop-support-link:hover { color: var(--accent); }
@media (max-width: 480px) {
  .loop-unmarkable-head { flex-direction: column; gap: 0.9rem; }
  .loop-unmarkable-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .loop-unmarkable-actions .primary-button { width: 100%; justify-content: center; }
}

/* ---------- results ---------- */
/* The marked front page: the score sits inside a hand-drawn red ink ellipse
   (the examiner's circle), the way a final mark is rung on a real script. */
.loop-results { max-width: 780px; margin: 0 auto; }
.loop-score-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 2rem clamp(1.2rem, 4vw, 2.6rem) 2.2rem; box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.loop-score-row { display: flex; align-items: center; gap: clamp(1.4rem, 4vw, 2.4rem); flex-wrap: wrap; margin-top: 0.4rem; }
.loop-score-ring { position: relative; display: inline-grid; place-items: center; padding: 1.4rem 2rem; }
.loop-score {
  font-family: "Fraunces", Georgia, serif; font-weight: 600;
  font-size: clamp(3.2rem, 9vw, 4.8rem); letter-spacing: -0.03em;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1;
}
.loop-score-ellipse {
  position: absolute; inset: 0; width: 100%; height: 100%;
  color: var(--accent); overflow: visible;
}
.loop-score-ellipse-path {
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: loopEllipseDraw 0.9s cubic-bezier(0.5, 0, 0.2, 1) 0.35s forwards;
}
@keyframes loopEllipseDraw { to { stroke-dashoffset: 0; } }
.loop-score-side { flex: 1; min-width: 220px; }
.loop-score-side p { margin: 0.3rem 0; color: var(--muted); }
.loop-score-marks { font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; color: var(--ink-soft, var(--ink)); }
.loop-score-marks strong { font-size: 1.7rem; color: var(--ink); }
.loop-delta { display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.18rem 0.65rem; border-radius: 999px; font-size: 0.88rem; font-weight: 700; }
.loop-delta.up { background: var(--soft-good, #e4efe4); color: var(--good-strong, #245231); }
.loop-delta.down { background: var(--soft-red, #f3e1dc); color: var(--danger); }
.loop-bar-note { font-size: 0.88rem; max-width: 40ch; }
.loop-progressbar { position: relative; height: 10px; margin-top: 1.8rem; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--line); }
.loop-progressbar-fill { height: 100%; border-radius: 999px; margin: -1px 0 0 -1px; border: 1px solid transparent;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 78%, var(--bg)), var(--accent)); }
.loop-progressbar-astar { position: absolute; top: -7px; bottom: -7px; width: 2.5px; background: var(--ink); border-radius: 2px; }
.loop-progressbar-astar i {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-family: "Fraunces", Georgia, serif; font-style: normal; font-weight: 700;
  font-size: 0.78rem; color: var(--ink); letter-spacing: 0.02em;
}

.loop-holes-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 1.6rem clamp(1.2rem, 4vw, 2.4rem) 1.8rem; box-shadow: var(--shadow); }
.loop-holes-panel h2 { margin-top: 0; font-size: clamp(1.25rem, 3.4vw, 1.55rem); }
.loop-holes-sub { color: var(--muted); margin-top: -0.4rem; }
.loop-holes { list-style: none; padding: 0; margin: 1rem 0 0; }
.loop-hole { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 0.2rem; border-bottom: 1px dashed var(--line-strong, var(--line)); }
.loop-hole:last-child { border-bottom: 0; }
.loop-hole-main { display: flex; align-items: center; gap: 0.8rem; }
.loop-hole-main small { display: block; color: var(--muted); margin-top: 0.1rem; }
.loop-hole-none { color: var(--muted); }
.loop-locked { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 10px; border: 1px dashed var(--line-strong, var(--line));
  color: var(--faint); opacity: 1; }
.loop-locked svg { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* examiner's margin note: red rule down the left, paper wash behind */
.loop-paywall { position: relative; margin-top: 1.6rem; padding: 1.3rem 1.4rem 1.4rem 1.55rem;
  border-radius: 4px 14px 14px 4px; background: var(--surface-soft);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.loop-paywall h3 { margin-top: 0; font-size: 1.12rem; }
.loop-paywall p { color: var(--muted); }

/* ---------- dashboard ---------- */
/* The examiner's desk, composed across the bench. A quiet scoreboard strip
   ruled across the top (the readiness gauge in miniature, best mark, papers
   sat, a "?" that unfolds the A* bar). Below it the desk itself: the dominant
   zone is THE NEXT MOVE — the one thing to do now, set in display type — with
   the open-holes queue ruled beneath it; the right rail (due checks /
   repaired & holding / papers) speaks in a smaller, muted voice. Rules and
   whitespace do all the separating: no boxes, one focal point. Prose measure
   stays ≤70ch; the composition uses the whole page rail (it shares the
   1280px edge the nav brand sits on). Under 1200px the desk folds to one
   column; under 700px the rail folds shut into disclosures. */
.loop-dash { max-width: 820px; margin: 0 auto; }

/* header bar: whisper eyebrow left, scoreboard right, one hairline under */
.loop-dash-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.7rem 1.4rem; flex-wrap: wrap;
  padding-bottom: 0.85rem; border-bottom: 1px solid var(--line-strong);
}
/* the slogan is gone; this whisper is all that remains of it. Doubled class
   outranks theme-pure's `.eyebrow { color: var(--accent) !important }` (it
   loads later), keeping the strip down to one quiet voice — the red is
   saved for NEXT MOVE and the marks. */
.loop-dash .loop-dash-eyebrow { margin: 0; color: var(--muted) !important; letter-spacing: 0.16em; }

.loop-sb { display: flex; align-items: center; gap: 1.05rem; min-width: 0; }
.loop-sb-item { display: inline-flex; align-items: baseline; gap: 0.45rem; white-space: nowrap; }
.loop-sb-item + .loop-sb-item { padding-left: 1.05rem; border-left: 1px solid var(--line-strong); }
.loop-ring { width: 21px; height: 21px; flex: 0 0 auto; align-self: center; }
.loop-ring-track { stroke: var(--line-strong); }
.loop-ring-fill { stroke: var(--accent); transition: stroke-dasharray 0.9s cubic-bezier(0.3, 0.6, 0.25, 1) 0.2s; }
.loop-sb-num {
  font-family: "Fraunces", Georgia, serif; font-size: 1.18rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums;
}
.loop-sb-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.loop-sb-info {
  position: relative; display: grid; place-items: center;
  width: 26px; height: 26px; margin: -1px 0; flex: 0 0 auto;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: none; cursor: pointer; color: var(--muted);
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.76rem; font-weight: 700; line-height: 1;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.loop-sb-info::after { content: ""; position: absolute; inset: -10px; } /* 44px+ hit area */
.loop-sb-info:hover, .loop-sb-info[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
/* Quiet settings gear at the end of the scoreboard — the only account/settings
   entry point (the topbar stays at two buttons). */
.loop-sb-settings { display: grid; place-items: center; width: 28px; height: 28px; margin-left: 0.1rem; flex: 0 0 auto; color: var(--muted); border-radius: 50%; transition: color 0.15s ease; }
.loop-sb-settings:hover { color: var(--accent); }
.loop-sb-settings:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the one-time education line, folded behind the "?" */
.loop-bar-explain {
  margin: 0.75rem 0 0 auto; text-align: right;
  color: var(--muted); font-size: 0.88rem; line-height: 1.5; max-width: 70ch;
}
.loop-bar-explain em { color: var(--ink-soft); }

/* the desk: one column until the bench is wide enough to earn the rail */
.loop-desk { margin-top: clamp(2.3rem, 7vh, 3.6rem); }
.loop-desk-main { min-width: 0; }

/* the next move — the page's single focal point, set in display type */
.loop-move { margin: 0; }
.loop-move-label {
  display: flex; align-items: center; gap: 0.7rem; margin: 0 0 1rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.17em;
  text-transform: uppercase; color: var(--accent);
}
.loop-move-label::after {
  content: ""; flex: 0 0 2.4rem; height: 2px; margin-top: 1px;
  background: var(--accent); border-radius: 2px;
}
.loop-move-headline {
  margin: 0; font-size: clamp(1.85rem, 4.6vw, 2.7rem);
  line-height: 1.07; letter-spacing: -0.025em; max-width: 22ch; color: var(--ink);
}
.loop-move-headline em {
  font-style: italic; color: var(--accent);
  /* the examiner's pen stroke under the part that matters */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M3 9 C 30 4 80 3.5 117 6.5' fill='none' stroke='%23891d1a' stroke-width='2.4' stroke-linecap='round' opacity='0.8'/%3E%3C/svg%3E") no-repeat bottom center / 100% 0.3em;
  padding-bottom: 0.16em;
}
.loop-move-sub { margin: 0.8rem 0 0; color: var(--muted); font-size: 1.02rem; line-height: 1.55; max-width: 52ch; }
.loop-move-actions { display: flex; align-items: center; gap: 0.9rem 1.1rem; flex-wrap: wrap; margin-top: 1.6rem; }
.loop-move-actions .form-message { margin: 0; min-height: 0; flex-basis: 100%; }

/* section titles: small caps, quiet — the rules do the architecture */
.loop-section-title {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin: 0; padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line-strong);
  font-family: "Hanken Grotesk", ui-sans-serif, sans-serif !important;
  font-size: 0.7rem !important; font-weight: 700 !important;
  letter-spacing: 0.17em; text-transform: uppercase; color: var(--muted);
}
.loop-title-count {
  font-family: "Fraunces", Georgia, serif; font-size: 1.12rem; font-weight: 600;
  letter-spacing: -0.01em; line-height: 1; color: var(--ink-soft, var(--ink));
  font-variant-numeric: tabular-nums;
}

/* the queue: the open holes, calm ledger rows under the next move */
.loop-queue { margin-top: clamp(2.4rem, 7vh, 3.8rem); }
.loop-q-list { list-style: none; margin: 0; padding: 0; }
.loop-q-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  margin: 0 -0.45rem; padding: 0.95rem 0.45rem;
  border-bottom: 1px dashed var(--line-strong); border-radius: 8px;
  transition: background-color 0.18s ease;
}
.loop-q-row[hidden] { display: none; } /* author display:flex must not defeat [hidden] */
.loop-q-row:has(.loop-q-repair):hover,
.loop-q-row:has(.loop-mini-revisit):hover { background: var(--accent-wash, rgba(137, 29, 26, 0.07)); }
.loop-q-main { min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.loop-q-skill { font-weight: 600; font-size: 0.99rem; line-height: 1.4; color: var(--ink-soft, var(--ink)); }
.loop-q-meta { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }
/* .loop-q-marks is shared with the paper rungs (line ~137), where it floats
   right via margin-left:auto — in the dashboard meta line it hugs the chip */
.loop-q-meta .loop-q-marks { margin-left: 0; font-size: inherit; font-weight: 500; font-variant-numeric: tabular-nums; }
.loop-q-repair {
  white-space: nowrap; padding: 0.7rem 0.45rem; border-radius: 6px; flex: 0 0 auto;
  font-size: 0.86rem; font-weight: 700; color: var(--accent);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(137, 29, 26, 0.4);
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.loop-q-repair:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
/* due memory checks: same queue, calmer amber lane — a scheduled re-proof of a skill they
   already fixed (revisit icon + faint warm wash + lighter title), not a fresh break. */
.loop-q-due { background: rgba(108, 76, 18, 0.05); }
.loop-q-due .loop-q-skill { font-weight: 500; }
.loop-q-row.loop-q-due:has(.loop-q-repair):hover { background: rgba(108, 76, 18, 0.10); }
.loop-q-tag { display: inline-flex; align-items: center; gap: 0.32rem; font-weight: 700; color: var(--warn-deep); } /* deep amber: 6.3:1 on the cream bg */
.loop-q-revisit { flex: 0 0 auto; opacity: 0.95; }
.loop-q-none {
  margin: 0; padding: 1.1rem 0 0.2rem;
  font-family: "Fraunces", Georgia, serif; font-style: italic; font-size: 1rem;
}
.loop-q-more {
  display: inline-flex; align-items: center; margin-top: 0.55rem;
  border: 0; background: none; cursor: pointer; padding: 0.7rem 0.45rem; border-radius: 6px;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.86rem; font-weight: 700; color: var(--accent);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(137, 29, 26, 0.4);
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.loop-q-more:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
.loop-q-more .loop-q-more-close { display: none; }
.loop-q-more[aria-expanded="true"] .loop-q-more-open { display: none; }
.loop-q-more[aria-expanded="true"] .loop-q-more-close { display: inline; }

/* the rail: due checks / repaired & holding / papers — the quiet voice.
   Each section is a <details>: open ruled columns on desktop and tablet,
   collapsed disclosures on the phone. The summary doubles as the section's
   ruled heading, so both presentations share one skeleton. */
.loop-rail { min-width: 0; margin-top: clamp(2.6rem, 8vh, 4rem); }
.loop-fold + .loop-fold { margin-top: clamp(1.5rem, 4vh, 2.3rem); }
.loop-fold summary {
  display: flex; align-items: baseline; gap: 0.6rem;
  min-height: 48px; padding: 0.85rem 0.1rem 0.7rem; cursor: pointer;
  list-style: none; border-radius: 6px;
  border-bottom: 1px solid var(--line-strong);
}
.loop-fold summary::-webkit-details-marker { display: none; }
.loop-fold summary::marker { content: ""; }
.loop-fold-title {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.17em;
  text-transform: uppercase; color: var(--muted); transition: color 0.15s ease;
}
.loop-fold summary:hover .loop-fold-title { color: var(--ink); }
.loop-fold-count {
  font-family: "Fraunces", Georgia, serif; font-size: 1.12rem; font-weight: 600;
  line-height: 1; color: var(--ink-soft, var(--ink)); font-variant-numeric: tabular-nums;
}
.loop-fold-chev { margin-left: auto; align-self: center; width: 15px; height: 15px;
  flex: 0 0 auto; color: var(--faint); transition: transform 0.2s ease; }
.loop-fold[open] .loop-fold-chev { transform: rotate(180deg); }
.loop-fold summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.loop-fold-body { padding: 0.15rem 0.1rem 0.2rem; }
.loop-fold-note { margin: 0.85rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

/* rail rows: the queue's skeleton in a smaller, muted voice */
.loop-rail .loop-q-row { margin: 0; padding: 0.75rem 0.1rem; gap: 0.9rem; border-bottom-color: var(--line); }
.loop-rail .loop-q-skill { font-size: 0.9rem; }
.loop-rail .loop-q-meta { font-size: 0.76rem; gap: 0.45rem; }
.loop-rail .loop-chip { font-size: 0.6rem; padding: 0.1rem 0.4rem; }
.loop-r-list .loop-q-row:last-child { border-bottom: 0; }

.loop-timeline { list-style: none; padding: 0; margin: 0.2rem 0 0; max-width: 480px; }
.loop-rail .loop-timeline { max-width: none; font-size: 0.9rem; }
.loop-rail .loop-tl-item { padding: 0.5rem 0; }
.loop-tl-item { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.6rem 0; }
.loop-tl-link { display: flex; align-items: baseline; gap: 0.6rem; flex: 1; min-width: 0;
  color: inherit; text-decoration: none; border-radius: 6px; }
.loop-tl-link:hover .loop-tl-label { color: var(--accent); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.loop-tl-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.loop-tl-label { color: var(--ink-soft); font-weight: 500; }
.loop-tl-dots { flex: 1; border-bottom: 2px dotted var(--line-strong, var(--line)); transform: translateY(-3px); }
.loop-tl-score { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.loop-tl-score.best { color: var(--accent-strong); }
.loop-tl-item.latest .loop-tl-label { font-weight: 700; color: var(--ink); }
.loop-tl-item.pending .loop-tl-score { color: var(--muted); font-weight: 500; font-style: italic; }

/* locked repairs: a quiet dashed lock where the repair link would be */
.loop-mini-lock { display: grid; place-items: center; width: 28px; height: 28px;
  flex: 0 0 auto; border-radius: 8px; border: 1px dashed var(--line-strong, var(--line)); color: var(--faint); }
.loop-mini-lock svg { width: 13px; height: 13px; }
/* repaired & holding rows (inside the rail fold) */
.loop-held { display: inline-flex; align-items: center; gap: 0.3rem; flex: 0 0 auto;
  color: var(--accent-strong); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.loop-held.gold { color: var(--warn-deep); } /* deep amber: AA on the cream bg */
.loop-mini-tick { width: 14px; height: 14px; flex: 0 0 auto; }
/* repaired skills are walkable again: the skill name links to the revisit */
.loop-mini-revisit { color: inherit; text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1.5px; text-decoration-color: rgba(137, 29, 26, 0.35);
  transition: color 0.18s ease; border-radius: 4px; }
.loop-mini-revisit:hover { color: var(--accent); text-decoration-color: currentColor; }
.loop-mini-dates { color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.loop-dash .loop-none {
  font-family: "Fraunces", Georgia, serif; font-style: italic; font-size: 1rem;
  color: var(--muted); border-bottom: 0 !important; padding: 0.55rem 0 0.2rem;
}

.loop-dash a:not(.primary-button):focus-visible,
.loop-dash button:not(.primary-button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* signed-out gate ("Sign in to see your loop") — boxless, centred, quiet */
.loop-gate-card {
  max-width: 460px; margin: clamp(2rem, 14vh, 5.5rem) auto 0; text-align: center;
}
.loop-gate-card h1 { margin: 0.6rem 0 0.45rem; font-size: clamp(1.6rem, 5vw, 2.1rem); }
.loop-gate-sub { margin: 0; color: var(--muted); }
.loop-gate-card .loop-next-row { justify-content: center; margin: 1.6rem 0 0; }

/* wide bench (≥1200px): the desk earns its rail — dominant move + queue
   left, the record in a narrow muted column right. The dashboard releases
   its single-column cap and spans the page rail (1280px), the same edge
   the nav brand sits on, so wide monitors read one composed sheet instead
   of a floating strip. */
@media (min-width: 1200px) {
  .loop-dash { max-width: none; }
  .loop-desk {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    column-gap: clamp(2.5rem, 4vw, 4rem);
    align-items: start;
  }
  /* the first rail rule sits on the NEXT MOVE label's line */
  .loop-rail { margin-top: 0; }
  .loop-rail .loop-fold:first-child summary { margin-top: -0.85rem; }
  .loop-move-headline { font-size: clamp(2.35rem, 2.5vw, 3.05rem); }
  .loop-move-sub { font-size: 1.06rem; }
  /* open sections read as quiet columns: the chevron whispers off; the
     heading still folds on click (hover darkens it; focus ring shows) */
  .loop-fold-chev { display: none; }
}

/* phone (≤700px): its own design — compact scoreboard (papers count lives
   in the Papers disclosure instead), the move first, the queue, then the
   rail folded shut into tappable disclosures. */
@media (max-width: 700px) {
  /* Paper front sheet stacks: title over instructions, no squeezed two-up. */
  .loop-sheet-head { grid-template-columns: 1fr; gap: 1.1rem; align-items: start; }
  .loop-sheet-instructions { min-width: 0; max-width: none; padding-top: 0.9rem; border-top: 1px solid rgba(23,32,31,0.1); }
  .loop-part-row { grid-template-columns: 2.2rem 1fr 2.6rem; }
  .loop-dash-bar { flex-direction: column; align-items: stretch; gap: 0.6rem; padding-bottom: 0.8rem; }
  .loop-sb { justify-content: space-between; gap: 0.8rem; }
  .loop-sb-item + .loop-sb-item { padding-left: 0.8rem; }
  .loop-sb-papers { display: none; }
  .loop-bar-explain { text-align: left; margin-left: 0; }
  .loop-desk { margin-top: 2rem; }
  .loop-move-headline { font-size: clamp(1.6rem, 7.6vw, 1.95rem); }
  .loop-move-actions { flex-direction: column; align-items: stretch; margin-top: 1.3rem; }
  .loop-move-actions .primary-button, .loop-move-actions .ghost-button {
    width: 100%; justify-content: center; text-align: center;
  }
  .loop-queue { margin-top: 2.3rem; }
  .loop-q-row { gap: 0.8rem; }
  /* the rail becomes a ruled stack of disclosures */
  .loop-rail { margin-top: 2.5rem; }
  .loop-fold + .loop-fold { margin-top: 0; }
  .loop-fold summary { align-items: center; padding: 0.85rem 0.1rem; }
  .loop-fold-body { padding-bottom: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .loop-ring-fill { transition: none; }
  .loop-q-row, .loop-q-repair, .loop-q-more, .loop-fold-chev,
  .loop-sb-info, .loop-fold-title, .loop-mini-revisit, .loop-tl-link { transition: none; }
}

/* ---------- repair tutor ---------- */
/* One narrative column — a hand-set revision card with the examiner's red pen
   in the margins, not a dashboard. 680px measure, guide content woven in as
   red-rule margin notes, depth chosen by repair_mode (REPAIR-PAGE-BRIEF). */
.loop-repair { max-width: 680px; margin: 0 auto; }
.loop-repair-head { margin-bottom: 1.6rem; }
.loop-back { display: inline-block; margin-bottom: 0.8rem; color: var(--muted); text-decoration: none; }
.loop-repair-title h1 { margin: 0.3rem 0 0.1rem; font-size: clamp(1.4rem, 3.6vw, 2rem); }
.loop-repair-title p { margin: 0; color: var(--muted); }
/* The app's global `input { width:100%; padding; border }` rule mangles native
   checkboxes/radios on the loop screens — every click re-laid-out an oversized
   control ("shaky ticks"). Fixed-size accent-coloured controls, zero shift. */
.loop-repair input[type="checkbox"],
.loop-repair input[type="radio"],
.loop-results input[type="radio"],
.loop-results input[type="checkbox"] {
  width: 1.05rem; height: 1.05rem; min-width: 1.05rem; flex: 0 0 auto;
  margin: 0.18rem 0 0; padding: 0; border: 0; border-radius: 0;
  background: none; accent-color: var(--accent); cursor: pointer;
}

/* Typeset maths must never blow a card open: scroll inside, quietly. */
.loop-repair mjx-container, .loop-results mjx-container,
.loop-paper-page mjx-container {
  max-width: 100%; overflow-x: auto; overflow-y: hidden;
}
/* Inline maths must sit ON the text baseline, not drop toward subscript:
   keep MathJax's computed baseline (no vertical-align override) and give it a
   little horizontal air so it doesn't crowd the words either side. */
.loop-repair mjx-container:not([display="true"]),
.loop-results mjx-container:not([display="true"]),
.loop-paper-page mjx-container:not([display="true"]) {
  margin-inline: 0.12em; vertical-align: baseline;
}
.loop-repair mjx-container[display="true"],
.loop-results mjx-container[display="true"],
.loop-paper-page mjx-container[display="true"] { vertical-align: middle; }
.loop-lesson-main, .loop-lesson-side { min-width: 0; }

.loop-repair-head { margin-bottom: 1.4rem; }
.loop-back { display: inline-block; margin-bottom: 1rem; color: var(--muted); font-size: 0.92rem;
  text-decoration: none; }
.loop-back:hover { color: var(--accent); }
/* topic eyebrow: small caps in the accent, the .loop-action-eyebrow idiom */
.loop-repair-eyebrow { display: flex; align-items: center; gap: 0.65rem; margin: 0 0 0.35rem; }
.loop-repair-eyebrow span { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); }
.loop-repair-title h1 { margin: 0.45rem 0 0.2rem; font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  letter-spacing: -0.02em; max-width: 26ch; }
.loop-repair-title p { margin: 0; color: var(--muted); }
.loop-mode-badge { display: inline-block; margin-top: 0.55rem !important; padding: 0.26rem 0.75rem;
  border-radius: 999px; background: var(--accent-wash, #f3e1dc);
  color: var(--accent-strong) !important; font-size: 0.78rem; font-weight: 700; }
.loop-revisit-note { margin-top: 0.55rem !important; color: var(--muted); font-size: 0.92rem;
  line-height: 1.5; max-width: 52ch; }

/* stepper row: visible stages for the mode + the skip-to-retest ghost */
.loop-stepper-row { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-top: 1.1rem; }
.loop-stepper { display: flex; gap: 0; list-style: none; padding: 0; margin: 0.2rem 0 0; flex-wrap: wrap; }
.loop-stepper li { position: relative; display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 1.1rem 0.4rem 0.5rem; color: var(--faint); font-size: 0.9rem; font-weight: 600; }
.loop-stepper li:not(:last-child)::after { content: ""; width: 1.4rem; height: 0;
  border-top: 2px dotted var(--line-strong, var(--line)); margin-left: 0.6rem; }
.loop-stepper li span { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; border: 1.5px solid var(--line-strong, var(--line));
  background: var(--surface); font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.loop-stepper li.now { color: var(--accent-strong); }
.loop-stepper li.now span { background: var(--accent); border-color: var(--accent); color: #fdf4e3; }
.loop-stepper li.done { color: var(--ink-soft, var(--ink)); }
.loop-stepper li.done span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
/* ≤480px: "Step 2 of 4 · Practise" + a thin red progress rule (the paper-timer
   line idiom) — never four wrapping pills */
.loop-stepper-compact { display: none; flex: 1 1 100%; }
.loop-stepper-compact span { font-size: 0.84rem; font-weight: 700; color: var(--ink-soft, var(--ink)); }
.loop-stepper-rule { display: block; height: 3px; margin-top: 0.4rem; border-radius: 2px;
  background: var(--line); overflow: hidden; }
.loop-stepper-rule i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.loop-skip-wrap { text-align: right; max-width: 240px; }
.loop-skip-retest { white-space: nowrap; }
.loop-skip-note { margin: 0.45rem 0 0; color: var(--faint); font-size: 0.82rem; line-height: 1.45; }
.loop-skip-mobile { display: none; }
@media (max-width: 640px) {
  .loop-skip-desktop { display: none; }
  .loop-skip-mobile { display: inline-flex; }
  .loop-next-row .loop-skip-mobile { width: 100%; justify-content: center; text-align: center; }
}
@media (max-width: 480px) {
  .loop-stepper { display: none; }
  .loop-stepper-compact { display: block; }
}
.loop-quiet-link { border: 0; background: none; cursor: pointer; padding: 0.55rem 0.3rem;
  font: inherit; font-size: 0.92rem; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; }
.loop-quiet-link:hover { color: var(--accent); }
.loop-quiet-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the one reading column */
.loop-lesson { display: block; }
.loop-lesson-main { max-width: 100%; }
.loop-lesson-main h2 { margin: 0 0 0.7rem; font-size: clamp(1.2rem, 3.2vw, 1.45rem); }
.loop-lesson-main h3 { margin: 1.5rem 0 0.55rem; font-size: 1.05rem; }
.loop-lesson-main p, .loop-routine, .loop-example-a { line-height: 1.6; }
.loop-routine { margin-bottom: 0.4rem; }

/* examiner's margin notes: red rule, Fraunces italic lead-in — the pen in the
   margin (replaces the old amber .loop-examiner pill, which read as warning UI) */
.loop-margin-note { display: block; margin: 1.1rem 0; padding: 0.85rem 1.05rem 0.9rem 1.15rem;
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px; background: var(--surface-soft); }
.loop-margin-lead { font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 600;
  color: var(--accent); margin-right: 0.35rem; }
.loop-margin-body { display: inline; }
.loop-margin-body, .loop-margin-note { font-size: 0.95rem; line-height: 1.55; color: var(--ink-soft, var(--ink)); }
.loop-leak-note { margin-top: 0; margin-bottom: 1.3rem; }

/* formula box — the centrepiece */
.loop-formula { margin: 0.9rem 0; padding: 1.05rem 1.25rem; border-radius: 4px 12px 12px 4px;
  background: var(--surface-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); overflow-x: auto; }
.loop-formula-eyebrow { display: block; margin-bottom: 0.45rem; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.loop-formula-body { font-weight: 600; line-height: 1.6; }
/* multi-line method boxes stay left-aligned prose; equations are the display objects */
.loop-formula-body .mr-block, .loop-formula-body .mr-list { text-align: left; }
.loop-formula-body br + * { margin-top: 0.35rem; }

/* method steps: Fraunces numerals hanging in the margin like a marker's tally */
.loop-method { list-style: none; counter-reset: loopstep; padding-left: 1.9rem; }
.loop-method li { counter-increment: loopstep; position: relative; margin: 0.65rem 0;
  line-height: 1.55; max-width: 60ch; }
.loop-method li::before { content: counter(loopstep) "."; position: absolute; left: -1.9rem; top: 0;
  width: 1.4rem; text-align: right; font-family: "Fraunces", Georgia, serif;
  font-weight: 600; color: var(--accent); }

/* structuredContent blocks (math-render.js) */
.mr-block { margin: 0 0 0.7rem; line-height: 1.65; }
.mr-block br { content: ""; display: block; margin-top: 0.25rem; }
.mr-list { list-style: none; margin: 0 0 0.7rem; padding-left: 1.1rem; }
.mr-list li { position: relative; padding: 0.2rem 0; line-height: 1.55; }
.mr-list li::before { content: "–"; position: absolute; left: -1.1rem;
  color: var(--accent); font-weight: 700; }
.loop-leak-checklist { margin-top: 0.2rem; }

/* disclosures: dashed folds, verb summaries, 44px tap targets */
.loop-example { margin-top: 1.1rem; border: 1px dashed var(--line-strong, var(--line));
  border-radius: 12px; padding: 0.45rem 1rem; }
.loop-example[open] { background: var(--surface-soft, transparent); padding-bottom: 0.85rem; }
.loop-example summary { cursor: pointer; font-weight: 600; color: var(--accent-strong);
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
  min-height: 44px; margin: 0 -1rem; padding: 0.3rem 1rem; }
.loop-example summary::-webkit-details-marker { display: none; }
.loop-example summary::before { content: ""; width: 0.5rem; height: 0.5rem; flex: 0 0 auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.18s ease; }
.loop-example[open] summary::before { transform: rotate(45deg); }
.loop-example-a { margin-top: 0.5rem; line-height: 1.6; }
.loop-example-q { font-weight: 500; }
.loop-example h4 { margin: 1.1rem 0 0.4rem; font-size: 0.95rem; }
.loop-reteach-fold { margin-top: 1.4rem; }

/* stage swap: 150ms fade/8px rise, GPU-only, guarded below */
.loop-repair .loop-lesson, .loop-repair .loop-ladder,
.loop-repair .loop-mcq, .loop-repair .loop-prove {
  animation: loopStageIn 0.15s ease-out;
}
@keyframes loopStageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.loop-ladder .loop-rung { margin-bottom: 1.2rem; }
.loop-rung header { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem;
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.loop-rung header h3 { margin: 0; font-size: 1.08rem; }
.loop-rung header .loop-q-marks { margin-left: auto; }
.loop-rung-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 0.85rem; flex: 0 0 auto; }
.loop-rung-q { font-weight: 500; line-height: 1.6; }
.loop-rung-support { color: var(--muted); }
.loop-rung-prompts { color: var(--muted); padding-left: 1.2rem; }
.loop-rung-prompts li { margin: 0.3rem 0; line-height: 1.5; }
.loop-rung-prompts li::marker { color: var(--accent); }

.loop-mcq-item { margin-bottom: 1.2rem; }
/* Probe question + options read in the body font (Hanken Grotesk), not a
   cramped legacy style (repair-ux fix 4): comfortable size + line-height. */
.loop-mcq-item h3 { margin-top: 0; font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem; line-height: 1.55; font-weight: 600; }
.loop-options { display: grid; gap: 0.55rem; }
.loop-option { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem 0.95rem;
  border: 1px solid var(--line-strong, var(--line)); border-radius: 12px; cursor: pointer;
  background: var(--surface); transition: border-color 0.15s ease, background 0.15s ease; }
.loop-option:hover { border-color: var(--accent); background: var(--accent-wash, var(--surface)); }
.loop-option:has(input:checked) { border-color: var(--accent); background: var(--accent-wash, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent); }
.loop-option:has(input:disabled) { cursor: default; opacity: 0.96; }
.loop-option .loop-option-text, .loop-option span {
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem; line-height: 1.6; }
.loop-option b { color: var(--accent-strong); margin-right: 0.2rem; font-weight: 700; }
/* a correct probe locks with a calm cue; a wrong one is marked but never
   reveals the right option — it stays answerable (fix 3). */
.loop-mcq-item.is-correct .loop-option:has(input:checked) {
  border-color: var(--good, #2f6b3f); box-shadow: inset 0 0 0 1px var(--good, #2f6b3f);
  background: var(--good-wash, rgba(47, 107, 63, 0.09)); }
.loop-mcq-item.is-wrong .loop-option:has(input:checked) {
  border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger);
  background: var(--soft-red, #f6e7e6); }
.loop-mcq-feedback { margin: 0.7rem 0 0; padding: 0.75rem 1rem; border-radius: 4px 10px 10px 4px;
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.98rem; line-height: 1.6; border: 1px solid var(--line); }
.loop-mcq-feedback .loop-fb-mark { display: inline; font-weight: 700; margin-right: 0.25rem; }
.loop-mcq-feedback .loop-fb-retry { display: block; margin-top: 0.35rem; font-weight: 600; }
.loop-mcq-feedback.ok { background: var(--soft-good, #e4efe4); color: var(--good-strong, #245231);
  border-left: 3px solid var(--good, #2f6b3f); }
.loop-mcq-feedback.bad { background: var(--soft-red); color: var(--danger);
  border-left: 3px solid var(--danger); }

.loop-retest-upload { margin: 1.3rem 0 0.4rem; }
.loop-retest-drop { margin-top: 0 !important; }
.loop-retest-drop.drag { border-color: var(--accent); background: var(--accent-wash, var(--surface-soft)); }
.loop-retest-upload .loop-upload-list { margin: 0.7rem 0 0.2rem; }
.loop-retest-gate {
  margin: 0.9rem 0 0.2rem; padding: 1rem 1.1rem 1.1rem 1.25rem;
  border-radius: 4px 12px 12px 4px; background: var(--surface-soft);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
}
.loop-retest-gate p { margin: 0 0 0.75rem; color: var(--ink-soft, var(--ink)); line-height: 1.5; }
.loop-retest-gate-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
@media (max-width: 520px) {
  .loop-retest-gate-actions { flex-direction: column; align-items: stretch; }
  .loop-retest-gate-actions .primary-button, .loop-retest-gate-actions .ghost-button { width: 100%; justify-content: center; text-align: center; }
}

/* Mark-distribution block (repair-ux fix 5): where each mark is credited. */
.loop-markdist { margin: 1.1rem 0 0.4rem; padding: 0.9rem 1.05rem 1rem;
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px; background: var(--surface-soft); }
.loop-markdist-head { margin: 0 0 0.6rem; font-family: "Hanken Grotesk", ui-sans-serif, sans-serif;
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: baseline; gap: 0.6rem; }
.loop-markdist-total { margin-left: auto; font-family: "Fraunces", Georgia, serif;
  font-size: 0.95rem; letter-spacing: 0; text-transform: none; color: var(--accent-strong); }
.loop-markdist-list { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.loop-markdist-row { display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.loop-markdist-row:last-child { border-bottom: 0; }
.loop-markdist-mark { flex: 0 0 auto; min-width: 2.1rem; text-align: center;
  font-family: "Hanken Grotesk", ui-sans-serif, sans-serif; font-weight: 700; font-size: 0.9rem;
  color: var(--bg); background: var(--accent); border-radius: 6px; padding: 0.12rem 0.4rem; }
.loop-markdist-mark-pending { background: var(--muted, #8a7e66); }
.loop-markdist-text { flex: 1 1 auto; line-height: 1.55;
  font-family: "Hanken Grotesk", ui-sans-serif, sans-serif; }
.loop-markdist-reason { display: block; margin-top: 0.2rem; font-size: 0.9rem; color: var(--muted); font-style: italic; }
.loop-markdist-verdict { flex: 0 0 auto; font-weight: 700; font-size: 1.05rem; }
.loop-markdist-marked .is-awarded .loop-markdist-verdict { color: var(--good-strong, #245231); }
.loop-markdist-marked .is-awarded .loop-markdist-mark { background: var(--good, #2f6b3f); color: var(--on-good, #f4faf2); }
.loop-markdist-marked .is-missed .loop-markdist-verdict { color: var(--danger); }
.loop-markdist-marked .is-missed .loop-markdist-mark { background: var(--muted, #8a7e66); }

/* Prove — AI-marking flow (repair-ux fix 6). */
.loop-prove-actions { margin-top: 0.9rem; }
.loop-prove-selfmark-note { margin: 0.7rem 0 0; font-size: 0.92rem; color: var(--muted); }
.loop-prove-selfmark-note.is-open { opacity: 0.7; }
.loop-selfmark { margin-top: 1rem; }
.loop-retest-marking { text-align: center; padding: 1.6rem 1rem 1.4rem; margin: 1.1rem 0 0.4rem;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.loop-retest-marking h3 { margin: 0 0 0.8rem; font-size: 1.1rem; }
.loop-retest-result { margin-top: 1.1rem; }
.loop-retest-verdict { padding: 1.1rem 1.2rem 1.2rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); }
.loop-retest-verdict.is-fail { border-left: 3px solid var(--danger); border-radius: 4px 14px 14px 4px; }
.loop-retest-verdict.is-pass { border-left: 3px solid var(--good, #2f6b3f); border-radius: 4px 14px 14px 4px; }
.loop-retest-verdict.is-pass .loop-retest-score strong { color: var(--good-strong, #245231); }
.loop-retest-verdict.is-unmarkable { border-left: 3px solid var(--accent); border-radius: 4px 14px 14px 4px; }
/* The embedded (bytes) retest score beat sits inside the prove byte result slot. */
.loop-byte-prove-score { margin-top: 0.6rem; }
.loop-retest-verdict h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.loop-retest-score { font-family: "Fraunces", Georgia, serif; font-size: 1.3rem; margin-bottom: 0.4rem; }
.loop-retest-score strong { color: var(--accent-strong); font-size: 1.6rem; }
.loop-retest-verdict-lede { color: var(--ink-soft, var(--ink)); line-height: 1.55; margin: 0 0 0.6rem; }

.loop-scheme { list-style: none; padding: 0; margin: 0.9rem 0; }
.loop-scheme li { display: block; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.loop-scheme li:last-child { border-bottom: 0; }
.loop-scheme label { display: flex; gap: 0.65rem; align-items: flex-start; cursor: pointer; }
.loop-scheme label span { line-height: 1.5; }
.loop-scheme label b { color: var(--accent-strong); margin-right: 0.2rem; }
.loop-scheme-tally { font-size: 1.05rem; }
.loop-scheme-tally strong { font-family: "Fraunces", Georgia, serif; font-size: 1.25rem;
  color: var(--accent-strong); font-variant-numeric: tabular-nums; }

.loop-repaired { display: grid; place-items: center; min-height: 60vh; }
.loop-repaired-card { text-align: center; max-width: 520px; padding: 2.4rem clamp(1.4rem, 5vw, 3rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); }
.loop-repaired-tick { width: 64px; height: 64px; color: var(--accent);
  filter: drop-shadow(0 1px 0 rgba(137, 29, 26, 0.18)); }
.loop-repaired-tick-path { stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: loopEllipseDraw 0.7s cubic-bezier(0.5, 0, 0.2, 1) 0.2s forwards; }
.loop-repaired-card h1 { margin: 0.8rem 0 0.6rem; font-size: clamp(1.6rem, 5vw, 2.1rem); }
.loop-repaired-sub { color: var(--muted); line-height: 1.6; }
.loop-repaired-sub strong { color: var(--ink); }
.loop-repaired-card .loop-next-row { justify-content: center; margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .loop-repaired-tick-path { animation: none; stroke-dashoffset: 0; }
  .loop-repair .loop-lesson, .loop-repair .loop-ladder,
  .loop-repair .loop-mcq, .loop-repair .loop-prove { animation: none; }
  .loop-timer-ctrl, .loop-quiet-link { transition: none; }
}

/* repair CTA row on phones: full-width, primary first, ≥44px */
@media (max-width: 640px) {
  .loop-repair .loop-next-row { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .loop-repair .loop-next-row .primary-button,
  .loop-repair .loop-next-row .ghost-button,
  .loop-repair .loop-next-row .admin-skip {
    width: 100%; justify-content: center; text-align: center; min-height: 44px;
  }
}

/* print: the blind retest goes to paper clean — question + diagram + marks,
   no chrome, no upload UI (.no-print), no scheme spoilers */
@media print {
  .loop-repair-head .loop-stepper-row, .loop-repair-head .loop-back,
  .loop-repair .loop-next-row, .loop-mode-badge, .loop-margin-note { display: none !important; }
  .loop-repair { max-width: none; }
  .loop-prove .loop-card { border: 0; box-shadow: none; padding: 0; }
}
.loop-scheme label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}
.loop-scheme label input[type="checkbox"] { flex: 0 0 auto; margin-top: 0.3rem; }
.loop-scheme label span { flex: 1 1 auto; text-align: left; }
.loop-scheme mjx-container { display: inline-block !important; text-align: left !important; margin: 0 !important; }
.loop-formula mjx-container { margin: 0.4rem 0 !important; }

/* Global styles.css sets `input { width: 100% }` — fatal for checkboxes/radios
   inside flex labels (the control's layout box fills the row and crushes the
   text span). Restore natural sizing inside loop controls. */
.loop-scheme label input[type="checkbox"],
.loop-options label input[type="radio"],
.loop-option input[type="radio"] {
  width: auto;
}
.loop-scheme label span { width: auto; }

/* Triage clusters + blank-report UI */
.loop-cluster { list-style: none; margin: 0 0 1.1rem; padding: 1rem 1.1rem;
  background: var(--surface-soft, rgba(255,255,255,0.5)); border: 1px solid var(--line);
  border-radius: 12px; }
.loop-cluster-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-bottom: 0.4rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--line); }
.loop-cluster-head strong { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
.loop-cluster-head small { color: var(--accent-strong); font-weight: 600; white-space: nowrap; }
.loop-cluster .loop-hole:last-child { padding-bottom: 0.2rem; }
.loop-modal-overlay { position: fixed; inset: 0; background: rgba(30,20,10,0.45); display: flex; align-items: center; justify-content: center; z-index: 60; }
.loop-modal { background: var(--paper, #faf6ee); border-radius: 14px; padding: 1.6rem; max-width: 560px; width: 92%; max-height: 86vh; overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,0.25); }
.loop-blank-row { padding: 0.45rem 0; border-bottom: 1px dashed var(--line, #ddd); }
.loop-blank-reasons { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 0.3rem; }
.loop-blank-reasons label { display: inline-flex; gap: 0.3rem; align-items: center; font-size: 0.92rem; cursor: pointer; }
.loop-blank-row input[type="checkbox"], .loop-blank-reasons input[type="radio"] { width: auto; }
.loop-pending-intent h3 { margin-top: 0; }

/* ---------- upgrade / paywall page ---------- */
/* Pricing as two clean cards on the paper ground; the season pass is the
   featured ink panel. Ticks are drawn red strokes, not text glyphs. */
.upg-page { max-width: 860px; margin: 0 auto; padding-bottom: 2.5rem; }
.upg-lede { color: var(--muted); line-height: 1.6; max-width: 56ch; }

.upg-cancelled {
  margin: 0 0 1.6rem; padding: 0.85rem 1.1rem; border-radius: 12px;
  background: var(--surface-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--blue, #565d72); color: var(--muted); font-size: 0.95rem;
}
.upg-cancelled strong { color: var(--ink); }

.upg-mission { margin-bottom: 2.6rem; padding: 1.6rem clamp(1.2rem, 4vw, 2.2rem) 1.8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-soft, var(--shadow)); }
.upg-mission h1 { margin: 0.2rem 0 0.5rem; font-size: clamp(1.5rem, 4.5vw, 2rem); }
.upg-mission-steps { list-style: none; counter-reset: upgstep; margin: 1.2rem 0 1.4rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.7rem; }
.upg-mission-steps li { counter-increment: upgstep; padding: 0.75rem 0.9rem; border-radius: 12px;
  background: var(--surface-soft); border: 1px solid var(--line); }
.upg-mission-steps b { display: block; font-family: "Fraunces", Georgia, serif; font-weight: 600; }
.upg-mission-steps b::before { content: counter(upgstep) ". "; color: var(--accent); font-weight: 700; }
.upg-mission-steps span { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.upg-mission-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.upg-quiet-link { color: var(--muted); font-size: 0.95rem; text-decoration: underline; text-underline-offset: 3px; }
.upg-quiet-link:hover { color: var(--accent); }

.upg-head { text-align: center; margin: 0.6rem 0 2rem; }
.upg-head h1 { margin: 0.3rem 0 0.7rem; font-size: clamp(2rem, 6vw, 2.9rem); letter-spacing: -0.025em; }
.upg-head h1 em { font-style: italic; color: var(--accent); }
.upg-head .upg-lede { margin: 0 auto; }

.upg-tick { width: 17px; height: 17px; flex: 0 0 auto; color: var(--accent); margin-top: 0.22em; }

.upg-free { max-width: 640px; margin: 0 auto 2.4rem; padding: 1.25rem 1.5rem 1.35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-soft, var(--shadow)); }
.upg-free-title { margin: 0 0 0.7rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint); font-family: "Hanken Grotesk", sans-serif !important; }
.upg-free-list { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 1.6rem; }
.upg-free-list li { display: flex; gap: 0.55rem; align-items: flex-start; line-height: 1.4; color: var(--ink-soft, var(--ink)); }
@media (max-width: 560px) { .upg-free-list { grid-template-columns: 1fr; } }

.upg-pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: stretch; margin-bottom: 1.6rem; }
@media (max-width: 720px) { .upg-pricing { grid-template-columns: 1fr; } }
.upg-card { display: flex; flex-direction: column; padding: 1.7rem 1.7rem 1.8rem; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line-strong, var(--line));
  box-shadow: var(--shadow-soft, var(--shadow)); }
.upg-card-head h2 { margin: 0 0 0.55rem; font-size: 1.3rem; }
.upg-price { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.3rem; }
.upg-amount { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 2.7rem;
  letter-spacing: -0.03em; color: var(--ink); line-height: 1; }
.upg-per { color: var(--muted); font-size: 1rem; }
.upg-tagline { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.95rem; }
.upg-features { list-style: none; margin: 0 0 1.5rem; padding: 1rem 0 0; flex: 1;
  border-top: 1px dashed var(--line-strong, var(--line)); }
.upg-features li { display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.32rem 0; line-height: 1.45; }
.upg-cta { width: 100%; justify-content: center; text-align: center; }

.upg-card-featured { position: relative; background: var(--ink); border-color: var(--ink);
  color: var(--bg); box-shadow: var(--shadow); }
.upg-card-featured .upg-card-head h2 { color: #f9efdd; }
.upg-card-featured .upg-amount { color: #f9efdd; }
.upg-card-featured .upg-per, .upg-card-featured .upg-tagline { color: rgba(241, 230, 210, 0.66); }
.upg-card-featured .upg-features { border-top-color: rgba(241, 230, 210, 0.25); }
.upg-card-featured .upg-features li { color: rgba(241, 230, 210, 0.92); }
.upg-card-featured .upg-tick { color: #e8b9a8; }
.upg-flag { position: absolute; top: -0.85rem; left: 1.4rem; margin: 0;
  padding: 0.28rem 0.8rem; border-radius: 999px; background: var(--accent); color: #fdf4e3;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  box-shadow: 0 4px 12px -4px rgba(110, 22, 19, 0.5); }

.upg-parent { display: grid; grid-template-columns: minmax(220px, 0.9fr) 1.1fr; gap: 1rem 2rem;
  align-items: center; padding: 1.4rem 1.6rem 1.5rem; border-radius: 16px;
  background: var(--surface-soft); border: 1px solid var(--line); margin-bottom: 1.8rem; }
@media (max-width: 720px) { .upg-parent { grid-template-columns: 1fr; } }
.upg-parent h2 { margin: 0 0 0.35rem; font-size: 1.12rem; }
.upg-parent-note { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.upg-parent-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
.upg-parent-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.upg-parent-row input[type="email"] { flex: 1; min-width: 200px; min-height: 44px;
  padding: 0.55rem 0.85rem; border-radius: 10px; border: 1px solid var(--line-strong, var(--line));
  background: var(--surface); color: var(--ink); font: inherit; }
.upg-parent-row input[type="email"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.upg-parent .form-message { margin: 0.5rem 0 0; }

.upg-footer { text-align: center; color: var(--muted); font-size: 0.88rem; }
.upg-footer a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
  padding: 0.55rem 0.1rem; margin: -0.55rem -0.1rem; }

@media (prefers-reduced-motion: reduce) {
  .loop-score-ellipse-path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- the desk pages: results + repair recomposed (main-thread pass) ----------
   Same composition law as the dashboard: use the canvas, protect the measure.
   Prose stays ≤70ch; the PAGE spans the full rail at ≥1200px. Rules and
   whitespace separate; boxes are reserved for the few true instruments
   (formula card, retest sheet). */
.loop-desk-page { max-width: 820px; margin: 0 auto; }
.loop-desk-page .loop-desk { margin-top: clamp(1.9rem, 5vh, 2.8rem); }

/* — results: the marked front sheet — */
.loop-result-strip {
  display: flex; align-items: center; gap: 1.4rem 2.2rem; flex-wrap: wrap;
  padding-bottom: 1.3rem; border-bottom: 1px solid var(--line-strong);
}
.loop-result-strip .loop-score-ring { flex: 0 0 auto; transform: scale(0.78); transform-origin: left center; margin: -0.7rem 0; }
.loop-result-meta { min-width: 0; }
.loop-result-meta .eyebrow { margin: 0 0 0.3rem; color: var(--muted) !important; letter-spacing: 0.16em; }
.loop-result-meta .loop-score-marks { margin: 0; font-size: 1.05rem; }
.loop-result-meta .loop-delta { margin-left: 0.6rem; font-size: 0.86rem; }
.loop-result-bar { flex: 1 1 260px; min-width: 220px; }
.loop-result-bar .loop-progressbar { margin: 0; }
.loop-result-bar .loop-bar-note { margin: 0.55rem 0 0; font-size: 0.84rem; color: var(--muted); max-width: 52ch; }

.loop-plan-header { display: flex; align-items: baseline; gap: 0.6rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line-strong); }
.loop-plan-header .loop-dash-eyebrow { margin: 0; color: var(--muted) !important; letter-spacing: 0.16em; }
.loop-plan-count { font-family: "Fraunces", Georgia, serif; font-size: 1.12rem; font-weight: 600; color: var(--ink-soft, var(--ink)); font-variant-numeric: tabular-nums; }
.loop-plan-sub { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.95rem; line-height: 1.55; max-width: 64ch; }
.loop-plan { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.loop-plan-group { margin-top: 1.7rem; }
.loop-plan-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
}
.loop-plan-title { color: var(--ink-soft, var(--ink)); }
.loop-plan-stake { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.loop-plan .loop-q-main strong { font-weight: 600; font-size: 0.99rem; line-height: 1.4; color: var(--ink-soft, var(--ink)); }
.loop-plan-none { color: var(--muted); padding: 1rem 0; }

.loop-rail-note { padding-top: 1.05rem; border-top: 1px solid var(--line-strong); margin-top: 1.6rem; }
.loop-rail-note:first-child { margin-top: 0; }
.loop-rail-note h3 {
  margin: 0 0 0.55rem; font-family: "Hanken Grotesk", ui-sans-serif, sans-serif;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.loop-rail-note p { margin: 0 0 0.9rem; font-size: 0.9rem; line-height: 1.55; color: var(--muted); max-width: 38ch; }

.loop-ask { padding: 1.1rem 0 1.3rem; border-top: 2px solid var(--accent); border-bottom: 1px solid var(--line-strong); margin-bottom: 2rem; }
.loop-ask h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.loop-ask > p { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.92rem; max-width: 64ch; }

/* — repair: the tutor's desk — */
.loop-rhead { padding-bottom: 0.85rem; border-bottom: 1px solid var(--line-strong); }
.loop-rhead-line { display: flex; align-items: baseline; gap: 0.9rem 1.3rem; flex-wrap: wrap; min-width: 0; }
.loop-rhead-back { font-size: 0.86rem; }
.loop-rhead-title {
  margin: 0; font-size: clamp(1.18rem, 2.4vw, 1.5rem); line-height: 1.25;
  letter-spacing: -0.015em; min-width: 0; flex: 1 1 22ch; max-width: 60ch;
}
.loop-rhead-kicker {
  display: block; margin-bottom: 0.2rem;
  font-family: "Hanken Grotesk", ui-sans-serif, sans-serif;
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; color: var(--accent);
}
.loop-rhead-mode { font-size: 0.84rem; color: var(--muted); white-space: nowrap; }
.loop-revisit-note { margin: 0.7rem 0 0; font-size: 0.88rem; color: var(--muted); font-style: italic; max-width: 70ch; }
.loop-stepper-compact { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.75rem; font-size: 0.78rem; color: var(--muted); }
.loop-stepper-rule { flex: 1 1 auto; display: block; height: 2px; background: var(--line-strong); border-radius: 2px; overflow: hidden; }
.loop-stepper-rule i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* the wayfinding rail (≥1200px) */
.loop-rnav { display: none; }
.loop-rnav-kicker { margin: 1.7rem 0 0.6rem; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; color: var(--muted); }
.loop-rsteps { list-style: none; margin: 0; padding: 0; }
.loop-rsteps li { position: relative; padding: 0.32rem 0 0.32rem 1.15rem; font-size: 0.92rem; color: var(--muted); }
.loop-rsteps li::before {
  content: ""; position: absolute; left: 0; top: 0.78rem;
  width: 7px; height: 7px; border-radius: 50%; border: 1.6px solid var(--line-strong); background: transparent;
}
.loop-rsteps li.done::before { background: var(--ink-soft, var(--ink)); border-color: var(--ink-soft, var(--ink)); }
.loop-rsteps li.now { color: var(--ink); font-weight: 600; }
.loop-rsteps li.now::before { background: var(--accent); border-color: var(--accent); }
.loop-rstep-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.loop-rstep-link:hover { color: var(--accent); }
.loop-rnav-topic { margin: 1.2rem 0 0; font-size: 0.82rem; color: var(--muted); }
.loop-skip-wrap { margin-top: 1.7rem; padding-top: 1.05rem; border-top: 1px solid var(--line-strong); }
.loop-skip-retest { background: none; border: 0; padding: 0; font: inherit; font-size: 0.9rem; color: var(--accent); cursor: pointer; }
.loop-skip-retest:hover { text-decoration: underline; }
.loop-skip-note { margin: 0.45rem 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--muted); max-width: 24ch; }
.loop-skip-mobile { display: inline-flex; }
.loop-quiet-link { background: none; border: 0; padding: 0; font: inherit; font-size: 0.92rem; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.loop-quiet-link:hover { color: var(--accent); }

/* the examiner's margin (≥1200px open annotations; below: disclosures) */
.loop-mnote { margin: 0 0 1.4rem; border-top: 2px solid var(--accent); padding-top: 0.65rem; }
.loop-mnote summary { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none; }
.loop-mnote summary::-webkit-details-marker { display: none; }
.loop-mnote-lead { font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 600; font-size: 0.95rem; color: var(--accent); }
.loop-mnote .loop-chev { width: 13px; height: 13px; color: var(--muted); transition: transform 0.18s ease; }
.loop-mnote[open] .loop-chev { transform: rotate(180deg); }
.loop-mnote-body { margin-top: 0.5rem; font-size: 0.88rem; line-height: 1.6; color: var(--ink-soft, var(--ink)); }
.loop-clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.loop-more { background: none; border: 0; padding: 0; margin-top: 0.4rem; font: inherit; font-size: 0.82rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* the work column */
.loop-work { min-width: 0; max-width: 70ch; }
.loop-kicker {
  margin: 1.9rem 0 0.9rem; font-family: "Hanken Grotesk", ui-sans-serif, sans-serif;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.17em; text-transform: uppercase; color: var(--muted);
}
.loop-kicker-sub { margin-top: 1.6rem; }
.loop-work .loop-lede { font-size: 1.02rem; line-height: 1.65; }
.loop-formula-eyebrow {
  display: block; margin-bottom: 0.4rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}
.loop-rung { margin-top: 1.6rem; }
.loop-rung-head, .loop-rung-fold summary { display: flex; align-items: center; gap: 0.7rem; }
.loop-rung-head h3, .loop-rung-fold summary h3 { margin: 0; font-size: 1.05rem; display: inline; }
.loop-rung-marks { margin-left: auto; font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.loop-rung-fold { border-top: 1px dashed var(--line-strong); padding-top: 1.1rem; }
.loop-rung-fold summary { cursor: pointer; list-style: none; }
.loop-rung-fold summary::-webkit-details-marker { display: none; }
.loop-rung-fold summary:hover h3 { color: var(--accent); }
.loop-rung-fold > *:not(summary) { margin-top: 0.9rem; }
.loop-mcq-flow .loop-mcq-item { margin-top: 1.6rem; }
.loop-mcq-item h3 { font-size: 1rem; line-height: 1.5; }
.loop-mcq-fold { border-top: 1px dashed var(--line-strong); padding-top: 1.1rem; }
.loop-mcq-fold summary { cursor: pointer; list-style: none; }
.loop-mcq-fold summary::-webkit-details-marker { display: none; }
.loop-mcq-fold summary h3 { display: inline; margin: 0; }
.loop-mcq-fold summary:hover h3 { color: var(--accent); }
.loop-mcq-fold[open] > *:not(summary) { margin-top: 0.9rem; }
.loop-retest-sheet { border: 1px solid var(--line-strong); border-radius: 14px; padding: 1.5rem 1.6rem; background: var(--paper, #faf3e4); margin-top: 0.4rem; }
.loop-retest-head { display: flex; justify-content: flex-end; margin-bottom: 0.6rem; }
.loop-reteach-fold { margin-top: 1.7rem; }
.loop-leak-checklist li { margin: 0.35rem 0; }
.loop-rnav :focus-visible, .loop-mnote summary:focus-visible, .loop-rung-fold summary:focus-visible,
.loop-mcq-fold summary:focus-visible, .loop-more:focus-visible, .loop-quiet-link:focus-visible,
.loop-skip-retest:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* — the wide bench — */
@media (min-width: 1200px) {
  .loop-desk-page { max-width: none; }
  .loop-desk-page .loop-stepper-compact { display: none; }
  .loop-desk-page .loop-rhead-back { display: none; }
  .loop-rnav { display: block; }
  .loop-repair-desk.loop-desk {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr) clamp(240px, 21vw, 300px);
    column-gap: clamp(3rem, 6vw, 6.5rem);
    align-items: start;
  }
  .loop-work { justify-self: start; width: 100%; }
  .loop-result-desk.loop-desk { column-gap: clamp(4rem, 8vw, 8rem); }
  /* dashboard polish: pull the desk up a touch — wide screens showed a
     vertical ocean between the strip and the move */
  .loop-dash .loop-desk { margin-top: clamp(1.9rem, 5vh, 2.7rem); }
  .loop-queue { margin-top: clamp(1.9rem, 5vh, 2.9rem); }
}
@media (max-width: 1199px) {
  .loop-rmargin { margin: 1.3rem 0 0; }
  .loop-mnote { border-top-width: 1px; border-color: var(--line-strong); }
  .loop-mnote-lead { color: var(--accent); }
}
@media (max-width: 700px) {
  .loop-result-strip .loop-score-ring { transform: scale(0.66); margin: -1.1rem -1.2rem -1.1rem 0; }
  .loop-rhead-mode { flex-basis: 100%; }
}
@media print {
  .loop-rnav, .loop-rmargin, .loop-rhead-mode, .loop-stepper-compact { display: none !important; }
  .loop-retest-sheet { border: none; padding: 0; background: none; }
}

/* ---------- desk pages, round 2 (owner feedback while testing) ---------- */
/* breadcrumb stepper: done stages are real buttons, the rule is the progress */
.loop-crumbs { display: flex; align-items: baseline; gap: 0.45rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.loop-crumbs li { display: inline-flex; align-items: baseline; font-size: 0.82rem; color: var(--muted); }
.loop-crumbs li + li::before { content: "→"; margin-right: 0.45rem; color: var(--line-strong); }
.loop-crumbs li.now span { color: var(--ink); font-weight: 700; }
.loop-crumb-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft, var(--ink)); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.loop-crumb-link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.loop-crumb-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.loop-stepper-compact { display: block; }
.loop-stepper-compact .loop-stepper-rule { margin-top: 0.55rem; }

/* maths can be wider than its card: contain it quietly, never break layout */
.loop-formula mjx-container, .loop-mnote mjx-container, .loop-work mjx-container {
  max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px;
}
.loop-formula mjx-container::-webkit-scrollbar, .loop-work mjx-container::-webkit-scrollbar { height: 4px; }
.loop-formula mjx-container::-webkit-scrollbar-thumb, .loop-work mjx-container::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 4px;
}

/* the desk earns a second column from 1024px: work + examiner's margin.
   The full three-zone bench (rail · work · margin) still starts at 1200px. */
@media (min-width: 1024px) and (max-width: 1199px) {
  .loop-desk-page { max-width: none; }
  .loop-repair-desk.loop-desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(230px, 24vw, 290px);
    column-gap: clamp(2.6rem, 5vw, 4.5rem);
    align-items: start;
  }
  .loop-rmargin { margin: 0; }
  .loop-mnote { border-top-width: 2px; border-color: var(--accent); }
  .loop-result-desk.loop-desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(230px, 24vw, 280px);
    column-gap: clamp(2.6rem, 5vw, 4.5rem);
    align-items: start;
  }
}
@media (min-width: 1200px) {
  /* the rail carries the skip on the wide bench — one affordance, not two */
  .loop-skip-mobile { display: none; }
}
/* dashboard joins the 1024px desk: main + rail, same as results */
@media (min-width: 1024px) and (max-width: 1199px) {
  .loop-dash { max-width: none; }
  .loop-dash .loop-desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(240px, 26vw, 300px);
    column-gap: clamp(2.6rem, 5vw, 4.5rem);
    align-items: start;
  }
  .loop-dash .loop-rail { margin-top: 0; }
}

/* ---------- hierarchy round (owner: "wheres the hierarchy… knowledge dump") */
/* The law: rule + method as one crowned unit; the rule is the centrepiece. */
.loop-law { margin: 1.9rem 0 2.1rem; }
.loop-law .loop-formula {
  background: transparent; border: 0; border-radius: 0;
  border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line-strong);
  padding: 1.05rem 0.2rem 1.25rem; margin: 0;
}
.loop-law .loop-formula-eyebrow { color: var(--accent); letter-spacing: 0.15em; }
.loop-law .loop-formula-body {
  font-family: "Fraunces", Georgia, serif; font-size: 1.24rem; line-height: 1.55;
  color: var(--ink); margin-top: 0.45rem;
}
.loop-law .loop-formula-body mjx-container { font-size: 108%; }
.loop-law .loop-method { margin: 1.2rem 0 0; }

/* "Why this works" / "Check your answer" / "Show the solution": footnote-level
   text disclosures — no box, a quiet red underlined line. */
details.loop-why { border: 0; background: transparent; padding: 0; margin: 1.15rem 0; }
details.loop-why > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem;
  font-weight: 600; font-size: 0.93rem; color: var(--accent);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px;
}
details.loop-why > summary::-webkit-details-marker { display: none; }
details.loop-why > summary::before { content: "\203A"; font-size: 1.1em; transition: transform 0.18s ease; }
details.loop-why[open] > summary::before { transform: rotate(90deg); }
details.loop-why > summary:hover { text-decoration-color: var(--accent); }
details.loop-why > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
details.loop-why > *:not(summary) { margin-top: 0.75rem; }
@media (prefers-reduced-motion: reduce) { details.loop-why > summary::before { transition: none; } }

/* The worked example: a designed moment — question on the desk, solution waits. */
.loop-worked { margin: 2.1rem 0 0.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line-strong); }
.loop-worked .loop-example-q { font-weight: 600; margin: 0.55rem 0 0.4rem; }

/* The practise ladder: one vertical rail, numbered discs, later rungs quiet
   until reached. The only boxed thing on the screen is the work itself. */
.loop-ladder { position: relative; margin: 1.5rem 0 0.5rem; }
.loop-ladder::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 12px; width: 2px; background: var(--line-strong); }
.loop-ladder .loop-rung { position: relative; padding: 0 0 0 2.7rem; margin: 0 0 1.7rem; border: 0; background: transparent; box-shadow: none; }
.loop-ladder .loop-rung-head { display: flex; align-items: baseline; gap: 0.6rem; padding: 0; }
.loop-ladder .loop-rung-head h3 { margin: 0; font-size: 1.05rem; }
.loop-ladder .loop-rung-n {
  position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--paper, var(--bg)); font-family: "Fraunces", Georgia, serif;
  font-size: 0.92rem; display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.loop-rung-marks { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.loop-rung-fold > summary { list-style: none; cursor: pointer; }
.loop-rung-fold > summary::-webkit-details-marker { display: none; }
.loop-rung-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.loop-rung-fold:not([open]) { opacity: 0.6; transition: opacity 0.15s ease; }
.loop-rung-fold:not([open]):hover { opacity: 0.85; }
.loop-rung-fold:not([open]) .loop-rung-n { background: transparent; color: var(--muted); border: 2px solid var(--line-strong); }
.loop-rung-open { font-size: 0.85rem; color: var(--accent); font-weight: 600; opacity: 0; margin-left: 0.7rem; }
.loop-rung-fold:not([open]) > summary:hover .loop-rung-open,
.loop-rung-fold:not([open]) > summary:focus-visible .loop-rung-open { opacity: 1; }
.loop-rung-fold[open] .loop-rung-open { display: none; }
@media (prefers-reduced-motion: reduce) { .loop-rung-fold:not([open]) { transition: none; } }

/* Margin notes accompany the scroll, so long stages don't strand a dead zone. */
@media (min-width: 1024px) { .loop-rmargin { position: sticky; top: 86px; align-self: start; } }

/* ---------- results: three acts (verdict / move / plan) ---------- */
.loop-verdict { max-width: none; padding: 1.1rem 0 0; }
.loop-verdict .eyebrow { color: var(--muted); }
.loop-verdict-score { display: flex; align-items: baseline; gap: 1.1rem; margin: 0.45rem 0 0.2rem; flex-wrap: wrap; }
.loop-verdict-num {
  font-family: "Fraunces", Georgia, serif; font-weight: 600; color: var(--ink);
  font-size: clamp(3.4rem, 6.5vw, 5.2rem); line-height: 1; letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.loop-verdict-marks { font-size: 1.05rem; color: var(--muted); }
.loop-verdict-marks strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.loop-verdict-meaning { margin: 0.35rem 0 1.15rem; font-size: 1.02rem; color: var(--ink-soft, var(--ink)); max-width: 58ch; }
.loop-verdict-bar { margin: 0; }

/* act 2 on results: same family as the dashboard's move, its own tense */
.loop-move-results { margin: 2.4rem 0 0.6rem; }
.loop-move-results .loop-move-headline { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }

/* act 3: the plan's group headers stop shouting */
.loop-plan-head { border: 0; }
.loop-plan-title { color: var(--ink); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.loop-plan-stake { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.loop-plan-header { display: flex; align-items: baseline; gap: 0.55rem; margin-bottom: 0.2rem; }
.loop-plan-count { font-family: "Fraunces", Georgia, serif; font-size: 1.15rem; color: var(--accent); }

/* ---------- paper timer: pause veil + reset confirmation (anti-abuse) ------ */
/* Paused = the paper is hidden, not just stopped. Blur as defence-in-depth
   behind the opaque veil so questions can't be read with the clock stopped. */
.loop-paper-paused .loop-paper-sheet, .loop-paper-paused .loop-upload { filter: blur(9px); pointer-events: none; user-select: none; }
.loop-pause-veil {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  background: rgba(234, 223, 200, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.loop-pause-card {
  text-align: center; max-width: 400px; width: 100%; background: #FCFAF3;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: 4px 4px 14px 14px;
  padding: 2.4rem 2.2rem 2rem;
  box-shadow: 0 8px 24px -6px rgba(33,7,6,0.13), 0 32px 64px -24px rgba(33,7,6,0.22);
  color: var(--ink);
}
/* Icon badge */
.loop-pause-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(137,29,26,0.08); border: 1.5px solid rgba(137,29,26,0.2);
  color: var(--accent); margin-bottom: 1.1rem;
}
/* Eyebrow label */
.loop-pause-eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--accent);
  margin: 0 0 0.3rem;
}
.loop-pause-card h2 {
  font-family: "Fraunces", Georgia, serif; font-size: 1.75rem; font-weight: 700;
  line-height: 1.15; margin: 0 0 0.75rem; color: var(--ink);
}
.loop-pause-card > p {
  color: var(--muted); line-height: 1.6; font-size: 0.95rem;
  margin: 0 0 1.6rem; max-width: 32ch; margin-left: auto; margin-right: auto;
}
/* Utility row: Print + Formula side by side, centred */
.loop-pause-utils {
  display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; margin-bottom: 0.85rem;
}
.loop-pause-card .primary-button { width: 100%; }

/* Pre-start cover + paused-overlay actions: print the paper / open the formula
   sheet / start (or resume), in a centered wrapping row. */
.loop-cover-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin: 1.5rem 0 0.3rem; }
.loop-cover-note { color: var(--muted); font-size: 0.92rem; line-height: 1.5; margin: 0.7rem 0 0; max-width: 46rem; }
.loop-pause-actions { display: flex; flex-direction: column; gap: 0; }
.loop-pause-actions .ghost-button, .loop-pause-actions .loop-formula-link { width: auto; }
/* The full question paper rides (hidden) on the cover so Print yields the real
   paper while the questions stay off-screen until Start. */
.loop-print-only { display: none; }

/* "Done — finished writing" gate. The CTA sits under the questions while writing;
   pressing it freezes the clock and flips the page into the untimed upload phase
   (questions hidden, upload shown). The upload block is hidden until then so the
   student can't half-upload against a running clock. */
.loop-done-cta { text-align: center; margin: 2.6rem auto 0; max-width: 36rem; }
.loop-done-cta .loop-done-btn { font-size: 1.25rem; padding: 20px 46px; font-weight: 700; border-radius: 12px; }
.loop-done-hint { color: var(--muted); font-size: 0.95rem; line-height: 1.55; margin: 0.9rem 0 0; }
@media (max-width: 540px) { .loop-done-cta .loop-done-btn { width: 100%; font-size: 1.1rem; padding: 16px 22px; } }
/* Done-phase banner: minimal — label + reopen link */
.loop-done-banner {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
  margin: 0 0 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.loop-done-label {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.32rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.loop-reopen-btn {
  font-size: 0.82rem; color: var(--muted);
  background: none; border: none; cursor: pointer; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.loop-reopen-btn:hover { color: var(--ink); }
.loop-upload { display: none; }
.loop-paper-done .loop-paper-sheet,
.loop-paper-done .loop-done-cta { display: none; }
.loop-paper-done .loop-upload { display: block; }

/* Scan-to-upload QR (upload phase): sits inside loop-upload-path, left column.
   Hidden until mounted (the link is fetched + the code drawn). */
.loop-qr {
  display: flex; flex-direction: column; gap: 0.85rem;
  background: var(--surface-soft, #faf4e4); border: 1.5px solid var(--line-strong);
  border-radius: 14px; padding: 1.2rem; height: 100%;
}
.loop-qr-code { flex: 0 0 auto; width: 116px; height: 116px; background: var(--plate, #fff); /* QR must stay scannable */ border-radius: 10px; padding: 8px; box-shadow: 0 6px 16px -10px rgba(33,7,6,0.4); }
.loop-qr-code svg { display: block; width: 100%; height: 100%; }
.loop-qr-copy { min-width: 0; }
.loop-qr-title { margin: 0 0 0.2rem; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.loop-qr-help { margin: 0; color: var(--muted); font-size: 0.83rem; line-height: 1.5; }

/* "or from this device" divider — only visible when QR is showing */
.loop-upload-or {
  display: none; /* hidden by default; JS shows it after QR mounts */
  align-items: center; gap: 0.7rem; color: var(--muted);
  font-size: 0.8rem; margin: 0 0 0.6rem;
}
.loop-upload-or[hidden] { display: none !important; }
.loop-upload-or:not([hidden]) { display: flex; }
.loop-upload-or::before, .loop-upload-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* When QR is visible, two-column layout is intentional; on narrow screens stack */
@media (max-width: 600px) {
  .loop-upload-paths { grid-template-columns: 1fr; }
  .loop-qr { flex-direction: row; align-items: flex-start; }
}


@media print {
  /* Print cleanly from the cover or a paused timed view: reveal the cover's
     questions, drop the pause blur, hide the veil and the on-screen controls. */
  .loop-print-only { display: block !important; }
  .loop-paper-paused .loop-paper-sheet, .loop-paper-paused .loop-upload { filter: none !important; pointer-events: auto !important; user-select: auto !important; }
  .loop-pause-veil, .loop-cover-actions, .loop-cover-note { display: none !important; }
}

.loop-confirm-backdrop {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: rgba(23,20,16,0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.loop-confirm-card {
  max-width: 440px; background: #FCFAF3; border: 1px solid rgba(23,32,31,0.14); border-radius: 16px;
  padding: 1.9rem; box-shadow: 0 30px 70px -28px rgba(23,32,31,0.6); color: var(--ink);
}
.loop-confirm-card h2 { font-family: "Fraunces", Georgia, serif; font-size: 1.55rem; margin: 0 0 0.7rem; }
.loop-confirm-card p { color: var(--ink-soft, var(--ink)); line-height: 1.55; margin: 0 0 0.6rem; }
.loop-confirm-warn { color: var(--accent) !important; font-weight: 600; }
.loop-confirm-actions { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1.3rem; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .loop-pause-veil, .loop-confirm-backdrop { backdrop-filter: none; } }

/* First-diagnostic onboarding modal (one-time). Built on the loop-confirm shell;
   a numbered 4-step list that teaches the repair loop's moves. Marked Script
   tokens: accent var(--accent) numerals, Fraunces heading, Hanken body. */
.loop-onboard-card { max-width: 484px; }
.loop-onboard-eyebrow {
  font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase;
  font-weight: 700; color: var(--accent) !important; margin: 0 0 0.45rem !important;
}
.loop-onboard-steps {
  list-style: none; margin: 1.2rem 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 1.05rem;
}
.loop-onboard-step { display: flex; gap: 0.85rem; align-items: flex-start; margin: 0; }
.loop-onboard-num {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #FCFAF3;
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 0.95rem;
  line-height: 1;
}
.loop-onboard-copy { min-width: 0; }
.loop-onboard-step-title {
  font-weight: 700; color: var(--ink); margin: 0.1rem 0 0.2rem !important;
  line-height: 1.3;
}
.loop-onboard-step-body {
  font-size: 0.93rem; line-height: 1.5; color: var(--ink-soft, var(--ink));
  margin: 0 !important;
}
.loop-onboard-card .loop-confirm-actions { justify-content: center; margin-top: 1.6rem; }
.loop-onboard-card .loop-confirm-actions .primary-button { width: 100%; }

/* Blank-report: show the actual question text so a student recognises the part. */
.loop-blank-qtext { margin: 0.25rem 0 0.5rem; color: var(--ink-soft, var(--ink)); font-size: 0.95rem; line-height: 1.5; max-width: 70ch; }

/* ============================================================================
   Focus dashboard (2026-06): the scoreboard header and the three-fold rail are
   gone. The next move is a centred hero; below it the desk splits into the
   open-holes queue (wide left) and a slim rail of two quiet stats — A* readiness
   (skills repaired & holding: a count + proportion bar, never a list) and the
   papers history. The >=1200px .loop-desk grid above already lays out the split;
   these rules style the hero, the readiness module, and the re-homed nav gear.
   ============================================================================ */

/* settings gear in the global nav (its old home, the scoreboard, is removed) */
.topnav-gear {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 9px; color: var(--ink-soft);
  transition: color 0.15s ease, background 0.15s ease;
}
.topnav-gear:hover { color: var(--accent); background: var(--surface); }
.topnav-gear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the next move: a LEFT-aligned working header (distinct from the results
   page's centred verdict). Topic bold ink, eyebrow keeps its trailing dash. */
.loop-dash-focus .loop-move-hero { margin: 0; text-align: left; padding-top: clamp(1.5rem, 4.5vh, 3.5rem); }
/* top band: hero (left) + A* readiness (right), aligned to the desk columns so
   the right side has presence from the top instead of a dead corner */
.loop-dash-top { margin-top: 0; }
@media (min-width: 1200px) {
  .loop-dash-top {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    column-gap: clamp(2.5rem, 4vw, 4rem);
    align-items: start;
  }
}
.loop-dash-focus .loop-move-hero .loop-move-label { justify-content: flex-start; margin-bottom: 0.8rem; }
.loop-dash-focus .loop-move-hero .loop-move-headline { max-width: 26ch; margin-inline: 0; font-weight: 500; font-size: clamp(1.85rem, 2.6vw, 2.35rem); }
.loop-dash-focus .loop-move-hero .loop-move-headline em { font-style: normal; font-weight: 700; color: var(--ink); background: none; padding: 0; }
.loop-dash-focus .loop-move-hero .loop-move-sub { max-width: 46ch; margin-inline: 0; }
.loop-dash-focus .loop-move-hero .loop-move-actions { justify-content: flex-start; }
.loop-dash-focus .loop-move-hero .loop-move-actions .primary-button { font-size: 1rem; padding: 0.9rem 1.8rem; }
.loop-dash-focus .loop-desk { margin-top: clamp(2rem, 5vh, 3rem); }
/* both column section rules align: each header is a label + a Fraunces figure */
.loop-dash-focus .loop-section-title { justify-content: space-between; }

/* A* readiness: now the right cell of the top band (beside the hero). Figure in
   the header, a proportion bar, one quiet note. */
.loop-ready { margin: 0; }
.loop-ready-bar {
  display: flex; height: 9px; margin-top: 1.1rem; border-radius: 999px; overflow: hidden;
  background: var(--surface-soft); border: 1px solid var(--line);
}
.loop-ready-held { background: var(--good, #2f6b3f); } /* skills HELD = earned, so green */
.loop-ready-pending { background: #caa05a; } /* repaired, memory check still pending */
.loop-ready-note { margin: 0.7rem 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--faint); }
.loop-ready-empty { margin-top: 0.9rem; }

/* papers list in the rail (timeline reused; span the rail column) */
.loop-papers { margin: 0; }
.loop-papers .loop-timeline { max-width: none; }
/* Give "Refer a friend" clear air below the papers list — it was hugging. */
.loop-refer { margin-top: clamp(2.6rem, 6vh, 3.75rem); }
.loop-refer:first-child { margin-top: 0; }

/* ============================================================================
   Results page redo (2026-06): a FORMAL repair hero (red eyebrow, bold — not
   italic, no squiggle — topic). Below, a two-column desk: the repair plan fills
   the wide left, the mark sits in a smaller right rail ("Your mark · for
   curiosity" with the score as its figure, so the two section rules line up),
   with a straight red A* gauge + the "what you got wrong" detail behind a fold.
   Stacks to one column under 860px.
   ============================================================================ */
.loop-results-focus { max-width: 920px; margin: 0 auto; }
/* on wide screens fill the page rail (1180px) like the dashboard — the same edge
   the nav brand and Dashboard button sit on, instead of a thin centred strip */
@media (min-width: 1200px) { .loop-results-focus { max-width: none; } }
.loop-results-focus .loop-move-hero { max-width: 560px; margin: 0 auto; text-align: center; padding-top: clamp(0.4rem, 2vh, 1.4rem); padding-bottom: clamp(1.8rem, 4vh, 2.4rem); }
/* formal hero: red eyebrow, no trailing dash; topic bold, not the squiggle em */
.loop-results-focus .loop-move-hero .loop-move-label { justify-content: center; }
.loop-results-focus .loop-move-hero .loop-move-label::after { display: none; }
.loop-results-focus .loop-move-hero .loop-move-headline { max-width: none; margin-inline: auto; font-weight: 500; font-size: clamp(2rem, 5vw, 2.7rem); }
.loop-results-focus .loop-move-hero .loop-move-headline em { font-style: normal; font-weight: 700; color: var(--ink); background: none; padding: 0; }
.loop-results-focus .loop-move-hero .loop-move-sub { max-width: 46ch; margin-inline: auto; }
.loop-results-focus .loop-move-hero .loop-move-actions { justify-content: center; }
.loop-results-focus .loop-move-hero .loop-move-actions .primary-button { font-size: 1.06rem; padding: 0.95rem 1.9rem; }

/* the two-column desk: plan (wide) | mark rail; both section rules align */
.loop-results-desk { margin-top: clamp(2rem, 5vh, 3rem); }
.loop-results-main { min-width: 0; }
.loop-results-rail { min-width: 0; margin-top: clamp(2.4rem, 6vh, 3.2rem); }
.loop-results-solo { max-width: 460px; margin: clamp(2rem, 5vh, 3rem) auto 0; }
@media (min-width: 860px) {
  /* plan absorbs the width; the mark rail stays a fixed, sensible column so it
     never stretches into a too-wide block */
  .loop-results-desk { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 400px); column-gap: clamp(2.6rem, 6vw, 6rem); align-items: start; }
  .loop-results-rail { margin-top: 0; }
}
.loop-results-focus .loop-section-title { justify-content: space-between; }
.loop-plan-sec .loop-q-more { display: inline-block; margin-top: 1rem; }

/* the mark rail */
.loop-curio { margin: 0; }
.loop-curio-tag { color: var(--accent); }
.loop-curio-gauge { display: block; margin-top: 0.9rem; }
/* Score bar: thick segmented track — solid earned + hatched "climb to A*" +
   a clean A* marker, so the gap reads as recoverable marks, not emptiness. */
.loop-curio-bar { position: relative; margin: 1.4rem 0 1.1rem; }
.loop-curio-bar-track {
  position: relative; height: 15px; border-radius: 8px;
  background: #e7d9bc; box-shadow: inset 0 1px 3px rgba(33,7,6,0.16);
  overflow: hidden;
}
.loop-curio-bar-climb {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: repeating-linear-gradient(45deg, rgba(137,29,26,0.24) 0 4px, rgba(137,29,26,0.06) 4px 9px);
}
.loop-curio-bar-earned {
  position: absolute; top: 0; bottom: 0; left: 0; border-radius: 8px;
  background: linear-gradient(90deg, #7a1916, #a3211d);
  box-shadow: 0 1px 2px rgba(137,29,26,0.4); min-width: 8px;
}
.loop-curio-bar-astar {
  position: absolute; top: -5px; height: 25px; width: 2px;
  background: var(--ink); transform: translateX(-1px);
}
.loop-curio-bar-astar::after {
  content: "A*"; position: absolute; top: -1.25rem; left: 50%; transform: translateX(-50%);
  font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 0.82rem;
  color: var(--ink); white-space: nowrap;
}
.loop-curio-sub { font-size: 0.84rem; color: var(--muted); margin: 0.6rem 0 0; }

/* what-you-got-wrong fold */
.loop-disc { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.3rem; }
.loop-disc > summary { list-style: none; display: flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.1rem; cursor: pointer; color: var(--accent); font-weight: 700; font-size: 0.82rem; }
.loop-disc > summary::-webkit-details-marker { display: none; }
.loop-disc > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.loop-disc-chev { display: inline-block; font-size: 0.74rem; transition: transform 0.18s ease; }
.loop-disc[open] .loop-disc-chev { transform: rotate(90deg); }
.loop-wrow { padding: 0.7rem 0.1rem; border-bottom: 1px dashed var(--line-strong); }
.loop-wrow:last-child { border-bottom: 0; }
.loop-wtop { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.loop-wq { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.loop-wlost { color: var(--accent); font-weight: 700; font-size: 0.78rem; font-variant-numeric: tabular-nums; margin-left: auto; }
.loop-wreason { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .loop-disc-chev { transition: none; } }

/* =========================================================================
   Results page v2 — full-paper marks section (loop-wp-*) + editable blanks
   ========================================================================= */

/* Body wrapper replaces the old desk/rail two-column layout */
.loop-results-body { margin-top: clamp(2rem, 5vh, 3.2rem); }

/* Curio section: now full-width card instead of a narrow rail */
.loop-curio-paper { margin: 0; }
.loop-curio-header { margin-bottom: 1.8rem; }

/* Per-paper question group */
.loop-wp-paper { border-top: 1px solid var(--line); }
.loop-wp-q { padding: clamp(1.2rem, 3vh, 1.8rem) 0; border-bottom: 1px solid var(--line); }
.loop-wp-q:last-child { border-bottom: 0; }
.loop-wp-qnum {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.7rem;
  letter-spacing: -0.01em;
}
.loop-wp-context {
  font-size: 0.94rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--line);
  max-width: 72ch;
}

/* Parts within a question */
.loop-wp-parts { display: flex; flex-direction: column; gap: 0; }
.loop-wp-part {
  padding: 0.75rem 0 0.75rem 1.1rem;
  border-left: 2px solid var(--line);
  margin-left: 0.3rem;
  margin-bottom: 0.4rem;
}
.loop-wp-part--wrong {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  border-radius: 0 6px 6px 0;
  padding-right: 0.7rem;
}
.loop-wp-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.loop-wp-label {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  min-width: 2.2ch;
}

/* Mark pip: awarded/max with colour coding */
.loop-wp-pip {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.loop-wp-full {
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.loop-wp-lost {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.loop-wp-denom { font-weight: 400; opacity: 0.7; }

/* Question text per part */
.loop-wp-qtext {
  font-size: 0.93rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 0.4rem;
  max-width: 70ch;
}

/* Examiner feedback line under wrong parts */
.loop-wp-reason {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px dashed var(--line);
}
.loop-wp-reason-label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin-right: 0.35rem;
}

/* Editable blank-report additions */
.loop-blank-saved {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.loop-blank-saved em { font-style: normal; color: var(--ink-soft); font-weight: 600; }
.loop-blank-change { color: var(--accent); font-size: 0.78rem; }

/* Responsive: on larger screens show context/parts slightly wider */
@media (min-width: 640px) {
  .loop-wp-context { max-width: 80ch; }
  .loop-wp-qtext { max-width: 80ch; }
}

/* Fallback for browsers without color-mix (Safari < 16.2) */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .loop-wp-part--wrong { background: rgba(137, 29, 26, 0.04); }
  .loop-wp-full { background: rgba(33, 7, 6, 0.08); }
  .loop-wp-lost { background: rgba(137, 29, 26, 0.10); }
}

/* ===========================================================================
   ARU_0171 PILOT — Seneca-style "bytes" micro-learning (LEARN stage only).
   Additive, appended at EOF: no existing rule is modified. Every selector is
   namespaced under .loop-bytes so it cannot affect other repair screens, the
   results page, or any other ARU.
   Design system: "The Marked Script" — ink/accent/line vars from theme-pure.css,
   Fraunces headings, Hanken body, no green, AA contrast, reduced-motion guard.
   =========================================================================== */
.loop-bytes { max-width: 40rem; margin: 0 auto; }
.loop-bytes-kicker { margin-bottom: 0.35rem; }
.loop-bytes-intro {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.6;
  margin: 0 0 1.35rem;
  max-width: 36rem;
}

/* --- progress: a subtle "byte 2 of 6" rail of dots ----------------------- */
.loop-bytes-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.loop-bytes-dots { display: flex; gap: 0.4rem; }
.loop-bytes-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.loop-bytes-dot.is-done { background: var(--muted); border-color: var(--muted); }
.loop-bytes-dot.is-now {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.18);
}
.loop-bytes-count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- in-byte reward: a momentum streak chip ------------------------------- */
/* Sits in NORMAL FLOW below the feedback line (positive top margin), so it can
   never overlap the explanation text above it (the old reward used a negative
   margin and collided). A clean first-try correct grows the streak; the green
   badge shows the running count and intensifies as it climbs. */
.loop-win {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.85rem 0 0.2rem;
  padding: 0.32rem 0.9rem 0.32rem 0.38rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--good, #2f6b3f) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--good, #2f6b3f) 22%, transparent);
  color: var(--good-strong, #245231);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  animation: loopWinIn 0.3s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .loop-win { background: var(--surface-soft); border-color: var(--line); }
}
.loop-win-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--good, #2f6b3f);
  color: var(--on-good, #f4faf2);
  flex: 0 0 auto;
  font-weight: 750;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  animation: loopWinPop 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.loop-win-text { line-height: 1.15; }
/* combo (2+ in a row): a soft accent ring that gets stronger when hot (5+). */
.loop-win.is-combo .loop-win-badge {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good, #2f6b3f) 16%, transparent);
}
.loop-win.is-hot { background: color-mix(in srgb, var(--good, #2f6b3f) 14%, transparent); }
.loop-win.is-hot .loop-win-badge {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good, #2f6b3f) 32%, transparent);
}
.loop-win.is-leaving { animation: loopWinOut 0.32s ease both; }
@keyframes loopWinIn {
  from { opacity: 0; transform: translateY(5px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes loopWinPop {
  0%   { transform: scale(0.6); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes loopWinOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-3px); }
}
/* Reduced motion: the reward still SHOWS (appears + clears with no animation). */
@media (prefers-reduced-motion: reduce) {
  .loop-win,
  .loop-win-badge,
  .loop-win.is-leaving { animation: none; }
}

/* --- guest "prove it" signup gate: shown in the prove byte to a not-signed-in
   visitor who's just finished the free first lesson ------------------------ */
.loop-byte-prove-gate {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.7rem;
  padding: 1.3rem 1.4rem; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface, #faf4e4));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .loop-byte-prove-gate { background: var(--surface-soft); border-color: var(--line); }
}
.loop-byte-gate-tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--accent); color: #fdf4e3; flex: 0 0 auto;
}
.loop-byte-gate-title { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; color: var(--ink); }
.loop-byte-gate-sub { margin: 0; color: var(--ink-soft); max-width: 44ch; line-height: 1.5; }
.loop-byte-gate-foot { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--muted); }
.loop-byte-gate-foot .loop-quiet-link { font-size: inherit; }

/* --- the single byte card: one thing on screen at a time ----------------- */
.loop-byte-card {
  background: #faf4e4;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.6rem 1.6rem 1.7rem;
  box-shadow: var(--shadow-soft, 0 14px 30px -22px rgba(60, 20, 15, 0.22));
}
.loop-byte-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.85rem;
}
/* graceful fallback if color-mix is unsupported */
@supports not (color: color-mix(in srgb, red, blue)) {
  .loop-byte-tag { background: var(--surface-soft); border-color: var(--line); }
}
.loop-byte-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.42rem;
  line-height: 1.18;
  color: var(--ink);
  margin: 0 0 1.05rem;
  letter-spacing: -0.01em;
}

/* --- prove-first popup: slip / memory-check intro as a MODAL over the repair
   page (it isn't a teaching byte, so it doesn't live in the slideshow) -------- */
.loop-slip-modal-back {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1.4rem;
  background: rgba(33, 7, 6, 0.5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: loopSlipFade 0.2s ease both;
}
.loop-slip-modal {
  width: 100%; max-width: 30rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 1.7rem 1.75rem 1.55rem;
  box-shadow: 0 24px 60px -22px rgba(33, 7, 6, 0.5);
  animation: loopSlipRise 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.loop-slip-modal .loop-byte-title { margin-bottom: 0.7rem; font-size: 1.34rem; }
.loop-slip-modal-body { margin: 0; font-size: 1.02rem; line-height: 1.6; color: var(--ink-soft); }
.loop-byte-tag-memory { color: var(--warn-deep); border-color: rgba(108, 76, 18, 0.3); background: rgba(108, 76, 18, 0.08); }
.loop-slip-modal-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-top: 1.4rem; }
.loop-slip-modal .primary-button { min-height: 48px; font-size: 1.02rem; padding: 0.78rem 1.4rem; }
@keyframes loopSlipFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes loopSlipRise { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .loop-slip-modal-back, .loop-slip-modal { animation: none; }
}

/* --- revealed pieces, added one at a time -------------------------------- */
.loop-byte-reveals { display: flex; flex-direction: column; gap: 0.95rem; }
.loop-byte-reveal {
  font-size: 1.04rem;
  line-height: 1.62;
  color: var(--ink-soft);
}
.loop-byte-reveal :is(p, .loop-byte-q) { margin: 0 0 0.6rem; }
.loop-byte-reveal :is(p, .loop-byte-q):last-child { margin-bottom: 0; }
.loop-byte-reveal b { color: var(--ink); font-weight: 700; }
/* the worked-example question stands a touch apart */
.loop-byte-q {
  font-size: 1.05rem;
  line-height: 1.6;
  padding-bottom: 0.2rem;
}
/* the just-revealed line eases in */
.loop-byte-reveal.is-fresh { animation: loopByteIn 0.34s ease both; }
@keyframes loopByteIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- the primary action row (Start / Next / Check / Prove) --------------- */
.loop-byte-actions { margin-top: 1.4rem; }
.loop-byte-card .primary-button {
  font-size: 1.02rem;
  padding: 0.78rem 1.4rem;
  min-height: 48px; /* big tap target */
}
.loop-byte-prove { font-size: 1.06rem !important; }

/* --- the tiny check ------------------------------------------------------ */
.loop-byte-check { margin-top: 1.5rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); }
.loop-byte-check-q {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 1rem;
}

/* MCQ options: full-width tappable rows, lettered A–D */
.loop-byte-opts { display: flex; flex-direction: column; gap: 0.6rem; }
.loop-byte-opt {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  min-height: 52px;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 1.0rem;
  line-height: 1.45;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.08s ease;
}
.loop-byte-opt:hover:not(:disabled) { border-color: var(--accent); }
.loop-byte-opt:active:not(:disabled) { transform: translateY(1px); }
.loop-byte-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.loop-byte-opt:disabled { cursor: default; }
.loop-byte-opt-key {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted);
  background: #faf4e4;
}
.loop-byte-opt-text { flex: 1 1 auto; }
/* correct (green — the reward) and wrong (muted, struck feel) states */
.loop-byte-opt.is-correct {
  border-color: var(--good, #2f6b3f);
  background: color-mix(in srgb, var(--good, #2f6b3f) 9%, var(--surface));
  color: var(--ink);
}
.loop-byte-opt.is-correct .loop-byte-opt-key {
  background: var(--good, #2f6b3f);
  border-color: var(--good, #2f6b3f);
  color: var(--on-good, #f4faf2);
}
/* Dark mode blanket-fills every option key with --surface-soft !important
   (theme-pure.css, so no cream-on-cream). That beats the fill above, leaving a
   DARK disc — and the near-black --on-good letter vanished inside it. Restore
   the green fill here with matching force so the key letter stays readable. */
html[data-theme="dark"] .loop-byte-opt.is-correct .loop-byte-opt-key {
  background: var(--good, #7cc78f) !important;
  border-color: var(--good, #7cc78f);
  color: var(--on-good, #10240f);
}
.loop-byte-opt.is-wrong {
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
  background: var(--surface-soft);
  color: var(--muted);
  opacity: 0.7;
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .loop-byte-opt.is-correct { border-color: var(--good, #2f6b3f); background: var(--soft-good, #e4efe4); }
  .loop-byte-opt.is-correct .loop-byte-opt-key { background: var(--good, #2f6b3f); color: var(--on-good, #f4faf2); }
}

/* one-word type-in */
.loop-byte-type { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.loop-byte-input {
  flex: 1 1 9rem;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  min-height: 48px;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--ink);
}
.loop-byte-input:focus { outline: none; border-color: var(--accent); }
.loop-byte-input:disabled { background: var(--surface-soft); color: var(--muted); }
.loop-byte-checkbtn { flex: 0 0 auto; min-height: 48px; }

/* feedback line under a check — green for a win, muted for a miss. (A wrong
   answer is deliberately NOT red: the miss stays quiet, the win is the colour.) */
.loop-byte-feedback {
  margin: 0.95rem 0 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.loop-byte-fb-mark { font-weight: 700; margin-right: 0.3rem; }
.loop-byte-feedback.is-ok .loop-byte-fb-mark { color: var(--good, #2f6b3f); }
.loop-byte-feedback.is-bad .loop-byte-fb-mark { color: var(--muted); }
.loop-byte-advance { margin-top: 1.2rem; }

/* maths inside bytes inherits the page typesetting; keep inline maths from
   forcing a horizontal scrollbar on a narrow card */
.loop-byte-card mjx-container { max-width: 100%; }
.loop-byte-card mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

@media (max-width: 540px) {
  .loop-byte-card { padding: 1.25rem 1.15rem 1.35rem; border-radius: 14px; }
  .loop-byte-title { font-size: 1.28rem; }
  .loop-byte-reveal { font-size: 1.0rem; }
  .loop-byte-card .primary-button { width: 100%; }
  .loop-byte-checkbtn { width: 100%; }
}

/* reduced-motion: no slide-ins, no dot scaling */
@media (prefers-reduced-motion: reduce) {
  .loop-byte-reveal.is-fresh { animation: none; }
  .loop-bytes-dot, .loop-byte-opt { transition: none; }
  .loop-bytes-dot.is-now { transform: none; }
}

/* ===========================================================================
   ARU_0171 PILOT — iteration 2 (owner feedback). Still append-only + namespaced
   under .loop-bytes / .loop-byte / .loop-rnav-bytes. No earlier rule is touched.
   Covers: clickable breadcrumb dots (fix 5), prominent skip-to-retest (fix 3),
   folded-in list styling + new byte kinds (fixes 1/4), revisited-check state.
   =========================================================================== */

/* --- breadcrumb dots are now clickable buttons (fix 5) ------------------- */
/* They were <span>s; as <button>s they need the link-button reset, a number
   inside, and reached / locked / done affordances. */
.loop-bytes-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.loop-bytes-dot-num {
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
/* reachable (≤ furthest): a real, inviting target */
.loop-bytes-dot.is-reached { cursor: pointer; }
.loop-bytes-dot.is-reached:hover:not(.is-now) { border-color: var(--accent); }
.loop-bytes-dot.is-reached:hover:not(.is-now) .loop-bytes-dot-num { color: var(--accent); }
.loop-bytes-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* locked (beyond furthest): visibly not-yet-available, no pointer */
.loop-bytes-dot.is-locked { cursor: not-allowed; opacity: 0.55; }
.loop-bytes-dot.is-locked .loop-bytes-dot-num { color: var(--line-strong, #d8c9ad); }
/* done: filled, number turns to surface colour for contrast */
.loop-bytes-dot.is-done { background: var(--muted); border-color: var(--muted); }
.loop-bytes-dot.is-done .loop-bytes-dot-num { color: #f7efdd; }
/* current: accent fill (overrides done when it's also the one on screen) */
.loop-bytes-dot.is-now { background: var(--accent); border-color: var(--accent); transform: scale(1.12); }
.loop-bytes-dot.is-now .loop-bytes-dot-num { color: #fdf4e3; }
/* the row of dots can wrap on a narrow card */
.loop-bytes-dots { flex-wrap: wrap; }
.loop-bytes-progress { align-items: flex-start; }

/* --- folded-in checklist inside a reveal (fix 1: "where it leaks") ------- */
.loop-byte-reveal .loop-byte-list {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.loop-byte-reveal .loop-byte-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.99rem;
  line-height: 1.55;
}
.loop-byte-reveal .loop-byte-list li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.62em;
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}

/* --- new byte-kind tags (fixes 1/4): leak + examiner read as accent --- */
/* They reuse the base .loop-byte-tag accent styling; no kind-specific colour
   needed (palette is single-accent, no green), but keep the hook for clarity. */
.loop-byte-tag-leak, .loop-byte-tag-examiner { /* inherits accent tag styling */ }

/* --- revisited byte (fix 5): the answered check reads as resolved -------- */
/* When a completed byte is reopened it renders its check in is-answered form:
   non-interactive, the correct option lit, dimmed so it's clearly a recap. */
.loop-byte-check.is-answered { opacity: 0.96; }
.loop-byte-check.is-answered .loop-byte-opt { cursor: default; }
.loop-byte-check.is-answered .loop-byte-opt:not(.is-correct) { opacity: 0.6; }
.loop-byte-check.is-answered .loop-byte-input { background: var(--surface-soft); color: var(--muted); }
.loop-byte-resume { margin-top: 1.4rem; }
/* "Back to where I was" is a clearly secondary action: ghost, not the loud
   accent fill the forward actions use. */
.loop-byte-continue {
  background: none !important;
  color: var(--accent) !important;
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent) !important;
  box-shadow: none !important;
}
.loop-byte-continue:hover { background: color-mix(in srgb, var(--accent) 8%, transparent) !important; }
@supports not (color: color-mix(in srgb, red, blue)) {
  .loop-byte-continue { border-color: var(--accent) !important; }
}

/* --- quiet "skip straight to the retest" ---------------------------------- */
/* A hairline-rule footnote under the byte card: muted question, accent
   underlined action. Deliberately QUIET — it must never compete with the
   in-byte "Next"/"Now prove it" primary. draw() hides it (via [hidden]) on
   prove/explain bytes, where skipping to the retest makes no sense. */
.loop-bytes-skip {
  margin: 2.1rem auto 0;
  max-width: 40rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.loop-bytes-skip[hidden] { display: none; }
.loop-bytes-skip-btn {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 0.45rem;
  min-height: 44px; /* full tap target despite the text-link look */
  padding: 0.35rem 0.6rem;
  font-family: inherit;
  font-size: 0.95rem;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.loop-bytes-skip-q { font-weight: 600; color: var(--muted); }
.loop-bytes-skip-act {
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color 0.15s ease;
}
.loop-bytes-skip-btn:hover .loop-bytes-skip-act { text-decoration-color: var(--accent); }
.loop-bytes-skip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.loop-bytes-skip-act .btn-arrow { font-weight: 400; text-decoration: none; display: inline-block; }
.loop-bytes-skip-note {
  margin: 0.15rem auto 0;
  max-width: 36rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--faint, #8a7257);
}

/* --- left rail in bytes mode (fixes 1/4): no step list, a calm note ------ */
.loop-rnav-topic-lead { margin-top: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.loop-rnav-bytes-note { margin: 0.9rem 0 0; font-size: 0.84rem; line-height: 1.55; color: var(--muted); }

/* reduced-motion: the new interactive dot must not pulse on becoming current */
@media (prefers-reduced-motion: reduce) {
  .loop-bytes-dot.is-now { transform: none; }
  .loop-bytes-skip-act, .loop-bytes-dot-num { transition: none; }
}

/* ===========================================================================
   EMBEDDED PROVE BYTE + EXPLAIN BYTE (the blind retest, folded into the bytes
   slideshow). Reuses the existing .loop-byte-* card chrome, .upload-dropzone,
   .loop-upload-list and .loop-marking-* motifs; only the in-byte retest sheet,
   the byte-sized marking card, the inline unmarkable note, and the
   scheme-derived walkthrough are new. Single accent, no green, AA, RM-guarded.
   =========================================================================== */

/* PROVE byte: the host fills .loop-byte-prove-body inside the byte card. */
.loop-byte-prove-lede {
  font-size: 1.0rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 1.05rem;
}

/* The question keeps the Y12/Y13 loop-paper anatomy (.loop-q) but flat: no card.
   The HEADER — folio ring, chip, marks — is centred as one row; the QUESTION
   TEXT (stem + parts) is left-aligned for readability, parts keeping their
   (a)/(b) label column. The QUESTION itself is bracketed by dashed rules above
   and below (the heading above it stays a plain left-aligned line). */
.loop-exam-q {
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  border-radius: 0;
  padding: 1rem 0;
  margin-bottom: 1.15rem;
}
/* the sheet holds ONE question, so the paper's per-question spacing collapses */
.loop-exam-q .loop-q { padding: 0; border-bottom: 0; }
/* header: folio ring + chip + marks centred together (marks no longer hang right) */
.loop-exam-q .loop-q-head { justify-content: center; margin-bottom: 0.9rem; }
.loop-exam-q .loop-q-marks { margin-left: 0; }
/* body: LEFT-aligned; parts keep the (a) label column (no per-part marks) */
.loop-exam-q .loop-q-stem { text-align: left; }
.loop-exam-q .loop-part-row-nomarks { grid-template-columns: 2.6rem 1fr; }
.loop-exam-q .loop-figure { margin: 0.9rem 0 0; }
/* pass mark (retest only): sits inside the bracket, set off by its own hairline;
   left-aligned like the rest of the body */
.loop-exam-q-foot {
  display: flex; justify-content: flex-start; align-items: baseline; gap: 0.45rem;
  margin-top: 0.9rem; padding: 0.55rem 0; border-top: 1px dashed var(--line);
  font-size: 0.78rem; color: var(--muted);
}
/* when the foot is present it owns the space down to the container's bottom
   dashed rule, so "Pass mark" sits CENTRED between the two dotted lines */
.loop-exam-q:has(.loop-exam-q-foot) { padding-bottom: 0; }
.loop-exam-q-foot-n {
  font-family: "Fraunces", Georgia, serif; font-size: 0.92rem; font-weight: 600;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}

/* ONE upload surface: the dropzone is the primary path; the phone QR sits
   beside it on desktop once minted (the :has() grid opens a second column) and
   is hidden on phones — scanning a QR with the phone it's shown on is absurd. */
.loop-prove-paths { display: grid; grid-template-columns: 1fr; gap: 0.8rem; align-items: stretch; }
@media (min-width: 700px) {
  .loop-prove-paths:has(.loop-retest-qr:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 250px);
  }
}
@media (max-width: 699px) {
  .loop-prove-paths .loop-retest-qr { display: none !important; }
}
.loop-byte-prove-upload .loop-retest-drop { margin-top: 0; }
.loop-byte-prove-upload .loop-upload-list { margin: 0.7rem 0 0.2rem; }

/* Scan-to-upload QR inside the prove byte: a compact vertical card in the
   right-hand column, reusing the diagnostic .loop-qr tokens. */
.loop-retest-qr {
  flex-direction: column; align-items: center; text-align: center;
  gap: 0.6rem; height: auto; margin: 0; padding: 0.95rem 0.9rem;
}
.loop-retest-qr .loop-qr-code { width: 92px; height: 92px; }
.loop-retest-qr .loop-qr-help { font-size: 0.78rem; }
.loop-retest-qr[hidden] { display: none !important; }
.loop-retest-qr:not([hidden]) { display: flex; }

/* the submit is the terminal action of the upload surface — full width, and
   snug against the paths: empty status lines collapse instead of holding a
   phantom paragraph of space between the boxes and the button */
.loop-byte-prove-upload .form-message:empty { display: none; margin: 0; }
.loop-byte-prove-upload .loop-byte-actions { margin-top: 1.05rem; }
.loop-byte-prove-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.loop-byte-prove-actions [data-prove-mark] { flex: 1 1 100%; justify-content: center; width: 100%; }

/* in-byte marking card: the same examiner-is-marking motif, CONTAINED in a real
   card (Marked Script tokens) so the retest marks inside the byte instead of
   blanking the page to the full-height beating-heart wait. The pulse + sweep
   track + cross-fading phase line are all kept, just sized down for a card. */
.loop-byte-marking {
  padding: clamp(1.5rem, 4vw, 2.1rem) 1.1rem clamp(1.3rem, 3.5vw, 1.7rem);
  margin: 1.1rem 0 0.2rem;
  display: grid; place-items: center; min-height: 0;          /* never full-height */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(33, 7, 6, 0.05), 0 22px 44px -36px rgba(137, 29, 26, 0.32);
}
.loop-byte-marking h3 {
  margin: 1.05rem 0 0; font-size: clamp(1.04rem, 2.4vw, 1.18rem);
  font-family: "Fraunces", Georgia, serif; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em; text-align: center;
}
.loop-byte-marking .loop-marking-pulse {
  width: clamp(56px, 10vw, 84px); margin: 0 auto;
}
.loop-byte-marking .loop-marking-track {
  margin: clamp(1.1rem, 2.6vw, 1.5rem) auto 0.9rem; max-width: 260px;
}
.loop-byte-marking .loop-marking-phase {
  font-size: 0.98rem; text-align: center; color: var(--muted);
}

/* ---------- PROVE-FIRST slip gate (the slip explanation card) ----------- */
/* Shown in place of byte 0 when marking classified the skill as a careless
   slip: the student kept the method marks, so we default to the blind retest
   and offer the full repair only if they fail (or ask for it). */
.loop-byte-tag-slip {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.loop-slipgate-body {
  font-size: clamp(1.02rem, 2.4vw, 1.1rem); line-height: 1.62;
  color: var(--ink-soft); margin: 0 0 1.3rem; max-width: 38rem;
}
.loop-slipgate-actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.65rem 1.1rem; margin-top: 0.4rem;
}
.loop-slipgate-actions .loop-slipgate-repair { color: var(--muted); }

/* inline "unmarkable" note — stays in the byte, offers a re-shoot */
.loop-byte-prove-note { margin: 1.1rem 0 0; padding: 0.95rem 1.05rem; border-radius: 12px;
  border-left: 3px solid var(--accent); background: #faf4e4; line-height: 1.55; }
.loop-byte-prove-note p { margin: 0 0 0.7rem; }
.loop-byte-prove-note p:last-child { margin-bottom: 0; }
.loop-byte-prove-recap { color: var(--muted); line-height: 1.55; margin: 0 0 0.4rem; }

/* EXPLAIN byte: a scheme-derived walkthrough when no authored one exists. The
   reveals themselves use the base .loop-byte-reveal styling; these style the
   compact "mark · step" lines the fallback builds. */
.loop-byte-wt { display: flex; flex-direction: column; gap: 0.55rem; }
.loop-byte-wt-line { margin: 0; line-height: 1.55; display: flex; gap: 0.6rem; align-items: baseline; }
.loop-byte-wt-mark {
  flex: 0 0 auto; min-width: 2.1rem; font-weight: 800; font-size: 0.82rem;
  color: var(--accent-strong, #6e1512); font-variant-numeric: tabular-nums;
}
.loop-byte-wt-ans { margin: 0.6rem 0 0; line-height: 1.55; }
.loop-byte-prove-close-note { color: var(--ink-soft, var(--ink)); line-height: 1.6; margin: 0.4rem 0 0; }
/* Explain byte: the failed question pinned at the top for context, staged reveals below. */
.loop-byte-explain-q { margin: 0 0 1.1rem; padding: 0.85rem 1rem; background: #faf4e4; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 4px 12px 12px 4px; }
.loop-byte-explain-q-k { display: block; font-weight: 800; color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; margin-bottom: 0.35rem; }
.loop-byte-explain-q-body { line-height: 1.55; }
/* A single equation on its own centred, breathing line — keeps worked solutions
   readable instead of a wall of inline maths. (Inline \(..\) inside a block.) */
.loop-byte-eq { display: block; text-align: center; margin: 0.85rem 0 0.4rem; line-height: 1.5; overflow-x: auto; overflow-y: hidden; }
.loop-byte-reveal .loop-byte-eq { font-size: 1.04em; }
/* Wide authored maths that MathJax can't line-break is split at render time
   (loop-bytes.js polishReveal) into \( … \) islands so it WRAPS on a phone
   instead of scrolling off it. -wrap = a \quad-separated list; -chain = one
   long derivation split before its =/⇒ so each wrapped line starts with the
   relation. */
.loop-byte-eq-wrap, .loop-byte-eq-chain {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  row-gap: 0.45rem; /* keeps the base overflow-x:auto — a single island wider
  than the column scrolls inside the div instead of blowing out the card */
}
.loop-byte-eq-wrap { column-gap: 1.15rem; }
.loop-byte-eq-chain { column-gap: 0.45rem; }
.loop-byte-eq-i { white-space: nowrap; }
/* inline maths glued to its trailing punctuation so a comma never orphans */
.loop-byte-nb { white-space: nowrap; }
/* trailing fragment an authored eq div carries after the maths (e.g. a unit) */
.loop-byte-eq-tail { white-space: nowrap; }
/* Anything still wider than the column (arrays, big built-up fractions) keeps
   the scroll fallback — slim themed bar, not the OS slab. */
.loop-byte-eq { scrollbar-width: thin; scrollbar-color: var(--line, #d8c9b4) transparent; padding-bottom: 2px; }
.loop-byte-eq::-webkit-scrollbar { height: 6px; }
.loop-byte-eq::-webkit-scrollbar-thumb { background: var(--line, #d8c9b4); border-radius: 3px; }
.loop-byte-eq::-webkit-scrollbar-track { background: transparent; }
/* A reveal's bold lead-in sits on its own line — the run-on "heading glued to
   prose" text wall was a real-user complaint. Applied by polishReveal only when
   the lead-in ends in sentence punctuation. */
.loop-byte-lead { display: block; font-weight: 700; color: var(--ink); margin: 0 0 0.35rem; }
.loop-byte-lead-q { margin-bottom: 0.55rem; }
/* Bytes view: the repair is just the bytes slideshow (no examiner margin column),
   so reclaim the room that empty margin reserved and give the reading column a
   touch more width to breathe. */
.loop-repair-bytes .loop-bytes { max-width: 44rem; }
.loop-repair-bytes .loop-work { max-width: 48rem; }
@media (min-width: 1200px) {
  .loop-repair-bytes .loop-repair-desk.loop-desk { grid-template-columns: 168px minmax(0, 1fr); }
}

/* ---- guardian pay: surfaced as a featured panel (parents usually pay) ------- */
.upg-card-note { margin: 0.7rem 0 0; font-size: 0.82rem; line-height: 1.4; color: rgba(241, 230, 210, 0.66); text-align: center; }
.upg-card-note a { color: #e8b9a8; text-decoration: underline; text-underline-offset: 2px; }
.upg-parent-featured {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  box-shadow: 0 1px 2px rgba(33,7,6,.05), 0 30px 60px -40px rgba(137,29,26,.4);
}
.upg-parent-featured .eyebrow {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 800; color: var(--accent); margin: 0 0 0.5rem;
}
.upg-parent-featured h2 { font-size: 1.22rem; margin: 0 0 0.4rem; }
.upg-parent-featured .upg-parent-row .primary-button { min-height: 44px; white-space: nowrap; }

/* ---- parent INTRO form (04/09): labelled fields, wells not bare boxes ------ */
.upg-intro { align-items: start; }
.upg-intro-fields { display: grid; gap: 0.85rem; }
.upg-intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
@media (max-width: 560px) { .upg-intro-grid { grid-template-columns: 1fr; } }
.upg-field { display: flex; flex-direction: column; gap: 0.38rem; margin: 0; }
.upg-field > span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.upg-field > span em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); opacity: 0.85; }
.upg-field input { width: 100%; min-height: 46px; padding: 0.62rem 0.95rem; border-radius: 12px;
  border: 1px solid var(--line-strong, var(--line)); background: var(--surface-soft); color: var(--ink);
  font: inherit; font-size: 0.98rem; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.upg-parent-featured .upg-field input { background: var(--surface-soft); }
.upg-field input::placeholder { color: var(--muted); opacity: 0.55; }
.upg-field input:hover { border-color: var(--accent); }
.upg-field input:focus-visible { outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-wash); }
.upg-intro-actions { display: flex; align-items: center; gap: 0.5rem 1.1rem; flex-wrap: wrap; margin-top: 0.15rem; }
.upg-intro-actions .primary-button { min-height: 46px; white-space: nowrap; }
.upg-intro-trust { margin: 0; flex: 1 1 220px; font-size: 0.82rem; line-height: 1.4; color: var(--muted); }
.upg-intro .form-message:empty { display: none; margin: 0; }

/* ── Y11 teach-first curriculum hub ─────────────────────────────────────── */
.y11-page { max-width: 1120px; }
/* desktop fills the viewport: hero (+ callout) on the left, the progress
   score-sheet + board control as a right-hand rail; stacks below 880px */
.y11-grid { display: grid; gap: clamp(1.4rem, 3vw, 2.6rem); }
.y11-grid .y11-progress-strip { margin-top: 0; }
@media (min-width: 880px) {
  .y11-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); align-items: start; }
  .y11-col-aside .y11-progress-strip { margin-top: 2.6rem; }
  .y11-col-aside .y11-domains { grid-template-columns: 1fr; }
}
.y11-track { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.y11-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .y11-fill { transition: none; } }

/* ── Hero: the lesson card, the dominant top element ────────────────────── */
.y11-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  border-top: 5px solid var(--accent); padding: clamp(1.8rem, 3.4vw, 2.9rem); box-shadow: var(--shadow); }
.y11-hero .eyebrow { color: var(--accent); }
.y11-hero-title { margin: 0.5rem 0 0.7rem; font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.1; color: var(--ink); letter-spacing: -0.015em; }
.y11-hero-sub { margin: 0 0 1.2rem; color: var(--ink-soft); font-size: 1.05rem; line-height: 1.5; max-width: 50ch; }
.y11-hero .loop-next-row { margin: 0; }
.y11-hero .primary-button { font-size: 1.08rem; padding-top: 0.85rem; padding-bottom: 0.85rem; }
.y11-hero-meta { margin: 0.95rem 0 0; color: var(--muted); font-size: 0.88rem; letter-spacing: 0.01em; }
.y11-hero.is-done { text-align: center; }
.y11-hero.is-done .loop-next-row { justify-content: center; }
.y11-hero.is-done h1 { margin: 0.4rem 0 0.6rem; font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem); line-height: 1.15; }
/* first-ever visit (TikTok lander, lesson 1): flat clean surface, headline sized up */
.y11-hero.is-first .y11-hero-title { font-size: clamp(2rem, 3.8vw, 3.3rem); }

/* ── Progress: a marker's score-sheet ledger, flat on the paper, demoted ──── */
/* a maroon examiner's margin rule runs down the left; the whole block sits at
   the same width as the hero above but reads far lighter — secondary status,
   not a competing card. */
.y11-progress-strip { margin: 2rem 0 0; padding-left: 1.4rem; border-left: 2px solid rgba(137, 29, 26, 0.5); }
/* persistent exam-board picker on the hub — demoted to a quiet caption line */
.y11-board-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 1.5rem 0 0;
  padding: 0 0 0 1.4rem; background: none; border: none; border-radius: 0; }
.y11-board-bar-label { font-weight: 700; font-size: 0.8rem; color: var(--muted); }
/* theme-pure.css forces select { background/border/radius !important }, so the
   pill styling has to win with !important + higher (class) specificity. */
.y11-board-bar-select { -webkit-appearance: none !important; appearance: none !important; width: auto !important;
  min-height: 30px; padding: 4px 30px 4px 12px; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--muted) !important; border: 1px solid var(--line-strong) !important; border-radius: 8px !important;
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23891d1a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important; background-size: 13px !important;
  cursor: pointer; }
.y11-board-bar-select:hover { border-color: var(--accent) !important; color: var(--ink-soft) !important; }
.y11-board-bar-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.y11-board-bar-saved { font-size: 0.8rem; font-weight: 700; color: var(--accent); opacity: 0; transition: opacity 0.15s ease; }
.y11-board-bar-saved.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .y11-board-bar-saved { transition: none; } }
.y11-progress-lede { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.3rem 1rem; margin: 0 0 0.3rem; }
/* "N skills locked in" — the count set large like a mark out of total */
.y11-progress-count { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: 0.95rem;
  font-weight: 500; color: var(--muted); }
.y11-progress-count b { font-size: 1.7rem; font-weight: 600; color: var(--ink-soft); margin-right: 0.15rem; }
.y11-progress-hint { margin: 0; font-size: 0.8rem; color: var(--faint); }
.y11-domains { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1.6rem; margin-top: 0.5rem; }
@media (max-width: 480px) { .y11-domains { grid-template-columns: 1fr; } }
/* each domain is a hairline-divided ledger row, not a fuel gauge */
.y11-bar { padding: 0.6rem 0; border-top: 1px solid var(--line); }
.y11-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem;
  font-size: 0.86rem; margin: 0; }
.y11-bar-name { font-family: "Fraunces", Georgia, serif; color: var(--ink-soft); font-weight: 500; }
.y11-bar-n { color: var(--faint); font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.y11-bar-track { position: relative; height: 5px; margin-top: 0.45rem; }
/* subtle 40%-graduation tick on the track (core domains only) */
.y11-bar-tick { position: absolute; top: -2px; bottom: -2px; width: 2px; transform: translateX(-1px);
  background: var(--line-strong); border-radius: 2px; }
.y11-bar-tick.is-met { background: var(--accent); }

/* ── "Up next" ledger: the rest of the current topic, under the hero ─────── */
/* Same examiner-margin-rule score-sheet language as the progress strip, so the
   left column reads hero → ledger instead of dying into empty cream. */
.y11-upnext { margin: 1.7rem 0 0; padding-left: 1.4rem; border-left: 2px solid rgba(137, 29, 26, 0.5); }
.y11-upnext-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 0.25rem; }
.y11-upnext-title { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); }
.y11-upnext-all { background: none; border: none; padding: 0.2rem 0; font: inherit; font-size: 0.8rem;
  font-weight: 700; color: var(--accent); cursor: pointer; white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.y11-upnext-all:hover { text-decoration-color: var(--accent); }
.y11-upnext-all:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.y11-upnext-list { list-style: none; margin: 0; padding: 0; }
.y11-upnext-row { border-top: 1px solid var(--line); }
.y11-upnext-btn { display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 44px;
  padding: 0.45rem 0.3rem 0.45rem 0; background: none; border: none; border-radius: 6px;
  font: inherit; text-align: left; color: var(--ink-soft); cursor: pointer; }
.y11-upnext-btn:hover .y11-upnext-label { color: var(--accent); }
.y11-upnext-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.y11-upnext-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  border: 1.6px solid var(--line-strong); background: transparent; }
.y11-upnext-row.is-done .y11-upnext-dot { background: var(--accent); border-color: var(--accent); opacity: 0.55; }
.y11-upnext-row.is-now .y11-upnext-dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash, rgba(137, 29, 26, 0.12)); }
.y11-upnext-label { flex: 1 1 auto; min-width: 0; font-size: 0.95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.y11-upnext-row.is-now .y11-upnext-label { font-weight: 700; color: var(--ink); }
.y11-upnext-row.is-done .y11-upnext-label { color: var(--muted); }
.y11-upnext-row.is-parked .y11-upnext-label { color: var(--faint); }
.y11-upnext-meta { flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--faint); }
.y11-upnext-row.is-now .y11-upnext-meta { color: var(--accent); }
.y11-upnext-gap { padding: 0.45rem 0; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--faint); }
.y11-upnext-list > :first-child { border-top: none; }

/* ── consolidation-paper / graduation prompt ────────────────────────────── */
.y11-callout { background: var(--accent-wash, var(--surface-soft)); border: 1px solid var(--accent);
  border-radius: 16px; padding: clamp(1.2rem, 3.5vw, 1.7rem); margin: 1.4rem 0 0; }
.y11-callout.is-graduate { border-color: var(--accent-strong); }
.y11-callout h2 { margin: 0.3rem 0 0.5rem; font-size: clamp(1.25rem, 3.5vw, 1.6rem); line-height: 1.2; }
.y11-callout-sub { margin: 0; color: var(--ink); max-width: 54ch; }
.y11-callout .loop-next-row { margin: 1rem 0 0; }
.y11-callout .form-message { margin: 0.6rem 0 0; color: var(--danger); }

/* ── tester-only skip-to-checkpoint panel ───────────────────────────────── */
.y11-dev { margin: 1.6rem 0 0; padding: 0.9rem 1.1rem; border: 1px dashed var(--line-strong);
  border-radius: 12px; background: var(--surface-soft, transparent); }
.y11-dev-h { margin: 0 0 0.6rem; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.y11-dev-note { text-transform: none; letter-spacing: 0; font-style: italic; }
.y11-dev-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.y11-dev-row .ghost-button { font-size: 0.85rem; }
.y11-dev .form-message { margin: 0.5rem 0 0; color: var(--muted); }

/* ── topic nav: compact pill trigger + left revision-notes drawer ────────── */
.y11-navtoggle { display: inline-flex; align-items: center; gap: 10px; width: auto; margin: 0 0 0.5rem;
  padding: 9px 15px; min-height: 42px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 11px; cursor: pointer; font: inherit; font-weight: 700; font-size: 0.92rem; color: var(--ink-soft);
  transition: border-color 0.15s ease; }
.y11-navtoggle:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .y11-navtoggle { transition: none; } }
.y11-navtoggle-icon { position: relative; width: 16px; height: 12px; flex: 0 0 auto; }
.y11-navtoggle-icon::before, .y11-navtoggle-icon::after { content: ""; position: absolute; left: 0; right: 0;
  height: 2px; border-radius: 2px; background: var(--accent); }
.y11-navtoggle-icon::before { top: 0; box-shadow: 0 5px 0 var(--accent); }
.y11-navtoggle-icon::after { bottom: 0; }
.y11-navtoggle-hint { font-weight: 600; color: var(--muted); font-size: 0.86rem; }
/* topic-nav handle: a small tab hugging the LEFT EDGE that opens the drawer —
   a peek affordance saying "there's a panel here". Below the drawer/backdrop z. */
/* Topics index-tab: a bookmark peeking from the left edge of the revision
   book. Compact (icon only) at rest, it EXPANDS on hover/focus to name itself
   — one clean affordance, not a tall slab of rotated text. Palette-token
   based, so it flips automatically when the theme does. */
.y11-drawer-handle { position: fixed; left: 0; top: 40%; transform: translateY(-50%); z-index: 50;
  display: flex; align-items: center; overflow: hidden; height: 52px; width: 40px; padding: 0;
  background: var(--accent); border: none; border-radius: 0 13px 13px 0;
  color: var(--surface); cursor: pointer;
  box-shadow: 3px 4px 18px -8px rgba(33, 7, 6, 0.5);
  transition: width 0.22s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.16s ease, box-shadow 0.16s ease;
  animation: y11-handle-nudge 1s ease 0.8s 2; }
@keyframes y11-handle-nudge { 50% { transform: translateY(-50%) translateX(5px); } }
.y11-drawer-handle:hover, .y11-drawer-handle:focus-visible { width: 118px; background: var(--accent-strong);
  box-shadow: 4px 5px 22px -8px rgba(33, 7, 6, 0.55); }
.y11-drawer-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 640px) { .y11-drawer-handle { height: 48px; width: 36px; }
  .y11-drawer-handle:hover, .y11-drawer-handle:focus-visible { width: 112px; } }
@media (prefers-reduced-motion: reduce) { .y11-drawer-handle { transition: width 0.01s; animation: none; } }
.y11-drawer-handle-icon { flex: 0 0 auto; margin: 0 10px; }
@media (max-width: 640px) { .y11-drawer-handle-icon { margin: 0 8px; } }
.y11-drawer-handle-label { writing-mode: horizontal-tb; transform: none; margin: 0; white-space: nowrap;
  font-size: 0.84rem; font-weight: 700; letter-spacing: 0.01em; color: var(--surface);
  opacity: 0; transition: opacity 0.15s ease 0.05s; }
.y11-drawer-handle:hover .y11-drawer-handle-label,
.y11-drawer-handle:focus-visible .y11-drawer-handle-label { opacity: 1; }
.y11-drawer-backdrop { position: fixed; inset: 0; background: rgba(33, 7, 6, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 1200; }
.y11-drawer-backdrop[hidden] { display: none; }
.y11-drawer { position: fixed; top: 0; left: 0; right: auto; height: 100%; width: min(460px, 92vw);
  background: var(--surface); border-right: 1px solid var(--line-strong);
  box-shadow: 12px 0 44px -16px rgba(33, 7, 6, 0.5); z-index: 1201;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
  display: flex; flex-direction: column; overflow: hidden; }
.y11-drawer.is-open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) { .y11-drawer { transition: none; } }
.y11-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.y11-drawer-title { margin: 0; font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.35rem;
  color: var(--ink); letter-spacing: -0.01em; }
.y11-drawer-x { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.y11-drawer-x:hover { color: var(--accent); border-color: var(--accent); }
.y11-drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px 28px; }
.y11-nav-next { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 15px;
  border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); cursor: pointer;
  font: inherit; text-align: left; margin: 0 0 16px; }
.y11-nav-next:hover { border-color: var(--accent); }
.y11-nav-next-k { display: block; font-weight: 700; font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); }
.y11-nav-next-l { display: block; font-weight: 700; font-size: 0.95rem; color: var(--ink); margin-top: 3px; }
.y11-nav-next-arrow { margin-left: auto; color: var(--accent); font-weight: 800; font-size: 1.1rem; }
.y11-nav-subject { border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  margin: 0 0 14px; overflow: hidden; }
.y11-nav-subj-head { display: flex; align-items: center; gap: 12px; padding: 15px 16px; cursor: pointer;
  list-style: none; }
.y11-nav-subj-head::-webkit-details-marker { display: none; }
.y11-nav-subj-name { margin: 0; font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.12rem;
  color: var(--ink); }
.y11-nav-subj-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); }
.y11-nav-chev { margin-left: auto; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; transition: transform 0.15s ease; }
.y11-nav-chev::before { content: "\25BE"; }
.y11-nav-subject[open] > .y11-nav-subj-head .y11-nav-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .y11-nav-chev, .y11-nav-chev-sm { transition: none; } }
.y11-nav-subj-body { border-top: 1px solid var(--line); padding: 4px 0 6px; }
.y11-nav-topic + .y11-nav-topic { border-top: 1px solid var(--line); }
.y11-nav-topic-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer;
  list-style: none; }
.y11-nav-topic-head::-webkit-details-marker { display: none; }
.y11-nav-ring { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: var(--surface); }
.y11-nav-ring.is-part { border-color: var(--accent); background: radial-gradient(var(--accent) 38%, transparent 40%); }
.y11-nav-ring.is-done { border-color: var(--accent); background: var(--accent); }
.y11-nav-topic-name { flex: 1; font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.y11-nav-topic-meta { flex: 0 0 auto; font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.y11-nav-chev-sm { flex: 0 0 auto; width: 24px; text-align: center; color: var(--muted); font-size: 0.72rem;
  transition: transform 0.15s ease; }
.y11-nav-chev-sm::before { content: "\25BE"; }
.y11-nav-topic[open] > .y11-nav-topic-head .y11-nav-chev-sm { transform: rotate(180deg); }
.y11-nav-lessons { list-style: none; margin: 0; padding: 2px 0 10px; position: relative; }
.y11-nav-lessons::before { content: ""; position: absolute; left: 28px; top: 16px; bottom: 20px; width: 2px;
  background: var(--line); }
.y11-nav-lesson { display: flex; position: relative; min-height: 40px; }
.y11-nav-lesson-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 16px;
  background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.y11-nav-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--line-strong); margin-left: 7px; position: relative; z-index: 1; }
.y11-nav-lesson.is-held .y11-nav-dot { background: var(--good, #2f6b3f); border-color: var(--good, #2f6b3f); }
.y11-nav-lesson.is-next .y11-nav-dot { background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash); }
.y11-nav-llabel { font-size: 0.95rem; color: var(--muted); }
.y11-nav-lesson.is-held .y11-nav-llabel { color: var(--ink-soft); }
.y11-nav-lesson.is-held .y11-nav-llabel::after { content: " \2713"; color: var(--good, #2f6b3f); font-weight: 800;
  font-size: 0.78rem; }
.y11-nav-lesson.is-next { background: var(--accent-wash); }
.y11-nav-lesson.is-next::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); }
.y11-nav-lesson.is-next .y11-nav-llabel { font-weight: 700; color: var(--ink); }
.y11-nav-lesson-btn:hover .y11-nav-llabel { color: var(--ink); }

/* ============================================================================
   History v4.2 — "Your revision book" (/history), minimal / dashboard-native.
   Matched to the rest of the app: content sits on BARE CREAM (no card, no
   sheet, no shadow) at the dashboard's 820px measure. The architecture is
   done by type, whitespace and hairline rules — the same restraint as the
   loop dashboard. Colour is disciplined: ink for text, maroon ONLY for the
   eyebrow, the pen-stroke, actions and the active tab; amber only for "due";
   one grey. hx-/hxs-/hxt-/hxl-/hxq- classes are this page's own.
   ============================================================================ */
.loop-dash.loop-history { max-width: 820px; }
.hx-sheet { margin-top: clamp(1rem, 3vh, 2.2rem); } /* plain region — no box */

/* the pull-tab's clearance at narrow widths; the centred measure clears it wide */
@media (max-width: 1099px) { .loop-history.hx-hasmap { padding-left: 48px; } }
@media (max-width: 640px) { .loop-history.hx-hasmap { padding-left: 38px; } }

/* masthead: the app's hero idiom — eyebrow (.loop-move-label, reused) + a
   Fraunces title carrying the signature pen-stroke on the italic word */
.hxs-mast { margin-bottom: clamp(1.3rem, 3.5vh, 2rem); }
.hxs-title { margin: 0; font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem); font-weight: 560;
  letter-spacing: -0.02em; line-height: 1.05; color: var(--ink); }
.hxs-title em { font-style: italic; color: var(--accent);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M3 9 C 30 4 80 3.5 117 6.5' fill='none' stroke='%23891d1a' stroke-width='2.4' stroke-linecap='round' opacity='0.8'/%3E%3C/svg%3E") no-repeat bottom center / 100% 0.28em;
  padding-bottom: 0.14em; }
.hxs-stats { margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--muted);
  font-variant-numeric: tabular-nums; }

/* tabs: quiet editorial underline — no pills, no fills */
.hx-tabs { display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-strong); }
.hx-tab { appearance: none; background: none; border: none; cursor: pointer; font: inherit;
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  padding: 0.2rem 0.1rem 0.7rem; margin-bottom: -1px;
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
  border-bottom: 1.5px solid transparent; transition: color 0.15s ease; }
.hx-tab:hover { color: var(--ink); }
.hx-tab.is-on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.hx-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hx-tab-n { font-size: 0.72rem; font-weight: 700; color: var(--muted);
  font-family: "Fraunces", Georgia, serif; font-variant-numeric: tabular-nums; }
.hx-tab.is-on .hx-tab-n { color: var(--accent); }

/* search: a quiet ruled field, right of the tab row */
input.hx-search { margin-left: auto; align-self: center; width: auto !important;
  min-width: 150px; max-width: 240px; font: inherit; font-size: 0.86rem;
  color: var(--ink); background: transparent !important;
  border: none !important; border-bottom: 1px solid var(--line-strong) !important;
  border-radius: 0 !important; box-shadow: none !important; padding: 0.35rem 0.1rem; }
input.hx-search::placeholder { color: var(--muted); opacity: 0.8; }
input.hx-search:focus-visible { outline: none; border-bottom-color: var(--accent) !important;
  box-shadow: 0 1px 0 var(--accent) !important; }
@media (max-width: 640px) { input.hx-search { flex: 1 1 100%; width: 100% !important;
  max-width: none; min-width: 0; margin: 0.35rem 0 0.4rem; } }

.hx-panel { display: none; margin-top: 0.4rem; }
.hx-panel.is-on { display: block; }

.hx-right { display: flex; align-items: center; gap: 1rem; flex: 0 0 auto;
  justify-content: flex-end; text-align: right; }
.hx-score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-soft, var(--ink)); font-size: 0.9rem; white-space: nowrap; }
.hx-score strong { font-weight: 700; color: var(--ink); }
.hx-pending { color: var(--muted); font-weight: 500; font-style: italic; }

.hx-row-line { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; width: 100%; }
.hx-qdetails > summary, .hxl-details > summary { cursor: pointer; list-style: none; }
.hx-qdetails > summary::-webkit-details-marker, .hxl-details > summary::-webkit-details-marker { display: none; }
.hx-qtext { margin: 0.55rem 0 0.25rem; padding: 0.8rem 0 0.55rem; border-top: 1px dashed var(--line);
  font-size: 0.95rem; line-height: 1.6; color: var(--ink); }
.hx-qtext p { margin: 0 0 0.55rem; }
.hx-qmarks { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--muted); }
/* actions read as the app's underline-text links, not buttons (bar the one CTA) */
.hx-practise { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.4rem 0 0.2rem;
  padding: 0.5rem 0.1rem; min-height: 40px; font: inherit; font-size: 0.86rem; font-weight: 700;
  color: var(--accent); background: none; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(137, 29, 26, 0.4); transition: color 0.15s ease, text-decoration-color 0.15s ease; }
.hx-practise:hover { color: var(--accent-strong); text-decoration-color: currentColor; background: none; }
.hx-practise:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hx-ghostlink { appearance: none; margin: 0.4rem 0 0.2rem; padding: 0.5rem 0.1rem; min-height: 40px;
  font: inherit; font-size: 0.84rem; font-weight: 700; color: var(--muted); background: none; border: none;
  cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent); }
.hx-ghostlink:hover { color: var(--ink); }
.hx-ghostlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── topics tab ────────────────────────────────────────────────────────────
   Subject = the app's own section-title idiom (small-caps label on a hairline).
   Each topic is one calm line: chevron · name · tally · due-dot · Drill. */
.hxt-group { margin-top: clamp(1.6rem, 4.5vh, 2.4rem); }
.hx-panel > .hxt-group:first-child { margin-top: 1.1rem; }
.hxt-group-label { margin: 0 0 0.15rem; padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line-strong);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.17em;
  text-transform: uppercase; color: var(--muted); }
.hxt-group-list { list-style: none; margin: 0; padding: 0; }
.hxl-topic { border-bottom: 1px dashed var(--line); }
.hxt-group-list > li:last-child > .hxl-topic { border-bottom: none; }
.hxl-topic-head { display: flex; align-items: center; gap: 0.6rem;
  min-height: 48px; padding: 0.55rem 0; cursor: pointer; list-style: none; }
.hxl-topic-head::-webkit-details-marker { display: none; }
.hxl-topic-head:hover .hxl-topic-name { color: var(--accent); }
.hxl-topic-chev { flex: 0 0 auto; width: 7px; height: 7px; margin: 0 1px 0 2px;
  border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted);
  transform: rotate(-45deg); transition: transform 0.15s ease; }
.hxl-topic[open] > .hxl-topic-head .hxl-topic-chev { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .hxl-topic-chev { transition: none; } }
.hxl-topic-name { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 0.99rem; font-weight: 600;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.15s ease; }
.hxl-topic-tally { flex: 0 0 auto; font-family: "Fraunces", Georgia, serif; font-size: 0.98rem;
  font-weight: 600; color: var(--ink-soft, var(--ink)); font-variant-numeric: tabular-nums; }
.hxl-topic-due { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.hxl-drill { appearance: none; flex: 0 0 auto; border: none; background: none;
  cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 700;
  color: var(--accent); padding: 0.55rem 0.1rem 0.55rem 0.35rem; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(137, 29, 26, 0.35); transition: color 0.15s ease, text-decoration-color 0.15s ease; }
.hxl-drill:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
.hxl-drill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hxl-topic-body { list-style: none; margin: 0; padding: 0 0 0.65rem 1.15rem; }

/* motion that whispers: an opened section settles in a few px, nothing more */
details[open] > .hxl-topic-body, .hxl-details[open] > .hxl-body { animation: hxreveal 0.18s ease-out; }
@keyframes hxreveal { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  details[open] > .hxl-topic-body, .hxl-details[open] > .hxl-body { animation: none; }
}

/* lesson rows inside a topic: opening one IS the method card */
.hxl-row { display: block; margin: 0; padding: 0; border-bottom: none; border-radius: 0;
  border-top: 1px dashed var(--line); }
.hxl-topic-body > .hxl-row:first-child { border-top: none; }
.hxl-summary { min-height: 44px; padding: 0.4rem 0; }
.hxl-summary:hover .loop-q-skill { color: var(--accent); }
.hxl-summary .loop-q-main { flex: 1 1 auto; min-width: 0; gap: 0.1rem; }
.hxl-summary .loop-q-skill { font-size: 0.92rem; font-weight: 600; line-height: 1.35; transition: color 0.15s ease; }
.hxl-summary .loop-q-meta { font-size: 0.75rem; gap: 0.5rem; }
.hxl-mark { flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.4px solid var(--line-strong); background: transparent; color: var(--accent-strong); }
.hxl-mark .loop-mini-tick { width: 12px; height: 12px; }
.hxl-mark.is-secure { border-color: color-mix(in srgb, var(--accent-strong) 45%, var(--line-strong)); }
.hxl-mark.is-due { border-style: dashed; border-color: var(--warn); color: var(--warn); }
.hxl-mark.is-prog { border-style: dashed; }
.hxl-state { flex: 0 0 auto; font-size: 0.74rem; white-space: nowrap; }
.hxl-state.hxl-ok { color: var(--muted); font-weight: 600; }
.hxl-state.hxl-due { color: var(--warn); font-weight: 700; }
.hxl-state.hxl-prog { color: var(--muted); font-weight: 500; font-style: italic; }
.hxl-body { margin-top: 0.3rem; padding: 0.6rem 0 0.5rem; border-top: 1px dashed var(--line); }
.hxl-full { margin: 0 0 0.5rem; font-size: 0.83rem; color: var(--muted); }
.hxl-method { margin: 0.15rem 0 0.25rem; font-size: 0.94rem; line-height: 1.55; color: var(--ink-soft); }
.hxl-method .loop-byte-reveal { margin-bottom: 0.45rem; }
.hxl-actions { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-top: 0.15rem; }
.hxl-flash > .hxl-summary { animation: hxlflash 1.4s ease; }
@keyframes hxlflash { 0% { background: var(--accent-wash, rgba(137,29,26,0.07)); } 100% { background: none; } }
@media (prefers-reduced-motion: reduce) { .hxl-flash > .hxl-summary { animation: none; } }

/* ── fix pile tab ──────────────────────────────────────────────────────────
   Wrong answers, first-class. One primary CTA (the single filled button on
   the page), quiet filter chips, then calm recognition rows: verdict mark,
   clamped question, meta. No margin rules — hairlines carry it. */
.hxq-lede { margin: clamp(1.1rem, 3vh, 1.6rem) 0 0.2rem; display: flex; }
.hxq-redo { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 44px; padding: 0.6rem 1.4rem; font: inherit; font-size: 0.9rem; font-weight: 700;
  color: var(--bg); background: var(--accent); border: none; border-radius: 9px; cursor: pointer;
  transition: background 0.15s ease; }
.hxq-redo:hover { background: var(--accent-strong); }
.hxq-redo:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
@media (max-width: 640px) { .hxq-redo { width: 100%; } }
.hxq-filters { display: flex; gap: 1.3rem; flex-wrap: wrap; margin: 0.9rem 0 0.15rem; }
.hxq-f { appearance: none; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--muted);
  background: none; border: none; border-bottom: 1.5px solid transparent; border-radius: 0;
  padding: 0.15rem 0.1rem 0.35rem; min-height: 30px; cursor: pointer; transition: color 0.15s ease; }
.hxq-f:hover { color: var(--ink); }
.hxq-f.is-on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.hxq-f span { color: var(--muted); font-family: "Fraunces", Georgia, serif;
  font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.hxq-f.is-on span { color: var(--accent); }
.hxq-f:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hxq-mlist { margin-top: 0.6rem; }
.hxq-row { display: block; margin: 0; padding: 0; border-bottom: none; border-radius: 0;
  border-top: 1px dashed var(--line); }
.hxq-mlist > .hxq-row:first-child { border-top: none; }
.hxq-summary { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.7rem 0; }
.hxq-verdict { flex: 0 0 42px; width: 42px; display: inline-flex; align-items: baseline; justify-content: flex-end;
  gap: 0.2rem; margin-top: 0.15rem; font-family: "Fraunces", Georgia, serif; font-size: 0.92rem;
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hxq-verdict.pass { color: var(--accent-strong); }
.hxq-verdict.fail { color: var(--accent); }
.hxq-verdict.pending { color: var(--muted); font-weight: 500; }
.hxq-verdict .loop-mini-tick { width: 12px; height: 12px; align-self: center; }
.hxq-x { width: 11px; height: 11px; align-self: center; }
.hxq-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.22rem; }
.hxq-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 0.9rem; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.hx-qdetails[open] .hxq-text { display: none; } /* the full question opens below — no duplicate */
.hxq-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; font-size: 0.74rem; color: var(--muted); }
.hxq-mlist .hx-qtext, .hxq-mlist .hxl-actions { margin-left: calc(42px + 0.9rem); }
@media (max-width: 480px) { .hxq-mlist .hx-qtext, .hxq-mlist .hxl-actions { margin-left: 0; } }

/* the History nav link would be hidden ≤640px by theme-pure's blanket
   `.topnav a:not(.primary-button) { display:none }` (it loads after this
   file, and hides the gear the same way). History is the only way INTO the
   page, so keep exactly this one anchor alive on phones — higher specificity
   (0,3,1) beats the hide rule's (0,2,1) regardless of load order — but shrink
   it to its clock icon: with the text label, [brand · History · Log out ·
   Dashboard] clipped the Dashboard button off the right edge at 390px. */
.topnav-history-ic { display: none; }
@media (max-width: 640px) {
  .topnav a.ghost-button.topnav-history {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 9px;
  }
  .topnav-history-ic { display: block; }
  .topnav-history-label { display: none; }
}

@media (max-width: 700px) {
  .hx-right { flex-direction: column; align-items: flex-end; gap: 0.25rem; }
  .hx-tab { padding: 0.45rem 0.75rem; font-size: 0.86rem; }
}

/* UNGATED bytes (2026-08-18): the row under a live check always offers a way on —
   a quiet "Skip this check" before it's answered (answering stays the primary),
   the primary "Next step" once it is. */
.loop-byte-advance-skip { justify-content: flex-end; margin-top: 0.35rem; }
.loop-byte-skipcheck { font-size: 0.86rem; color: var(--muted); }
.loop-byte-skipcheck:hover { color: var(--accent); }
.loop-byte-skipcheck .btn-arrow { margin-left: 2px; }

/* ══════════════════════════════════════════════════════════════════════════
   SYNOPTIC PAPERS ON THE HUB (2026-09-04) — the score-sheet ledger under the
   lesson hero. Same examiner-margin motif as the progress strip; one accent.
   ══════════════════════════════════════════════════════════════════════════ */
.y11-papers { margin: 1.7rem 0 0; padding-left: 1.4rem; border-left: 2px solid rgba(137, 29, 26, 0.5); }
.y11-papers-head { margin: 0 0 0.6rem; }
.y11-papers-title { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: 1.05rem; font-weight: 600; color: var(--ink);
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.y11-papers-best { font-family: "HankenGrotesk", system-ui, sans-serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); }
.y11-papers-sub { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; max-width: 56ch; }
.y11-papers-ledger { list-style: none; margin: 0.6rem 0 0; padding: 0; max-width: 420px; }
.y11-paper-row { border-top: 1px solid var(--line); }
.y11-paper-link { display: flex; align-items: baseline; gap: 0.6rem; min-height: 44px; padding: 0.55rem 0.1rem;
  text-decoration: none; color: inherit; }
a.y11-paper-link:hover .y11-paper-label { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.y11-paper-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.y11-paper-label { color: var(--ink-soft); font-weight: 500; font-size: 0.95rem; }
.y11-paper-dots { flex: 1; border-bottom: 2px dotted var(--line-strong, var(--line)); transform: translateY(-4px); }
.y11-paper-score { font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.y11-paper-score.is-best { color: var(--accent); }
.y11-paper-score.is-pending { font-family: inherit; font-weight: 500; font-size: 0.85rem; font-style: italic; color: var(--muted); }
.y11-papers-none { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.9rem; }
.y11-papers-cta { display: flex; align-items: center; gap: 0.6rem 1.1rem; flex-wrap: wrap; margin: 1rem 0 0; }
.y11-papers-cta .primary-button { min-height: 46px; }
.y11-papers-cta .form-message { flex-basis: 100%; margin: 0; }
.y11-papers-cta .form-message:empty { display: none; }
.y11-papers-cta.is-locked .primary-button { opacity: 0.38; cursor: not-allowed; filter: grayscale(1); }
.y11-papers-free { margin: 0; flex: 1 1 220px; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }
.y11-papers-free b { color: var(--ink-soft); font-weight: 600; }
.y11-papers-free a { color: var(--accent); font-weight: 700; text-decoration: none; }
.y11-papers-free a:hover { text-decoration: underline; }
/* the lock: the one loud thing on the free hub — accent border, accent wash, a filled button */
.y11-papers-lock { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 0.9rem; align-items: center;
  margin: 1rem 0 0; padding: 1rem 1.1rem; border: 1.5px solid var(--accent); border-radius: 14px;
  background: var(--accent-wash, rgba(137, 29, 26, 0.07)); color: var(--ink); }
.y11-papers-lock-icon { color: var(--accent); display: inline-flex; }
.y11-papers-lock-copy { display: grid; gap: 0.15rem; }
.y11-papers-lock-copy b { font-family: "Fraunces", Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.y11-papers-lock-copy span { font-size: 0.88rem; line-height: 1.45; color: var(--ink-soft); }
.y11-papers-unlock { grid-column: 1 / -1; justify-self: start; min-height: 46px; }

/* the Y11 pre-flight dialog */
.y11-modal-scrim { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem;
  background: rgba(33, 7, 6, 0.42); backdrop-filter: blur(3px); animation: y11-scrim-in 0.18s ease-out both; }
.y11-modal { width: min(520px, 100%); background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong, var(--line));
  border-radius: 18px; padding: clamp(1.3rem, 4vw, 1.8rem); box-shadow: var(--shadow); animation: y11-modal-in 0.22s ease-out both; }
.y11-modal .eyebrow { color: var(--accent); margin: 0; }
.y11-modal h2 { margin: 0.5rem 0 0.6rem; font-family: "Fraunces", Georgia, serif; font-size: clamp(1.3rem, 3.6vw, 1.7rem); line-height: 1.15; }
.y11-modal-body { margin: 0; color: var(--ink-soft); line-height: 1.55; font-size: 0.98rem; }
.y11-modal-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.3rem; }
.y11-modal-actions .primary-button, .y11-modal-actions .ghost-button { min-height: 46px; }
@keyframes y11-scrim-in { from { opacity: 0; } }
@keyframes y11-modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .y11-modal-scrim, .y11-modal { animation: none; } }

/* ── results: what to learn ─────────────────────────────────────────────── */
.loop-learn { margin-top: clamp(2rem, 5vh, 3rem); }
.loop-learn-list { list-style: none; margin: 0; padding: 0; }
.loop-learn-row { border-top: 1px solid var(--line); }
.loop-learn-row:last-child { border-bottom: 1px solid var(--line); }
.loop-learn-link { display: flex; align-items: center; gap: 1rem; min-height: 56px; padding: 0.75rem 0.4rem; text-decoration: none; color: inherit;
  transition: background 0.14s ease-out; }
.loop-learn-link:hover { background: var(--accent-wash, rgba(137, 29, 26, 0.07)); }
.loop-learn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.loop-learn-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.2rem; }
.loop-learn-title { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.02rem; color: var(--ink); line-height: 1.3; }
.loop-learn-meta { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }
.loop-learn-meta .loop-q-marks { margin-left: 0; font-size: inherit; font-weight: 500; }
.loop-learn-status { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber, var(--muted)); }
.loop-learn-go { flex: 0 0 auto; color: var(--accent); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.loop-learn-link:hover .loop-learn-go { text-decoration: underline; text-underline-offset: 3px; }
.loop-wp-learn { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.55rem; min-height: 36px; padding: 0 0.1rem;
  font-size: 0.86rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.loop-wp-learn b { font-weight: 700; }
.loop-wp-learn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── upgrade: the parent intro leads; kid name + who the number is for ──── */
.upg-relation { display: flex; gap: 0; border: 1px solid var(--line-strong, var(--line)); border-radius: 10px; overflow: hidden;
  background: var(--surface); }
.upg-relation label { flex: 1; position: relative; }
.upg-relation input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.upg-relation span { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 0.92rem; font-weight: 600;
  color: var(--muted); border-right: 1px solid var(--line); transition: background 0.14s ease-out, color 0.14s ease-out; }
.upg-relation label:last-child span { border-right: none; }
.upg-relation input:checked + span { background: var(--accent); color: #fff; }
.upg-relation input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.upg-relation input:hover:not(:checked) + span { color: var(--ink); }
.upg-intro-first { grid-template-columns: 1.1fr 1fr; }
@media (max-width: 560px) { .upg-intro-first { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════════════════
   LEAGUE (2026-09-04) — a small weekly board in the score-sheet voice.
   Rank numerals in Fraunces, hairline rows, one accent for "you", pace-setters
   visibly machine (robot glyph + tag), zone lines drawn like an examiner's rule.
   ══════════════════════════════════════════════════════════════════════════ */
.lg-page { max-width: 760px; }
.lg-head { display: grid; gap: 1.2rem 2rem; align-items: start; margin-bottom: clamp(1.4rem, 4vh, 2.4rem); }
@media (min-width: 720px) { .lg-head { grid-template-columns: 1.3fr 1fr; } }
.lg-head .eyebrow { color: var(--accent); }
.lg-title { margin: 0.35rem 0 0.5rem; font-family: "Fraunces", Georgia, serif; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1; font-weight: 600; }
.lg-title sup { font-size: 0.4em; vertical-align: super; font-weight: 500; margin-left: 0.05em; }
.lg-next { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.5; }
.lg-next b { color: var(--accent); }
.lg-last { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.86rem; }
.lg-head-side { display: grid; gap: 0.8rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.lg-me { display: flex; align-items: center; gap: 0.7rem; }
.lg-me .lg-avatar { width: 40px; height: 40px; }
.lg-me-name { display: block; font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.05rem; }
.lg-rename { background: none; border: none; padding: 0.15rem 0; font: inherit; font-size: 0.78rem; color: var(--muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); min-height: 32px; }
.lg-rename:hover:not(:disabled) { color: var(--accent); text-decoration-color: currentColor; }
.lg-rename:disabled { opacity: 0.45; cursor: default; }
.lg-stats { display: flex; gap: 1.4rem; }
.lg-stat { display: grid; }
.lg-stat small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lg-stat b { font-family: "Fraunces", Georgia, serif; font-size: 1.5rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lg-days { display: flex; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.lg-day { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong, var(--line)); display: grid; place-items: center;
  font-size: 0.66rem; font-weight: 700; color: var(--muted); }
.lg-day.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

.lg-list { list-style: none; margin: 0; padding: 0; }
.lg-row { display: grid; grid-template-columns: 2.2rem 34px 1fr auto; align-items: center; gap: 0.75rem; min-height: 52px;
  padding: 0.45rem 0.5rem; border-top: 1px solid var(--line); }
.lg-row:last-of-type { border-bottom: 1px solid var(--line); }
.lg-row.is-me { background: var(--accent-wash, rgba(137, 29, 26, 0.07)); box-shadow: inset 3px 0 0 0 var(--accent); border-radius: 0 8px 8px 0; }
.lg-rank { font-family: "Fraunces", Georgia, serif; font-size: 1.25rem; font-weight: 600; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.lg-row.is-me .lg-rank { color: var(--accent); }
.lg-avatar { width: 32px; height: 32px; color: var(--ink-soft); }
.lg-avatar-bot { color: var(--muted); opacity: 0.8; }
.lg-name { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-weight: 600; font-size: 0.98rem; color: var(--ink); min-width: 0; }
.lg-row.is-bot .lg-name { font-weight: 500; color: var(--ink-soft); font-style: italic; }
.lg-tag { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line-strong, var(--line)); border-radius: 999px; padding: 0.12rem 0.45rem; font-style: normal; }
.lg-tag.is-you { color: #fff; background: var(--accent); border-color: var(--accent); }
.lg-tag.is-friend { color: var(--accent); border-color: var(--accent); }
.lg-pts { display: flex; align-items: baseline; gap: 0.25rem; font-variant-numeric: tabular-nums; }
.lg-pts b { font-family: "Fraunces", Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.lg-pts small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.lg-zone { list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 0.15rem 0.5rem; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.lg-zone::before, .lg-zone::after { content: ""; flex: 1; border-top: 1.5px dashed var(--accent); opacity: 0.6; }
.lg-disclosure { margin: 0.8rem 0 0; font-size: 0.78rem; line-height: 1.45; color: var(--muted); }
.lg-how { margin-top: 1rem; }
.lg-how summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); min-height: 40px; display: flex; align-items: center; }
.lg-how-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.25rem; font-size: 0.9rem; color: var(--ink-soft); }
.lg-how-list b { display: inline-block; min-width: 2.2rem; font-family: "Fraunces", Georgia, serif; color: var(--accent); font-size: 1.05rem; }
.lg-muted { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }

.lg-friends { margin-top: clamp(2rem, 6vh, 3rem); }
.lg-code-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin: 0.8rem 0 1rem; }
.lg-code { font-family: "Fraunces", Georgia, serif; font-size: 1.5rem; font-weight: 600; letter-spacing: 0.06em; color: var(--ink);
  padding: 0.3rem 0.7rem; border: 1.5px dashed var(--line-strong, var(--line)); border-radius: 10px; }
.lg-add-label { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.lg-add-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.lg-add-row input { flex: 1 1 180px; min-height: 46px; padding: 0.5rem 0.8rem; font: inherit; font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line-strong, var(--line)); border-radius: 10px; background: var(--surface); color: var(--ink); }
.lg-add-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lg-add .form-message { margin: 0.4rem 0 0; }
.lg-add .form-message:empty { display: none; }
.lg-pending, .lg-friendlist { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.lg-pending-row { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; min-height: 48px; padding: 0.4rem 0.2rem; border-top: 1px solid var(--line); }
.lg-pending-row .lg-name small { font-weight: 500; color: var(--muted); }
.lg-pending-row .lg-pts { margin-left: auto; }
.lg-mini { min-height: 38px; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.lg-settings { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.lg-opt { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.92rem; color: var(--ink); min-height: 44px; cursor: pointer; }
.lg-opt input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--accent); }
.lg-opt small { color: var(--muted); }

/* hub card */
.lg-card-host:empty { display: none; }
.lg-card { display: grid; gap: 0.35rem; margin: 1.5rem 0 0; padding: 0.9rem 1rem; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color 0.15s ease-out, transform 0.15s ease-out; }
.lg-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.lg-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lg-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.lg-card-tier { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lg-card-main { display: flex; align-items: baseline; gap: 0.6rem; }
.lg-card-main > b { font-family: "Fraunces", Georgia, serif; font-size: 2rem; font-weight: 600; line-height: 1; color: var(--ink); }
.lg-card-main > b sup { font-size: 0.42em; font-weight: 500; }
.lg-card-main > span { font-size: 0.86rem; color: var(--muted); }
.lg-card-main > span b { color: var(--ink-soft); }
.lg-card-foot { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .lg-card { transition: none; } .lg-card:hover { transform: none; } }

/* ══════════════════════════════════════════════════════════════════════════
   UPGRADE (2026-09-04 evening pass) — hierarchy and air. The Y11 view no longer
   fights to fit one viewport: the page scrolls, the cards breathe, the intro
   form reads as two labelled groups with one primary field.
   ══════════════════════════════════════════════════════════════════════════ */
.upg-page { max-width: 960px; }
.y11-upg { max-width: 960px; padding-bottom: 3rem; }
.y11-upg .upg-head { margin: 1rem 0 2.2rem; }
.y11-upg .upg-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); }
.upg-pricing, .y11-upg .upg-pricing.y11-pricing { gap: clamp(1.4rem, 3vw, 2.2rem); margin: 3.2rem 0 2rem; align-items: stretch; }
.y11-upg .upg-pricing.y11-pricing { grid-template-columns: 1fr 1.08fr; }
.upg-card, .y11-upg .upg-card { padding: clamp(1.6rem, 3vw, 2.1rem) clamp(1.5rem, 3vw, 2rem) clamp(1.7rem, 3vw, 2.2rem); }
.y11-upg .upg-amount { font-size: clamp(2.4rem, 5vw, 3rem); }
.y11-upg .upg-features { margin-bottom: 1.6rem; padding-top: 1rem; }
.y11-upg .upg-features li { padding: 0.36rem 0; }
.upg-flag { top: -1rem; }
/* the intro card */
.upg-parent.upg-intro, .y11-upg .upg-parent, body.y11-upg-page .upg-parent {
  grid-template-columns: minmax(240px, 0.8fr) 1.25fr; gap: 1.6rem 2.6rem;
  padding: clamp(1.7rem, 3.2vw, 2.4rem) clamp(1.5rem, 3.2vw, 2.4rem); margin-bottom: 0; }
@media (max-width: 760px) { .upg-parent.upg-intro, .y11-upg .upg-parent, body.y11-upg-page .upg-parent { grid-template-columns: 1fr; gap: 1.4rem; } }
.upg-parent-featured .eyebrow { margin: 0 0 0.5rem; }
.upg-parent.upg-intro h2, body.y11-upg-page .upg-parent h2 { font-family: "Fraunces", Georgia, serif; font-size: clamp(1.45rem, 2.8vw, 1.85rem); line-height: 1.15; margin: 0 0 0.7rem; }
.upg-parent.upg-intro .upg-parent-note, body.y11-upg-page .upg-parent-note { font-size: 0.95rem; line-height: 1.55; color: var(--ink-soft); }
.upg-parent-steps { list-style: none; margin: 1.3rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--line); display: grid; gap: 0.55rem; }
.upg-parent-steps li { display: flex; align-items: center; gap: 0.7rem; font-size: 0.9rem; color: var(--ink-soft); }
.upg-parent-steps b { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 0.9rem; color: var(--accent); border: 1.5px solid var(--accent); }
.upg-intro-fields { gap: 1.3rem; }
.upg-intro-group { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 0.85rem; }
.upg-intro-group legend { padding: 0; margin: 0 0 0.2rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.upg-intro-group + .upg-intro-group { padding-top: 1.1rem; border-top: 1px dashed var(--line-strong, var(--line)); }
.upg-field > span { font-size: 0.8rem; letter-spacing: 0.02em; text-transform: none; font-weight: 600; color: var(--ink-soft); }
.upg-field input, .upg-relation span { min-height: 50px; }
.upg-field input { font-size: 1.02rem; border-radius: 12px; }
.upg-field.is-primary input { font-size: 1.15rem; letter-spacing: 0.02em; border-color: var(--accent); background: var(--surface); }
.upg-relation { border-radius: 12px; }
.upg-relation span { font-size: 0.95rem; }
.upg-intro-actions { margin-top: 0.4rem; gap: 0.7rem 1.2rem; }
.upg-intro-actions .primary-button { min-height: 52px; padding-left: 1.6rem; padding-right: 1.4rem; font-size: 1.05rem; }
.upg-intro-trust { font-size: 0.84rem; }
/* neutralise the retired one-viewport compaction on short laptops */
@media (max-height: 840px) {
  body.y11-upg-page .upg-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin: 0.3rem 0 0.7rem; }
  body.y11-upg-page .upg-head { margin: 1rem 0 2.2rem; }
  body.y11-upg-page .upg-head .upg-lede { font-size: 1rem; line-height: 1.6; }
  body.y11-upg-page .upg-card { padding: clamp(1.6rem, 3vw, 2.1rem) clamp(1.5rem, 3vw, 2rem) clamp(1.7rem, 3vw, 2.2rem); border-radius: 18px; }
  body.y11-upg-page .upg-card-head h2 { font-size: 1.3rem; margin-bottom: 0.55rem; }
  body.y11-upg-page .upg-amount { font-size: clamp(2.4rem, 5vw, 3rem); }
  body.y11-upg-page .upg-per { font-size: 1rem; }
  body.y11-upg-page .upg-tagline { font-size: 0.95rem; margin-bottom: 1rem; }
  body.y11-upg-page .upg-features { margin-bottom: 1.6rem; padding-top: 1rem; }
  body.y11-upg-page .upg-features li { padding: 0.36rem 0; font-size: 0.98rem; }
  body.y11-upg-page .upg-cta { padding: 0.8rem 1.2rem; font-size: 1rem; }
  body.y11-upg-page .y11-billtoggle { margin-bottom: 1.1rem; }
  body.y11-upg-page .y11-billtoggle-btn { padding: 8px 20px; font-size: 0.86rem; }
  body.y11-upg-page .upg-flag { font-size: 0.72rem; }
  body.y11-upg-page .upg-footer { font-size: 0.85rem; margin: 0.4rem 0 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   THE DESK (2026-09-04 evening) — the hub as a composed dashboard. The shell
   widens for the hub; the desk is a two-column grid: lesson hero + papers on
   the left, your standing (rank, first glance) + progress + this topic on the
   right. Cards share one grammar; the hero stays the loudest thing.
   ══════════════════════════════════════════════════════════════════════════ */
.y11-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(1.15rem, 2.2vw, 1.5rem) clamp(1.2rem, 2.4vw, 1.6rem); box-shadow: var(--shadow-soft, none); }
.y11-desk { display: grid; gap: clamp(1rem, 2vw, 1.4rem); grid-template-columns: minmax(0, 1fr); }
.y11-desk > * { min-width: 0; }
.y11-desk-hero .y11-hero { margin: 0; }
.y11-desk-hero .y11-callout { margin-top: 1rem; }
/* cards that used to be margin-rule strips */
.y11-papers.y11-card { margin: 0; padding-left: clamp(1.2rem, 2.4vw, 1.6rem); border-left: 1px solid var(--line); }
.y11-papers.y11-card .y11-papers-ledger { max-width: none; }
.y11-papers.y11-card .y11-papers-sub { max-width: none; }
.y11-progress-strip.y11-card { margin: 0; padding-left: clamp(1.2rem, 2.4vw, 1.6rem); border-left: 1px solid var(--line); }
.y11-desk .y11-domains { grid-template-columns: 1fr; }
.y11-desk .y11-progress-lede { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.y11-upnext.y11-card { margin: 0; padding-left: clamp(1.2rem, 2.4vw, 1.6rem); border-left: 1px solid var(--line); }
.y11-desk .y11-board-bar { margin: 1rem 0 0; }
.y11-desk .y11-hero { box-shadow: var(--shadow); }

/* the standing card — rank at first glance */
.y11-desk-standing .lg-card-host:empty { display: none; }
.lg-card { display: grid; gap: 0.45rem; margin: 0; padding: clamp(1.1rem, 2.2vw, 1.4rem) clamp(1.2rem, 2.4vw, 1.6rem); text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-soft, none);
  transition: border-color 0.15s ease-out, transform 0.15s ease-out; }
.lg-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.lg-card.is-skeleton { min-height: 168px; }
.lg-card.is-skeleton .lg-card-main b { display: block; height: 2.6rem; width: 5rem; border-radius: 8px; background: var(--line); animation: lg-shimmer 1.2s ease-in-out infinite; }
@keyframes lg-shimmer { 50% { opacity: 0.45; } }
.lg-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.lg-card-kicker { font-family: "Fraunces", Georgia, serif; font-size: 1.02rem; font-weight: 600; color: var(--ink); }
.lg-card-main { display: flex; align-items: baseline; gap: 0.6rem 0.75rem; flex-wrap: wrap; margin-top: 0.15rem; }
.lg-card-main > b { font-family: "Fraunces", Georgia, serif; font-size: clamp(2.4rem, 3.4vw, 3rem); font-weight: 600; line-height: 1; color: var(--accent); }
.lg-card-main > b sup { font-size: 0.38em; font-weight: 500; }
.lg-card-of { font-size: 0.9rem; color: var(--muted); }
.lg-card-pts { margin-left: auto; display: grid; text-align: right; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.15; }
.lg-card-pts b { font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.lg-card-pts small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lg-card-days { display: flex; gap: 0.3rem; margin-top: 0.35rem; min-height: 24px; }
.lg-card-day { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong, var(--line)); display: grid; place-items: center; font-style: normal; }
.lg-card-day b { font-size: 0.6rem; font-weight: 700; color: var(--muted); }
.lg-card-day.is-on { background: var(--accent); border-color: var(--accent); }
.lg-card-day.is-on b { color: #fff; }
.lg-card-foot { margin-top: 0.3rem; font-size: 0.82rem; color: var(--accent); font-weight: 600; }

/* league page avatars: tinted discs, one hue per name */
.lg-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto;
  background: color-mix(in srgb, var(--lg-hue, var(--accent)) 16%, var(--surface)); color: var(--lg-hue, var(--accent)); }
.lg-avatar svg { width: 20px; height: 20px; }
.lg-me .lg-avatar { width: 44px; height: 44px; }
.lg-me .lg-avatar svg { width: 24px; height: 24px; }
.lg-hue-0 { --lg-hue: #891d1a; } .lg-hue-1 { --lg-hue: #1f5f8b; } .lg-hue-2 { --lg-hue: #2f6b3a; } .lg-hue-3 { --lg-hue: #8a5a00; }
.lg-hue-4 { --lg-hue: #5b3c8a; } .lg-hue-5 { --lg-hue: #a8542c; } .lg-hue-6 { --lg-hue: #1d6f6a; } .lg-hue-7 { --lg-hue: #7a2f5c; }
.lg-hue-8 { --lg-hue: #4d5e1f; } .lg-hue-9 { --lg-hue: #2b4a9b; } .lg-hue-10 { --lg-hue: #9b3a1f; } .lg-hue-11 { --lg-hue: #3f6d8e; }
html[data-theme="dark"] .lg-avatar { background: color-mix(in srgb, var(--lg-hue, var(--accent)) 28%, var(--surface)); color: color-mix(in srgb, var(--lg-hue, var(--accent)) 55%, #fff); }
.lg-row .lg-name { font-style: normal; font-weight: 600; color: var(--ink); }

/* ── the hub shell, FLUID (2026-09-04 late) ─────────────────────────────────
   Lesson: theme-pure pins the contents rail at a fixed 352px and caps the work
   column at 660px; the first desk build offset the desk by fixed pixels and
   centred it on wide screens, so on Raghu's viewport the rail sat on top of the
   cards. Now: the rail width is a clamp of the viewport, the desk sits in the
   space to the RIGHT of the rail (centred within that space, never behind it),
   and the desk's own columns come from a container query on its real width —
   not from the viewport. No fixed pixel offsets remain. */
.loop-lesson-only.is-hub { --rail-w: clamp(13.5rem, 22vw, 22rem); --hub-gutter: clamp(1rem, 2.4vw, 2.4rem); --desk-max: 72rem; }
/* NO container queries here: Chrome collapsed the work column (and then the
   wrapper) to its min-content once inline-size containment sat anywhere under
   theme-pure's block-mode shell. Viewport rules, in rem, do the job: the rail
   is a clamp of the viewport, so the desk always has ≥ 46rem beside it. */
.y11-desk-wrap { min-width: 0; }
@media (min-width: 1041px) {
  .loop-lesson-only.is-hub .lesson-rail { width: var(--rail-w) !important; }
  .loop-lesson-only.is-hub .loop-work {
    width: auto !important; max-width: var(--desk-max) !important; padding: 0 !important;
    margin-left: max(calc(var(--rail-w) + var(--hub-gutter)), calc((100vw - var(--desk-max) + var(--rail-w)) / 2)) !important;
    margin-right: var(--hub-gutter) !important;
  }
  .loop-lesson-only.is-hub.rail-collapsed .lesson-rail { width: 3.5rem !important; }
  .loop-lesson-only.is-hub.rail-collapsed .loop-work {
    margin-left: max(calc(3.5rem + var(--hub-gutter)), calc((100vw - var(--desk-max) + 3.5rem) / 2)) !important;
  }
}
@media (max-width: 1040px) {
  .loop-lesson-only.is-hub .loop-work { max-width: min(48rem, 100%) !important; margin: 0 auto !important; padding: 0 clamp(0.75rem, 3vw, 1rem) !important; }
}
.y11-desk-left, .y11-desk-right { display: grid; gap: clamp(1rem, 1.6vw, 1.4rem); min-width: 0; align-content: start; }
.y11-desk-upnext:empty, .y11-desk-progress:empty { display: none; }
/* two columns once the desk has room for two real cards (≈46rem of viewport
   below the fixed-rail breakpoint; above it the rail clamp guarantees it) */
@media (min-width: 46rem) {
  .y11-desk { grid-template-columns: minmax(0, 1.55fr) minmax(min(18rem, 42%), 1fr); align-items: start; }
}
.y11-papers-lock { grid-template-columns: auto 1fr; }
@media (min-width: 46rem) { .y11-papers-lock { grid-template-columns: auto 1fr auto; } .y11-papers-unlock { grid-column: auto; } }
