/* ==========================================================================
   netmov — la carte.
   Même langage que la page d'accueil : blanc, bleu netmov et marine, le tout en arrondi, comme les nœuds du logo.
   Les surfaces qui flottent sur la carte (en-tête, panneau, commandes, fiche) portent la seule ombre de l'interface ;
   partout ailleurs, la profondeur vient des tons (brume sur blanc, blanc sur brume). Plus Jakarta Sans pour les titres,
   Inter pour le reste, chiffres tabulaires. Couleurs de confiance sémantiques (vert, gris, rouge, cyan) distinctes
   de l'accent ; bus, trams et métros dans la couleur de leur ligne. Thème sombre : marine profond.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f2f5fa;
  --bg-rgb: 255, 255, 255;
  --tint-rgb: 10, 26, 54;
  --card: #ffffff;
  --card-2: #f2f5fa;
  --mist: #f2f5fa;
  --mist-2: #e8eef7;
  --tint: #e6efff;
  --border: #e2e8f0;
  --border-strong: #cbd5e3;
  --text: #0a1a36;
  --muted: #4b5a73;
  --muted-2: #8c98ab;

  --accent: #0b63ff;
  --accent-hover: #0a56db;
  --accent-ink: #ffffff;
  --accent-rgb: 11, 99, 255;
  --accent-text: #0b63ff;

  --rt: #12a06f;
  --sc: #8c98ab;
  --un: #de3b3b;
  --cf: #0891b2;
  --rt-rgb: 18, 160, 111;
  --sc-rgb: 140, 152, 171;
  --un-rgb: 222, 59, 59;
  --cf-rgb: 8, 145, 178;

  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: var(--font-body);

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --r-xl: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --shadow: 0 18px 44px -20px rgba(7, 26, 58, 0.4), 0 1px 2px rgba(7, 26, 58, 0.06);
  --glass: rgba(var(--bg-rgb), 0.9);
  --gutter: 16px;
  --sheet-w: 420px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071a3a;
  --bg-rgb: 11, 23, 48;
  --tint-rgb: 255, 255, 255;
  --card: #10213f;
  --card-2: #142a4d;
  --mist: #142a4d;
  --mist-2: #1b355c;
  --tint: #16305c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f5fa;
  --muted: #b7c3d6;
  --muted-2: #7f8ea8;
  --accent: #2f7bff;
  --accent-hover: #4d8dff;
  --accent-text: #7fb2ff;
  --accent-rgb: 47, 123, 255;
  --rt: #34d399;
  --sc: #8a93a6;
  --un: #ff6b6b;
  --cf: #22d3ee;
  --rt-rgb: 52, 211, 153;
  --sc-rgb: 138, 147, 166;
  --un-rgb: 255, 107, 107;
  --cf-rgb: 34, 211, 238;
  --shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.7), 0 1px 2px rgba(0, 0, 0, 0.3);
  --glass: rgba(var(--bg-rgb), 0.86);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
b, strong { font-weight: 600; }
img { display: block; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--r-s); font-weight: 600; }
.skip-link:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Map ---------- */
#map { position: absolute; inset: 0; background: var(--bg); }
.map-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 62%, rgba(var(--bg-rgb), 0.35) 100%);
}
.maplibregl-ctrl-attrib { background: rgba(var(--bg-rgb), 0.85) !important; color: var(--muted-2) !important; font: 10.5px/1.4 var(--font-body) !important; border-radius: 8px 0 0 0; padding: 2px 8px !important; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-bottom-right { bottom: 0; right: 0; }
.maplibregl-canvas:focus { outline: none; }

/* ---------- Floating surfaces ---------- */
.glass {
  background: var(--glass);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

/* ---------- HUD placement ---------- */
.hud { position: absolute; z-index: 10; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-tl { top: var(--gutter); left: var(--gutter); width: min(380px, calc(100vw - 2 * var(--gutter))); }
.hud-tr { top: var(--gutter); right: var(--gutter); width: 320px; transition: opacity .3s var(--ease), transform .45s var(--ease); }
.hud-br { bottom: 40px; right: var(--gutter); align-items: flex-end; transition: transform .45s var(--ease), bottom .35s var(--ease); }
/* the map controls keep their corner; they only step aside while the panel is unfolded (networks, settings), like for a sheet */
body.live-open:not(.sheet-open) .hud-br { transform: translateX(calc(-1 * (320px + 12px))); }
body.sheet-open .hud-tr, body.panel-open .hud-tr { opacity: 0; transform: translateX(12px); pointer-events: none; }
body.sheet-open .hud-tr > *, body.panel-open .hud-tr > * { pointer-events: none; }
body.sheet-open .hud-br, body.panel-open .hud-br { transform: translateX(calc(-1 * (var(--sheet-w) + 12px))); }

/* ---------- Top card: the brand and the search, one sheet like on the home page ---------- */
.top { position: relative; z-index: 3; padding: 14px 14px 12px; animation: rise .7s var(--ease) both; } /* above the mode pills: the results drop over them */
/* the wordmark is navy: the dark theme shows its light variant (assets/logo_large_light.png) */
.brand-home img[data-on="dark"] { display: none; }
:root[data-theme="dark"] .brand-home img[data-on="light"] { display: none; }
:root[data-theme="dark"] .brand-home img[data-on="dark"] { display: block; }
.brand { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "logo chip" "sub chip"; align-items: center; column-gap: 12px; padding: 0 4px; }
.brand-home { grid-area: logo; display: inline-block; width: max-content; border-radius: 8px; transition: opacity .2s var(--ease); }
.brand-home:hover { opacity: .8; }
.brand-home img { height: 23px; width: auto; }
.brand-sub { grid-area: sub; margin-top: 5px; font-size: 11.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-chip { grid-area: chip; display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--mist); font: 500 11.5px/1 var(--font-body); color: var(--muted); white-space: nowrap; }
.live-chip.is-live { color: var(--rt); background: rgba(var(--rt-rgb), 0.12); }
.live-chip.is-stale { color: var(--un); background: rgba(var(--un-rgb), 0.12); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; }
.is-live .live-dot { animation: pulse 1.8s ease-out infinite; }

/* ---------- Search ---------- */
.search { position: relative; z-index: 5; display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0 10px 0 14px; height: 48px; border-radius: 15px; background: var(--mist); color: var(--muted); transition: background .2s var(--ease), box-shadow .2s var(--ease); }
.search:focus-within { background: var(--card); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.35); color: var(--text); }
/* the magnifier, drawn in the logo's language: a node and its handle */
.s-glyph { position: relative; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted-2); flex: none; }
.s-glyph::after { content: ""; position: absolute; right: -6px; bottom: -5px; width: 7px; height: 2px; border-radius: 2px; background: var(--muted-2); transform: rotate(45deg); }
.search:focus-within .s-glyph { border-color: var(--accent); } .search:focus-within .s-glyph::after { background: var(--accent); }
.search input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; font-size: 14.5px; font-weight: 500; }
.search input::placeholder { color: var(--muted-2); font-weight: 400; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd { font: 500 11px/1 var(--font-body); color: var(--muted-2); background: var(--card); border-radius: 6px; padding: 4px 7px; }
.search:focus-within .search-kbd { background: var(--mist); }
/* solid card: results must stay readable over any map */
.search-results { position: absolute; left: -14px; right: -14px; top: calc(100% + 18px); max-height: min(62vh, 480px); overflow: auto; overscroll-behavior: contain; padding: 8px; z-index: 20;
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow); animation: pop .22s var(--ease) both; scrollbar-width: thin; }
.sr-group { display: flex; align-items: center; gap: 8px; padding: 12px 10px 6px; font: 600 12px/1 var(--font-body); color: var(--muted-2); }
.sr-group:first-child { padding-top: 6px; }
.sr-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 7px 10px; border-radius: 12px; text-align: left; color: var(--text); transition: background .12s var(--ease); }
.sr-item:hover, .sr-item.is-active { background: var(--mist); }
.sr-ico { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--tint); color: var(--accent-text); }
.sr-text { flex: 1; min-width: 0; }
.sr-main { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sr-main mark { background: none; color: var(--accent-text); font-weight: 600; }
.sr-meta { display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.sr-side { flex: none; display: inline-flex; align-items: center; gap: 4px; text-align: right; font: 500 12px/1.2 var(--font-body); color: var(--muted); }
.sr-empty { padding: 16px 12px; color: var(--muted); font-size: 13px; }
.sr-empty b { color: var(--text); }

/* ---------- Mobile mode pills (hidden on desktop) ---------- */
.mode-pills { display: none; }

/* ---------- Badges, chips, dots ---------- */
.cat { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 24px; padding: 0 8px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 12px/1 var(--font-display); letter-spacing: .01em; flex: none; }
.cat.cat-L, .cat.cat-S { background: var(--tint); color: var(--accent-text); }
.cat.cat-P, .cat.cat-other { background: var(--mist-2); color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-rt { background: var(--rt); box-shadow: 0 0 0 3px rgba(var(--rt-rgb), 0.18); }
.dot-sc { background: var(--sc); box-shadow: 0 0 0 3px rgba(var(--sc-rgb), 0.18); }
.dot-un { background: var(--un); box-shadow: 0 0 0 3px rgba(var(--un-rgb), 0.18); }
.dot-cf { background: var(--cf); box-shadow: 0 0 0 3px rgba(var(--cf-rgb), 0.18); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 11px; background: var(--mist); color: var(--muted); font-size: 13px; font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease); }
.chip:hover { color: var(--text); background: var(--mist-2); }
.chip:active { transform: scale(.96); }
.chip.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.is-on .dot { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); }
.chip:not(.is-on) .dot { opacity: .45; box-shadow: none; }
.line-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 30px; height: 22px; padding: 0 7px; border-radius: 7px; background: var(--lc); color: var(--li); font: 700 12px/1 var(--font-display); letter-spacing: -0.01em; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }
.line-badge-big { min-width: 46px; height: 36px; padding: 0 10px; border-radius: 11px; font-size: 19px; }
.mode-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mc); flex: none; }
/* mode tile: a white glyph on the mode's colour, like an app icon */
.mode-ico { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 10px; background: var(--mc); color: #fff;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(7, 26, 58, 0.14); }
.mode-ico svg { width: 19px; height: 19px; display: block; }
/* operator brands: a logo, or a monogram when none is known */
.op-logo { display: block; flex: none; height: 16px; width: auto; max-width: 46px; object-fit: contain; }
.op-mono { display: inline-grid; place-items: center; flex: none; height: 17px; min-width: 20px; padding: 0 5px; border-radius: 5px; background: var(--bc, #0d2550); color: #fff;
  font: 800 9.5px/1 var(--font-display); letter-spacing: 0.01em; white-space: nowrap; }
.brand-tile { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.brand-tile .op-logo { height: 18px; max-width: 26px; }
.brand-tile .op-mono { height: 16px; padding: 0 3px; font-size: 8px; }
:root[data-theme="dark"] .brand-tile { background: #f4f6fa; }

/* ---------- Live panel ---------- */
/* the desktop panel never grows past the window: head with three tabs, a body that scrolls */
.hud-tr { max-height: calc(100dvh - 2 * var(--gutter)); }
.live { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 2 * var(--gutter)); padding: 10px 10px 8px; animation: rise .7s .12s var(--ease) both; }
.live-head { display: flex; align-items: center; gap: 4px; padding: 0 0 8px; flex: none; }
/* at rest: a small card. Head, then the modes as tiles (a tile is its own switch), then two folded entries. */
.live-head .live-title { padding-left: 4px; }
.live-head .live-clock { margin: 0 0 0 2px; font-variant-numeric: tabular-nums; }
.live-total { margin-left: auto; font: 700 13px/1 var(--font-display); color: var(--text); }
.live-head .icon-btn { width: 28px; height: 28px; }
#live-rows { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; flex: none; }
#live-rows > .live-row[data-mode] { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 4px 0; border-radius: 14px; background: var(--mist); text-align: center; overflow: hidden; }
#live-rows > .live-row[data-mode]:hover { background: var(--mist-2); }
#live-rows > .live-row[data-mode] .mode-ico { width: 28px; height: 28px; border-radius: 9px; }
#live-rows > .live-row[data-mode] .mode-ico svg { width: 17px; height: 17px; }
#live-rows > .live-row[data-mode] .lr-main { width: 100%; }
#live-rows > .live-row[data-mode] .lr-top { flex-direction: column-reverse; align-items: center; gap: 3px; }
#live-rows > .live-row[data-mode] .lr-n { margin: 0; font-size: 14px; }
#live-rows > .live-row[data-mode] .lr-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 10.5px/1.1 var(--font-body); color: var(--muted); }
#live-rows > .live-row[data-mode] .lr-sub, #live-rows > .live-row[data-mode] .switch-mini { display: none; }
#live-rows > .live-row[data-mode] .lr-bar { height: 3px; margin: 7px -4px 0; border-radius: 0; }
#live-rows > .live-row[data-mode].is-off { opacity: 1; background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
#live-rows > .live-row[data-mode].is-off .lr-n, #live-rows > .live-row[data-mode].is-off .lr-name { color: var(--muted-2); }
#live-rows > .live-row[data-mode].is-off .lr-bar { visibility: hidden; }
#live-rows > .live-dev { grid-column: 1 / -1; background: var(--mist); }
.live-more { display: flex; gap: 6px; margin-top: 8px; flex: none; }
.live-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 11px; background: var(--mist); font: 600 12.5px/1 var(--font-body); color: var(--text); white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease); }
.live-tab:hover { background: var(--mist-2); }
.live-tab b { font: 500 11.5px/1 var(--font-body); color: var(--muted); }
.live-tab svg { color: var(--muted-2); transition: transform .25s var(--ease); }
.live-tab.is-on { background: var(--accent); color: #fff; }
.live-tab.is-on b, .live-tab.is-on svg { color: rgba(255, 255, 255, .8); }
.live-tab.is-on svg { transform: rotate(180deg); }
.live-tab[hidden] { display: none; }
.live-body[hidden] { display: none; }
.live-body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.live-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin-right: -6px; padding-right: 6px; }
.live-pane[hidden] { display: none; }
/* networks: one row per network, grouped by country; the row is the switch */
/* networks: two columns of small tiles under each country; a tile is its own switch, like the mode tiles */
.net-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.net-group + .net-group { margin-top: 10px; }
.net-group-h { grid-column: 1 / -1; display: block; padding: 2px 4px 0; font: 600 11.5px/1 var(--font-body); color: var(--muted-2); }
.src-row { grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 7px 8px; border-radius: 12px; background: var(--mist); }
.src-row:hover { background: var(--mist-2); }
.src-row .src-brand { width: 26px; height: 26px; border-radius: 8px; background: var(--card); }
.src-row .lr-sub, .src-row .switch-mini { display: none; }
.src-row .lr-top { gap: 6px; }
.src-row .lr-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.src-row .lr-n { font: 500 11.5px/1 var(--font-body); color: var(--muted); }
.src-row.is-off { opacity: 1; background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.src-row.is-off .lr-name { color: var(--muted-2); }
.src-brand { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 10px; background: var(--mist); }
.src-brand .op-logo { height: auto; max-height: 16px; max-width: 24px; }
.src-brand .op-mono { height: 16px; padding: 0 3px; font-size: 8px; }
.live-row.is-off .src-brand { filter: grayscale(1); }
.nets-all { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px 8px; font-size: 12px; color: var(--muted); }
.nets-all button { height: 28px; padding: 0 10px; border-radius: 9px; background: var(--mist); font: 600 12px/1 var(--font-body); color: var(--text); }
.nets-all button:hover { background: var(--mist-2); }
/* settings inside the panel: the groups of the settings sheet, tighter */
.settings-inline .set-group { padding: 10px 6px 6px; }
.settings-inline .set-group:first-child { padding-top: 2px; }
.settings-inline .set-foot { padding: 12px 6px 4px; }
.settings-inline .seg-ctl { display: flex; }
.settings-inline .seg-ctl button { flex: 1; padding: 0 6px; }
.settings-inline .switch { min-height: 44px; }
.live-title { font: 700 15px/1 var(--font-display); letter-spacing: -0.01em; }
.live-clock { margin-left: auto; font: 500 12px/1 var(--font-body); color: var(--muted-2); }
.live-rows { display: flex; flex-direction: column; gap: 2px; }
.live-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 6px 6px; border-radius: 14px; text-align: left; transition: background .15s var(--ease), opacity .25s var(--ease); }
.live-row:hover { background: var(--mist); }
.live-row.is-off { opacity: .45; }
.live-row.is-off .mode-ico { filter: grayscale(1); }
.lr-main { display: block; min-width: 0; }
.lr-top { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.lr-name { font-weight: 600; font-size: 13.5px; }
.lr-n { font: 600 13px/1 var(--font-display); color: var(--text); margin-left: auto; }
.lr-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* operator filter (live panel): one chip per operator, tap to hide / show */
.live-ops { margin: 8px 6px 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.live-ops-h { display: block; margin: 0 0 8px; font: 600 12px/1 var(--font-body); color: var(--muted-2); }
.live-ops-list { display: flex; flex-wrap: wrap; gap: 6px; }
.op-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 9px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--mist); transition: background .15s var(--ease), opacity .2s var(--ease), transform .15s var(--ease); }
.op-chip .op-logo { height: 15px; max-width: 40px; }
.op-chip.is-off .op-logo, .op-chip.is-off .op-mono { filter: grayscale(1); opacity: .7; }
.op-chip b { font: 500 11.5px/1 var(--font-body); color: var(--muted); }
.op-chip:hover { background: var(--mist-2); }
.op-chip:active { transform: scale(.96); }
.op-chip.is-off { opacity: .5; }
.lr-bar { display: flex; height: 4px; margin-top: 6px; border-radius: 999px; overflow: hidden; background: var(--mist-2); }
.lr-bar i { display: block; height: 100%; width: 0; transition: width .8s var(--ease); }
.lr-bar .b-rt { background: var(--rt); } .lr-bar .b-cf { background: var(--cf); } .lr-bar .b-sc { background: var(--sc); } .lr-bar .b-un { background: var(--un); }
.live-row .switch-mini { width: 32px; height: 20px; border-radius: 999px; background: var(--mist-2); position: relative; transition: background .2s var(--ease); flex: none; }
.live-row .switch-mini::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); transition: transform .25s var(--ease); box-shadow: 0 1px 2px rgba(7, 26, 58, 0.2); }
.live-row:not(.is-off) .switch-mini { background: var(--accent); }
.live-row:not(.is-off) .switch-mini::after { transform: translateX(12px); background: #fff; }

/* ---------- Switch ---------- */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 4px 0; font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none; }
.switch .sw-text { min-width: 0; }
.switch .sw-text small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--mist-2); transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(7, 26, 58, 0.2); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 3px solid rgba(var(--accent-rgb), 0.45); outline-offset: 2px; }

/* ---------- Segmented ---------- */
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; border-radius: 13px; background: var(--mist); }
.seg-ctl button { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: background .2s var(--ease), color .2s var(--ease); }
.seg-ctl button:hover { color: var(--text); }
.seg-ctl button.is-on { background: var(--card); color: var(--text); font-weight: 600; }

/* ---------- Controls ---------- */
.ctrl { display: flex; flex-direction: column; overflow: hidden; border-radius: 999px; animation: rise .7s .2s var(--ease) both; }
.ctrl button { width: 44px; height: 44px; display: grid; place-items: center; font: 500 22px/1 var(--font-display); color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease); }
.ctrl button + button { border-top: 1px solid var(--border); }
.ctrl button:hover { background: var(--mist); color: var(--text); }
.ctrl button.is-on { color: var(--accent-text); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease); flex: none; }
.icon-btn:hover { background: var(--mist); color: var(--text); }
:focus-visible { outline: 3px solid rgba(var(--accent-rgb), 0.45); outline-offset: 2px; }

/* ---------- Sheet ---------- */
.sheet { position: absolute; z-index: 15; top: var(--gutter); right: var(--gutter); bottom: var(--gutter); width: min(var(--sheet-w), calc(100vw - 2 * var(--gutter))); display: flex; flex-direction: column; overflow: hidden;
  background: rgba(var(--bg-rgb), 0.94); transform: translateX(18px); opacity: 0; transition: transform .5s var(--ease), opacity .3s var(--ease), height .38s var(--ease); }
.sheet.is-open { transform: none; opacity: 1; }
.sheet-grip { display: none; }
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 3; background: var(--mist); }
#sheet-body { overflow: auto; overscroll-behavior: contain; flex: 1; scrollbar-width: thin; transition: opacity .16s var(--ease); }
#sheet-body.is-swapping { opacity: 0; }
.sh-in > * { animation: sh-in .42s var(--ease) both; }
.sh-in > *:nth-child(2) { animation-delay: .03s; } .sh-in > *:nth-child(3) { animation-delay: .06s; } .sh-in > *:nth-child(n+4) { animation-delay: .09s; }

.sh-head { padding: 18px 20px 16px; }
.sh-kicker { display: flex; align-items: center; gap: 10px; min-height: 32px; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; padding-right: 40px; }
.sh-kicker .k-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-tools { margin-left: auto; display: flex; gap: 6px; flex: none; }
.sh-title { display: flex; align-items: center; gap: 12px; font: 800 clamp(22px, 3vw, 27px)/1.1 var(--font-display); letter-spacing: -0.03em; margin: 0; }
.sh-title .t-text { min-width: 0; overflow-wrap: anywhere; }
.sh-title .t-arrow { color: var(--accent-text); font-weight: 600; margin-right: 4px; }
.sh-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.sh-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
.sh-state { font-size: 13px; color: var(--text); }
.sh-state .num { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--mist); color: var(--text); white-space: nowrap; }
.pill-big { height: 30px; padding: 0 12px; font-size: 13.5px; font-weight: 700; }
.pill-late { background: rgba(var(--un-rgb), 0.13); color: var(--un); }
.pill-ontime { background: rgba(var(--rt-rgb), 0.13); color: var(--rt); }
.pill-early { background: rgba(var(--cf-rgb), 0.13); color: var(--cf); }
.pill-neutral { background: var(--mist); color: var(--muted); }
.pill-dev { background: rgba(249, 115, 22, 0.16); color: #c2410c; }
.pill-devc { background: transparent; color: #c2410c; box-shadow: inset 0 0 0 1.5px rgba(249, 115, 22, 0.55); }
:root[data-theme="dark"] .pill-dev, :root[data-theme="dark"] .pill-devc { color: #fb923c; }
.verdict.v-dev { border-color: #f97316; }
.dev-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.dev-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lg { display: inline-block; width: 26px; height: 0; border-top: 4px solid #f97316; border-radius: 2px; }
.lg-cand { border-top-style: dashed; }
.lg-unc { border-top: 3px dotted #f97316; }
.lg-rep { border-top: 3px dashed #8b919c; }
.stock { margin-top: 12px; display: grid; gap: 8px; }
.stock-plan { display: flex; gap: 3px; height: 12px; min-width: 60px; }
.stock-plan { height: 16px; }
.stock-plan i { position: relative; flex: 1; background: var(--tlc); border-radius: 8px; }
.stock-plan i::after { content: ""; position: absolute; left: 9px; right: 9px; top: 4px; height: 5px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, rgba(7, 26, 58, 0.5) 0 9px, transparent 9px 13px); }
.stock .comp-chips { margin-top: 0; }
.stock .comp-chip b { color: var(--text); font-weight: 600; }
.live-dev .lr-sub { color: var(--muted); }
.live-dev > svg { color: var(--muted-2); justify-self: end; }
.dev-list { padding: 6px 8px 14px; }
.dev-row { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 56px; padding: 9px 12px; border-radius: 14px; text-align: left; transition: background .15s var(--ease); }
.dev-row + .dev-row { box-shadow: 0 -1px 0 var(--border); }
.dev-row:hover { background: var(--mist); }
.pos-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 10px; border-radius: 9px; font-size: 12.5px; color: var(--muted); background: var(--mist); transition: background .15s var(--ease), color .15s var(--ease); }
.pos-chip:hover { color: var(--text); background: var(--mist-2); }
.pos-chip .num { color: var(--text); }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; background: var(--mist); color: var(--muted); font-size: 12px; font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease); }
.tool-btn:hover { color: var(--text); background: var(--mist-2); }
.tool-btn.is-on { background: var(--accent); color: var(--accent-ink); }
.sh-num { font: 600 13px/1 var(--font-display); color: var(--text); }

/* "now" block: a tinted card inside the sheet */
.now { margin: 0 14px 6px; padding: 14px 16px 16px; border-radius: 18px; background: var(--tint); }
.now-label { font: 600 12px/1 var(--font-body); color: var(--accent-text); }
.now-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; }
.now-name { font: 700 19px/1.2 var(--font-display); letter-spacing: -0.02em; min-width: 0; }
.now-time { font: 700 20px/1 var(--font-display); letter-spacing: -0.02em; flex: none; text-align: right; }
.now-time s { display: block; margin-bottom: 4px; font: 500 12px/1 var(--font-body); color: var(--muted-2); text-decoration: line-through; }
.now-sub { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.now-sub b { color: var(--text); font-weight: 600; }
.now-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 11.5px; color: var(--muted-2); }
.now-from { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-track { --lc: var(--accent); position: relative; flex: 1; height: 4px; border-radius: 999px; background: rgba(var(--tint-rgb), 0.12); }
.now-track i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--lc); transition: width 1s linear; }
.now-track b { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc) 25%, transparent); transition: left 1s linear; }

/* tabs: a segmented control */
.tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; margin: 8px 14px 4px; padding: 3px; border-radius: 14px; background: var(--mist); }
.tab { flex: 1; height: 36px; border-radius: 11px; font-size: 13px; font-weight: 500; color: var(--muted); transition: background .2s var(--ease), color .2s var(--ease); }
.tab:hover { color: var(--text); }
.tab.is-on { background: var(--card); color: var(--text); font-weight: 600; }
.tab-panel { animation: fade .22s var(--ease) both; }
.sh-section { padding: 16px 20px; }
.sh-section + .sh-section { border-top: 1px solid var(--border); }
.sh-section h4, .h4 { margin: 0 0 10px; font: 700 13px/1.2 var(--font-display); letter-spacing: -0.01em; color: var(--muted); }

/* reliability / position explanations */
.reliab { display: flex; flex-direction: column; gap: 8px; }
.reliab-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 7px 0; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.reliab-row:last-child { border-bottom: 0; }
.reliab-row .k { color: var(--muted); flex: none; }
.reliab-row .v { font-weight: 500; font-size: 12.5px; text-align: right; overflow-wrap: anywhere; }
.reliab-row .v small { display: block; font-weight: 400; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.verdict { padding: 12px 14px; border-radius: 14px; background: var(--mist); border-left: 3px solid var(--sc); font-size: 13px; color: var(--muted); line-height: 1.55; }
.verdict.v-rt { border-color: var(--rt); } .verdict.v-un { border-color: var(--un); } .verdict.v-cf { border-color: var(--cf); }
.verdict b { color: var(--text); }
.verdict-k { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; color: var(--text); font-size: 13.5px; }
.verdict + .verdict { margin-top: 10px; }
.gauge { margin-top: 10px; }
.gauge-track { position: relative; height: 6px; border-radius: 999px; background: linear-gradient(90deg, rgba(var(--rt-rgb), .55), rgba(var(--cf-rgb), .55) 45%, rgba(var(--sc-rgb), .45) 100%); }
.gauge-track b { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--card); transition: left .8s var(--ease); }
.gauge-scale { display: flex; justify-content: space-between; margin-top: 6px; font: 500 10.5px/1 var(--font-body); color: var(--muted-2); }
.tech-h { margin: 18px 0 4px !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 13px; background: var(--mist); color: var(--text); transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease); }
.btn:hover { background: var(--mist-2); }
.btn:active { transform: scale(.97); }

/* Timeline (trains and buses): nodes on a line */
.tl { position: relative; padding: 12px 20px 22px; }
.tl-more { display: block; margin: 0 0 6px 34px; padding: 6px 0; font-size: 12.5px; font-weight: 500; color: var(--accent-text); }
.tl-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-row { position: relative; display: grid; grid-template-columns: 22px 1fr auto; column-gap: 12px; align-items: start; padding: 7px 0; min-height: 46px; }
.tl-row.is-folded { display: none; }
.tl-row::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--mist-2); }
.tl-rows > .tl-row:first-child::before { top: 50%; }
.tl-rows > .tl-row:last-child::before { bottom: 50%; }
.tl-row.is-past::before { background: color-mix(in srgb, var(--tlc, var(--accent)) 45%, transparent); }
.tl-node { position: relative; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; margin-top: 3px; }
.tl-node::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--muted-2); transition: background .25s, border-color .25s, box-shadow .25s; }
.is-past .tl-node::after { background: var(--tlc, var(--accent)); border-color: var(--tlc, var(--accent)); }
.is-current .tl-node::after { background: var(--card); border-color: var(--tlc, var(--accent)); box-shadow: 0 0 0 5px color-mix(in srgb, var(--tlc, var(--accent)) 20%, transparent); }
.is-skipped .tl-node::after { background: transparent; border-style: dashed; }
.tl-main { min-width: 0; }
.tl-name { font-weight: 500; line-height: 1.3; }
.is-past .tl-name { color: var(--muted); }
.is-current .tl-name { color: var(--text); font-weight: 600; }
.tl-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.tl-tag-warn { color: var(--un); }
.tl-tag-next { color: var(--tlc-text, var(--accent-text)); font: 600 11px/1 var(--font-body); }
.tl-time { text-align: right; font-weight: 500; font-size: 13px; line-height: 1.3; white-space: nowrap; }
.tl-time > span { display: block; }
.tl-time .sched { font-size: 11px; font-weight: 400; color: var(--muted-2); text-decoration: line-through; }
.tl-time .real { color: var(--muted); }
.tl-delay { margin-top: 2px; font-size: 11px; color: var(--un); }
.tl-delay.ok { color: var(--rt); } .tl-delay.early { color: var(--cf); }
.tl-time .est { font-size: 10.5px; font-weight: 400; color: var(--muted-2); }
.tl-veh { position: absolute; left: 31px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--tlc, var(--accent)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tlc, var(--accent)) 25%, transparent); transform: translateY(-50%); transition: top 1s linear; z-index: 2; pointer-events: none; }
.tl-veh.is-train { border-radius: 5px; }
.tl-veh.is-train::after { content: ""; position: absolute; inset: 4px; border-radius: 2px; background: #fff; opacity: .5; }

/* Composition */
.h4-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.comp-src { margin: -4px 0 12px; font: 500 11.5px/1 var(--font-body); color: var(--muted-2); }
.comp-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cs-v { display: block; font: 800 22px/1 var(--font-display); letter-spacing: -0.03em; }
.cs-v small { font: 500 12px/1 var(--font-body); color: var(--muted); letter-spacing: 0; }
.cs-k { display: block; font-size: 11px; color: var(--muted-2); margin-top: 5px; }
.comp-type { margin: 12px 0 8px; font-size: 12.5px; color: var(--muted); }
.comp-plan { display: flex; align-items: flex-end; gap: 9px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 6px 4px 2px; margin: 0 -2px; scrollbar-width: thin; }
.cset { position: relative; display: flex; align-items: flex-end; gap: 3px; flex: none; animation: car-in .55s var(--ease) both; }
.cset:nth-child(2) { animation-delay: .06s; } .cset:nth-child(3) { animation-delay: .12s; } .cset:nth-child(n+4) { animation-delay: .18s; }
.cset::after { content: ""; position: absolute; left: -5px; right: -5px; bottom: 14px; height: 1px; background: rgba(var(--tint-rgb), 0.18); pointer-events: none; }
.car { flex: none; width: var(--w); min-width: 16px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; border-radius: 6px; }
.car-n { height: 10px; font: 500 10px/1 var(--font-body); color: var(--muted-2); text-align: center; transition: color .2s var(--ease); }
.car-body { position: relative; height: 24px; border-radius: 6px; overflow: hidden; background: rgba(var(--tint-rgb), 0.14); transition: background .2s var(--ease), box-shadow .2s var(--ease), transform .25s var(--ease); }
.car-body::before, .car-dd .car-body::after { content: ""; position: absolute; left: 4px; right: 4px; top: 5px; height: 5px; border-radius: 2px; background: repeating-linear-gradient(90deg, rgba(var(--bg-rgb), 0.7) 0 5px, transparent 5px 8px); }
.car-dd .car-body { height: 31px; }
.car-dd .car-body::after { top: 17px; }
.car-first .car-body { background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.3) 0 var(--p1), rgba(var(--tint-rgb), 0.14) var(--p1) 100%); }
.car-1 { position: absolute; left: 4px; bottom: 2px; font: 700 9px/1 var(--font-body); color: var(--accent-text); }
.car-loco .car-body { height: 25px; background: rgba(var(--tint-rgb), 0.34); }
.car-loco .car-body::before { left: 5px; right: auto; width: 6px; height: 7px; background: rgba(var(--bg-rgb), 0.75); }
.car-loco.cab-r .car-body::before { left: auto; right: 5px; }
.cab-l .car-body { clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 42%); }
.cab-r .car-body { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 42%, 100% 100%, 0 100%); }
.cab-l .car-body::before { left: 9px; } .cab-r:not(.car-loco) .car-body::before { right: 9px; }
.car-feats { display: flex; justify-content: center; gap: 1px; height: 12px; color: var(--muted); }
.car-feats svg { width: 12px; height: 12px; flex: none; }
.car:hover .car-body, .car.is-on .car-body { box-shadow: inset 0 0 0 1.5px var(--accent); transform: translateY(-2px); }
.car:hover .car-n, .car.is-on .car-n { color: var(--text); }
.car-loco:hover .car-body, .car-loco.is-on .car-body { background: rgba(var(--tint-rgb), 0.45); }
.comp-detail { min-height: 40px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--mist); font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.comp-detail b { color: var(--text); font-weight: 600; }
.comp-detail .muted { color: var(--muted-2); }
.comp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.comp-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 8px; background: var(--mist); font-size: 12px; color: var(--muted); }
.comp-chip svg { width: 14px; height: 14px; color: var(--text); }
.comp-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -2px 0 12px; }
.comp-tab { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 30px; padding: 0 11px; border-radius: 9px; background: var(--mist); font-size: 12px; color: var(--muted); transition: background .2s var(--ease), color .2s var(--ease); }
.comp-tab:hover { color: var(--text); }
.comp-tab.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.comp-now { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.comp-wait { display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--muted-2); }
.comp-ghost { display: flex; gap: 3px; }
.comp-ghost i { flex: 1; height: 24px; border-radius: 6px; background: linear-gradient(90deg, var(--mist), var(--mist-2), var(--mist)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.comp-note { margin: 0; font-size: 12.5px; color: var(--muted-2); line-height: 1.5; }
.b-len { font: 500 11px/1 var(--font-body); color: var(--muted-2); }
.pop-comp { margin-top: 3px; font: 500 11px/1.3 var(--font-body); color: var(--muted); }

/* Station board */
.board-head { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 6px 20px 8px; font: 600 11.5px/1 var(--font-body); color: var(--muted-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; background: rgba(var(--bg-rgb), 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.board { padding: 4px 8px 12px; }
.board-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 11px 12px; border-radius: 14px; text-align: left; color: var(--text); transition: background .15s var(--ease); }
.board-row + .board-row { box-shadow: 0 -1px 0 var(--border); }
.board-row:hover { background: var(--mist); box-shadow: none; }
.board-row:hover + .board-row { box-shadow: none; }
.b-time { font: 700 17px/1 var(--font-display); letter-spacing: -0.02em; }
.b-time s { display: block; margin-top: 4px; font: 500 11px/1 var(--font-body); color: var(--muted-2); }
.b-time .b-dl { display: block; margin-top: 4px; font: 500 11px/1 var(--font-body); white-space: nowrap; }
.b-main { min-width: 0; }
.b-dest { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-sub { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.b-sub .cat { height: 20px; min-width: 32px; font-size: 11px; padding: 0 6px; }
.b-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.b-in { font: 600 12.5px/1 var(--font-body); color: var(--text); }
.b-in.soon { color: var(--accent-text); }
.b-flag { font-size: 11px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 5px; }
.board-row.is-canceled .b-dest, .board-row.is-canceled .b-time { text-decoration: line-through; color: var(--muted-2); }
.board-row.is-canceled .b-flag { color: var(--un); }
.near { padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.near-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 10px; }
.near-v { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 9px; border-radius: 12px; background: var(--mist); text-align: left; transition: background .15s var(--ease), transform .15s var(--ease); }
.near-v:hover { background: var(--mist-2); }
.near-v:active { transform: scale(.97); }
.near-v span:last-child { min-width: 0; }
.near-v small { display: block; font: 500 10.5px/1.2 var(--font-body); color: var(--muted-2); }
.near-v em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 26px 20px; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.5; }
.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--mist), var(--mist-2), var(--mist)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin: 10px 20px; }
.sk-head { padding: 22px 0 8px; }
.sk-head .skeleton:first-child { height: 26px; width: 55%; }

/* ---------- Settings panel ---------- */
.panel { position: absolute; z-index: 16; top: var(--gutter); right: var(--gutter); bottom: var(--gutter); width: min(var(--sheet-w), calc(100vw - 2 * var(--gutter))); display: flex; flex-direction: column; overflow: hidden;
  background: rgba(var(--bg-rgb), 0.95); transform: translateX(18px); opacity: 0; transition: transform .5s var(--ease), opacity .3s var(--ease); }
.panel.is-open { transform: none; opacity: 1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 12px 20px; }
.panel-head h2 { margin: 0; font: 800 22px/1 var(--font-display); letter-spacing: -0.03em; }
.panel-body { flex: 1; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 12px; }
.set-group { padding: 14px 20px 10px; }
.set-group + .set-group { border-top: 1px solid var(--border); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; }
.set-row > span { font-size: 13.5px; }
.set-row > span small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.set-block { padding: 6px 0 10px; }
.set-block > span { display: block; font-size: 13.5px; margin-bottom: 8px; }
.set-mode { display: flex; align-items: center; gap: 10px; }
.set-foot { padding: 14px 20px 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-2); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--gutter); }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7, 26, 58, 0.45); animation: fade .25s var(--ease) both; }
.modal-card { position: relative; width: min(660px, 100%); max-height: calc(100vh - 2 * var(--gutter)); overflow: auto; padding: 28px 28px 24px; border-radius: var(--r-xl); background: var(--card); box-shadow: var(--shadow); animation: pop .35s var(--ease) both; scrollbar-width: thin; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--mist); }
.modal h2 { margin: 0 0 10px; padding-right: 30px; font: 800 clamp(22px, 3vw, 28px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.modal h3 { margin: 24px 0 10px; font: 700 15px/1.2 var(--font-display); letter-spacing: -0.01em; }
.modal p { margin: 0 0 10px; color: var(--muted); line-height: 1.6; }
.modal p.lead { color: var(--text); font-size: 15px; }
.modal strong { color: var(--text); }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 14px 0 4px; }
.about-grid div { padding: 12px 14px; border-radius: 14px; background: var(--mist); font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.about-grid .k { display: block; font: 700 12px/1 var(--font-display); color: var(--accent-text); margin-bottom: 6px; }
.conf-list { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.conf-list li { display: flex; align-items: baseline; gap: 10px; }
.conf-list .dot { transform: translateY(-1px); }
.conf-list b { color: var(--text); }
.src-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.src-item { padding: 12px 14px; border-radius: 14px; background: var(--mist); }
.src-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.src-top b { font: 700 14px/1.2 var(--font-display); }
.src-state { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1 var(--font-body); color: var(--muted-2); white-space: nowrap; }
.src-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.src-state.s-ok { color: var(--rt); } .src-state.s-ok i { background: var(--rt); }
.src-state.s-degraded { color: #b45309; } .src-state.s-degraded i { background: #eaa112; }
.src-state.s-down { color: var(--un); } .src-state.s-down i { background: var(--un); }
.src-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.src-attr { margin-top: 4px; font-size: 11.5px; color: var(--muted-2); }
.map-links { display: flex; flex-wrap: wrap; gap: 6px; }
.map-links .chip { text-decoration: none; }

/* ---------- Intro: the brand moment, white in both themes ---------- */
.intro { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #ffffff; transition: opacity .6s var(--ease), visibility .6s; }
.intro.is-done { opacity: 0; visibility: hidden; }
.intro-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: pop .6s var(--ease) both; }
.intro-mark { height: 38px; width: auto; }
.intro-sub { color: #4b5a73; font-size: 13px; }
.intro-bar { width: 160px; height: 4px; border-radius: 999px; background: #e8eef7; overflow: hidden; }
.intro-bar span { display: block; width: 40%; height: 100%; background: #0b63ff; border-radius: 999px; animation: slide 1.2s var(--ease) infinite; }

/* ---------- Popup (hover) ---------- */
.maplibregl-popup-content { background: var(--card); color: var(--text); border-radius: 14px; box-shadow: var(--shadow); padding: 9px 12px; font: 12.5px/1.35 var(--font-body); }
.maplibregl-popup-tip { display: none; }
.pop-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pop-title .op-logo { height: 14px; max-width: 36px; }
.pop-title .op-mono { height: 15px; font-size: 8.5px; }
.pop-title .line-badge { min-width: 26px; height: 20px; font-size: 11px; }
.pop-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.pop-sub .late { color: var(--un); } .pop-sub .early { color: var(--cf); } .pop-sub .ok { color: var(--rt); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sh-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--rt-rgb), 0.55); } 100% { box-shadow: 0 0 0 9px rgba(var(--rt-rgb), 0); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes slide { from { transform: translateX(-120%); } to { transform: translateX(300%); } }
@keyframes car-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive: tablet & phone ---------- */
@media (max-width: 900px) {
  :root { --gutter: 12px; }
  .hud-tl { width: auto; right: var(--gutter); gap: 8px; }
  .hud-tr { display: none !important; }
  .top { padding: 10px 10px 10px; border-radius: 22px; }
  .brand { grid-template-areas: "logo chip"; padding: 0 2px 0 6px; }
  .brand-home img { height: 20px; }
  .brand-sub { display: none; }
  .search { height: 44px; margin-top: 8px; }
  .search-kbd { display: none; }
  .search-results { left: -10px; right: -10px; top: calc(100% + 14px); max-height: calc(100dvh - 150px); }
  .mode-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; animation: rise .7s .1s var(--ease) both; }
  .mode-pills::-webkit-scrollbar { display: none; }
  .mode-pill { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 36px; padding: 0 12px 0 10px; border-radius: 12px; font-size: 12.5px; font-weight: 600; color: var(--text);
    background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
  .mode-pill b { font: 500 11.5px/1 var(--font-body); color: var(--muted); }
  .mode-pill.is-off { opacity: .5; }
  .mode-pill.is-off .mode-dot { background: var(--muted-2); }
  .mode-pill:active { transform: scale(.96); }
  .pill-sep { flex: none; width: 1px; margin: 8px 2px; background: var(--border-strong); }
  .op-pill .mode-dot { background: var(--accent); }
  body.sheet-open .mode-pills, body.panel-open .mode-pills { opacity: 0; pointer-events: none; }
  .hud-br { bottom: calc(24px + env(safe-area-inset-bottom)); right: var(--gutter); gap: 8px; }
  .hud-br .ctrl:first-child { display: none; } /* pinch to zoom */
  body.sheet-open .hud-br, body.panel-open .hud-br { transform: none; bottom: calc(var(--sheet-h, 0px) + 12px); }
  body.sheet-full .hud-br, body.panel-open .hud-br { opacity: 0; pointer-events: none; }

  /* bottom sheet: the map stays visible above it; drag the grip to resize */
  .sheet, .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: var(--sheet-h, 46dvh); max-height: calc(100dvh - 60px); border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(40px); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -12px 40px -16px rgba(7, 26, 58, 0.4); }
  .sheet.is-dragging, .panel.is-dragging { transition: none; }
  .sheet-grip { display: flex; justify-content: center; align-items: center; height: 24px; flex: none; cursor: grab; touch-action: none; }
  .sheet-grip i { width: 40px; height: 5px; border-radius: 3px; background: var(--mist-2); }
  .sheet-close { top: 12px; }
  .sh-head { padding-top: 4px; touch-action: pan-y; }
  .sh-title { font-size: 22px; }
  .panel { height: min(86dvh, 720px); }
  .panel-head { padding-top: 4px; }
  .modal { padding: 0; place-items: end center; }
  .modal-card { width: 100%; max-height: 88dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .4s var(--ease) both; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) {
  .live-chip { width: 28px; padding: 0; justify-content: center; }
  .live-chip span { display: none; }
  .live-dot { width: 9px; height: 9px; }
  .now-name, .now-time { font-size: 18px; }
  .board-head, .board-row { grid-template-columns: 56px 1fr auto; gap: 10px; }
}

/* official operator messages (De Lijn alerts) and departure boards of bus / tram stops */
.op-alerts { display: grid; gap: 6px; padding: 4px 16px 10px; }
.op-alert { border-radius: 14px; background: var(--mist); }
.op-alert summary { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; list-style: none; }
.op-alert summary::-webkit-details-marker { display: none; }
.op-alert summary > svg:last-child { color: var(--muted-2); transition: transform .2s var(--ease); }
.op-alert[open] summary > svg:last-child { transform: rotate(90deg); }
.op-ico { color: #eaa112; display: inline-flex; }
.op-t { display: grid; gap: 2px; min-width: 0; }
.op-t b { font-size: 13px; font-weight: 600; }
.op-t small { font-size: 11px; color: var(--muted-2); }
.op-alert p { margin: 0; padding: 0 12px 10px 39px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.op-alert a { display: inline-block; margin: 0 12px 10px 39px; font-size: 12px; color: var(--accent-text); }
.op-more { font-size: 12px; color: var(--muted-2); padding: 0 4px; }
.op-cancel { margin: 4px 16px 6px; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: rgba(var(--un-rgb), 0.12); color: var(--text); }
.board-row.no-veh { cursor: default; }
.board-row.no-veh:hover { background: none; }
.board-row:disabled { opacity: 1; color: var(--text); }
.b-dest .line-badge { margin-right: 6px; vertical-align: 1px; }

/* map picker: the map's title in the brand card (and the first pill on phones) opens the list of maps */
.map-pick { display: inline-flex; align-items: center; gap: 3px; padding: 1px 3px; margin: -1px -3px; border-radius: 6px; font: 600 11.5px/1 var(--font-body); color: var(--accent-text); white-space: nowrap; transition: background .15s var(--ease); }
.map-pick:hover { background: var(--mist); }
.map-pick svg { width: 12px; height: 12px; }
.map-pill svg { width: 12px; height: 12px; margin-left: -2px; color: var(--accent-text); }
.map-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; min-width: 250px; max-width: min(360px, calc(100vw - 2 * var(--gutter))); padding: 8px; animation: rise .25s var(--ease) both; }
.map-menu-h { padding: 6px 10px 8px; font: 700 11px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.map-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; transition: background .15s var(--ease); }
.map-item:hover { background: var(--mist); }
.map-item.is-on { background: var(--tint); }
.map-item.is-on .map-item-t::after { content: " ✓"; color: var(--accent-text); }
.map-item-t { font: 600 13.5px/1.2 var(--font-display); }
.map-item-d { font-size: 12px; line-height: 1.3; color: var(--muted); }
