/* MIF Study Hub: transit-system wayfinding. Each course is a line, sessions are stops, deadlines are departures.
   Dark "night platform" by default (evening study); light "daytime signage" on request. */

@font-face { font-family: "Barlow"; src: url("fonts/Barlow-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/BarlowCondensed-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* night platform */
  --ground: #0e1217;
  --panel: #141a21;
  --raised: #1b232c;
  --rule: #27313c;
  --rule-strong: #3a4654;
  --ink: #e9eef3;
  --ink-2: #a7b2be;
  --ink-3: #8592a0;
  /* lines (after the Riyadh Metro set) */
  --blue: #5aa2ff;
  --green: #3fd08f;
  --orange: #ff9d45;
  --purple: #b993ff;
  --grey: #66717d;
  /* status: reserved, never a course */
  --red: #ff6b6b;
  --yellow: #ffd23f;
  --on-line: #0a0e12;
  --on-status: #0a0e12;
  --focus: #ffd23f;
  --yellow-ink: #ffd23f;
  --line: var(--blue);
  --sans: "Barlow", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Barlow Condensed", "Barlow", ui-sans-serif, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 6px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* daytime signage */
  --ground: #f2f4f6;
  --panel: #ffffff;
  --raised: #e9edf1;
  --rule: #d4dae0;
  --rule-strong: #b7c0c9;
  --ink: #0f1419;
  --ink-2: #485461;
  --ink-3: #5b6774;
  --blue: #1462d6;
  --green: #0a8050;
  --orange: #c0560a;
  --purple: #7442c4;
  --grey: #87919b;
  --red: #c42828;
  --yellow: #ffcf2e;
  --on-line: #ffffff;
  --on-status: #1a1400;
  --focus: #1462d6;
  --yellow-ink: #8a6200;
  color-scheme: light;
}
.c711 { --line: var(--blue); } .c712 { --line: var(--green); } .clead { --line: var(--orange); } .cornt { --line: var(--purple); } .cother { --line: var(--grey); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--rule-strong) var(--ground); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.5 var(--sans); caret-color: var(--line); -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--line) 38%, transparent); color: var(--ink); }
a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--line) 70%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--line); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
.num, time, .tnum { font-variant-numeric: tabular-nums lining-nums; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico.sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--ground); border-bottom: 1px solid var(--rule); }
.top-row { display: flex; align-items: center; gap: 10px; height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 20px/1 var(--cond); letter-spacing: .01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.spacer { flex: 1; }
.hbtn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid var(--rule); background: var(--panel); border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.hbtn:hover { border-color: var(--rule-strong); }
.hbtn.running { border-color: var(--line); color: var(--ink); }
.hbtn.running .ico { color: var(--line); }
.hbtn.icon-only { width: 36px; padding: 0; justify-content: center; }

main { padding: 28px 0 96px; }
h1 { font: 600 36px/1.08 var(--cond); letter-spacing: -.005em; margin: 0; text-wrap: balance; }
h2 { font: 600 22px/1.2 var(--cond); margin: 0 0 12px; letter-spacing: .005em; text-wrap: balance; }
h3 { font: 600 16px/1.3 var(--sans); margin: 0 0 6px; }
.lede { color: var(--ink-2); margin: 6px 0 0; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.xs { font-size: 13px; }
p { margin: 0 0 10px; }
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 20px; }
.stack > * + * { margin-top: 28px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sep { border: 0; border-top: 1px solid var(--rule); margin: 16px 0; }
section + section { margin-top: 40px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid var(--rule-strong); background: var(--panel); border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink); transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--raised); }
.btn.go { background: var(--line); border-color: var(--line); color: var(--on-line); }
.btn.go:hover { filter: brightness(1.08); background: var(--line); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.quiet:hover { color: var(--ink); background: var(--raised); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn kbd { border-color: currentColor; background: transparent; color: inherit; opacity: .7; }

/* ---------- Plates & roundels ---------- */
.roundel { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--line); color: var(--on-line); font: 700 16px/1 var(--cond); letter-spacing: .02em; flex: none; font-variant-numeric: tabular-nums; }
.roundel.lg { width: 60px; height: 60px; font-size: 21px; }
.roundel.sm { width: 26px; height: 26px; font-size: 12px; }
.cother .roundel { background: transparent; border: 2px dashed var(--grey); color: var(--ink-2); }
.plate { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--raised); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plate.soon { background: var(--yellow); color: var(--on-status); }
.plate.over { background: var(--red); color: var(--on-status); }
.plate.line { background: color-mix(in srgb, var(--line) 18%, transparent); color: var(--ink); }

/* ---------- Line track (stops along a course line) ---------- */
.track { position: relative; display: flex; align-items: center; justify-content: space-between; height: 18px; min-width: 0; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--line); }
.track .stop { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--ground); border: 3px solid var(--line); flex: none; }
.track .stop.done { background: var(--line); border-color: var(--ink); border-width: 2px; }
.track .stop.next { width: 18px; height: 18px; border-width: 4px; box-shadow: 0 0 0 3px var(--ground); }
.track.empty::before { background: none; border-top: 3px dashed var(--grey); height: 0; margin-top: -1.5px; border-radius: 0; }
.track.lg { height: 22px; }
.track.lg .stop { width: 14px; height: 14px; }
.track.lg .stop.next { width: 22px; height: 22px; }
.track-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Home: line map ---------- */
.line-map { list-style: none; margin: 20px 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.line-map li + li { border-top: 1px solid var(--rule); }
.map-sub { margin: 26px 0 0; font: 600 14px/1 var(--cond); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.map-sub + .line-map { margin-top: 10px; }
.line-row { display: grid; grid-template-columns: 44px minmax(190px, 260px) minmax(160px, 1fr) minmax(170px, 230px) 18px; gap: 20px; align-items: center; padding: 13px 20px; text-decoration: none; color: var(--ink); transition: background-color .15s; }
.line-row:hover { background: var(--raised); }
.line-row:hover .chev { color: var(--line); transform: translateX(2px); }
.line-row .name { font: 600 19px/1.15 var(--cond); }
.line-row .who { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.line-row .flags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.line-row .next-dep { font-size: 14px; line-height: 1.35; }
.line-row .next-dep time { font-weight: 700; font-size: 15.5px; }
.line-row .next-dep .what { color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.line-row .chev { color: var(--ink-3); transition: transform .15s, color .15s; }
@media (max-width: 860px) {
  .line-row { grid-template-columns: 44px 1fr 18px; grid-template-areas: "r n c" "t t t" "d d d"; gap: 12px 14px; }
  .line-row > .roundel { grid-area: r; } .line-row > .nm { grid-area: n; } .line-row > .tk { grid-area: t; } .line-row > .next-dep { grid-area: d; } .line-row > .chev { grid-area: c; }
}

/* ---------- Departures board ---------- */
.board { border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); overflow-x: auto; }
.board table { width: 100%; border-collapse: collapse; font-size: 15px; }
.board th { text-align: left; font: 600 14px/1 var(--cond); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); padding: 12px 14px; background: var(--raised); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.board td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board td.when { white-space: nowrap; font: 600 17px/1.2 var(--cond); font-variant-numeric: tabular-nums; }
.board td.due { white-space: nowrap; text-align: right; }
.board .num { text-align: right; white-space: nowrap; }
.board .note { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.board tr.total td { font-weight: 700; background: var(--raised); }
.check { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border-radius: 50%; border: 3px solid var(--line); background: var(--ground); cursor: pointer; display: inline-grid; place-items: center; flex: none; transition: background-color .2s, border-color .2s; }
.check:checked { background: var(--line); border-color: var(--line); }
.check:checked::after { content: ""; width: 8px; height: 4px; border-left: 2px solid var(--on-line); border-bottom: 2px solid var(--on-line); transform: translateY(-1px) rotate(-45deg); }
.check.fill-in { animation: fill-in .26s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes fill-in { from { transform: scale(.6); } to { transform: scale(1); } }

/* ---------- Course page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); text-decoration: none; margin-bottom: 16px; }
.back:hover { color: var(--ink); }
.course-title { display: grid; grid-template-columns: 60px 1fr; gap: 16px; align-items: center; }
.course-title .meta { color: var(--ink-2); font-size: 14.5px; margin-top: 6px; }
.course-line { margin: 22px 0 0; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule); margin: 22px 0 26px; }
@media (max-width: 760px) { .tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); padding-right: 36px; } }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--line); }
.cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.next-step { border-color: color-mix(in srgb, var(--line) 55%, var(--rule)); }
.next-step .task-name { font: 600 25px/1.18 var(--cond); margin: 0 0 6px; }
.next-step .why { color: var(--ink-2); margin: 0 0 12px; }
.meta-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* Notices: a ruled service-status list. Icon carries status, headline carries the fact, one line of detail, one action. */
.notices { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.notices li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 0 12px; align-items: start; padding: 14px 16px; }
.notices li + li { border-top: 1px solid var(--rule); }
.notices .sig { padding-top: 2px; color: var(--ink-3); }
.notices li.warn .sig { color: var(--red); }
.notices .nt { font: 600 18px/1.25 var(--cond); }
.notices p { margin: 3px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.45; max-width: 66ch; }
.notices .btn { margin-top: 1px; white-space: nowrap; }
.h-meta { font: 500 14px/1 var(--sans); color: var(--ink-2); margin-left: 10px; }
@media (max-width: 600px) { .notices li { grid-template-columns: 20px minmax(0, 1fr); } .notices .btn { grid-column: 2; justify-self: start; margin-top: 10px; } }
.notice { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--raised); font-size: 15px; }
.notice + .notice { margin-top: 8px; }
.notice .ico { margin-top: 2px; }
.notice.warn .ico { color: var(--red); }
.notice.info .ico { color: var(--ink-2); }

.weights { display: flex; gap: 3px; margin: 0 0 12px; }
.weights span { height: 10px; border-radius: 2px; border: 2px solid var(--line); background: transparent; }
.weights span.done { background: var(--line); }
.weights-legend { font-size: 13px; color: var(--ink-2); margin: -4px 0 12px; }

dl.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; margin: 0; font-size: 15px; }
dl.kv dt { color: var(--ink-2); font-weight: 600; font-size: 14px; }
dl.kv dd { margin: 0; }
ul.clean { padding-left: 18px; margin: 6px 0 0; }
ul.clean li { margin-bottom: 6px; }
ul.clean li::marker { color: var(--line); }
.ann + .ann { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 12px; }
.ann .t { font-weight: 600; }
.ai-yes { font-weight: 700; } .ai-no { color: var(--red); font-weight: 700; }
textarea, input[type="text"] { width: 100%; font: inherit; color: var(--ink); background: var(--ground); border: 1px solid var(--rule-strong); border-radius: var(--r); padding: 10px 12px; }
textarea:focus, input[type="text"]:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
::placeholder { color: var(--ink-3); }

/* ---------- Vertical line diagram (schedule + study plan) ---------- */
.vline { list-style: none; margin: 0; padding: 0; position: relative; --rail: 76px; }
.vline::before { content: ""; position: absolute; left: calc(var(--rail) + 23px); top: 14px; bottom: 14px; width: 6px; border-radius: 3px; background: var(--line); }
.vline > li { position: relative; display: grid; grid-template-columns: var(--rail) 20px 1fr; gap: 0 16px; padding: 10px 0; }
.vline .when { text-align: right; font: 700 16px/1.25 var(--cond); padding-top: 1px; font-variant-numeric: tabular-nums; }
.vline .when small { display: block; font: 500 13px/1.3 var(--sans); color: var(--ink-2); }
.vline .node { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--ground); border: 4px solid var(--line); margin-top: 1px; }
.vline .node.past { background: var(--line); border-color: var(--ink); border-width: 3px; }
.vline .node.xfer { width: 24px; height: 24px; margin-left: -2px; margin-top: -1px; background: var(--ink); border: 4px solid var(--ground); box-shadow: 0 0 0 3px var(--line); }
.vline .body { min-width: 0; padding-bottom: 6px; }
.vline .topic { font-weight: 600; font-size: 16.5px; line-height: 1.35; }
.vline .prep { margin-top: 6px; font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.vline .prep .lbl { color: var(--ink-2); }
.vline .deliv { margin-top: 8px; display: flex; gap: 7px; align-items: flex-start; font-weight: 600; font-size: 14.5px; }
.vline .deliv .ico { color: var(--yellow-ink); margin-top: 2px; }
.vline > li.past .topic, .vline > li.past .when { color: var(--ink-2); }
.vline > li.zone { padding: 22px 0 6px; }
.vline > li.zone .zone-name { grid-column: 3; font: 600 18px/1.2 var(--cond); }
.vline > li.zone .zone-name .muted { font-family: var(--sans); font-weight: 500; font-size: 14px; margin-left: 8px; }
.vline > li.zone .node { width: 14px; height: 14px; margin: 3px 0 0 3px; border-width: 3px; border-radius: 3px; background: var(--line); border-color: var(--line); }
.vline > li.task .check { margin-top: 1px; }
.vline > li.task.done .topic { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-2); }
.vline > li.task .task-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: start; }
.vline > li.task .why { color: var(--ink-2); font-size: 14.5px; margin-top: 2px; }
.vline > li.task .meta-row { margin: 8px 0 0; }
@media (max-width: 600px) {
  .vline { --rail: 0px; }
  .vline > li { grid-template-columns: 20px 1fr; gap: 0 14px; }
  .vline::before { left: 7px; }
  .vline .when { display: none; }
  .vline > li.zone .zone-name { grid-column: 2; }
  .vline .body .when-m { display: inline; font: 700 16px/1.3 var(--cond); color: var(--ink-2); margin-right: 8px; }
  .vline > li.task .task-grid { grid-template-columns: 1fr; }
}
.when-m { display: none; }
.m-only { display: none !important; }
@media (max-width: 600px) { .meta-row.m-only, .plate.m-only { display: inline-flex !important; } .meta-row.m-only { display: flex !important; } }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; color: var(--ink-2); font-size: 15px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--ink); }
.toggle input { width: 18px; height: 18px; accent-color: var(--line); }

/* ---------- Learn ---------- */
.learn { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .learn { grid-template-columns: 1fr; } }
.topics { list-style: none; margin: 0; padding: 0; position: relative; }
.topics::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--line); opacity: .55; }
.topics button { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px 7px 0; cursor: pointer; font-size: 15px; color: var(--ink-2); border-radius: 4px; }
.topics button::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--ground); border: 3px solid var(--line); box-sizing: border-box; margin-top: 2px; }
.topics button.read::before { background: var(--line); }
.topics button:hover { color: var(--ink); }
.topics button[aria-current="true"] { color: var(--ink); font-weight: 700; }
.explainer h2 { font-size: 30px; margin-bottom: 14px; }
.summary { background: color-mix(in srgb, var(--line) 13%, var(--panel)); border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; font-size: 16.5px; }
.points { padding-left: 20px; margin: 0 0 16px; max-width: 72ch; }
.points li { margin-bottom: 9px; }
.points li::marker { color: var(--line); }
.formula { font: 14px/1.55 var(--mono); background: var(--ground); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; margin: 0 0 16px; white-space: pre-wrap; overflow-x: auto; }
.selfcheck { border: 1px solid var(--rule-strong); border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; }
.selfcheck .ans { margin-top: 8px; font-weight: 600; color: var(--ink); background: var(--raised); border-radius: 4px; padding: 8px 10px; }

/* ---------- Flashcards ---------- */
.decks { list-style: none; margin: 0 0 18px; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.decks li + li { border-top: 1px solid var(--rule); }
.decks label { display: grid; grid-template-columns: 20px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; }
.decks label:hover { background: var(--raised); }
.decks input { width: 18px; height: 18px; accent-color: var(--line); }
.decks .counts { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.drill { max-width: 700px; }
.drill-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.drill-head b { font: 600 18px/1.2 var(--cond); }
.drill-head span { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--raised); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.bar > i { display: block; height: 100%; background: var(--line); transition: width .25s cubic-bezier(.2, .8, .2, 1); }
.flash { min-height: 240px; display: grid; place-items: center; text-align: center; padding: 30px; cursor: pointer; user-select: none; }
.flash .term { font: 600 30px/1.15 var(--cond); }
.flash .def { font-size: 18px; margin-top: 14px; color: var(--ink); max-width: 52ch; }
.flash.flipped .term { font-size: 22px; color: var(--ink-2); }
.hint { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
kbd { font: 12px/1.4 var(--mono); border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--raised); }

/* ---------- Quiz ---------- */
.q-title { font: 600 23px/1.25 var(--cond); margin: 0 0 14px; }
.opt { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel); cursor: pointer; font-size: 16px; color: var(--ink); }
.opt:hover:not(:disabled) { border-color: var(--line); background: var(--raised); }
.opt .k { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--rule-strong); font: 700 13px/1 var(--cond); color: var(--ink-2); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--panel)); }
.opt.wrong .k { background: var(--red); border-color: var(--red); color: var(--on-status); }
.opt:disabled { cursor: default; }
.explain { padding: 12px 14px; border-radius: var(--r); background: var(--raised); margin: 6px 0 14px; font-size: 15.5px; }
.quiz-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.quiz-list li + li { border-top: 1px solid var(--rule); }
.quiz-list button { display: grid; grid-template-columns: 1fr auto 18px; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 15px 16px; background: none; border: 0; cursor: pointer; color: var(--ink); }
.quiz-list button:hover { background: var(--raised); }
.quiz-list b { font: 600 18px/1.2 var(--cond); }
.review { padding-left: 22px; margin: 0 0 14px; }
.review li { margin-bottom: 12px; }
.review .ok { font-weight: 600; } .review .no { color: var(--red); font-weight: 600; }

/* ---------- Practice ---------- */
.prob { font-size: 18px; line-height: 1.55; margin: 0 0 16px; max-width: 62ch; }
.answer-row { display: flex; gap: 8px; align-items: center; }
.answer-row input { max-width: 240px; font-variant-numeric: tabular-nums; }
.steps { font: 14px/1.6 var(--mono); white-space: pre-wrap; background: var(--ground); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; margin-top: 4px; }
.feedback { font-weight: 600; margin: 12px 0; }
.feedback.no { color: var(--red); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--rule-strong); }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--on-line); }

/* ---------- Files ---------- */
.files { list-style: none; padding: 0; margin: 0; }
.files li { display: grid; grid-template-columns: 210px 1fr; gap: 14px; padding: 11px 0; border-top: 1px solid var(--rule); }
.files li:first-child { border-top: 0; padding-top: 0; }
.files .k { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
@media (max-width: 600px) { .files li { grid-template-columns: 1fr; gap: 2px; } }
.jumps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ext { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Station-clock timer (popover) ---------- */
.timer-pop { position: fixed; top: 66px; right: max(20px, calc((100vw - 1120px) / 2 + 20px)); width: 330px; max-width: calc(100vw - 32px); z-index: 40; background: var(--raised); border-color: var(--rule-strong); }
.timer-pop .dial .face { fill: var(--panel); }
.timer-pop h2 { margin: 0; }
.dial { position: relative; width: 176px; height: 176px; margin: 14px auto 12px; }
.dial svg { width: 100%; height: 100%; }
.dial .face { fill: var(--ground); stroke: var(--rule-strong); stroke-width: 1.5; }
.dial .tick { stroke: var(--ink-3); stroke-width: 1.5; }
.dial .tick.h { stroke: var(--ink); stroke-width: 3; }
.dial .arc { fill: none; stroke: var(--line); stroke-width: 7; stroke-linecap: butt; transition: stroke-dashoffset .25s linear; }
.dial .readout { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.dial .readout b { display: block; font: 700 40px/1 var(--cond); font-variant-numeric: tabular-nums; }
.dial .readout small { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.working-on { font-size: 13.5px; color: var(--ink-2); min-height: 20px; margin-top: 10px; text-align: center; }
.timer-pop textarea { min-height: 84px; margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: var(--r); font-weight: 600; font-size: 15px; transition: opacity .2s, transform .2s cubic-bezier(.2, .8, .2, 1); pointer-events: none; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.note { font-size: 14px; color: var(--ink-2); margin: 10px 0 0; }
.empty-state { padding: 6px 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Header nav ---------- */
.hnav { display: flex; }
.hnav a.hbtn { text-decoration: none; color: var(--ink); }
.hnav a[aria-current="true"] { border-color: var(--rule-strong); background: var(--raised); }
@media (max-width: 520px) { .hbtn .lbl { display: none; } .hbtn.running .lbl { display: inline; } .hbtn { padding: 0 10px; } .brand { font-size: 18px; } }

/* ---------- Library shelf ---------- */
.lib-h { display: flex; align-items: center; gap: 10px; }
.shelf { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.shelf li + li { border-top: 1px solid var(--rule); }
.shelf a { display: grid; grid-template-columns: minmax(0, 1fr) auto 104px 18px; gap: 16px; align-items: center; padding: 14px 18px; text-decoration: none; color: var(--ink); transition: background-color .15s; }
.shelf a:hover { background: var(--raised); }
.shelf a:hover .ico { color: var(--line); }
.shelf b { font: 600 18px/1.2 var(--cond); }
.shelf .resume { text-align: right; }
.shelf .ico { color: var(--ink-3); }
@media (max-width: 600px) { .shelf a { grid-template-columns: minmax(0, 1fr) 18px; } .shelf .plate, .shelf .resume { display: none; } }

/* ---------- Reader ---------- */
body[data-view="read"] main { padding: 0; }
body[data-view="read"] #app { max-width: none; padding: 0; }
body[data-view="read"] .top .wrap { max-width: none; }
.reader { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 59px); height: calc(100dvh - 59px); }
.reader-side { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--rule); padding: 18px 20px 32px; }
.reader-side .back { margin-bottom: 12px; }
.book-title { font: 600 26px/1.1 var(--cond); margin: 0 0 6px; }
.reader-frame { background: #2a2e33; }
:root[data-theme="light"] .reader-frame { background: #dfe4e9; }
.reader-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.jump { display: grid; grid-template-columns: 78px 90px auto; gap: 8px; align-items: center; margin-top: 14px; font-size: 14px; font-weight: 600; }
.jump + .jump { margin-top: 8px; }
input[type="number"] { width: 100%; font: inherit; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--ground); border: 1px solid var(--rule-strong); border-radius: var(--r); padding: 6px 8px; }
input[type="number"]:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.rd { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 12px; }
.rd summary { cursor: pointer; font: 600 17px/1.3 var(--cond); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.rd summary::-webkit-details-marker { display: none; }
.rd summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
.rd[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.rd textarea { margin-top: 10px; min-height: 140px; }
.toc { list-style: none; margin: 10px 0 0; padding: 0; position: relative; }
.toc::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--line); opacity: .5; }
.toc a { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 5px 0; text-decoration: none; color: var(--ink-2); font-size: 14.5px; line-height: 1.35; }
.toc a::before { content: ""; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; background: var(--panel); border: 3px solid var(--line); margin-top: 1px; }
.toc a.sub { font-size: 13.5px; }
.toc a.sub::before { width: 10px; height: 10px; border-width: 2px; margin: 4px 0 0 3px; }
.toc a:hover { color: var(--ink); }
.toc a.cur { color: var(--ink); font-weight: 700; }
.toc a.cur::before { background: var(--line); }
.toc .pp { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-3); padding-top: 1px; }
@media (max-width: 860px) {
  .reader { grid-template-columns: 1fr; height: auto; }
  .reader-side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .reader-frame { height: 82vh; height: 82dvh; }
  .rd { margin-top: 12px; }
}

.line-row.compact { padding-top: 9px; padding-bottom: 9px; }
.line-row.compact .roundel { width: 34px; height: 34px; font-size: 14px; justify-self: center; }
.line-row.compact .name { font-size: 17px; }
.line-row.compact .who { margin-top: 1px; }
.line-row.compact .next-dep { font-size: 13.5px; }
@media (max-width: 600px) {
  .track .stop { width: 8px; height: 8px; border-width: 2px; }
  .track .stop.done { border-width: 1.5px; }
  .track .stop.next { width: 14px; height: 14px; border-width: 3px; }
  .track.lg .stop { width: 9px; height: 9px; border-width: 2px; }
  .track.lg .stop.next { width: 16px; height: 16px; border-width: 3px; }
  .track::before { height: 4px; margin-top: -2px; }
  .line-row.compact { grid-template-areas: "r n c" "d d d"; }
  .line-row.compact > .tk { display: none; }
}
:root[data-theme="light"] .plate.over, :root[data-theme="light"] .opt.wrong .k { color: #fff; }
.vline > li.now-row { padding: 4px 0; }
.vline > li.now-row .when { color: var(--yellow-ink); font-size: 15px; padding-top: 3px; }
.vline .node.now { width: 20px; height: 20px; background: var(--yellow); border: 4px solid var(--ground); box-shadow: 0 0 0 2px var(--yellow); }
/* green belongs to MIF712; correctness reads as ink + check, errors as red */
.ai-yes { color: var(--ink); }
.opt.right { border-color: var(--ink); background: var(--raised); }
.opt.right .k { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.feedback.ok, .review .ok { color: var(--ink); }
.plate.ok { background: var(--raised); color: var(--ink); }
.opt .k .ico { width: 14px; height: 14px; stroke-width: 2.5; vertical-align: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Motion explainers (player) ---------- */
.mg { margin: 4px 0 20px; }
.mg-stage { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--ground); cursor: pointer; }
.mg-stage > svg { display: block; width: 100%; height: 100%; }
.mg-bigplay { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 20px 0 16px; border-radius: 23px; border: 0; background: var(--line); color: var(--on-line); font: 600 17px/1 var(--sans); cursor: pointer; }
.mg-bigplay svg { width: 20px; height: 20px; fill: currentColor; }
.mg-bigplay:hover { filter: brightness(1.08); }
.mg.playing .mg-bigplay, .mg.started .mg-bigplay { display: none; }
.mg-cap { min-height: 52px; padding: 10px 2px 2px; font-size: 16.5px; line-height: 1.45; color: var(--ink); max-width: 72ch; }
.mg-bar { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.mg-bar .btn { min-width: 64px; }
.mg-track { position: relative; flex: 1; height: 28px; cursor: pointer; }
.mg-rail-bar { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--rule-strong); overflow: hidden; }
.mg-rail-bar i { display: block; height: 100%; width: 0; background: var(--line); }
.mg-sstop { position: absolute; top: 6px; width: 16px; height: 16px; margin-left: -8px; padding: 0; border-radius: 50%; border: 3px solid var(--rule-strong); background: var(--ground); cursor: pointer; }
.mg-sstop.passed { border-color: var(--line); background: var(--line); }
.mg-sstop:focus-visible { outline-offset: 2px; }
.mg-time { font-size: 13.5px; color: var(--ink-2); min-width: 84px; text-align: right; }
.mg-cc[aria-pressed="false"] { text-decoration: line-through; }
@media (max-width: 600px) { .mg-time { display: none; } .mg-bar .btn { min-width: 0; } .mg-bigplay { height: 40px; font-size: 15px; } }

/* ---------- Motion explainers (scene vocabulary) ---------- */
.mg-bg { fill: var(--ground); }
.mg-h { font: 600 54px var(--cond); fill: var(--ink); }
.mg-title { font: 600 108px var(--cond); fill: var(--ink); letter-spacing: -0.01em; }
.mg-sub { font: 400 30px var(--sans); fill: var(--ink-2); }
.mg-rail { stroke: var(--line); stroke-width: 10; stroke-linecap: round; fill: none; }
.mg-rail.thin { stroke-width: 5; }
.mg-stop { fill: var(--ground); stroke: var(--line); stroke-width: 5; }
.mg-stop.next { fill: var(--line); stroke: var(--ink); stroke-width: 4; }
.mg-stop.small { stroke-width: 4; }
.mg-label { font: 600 42px var(--cond); fill: var(--ink); }
.mg-desc { font: 400 25px var(--sans); fill: var(--ink-2); }
.mg-note { font: 500 25px var(--sans); fill: var(--yellow-ink); }
.mg-curve { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.mg-curve.alt1 { stroke: var(--ink-2); } .mg-curve.alt2 { stroke: var(--ink-3); }
.mg-dot { fill: var(--line); }
.mg-dot.hot { fill: var(--yellow); }
.mg-plate { fill: var(--raised); stroke: var(--rule-strong); stroke-width: 2; }
.mg-plate.hl { fill: color-mix(in srgb, var(--line) 24%, var(--raised)); stroke: var(--line); }
.mg-plate-t { font: 600 22px var(--sans); fill: var(--ink); }
.mg-colbar { fill: var(--line); }
.mg-colbar.hl { fill: var(--yellow); }
.mg-tiny { font: 500 20px var(--sans); fill: var(--ink-2); }
.mg-tiny.hl, .mg-tiny.hot { fill: var(--yellow-ink); font-weight: 600; }
.mg-cell { fill: var(--raised); }
.mg-cell.head { fill: color-mix(in srgb, var(--line) 35%, var(--raised)); }
.mg-scribble { stroke: var(--ink-3); stroke-width: 8; stroke-linecap: round; }
.mg-item { font: 600 36px var(--cond); fill: var(--ink); }
.mg-itemsub { font: 400 22px var(--sans); fill: var(--ink-2); }
.mg-eqt { font: 600 76px var(--cond); fill: var(--ink); }
.mg-eqt.hl { fill: var(--line); }
.mg-eqline { font: 500 32px var(--sans); fill: var(--ink-2); }
.mg-eqline.hl { fill: var(--ink); font-weight: 700; }
.mg-axis, .mg-tick { stroke: var(--ink-3); stroke-width: 3; fill: none; }
.mg-rowlabel { font: 600 28px var(--cond); fill: var(--ink-2); }
.mg-mline { stroke: var(--yellow); stroke-width: 4; }
.mg-mlabel { font: 700 26px var(--cond); fill: var(--yellow-ink); }
.mg-marker.b .mg-mline { stroke: var(--ink); }
.mg-marker.b .mg-mlabel { fill: var(--ink); }
.mg-bracket { fill: none; stroke: var(--yellow); stroke-width: 4; }
.mg-barval { font: 700 34px var(--cond); fill: var(--ink); }
.mg-arrow { stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.mg-arrowhead { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.mg-flowlabel { font: 700 26px var(--cond); fill: var(--ink); }
.mg-coin { fill: var(--yellow); }
.mg-total { font: 700 40px var(--cond); fill: var(--yellow-ink); }
.mg-ring { fill: none; stroke: var(--line); stroke-width: 8; }
.mg-ring.faint { opacity: .35; }
.mg-center { font: 700 40px var(--cond); fill: var(--ink); }
.mg-roundel { fill: var(--line); }
.mg-roundel-t { font: 700 28px var(--cond); fill: var(--on-line); }
.mg-nlabel { font: 600 34px var(--cond); fill: var(--ink); }
.mg-nsub { font: 400 21px var(--sans); fill: var(--ink-2); }
.mg-runner { fill: var(--yellow); }
.mg-runner.big { stroke: var(--ground); stroke-width: 5; }
.mg-trend { stroke: var(--yellow); stroke-width: 5; stroke-linecap: round; }
.mg-rlabel { font: 700 44px var(--cond); fill: var(--ink); }
.mg-band { fill: var(--line); }
.mg-band.hl { fill: var(--yellow); }
.mg-ctitle { font: 600 38px var(--cond); fill: var(--ink); }
.mg-cline { font: 400 24px var(--sans); fill: var(--ink-2); }
.mg-stat { font: 700 84px var(--cond); fill: var(--ink); }
.mg-node { fill: var(--raised); stroke: var(--rule-strong); stroke-width: 2; }
.mg-node.hl { fill: color-mix(in srgb, var(--line) 22%, var(--raised)); stroke: var(--line); }
.mg-nodet { font: 700 34px var(--cond); fill: var(--ink); }
.mg-nodet.sm { font-size: 28px; }
.mg-nodev { font: 700 32px var(--cond); fill: var(--line); }
.mg-link { fill: none; stroke: var(--line); stroke-width: 5; }
.mg-op { font: 700 54px var(--cond); fill: var(--ink-3); }
.mg-fulcrum { fill: var(--raised); stroke: var(--rule-strong); stroke-width: 2; }
.mg-beam { stroke: var(--ink); stroke-width: 8; stroke-linecap: round; }
.mg-block { fill: var(--raised); stroke: var(--line); stroke-width: 3; }
.mg-block.hl { fill: color-mix(in srgb, var(--line) 30%, var(--raised)); }
.mg-blockt { font: 600 26px var(--sans); fill: var(--ink); }
.mg-year { font: 700 34px var(--cond); fill: var(--line); }
.mg-evt { font: 500 21px var(--sans); fill: var(--ink-2); }
.mg-quote { font: 600 58px var(--cond); fill: var(--ink); }
.mg-q { font: 600 44px var(--cond); fill: var(--ink); }
.mg-answer { fill: color-mix(in srgb, var(--line) 16%, var(--raised)); }
.mg-checkmark { fill: none; stroke: var(--line); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.mg-a { font: 600 30px var(--sans); fill: var(--ink); }
.mg-bugdot { fill: var(--line); }
.mg-bugt { font: 700 15px var(--cond); fill: var(--on-line); }
.mg-bugl { font: 500 18px var(--sans); fill: var(--ink-3); }
#acct-btn { color: var(--ink); text-decoration: none; }
