/* Distracted Driver Camera Map — bottom-nav layout */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #0ea5e9;
  --accent-dim: #0284c7;
  --accent-glow: rgba(14, 165, 233, 0.18);
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar-h: 54px;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.88);
  --glass-shadow: 0 -2px 24px rgba(0, 0, 0, 0.06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

@supports (height: 100dvh) {
  body, .app { height: 100dvh; }
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* === Icons === */
.icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-sm { width: 15px; height: 15px; }
.icon-xs { width: 12px; height: 12px; vertical-align: -1px; }

/* === Glass === */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--glass-border);
}

/* ============================================================
   NEAR ALERT — fixed top banner
   ============================================================ */
.near-alert {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: rgba(251, 191, 36, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(217, 119, 6, 0.2);
  color: var(--text);
  animation: slideDown 0.3s var(--ease);
}
.near-alert.hidden { display: none; }

.near-alert-icon { color: #92400e; flex-shrink: 0; }
.near-alert-icon.icon { width: 18px; height: 18px; }

.near-alert strong { font-size: 0.78rem; font-weight: 600; }
.near-alert p { margin: 0.05rem 0 0; font-size: 0.68rem; color: #78350f; }

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ============================================================
   MAP — fills the entire viewport
   ============================================================ */
.map-container {
  flex: 1;
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #e2e8f0;
}

/* Clear route FAB on map — bottom center above nav */
.clear-route-fab {
  position: fixed;
  bottom: calc(var(--bar-h) + var(--safe-bottom) + 3.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  animation: fadeIn 0.2s var(--ease);
}
.clear-route-fab:hover { background: rgba(255, 255, 255, 0.95); }
.clear-route-fab .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.clear-route-fab[hidden] { display: none; }

/* Legend — top-left, horizontal */
.legend {
  position: absolute;
  top: calc(var(--safe-top) + 0.5rem);
  left: 0.5rem;
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  z-index: 1000;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.legend-item { display: flex; align-items: center; gap: 0.2rem; }

.legend-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-marker.camera  { background: #16a34a; opacity: 0.55; }
.legend-marker.nearby  { background: var(--danger); opacity: 0.65; }
.legend-marker.you     { background: var(--accent); }

/* ============================================================
   LIST VIEW
   ============================================================ */
.list-view {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s var(--ease);
}
.list-view[hidden] { display: none; }

.list-header {
  flex-shrink: 0;
  padding: calc(var(--safe-top) + 0.75rem) 1rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.list-title {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.list-search {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.list-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.list-search::placeholder { color: var(--text-muted); }

.list-items {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  padding-bottom: calc(var(--bar-h) + var(--safe-bottom) + 3rem);
  -webkit-overflow-scrolling: touch;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.list-item:hover { background: rgba(0, 0, 0, 0.02); }
.list-item:active { background: rgba(0, 0, 0, 0.04); }

.list-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  opacity: 0.5;
  flex-shrink: 0;
}

.list-item-body { flex: 1; min-width: 0; }

.list-item-road {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-suburb {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.list-item-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.list-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ============================================================
   USER DOT MARKER (blue dot with halo)
   ============================================================ */
.user-dot {
  background: none !important;
  border: none !important;
}

.user-dot-outer {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.2) 0%, rgba(14, 165, 233, 0) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.user-dot-inner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(59, 130, 246, 0.4);
}

.user-dot-arrow {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid #3b82f6;
  filter: drop-shadow(0 -1px 2px rgba(59, 130, 246, 0.4));
}

/* Map scale-up during navigation to hide rotation corners */
#map.nav-mode {
  transform: scale(1.42);
  transform-origin: center center;
}

/* ============================================================
   ROUTE PANEL
   ============================================================ */
.route-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: var(--surface);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  animation: slideDown 0.25s var(--ease);
  max-height: 80vh;
  overflow-y: auto;
}
.route-panel[hidden] { display: none; }

.route-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 0.75rem) 1.25rem 0.65rem;
}

.route-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.route-panel-title .icon { color: var(--text-muted); }

.route-panel-body {
  padding: 0 1.25rem 1rem;
}

.route-field {
  margin-bottom: 0.6rem;
}

.route-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.route-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.82rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.route-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.route-input[readonly] {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-muted);
  cursor: default;
}
.route-input::placeholder { color: var(--text-muted); }

.route-suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}
.route-suggestions:empty { display: none; }

.route-suggestion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.route-suggestion:hover { background: rgba(0, 0, 0, 0.02); }
.route-suggestion:active { background: rgba(0, 0, 0, 0.04); }
.route-suggestion .icon { color: var(--text-muted); flex-shrink: 0; width: 16px; height: 16px; }

.route-suggestion-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-searching {
  padding: 0.75rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.route-summary {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.route-summary[hidden] { display: none; }

.route-summary-stats {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.65rem;
}

.route-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.route-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.route-stat-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.route-cameras-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.route-cameras-label strong { color: var(--danger); }

.route-btn-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.route-btn-clear:hover { background: rgba(0, 0, 0, 0.03); color: var(--text); }
.route-btn-clear .icon { width: 14px; height: 14px; }

/* ============================================================
   NAVIGATION HUD
   ============================================================ */
.nav-hud {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.nav-hud[hidden] { display: none; }
.nav-hud > * { pointer-events: auto; }

.nav-hud-top {
  margin: calc(var(--safe-top) + 0.5rem) 0.5rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-hud-camera {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.nav-hud-camera .icon { width: 16px; height: 16px; color: var(--text-muted); }
.nav-hud-camera.alert { color: var(--danger); }
.nav-hud-camera.alert .icon { color: var(--danger); }

.nav-hud-stats {
  display: flex;
  justify-content: space-around;
}

.nav-hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.nav-hud-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.nav-hud-stat-label {
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  align-self: center;
  margin-bottom: calc(var(--safe-bottom) + 1.25rem);
  padding: 0.65rem 2rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--danger);
  border: none;
  border-radius: 28px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.15s;
}
.nav-stop-btn:active { transform: scale(0.95); }
.nav-stop-btn .icon { width: 16px; height: 16px; fill: #fff; stroke: #fff; }

/* Start nav button in route summary */
.route-btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.route-btn-start:hover { background: #2563eb; }
.route-btn-start .icon { width: 16px; height: 16px; }

/* ============================================================
   DISCLAIMER MODAL (Full screen blur)
   ============================================================ */
.disclaimer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(var(--bar-h) + var(--safe-bottom) + 3rem);
  background: rgba(241, 245, 249, 0.4);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  animation: fadeIn 0.25s var(--ease);
}
.disclaimer-overlay[hidden] { display: none; }

.disclaimer-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 400px;
  animation: scaleUp 0.25s var(--ease);
  overflow: hidden;
}

.disclaimer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.disclaimer-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.disclaimer-title .icon { color: var(--accent); }

.disclaimer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.disclaimer-close:hover { background: rgba(0, 0, 0, 0.1); color: var(--text); }
.disclaimer-close .icon { width: 16px; height: 16px; }

.disclaimer-body {
  padding: 1.25rem 1.5rem 1.5rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.disclaimer-body p { margin: 0; }
.disclaimer-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.warning-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
}
.warning-box .icon { color: var(--danger); flex-shrink: 0; }

.info-section {
  padding: 0;
}

.info-section-title {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.info-section-title .icon { color: var(--text-muted); }

.info-section p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.info-section p strong { color: var(--text); }

.info-footer {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.info-footer strong { color: var(--text); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ============================================================
   BOTTOM NAV BAR — Floating Pill
   ============================================================ */
.bottombar {
  position: fixed;
  bottom: calc(1.25rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.5rem);
  max-width: 400px;
  z-index: 1001;
  border-radius: 40px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.bottombar-status {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.2rem 0.5rem 0;
  min-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--ease), opacity 0.25s;
}
.bottombar-status:empty {
  max-height: 0;
  padding: 0;
}
.bottombar-status:not(:empty) {
  max-height: 24px;
}

.bottombar-tabs {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: var(--bar-h);
  padding: 0 0.25rem;
}

/* Individual tab */
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.2rem 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s;
  font-family: var(--font);
  position: relative;
}
.tab:hover { color: var(--text); }
.tab:active .tab-icon-wrap { transform: scale(0.9); }
.tab:disabled { cursor: default; opacity: 1; }

.tab-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  transition: transform 0.15s, background 0.2s;
}

.tab .icon { width: 22px; height: 22px; stroke-width: 1.6; }

.tab-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Brand tab */
.tab-brand {
  color: var(--text);
}
.tab-brand .tab-icon-wrap {
  color: var(--text);
}
.tab-brand .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.tab-brand .tab-label { font-weight: 500; }

/* Badge on brand icon */
.tab-badge {
  position: absolute;
  top: 2px;
  right: 0px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}
.tab-badge:empty { display: none; }

/* Primary action tab (Locate) */
.tab-primary { color: var(--text); }
.tab-primary .tab-label { color: var(--text); font-weight: 500; }

.tab-icon-accent {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  margin-top: 0;
}
.tab-icon-accent .icon { width: 22px; height: 22px; stroke-width: 1.8; }

.tab-primary.loading .tab-icon-accent {
  opacity: 0.6;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* Located indicator dot on Locate tab */
.tab.located .tab-icon-wrap::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 2px var(--glass-bg);
}

/* Info tab active state */
.tab.active {
  color: var(--text);
}
.tab.active .tab-icon-wrap {
  background: rgba(0, 0, 0, 0.05);
}

/* ============================================================
   LEAFLET OVERRIDES
   ============================================================ */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-family: var(--font);
}
.leaflet-popup-tip { background: var(--surface); }

.leaflet-popup-content {
  margin: 0.65rem 0.85rem;
  font-size: 0.8rem;
  min-width: 170px;
  line-height: 1.5;
}

.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--text); }

/* Move zoom controls above bottom bar */
.leaflet-bottom.leaflet-right {
  bottom: calc(var(--bar-h) + var(--safe-bottom) + 2rem);
}

/* Route destination marker */
.route-dest-marker { background: none !important; border: none !important; }
.route-dest-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Gradient circle markers */
.camera-marker { background: none !important; border: none !important; }

.gradient-marker .gradient-marker-outer {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.gradient-marker-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #1e293b;
  color: #fff;
  border-radius: 50%;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 360px;
  height: 100%;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  padding: calc(1rem + var(--safe-top)) 1rem calc(var(--bar-h) + var(--safe-bottom) + 2.5rem);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close:hover { background: rgba(0, 0, 0, 0.08); color: var(--text); }
.sidebar-close .icon { width: 18px; height: 18px; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

#sidebar-content h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

#sidebar-content .meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#sidebar-content p {
  font-size: 0.8rem;
  line-height: 1.6;
}

#sidebar-content .sidebar-source {
  margin-top: 0.65rem;
  font-size: 0.7rem;
}
#sidebar-content .sidebar-source a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}
#sidebar-content .sidebar-source a:hover { color: var(--accent-dim); }

/* ============================================================
   RESPONSIVE — desktop
   ============================================================ */
@media (min-width: 640px) {
  .disclaimer-card {
    max-width: 440px;
  }
}

@media (min-width: 1024px) {
  :root {
    --bar-h: 50px;
  }

  .bottombar-tabs {
    max-width: 320px;
    margin: 0 auto;
  }

  .legend { left: 1rem; font-size: 0.65rem; }

  .sidebar {
    max-width: 420px;
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.1);
  }

  #sidebar-content h2 { font-size: 1.2rem; }
}
