:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --text: #f5f5f7;
  --muted: #a0a4ad;
  --accent: #ff7a59;
  --border: #2a2e38;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

header {
  position: relative;
  /* Extra top padding so the "[Name] you are cooking!" heading sits clearly
     below the absolutely-positioned Sign out / Hub / Admin / Seizure pills
     in the top-right of the header. */
  padding: 56px 16px 12px;
  text-align: center;
}
/* Header action buttons (Sign out / Hub / Admin / Exams / Seizure) live in a
   flex row at the top-right, so however many are visible they auto-arrange
   without overlapping. */
.header-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  max-width: calc(100% - 28px);
}
.header-actions .logout-btn,
.header-actions .admin-link,
.header-actions .seizure-btn {
  position: static;
  top: auto;
  right: auto;
}
/* "Next exam: X in Y days" line under the tagline (moo + admin only) */
.next-exam {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.next-exam.hidden { display: none; }
.next-exam .next-exam-paper {
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.next-exam .next-exam-count {
  font-weight: 600;
  color: var(--gold);
  margin-left: 4px;
}

/* "Today's revision: <subject>" line under "Next exam" — same gating
   (moo + admin only). Slightly muted vs the next-exam accent so the two
   sit comfortably stacked. */
.todays-revision {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}
.todays-revision strong { color: var(--text); }
.todays-revision.hidden { display: none; }

/* CTA button row holding "Exam timetable" + "Revision Schedule" side by
   side, centred below the Next-exam / Today's revision lines. */
.exams-cta-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* "Exam timetable" / "Revision Schedule" call-to-action pills.
   Same role-gated visibility as the Next-exam line (moo + admin only). */
.exams-cta {
  display: inline-block;
  padding: 8px 20px;
  background: var(--accent-soft, rgba(255, 122, 89, 0.1));
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s;
}
.exams-cta:hover {
  background: var(--accent);
  color: #11141a;
  text-decoration: none;
}
.exams-cta.hidden { display: none; }

.logout-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.logout-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.admin-link {
  position: absolute;
  top: 14px;
  right: 178px;
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.admin-link:hover {
  border-color: var(--accent);
  color: var(--text);
}
.admin-link.hidden { display: none; }
.seizure-btn {
  position: absolute;
  top: 14px;
  right: 96px;
  padding: 6px 12px;
  background: rgba(255, 71, 87, 0.12);
  color: #ff4757;
  border: 1px solid #ff4757;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seizure-btn:hover {
  background: #ff4757;
  color: #fff;
  text-decoration: none;
}
header h1 {
  margin: 0;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

form {
  display: grid;
  gap: 8px;
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
form.hidden { display: none; }
#experiment-form {
  margin-top: 12px;
  border-color: #3a4a3a;
  background: #161c18;
}
#experiment-form button {
  background: #6dc36d;
}
#case-study-form {
  margin-top: 12px;
  border-color: #4a3f2a;
  background: #1c1814;
}
#case-study-form button {
  background: #d9a86d;
}
#timeline-form {
  margin-top: 12px;
  border-color: #3a3a4a;
  background: #18181c;
}
#timeline-form button {
  background: #8a8ad9;
}
label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
select, input, button {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #11141a;
  color: var(--text);
  font-family: inherit;
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath d='M6 9L1 4h10z' fill='%23a0a4ad'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
button {
  background: var(--accent);
  color: #11141a;
  font-weight: 700;
  border: none;
  cursor: pointer;
  margin-top: 6px;
}
button:disabled { opacity: 0.6; cursor: wait; }

/* Loading state for submit buttons — shows a small spinning circle after the
   button's text. The button text itself is changed via JS (e.g. "Look it up"
   → "Looking it up"). */
button.is-loading {
  cursor: progress;
  opacity: 0.85;
}
button.is-loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.status {
  text-align: center;
  margin: 12px 0;
  color: var(--muted);
  min-height: 20px;
  font-size: 14px;
}

.result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 12px 0 24px;
}
.result.hidden { display: none; }
.result h2 {
  margin: 0 0 4px;
  font-size: 24px;
  text-transform: capitalize;
}
.subject-tag {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.explanation {
  font-size: 17px;
  margin: 0 0 16px;
  white-space: pre-wrap;
}

.diagram {
  max-width: 320px;
  margin: 4px auto 14px;
  padding: 8px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.diagram:empty { display: none; }
.diagram-thumb {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}
.diagram img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.formula-box {
  background: linear-gradient(135deg, #1d1814, #11141a);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.formula-box.hidden { display: none; }
.formula-box .section-label {
  margin: 0 0 8px;
  color: var(--accent);
}
.formula-equation {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  line-height: 1.4;
  word-break: break-word;
}
.formula-example {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.formula-example-label {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.formula-inputs {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
}
.formula-inputs li {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  padding: 2px 0;
}
.formula-calc {
  margin: 10px 0 8px;
  padding: 8px 10px;
  background: rgba(255, 122, 89, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.formula-result {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  word-break: break-word;
}

.examples, .questions {
  margin: 0 0 16px;
}
.examples:empty, .questions:empty { display: none; }
.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px;
}
.example-card {
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.example-card .example-diagram,
.question-card .question-diagram {
  display: flex;
  justify-content: center;
  margin: 0 0 12px;
}
.example-card .example-diagram svg,
.question-card .question-diagram svg {
  max-width: 100%;
  height: auto;
  max-height: 240px;
}
.example-card .example-problem {
  font-weight: 600;
  margin: 0 0 8px;
}
.example-card .example-working {
  margin: 0 0 10px;
  padding-left: 22px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
.example-card ol.example-working { margin: 0 0 10px; }
.example-card .example-working li { margin-bottom: 4px; }
.example-card .example-working li:last-child { margin-bottom: 0; }
.example-card .example-answer {
  margin: 0;
  color: #6dc36d;
  font-weight: 600;
}
.example-card .example-answer-label {
  color: var(--muted);
  font-weight: 400;
  margin-right: 4px;
}

.more-examples-btn {
  display: block;
  width: 100%;
  margin: 4px 0 6px;
  padding: 11px 14px;
  background: var(--accent-soft, rgba(255, 122, 89, 0.1));
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.more-examples-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.more-examples-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* Maths revision-priority traffic-light pill (shown next to the topic title
   in the Slides study view for the Papers 2 & 3 calculator-paper revision). */
.priority-pill {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.priority-pill.priority-green {
  background: rgba(80, 200, 120, 0.18);
  color: #5fcf7f;
  border: 1px solid rgba(80, 200, 120, 0.5);
}
.priority-pill.priority-amber {
  background: rgba(230, 170, 60, 0.18);
  color: #e6aa3c;
  border: 1px solid rgba(230, 170, 60, 0.5);
}
.priority-pill.priority-red {
  background: rgba(225, 90, 90, 0.18);
  color: #e57a7a;
  border: 1px solid rgba(225, 90, 90, 0.5);
}

.question-card {
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.question-text {
  font-weight: 600;
  margin: 0 0 12px;
}
.option-list {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
}
.option-btn {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option-btn:hover { border-color: var(--accent); }
.option-btn.correct {
  border-color: #6dc36d;
  background: #1a2d1a;
  color: #b8d8b8;
}
.option-btn.wrong {
  border-color: #d96d6d;
  background: #2d1a1a;
  color: #d8b8b8;
}
.option-btn:disabled { cursor: default; }
.option-btn:disabled:hover { border-color: inherit; }
.question-explanation {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #2a3a2a;
  border-radius: 6px;
  color: #b8d8b8;
  font-size: 14px;
  display: none;
}
.question-card.answered .question-explanation { display: block; }

.images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}
.images:empty { display: none; }
.img-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.img-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  background: #11141a;
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.15s;
}
.img-thumb:hover { border-color: var(--accent); }
.img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  align-self: flex-start;
  max-width: 100%;
  transition: border-color 0.15s, color 0.15s;
}
.img-source-link:hover {
  border-color: var(--accent);
  color: var(--text);
}
.img-source-link svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.img-source-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 600px) {
  .images { grid-template-columns: repeat(4, 1fr); }
}

.one-go {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 16px;
  background: linear-gradient(135deg, #ff7a59, #ff5c8a);
  color: #11141a;
  font-weight: 700;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(255, 122, 89, 0.25);
  transition: transform 0.1s, box-shadow 0.1s;
}
.one-go:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255, 122, 89, 0.35); }
.one-go:active { transform: translateY(0); }
.one-go.hidden { display: none; }
.one-go-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0;
}

/* Secondary CTA — Flash Cards + Analysis Tips. Same gradient + colour
   language as .one-go so they read as siblings, but with smaller padding /
   font so they don't compete visually with the master "In One Go" pack
   button below them. */
.feature-cta {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 122, 89, 0.88), rgba(255, 92, 138, 0.88));
  color: #11141a;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  box-shadow: 0 3px 10px rgba(255, 122, 89, 0.18);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.feature-cta:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(255, 122, 89, 0.28); filter: brightness(1.04); }
.feature-cta:active { transform: translateY(0); }
.feature-cta.hidden { display: none; }
.feature-cta-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 3px;
  text-transform: none;
  letter-spacing: 0;
}

/* Per-paper revision buttons — slice the master "In One Go" pack down to a
   single exam paper's topics, no extra LLM call. Smaller / secondary style
   so they sit visually beneath the master button without competing. */
.paper-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.paper-buttons.hidden { display: none; }
.paper-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 122, 89, 0.08);
  color: var(--accent);
  border: 1px solid rgba(255, 122, 89, 0.4);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.paper-btn:hover {
  background: rgba(255, 122, 89, 0.18);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.paper-btn:active { transform: translateY(0); }
.paper-btn .paper-btn-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0;
}
.paper-btn[aria-expanded="true"] {
  background: rgba(255, 122, 89, 0.18);
  border-color: var(--accent);
}
.paper-btn .paper-btn-chev {
  float: right;
  font-size: 14px;
  line-height: 1.1;
  transition: transform 0.15s;
}
.paper-btn[aria-expanded="true"] .paper-btn-chev { transform: rotate(180deg); }
/* Module sub-buttons (history only) — indented under their paper. */
.paper-modules {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 6px 16px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 122, 89, 0.25);
}
.paper-modules.is-open { display: flex; }
.module-btn {
  /* Per-module colour driven by --mod-color (set per data-module-id below).
     Defaults to the orange accent so non-History modules still look fine
     if any subject ever grows modules. */
  --mod-color: var(--accent);
  --mod-color-soft: rgba(255, 122, 89, 0.14);
  --mod-color-strong: rgba(255, 122, 89, 0.30);
  --mod-color-text: var(--text);

  display: block;
  width: 100%;
  padding: 10px 14px 10px 16px;
  background: var(--mod-color-soft);
  color: var(--mod-color-text);
  border: 1px solid var(--mod-color);
  border-left: 5px solid var(--mod-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
}
.module-btn:hover {
  background: var(--mod-color-strong);
  color: #fff;
}
.module-btn:active { transform: translateY(1px); }

/* Per-module colour palette — matches the mind-map branch palette so the
   module buttons, mind-map page borders and cover-sheet group colours all
   read as part of the same visual language. */
.module-btn[data-module-id="cp"]   { --mod-color: #e63946; --mod-color-soft: rgba(230, 57, 70, 0.16);  --mod-color-strong: rgba(230, 57, 70, 0.32);  --mod-color-text: #ffb0b6; }
.module-btn[data-module-id="eliz"] { --mod-color: #1d4ed8; --mod-color-soft: rgba(29, 78, 216, 0.18);  --mod-color-strong: rgba(29, 78, 216, 0.34);  --mod-color-text: #a8bdff; }
.module-btn[data-module-id="sk"]   { --mod-color: #16a34a; --mod-color-soft: rgba(22, 163, 74, 0.16);  --mod-color-strong: rgba(22, 163, 74, 0.32);  --mod-color-text: #86efac; }
.module-btn[data-module-id="vik"]  { --mod-color: #0891b2; --mod-color-soft: rgba(8, 145, 178, 0.18);  --mod-color-strong: rgba(8, 145, 178, 0.34);  --mod-color-text: #67e8f9; }
.module-btn[data-module-id="nazi"] { --mod-color: #ea580c; --mod-color-soft: rgba(234, 88, 12, 0.16);  --mod-color-strong: rgba(234, 88, 12, 0.32);  --mod-color-text: #fdba74; }

/* History "Mind map" variant — purple/orange gradient to read as a
   different kind of action (open the mind map) vs the In-One-Go modules. */
.module-btn.mindmap-btn {
  margin-top: 6px;
  --mod-color: #7c3aed;
  --mod-color-soft: rgba(124, 58, 237, 0.16);
  --mod-color-strong: rgba(124, 58, 237, 0.34);
  --mod-color-text: #d8c4ff;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.18), rgba(255, 122, 89, 0.18));
  font-weight: 700;
}
.module-btn.mindmap-btn:hover {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.32), rgba(255, 122, 89, 0.32));
  color: #fff;
}

/* History "Model Answers" variant — gold/pink gradient (Component 2 only)
   to read as a third distinct kind of action vs the green Skipton In One
   Go button and the purple Mind map button. */
.module-btn.modelanswers-btn {
  margin-top: 6px;
  --mod-color: #f59e0b;
  --mod-color-soft: rgba(245, 158, 11, 0.16);
  --mod-color-strong: rgba(245, 158, 11, 0.34);
  --mod-color-text: #fde68a;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(219, 39, 119, 0.18));
  font-weight: 700;
}
.module-btn.modelanswers-btn:hover {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.32), rgba(219, 39, 119, 0.32));
  color: #fff;
}

/* Non-history "Slides" sub-button — green to echo the In One Go pack
   it launches. Sits inside the expanded paper dropdown alongside Test Me. */
.module-btn.slides-btn {
  margin-top: 4px;
  --mod-color: #16a34a;
  --mod-color-soft: rgba(22, 163, 74, 0.16);
  --mod-color-strong: rgba(22, 163, 74, 0.34);
  --mod-color-text: #86efac;
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.18), rgba(34, 197, 94, 0.22));
  font-weight: 700;
}
.module-btn.slides-btn:hover {
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.32), rgba(34, 197, 94, 0.36));
  color: #fff;
}

/* History "Test Me" variant — cyan/teal gradient (Component 2 only) to
   read as a fourth distinct kind of action — quiz / drilling vs the green
   In One Go (study), purple Mind map (browse) and gold Model Answers (read). */
.module-btn.testme-btn {
  margin-top: 6px;
  --mod-color: #22d3ee;
  --mod-color-soft: rgba(34, 211, 238, 0.16);
  --mod-color-strong: rgba(34, 211, 238, 0.34);
  --mod-color-text: #a5f3fc;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.18), rgba(8, 145, 178, 0.22));
  font-weight: 700;
}
.module-btn.testme-btn:hover {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.32), rgba(8, 145, 178, 0.36));
  color: #fff;
}

/* When a Slides / Test Me button itself expands (paper has sections), give
   it a chevron that rotates on open, like the paper buttons. */
.module-btn .paper-btn-chev {
  float: right;
  font-size: 13px;
  line-height: 1.1;
  transition: transform 0.15s;
}
.module-btn[aria-expanded="true"] .paper-btn-chev { transform: rotate(180deg); }

/* Inline "choose a section" picker that drops below a Slides / Test Me
   button when its paper defines sections (e.g. Number, Algebra). Hidden
   until the parent button is tapped. Indented a touch further than the
   module buttons so the hierarchy reads paper > Slides > section. */
.paper-sections {
  display: none;
  flex-direction: column;
  gap: 3px;
  margin: 2px 0 4px 14px;
  padding-left: 8px;
  border-left: 2px dashed rgba(255, 122, 89, 0.25);
}
.paper-sections.is-open { display: flex; }
.paper-sections[data-kind="slides"] { border-left-color: rgba(22, 163, 74, 0.35); }
.paper-sections[data-kind="testme"] { border-left-color: rgba(34, 211, 238, 0.35); }
.section-btn {
  display: block;
  width: 100%;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
}
.section-btn:hover { background: rgba(255, 255, 255, 0.10); }
.section-btn:active { transform: translateY(1px); }
.paper-sections[data-kind="slides"] .section-btn:hover { border-color: rgba(22, 163, 74, 0.55); }
.paper-sections[data-kind="testme"] .section-btn:hover { border-color: rgba(34, 211, 238, 0.55); }
/* "Whole paper" reset option — accent-tinted so it's easy to spot. */
.section-btn[data-section-id="__all"] {
  background: rgba(255, 122, 89, 0.12);
  border-color: rgba(255, 122, 89, 0.30);
  color: #ffd2c4;
}
.section-btn[data-section-id="__all"]:hover { background: rgba(255, 122, 89, 0.22); }

/* Main-app "Test Me" button — cyan accent so it visually pairs with the
   History per-component Test Me buttons. Sits below the green In One Go. */
.formula-sheet-btn.test-me-cta {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), rgba(8, 145, 178, 0.20));
  border-color: rgba(34, 211, 238, 0.45);
  color: #a5f3fc;
}
.formula-sheet-btn.test-me-cta .formula-sheet-btn-sub { color: rgba(165, 243, 252, 0.7); }
.formula-sheet-btn.test-me-cta:hover {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.28), rgba(8, 145, 178, 0.32));
  border-color: #22d3ee;
  color: #fff;
}

.voice-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.voice-toggle-row.hidden { display: none; }
.voice-toggle-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.voice-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #11141a;
}
.voice-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 120ms, color 120ms;
}
.voice-btn:hover { color: var(--text); }
.voice-btn.active {
  background: var(--accent);
  color: #11141a;
}

.speaking-exam {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 16px;
  background: linear-gradient(135deg, #d9a86d, #ff7a59);
  color: #11141a;
  font-weight: 700;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(217, 168, 109, 0.25);
  transition: transform 0.1s, box-shadow 0.1s;
}
.speaking-exam:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(217, 168, 109, 0.35); }
.speaking-exam:active { transform: translateY(0); }
.speaking-exam.hidden { display: none; }
.speaking-exam-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0;
}

/* Section header / sub-text — used by Formula sheet + Answer structures
   sections. (The English Lit quote-bank block that previously surrounded
   these rules has moved to /flash-cards.html — its own page.) */
.section-header {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--accent);
}
.section-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.study-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.study-overlay.hidden { display: none; }
.study-header {
  position: relative;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.study-close {
  position: absolute;
  top: 14px;
  right: 12px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.study-close:hover {
  border-color: var(--accent);
  color: var(--text);
}
.study-subject {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.study-topic {
  margin: 4px 110px 12px 0;
  font-size: 20px;
  line-height: 1.25;
}
.study-progress-bar {
  height: 6px;
  background: var(--card);
  border-radius: 3px;
  overflow: hidden;
}
.study-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}
.study-progress-text {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.study-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}
.study-toolbar-btn {
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.study-toolbar-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.study-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.study-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}
.study-nav {
  display: flex;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.study-nav-btn {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.study-nav-btn:disabled { opacity: 0.4; cursor: default; }
.study-nav-btn.primary {
  background: var(--accent);
  color: #11141a;
  border-color: var(--accent);
}

.flashcard {
  position: relative;
  perspective: 1000px;
  margin: 0 0 14px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  min-height: 130px;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-side {
  position: absolute;
  inset: 0;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flashcard-front .flashcard-label,
.flashcard-back .flashcard-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px;
}
.flashcard-front .flashcard-text {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.flashcard-back { transform: rotateY(180deg); background: #1a2d1a; border-color: #3a4a3a; }
.flashcard-back .flashcard-label { color: #b8d8b8; }
.flashcard-back .flashcard-text {
  font-size: 16px;
  line-height: 1.45;
  margin: 0;
}
.flashcard-hint {
  text-align: center;
  margin: -6px 0 14px;
  font-size: 11px;
  color: var(--muted);
}

/* Static flashcard: term + definition shown together (no flip), in two
   clearly-distinct sections. */
.flashcard-static {
  margin: 0 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.flashcard-static .flashcard-section { padding: 16px 20px; }
.flashcard-static .flashcard-term { background: var(--card); }
.flashcard-static .flashcard-def {
  background: #1a2d1a;
  border-top: 2px solid #3a4a3a;
}
.flashcard-static .flashcard-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}
.flashcard-static .flashcard-def .flashcard-label { color: #b8d8b8; }
.flashcard-static .flashcard-term .flashcard-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.flashcard-static .flashcard-def .flashcard-text {
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}
.flashcard-static .flashcard-example {
  background: #131a2e;
  border-top: 2px solid #2a3a5a;
}
.flashcard-static .flashcard-example .flashcard-label { color: #8fb4ff; }
.flashcard-example-problem {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 8px;
}
ol.flashcard-working {
  margin: 0 0 8px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.55;
}
ol.flashcard-working li { margin-bottom: 4px; }
ol.flashcard-working li:last-child { margin-bottom: 0; }
.flashcard-example-answer {
  margin: 0;
  color: #6dc36d;
  font-weight: 600;
  font-size: 15px;
}
.flashcard-example-answer-label { color: var(--muted); font-weight: 400; }

/* Grouped facts: a whole topic's flashcards shown together as colour-coded
   cards (mirrors the revision-sheet branch boxes). One page per topic in the
   In One Go study mode. Colours cycle via .fact-card--<colour>. */
.fact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 14px;
}
@media (min-width: 640px) { .fact-grid { grid-template-columns: 1fr 1fr; } }
.fact-card {
  border: 1px solid var(--fc-color, var(--accent));
  border-left: 6px solid var(--fc-color, var(--accent));
  background: var(--fc-bg, var(--card));
  border-radius: 10px;
  padding: 12px 14px;
}
.fact-term {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--fc-color, var(--text));
}
.fact-def {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.fact-card .flashcard-example {
  margin-top: 10px;
  background: #131a2e;
  border: 1px solid #2a3a5a;
  border-radius: 8px;
  padding: 10px 12px;
}
.fact-card .flashcard-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8fb4ff;
  margin: 0 0 6px;
}
.fact-card--red    { --fc-color: #f4707b; --fc-bg: rgba(230, 57, 70, 0.10); }
.fact-card--blue   { --fc-color: #7aa2ff; --fc-bg: rgba(59, 130, 246, 0.10); }
.fact-card--green  { --fc-color: #4ade80; --fc-bg: rgba(22, 163, 74, 0.10); }
.fact-card--purple { --fc-color: #c084fc; --fc-bg: rgba(168, 85, 247, 0.10); }
.fact-card--orange { --fc-color: #fb923c; --fc-bg: rgba(234, 88, 12, 0.10); }
.fact-card--teal   { --fc-color: #2dd4bf; --fc-bg: rgba(20, 184, 166, 0.10); }
.fact-card--pink   { --fc-color: #f472b6; --fc-bg: rgba(219, 39, 119, 0.10); }

.study-section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 0 8px;
}
.study-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 24px;
}
.study-loading h3 {
  margin: 0 0 10px;
  font-size: 22px;
}
.study-loading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.study-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--card);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 0 20px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.study-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.study-action-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.study-action-btn:hover { color: var(--text); border-color: var(--accent); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: var(--accent);
}

.video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #11141a;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  height: auto;
  padding-bottom: 18px;
  border: 1px dashed var(--border);
}

.scaffolds-bank {
  margin-top: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.scaffolds-bank.hidden { display: none; }
.scaffolds-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}
@media (min-width: 600px) {
  .scaffolds-buttons { grid-template-columns: 1fr 1fr; }
}
.scaffold-btn {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #11141a;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.scaffold-btn:hover { border-color: var(--accent); }
.scaffold-btn.active {
  border-color: var(--accent);
  background: #1d1814;
}
.scaffold-btn-meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: lowercase;
}
.scaffolds-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.scaffolds-panel.hidden { display: none; }
.scaffold-card-header {
  margin: 0 0 12px;
}
.scaffold-card-title {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.3;
}
.scaffold-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.scaffold-meta-pill {
  display: inline-block;
  padding: 3px 10px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.scaffold-section {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.scaffold-section:last-child { margin-bottom: 0; }
.scaffold-prose {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
.scaffold-step {
  margin: 0 0 10px;
  padding: 0 0 10px;
  border-bottom: 1px dashed var(--border);
}
.scaffold-step:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.scaffold-step-label {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
}
.scaffold-step-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
.scaffold-step-example {
  margin: 6px 0 0;
  padding: 6px 10px;
  background: rgba(255, 122, 89, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.45;
  font-style: italic;
}
.scaffold-eg-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-style: normal;
  font-weight: 700;
  border-radius: 3px;
  background: var(--accent);
  color: #11141a;
}
.scaffold-watchouts ul {
  margin: 0;
  padding-left: 20px;
}
.scaffold-watchouts li {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.eng-lang-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin: 12px 0 24px;
}
.eng-lang-result.hidden { display: none; }
.el-header {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.el-question-tag {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}
.el-title {
  margin: 0;
  font-size: 24px;
  text-transform: capitalize;
}
.el-section {
  margin: 0 0 14px;
}
.el-section:last-child { margin-bottom: 0; }
.el-prose {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}
.el-example {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.el-example:last-child { margin-bottom: 0; }
.el-example-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #2a2e38;
  color: var(--muted);
  border-radius: 4px;
  margin-top: 2px;
}
.el-example-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
}
.el-phrases {
  margin: 0;
  padding-left: 20px;
}
.el-phrases li {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 6px;
  font-style: italic;
}
.el-model {
  padding: 12px 14px;
  background: rgba(255, 122, 89, 0.06);
  border: 1px solid var(--accent);
  border-radius: 8px;
}
.el-model .section-label {
  color: var(--accent);
}

.case-study-result {
  background: var(--card);
  border: 1px solid #4a3f2a;
  border-radius: 12px;
  padding: 18px 18px 16px;
  margin: 12px 0 24px;
}
.case-study-result.hidden { display: none; }
.cs-header {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.cs-category {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d9a86d;
  font-weight: 700;
}
.cs-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
}
.cs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cs-meta-pill {
  display: inline-block;
  padding: 3px 10px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.cs-key-facts {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #1c1814;
  border: 1px solid #4a3f2a;
  border-radius: 8px;
}
.cs-key-facts .section-label {
  margin: 0 0 8px;
  color: #d9a86d;
}
.cs-key-facts ul {
  margin: 0;
  padding-left: 20px;
}
.cs-key-facts li {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 4px;
}
.cs-section {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.cs-section:last-child { margin-bottom: 0; }
.cs-section-heading {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}
.cs-section-points {
  margin: 0;
  padding-left: 20px;
}
.cs-section-points li {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.timeline-result {
  background: var(--card);
  border: 1px solid #3a3a4a;
  border-radius: 12px;
  padding: 18px 18px 16px;
  margin: 12px 0 24px;
}
.timeline-result.hidden { display: none; }
.tl-header {
  margin: 0 0 16px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.tl-module {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8ad9;
  font-weight: 700;
}
.tl-title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
}
.tl-period {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.tl-events {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.tl-events::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #3a3a4a;
}
.tl-event {
  position: relative;
  padding-left: 28px;
  margin-bottom: 14px;
}
.tl-event:last-child { margin-bottom: 0; }
.tl-event::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8a8ad9;
  border: 2px solid var(--card);
}
.tl-event-date {
  font-size: 12px;
  font-weight: 700;
  color: #8a8ad9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.tl-event-body {
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.tl-event-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.tl-event-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.translate-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 16px;
  margin: 12px 0 24px;
}
.translate-result.hidden { display: none; }

.translate-pair {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.translate-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.translate-target-line {
  border-color: #3a2f24;
  background: #1d1814;
}
.lang-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 4px;
  background: #2a2e38;
  color: var(--muted);
  margin-top: 3px;
}
.translate-target-line .lang-tag {
  background: var(--accent);
  color: #11141a;
}
.translate-text {
  flex: 1;
  font-size: 17px;
  line-height: 1.4;
  word-break: break-word;
}
.translate-text-primary {
  font-weight: 600;
  color: var(--accent);
}

.speak-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.speak-btn:hover { border-color: var(--accent); background: #1d1814; }
.speak-btn:active { transform: scale(0.95); }
.speak-btn.speaking {
  background: var(--accent);
  color: #11141a;
  border-color: var(--accent);
}

.translate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}
.translate-meta-item {
  display: inline-block;
  padding: 3px 9px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.translate-meta-item strong {
  color: var(--text);
  font-weight: 600;
  text-transform: none;
}

.translate-conjugation {
  margin-top: 14px;
}
.conjugation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.conj-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.conj-pronoun {
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.conj-form {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
@media (max-width: 480px) {
  .conjugation-grid { grid-template-columns: 1fr; }
}

.translate-examples {
  margin-top: 16px;
}
.example-pair {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.example-pair:last-child { margin-bottom: 0; }
.example-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.example-line .translate-text {
  font-size: 15px;
  font-weight: 500;
}
.example-translation {
  margin: 6px 0 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-main {
  width: 100%;
  max-width: 380px;
}
.login-header {
  text-align: center;
  padding: 0 0 16px;
}
.login-header h1 {
  margin: 0;
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.login-error {
  margin: 8px 0 0;
  color: #ff8a8a;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}
.login-error:empty { min-height: 18px; }

/* ==========================
   Maths formula sheet
   ========================== */
.formula-sheet-btn {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 14px;
  background: #11141a;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.1s;
}
.formula-sheet-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.formula-sheet-btn:active { transform: translateY(0); }
.formula-sheet-btn.hidden { display: none; }
.formula-sheet-btn-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
}

.formula-sheet {
  margin-top: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.formula-sheet.hidden { display: none; }

.formula-sheet-toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.formula-sheet-headings { flex: 1 1 220px; min-width: 0; }
.formula-sheet-headings .section-header { margin: 0; }
.formula-sheet-headings .section-sub { margin: 2px 0 0; }
.formula-sheet-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.formula-sheet-action-btn {
  padding: 8px 14px;
  background: var(--accent);
  color: #11141a;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.1s;
}
.formula-sheet-action-btn:hover { filter: brightness(1.05); }
.formula-sheet-action-btn-secondary {
  background: #11141a;
  color: var(--text);
  border: 1px solid var(--border);
}

.formula-sheet-legend {
  margin: 6px 0 14px;
  padding: 8px 10px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.formula-print-header,
.formula-print-footer { display: none; }

/* Maths-only — paper master tabs above the topic tabs */
.formula-paper-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.formula-paper-tab {
  flex: 1 1 200px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px;
  background: #11141a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.formula-paper-tab:hover { border-color: var(--accent); }
.formula-paper-tab.is-active {
  background: var(--accent);
  color: #11141a;
  border-color: var(--accent);
}
.formula-paper-tab-sub {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  opacity: 0.8;
}

.formula-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
}
.formula-tab {
  padding: 7px 14px;
  background: #11141a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.formula-tab:hover { border-color: var(--accent); }
.formula-tab.is-active {
  background: var(--accent);
  color: #11141a;
  border-color: var(--accent);
}
/* Topic tab is hidden when all of its formulas are calc-only and the
   non-calculator master tab is selected (i.e. it'd be empty). */
.formula-tab.is-empty { display: none; }

/* When the user picks "Non-calculator", hide calc-only formulas. The
   default state of .formula-groups is data-paper-mode="non-calc". */
.formula-groups[data-paper-mode="non-calc"] .formula-item.is-calc-only {
  display: none;
}
/* Small badge on calc-only formulas (visible only in calculator mode) */
.formula-calc-tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px;
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-left: 6px;
}

.formula-groups {
  display: block;
  max-width: 720px;
  margin: 0 auto;
}

.formula-group {
  padding: 12px 14px;
  background: #11141a;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.formula-group.hidden { display: none; }
.formula-group-topic {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.formula-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.formula-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.formula-item:last-child { border-bottom: none; padding-bottom: 0; }
.formula-item-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
  text-align: center;
}
.formula-item-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  flex: 0 1 auto;
  line-height: 1.35;
}
.formula-provided-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(76, 175, 80, 0.12);
  color: #7fd189;
  border: 1px solid rgba(76, 175, 80, 0.35);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.formula-provided-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.18);
}
.formula-item-latex {
  margin: 8px auto 0;
  padding: 12px 18px;
  background: rgba(255, 122, 89, 0.08);
  border: 1px solid rgba(255, 122, 89, 0.25);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.3;
  overflow-x: auto;
  text-align: center;
}
.formula-item-latex .katex { font-size: 1.1em; }

/* ==========================
   Print — only the formula sheet
   ========================== */
@media print {
  @page { size: A4; margin: 10mm; }

  /* Hide every direct child of <body> except <main>, then hide every direct
     child of <main> except #formula-sheet. The formula sheet sits inside <main>
     so we can't just toggle body's children. */
  body.printing-formula-sheet > * { display: none !important; }
  body.printing-formula-sheet > main {
    display: block !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.printing-formula-sheet main > *:not(#formula-sheet) { display: none !important; }
  body.printing-formula-sheet .no-print { display: none !important; }

  body.printing-formula-sheet {
    background: #fff !important;
    color: #000 !important;
  }

  body.printing-formula-sheet #formula-sheet {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: none !important;
    color: #000 !important;
  }

  /* Force browser to honour our colours in print, regardless of the
     user's "background graphics" setting in the print dialog. */
  body.printing-formula-sheet,
  body.printing-formula-sheet * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-formula-sheet .formula-print-header {
    display: block;
    margin: 0 0 6mm;
    padding: 0 0 3mm;
    border-bottom: 2px solid #1a1d24;
  }
  body.printing-formula-sheet .formula-print-header h2 {
    margin: 0;
    font-size: 16pt;
    color: #1a1d24;
    font-weight: 700;
  }
  body.printing-formula-sheet .formula-print-header p {
    margin: 1mm 0 0;
    font-size: 9pt;
    color: #555;
  }

  body.printing-formula-sheet .formula-groups {
    display: block;
    max-width: none;
    column-count: 2;
    column-gap: 5mm;
    /* `auto` fills columns top-to-bottom (no balancing gaps). `balance`
       leaves big air-gaps when groups have break-inside: avoid because the
       browser tries to equalise column heights and can't split groups. */
    column-fill: auto;
  }

  /* Tabs are a screen-only navigation aid — never print them. */
  body.printing-formula-sheet .formula-tabs,
  body.printing-formula-sheet .formula-paper-tabs { display: none !important; }

  /* In print, ignore the paper filter and show ALL formulas (so the printout
     covers both calculator and non-calc papers). The "calc only" badge keeps
     showing so the student knows which formulas are calc-paper-only. */
  body.printing-formula-sheet .formula-groups[data-paper-mode="non-calc"] .formula-item.is-calc-only {
    display: list-item !important;
  }
  body.printing-formula-sheet .formula-calc-tag {
    background: transparent !important;
    color: #1e3a8a !important;
    border: 1px solid #1e3a8a !important;
    font-size: 7pt;
    padding: 0 4px;
  }

  /* In print, every group should appear regardless of which tab was active. */
  body.printing-formula-sheet .formula-group,
  body.printing-formula-sheet .formula-group.hidden {
    display: block !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 2.5mm;
    border-bottom: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* Topic header as a coloured banner — overridden per topic below. */
  body.printing-formula-sheet .formula-group-topic {
    font-size: 10pt;
    margin: 0 0 1.2mm;
    padding: 0.8mm 3mm 0.8mm 2mm;
    letter-spacing: 0.04em;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 1.2mm;
    border-left: 3mm solid #555;
  }
  body.printing-formula-sheet .formula-list { margin: 0; padding: 0; }
  body.printing-formula-sheet .formula-item {
    padding: 0.8mm 0 !important;
    border-bottom: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.printing-formula-sheet .formula-item-head {
    margin-bottom: 0.3mm;
    gap: 4px;
  }
  body.printing-formula-sheet .formula-item-name {
    font-size: 8pt;
    line-height: 1.25;
    color: #1a1d24 !important;
    font-weight: 600;
  }
  /* Default formula box (topic-colour override applied per group below). */
  body.printing-formula-sheet .formula-item-latex {
    font-size: 8.5pt;
    color: #000 !important;
    overflow: visible;
    background: #fafafa !important;
    border: 1px solid #e0e0e0 !important;
    border-left-width: 2mm !important;
    border-left-style: solid !important;
    border-left-color: #555 !important;
    border-radius: 1.2mm;
    padding: 0.7mm 2.4mm !important;
    margin-top: 0.5mm !important;
  }
  body.printing-formula-sheet .formula-item-latex .katex { font-size: 0.9em; color: #000; }

  /* ---- Per-topic colour palette (cycles every 8 groups) ---- */

  /* Topic 1 — Coral */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+1) .formula-group-topic {
    color: #9c1521; background: #fce4e6; border-left-color: #e63946;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+1) .formula-item-latex {
    border-left-color: #e63946 !important;
  }

  /* Topic 2 — Indigo */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+2) .formula-group-topic {
    color: #1e3a8a; background: #dfeafe; border-left-color: #1d4ed8;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+2) .formula-item-latex {
    border-left-color: #1d4ed8 !important;
  }

  /* Topic 3 — Green */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+3) .formula-group-topic {
    color: #14532d; background: #dcfce7; border-left-color: #16a34a;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+3) .formula-item-latex {
    border-left-color: #16a34a !important;
  }

  /* Topic 4 — Purple */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+4) .formula-group-topic {
    color: #4c1d95; background: #ede9fe; border-left-color: #7c3aed;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+4) .formula-item-latex {
    border-left-color: #7c3aed !important;
  }

  /* Topic 5 — Orange */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+5) .formula-group-topic {
    color: #9a3412; background: #ffedd5; border-left-color: #ea580c;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+5) .formula-item-latex {
    border-left-color: #ea580c !important;
  }

  /* Topic 6 — Teal */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+6) .formula-group-topic {
    color: #155e75; background: #cffafe; border-left-color: #0891b2;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+6) .formula-item-latex {
    border-left-color: #0891b2 !important;
  }

  /* Topic 7 — Pink */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+7) .formula-group-topic {
    color: #831843; background: #fce7f3; border-left-color: #db2777;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+7) .formula-item-latex {
    border-left-color: #db2777 !important;
  }

  /* Topic 8 — Amber */
  body.printing-formula-sheet .formula-group:nth-of-type(8n+8) .formula-group-topic {
    color: #713f12; background: #fef3c7; border-left-color: #ca8a04;
  }
  body.printing-formula-sheet .formula-group:nth-of-type(8n+8) .formula-item-latex {
    border-left-color: #ca8a04 !important;
  }
  body.printing-formula-sheet .formula-provided-tag {
    background: transparent !important;
    color: #1b5e20 !important;
    border: 1px solid #1b5e20 !important;
    font-size: 7pt;
    padding: 0 4px;
  }
  body.printing-formula-sheet .formula-provided-dot {
    background: #1b5e20 !important;
    box-shadow: none !important;
  }
  body.printing-formula-sheet .formula-print-footer {
    display: block;
    margin-top: 4mm;
    padding-top: 2mm;
    border-top: 1px solid #ccc;
    font-size: 8pt;
    color: #333;
    text-align: center;
  }
}

/* === History Practice Questions =========================================== */
/* Full-screen modal that reuses .study-overlay layout. Two visual stages:    */
/* (1) topic-button grid grouped by OCR B module; (2) question card per click.*/

.practice-overlay .study-progress.hidden,
.practice-overlay .study-nav.hidden,
.practice-overlay .practice-filter-row.hidden { display: none; }

.practice-filter-row {
  display: flex;
  gap: 6px;
  margin: 10px 0 0;
}
.practice-filter-btn {
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.practice-filter-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.practice-filter-btn.active {
  background: var(--accent);
  color: #11141a;
  border-color: var(--accent);
}

/* --- Topic grid (stage 1) ------------------------------------------------- */
.practice-module {
  margin: 0 0 22px;
}
.practice-module-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.practice-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.practice-topic-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  font-family: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms, transform 120ms;
}
.practice-topic-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.practice-topic-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.practice-topic-btn .pt-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.practice-topic-btn .pt-stats {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.practice-topic-btn .pt-wrong {
  color: #f08a8a;
}
.practice-topic-btn .pt-build {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.practice-topic-btn .pt-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* --- Question stage (stage 2) -------------------------------------------- */
.practice-q-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 18px 14px;
  margin: 0 0 14px;
}
.practice-q-type-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft, rgba(255, 122, 89, 0.12));
  color: var(--accent);
  margin: 0 0 10px;
}
.practice-q-source {
  background: rgba(217, 168, 109, 0.08);
  border: 1px solid rgba(217, 168, 109, 0.3);
  border-left: 3px solid var(--gold, #d9a86d);
  padding: 12px 14px;
  border-radius: 6px;
  margin: 0 0 14px;
}
.practice-q-source-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold, #d9a86d);
  margin: 0 0 6px;
  font-weight: 700;
}
.practice-q-source-text {
  margin: 0;
  font-style: italic;
  line-height: 1.5;
  font-size: 14.5px;
  color: var(--text);
}
.practice-q-stem {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.45;
}
.practice-q-stem strong { color: var(--accent); }

.practice-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}
/* Single-select option button reuses .option-btn from the pack flow.
   Multi-select needs its own checkbox-flavoured button — same shape, but the
   "Submit" gate is its own affordance. */
.practice-multi-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.practice-multi-option:hover { border-color: var(--accent); }
.practice-multi-option .pmo-box {
  flex: 0 0 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 4px;
  margin-top: 1px;
  position: relative;
  transition: background 120ms, border-color 120ms;
}
.practice-multi-option.selected .pmo-box {
  background: var(--accent);
  border-color: var(--accent);
}
.practice-multi-option.selected .pmo-box::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(45deg, transparent 45%, #11141a 45%, #11141a 55%, transparent 55%),
                    linear-gradient(-45deg, transparent 45%, #11141a 45%, #11141a 55%, transparent 55%);
  background-size: 12px 2px, 12px 2px;
  background-position: 3px 6px, 3px 12px;
  background-repeat: no-repeat;
}
.practice-multi-option:disabled { cursor: default; }
.practice-multi-option.correct {
  background: rgba(110, 231, 168, 0.12);
  border-color: rgba(110, 231, 168, 0.5);
}
.practice-multi-option.wrong {
  background: rgba(240, 138, 138, 0.10);
  border-color: rgba(240, 138, 138, 0.45);
}
.practice-multi-option.missed {
  /* User didn't pick this but it WAS correct — flag in gold so they see it. */
  background: rgba(217, 168, 109, 0.10);
  border-color: rgba(217, 168, 109, 0.5);
}

.practice-submit-btn {
  padding: 12px 18px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #11141a;
  cursor: pointer;
  align-self: flex-start;
}
.practice-submit-btn:disabled {
  opacity: 0.4;
  cursor: default;
  border-color: var(--border);
  background: var(--card);
  color: var(--muted);
}

.practice-feedback {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.practice-feedback.correct {
  background: rgba(110, 231, 168, 0.10);
  border: 1px solid rgba(110, 231, 168, 0.4);
  color: #b8e8c8;
}
.practice-feedback.wrong {
  background: rgba(240, 138, 138, 0.08);
  border: 1px solid rgba(240, 138, 138, 0.4);
  color: #f0c0c0;
}
.practice-feedback-label {
  font-weight: 700;
  margin-right: 6px;
}

.practice-loading,
.practice-empty,
.practice-error {
  text-align: center;
  padding: 40px 20px;
}
.practice-loading h3,
.practice-empty h3,
.practice-error h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.practice-loading p,
.practice-empty p,
.practice-error p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.practice-error h3 { color: #f08a8a; }
.practice-empty .practice-empty-action {
  margin-top: 16px;
}

@media (max-width: 600px) {
  .practice-topic-grid {
    grid-template-columns: 1fr;
  }
}

