/* ============================================================
   Component 3 — Developing Fitness | Revision Site
   styles.css — mobile-first, zero-dependency
   ============================================================ */

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --navy:       #0B2545;
  --green-dark: #3E6B58;
  --yellow:     #F4D35E;
  --cream:      #FAF7F0;
  --red:        #B23A48;
  --white:      #FFFFFF;
  --grey-light: #F0EDE8;
  --grey-mid:   #C8C3BC;
  --grey-text:  #5A5550;

  --font-body: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", serif;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 2px 8px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.07);

  --transition: 0.18s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--navy);
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.25;
  color: var(--navy);
}

h1 { font-size: clamp(1.5rem, 5vw, 2.25rem); }
h2 { font-size: clamp(1.2rem, 4vw, 1.6rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { max-width: 70ch; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  flex: 1;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.btn-primary:hover { background: #0f2f5e; border-color: #0f2f5e; }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

.btn-success {
  background: var(--green-dark);
  color: var(--white);
  border-color: var(--green-dark);
}
.btn-success:hover { background: #2e5040; }

.btn-danger {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}
.btn-danger:hover { background: #8e2d39; }

.btn-sm {
  font-size: .8125rem;
  padding: .4rem .85rem;
}

/* ── Site header (home) ─────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 2rem 0 1.75rem;
  border-bottom: 4px solid var(--yellow);
}

.site-header .container { display: flex; flex-direction: column; gap: .5rem; }

.site-label {
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  max-width: none;
}

.site-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  color: var(--white);
  line-height: 1.15;
  letter-spacing: -.01em;
}

.countdown {
  display: inline-flex;
  align-items: center;
  background: var(--yellow);
  color: var(--navy);
  padding: .35rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 500;
  margin-top: .25rem;
  width: fit-content;
}

.countdown strong { font-weight: 700; }

/* ── Intro text (home) ──────────────────────────────────────── */
.intro-text {
  font-size: 1.05rem;
  color: var(--grey-text);
  margin-bottom: 2rem;
  max-width: 60ch;
}

/* ── Topic grid (home) ──────────────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

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

/* ── Topic card ─────────────────────────────────────────────── */
.topic-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 8px solid var(--topic-colour, var(--navy));
  text-decoration: none;
  color: var(--navy);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.topic-card:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.topic-card--special {
  grid-column: 1 / -1;
  border-left-width: 6px;
  background: var(--cream);
}

.topic-letter-badge {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: .1rem;
}

.topic-card-body { flex: 1; min-width: 0; }

.topic-card-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .3rem;
  line-height: 1.3;
}

.topic-card-blurb {
  font-size: .875rem;
  color: var(--grey-text);
  line-height: 1.5;
  margin-bottom: .5rem;
  max-width: none;
}

.topic-card-meta { display: flex; align-items: center; gap: .5rem; }

.topic-sub-count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--grey-text);
  background: var(--grey-light);
  padding: .15rem .5rem;
  border-radius: 20px;
}

/* ── Home actions ───────────────────────────────────────────── */
.home-actions { margin-top: 1rem; }

/* ── Site footer ────────────────────────────────────────────── */
.site-footer {
  background: var(--cream);
  border-top: 1px solid var(--grey-mid);
  padding: 1rem 0;
  margin-top: auto;
}

.site-footer p {
  font-size: .8125rem;
  color: var(--grey-text);
  max-width: none;
}

/* ── Topic header (topic.html) ──────────────────────────────── */
.topic-header {
  background: var(--navy);
  color: var(--white);
  padding: 1.25rem 0 1rem;
  border-bottom: 4px solid var(--topic-colour, var(--navy));
  position: sticky;
  top: 0;
  z-index: 100;
}

.topic-header .container {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.back-link {
  font-size: .8125rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  transition: color var(--transition);
  width: fit-content;
}
.back-link:hover { color: var(--white); }

.topic-header-content {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.topic-letter {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,.3);
}

.topic-title {
  font-family: var(--font-head);
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: var(--white);
  line-height: 1.2;
}

/* ── Mode navigation tabs ───────────────────────────────────── */
.mode-nav {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.15);
  position: sticky;
  top: 0; /* stacks below topic-header via z-index */
  z-index: 99;
}

/* When topic-header is present, mode-nav sticks below it */
.page-topic .topic-header { position: sticky; top: 0; z-index: 100; }
.page-topic .mode-nav { position: sticky; top: var(--header-h, 80px); z-index: 99; }

.mode-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mode-tab {
  flex-shrink: 0;
  padding: .75rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.6);
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition),
              background var(--transition);
  white-space: nowrap;
}
.mode-tab:hover { color: rgba(255,255,255,.9); }
.mode-tab.active {
  color: var(--white);
  border-bottom-color: var(--yellow);
  background: rgba(255,255,255,.06);
}
.mode-tab:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
}

/* ── Mode panels ────────────────────────────────────────────── */
.mode-panel { padding-top: 1.5rem; }
.mode-panel.hidden { display: none; }

/* ── Revise mode — sub-topic sections ───────────────────────── */
.subtopic-section {
  margin-bottom: 1.5rem;
  border: 1px solid var(--grey-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.subtopic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .875rem 1.25rem;
  background: var(--cream);
  border: none;
  border-bottom: 1px solid var(--grey-light);
  cursor: pointer;
  text-align: left;
  gap: .75rem;
  transition: background var(--transition);
}
.subtopic-header:hover { background: #f0ece3; }
.subtopic-header:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: -3px;
}

.subtopic-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.subtopic-chevron {
  font-size: 1.3rem;
  color: var(--grey-text);
  line-height: 1;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.subtopic-chevron.rotated { transform: rotate(180deg); }

.subtopic-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--white);
}
.subtopic-body.collapsed { display: none; }

/* ── Content blocks ─────────────────────────────────────────── */
.block-prose {
  font-size: .9375rem;
  line-height: 1.7;
  color: var(--navy);
  max-width: 70ch;
}

/* Definition box */
.block-definition {
  background: var(--cream);
  border-left: 5px solid var(--navy);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .875rem 1rem;
}
.block-definition dl { margin: 0; }
.def-term {
  font-family: var(--font-head);
  font-size: .9375rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .25rem;
}
.def-body {
  font-size: .9375rem;
  line-height: 1.65;
  color: #2c3e2d;
  margin-left: 0;
  max-width: 65ch;
}

/* List block */
.block-list { }
.block-list-heading {
  font-weight: 700;
  font-size: .9375rem;
  margin-bottom: .4rem;
  color: var(--navy);
}
.block-list ul {
  list-style: disc;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.block-list ul li { font-size: .9375rem; line-height: 1.6; }

/* Table block */
.block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.block-table table, .compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  line-height: 1.5;
}
.block-table th, .compare-table th {
  background: var(--navy);
  color: var(--white);
  padding: .6rem .875rem;
  text-align: left;
  font-family: var(--font-head);
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
}
.block-table td, .compare-table td {
  padding: .575rem .875rem;
  border-bottom: 1px solid var(--grey-light);
  vertical-align: top;
  color: var(--navy);
}
.block-table tr:nth-child(even) td,
.compare-table tr:nth-child(even) td {
  background: var(--cream);
}
.block-table tr:last-child td,
.compare-table tr:last-child td { border-bottom: none; }
.block-table table caption {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grey-text);
  padding-bottom: .4rem;
  text-align: left;
}

/* Tip callout */
.block-tip {
  background: var(--yellow);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.tip-label {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5a4800;
}
.block-tip p {
  font-size: .9rem;
  line-height: 1.6;
  color: #3a3000;
  max-width: 65ch;
}

/* Compare block */
.block-compare { overflow-x: auto; }

/* ── Questions mode — card wrapper ──────────────────────────── */
.questions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.score-counter {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--cream);
  padding: .35rem .85rem;
  border-radius: 20px;
  border: 1px solid var(--grey-mid);
}

.q-nav-btns { display: flex; gap: .5rem; }

.question-card {
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  min-height: 220px;
}

.q-number {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--grey-text);
  margin-bottom: 1rem;
  max-width: none;
}

.q-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--navy);
  margin-bottom: 1.25rem;
  max-width: 65ch;
}

/* Fill-in-the-blank */
.blank-input {
  display: inline-block;
  width: 5rem;
  padding: .25rem .5rem;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 2px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--white);
  color: var(--navy);
  margin: 0 .25rem;
  transition: border-color var(--transition);
}
.blank-input:focus { outline: none; border-color: var(--navy); }
.blank-input.input-correct { border-color: var(--green-dark); background: #edfaf3; }
.blank-input.input-wrong  { border-color: var(--red); background: #fdf0f1; }

/* MCQ */
.mcq-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: .6rem;
  margin-bottom: 1rem;
}
@media (min-width: 560px) {
  .mcq-options { grid-template-columns: repeat(2, 1fr); }
}

.mcq-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: var(--white);
  border: 2px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: border-color var(--transition), background var(--transition),
              transform var(--transition);
}
.mcq-option:hover:not(:disabled) {
  border-color: var(--navy);
  background: var(--cream);
  transform: translateY(-1px);
}
.mcq-option:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.mcq-option:disabled { cursor: default; transform: none; }

.mcq-label {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--grey-light);
  color: var(--navy);
  font-weight: 700;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.mcq-text { font-size: .9rem; line-height: 1.4; }

.option-correct { border-color: var(--green-dark) !important; background: #edfaf3 !important; }
.option-correct .mcq-label { background: var(--green-dark) !important; color: var(--white) !important; }
.option-wrong   { border-color: var(--red) !important; background: #fdf0f1 !important; }
.option-wrong .mcq-label   { background: var(--red) !important; color: var(--white) !important; }

/* Match-up */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 520px) { .match-grid { grid-template-columns: 1fr; } }

.match-col { display: flex; flex-direction: column; gap: .5rem; }

.match-col:first-child::before {
  content: 'Terms';
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--grey-text);
}
.match-col:last-child::before {
  content: 'Definitions';
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--grey-text);
}

.match-item {
  padding: .6rem .875rem;
  background: var(--white);
  border: 2px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
  line-height: 1.45;
  transition: border-color var(--transition), background var(--transition);
  min-height: 2.5rem;
}
.match-item:hover:not(:disabled) { border-color: var(--navy); }
.match-item:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.match-item.match-selected { border-color: var(--navy); background: #e8f0f8; }
.match-item.match-paired { border-color: var(--grey-mid); background: var(--cream); opacity: .75; }
.match-item.option-correct { border-color: var(--green-dark) !important; background: #edfaf3 !important; }
.match-item.option-wrong   { border-color: var(--red) !important; background: #fdf0f1 !important; }

/* Flashcard */
.flashcard {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 1rem;
  height: 200px;
  perspective: 1000px;
  cursor: pointer;
  display: block;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 2px solid var(--grey-mid);
  text-align: center;
  gap: .75rem;
}

.flashcard-front { background: var(--cream); }
.flashcard-back  { background: var(--navy); color: var(--white); transform: rotateY(180deg); }

.flashcard-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .55;
}
.flashcard-front .flashcard-label { color: var(--grey-text); }
.flashcard-back  .flashcard-label { color: rgba(255,255,255,.6); }

.flashcard-content {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  max-width: 42ch;
}
.flashcard-front .flashcard-content { color: var(--navy); }
.flashcard-back  .flashcard-content { color: var(--white); }

.flashcard-hint {
  text-align: center;
  font-size: .8125rem;
  color: var(--grey-text);
  margin-bottom: .75rem;
  max-width: none;
}

.flashcard-mark {
  display: flex;
  gap: .75rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.flashcard-mark.hidden { display: none; }

/* Feedback */
.feedback {
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  line-height: 1.55;
  margin-top: .875rem;
  max-width: 65ch;
}
.feedback.hidden { display: none; }
.feedback-correct { background: #edfaf3; color: #1a4d2e; border: 1px solid #a8d9b4; }
.feedback-wrong   { background: #fdf0f1; color: #5c1c23; border: 1px solid #f0b8bc; }

/* Navigation within question modes */
.q-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.q-progress {
  font-size: .875rem;
  font-weight: 600;
  color: var(--grey-text);
}

/* Summary screen */
.summary-screen {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 420px;
  margin: 0 auto;
}
.summary-title {
  font-family: var(--font-head);
  font-size: 1.4rem;
  margin-bottom: .75rem;
}
.summary-score {
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: .35rem;
}
.summary-pct {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: .5rem;
  max-width: none;
}
.summary-msg {
  font-size: .9rem;
  color: var(--grey-text);
  margin-bottom: 1.5rem;
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
}
.summary-actions { display: flex; flex-direction: column; gap: .6rem; align-items: center; }
@media (min-width: 400px) {
  .summary-actions { flex-direction: row; justify-content: center; }
}

/* ── Exam mode ──────────────────────────────────────────────── */
.exam-card {
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.exam-q-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.marks-badge {
  background: var(--red);
  color: var(--white);
  font-size: .8125rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-family: var(--font-body);
}

.command-badge {
  background: var(--navy);
  color: var(--yellow);
  font-size: .8125rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.exam-q-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--navy);
  max-width: 65ch;
}

.exam-answer {
  width: 100%;
  padding: .75rem 1rem;
  font-family: var(--font-body);
  font-size: .9375rem;
  line-height: 1.6;
  border: 2px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  color: var(--navy);
  background: var(--white);
  resize: vertical;
  transition: border-color var(--transition);
}
.exam-answer:focus { outline: none; border-color: var(--navy); }
.exam-answer-short { min-height: 80px; }

.exam-btn-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

/* BUG panel */
.bug-panel {
  background: var(--cream);
  border: 1px solid var(--grey-mid);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .875rem;
  line-height: 1.6;
}
.bug-panel.hidden { display: none; }
.bug-panel strong { display: block; margin-bottom: .4rem; font-size: .9rem; }
.bug-panel ul { list-style: none; display: flex; flex-direction: column; gap: .3rem; padding: 0; }
.bug-panel li { padding-left: .1rem; }

/* Mark scheme panel */
.markscheme-panel {
  background: #edfaf3;
  border: 1px solid #a8d9b4;
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .875rem;
  line-height: 1.65;
  color: #1a4d2e;
}
.markscheme-panel.hidden { display: none; }
.markscheme-panel > strong { display: block; margin-bottom: .75rem; font-size: .9rem; }

/* LBMS table inside mark scheme */
.lbms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8125rem;
  margin-bottom: .875rem;
}
.lbms-table th {
  background: var(--green-dark);
  color: var(--white);
  padding: .45rem .75rem;
  text-align: left;
  font-weight: 700;
}
.lbms-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid #c8e8d4;
  vertical-align: top;
  line-height: 1.5;
}
.lbms-table tr:last-child td { border-bottom: none; }
.lbms-table tr:nth-child(even) td { background: rgba(255,255,255,.5); }

.ms-subhead {
  font-weight: 700;
  font-size: .8125rem;
  margin-bottom: .4rem;
}
.ms-points {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.ms-mark {
  background: var(--green-dark);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
  padding: .05rem .3rem;
  border-radius: 3px;
  margin-left: .15rem;
  vertical-align: middle;
}

/* ── Placeholder & error states ─────────────────────────────── */
.placeholder {
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: .9375rem;
  color: var(--grey-text);
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px dashed var(--grey-mid);
  max-width: none;
}

.error {
  color: var(--red);
  background: #fdf0f1;
  border: 1px solid #f0b8bc;
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .9rem;
  max-width: none;
}

/* ── Focus ring global override ─────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Scrollbar (Webkit) ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--grey-mid); border-radius: 3px; }

/* ════════════════════════════════════════════════════════════
   PAST PAPERS — home page section + paper page
   ════════════════════════════════════════════════════════════ */

.past-papers-section {
  margin: 3rem 0 2rem;
  padding: 1.5rem;
  background: var(--cream);
  border: 1px solid #e3dec9;
  border-radius: 12px;
}

.section-heading {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  color: var(--navy);
  margin: 0 0 .5rem;
}

.section-intro {
  margin: 0 0 1.25rem;
  color: #444;
  max-width: 70ch;
}

.paper-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 700px) {
  .paper-grid { grid-template-columns: 1fr 1fr; }
}

.paper-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: white;
  border: 2px solid var(--navy);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.paper-card:hover, .paper-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(11, 37, 69, 0.15);
  background: #fff;
  outline: none;
}

.paper-card-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.paper-card-body { flex: 1; min-width: 0; }

.paper-card-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  color: var(--navy);
  margin: 0 0 .25rem;
}

.paper-card-blurb {
  font-size: .9rem;
  color: #666;
  margin: 0;
}

/* ── Paper page ───────────────────────────────────────────── */

.page-paper { background: var(--cream); }

.paper-header-content {
  margin-top: .5rem;
}

.paper-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: white;
  margin: 0;
}

.paper-meta {
  font-size: .9rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: .25rem;
}

/* ── Mode choice ─────────────────────────────────────────── */

.paper-intro {
  padding: 2rem 0;
}

.paper-intro-card {
  max-width: 700px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.paper-intro-card h2 {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--navy);
  margin: 0 0 1.5rem;
  text-align: center;
}

.mode-choice {
  display: grid;
  gap: 1rem;
}

@media (min-width: 600px) {
  .mode-choice { grid-template-columns: 1fr 1fr; }
}

.mode-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
  padding: 1.5rem;
  background: var(--cream);
  border: 2px solid var(--navy);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--navy);
  transition: background .15s, transform .15s;
}

.mode-choice-btn:hover, .mode-choice-btn:focus-visible {
  background: var(--yellow);
  transform: translateY(-2px);
  outline: none;
}

.mode-choice-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: bold;
}

.mode-choice-blurb {
  font-size: .9rem;
  color: #555;
  line-height: 1.5;
}

/* ── Timer bar ────────────────────────────────────────────── */

.timer-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: white;
  padding: .75rem 0;
  border-bottom: 3px solid var(--yellow);
}

.timer-bar .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.timer-label {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.timer-display {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--yellow);
  flex: 1;
}

.timer-bar.timer-warning {
  background: var(--red);
  animation: timer-pulse 1.5s ease-in-out infinite;
}

.timer-bar.timer-warning .timer-display {
  color: white;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ── Paper questions ─────────────────────────────────────── */

.paper-questions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 0;
}

.paper-q-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.paper-q-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.paper-q-number {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--navy);
  margin-right: .25rem;
}

.paper-q-text {
  margin: 0 0 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.paper-mcq-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 0 0 1rem;
}

.paper-mcq-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .65rem .85rem;
  background: var(--cream);
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1.4;
}

.paper-mcq-option:hover {
  background: #faf2dc;
}

.paper-mcq-option input[type="radio"] {
  margin-top: .15rem;
  flex-shrink: 0;
}

.ms-mcq-answer {
  margin: .5rem 0 0;
  font-size: .95rem;
}

.paper-finish-row {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
}

/* ── Results banner ──────────────────────────────────────── */

.paper-results {
  padding: 1.5rem 0;
}

.results-card {
  background: var(--green);
  color: white;
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
}

.results-card h2 {
  font-family: Georgia, 'Times New Roman', serif;
  margin: 0 0 .5rem;
  color: white;
}

.results-card p {
  margin: 0 0 1rem;
  color: rgba(255,255,255,0.95);
}

.results-card .btn-outline {
  background: white;
  color: var(--green);
  border-color: white;
}

/* ── Print styles ───────────────────────────────────────────── */
@media print {
  .site-header, .mode-nav, .home-actions,
  .site-footer, .questions-header, .q-navigation,
  #panel-questions, #panel-exam { display: none !important; }

  #panel-revise { display: block !important; }

  .topic-header {
    position: static;
    background: none;
    color: var(--navy);
    border-bottom: 2px solid var(--navy);
    padding: .5rem 0;
  }
  .topic-title { color: var(--navy); }
  .back-link { display: none; }
  .topic-letter { border: 2px solid var(--navy); color: var(--navy); }

  .subtopic-header { background: none; border-bottom: 1px solid var(--navy); }
  .subtopic-body.collapsed { display: flex !important; }

  .block-table th { background: none; color: var(--navy); border-bottom: 2px solid var(--navy); }

  .block-tip { background: none; border: 1px solid var(--navy); }
  .tip-label { color: var(--navy); }
  .block-tip p { color: var(--navy); }

  body { font-size: 10pt; }
  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; }
  h3 { font-size: 12pt; }
}
