/* Layout: the soft keys look from the Dodgin' Desmond v4 system. The page is a pale keypad: one raised panel
   holds the calculator, a dark display is set into the top of it, and everything a student can press is a
   raised pill that sinks when pressed. Saffron fills the one main key in view; the chosen option is a key
   that stays held down. Day is the default theme and Night follows the device setting. */
/* Jost, self-hosted. Variable font: one file per subset covers weights 300 to 500. Licence: /assets/fonts/OFL.txt */
@font-face {
  font-family: "Jost"; font-style: normal; font-weight: 300 500; font-display: swap;
  src: url("/assets/fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost"; font-style: normal; font-weight: 300 500; font-display: swap;
  src: url("/assets/fonts/jost-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Day. test.js checks the contrast of these pairs in both themes, so keep each colour a plain six-digit hex. */
:root {
  --ground: #e2e3e0;
  --panel: #e9eae7;
  --well: #f0f1ee;
  --key: #f8f8f6;
  --key-pressed: #eceeea;
  --key-held: #2b2f2d;
  --on-key-held: #f4f4f1;
  --ink: #141b18;
  --ink-soft: #474e4b;
  --field-rule: #737a77; /* the edge of a field: 3:1 against the well, the panel and the ground, as form fields need */
  --saffron: #feb800;
  --on-saffron: #141b18;
  --legend: #7d5200; /* saffron darkened until it reads as small text on a key, the panel or a well */
  --legend-held: #feb800;
  --display: #2b2f2d;
  --on-display: #f4f4f1;
  --on-display-soft: #a7adaa;
  --focus: #141b18;
  --rule: rgba(20, 27, 24, 0.14);
  --display-rule: rgba(255, 255, 255, 0.12);
  --key-rest: inset 0 1px 0 #ffffffe6, 0 1px 1px #141b181f, 0 6px 10px -4px #141b1838, 0 14px 22px -10px #141b182e, -3px -3px 8px #ffffffb3;
  --key-press: inset 0 2px 5px #141b1833, inset 0 -1px 0 #ffffffb3;
  --well-in: inset 0 2px 4px #141b1824, inset 0 -1px 0 #ffffffcc;
  --display-in: inset 0 3px 8px #00000080, 0 1px 0 #ffffffcc;
  --panel-raise: inset 0 1px 0 #ffffffe6, 0 2px 4px #141b1814, 0 30px 60px -24px #141b1847, -8px -8px 24px #ffffff99;
  --font-sans: "Jost", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  --space-half: 4px;
  --space-1: 8px;
  --key-gap: 12px;
  --space-2: 16px;
  --space-3: 32px;
  --space-4: 64px;
  --radius-well: 14px;
  --radius-display: 20px;
  --radius-panel: 36px;
  --radius-pill: 9999px;
  --key-h: 52px;
  --key-h-sm: 44px;
  --key-pad: 24px;
  --well-h: 48px;
  color-scheme: light dark;
}
/* Night: the same shapes, dark keys on a dark panel, a pale held key, the same saffron. */
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #171a19;
    --panel: #1f2322;
    --well: #141716;
    --key: #2e3331;
    --key-pressed: #262a29;
    --key-held: #f4f4f1;
    --on-key-held: #141b18;
    --ink: #f4f4f1;
    --ink-soft: #b4bab7;
    --field-rule: #7b827f;
    --legend: #feb800;
    --legend-held: #7d5200;
    --display: #0f1211;
    --focus: #feb800;
    --rule: rgba(244, 244, 241, 0.14);
    --key-rest: inset 0 1px 0 #ffffff14, 0 1px 1px #00000066, 0 6px 10px -4px #0000008c, 0 14px 22px -10px #00000080, -2px -2px 6px #ffffff08;
    --key-press: inset 0 2px 5px #00000099, inset 0 -1px 0 #ffffff0a;
    --well-in: inset 0 2px 4px #00000080, inset 0 -1px 0 #ffffff0a;
    --display-in: inset 0 3px 8px #000000b3, 0 1px 0 #ffffff0f;
    --panel-raise: inset 0 1px 0 #ffffff0f, 0 2px 4px #00000066, 0 30px 60px -24px #000000b3;
  }
}

* { box-sizing: border-box; }
/* The hidden attribute always wins over a component's own display rule (the paste panel, dialogs' rows). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.55; font-weight: 400; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: var(--space-3); }
@media (max-width: 640px) { .wrap { padding-inline: var(--space-2); } }

/* Type roles */
.label { font-size: 12px; line-height: 1.2; font-weight: 500; letter-spacing: 0.08em; color: var(--ink-soft); }
.title { font-size: 20px; line-height: 1.25; font-weight: 500; }
.soft { color: var(--ink-soft); }
.small { font-size: 14px; line-height: 1.45; }

/* Header and hero, on the ground */
.top-in { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-block: 20px; flex-wrap: wrap; }
.brand { font-weight: 500; font-size: 20px; letter-spacing: -0.01em; text-decoration: none; }
.top nav { display: flex; gap: var(--space-3); font-size: 15px; color: var(--ink-soft); }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--ink); text-decoration: underline; }
.hero-in { padding-block: var(--space-3); display: flex; flex-direction: column; gap: var(--key-gap); }
.headline { font-weight: 500; font-size: clamp(30px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.02em; max-width: 20ch; text-wrap: balance; }
.lede { font-size: 18px; line-height: 1.5; color: var(--ink-soft); max-width: 58ch; }
@media (max-width: 640px) { .hero-in { padding-block: var(--space-1) var(--space-2); gap: var(--space-1); } .top nav { gap: var(--space-2); } .lede { font-size: 16px; } }

/* The panel: the calculator body. One per page; only it and the keys on it are raised. */
.device {
  position: relative; border-radius: var(--radius-panel); background: var(--panel); box-shadow: var(--panel-raise);
  color: var(--ink); padding: var(--space-3);
}
@media (max-width: 640px) { .device { padding: var(--space-2); margin-inline: -4px; border-radius: 28px; } }

/* The display: dark in both themes, set into the top of the panel, everything right-aligned.
   The working, the one big result, the saffron rule running off the right edge, then what the number means. */
.display {
  position: relative; display: flex; flex-direction: column; overflow: hidden; text-align: right;
  background: var(--display); color: var(--on-display); border-radius: var(--radius-display); box-shadow: var(--display-in);
  padding: 24px 28px 20px;
}
.expr { order: 1; font-size: 14px; line-height: 1.3; letter-spacing: 0.02em; color: var(--on-display-soft); min-height: 1.3em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.big { order: 2; font-weight: 400; font-size: clamp(64px, 9vw, 96px); line-height: 1; letter-spacing: -0.02em; margin-top: var(--space-1); font-variant-numeric: tabular-nums; }
.big .unit { font-size: 0.42em; letter-spacing: 0; margin-left: 2px; color: var(--on-display-soft); }
.underline { order: 3; display: block; flex: none; align-self: flex-end; width: 46%; height: 3px; margin: var(--space-half) -28px 0 0; background: var(--saffron); }
.caption { order: 4; font-size: 16px; line-height: 1.3; color: var(--on-display-soft); margin-top: var(--key-gap); }
/* University colour: a small dot in the corner of the display, the same dot as in the university list.
   Most university colours are dark, so a light ring keeps them visible. Saffron stays the only accent. */
.uni-stripe .display::before { content: ""; position: absolute; top: 24px; left: 24px; width: 12px; height: 12px; border-radius: 50%; background: var(--uni); border: 1.5px solid rgba(244, 244, 241, 0.7); }
/* Keep a long working line clear of the dot. */
.uni-stripe .expr { padding-left: 24px; }
@media (max-width: 640px) {
  .display { padding: var(--space-2) 20px; }
  .underline { margin-right: -20px; }
  .caption { font-size: 15px; margin-top: var(--space-1); }
  .uni-stripe .display::before { top: 18px; left: 18px; }
}

/* Top of the panel: the display across the full width, then the grade keys with "Email this to myself" beside them. */
.dev-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); align-items: end; }
.dev-display { display: contents; }
#display-wrap { order: 1; grid-column: 1 / -1; }
.targets { order: 2; }
.keep-jump { order: 3; }

/* Keys: a full pill, raised at rest, sunk while pressed. The chosen one stays held down. */
.keys { display: flex; flex-wrap: wrap; gap: var(--key-gap); border: 0; margin: 0; padding: 0; min-width: 0; }
.keys legend { padding: 0; margin-bottom: var(--space-1); width: 100%; }
.key {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 88px; min-height: var(--key-h); padding: 0 var(--key-pad); cursor: pointer;
  font-size: 18px; line-height: 1; font-weight: 500; color: var(--ink); background: var(--key); border: 0; border-radius: var(--radius-pill); box-shadow: var(--key-rest);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}
.key:hover { transform: translateY(-1px); }
.key:active { background: var(--key-pressed); box-shadow: var(--key-press); transform: translateY(1px); }
.tkey { min-width: 104px; padding: 10px 30px 0 26px; }
.tkey input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
/* The corner legend: one short fact about the key. On a grade key, its boundary. */
.tkey .legend { position: absolute; top: 8px; right: 16px; font-size: 11px; line-height: 1; font-weight: 500; font-style: normal; letter-spacing: 0.04em; color: var(--legend); pointer-events: none; }
.tkey:has(input:checked), .key[aria-pressed="true"] { background: var(--key-held); color: var(--on-key-held); box-shadow: var(--key-press); transform: translateY(1px); }
.tkey:has(input:checked) .legend { color: var(--legend-held); }
.tkey:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (max-width: 640px) {
  .dev-top { grid-template-columns: minmax(0, 1fr); }
  .targets .key { flex: 1 1 0; min-width: 0; padding: 10px 22px 0 14px; }
  .tkey .legend { right: 13px; }
  .keep-jump { justify-self: end; }
}

.chips .key { font-size: 15px; min-height: var(--key-h-sm); min-width: 0; padding: 0 var(--space-2); }

/* Body of the panel */
.dev-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: var(--space-4); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--rule); }
@media (max-width: 900px) { .dev-body { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
@media (max-width: 640px) { .dev-body { margin-top: var(--space-2); padding-top: var(--space-2); } }
.sheet { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.setting { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.chips { margin-top: calc(var(--space-2) * -1); }
/* Text links: the only thing a student can press that is not a key. */
.linkish { border: 0; background: none; padding: 0; cursor: pointer; font-weight: 500; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }

/* Wells: anything typed into is pressed into the panel, with an edge that reads without the shadow. */
.dfield {
  background: var(--well); border: 1px solid var(--field-rule); border-radius: var(--radius-well); box-shadow: var(--well-in); color: var(--ink);
  padding: 0 14px; min-height: var(--key-h-sm); width: 100%; transition: border-color 0.12s ease;
}
.dfield::placeholder { color: var(--ink-soft); opacity: 1; }
.dfield:hover { border-color: var(--ink-soft); }
.dfield:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
.dfield.num { padding: 0 var(--space-half); text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.dfield.w { width: 72px; }
textarea.dfield { padding: 12px 14px; }
select.dfield {
  appearance: none; -webkit-appearance: none; cursor: pointer; width: auto; min-width: 200px; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23737a77'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.stage { display: flex; flex-direction: column; gap: var(--space-1); }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--space-2); }
.stage-h { font-size: 20px; line-height: 1.25; font-weight: 500; }
.mod { display: grid; grid-template-columns: minmax(0, 1fr) 68px 72px 32px; gap: var(--space-1); align-items: center; }
.mod-head { padding: 0 2px; }
.mod-head .r { text-align: center; }
/* Remove a module: a small round key, with a 44px hit area. */
.rm { position: relative; border: 0; padding: 0; background: var(--key); box-shadow: var(--key-rest); color: var(--ink-soft); cursor: pointer; font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 50%; transition: box-shadow 0.12s ease, background-color 0.12s ease; }
.rm::after { content: ""; position: absolute; inset: -6px; }
.rm:hover { color: var(--ink); }
.rm:active { background: var(--key-pressed); box-shadow: var(--key-press); }
/* "+ Add module" and "Paste a list": small keys under each year. */
.add {
  display: inline-flex; align-items: center; min-height: var(--key-h-sm); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-pill);
  background: var(--key); box-shadow: var(--key-rest); color: var(--ink); cursor: pointer; font-size: 15px; font-weight: 500;
  transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}
.add:hover { transform: translateY(-1px); }
.add:active { background: var(--key-pressed); box-shadow: var(--key-press); transform: translateY(1px); }
@media (max-width: 480px) { .mod { grid-template-columns: minmax(0, 1fr) 50px 56px 28px; gap: 6px; } .rm { width: 28px; height: 28px; } .rm::after { inset: -8px -5px; } .mod .dfield { padding-inline: 10px; } .mod .dfield.num { padding-inline: 2px; } }

/* Results */
.results { display: flex; flex-direction: column; gap: var(--space-2); position: sticky; top: var(--space-2); align-self: start; }
@media (max-width: 900px) { .results { position: static; } }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); margin: 0; }
.facts dd { margin: 4px 0 0; font-size: 24px; line-height: 1.2; font-weight: 400; font-variant-numeric: tabular-nums; }
.msg { font-size: 16px; }
.msg strong { color: var(--ink); font-weight: 500; }
/* Notes: flat and pressed in, never raised. */
.note { border-radius: var(--radius-display); background: var(--well); box-shadow: var(--well-in); padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink); }
.note .label { color: var(--legend); }
.note .btn { min-height: var(--key-h-sm); padding: 0 var(--space-2); font-size: 15px; }
.scale-wrap { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); }
/* Where you'd land: a second small readout, so it is the display colour and the saffron line reads on it. */
.scale { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); height: 36px; border-radius: var(--radius-well); background: var(--display); box-shadow: var(--display-in); overflow: hidden; }
.scale span { display: grid; place-items: center; font-size: 13px; color: var(--on-display-soft); }
.scale span + span { border-left: 1px solid var(--display-rule); }
.mk { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--saffron); transform: translateX(-1.5px); transition: left 0.2s ease; }
.mk.sofar { background: var(--on-display-soft); }
.whatif { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); }
input[type="range"] { width: 100%; min-height: 28px; accent-color: var(--key-held); }
.share { display: flex; flex-wrap: wrap; gap: var(--key-gap); margin-top: var(--space-1); }
.share .btn.accent { flex: 1 1 auto; }
.toast { color: var(--legend); min-height: 1em; }
.share-course { align-items: flex-start; margin-top: var(--space-1); padding: 6px 0; }
/* Prize draw: a quiet note under the share buttons, and the same panel-coloured dialog as Report a problem */
.draw-line { gap: var(--space-1); }
.draw-line .btn { align-self: flex-start; margin-top: var(--space-half); }
.draw-check { align-items: flex-start; padding: 6px 0; }
.draw-done { display: flex; flex-direction: column; gap: var(--space-1); }
.draw-done .title:focus { outline: none; }

/* Buttons are keys. Saffron is the one main action in view; an open dialog or panel counts as its own view. */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: var(--key-h); padding: 0 var(--key-pad); border: 0; border-radius: var(--radius-pill);
  background: var(--key); color: var(--ink); box-shadow: var(--key-rest); font-weight: 500; font-size: 16px; line-height: 1.1; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { background: var(--key-pressed); box-shadow: var(--key-press); transform: translateY(1px); }
.btn.accent, .btn.accent:active { background: var(--saffron); color: var(--on-saffron); }
/* A key that can't be pressed goes flat and level with the panel. */
.btn:disabled { background: var(--well); color: var(--ink-soft); box-shadow: none; transform: none; cursor: default; }

/* Home keys: each university is a key, and "Any university" is the saffron one, where the equals would be. */
.dev-label { margin: 24px 0 var(--key-gap); }
.ukeys { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--key-gap); }
.ukey {
  display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 68px; padding: 10px 28px; text-decoration: none; border-radius: var(--radius-pill);
  background: var(--key); color: var(--ink); box-shadow: var(--key-rest); transition: box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}
.ukey:hover { transform: translateY(-1px); }
.ukey:active { background: var(--key-pressed); box-shadow: var(--key-press); transform: translateY(1px); }
.ukey-name { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; line-height: 1.15; }
.ukey-rule { font-size: 13px; line-height: 1.3; color: var(--ink-soft); }
.udot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--field-rule); }
.ukey.eq, .ukey.eq:active { background: var(--saffron); color: var(--on-saffron); }
.ukey.eq .ukey-rule { color: var(--on-saffron); }

/* Info pages: plain text on the panel */
.info { padding-bottom: var(--space-4); }
.prose { display: flex; flex-direction: column; gap: var(--space-3); max-width: 68ch; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--rule); }
.prose h2 { margin-bottom: var(--space-1); }
.prose p + p { margin-top: var(--space-1); }
.prose ul { margin: var(--space-1) 0 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; }
.prose strong { font-weight: 500; }

/* Sections on the ground, below the panel */
.ground { padding-block: var(--space-4) 0; }
.faq dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-2) 0 0; }
@media (max-width: 700px) { .faq dl { grid-template-columns: minmax(0, 1fr); } }
.faq dt { font-weight: 500; margin-bottom: 4px; }
.faq dd { margin: 0; color: var(--ink-soft); }
.rules { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-4); }
@media (max-width: 820px) { .rules { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
.rules ol { margin: var(--space-2) 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--space-1); }
.rules-side { display: flex; flex-direction: column; gap: var(--space-1); padding-top: 6px; }
.rules-side ul { margin: 0 0 var(--space-2); padding-left: 1.1em; }
.signup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); align-items: end; margin-block: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--rule); }
@media (max-width: 820px) { .signup { grid-template-columns: minmax(0, 1fr); } }
.signup .soft { margin-top: 6px; }
.signup form { display: flex; flex-direction: column; gap: var(--space-1); }
.signup .row { display: flex; gap: var(--key-gap); flex-wrap: wrap; }
.gfield { flex: 1 1 220px; min-height: var(--key-h); padding: 0 var(--space-2); border: 1px solid var(--field-rule); border-radius: var(--radius-well); background: var(--well); box-shadow: var(--well-in); color: var(--ink); }
.gfield::placeholder { color: var(--ink-soft); opacity: 1; }
.gfield:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.foot { border-top: 1px solid var(--rule); }
.foot-in { padding-block: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); font-size: 14px; max-width: 1120px; }
.foot-in p { max-width: 80ch; }
@media (max-width: 900px) { .foot-in { padding-bottom: 110px; } }

/* Phone dock: a second readout, flush with the bottom of the screen, carrying the same result and its saffron rule. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  border: 0; border-radius: var(--radius-display) var(--radius-display) 0 0; background: var(--display); color: var(--on-display);
  padding: var(--key-gap) var(--key-pad) calc(var(--space-2) + env(safe-area-inset-bottom, 0px)); cursor: pointer; text-align: left;
}
.dock #dock-t { font-size: 30px; font-weight: 400; line-height: 1.1; padding-bottom: var(--space-half); border-bottom: 3px solid var(--saffron); font-variant-numeric: tabular-nums; }
.dock .unit { font-size: 0.6em; }
.dock .soft { color: var(--on-display-soft); }
.dock:focus-visible { outline-color: var(--saffron); outline-offset: -5px; }
.dock[hidden] { display: none; }
@media (min-width: 901px) { .dock { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } .key:hover, .btn:hover, .add:hover, .ukey:hover { transform: none; } }

/* Cookie notice (src/analytics.js): the display colour, so it stands off the pale page. Sits above the phone dock until the visitor chooses. */
.cookie-note {
  position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20; max-width: 360px;
  background: var(--display); color: var(--on-display); border: 1px solid var(--display-rule); border-radius: var(--radius-display);
  padding: var(--space-2); font-size: 14px; line-height: 1.45;
}
.cookie-note p { margin: 0 0 12px; }
.cookie-btns { display: flex; gap: var(--space-1); justify-content: flex-end; align-items: center; }
.cookie-btns a { margin-right: auto; color: var(--on-display); }
.cookie-btns .btn { min-height: var(--key-h-sm); padding: 0 18px; font-size: 14px; box-shadow: none; }
.cookie-note :focus-visible { outline-color: var(--saffron); }
/* Phones: a slim bar along the bottom, so the result stays in view on first load */
@media (max-width: 640px) {
  .cookie-note { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); max-width: none; padding: 10px 12px; font-size: 13px; line-height: 1.35; }
  .cookie-note p { margin-bottom: 8px; }
}
@media print { .cookie-note { display: none; } }

/* Keep your marks: a quiet full-width row along the bottom of the panel */
.keep { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-2) var(--space-4); align-items: start; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--rule); }
@media (max-width: 900px) { .keep { grid-template-columns: minmax(0, 1fr); } }
.keep .soft { margin-top: 4px; }
.keep form, .report form { display: flex; flex-direction: column; gap: var(--space-1); }
.keep .row, .report .row { display: flex; flex-wrap: wrap; gap: var(--key-gap); align-items: center; }
.keep .row .dfield { flex: 1 1 220px; width: auto; min-height: var(--well-h); }
.keep .keep-btns { align-items: stretch; }
.keep .keep-btns .btn { flex: 1 1 236px; padding-inline: 12px; white-space: nowrap; }
.keep-jump { text-align: right; }
.keep-jump[hidden] { display: none; }
.keep-jump .linkish { min-height: var(--key-h-sm); }
/* A tick box is a small round key that stays held when ticked. Its edge reads without the shadow. */
.check { display: flex; align-items: center; gap: var(--key-gap); min-height: var(--key-h-sm); cursor: pointer; color: var(--ink-soft); }
.check input { appearance: none; -webkit-appearance: none; width: 28px; height: 28px; margin: 0; flex: none; cursor: pointer; display: grid; place-content: center; border: 1px solid var(--field-rule); border-radius: 50%; background: var(--key); box-shadow: var(--key-rest); }
.check input:checked { background: var(--key-held); border-color: var(--key-held); box-shadow: var(--key-press); }
.check input:checked::before { content: ""; width: 11px; height: 6px; border-left: 2px solid var(--on-key-held); border-bottom: 2px solid var(--on-key-held); transform: translateY(-1px) rotate(-45deg); }
.restored { margin: 0 0 var(--space-2); padding: 12px 18px; border-radius: var(--radius-display); background: var(--well); box-shadow: var(--well-in); color: var(--ink); }

/* Report a problem: a small panel-coloured dialog */
.report {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; border: 0; padding: var(--space-3);
  border-radius: 28px; background: var(--panel); color: var(--ink); box-shadow: var(--panel-raise);
}
.report::backdrop { background: rgba(20, 27, 24, 0.6); }
.report .label { margin-top: var(--space-1); }
.report .title { margin-bottom: 4px; }
.report textarea.dfield { font: inherit; color: var(--ink); resize: vertical; min-height: 110px; line-height: 1.5; }
.report select.dfield { width: 100%; }
.report .row { justify-content: flex-end; margin-top: var(--space-1); }
.report .check[hidden] { display: none; }
@media (max-width: 640px) { .report { padding: 24px var(--space-2); } }


/* Story image: the same panel-coloured dialog, holding a preview of the picture before it's shared */
.story-in { display: flex; flex-direction: column; gap: var(--space-1); }
.story img { display: block; width: 100%; height: auto; max-height: min(56vh, 620px); object-fit: contain; margin-block: var(--space-1); border-radius: var(--radius-well); }
.story .row { justify-content: flex-end; }

/* Paste a list: a second small key beside "+ Add module", opening a small panel in the sheet */
.stage-actions { display: flex; flex-wrap: wrap; gap: var(--key-gap); margin-top: var(--space-half); }
.paste { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); padding: var(--space-2); border: 1px solid var(--rule); border-radius: var(--radius-display); }
.paste textarea.dfield { font: inherit; color: var(--ink); resize: vertical; min-height: 120px; line-height: 1.5; }
.paste .row { display: flex; flex-wrap: wrap; gap: var(--key-gap); justify-content: flex-end; }
.paste .btn, .report .btn { min-height: 48px; }
.paste-note { margin: var(--space-1) 0 0; }

/* Clear my marks: a quiet link under the keep-your-marks note */
.keep .clear { margin-top: var(--space-1); }
.keep .clear .linkish { min-height: var(--key-h-sm); }

/* Footer link-button (Report a problem) on the ground */
.foot .linkish { color: var(--ink); font-size: 14px; }
/* Without the email form, the keep row is a single column */
.keep.keep-solo { grid-template-columns: minmax(0, 1fr); }
