:root {
  --paper: #f0e9d7;
  --paper-dark: #e5dec6;
  --ink: #15130e;
  --ink-soft: #3a352a;
  --highway: #f5c518;
  --red: #c02c29;
  --green: #1f6b42;
  --caution: #b87900;
  color-scheme: light dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: ui-serif, serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(0, 0, 0, 0.025) 0%, transparent 60%),
    radial-gradient(ellipse 60% 70% at 95% 100%, rgba(0, 0, 0, 0.035) 0%, transparent 55%);
}

/* ========== HEADER ========== */
.header-band {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 0;
  position: relative;
}

.header-band::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--highway) 0,
    var(--highway) 14px,
    var(--ink) 14px,
    var(--ink) 28px
  );
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--highway);
  margin: 0 10px 2px;
  vertical-align: middle;
}

.form-code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  opacity: 0.65;
  text-transform: uppercase;
}

.form-code #buildVersion {
  font-variant-numeric: tabular-nums;
}

/* ========== CONTAINER ========== */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 32px 120px;
}

/* ========== HOME SCREEN ========== */
.hero-stamp {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 48px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-title {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(56px, 10vw, 128px);
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 56px;
}

.hero-title em {
  font-style: normal;
  background: var(--highway);
  color: #15130e; /* always dark on yellow */
  padding: 0 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.screen-section {
  margin-bottom: 36px;
}

.section-heading {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.1;
}

.mode-grid {
  display: grid;
  gap: 14px;
}

.mode-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 24px 28px;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.2s,
    color 0.2s;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  position: relative;
}

.mode-count {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 44px;
  line-height: 1;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  min-width: 84px;
  text-align: center;
  transition: all 0.2s;
  font-variant-numeric: tabular-nums;
}

.mode-name {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 4px;
  line-height: 1.1;
}

.mode-desc {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
  transition:
    color 0.2s,
    opacity 0.2s;
}

.mode-arrow {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 32px;
  transition: transform 0.2s;
  line-height: 1;
}

.mode-card:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--highway);
}

.mode-card:hover .mode-count {
  background: var(--highway);
  color: var(--ink);
}
.mode-card:hover .mode-arrow {
  transform: translateX(4px);
}
.mode-card:hover .mode-desc {
  color: var(--paper);
  opacity: 0.82;
}

.mode-card.active {
  background: var(--highway);
  border-color: var(--ink);
}

/* CTA variant: no count, full-width text + arrow. Used for the
   Study Guide entry that opens the explore screen rather than
   starting a quiz. */
.mode-card.mode-card-cta {
  grid-template-columns: 1fr auto;
}

/* ========== SECTION PICKER ========== */
.section-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.section-chip {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: all 0.15s;
}

.section-chip:hover {
  background: var(--highway);
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.section-chip-num {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  opacity: 0.6;
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.section-chip-name {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.15;
  margin-bottom: 6px;
}

.section-chip-status {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(21, 19, 14, 0.18);
  color: var(--ink-soft);
}

.section-chip-strong {
  border-color: var(--green);
  border-width: 2px;
  padding: 13px 15px;
}
.section-chip-strong .section-chip-status {
  color: var(--green);
}

.section-chip-practicing .section-chip-status {
  color: var(--ink);
}

.section-chip-building .section-chip-status,
.section-chip-not-started .section-chip-status {
  color: var(--ink-soft);
  opacity: 0.75;
}

.handbook-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--ink);
  background: var(--paper);
  text-decoration: none;
  color: inherit;
  transition:
    background 0.12s,
    transform 0.12s,
    box-shadow 0.12s;
}
.handbook-link:hover {
  background: var(--paper-dark);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.handbook-link:focus-visible {
  outline: 2px solid var(--highway);
  outline-offset: 3px;
}

.handbook-link-label {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.handbook-link-url {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  word-break: break-all;
}

.source-note {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-style: italic;
  padding-top: 28px;
  border-top: 1px solid rgba(21, 19, 14, 0.2);
  line-height: 1.55;
  max-width: 65ch;
}

.source-note strong {
  font-style: normal;
  color: var(--ink);
}

.home-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(21, 19, 14, 0.15);
}

.verify-link {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 8px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s;
}
.verify-link:hover {
  color: var(--ink);
}
.verify-link:focus-visible {
  outline: 2px solid var(--highway);
  outline-offset: 3px;
}

/* ========== FLAG UI ========== */
.flag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 0;
  margin-top: 16px;
  border-top: 1px dashed rgba(21, 19, 14, 0.15);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.flag-label {
  color: var(--ink-soft);
}

.flag-btn {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid rgba(21, 19, 14, 0.25);
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.flag-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.flag-btn.active[data-status="verified"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper);
}
.flag-btn.active[data-status="wrong-answer"] {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}
.flag-btn.active[data-status="wrong-reference"] {
  background: var(--caution);
  border-color: var(--caution);
  color: var(--paper);
}
.flag-btn.active[data-status="other"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.flag-version-note {
  font-size: 10px;
  opacity: 0.7;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

/* ========== BOOKMARK UI ========== */
.bookmark-btn {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid rgba(21, 19, 14, 0.25);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.bookmark-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.bookmark-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ========== QUIZ SCREEN ========== */
.quiz-screen,
.results-screen,
.verify-screen,
.explore-screen {
  display: none;
}
.quiz-screen.active,
.results-screen.active,
.verify-screen.active,
.explore-screen.active {
  display: block;
}

.progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-bottom: 12px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}

.progress-fill-bg {
  height: 4px;
  background: var(--paper-dark);
  position: relative;
  margin-bottom: 48px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.progress-fill {
  height: 100%;
  background: var(--ink);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.question-meta {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.question-meta .pill {
  background: var(--ink);
  color: var(--paper);
  padding: 4px 10px;
  letter-spacing: 0.15em;
}

.question-text {
  font-family: ui-serif, serif;
  font-size: clamp(22px, 2.6vw, 27px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  margin-bottom: 36px;
  max-width: 32em;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.answer-btn {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 16px 22px;
  cursor: pointer;
  font-family: ui-serif, serif;
  font-size: 17px;
  line-height: 1.45;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 18px;
  align-items: center;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  position: relative;
}

.answer-letter {
  background: var(--ink);
  color: var(--paper);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 19px;
  text-transform: uppercase;
  border-radius: 50%;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}

.answer-status {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.25s;
  font-weight: 700;
}

.answer-btn.selected {
  background: var(--highway);
  border-color: var(--ink);
  color: var(--ink);
}
.answer-btn.selected .answer-letter {
  background: var(--ink);
  color: var(--highway);
}

.answer-btn.correct {
  background: var(--green);
  color: var(--paper);
  border-color: var(--green);
}
.answer-btn.correct .answer-letter {
  background: var(--paper);
  color: var(--green);
}
.answer-btn.correct .answer-status {
  opacity: 1;
}

.answer-btn.incorrect {
  background: var(--red);
  color: var(--paper);
  border-color: var(--red);
}
.answer-btn.incorrect .answer-letter {
  background: var(--paper);
  color: var(--red);
}
.answer-btn.incorrect .answer-status {
  opacity: 1;
}

.answer-btn:disabled {
  cursor: default;
}

.answer-btn:hover:not(:disabled):not(.selected):not(.correct):not(.incorrect) {
  background: var(--ink);
  color: var(--paper);
}
.answer-btn:hover:not(:disabled):not(.selected):not(.correct):not(.incorrect) .answer-letter {
  background: var(--highway);
  color: var(--ink);
}

/* "Returned from skip" pill */
.returned-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--highway);
  color: #15130e; /* always dark — sits on yellow in both modes */
  padding: 4px 10px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-transform: uppercase;
}
.returned-pill::before {
  content: "\21BA";
  font-size: 13px;
  font-weight: 900;
}

/* Right side of progress bar — groups mode label with the returned pill when present */
.progress-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Grouped action buttons */
.action-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.feedback {
  display: none;
  padding: 18px 24px;
  background: var(--paper-dark);
  border-left: 4px solid var(--highway);
  margin-bottom: 24px;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feedback.show {
  display: block;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-label {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.ref-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.ref-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ref-col-section {
  flex: 1 1 60%;
}

.ref-col-page {
  flex: 0 0 auto;
}

.ref-num {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}

.ref-title {
  font-family: system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 15px 28px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.15s;
}

.btn:hover {
  background: var(--highway);
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  background: var(--paper);
}

.btn.primary {
  background: var(--ink);
  color: var(--paper);
}
.btn.primary:hover:not(:disabled) {
  background: var(--highway);
  color: var(--ink);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  padding: 15px 16px;
}
.btn.ghost:hover {
  background: var(--paper-dark);
  transform: none;
}

/* ========== RESULTS SCREEN ========== */
.score-block {
  text-align: center;
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 48px;
  position: relative;
}

.score-label {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.score-pct {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(120px, 22vw, 220px);
  line-height: 0.85;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.score-pct.pass {
  color: var(--green);
}
.score-pct.caution {
  color: var(--caution);
}
.score-pct.fail {
  color: var(--red);
}

.score-stamp {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 8px 22px;
  border: 3px solid currentColor;
  margin-top: 18px;
  transform: rotate(-3deg);
}

.score-stamp.pass {
  color: var(--green);
}
.score-stamp.caution {
  color: var(--caution);
}
.score-stamp.fail {
  color: var(--red);
}

.caution-note {
  margin: 22px auto 0;
  max-width: 42ch;
  font-family: ui-serif, serif;
  font-size: 15px;
  font-style: italic;
  color: var(--caution);
  line-height: 1.55;
  padding: 0 16px;
}

.score-detail {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-top: 16px;
}

.missed-label {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.missed-hint {
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 24px;
}

.missed-item {
  padding: 22px 0;
  border-top: 1px solid rgba(21, 19, 14, 0.2);
}

.missed-q {
  font-family: ui-serif, serif;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

.missed-answer {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  line-height: 1.45;
}

.missed-answer .letter {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: 11px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
}

.missed-answer.wrong .letter {
  background: var(--red);
  color: var(--paper);
}
.missed-answer.right .letter {
  background: var(--green);
  color: var(--paper);
}
.missed-answer strong {
  color: var(--ink);
  font-weight: 500;
  font-style: italic;
}

.missed-ref {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 10px;
}

.perfect-msg {
  text-align: center;
  font-family: ui-serif, serif;
  font-size: 19px;
  font-style: italic;
  padding: 32px 0 8px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 48px;
  flex-wrap: wrap;
}

/* ========== VERIFY SCREEN ========== */
.verify-backrow {
  padding-top: 16px;
  margin-bottom: 16px;
}

.verify-title-block {
  margin-bottom: 32px;
}

.verify-kicker {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.verify-title {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.verify-count {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 12px;
}

.verify-empty {
  padding: 48px 0;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
}

.verify-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 60px;
}

.verify-card {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.verify-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.verify-card-id {
  color: var(--ink);
  font-weight: 700;
}

.verify-card-q {
  font-family: ui-serif, serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}

.verify-card-topic {
  font-family: ui-serif, serif;
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
}

.verify-card-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verify-card-choice {
  font-family: ui-serif, serif;
  font-size: 15px;
  color: var(--ink-soft);
  padding: 6px 12px 6px 16px;
  border-left: 2px solid rgba(21, 19, 14, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.verify-card-choice.correct {
  border-left-color: var(--green);
  background: var(--paper-dark);
  color: var(--ink);
  font-weight: 600;
}

.verify-card-choice-tag {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
}

.verify-footer {
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid rgba(21, 19, 14, 0.15);
  margin-bottom: 60px;
  display: flex;
  justify-content: flex-start;
}

/* ========== STUDY AND EXPLORE SCREEN ========== */
.explore-backrow {
  padding-top: 16px;
  margin-bottom: 16px;
}

.explore-title-block {
  margin-bottom: 32px;
}

.explore-kicker {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.explore-title {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.explore-empty {
  padding: 48px 0;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
}

.explore-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.explore-row {
  background: var(--paper);
  border: 1px solid rgba(21, 19, 14, 0.25);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.explore-row-q {
  font-family: ui-serif, serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 500;
}

.explore-row-a {
  font-family: ui-serif, serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  padding: 6px 12px;
  border-left: 3px solid var(--green);
  background: var(--paper-dark);
}

.explore-row-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.explore-row-meta {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.explore-bank {
  font-family: ui-serif, serif;
  font-size: 15px;
  color: var(--ink);
}

.explore-coverage-note {
  font-family: ui-serif, serif;
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .container {
    padding: 40px 20px 80px;
  }
  .mode-card {
    grid-template-columns: auto 1fr;
    gap: 16px;
    padding: 20px;
  }
  .mode-arrow {
    display: none;
  }
  .mode-count {
    font-size: 36px;
    min-width: 68px;
    padding: 8px 10px;
  }
  .mode-name {
    font-size: 20px;
  }
  .answer-btn {
    padding: 14px 16px;
    font-size: 15.5px;
    grid-template-columns: 32px 1fr;
    gap: 14px;
  }
  .answer-letter {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .answer-status {
    display: none;
  }
  .header-inner {
    padding: 0 20px;
  }
  .progress-bar {
    font-size: 10px;
    gap: 10px;
  }
  .hero-stamp {
    font-size: 10px;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
  .btn {
    font-size: 15px;
    padding: 13px 22px;
  }
  .section-picker {
    padding: 16px;
  }

  /* Review rows — tighten padding on mobile */
  .review-row {
    padding: 14px 14px;
  }
  .row-q {
    font-size: 15px;
  }
  .filter-group-wide {
    grid-column: span 1;
  }

  /* Collapse the two-column metadata to a single stack on narrow viewports */
  .row-meta {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .row-badges {
    justify-content: flex-start;
  }
}

/* ============================================================
   DARK MODE
   Placed last so all overrides win against earlier same-specificity rules.
   Strategy:
   1. Swap the neutral vars (--paper, --ink, etc.) so body-level elements auto-flip.
   2. Brighten accent vars (--green/--red/--caution) for legibility on dark bg.
   3. Pin colors on elements that should NOT swap: the header identity,
      highway-yellow surfaces (which always need dark text), and correct/incorrect
      states (which always need cream text on saturated bg).
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1714; /* body bg — very dark warm brown */
    --paper-dark: #252017; /* raised panels (feedback, picker, progress track) */
    --ink: #f0e9d7; /* body text — warm cream */
    --ink-soft: #b8ad95; /* secondary text — muted cream */
    --red: #e86864; /* brighter red for contrast on dark bg */
    --green: #4ba875; /* brighter green */
    --caution: #e5a638; /* brighter amber */
    /* --highway unchanged — #f5c518 pops against both paper and dark paper */
  }

  /* Soften the subtle body gradient so it doesn't lift toward light */
  body {
    background-image:
      radial-gradient(ellipse 80% 60% at 10% 0%, rgba(255, 255, 255, 0.028) 0%, transparent 60%),
      radial-gradient(ellipse 60% 70% at 95% 100%, rgba(255, 255, 255, 0.035) 0%, transparent 55%);
  }

  /* Header: always dark + cream; hazard stripe keeps identity in both modes */
  .header-band {
    background: #0a0806;
    color: #f0e9d7;
  }
  .header-band::after {
    background: repeating-linear-gradient(-45deg, #f5c518 0, #f5c518 14px, #0a0806 14px, #0a0806 28px);
  }

  /* Yellow-highlighted hero word: text must be dark */
  .hero-title em {
    color: #15130e;
  }

  /* Selected answer (yellow fill): text and letter always dark */
  .answer-btn.selected {
    color: #15130e;
  }
  .answer-btn.selected .answer-letter {
    background: #15130e;
    color: #f5c518;
  }

  /* Hover on unconfirmed answer: yellow letter disc keeps dark letter */
  .answer-btn:hover:not(:disabled):not(.selected):not(.correct):not(.incorrect) .answer-letter {
    background: #f5c518;
    color: #15130e;
  }

  /* Correct / incorrect reveals: saturated bg keeps cream text & letter disc */
  .answer-btn.correct,
  .answer-btn.incorrect {
    color: #f0e9d7;
  }
  .answer-btn.correct .answer-letter {
    background: #f0e9d7;
    color: var(--green);
  }
  .answer-btn.incorrect .answer-letter {
    background: #f0e9d7;
    color: var(--red);
  }

  /* Primary and ghost buttons hovering into yellow: pin dark text */
  .btn:hover:not(:disabled),
  .btn.primary:hover:not(:disabled) {
    color: #15130e;
  }

  /* Yellow-filled interactive surfaces — active mode card, hover chip, returned pill */
  .mode-card.active {
    color: #15130e;
  }
  .section-chip:hover {
    color: #15130e;
  }
  .returned-pill {
    color: #15130e;
  }

  /* Feedback panel: left border stays highway yellow; label text uses ink-soft (already handles dark) */
}
