:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  /* Precedent brand: logo ring blue, pink, green. Bright values are for fills; --accent is the text-safe blue */
  --brand-blue: #31a8f7;
  --brand-pink: #f4279d;
  --brand-green: #2fd12f;
  --brand-orange: #f97316;
  --brand-purple: #8b5cf6;
  --brand-teal: #14b8a6;
  --brand-red: #ef4444;
  --brand-amber: #eab308;
  --brand-indigo: #6366f1;
  --brand-lime: #84cc16;
  --accent: #0a72b8;
  --accent-ink: #ffffff;
  --tint: #eef7fe;
  /* city fills that carry text (white on light, ink on dark) */
  --wel-ink: #0a72b8;
  --akl-ink: #c2127a;
  --chc-ink: #1a7f1a;
  --act-ink: #c2410c;
  --cns-ink: #6d28d9;
  --vic-ink: #0f766e;
  --red-ink: #b91c1c;
  --amb-ink: #a16207;
  --ind-ink: #4338ca;
  --lim-ink: #4d7c0f;
  --city-on: #ffffff;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --nodata: #b9b7ae;
  --early: #2a78d6;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --worse: #f0a050;
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #4fb6f9;
    --accent-ink: #0b0b0b;
    --tint: #10202b;
    --wel-ink: #4fb6f9;
    --akl-ink: #f4279d;
    --chc-ink: #2fd12f;
    --act-ink: #fb923c;
    --cns-ink: #a78bfa;
    --vic-ink: #2dd4bf;
    --red-ink: #f87171;
    --amb-ink: #facc15;
    --ind-ink: #a5b4fc;
    --lim-ink: #a3e635;
    --city-on: #0b0b0b;
    --nodata: #5a5955;
    --early: #3987e5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --worse: #f0a050;
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #4fb6f9;
  --accent-ink: #0b0b0b;
  --tint: #10202b;
  --wel-ink: #4fb6f9;
  --akl-ink: #f4279d;
  --chc-ink: #2fd12f;
  --act-ink: #fb923c;
  --cns-ink: #a78bfa;
  --vic-ink: #2dd4bf;
  --red-ink: #f87171;
  --amb-ink: #facc15;
  --ind-ink: #a5b4fc;
  --lim-ink: #a3e635;
  --city-on: #0b0b0b;
  --nodata: #5a5955;
  --early: #3987e5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--ink); font: 14px/1.45 var(--font);
  display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }

/* header */
.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--brand-blue) 0 33.3%, var(--brand-pink) 33.3% 66.6%, var(--brand-green) 66.6%); }
.brand svg { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 6px; margin-left: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (hover: hover) { .tabs { scrollbar-width: thin; } }    /* a mouse can't swipe, so show the bar if they don't all fit */
.tabs a {
  padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--ink);
  font-weight: 550; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-selected="true"] { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--critical); box-shadow: 0 0 0 0 var(--critical); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208,59,59,.55); } 70% { box-shadow: 0 0 0 7px rgba(208,59,59,0); } 100% { box-shadow: 0 0 0 0 rgba(208,59,59,0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.icon-btn {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
/* only installed apps get the reload button: a browser tab has its own */
.icon-btn.reload { display: none; }
@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) { .icon-btn.reload { display: grid; } .icon-btn.reload + .icon-btn { margin-left: 6px; } }
.mapnote { position: absolute; z-index: 5; left: 50%; top: 40%; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.15); text-align: center; }
.icon-btn.small { margin: 0; width: 28px; height: 28px; font-size: 18px; line-height: 1; }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* map view */
.mapwrap { position: relative; flex: 1; min-height: 560px; }
.map { position: absolute; inset: 0; }
.panel {
  position: absolute; top: 16px; left: 16px; width: var(--panel-w, 400px); max-height: calc(100% - 200px);
  overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; z-index: 5; display: flex; flex-direction: column; gap: 12px;
}
#panel-live, #panel-trains { max-height: calc(100% - 32px); }
.peek { display: none; }
/* drag the panel's right edge to widen it (desktop); placed over the edge by JS */
.pgrip { position: absolute; z-index: 6; width: 10px; margin-left: -5px; cursor: ew-resize; touch-action: none; }
.pgrip::after { content: ""; position: absolute; left: 3px; top: 50%; width: 4px; height: 36px; margin-top: -18px; border-radius: 2px; background: var(--border); transition: background .15s; }
.pgrip:hover::after, .pgrip:focus-visible::after, .pgrip.drag::after { background: var(--accent); }
.pgrip:focus-visible { outline: none; }
body.resizing { cursor: ew-resize; user-select: none; }
.panel[hidden], .timeline[hidden], .routesview[hidden], .insights[hidden], .mapwrap[hidden] { display: none; }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; width: 100%; }
.search:focus-within { border-color: var(--accent); }
.results { list-style: none; margin: -6px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 10px; max-height: 260px; overflow: auto; background: var(--surface); }
.results li { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.results li:hover, .results li.on { background: var(--surface-2); }
.results .nm { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  display: inline-block; min-width: 34px; max-width: 13em; height: 22px; line-height: 22px; padding: 0 6px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; box-sizing: border-box;
  border-radius: 6px; font-weight: 650; font-size: 12px; background: var(--surface-2); color: var(--ink); flex: none;
  box-shadow: inset 0 0 0 1px var(--border);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.label .linkbtn { font-size: 12px; margin-left: 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.seg.wide, .panel .seg { display: flex; flex-wrap: nowrap; } .seg.wide button, .panel .seg button { flex: 1; padding: 5px 4px; white-space: nowrap; }
.legend { display: grid; grid-template-columns: 1fr; gap: 5px; font-size: 12px; color: var(--ink-2); }
.legend .k { display: flex; align-items: center; gap: 8px; }
/* beside the zoom buttons, so opening it never moves them. max-content because the attribution sets the
   width of this corner, and it shrinks to an icon when the map is first moved */
.maplibregl-ctrl-top-right .mapkey { position: absolute; top: 10px; right: 50px; width: max-content; margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-family: var(--font); }
.mapkey-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--ink); box-shadow: var(--shadow); font: 600 12px/1.4 var(--font); cursor: pointer; }
/* strong enough to beat MapLibre's see-through hover colour, which sticks on touch screens until the next tap */
.maplibregl-ctrl.mapkey .mapkey-btn:not(:disabled) { background: var(--surface); }
.maplibregl-ctrl.mapkey .mapkey-btn[aria-expanded="true"]:not(:disabled) { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.mapkey-box { padding: 8px 10px; max-width: 230px; max-height: 50vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.mapkey-box[hidden] { display: none; }
.mapkey-box .legend { display: none; }
body[data-view="map"] .mapkey-box #legend, body[data-view="live"] .mapkey-box #legend-live, body[data-view="trains"] .mapkey-box #tlegend { display: grid; }
/* nothing to key when lines wear their own colours */
body[data-view="map"] .maplibregl-ctrl-top-right .mapkey:has(#legend:empty), body[data-view="trains"] .maplibregl-ctrl-top-right .mapkey:has(#tlegend:empty), body[data-view="map"][data-nofigs="1"] .maplibregl-ctrl-top-right .mapkey { display: none; }
.sw { width: 22px; height: 6px; border-radius: 3px; flex: none; }
.sw.dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border); }
.sw.dash { background: repeating-linear-gradient(90deg, var(--nodata) 0 5px, transparent 5px 8px); }
.ico { font-size: 11px; width: 14px; text-align: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.fine { font-size: 12px; color: var(--muted); margin: 0; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--page); display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.card .row { display: flex; justify-content: space-between; color: var(--ink-2); }
.card .row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; text-align: left; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* tooltip */
.tip {
  position: absolute; z-index: 30; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px;
  font-size: 12px; min-width: 190px; max-width: 280px;
}
.tip.pinned { pointer-events: auto; padding-right: 40px; }
.tip .also { margin-top: 6px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tip .tip-links { display: flex; gap: 14px; margin-top: 8px; font-weight: 600; font-size: 13px; }
.tip.sheet .tip-links a { padding: 4px 0; }
.also-chip { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit; line-height: 0; border-radius: 6px; }
.also-chip .chip { pointer-events: none; }
.also-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip h4, .maplibregl-popup-content h4 { margin: 0 0 6px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.tip .tip-op, .maplibregl-popup-content .tip-op { margin: 8px 0 2px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 600; color: var(--ink); }
.tip .r, .maplibregl-popup-content .r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip .r b, .maplibregl-popup-content .r b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
/* "20 s ago · 12:52:01 am" stays on one line; the label gives way instead */
.tip .r:has(b.age), .maplibregl-popup-content .r:has(b.age) { white-space: nowrap; }
.tip .r, .maplibregl-popup-content .r { min-width: 0; }

/* timeline */
.timeline {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 5; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px 12px;
}
.tl-head { display: flex; align-items: center; gap: 8px; }
.tl-head .icon-btn { margin-left: 0; }
.tl-date { display: flex; flex-direction: column; min-width: 190px; padding: 0 4px; }
.tl-date strong { font-size: 15px; }
.tl-date span { font-size: 12px; color: var(--ink-2); }
.tl-net { margin-left: auto; display: flex; gap: 18px; font-size: 12px; color: var(--ink-2); }
.tl-net b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart { position: relative; width: 100%; }
#netchart { height: 70px; margin-top: 6px; }
#slider { width: 100%; margin: 2px 0 0; accent-color: var(--accent); }
.chart svg { display: block; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: .10; }
.chart .mark { stroke: var(--ink); stroke-width: 1.5; }
.chart .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover, .chart .bar.on { opacity: .8; }
.chart .ctip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 8px; padding: 6px 8px; font-size: 12px; white-space: nowrap; z-index: 3; }

/* live */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--page); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.kpi b { display: block; font-size: 22px; line-height: 1.1; font-weight: 650; }
.kpi span { font-size: 12px; color: var(--ink-2); }
.livelist { display: flex; flex-direction: column; gap: 8px; }
.alert { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--page); }
.alert .hd { display: flex; gap: 8px; align-items: flex-start; }
.alert .hd strong { font-size: 13px; }
.alert .meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.alert .routes { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip-link { text-decoration: none; border-radius: 6px; }
.chip-link:hover .chip, .chip-link:focus-visible .chip { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert details { margin-top: 6px; font-size: 12px; color: var(--ink-2); white-space: pre-line; }
.alert summary { cursor: pointer; color: var(--accent); }
.eff { font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.eff.NO_SERVICE, .eff.REDUCED_SERVICE { background: var(--critical); color: #fff; }
.eff.DETOUR, .eff.STOP_MOVED, .eff.SIGNIFICANT_DELAYS { background: var(--warning); color: #0b0b0b; }
.cx { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.cx .t { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.cx .past { opacity: .5; }
.none { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* routes view */
.routesview { display: flex; flex-direction: column; gap: 12px; padding: 16px; flex: 1; min-height: 0; }
.rv-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rv-controls .search { width: 280px; }
.rv-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* desktop: the list stays in view (scrolling in its own box) while a long route's detail scrolls the page */
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 190px); position: sticky; top: 72px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.rtable th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--ink-2); padding: 10px; border-bottom: 1px solid var(--grid); cursor: pointer; user-select: none; white-space: nowrap; }
.rtable th[aria-sort]::after { content: " ↓"; color: var(--muted); }
.rtable th[aria-sort="ascending"]::after { content: " ↑"; }
.rtable td { padding: 8px 10px; border-bottom: 1px solid var(--grid); }
.rtable td.nm { color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable tbody tr { cursor: pointer; }
.rtable tbody tr:hover, .rtable tbody tr.on { background: var(--surface-2); }
.detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; }
.rback, .rjump { display: none; }
.detail h2 { margin: 0; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.detail h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.detail .sub { color: var(--ink-2); margin: -10px 0 0; }
.detail .empty { color: var(--ink-2); }
.detail .empty h2 { color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.deps { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail .deps { display: block; overflow-x: auto; }   /* its own scroll on phones, not the page's */
.deps th, .deps td { padding: 5px 6px; border-bottom: 1px solid var(--grid); text-align: left; }
.deps th { color: var(--ink-2); font-weight: 600; }
.deps .num { text-align: right; font-variant-numeric: tabular-nums; }

.foot { padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; }
.madeby { color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.madeby:hover, .madeby:focus-visible { color: var(--accent); text-decoration: underline; }
.about a { color: var(--accent); }
.brand .region { font-weight: 600; color: var(--ink-2); padding-left: 8px; border-left: 1px solid var(--border); }

/* maplibre chrome */
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--border); box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon, :root:not([data-theme="light"]) .dark-ctrl .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--ink-2); }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
@media (min-width: 861px) { .maplibregl-ctrl-bottom-right { bottom: var(--tl-over, 0px); } }  /* clear of the timeline over the map */
.maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }

.ask { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: min(360px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px 44px 14px 16px; font-size: 14px; animation: ask-in .2s ease-out; }
.ask p { margin: 0 0 12px; line-height: 1.4; }
.ask-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ask .btn { padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.ask .btn:disabled { opacity: .6; cursor: default; }
@keyframes ask-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 860px) { .ask { left: 16px; right: 16px; width: auto; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .ask.ask-top { top: calc(16px + env(safe-area-inset-top)); bottom: auto; } }
@media (prefers-reduced-motion: reduce) { .ask { animation: none; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.btn-map { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 7px 12px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; font-size: 13px; }
.btn-map::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.liveroute { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.liveroute .lr-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.liveroute .lr-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.liveroute .lr-all { font-weight: 600; font-size: 13px; }
.liveroute .lr-links { display: flex; gap: 14px; white-space: nowrap; flex-wrap: wrap; justify-content: flex-end; }
/* phones: the picked live route on the map, tap to show all again (desktop has Show all beside the map) */
.mappick { position: absolute; left: 10px; bottom: 10px; right: 60px; z-index: 5; display: none; align-items: center; gap: 4px; width: max-content; max-width: calc(100% - 70px);
  padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.mappick button { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 2px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.mappick button[data-pick][aria-pressed="false"] { opacity: .5; }
.mappick button[data-pick]:only-of-type { opacity: 1; }
.mappick .mp-all { padding: 2px 8px 2px 4px; }
.mappick b { font-size: 16px; line-height: 1; color: var(--muted); }
@media (max-width: 860px) { body[data-view="live"] .mappick:not([hidden]) { display: flex; } }
.mappick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip-more { display: block; margin-top: 8px; font-weight: 600; font-size: 13px; }
.follow-btn { margin-top: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); font-weight: 600; cursor: pointer; }
.follow-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* narrow screens */
@media (max-width: 860px) {
  :root { --top-h: 51px; }
  /* the page scrolls as a whole, so the footer sits after the content instead of over it, and the
     sticky header's containing block (body) is as tall as the page. svh: at least the screen with the
     address bar showing, so nothing is sized against a height that changes as the bar slides away */
  html, body { height: auto; }
  body { min-height: 100svh; }
  main { flex: none; }
  .top { gap: 8px; padding: 8px 12px; }
  .brand span { display: none; }
  .mapwrap { display: flex; flex-direction: column; min-height: 0; }
  .map { position: relative; height: 52vh; min-height: 320px; flex: none; }
  .panel { position: static; width: auto; max-height: none; margin: 12px 16px 0; box-shadow: none; }
  .pgrip { display: none; }
  .timeline { position: static; margin: 12px 16px; box-shadow: none; }
  .tl-head { flex-wrap: wrap; }
  .tl-net { margin-left: 0; width: 100%; justify-content: space-between; }
  .tl-date { min-width: 0; flex: 1; }
  .rv-body { grid-template-columns: minmax(0, 1fr); }
  .rv-controls .search { width: 100%; }
  .detail { position: static; }
  .two { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  /* live and trains: the map fills the screen above a short strip of the panel, so a vehicle's
     card covers map rather than half the figures, and the strip shows there's more below */
  body:is([data-view="live"], [data-view="trains"], [data-view="map"]) .map { position: sticky; top: var(--top-h); height: calc(100svh - var(--top-h) - 64px); min-height: 320px; }
  /* these lists are worth a glance, so their panel sits a little higher */
  body:is([data-view="trains"], [data-view="map"]) .map { height: calc(100svh - var(--top-h) - 170px); }
  /* ... and the panel slides up over the map, which stays where it is with its top in view */
  body:is([data-view="live"], [data-view="trains"], [data-view="map"]) .mapwrap > .panel { position: relative; top: 0; left: 0; z-index: 2; margin: 0; border-width: 1px 0 0; border-radius: var(--radius) var(--radius) 0 0; padding: 14px 16px 16px; }
  body[data-view="map"]:not(.playing) .timeline { position: relative; inset: auto; z-index: 2; width: auto; margin: 0; border-width: 1px 0 0; border-radius: 0; }
  /* playing the timeline: map fills the screen above the timeline, which docks to the bottom */
  body.playing[data-view] .map { height: calc(100svh - var(--top-h, 56px) - var(--tl-h, 150px)); min-height: 200px; }
  body.playing .timeline { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 15; border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .18); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  body.playing .foot { padding-bottom: var(--tl-h, 150px); }
  .peek { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: -4px 0 2px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
  .peek .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--axis); }
  /* one at a time: the whole list as a normal page, or the route on its own */
  .tablewrap { max-height: none; overflow: visible; position: static; }
  .rtable th { top: var(--top-h); }
  .rtable th, .rtable td { padding-left: 5px; padding-right: 5px; }
  body[data-route-open="1"] .rv-controls .search, body[data-route-open="1"] .tablewrap, body:not([data-route-open="1"]) .detail { display: none; }
  .rback { display: block; font-size: 13px; font-weight: 600; }
  .rjump { position: sticky; top: var(--top-h); z-index: 3; display: flex; gap: 6px; margin: 0 -16px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-block: 1px solid var(--grid); }
  .rjump button { flex: 1 0 auto; padding: 6px 10px; border: 1px solid var(--accent); border-radius: 999px; background: none; color: var(--accent); font: 600 12.5px/1.3 var(--font); cursor: pointer; }
  .rjump button[hidden] { display: none; }
  .detail > div { scroll-margin-top: calc(var(--top-h) + 52px); }
}

/* worst periods */
.worst summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.worst summary::-webkit-details-marker { display: none; }
.worst summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.worst[open] summary::before { content: "▾"; }
.worst .seg { margin: 8px 0; }
.worstlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; counter-reset: w; }
.worstlist li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; cursor: pointer; counter-increment: w; }
.worstlist li::before { content: counter(w); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.worstlist li:hover, .worstlist li.on { background: var(--surface-2); }
.worstlist .wd { font-weight: 600; }
.worstlist .wn { display: block; font-size: 11px; color: var(--ink-2); font-weight: 400; }
.worstlist .wv { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.worstlist .wv small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.worstdays { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.worstdays li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--grid); }
.worstdays b { font-variant-numeric: tabular-nums; }

/* buses: route list (same look as the trains table) */
.blist { flex: none; max-height: 42vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.blines th { position: sticky; top: 0; background: var(--surface); cursor: pointer; z-index: 1; }
.blines th[aria-sort="ascending"] { color: var(--ink); }
.blines td.nm { max-width: 0; width: 100%; }
.blines .rn { display: flex; align-items: center; gap: 8px; min-width: 0; }
.blines .rn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 12px; }
.blines tbody tr.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }

/* trains */
.tmonth { display: flex; align-items: center; gap: 8px; }
.tmonth .tl-date { flex: 1; text-align: center; }
.tlines { width: 100%; border-collapse: collapse; font-size: 12px; }
.tlines th { color: var(--ink-2); font-weight: 600; text-align: right; padding: 4px 6px; }
.tlines th:first-child { text-align: left; }
.tlines td { padding: 6px; border-top: 1px solid var(--grid); text-align: right; font-variant-numeric: tabular-nums; }
.tlines td:first-child { text-align: left; }
.tlines tbody tr { cursor: pointer; }
.tlines tbody tr:hover { background: var(--surface-2); }
.tlines tbody tr.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.tlines .nm small { display: block; color: var(--muted); font-size: 11px; }
.tlines .tot td { font-weight: 650; }
.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .reft { fill: var(--muted); font-size: 10px; }
.lates { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.lates li { display: flex; align-items: center; gap: 6px; }
.lates li .hs { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lates li b { font-variant-numeric: tabular-nums; }
.tip.sheet {
  position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: none; min-width: 0; max-height: 45vh; overflow: auto; pointer-events: auto; z-index: 50;
  padding-right: 40px; font-size: 13px;
}
.tip.sheet:not([hidden]) { animation: sheet-in .3s ease-out; }   /* timed with the map's padding ease (sheetPad) */
@keyframes sheet-in { from { transform: translateY(calc(100% + 16px)); } }
@media (prefers-reduced-motion: reduce) { .tip.sheet:not([hidden]) { animation: none; } }
.tip-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }

/* intro page */
body.intro { display: block; height: auto; overflow-x: clip; }
html:has(body.intro) { overflow-x: clip; }  /* phones ignore it on body alone and let the page scroll sideways */
.page { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; display: block; }
.page section { margin-top: 44px; }
.page h2 { font-size: 20px; margin: 0 0 14px; }
.hero { margin-top: 0 !important; position: relative; padding: 56px 0 8px; }
.hero > * { position: relative; }
.hero::before { content: ""; position: absolute; inset: 0 calc(50% - 50vw); z-index: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 85% 20%, color-mix(in srgb, var(--brand-blue) 18%, transparent), transparent 70%),
              radial-gradient(500px 260px at 100% 85%, color-mix(in srgb, var(--brand-pink) 12%, transparent), transparent 70%),
              radial-gradient(420px 220px at 65% 100%, color-mix(in srgb, var(--brand-green) 12%, transparent), transparent 70%); }
.hero h1 { font-size: clamp(40px, 8vw, 72px); line-height: 1; margin: 0 0 16px; letter-spacing: -0.02em; }
.lede { font-size: clamp(17px, 2.4vw, 21px); color: var(--ink-2); max-width: 640px; margin: 0 0 22px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 28px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 14px 17px;
  position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--axis); }
.stat[class*="rc-"]::before { background: var(--rc); }
.stat b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-2); }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .cards3 { grid-template-columns: minmax(0, 1fr); } }
.icard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.icard h3, .region-card h3 { margin: 0 0 6px; font-size: 16px; }
.icard p, .region-card p { margin: 0; color: var(--ink-2); }
/* region cards: same shape for every city, links pinned to the bottom */
.regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.region-card { display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--rc); border-radius: var(--radius); padding: 16px 18px 18px;
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.region-card:hover { transform: translateY(-2px); border-color: var(--rc); }
.region-card h3 { font-size: 20px; margin: 0; }
.region-card .rc-hist { font-size: 13px; }
.region-card .rc-hist b { color: var(--ink); font-weight: 600; }
.region-links { display: grid; grid-template-columns: 1fr; gap: 10px; padding-top: 10px; margin-top: auto; }
.region-links .sub { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; white-space: nowrap; }
.region-links .sub span { color: var(--rc-ink, var(--accent)); font-weight: 600; font-size: 14px; }
.region-links .sub span:hover { text-decoration: underline; text-underline-offset: 3px; }
.region-links span.live { display: block; text-align: center; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--rc);
  background: var(--surface); color: var(--ink); font-weight: 650; font-size: 14px; }
.region-links span.live:hover { background: color-mix(in srgb, var(--rc) 12%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .region-card { transition: none; } .region-card:hover { transform: none; } }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px 32px; }
.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); }
.plain b { color: var(--ink); }
.about p { color: var(--ink-2); max-width: 760px; margin: 0; }
@media (max-width: 860px) { .brand .region { display: none; } }

/* city colours: Wellington blue, Auckland pink, Christchurch green (intro cards, stats, buttons, region headers).
   Charts and the map keep --accent blue so the city colour never reads as a status colour. */
.rc-wellington, body[data-region="wellington"] { --rc: var(--brand-blue); --rc-ink: var(--wel-ink); }
.rc-auckland, body[data-region="auckland"] { --rc: var(--brand-pink); --rc-ink: var(--akl-ink); }
.rc-christchurch, body[data-region="christchurch"] { --rc: var(--brand-green); --rc-ink: var(--chc-ink); }
.rc-sydney, body[data-region="sydney"] { --rc: var(--brand-pink); --rc-ink: var(--akl-ink); }
.rc-melbourne, body[data-region="melbourne"] { --rc: var(--brand-green); --rc-ink: var(--chc-ink); }
.rc-brisbane, body[data-region="brisbane"] { --rc: var(--brand-blue); --rc-ink: var(--wel-ink); }
.rc-adelaide, body[data-region="adelaide"] { --rc: var(--brand-orange); --rc-ink: var(--act-ink); }
.rc-victoria, body[data-region="victoria"] { --rc: var(--brand-purple); --rc-ink: var(--cns-ink); }
.rc-newcastle, body[data-region="newcastle"] { --rc: var(--brand-teal); --rc-ink: var(--vic-ink); }
.rc-canberra, body[data-region="canberra"] { --rc: var(--brand-red); --rc-ink: var(--red-ink); }
.rc-centralcoast, body[data-region="centralcoast"] { --rc: var(--brand-amber); --rc-ink: var(--amb-ink); }
.rc-wollongong, body[data-region="wollongong"] { --rc: var(--brand-indigo); --rc-ink: var(--ind-ink); }
.rc-cairns, body[data-region="cairns"] { --rc: var(--brand-lime); --rc-ink: var(--lim-ink); }
.btn[class*="rc-"] { background: var(--surface); color: var(--ink); border: 2px solid var(--rc); padding: 9px 15px; }
.btn[class*="rc-"]:hover { background: color-mix(in srgb, var(--rc) 12%, var(--surface)); }
body[data-region] .top::after { background: var(--rc); }
body[data-region] .tabs a[aria-selected="true"] { background: var(--rc-ink); color: var(--city-on); }
body[data-region] .tabs a[aria-selected="true"] .pulse { background: currentColor; }
@media (min-width: 861px) { body[data-region] .brand .region { display: inline-flex; align-items: center; gap: 6px; } }
body[data-region] .brand .region::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }

/* intro page: labelled theme switch */
.theme-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.theme-btn:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hw-lede { margin: 0 0 12px; color: var(--ink-2); }
.hw-regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.hw-region { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--rc); border-radius: var(--radius); padding: 14px 16px; }
.hw-region h3 { margin: 0 0 8px; font-size: 16px; }
.hw-region p { margin: 0 0 8px; color: var(--ink-2); font-size: 14px; }
.hw-region p:last-child { margin-bottom: 0; }
.hw-region b { color: var(--ink); }
.support-box { max-width: 760px; padding: 14px 18px; border-left: 4px solid var(--brand-blue); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; display: flex; flex-direction: column; gap: 10px; }
.support-box p { margin: 0; color: var(--ink); }
.support-box .support-note { color: var(--ink-2); font-size: 13px; }
.support-box .support-per { margin: 2px 0 -4px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.support-amounts { display: flex; flex-wrap: wrap; gap: 8px; }
.support-amounts .btn { min-width: 60px; justify-content: center; padding: 9px 14px; }
.support-box .support-alt { font-size: 14px; color: var(--ink-2); }
.support-box .support-alt + .support-alt { margin-top: -6px; }

/* live map route finder */
.livesearch { position: relative; }
.lq-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: min(360px, 50vh); overflow-y: auto; }
.lq-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.lq-list li[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.lq-list .lq-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lq-list .lq-name small { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--ink-2); }
.lq-list .lq-n { color: var(--muted); font-size: 12px; white-space: nowrap; }
.lq-list .lq-none { color: var(--muted); cursor: default; }

/* shown until the history file arrives (app.js historyBadge) */
.historybadge { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 600; white-space: nowrap;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow); pointer-events: none; }
.historybadge[hidden] { display: none; }
.historybadge { overflow: hidden; font-variant-numeric: tabular-nums; }
.historybadge::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--share, 0) * 100%); background: currentColor; transition: width .15s linear; }
.historybadge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: historypulse 1.1s ease-in-out infinite; }
.historybadge.failed { background: var(--critical); color: #fff; white-space: normal; }
.historybadge.failed::before { display: none; }
body:has(.testbadge) .historybadge { top: 94px; }
@keyframes historypulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .historybadge::before { animation: none; } }
/* test site label (track.js) */
.testbadge { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 3px 10px; border-radius: 999px;
  background: var(--warning); color: #000; font-size: 12px; font-weight: 650; pointer-events: none; }
/* how a route runs */
.runkpis { grid-template-columns: repeat(4, 1fr); }
#trun .runkpis { grid-template-columns: 1fr 1fr; }
#trun .worstdays li { flex-direction: column; }
@media (max-width: 700px) { .runkpis { grid-template-columns: 1fr 1fr; } }
.more-stops summary { margin-top: 6px; font-size: 12px; color: var(--accent); cursor: pointer; }
/* stops */
.stopchip { display: inline-block; flex: none; min-width: 40px; padding: 1px 6px; margin-right: 6px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-weight: 600; text-align: center; color: var(--ink-2); background: var(--page); }
.lq-list .stopchip { margin-right: 0; }
#stop-board:not(:empty) { margin: 10px 0; }
.stopcard { padding: 10px; background: var(--page); border: 1px solid var(--border); border-radius: 10px; }
.stophead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stophead h3 { flex: 1 1 120px; margin: 0; font-size: 14px; }
.stophead .linkbtn[aria-pressed="true"] { font-weight: 650; }
.stopfilter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.stopfilter button { background: none; border: 0; padding: 2px; border-radius: 8px; cursor: pointer; font: inherit; }
.stopfilter button[data-rf]:not(.linkbtn) { opacity: .45; }
.stopfilter:not(:has([aria-pressed="true"])) button[data-rf], .stopfilter button[aria-pressed="true"] { opacity: 1; }
.stopfilter button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.arrivals, .savedstops, .trip-stops { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.arrivals li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.arrivals .arr-to { flex: 1; min-width: 0; }
.arrivals small { display: block; font-size: 11px; color: var(--ink-2); }
.arrivals small .linkbtn { font-size: 11px; }
.arrivals b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.arrivals .gone .arr-to, .arrivals .gone b { text-decoration: line-through; color: var(--muted); }
.arrivals .gone small { text-decoration: none; display: inline-block; }
.savedstops li { padding: 4px 0; }
.savedstops a { color: inherit; text-decoration: none; }
.trip-stops { margin-top: 6px; font-size: 12px; }
.trip-stops li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.trip-stops a { color: inherit; }
.trip-stops b { flex: none; white-space: nowrap; }
.trip-stops .more { color: var(--muted); padding: 0; }

/* insights */
.insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; flex: none; }
.ins { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ins h2 { margin: 0; font-size: 18px; }
.ins { scroll-margin-top: var(--ins-off, 72px); }
.insnav { grid-column: 1 / -1; display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; gap: 6px; position: sticky; top: 0; z-index: 5; margin: -16px -16px 0; padding: 10px 16px; background: var(--page); border-bottom: 1px solid var(--border); }
.insnav:empty { display: none; }
.insnav button { flex: none; white-space: nowrap; }
.ins .daygrid th, .ins .daygrid td:not(:first-child) { text-align: center; }
.ins .daygrid td small, .ins .daygrid th small { display: block; color: var(--ink-2); font-weight: 400; }
.ins .daygrid td { font-variant-numeric: tabular-nums; }
.insnav button { padding: 5px 12px; border: 1.5px solid var(--rc, var(--accent)); border-radius: 999px; background: var(--surface); color: var(--rc-ink, var(--accent)); font: 600 12.5px/1.3 var(--font); cursor: pointer; }
.insnav button:hover, .insnav button:focus-visible, .insnav button.on { background: var(--rc, var(--accent)); color: var(--city-on, #fff); }
.ins h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ins .sub { color: var(--ink-2); margin: -6px 0 0; }
.ins .fine { margin: 0; }
.ins .deps { display: block; overflow-x: auto; }
.eta-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 16px; }
.eta-sides h3 { margin-top: 0; }
.ins .worstdays li { gap: 12px; }
.ins .worstdays b { white-space: nowrap; }
#ins-week, #ins-wait, #ins-notices { grid-column: 1 / -1; }
.chart .bhit.pick { cursor: pointer; }
.chart .bhit.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chart svg.picked .bar:not(.sel) { opacity: .4; }
.chart svg.picked .bar:not(.sel):hover, .chart svg.picked .bar.on:not(.sel) { opacity: .7; }
.deps.fullr td small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.deps.fullr td.strong { font-weight: 650; }
.deps.fullr th.num { white-space: normal; }
.deps.fullr th.grp { text-align: center; color: var(--ink); background: linear-gradient(var(--rc, var(--accent)), var(--rc, var(--accent))) center bottom / calc(100% - 12px) 2px no-repeat; }
.deps.fullr .gs, .deps .gs { border-left: 1px solid var(--border); }
.deps th.grp { text-align: center; white-space: normal; }
/* the better and worse of two scores side by side */
.deps td.better { color: var(--good); font-weight: 650; }
.deps td.worse { color: var(--worse, #c2610a); font-weight: 650; }
@media (min-width: 1100px) {
  #ins-compare .runkpis { grid-template-columns: repeat(3, 1fr); }
  #ins-notices .runkpis { grid-template-columns: repeat(5, 1fr); }
  .runkpis.wide2 { grid-template-columns: repeat(2, 1fr); }
  .runkpis.wide3 { grid-template-columns: repeat(3, 1fr); }
  .ins .deps, .detail .deps { display: table; width: 100%; }   /* room to spare: fill the card */
}
@media (max-width: 1600px) { .rtable td.nm { max-width: 170px; } }
.noticebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.noticebar .search { flex: 1; min-width: 200px; }
.noticebar .search input { padding-left: 10px; }
.noticebar select { padding: 7px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; }
.st-ran td:last-child, .st-part td:last-child { font-weight: 600; }
.connform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.connfield { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; color: var(--ink-2); }
.connfield .livesearch { margin-top: 0; }
.connfield .seg { display: flex; }
.connform .btn-map { margin: 0; cursor: pointer; font: inherit; align-self: end; }
.connform .btn-map::before { display: none; }
.bmark { fill: var(--serious); pointer-events: none; }
#d-alerts .worstdays li > span { min-width: 0; }
#d-alerts .worstdays b { flex: none; margin-left: 12px; }
@media (max-width: 860px) {
  .insights { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .insnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -12px -12px 0; padding: 8px 12px; }
  .insnav button { flex: none; }
  .connform { grid-template-columns: minmax(0, 1fr); }
}
/* phones: the menu gets its own row, so every tab can be seen */
@media (max-width: 680px) {
  :root { --top-h: 90px; }
  .testbadge { top: 14px; }
  .top { flex-wrap: wrap; gap: 6px 8px; }
  .brand span:first-of-type { display: inline; }
  .top .icon-btn { margin-left: auto; }
  .tabs { order: 3; flex: 0 0 100%; gap: 3px; margin-left: 0; }
  .tabs a { flex: 1 0 auto; justify-content: center; gap: 4px; padding: 6px 4px; font-size: 13px; }
}
@media (max-width: 400px) {
  :root { --top-h: 88px; }
  .tabs { gap: 2px; }
  .tabs a { gap: 3px; padding-left: 2px; padding-right: 2px; font-size: 12px; }
}
/* these pages are taller than the window, so the footer follows them rather than sitting over them */
@media (min-width: 861px) {
  body[data-view="insights"], body[data-view="routes"] { height: auto; min-height: 100%; }
  body[data-view="insights"] main, body[data-view="routes"] main { flex: 1 0 auto; }
}
body[data-view="tools"] { height: auto; min-height: 100svh; }
body[data-view="tools"] main { flex: 1 0 auto; }
.nolive { font-size: 12px; color: var(--muted); white-space: nowrap; }
.svc { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.ins .worstdays small { display: block; color: var(--ink-2); }
body:not([data-ferry="1"]) #ferry-note, body:not([data-ferry="1"]) #ship-list, body:not([data-ferry="1"]) #sailings { display: none; }
.sail-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.sail-op { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.sail-op b { font-size: 1.3rem; }
.sail-op small { color: var(--ink-2); }
#sailings .worstdays small { color: var(--ink-2); margin-left: 4px; }
#sailings .worstdays b { font-weight: 500; text-align: right; margin-left: 12px; }
body[data-ferry="1"] #worst, body[data-ferry="1"] #panel-map .check { display: none; }
body[data-ferry="1"] #metric [data-v="flow"], body[data-nofigs="1"] #panel-map .field, body[data-nofigs="1"] #panel-map .search, body[data-nofigs="1"] #legend-note, body[data-nofigs="1"] #about-metric { display: none; }
#ship-list .worstdays small { color: var(--ink-2); margin-left: 4px; }
#ship-list .worstdays b { font-weight: 500; text-align: right; margin-left: 12px; }
.shipgo { cursor: pointer; }
body[data-ferry="1"] #panel-map { max-height: calc(100% - 32px); }

/* where buses gain and lose time: the timeline becomes an hour slider */
body[data-flow="1"] :is(#netchart, #prev, #next, #tl-net, #worst) { display: none; }
#bperiod { display: none; }
body[data-flow="1"] #bperiod { display: flex; }
body[data-flow="1"] #panel-trains :is(div:has(> #tchart), div:has(> #trepl), div:has(> #tnow), #tcollect, #trun, #tdeps, #t-about) { display: none; }
.worstdays small.on-routes { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-left: 12px; vertical-align: middle; color: var(--ink-2); }
.on-routes span { white-space: nowrap; }
.chart .ctip.multi { white-space: normal; width: min(360px, 100%); }
.chart .ctip.multi div { margin-top: 3px; }
.deps.notices small { display: block; color: var(--ink-2); }
.deps.warning { display: table; width: auto; min-width: min(360px, 100%); margin-bottom: 12px; }
#notice-warning h3 { margin-top: 12px; }
.deps.notices td:first-child { white-space: nowrap; }
.deps.notices tr.ntrip td { background: var(--surface-2); }
.deps.notices .ntoggle { font-size: 12px; }
.deps.notices small.lead-short { color: color-mix(in srgb, #e06a00 85%, var(--ink)); font-weight: 600; }
.deps.notices small.lead-after { color: var(--critical); font-weight: 600; }
@media (min-width: 861px) { .deps.notices td:nth-child(4), .deps.notices td:nth-child(5) { white-space: nowrap; } }
.conn-def { margin: 0; color: var(--ink-2); }
.conn-def b { color: var(--ink); }
.cr-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.cr-top h3 { margin: 0; font-size: 14px; }
.cr-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; font-size: 12px; color: var(--ink-2); }
.cr-key span { display: inline-flex; align-items: center; gap: 6px; }
.cr-key i { position: relative; display: inline-block; flex: none; left: auto; transform: none; }
.cr-key .cr-walk { width: 16px; }
.cr-key .cr-gap { width: 16px; height: 8px; }
.cr-key .cr-gap.made { background: var(--good); }
.cr-key .cr-gap.missed { background: var(--critical); }
.conn-runs { list-style: none; margin: 0; padding: 0; }
.conn-runs li { display: grid; gap: 2px 16px; padding: 8px 0; border-top: 1px solid var(--grid); font-size: 12px; }
.cr-head { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); }
.cr-head b { color: var(--ink); font-weight: 600; text-align: right; }
.cr-head i { font-style: normal; margin-right: 4px; color: var(--good); }
.missed .cr-head i { color: var(--critical); }
.cr-times { display: flex; flex-wrap: wrap; gap: 0 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cr-times b { color: var(--ink); }
.cr-times small { color: var(--muted); font-size: 11px; }
.cr-track { position: relative; height: 22px; }
.cr-track span { position: absolute; }
.cr-due { top: 0; bottom: 0; width: 1px; background: var(--border); }
.cr-walk { display: block; top: 10px; height: 2px; background: var(--ink-2); }
.cr-gap { top: 7px; height: 8px; border-radius: 2px; }
.made .cr-gap { background: var(--good); }
.missed .cr-gap { background: var(--critical); }
.cr-in { width: 10px; height: 10px; top: 6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); transform: translateX(-50%); }
.cr-out { width: 3px; height: 18px; top: 2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); transform: translateX(-50%); }
.cr-gone { top: 2px; line-height: 18px; font-size: 13px; font-weight: 700; color: var(--critical); transform: translateX(-50%); }
/* 28 px at the right so the last label, centred on its tick, stays inside the card ("+20 min" ran past it) */
.cr-axis { position: relative; height: 16px; font-size: 11px; color: var(--muted); margin: 0 28px 0 12px; }
.cr-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.cr-more { margin-top: 8px; align-self: flex-start; }
.conn-runs .cr-track { margin: 0 28px 0 12px; }
@media (min-width: 861px) {
  .conn-runs li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .conn-runs li .cr-track { grid-column: 2; grid-row: 1 / 3; }
  .cr-axis { margin-left: calc(50% + 20px); }
}

/* Tools: my trips, did it run?, connections, stops */
.toolsview { display: block; width: 100%; max-width: 760px; margin: 0 auto; box-sizing: border-box; }
.toolsview > [data-tool] > .ins, .minecard { margin-top: 12px; }
.toolsview .livesearch { position: relative; margin-top: 10px; }
.toolsview .search input { padding-left: 2px; font-size: 16px; }
.toolsview .ins h3 { margin: 14px 0 6px; }
#tooltabs { margin-top: 4px; }
#tooltabs[hidden] { display: none; }
#tooltabs button { padding: 8px 4px; }
.minecard .stophead h3 { flex: 1; min-width: 0; margin: 0; font-size: 15px; color: var(--ink); }
.minecard .stophead .linkbtn { flex: none; }
.minecard .linkbtn[aria-pressed="true"] { font-weight: 700; }
.minecard .linkbtn[data-alert] { padding: 3px 10px; border: 1px solid var(--accent); border-radius: 999px; font-size: 13px; }
.minecard .linkbtn[data-alert][aria-pressed="true"] { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--ink); }
.mine-alerts { margin-top: 12px; }
.mine-now { font-size: 18px; font-weight: 600; margin: 4px 0; }
.mine-now.bad { color: var(--bad, #c0392b); }
.arrivals small.flag, .minecard small.flag { display: block; font-size: 12px; color: var(--ink-2); }
small.flag.warn { color: var(--warn, #b45f06); }
small.flag.good { color: var(--good, #2e7d32); }
.todayline { font-size: 13px; line-height: 1.4; padding: 8px 10px; margin-bottom: 8px; background: var(--page); border: 1px solid var(--border); border-radius: 10px; }
.picklist { list-style: none; margin: 6px 0 0; padding: 0; }
.picklist.tall { max-height: 280px; overflow-y: auto; margin-top: 8px; }
.picklist button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 6px; font: inherit; font-size: 14px; color: var(--ink); text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.picklist button:hover { background: var(--surface-2); }
.picklist:not(.tall) button { justify-content: flex-start; }
.picklist small { font-size: 12px; color: var(--ink-2); }
.checkhead { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
.daypick { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.daypick a { flex: none; padding: 5px 10px; font-size: 13px; color: var(--ink-2); text-decoration: none; background: var(--surface-2); border-radius: 8px; }
.daypick a[aria-current="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--accent); font-weight: 600; }
.checklist { list-style: none; margin: 8px 0; padding: 0; font-size: 14px; }
.checklist li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.checklist li[hidden] { display: none; }
.checklist small { display: block; font-size: 12px; color: var(--ink-2); }
.checklist b { white-space: nowrap; }
.checklist .ck-cancelled b { color: var(--bad, #c0392b); }
.checklist .ck-not_tracked b, .checklist .ck-part b { color: var(--warn, #b45f06); }
.checklist .ck-ran b { color: var(--good, #2e7d32); }

/* home page "Install the app" */
.install[hidden], .install-btn[hidden] { display: none; }
.install-btn { gap: 8px; margin: 4px 0 12px; border: 2px solid var(--accent); cursor: pointer; font: inherit; font-weight: 600; }
.install-how { margin: 0 0 10px; padding-left: 22px; color: var(--ink-2); }
.install-how li { margin: 4px 0; }
.install-how svg { vertical-align: -3px; }
.install-both { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.install-both h3 { margin-top: 0; }
.relnote { display: block; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }

/* live map: feed status badge (app.js feedBadge) */
.feedbadge { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: min(340px, calc(100% - 110px)); font-size: 12px;
  background: var(--warning); color: #0b0b0b; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.feedbadge[open] { border-radius: 10px; }
.feedbadge[open] summary::after { content: "▴"; }
body:has(.testbadge) .feedbadge { top: 42px; }
.feedbadge[hidden], body:not([data-view="live"]) .feedbadge { display: none; }
.feedbadge summary { list-style: none; cursor: pointer; padding: 4px 10px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.feedbadge summary::-webkit-details-marker { display: none; }
.feedbadge summary::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #0b0b0b; animation: historypulse 1.6s ease-in-out infinite; }
.feedbadge summary::after { content: "▾"; font-weight: 400; opacity: .7; }
.feedbadge p { margin: 0; padding: 0 10px 8px; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .feedbadge summary::before { animation: none; } }

/* Insights: how predictions are made in this city */
.ins ul.method { margin: 6px 0 10px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.ins ul.method li { margin: 4px 0; }
.ins ul.method b { color: var(--ink); font-weight: 600; }

/* phones: stop search + My trips / saved stops above the live map; an open stop's departures before the map */
.quick, .phone-only { display: none; }
.quickchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.quickchips::-webkit-scrollbar { display: none; }
.quickchips[hidden] { display: none; }
.qchip { display: inline-flex; align-items: center; flex: none; gap: 2px; max-width: 70vw; padding: 5px 10px 5px 6px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qchip:first-child:not(:has(.stopchip)) { padding-left: 12px; border-color: var(--accent); color: var(--accent); }
.qchip b { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.qchip .stopchip { min-width: 0; margin-right: 6px; }
.qchip[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
@media (max-width: 860px) {
  .phone-only { display: inline; }
  body[data-view="live"] .quick { display: block; position: relative; z-index: 30; padding: 10px 16px 8px; background: var(--surface); border-bottom: 1px solid var(--grid); }
  .quick .livesearch { margin: 0; }
  .quick .quickchips { margin-top: 8px; }
  body[data-view="live"] .map { height: calc(100svh - var(--top-h) - 64px - var(--quick-h, 0px)); }
  body[data-view="live"][data-stop="1"]:not(.mapon) .map { display: none; }
  body[data-view="live"][data-stop="1"]:not(.mapon) #panel-live .peek { display: none; }
}

/* a picked route's stops on the Live card: a line with a dot per stop, each one a link */
.lr-stops { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.lr-stops[hidden] { display: none; }
.lr-stops summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.lr-stops .lr-dir { margin: 8px 0 4px; }
.rstops { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; font-size: 13px; }
.rsbody { max-height: 55vh; overflow-y: auto; }
.rstops li { position: relative; padding: 3px 0 3px 18px; }
.rstops li::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 3px; background: var(--rc-line); }
.rstops li:first-child::before { top: 50%; }
.rstops li:last-child::before { bottom: 50%; }
.rstops li::after { content: ""; position: absolute; left: 1px; top: calc(50% - 4.5px); width: 9px; height: 9px; box-sizing: border-box;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--rc-line); }
.rstops a { color: var(--ink); text-decoration: none; }
.rstops a:hover, .rstops a:focus-visible { color: var(--accent); text-decoration: underline; }
@media (max-width: 860px) { .rsbody { max-height: none; } }

/* a stop's "save a service" search, at the top of its card: compact until tapped */
.stopsave { margin: 10px 0 6px; padding: 10px; border: 2px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, var(--page)); }
.stopsave h4 { margin: 0 0 8px; font-size: 14px; color: var(--accent); }
.stopsave h4 span { font-weight: 700; }
.stopsave:not(.open) :is(.savechips, .savelist, .savenote) { display: none; }
.savechips { display: flex; gap: 4px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.savechips::-webkit-scrollbar { display: none; }
.savechips button { flex: none; }
.savechips:empty { display: none; }
.savechips button { padding: 2px; border: 0; background: none; cursor: pointer; border-radius: 8px; }
.savelist button span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.savelist button small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.savelist button em { flex: none; font-style: normal; font-size: 13px; font-weight: 600; color: var(--accent); }
.savelist button[aria-pressed="true"] em { color: var(--good); }
.stopsave .savenote:empty { display: none; }

/* a tapped stop's card on the map */
.stoppop .maplibregl-popup-content { display: flex; flex-direction: column; gap: 6px; padding: 10px 28px 10px 12px; font-size: 13px;
  background: var(--surface); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); }
.stoppop .maplibregl-popup-content .linkbtn { align-self: flex-start; font-weight: 600; font-size: 13px; }
.stoppop .maplibregl-popup-close-button { color: var(--muted); font-size: 18px; padding: 2px 8px; }
.stoppop.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.stoppop.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }

/* the other lines under a tap on the map, beside the picked one */
.lr-also { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chipbtn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.chipbtn:hover .chip, .chipbtn:focus-visible .chip { outline: 2px solid var(--accent); outline-offset: 1px; }
#t-also .lr-also { margin: 4px 0 8px; }
#route-card .lr-also { margin: 2px 0; }
.rbranch { margin-top: 10px; }
.rbranch p { margin: 0 0 2px; }
.rbranch .rstops { margin-top: 2px; }
.rbranch .rstops li::before { background: repeating-linear-gradient(var(--rc-line) 0 4px, transparent 4px 7px); }

/* Connections: the stop being checked, as a card rather than a small heading */
.connstop { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; margin: 4px 0 6px; padding: 12px 14px;
  border: 2px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, var(--page)); }
.connstop .cs-label { grid-column: 1; font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.connstop .cs-name { grid-column: 1; display: flex; align-items: center; gap: 4px; font-size: 17px; }
.connstop #c-change { grid-column: 2; grid-row: 1 / span 2; font-weight: 600; }
.connstop + .cs-next { margin: 8px 0 12px; }
#ins-connect > .livesearch[hidden] { display: none; }

/* vehicles in a route's stop list (Live): on the line between stops, or beside the stop they're at */
.rstops li.rsv-li { padding-top: 1px; padding-bottom: 1px; }
.rstops li.rsv-li::after { display: none; }
.rsveh { display: inline-flex; align-items: center; gap: 5px; margin: 1px 6px 1px 0; padding: 1px 8px 1px 4px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.rsveh i { width: 10px; height: 10px; border-radius: 50%; background: var(--vt); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--vt); }
.rstops li:not(.rsv-li) > .rsveh { margin-left: 8px; }
.rsv-li .rsveh { margin-left: -14px; }
.rsveh.old { opacity: .5; }
.rsveh:hover, .rsveh:focus-visible { border-color: var(--accent); }
.rsn { font-weight: 400; }

/* home page: My overview (saved trips and stops) */
.overview { padding-top: 8px; }
.ov-region h3 { margin: 12px 0 6px; font-size: 15px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ov-card { display: block; padding: 12px 14px; border: 1px solid var(--border); border-top: 3px solid var(--rc, var(--accent)); border-radius: 10px;
  background: var(--surface); color: var(--ink); text-decoration: none; }
.ov-card:hover { border-color: var(--rc, var(--accent)); }
.ov-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-head b { font-size: 15px; }
.ov-chip, .ov-code { display: inline-block; min-width: 28px; padding: 1px 6px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--rc, var(--accent)) 18%, var(--surface)); color: var(--ink); }
.ov-code { border: 1px solid var(--border); background: none; }
.ov-alert { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.ov-now { margin: 6px 0 2px; font-size: 16px; font-weight: 600; }
.ov-now.bad, .ov-deps .bad { color: var(--critical); }
.ov-now.warn { color: var(--serious); }
.ov-fine { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.ov-deps { list-style: none; margin: 8px 0 0; padding: 0; }
.ov-deps li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.ov-deps li + li { border-top: 1px solid var(--grid); }
.ov-deps span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ov-deps b { font-variant-numeric: tabular-nums; }

/* region cards: vehicles running now */
.rc-stats { display: grid; margin: auto 0 0; padding: 2px 0 0 12px; border-left: 3px solid var(--rc); }
.rc-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; }
.rc-stats span { font-size: 13px; color: var(--ink-2); }
.rc-stats b { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 4ch; text-align: right; }
.rc-stats + .region-links { margin-top: 0; }
