  /* ─── THE BALLOT — adaptive answers + commit strip ─── */
/* ══════════════════════════════════════════════════════════════════════════
   BALLOT + COMMIT STRIP — answer choices, free response, confidence overlay.
   Scoped under .bs per the broadsheet override layer (see index.html ~1826).
   ────────────────────────────────────────────────────────────────────────── */

/* ── Ballot grid: default = SHORT numeric answers (4 across, capped tile
   width); .single-col is the app's existing long-answer discriminator
   (isReading flag) and gets the stacked full-measure row treatment. Both
   feed the SAME .choice-btn / .choice-text rules below via specificity,
   not duplicate rule sets. ── */
.bs .choices-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 148px));
  gap: 12px;
  max-width: 812px;
  margin-top: 22px;
}
.bs .choices-grid.single-col {
  grid-template-columns: 1fr;
  gap: 10px;
}
/* Middle tier: too long for a display numeral, too short to deserve a
   full-measure row. Two columns, set as TEXT rather than as a figure. */
.bs .choices-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 620px;
}
.bs .choices-grid.compact .choice-text {
  text-align: left;
  font-family: var(--bs-ui);
  font-variation-settings: 'wdth' 100;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}
@media (max-width: 700px) {
  .bs .choices-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .bs .choices-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Base rule doubles as the SHORT tile's layout; single-col overrides the
   parts that differ for the long row (higher specificity via the extra
   .choices-grid.single-col ancestor class, so no !important needed). */
.bs .choice-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bs-sheet);
  border: 2px solid var(--bs-ink);
  border-radius: 0;
  color: var(--bs-ink);
  font-family: var(--bs-ui);
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: visible;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.bs .choice-btn:hover { background: var(--bs-stock-2); }
.bs .choice-btn:active { transform: translateY(1px); }
.bs .choice-btn:focus-visible { outline: 3px solid var(--bs-blue); outline-offset: 2px; }
/* The ballot is genuinely disabled twice in the answer flow — while the
   confidence strip is up, and again for the whole review — but nothing said
   so: the tiles kept cursor:pointer and still lit on hover, so a locked ballot
   invited clicks it would ignore. No opacity here (see .bs .stat::before). */
.bs .choice-btn:disabled { cursor: default; }
/* Excluding the verdict classes matters: the ballot is disabled DURING review,
   when those classes carry the marking. A bare :disabled:hover would outrank
   them (0,3,0 over 0,2,0) and wipe the correct answer's ground on hover. */
.bs .choice-btn:disabled:not(.selected):not(.correct):not(.wrong-pick):hover {
  background: transparent;
}
.bs .choice-btn:disabled:active { transform: none; }

.bs .choices-grid.single-col .choice-btn {
  align-items: flex-start;
  padding: 16px 18px;
}

@media (max-width: 560px) {
  .bs .choice-btn { min-height: 48px; }
}

/* Small square key box — mono, hairline border. Same treatment in both
   layouts; the mockup only shows it in the short tile but nothing about it
   is layout-specific. */
.bs .choice-letter {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--bs-ink);
  border-radius: 0;
  background: var(--bs-sheet);
  color: var(--bs-ink);
  font-family: var(--bs-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

/* Value text: Fraunces numeral by default (short tile); single-col swaps to
   Archivo sentence-case body copy — Fraunces 900 is unreadable at
   sentence length, per the mockup's own split. */
.bs .choice-text {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--bs-ed);
  font-variation-settings: normal;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  /* Backstop. The tier thresholds above should mean no value ever exceeds its
     tile, but a choice can still arrive longer than measured (an unstripped
     LaTeX macro, an em-dash run). Wrapping inside the box is always better
     than spilling outside it, which is what overflow:visible was doing. */
  overflow-wrap: anywhere;
}
.bs .choices-grid.single-col .choice-text {
  text-align: left;
  padding-top: 2px;
  font-family: var(--bs-ui);
  font-variation-settings: 'wdth' 100;
  font-weight: 500;
  font-size: 15.5px;
  line-height: 1.45;
  letter-spacing: normal;
  font-variant-numeric: normal;
}

/* Selection: a pen circle, not a colour wash. Border still shifts so the
   state reads even before the stroke finishes drawing. */
.bs .choice-btn.selected {
  border-color: var(--bs-blue);
  background: var(--bs-sheet);
  background: color-mix(in srgb, var(--bs-blue) 6%, var(--bs-sheet) 94%);
}
.bs .choice-btn.selected .choice-letter {
  border-color: var(--bs-blue);
  color: var(--bs-blue);
}
.bs .choice-btn .bs-circle {
  position: absolute;
  inset: -9px -7px;
  pointer-events: none;
  overflow: visible;
}
.bs .choice-btn .bs-circle ellipse {
  fill: none;
  stroke: var(--bs-blue);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  animation: bsCircleDraw .5s var(--ease-snap) forwards;
}
@keyframes bsCircleDraw { to { stroke-dashoffset: 0; } }

/* Reveal states fire in place on paper — solid border + a faint tint (no
   glow) plus a knocked-out key box carry the verdict. Animation names
   (revealLift/revealBar/revealShake) are the app's existing @keyframes;
   only the colours change here. */
.bs .choice-btn.correct {
  border-color: var(--bs-ok);
  background: var(--bs-sheet);
  background: color-mix(in srgb, var(--bs-ok) 10%, var(--bs-sheet) 90%);
  animation: revealLift .45s var(--ease-snap) both;
}
.bs .choice-btn.correct::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--bs-ok);
  transform-origin: left center;
  animation: revealBar .4s var(--ease-snap) both;
}
.bs .choice-btn.correct .choice-letter {
  background: var(--bs-ok);
  border-color: var(--bs-ok);
  color: #fff;
}
.bs .choice-btn.wrong-pick {
  border-color: var(--bs-miss);
  background: var(--bs-sheet);
  background: color-mix(in srgb, var(--bs-miss) 10%, var(--bs-sheet) 90%);
  animation: revealShake .3s ease-in-out both;
}
.bs .choice-btn.wrong-pick .choice-letter {
  background: var(--bs-miss);
  border-color: var(--bs-miss);
  color: #fff;
}
.bs .choice-btn.dimmed { opacity: .45; }

/* Answer-choice images are line art on paper, not a white slab. */
.bs .choice-img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin: 6px auto 2px;
  background: var(--bs-sheet);
  border: 1px solid var(--bs-rule);
  border-radius: 0;
  padding: 8px;
}

/* ── Free response ── */
.bs .free-response {
  position: relative;
  display: flex;
  gap: 12px;
  max-width: 812px;
}
.bs .free-response input {
  flex: 1;
  min-width: 0;
  background: var(--bs-sheet);
  border: 2px solid var(--bs-ink);
  border-radius: 0;
  padding: 16px 18px;
  font-family: var(--bs-ui);
  font-variation-settings: 'wdth' 100;
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: var(--bs-ink);
  outline: none;
  transition: border-color .12s ease, background .12s ease;
}
.bs .free-response input:focus {
  border-color: var(--bs-blue);
  background: var(--bs-sheet);
  background: color-mix(in srgb, var(--bs-blue) 4%, var(--bs-sheet) 96%);
}
@media (max-width: 560px) {
  .bs .free-response { flex-direction: column; }
}

/* ── Commit: the ONE element that keeps the hard ink offset shadow — an
   MC submit and a free-response submit are the same conceptual action on
   two different DOM paths, so both read as "the" primary action. ── */
.bs .mc-submit-row {
  position: relative;
  margin-top: 24px;
  max-width: 812px;
}
.bs .btn-primary {
  width: 100%;
  padding: 16px 0;
  background: var(--bs-blue);
  color: #fff;
  border: 2px solid var(--bs-ink);
  border-radius: 0;
  font-family: var(--bs-ed);
  font-variation-settings: normal;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--bs-ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.bs .btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--bs-ink); }
.bs .btn-primary:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--bs-ink); }
.bs .btn-primary:focus-visible { outline: 3px solid var(--bs-ink); outline-offset: 4px; }
/* Solid muted pair rather than opacity — see the note on .submit-btn:disabled.
   The letterpress shadow also goes: an un-pressable button should not look like
   it is standing off the page waiting to be pressed. */
.bs .btn-primary:disabled {
  background: var(--bs-stock-2);
  color: var(--bs-ink-2);
  cursor: default;
  transform: none;
  box-shadow: none;
}
.bs .btn-primary:disabled:hover { transform: none; box-shadow: none; }

.bs .submit-btn {
  padding: 0 26px;
  background: var(--bs-blue);
  color: #fff;
  border: 2px solid var(--bs-ink);
  border-radius: 0;
  font-family: var(--bs-ed);
  font-variation-settings: normal;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .12s ease;
}
.bs .submit-btn:hover {
  background: var(--bs-blue);
  background: color-mix(in srgb, var(--bs-blue) 82%, var(--bs-ink) 18%);
}
.bs .submit-btn:focus-visible { outline: 3px solid var(--bs-ink); outline-offset: 3px; }
/* A solid muted pair, not opacity. Opacity composites the whole button toward
   whatever is behind it — under the dark theme that was near-black, so a faded
   pale label still read. On paper the backdrop is near-white, so the label
   blended into the page at 2.60:1. This pair measures 6.96:1. */
.bs .submit-btn:disabled { background: var(--bs-stock-2); color: var(--bs-ink-2);
  box-shadow: none; cursor: default; }
.bs .submit-btn:disabled:hover { background: var(--bs-blue); }
@media (max-width: 560px) {
  .bs .submit-btn { width: 100%; padding: 14px 0; }
}

/* ── Confidence overlay: a segmented printed control, laid directly over
   .mc-submit-row / .free-response (position:absolute; inset:0) exactly as
   the app already does it — zero layout jump, JS untouched. Only its skin
   changes here. ── */
.bs .conf-strip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  background: var(--bs-sheet);
  border: 2px solid var(--bs-ink);
  animation: confIn .12s ease both;
}
.bs .conf-q {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 14px;
  border-right: 2px solid var(--bs-ink);
  font-family: var(--bs-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bs-ink-3);
  white-space: nowrap;
}
.bs .conf-chip {
  flex: 1;
  border: none;
  border-right: 2px solid var(--bs-ink);
  background: transparent;
  color: var(--bs-ink-2);
  font-family: var(--bs-ui);
  font-variation-settings: 'wdth' 82;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.bs .conf-chip:last-child { border-right: none; }
.bs .conf-chip:hover,
.bs .conf-chip:focus-visible,
.bs .conf-chip:active {
  background: var(--bs-ink);
  color: var(--bs-stock);
  outline: none;
}
.bs .conf-chip:focus-visible {
  outline: 3px solid var(--bs-blue);
  outline-offset: -3px;
}
.bs .conf-key {
  margin-left: 6px;
  font-family: var(--bs-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: inherit;
  opacity: .75;
}
@media (max-width: 560px) {
  .bs .conf-strip { flex-wrap: wrap; inset: auto 0 0 0; height: auto; min-height: 100%; }
  .bs .conf-q { flex: 1 1 100%; border-right: none; border-bottom: 2px solid var(--bs-ink);
    justify-content: center; padding: 8px 0; }
  .bs .conf-chip { min-height: 44px; font-size: 13px; }
  .bs .conf-key { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bs .choice-btn .bs-circle ellipse { animation: none; stroke-dashoffset: 0; }
  .bs .choice-btn.correct,
  .bs .choice-btn.correct::after,
  .bs .choice-btn.wrong-pick,
  .bs .conf-strip {
    animation: none;
    transition-duration: 1ms;
  }
  .bs .choice-btn,
  .bs .btn-primary,
  .bs .submit-btn {
    transition-duration: 1ms;
  }
}
