/* ============================================================================
   Test screen: sticky bar and progress, the two-column body, question cards,
   navigation, and the answer-sheet panel.
   ========================================================================== */

/* ------------------------------------------------------------- Test bar --- */

.test-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r) var(--r) 0 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: var(--header-h);
  z-index: 15;
}
.test-bar-left, .test-bar-center, .test-bar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.test-bar-left { font-weight: 560; }
.test-bar-center {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

.section-badge {
  font-size: .6875rem;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .2rem .5rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
}
.answered-count { font-variant-numeric: tabular-nums; }

.clock {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  padding: .15rem .5rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.clock.is-warning { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.clock.is-critical { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }

/* Thin position indicator welded under the test bar. */
.progress-track {
  height: 3px;
  background: var(--surface-3);
  border-inline: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 200ms var(--ease);
}

.instructions {
  margin: var(--sp-4) 0 var(--sp-5);
  padding-left: var(--sp-3);
  border-left: 2px solid var(--border-strong);
  color: var(--text-muted);
  font-size: .9rem;
}

/* ------------------------------------------------------------ Test body --- */

.test-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: start;
}
#screen-test.no-support .test-body { grid-template-columns: minmax(0, 1fr); }
#screen-test.no-support .col-questions { max-width: 48rem; margin: 0 auto; }

/* The source material stays put while you answer, so it scrolls on its own.
   Without a cue that costs nothing, a long passage simply looks truncated —
   hence the fade, which app.js hides once you reach the bottom. */
.col-support {
  position: sticky;
  top: calc(var(--sticky-stack) + var(--sp-3));
  max-height: calc(100vh - var(--sticky-stack) - var(--sp-6));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
/* No `position: relative` here: it would override the sticky above and let the
   column scroll away — exactly on the long passages sticky exists for. The cue
   sticks to the bottom of the scroll container on its own. */
.col-support.is-scrollable::after {
  content: "more below ↓";
  position: sticky;
  bottom: 0;
  display: block;
  padding: 2.5rem 0 var(--sp-2);
  margin-top: -2.5rem;
  text-align: center;
  font-size: .7rem;
  font-weight: 620;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: linear-gradient(to top, var(--bg) 40%, transparent);
  pointer-events: none;
  transition: opacity var(--fast) var(--ease);
}
.col-support.is-at-bottom::after { opacity: 0; }
.support { display: grid; gap: var(--sp-4); padding-bottom: var(--sp-2); }

.support-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-5);
}
.support-kind {
  font-family: var(--font-mono);
  font-size: .625rem;
  font-weight: 560;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

.support-photo img { width: 100%; border-radius: var(--r-sm); display: block; }
.support-photo figcaption {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: var(--sp-2);
}
.support-photo-text p { font-family: var(--font-read); font-size: 1.02rem; }
.support-photo-text p:last-child { margin-bottom: 0; }

/* A grid keeps wrapped lines aligned under the text rather than under the
   speaker label. */
.support-transcript .line {
  display: grid;
  grid-template-columns: 2.1rem 1fr;
  margin-bottom: var(--sp-3);
}
.support-transcript .line.no-speaker { grid-template-columns: 1fr; }
.support-transcript .line:last-child { margin-bottom: 0; }
.speaker {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 680;
  line-height: 1.9;
  color: var(--accent);
}
.line-text { font-family: var(--font-read); font-size: 1.02rem; }

.support-passage { font-family: var(--font-read); font-size: 1.02rem; line-height: 1.6; }
.support-passage p:last-child { margin-bottom: 0; }
/* "Questions 147-148 refer to the following notice." This is the examiner
   talking, not the document, so it is set apart from the serif below it. */
.passage-label {
  font-family: var(--font-mono);
  font-size: .6875rem;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: .02em;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--rule);
}
.support-note { font-size: .8125rem; color: var(--text-muted); margin: 0; }

.blank {
  font: inherit;
  font-family: var(--font-mono);
  font-size: .82em;
  font-weight: 660;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: .05em .35em;
  margin: 0 .1em;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.blank:hover { background: var(--accent); color: var(--accent-text); }

/* ------------------------------------------------------------ Questions --- */

.questions { display: grid; gap: var(--sp-4); }
.question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-5);
  scroll-margin-top: calc(var(--sticky-stack) + var(--sp-4));
}
.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
/* A number you are tracking, so: monospace, tabular, and nothing around it.
   The box it used to sit in made it read as a control. */
.question-number {
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  letter-spacing: -.01em;
}
.flag {
  font: inherit;
  font-size: .78rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: .15rem .6rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
.flag:hover { color: var(--text); border-color: var(--border-strong); }
.flag.is-on {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-soft);
}
/* The keyboard target. A screen can hold five questions, so it has to be
   obvious which one A–D will answer. */
.question.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}
.question.is-answered .question-number { color: var(--accent); }
.answered-mark {
  color: var(--ok);
  font-size: .8rem;
  font-weight: 700;
  margin-right: auto;
  margin-left: calc(var(--sp-2) * -1 + var(--sp-3));
}

.question-text { margin-bottom: var(--sp-4); font-size: 1.0125rem; }

.choices { display: grid; gap: 2px; }
/* Flat rows, not boxes. Four bordered rectangles per question turned every
   card into a stack of controls; the border is spent on the selected one only,
   which is the single thing worth pointing at. The transparent border keeps
   the row from shifting when it becomes selected. */
.choice {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--sp-3);
  padding: .45rem .6rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.choice:hover { background: var(--surface-2); }
.choice.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* The lettered badge is the control. A native radio beside it says the same
   thing twice, so the input stays for semantics and keyboard focus but is
   taken out of the picture. */
.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.choice:has(input:focus-visible) { box-shadow: var(--ring); }
.choice-letter {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .6875rem;
  font-weight: 620;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.choice.is-selected .choice-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.choice-text { line-height: 1.45; }
.choice input:disabled { cursor: not-allowed; }
.choice:has(input:disabled) { cursor: default; opacity: .8; }

/* ----------------------------------------------------------- Navigation --- */

.test-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.test-nav-mid {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
}
.nav-hint { color: var(--text-muted); font-size: .85rem; text-align: center; }

/* Every question on this screen is answered — a nudge, never an auto-jump. */
.primary-button.is-ready { box-shadow: var(--shadow-sm), var(--ring); }

.shortcuts {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
  justify-content: center;
  margin: var(--sp-4) 0 0;
  font-size: .78rem;
  color: var(--text-faint);
}
.shortcuts span { opacity: .5; margin: 0 var(--sp-1); }
kbd {
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1;
  padding: .2em .4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-muted);
}

/* --------------------------------------------------------- Answer sheet --- */

.grid-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #0a0e14 40%, transparent);
  z-index: 29;
}

.grid-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(26rem, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4) var(--sp-5);
  overflow-y: auto;
  z-index: 30;
}
.grid-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: .78rem;
  color: var(--text-muted);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.dot {
  display: inline-block;
  width: .7rem;
  height: .7rem;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  margin-right: var(--sp-1);
  vertical-align: -1px;
}
.dot.is-answered { background: var(--accent-soft); border-color: var(--accent-border); }
.dot.is-flagged { background: var(--warn-soft); border-color: var(--warn); }
.dot.is-current { background: var(--accent); border-color: var(--accent); }

.grid { display: grid; gap: var(--sp-5); }
.grid-part-title {
  font-size: .6875rem;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.grid-cells { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.grid-cell {
  font: inherit;
  font-family: var(--font-mono);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  width: 2.4rem;
  padding: .3rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-faint);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.grid-cell:hover { border-color: var(--text-faint); color: var(--text); }
.grid-cell.is-answered {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 620;
}
.grid-cell.is-flagged { box-shadow: inset 0 -3px 0 var(--warn); }
.grid-cell.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 660;
}
