/* RailPilot live-map prototype — styles (refinement pass, 5 Nov 2026).
   The map is a self-contained component (.lm) sized by its container. Tokens inherit the frozen
   RailPilot identity (navy canvas, teal accent, Archivo + IBM Plex Sans). Detail follows the zoom tier
   the renderer sets in data-zoom (far | mid | near); the view (network | follow) and the follow state
   (following | suspended) are classes on the root. Skins A/B/C are token overrides. */

.lm {
  --lm-bg: #071A2B; --lm-water: #0A2135; --lm-land: #081D30;
  --lm-surface: #10283A; --lm-surface-2: #173448; --lm-line: rgba(159,179,194,.18);
  --lm-text: #F6FAFC; --lm-text-2: #C5D3DD; --lm-muted: #9FB3C2;
  --lm-teal: #26D6C5; --lm-teal-ink: #062B2A; --lm-teal-dim: rgba(38,214,197,.14);
  --lm-G: #3DBE6C; --lm-O: #F6A94B; --lm-G-lit: #9BF2BB; --lm-O-lit: #FFD79A;
  --lm-warn: #F7C96B; --lm-severe: #FF7A6B; --lm-warn-dim: rgba(247,201,107,.14);
  --lm-body: #E4EBF1; --lm-glass: #16293B; --lm-outline: #0A1826; --lm-lamp: #FFF1BF; --lm-tail: #FF6B5C;
  --lm-font: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
  --lm-display: 'Archivo', 'IBM Plex Sans', system-ui, sans-serif;
  --lm-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --lm-rw: 5px; --lm-glow: .22; --lm-lbl-font: var(--lm-font);
  --lm-ease: cubic-bezier(.2,.7,.2,1);
  position: relative; width: 100%; height: 100%; min-height: 240px; overflow: hidden;
  background: var(--lm-bg); color: var(--lm-text); font-family: var(--lm-font); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; color-scheme: dark; user-select: none; -webkit-user-select: none;
  container-type: inline-size;
}
.lm *, .lm *::before, .lm *::after { box-sizing: border-box; }
/* The design harness page had this rule globally; the app's stylesheet does not, and the
   renderer hides its legend, sheet, strip and toast with the attribute. */
.lm [hidden] { display: none !important; }
/* With the Motion adapter live (ui-motion.js), these entrances are springs driven from JS;
   the CSS keyframes below stay as the fallback and for reduced motion. */
.lm.lm-motion :is(.lm-sheet, .lm-toast, .lm-strip, .lm-back, .lm-status, .lm-recenter, .lm-modebar) { animation: none; }
.lm :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }   /* :where: the component rules (.lm-chip, .lm-back) must win this reset */
.lm button:focus-visible, .lm [tabindex]:focus-visible { outline: 2px solid var(--lm-teal); outline-offset: 2px; }
.lm .num { font-variant-numeric: tabular-nums; }
.lm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* ambient: a quiet vignette so the edges recede and the network sits in light */
.lm::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,0) 45%, rgba(0,0,0,.32) 100%); }
.lm[data-zoom="far"] { --lm-rw: 3.5px; }
.lm[data-zoom="mid"] { --lm-rw: 5px; }
.lm[data-zoom="near"] { --lm-rw: 7px; }

/* ---- context --------------------------------------------------------------------------- */
.lm-bay { fill: var(--lm-water); }
.lm-river { fill: none; stroke: var(--lm-water); stroke-width: 7px; stroke-linecap: round; stroke-linejoin: round; }
.lm-ctxlbl { font-size: 10px; fill: var(--lm-muted); opacity: .5; letter-spacing: .16em; text-transform: uppercase; font-weight: 500; }
.lm[data-zoom="far"] .lm-ctxlbl { opacity: .32; }
.lm-gridlines { fill: none; stroke: rgba(159,179,194,.07); stroke-width: 1px; }

/* ---- tracks: casing · ribbon · highlight, with a soft ground shadow once you are close ------- */
.lm-track-shadow { fill: none; stroke: rgba(0,0,0,.38); stroke-width: calc(var(--lm-rw) + 7px); stroke-linecap: round; stroke-linejoin: round; transform: translate(0, 3px); display: none; }
.lm[data-zoom="near"] .lm-track-shadow { display: block; }
.lm-track-casing { fill: none; stroke: var(--lm-bg); stroke-width: calc(var(--lm-rw) + 4px); stroke-linecap: round; stroke-linejoin: round; }
.lm-track { fill: none; stroke-width: var(--lm-rw); stroke-linecap: round; stroke-linejoin: round; transition: opacity .5s var(--lm-ease); }
.lm-track.G { stroke: var(--lm-G); filter: drop-shadow(0 0 5px rgba(61,190,108,var(--lm-glow))); }
.lm-track.O { stroke: var(--lm-O); filter: drop-shadow(0 0 5px rgba(246,169,75,var(--lm-glow))); }
.lm[data-zoom="far"] .lm-track { filter: none; }
.lm-track-hl { fill: none; stroke: rgba(255,255,255,.17); stroke-width: 1px; stroke-linecap: round; stroke-linejoin: round; display: none; transform: translate(0, -1.5px); }
.lm[data-zoom="near"] .lm-track-hl { display: block; }
.lm.has-sel.sel-G .lm-track.O, .lm.has-sel.sel-O .lm-track.G { opacity: .4; }
.lm.has-sel .lm-track { filter: none; }

/* selected train's remaining route */
.lm-routeGlow, .lm-route { opacity: 0; transition: opacity .45s var(--lm-ease); }
.lm.has-sel .lm-routeGlow, .lm.has-sel .lm-route { opacity: 1; }
.lm-route-glow { fill: none; stroke-width: 15px; stroke-linecap: round; stroke-linejoin: round; opacity: .2; }
.lm-route-glow.G { stroke: var(--lm-G); } .lm-route-glow.O { stroke: var(--lm-O); }
.lm-route { fill: none; stroke-width: var(--lm-rw); stroke-linecap: round; stroke-linejoin: round; }
.lm-route.G { stroke: var(--lm-G-lit); } .lm-route.O { stroke: var(--lm-O-lit); }
.lm-route-flow { fill: none; stroke: rgba(255,255,255,.6); stroke-width: 2px; stroke-linecap: round; stroke-dasharray: 2 20; animation: lm-flow 1.2s linear infinite; }
@keyframes lm-flow { to { stroke-dashoffset: -22; } }

/* ---- stations -------------------------------------------------------------------------- */
.lm-stn { cursor: pointer; }
.lm-stn .hit { fill: transparent; }
.lm-stn .ring { fill: var(--lm-bg); stroke: var(--lm-text-2); stroke-width: 1.8px; r: 4px; transition: stroke .3s, fill .3s; }
.lm-stn.major .ring { stroke: var(--lm-text); stroke-width: 2.2px; r: 5.5px; }
.lm-stn.junction .ring { r: 6.5px; }
.lm-stn .core { fill: var(--lm-text); r: 0; }
.lm-stn.terminus .core, .lm-stn.junction .core { r: 1.9px; }
.lm[data-zoom="far"] .lm-stn .ring { r: 2.8px; stroke-width: 1.5px; }
.lm[data-zoom="far"] .lm-stn.major .ring { r: 4.2px; stroke-width: 2px; }
.lm[data-zoom="far"] .lm-stn .core { r: 0; } .lm[data-zoom="far"] .lm-stn.terminus .core { r: 1.4px; }
.lm[data-zoom="near"] .lm-stn .ring { r: 5.5px; stroke-width: 2px; }
.lm[data-zoom="near"] .lm-stn.major .ring { r: 7px; stroke-width: 2.4px; }
.lm[data-zoom="near"] .lm-stn.junction .ring { r: 8px; }
.lm[data-zoom="near"] .lm-stn .core { r: 1.7px; fill: var(--lm-text-2); }
.lm-stn.commute .ring { stroke: var(--lm-teal); }
.lm-stn.commute-end .ring { fill: var(--lm-teal-dim); }
.lm-stn.sel .ring { fill: var(--lm-teal); stroke: var(--lm-teal); }
.lm-stn .halo { fill: none; stroke-width: 2px; opacity: 0; }
.lm-stn.lit-G .halo { stroke: var(--lm-G); animation: lm-halo 2.2s var(--lm-ease) forwards; }
.lm-stn.lit-O .halo { stroke: var(--lm-O); animation: lm-halo 2.2s var(--lm-ease) forwards; }
.lm-stn.lit-G .ring { stroke: var(--lm-G); } .lm-stn.lit-O .ring { stroke: var(--lm-O); }
@keyframes lm-halo { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.7); } }
.lm-lbl { font-family: var(--lm-lbl-font); font-size: 11.5px; font-weight: 500; fill: var(--lm-text-2); pointer-events: none; paint-order: stroke; stroke: var(--lm-bg); stroke-width: 3.5px; stroke-linejoin: round; letter-spacing: .005em; }
.lm-lbl.major { font-size: 12.5px; font-weight: 700; fill: var(--lm-text); }
.lm-lbl.terminus { letter-spacing: .01em; }
.lm-lbl.commute { fill: var(--lm-text); }
.lm.has-sel .lm-lbl:not(.major) { opacity: .62; }

/* ---- trains ---------------------------------------------------------------------------- */
.lm-train { cursor: pointer; transition: opacity .4s var(--lm-ease); }
.lm-train .hit { fill: transparent; }
.lm-train .glow { opacity: 0; transition: opacity .4s; }
.lm-train.moving .glow { opacity: .45; }
.lm-train.sel .glow { opacity: .85; r: 28px; }
.lm-train .ltr { font-family: var(--lm-display); font-weight: 800; text-anchor: middle; pointer-events: none; }
.lm-train .ltr.car { fill: var(--lm-outline); } .lm-train .ltr.line { fill: var(--lm-bg); }
.lm.mk-dart .lm-train.G .ltr.line { fill: var(--lm-G); } .lm.mk-dart .lm-train.O .ltr.line { fill: var(--lm-O); }
.lm-train .selring { fill: none; stroke: var(--lm-teal); stroke-width: 2px; opacity: 0; transition: opacity .3s; }
.lm-train.sel .selring { opacity: 1; }
.lm-train .stalering { fill: none; stroke: var(--lm-warn); stroke-width: 1.5px; stroke-dasharray: 3 3; opacity: 0; transition: opacity .6s; }
.lm-train.stale .stalering { opacity: .9; }
.lm-train.stale { opacity: .62; } .lm-train.stale .glow { opacity: 0; }
.lm-train.dim { opacity: .34; }
.lm-train.dying { opacity: 0; transition: opacity 1s var(--lm-ease); }
.lm-train .body { transition: transform .35s var(--lm-ease); }
/* Metrorail (final) */
.mk-metro .car { fill: var(--lm-body); stroke: var(--lm-outline); stroke-width: 1.1px; transition: fill .5s, stroke .3s; }
.mk-metro .cab { stroke: var(--lm-outline); stroke-width: 1px; transition: fill .5s; }
.lm-train.G .mk-metro .cab { fill: var(--lm-G); } .lm-train.O .mk-metro .cab { fill: var(--lm-O); }
.mk-metro .shield { fill: var(--lm-glass); transition: fill .4s; }
.mk-metro .win { fill: none; stroke: var(--lm-glass); stroke-width: 1.3px; stroke-dasharray: 4.6 1.3; }
.mk-metro .stripe { fill: none; stroke-width: .9px; opacity: .95; }
.lm-train.G .mk-metro .stripe { stroke: var(--lm-G); } .lm-train.O .mk-metro .stripe { stroke: var(--lm-O); }
.mk-metro .seam { stroke: var(--lm-outline); stroke-width: .7px; opacity: .22; }
.mk-metro .sep { stroke: var(--lm-outline); stroke-width: .9px; opacity: .55; }
.mk-metro .lamp { fill: var(--lm-lamp); opacity: .3; transition: opacity .4s; }
.mk-metro .tail { stroke: var(--lm-tail); stroke-width: 1.5px; stroke-linecap: round; opacity: .5; transition: opacity .4s; }
.mk-metro .beam { opacity: 0; transition: opacity .5s; }
.lm-train.moving .mk-metro .lamp { opacity: 1; } .lm-train.moving .mk-metro .tail { opacity: .95; }
.lm-train.moving .mk-metro .beam { opacity: .3; }
.lm[data-zoom="far"] .mk-metro .beam { display: none; }
.lm-train.dwell .mk-metro .shield { fill: #FFE8A3; }                           /* standing at a platform: cab lit */
.lm-train.stale .mk-metro .car { fill: #8A98A3; } .lm-train.stale .mk-metro .cab { fill: #5E6C78; } .lm-train.stale .mk-metro .stripe { stroke: #5E6C78; }
.lm-train.stale .mk-metro .lamp, .lm-train.stale .mk-metro .tail, .lm-train.stale .mk-metro .beam { opacity: 0; }
.lm-train.sel .mk-metro .car { stroke: var(--lm-teal); stroke-width: 1.4px; }
.lm-train.late .mk-metro .car { stroke: var(--lm-warn); }
/* Route Dart (Concept A) */
.mk-dart .shell { fill: var(--lm-bg); fill-opacity: .92; stroke-width: 2px; stroke-linejoin: round; transition: fill-opacity .4s; }
.mk-dart .chev { fill: none; stroke-width: 1.8px; stroke-linecap: round; stroke-linejoin: round; }
.mk-dart .bar { stroke-width: 1.4px; opacity: .55; stroke-linecap: round; }
.lm-train.G .mk-dart .shell, .lm-train.G .mk-dart .chev, .lm-train.G .mk-dart .bar { stroke: var(--lm-G); } .lm-train.O .mk-dart .shell, .lm-train.O .mk-dart .chev, .lm-train.O .mk-dart .bar { stroke: var(--lm-O); }
.lm-train.dwell .mk-dart .shell { fill: #FFE8A3; fill-opacity: .25; }
.lm-train.stale .mk-dart .shell, .lm-train.stale .mk-dart .chev, .lm-train.stale .mk-dart .bar { stroke: #8A98A3; } .lm-train.stale .ltr.line { fill: #8A98A3; }
.lm-train.sel .mk-dart .shell { stroke: var(--lm-teal); fill: var(--lm-teal); fill-opacity: .18; }
.lm[data-zoom="far"] .mk-dart .bar { display: none; }
/* Portrait (panel only) */
.lm-portrait { width: 30px; height: 32px; flex: none; }
.lm-portrait .glass { fill: var(--lm-bg); } .lm-portrait .lamp { fill: var(--lm-lamp); } .lm-portrait .bumper { stroke: var(--lm-bg); stroke-width: 1.6px; stroke-linecap: round; opacity: .6; } .lm-portrait .rails { stroke: var(--lm-muted); stroke-width: 1.4px; stroke-linecap: round; opacity: .7; }
.lm-portrait.G .face { fill: var(--lm-G); } .lm-portrait.O .face { fill: var(--lm-O); }
.lm-portrait .split { stroke-width: 1.4px; } .lm-portrait.G .split { stroke: var(--lm-G); } .lm-portrait.O .split { stroke: var(--lm-O); }
/* ghosts, rings, traces, callout */
.lm-tail circle { opacity: 0; transition: opacity .5s; }
.lm-tail.G circle { fill: var(--lm-G); } .lm-tail.O circle { fill: var(--lm-O); }
.lm-tail.on .t0 { opacity: .38; } .lm-tail.on .t1 { opacity: .2; } .lm-tail.on .t2 { opacity: .08; }
.lm-tail.dim circle, .lm-tail.dying circle { opacity: 0 !important; }
.lm-obs { fill: none; stroke-width: 2px; transform-box: fill-box; transform-origin: center; animation: lm-obs .9s var(--lm-ease) forwards; pointer-events: none; }
.lm-obs.G { stroke: var(--lm-G); } .lm-obs.O { stroke: var(--lm-O); }
@keyframes lm-obs { 0% { opacity: .95; transform: scale(.7); } 100% { opacity: 0; transform: scale(2.6); } }
.lm-corrline { fill: none; stroke: var(--lm-teal); stroke-width: 2px; stroke-dasharray: 3 4; opacity: .9; animation: lm-fade 1.4s linear forwards; }
.lm-corrdot { fill: none; stroke: var(--lm-teal); stroke-width: 1.5px; animation: lm-fade 1.4s linear forwards; }
@keyframes lm-fade { 70% { opacity: .9; } 100% { opacity: 0; } }
.lm-sweep-wedge { fill: none; stroke: var(--lm-teal); stroke-width: 1px; opacity: .22; stroke-dasharray: 2 5; }
.lm-callout rect { fill: rgba(7,26,43,.9); stroke: var(--lm-teal); stroke-width: 1px; }
.lm-callout text { font-size: 11.5px; font-weight: 600; fill: var(--lm-text); }

/* ---- chrome ---------------------------------------------------------------------------- */
.lm-ui { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.lm-ui > * { pointer-events: auto; }
.lm-top { position: absolute; top: 12px; left: 12px; right: 12px; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px; pointer-events: none; }
.lm-top > * { pointer-events: auto; }
.lm-topl { display: flex; align-items: center; min-width: 0; }
.lm-modebar { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(7,26,43,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--lm-line), 0 6px 20px rgba(0,0,0,.25); }
.lm-chip { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--lm-text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s; }
.lm-chip svg { width: 15px; height: 15px; }
.lm-chip:hover { color: var(--lm-text); }
.lm-chip[aria-pressed="true"] { background: var(--lm-teal); color: var(--lm-teal-ink); }
.lm-back { height: 44px; padding: 0 16px 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--lm-text); display: inline-flex; align-items: center; gap: 4px; background: rgba(7,26,43,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--lm-line), 0 6px 20px rgba(0,0,0,.25); animation: lm-pop .3s var(--lm-ease); }
.lm-back svg { width: 18px; height: 18px; }
.lm-topc { display: flex; justify-content: center; align-items: center; min-width: 0; }
.lm-status { height: 44px; padding: 0 14px 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--lm-text-2); display: inline-flex; align-items: center; gap: 6px; background: rgba(7,26,43,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--lm-line); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; animation: lm-pop .3s var(--lm-ease); }
.lm-status svg { width: 16px; height: 16px; color: var(--lm-teal); flex: none; }
.lm-recenter { height: 44px; padding: 0 16px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--lm-teal-ink); background: var(--lm-teal); display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 8px 22px rgba(38,214,197,.3); white-space: nowrap; animation: lm-pop .3s var(--lm-ease); }
.lm-recenter svg { width: 17px; height: 17px; }
@keyframes lm-pop { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
.lm.view-network .lm-back, .lm.view-network .lm-topc > * { display: none; }
.lm.view-follow .lm-modebar { display: none; }
.lm.view-follow.following .lm-recenter { display: none; }
.lm.view-follow.suspended .lm-status { display: none; }
.lm-topr { display: flex; flex-direction: column; gap: 6px; }
.lm-ibtn { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(7,26,43,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--lm-line), 0 6px 20px rgba(0,0,0,.25); color: var(--lm-text-2); }
.lm-ibtn:hover { color: var(--lm-text); }
.lm-ibtn svg { width: 18px; height: 18px; }
.lm-ibtn.x { background: var(--lm-surface-2); box-shadow: none; width: 34px; height: 34px; }
.lm-legend { position: absolute; top: 62px; right: 12px; width: min(300px, calc(100% - 24px)); background: rgba(16,40,58,.97); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--lm-text-2); box-shadow: 0 12px 30px rgba(0,0,0,.4); z-index: 3; }
.lm-legend .row { display: flex; align-items: center; gap: 8px; }
.lm-legend .row small { color: var(--lm-muted); margin-left: auto; text-align: right; }
.lm-legend .sw { width: 18px; height: 4px; border-radius: 2px; flex: none; }
.lm-legend .sw.G { background: var(--lm-G); } .lm-legend .sw.O { background: var(--lm-O); }
.lm-legend .k { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid var(--lm-text-2); }
.lm-legend .k.obs { background: var(--lm-text-2); box-shadow: 0 0 0 3px rgba(197,211,221,.25); }
.lm-legend .k.est { border-color: var(--lm-G); background: linear-gradient(90deg, transparent, rgba(61,190,108,.6)); }
.lm-legend .k.stale { border-style: dashed; border-color: var(--lm-warn); }
.lm-legend .schem { color: var(--lm-muted); font-style: italic; font-size: 11px; border-top: 1px solid var(--lm-line); padding-top: 7px; }
.lm-foot { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.lm-foot > * { pointer-events: auto; }
.lm-stamp { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 10px; border-radius: 999px; background: rgba(7,26,43,.86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 12px; font-weight: 600; color: var(--lm-text-2); white-space: nowrap; box-shadow: inset 0 0 0 1px var(--lm-line); min-width: 0; overflow: hidden; }
.lm-stamp .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lm-stamp .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lm-muted); flex: none; }
.lm-stamp.live { color: var(--lm-teal); } .lm-stamp.live .dot { background: var(--lm-teal); box-shadow: 0 0 8px var(--lm-teal); }
.lm-stamp.stale { color: var(--lm-warn); box-shadow: inset 0 0 0 1px rgba(247,201,107,.55); } .lm-stamp.stale .dot { background: var(--lm-warn); }
.lm-stamp.loading .dot { animation: lm-blink 1.2s ease-in-out infinite; }
@keyframes lm-blink { 50% { opacity: .3; } }
.lm-scale { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 10px; color: var(--lm-muted); font-variant-numeric: tabular-nums; }
.lm-scale .bar { height: 3px; border-left: 1px solid var(--lm-muted); border-right: 1px solid var(--lm-muted); background: linear-gradient(var(--lm-muted), var(--lm-muted)) center / 100% 1px no-repeat; }
.lm-simtag { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #3A2A00; background: var(--lm-warn); padding: 4px 8px; border-radius: 6px; }
.lm.view-follow .lm-foot { bottom: auto; top: 62px; left: 12px; right: 64px; align-items: flex-start; }
.lm.view-follow .lm-scale { display: none; }
.lm-toast { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); background: var(--lm-text); color: var(--lm-bg); font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; z-index: 4; animation: lm-toast .25s var(--lm-ease); }
.lm.view-follow .lm-toast { top: 108px; }
@keyframes lm-toast { from { opacity: 0; transform: translate(-50%, -6px); } }

/* On a phone the app's own header carries the feed's age and state right above the map, and
   the Follow sheet repeats both for the train; the stamp would be a third copy sitting on the
   little map left above the sheet, so it steps aside while a train is followed. */
.lm.view-follow:not(.desk) .lm-foot { display: none; }

/* ---- panel ----------------------------------------------------------------------------- */
.lm-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(16,40,58,.97); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 36px rgba(0,0,0,.4); padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; max-height: 50%; overflow-y: auto; animation: lm-sheet .34s var(--lm-ease); z-index: 2; }
@keyframes lm-sheet { from { transform: translateY(28px); opacity: 0; } }
.lm-sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--lm-line); margin: 0 auto 2px; flex: none; }
.lm-sheet .ttl { display: flex; align-items: center; gap: 10px; }
.lm-sheet .ttl .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lm-sheet .ttl h3 { margin: 0; font-family: var(--lm-display); font-size: 18px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.lm-sheet .ttl .sub { font-size: 12.5px; color: var(--lm-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-sheet .ttl .x { margin-left: auto; flex: none; }
.lmdot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--lm-display); font-weight: 800; font-size: 13px; color: var(--lm-bg); flex: none; }
.lmdot.G { background: var(--lm-G); } .lmdot.O { background: var(--lm-O); } .lmdot.sm { width: 20px; height: 20px; font-size: 11px; }
.lm-sheet .staterow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.lm-sheet .staterow .now { min-width: 0; }
.lm-sheet .chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; flex: none; }
.lm-sheet .chip.obs { color: var(--lm-teal); background: var(--lm-teal-dim); box-shadow: inset 0 0 0 1px rgba(38,214,197,.4); }
.lm-sheet .chip.est { color: var(--lm-text-2); background: var(--lm-surface-2); box-shadow: inset 0 0 0 1px var(--lm-line); }
.lm-sheet .chip.stale { color: var(--lm-warn); background: var(--lm-warn-dim); box-shadow: inset 0 0 0 1px rgba(247,201,107,.4); }
.lm-sheet .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 10px 12px; border-radius: 12px; background: rgba(7,26,43,.55); }
.lm-sheet .f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm-sheet .k, .lm-sheet .kicker, .lm-roster .kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--lm-muted); }
.lm-sheet .v { font-size: 14.5px; font-weight: 600; color: var(--lm-text); line-height: 1.25; }
.lm-sheet .v small { font-weight: 500; font-size: 12px; color: var(--lm-muted); margin-left: 4px; }
.lm-sheet .then { font-size: 12.5px; color: var(--lm-text-2); display: flex; gap: 8px; align-items: baseline; }
.lm-sheet .preds { display: flex; flex-direction: column; }
.lm-sheet .kicker { padding: 2px 0 4px; }
.lm-sheet .pr { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; min-height: 40px; border-top: 1px solid var(--lm-line); font-size: 14px; }
.lm-sheet .pr:first-of-type { border-top: 0; }
.lm-sheet .pr .nm { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.lm-sheet .pr .nm small { font-weight: 400; font-size: 11px; color: var(--lm-muted); }
.lm-sheet .pr .in { font-family: var(--lm-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.lm-sheet .pr .at { font-size: 12px; color: var(--lm-muted); min-width: 64px; text-align: right; }
.lm-sheet .empty { font-size: 13px; color: var(--lm-muted); padding: 6px 0; }
.lm-sheet .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.lm-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--lm-teal); color: var(--lm-teal-ink); font-weight: 700; font-size: 13px; }
.lm-btn svg { width: 16px; height: 16px; }
.lm-btn.quiet { background: var(--lm-surface-2); color: var(--lm-text); font-weight: 600; }
.lm-btn.on { background: var(--lm-teal-dim); color: var(--lm-teal); box-shadow: inset 0 0 0 1px var(--lm-teal); }
.lm-sheet .note { margin: 0; font-size: 11px; color: var(--lm-muted); line-height: 1.4; }

/* ---- desktop control-centre layout (≥900px container) -------------------------------- */
.lm-roster { display: none; }
@container (min-width: 900px) {
  .lm-roster { display: flex; flex-direction: column; position: absolute; left: 16px; top: 16px; bottom: 16px; width: 314px; background: rgba(16,40,58,.94); backdrop-filter: blur(10px); border-radius: 18px; padding: 14px 8px 10px; overflow-y: auto; box-shadow: 0 14px 40px rgba(0,0,0,.35); scrollbar-width: thin; }
  .lm-roster .hd { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 8px; }
  .lm-roster .cnt { font-size: 12px; color: var(--lm-muted); }
  .lm-roster .row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; min-height: 48px; padding: 6px 8px; border-radius: 10px; text-align: left; }
  .lm-roster .row:hover { background: var(--lm-surface-2); }
  .lm-roster .row.sel { background: var(--lm-teal-dim); box-shadow: inset 0 0 0 1px rgba(38,214,197,.5); }
  .lm-roster .meta { min-width: 0; display: flex; flex-direction: column; }
  .lm-roster .d { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lm-roster .d small { color: var(--lm-muted); font-weight: 500; }
  .lm-roster .s { font-size: 11px; color: var(--lm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lm-roster .st { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--lm-text-2); }
  .lm-roster .st.obs { background: var(--lm-teal); border-color: var(--lm-teal); box-shadow: 0 0 6px var(--lm-teal); }
  .lm-roster .st.stale { border-style: dashed; border-color: var(--lm-warn); }
  .lm-top { left: 346px; }
  .lm-foot, .lm.view-follow .lm-foot { left: 346px; right: 12px; bottom: 12px; top: auto; align-items: flex-end; }
  .lm.view-follow .lm-scale { display: flex; }
  .lm-sheet { left: auto; right: 16px; top: 16px; bottom: auto; width: 376px; max-height: calc(100% - 32px); border-radius: 18px; animation: lm-panel .32s var(--lm-ease); }
  @keyframes lm-panel { from { transform: translateX(16px); opacity: 0; } }
  .lm-legend { right: 16px; top: 64px; }
  .lm-sheet:not([hidden]) ~ .lm-legend { right: 408px; }
  .lm.view-follow .lm-top { right: 404px; }
  .lm.view-follow .lm-toast { top: 64px; }
}

/* ---- skins ----------------------------------------------------------------------------- */
/* A · Live Command Center: deeper ground, 1 km grid, mono instrumentation, distance rings on the selection */
.lm.skin-command { --lm-bg: #040D18; --lm-water: #071626; --lm-surface: #0B1B2B; --lm-surface-2: #12283C; --lm-glow: .45; --lm-lbl-font: var(--lm-mono); }
.lm.skin-command .lm-lbl { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 500; }
.lm.skin-command .lm-lbl.major { font-size: 10.5px; font-weight: 700; }
.lm.skin-command .lm-stamp, .lm.skin-command .lm-scale, .lm.skin-command .lm-sheet .chip, .lm.skin-command .lm-sheet .v.num { font-family: var(--lm-mono); }
.lm.skin-command .lm-stn .ring { stroke-width: 1.6px; }
.lm.skin-command .lm-stn.major .ring { stroke: var(--lm-teal); }
.lm.skin-command .lm-train.moving .glow { opacity: .8; }
.lm.skin-command .lm-modebar, .lm.skin-command .lm-ibtn, .lm.skin-command .lm-stamp, .lm.skin-command .lm-back, .lm.skin-command .lm-status, .lm.skin-command .lm-recenter { border-radius: 8px; }
.lm.skin-command .lm-chip { border-radius: 6px; font-family: var(--lm-mono); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.lm.skin-command .lm-route-flow { stroke-dasharray: 1 10; }
/* B · Living Transit Map (recommended): the frozen identity, soft light, event-driven motion */
.lm.skin-living { --lm-glow: .22; }
/* C · Digital Twin: elevated guideway with a ground shadow, a horizon haze, a restrained tilt */
.lm.skin-twin { --lm-bg: #061423; --lm-water: #091C2E; --lm-glow: .3; }
.lm.skin-twin .lm-svg { transform: perspective(1100px) rotateX(26deg) scale(1.08); transform-origin: 50% 62%; }
.lm.skin-twin .lm-track-shadow { display: block; stroke: rgba(0,0,0,.55); transform: translate(4px, 10px); }
.lm.skin-twin::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(6,20,35,.9) 0%, rgba(6,20,35,.35) 22%, rgba(6,20,35,0) 48%); }
.lm.skin-twin .lm-train .body { filter: drop-shadow(2px 5px 3px rgba(0,0,0,.6)); }
.lm.skin-twin .lm-stn .ring { filter: drop-shadow(1px 4px 2px rgba(0,0,0,.6)); }

/* ---- comparison / reduced motion -------------------------------------------------------- */
.lm.mode-snapshot .lm-tail, .lm.mode-snapshot .lm-route-flow, .lm.mode-snapshot .mk-metro .beam { display: none; }
.lm.mode-snapshot .lm-train .glow { opacity: 0 !important; }
.lm.reduced .lm-route-flow, .lm.reduced .lm-tail, .lm.reduced .lm-obs, .lm.reduced .mk-metro .beam { display: none; }
.lm.reduced .lm-stn .halo { animation: none; }
.lm.reduced .lm-sheet, .lm.reduced .lm-toast, .lm.reduced .lm-back, .lm.reduced .lm-status, .lm.reduced .lm-recenter { animation: none; }
.lm.reduced .lm-train .body, .lm.reduced .lm-track, .lm.reduced .lm-train, .lm.reduced .lm-routeGlow, .lm.reduced .lm-route { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .lm:not(.motion-forced) .lm-route-flow, .lm:not(.motion-forced) .lm-tail, .lm:not(.motion-forced) .lm-obs, .lm:not(.motion-forced) .mk-metro .beam { display: none; }
}

/* The Follow sheet is a stable skeleton while a train is followed: a head slot, the app's scene host,
   and a body that is rewritten three times a second. The wrappers keep the sheet's own spacing. */
.lm-sheet .lm-hd-slot, .lm-sheet .lm-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lm-sheet .lm-hd-slot:empty { display: none; }

