/* ============================================================
   DriveData — map-first interface
   Tokens → base → chrome (topbar, rail, panel, sheet) → content
   ============================================================ */

:root {
  --bg: #171B21;
  --panel: #1F252D;
  --raised: #283039;
  --hover: #2F3842;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.16);
  --text: #EDEFF2;
  --muted: #98A2AE;
  --faint: #6B7684;
  --lane: #F5C842;
  --lane-ink: #1B1400;
  --green: #35A968;
  --orange: #F08A24;
  --red: #E0483E;
  --blue: #62B0E8;
  --fire: #FF6B3D;
  --ev: #4CC38A;
  --fuel: #9CB0C4;
  --station: #C58BF2;
  --purple: #C58BF2;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --radius: 10px;
  --radius-sm: 6px;
  --topbar-h: 56px;
  --rail-w: 196px;
  --panel-w: 400px;
  --font: 'Overpass', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #EDF0F3;
  --panel: #FFFFFF;
  --raised: #F3F5F8;
  --hover: #E8ECF1;
  --line: rgba(20,30,40,.09);
  --line-strong: rgba(20,30,40,.2);
  --text: #1B2027;
  --muted: #5B6572;
  --faint: #8A94A0;
  --lane: #E9B412;
  --shadow: 0 8px 30px rgba(20,30,40,.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
button, [role="button"] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lane); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; } }

/* ── Map ─────────────────────────────────────────────────── */
#map { position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--bg); }
.maplibregl-ctrl-group { background: var(--panel) !important; box-shadow: var(--shadow) !important; border-radius: var(--radius-sm) !important; }
.maplibregl-ctrl-group button { width: 36px !important; height: 36px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.85); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--panel) 85%, transparent) !important; color: var(--muted) !important; font-size: 11px !important; border-radius: var(--radius-sm) 0 0 0; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-bottom-right { bottom: 2px; }
.maplibregl-popup-content { background: var(--panel); color: var(--text); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px 10px; font-family: var(--font); font-size: 13px; }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; }
.maplibregl-canvas { outline: none; }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.01em; flex: 0 0 auto; }
.brand-mark { width: 30px; height: 20px; border-radius: 4px; background: var(--raised); position: relative; overflow: hidden; border: 1px solid var(--line-strong); }
.brand-mark::before { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 3px; margin-top: -1.5px; background: repeating-linear-gradient(90deg, var(--lane) 0 6px, transparent 6px 10px); }
.brand-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line-strong); }
.brand span:last-child { display: none; }
@media (min-width: 640px) { .brand span:last-child { display: inline; } }

.search { position: relative; flex: 1 1 auto; max-width: 560px; }
.search input {
  width: 100%; height: 40px; padding: 0 40px 0 40px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--raised); color: var(--text); font: inherit; font-size: 15px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--lane); }
.search .icon { position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: transparent; color: var(--muted); display: none; }
.search.has-value .clear { display: block; }
.search-results {
  position: absolute; left: 0; right: 0; top: 46px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: none; max-height: min(60vh, 420px); overflow-y: auto;
}
.search.open .search-results { display: block; }
.search-results button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent; text-align: left; border-bottom: 1px solid var(--line); }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover, .search-results button[aria-selected="true"] { background: var(--hover); }
.search-results .kind { width: 30px; height: 30px; border-radius: 8px; background: var(--raised); display: grid; place-items: center; flex: 0 0 auto; font-size: 14px; }
.search-results .t { font-weight: 600; font-size: 14px; }
.search-results .s { color: var(--muted); font-size: 12.5px; }
.search-results .hint { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.tb-btn {
  height: 38px; padding: 0 12px; border-radius: 19px; border: 1px solid var(--line); background: var(--raised);
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.tb-btn:hover { background: var(--hover); }
.tb-btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn.dice { border-color: color-mix(in srgb, var(--lane) 55%, transparent); }
.tb-btn .label { display: none; }
@media (min-width: 900px) { .tb-btn .label { display: inline; } }
.nav-link { display: none; color: var(--muted); text-decoration: none; font-size: 14px; padding: 0 8px; }
.nav-link:hover { color: var(--text); }
@media (min-width: 1100px) { .nav-link { display: inline; } }
.theme-toggle .sun { display: none; } .theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; } [data-theme="light"] .theme-toggle .moon { display: none; }

/* ── Layer rail (desktop) / chip row (mobile) ─────────────── */
.rail {
  position: fixed; z-index: 30; left: 12px; top: calc(var(--topbar-h) + 12px); width: var(--rail-w);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.rail-title { font-size: 11.5px; color: var(--faint); padding: 6px 10px 4px; letter-spacing: .02em; }
.layer-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0;
  background: transparent; text-align: left; font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background .12s;
}
.layer-btn:hover { background: var(--hover); color: var(--text); }
.layer-btn[aria-pressed="true"] { color: var(--text); background: var(--raised); }
.layer-btn .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--dot); flex: 0 0 auto; box-shadow: 0 0 0 2px color-mix(in srgb, var(--dot) 35%, transparent); opacity: .35; transition: opacity .12s; }
.layer-btn[aria-pressed="true"] .sw { opacity: 1; }
.layer-btn .n { margin-left: auto; font-size: 12px; color: var(--faint); min-width: 1.5em; text-align: right; }
.layer-btn[aria-pressed="true"] .n { color: var(--muted); }
.layer-btn .lbl { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.rail-note { font-size: 12px; color: var(--faint); padding: 6px 10px 8px; line-height: 1.35; }
.legend { display: none; flex-wrap: wrap; gap: 4px 10px; padding: 2px 10px 8px 32px; }
.legend.show { display: flex; }
.legend span { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; }

/* ── Detail panel ─────────────────────────────────────────── */
.panel {
  position: fixed; z-index: 35; top: calc(var(--topbar-h) + 12px); right: 12px; bottom: 12px; width: var(--panel-w);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 24px)); transition: transform .22s ease;
}
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.panel-head .crumb { font-size: 12.5px; color: var(--muted); flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.panel-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-handle { display: none; }

/* Content blocks inside panels */
.p-media { position: relative; background: #0F1216; aspect-ratio: 16 / 9; }
.p-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.p-media .media-note { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: #E6E9ED; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 12px; }
.p-media .media-actions { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; }
.p-media .media-actions button { width: 34px; height: 34px; border-radius: 17px; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.p-media .media-actions button svg { width: 17px; height: 17px; }
.p-media .media-actions button.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.p-media .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 46px; border: 0; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; }
.p-media .nav.prev { left: 0; border-radius: 0 8px 8px 0; } .p-media .nav.next { right: 0; border-radius: 8px 0 0 8px; }
.p-media .nav svg { width: 20px; height: 20px; }
.p-media.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.p-section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.p-section:last-child { border-bottom: 0; }
.p-title { font-size: 19px; font-weight: 700; line-height: 1.25; margin: 0 0 2px; letter-spacing: -.01em; }
.p-sub { color: var(--muted); font-size: 13.5px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 12px; background: var(--raised); color: var(--text); }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.badge.live i { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.badge.sev-major, .badge.sev-severe { background: color-mix(in srgb, var(--red) 22%, transparent); color: color-mix(in srgb, var(--red) 70%, var(--text)); }
.badge.sev-moderate { background: color-mix(in srgb, var(--orange) 22%, transparent); }
.badge.sev-minor { background: color-mix(in srgb, var(--lane) 18%, transparent); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11.5px; color: var(--faint); margin-bottom: 1px; }
.facts dd { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.p-text { font-size: 14px; color: var(--text); white-space: pre-line; margin: 0; }
.p-text.muted { color: var(--muted); }
.source-line { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.source-line a { color: var(--muted); }
.source-line .dot { display: inline-block; vertical-align: middle; margin-right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.source-line .dot.warn { background: var(--orange); }
.source-line .dot.bad { background: var(--red); }
.note { font-size: 12.5px; color: var(--muted); background: var(--raised); border-radius: 8px; padding: 8px 10px; margin-top: 10px; line-height: 1.4; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list button, .list a.row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: 0; background: transparent; text-align: left; text-decoration: none; }
.list button:hover .t, .list a.row:hover .t { color: var(--lane); }
.list .mark { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: 0 0 auto; }
.list .t { font-size: 14px; font-weight: 500; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12.5px; color: var(--muted); flex: 0 0 auto; }
.list .two { flex: 1 1 auto; min-width: 0; }
.list .two .t { white-space: normal; }
.list .two .s { display: block; }
.h { font-size: 12px; color: var(--faint); margin: 0 0 6px; font-weight: 600; letter-spacing: .01em; }
.h .n { color: var(--muted); font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--raised); font-weight: 600; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--lane); color: var(--lane-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--raised); border-radius: 8px; padding: 10px; border-left: 3px solid var(--c, var(--line)); }
.stat b { display: block; font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat.dim { opacity: .5; }

.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-now .temp { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.wx-now .cond { font-size: 15px; font-weight: 600; }
.wx-now .feels { font-size: 12.5px; color: var(--muted); }
.wx-hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.wx-hours div { flex: 0 0 52px; text-align: center; background: var(--raised); border-radius: 8px; padding: 6px 4px; }
.wx-hours .t { font-size: 11px; color: var(--muted); }
.wx-hours .i { font-size: 18px; line-height: 1.3; }
.wx-hours .v { font-size: 13px; font-weight: 600; }
.wx-hours .p { font-size: 10.5px; color: var(--blue); }
.wx-days { display: grid; gap: 4px; }
.wx-days div { display: grid; grid-template-columns: 56px 30px 1fr auto; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; }
.wx-days .mx { font-weight: 600; } .wx-days .mn { color: var(--muted); }

.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line-strong); border-top-color: var(--lane); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
.error-box { margin: 12px 16px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--text); font-size: 13.5px; }

/* Overview panel */
.overview-hero { padding: 16px 16px 12px; }
.overview-hero h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.015em; line-height: 1.2; }
.overview-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 5px 10px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line); text-decoration: none; }
.chip:hover { background: var(--hover); }

/* ── Status bar ──────────────────────────────────────────── */
.status {
  position: fixed; z-index: 30; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px 5px 8px;
  font-size: 12.5px; color: var(--muted); max-width: calc(100vw - 24px); backdrop-filter: blur(8px);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.status .dot.warn { background: var(--orange); } .status .dot.bad { background: var(--red); } .status .dot.off { background: var(--faint); }
.status b { color: var(--text); font-weight: 600; }
.status .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.loading .dot { animation: pulse .9s infinite; }

/* ── Road trip bar ───────────────────────────────────────── */
.trip {
  position: fixed; z-index: 36; left: 50%; bottom: 20px; transform: translate(-50%, 140%); transition: transform .25s ease;
  background: var(--panel); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; max-width: calc(100vw - 24px);
}
.trip:not(.show) { visibility: hidden; opacity: 0; pointer-events: none; }
.trip.show { transform: translate(-50%, 0); }
.trip .info { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.trip .info b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.trip .info span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.trip .icon-btn { width: 36px; height: 36px; border-radius: 18px; background: var(--raised); color: var(--text); }
.trip .icon-btn.play { background: var(--lane); color: var(--lane-ink); }
.trip .bar { position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px; background: var(--line); border-radius: 1px; overflow: hidden; }
.trip .bar i { display: block; height: 100%; width: 0; background: var(--lane); transition: width .3s linear; }

/* Toast */
.toast { position: fixed; z-index: 60; left: 50%; top: calc(var(--topbar-h) + 12px); transform: translate(-50%, -20px); opacity: 0; transition: all .2s; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; max-width: min(92vw, 420px); pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Weather-here pin hint */
.wx-hint { position: fixed; z-index: 30; left: 50%; top: calc(var(--topbar-h) + 12px); transform: translateX(-50%); background: var(--lane); color: var(--lane-ink); font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 16px; box-shadow: var(--shadow); display: none; }
.wx-hint.show { display: block; }

/* Welcome overlay (first visit) */
.welcome { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(8,10,14,.55); backdrop-filter: blur(4px); }
.welcome[hidden] { display: none; }
.welcome-card { width: min(92vw, 440px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; }
.welcome-card h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.015em; line-height: 1.15; }
.welcome-card p { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; }
.welcome-card .row { display: flex; gap: 8px; }

/* SEO / no-JS content hidden behind the app when JS runs */
.seo-content { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; }
.no-js .seo-content { position: static; width: auto; height: auto; padding: 24px; max-width: 760px; margin: 0 auto; }
.no-js #map, .no-js .rail, .no-js .panel, .no-js .status { display: none; }
.no-js body { overflow: auto; }

/* ── Mobile: chip row + bottom sheet ─────────────────────── */
@media (max-width: 899px) {
  :root { --topbar-h: 52px; }
  .topbar { gap: 8px; padding: 0 8px; }
  .search input { height: 38px; }
  .rail {
    left: 0; right: 0; top: var(--topbar-h); bottom: auto; width: auto; border-radius: 0; border: 0; box-shadow: none; background: transparent;
    padding: 8px 10px; flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-title, .rail-sep, .rail-note, .legend { display: none !important; }
  .layer-btn { pointer-events: auto; width: auto; flex: 0 0 auto; padding: 7px 12px 7px 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
  .layer-btn[aria-pressed="true"] { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
  .layer-btn .n { margin-left: 2px; }
  .layer-btn .sw { width: 10px; height: 10px; }
  .wx-hint { top: calc(var(--topbar-h) + 54px); }
  .status { bottom: calc(10px + env(safe-area-inset-bottom)); left: 8px; }
  .maplibregl-ctrl-bottom-right { bottom: calc(6px + env(safe-area-inset-bottom)); }
  .trip { top: calc(var(--topbar-h) + 52px); bottom: auto; transform: translate(-50%, -160%); }
  .trip.show { transform: translate(-50%, 0); }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; height: 58vh; max-height: 92vh;
    transform: translateY(105%); transition: transform .25s ease, height .2s ease;
  }
  .panel.open { transform: none; }
  .panel.full { height: 92vh; }
  .panel.peek { height: 44vh; }
  .sheet-handle { display: block; width: 100%; height: 22px; border: 0; background: transparent; padding: 0; touch-action: none; }
  .sheet-handle::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 9px auto 0; }
  .panel-head { padding-top: 0; }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat b { font-size: 18px; }
  .topbar-actions .tb-btn.icon-only.sources { display: none; }
}

/* Pages (sources, landing pages) */
.page { position: static; overflow: auto; }
.page body { overflow: auto; }
.page-wrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; }
.page-wrap h1 { font-size: 32px; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 8px; }
.page-wrap h2 { font-size: 20px; margin: 28px 0 10px; }
.page-wrap p.lead { color: var(--muted); font-size: 16px; margin: 0 0 20px; max-width: 62ch; }
.page-wrap p, .page-wrap li { max-width: 72ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--faint); font-weight: 600; font-size: 12px; }
.table a { color: var(--text); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--raised); }
.pill.ok { color: var(--green); } .pill.bad { color: var(--red); } .pill.off { color: var(--faint); }
.page-nav { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.page-nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.page-nav a:hover { color: var(--text); }
.page-nav .brand { margin-right: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: inherit; cursor: pointer; }
.linkish:hover { color: var(--text); }
