/* GH-300 Practice Exam — mobile first.
   Many students practise on a phone, so every layout starts at 360px and
   widens at breakpoints, never the other way round. */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-raised: #1c2128;
  --border: #30363d;
  --border-strong: #444c56;

  --text: #e6edf3;
  --text-dim: #9198a1;
  --text-faint: #6e7681;

  --accent: #2f81f7;
  --accent-hover: #4c94f8;
  --accent-soft: rgba(47, 129, 247, 0.12);

  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, 0.12);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.12);
  --flag: #db6d28;
  --pass: #3fb950;
  --pass-soft: rgba(63, 185, 80, 0.12);

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #d1d9e0;
    --border-strong: #b7bec7;

    --text: #1f2328;
    --text-dim: #59636e;
    --text-faint: #818b98;

    --accent: #0969da;
    --accent-hover: #0860ca;
    --accent-soft: rgba(9, 105, 218, 0.08);

    --warn: #9a6700;
    --warn-soft: rgba(154, 103, 0, 0.1);
    --danger: #cf222e;
    --danger-soft: rgba(207, 34, 46, 0.08);
    --flag: #bc4c00;
    --pass: #1a7f37;
    --pass-soft: rgba(26, 127, 55, 0.08);

    --shadow: 0 1px 3px rgba(31, 35, 40, 0.12);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
}
.screen.is-active {
  display: flex;
}

/* ------------------------------ header ------------------------------ */

.site-header {
  padding: 8px 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.trainer-line {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.trainer-line strong {
  color: var(--text);
}

.chip {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-dim);
  vertical-align: 1px;
}

.section-title {
  margin: 4px 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ------------------------------ banners ------------------------------ */

/* A `display` rule beats the HTML `hidden` attribute, so anything using
   [hidden] to toggle must restore it explicitly. Applied globally: several
   banners and panels here are shown/hidden that way. */
[hidden] {
  display: none !important;
}

.banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.banner-warn {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--text);
}

@media (min-width: 560px) {
  .banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ------------------------------ tier cards ------------------------------ */

/* Six papers, stacked as three tier groups of two. */
.tier-grid {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.tier-group-heading {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.tier-group .tier-blurb {
  margin: 0 0 10px;
}

/* Paper 1 and Paper 2 side by side from tablet up, stacked on a phone. */
.paper-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .paper-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Full title from the JSON. */
.paper-title {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--text-dim);
}

/* A paper with a saved, unfinished attempt. */
.tier-card.is-resumable {
  border-color: var(--accent);
}
.card-tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tier-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.tier-card:hover {
  border-color: var(--accent);
}
.tier-card:active {
  transform: scale(0.995);
}

.tier-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.tier-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  text-transform: capitalize;
}

.tier-level {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.tier-level[data-tier='simple'] {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.14);
}
.tier-level[data-tier='medium'] {
  color: var(--warn);
  background: var(--warn-soft);
}
.tier-level[data-tier='complex'] {
  color: var(--danger);
  background: var(--danger-soft);
}

.tier-blurb {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-dim);
  flex: 1;
}

.tier-stats {
  display: flex;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.tier-stat {
  display: flex;
  flex-direction: column;
}
.tier-stat-value {
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.tier-stat-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tier-cta {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.loading {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 20px 0;
}

.exam-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text-dim);
}
.exam-note strong {
  color: var(--text);
}

/* ------------------------------ exam bar ------------------------------ */

.exam-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  margin: 0 0 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.exam-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.exam-progress {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.exam-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.timer {
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Under 5 minutes, then under 1 minute. */
.timer.is-low {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}
.timer.is-critical {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer.is-critical {
    animation: none;
  }
  .tier-card {
    transition: none;
  }
}

.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ------------------------------ question ------------------------------ */

.question-card {
  flex: 1;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

/* Long domain labels ("Prompt Engineering and Context Crafting") wrap to
   two lines on a phone. Let the pill shrink and the flag button hold its
   width, so the two never collide. */
.question-meta .pill {
  min-width: 0;
}
.question-meta .btn-flag {
  flex: 0 0 auto;
}

.pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
}

.question-text {
  margin: 0 0 18px;
  font-size: 1.05rem;
  font-weight: 550;
  line-height: 1.5;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.option:hover {
  border-color: var(--border-strong);
}

.option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Visually hidden but focusable, so keyboard and screen readers work. */
.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  margin-top: 1px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}

.option.is-selected .option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.option-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ------------------------------ buttons ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  min-height: 44px; /* comfortable touch target */
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--text-faint);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 7px 12px;
  min-height: 36px;
  font-size: 0.82rem;
}

.btn-flag {
  padding: 6px 12px;
  min-height: 36px;
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-dim);
  font-size: 0.8rem;
}
.btn-flag:hover {
  color: var(--flag);
  border-color: var(--flag);
}
.btn-flag[aria-pressed='true'] {
  color: var(--flag);
  border-color: var(--flag);
  background: rgba(219, 109, 40, 0.1);
}

.btn-link {
  margin-top: 14px;
  padding: 4px 0;
  min-height: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover {
  color: var(--text);
}

/* ------------------------------ exam nav ------------------------------ */

.exam-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.exam-nav .btn {
  flex: 0 1 auto;
  min-width: 108px;
}

/* On a narrow phone the three-up row (Previous / Review all / Next) runs
   past the edge. Let the two nav buttons give up their min-width before
   anything clips. */
@media (max-width: 430px) {
  .exam-nav .btn {
    min-width: 0;
  }
  .exam-nav .btn-secondary,
  .exam-nav .btn-primary {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.answered-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ review ------------------------------ */

.review-tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.tally {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tally-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.tally-label {
  font-size: 0.74rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Unanswered and flagged are only coloured when non-zero --- a screen of
   loud warning colours reading "0" trains students to ignore them. */
.tally-unanswered.is-active {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.tally-unanswered.is-active .tally-value {
  color: var(--danger);
}

.tally-flagged.is-active {
  border-color: var(--flag);
  background: rgba(219, 109, 40, 0.1);
}
.tally-flagged.is-active .tally-value {
  color: var(--flag);
}

.review-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn-filter {
  background: var(--surface);
  color: var(--text-dim);
  border-color: var(--border-strong);
}
.btn-filter:hover {
  color: var(--text);
}
.btn-filter.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.review-body {
  margin-top: 14px;
}

/* auto-fill keeps the cells a consistent size instead of stretching them
   across the row when a filter leaves only a few visible. */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.review-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.review-cell:hover {
  border-color: var(--text-faint);
  transform: translateY(-1px);
}
.review-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.review-cell.is-answered {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.review-cell.is-unanswered {
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--text-faint);
}

/* Flag is an overlay dot, not a background: a question can be both
   flagged and answered, and both states must stay readable at once. */
.review-cell.is-flagged::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--flag);
}

.review-cell.is-current {
  box-shadow: inset 0 0 0 2px var(--text-dim);
}

.review-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  font-size: 0.76rem;
  color: var(--text-dim);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}
.swatch-answered {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.swatch-unanswered {
  border-style: dashed;
}
.swatch-flagged {
  background: var(--flag);
  border-color: var(--flag);
  border-radius: 50%;
}

/* "Review all" sits between prev/next; it is a button but reads as the
   progress readout it replaced. */
.btn-review {
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
  margin-top: 0;
  min-width: 0;
  text-decoration: none;
}
.btn-review:hover .review-hint {
  color: var(--accent);
}
.review-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------ results ------------------------------ */

.verdict {
  margin-top: 18px;
  padding: 24px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.verdict.is-pass {
  border-color: var(--pass);
  background: var(--pass-soft);
}
.verdict.is-fail {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.verdict-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}
.score-value {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.is-pass .score-value {
  color: var(--pass);
}
.is-fail .score-value {
  color: var(--danger);
}
.score-max {
  font-size: 1rem;
  color: var(--text-dim);
  font-weight: 600;
}

.verdict-label {
  margin: 10px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.is-pass .verdict-label {
  color: var(--pass);
}
.is-fail .verdict-label {
  color: var(--danger);
}

.verdict-detail {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* Score bar with the 700 pass mark drawn on it, so the gap to passing is
   visible rather than something the student has to calculate. */
.score-bar {
  position: relative;
  height: 10px;
  margin-top: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: visible;
}
.score-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--text-faint);
  transition: width 0.5s ease-out;
}
.is-pass .score-fill {
  background: var(--pass);
}
.is-fail .score-fill {
  background: var(--danger);
}
.score-threshold {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 70%; /* 700 / 1000 --- kept in sync by app.js */
  width: 2px;
  background: var(--text);
  opacity: 0.55;
}
.score-threshold-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
}

.result-tally {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}
@media (max-width: 430px) {
  .result-tally {
    grid-template-columns: repeat(2, 1fr);
  }
}
.result-tally .tally-value {
  font-size: 1.25rem;
}

.section-note {
  margin: 2px 0 12px;
  font-size: 0.84rem;
  color: var(--text-dim);
}

/* --- domain breakdown --- */

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

.domain-row {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.domain-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.domain-name {
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 0;
}
.domain-fraction {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.domain-track {
  height: 7px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.domain-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease-out;
}
/* Banded against the same 70% bar the exam is scored on, so a domain
   reads the same way as the overall verdict. */
.domain-fill.is-strong {
  background: var(--pass);
}
.domain-fill.is-mid {
  background: var(--warn);
}
.domain-fill.is-weak {
  background: var(--danger);
}

.domain-hint {
  margin: 7px 0 0;
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* --- history --- */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
}
.history-row.is-latest {
  border-color: var(--accent);
}
.history-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 52px;
}
.history-score.is-pass {
  color: var(--pass);
}
.history-score.is-fail {
  color: var(--danger);
}
.history-tier {
  text-transform: capitalize;
  color: var(--text-dim);
}
.history-when {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 0.78rem;
  text-align: right;
}
.history-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.86rem;
}

/* Score change vs. the previous attempt at the same tier. */
.history-trend {
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: right;
}
.history-trend.is-up {
  color: var(--pass);
}
.history-trend.is-down {
  color: var(--text-dim);
}

/* Home-screen history block. */
.home-history {
  margin-top: 32px;
}
.home-history .history-list {
  margin-bottom: 12px;
}
.btn-small {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.results-actions .btn {
  flex: 1 1 auto;
}

/* --------------------------- answer review --------------------------- */

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.answer-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
}
.answer-card.is-correct {
  border-left-color: var(--pass);
}
.answer-card.is-wrong {
  border-left-color: var(--danger);
}
.answer-card.is-skipped {
  border-left-color: var(--text-faint);
}

.answer-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.answer-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.answer-verdict {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.answer-verdict.is-correct {
  background: var(--pass-soft);
  color: var(--pass);
}
.answer-verdict.is-wrong {
  background: var(--danger-soft);
  color: var(--danger);
}
.answer-verdict.is-skipped {
  background: var(--surface-raised);
  color: var(--text-dim);
}

.answer-question {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.4;
}
/* The correct answer is always marked, including when the student picked
   it and when they picked nothing --- studying needs the right answer
   visible in every case. */
.answer-option.is-correct {
  border-color: var(--pass);
  background: var(--pass-soft);
}
.answer-option.is-chosen-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.answer-mark {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.82rem;
}
.answer-option.is-correct .answer-mark {
  color: var(--pass);
}
.answer-option.is-chosen-wrong .answer-mark {
  color: var(--danger);
}
.answer-tag {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

.answer-explanation {
  margin: 12px 0 0;
  padding: 11px 13px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.answer-explanation strong {
  color: var(--text);
}

/* ------------------------------ error ------------------------------ */

.error-box {
  margin: auto 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--danger);
  border-radius: var(--radius-lg);
}
.error-box h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: var(--danger);
}
.error-detail {
  margin: 0 0 18px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
  overflow-x: auto;
}

/* ------------------------------ footer ------------------------------ */

.site-footer {
  margin-top: auto;
  padding-top: 28px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.site-footer p {
  margin: 3px 0;
}
.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--accent);
}

.site-footer-slim {
  padding-top: 20px;
  font-size: 0.76rem;
}
