/* Look and feel follows orac2.info (the AIO's own training site): a charcoal
   top bar, white page, Arial headings with a grey bar on h2, serif reading text,
   blue links. Light only, whatever the computer's dark-mode setting: the iframe
   and form controls follow `color-scheme`, so they stay light too.

   Fonts are served from this app (CSP font-src 'self'), under the SIL Open Font
   License (fonts/OFL-*.txt). Noto Serif is Droid Serif's successor, the face
   ORAC uses, with lining figures so numbers in maths sit level. JetBrains Mono
   keeps 0/O and 1/l/I apart; its ligatures are switched off so `>=` and `!=`
   show as she types them, never as ≥ or ≠. */
@font-face { font-family: "Noto Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/noto-serif-latin-400-normal.e99d66d6b97c.woff2") format("woff2"); }
@font-face { font-family: "Noto Serif"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/noto-serif-latin-700-normal.4c107a44b004.woff2") format("woff2"); }
@font-face { font-family: "Noto Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/noto-serif-latin-400-italic.882c6b9ae38e.woff2") format("woff2"); }
/* Noto Serif has no arrows or ≤ ≥ ≠, so a 5 KB cut of Noto Sans Math supplies
   just those (pyftsubset --unicodes=U+2190-2199,U+21D0-21D4,U+2212,U+221A,
   U+221E,U+2248,U+2260-2265,U+22C5). Without it "level → yes" borrows a tiny
   arrow from whatever serif the computer has. */
@font-face { font-family: "Lesson Symbols"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/lesson-symbols.6e9199ee4e07.woff2") format("woff2");
  unicode-range: U+2190-2199, U+21D0-21D4, U+2212, U+221A, U+221E, U+2248, U+2260-2265, U+22C5; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-400-normal.caf0dfde4e44.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-700-normal.69002db50656.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #ffffff; --fg: #212529; --muted: #5c636a; --line: #dee2e6; --field-line: #ced4da;
  --card: #ffffff; --accent: #0b5ed7; --link: #0a58ca; --link-hover: #084298;
  --warn: #b02a37; --ok: #146c43;
  --nav: #343a40; --rule: #c2c1c1;
  --info-bg: #d1ecf1; --info-line: #bee5eb; --info-fg: #0c5460;
  --code-bg: #f6f8fa; --code-line: #d0d7de; --code-fg: #1f2328;
  --focus: rgba(13, 110, 253, .35);
  --serif: "Noto Serif", "Lesson Symbols", "Droid Serif", "Noto Serif SC", "Songti SC", serif;
  --sans: "Helvetica Neue", Arial, "Lesson Symbols", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
/* `hidden` always wins, even over a class that sets display (the save bar). */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.65 var(--serif); font-variant-numeric: lining-nums;
}
a, a:visited { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 20px;
  background: var(--nav); color: #fff;
}
.topbar .brand, .topbar .brand:visited { color: #fff; font-size: 20px; text-decoration: none; }
.who { margin-left: auto; color: rgba(255, 255, 255, .78); font-size: 15px; }
.role {
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 10px; padding: 0 8px;
  margin-left: 6px; font-size: 13px;
}
.logout-form { margin: 0; }
.topbar button.linkish { color: rgba(255, 255, 255, .85); text-decoration: none; font-size: 15px; }
.topbar button.linkish:hover { color: #fff; text-decoration: underline; }
main { padding: 24px 16px 48px; }
.lesson, .narrow { max-width: 880px; margin: 0 auto; }
.narrow { max-width: 400px; }
h1, h2, h3 { font-family: var(--sans); font-weight: 700; line-height: 1.25; }
h1 { font-size: 30px; margin: 10px 0 12px; }
/* ORAC's h2: a grey bar down the left. */
h2 { font-size: 21px; margin: 0 0 10px; padding-left: 10px; border-left: 6px solid var(--rule); }
h3 { font-size: 16px; margin: 16px 0 6px; color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 18px 20px; margin: 18px 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.muted { color: var(--muted); font-size: 15px; }
.err, .warn { color: var(--warn); }
/* Her lesson notes read as ORAC's info boxes: full size, not grey small print. */
.notes {
  color: var(--info-fg); background: var(--info-bg); border: 1px solid var(--info-line);
  border-radius: 6px; padding: 12px 18px 12px 38px; font-size: 16px;
}
.notes li + li { margin-top: 6px; }
.prewrap { white-space: pre-wrap; }
.statement { white-space: pre-wrap; }
.illustration { margin: 6px 0 14px; }
.illustration img { display: block; max-width: 100%; height: auto; }
.ask { color: var(--link); font-size: 16px; margin: 2px 0; }
label.q { display: block; margin: 12px 0 4px; font-size: 16px; color: var(--fg); }
textarea, input[type=text], input[type=password], select {
  width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--field-line);
  border-radius: 4px; background: #fff; color: var(--fg);
  font: inherit; font-size: 16px; line-height: 1.5;
}
textarea:focus, input[type=text]:focus, input[type=password]:focus, select:focus {
  outline: none; border-color: #86b7fe; box-shadow: 0 0 0 4px var(--focus);
}

/* Code: one face everywhere, larger than the 13px browsers default to, with
   the line height of an editor. */
textarea.mono, pre, code, .mono, .choiceLabel {
  font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
textarea.mono, pre, .mono { font-size: 15px; line-height: 1.55; }
textarea.code { min-height: 220px; tab-size: 4; }
pre {
  background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--code-line);
  border-radius: 6px; padding: 10px 12px; overflow: auto; white-space: pre-wrap;
  margin: 6px 0; tab-size: 4;
}
/* Code inside a sentence, from `backticks` in the lesson text. */
code {
  font-size: .9em; color: var(--code-fg); background: var(--code-bg);
  border: 1px solid var(--code-line); border-radius: 4px; padding: .05em .35em;
}
pre code { font-size: inherit; background: none; border: 0; padding: 0; }
pre.mini { max-height: 110px; font-size: 13.5px; }
/* The snippet a multiple-choice question asks about. Not editable, and it
   must not read as an input box, or she will try to type in it. */
pre.snippet { font-size: 16px; line-height: 1.55; padding: 12px 14px; }

/* Multiple choice. Big hit targets: she may be on a laptop trackpad, and a
   mis-click that silently changes a saved answer is worse than a slow one. */
.choices { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
label.choice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 6px;
  cursor: pointer; background: #fff;
}
label.choice:hover { border-color: var(--accent); background: #f8fbff; }
label.choice input {
  margin: 4px 0 0; flex: none; width: 18px; height: 18px; cursor: pointer;
  accent-color: var(--accent);
}
label.choice:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
/* The picked option is marked by position and weight, never by colour alone,
   and never with a right/wrong cue. */
label.choice:has(input:checked) { border-color: var(--accent); background: #e7f1ff; font-weight: 700; }
.choiceLabel { white-space: pre-wrap; font-size: 15px; line-height: 1.55; }

/* Teacher page only: her pick resolved against the key. The word carries the
   verdict, so this still reads correctly without colour. */
.mcqline { margin: 4px 0; }
.mcqmark {
  font-family: var(--sans); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; margin-right: 8px;
}
.mcq-right .mcqmark { color: var(--ok); border-color: var(--ok); }
.mcq-wrong .mcqmark { color: var(--warn); border-color: var(--warn); }

/* The per-input saved line. Empty most of the time, so it must not reserve
   space and make the page jump as it appears and clears. */
.fieldState { display: block; font-size: 14px; min-height: 1.2em; margin: 2px 0 0; }
.fieldState.ok { color: var(--ok); }
.fieldState.bad { color: var(--warn); font-weight: 700; }
/* Submit's check: one line per example. */
.exampleResults { list-style: none; padding: 0; margin: 8px 0 0; }
.exampleResults li { margin: 3px 0; }
.exampleResults li.ok { color: var(--ok); }
.exampleResults li.bad { color: var(--warn); font-weight: 700; }
/* A hidden test that went wrong: its input, for her to work out by hand. */
.exampleResults li.hiddenFail { color: var(--fg); }
.exampleResults li.hiddenFail pre { margin: 4px 0; max-height: 14em; overflow: auto; }
/* Teacher page: the hidden tests one attempt got right or wrong. */
.hiddenline { margin: 4px 0; font-weight: 700; }
.hiddenline.hidden-ok { color: var(--ok); }
.hiddenline.hidden-bad { color: var(--warn); }

button {
  font-family: var(--sans); font-size: 15px; line-height: 1.4; padding: 8px 16px;
  border-radius: 4px; border: 1px solid var(--field-line); background: #f8f9fa;
  color: var(--fg); cursor: pointer;
}
button:hover:not(:disabled) { background: #e9ecef; border-color: #adb5bd; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--link); border-color: var(--link); }
button:disabled { opacity: .55; cursor: default; }
button.linkish {
  border: 0; background: none; color: var(--link); padding: 2px 4px;
  text-decoration: underline; cursor: pointer;
}
button.linkish:hover:not(:disabled) { background: none; color: var(--link-hover); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.savebar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 14px; margin: 12px 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.state { font-family: var(--sans); font-size: 15px; font-weight: 700; }
.state.idle { color: var(--muted); }
.state.saving { color: var(--accent); }
.state.saved { color: var(--ok); }
.state.failed { color: var(--warn); }
.tag {
  font-family: var(--sans); font-size: 13px; font-weight: 400; color: #495057;
  background: #f1f3f5; border: 1px solid var(--line); border-radius: 10px;
  padding: 1px 8px; margin-left: 6px; vertical-align: middle;
}
.warn-tag { color: var(--warn); border-color: var(--warn); background: #fff; }
.samples { display: flex; flex-wrap: wrap; gap: 0 14px; }
.samples > h3 { flex-basis: 100%; margin-bottom: 0; }
.sample { flex: 1 1 240px; }
.sample .label, .label {
  font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 6px;
}
iframe#runnerFrame {
  width: 100%; height: 56px; border: 1px solid var(--line); border-radius: 6px;
  color-scheme: light;
}
.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
/* ORAC's tables: a charcoal header row. */
.grid thead th { background: var(--nav); color: #fff; font-family: var(--sans); font-weight: 700; border-bottom: 0; }
.grid.small { font-size: 14px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.attempt { border-left: 3px solid var(--line); padding-left: 12px; margin: 10px 0; }
.events { font-size: 15px; padding-left: 18px; }
.kv dt { font-family: var(--sans); font-weight: 700; font-size: 14px; margin-top: 8px; }
.kv dd { margin: 0 0 4px; font-size: 15px; }
.conflict { border: 1px solid var(--warn); border-radius: 6px; padding: 12px; margin-top: 12px; }
.teacher-only { margin-top: 12px; border: 1px dashed var(--warn); border-radius: 6px; padding: 10px; }
.teacher-only summary { cursor: pointer; color: var(--warn); font-size: 15px; }
.dim { display: inline-flex; flex-direction: column; font-size: 14px; color: var(--muted); width: 64px; }
.feedback p { margin: 6px 0; }

/* Teacher: ORAC starter coverage. */
.lesson.wide { max-width: 1120px; }
.coverage-big { font-family: var(--sans); font-size: 20px; }
.coverage-num { font-size: 34px; font-weight: 700; }
.coverage-bar {
  position: relative; height: 14px; margin: 10px 0 8px; border-radius: 7px;
  background: #e9ecef; overflow: hidden;
}
.coverage-bar span { position: absolute; top: 0; bottom: 0; left: 0; }
.coverage-bar-planned { background: #b6d4fe; }
.coverage-bar-done { background: var(--ok); z-index: 1; }
.coverage-legend { margin: 0; font-size: 15px; }
.cov {
  display: inline-block; font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  border-radius: 10px; padding: 1px 8px; border: 1px solid transparent; white-space: nowrap;
}
.cov-same { background: var(--ok); color: #fff; }
.cov-similar { background: #fff; color: var(--ok); border-color: var(--ok); }
.cov-planned { background: #e7f1ff; color: var(--link-hover); border-color: #b6d4fe; }
.cov-ready { background: #fff; color: var(--link-hover); border-color: #b6d4fe; font-weight: 400; }
.cov-checkpoint { background: #f1f3f5; color: #495057; border-color: var(--line); }
.cov-gap { background: #fff; color: var(--warn); border-color: var(--warn); }
.grid.coverage td { font-size: 14.5px; }
.cov-taught { background: #fff; color: var(--ok); border-color: var(--ok); }
/* Knowledge points: Python in blue, the logic (method) in amber. */
.kp-checks { margin: 12px 0 0; padding: 0; list-style: none; font-family: var(--sans); font-size: 15px; }
.kp-checks li { margin: 3px 0; }
.kp-checks .ok { color: var(--ok); }
.kp-checks .bad { color: var(--warn); font-weight: 700; }
.kp-nav { margin: 12px 0 0; font-family: var(--sans); font-size: 15px; }
.kp-sets-head { margin-top: 28px; }
.kp {
  display: inline-block; margin: 2px 4px 2px 0; padding: 1px 8px; border: 1px solid;
  border-radius: 10px; font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
}
.kp code { font-size: 12.5px; background: none; border: 0; padding: 0; color: inherit; }
.kp-python { background: #e7f1ff; border-color: #b6d4fe; color: #084298; }
.kp-logic { background: #fff3cd; border-color: #ffe69c; color: #664d03; }
.kp-code { font-weight: 700; }
.kp-when { color: #495057; font-size: 12.5px; }
.kp-late { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.kp-line { margin-top: 6px; }
.kp-head {
  display: inline-block; min-width: 52px; font-family: var(--sans); font-size: 11.5px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6c757d;
}
.kp-problem + .kp-problem { margin-top: 8px; }
.kp-c {
  display: inline-block; padding: 0 5px; border-radius: 4px; font-family: var(--mono);
  font-size: 12.5px; color: #6c757d; background: #f1f3f5;
}
.kp-c.kp-new.kp-python { background: #cfe2ff; color: #084298; font-weight: 700; }
.kp-c.kp-new.kp-logic { background: #ffe69c; color: #664d03; font-weight: 700; }
.kp-family th { background: #f1f3f5; font-family: var(--sans); font-size: 14px; }
.kp-lessons td:nth-child(2) { min-width: 300px; }
.kp-lessons td:nth-child(4) { min-width: 220px; }
.kp-points td:first-child { min-width: 200px; }
.kp-points td:nth-child(3), .kp-points td:nth-child(4) { min-width: 210px; }
.kp-points td:nth-child(5) { min-width: 200px; }
.table-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.res { font-family: var(--sans); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.res-passed, .res-passed:visited { color: var(--ok); }
.res-wrong, .res-wrong:visited { color: var(--warn); }
.res-submitted, .res-submitted:visited, .res-ran, .res-ran:visited { color: #495057; }
.res-none, .res-none:visited { color: var(--muted); font-weight: 400; }
@media (max-width: 700px) {
  main { padding: 16px 16px 40px; }
  .topbar { padding: 6px 16px; }
  .card { padding: 14px 14px; }
  .cols { grid-template-columns: 1fr; }
}

/* --- non-production environment banner ----------------------------------- */
/* Shown only when the environment is not production. Deliberately loud: the
   staging hostname is one word from production, and answers entered here do not
   count. Sticky so it stays visible while scrolling a long lesson page. */
.envbanner {
  position: sticky; top: 0; z-index: 20;
  background: #7c2d12; color: #fff;
  padding: 7px 16px; font-size: 14px; line-height: 1.45;
  border-bottom: 3px solid #fdba74;
  /* diagonal hazard stripes, kept subtle enough to read text over */
  background-image: repeating-linear-gradient(
    135deg, rgba(255,255,255,.08) 0 10px, rgba(255,255,255,0) 10px 20px);
}
.envbanner strong { letter-spacing: .04em; }
.envbanner-sub { display: block; font-size: 13px; opacity: .92; }
.envbanner code {
  color: #fff; background: rgba(255,255,255,.18); border: 0; padding: 0 4px; border-radius: 4px;
}
/* The save-status bar is also sticky; offset it so the two do not overlap. */
.has-env-banner .savebar { top: 56px; }
@media (max-width: 700px) { .has-env-banner .savebar { top: 72px; } }
@media (prefers-reduced-motion: reduce) { .envbanner { background-image: none; } }

/* Progress: one chip per question, on "My lessons" and at the top of a lesson.
   Each links to its question. The colour repeats the word, never replaces it. */
.progress-summary { font-family: var(--sans); font-size: 16px; margin: 6px 0; }
.progress-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 8px 0 10px; }
a.prog, a.prog:visited {
  display: inline-block; font-family: var(--sans); font-size: 14px; line-height: 1.4;
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none;
}
a.prog:hover { text-decoration: underline; }
a.prog-right, a.prog-right:visited { color: #fff; background: var(--ok); border-color: var(--ok); }
a.prog-wrong, a.prog-wrong:visited { color: var(--warn); background: #fff5f5; border-color: var(--warn); }
a.prog-unchecked, a.prog-unchecked:visited { color: #7a4a00; background: #fff8e1; border-color: #e0a800; }
a.prog-answered, a.prog-answered:visited { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-line); }
a.prog-started, a.prog-started:visited { color: #495057; background: #f1f3f5; border-color: #adb5bd; }
a.prog-none, a.prog-none:visited { color: var(--muted); background: #fff; border-style: dashed; border-color: var(--field-line); }
.toTop, .toTop:visited { display: inline-block; margin-top: 12px; font-family: var(--sans); font-size: 14px; }

/* Python's state, at the top of a lesson and next to every Run button. */
.py { font-family: var(--sans); font-size: 15px; margin: 0 0 6px; }
.row .py { font-size: 14px; margin: 0; }
.py-loading { color: var(--muted); }
.py-ready { color: var(--ok); }
.py-failed { color: var(--warn); font-weight: 700; }
.py-ready::before, .py-loading::before, .py-failed::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; background: currentColor;
}
.py-loading::before { background: none; border: 2px solid currentColor; width: 6px; height: 6px; }
/* Teacher page: a load that failed or was too slow. */
tr.py-bad td { color: var(--warn); }

/* Every code question: 1 plan it, 2 trace it, 3 code it. Always open. */
.thinking { margin-top: 14px; }
.thinkHint { display: block; font-size: 14px; line-height: 1.5; margin-top: 2px; }
textarea.trace { font-size: 14.5px; }
/* Teacher page: her plan and trace, as she typed them. */
pre.thought { white-space: pre-wrap; font-size: 14.5px; }
