/* Exam HQ.
 *
 * Subject: five weeks of Grade 11 exams. Audience: one student, on a laptop at
 * a desk and a phone on a bus. Job: answer "what do I do right now" in one
 * glance, then get out of the way.
 *
 * Structure borrowed from sum-quest (graph paper, hard offset shadows, chunky
 * cards) because he asked for it as the reference. The palette is its own:
 * cool exam-hall paper and dark ink, one hot accent for "now", and a colour per
 * subject used only as a stripe or dot, never behind body text, so contrast is
 * decided by ink-on-paper alone. */

:root {
  --ink:       #18202e;
  --ink-soft:  #4a5468;
  --paper:     #eef0f2;
  --surface:   #ffffff;
  --surface-2: #e2e6ea;
  --line:      #18202e;
  --now:       #d9480f;
  --now-soft:  #ffe3d3;
  --done:      #1f7a55;
  --done-soft: #d3f0e2;
  --warn:      #a4600a;

  --s-it:  #3b5bdb; --s-ma:  #c2255c; --s-fse: #7048e8; --s-ps:  #0c8599;
  --s-lo:  #e67700; --s-zu:  #2b8a3e; --s-fsm: #9c36b5; --s-en:  #1971c2;
  --s-hi:  #a61e4d; --s-all: #495057;

  --shadow:    4px 4px 0 var(--line);
  --shadow-sm: 2px 2px 0 var(--line);
  --radius:    10px;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e9edf2; --ink-soft: #a7b0bf; --paper: #121722; --surface: #1b2230;
    --surface-2: #263042; --line: #05070b; --now: #ff8a4c; --now-soft: #4a2414;
    --done: #5fd39f; --done-soft: #173828; --warn: #f2b05a;
    --s-it: #7c94ff; --s-ma: #f06595; --s-fse: #a48bff; --s-ps: #3bc9db;
    --s-lo: #ffa94d; --s-zu: #69db7c; --s-fsm: #da77f2; --s-en: #4dabf7;
    --s-hi: #f783ac; --s-all: #adb5bd;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e9edf2; --ink-soft: #a7b0bf; --paper: #121722; --surface: #1b2230;
  --surface-2: #263042; --line: #05070b; --now: #ff8a4c; --now-soft: #4a2414;
  --done: #5fd39f; --done-soft: #173828; --warn: #f2b05a;
  --s-it: #7c94ff; --s-ma: #f06595; --s-fse: #a48bff; --s-ps: #3bc9db;
  --s-lo: #ffa94d; --s-zu: #69db7c; --s-fsm: #da77f2; --s-en: #4dabf7;
  --s-hi: #f783ac; --s-all: #adb5bd;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image:
    linear-gradient(var(--surface-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--surface-2) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 16px 16px 64px; }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--now); outline-offset: 2px; border-radius: 4px; }

/* Nav */
.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.brand { font-family: var(--font-mono); font-weight: 700; letter-spacing: .02em; margin-right: auto; text-decoration: none; }
.nav a.tab {
  font-family: var(--font-mono); font-size: 14px; text-decoration: none;
  padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.nav a.tab[aria-current="page"] { background: var(--ink); color: var(--paper); }

h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.15; margin: 0 0 4px; }
.sub { color: var(--ink-soft); margin: 0 0 20px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 0 0 6px; }

.card {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}

/* Subject marker */
.subj { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.subj::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sc, var(--s-all)); border: 1.5px solid var(--line); flex: none; }
[data-s="it"]  { --sc: var(--s-it); }  [data-s="ma"]  { --sc: var(--s-ma); }
[data-s="fse"] { --sc: var(--s-fse); } [data-s="ps"]  { --sc: var(--s-ps); }
[data-s="lo"]  { --sc: var(--s-lo); }  [data-s="zu"]  { --sc: var(--s-zu); }
[data-s="fsm"] { --sc: var(--s-fsm); } [data-s="en"]  { --sc: var(--s-en); }
[data-s="hi"]  { --sc: var(--s-hi); }  [data-s="all"] { --sc: var(--s-all); }

/* Countdown */
.count { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.count .big { font-family: var(--font-mono); font-size: 44px; font-weight: 700; line-height: 1; }
.count .big small { font-size: 16px; font-weight: 400; color: var(--ink-soft); }
.count .what { flex: 1; min-width: 180px; }
.count .what strong { display: block; font-size: 18px; }

/* Now */
.now { border-color: var(--now); box-shadow: 4px 4px 0 var(--now); }
.now .task { font-size: 20px; font-weight: 600; margin: 6px 0 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 8px;
  padding: 9px 14px; box-shadow: var(--shadow-sm); text-decoration: none; display: inline-block;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.primary { background: var(--now); color: #fff; }
.btn.go { background: var(--done); color: #fff; }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .btn.go { color: #05070b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary, :root:not([data-theme="light"]) .btn.go { color: #05070b; } }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

/* Block list */
.blocks { list-style: none; margin: 0; padding: 0; }
.blocks li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1.5px dashed var(--surface-2);
}
.blocks li:first-child { border-top: 0; }
.blocks input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--done); cursor: pointer; }
.blocks .t { font-weight: 500; }
.blocks .h { font-family: var(--font-mono); font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.blocks li.is-done .t { text-decoration: line-through; color: var(--ink-soft); }

.bar { height: 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--done); width: 0; transition: width .4s ease; }

.note { background: var(--now-soft); border: 2px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.muted { color: var(--ink-soft); }

/* Days list */
details.day { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
details.day > summary { cursor: pointer; padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
details.day > summary::-webkit-details-marker { display: none; }
details.day > summary .d { font-family: var(--font-mono); font-weight: 700; min-width: 92px; }
details.day > summary .k { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; color: var(--ink-soft); }
details.day > summary .x { color: var(--now); font-weight: 600; }
details.day[open] > summary { border-bottom: 2px solid var(--line); }
details.day .inner { padding: 4px 14px 10px; }
details.day.past { opacity: .7; }

/* Exam table */
table.exams { width: 100%; border-collapse: collapse; font-size: 15px; }
table.exams th, table.exams td { text-align: left; padding: 8px 6px; border-bottom: 1.5px solid var(--surface-2); vertical-align: top; }
table.exams th { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; color: var(--ink-soft); }
table.exams tr.written td { color: var(--ink-soft); text-decoration: line-through; }
table.exams td.n { font-family: var(--font-mono); white-space: nowrap; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip {
  font: inherit; font-size: 14px; cursor: pointer; color: var(--ink);
  border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip .c { font-family: var(--font-mono); margin-left: 4px; opacity: .8; }

/* Flashcard */
.flash { min-height: 260px; display: flex; flex-direction: column; }
.flash .q { font-size: 21px; font-weight: 600; margin: 4px 0 14px; }
.flash .a { font-size: 18px; border-top: 2px dashed var(--surface-2); padding-top: 14px; margin-top: auto; }
.flash .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grades .btn { padding: 10px 4px; font-size: 15px; }
.grades .btn kbd { display: block; font-family: var(--font-mono); font-size: 11px; opacity: .7; font-weight: 400; }
.g0 { background: #ffd8d8 !important; } .g3 { background: var(--done-soft) !important; }
:root[data-theme="dark"] .g0 { background: #4a1d1d !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .g0 { background: #4a1d1d !important; } }

/* Notes */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.notes-body h3 { font-size: 18px; margin: 22px 0 6px; }
.notes-body p, .notes-body li { max-width: 68ch; }
.notes-body .worked { background: var(--surface-2); border-left: 5px solid var(--sc, var(--ink)); border-radius: 6px; padding: 8px 14px; margin: 12px 0; }
.notes-body .flag { border: 2px dashed var(--warn); border-radius: 6px; padding: 6px 10px; }
.notes-body table { border-collapse: collapse; margin: 10px 0; font-size: 15px; display: block; overflow-x: auto; max-width: 100%; }
.notes-body th, .notes-body td { border: 1.5px solid var(--surface-2); padding: 6px 10px; text-align: left; vertical-align: top; }
.notes-body th { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); }
.notes-body pre {
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.5; background: var(--surface-2);
  border-radius: 6px; padding: 10px 12px; max-width: 100%;
  /* Wrap rather than scroll: a phone is where most of the revising happens,
     and a sideways-scrolling algorithm can't be read in one look. */
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.uml { font-family: var(--font-mono); font-size: 14px; border: 2px solid var(--ink); background: var(--surface); max-width: 420px; margin: 8px 0; }
.uml > div { padding: 6px 10px; overflow-wrap: anywhere; }
.uml-name { font-weight: 700; text-align: center; }
.uml-part { border-top: 2px solid var(--ink); }
.notes-body .worked pre { background: var(--surface); }
.notes-body .worked th { background: var(--surface); }
.notes-body code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.scope { font-size: 14px; color: var(--ink-soft); border-left: 3px solid var(--sc, var(--ink)); padding-left: 10px; margin: 0 0 8px; }

.foot { margin-top: 40px; font-size: 14px; color: var(--ink-soft); }
.foot .row { margin-top: 8px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 480px) {
  .count .big { font-size: 36px; }
  .grades { grid-template-columns: repeat(2, 1fr); }
  table.exams .hide-s { display: none; }
}

/* Mastery, calibration */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.stats strong { display: block; font-family: var(--font-mono); font-size: 24px; line-height: 1.1; }
.stats span { font-size: 14px; color: var(--ink-soft); }
.stats .wide { grid-column: 1 / -1; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); background: transparent; display: inline-block; }
.dot.on { background: var(--done); }
.predict { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.predict input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--now); height: 32px; }
.big-n { font-family: var(--font-mono); font-size: 40px; font-weight: 700; line-height: 1; display: block; }
.vs { display: flex; gap: 32px; margin: 8px 0 12px; }
.mastered-toast { background: var(--done-soft); border: 2px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; font-weight: 600; }
.ready { list-style: none; margin: 0; padding: 0; }
.ready li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-top: 1.5px dashed var(--surface-2); }
.ready li:first-child { border-top: 0; }
.ready .bar { grid-column: 1 / -1; margin: 2px 0 0; height: 10px; }
.ready .pct { font-family: var(--font-mono); font-weight: 700; }

/* The city. Its own night palette, independent of the page theme: it is a
 * scene, not chrome, so it looks the same in light and dark mode. */
.city-host { margin: 0 0 16px; }
.city-wrap { border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: #05070f; }
svg.city { display: block; width: 100%; height: auto; }
.city .bldg { fill: #0f1626; }
.city.is-day .bldg { fill: #34435c; }
.city .ground { fill: #070a12; }
.city .w-none { fill: #141b2b; }
.city .w-0 { fill: #222c41; }
.city .w-1 { fill: #6e5a30; }
.city .w-2 { fill: #c4923f; }
.city .w-3 { fill: #ffd478; }
.city.is-day .w-0, .city.is-day .w-none { fill: #4b5b76; }
.city .crane rect { fill: #3b465c; }
.city .star { fill: #e8eefc; }
.city .star.tw { animation: twinkle 3.2s ease-in-out infinite alternate; }
.city .beacon { fill: #ff5a4a; animation: beacon 1.6s steps(2, end) infinite; }
.city .beacon.slow { animation-duration: 2.8s; }
.city .label { fill: #c9d3e6; font-family: var(--font-mono); font-size: 11px; text-anchor: middle; font-weight: 700; }
.city .label.pct { fill: var(--sc, #c9d3e6); font-size: 10px; }
.city .hl { fill: transparent; }
.city a.district:hover .hl, .city a.district:focus .hl { fill: rgba(255, 255, 255, .06); }
.city a.district:focus-visible .hl { stroke: #ff8a4c; stroke-width: 2; }
.city a.district:focus { outline: none; }
.city-cap { font-size: 14px; margin: 8px 0 0; }
@keyframes twinkle { from { opacity: .25; } to { opacity: 1; } }
@keyframes beacon { 0% { opacity: 1; } 100% { opacity: .2; } }
.city .far rect { fill: #1a2442; opacity: .75; }

/* Essay trainer and past-paper tracker */
.clock { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.clock.over { color: var(--now); }
.q.prompt { font-size: 19px; }
.prompt-small { font-weight: 600; margin: 0 0 8px; }
textarea, select, input[type="text"], input[type="number"] {
  font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { font-family: var(--font-mono); font-size: 14px; line-height: 1.5; resize: vertical; min-height: 220px; margin: 4px 0 8px; }
select { max-width: 100%; }
.checks { list-style: none; padding: 0; margin: 8px 0 14px; }
.checks li { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 8px 0; border-top: 1.5px dashed var(--surface-2); }
.checks input { width: 22px; height: 22px; accent-color: var(--done); margin: 2px 0 0; }
.your-plan pre, .plan-pre { font-family: var(--font-mono); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin: 6px 0; }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.form-row label, .lost-grid label { font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.lost-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.lost-grid label span { min-height: 2.6em; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr 1fr; } .form-row label:first-child { grid-column: 1 / -1; } }

/* Plan links, focus, sleep */
.focus { margin: 4px 0 6px; font-size: 14px; font-weight: 600; color: var(--now); }
.blink { margin-top: 6px; }
.note.sleep { background: var(--surface-2); }
.blocks li > div { min-width: 0; }

/* City billboards: one per logged past paper */
.city .billboard .pole { fill: #3b465c; }
.city .bb-hi { fill: #63d9a8; } .city .bb-mid { fill: #ffc861; } .city .bb-lo { fill: #ff7a7a; }
.city .bb-t { font-family: var(--font-mono); font-size: 7px; font-weight: 700; fill: #10151f; text-anchor: middle; }
