:root {
  --bg: #f4f6fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-2: #eef1f7;
  --surface-3: #e3e8f1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #7c8799;
  --line: rgba(15, 23, 42, 0.09);
  --accent: #4f46e5;
  --accent-2: #0891b2;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --grad: linear-gradient(135deg, #4f46e5, #0891b2);
  --shadow: 0 10px 40px -12px rgba(15, 23, 42, 0.25), 0 2px 8px -2px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --open: #059669;
  --blocked: #dc2626;
  --unknown: #d97706;
  --na: #64748b;
  --route: #4f46e5;
  --route-alt: #94a3b8;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --nav-w: 88px;
  --panel-w: 430px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #070b16;
  --surface: rgba(15, 20, 36, 0.9);
  --surface-solid: #0f1424;
  --surface-2: #161d31;
  --surface-3: #1f2840;
  --text: #e8ecf6;
  --text-2: #a3adc2;
  --text-3: #6f7a91;
  --line: rgba(148, 163, 184, 0.13);
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --grad: linear-gradient(135deg, #6366f1, #06b6d4);
  --shadow: 0 14px 50px -12px rgba(0, 0, 0, 0.7), 0 2px 10px -2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --open: #34d399;
  --blocked: #f87171;
  --unknown: #fbbf24;
  --na: #94a3b8;
  --route: #818cf8;
  --route-alt: #475569;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.92em; }

#map { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
.leaflet-container { font-family: var(--font); background: var(--bg); }
.leaflet-control-attribution { font-size: 10.5px; background: var(--surface) !important; color: var(--text-3); backdrop-filter: blur(8px); border-radius: 8px 0 0 0; }
.leaflet-control-attribution a { color: var(--text-2); }
.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow) !important; border-radius: 14px !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--surface-solid) !important; color: var(--text) !important; border-color: var(--line) !important; width: 38px !important; height: 38px !important; line-height: 38px !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.leaflet-tooltip { background: var(--surface-solid); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 8px; font-weight: 500; }
.leaflet-tooltip::before { display: none; }

.tiles-light { filter: saturate(.55) brightness(1.03) contrast(.95); }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.45); }
.leaflet-top.leaflet-right { top: 58px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; z-index: 30; left: 14px; top: 14px; bottom: 14px; width: var(--nav-w);
  background: var(--surface); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px 8px;
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; color: var(--text-2); text-decoration: none; font-size: 11.5px; font-weight: 600; text-align: center; transition: background .2s, color .2s, transform .2s; }
.nav a svg { width: 23px; height: 23px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a:active { transform: scale(.96); }
.nav .brand { flex-direction: column; gap: 6px; margin-bottom: 10px; color: var(--text); font-family: var(--font-display); font-size: 11px; line-height: 1.15; }
.nav .brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav .brand:hover { background: none; }

/* ---------- Panel / bottom sheet ---------- */
.panel {
  position: fixed; z-index: 20; top: 14px; bottom: 14px; left: calc(var(--nav-w) + 28px); width: var(--panel-w);
  background: var(--surface); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), height .35s cubic-bezier(.2,.8,.2,1);
}
.panel-scroll { overflow-y: auto; padding: 22px 22px 28px; flex: 1; overscroll-behavior: contain; scrollbar-width: thin; }
.sheet-handle { display: none; }
.view-enter { animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.topbar { position: fixed; z-index: 25; top: 14px; right: 14px; display: flex; gap: 10px; align-items: center; }
.integrity { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(16px); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.integrity svg { width: 17px; height: 17px; color: var(--open); flex: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(16px); }
.icon-btn svg { width: 20px; height: 20px; }
:root[data-theme='dark'] .icon-btn .sun, :root:not([data-theme='dark']) .icon-btn .moon { display: none; }

.legend { position: fixed; z-index: 15; right: 14px; bottom: 30px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(16px); font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.legend-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 6px; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }

/* ---------- Status pins & chips ---------- */
.pin { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; border: 2px solid var(--surface-solid); box-shadow: 0 1px 4px rgba(0,0,0,.3); line-height: 1; }
.pin.s-open { background: var(--open); }
.pin.s-blocked { background: var(--blocked); border-radius: 5px; }
.pin.s-unknown { background: var(--unknown); }
.pin.s-na { background: var(--na); }
.s-open { --s: var(--open); } .s-blocked { --s: var(--blocked); } .s-unknown { --s: var(--unknown); } .s-na { --s: var(--na); }

.route-pin { display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: 0 3px 12px rgba(0,0,0,.25); font-size: 11px; font-weight: 700; white-space: nowrap; color: var(--text); width: max-content; transform: translate(-12px, -12px); }
.route-pin .n { color: var(--text-3); font-weight: 600; }
.end-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: translate(-3px, -27px) rotate(-45deg); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.35); border: 3px solid #fff; }
.end-pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 12px; }
.end-pin.a { background: #0f172a; } .end-pin.b { background: var(--grad); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59,130,246,.25); }

.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: color-mix(in srgb, var(--s) 13%, transparent); color: var(--s); border: 1px solid color-mix(in srgb, var(--s) 30%, transparent); }
.status-chip .pin { width: 18px; height: 18px; font-size: 10px; border-width: 0; box-shadow: none; }

.status-hero { border-radius: var(--r-lg); padding: 22px; background: color-mix(in srgb, var(--s) 10%, var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--s) 28%, transparent); position: relative; overflow: hidden; }
.status-hero .big { display: flex; align-items: center; gap: 14px; font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--s); letter-spacing: -0.02em; line-height: 1.1; }
.status-hero .big .pin { width: 46px; height: 46px; font-size: 22px; border-width: 3px; }
.status-hero .meta { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.status-hero .reason { margin-top: 12px; font-size: 13.5px; color: var(--text-2); }

/* ---------- Common blocks ---------- */
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 6px; }
.view-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.view-sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.card { background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-sm); }
.card + .card, .stack > * + * { margin-top: 12px; }
.section { margin-top: 22px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.section-h h3 { font-size: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.label { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.value { font-weight: 700; font-size: 15px; }
.unavail { color: var(--text-3); font-weight: 700; letter-spacing: .02em; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .15s, background .2s, box-shadow .2s; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { width: 100%; padding: 16px; font-size: 16px; border-radius: 16px; font-family: var(--font-display); letter-spacing: .01em; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.banner { display: flex; gap: 12px; padding: 13px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.banner svg { width: 20px; height: 20px; flex: none; color: var(--unknown); margin-top: 1px; }
.banner b { color: var(--text); }
.banner.info svg { color: var(--accent); }
.banner.good svg { color: var(--open); }

/* ---------- Search inputs ---------- */
.field { position: relative; }
.field input { width: 100%; padding: 14px 14px 14px 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); outline: none; font-size: 15px; transition: border-color .2s, box-shadow .2s, background .2s; }
.field input:focus { border-color: var(--accent); background: var(--surface-solid); box-shadow: 0 0 0 4px var(--accent-soft); }
.field .dot { position: absolute; left: 16px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; }
.field .dot.a { border: 3px solid var(--text); }
.field .dot.b { background: var(--grad); border-radius: 3px; }
.field .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: none; cursor: pointer; color: var(--text-3); padding: 6px; }
.route-inputs { position: relative; display: grid; gap: 8px; }
.swap { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-solid); box-shadow: var(--shadow-sm); cursor: pointer; display: grid; place-items: center; }
.swap svg { width: 16px; height: 16px; }
.suggest { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; padding: 11px 14px; border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button:last-child { border-bottom: none; }
.suggest button:hover, .suggest button.hl { background: var(--surface-2); }
.suggest .t { font-weight: 600; font-size: 14px; }
.suggest .s { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .msg { padding: 12px 14px; font-size: 13px; color: var(--text-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-solid); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); transition: background .2s, color .2s; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip svg { width: 14px; height: 14px; }

/* ---------- Progress ---------- */
.progress { font-size: 13px; }
.progress li { list-style: none; padding: 5px 0 5px 22px; position: relative; color: var(--text-2); animation: rise .25s ease; }
.progress li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--open); }
.progress li:last-child::before { background: var(--accent); animation: pulse 1s infinite; }
.progress ul { margin: 0; padding: 0; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .4; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Planner results ---------- */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.segmented button { position: relative; z-index: 1; border: none; background: none; padding: 10px 6px; font-weight: 700; font-size: 12.5px; letter-spacing: .03em; cursor: pointer; border-radius: 11px; color: var(--text-2); transition: color .25s; }
.segmented button.on { color: var(--text); }
.segmented .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 11px; background: var(--surface-solid); box-shadow: var(--shadow-sm); transition: transform .35s cubic-bezier(.2,.8,.2,1); }

.hero-time { margin-top: 16px; padding: 18px; border-radius: var(--r-lg); background: var(--grad); color: #fff; position: relative; overflow: hidden; box-shadow: 0 16px 40px -18px color-mix(in srgb, var(--accent) 80%, transparent); }
.hero-time::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.1); }
.hero-time .row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; position: relative; z-index: 1; }
.hero-time .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .8; font-weight: 700; }
.hero-time .t { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hero-time .t.sm { font-size: 24px; }
.hero-time .arrow { opacity: .7; font-size: 20px; padding-bottom: 6px; }
.hero-time .warn { position: relative; z-index: 1; margin-top: 10px; font-size: 12.5px; background: rgba(0,0,0,.2); padding: 7px 10px; border-radius: 10px; }

.slider-wrap { margin-top: 16px; padding: 14px 14px 8px; border-radius: var(--r-md); background: var(--surface-solid); border: 1px solid var(--line); }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.slider-top .v { font-family: var(--font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; cursor: grab; }
input[type=range]:active { cursor: grabbing; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0 var(--p, 0%), var(--surface-3) var(--p, 0%)); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; background: var(--surface-3); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.25); transition: transform .15s; }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 2px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.stat { padding: 12px 13px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line); }
.stat .label { display: block; margin-bottom: 2px; }
.stat .value { font-family: var(--font-display); font-size: 19px; font-variant-numeric: tabular-nums; }
.stat .value.unavail { font-size: 13px; font-family: var(--font); }

.breakdown { margin-top: 12px; }
.breakdown .line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.breakdown .line:last-child { border-bottom: none; font-weight: 700; padding-top: 10px; }
.breakdown .line .sub { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; }

.route-card { cursor: pointer; transition: border-color .2s, transform .2s, box-shadow .2s; position: relative; }
.route-card:hover { transform: translateY(-1px); }
.route-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.route-card .top { display: flex; justify-content: space-between; align-items: center; }
.route-card .name { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; }
.route-card .dur { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.route-card .facts { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); margin-top: 2px; flex-wrap: wrap; }
.route-card .facts b { color: var(--text); }
.route-card .origin { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.xpips { display: flex; gap: 3px; }
.xpips .pin { width: 14px; height: 14px; font-size: 8px; border-width: 1.5px; box-shadow: none; }

.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: linear-gradient(var(--text), var(--accent)); opacity: .25; }
.tl-item { position: relative; padding: 4px 0 14px; }
.tl-item > .node { position: absolute; left: -30px; top: 6px; }
.tl-item .node.end { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: #0f172a; border: 3px solid var(--surface-solid); }
.tl-item .node.end.b { background: var(--accent); }
.tl-item .node .pin { width: 24px; height: 24px; font-size: 12px; }
.tl-item .ttl { font-weight: 700; font-size: 14px; }
.tl-card { margin-top: 6px; padding: 11px 12px; border-radius: 13px; background: var(--surface-solid); border: 1px solid var(--line); font-size: 12.5px; cursor: pointer; transition: border-color .2s; }
.tl-card:hover { border-color: var(--accent); }
.tl-card .kv { font-size: 12.5px; gap: 4px 12px; margin-top: 8px; }

details.collapse { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-solid); overflow: hidden; }
details.collapse > summary { padding: 14px 16px; cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::after { content: '›'; font-size: 22px; transition: transform .25s; color: var(--text-3); line-height: 1; }
details.collapse[open] > summary::after { transform: rotate(90deg); }
details.collapse > .body { padding: 0 16px 16px; }
.checks li { list-style: none; display: flex; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.checks ul { padding: 0; margin: 6px 0 0; }
.checks .x { color: var(--blocked); font-weight: 800; }
.checks .ok { color: var(--open); font-weight: 800; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, transform .15s; text-align: left; width: 100%; }
.list-item:hover { border-color: var(--accent); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 12px; color: var(--text-3); }
.empty { text-align: center; padding: 34px 18px; color: var(--text-2); }
.empty svg { width: 42px; height: 42px; color: var(--text-3); margin-bottom: 8px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--text); }

.src-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.src-card h3 { font-size: 15.5px; }
.kind { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; padding: 4px 8px; border-radius: 7px; white-space: nowrap; }
.kind.LIVE { background: color-mix(in srgb, var(--open) 15%, transparent); color: var(--open); }
.kind.SCHEDULED { background: var(--accent-soft); color: var(--accent); }
.kind.HISTORICAL { background: color-mix(in srgb, var(--unknown) 15%, transparent); color: var(--unknown); }
.kind.UNAVAILABLE { background: color-mix(in srgb, var(--na) 18%, transparent); color: var(--na); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.conn::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--na); }
.conn.ok::before { background: var(--open); box-shadow: 0 0 0 3px color-mix(in srgb, var(--open) 25%, transparent); }
.conn.bad::before { background: var(--blocked); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 13.5px; transition: all .3s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.star-btn { border: none; background: none; cursor: pointer; padding: 6px; color: var(--text-3); }
.star-btn.on { color: #f59e0b; }
.star-btn.on svg { fill: currentColor; }
.star-btn svg { width: 22px; height: 22px; }
.pick-hint { position: fixed; z-index: 35; top: 70px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  :root { --nav-h: 64px; }
  .nav { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; gap: 0; border-bottom: none; }
  .nav a { flex: 1; min-width: 0; padding: 6px 1px; font-size: 9.5px; gap: 3px; white-space: nowrap; letter-spacing: -0.01em; }
  .nav a svg { flex: none; }
  .nav a svg { width: 21px; height: 21px; }
  .nav .brand { display: none; }
  .panel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); height: 52vh; border-radius: 22px; }
  .panel[data-sheet='peek'] { height: 128px; }
  .panel[data-sheet='full'] { height: calc(100vh - var(--nav-h) - 80px); height: calc(100dvh - var(--nav-h) - 80px); }
  .sheet-handle { display: grid; place-items: center; width: 100%; height: 22px; border: none; background: none; cursor: grab; flex: none; touch-action: none; }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 99px; background: var(--text-3); opacity: .5; }
  .panel-scroll { padding: 4px 16px 22px; }
  .topbar { top: 10px; right: 10px; left: 10px; justify-content: space-between; }
  .integrity { font-size: 11px; padding: 8px 12px; }
  .legend { display: none; }
  .view-title { font-size: 22px; }
  .leaflet-top.leaflet-right { top: 52px; }
  .hero-time .t { font-size: 28px; }
}
@media (min-width: 821px) {
  .leaflet-left { left: calc(var(--nav-w) + var(--panel-w) + 40px); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- passenger rail ---------- */
.train-pin { display: flex; align-items: center; gap: 5px; padding: 4px 9px 4px 5px; border-radius: 999px; background: var(--c); color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; width: max-content; transform: translate(-14px, -14px); box-shadow: 0 4px 14px rgba(0,0,0,.35); border: 2px solid #fff; }
.train-pin svg { width: 15px; height: 15px; }
.train-pin.approx { border-style: dashed; }
.pass { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; flex-wrap: wrap; }
.pass.past { opacity: .5; }
.pass .agency { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 7px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); border-left: 3px solid var(--c); white-space: nowrap; }
.pass .grow { flex: 1; min-width: 60px; color: var(--text-2); font-size: 12.5px; }
.src-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; }
.src-tag.live { background: color-mix(in srgb, var(--open) 16%, transparent); color: var(--open); }
.src-tag.sch { background: var(--accent-soft); color: var(--accent); }
details.pass-d { border-bottom: 1px dashed var(--line); }
details.pass-d:last-of-type { border-bottom: none; }
details.pass-d > summary { list-style: none; cursor: pointer; }
details.pass-d > summary::-webkit-details-marker { display: none; }
details.pass-d p { margin: 0 0 8px; }
.overlap { display: flex; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--unknown) 12%, transparent); border: 1px solid color-mix(in srgb, var(--unknown) 30%, transparent); }
.overlap > svg { width: 18px; height: 18px; color: var(--unknown); flex: none; margin-top: 2px; }
.rr-table { display: grid; gap: 8px; }
.rr { display: grid; grid-template-columns: 1fr 1.15fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.chip svg { width: 14px; height: 14px; }
@media (max-width: 480px) { .rr { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- data architecture UI ---------- */
.q { display: inline-block; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; vertical-align: middle; border: 1px solid transparent; }
.q-VERIFIED { background: color-mix(in srgb, var(--open) 14%, transparent); color: var(--open); border-color: color-mix(in srgb, var(--open) 30%, transparent); }
.q-RECENT { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.q-STALE { background: color-mix(in srgb, var(--unknown) 14%, transparent); color: var(--unknown); border-color: color-mix(in srgb, var(--unknown) 30%, transparent); }
.q-UNVERIFIED { background: color-mix(in srgb, var(--blocked) 10%, transparent); color: var(--blocked); border-color: color-mix(in srgb, var(--blocked) 25%, transparent); }
.q-UNKNOWN { background: var(--surface-2); color: var(--text-3); border-color: var(--line); }
.block-h { margin: 22px 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--text-3); display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.segmented.two { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.segmented.two .thumb { width: calc((100% - 8px) / 2); }
.tag.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.tag.warn { background: color-mix(in srgb, var(--unknown) 15%, transparent); color: var(--unknown); }
.panel-rows { margin-top: 12px; border-top: 1px solid var(--line); }
.prow { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: start; }
.plabel { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; padding-top: 3px; }
.train-card { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 13px; padding: 11px 13px; background: var(--surface-solid); margin-bottom: 8px; }
.train-card .tc-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.train-card .agency { font-weight: 800; font-size: 13.5px; }
.train-card .kv { font-size: 12.5px; gap: 4px 12px; }
.hist { display: grid; gap: 0; }
.hrow { display: grid; grid-template-columns: 118px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.hrow:last-child { border-bottom: none; }
.hrow .bad { color: var(--blocked); font-weight: 700; }
.srow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.srow:last-child { border-bottom: none; }
.pin.s-sep { background: var(--surface-solid); color: var(--na); border-color: var(--na); border-radius: 4px; }
.pin.s-closed { background: transparent; color: var(--na); border: 2px dashed var(--na); box-shadow: none; }
dl.raw { font-size: 11.5px; grid-template-columns: minmax(120px, auto) 1fr; }
dl.raw dd { font-weight: 500; }
.status-hero .meta { grid-template-columns: repeat(3, 1fr); }
.stat .small.muted { display: block; margin-top: 2px; }
@media (max-width: 480px) { .hrow { grid-template-columns: 1fr; gap: 2px; } .status-hero .meta { grid-template-columns: 1fr 1fr; } }

/* ---------- crossing arrivals ---------- */
.arr { display: flex; align-items: center; gap: 10px; padding: 7px 0; flex-wrap: wrap; }
.arr.past { opacity: .45; }
.arr .at { font-size: 16px; min-width: 74px; }
.arr .rel { min-width: 74px; }
.arr .by { flex: 1; color: var(--text-2); border-left: 3px solid var(--c); padding-left: 7px; }
.arr-list details.pass-d { border-bottom: 1px dashed var(--line); }
.avg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.avg > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.avg > div.now { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avg b { font-size: 16px; }
@media (max-width: 480px) { .avg { grid-template-columns: 1fr; } }

/* ---------- Rail Crossing Locator styling ---------- */
.bm-ctl { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface-solid); margin-top: 8px !important; }
.bm-ctl button { border: none; border-bottom: 1px solid var(--line); background: var(--surface-solid); color: var(--text-2); font-size: 11px; font-weight: 700; padding: 7px 10px; cursor: pointer; text-align: left; }
.bm-ctl button:last-child { border-bottom: none; }
.bm-ctl button.on { background: var(--accent-soft); color: var(--accent); }
.rr-ico { position: relative; border-radius: 50%; display: grid; place-items: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.rr-ico img { width: 100%; height: 100%; display: block; }
.rr-ico.closed { opacity: .55; filter: grayscale(1); }
.rr-ico.st-s-blocked { box-shadow: 0 0 0 3px var(--blocked); }
.rr-ico.st-s-unknown { box-shadow: 0 0 0 3px var(--unknown); }
.rr-ico.st-s-open { box-shadow: 0 0 0 3px var(--open); }
.rr-pin { width: 20px; height: 20px; vertical-align: middle; flex: none; }
.rr-pin.closed { opacity: .5; filter: grayscale(1); }
.chip .rr-pin { width: 16px; height: 16px; }
.legend .ring { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--na); }
.legend .ring.st-s-blocked { border-color: var(--blocked); }
.legend .ring.st-s-unknown { border-color: var(--unknown); }
.rail-sample { width: 22px; height: 5px; background: repeating-linear-gradient(90deg, #262626 0 5px, #fff 5px 9px); border: 1.5px solid #262626; border-radius: 2px; }
@media (max-width: 820px) { .bm-ctl { flex-direction: row; } .bm-ctl button { border-bottom: none; border-right: 1px solid var(--line); } }

.bm-ctl button[data-traffic] { border-top: 2px solid var(--line); }
.bm-ctl button[data-traffic].on { background: color-mix(in srgb, var(--open) 16%, transparent); color: var(--open); }

/* ---------- moving trains + settings ---------- */
.moving-train { transition: transform 1s linear; }
.is-zooming .moving-train { transition: none; }
.train-pin.est { border-style: dashed; }
.icon-btn { color: var(--text); text-decoration: none; }
.segmented.n2 { grid-template-columns: 1fr 1fr; }
.segmented.n3 { grid-template-columns: repeat(3, 1fr); }
.segmented.n4 { grid-template-columns: repeat(4, 1fr); }
.segmented[data-set] button.on { background: var(--surface-solid); box-shadow: var(--shadow-sm); color: var(--text); }
.segmented[data-set] { margin-bottom: 8px; }

/* small top-down train drawn on the track, rotated to its heading */
.mtrain { position: absolute; left: 0; top: 0; display: flex; gap: 1.5px; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(var(--tscale, 1)); transition: transform 1s linear; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.55)); cursor: pointer; }
.mtrain i { width: 11px; height: 6px; background: var(--c); border: 1px solid #111; border-radius: 1.5px; }
.mtrain i:last-child { border-radius: 1.5px 4px 4px 1.5px; } /* nose points the way it is heading */
.is-zooming .mtrain { transition: none; }

.legend .ring.st-s-open { border-color: var(--open); }

/* detected trains (FDOT sensors) */
.det { position: absolute; transform: translate(-50%, -160%); display: flex; gap: 1.5px; padding: 3px; border-radius: 6px; background: var(--surface-solid); box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: pointer; }
.det i { width: 9px; height: 7px; background: #374151; border: 1px solid #111; border-radius: 1.5px; }
.det i:first-child { background: #111827; border-radius: 4px 1.5px 1.5px 4px; }
.det.now { outline: 2px solid var(--blocked); animation: detpulse 1.2s ease-in-out infinite; }
.det.pax i { background: #2563eb; }
.det.sm { position: static; transform: none; padding: 2px; box-shadow: none; animation: none; }
.det.sm i { width: 6px; height: 5px; }
@keyframes detpulse { 50% { outline-color: transparent; } }

/* official GPS trains glide between 30-second reports */
.moving-train.gps { transition: transform 30s linear; }
.is-zooming .moving-train.gps { transition: none; }
.mtrain.gps i { border-color: #fff; box-shadow: 0 0 0 1px #111; }

.cam-box { position: absolute; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 4px; pointer-events: none; }
.cam-box.gate { border-color: var(--unknown); background: color-mix(in srgb, var(--unknown) 18%, transparent); }
#obsForm select, #obsForm input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }

/* ---------- Installed app (iOS / Android) ---------- */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body { -webkit-text-size-adjust: 100%; }
.topbar { top: calc(14px + env(safe-area-inset-top)); }
@media (max-width: 820px) {
  .topbar { top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right)); }
  .pick-hint { top: calc(70px + env(safe-area-inset-top)); }
  .panel[data-sheet='full'] { height: calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 80px); }
  /* iOS zooms the page when a field under 16px gets focus */
  input, select, textarea, .field input { font-size: 16px; }
  .toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
}
.offline-bar { position: fixed; z-index: 70; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: var(--unknown); color: #fff; font-weight: 700; font-size: 12.5px; box-shadow: var(--shadow); max-width: calc(100vw - 24px); text-align: center; }

/* ---------- cleaner map chrome ---------- */
.layers-ctl { position: relative; margin-top: 8px !important; }
.layers-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-solid); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--text); }
.layers-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.layers-menu { position: absolute; right: 0; top: 48px; min-width: 150px; padding: 6px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.layers-menu[hidden] { display: none; }
.layers-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 4px 8px 2px; }
.layers-menu button { text-align: left; border: none; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.layers-menu button.on { background: var(--accent-soft); color: var(--accent); }
.layers-menu button[data-traffic] { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; }
.layers-menu button[data-traffic].on { color: var(--open); background: color-mix(in srgb, var(--open) 12%, transparent); }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; }
@media (max-width: 820px) {
  /* phones: pinch to zoom, so no +/- buttons; the no-invented-data promise shrinks to a shield (full text in Sources) */
  .leaflet-control-zoom { display: none; }
  .integrity { padding: 0; width: 40px; height: 40px; justify-content: center; border-radius: 12px; }
  .integrity span { display: none; }
  .integrity svg { width: 20px; height: 20px; }
  .topbar { justify-content: flex-end; gap: 8px; }
  .leaflet-top.leaflet-right { top: calc(58px + env(safe-area-inset-top)); }
}
