/*
 * CertaRounds — Mock Exams hub (#/mock) and the exam (#/mock/:id). Styles for src/screens/mock.js.
 * Semantic tokens only (docs/COMPONENTS.md §2). Every rule is scoped to this screen's own mock-*
 * classes; components are placed and composed here, never restyled.
 *
 *   hub     page header · resume card · set-up card · (≥1024 rail: your mock exams, how it works)
 *   exam    focus layout. Reading column + navigator panel: ≥1280 the split reader (720 + 420),
 *           1024–1279 720-ish + 300; below 1024 the navigator is a sheet. Sticky action bar on phones.
 */

/* =====================================================================================
   HUB
   ===================================================================================== */
.mock-card-title {
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  line-height: var(--lh-snug);
  color: var(--text-strong);
}

/* ---------- Resume (an exam in progress) ---------- */
.mock-resume { display: flex; flex-direction: column; gap: var(--sp-4); }
.mock-resume__row { display: flex; align-items: center; gap: var(--sp-4); }
.mock-resume__gem { flex: 0 0 auto; display: inline-flex; }
.mock-resume__text { flex: 1 1 auto; min-width: 0; }
.mock-resume__over {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-accent);
}
.mock-resume__title {
  margin-top: 2px;
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  color: var(--text-strong);
}
.mock-resume__meta { margin-top: 2px; font-size: var(--fs-13); color: var(--text-2); font-variant-numeric: tabular-nums; }
.mock-resume__cta { flex: 0 0 auto; }
.mock-resume__note {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-13);
  color: var(--text-2);
}
.mock-resume__note .icon { color: var(--success); flex-shrink: 0; }
.mock-resume__text .progress { margin-top: var(--sp-2); }
@media (max-width: 519px) {
  .mock-resume__row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; row-gap: var(--sp-4); }
  .mock-resume__cta { grid-column: 1 / -1; }
  .mock-resume__cta .btn { width: 100%; }
}

/* ---------- Set-up ---------- */
.mock-setup { display: flex; flex-direction: column; gap: var(--sp-5); }
.mock-setup__head { display: flex; align-items: center; gap: var(--sp-3); }
.mock-setup__gem { flex: 0 0 auto; display: inline-flex; }
.mock-setup__title {
  font-size: var(--fs-20);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
}
.mock-setup__sub { margin-top: 2px; font-size: var(--fs-15); color: var(--text-2); }

.mock-setup__fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
@media (min-width: 1200px) {
  .mock-setup__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
}
.mock-field { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.mock-field__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.mock-field__label { font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-strong); }
.mock-field__hint { font-size: var(--fs-13); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Three facts about the exam you're about to start */
.mock-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.mock-fact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon value" "icon label";
  align-items: center;
  column-gap: var(--sp-2);
  padding: var(--sp-2);
  min-width: 0;
}
.mock-fact__icon {
  grid-area: icon;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.mock-fact__value {
  grid-area: value;
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}
.mock-fact__label { grid-area: label; font-size: var(--fs-12); color: var(--text-2); line-height: 1.3; }
@media (max-width: 479px) {
  .mock-facts { padding: var(--sp-2); gap: 0; }
  .mock-fact { grid-template-columns: minmax(0, 1fr); grid-template-areas: "icon" "value" "label"; justify-items: center; text-align: center; row-gap: 4px; padding: var(--sp-2) 2px; }
  .mock-fact__icon { display: none; }
  .mock-fact__value { font-size: var(--fs-15); }
}

/* The specialty mix of this exact round */
.mock-mix { display: flex; flex-direction: column; gap: var(--sp-2); }
.mock-mix__label { font-size: var(--fs-13); color: var(--text-2); }
.mock-mix__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.mock-setup__foot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--divider);
}
.mock-setup__note {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  font-size: var(--fs-13);
  line-height: 1.45;
  color: var(--text-3);
}
.mock-setup__note .icon { flex-shrink: 0; margin-top: 1px; }
@media (min-width: 768px) {
  .mock-setup__foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .mock-setup__note { max-width: 44ch; }
  .mock-setup__foot .btn { flex: 0 0 auto; }
}

/* ---------- Your mock exams ---------- */
.mock-history { display: flex; flex-direction: column; gap: var(--sp-3); }
.mock-history__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.mock-history__count { font-size: var(--fs-13); color: var(--text-3); }
.mock-history__list { margin: 0 calc(-1 * var(--sp-2)); }
.mock-history__row .list-row__title { font-weight: var(--fw-semibold); }
.mock-history__row .list-row__sub { font-variant-numeric: tabular-nums; }
.mock-history__empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1);
  padding: var(--sp-1) 0 0;          /* plain inside the one card — no card in a card (R2) */
}
.mock-history__empty-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  margin-bottom: var(--sp-2);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.mock-history__empty-title { font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-strong); }
.mock-history__empty-text { font-size: var(--fs-13); line-height: 1.5; color: var(--text-2); }

/* ---------- How it works ---------- */
.mock-how { display: flex; flex-direction: column; gap: var(--sp-4); }
.mock-how__list { display: flex; flex-direction: column; gap: var(--sp-4); }
.mock-how__item { display: flex; align-items: flex-start; gap: var(--sp-3); }
.mock-how__icon {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.mock-how__title { font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-strong); line-height: 1.35; }
.mock-how__text { margin-top: 2px; font-size: var(--fs-13); line-height: 1.5; color: var(--text-2); }

/* =====================================================================================
   EXAM
   ===================================================================================== */
/* ---------- Top bar: overline + "Question 12 / 100" · stopwatch pill · pause ---------- */
.mock-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.mock-title__over {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-accent);
}
.mock-title:focus { outline: none; }
.mock-title__line { white-space: nowrap; }
@media (max-width: 399px) {
  /* "12 / 100" on the narrowest phones; the word stays for screen readers */
  .mock-title__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.mock-topright { display: flex; align-items: center; gap: var(--sp-1); }
/* The icon sheet's stopwatch pill (outline stopwatch + 01:28 on lavender) */
.mock-clock {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid transparent;
  white-space: nowrap;
}
.mock-clock .timer { font-size: var(--fs-15); }
.mock-clock--warn { background: var(--warning-bg); border-color: var(--warning-border); }
.mock-clock--over { background: var(--danger-bg); border-color: var(--danger-border); }
@media (max-width: 767px) {
  .mock-clock { height: 34px; padding: 0 10px 0 8px; }
}

/* ---------- Frame ---------- */
.mock-exam { align-items: start; }
.mock-main { display: flex; flex-direction: column; min-width: 0; }
/* 1024-1279: the navigator is a narrower side panel (from 1280 the split reader in layout.css takes over) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .mock-exam.reader--split {
    max-width: none;
    grid-template-columns: minmax(0, var(--reading-max)) 300px;
    gap: var(--sp-6);
  }
  .mock-exam.reader--split .reader__panel {
    position: sticky;
    top: calc(var(--focus-head) + var(--sp-5));
    max-height: calc(100vh - var(--focus-head) - var(--sp-5) * 2);
    max-height: calc(100dvh - var(--focus-head) - var(--sp-5) * 2);
    overflow: auto;
  }
}

/* ---------- Toolbar: flag + navigator ---------- */
.mock-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-1) 0 var(--sp-4);
}
.mock-toolbar__spacer { flex: 1 1 auto; }
.mock-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.mock-flag .icon { color: var(--text-3); }
.mock-flag:hover { background: var(--surface-hover); border-color: var(--border-hover); color: var(--text); }
.mock-flag:active { background: var(--surface-pressed); }
.mock-flag:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.mock-flag.is-on { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.mock-flag.is-on .icon { color: var(--warning); }
/* 44px hit area on touch without a taller pill */
@media (pointer: coarse), (max-width: 767px) { .mock-flag { position: relative; } .mock-flag::after { content: ""; position: absolute; inset: -4px 0; } }

/* ---------- Stem, options, confidence ---------- */
.mock-stem {
  max-width: var(--measure);
  margin: 0 0 var(--sp-5);
  font-size: var(--fs-stem);
  line-height: var(--lh-stem);
  color: var(--text);
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.mock-options { margin-bottom: var(--sp-5); }
.mock-loading__options { display: flex; flex-direction: column; gap: var(--sp-3); }
.mock-confidence { margin-bottom: var(--sp-2); }
.mock-saved {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin-top: var(--sp-2);
  font-size: var(--fs-13);
  color: var(--text-3);
}
.mock-saved.is-saved { color: var(--text-2); }
.mock-saved .icon { color: var(--success); flex-shrink: 0; }

/* Every question answered */
.mock-alldone {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-strong);
  font-size: var(--fs-13);
  line-height: 1.45;
}
.mock-alldone > .icon { color: var(--success); flex-shrink: 0; }
.mock-alldone p { flex: 1 1 auto; min-width: 0; }
.mock-alldone .btn { flex: 0 0 auto; }

/* ---------- Action bar: keys + Previous + Next ---------- */
.mock-actions { align-items: center; }
.mock-keys { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
@media (min-width: 768px) {
  .mock-actions { margin-top: var(--sp-3); }
  .mock-actions__spacer { flex: 1 1 auto; }
}

/* ---------- Navigator (side panel from 1024, a sheet below) ---------- */
.mock-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.mock-panel__title {
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  color: var(--text-strong);
}
.mock-panel__foot { padding-top: var(--sp-4); border-top: 1px solid var(--divider); }

.mock-nav { display: flex; flex-direction: column; gap: var(--sp-4); }
.mock-nav__body { display: flex; flex-direction: column; gap: var(--sp-3); }
.mock-nav__summary { display: flex; align-items: center; gap: var(--sp-3); }
.mock-nav__sumtitle {
  font-size: var(--fs-20);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.mock-nav__sumof { font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--text-2); letter-spacing: 0; }
.mock-nav__sumsub { margin-top: 2px; font-size: var(--fs-13); color: var(--text-2); }
.mock-nav__none {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-13);
  color: var(--text-2);
  text-align: center;
}

/* Legend: drawn exactly like the cells — answered = solid violet, unanswered = outline,
   flagged = flag badge, current = thick ring. Fill vs outline, badge and ring: never colour alone. */
.mock-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-4); }
.mock-legend__item {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-12);
  color: var(--text-2);
}
.mock-legend__item strong { color: var(--text-strong); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.mock-legend__sw {
  position: relative;
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin: 3px;
  border-radius: 5px;
  border: 1.5px solid var(--border-control);
  background: var(--surface);
}
.mock-legend__sw--answered { background: var(--primary); border-color: var(--primary); }
.mock-legend__sw--current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-strong); }
.mock-legend__sw .mock-cell__flag { top: -6px; right: -6px; width: 13px; height: 13px; }

/* The grid of numbered cells */
.mock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  padding: 6px;                                   /* room for the current ring and the flag badge */
  margin: -6px;
}
.mock-nav--sheet .mock-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
/* Side panel: rows of ten (1-10, 11-20 ...) from 1280; eight in the narrower 1024-1279 panel */
.mock-nav--panel .mock-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.mock-nav--panel .mock-cell { min-height: 0; border-radius: 8px; font-size: var(--fs-12); }
@media (max-width: 1279px) { .mock-nav--panel .mock-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.mock-cell {
  position: relative;
  display: grid; place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1.5px solid var(--border-control);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.mock-nav--sheet .mock-cell { aspect-ratio: auto; height: 48px; min-height: 48px; }
/* Blocks of 25 (sheet, long exams) */
.mock-secs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.mock-cell:hover { border-color: var(--border-hover); background: var(--surface-hover); color: var(--text); }
.mock-cell:active { transform: scale(.96); }
.mock-cell:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.mock-cell.is-answered { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.mock-cell.is-answered:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-fg); }
.mock-cell.is-current { font-weight: var(--fw-bold); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--text-strong); }
.mock-cell.is-current:not(.is-answered) { color: var(--text-strong); }
.mock-cell.is-current:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--text-strong), 0 0 0 7px var(--focus); }
/* Flag badge: small, on the corner, the numeral nudged away so it stays readable at 27 px */
.mock-cell__flag {
  position: absolute;
  top: -4px; right: -4px;
  display: grid; place-items: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}
.mock-cell__flag .icon { width: 9px; height: 9px; }
.mock-nav--sheet .mock-cell__flag { top: -5px; right: -5px; width: 18px; height: 18px; }
.mock-nav--sheet .mock-cell__flag .icon { width: 11px; height: 11px; }
@media (prefers-reduced-motion: reduce) { .mock-cell:active { transform: none; } }

/* ---------- Paused, welcome back, time is up ---------- */
.mock-paused { display: flex; justify-content: center; padding: var(--sp-2) 0 var(--sp-6); }
.mock-paused__card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--sp-5) var(--sp-5);
}
.mock-paused__ring { margin-bottom: var(--sp-3); }
.mock-paused__over {
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-accent);
}
.mock-paused__title {
  font-size: var(--fs-24);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
}
.mock-paused__body { max-width: 38ch; font-size: var(--fs-15); line-height: 1.5; color: var(--text-2); }
.mock-paused__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  margin: var(--sp-3) 0 var(--sp-2);
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.mock-paused__stats li { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.mock-paused__stats strong {
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.mock-paused__stats span { font-size: var(--fs-12); color: var(--text-2); }
.mock-paused__actions { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; margin-top: var(--sp-3); }
@media (min-width: 1024px) { .mock-paused { padding-top: var(--sp-6); } }

/* ---------- Submit confirmation (modal body) ---------- */
.mock-confirm { display: flex; flex-direction: column; gap: var(--sp-4); text-align: left; }
.mock-confirm__stats {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.mock-confirm__stat { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-15); color: var(--text); }
.mock-confirm__stat .icon { flex-shrink: 0; color: var(--text-3); }
.mock-confirm__stat strong { font-weight: var(--fw-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.mock-confirm__stat--warn { color: var(--warning); }
.mock-confirm__stat--warn .icon, .mock-confirm__stat--warn strong { color: var(--warning); }
.mock-confirm__note { font-size: var(--fs-13); line-height: 1.5; color: var(--text-2); }

/* ---------- Loading / error states ---------- */
.mock-state { padding: var(--sp-6) 0; }

/* ---------- Hub on desktop: "How it works" as a 2 x 2 grid under the set-up ---------- */
@media (min-width: 1024px) {
  .mock-hub .mock-how__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-6); }
}
.mock-hub__header { margin-bottom: 0; }

/* 1024-1279: the exam uses the whole page box (reading column + 300 px navigator), so its top bar
   and progress bar span the same box — back button over the stem, clock over the panel (R1 P2).
   From 1280 the shared split width (TopBar wide) already lines up. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .shell[data-screen="mock"][data-mode="focus"] .topbar.topbar--wide { max-width: none; padding: 0 var(--gutter); }
  .shell[data-screen="mock"][data-mode="focus"] .topbar-progress--wide { max-width: none; margin: 0 var(--gutter); }
}
.mock-history__row .list-row__sub { display: flex; flex-direction: column; }
.mock-tok { white-space: nowrap; }
.mock-history__sub { margin-top: calc(-1 * var(--sp-2)); font-size: var(--fs-13); color: var(--text-2); }

/* =====================================================================================
   F2 (R2 gauntlet)
   ===================================================================================== */
/* Phones: equal-width sides so the title is centred on the SCREEN, not in the space the clock leaves */
@media (max-width: 767px) {
  .mock-topleft, .mock-topright { width: 118px; display: flex; align-items: center; }
  .mock-topright { justify-content: flex-end; }
}
/* Untimed exams count up: the pill says "used" and drops the countdown's lavender urgency */
.mock-clock--up { background: var(--surface-2); border-color: var(--border); }
.mock-clock__note { margin-left: 4px; font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--text-2); }
@media (max-width: 767px) { .mock-clock--up .timer .icon { color: var(--text-2); } }

/* Tablet + desktop: Previous / Next stay in reach — a sticky tray aligned to the reading column,
   a hairline on top and a soft fade above it so content slides under instead of being sliced (R3).
   The tray follows the content and only sticks when the question is taller than the screen (R4). */
@media (min-width: 768px) {
  .mock-actions {
    position: sticky;
    bottom: 0;
    z-index: var(--z-sticky);
    margin-top: auto;
    padding: var(--sp-3) 0 calc(var(--sp-3) + var(--safe-bottom));
    background: var(--bg);
    border-top: 1px solid var(--divider);
    box-shadow: none;
  }
  .mock-actions::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    bottom: 100%;
    height: 24px;
    margin-bottom: 1px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
  }
  .mock-main > :nth-last-child(2) { margin-bottom: var(--sp-5); }     /* room above the tray's fade */
  html:has(.mock-actions) { scroll-padding-bottom: 96px; }
}

/* "Finished early? Review and submit" (phones / tablets, before the last question) */
.mock-finish { margin-top: var(--sp-3); font-size: var(--fs-13); color: var(--text-2); }
.mock-finish__link {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0; background: none;
  font: inherit; font-weight: var(--fw-semibold);
  color: var(--link);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.mock-finish__link:hover { color: var(--link-hover); }
.mock-finish__link:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

/* Side panel: the header, counts and filter stay, the GRID scrolls, and Submit is a sticky footer —
   the terminal action is visible at 1024×768, 1180×820 and 1280×800 (R2 P1). */
@media (min-width: 1024px) {
  .mock-exam.reader--split .mock-panel {
    overflow: hidden;
    padding-bottom: 0;
    max-height: calc(100vh - var(--focus-head) - var(--sp-5) * 2);
    max-height: calc(100dvh - var(--focus-head) - var(--sp-5) * 2);
  }
  .mock-panel .mock-nav { flex: 1 1 auto; min-height: 0; }
  .mock-panel .mock-nav__body { flex: 1 1 auto; min-height: 0; }
  .mock-panel .mock-grid { overflow: hidden; min-height: 0; flex: 0 1 auto; overscroll-behavior: contain; }
  .mock-panel .mock-grid.is-scroll { overflow-y: auto; }      /* only when it really overflows (R3) */
  .mock-panel .mock-nav__body > .mock-grid { max-height: none; }
  .mock-panel__foot {
    flex: 0 0 auto;
    margin: 0 calc(-1 * var(--sp-5));
    padding: var(--sp-3) var(--sp-5) var(--sp-4);
    background: var(--surface);
  }
}
/* Narrow panel (< 1280): blocks of 25 in rows of five — cells ≥ 36 px, no scrolling for 100 questions */
.mock-nav--panel.mock-nav--blocks .mock-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mock-nav--panel.mock-nav--blocks .mock-cell { aspect-ratio: auto; height: 40px; min-height: 40px; font-size: var(--fs-13); }

/* Flag badge sits on the cell corner, outside the numeral's box (numerals stay centred) */
.mock-cell__flag { top: -6px; right: -6px; }

/* Confidence labels keep one line at 360 (one vocabulary at every width) */
.mock-confidence .confidence__opt { white-space: nowrap; }

/* Phones: Start sits right under the summary, the specialty mix after it (R2: CTA in the first screen) */
@media (max-width: 767px) {
  .mock-setup__foot { order: 4; flex-direction: column-reverse; padding-top: 0; border-top: 0; gap: var(--sp-3); }
  .mock-mix { order: 5; padding-top: var(--sp-4); border-top: 1px solid var(--divider); }
  .mock-setup__head { order: 1; } .mock-setup__fields { order: 2; } .mock-facts { order: 3; }
}

/* =====================================================================================
   F3 (R3 gauntlet)
   ===================================================================================== */
/* Toolbar pills never wrap their label; "Flag" alone at ≤ 380 px (the button's name stays "Flag for review") */
.mock-flag, .mock-toolbar .btn { white-space: nowrap; }
.mock-flag__short { display: none; }
@media (max-width: 380px) {
  .mock-flag__full { display: none; }
  .mock-flag__short { display: inline; }
  .mock-toolbar { gap: 6px; }
}
/* Phones: the untimed clock keeps its "used" note so it never reads as a countdown */
@media (max-width: 767px) {
  .mock-clock { padding: 0 9px 0 7px; }
  .mock-clock .timer { font-size: var(--fs-13); gap: 4px; }
  .mock-clock__note { margin-left: 3px; font-size: 11px; }
}
/* The keyboard legend only where there is a keyboard-and-mouse setup (not an iPad in portrait) */
@media (hover: none), (pointer: coarse) { .mock-keys { display: none !important; } }
/* 1024–1279: the exam (reading column + 300 px navigator) is centred, and its top bar spans the same box */
@media (min-width: 1024px) and (max-width: 1279px) {
  .mock-exam.reader--split { justify-content: center; margin-left: auto; margin-right: auto; max-width: calc(var(--reading-max) + 300px + var(--sp-6)); }
  .shell[data-screen="mock"][data-mode="focus"] .topbar.topbar--wide { max-width: calc(var(--reading-max) + 300px + var(--sp-6) + 2 * var(--gutter)); margin: 0 auto; }
  .shell[data-screen="mock"][data-mode="focus"] .topbar-progress--wide { max-width: calc(var(--reading-max) + 300px + var(--sp-6)); margin: 0 auto; }
}
/* "+ 12 more specialties" / "Show fewer": a quiet text disclosure, not a chip */
.mock-mix__more {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0; background: none;
  font: inherit; font-size: var(--fs-13); font-weight: var(--fw-semibold);
  color: var(--link);
  cursor: pointer;
}
.mock-mix__more:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
.mock-mix__more:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
.mock-mix__chips { align-items: center; }

/* F4 (R4) ---------------------------------------------------------------------------- */
/* Pause: a quiet ghost pill, labelled at every width */
.mock-toolbar [data-key="pause"], .mock-topright [data-key="pause"] { color: var(--text-2); }
.mock-topright .btn { white-space: nowrap; }
/* The submit sheet's ticking time keeps a steady width */
.mock-live-clock { font-variant-numeric: tabular-nums; }
