/* City Showdown: styles.
   The look borrows from wayfinding: every area of the model is a coloured line, every figure a stop on it,
   and a result an arrival board. Light and dark themes share one set of names; only the values change.
   Fonts: Barlow and Barlow Condensed (SIL Open Font License, files in assets/fonts). */

/* ------------------------------------------------------------------ fonts */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-400-normal.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: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-ext-400-normal.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; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-vietnamese-400-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-latin-500-normal.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: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-latin-ext-500-normal.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; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-vietnamese-500-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-latin-600-normal.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: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-latin-ext-600-normal.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; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-vietnamese-600-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-latin-700-normal.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: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-latin-ext-700-normal.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; }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-vietnamese-700-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-600-normal.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: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-ext-600-normal.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; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-vietnamese-600-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-700-normal.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: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-ext-700-normal.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; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-vietnamese-700-normal.woff2") format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --paper: #F3F5F9; --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-5: #e87ba4; --surface: #FFFFFF; --well: #E9EDF4; --ink: #14213D; --ink-2: #34405A; --ink-3: #566176;
  --hair: #D5DBE4; --rail: #C3CCD9; --stop: #7A8699; --signal: #FFC72C; --signal-2: #FFD457; --on-signal: #14213D;
  --focus: #1B5FD9; --link: #14478F; --board: #14213D; --on-board: #FFFFFF; --on-board-2: #C9D3E6; --board-line: #3A4A70;
  --warn-bg: #FFF4CC; --warn-line: #B07D00; --warn-ink: #4F3A00; --err-bg: #FDECEA; --err-line: #B3261E; --err-ink: #7A1A14;
  --ok-bg: #E2F3EA; --ok-ink: #0A5236; --ok-line: #0B6B45;
  --up: #0B6B45; --down: #9A3412;
  --cat-EDU: #1baf7a; --cat-SAF: #eb6834; --cat-AFF: #2a78d6; --cat-ENV: #008300; --cat-HEA: #e87ba4; --cat-MOB: #6250d6; --cat-DIG: #e34948;
  --shadow: 0 1px 2px rgba(20, 33, 61, 0.06), 0 8px 24px rgba(20, 33, 61, 0.08);
  --radius: 6px; --radius-s: 4px; --side: 272px; --page: 1120px; --measure: 74ch;
  --gap: 24px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Barlow Condensed", "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* The dark theme: the same hues, stepped for a dark surface. Declared twice on purpose, once for a
   system set to dark and once for the switch in the sidebar. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0D1528; --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --surface: #152038; --well: #1C2A49; --ink: #EEF2F8; --ink-2: #C7D0E0; --ink-3: #9FABC2;
    --hair: #2A3A5E; --rail: #3A4C76; --stop: #7283A8; --focus: #8FB8FF; --link: #9CC2FF; --board: #1A2848; --board-line: #3A4C76;
    --warn-bg: #3A2F0B; --warn-line: #E0B030; --warn-ink: #FFE9A8; --err-bg: #3B1512; --err-line: #FF8A80; --err-ink: #FFD6D2;
    --ok-bg: #0F3326; --ok-ink: #BDEFD6; --ok-line: #6FD3A6;
    --up: #6FD3A6; --down: #FFB08A;
    --cat-EDU: #199e70; --cat-SAF: #d95926; --cat-AFF: #3987e5; --cat-ENV: #008300; --cat-HEA: #d55181; --cat-MOB: #9085e9; --cat-DIG: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0D1528; --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --surface: #152038; --well: #1C2A49; --ink: #EEF2F8; --ink-2: #C7D0E0; --ink-3: #9FABC2;
  --hair: #2A3A5E; --rail: #3A4C76; --stop: #7283A8; --focus: #8FB8FF; --link: #9CC2FF; --board: #1A2848; --board-line: #3A4C76;
  --warn-bg: #3A2F0B; --warn-line: #E0B030; --warn-ink: #FFE9A8; --err-bg: #3B1512; --err-line: #FF8A80; --err-ink: #FFD6D2;
  --ok-bg: #0F3326; --ok-ink: #BDEFD6; --ok-line: #6FD3A6;
  --up: #6FD3A6; --down: #FFB08A;
  --cat-EDU: #199e70; --cat-SAF: #d95926; --cat-AFF: #3987e5; --cat-ENV: #008300; --cat-HEA: #d55181; --cat-MOB: #9085e9; --cat-DIG: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.55 var(--font); min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: 0.002em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 3.8vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 1.85rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 0.85em; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
h1:focus, h2:focus, h3:focus { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 0 0 var(--radius-s) var(--radius-s); }
.skip-link:focus { top: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ buttons, fields, small parts */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px; border-radius: 6px; border: 2px solid transparent; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
.btn-primary:hover:not([disabled]) { background: var(--signal-2); border-color: var(--signal-2); }
.btn-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-dark:hover:not([disabled]) { background: var(--ink-2); border-color: var(--ink-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rail); }
.btn-ghost:hover:not([disabled]) { background: var(--well); border-color: var(--stop); }
.btn-lg { min-height: 54px; padding: 12px 28px; font: 700 1.35rem/1 var(--display); letter-spacing: 0.01em; border-radius: 6px; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: 0.9375rem; border-width: 1.5px; }
.btn-link { background: none; border: 0; padding: 0; min-height: 24px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 500; text-align: left; }
.btn-link:hover { text-decoration-thickness: 2px; }
.chip { min-height: 40px; padding: 7px 16px; border-radius: 6px; border: 1.5px solid var(--rail); background: var(--surface); font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-survey::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 1.5px var(--ink); vertical-align: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-grow { flex: 1 1 260px; }
.field-label { font-weight: 600; font-size: 0.9375rem; }
.text-input, .select, .copy-field { width: 100%; min-height: 44px; padding: 9px 14px; border-radius: 4px; border: 1.5px solid var(--stop); background: var(--surface); color: var(--ink); }
.text-input:hover, .select:hover { border-color: var(--ink-3); }
.text-input[aria-invalid="true"] { border-color: var(--err-line); box-shadow: 0 0 0 3px var(--err-bg); }
.select { padding-right: 34px; }
.select-short { width: auto; min-width: 92px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); flex: none; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.notice { border-left: 5px solid var(--focus); background: var(--well); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 14px 18px; margin: 0 0 14px; }
.notice p { margin: 0; color: var(--ink-2); font-size: 0.9844rem; }
.notice-title { display: block; margin-bottom: 4px; }
.notice-caution { border-left-color: var(--warn-line); background: var(--warn-bg); }
.notice-caution, .notice-caution p { color: var(--warn-ink); }
.notice-error { border-left-color: var(--err-line); background: var(--err-bg); }
.notice-error, .notice-error p { color: var(--err-ink); }
.notice .btn { margin-top: 10px; }
.notice .bullets { margin-top: 4px; }

/* ------------------------------------------------------------------ charts */
.chart-box { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 20px 22px 12px; }
.chart-view { position: relative; }
.chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); color: var(--ink-3); font-size: 0.9375rem; }
.gap-chart { margin-top: 12px; }
.gap-row, .gap-head { display: grid; grid-template-columns: 200px minmax(0, 1fr) 160px; gap: 14px; align-items: center; padding: 5px 0; }
.gap-label { overflow-wrap: anywhere; }
.gap-sides { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-3); font-size: 0.875rem; }
.gap-track { position: relative; height: 18px; background: linear-gradient(90deg, transparent calc(50% - 1px), var(--stop) calc(50% - 1px), var(--stop) calc(50% + 1px), transparent calc(50% + 1px)); }
.gap-bar { position: absolute; top: 2px; height: 14px; }
.gap-a { border-radius: 0 4px 4px 0; } .gap-b { border-radius: 4px 0 0 4px; }
.gap-value { font-size: 0.9375rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gap-total { margin: 12px 0 0; font-weight: 600; }
.range-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 16px; align-items: center; padding: 7px 0; }
.range-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-track, .range-axis { position: relative; height: 18px; margin: 0 8px; }
.range-track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--hair); }
.range-full { position: absolute; top: 8px; height: 2px; background: var(--ink-2); }
.range-mid { position: absolute; top: 5px; height: 8px; border-radius: 4px; background: var(--ink-2); }
.range-dot { position: absolute; top: 1px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--signal); border: 3px solid var(--ink); }
.range-axis span { position: absolute; transform: translateX(-50%); color: var(--ink-3); font-size: 0.8125rem; }
.range-first { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.range-head .range-first { font-weight: 400; color: var(--ink-3); font-size: 0.8125rem; }

/* ------------------------------------------------------------------ tables, folds, tiles */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9844rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
.data-table thead th { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid var(--ink); white-space: nowrap; vertical-align: bottom; }
.data-table tbody th { font-weight: 500; }
.data-table tbody tr:hover th, .data-table tbody tr:hover td { background: var(--well); }
.data-table tfoot th, .data-table tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 600; }
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub { display: block; color: var(--ink-3); font-size: 0.875rem; font-weight: 400; }
.row-pick th, .row-pick td { background: var(--ok-bg); color: var(--ok-ink); }
.row-pick th .cell-sub { color: var(--ok-ink); }
.fold { border-top: 1px solid var(--hair); }
.fold:last-child { border-bottom: 1px solid var(--hair); }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 6px; font-weight: 600; border-radius: 4px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2.5px solid var(--ink-2); border-bottom: 2.5px solid var(--ink-2); transform: rotate(45deg); margin-left: auto; transition: transform 0.15s ease; }
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold > summary:hover { background: var(--well); }
.fold-count { background: var(--well); border-radius: 4px; padding: 1px 10px; font-size: 0.875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.fold-body { padding: 4px 6px 20px; }
.fold-small { border: 0; }
.fold-small:last-child { border: 0; }
.fold-small > summary { padding: 6px 4px; font-weight: 500; font-size: 0.9375rem; color: var(--link); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius-s); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--ink); }
.tile-big { font: 700 2.1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.tile-small { color: var(--ink-2); font-weight: 500; }
.formula-block { background: var(--well); border-left: 5px solid var(--signal); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 12px 16px; margin: 8px 0 14px; overflow-x: auto; }
.formula-block code, .formula-block pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9375rem; white-space: pre; margin: 0; }
.refs { list-style: none; display: grid; gap: 12px; font-size: 0.9844rem; }
.refs li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
.ref-id { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ref-title { font-weight: 500; }
.ref-meta { display: block; color: var(--ink-3); font-size: 0.9375rem; margin-top: 2px; }
.url { overflow-wrap: anywhere; word-break: break-word; }
.refs .url { display: block; margin-top: 2px; }
.glossary { margin: 0; }
.glossary dt { font-weight: 700; margin-top: 14px; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0; color: var(--ink-2); max-width: var(--measure); }

/* ------------------------------------------------------------------ dialog and messages */
html.has-modal { overflow: hidden; }
.modal-backdrop { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 90; background: rgba(13, 21, 40, 0.6); display: grid; place-items: center; padding: 18px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 24px 26px 20px; box-shadow: var(--shadow); }
.modal-title { margin-bottom: 14px; font-size: 1.7rem; }
.modal-body { display: grid; gap: 10px; }
.modal-body p { margin: 0; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.copy-field { font-size: 0.9375rem; resize: vertical; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 95; display: grid; gap: 8px; width: min(520px, calc(100vw - 28px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; box-shadow: var(--shadow); animation: rise 0.2s ease-out both; }
.toast-action { background: transparent; border: 1.5px solid currentColor; color: inherit; border-radius: 4px; padding: 4px 12px; font-weight: 600; cursor: pointer; flex: none; }

/* ------------------------------------------------------------------ frame: sidebar, top bar, page
   A sidebar in the colour of a departure board on the left, the pages on the right. */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--board) var(--side), transparent var(--side)); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--board); color: var(--on-board); display: flex; flex-direction: column; gap: 18px; padding: 22px 16px 18px; border-right: 1px solid var(--board-line); z-index: 60; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; }
.side-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-board); text-decoration: none; }
.side-brand .brand-mark { width: 22px; height: 22px; border-radius: 50%; background: var(--signal); border: 6px solid #fff; flex: none; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.side-brand-name { font: 700 1.55rem/1 var(--display); }
.side-brand-sub { color: var(--on-board-2); font-size: 0.875rem; margin-top: 3px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 4px; color: var(--on-board-2); text-decoration: none; font-weight: 500; border-left: 4px solid transparent; }
.side-nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-board); }
.side-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: var(--on-board); font-weight: 600; border-left-color: var(--signal); }
.side-nav a:focus-visible { outline: 3px solid var(--signal); outline-offset: 1px; }
.side-nav-label { margin: 14px 0 4px; padding: 0 16px; font-size: 0.875rem; font-weight: 600; color: var(--on-board-2); }
.nav-icon { width: 22px; height: 22px; flex: none; display: inline-flex; }
.nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-card { border: 1px solid var(--board-line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; font-size: 0.9375rem; color: var(--on-board-2); }
.side-card-title { font-size: 0.875rem; font-weight: 600; margin: 0; }
.side-card p { margin: 0; overflow-wrap: anywhere; }
.side-city { font: 700 1.25rem/1.15 var(--display); color: var(--on-board); }
.side-tools { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px; }
.side-btn { min-height: 40px; padding: 6px 14px; border-radius: 6px; border: 1.5px solid var(--board-line); background: transparent; color: var(--on-board); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.side-btn:hover { background: rgba(255, 255, 255, 0.08); }
.side-btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.side-btn.side-close { display: none; }
.theme-glyph { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.scrim { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; min-height: 62px; padding: 10px clamp(16px, 3vw, 36px); background: var(--surface); border-bottom: 1px solid var(--hair); }
.menu-btn { display: none; }
.topbar-scope { margin: 0; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; font-size: 0.9844rem; }
.topbar-scope strong { color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
main { flex: 1; outline: none; }
.page { width: 100%; max-width: var(--page); margin: 0 auto; padding: clamp(24px, 4vw, 44px) clamp(16px, 3vw, 36px) 64px; }
.page-title { margin-bottom: 10px; }
.page-lede { font-size: 1.125rem; color: var(--ink-2); max-width: 68ch; margin-bottom: 28px; }
.site-footer { border-top: 1px solid var(--hair); background: var(--surface); padding: 20px clamp(16px, 3vw, 36px) 26px; color: var(--ink-3); font-size: 0.9375rem; }
.site-footer p { max-width: 92ch; margin-bottom: 6px; }

/* ------------------------------------------------------------------ building blocks */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: clamp(18px, 2.4vw, 26px); min-width: 0; }
.page > * + *, .result-body > * + *, .card + .card, .card + .section-block, .section-block + .card, .section-block + .section-block { margin-top: var(--gap); }
.page > .page-title + .page-lede { margin-top: 0; }
.page > .page-lede + * { margin-top: 0; }
.card > :last-child, .card p:last-child, .step-box p:last-child { margin-bottom: 0; }
.card .section-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--hair); }
.bullets + p, .bullets + .table-scroll, .bullets + h3 { margin-top: 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-note { color: var(--ink-3); font-size: 0.9375rem; margin: 0; }
.card-link { margin: 12px 0 0; }
.section-block > h2 { margin-bottom: 12px; }
.section-block > h3, .card > h3 { margin-bottom: 10px; }
.label-head { font: 600 1.0625rem/1.3 var(--font); margin: 0 0 8px; }
.label-line { font-weight: 600; margin: 12px 0 4px; }
.prose > h2 { margin-bottom: 14px; }
.prose > h3 { margin: 20px 0 8px; }
.prose p, .prose li { max-width: var(--measure); }
.prose .table-scroll + p { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-2 > .card + .card { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.stack { display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.muted { color: var(--ink-3); }
.small { font-size: 0.9375rem; }
.tiny { font-size: 0.8125rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875em; }
.bullets { padding-left: 1.2em; display: grid; gap: 6px; }
.bullets li { max-width: 86ch; }
.ref-btn { background: none; border: 0; padding: 0; color: var(--link); font-size: 0.8125rem; font-weight: 500; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; white-space: nowrap; }
.ref-btn:hover { text-decoration-style: solid; }
.cell-sub + .ref-btn, .numeric .ref-btn { display: inline-block; margin-top: 2px; }
.note-wide { margin-top: var(--gap); max-width: 86ch; }
.pos { color: var(--up); } .neg { color: var(--down); }
.diff-pos { color: var(--up); font-weight: 600; } .diff-neg { color: var(--down); font-weight: 600; }
.toc-title { font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.toc-list { columns: 2 240px; column-gap: 32px; padding-left: 1.3em; }
.toc-list li { padding: 3px 0; break-inside: avoid; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 4px; font-size: 0.875rem; font-weight: 600; border: 1px solid; white-space: nowrap; line-height: 1.5; }
.badge-pass { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.badge-fail { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-line); }
.badge-unknown { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.badge-info { background: var(--well); color: var(--ink-2); border-color: var(--rail); }

/* ------------------------------------------------------------------ the main page: our answer to the contest question */
.answer-head { max-width: 900px; }
.answer-kicker { font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.answer-head .page-lede { margin-bottom: 0; }
.answer-board { margin-top: 24px; }
.page > .answer-note { margin-top: 10px; }
.answer-map .data-table td { white-space: normal; }
.answer-jump { font-weight: 600; }
.answer-map > h2 { margin-bottom: 10px; }
.answer-sec > h3 { margin-top: 22px; }
.answer-sec .table-scroll { margin: 12px 0 14px; }
.answer-sec .data-table td, .answer-sec .data-table th { line-height: 1.45; }
.answer-steps { margin-bottom: 4px; }
.answer-top tbody th { white-space: nowrap; }
.answer-bars { margin: 6px 0 4px; max-width: 760px; }
.answer-bars .mini-bar { grid-template-columns: minmax(150px, 260px) minmax(0, 1fr) 110px; }
.answer-filter { max-width: 360px; margin: 6px 0 4px; }
.row-off th, .row-off td { background: var(--warn-bg); }
.answer-limits li { max-width: 92ch; }
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius); padding: 16px 20px; margin-top: 16px; }
.resume-title { font: 600 1.0625rem/1.3 var(--font); margin: 0 0 4px; }
.resume-text { margin: 0 0 4px; }
.resume .small { margin: 0; }
.home-links li { max-width: 80ch; }

/* ------------------------------------------------------------------ the steps of Find a city and Check a city */
.step-box { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: clamp(18px, 2.4vw, 26px); min-width: 0; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 16px; }
.step-head h2 { margin: 0; }
.step-head .card-note { margin-left: auto; }
.step-num { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: 4px; background: var(--ink); color: var(--paper); font: 700 1.45rem/1 var(--display); font-variant-numeric: tabular-nums; }
.run-step .run-bar { border: 0; border-radius: 0; padding: 0; background: none; }
.run-bar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.priorities-bar { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 16px 22px; }
.priorities-bar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.priorities-bar-title { font-size: 1.35rem; }
.priorities-bar-title span { font-weight: 600; }
.priorities-bar .mini-bars { margin-top: 10px; max-width: 620px; }

/* ------------------------------------------------------------------ limits: one large section, hard to miss */
.limits-step { background: var(--surface); border: 2px solid var(--ink); border-top: 8px solid var(--signal); border-radius: var(--radius); padding: clamp(20px, 3vw, 30px); min-width: 0; }
.limits-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.limits-head h2 { font-size: clamp(2rem, 3.4vw, 2.6rem); }
.limits-step .step-num { width: 48px; height: 48px; font-size: 1.9rem; background: var(--signal); color: var(--on-signal); }
.limits-lead { font-size: 1.125rem; max-width: 72ch; margin: 0 0 18px; }
.limits-lead strong { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.limits-empty { margin: 0; padding: 14px 16px; background: var(--well); border-radius: var(--radius-s); font-weight: 500; }
.lim-list { display: grid; gap: 12px; }
.lim { border: 1.5px solid var(--rail); border-radius: var(--radius-s); background: var(--paper); padding: 16px 18px; display: grid; gap: 10px; min-width: 0; }
.lim.is-on { border: 2px solid var(--ink); background: var(--surface); padding: 15.5px 17.5px; }
.lim > * { margin: 0; }
.lim-head { display: flex; align-items: center; gap: 12px; }
.lim-switch { width: 26px; height: 26px; margin: 0; flex: none; accent-color: var(--ink); cursor: pointer; }
.lim-name { font: 700 1.55rem/1.1 var(--display); cursor: pointer; }
.lim-question { font-size: 1.0625rem; }
.lim-fields { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.lim-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.lim-word { font-weight: 600; min-width: 4.6em; }
.lim-before { display: inline-block; min-width: 0.7em; font: 700 1.6rem/1 var(--display); }
.lim-input { width: 9em; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lim-after { color: var(--ink-2); font-weight: 500; }
.lim-what { font-size: 0.9375rem; color: var(--ink-2); max-width: 88ch; }
.lim .fold-small { margin-top: -6px; }
.lim .fold-small > summary { display: inline-flex; padding-left: 0; }
.lim .fold-small > summary::after { margin-left: 4px; }
.lim .fold-small .fold-body { padding: 0 4px 4px; }
.lim .fold-small .fold-body p { margin: 0 0 4px; color: var(--ink-2); max-width: 88ch; }
.lim-count { font-size: 1rem; color: var(--ink-2); }
.lim-count strong { color: var(--ink); font-size: 1.125rem; }
.lim-error { color: var(--err-ink); background: var(--err-bg); border-left: 4px solid var(--err-line); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 8px 12px; font-weight: 500; }
.lim-prompt { color: var(--warn-ink); background: var(--warn-bg); border-left: 4px solid var(--warn-line); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 8px 12px; font-weight: 500; }
.limits-step .notice { margin: 0 0 14px; }
.lim-unavailable { margin-top: 14px; padding: 12px 16px; border: 1px solid var(--hair); border-radius: var(--radius-s); color: var(--ink-2); }
.lim-unavailable-title { font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.lim-total { margin-top: 18px; background: var(--board); color: var(--on-board); border-radius: var(--radius-s); padding: 16px 20px; display: grid; gap: 4px; }
.lim-total strong { font: 700 clamp(1.7rem, 2.8vw, 2.1rem)/1.05 var(--display); font-variant-numeric: tabular-nums; }
.lim-total span { color: var(--on-board-2); max-width: 80ch; }
.lim-total a { color: var(--signal); font-weight: 600; justify-self: start; }
.lim-total.is-none strong { color: var(--signal); }
.lim-total.is-error { background: var(--err-bg); color: var(--err-ink); border: 2px solid var(--err-line); }
.lim-total.is-error span { color: var(--err-ink); }

/* ------------------------------------------------------------------ choosing a city, settings in short */
.pick-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.search-results { list-style: none; margin: 6px 0 0; padding: 6px; border: 1px solid var(--hair); border-radius: var(--radius-s); background: var(--surface); max-height: 320px; overflow-y: auto; box-shadow: var(--shadow); }
.search-results li + li { margin-top: 2px; }
.search-none { padding: 8px 10px; }
.search-hit { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 4px; padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.search-hit:hover, .search-hit:focus-visible { background: var(--well); }
.search-hit-sub { color: var(--ink-3); font-size: 0.875rem; text-align: right; }
.scope-box { border: 1px solid var(--hair); border-radius: var(--radius-s); padding: 12px 14px; display: grid; gap: 10px; }
.city-card { background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius-s); padding: 18px 20px; }
.city-card h3 { margin-bottom: 4px; font-size: 1.45rem; }
.country-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.country-row .select { width: auto; min-width: 260px; max-width: 100%; }
.find-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; }
.find-controls + .field { margin-top: 14px; }
.compare-country { max-width: 420px; }
.compare-country + .vs { margin-top: 16px; }
.mini-bars { display: grid; gap: 7px; }
.mini-bar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 0.9375rem; }
.mini-bar-track { height: 10px; background: var(--well); border-radius: 2px; overflow: hidden; }
.mini-bar-track i { display: block; height: 100%; }
.mini-bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.run-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; background: var(--surface); border: 1px solid var(--hair); border-left: 6px solid var(--signal); border-radius: var(--radius); padding: 16px 22px; }
.run-bar-text { margin: 0; color: var(--ink-2); max-width: 70ch; }
.btn-run { min-height: 54px; padding: 10px 28px; font: 700 1.35rem/1 var(--display); border-radius: 6px; }

/* ------------------------------------------------------------------ progress of a calculation */
.progress { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 16px 22px; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--well); overflow: hidden; margin: 8px 0 14px; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--signal); transition: width 0.25s ease; }
.progress-steps { list-style: none; display: grid; gap: 8px; }
.progress-step { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; color: var(--ink-3); }
.progress-step .dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--rail); margin-top: 3px; }
.progress-step.is-active { color: var(--ink); }
.progress-step.is-active .dot { border-color: var(--signal); background: var(--signal); animation: pulse 1s ease-in-out infinite; }
.progress-step.is-done { color: var(--ink-2); }
.progress-step.is-done .dot { border-color: var(--ok-line); background: var(--ok-line); }
.progress-step.is-error { color: var(--err-ink); }
.progress-step.is-error .dot { border-color: var(--err-line); background: var(--err-line); }
.progress-detail { font-size: 0.875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.progress.is-finished { padding: 10px 18px; border-left: 6px solid var(--ok-line); }
.progress.is-finished > strong { color: var(--ok-ink); }
.progress-summary { color: var(--ink-2); }
.progress-fold { margin-top: 4px; }
.progress-fold .fold-body { padding-bottom: 6px; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------------ results */
.stale { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; border: 2px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 18px; margin: 0 0 var(--gap); }
.stale p { margin: 0; font-weight: 500; max-width: 80ch; }
.results.is-stale .result-body { opacity: 0.72; }
.verdict { background: var(--board); color: var(--on-board); border-radius: var(--radius); padding: clamp(20px, 3vw, 30px); border-top: 6px solid var(--signal); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: start; }
.verdict-scope { color: var(--on-board-2); margin: 0 0 8px; font-size: 0.9375rem; }
.verdict-city { font: 700 clamp(2.1rem, 4.4vw, 3.2rem)/1 var(--display); margin: 0 0 10px; overflow-wrap: anywhere; }
.verdict-badge { margin: 0 0 16px; }
.verdict .badge { border-color: currentColor; }
.verdict-lines { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; max-width: 78ch; }
.verdict-lines dt { color: var(--on-board-2); font: 600 1.0625rem/1.4 var(--display); }
.verdict-lines dd { margin: 0; }
.plate { background: var(--signal); color: var(--on-signal); border-radius: var(--radius); padding: 16px 22px 14px; display: flex; flex-direction: column; min-width: 200px; }
.plate-label { font-weight: 600; }
.plate-score { font: 700 clamp(3.2rem, 6vw, 4.4rem)/0.98 var(--display); font-variant-numeric: tabular-nums; }
.plate-under { font-size: 1rem; }
.plate-none { background: var(--well); color: var(--ink); }
.limit-table td, .limit-table th { vertical-align: middle; }
.limit-table .badge { font-size: 0.8125rem; }
.state-cell { white-space: nowrap; }
.contrib-list { list-style: none; display: grid; gap: 10px; margin: 0; }
.contrib { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding-bottom: 10px; border-bottom: 1px solid var(--hair); }
.contrib:last-child { border-bottom: 0; padding-bottom: 0; }
.contrib-name { font-weight: 600; }
.contrib-points { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.contrib-detail { grid-column: 1 / -1; color: var(--ink-2); font-size: 0.9375rem; }
.alt-intro { max-width: 80ch; }
.alt-list, .match-list { list-style: none; display: grid; gap: 14px; margin: 0; }
.alt { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px 16px; border-left: 6px solid var(--ok-line); }
.card .alt { background: var(--paper); }
.alt-no, .match-no { font: 700 1.9rem/1 var(--display); color: var(--ink-3); }
.alt-name, .match-name { font: 700 1.5rem/1.1 var(--display); margin: 0 0 4px; }
.alt-compare { margin: 0; font-size: 0.9375rem; color: var(--ink-2); font-weight: 500; }
.alt-score, .match-score { text-align: right; }
.alt-score strong, .match-score strong { font: 700 2.2rem/1 var(--display); font-variant-numeric: tabular-nums; display: block; }
.match-score span { color: var(--ink-3); font-size: 0.9375rem; font-weight: 500; }
.alt-body { grid-column: 2 / -1; display: grid; gap: 8px; }
.alt-body p { margin: 0; }
.alt-facts, .match-facts { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 0.9375rem; color: var(--ink-2); margin: 0; }
.alt-reasons { padding-left: 1.1em; margin: 0; display: grid; gap: 3px; font-size: 0.9844rem; }
.near { border-left-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.card .near { background: var(--warn-bg); }
.near .alt-no, .near .muted { color: var(--warn-ink); }
.near-flag { font-weight: 700; font-size: 0.9375rem; margin: 0 0 2px; }
.find-line { max-width: 82ch; }
.match { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px 16px; border-left: 6px solid var(--ok-line); }
.match-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 16px; }
.match-score { margin: 0; flex: none; display: flex; align-items: baseline; gap: 6px; }
.match-score strong { font-size: 2rem; display: inline; }
.match-main { display: grid; gap: 8px; min-width: 0; }
.match-main > * { margin: 0; }
.match-flag { display: inline-block; margin-left: 10px; vertical-align: middle; font: 600 0.8125rem/1.4 var(--font); color: var(--ink-2); background: var(--well); border-radius: 4px; padding: 1px 8px; }
.match-text { color: var(--ink-2); max-width: 80ch; }
.folds .fold:first-child { border-top: 1px solid var(--hair); }
.tools-row { display: flex; flex-wrap: wrap; gap: 10px; }
.empty-state { text-align: left; border: 1px solid var(--hair); border-radius: var(--radius); padding: clamp(20px, 4vw, 32px); background: var(--surface); }
.empty-state h2, .empty-state h3 { margin-bottom: 8px; }
.empty-state p { margin: 0; max-width: 72ch; }
.h2h-lead { font-size: 1.0625rem; max-width: 80ch; }
.h2h-badges { margin-bottom: 16px; }

/* ------------------------------------------------------------------ priorities and limits */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 2px solid var(--hair); }
.tabs + .card { margin-top: 18px; }
.card.tab-plain { border: 0; padding: 0; background: none; }
.tab { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; border-radius: 4px 4px 0 0; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover { color: var(--ink); background: var(--well); }
.presets-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.preset-note { margin: 12px 0 0; color: var(--ink-2); }
.panel-intro { max-width: 80ch; color: var(--ink-2); }
.wrow { display: grid; grid-template-columns: minmax(150px, 0.9fr) minmax(0, 1.6fr) 96px minmax(120px, 0.6fr); gap: 8px 18px; align-items: center; padding: 12px 10px; margin: 0 -10px; border-bottom: 1px solid var(--hair); border-radius: 4px; }
.wrow:last-child { border-bottom: 0; }
.wrow-name { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.wrow-name label { overflow-wrap: anywhere; }
.wrow-sub { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.875rem; }
.wrow input[type="range"] { width: 100%; accent-color: var(--ink); height: 32px; cursor: pointer; }
.wrow input[type="number"] { width: 100%; }
.wrow-share { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9375rem; color: var(--ink-2); }
.wrow-share strong { color: var(--ink); font-size: 1.05rem; }
.wrow.is-off { background: var(--well); }                          /* marked by a tint, not by fading: the text keeps its contrast */
.wrow.is-off .wrow-share, .wrow.is-off .wrow-share span, .wrow.is-off .wrow-sub { color: var(--ink-2); }
.wrow.is-off input[type="range"] { accent-color: var(--stop); }
.area-block { border: 1px solid var(--hair); border-radius: var(--radius); padding: 4px 18px; margin-top: 14px; background: var(--surface); }
.area-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0 8px; border-bottom: 1px solid var(--hair); }
.area-block-head h3 { margin: 0; font-size: 1.25rem; }
.area-block-head .swatch { width: 14px; height: 14px; }
.sticky-run { position: sticky; bottom: 12px; z-index: 30; padding: 12px 18px; box-shadow: var(--shadow); }
.sticky-run .btn-run { min-height: 46px; font-size: 1.2rem; padding: 8px 22px; }

/* ------------------------------------------------------------------ comparison */
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: end; }
.vs-sep { font: 700 1.2rem/1 var(--display); color: var(--ink-3); padding-bottom: 12px; }

/* ------------------------------------------------------------------ narrower screens */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; transition: transform 0.22s ease, visibility 0s linear 0.22s; }
  html.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); transition: transform 0.22s ease; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(13, 21, 40, 0.55); }
  .scrim[hidden] { display: none; }
  .side-btn.side-close { display: inline-flex; }
  .menu-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 6px; border: 1.5px solid var(--rail); background: var(--surface); font-weight: 600; cursor: pointer; }
  .menu-btn:hover { background: var(--well); }
  .menu-btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
  .pick-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  /* One column: the parts of the board are laid out in reading order, with the score straight after the name. */
  .verdict { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
  .verdict > div:first-child { display: contents; }
  .verdict-scope { order: 1; margin: 0; }
  .verdict-city { order: 2; margin: 0; }
  .verdict .plate { order: 3; justify-self: start; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 10px 18px; min-width: 0; }
  .verdict .plate-score { font-size: 2.8rem; }
  .verdict-badge { order: 4; margin: 0; }
  .verdict-lines { order: 5; }
}
@media (max-width: 760px) {
  :root { --gap: 18px; }
  .wrow { grid-template-columns: minmax(0, 1fr) 86px; }
  .wrow-name { grid-column: 1 / -1; }
  .wrow-share { grid-column: 1 / -1; text-align: left; }
  .lim { padding: 14px; }
  .lim.is-on { padding: 13.5px; }
  .lim-name { font-size: 1.4rem; }
  .lim-field { flex: 1 1 100%; }
  .lim-word { flex: 1 1 100%; min-width: 0; }
  .lim-before:empty { display: none; }
  .lim-input { width: 7.5em; flex: 0 1 7.5em; min-width: 0; }
  .run-bar-controls { width: 100%; }
  .alt, .match { grid-template-columns: 34px minmax(0, 1fr); padding: 16px; }
  .alt-score { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .alt-score strong, .match-score strong { font-size: 1.8rem; }
  .alt-body { grid-column: 1 / -1; }
  .vs { grid-template-columns: minmax(0, 1fr); }
  .vs-sep { padding: 0; }
  .mini-bar { grid-template-columns: 108px minmax(0, 1fr) 50px; }
  .topbar { min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  .topbar-scope { display: none; }
  .sticky-run { position: static; box-shadow: none; }
  .btn-run { min-height: 50px; font-size: 1.25rem; padding: 10px 22px; }
  .gap-row, .gap-head { grid-template-columns: 112px minmax(0, 1fr) 92px; gap: 10px; }
  .range-row { grid-template-columns: 104px minmax(0, 1fr) 64px; gap: 10px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 6px; }
  .verdict-lines { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .verdict-lines dd { margin-bottom: 8px; }
  .refs li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .limit-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .limit-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--hair); }
  .limit-table th, .limit-table td { display: block; border: 0; padding: 3px 0; text-align: left !important; white-space: normal; }
  .limit-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-2); }
  .limit-table .cell-sub { display: inline; margin-left: 6px; }
  .country-row .select { min-width: 0; width: 100%; }
}
@media (max-width: 420px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .plate { min-width: 0; }
  .btn-run { width: 100%; }
  .data-table { font-size: 0.9375rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .card { padding: 16px; }
  .area-block { padding: 4px 12px; }
  .tab { padding: 8px 9px; font-size: 0.9375rem; }
  .topbar-actions .badge { display: none; }
}

/* ------------------------------------------------------------------ motion, contrast, print */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .gap-bar, .swatch, .range-mid, .range-dot, .mini-bar-track i, .progress-bar i { forced-color-adjust: none; }
  .btn, .chip, .plate, .tile, .card, .step-box, .limits-step, .lim, .lim-total, .priorities-bar, .notice, .badge, .alt, .match { border: 2px solid CanvasText; }
}
@media print {
  @page { margin: 14mm; }
  :root { --paper: #fff; --surface: #fff; --well: #f1f1f1; --ink: #000; --ink-2: #222; --ink-3: #444; --hair: #bbb; --board: #fff; --on-board: #000; --on-board-2: #333; }
  body { font-size: 11pt; }
  .app { display: block; background: none; }
  .sidebar, .topbar, .skip-link, .toasts, .modal-backdrop, .scrim, .run-bar, .progress, .tools-row, .btn, .btn-link, .ref-btn, .tabs, .site-footer a { display: none !important; }
  .verdict { border: 2px solid #000; }
  .plate { border: 2px solid #000; }
  .card, .alt, .match, tr { break-inside: avoid; }
  .fold > summary::after { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------------------------------------------------------- charts of the student survey
   Colours: the validated categorical palette (light on white, dark on the dark card), always with a label or a
   legend that gives the numbers, and a table view. */
.viz-s1 { fill: var(--viz-1); background: var(--viz-1); } .viz-s2 { fill: var(--viz-2); background: var(--viz-2); }
.viz-s3 { fill: var(--viz-3); background: var(--viz-3); } .viz-s4 { fill: var(--viz-4); background: var(--viz-4); }
.viz-s5 { fill: var(--viz-5); background: var(--viz-5); }
.viz text { font-family: var(--font); fill: var(--ink-2); }
.viz-axis { stroke: var(--rail); stroke-width: 1; }
.viz-val { font-size: 11px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.viz-tick { font-size: 11px; fill: var(--ink-3); }
.viz-hit { fill: transparent; }
.viz-mark:hover .viz-s1 { opacity: 0.8; }
.col-chart { display: block; width: 100%; max-width: 460px; height: auto; }
.viz-slice { stroke: var(--surface); stroke-width: 1.5; }
.viz-slice:hover { opacity: 0.85; }
.pie-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.pie { width: 150px; height: 150px; flex: none; }
.viz-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9375rem; }
.viz-legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.viz-legend li.is-zero { color: var(--ink-3); }
.viz-legend-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.viz-legend-row { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 12px; }
.viz-legend-row li { display: flex; }
.viz-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.bar-list { display: grid; gap: 8px; }
.bar-list .mini-bar { grid-template-columns: minmax(120px, 240px) minmax(0, 1fr) 96px; }
.bar-list-wide .mini-bar { grid-template-columns: minmax(150px, 300px) minmax(0, 1fr) 120px; }
.bar-list .mini-bar-track { height: 12px; border-radius: 0 3px 3px 0; }
.bar-label { display: flex; flex-direction: column; }
.bar-sub { font-size: 0.8125rem; color: var(--ink-3); }
.weight-sets { display: grid; gap: 14px; }
.weight-set { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 6px 14px; align-items: center; }
.weight-set-name { font-weight: 600; }
.weight-set-bars { display: grid; gap: 3px; }
.weight-set-bars .mini-bar { grid-template-columns: minmax(0, 1fr) 52px; }
.weight-set-bars .mini-bar-track { height: 8px; border-radius: 0 3px 3px 0; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.chart-tile h3 { margin: 0 0 2px; font-size: 1.0625rem; }
.chart-tile .chart-sub { margin: 0 0 8px; color: var(--ink-3); font-size: 0.875rem; }
.viz-none { border: 1.5px solid var(--rail); }
@media (max-width: 560px) {
  .bar-list .mini-bar, .bar-list-wide .mini-bar { grid-template-columns: minmax(0, 1fr) 84px; }
  .bar-list .mini-bar .mini-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .weight-set { grid-template-columns: 1fr; }
}
/* ---------------------------------------------------------------- reading aids */
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 40; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font: 600 0.9375rem/1 var(--font); cursor: pointer; box-shadow: 0 4px 14px rgba(20, 33, 61, 0.18); }
.to-top:hover { background: var(--ink); color: var(--paper); }
.to-top[hidden] { display: none; }
.in-short { margin: 0 0 14px; padding: 10px 14px; border-left: 4px solid var(--signal); background: var(--well); border-radius: 0 var(--radius) var(--radius) 0; }
.in-short-box ul { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
.page-toc { margin: 8px 0 0; padding-left: 1.4em; display: grid; gap: 4px; }
.survey-quote { margin: 12px 0 16px; padding: 12px 16px; border-left: 4px solid var(--rail); background: var(--well); border-radius: 0 var(--radius) var(--radius) 0; }
.survey-quote p { margin: 0 0 6px; } .survey-quote p:last-child { margin: 0; }
.step-hint { margin: 0 0 12px; color: var(--ink-2); }
.quick-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.quick-picks-label { font-weight: 600; margin-right: 4px; }
.chip-small { min-height: 36px; padding: 5px 12px; font-size: 0.9375rem; }
.skip-results { margin: 0 0 12px; font-weight: 600; }
.limits-rules { margin: 4px 0 14px; }
