* { box-sizing: border-box; }

/* SeasonRoute design system: light, professional, blue/white — matching the
   approved mockup. Cards are white with soft shadows on a cool gray page;
   the primary blue drives buttons/links/active states. The old neon-glow
   tokens are kept as NAMES (many components reference them) but their
   values are now subtle shadows. */
:root {
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --danger: #dc2626;
  --warn: #f59e0b;
  --safe: #16a34a;
  --gravel: #d9a441;
  --track: #b5773c;
  --closed: #dc2626;
  --glow-danger: 0 1px 3px rgba(220, 38, 38, 0.25);
  --glow-warn: 0 1px 3px rgba(245, 158, 11, 0.25);
  --glow-safe: 0 1px 3px rgba(37, 99, 235, 0.20);
  --purple: #8b5cf6;
  --bus-zone: #4dabf7;
  --on-accent: #ffffff;
  --navy: #10265c;
}

/* ---- Theme axis: light / dark ---- */
body[data-theme="light"] {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #f4f6fa;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --backdrop: rgba(15, 23, 42, 0.45);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}
body[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #253349;
  --text: #e8eef8;
  --muted: #93a4bd;
  --border: #334155;
  --backdrop: rgba(2, 6, 16, 0.7);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* ---- Mode axis: winter (mockup blue) / summer (warm amber) ---- */
body[data-theme="light"] { --accent: #1d5bd8; --accent-light: #2563eb; }
body[data-theme="dark"]  { --accent: #3b82f6; --accent-light: #60a5fa; }

body[data-mode="winter"] { --mode-tint: #1d5bd8; }
body[data-mode="summer"] { --mode-tint: #f59e0b; }

/* Show a control only in the matching season — winter/summer toggles hidden
   the rest of the year rather than always cluttering the menus. */
.layer-row.mode-only-winter, .layer-row.mode-only-summer,
.field.mode-only-winter, .field.mode-only-summer,
div.mode-only-winter, div.mode-only-summer,
p.mode-only-winter, p.mode-only-summer,
ul.mode-only-winter, ul.mode-only-summer,
h3.mode-only-winter, h3.mode-only-summer { display: none; }
body[data-mode="winter"] .layer-row.mode-only-winter { display: flex; }
body[data-mode="winter"] .field.mode-only-winter, body[data-mode="winter"] div.mode-only-winter, body[data-mode="winter"] p.mode-only-winter, body[data-mode="winter"] ul.mode-only-winter, body[data-mode="winter"] h3.mode-only-winter { display: block; }
body[data-mode="summer"] .layer-row.mode-only-summer { display: flex; }
body[data-mode="summer"] .field.mode-only-summer, body[data-mode="summer"] div.mode-only-summer, body[data-mode="summer"] p.mode-only-summer, body[data-mode="summer"] ul.mode-only-summer, body[data-mode="summer"] h3.mode-only-summer { display: block; }

body[data-theme="light"] { --header-bg: var(--surface); }
body[data-theme="dark"]  { --header-bg: var(--surface); }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

a { color: var(--accent); }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------------- Toolbar ---------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--header-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 230, 168, 0.08);
  z-index: 1000;
}

.toolbar-brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-roundel {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.25rem;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: var(--shadow);
}
.brand-words { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text { font-size: 1.05rem; font-weight: 900; letter-spacing: 0.01em; color: var(--text); }
.brand-text-accent { color: var(--accent); }
.brand-tagline { font-size: 0.66rem; color: var(--muted); font-weight: 600; }

.main-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav-link {
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-weight: 700; font-size: 0.88rem;
}
.nav-link:hover { color: var(--accent); background: var(--surface-alt); }
.nav-link.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }

.units-select {
  background: var(--surface-alt); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 6px; font-size: 0.88rem; font-weight: 700; cursor: pointer;
}

.toolbar-search { position: relative; display: flex; flex: 1 1 240px; max-width: 400px; }
.toolbar-search input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px 0 0 999px;
  font-size: 0.92rem;
}
.toolbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 230, 168, 0.18); }
.toolbar-search button {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 0 999px 999px 0;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 800;
}
.toolbar-search button:hover { filter: brightness(1.1); box-shadow: var(--glow-safe); }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 6px;
  box-shadow: var(--shadow);
  z-index: 1200;
  overflow: hidden;
}
.search-results.hidden { display: none; }
.search-result-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 0.88rem; border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-alt); }
.search-result-label { flex: 1; cursor: pointer; }
.search-result-route-btn {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--surface-alt);
  border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 0.9rem;
}
.search-result-route-btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.toolbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.icon-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.icon-btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: var(--glow-safe); }

.mode-toggle { display: flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.mode-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-size: 0.85rem; font-weight: 700; opacity: 0.85;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.mode-btn.active { background: var(--mode-tint); color: #04101f; opacity: 1; box-shadow: 0 0 14px rgba(79, 140, 255, 0.5); }
body[data-mode="summer"] .mode-btn.active { box-shadow: 0 0 14px rgba(255, 159, 79, 0.5); }

.view-toggle { display: flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.view-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-size: 0.85rem; font-weight: 700; opacity: 0.85;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.view-btn.active { background: var(--accent); color: var(--on-accent); opacity: 1; box-shadow: var(--glow-safe); }

/* Layers only matter with the map on screen — hide the button on Dashboard
   and Radar so those views' toolbars stay simpler. */
body:not([data-view="map"]) #layers-btn { display: none; }

/* ---------------- Map shell ---------------- */
.map-shell { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 1; background: var(--bg); }

/* ---------------- Dashboard view ---------------- */
/* An opaque full-screen layer drawn over the (always-mounted, always
   correctly-sized) map — switching to Map view just hides this, so Leaflet
   never has to recover from being display:none. */
#view-dashboard {
  position: absolute; inset: 0; z-index: 1000; overflow-y: auto;
  background: var(--bg); padding: 28px 32px 60px;
}
body:not([data-view="dashboard"]) #view-dashboard { display: none !important; }

/* ---------------- Radar view ---------------- */
/* Same opaque-overlay pattern as the dashboard, but with its own Leaflet
   instance (RadarPage.map) — the commute map underneath stays untouched.
   RadarPage calls invalidateSize() on entry to recover from display:none. */
#view-radar {
  position: absolute; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column;
}
body:not([data-view="radar"]) #view-radar { display: none; }
#radar-map { flex: 1; min-height: 0; }
body[data-theme="dark"] #radar-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(1.05) saturate(0.85);
}
/* Radar/satellite data tiles must never be color-inverted by the theme. */
#radar-map .leaflet-radar-pane { filter: none !important; }

.radar-controls {
  padding: 10px 14px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.radar-controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.radar-controls select {
  background: var(--surface-alt); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; font-size: 0.85rem;
}
.radar-opacity-label { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
#radar-timeline { flex: 1; min-width: 120px; accent-color: var(--accent); }
.radar-frame-label { font-family: var(--font-mono); font-size: 0.85rem; min-width: 90px; }
.radar-forecast-badge {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em;
  background: var(--warn); color: #241400; border-radius: 6px; padding: 2px 6px; vertical-align: middle;
}
.radar-legend { min-height: 20px; }
.radar-legend-img { max-height: 44px; border-radius: 6px; background: #fff; padding: 2px; }
.radar-legend-bar {
  height: 8px; border-radius: 4px; max-width: 420px;
  background: linear-gradient(90deg, #74d0f0, #4aa8e0, #3c78d8, #52c452, #f7e04a, #f2a13c, #e5533c, #b53cc9);
}
.radar-legend-labels {
  display: flex; justify-content: space-between; max-width: 420px;
  font-size: 0.68rem; color: var(--muted); margin-top: 3px;
}

.dash-page { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; }
#view-dashboard { padding: 20px 24px 0; }
.dash-section.dash-hidden { display: none !important; }
#dashboard-updated { margin: 10px 0 0; }

/* Cards */
.dash-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 16px 18px; min-width: 0;
}
.dash-card-header h3, .dash-card-header h4 {
  margin: 0 0 12px; font-size: 0.8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text);
}
.dash-card .disclaimer { font-size: 0.72rem; color: var(--muted); }

/* Grids */
.dash-grid-top { display: grid; grid-template-columns: 280px 1fr 300px; gap: 18px; align-items: start; margin-bottom: 18px; }
.dash-top-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-grid-widgets { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.dash-grid-more { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) {
  .dash-grid-top { grid-template-columns: 1fr 1fr; }
  .dash-top-col-map { grid-column: 1 / -1; order: -1; }
  .dash-grid-widgets { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dash-grid-top, .dash-grid-more { grid-template-columns: 1fr; }
}

/* Hero mode pill */
.mode-hero {
  display: flex; justify-content: center; gap: 0; margin: 4px auto 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); padding: 5px; max-width: 640px;
}
.mode-hero .mode-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: none; background: transparent; border-radius: 999px; padding: 10px 18px;
  cursor: pointer; color: var(--muted); font-family: var(--font);
}
.mode-hero .mode-hero-icon { font-size: 1.3rem; }
.mode-hero .mode-hero-words { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.mode-hero .mode-hero-words b { font-size: 0.86rem; letter-spacing: 0.04em; }
.mode-hero .mode-hero-words small { font-size: 0.7rem; }
.mode-hero .mode-btn.active { background: var(--mode-tint); color: #fff; box-shadow: var(--shadow); }
body[data-mode="summer"] .mode-hero .mode-btn.active { color: #241400; }

/* Current conditions card */
.cc-place { font-weight: 700; font-size: 0.9rem; margin-bottom: 8px; }
.cc-main { display: flex; align-items: center; gap: 12px; }
.cc-icon { font-size: 2.6rem; }
.cc-temp { font-size: 2.6rem; font-weight: 800; font-family: var(--font-mono); }
.cc-temp small { font-size: 1.4rem; font-weight: 700; }
.cc-desc { font-weight: 700; margin-top: 2px; }
.cc-feels { color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; }
.cc-row {
  display: flex; justify-content: space-between; font-size: 0.85rem;
  padding: 7px 0; border-top: 1px solid var(--border);
}
.cc-row span { color: var(--muted); }

/* Gauges */
.gauge { text-align: center; }
.gauge-svg { width: 170px; max-width: 100%; display: block; margin: 0 auto; }
.gauge-title { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.03em; margin-top: -34px; }
.gauge-sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.gauge-why { margin-top: 8px; font-size: 0.82rem; }
.gauge-why summary { color: var(--accent); cursor: pointer; font-weight: 700; }
.gauge-why ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
#card-overview .verdict-card { border: none; box-shadow: none; padding: 12px 0 0; margin: 10px 0 0; border-top: 1px solid var(--border); border-radius: 0; }

/* Plan route bar + map card */
.dash-card-map { padding: 14px; }
.plan-route-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.plan-route-bar input {
  flex: 1 1 140px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-alt); color: var(--text); font-size: 0.9rem;
}
.plan-route-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
#map-dock-slot { height: 460px; border-radius: 12px; background: var(--surface-alt); }
#map.docked { z-index: 1001; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.map-legend-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.legend-chip { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.legend-chip i { width: 18px; height: 5px; border-radius: 3px; display: inline-block; }

/* Floating map chrome only belongs to the full Map view */
body:not([data-view="map"]) .current-conditions-card,
body:not([data-view="map"]) .map-legends { display: none !important; }

/* Alerts card */
.alerts-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.72rem;
}

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 6px; cursor: pointer; color: var(--text); font-size: 0.72rem; font-weight: 600;
  font-family: var(--font); text-align: center;
}
.quick-action:hover { border-color: var(--accent); color: var(--accent); }
.quick-action-icon { font-size: 1.4rem; }

/* Hourly strip */
.hourly-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.hourly-cell {
  flex: 1 0 62px; text-align: center; padding: 10px 4px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
}
.hourly-cell.now { border-color: var(--accent); background: rgba(37, 99, 235, 0.08); }
.hourly-time { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.hourly-icon { font-size: 1.3rem; margin: 4px 0; }
.hourly-temp { font-weight: 800; font-family: var(--font-mono); }
.hourly-precip { font-size: 0.68rem; color: var(--muted); margin-top: 3px; }

/* Hazard summary bars */
.hazard-bar-row { display: grid; grid-template-columns: 110px 1fr 92px; align-items: center; gap: 10px; padding: 7px 0; }
.hazard-bar-name { font-size: 0.82rem; font-weight: 600; }
.hazard-bar-track { height: 7px; border-radius: 4px; background: var(--surface-alt); overflow: hidden; display: block; }
.hazard-bar-track i { display: block; height: 100%; border-radius: 4px; }
.hazard-bar-word { font-size: 0.75rem; font-weight: 800; text-align: right; }

/* Recommended routes */
.reco-route { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.reco-route:first-child { border-top: none; padding-top: 0; }
.reco-route-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.reco-route-info small { color: var(--muted); }
.route-risk-badge { font-weight: 800; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; color: #fff; }
.route-risk-badge.ok { background: var(--safe); }
.route-risk-badge.mid { background: var(--warn); color: #241400; }
.route-risk-badge.bad { background: var(--danger); }

/* Driving tips */
.tips-card { background: linear-gradient(180deg, rgba(37, 99, 235, 0.10), transparent 70%), var(--surface); }
.tips-list { list-style: none; margin: 0; padding: 0; }
.tips-list li { padding: 6px 0; font-size: 0.86rem; border-top: 1px dashed var(--border); }
.tips-list li:first-child { border-top: none; }

/* Camera previews */
.camera-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.camera-thumb {
  position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  padding: 0; cursor: pointer; background: var(--surface-alt); aspect-ratio: 16 / 10;
}
.camera-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: none; }
.camera-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  background: rgba(15, 23, 42, 0.72); color: #fff; font-size: 0.66rem; text-align: left;
}
.camera-viewall { width: 100%; margin-top: 10px; }
.route-cameras { margin-top: 12px; }
.route-cameras-title { font-weight: 800; font-size: 0.82rem; margin-bottom: 8px; }
.route-camera-grid { grid-template-columns: 1fr 1fr; }

/* Trip Preview overlay */
#route-preview {
  position: fixed; inset: 0; z-index: 2100;
  background: var(--bg); display: flex; flex-direction: column;
}
#route-preview.hidden { display: none; }
.route-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.route-preview-head h2 { margin: 0; font-size: 1.05rem; }
.route-preview-body {
  flex: 1; overflow-y: auto; padding: 18px 20px 40px;
  display: flex; flex-direction: column; gap: 14px; max-width: 760px; margin: 0 auto; width: 100%;
}
.preview-route-line { font-size: 1.02rem; }
.preview-route-stats { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.preview-wx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .preview-wx-row { grid-template-columns: 1fr; } }
.preview-wx { font-size: 0.95rem; line-height: 1.5; }
.preview-nudge { border: 2px solid var(--warn); }
.preview-nudge .camera-thumb { width: 100%; aspect-ratio: 16 / 8; }
.preview-actions {
  display: flex; gap: 10px; position: sticky; bottom: 0;
  background: var(--bg); padding: 10px 0 4px;
}
.preview-actions .btn { flex: 1; padding: 12px; font-size: 0.95rem; }

/* Footer */
.site-footer {
  margin: 26px -24px 0; padding: 24px 28px; background: var(--navy); color: #dbe4f5;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
}
.site-footer-brand { display: flex; align-items: center; gap: 10px; }
.site-footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer-links a { color: #dbe4f5; font-size: 0.85rem; text-decoration: none; }
.site-footer-links a:hover { text-decoration: underline; }
.site-footer-note { flex-basis: 100%; margin: 0; font-size: 0.72rem; color: #9fb0d0; }

body[data-theme="dark"] #map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(1.05) saturate(0.85);
}
body[data-theme="light"][data-mode="winter"] #map .leaflet-tile-pane { filter: saturate(0.55) brightness(1.08) hue-rotate(-6deg); }
body[data-theme="light"][data-mode="summer"] #map .leaflet-tile-pane { filter: saturate(1.25) brightness(1.02) hue-rotate(4deg); }

/* Satellite imagery keeps its true color — recoloring/inverting a photo looks wrong */
body[data-basemap="satellite"] #map .leaflet-tile-pane { filter: none !important; }

/* keep popups/markers legible in dark mode (double-invert them back) */
body[data-theme="dark"] #map .leaflet-marker-icon,
body[data-theme="dark"] #map .leaflet-popup,
body[data-theme="dark"] #map .grid-arrow-icon {
  filter: invert(1) hue-rotate(180deg);
}
/* The popup's double-invert above also lands on the camera photo inside it,
   discoloring it — invert it a second time to cancel that back out, so the
   image shows its true colors while the popup text around it stays legible. */
body[data-theme="dark"] .camera-popup-img {
  filter: invert(1) hue-rotate(180deg);
}

/* ---------------- Current conditions card ---------------- */
.current-conditions-card {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 800;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-alt) 100%);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 20px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 230, 168, 0.08) inset;
  min-width: 180px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.ccc-top { display: flex; align-items: center; gap: 8px; }
.ccc-icon { font-size: 1.9rem; }
.ccc-temp {
  font-size: 2rem; font-weight: 800; font-family: var(--font-mono); letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--purple, #8b5cf6));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ccc-place { font-weight: 700; margin-top: 2px; }
.ccc-desc { color: var(--muted); font-size: 0.85rem; }
.ccc-feels { font-size: 0.85rem; margin-top: 4px; color: var(--muted); font-family: var(--font-mono); }
.ccc-hint { font-size: 0.72rem; color: var(--accent); margin-top: 6px; font-weight: 700; }
.hidden { display: none !important; }

/* ---------------- Map legends ---------------- */
.map-legends { position: absolute; bottom: 14px; left: 14px; z-index: 800; display: flex; flex-direction: column; gap: 8px; max-width: 260px; }
.map-legend {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 0.78rem;
  box-shadow: var(--shadow);
}
.map-legend .legend-title { font-weight: 800; margin-bottom: 4px; }
.legend-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.legend-swatch { width: 16px; height: 4px; border-radius: 2px; display: inline-block; background: currentColor; box-shadow: 0 0 6px currentColor; }
.legend-swatch.dashed { background-image: repeating-linear-gradient(90deg, currentColor 0 6px, transparent 6px 10px); height: 3px; box-shadow: none; }

/* ---------------- Panels ---------------- */
.panel-backdrop {
  position: absolute; inset: 0;
  background: var(--backdrop);
  z-index: 1900; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.panel-backdrop.visible { opacity: 1; pointer-events: auto; }

.side-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow), -1px 0 0 rgba(0, 230, 168, 0.1);
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.side-panel.open { transform: translateX(0); }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.panel-close {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--muted); padding: 4px 8px; border-radius: 999px;
}
.panel-close:hover { background: var(--surface-alt); color: var(--danger); }

.panel-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.panel-body h3, #view-dashboard h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 800; margin: 18px 0 8px; }
.panel-body h3:first-child, #view-dashboard h3:first-child { margin-top: 0; }
.panel-body h4, #view-dashboard h4 { font-size: 0.78rem; font-weight: 700; color: var(--text); margin: 14px 0 6px; opacity: 0.75; }
.panel-hint { font-size: 0.78rem; color: var(--muted); margin: 4px 0 0; }
/* ---------------- Travel verdict (go / caution / no) ---------------- */
#travel-verdict:empty { display: none; }
.verdict-card {
  border-radius: 16px; padding: 18px 20px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.verdict-title { font-size: 1.6rem; font-weight: 800; font-family: var(--font-mono); letter-spacing: 0.01em; }
.verdict-reason { font-size: 0.84rem; margin-top: 4px; opacity: 0.85; }
.verdict-checklist { font-size: 0.8rem; margin-top: 8px; font-weight: 600; }
.verdict-countdown:empty { display: none; }
.verdict-countdown { font-size: 0.8rem; margin-top: 6px; font-weight: 700; font-family: var(--font-mono); opacity: 0.9; }
.verdict-sparkline { margin-top: 12px; }
.verdict-sparkline svg { width: 100%; height: 48px; display: block; }
.verdict-go { background: linear-gradient(150deg, rgba(0, 230, 168, 0.18), rgba(0, 230, 168, 0.05)); border-color: var(--safe); box-shadow: var(--glow-safe); }
.verdict-wait { background: linear-gradient(150deg, rgba(255, 176, 32, 0.18), rgba(255, 176, 32, 0.05)); border-color: var(--warn); box-shadow: var(--glow-warn); }
.verdict-no { background: linear-gradient(150deg, rgba(255, 77, 109, 0.2), rgba(255, 77, 109, 0.06)); border-color: var(--danger); box-shadow: var(--glow-danger); animation: pulse-glow 2s ease-in-out infinite; }
.hazard-callout { font-weight: 700; color: var(--warn); }

.daily-summary:empty { display: none; }
.daily-summary {
  font-size: 0.95rem; font-weight: 700; padding: 12px 14px; margin-bottom: 12px; border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------------- Toggle switches ---------------- */
.layer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 8px;
}
.layer-row:last-child { margin-bottom: 0; }
.layer-label { font-size: 0.92rem; font-weight: 600; }
.layer-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.layer-row select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px; font-size: 0.82rem; font-weight: 600;
}

/* Small pill flagging a control as only relevant for one season — shown
   inline so it's clear why something isn't always there, not just missing. */
.season-badge {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle;
}
.season-badge.badge-winter { background: rgba(79, 140, 255, 0.15); color: #8fb4ff; }
.season-badge.badge-summer { background: rgba(255, 159, 79, 0.15); color: #ffb87a; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 999px; transition: 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: var(--surface); border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); box-shadow: var(--glow-safe); }
.switch input:checked + .slider::before { background: #ffffff; transform: translateX(18px); }

/* Floating radar toggle — a single button directly on the map instead of a
   menu control, per the "keep it simple" request. */
.radar-toggle-control {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border-radius: 10px; cursor: pointer; font-size: 1.15rem; opacity: 0.6;
}
.radar-toggle-control.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent) inset, var(--glow-safe); }
/* Radar tiles get their own pane so the dark-mode/season map filters (meant
   for the base map) never shift radar colors. */
#map .leaflet-radar-pane { filter: none !important; }

/* Time + step controls, only shown while radar is on (Radar.setVisible
   toggles the .hidden class) — deliberately compact, not the old
   menu-embedded slider. */
.radar-time-pill {
  display: flex; align-items: center; gap: 2px; background: var(--surface);
  border-radius: 10px; padding: 4px 8px; margin-top: 6px;
}
.radar-pill-btn { border: none; background: none; color: var(--text); cursor: pointer; font-size: 0.9rem; padding: 2px 4px; }
.radar-pill-btn:hover { color: var(--accent); }
.radar-pill-time { font-size: 0.76rem; font-weight: 700; font-family: var(--font-mono); color: var(--muted); margin-left: 4px; white-space: nowrap; }

/* ---------------- Forms / inputs in panels ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 5px; }
.field input[type="text"], .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-alt); color: var(--text); font-size: 0.9rem;
}
.field input[type="text"]:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 230, 168, 0.16); }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row .field { flex: 1; margin-bottom: 0; }
.btn {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-alt); color: var(--text); cursor: pointer; font-size: 0.85rem; font-weight: 700;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-primary:hover { background: var(--accent-light); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--glow-safe); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; margin: 10px 0; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-value { font-weight: 800; min-width: 40px; text-align: right; font-family: var(--font-mono); color: var(--accent); }

/* ---------------- Route panel ---------------- */
.route-card {
  border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 14px;
  padding: 12px 14px; margin-top: 10px; cursor: pointer; background: var(--surface-alt);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.route-card.selected { border-color: var(--accent); border-left-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--glow-safe); }
.route-card-title { font-weight: 800; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); }
.route-card-stats { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.route-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--safe); color: var(--on-accent); margin-top: 6px;
}
.route-badge.warn { background: var(--warn); color: #241400; }
.route-warning { font-size: 0.8rem; color: var(--danger); margin-top: 6px; font-weight: 700; }
.route-warning-strong { font-size: 0.85rem; padding: 8px 10px; border: 1.5px solid var(--danger); border-radius: 10px; background: rgba(255, 77, 109, 0.1); box-shadow: var(--glow-danger); }
.arrival-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-top: 10px; font-size: 0.88rem; }
.route-report { margin-top: 10px; font-size: 0.82rem; }
.route-report summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 4px 0; }
.route-report-row { padding: 8px 0; border-top: 1px solid var(--border); }
.route-report-time { font-weight: 600; margin-bottom: 4px; }
.route-report-cells { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; }

/* Environment Canada alert popup card */
.ec-popup-wrap .leaflet-popup-content { margin: 0; width: auto !important; }
.ec-popup { display: flex; min-width: 250px; max-width: 300px; border-radius: 12px; overflow: hidden; }
.ec-popup-band { width: 6px; flex: none; }
.ec-popup-body { padding: 10px 12px; min-width: 0; }
.ec-popup-title { font-weight: 800; font-size: 0.95rem; }
.ec-popup-region { color: var(--muted); font-size: 0.78rem; margin: 1px 0 6px; }
.ec-popup-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ec-chip {
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text);
}
.ec-popup-times { font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.ec-popup-summary { margin: 0; font-size: 0.8rem; line-height: 1.45; }
.ec-popup-full { margin-top: 6px; font-size: 0.78rem; }
.ec-popup-full summary { color: var(--accent); font-weight: 700; cursor: pointer; }
.ec-popup-full p { max-height: 180px; overflow-y: auto; margin: 6px 0 0; white-space: pre-line; }
.ec-popup-nav { margin-bottom: 6px; }

/* Fuel/food/rest-stop markers along a route */
.route-stop-icon {
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* Winter kit checklist */
.winter-kit-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; }
.winter-kit-item {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font-size: 0.88rem;
}
.winter-kit-item.packed { opacity: 0.65; }
.winter-kit-item.packed span { text-decoration: line-through; }
.winter-kit-item input { accent-color: var(--accent); }

/* AI briefing / trip Q&A output */
.ai-card {
  background: var(--surface-alt); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; margin-top: 10px; font-size: 0.9rem; line-height: 1.5;
}
.ai-card .panel-hint { margin: 8px 0 0; font-size: 0.72rem; }
.ai-briefing-actions { margin: 8px 0 12px; }

/* ---------------- Conditions panel (weather + risk) ---------------- */
.alerts-panel {
  background: linear-gradient(150deg, rgba(255, 77, 109, 0.16), rgba(255, 77, 109, 0.05));
  border: 1px solid var(--danger); color: var(--text);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
  box-shadow: var(--glow-danger);
}
.alerts-panel h3 { margin: 0 0 6px 0; font-size: 0.95rem; color: var(--danger); text-transform: none; letter-spacing: normal; }
.alert-item { margin-bottom: 10px; font-size: 0.86rem; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 8px; }
.alert-item:last-child { border-bottom: none; margin-bottom: 0; }
.alert-item strong { display: block; }
.alert-nav { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; margin-bottom: 8px; }
.alert-nav button { border: none; background: none; color: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.alert-nav button:disabled { opacity: 0.3; cursor: default; }

.metrics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.metric-card {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.metric-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--glow-safe); }
.metric-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.metric-value { font-size: 1.35rem; font-weight: 800; margin-top: 4px; font-family: var(--font-mono); }
.metric-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.risk-card { margin-bottom: 14px; }
.risk-level {
  font-size: 1.15rem; font-weight: 800; padding: 7px 16px; border-radius: 999px;
  display: inline-block; color: var(--on-accent); background: var(--safe); box-shadow: var(--glow-safe);
  font-family: var(--font-mono); letter-spacing: 0.02em;
}
.risk-level.moderate { background: var(--warn); color: #241400; box-shadow: var(--glow-warn); }
.risk-level.high, .risk-level.severe { background: var(--danger); color: #fff; box-shadow: var(--glow-danger); animation: pulse-glow 2s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { box-shadow: var(--glow-danger); }
  50% { box-shadow: 0 0 26px rgba(255, 77, 109, 0.85); }
}
.risk-reasons { margin: 10px 0 0 0; padding-left: 18px; font-size: 0.88rem; }
.risk-reasons li { margin-bottom: 4px; }

.road-links-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.road-links-list li a {
  display: inline-block; padding: 7px 14px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 999px; text-decoration: none;
  font-size: 0.82rem; font-weight: 700; color: var(--text);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.road-links-list li a:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; color: var(--accent); }
.disclaimer { font-size: 0.76rem; color: var(--muted); margin-top: 12px; }

/* ---------------- Favorites / recent places ---------------- */
.place-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem;
}
.place-row:last-child { border-bottom: none; }
.place-row-label { cursor: pointer; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-row-label:hover { color: var(--accent); }
.place-row-remove { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; flex-shrink: 0; }
.place-row-remove:hover { color: var(--danger); }
#favorites-add-current { margin: 8px 0 14px; }
#recents-clear { margin: 8px 0 14px; }

/* ---------------- Offline banner ---------------- */
.offline-banner {
  background: var(--warn);
  color: #241400;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* ---------------- Trend outlook ---------------- */
.trend-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.trend-line { font-size: 0.9rem; margin-bottom: 6px; }
.trend-line:last-of-type { margin-bottom: 8px; }

/* ---------------- Departure-time advisor / hazard timeline ---------------- */
.advisor-message { font-size: 0.9rem; font-weight: 600; margin-bottom: 10px; }

/* ---------------- Departure-time comparison ---------------- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.compare-col { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; }
.compare-select { width: 100%; margin: 4px 0 8px; padding: 5px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.8rem; }
.compare-temp { font-size: 1.1rem; font-weight: 800; margin-top: 6px; font-family: var(--font-mono); }
.compare-reason { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
#advisor-calendar-btn { margin-top: 4px; }

/* ---------------- Hazard stat cards + trend graph ---------------- */
.hazard-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.hazard-stat-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.hazard-stat-label { font-size: 0.68rem; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hazard-stat-value { font-size: 1.15rem; font-weight: 800; margin-top: 4px; font-family: var(--font-mono); }
.hazard-stat-bar-track { height: 4px; border-radius: 2px; background: var(--border); margin-top: 8px; overflow: hidden; }
.hazard-stat-bar-fill { height: 100%; border-radius: 2px; }
.hazard-trend-heading { font-size: 0.82rem; font-weight: 700; margin-bottom: 8px; }
.hazard-trend-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.hazard-trend-svg { width: 100%; height: 64px; display: block; }
.hazard-trend-labels { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }

/* ---------------- Forecast (4hr / 3-day) ---------------- */
.forecast-subheading { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); font-weight: 800; margin: 10px 0 6px; }
.forecast-subheading:first-child { margin-top: 0; }
.forecast-hourly-row, .forecast-daily-row { display: flex; gap: 6px; }
.forecast-hour, .forecast-day {
  flex: 1; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 4px; text-align: center; font-size: 0.78rem;
}
.forecast-hour-label, .forecast-day-label { font-weight: 700; margin-bottom: 2px; }
.forecast-icon { font-size: 1.25rem; margin: 2px 0; }
.forecast-hour-temp, .forecast-day-temps { font-size: 0.85rem; font-family: var(--font-mono); font-weight: 700; }
.forecast-pop { color: var(--accent); font-size: 0.72rem; margin-top: 2px; font-weight: 700; }
.forecast-snow { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.forecast-daily-row { margin-bottom: 14px; }

/* ---------------- History log ---------------- */
.history-summary { font-size: 0.88rem; font-weight: 600; margin-bottom: 8px; }
.history-grid { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.history-dot { width: 13px; height: 13px; border-radius: 4px; background: var(--safe); display: inline-block; box-shadow: 0 0 5px rgba(0, 230, 168, 0.5); transition: transform 0.1s ease; }
.history-dot:hover { transform: scale(1.3); }
.history-dot.risk-moderate { background: var(--warn); box-shadow: 0 0 5px rgba(255, 176, 32, 0.5); }
.history-dot.risk-high, .history-dot.risk-severe { background: var(--danger); box-shadow: 0 0 5px rgba(255, 77, 109, 0.55); }
.history-legend { display: flex; gap: 12px; font-size: 0.72rem; color: var(--muted); flex-wrap: wrap; }
.history-legend span { display: flex; align-items: center; gap: 4px; }
.history-legend .history-dot { width: 9px; height: 9px; }

/* ---------------- Week-ahead outlook ---------------- */
.week-dots { display: flex; gap: 6px; margin-bottom: 6px; }
.week-dot { flex: 1; height: 32px; border-radius: 8px; background: var(--safe); box-shadow: 0 0 6px rgba(0, 230, 168, 0.4); transition: transform 0.1s ease; }
.week-dot:hover { transform: scaleY(1.08); }
.week-dot.risk-moderate { background: var(--warn); box-shadow: 0 0 6px rgba(255, 176, 32, 0.4); }
.week-dot.risk-high, .week-dot.risk-severe { background: var(--danger); box-shadow: 0 0 6px rgba(255, 77, 109, 0.5); }
.week-labels { display: flex; gap: 6px; margin-bottom: 8px; }
.week-labels span { flex: 1; text-align: center; font-size: 0.7rem; color: var(--muted); font-weight: 700; }

/* ---------------- Trip log ---------------- */
.trip-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.trip-row:last-child { border-bottom: none; }
.trip-row-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }

/* ---------------- Onboarding wizard ---------------- */
.onboarding-backdrop {
  position: fixed; inset: 0; z-index: 3000; background: var(--backdrop);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.onboarding-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; max-width: 380px; width: 100%; box-shadow: var(--shadow);
}
.onboarding-progress { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 800; margin-bottom: 8px; }
.onboarding-card h3 { margin: 0 0 8px; font-size: 1.1rem; }

/* ---------------- Grid weather overlay (wind arrows) ---------------- */
.grid-arrow-icon { font-size: 18px; line-height: 1; text-shadow: 0 0 3px rgba(0,0,0,0.5); }

/* ---------------- 511 Ontario cameras ---------------- */
.camera-icon { font-size: 16px; line-height: 1; text-shadow: 0 0 3px rgba(0,0,0,0.6); }
.camera-popup-img { display: block; margin-top: 6px; max-width: 240px; border-radius: 10px; }

/* ---------------- School bus overlay ---------------- */
.bus-icon { font-size: 16px; line-height: 1; text-shadow: 0 0 3px rgba(0,0,0,0.6); }

/* ---------------- Gradient (snow depth / heat index) canvas layer ---------------- */
.gradient-canvas-layer { pointer-events: none; }

/* ---------------- Navigation HUD ---------------- */
.nav-hud {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 900;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-alt) 100%); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow), 0 0 0 1px rgba(0, 230, 168, 0.1) inset; padding: 12px 16px;
}
.nav-hud-main { display: flex; align-items: center; gap: 12px; }
.nav-hud-icon { font-size: 1.9rem; flex-shrink: 0; color: var(--accent); }
.nav-hud-text { flex: 1; min-width: 0; }
.nav-hud-instruction { font-weight: 800; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-hud-distance { font-size: 0.85rem; color: var(--muted); font-family: var(--font-mono); }
.nav-hud-stats { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); }
#nav-hud-traffic { color: var(--warn); font-weight: 800; }
.nav-hud-stats .btn { margin-left: auto; }
#nav-hud-mute, #nav-hud-bigtext { border: none; background: var(--surface-alt); color: var(--text); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 0.95rem; }
#nav-hud-bigtext { font-weight: 800; font-size: 0.8rem; }
body[data-nav-bigtext="true"] #nav-hud-bigtext { background: var(--accent); color: var(--on-accent); }
.nav-hud-warning { margin-top: 8px; font-weight: 800; color: var(--danger); }
.nav-hud-alert {
  margin-top: 8px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 0.9rem;
}

/* Big-text low-visibility mode: oversized glanceable HUD */
body[data-nav-bigtext="true"] .nav-hud {
  background: #0b1220; color: #ffffff; border-color: #ffffff33;
}
body[data-nav-bigtext="true"] .nav-hud-instruction { font-size: 1.9rem; line-height: 1.2; color: #fff; }
body[data-nav-bigtext="true"] .nav-hud-distance { font-size: 1.3rem; color: #cfe0ff; }
body[data-nav-bigtext="true"] .nav-hud-icon { font-size: 2.6rem; }
body[data-nav-bigtext="true"] .nav-hud-stats { font-size: 1.05rem; color: #cfe0ff; }
body[data-nav-bigtext="true"] #nav-hud-end { padding: 12px 20px; font-size: 1rem; }

/* ---------------- Road popup / leaflet popup theming ---------------- */
body[data-theme="dark"] .leaflet-popup-content-wrapper,
body[data-theme="dark"] .leaflet-popup-tip { background: var(--surface); color: var(--text); }

@media (max-width: 700px) {
  .toolbar-brand span.brand-text { display: none; }
  .toolbar-search { max-width: none; order: 3; flex-basis: 100%; }
  .side-panel { width: 100vw; }
}

/* ---------------- Animated weather backdrop (dashboard) ---------------- */
/* Sits at z-index 0 inside #view-dashboard; columns get z-index 1 so text
   always reads over the scene. Everything is deliberately low-opacity. */
.dash-col { position: relative; z-index: 1; }
#weather-fx {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
/* Scene washes: base per weather, modified by time of day. Dawn/dusk clear
   skies get the warm sunset/sunrise horizon; night versions go darker. */
#weather-fx[data-scene="clear"][data-time="day"] { background: linear-gradient(180deg, rgba(96, 165, 250, 0.28), rgba(253, 224, 71, 0.07) 55%, transparent 80%); }
#weather-fx[data-scene="clear"][data-time="dawn"] { background: linear-gradient(180deg, rgba(96, 130, 220, 0.30), rgba(251, 191, 36, 0.20) 55%, rgba(251, 146, 60, 0.16) 78%, transparent 95%); }
#weather-fx[data-scene="clear"][data-time="dusk"] { background: linear-gradient(180deg, rgba(49, 46, 129, 0.38), rgba(244, 114, 82, 0.22) 55%, rgba(251, 146, 60, 0.20) 78%, transparent 95%); }
#weather-fx[data-scene="clear"][data-time="night"] { background: linear-gradient(180deg, rgba(30, 41, 90, 0.45), transparent 75%); }
#weather-fx[data-scene="cloudy"] { background: linear-gradient(180deg, rgba(148, 163, 184, 0.22), transparent 70%); }
#weather-fx[data-scene="cloudy"][data-time="night"] { background: linear-gradient(180deg, rgba(51, 65, 85, 0.42), transparent 75%); }
#weather-fx[data-scene="cloudy"][data-time="dusk"], #weather-fx[data-scene="cloudy"][data-time="dawn"] { background: linear-gradient(180deg, rgba(100, 116, 139, 0.30), rgba(251, 146, 60, 0.10) 70%, transparent 90%); }
#weather-fx[data-scene="rain"] { background: linear-gradient(180deg, rgba(71, 105, 145, 0.30), rgba(100, 116, 139, 0.12) 60%, transparent 85%); }
#weather-fx[data-scene="rain"][data-time="night"] { background: linear-gradient(180deg, rgba(30, 41, 59, 0.52), rgba(30, 41, 59, 0.18) 60%, transparent 85%); }
#weather-fx[data-scene="freezing-rain"] { background: linear-gradient(180deg, rgba(103, 145, 190, 0.34), rgba(165, 220, 255, 0.10) 55%, transparent 80%); }
#weather-fx[data-scene="snow"] { background: linear-gradient(180deg, rgba(148, 180, 216, 0.25), transparent 75%); }
#weather-fx[data-scene="snow"][data-time="night"] { background: linear-gradient(180deg, rgba(51, 65, 110, 0.42), transparent 78%); }
#weather-fx[data-scene="storm"] { background: linear-gradient(180deg, rgba(51, 65, 85, 0.50), rgba(51, 65, 85, 0.15) 60%, transparent 85%); }
#weather-fx[data-scene="storm"][data-time="night"] { background: linear-gradient(180deg, rgba(15, 23, 42, 0.60), rgba(15, 23, 42, 0.22) 60%, transparent 88%); }
#weather-fx[data-scene="fog"] { background: linear-gradient(180deg, rgba(148, 163, 184, 0.30), rgba(148, 163, 184, 0.12) 60%, transparent 85%); }
#weather-fx[data-scene="fog"][data-time="night"] { background: linear-gradient(180deg, rgba(71, 85, 105, 0.44), rgba(71, 85, 105, 0.16) 60%, transparent 88%); }

.fx-sun {
  position: absolute; top: 40px; right: 8%;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 224, 71, 0.55), rgba(253, 224, 71, 0.12) 60%, transparent 72%);
  animation: fx-sunpulse 6s ease-in-out infinite;
}
@keyframes fx-sunpulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.12); opacity: 1; }
}
/* Dawn/dusk: bigger, warmer sun sitting low, slowly rising or sinking. */
.fx-sun-low {
  top: auto; bottom: -40px; right: 14%;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.60), rgba(251, 191, 36, 0.22) 55%, transparent 72%);
}
.fx-sun-setting { animation: fx-sunset 90s linear infinite; }
.fx-sun-rising { animation: fx-sunrise 90s linear infinite; }
@keyframes fx-sunset { 0% { transform: translateY(-36px); } 100% { transform: translateY(30px); } }
@keyframes fx-sunrise { 0% { transform: translateY(30px); } 100% { transform: translateY(-36px); } }

.fx-star {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(226, 232, 240, 0.9);
  animation: fx-twinkle 4s ease-in-out infinite;
}
@keyframes fx-twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.9; } }

.fx-cloud {
  position: absolute; left: -220px;
  width: 200px; height: 60px; border-radius: 60px;
  background: rgba(148, 163, 184, 0.28);
  filter: blur(14px);
  animation: fx-drift linear infinite;
}
@keyframes fx-drift { to { transform: translateX(calc(100vw + 440px)); } }

.fx-drop {
  position: absolute; top: -30px;
  width: 1.5px; height: 22px;
  background: linear-gradient(rgba(147, 197, 253, 0), rgba(147, 197, 253, 0.55));
  animation: fx-fall linear infinite;
}
@keyframes fx-fall { to { transform: translateY(105vh); } }

.fx-flake {
  position: absolute; top: -24px;
  color: rgba(226, 232, 240, 0.65);
  animation: fx-snowfall linear infinite;
}
@keyframes fx-snowfall {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(52vh) translateX(24px); }
  100% { transform: translateY(105vh) translateX(-12px); }
}

.fx-haze {
  position: absolute; left: -30%;
  width: 160%; height: 46px; border-radius: 50%;
  background: rgba(148, 163, 184, 0.20);
  filter: blur(18px);
  animation: fx-hazedrift ease-in-out infinite alternate;
}
@keyframes fx-hazedrift { to { transform: translateX(18%); } }

.fx-lightning {
  position: absolute; inset: 0;
  background: rgba(226, 232, 255, 0.0);
  animation: fx-flash 7s ease-out infinite;
}
@keyframes fx-flash {
  0%, 91%, 100% { background: rgba(226, 232, 255, 0); }
  92% { background: rgba(226, 232, 255, 0.28); }
  93% { background: rgba(226, 232, 255, 0.04); }
  94.5% { background: rgba(226, 232, 255, 0.20); }
  96% { background: rgba(226, 232, 255, 0); }
}

/* Light theme: soften the scene washes so text contrast holds up. */
body[data-theme="light"] #weather-fx { opacity: 0.55; }
body[data-theme="light"] .fx-star { background: rgba(71, 85, 105, 0.8); }
body[data-theme="light"] .fx-flake { color: rgba(100, 130, 170, 0.7); }

/* Reduced motion: keep the scene's static gradient, drop all movement. */
@media (prefers-reduced-motion: reduce) {
  #weather-fx > * { display: none; }
}
