/* palette: clean academic (slate ink / paper white / one subject accent)
 *
 * The subject accent (--accent) is the only strong colour on the page. It
 * marks identity - the badge in the top bar, the progress fill, the active
 * nav item - and nothing else. Primary buttons stay ink so that "the thing
 * you press" and "the thing that is wrong" never look alike.
 *
 * Every subject overrides --accent / --accent-2 / --accent-soft with its own
 * colour, so the seven sites read as one family and are still told apart at
 * a glance. */

















:root {
  --ink: #16202e;
  --ink-2: #47566b;
  --ink-3: #5f6e82;
  --line: #e2e8f0;
  --line-2: #f1f4f8;
  --bg: #f6f8fa;
  --card: #ffffff;
  --btn: #16202e;
  --btn-hover: #0d1521;
  --brand: #b23a1f;
  --brand-2: #8e2e19;
  --brand-soft: #fbebe7;
  --hot: #a8124a;
  --hot-soft: #fbe9f0;
  --amber: #8a5a00;
  --amber-soft: #fbeac6;
  --green: #16794c;
  --green-soft: #e6f4ec;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 46, .05), 0 4px 14px rgba(22, 32, 46, .05);
  --shadow-lift: 0 2px 4px rgba(22, 32, 46, .07), 0 12px 30px rgba(22, 32, 46, .10);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
a:hover { color: var(--brand-2); }

.wrap { max-width: 900px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--ink-3); }
.small { font-size: .84rem; }
.lede { font-size: 1.02rem; color: var(--ink-2); max-width: 62ch; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand span {
  background: var(--brand);
  color: #fff;
  font-size: .8rem;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: 2px;
  margin-left: 4px;
  letter-spacing: .02em;
}
/* The nav must never stack into a column. When the row gets tight the
   links scroll sideways instead, the way the phone layout does, so the
   header keeps its shape instead of growing a column of one-word links. */
.nav {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { display: none; }
.navlink {
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
}
.navlink:hover { background: var(--line-2); color: var(--ink); }

/* The top bar now carries a rank chip as well as the nav, so give the nav
   room to breathe before it wraps onto a second line. */
@media (min-width: 900px) {
  .topbar-inner { gap: 12px; }
  .nav { flex-wrap: nowrap; }
  .navlink { padding: 7px 8px; font-size: .85rem; }
  .brand { font-size: .98rem; }
}
.tier-select {
  font: inherit;
  font-size: .84rem;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--ink-2);
}

/* -------------------------------------------------------------- page head */

main { padding: 26px 0 60px; }
/* The page title sits directly under the sticky top bar, so it needs a
   little air of its own - without it the h1 looks welded to the bar. */
.page-head { margin-bottom: 22px; padding-top: 16px; }
.page-head h1 { margin-bottom: .25em; }
.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 12px;
  flex-wrap: wrap;
}
.page-head-row h2 { margin: 0; }
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .86rem;
  margin-bottom: .5em;
  text-decoration: none;
}

/* ------------------------------------------------------- quiz status strip */
.quiz-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 10px 14px;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.quiz-strip .small-btn { margin-top: 0; }

.topic-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 22px;
}
.jump-link {
  font-size: .82rem;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.jump-link:hover { border-color: var(--brand); color: var(--brand); }
/* The question count on each topic link. It is there so that no link is a
   surprise: she knows how much is behind it before she taps it. */
.jump-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Shown when the tier filter had to be relaxed so the page is not empty. */
.tier-note {
  margin: -12px 0 18px;
  padding: 8px 12px;
  border-left: 3px solid var(--brand);
  background: var(--line-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

/* Author `display` rules beat the UA stylesheet's [hidden] rule, so the
   Next-question button would stay visible before a question is answered.
   Force it back to display:none whenever the hidden attribute is set. */
[hidden] { display: none !important; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); color: #fff; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-right { background: var(--green); color: #fff; }
.btn-right:hover { background: #0f5e3a; color: #fff; }
.btn-wrong { background: var(--hot); color: #fff; }
/* The middle of the three-way self-grade. It was used in every
   app.js and defined in no stylesheet, so it rendered as the
   browser's default grey button in the middle of a green-to-red
   scale. Amber sits between the two and stays legible to a
   colour-blind reader (2.57:1 against the green). */
.btn-mid { background: var(--amber); color: #fff; }
.btn-mid:hover { background: #6f4900; color: #fff; }
.btn-wrong:hover { background: #9d1f1f; color: #fff; }
.small-btn { padding: 6px 12px; font-size: .84rem; margin-top: .4em; }

/* ------------------------------------------------------------- progress */

.progress-bar-wrap { margin-bottom: 22px; }
.progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width .3s;
}

/* -------------------------------------------------------------- day cards */

.day-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.day-card.done { border-color: var(--green); }
.day-card.done .day-num { background: var(--brand); color: #fff; }
.day-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  background: var(--line-2);
}
.day-num {
  grid-row: 1 / span 2;
  align-self: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: .82rem;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
}
.day-title { font-weight: 650; font-size: 1.02rem; }
.day-meta { font-size: .86rem; color: var(--ink-3); }
.day-body {
  padding: 4px 18px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.blk h3 {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.blk .mins {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-3);
  font-size: .8rem;
  margin-left: 6px;
}
.blk ul { margin: 0 0 .6em; padding-left: 1.15em; }
.blk li { margin-bottom: .3em; font-size: .92rem; }
.day-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--line-2);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------ topic grid */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.topic-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.topic-tile:hover { border-color: var(--brand); transform: translateY(-1px); color: var(--ink); }
.tile-num {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  font-weight: 700;
}
.tile-title { font-weight: 650; font-size: .98rem; }
.tile-meta { font-size: .8rem; color: var(--ink-3); }

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sn-link {
  font-size: .82rem;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--line-2);
  color: var(--ink-2);
  text-decoration: none;
}
.sn-link:hover { background: var(--brand-soft); color: var(--brand); }

/* -------------------------------------------------------------- sections */

.section-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
/* The section a day's link points at. The plan sends you straight to it, so
   it has to be obvious which one you landed on. */
.section-block.focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow);
}
.section-block.focus .section-head h2 { color: var(--brand); }
.day-sections { line-height: 2; }
.day-sections a {
  display: inline-block;
  padding: 1px 7px;
  margin: 2px 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: .8rem;
  white-space: nowrap;
}
.day-sections a:hover { border-color: var(--brand); color: var(--brand); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 1.12rem; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: .8rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.badge-f { background: var(--line-2); color: var(--ink-2); }
.badge-ht { background: var(--amber-soft); color: var(--amber); }
.badge-phys { background: var(--brand-soft); color: var(--brand); }

.points { display: grid; gap: 14px; }
.point {
  border-left: 3px solid var(--line);
  padding-left: 13px;
}
.point h3 { margin-bottom: .2em; font-size: .97rem; }
.point p { max-width: 68ch; margin-bottom: .5em; font-size: .95rem; color: var(--ink-2); }
.eq {
  font-family: var(--mono);
  font-size: .92rem;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 11px;
  margin: .4em 0;
  overflow-x: auto;
  white-space: pre-wrap;
}
.key-box {
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: .9rem;
  margin: .4em 0;
}
.warn-box {
  background: var(--hot-soft);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: .9rem;
  margin: .4em 0;
  color: var(--hot);
}
.section-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ quiz */

.quiz-bar { margin-bottom: 14px; }
.quiz-progress {
  height: 5px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.quiz-progress span { display: block; height: 100%; background: var(--brand); }

.q-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.q-head { margin-bottom: .5em; }
.q-text { font-size: 1.05rem; margin: 0; font-weight: 500; }

/* The value of the question, sitting on the question itself. A student
   cannot budget her time or judge how much to write without knowing this,
   and it is the thing that turns "I got it wrong" into "I lost two marks
   on Mark 3". */
.q-marks {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* The mark scheme as a list. One mark per line is how an examiner reads
   it, and it is how a student can count what she has. */
.ms-list { margin: 0 0 .8em; padding-left: 0; list-style: none; }
.ms-point {
  display: flex; gap: 10px; align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line-2);
}
.ms-point:first-child { border-top: 0; }
.ms-label {
  flex: none;
  min-width: 74px;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ms-text { font-size: .92rem; color: var(--ink-2); }

/* The score picker. One click gives an exact score, which is no more work
   than the old three-button self-marking and tells the revision plan where
   the marks actually went. */
.score-picker { margin-top: 10px; }
.sp-label { font-size: .84rem; font-weight: 600; margin: 0 0 8px; }
.sp-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.sp-btn {
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  min-width: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.sp-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.sp-btn:disabled { opacity: .45; cursor: default; }
.sp-btn.full { border-color: var(--brand); background: var(--brand-soft); }
.sp-band { margin-bottom: 8px; }
.sp-band-label {
  display: block;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 4px;
}
.sp-ask {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.sp-ask p { margin: 0 0 8px; }
.sp-ask .btn { margin-right: 8px; }

/* ---------------------------------------------------- the marker's verdict */

.ai-wait {
  font-size: .9rem;
  color: var(--ink-2);
  padding: 6px 0;
}
.ai-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--card);
  padding: 12px 14px;
}
.ai-kicker {
  margin: 0;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--brand);
}
.ai-score {
  margin: 2px 0 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
}
.ai-level {
  margin: 0 0 4px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ai-evidence {
  margin: 0 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
  font-size: .9rem;
}
.ai-marks { list-style: none; margin: 0 0 10px; padding: 0; }
.ai-mark {
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--line-2);
}
.ai-mark:first-child { border-top: 0; }
.ai-mark .am-label {
  flex: none;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
  min-width: 58px;
}
.ai-mark .am-verdict { flex: none; font-size: .8rem; font-weight: 700; }
.ai-mark.got .am-verdict { color: var(--brand); }
.ai-mark.miss .am-verdict { color: var(--hot); }
.ai-mark .am-quote {
  flex: 1 1 100%;
  color: var(--ink-2);
  font-size: .88rem;
  font-style: italic;
}
.ai-mark .am-reason {
  flex: 1 1 100%;
  color: var(--ink-3);
  font-size: .82rem;
}
.ai-feedback {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--line-2);
  font-size: .9rem;
  color: var(--ink-2);
}
.ai-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ai-acts .btn { margin-right: 0; }
.q-body { margin-top: 14px; }

.opts { display: grid; gap: 8px; margin-bottom: 12px; }
.opt {
  text-align: left;
  font: inherit;
  font-size: .95rem;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
/* Disabled options used to fall back to the browser's disabled colour
   (rgba(16,16,16,0.3)), which left the correct answer at 1.97:1 on its own
   green background - the highest-value second of the whole site, unreadable.
   Pin the text colour so every option stays legible once it is answered. */
.opt:disabled { cursor: default; color: var(--ink); -webkit-text-fill-color: currentColor; }
.opt:disabled .opt-label { color: var(--ink-2); }
.opt-right {
  border-color: var(--green);
  background: var(--green-soft);
  font-weight: 600;
  /* The redundant, non-colour cue. Colour alone fails a red-green
     colour-blind reader; the thick left bar and the word below both
     survive in greyscale. */
  box-shadow: inset 4px 0 0 var(--green);
}
.opt-wrong {
  border-color: var(--hot);
  background: var(--hot-soft);
  /* Dashed border: a second non-colour cue that needs no hue at all. */
  border-style: dashed;
}
.opt-label {
  display: block;
  margin-top: 5px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.answer-box {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  margin-bottom: 10px;
  font-family: inherit;
}
.answer-box:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.next-btn { margin-top: 14px; }

.feedback { margin-top: 14px; }
.fb-inner { border-radius: 8px; padding: 14px; border: 1px solid var(--line); }
.fb-good { background: var(--green-soft); border-color: var(--green); }
.fb-bad { background: var(--hot-soft); border-color: var(--hot); }
.fb-open { background: var(--line-2); }
.fb-inner h4 { margin-bottom: .4em; }
.ms { font-size: .93rem; margin-bottom: .5em; }
.ans { font-size: .95rem; margin-bottom: .4em; }
.tip { font-size: .88rem; color: var(--ink-2); margin-bottom: .2em; }
.scaffold { margin: .3em 0 .6em; padding-left: 1.2em; font-size: .9rem; }
.scaffold li { margin-bottom: .2em; }

.quiz-done {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow);
}
.score-big { font-size: 2.4rem; font-weight: 700; margin: .2em 0; }
.score-big span { font-size: 1.1rem; color: var(--ink-3); font-weight: 500; }
.quiz-done .btn { margin: 0 5px; }

/* ------------------------------------------------------------ flashcards */

.card-stage { max-width: 560px; margin: 0 auto; }
.flashcard {
  position: relative;
  min-height: 220px;
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 16px;
}
.fc-face {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  box-shadow: var(--shadow);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  transition: opacity .18s;
}
.fc-back { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.flashcard.flipped .fc-front { opacity: 0; }
.flashcard.flipped .fc-back { opacity: 1; }
.fc-q { font-size: 1.06rem; font-weight: 600; margin-bottom: .5em; }
.fc-a { font-size: 1rem; margin-bottom: .6em; }
.fc-bar { text-align: center; margin-bottom: 14px; }
.fc-btns { display: flex; gap: 10px; justify-content: center; }
.fc-btns .btn { flex: 1; max-width: 200px; }

/* -------------------------------------------------------------- mistakes */

.empty-state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
}
.mistake-group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.mistake-group h3 { font-size: .95rem; color: var(--brand); }
.mistake-item {
  border-left: 3px solid var(--hot);
  padding: 8px 0 8px 13px;
  margin-bottom: 10px;
}
.mistake-item:last-child { margin-bottom: 0; }
.mq { font-weight: 500; margin-bottom: .3em; }
.ms { font-size: .9rem; color: var(--ink-2); margin-bottom: .2em; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 9px 18px;
  border-radius: 99px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

.footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 22px 0 34px;
  font-size: .84rem;
  color: var(--ink-3);
}
.footer p { margin: 0 0 .3em; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .day-body { grid-template-columns: 1fr; gap: 14px; }
  .topbar-inner { min-height: auto; padding: 10px 18px; }
  .nav { order: 3; width: 100%; }
  .tier-select { margin-left: auto; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* ------------------------------------------------------------------ print */

@media print {
  .topbar, .footer, .day-foot, .nav, .tier-select, .btn,
  .setup-overlay, .toast { display: none !important; }
  body { background: #fff; }
  .day-card, .section-block { break-inside: avoid; box-shadow: none; border-color: #ccc; }
  .day-body { grid-template-columns: 1fr 1fr; }
}


/* --------------------------------------------- self-marking a long answer
   Long answers are marked by the student, so the site asks them how they
   did. Without this the site cannot tell a right answer from a wrong one. */
.self-grade {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--line-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.self-grade p { margin: 0 0 9px; }
.self-grade .btn { margin-right: 8px; }
/* ==========================================================================
   Progress layer — welcome screen, today panel, profile chip, study
   calendar.

   This replaces the old expedition layer (characters, ranks, streaks,
   badges, the supply depot). The rule for this file is simple: every
   colour that appears must mean something, and every number must be a
   thing that actually happened. No points, no levels, no shop.
   ========================================================================== */

/* Shared headings. The core site uses these two classes, so they live
   here rather than being redefined in seven places. */
.section-title {
  font-size: 1.12rem;
  margin: 1.9em 0 .7em;
  padding-bottom: .35em;
  border-bottom: 2px solid var(--line-2);
}
.section-title.small { font-size: .95rem; margin-top: 1.3em; }
.small-note { font-size: .88rem; color: var(--ink-3); max-width: 68ch; }

/* A visible focus ring, everywhere. Keyboard users navigate this site a
   lot: it is full of links into the plan and back out again. */
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Buttons get a little physical feedback. */
.btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .btn, .btn:active { transition: none; transform: none; }
}

/* --------------------------------------------------------------- topbar */

/* The top bar carries the subject code, the nav, the tier filter and the
   profile button. That is four things, so the row has to stay tight and
   the nav has to be allowed to shrink before anything wraps. */
@media (min-width: 900px) {
  .topbar-inner { gap: 12px; }
  .nav { flex-wrap: nowrap; }
  .navlink { padding: 7px 9px; font-size: .85rem; }
  .brand { font-size: .98rem; }
}

/* Between the phone layout and the desktop one there is not enough room
   for the nav to share the row with the subject name, the tier filter and
   the profile button. It takes a row of its own there: those three stay
   on the first row and the links sit underneath, scrolling sideways if the
   window is narrower than the links. */
@media (min-width: 621px) and (max-width: 899px) {
  .topbar-inner { gap: 10px 12px; }
  .brand { order: 1; }
  .tier-select { order: 2; margin-left: auto; }
  .profile-chip { order: 3; }
  .nav { order: 4; flex: 0 0 100%; width: 100%; }
}

/* Where you are. Without this the nav gives no sense of place, and the
   plan is a long page with a lot of links. */
.navlink.on {
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--brand);
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color .12s, background .12s;
}
.profile-chip:hover { border-color: var(--ink-3); background: var(--line-2); }
.pc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.pc-name { font-size: .86rem; font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------- the welcome */

.setup-overlay {
  position: fixed;
  inset: 0;
  /* Above the tutor's floating button (z-index 8000) and the tutor panel
     (9000), so the welcome screen is never half-covered by either. */
  z-index: 9500;
  background: rgba(22, 32, 46, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  overflow-y: auto;
}
.setup-panel {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 16px;
  padding: 26px 26px 20px;
  box-shadow: 0 24px 60px rgba(22, 32, 46, .28);
}
.setup-panel.narrow { max-width: 460px; }

.setup-head { margin-bottom: 20px; }
.setup-kicker {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin: 0 0 .5em;
}
.setup-title {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 .35em;
  letter-spacing: -.015em;
}
.setup-title.small { font-size: 1.25rem; }
.setup-lede { font-size: .96rem; color: var(--ink-2); margin: 0; max-width: 46ch; }

.setup-h {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin: 22px 0 .6em;
}
.setup-note { font-size: .85rem; color: var(--ink-3); margin: 0 0 .7em; }

.setup-name-row { display: flex; gap: 8px; }
.setup-input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
.setup-input::placeholder { color: var(--ink-3); }
.setup-input:focus { border-color: var(--brand); }

.focus-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.focus-pick {
  font: inherit;
  font-size: .85rem;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s, background .12s, color .12s;
}
.focus-pick:hover { border-color: var(--ink-3); color: var(--ink); }
.focus-pick.on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-2);
  font-weight: 600;
}
.focus-pick b { font-weight: 700; margin-right: 4px; }

.setup-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
  display: flex;
  gap: 10px;
  align-items: center;
}
.setup-foot.row { justify-content: space-between; }
.setup-go { min-width: 160px; text-align: center; }
.setup-fineprint {
  font-size: .8rem;
  color: var(--ink-3);
  margin: 14px 0 0;
  line-height: 1.5;
}

/* ---------------------------------------------------------- the profiles */

.acct-list { display: flex; flex-direction: column; gap: 8px; }
.acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.acct-row.current { border-color: var(--brand); background: var(--brand-soft); }
.ac-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--line-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
}
.acct-row.current .ac-avatar { background: var(--card); color: var(--brand-2); }
.ac-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ac-name { font-weight: 600; font-size: .95rem; }
.ac-meta { font-size: .8rem; color: var(--ink-3); }
.ac-actions { flex: 0 0 auto; }
.ac-here {
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* --------------------------------------------------------- today panel */

.today-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.tp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 4px;
}
.tp-title { font-size: 1.2rem; margin: 0; letter-spacing: -.01em; }
.tp-date { font-size: .84rem; color: var(--ink-3); }

.tp-list { display: flex; flex-direction: column; }
.tp-action {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-2);
}
.tp-action:last-child { border-bottom: 0; }
.tp-n {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: .8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.tp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tp-atitle { font-weight: 650; font-size: 1rem; line-height: 1.35; }
.tp-atext { font-size: .89rem; color: var(--ink-2); }
.tp-btn { flex: 0 0 auto; align-self: center; white-space: nowrap; }

.tp-empty { padding: 18px 0 4px; }
.tp-empty-title { font-weight: 650; font-size: 1.02rem; margin: 0 0 .3em; }

/* ----------------------------------------------------------- the numbers */

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-top: 16px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  flex: 1 1 110px;
  background: var(--card);
  padding: 11px 13px;
  min-width: 0;
}
.stat-n {
  display: block;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-note { font-size: .8rem; font-weight: 600; color: var(--ink-3); }
.stat-l {
  display: block;
  font-size: .8rem;
  color: var(--ink-3);
  letter-spacing: .02em;
  line-height: 1.35;
}

/* ------------------------------------------------------ the study calendar */

.cal-wrap { margin-top: 0; }
.tp-lower { display: block; }
.tp-lower .stat-strip { margin-top: 16px; }
.tp-lower .cal-wrap { margin-top: 20px; }
.tp-lower .cal-wrap .section-title.small { margin-top: 0; margin-bottom: .5em; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 14px);
  grid-auto-rows: 14px;
  gap: 4px;
  justify-content: start;
}
.cal-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #f1f5f9;
}
/* One ramp, one colour. The grid records how many questions were answered
   on a day; it does not score the day, and it does not colour a busy day
   differently from a quiet one in a way that reads as a reward. */
.cal-cell.on.l1 { background: #e9eef4; }
.cal-cell.on.l2 { background: #d2dae4; }
.cal-cell.on.l3 { background: #aebbcb; }
.cal-cell.on.l4 { background: #5b6a80; }
.cal-cell.future { background: transparent; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 620px) {
  /* The top bar is sticky, so every row it costs is a row of the screen
     the student cannot read. The nav becomes one scrolling strip instead of
     three wrapped lines, and the profile button sits at the right of it. */
  .nav {
    order: 3;
    flex: 0 1 auto;
    /* max-width, not width: the strip is as long as it needs to be, but
       never so long that it pushes the profile button onto a third row. */
    max-width: calc(100% - 142px);
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .navlink { padding: 6px 9px; font-size: .82rem; }
  .profile-chip { order: 4; flex: 0 0 auto; max-width: 120px; }
  .pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tier-select { order: 2; flex: 0 0 auto; }

  .setup-overlay { align-items: flex-start; padding: 0; }
  .setup-panel {
    max-width: none;
    border-radius: 0;
    min-height: 100%;
    padding: 24px 18px 72px;
  }
  .setup-title { font-size: 1.4rem; }
  .tp-action { flex-wrap: wrap; }
  .tp-btn { width: 100%; text-align: center; margin-top: 4px; }
  .today-panel { padding: 16px; }
  .stat { flex: 1 1 calc(50% - 1px); }
  .cal-grid { grid-template-columns: repeat(7, 12px); grid-auto-rows: 12px; }
  .cal-cell { width: 12px; height: 12px; }
  /* Touch targets. A fingertip needs about 44px; anything smaller is a
     guess, and on a phone a guess costs a mis-tap or a miss. */
  .navlink,
  .tier-select,
  .jump-link,
  .sn-link,
  .focus-pick,
  .fc-mini,
  .profile-chip,
  .acct-chip { min-height: 44px; }
  /* The brand is the way back to the hub, and it was only 27px high - the
     one control in the top bar that a fingertip could miss. It is centred
     in its 44px so the text does not float at the top of the box. */
  .brand { align-items: center; }
  /* The backup button drops its words on a phone and is left with just an
     icon, which made it 34px wide. */
  .acct-chip { min-width: 44px; justify-content: center; }
  /* "All topics", at the top of a topic page, is a way back that a
     fingertip used to miss as well. */
  .back { min-height: 44px; display: inline-flex; align-items: center; }
  .navlink,
  .jump-link,
  .sn-link,
  .focus-pick,
  .fc-mini {
    display: inline-flex;
    align-items: center;
  }
  .jump-link { padding: 11px 13px; }
  .sn-link { padding: 11px 12px; }
  .focus-pick { padding: 11px 12px; }
  .fc-mini { padding: 11px 12px; }
  .tier-select { padding: 10px 9px; }
  .profile-chip { padding: 7px 12px 7px 7px; }
  /* The sticky bar is charged against every screen of reading. On a
     phone it used to wrap onto three rows and cost 152px of an 844px
     viewport. The tier selector now sits on the first row with the
     brand, and the nav strip and the profile button share the second. */
  /* The card padding comes off on a phone, so the line is not much
     narrower than the screen allows. */
  .section-block { padding: 16px 12px; }
  .topbar-inner { gap: 8px; }
  .brand { order: 1; max-width: 148px; }
  /* "GCSE" is on every page already; on a phone the space is worth more
     to the nav strip than to the word. */
  .brand-gcse { display: none; }
  .nav {
    order: 2;
    flex: 0 1 auto;
    width: auto;
    /* The cap is what makes the bar wrap into two rows instead of three:
       the flex line is broken on the item's hypothetical width, so an
       uncapped nav strip would push the profile button onto a third row. */
    max-width: 195px;
    min-width: 0;
  }
  /* The tier selector shares the second row with the profile button, so
     the nav strip gets the whole first one. */
  .tier-select { order: 3; margin-left: 0; }
  .profile-chip { order: 4; }
  .acct-chip { order: 5; }
  /* The tutor button floats over the bottom of the page, so the footer
     has to end above it. */
  .footer { padding-bottom: 84px; }
}

@media print {
  .setup-overlay, .today-panel, .cal-wrap { display: none !important; }
}

/* --------------------------------------------- section index anchors
   The index at the top of a topic page jumps to the section it names. Two
   things go with that: the section needs an id to land on, and the index
   entry for the section being read is marked so the page says where you
   landed. The room left for the sticky top bar is worked out in the script,
   because the bar is a different height on a phone. */
.section-block.focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow);
}
.section-block.focus .section-head h2 { color: var(--brand); }
.sn-link.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ------------------------------------- flashcards: choosing which topics */

.fc-topics { max-width: 560px; margin: 0 auto 18px; }
.fc-topics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
}
.fc-topics-sum { font-size: .9rem; color: var(--ink-2); }
.fc-topics-sum b { color: var(--ink); font-weight: 700; }
.fc-topics-acts { display: flex; gap: 6px; flex: none; }
.fc-mini {
  font: inherit;
  font-size: .82rem;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, background .12s, color .12s;
}
.fc-mini:hover { border-color: var(--ink-3); color: var(--ink); }
.fc-mini.on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-2);
  font-weight: 600;
}

.fc-topics-panel {
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
}
.fc-topics-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 330px;
  overflow-y: auto;
}
.fc-topic {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--ink-2);
}
.fc-topic:hover { background: var(--line-2); }
.fc-topic.on { color: var(--ink); }
.fc-topic-cb {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.fc-topic-cb:disabled { cursor: default; opacity: .45; }
.fc-topic-code {
  flex: none;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.fc-topic.on .fc-topic-code { color: var(--brand-2); }
.fc-topic-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-topic-n {
  flex: none;
  font-size: .8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.fc-topics-bulk {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}

/* ---------------------------------------------- GCSE HUB NAV + IDENTITY
   The way back to the hub, and the name we already know.

   Every subject links back to the revision hub, so moving between subjects
   is one click instead of the browser's back button. And the welcome
   screen only asks for a name when it does not already know one. */

.navlink-hub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--ink);
  margin-right: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
}
.navlink-hub::before { content: '\2190'; font-weight: 700; }
.navlink-hub:hover { background: var(--line-2); color: var(--brand-2); }
.brand { cursor: pointer; }
.brand:hover { color: var(--brand-2); }

.setup-known {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--brand);
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: .95rem;
}
.setup-known-mark { color: var(--brand-2); font-weight: 700; }
.setup-known-text b { font-weight: 700; }
.setup-known-change {
  margin-left: auto;
  font: inherit;
  font-size: .84rem;
  color: var(--brand-2);
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  text-decoration: underline;
}
.setup-known-change:hover { color: var(--ink); }
