/* Every street — calm map UI. Colours are per theme; map colours live in themes.js. */
:root, [data-theme="night"] {
  --bg: #05080f;
  --bg-rgb: 5, 8, 15;
  --hero-glow: #0b1322;
  --panel: rgba(9, 13, 22, 0.88);
  --panel-solid: #0b111c;
  --line: rgba(190, 215, 240, 0.10);
  --line-2: rgba(190, 215, 240, 0.18);
  --ink: #eef3f8;
  --muted: #9aa6b6;
  --faint: #66748a;
  --trace: #52d4e6;
  --trace-ink: #04131a;
  --warm: #ffb547;
  --warm-ink: #1d1203;
  --pink: #ff4f8b;
  --violet: #a78bfa;
  --violet-ink: #140b2a;
  --ok: #7ef0b0;
  --shadow: 0 16px 50px rgba(0, 0, 0, .45);
  --text-shadow: 0 2px 30px rgba(5, 8, 15, .85);
  color-scheme: dark;
}
[data-theme="graphite"] {
  --bg: #111214;
  --bg-rgb: 17, 18, 20;
  --hero-glow: #17191c;
  --panel: rgba(22, 23, 26, 0.9);
  --panel-solid: #18191c;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --ink: #ececec;
  --muted: #a3a6ab;
  --faint: #6f737a;
  --trace: #a3c6d4;
  --trace-ink: #0f1a1f;
  --warm: #ffa23a;
  --warm-ink: #1f1203;
  --pink: #ff5a7a;
  --violet: #b39cff;
  --violet-ink: #160d2c;
  --ok: #8fe3b4;
  --shadow: 0 16px 50px rgba(0, 0, 0, .5);
  --text-shadow: 0 2px 30px rgba(17, 18, 20, .85);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f2f0eb;
  --bg-rgb: 242, 240, 235;
  --hero-glow: #f7f6f2;
  --panel: rgba(251, 250, 247, 0.96);
  --panel-solid: #fbfaf7;
  --line: rgba(30, 35, 45, 0.10);
  --line-2: rgba(30, 35, 45, 0.18);
  --ink: #1d2229;
  --muted: #59616d;
  --faint: #868c96;
  --trace: #17708a;
  --trace-ink: #ffffff;
  --warm: #d9571b;
  --warm-ink: #ffffff;
  --pink: #d01f63;
  --violet: #5b3cc4;
  --violet-ink: #ffffff;
  --ok: #1d8a52;
  --shadow: 0 10px 30px rgba(40, 35, 25, .12);
  --text-shadow: 0 1px 18px rgba(242, 240, 235, .9);
  color-scheme: light;
}
:root {
  --radius: 14px;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--sans); font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s;
}
a { color: var(--trace); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
b, strong { font-weight: 500; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--trace); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Hero / map ─────────────────────────────────────────────────────────── */
.hero {
  position: relative; height: 88vh; height: 88svh; min-height: 560px; overflow: hidden;
  background: radial-gradient(ellipse at 55% 45%, var(--hero-glow) 0%, var(--bg) 70%);
  isolation: isolate;
}
.map { position: absolute; inset: 0; }
.map-error { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); margin: 0; }
.vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(to top, rgba(var(--bg-rgb), .9) 0%, rgba(var(--bg-rgb), .5) 15%, rgba(var(--bg-rgb), 0) 36%),
    linear-gradient(to bottom, rgba(var(--bg-rgb), .7) 0%, rgba(var(--bg-rgb), 0) 16%);
  transition: opacity .5s var(--ease);
}
.hero:not([data-mode="coverage"]) .vignette { opacity: .5; }
.hero > :not(.map):not(.vignette) { z-index: 2; }

.loadbar { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; pointer-events: none; }
.loadbar::after {
  content: ''; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--trace), transparent);
  animation: load 1.3s var(--ease) infinite;
}
.loadbar.done { opacity: 0; transition: opacity .6s; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Title + preferences */
.brand { position: absolute; top: 24px; left: 32px; }
.brand::before {   /* soft backdrop so map labels don't run through the title */
  content: ''; position: absolute; inset: -30px -60px -24px -50px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--bg-rgb), .8), rgba(var(--bg-rgb), 0));
}
.title { margin: 0; font-weight: 500; font-size: 16px; letter-spacing: .005em; color: var(--ink); text-shadow: var(--text-shadow); }
.prefs { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.lang { display: flex; gap: 2px; }
.lang button {
  border: 0; background: none; padding: 2px 5px; cursor: pointer; border-radius: 5px;
  font-size: 11.5px; letter-spacing: .06em; color: var(--faint); transition: color .15s;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); }

/* Big number */
.hero-stats {
  position: absolute; left: 32px; bottom: 34px; margin: 0;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.hero:not([data-mode="coverage"]) .hero-stats { opacity: 0; transform: translateY(12px); pointer-events: none; }
.hero-stats p { margin: 0; }
.pct {
  display: flex; align-items: baseline;
  font-weight: 200; font-size: clamp(76px, 9vw, 136px); line-height: .9; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums; margin-bottom: 14px !important; text-shadow: var(--text-shadow);
}
.pct-unit { font-size: .4em; font-weight: 300; color: var(--muted); letter-spacing: 0; margin-left: .06em; }
html[lang="nb"] .pct-unit { margin-left: .22em; }
.hero-line { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; text-shadow: var(--text-shadow); }
.hero-line.dim { color: var(--muted); font-size: 15px; margin-top: 2px !important; }
.hero-meta { margin-top: 12px !important; font-size: 12.5px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.hero-meta a { color: var(--muted); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.skeleton { color: transparent !important; text-shadow: none; background: linear-gradient(90deg, var(--line), var(--line-2), var(--line)) 0 0/200% 100%;
  border-radius: 8px; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.info {
  display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; padding: 0; margin-left: 6px;
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; vertical-align: 2px;
}
.info:hover { color: var(--ink); border-color: var(--muted); }
.info-pop {
  display: block; max-width: 330px; margin-top: 8px; padding: 9px 12px; font-size: 13px; line-height: 1.45; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; text-shadow: none;
}

/* New nodes notice */
.gap-alert {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px 7px 12px; cursor: pointer;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--pink) 45%, transparent);
  background: var(--panel); font-size: 13px; color: var(--ink); box-shadow: var(--shadow);
}
.gap-alert:hover { border-color: var(--pink); }
.gap-alert::after { content: '→'; color: var(--pink); }
.gap-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); }
.hero[data-mode="history"] .gap-alert, .hero[data-mode="plan"] .gap-alert { display: none; }

/* Mode switch */
.modes {
  position: absolute; top: 22px; right: 24px; display: flex; padding: 4px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.modes button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: 7px 15px; border-radius: 999px; font-size: 13.5px; color: var(--muted); transition: color .2s;
}
.modes button:hover, .modes button[aria-pressed="true"] { color: var(--ink); }
.modes-ink {
  position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; z-index: 0;
  background: color-mix(in srgb, var(--trace) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--trace) 35%, transparent);
  transition: transform .35s var(--ease), width .35s var(--ease);
}

/* Map controls */
.controls { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; }
.ctl {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted);
  transition: color .15s, border-color .15s, background .15s;
}
.ctl:hover { color: var(--ink); border-color: var(--line-2); }
.ctl[aria-pressed="true"] { color: #fff; background: #3b9cff; border-color: #3b9cff; }
.ctl.busy svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Panel */
.panel {
  position: absolute; top: 76px; right: 76px; width: 360px; max-height: calc(100% - 100px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: rise .3s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 14px 14px 12px; gap: 12px; overflow: hidden; }
.pane[data-pane="plan"] { overflow: auto; overscroll-behavior: contain; }
.pane-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px; }
.search, .chips, .legend { flex: none; }
.pane-title { margin: 2px 2px 0; font-size: 16px; font-weight: 500; }
.pane-note { margin: -6px 2px 0; color: var(--muted); font-size: 13.5px; }
.pane-lead { margin: 2px 2px 10px; font-size: 14.5px; color: var(--ink); }
.pane-lead b { font-variant-numeric: tabular-nums; }
.pane-lead .muted { display: block; font-size: 13px; margin-top: 2px; }
.pad { padding: 8px; }
.sheet-handle { display: none; }

.search { position: relative; }
.search input {
  width: 100%; height: 42px; padding: 0 12px 0 38px; font: inherit; font-size: 15px; color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, transparent); border: 1px solid var(--line); border-radius: 11px; outline: none;
  transition: border-color .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: color-mix(in srgb, var(--trace) 60%, transparent); }
.search-icon { position: absolute; left: 12px; top: 12px; color: var(--faint); }
.search-results {
  position: absolute; z-index: 5; top: 46px; left: 0; right: 0; margin: 0; padding: 5px; list-style: none;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 11px; box-shadow: var(--shadow);
}
.search-results li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14.5px; }
.search-results li[aria-selected="true"], .search-results li:hover { background: color-mix(in srgb, var(--trace) 12%, transparent); }
.search-results li.empty { color: var(--muted); cursor: default; background: none; }
.sr-tag { color: var(--warm); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr-tag.done { color: var(--trace); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 12px; cursor: pointer;
  font-size: 13px; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line); background: transparent; border-radius: 999px; transition: color .15s, border-color .15s, background .15s;
}
.chip b { font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip[aria-pressed="true"], .chip.on { color: var(--warm-ink); background: var(--warm); border-color: var(--warm); }
.chip[aria-pressed="true"] b { color: inherit; opacity: .7; }
.chip-new[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: #fff; }
.chip.small { height: 27px; padding: 0 10px; font-size: 12.5px; }

.street-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.street-row {
  width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; text-align: left;
  padding: 9px 10px 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; transition: background .12s;
}
.street-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.sr-name { font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-note { font-size: 12.5px; color: var(--warm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-bar { grid-column: 1 / -1; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--warm) 25%, transparent); overflow: hidden; margin-top: 5px; }
.sr-bar i { display: block; height: 100%; background: var(--trace); opacity: .75; }
.street-row.is-new .sr-name::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%;
  border: 1.5px solid var(--pink); vertical-align: 1px; }
.ok { color: var(--ok); }

.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.back { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 2px; font-size: 13px; }
.back:hover { color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 9px; background: color-mix(in srgb, var(--ink) 6%, transparent); cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); }
.detail { padding: 0 2px; }
.detail-name { margin: 0 0 8px; font-size: 22px; font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
.detail-big { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.detail-big span:first-child { font-size: 32px; font-weight: 200; color: var(--warm); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-right: 4px; }
.meter { height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--warm) 25%, transparent); overflow: hidden; margin-bottom: 6px; }
.meter i { display: block; height: 100%; background: var(--trace); border-radius: 5px; transition: width .6s var(--ease); }
.tag-new, .tag-easy { display: inline-block; margin: 8px 6px 0 0; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.tag-new { color: var(--pink); border: 1px solid color-mix(in srgb, var(--pink) 50%, transparent); }
.tag-easy { color: var(--warm); border: 1px solid color-mix(in srgb, var(--warm) 50%, transparent); }
.detail .small { margin: 12px 0 0; }
.link { border: 0; background: none; padding: 0; color: var(--trace); cursor: pointer; font: inherit; text-align: left; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.quiet { font-size: .9em; color: var(--muted); }
.link.quiet:hover { color: var(--trace); }
.ext { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 8px 13px; border-radius: 10px;
  border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; }
.ext:hover { border-color: var(--trace); text-decoration: none; }
.ext svg { width: 15px; height: 15px; color: var(--trace); }

.near { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 18px; font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.eyebrow.small { margin: 4px 2px 6px; font-size: 11px; letter-spacing: .14em; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 10px 2px 0; border-top: 1px solid var(--line); list-style: none; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-red { background: var(--warm); }
.lg-vis { background: var(--trace); opacity: .7; width: 6px; height: 6px; }
.lg-new { border: 1.6px solid var(--pink); width: 11px; height: 11px; }

/* Plan */
.drop {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; border-radius: 12px; min-height: 52px;
  border: 1px dashed color-mix(in srgb, var(--violet) 50%, transparent); background: color-mix(in srgb, var(--violet) 6%, transparent);
  color: var(--muted); font-size: 14px; transition: background .15s, border-color .15s;
}
.drop:hover, .drop:focus-within { background: color-mix(in srgb, var(--violet) 12%, transparent); border-color: var(--violet); }
.drop b { color: var(--ink); }
.drop svg { color: var(--violet); width: 22px; height: 22px; }
.hero.dragging::after {
  content: attr(data-drop); position: absolute; inset: 12px; z-index: 10; display: grid; place-items: center;
  border: 2px dashed var(--violet); border-radius: 20px; background: color-mix(in srgb, var(--bg) 60%, transparent);
  font-size: 18px; color: var(--ink); pointer-events: none;
}
.course-list { display: flex; flex-wrap: wrap; gap: 6px; }
/* with a route loaded, its result comes first and the loader steps back */
.has-route .plan-result { order: -1; }
.has-route .pane[data-pane="plan"] .pane-title, .has-route .pane[data-pane="plan"] .pane-note { display: none; }
.has-route .drop { min-height: 0; padding: 9px 12px; font-size: 13px; }
.has-route .drop svg { width: 18px; height: 18px; }
.route-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.route-head p { margin: 0; }
.route-name { font-size: 17px; font-weight: 500; }
.route-sum { margin: 10px 2px; font-size: 14.5px; }
.thresholds { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.thresholds .muted { margin-right: 2px; }
.thresholds .chip[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: var(--violet-ink); }

/* Timeline */
.timeline {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); width: min(820px, calc(100% - 48px));
  display: flex; align-items: center; gap: 16px; padding: 12px 18px 12px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: rise .3s var(--ease);
}
.play {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none; cursor: pointer; border-radius: 50%;
  border: 0; background: var(--trace); color: var(--trace-ink);
}
.play svg { width: 20px; height: 20px; stroke-width: 2.4; }
.play:hover { filter: brightness(1.08); }
.tl-main { flex: 1; min-width: 0; }
.tl-read { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-year { font-size: 28px; font-weight: 200; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.tl-date { color: var(--muted); font-size: 14px; min-width: 4.5em; }
.tl-count { margin-left: auto; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-count b { color: var(--ink); font-weight: 400; }
.speeds { display: flex; gap: 1px; }
.speeds button {
  border: 0; background: none; cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 12px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.speeds button:hover { color: var(--ink); }
.speeds button[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.tl-track { position: relative; height: 34px; margin-top: 4px; }
.tl-note { margin: 2px 0 0; font-size: 12px; color: var(--faint); }
#tl-hist { position: absolute; left: 0; right: 0; bottom: 13px; width: 100%; height: 20px; }
#tl-range { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; margin: 0; height: 26px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#tl-range::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); border-radius: 2px; }
#tl-range::-moz-range-track { height: 2px; background: var(--line-2); border-radius: 2px; }
#tl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--ink); border: 3px solid var(--trace); }
#tl-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--trace); }

/* Tooltip, toast, popups, markers */
.tooltip {
  position: absolute; top: 0; left: 0; pointer-events: none; z-index: 6 !important; will-change: transform;
  padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; color: var(--ink);
  background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.toast {
  position: absolute; left: 50%; bottom: 110px; transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); font-size: 14px;
  transition: opacity .25s, transform .25s; z-index: 8 !important;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.maplibregl-popup.night .maplibregl-popup-content {
  background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 10px 30px 10px 13px; box-shadow: var(--shadow); font: 13.5px/1.4 var(--sans);
}
.maplibregl-popup.night .maplibregl-popup-close-button { color: var(--muted); font-size: 18px; width: 28px; height: 28px; border-radius: 8px; right: 2px; top: 2px; }
.maplibregl-popup.night .maplibregl-popup-close-button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.maplibregl-popup.night.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup.night.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup.night.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--panel-solid); }
.maplibregl-popup.night.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup.night.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup.night.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--panel-solid); }
.maplibregl-popup.night.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel-solid); }
.maplibregl-popup.night.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel-solid); }
.pp-title { margin: 0 0 3px; display: flex; align-items: center; gap: 6px; }
.pp-title b { font-weight: 500; }
.pp-title svg { color: var(--trace); width: 16px; height: 16px; }
.pp-sub { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }

.cl-badge {
  display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; cursor: pointer;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--warm) 70%, transparent); background: var(--panel-solid); color: var(--warm);
  font-size: 12px; transition: transform .15s;
}
.cl-badge:hover { transform: scale(1.1); }
.cl-badge.sel { background: var(--warm); color: var(--warm-ink); }
.done-ping { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--trace); }
.done-ping::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--trace); animation: ping 1.6s var(--ease) infinite; }
@keyframes ping { to { transform: scale(3); opacity: 0; } }

.maplibregl-ctrl-bottom-right { z-index: 3 !important; }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--bg) 75%, transparent) !important; color: var(--faint); font-size: 11px; }
.maplibregl-ctrl-attrib a, .maplibregl-ctrl-attrib-inner { color: var(--muted) !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: color-mix(in srgb, var(--bg) 75%, transparent) !important; }
[data-theme="night"] .maplibregl-ctrl-attrib-button, [data-theme="graphite"] .maplibregl-ctrl-attrib-button { filter: invert(.85); }
.maplibregl-ctrl-attrib-button { background-color: transparent !important; }
.maplibregl-ctrl-attrib.maplibregl-compact-show { padding-right: 30px; }

.scroll-cue { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); color: var(--faint); padding: 6px; transition: opacity .3s; }
.scroll-cue:hover { color: var(--ink); }
.hero:not([data-mode="coverage"]) .scroll-cue { opacity: 0; pointer-events: none; }

/* ── Below the fold ─────────────────────────────────────────────────────── */
.below { max-width: 1120px; margin: 0 auto; padding: 80px 32px 56px; }
.conquests { margin-bottom: 88px; }
.conquest-date { margin: 0 0 20px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 300; letter-spacing: -.01em; line-height: 1.2; }
.conquest-date .muted { font-size: 15px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.done-list { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.done-street {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 0; border: 0; background: none; cursor: pointer;
  font-size: 17px; color: var(--ink); text-align: left;
}
.done-street svg { color: var(--trace); width: 17px; height: 17px; stroke-width: 2; }
.done-street:hover span { text-decoration: underline; text-decoration-color: var(--trace); text-underline-offset: 4px; }
.more-streets { width: 100%; }
.more-streets summary { cursor: pointer; color: var(--muted); font-size: 15px; padding: 4px 0; }
.more-streets .done-list { margin-top: 10px; }
.conquest-more { margin-top: 40px; }
.earlier { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.earlier li { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.earlier-date { color: var(--faint); font-variant-numeric: tabular-nums; }
.earlier-names .link { color: var(--ink); }
.earlier-names .link:hover { color: var(--trace); }

.story { margin-bottom: 80px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 44px; }
.fact { display: flex; flex-direction: column; gap: 8px; padding: 22px 0 26px; border-top: 1px solid var(--line); }
.fact-num { font-size: 52px; font-weight: 200; letter-spacing: -.035em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.fact-text { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.45; }
.footnote { grid-column: 1 / -1; margin: 6px 0 0; color: var(--faint); font-size: 13px; }
.progress-fig { margin: 56px 0 0; max-width: 760px; }
/* not an icon: don't inherit the icon stroke (it outlined the labels and made them look bold) */
#progress-chart { display: block; width: 100%; height: auto; overflow: visible; stroke: none; stroke-width: 1; }
#progress-chart .axis { fill: var(--faint); font: 400 11.5px var(--sans); }
#progress-chart .val { fill: var(--muted); font: 400 12px var(--sans); font-variant-numeric: tabular-nums; }
#progress-chart .baseline { stroke: var(--line-2); stroke-width: 1; }
.progress-fig figcaption { margin-top: 10px; color: var(--muted); font-size: 13.5px; }

.foot { padding-top: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; max-width: 720px; }
.foot p { margin: 0 0 10px; }
.foot .muted { color: var(--faint); font-size: 13px; }

/* ── Phones ──────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .hero { height: calc(100vh - 54px); height: calc(100svh - 54px); min-height: 480px; }
  .brand { top: 14px; left: 16px; right: 70px; }
  .title { font-size: 15px; }
  .prefs { margin-top: 6px; gap: 12px; }

  .modes { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; right: 10px; }
  .modes button { flex: 1; padding: 0 4px; height: 42px; font-size: 13.5px; }

  .hero-stats { left: 16px; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); }
  .pct { font-size: 72px; margin-bottom: 10px !important; }
  .hero-line { font-size: 16px; }
  .hero-line.dim { font-size: 14px; }
  .hero-meta { margin-top: 10px !important; font-size: 12px; }

  .controls { top: 74px; right: 12px; transform: none; }
  #ctl-in, #ctl-out { display: none; }
  .ctl { width: 44px; height: 44px; }

  .gap-alert { top: 80px; left: 16px; transform: none; max-width: calc(100% - 84px); font-size: 12px; padding: 7px 12px; }

  .panel {
    top: auto; left: 8px; right: 8px; width: auto; bottom: calc(62px + env(safe-area-inset-bottom));
    max-height: 196px; border-radius: 18px; transition: max-height .35s var(--ease);
  }
  .panel.open { max-height: min(62%, 560px); }
  .sheet-handle { display: grid; place-items: center; height: 22px; padding: 0; border: 0; background: none; cursor: grab; flex: none; touch-action: none; }
  .sheet-handle span { width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); }
  .pane { padding: 0 12px 12px; gap: 10px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { height: 36px; }
  .panel:not(.open) .legend, .panel:not(.open) .pane-note { display: none; }
  .street-row { padding: 11px 10px 12px; }
  .drop { min-height: 56px; }

  .timeline { left: 8px; right: 8px; width: auto; transform: none; bottom: calc(62px + env(safe-area-inset-bottom)); padding: 10px 12px 10px 10px; gap: 12px; }
  .play { width: 44px; height: 44px; }
  .tl-year { font-size: 24px; }
  .tl-count { margin-left: 0; order: 3; font-size: 12.5px; }
  .speeds { margin-left: auto; }

  .scroll-cue { display: none; }
  .toast { bottom: 140px; width: max-content; max-width: calc(100% - 32px); }
  .maplibregl-ctrl-bottom-right { bottom: calc(56px + env(safe-area-inset-bottom)); }
  .hero:not([data-mode="coverage"]) .maplibregl-ctrl-bottom-right { bottom: auto; top: 8px; }
  .vignette { background:
    linear-gradient(to top, rgba(var(--bg-rgb), .95) 0%, rgba(var(--bg-rgb), .7) 26%, rgba(var(--bg-rgb), 0) 46%),
    linear-gradient(to bottom, rgba(var(--bg-rgb), .8) 0%, rgba(var(--bg-rgb), 0) 16%); }

  .below { padding: 48px 20px 40px; }
  .conquests { margin-bottom: 60px; }
  .done-street { font-size: 16.5px; }
  .earlier li { grid-template-columns: 62px 1fr; gap: 10px; font-size: 14.5px; }
  .fact { padding: 18px 0 20px; }
  .fact-num { font-size: 42px; }
  .fact-text { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
