/* Samo SAT Practice — test interface styles */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../vendor/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-600-italic.woff2") format("woff2");
  font-weight: 600 700; font-style: italic; font-display: swap;
}

:root {
  --paper: #F6F8FB;
  --surface: #FFFFFF;
  --ink: #14213D;
  --ink-soft: #4A5A73;
  --line: #D6DEEA;
  --line-strong: #A9B6CA;
  --sky: #2F6FDB;
  --sky-deep: #1F51A8;
  --sky-wash: #E8F0FC;
  --sun: #E9A23B;
  --sun-deep: #B5741B;
  --good: #1E7D52;
  --good-wash: #E5F4EC;
  --bad: #B83A2B;
  --bad-wash: #FBEAE7;

  --font: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* Question content (passages, prompts, choices) is set in a serif that sits well next to KaTeX math. */
  --font-content: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow-float: 0 12px 32px rgba(20, 33, 61, 0.18), 0 2px 6px rgba(20, 33, 61, 0.12);
  --bar-h: 76px;
  --foot-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 42px; padding: 0 1.4rem;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 0.95rem;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-primary { background: var(--sky); color: #fff; }
.btn-primary:hover { background: var(--sky-deep); }
.btn-primary:disabled { background: var(--line-strong); cursor: not-allowed; }
.btn-outline { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--sky-wash); }
.btn-large { min-height: 52px; padding: 0 2rem; font-size: 1.05rem; }

.link-btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: none; border: 0; padding: 2px 0;
  font-weight: 700; font-size: 0.9rem; color: var(--ink-soft);
}
.link-btn:hover { color: var(--ink); }
.chev { width: 12px; height: 12px; stroke-width: 2; transition: transform 150ms ease; }
[aria-expanded="true"] > .chev { transform: rotate(180deg); }

.pill-btn {
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 999px;
  padding: 1px 12px; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft);
}
.pill-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.pill-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  background: none; border: 0; border-radius: var(--radius-s); color: var(--ink-soft);
}
.icon-btn:hover { background: var(--sky-wash); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Screens ---------- */
.screen { min-height: 100%; }

/* Home */
.home { display: grid; place-items: start center; padding: clamp(2rem, 8vh, 6rem) 1rem 3rem; }
.home-inner { width: 100%; max-width: 560px; }
.wordmark {
  display: flex; align-items: center; gap: 0.6rem; margin: 0 0 2.5rem;
  font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em;
}
.wordmark-mark { width: 30px; height: 30px; stroke-width: 2.2; color: var(--sky); }
.wordmark-mark path:nth-child(2) { stroke: var(--sun); }
.home-title { font-size: clamp(1.75rem, 4.5vw, 2.4rem); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -0.01em; }
.home-lede { color: var(--ink-soft); font-size: 1.08rem; line-height: 1.6; margin: 0 0 2.5rem; max-width: 52ch; }

.start-form { display: grid; gap: 0.6rem; }
.start-form > label { font-weight: 700; font-size: 0.95rem; }
.start-form input[type="text"] {
  height: 48px; padding: 0 0.9rem;
  border: 2px solid var(--line-strong); border-radius: var(--radius-m); background: var(--surface);
}
.start-form input[type="text"]:focus { border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px var(--sky-wash); }
.choice-list { display: grid; gap: 1.5rem; margin: 1.25rem 0 0.5rem; }
.choice-group { border: 0; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.choice-group legend { padding: 0; margin-bottom: 0.6rem; font-weight: 700; font-size: 0.95rem; }
.module-option {
  display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.85rem; align-items: center;
  padding: 0.9rem 1rem; border: 2px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); cursor: pointer;
}
.module-option:hover { border-color: var(--line-strong); }
.module-option:has(input:checked) { border-color: var(--sky); background: var(--sky-wash); }
.module-option input { grid-row: 1; width: 18px; height: 18px; accent-color: var(--sky); margin: 0; }
.module-option > :not(input) { grid-column: 2; }
.module-option strong { font-size: 1rem; }
.module-option span { color: var(--ink-soft); font-size: 0.9rem; }
.module-option .resume-note { color: var(--sun-deep); font-weight: 700; }
.module-option .last-note { color: var(--ink-soft); }
.inline-link { background: none; border: 0; padding: 0; font-weight: 700; color: var(--sky-deep); text-decoration: underline; text-underline-offset: 2px; }
.inline-link:hover { color: var(--ink); }
.loading { color: var(--ink-soft); margin: 0; }
.form-error { color: var(--bad); margin: 0; font-weight: 700; }
.start-form .btn-large { justify-self: start; margin-top: 0.75rem; }

/* ---------- Test layout ---------- */
.test { display: grid; grid-template-rows: var(--bar-h) 1fr var(--foot-h); height: 100vh; height: 100dvh; min-height: 0; }

.test-bar {
  position: relative; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: var(--surface);
}
.bar-left { min-width: 0; }
.module-title { margin: 0 0 2px; font-size: 1rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-center { display: grid; justify-items: center; gap: 4px; }
.timer { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; min-width: 5ch; text-align: center; }
.timer.is-hidden { color: var(--ink-soft); }
.timer.is-hidden svg { width: 24px; height: 24px; display: block; }
.timer.is-warning { color: var(--bad); }
.bar-right { display: flex; justify-content: flex-end; gap: 0.25rem; }
.tool-btn {
  display: grid; justify-items: center; gap: 2px;
  background: none; border: 0; border-radius: var(--radius-s);
  padding: 6px 10px; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft);
}
.tool-btn svg { width: 24px; height: 24px; }
.tool-btn:hover { color: var(--ink); background: var(--paper); }
.tool-btn[aria-pressed="true"] { color: var(--sky-deep); background: var(--sky-wash); }

/* The horizon: elapsed time, from morning sky to dusk */
.horizon { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--line); overflow: hidden; }
.horizon-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #A9CDF5 0%, var(--sky) 55%, #6B5BB8 82%, var(--sun) 100%);
  background-size: 100vw 100%; background-repeat: no-repeat;
  transition: width 1s linear;
}

.question-area { overflow: auto; min-height: 0; background: var(--surface); outline: none; }

.test-foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: var(--surface); border-top: 1.5px solid var(--line);
}
.student-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--radius-s);
  padding: 8px 16px; font-weight: 700; font-size: 0.95rem;
}
.nav-btn:hover { background: #22325A; }
.foot-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* ---------- Question ---------- */
.q-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
/* Two panes (passage | question) with a draggable divider */
.split { --split: 50%; display: grid; grid-template-columns: var(--split) 12px minmax(0, 1fr); height: 100%; min-height: 0; }
.split.is-resizing { user-select: none; cursor: col-resize; }
.pane { overflow: auto; min-height: 0; min-width: 0; }
.pane-left { background: var(--surface); }
.split .q-wrap { margin: 0; max-width: 680px; padding: 2rem 2rem 3rem; }
.divider { position: relative; background: var(--line); cursor: col-resize; touch-action: none; outline-offset: -3px; }
.divider:hover, .split.is-resizing .divider { background: var(--line-strong); }
.divider-grip {
  position: absolute; top: 50%; left: 50%; width: 22px; height: 44px; transform: translate(-50%, -50%);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 999px;
  background-image: radial-gradient(circle, var(--ink-soft) 1.3px, transparent 1.6px);
  background-size: 6px 8px; background-position: center; background-repeat: repeat-y;
}
.spr-directions { padding: 2rem 2rem 3rem; }

/* Reading and Writing passages */
.passage-wrap { padding: 2rem 2.25rem 3rem; max-width: 760px; margin-left: auto; }
.passage { font-size: 1.0625rem; line-height: 1.75; }
.passage p { margin: 0 0 1rem; }
.passage-heading { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.passage-heading:first-child { margin-top: 0; }
.passage-list { margin: 0 0 1rem; padding-left: 1.3rem; }
.passage-list li { margin-bottom: 0.5rem; }
.passage .q-figure, .passage .q-table-wrap { margin-top: 1.25rem; }
.blank { display: inline-block; width: 4.5em; height: 1.1em; margin: 0 0.15em; border-bottom: 1.5px solid var(--ink); vertical-align: baseline; }
.passage u, .q-prompt u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

mark.hl { color: inherit; border-radius: 2px; cursor: pointer; padding: 0.05em 0; }
mark.hl-yellow { background: #FBE39A; }
mark.hl-blue { background: #CFE2FB; }
mark.hl-pink { background: #F8D2E2; }
mark.hl-underline { background: none; text-decoration: underline; text-decoration-color: var(--sky); text-decoration-thickness: 2.5px; text-underline-offset: 4px; }
mark.hl.is-editing { box-shadow: 0 0 0 2px var(--ink); }
mark.hl:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
mark.hl-has-note::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 2px; border-radius: 50%;
  background: var(--sun-deep); vertical-align: super;
}

/* Note editor */
.note-drawer {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: var(--foot-h);
  background: var(--surface); border-top: 3px solid var(--ink); box-shadow: 0 -10px 28px rgba(20, 33, 61, 0.14);
  padding: 0.75rem 1.5rem 1rem;
}
.note-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.6rem; }
.note-title { font-size: 1rem; margin: 0; flex: none; }
.note-quote { flex: 1; min-width: 0; color: var(--ink-soft); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-body { display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem 1.25rem; align-items: start; }
.note-style-row { display: grid; gap: 0.35rem; }
.note-label { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.note-styles { display: flex; gap: 0.5rem; }
.style-swatch { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line-strong); padding: 0; position: relative; }
.swatch-yellow { background: #FBE39A; }
.swatch-blue { background: #CFE2FB; }
.swatch-pink { background: #F8D2E2; }
.swatch-underline { background: var(--surface); }
.swatch-underline::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 9px; height: 2.5px; background: var(--sky); border-radius: 2px; }
.style-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.note-text {
  width: 100%; min-height: 72px; max-height: 26vh; resize: vertical; padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); font: inherit; line-height: 1.45;
}
.note-text:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-wash); }
.note-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.q-head {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--paper); border-bottom: 2px dotted var(--line-strong);
  padding-right: 0.5rem; margin-bottom: 1.5rem;
}
.q-num {
  display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 6px;
  background: var(--ink); color: #fff; font-weight: 700;
}
.flag-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: none; border: 0; padding: 6px 4px; font-size: 0.9rem; font-weight: 700; color: var(--ink-soft);
}
.flag-btn svg { width: 20px; height: 20px; }
.flag-btn:hover { color: var(--ink); }
.flag-btn[aria-pressed="true"] { color: var(--ink); }
.flag-btn[aria-pressed="true"] svg { fill: var(--sun); stroke: var(--sun-deep); }

.elim-toggle {
  margin-left: auto;
  display: inline-grid; place-items: center; height: 30px; padding: 0 8px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; position: relative; color: var(--ink-soft);
}
.elim-toggle::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 1.5px; background: currentColor; transform: rotate(-12deg);
}
.elim-toggle:hover { border-color: var(--ink); color: var(--ink); }
.elim-toggle[aria-pressed="true"] { background: var(--sky); border-color: var(--sky); color: #fff; }

.q-prompt { font-size: 1.0625rem; line-height: 1.65; margin: 0 0 1.5rem; }
.q-prompt .katex-display { margin: 0.75rem 0 1rem; text-align: left; }
.q-prompt .katex-display > .katex { text-align: left; }
.katex { font-size: 1.08em; }

.q-figure { margin: 0 0 1.5rem; display: grid; justify-items: center; gap: 0.5rem; }
.q-figure img { display: block; max-width: 100%; height: auto; }
.q-figure figcaption { font-size: 0.9rem; color: var(--ink-soft); font-style: italic; }
.figure-missing { margin: 0; padding: 1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-s); color: var(--ink-soft); }
.q-table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.q-table { border-collapse: collapse; margin: 0 auto; font-size: 1rem; font-variant-numeric: tabular-nums; }
.q-table caption { font-weight: 700; margin-bottom: 0.5rem; }
.q-table th, .q-table td { border: 1.5px solid var(--ink); padding: 0.45rem 1.1rem; text-align: center; }
.q-table th { background: var(--paper); font-weight: 700; }

.choices { display: grid; gap: 0.8rem; margin: 0; padding: 0; list-style: none; }
.choice-row { display: flex; align-items: center; gap: 0.6rem; }
.choice {
  flex: 1; display: flex; align-items: center; gap: 0.9rem; text-align: left;
  min-height: 52px; padding: 0.55rem 1rem 0.55rem 0.6rem;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-m);
  font-size: 1.0625rem; line-height: 1.45; position: relative;
}
.choice:hover { border-color: var(--ink); }
.choice-letter {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  border: 1.5px solid var(--ink); border-radius: 50%; font-weight: 700; font-size: 0.9rem;
}
.choice[aria-checked="true"] { border: 3px solid var(--sky); padding-left: calc(0.6rem - 1.5px); background: var(--sky-wash); }
.choice[aria-checked="true"] .choice-letter { background: var(--sky); border-color: var(--sky); color: #fff; }

.choice-row.is-crossed .choice { color: var(--ink-soft); border-color: var(--line); background: var(--paper); }
.choice-row.is-crossed .choice-text,
.choice-row.is-crossed .choice-letter { opacity: 0.55; }
.choice-row.is-crossed .choice::after {
  content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 2px; background: var(--ink); opacity: 0.75;
}

.strike-btn {
  flex: none; width: 34px; height: 34px; position: relative;
  border: 1.5px solid var(--ink-soft); border-radius: 50%; background: var(--surface);
  font-size: 0.8rem; font-weight: 700; color: var(--ink-soft);
}
.strike-btn::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; height: 1.5px; background: currentColor; }
.strike-btn:hover { color: var(--ink); border-color: var(--ink); }
.strike-btn.is-undo { width: auto; border: 0; border-radius: var(--radius-s); padding: 0 6px; text-decoration: underline; font-size: 0.85rem; }
.strike-btn.is-undo::after { display: none; }
.question-area:not(.elim-mode) .strike-btn { display: none; }

/* Student-produced response */
.spr-directions h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.spr-directions ul { padding-left: 1.2rem; margin: 0 0 1.25rem; }
.spr-directions li { margin-bottom: 0.45rem; font-size: 0.95rem; line-height: 1.5; }
.spr-examples { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.spr-examples caption { text-align: left; font-weight: 700; margin-bottom: 0.4rem; }
.spr-examples th, .spr-examples td { border: 1px solid var(--line-strong); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.spr-examples th { background: var(--paper); }

.spr-field { display: grid; gap: 0.4rem; max-width: 260px; }
.spr-input {
  height: 56px; padding: 0 0.9rem; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.04em;
  border: 2px solid var(--ink-soft); border-radius: var(--radius-s); background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.spr-input:focus { border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px var(--sky-wash); }
.spr-preview { font-size: 0.95rem; color: var(--ink-soft); min-height: 2.5rem; display: flex; align-items: center; gap: 0.5rem; }
.spr-preview .katex { font-size: 1.3em; color: var(--ink); }
.spr-hint { font-size: 0.85rem; color: var(--bad); min-height: 1.2em; margin: 0; }

/* Check your work */
.review-wrap { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.5rem 3rem; text-align: center; }
.review-wrap h2 { font-size: 1.6rem; margin: 0 0 0.5rem; }
.review-wrap > p { color: var(--ink-soft); margin: 0 0 2rem; }
.review-card { border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.5rem 1.5rem; text-align: left; background: var(--surface); }
.review-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1.5px solid var(--line); }
.review-card-head h3 { margin: 0; font-size: 1rem; }

/* Navigator grid (shared by popover and review page) */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; padding: 0; margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.legend-icon svg { width: 18px; height: 18px; }
.legend-unanswered { border: 1.5px dashed var(--ink-soft); border-radius: 3px; width: 16px; height: 16px; }
.flag-icon svg { fill: var(--sun); stroke: var(--sun-deep); }
.pin-icon { color: var(--ink); }

.nav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 0.9rem 0.7rem; padding: 1.2rem 0.2rem 0.3rem; }
.nav-cell {
  position: relative; height: 42px; display: grid; place-items: center;
  border: 1.5px dashed var(--ink-soft); border-radius: var(--radius-s); background: var(--surface);
  font-weight: 700; color: var(--sky-deep);
}
.nav-cell:hover { background: var(--sky-wash); }
.nav-cell.is-answered { background: var(--sky); border: 1.5px solid var(--sky); color: #fff; }
.nav-cell.is-answered:hover { background: var(--sky-deep); }
.nav-cell .cell-flag { position: absolute; top: -8px; right: -7px; width: 16px; height: 16px; fill: var(--sun); stroke: var(--sun-deep); stroke-width: 1.6; }
.nav-cell .cell-pin { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; color: var(--ink); fill: var(--surface); }

/* ---------- Popovers ---------- */
.popover {
  position: fixed; z-index: 40; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-float);
}
.directions-pop { top: calc(var(--bar-h) + 6px); left: 1.5rem; width: min(640px, calc(100vw - 3rem)); max-height: calc(100vh - var(--bar-h) - var(--foot-h) - 2rem); display: flex; flex-direction: column; }
.directions-pop .popover-body { padding: 1.5rem 1.75rem 0.5rem; overflow: auto; }
.popover-actions { display: flex; justify-content: flex-end; padding: 1rem 1.5rem 1.25rem; }
.popover-actions.center { justify-content: center; }
.nav-pop {
  bottom: calc(var(--foot-h) + 12px); left: 50%; transform: translateX(-50%);
  width: min(520px, calc(100vw - 2rem)); padding: 1.1rem 1.4rem 0.2rem;
}
.nav-pop::after {
  content: ""; position: absolute; bottom: -9px; left: 50%; width: 16px; height: 16px; margin-left: -8px;
  background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg);
}
.nav-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 0.75rem; margin-bottom: 0.75rem; border-bottom: 1.5px solid var(--line); }
.nav-pop-head h2 { font-size: 1rem; margin: 0; }

.prose h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
.prose h3 { font-size: 1rem; margin: 1.1rem 0 0.4rem; }
.prose p, .prose li { line-height: 1.6; }
.prose p { margin: 0 0 0.8rem; }
.prose ul { padding-left: 1.2rem; margin: 0 0 0.8rem; }

/* ---------- Floating tools ---------- */
.float-panel {
  position: fixed; z-index: 30; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  box-shadow: var(--shadow-float); overflow: hidden; min-width: 280px; min-height: 240px;
}
.float-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  height: 44px; padding: 0 0.4rem 0 1rem; background: var(--ink); color: #fff;
  cursor: grab; user-select: none; touch-action: none; flex: none;
}
.float-head:active { cursor: grabbing; }
.float-title { font-weight: 700; font-size: 0.95rem; }
.float-head .icon-btn { color: #C9D4E6; }
.float-head .icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.float-head-actions { display: flex; gap: 2px; }
.calc-panel { top: calc(var(--bar-h) + 12px); left: 16px; width: 420px; height: 560px; }
.calc-panel.is-expanded { width: min(900px, calc(100vw - 32px)) !important; height: calc(100vh - var(--bar-h) - var(--foot-h) - 24px) !important; }
.calc-body { flex: 1; min-height: 0; position: relative; }
.calc-status { margin: 0; padding: 1.25rem; color: var(--ink-soft); line-height: 1.55; }
.ref-panel { top: calc(var(--bar-h) + 12px); right: 16px; width: 440px; height: 520px; }
.ref-body { flex: 1; overflow: auto; padding: 1rem 1.25rem 1.5rem; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ref-item { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.6rem 0.75rem; }
.ref-item h3 { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 0.3rem; }
.ref-item .katex { font-size: 1.05em; }
.ref-facts { font-size: 0.92rem; }
.resize-grip {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--line-strong) 50%, var(--line-strong) 58%, transparent 58%, transparent 70%, var(--line-strong) 70%, var(--line-strong) 78%, transparent 78%);
}

/* ---------- Toast & dialog ---------- */
.toast {
  position: fixed; z-index: 60; top: calc(var(--bar-h) + 14px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 0.7rem 1.2rem; border-radius: var(--radius-m);
  font-weight: 700; box-shadow: var(--shadow-float); max-width: calc(100vw - 2rem);
}
.dialog {
  border: 0; border-radius: var(--radius-m); padding: 1.5rem 1.75rem; max-width: 440px; width: calc(100vw - 2rem);
  box-shadow: var(--shadow-float); color: var(--ink);
}
.dialog::backdrop { background: rgba(20, 33, 61, 0.45); }
.dialog h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.dialog p { margin: 0 0 1.25rem; color: var(--ink-soft); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

/* ---------- Results ---------- */
.results { padding: 2.5rem 1rem 4rem; }
.results-inner { max-width: 820px; margin: 0 auto; }
.results-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.results-head h1 { margin: 0 0 0.35rem; font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; }
.results-head p { margin: 0; color: var(--ink-soft); }
.score-line { display: flex; align-items: baseline; gap: 0.5rem; }
.score-line strong { font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score-line span { color: var(--ink-soft); font-size: 1.05rem; }
.results-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 2.5rem; }

.domain-table, .answer-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.domain-table { margin-bottom: 2.5rem; }
.results h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.domain-table th, .domain-table td, .answer-table th, .answer-table td { padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--line); text-align: left; }
.domain-table th, .answer-table th { font-size: 0.85rem; color: var(--ink-soft); background: var(--paper); }
.domain-table td:last-child, .domain-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { display: block; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar-track span { display: block; height: 100%; background: var(--sky); }

.answer-row { cursor: pointer; }
.answer-row:hover td { background: var(--paper); }
.answer-row td:first-child { font-weight: 700; width: 3.5rem; }
.answer-row button { background: none; border: 0; padding: 0; font-weight: 700; color: var(--sky-deep); text-decoration: underline; }
.result-tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.result-tag.is-correct { background: var(--good-wash); color: var(--good); }
.result-tag.is-wrong { background: var(--bad-wash); color: var(--bad); }
.result-tag.is-blank { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }
.detail-row td { background: var(--paper); padding: 1.1rem 1.25rem 1.4rem; }
.detail-row .q-prompt { margin-bottom: 0.9rem; }
.detail-choices { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.35rem; }
.detail-choices li { padding: 0.35rem 0.6rem; border-radius: var(--radius-s); }
.detail-choices li.is-key { background: var(--good-wash); }
.detail-choices li.is-picked-wrong { background: var(--bad-wash); }
.detail-explain { border-left: 4px solid var(--sky); padding: 0.2rem 0 0.2rem 0.9rem; margin: 0; line-height: 1.6; }

/* ---------- Between modules ---------- */
.transition, .break { display: grid; place-items: center; padding: 3rem 1rem; min-height: 100vh; min-height: 100dvh; }
.transition-inner { width: 100%; max-width: 720px; text-align: center; }
.transition-inner h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 0.6rem; }
.transition-text { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.6; max-width: 52ch; margin: 0 auto 2.5rem; }
.transition-next { font-weight: 700; margin: 2rem 0 1rem; min-height: 1.5em; }
.transition-progress { height: 5px; max-width: 320px; margin: 0 auto; background: var(--line); border-radius: 3px; overflow: hidden; }
.transition-progress span { display: block; height: 100%; width: 0; background: var(--sky); }
#transition-btn { margin-top: 1rem; }

.step-track { list-style: none; padding: 0; margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.step { position: relative; display: grid; justify-items: center; gap: 0.6rem; padding: 0 0.25rem; font-size: 0.85rem; color: var(--ink-soft); }
.step::before { content: ""; position: absolute; top: 9px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-next::before { background: var(--sky); }
.step-dot { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.step.is-done .step-dot { background: var(--sky); border-color: var(--sky); }
.step.is-done .step-dot::after { content: ""; position: absolute; left: 6px; top: 2px; width: 4px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.is-next .step-dot { border-color: var(--sky); box-shadow: 0 0 0 4px var(--sky-wash); }
.step.is-next .step-label { color: var(--ink); font-weight: 700; }
.step.is-break .step-dot { border-style: dashed; }
.step-label { line-height: 1.3; }

/* ---------- Break ---------- */
.break-inner { width: 100%; max-width: 900px; display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 3rem; align-items: center; }
.break-clock-card { background: var(--ink); color: #fff; border-radius: var(--radius-m); padding: 2rem 1.75rem 1.75rem; text-align: center; }
.break-clock-label { margin: 0 0 0.5rem; color: #C9D4E6; font-weight: 700; font-size: 0.95rem; }
.break-clock { margin: 0 0 1.5rem; font-size: clamp(3rem, 9vw, 4.5rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.break-horizon { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.break-text h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 1rem; }
.break-text p { color: var(--ink-soft); line-height: 1.65; margin: 0 0 0.9rem; max-width: 56ch; }
.break-text .break-next { color: var(--ink); font-weight: 700; margin: 1.5rem 0 1.5rem; }

/* Results: sections and modules */
.section-scores { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: -0.75rem 0 1.5rem; }
.section-score { display: grid; gap: 0.15rem; padding: 0.8rem 1.1rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); min-width: 220px; }
.section-score-name { font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }
.section-score-value strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.results-section { margin-bottom: 3rem; }
.results-section-title { font-size: 1.35rem !important; margin: 0 0 1rem !important; padding-bottom: 0.5rem; border-bottom: 2px solid var(--ink); }
.results-module-title { font-size: 1.05rem; margin: 2rem 0 0.75rem; }
.answer-wrap, .domain-wrap { overflow-x: auto; }
.skill-cell { color: var(--ink-soft); font-size: 0.9rem; }
.detail-row .passage { font-size: 1rem; margin-bottom: 1rem; max-width: 70ch; }

/* Content typography */
.passage, .q-prompt, .choice-text, .q-table, .detail-explain, .detail-choices { font-family: var(--font-content); }
.passage, .q-prompt, .choice-text { font-size: 1.125rem; }
.q-table th { font-family: var(--font-content); font-weight: 600; }
.passage-heading { font-family: var(--font); }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  :root { --bar-h: 64px; --foot-h: 64px; }
  .test-bar, .test-foot { padding: 0 0.75rem; gap: 0.5rem; }
  .tool-btn span { display: none; }
  .module-title { font-size: 0.85rem; }
  .split { grid-template-columns: 1fr; height: auto; }
  .divider { display: none; }
  .pane { overflow: visible; }
  .pane-left { border-bottom: 4px solid var(--line); }
  .spr-directions, .passage-wrap { padding: 1.25rem 1rem; }
  .split .q-wrap, .q-wrap { padding: 1.25rem 1rem 2rem; }
  .note-drawer { padding: 0.75rem 1rem; }
  .note-body { grid-template-columns: 1fr; }
  .note-actions { flex-direction: row; justify-content: flex-end; }
  .student-name { display: none; }
  .test-foot { grid-template-columns: auto 1fr; }
  .nav-btn { justify-self: start; padding: 8px 10px; font-size: 0.85rem; }
  .btn { padding: 0 1rem; }
  .calc-panel, .ref-panel { left: 8px !important; right: 8px; width: auto !important; top: calc(var(--bar-h) + 8px) !important; height: 60vh !important; }
  .resize-grip { display: none; }
}

@media (max-width: 700px) {
  .break-inner { grid-template-columns: 1fr; gap: 2rem; }
  .step-track { grid-auto-flow: row; grid-auto-columns: auto; gap: 0.9rem; justify-content: start; text-align: left; }
  .step { grid-template-columns: auto 1fr; justify-items: start; align-items: center; }
  .step::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.break-horizon .horizon-fill { background: var(--sun); }
.routing-note { margin: -0.25rem 0 1.25rem; padding: 0.75rem 1rem; background: var(--sky-wash); border-left: 4px solid var(--sky); border-radius: 0 var(--radius-s) var(--radius-s) 0; line-height: 1.55; max-width: 72ch; }
