:root {
  --bg: #0a0c0f;
  --panel-bg: rgba(15, 18, 22, 0.92);
  --panel-bg-solid: #12151a;
  --panel-border: rgba(255, 255, 255, 0.09);
  --divider: rgba(255, 255, 255, 0.07);
  --text-primary: #eef1f4;
  --text-secondary: #97a1ad;
  --text-tertiary: #6b7482;
  --accent-green: #4bab7c;
  --accent-green-soft: rgba(75, 171, 124, 0.16);
  --accent-amber: #d9a441;
  --accent-red: #d97a6a;
  --accent-blue: #5b93d9;
  --accent-purple: #9b8cd9;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  font-size: 15px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#map {
  position: absolute;
  inset: 0;
  filter: brightness(0.88) saturate(0.8) contrast(1.05);
}

#map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6,7,9,0.55) 0%, rgba(6,7,9,0) 14%, rgba(6,7,9,0) 78%, rgba(6,7,9,0.6) 100%),
    radial-gradient(ellipse at 50% 50%, rgba(6,7,9,0) 55%, rgba(6,7,9,0.35) 100%);
  z-index: 2;
}

.maplibregl-ctrl-attrib {
  background: rgba(10, 12, 15, 0.65) !important;
  color: var(--text-tertiary) !important;
}
.maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }
.maplibregl-ctrl-bottom-right { z-index: 3; margin-bottom: 44px; }

/* ---------- Top bar ---------- */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(8,9,11,0.85) 0%, rgba(8,9,11,0.0) 100%);
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.badge {
  margin-left: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f3d9a8;
  background: rgba(217, 164, 65, 0.14);
  border: 1px solid rgba(217, 164, 65, 0.35);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: help;
}

.before-after {
  position: relative;
  margin-left: auto;
  display: flex;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.ba-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease;
}
.ba-btn.active { color: #0a0c0f; }
.ba-thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  background: var(--accent-green);
  border-radius: 999px;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  z-index: 1;
}
.before-after[data-active="before"] .ba-thumb { transform: translateX(0); background: var(--accent-amber); }
.before-after[data-active="proposed"] .ba-thumb { transform: translateX(100%); background: var(--accent-green); }

.icon-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 38px; height: 38px;
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: absolute;
  top: 78px;
  left: 20px;
  bottom: 92px;
  width: 340px;
  z-index: 9;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#sidebar.collapsed {
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

.panel-show-btn {
  position: absolute;
  top: 88px;
  left: 20px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.panel-show-btn:hover { background: rgba(255,255,255,0.1); }

.sidebar-head {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  border-bottom: 1px solid var(--divider);
}

.panel-hide-btn {
  flex-shrink: 0;
  width: 34px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--divider);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
}
.panel-hide-btn:hover { color: var(--text-primary); }

.tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 13px 6px 11px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--accent-green); }

.tab-panels { position: relative; flex: 1; overflow: hidden; }
.panel {
  position: absolute;
  inset: 0;
  padding: 18px 18px 16px;
  overflow-y: auto;
  display: none;
}
.panel.active { display: block; }

.panel h2 { font-size: 14px; margin: 0 0 12px; font-weight: 700; }
.panel h3 { font-size: 12px; margin: 18px 0 8px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.metric-grid.small .metric-card .value { font-size: 17px; }

.metric-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 10px 12px;
}
.metric-card .value {
  font-size: 20px;
  font-weight: 800;
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent-green);
  line-height: 1.15;
}
.metric-card.ej .value { color: var(--accent-red); }
.metric-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.3;
}

.foot-note {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-top: 16px;
}
.foot-note code { color: var(--text-secondary); }

.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  font-size: 13.5px;
}
.layer-row input { accent-color: var(--accent-green); width: 16px; height: 16px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.swatch-green { background: var(--accent-green); }
.swatch-outline { background: transparent; border: 2px solid var(--accent-purple); }
.swatch-ej { background: var(--accent-red); }
.swatch-census { background: var(--accent-blue); }
.layer-label { flex: 1; }

.hint {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 10px;
  line-height: 1.4;
}

.legend {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
  font-size: 11px;
  color: var(--text-secondary);
}
.legend .legend-title { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.legend-bar {
  height: 8px;
  border-radius: 4px;
  margin: 6px 0 4px;
}
.legend-scale { display: flex; justify-content: space-between; }

.segment-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.segment-btn:hover { background: rgba(255,255,255,0.08); }
.segment-btn.selected { border-color: var(--accent-green); background: var(--accent-green-soft); }
.segment-btn strong { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.segment-btn small { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.segment-btn.ghost { background: transparent; border-style: dashed; color: var(--text-secondary); font-size: 12px; justify-content: center; }
.seg-tag {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  color: #0a0c0f;
}
.seg-tag-a { background: var(--accent-green); }
.seg-tag-b { background: #7fcf9e; }

#segment-detail { margin-top: 4px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
#segment-detail .sd-title { color: var(--text-primary); font-weight: 700; font-size: 13px; margin-bottom: 4px; }

.disclaimer-inline {
  font-size: 11.5px;
  color: #f3d9a8;
  background: rgba(217, 164, 65, 0.12);
  border: 1px solid rgba(217, 164, 65, 0.3);
  padding: 8px 10px;
  border-radius: 8px;
  margin: 0 0 14px;
}

.disclaimer-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.disclaimer-list li { margin-bottom: 10px; }
.disclaimer-list strong { color: var(--text-primary); }

/* ---------- Bottom bar ---------- */
#bottombar {
  position: absolute;
  left: 20px; right: 20px; bottom: 20px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 18px;
}
.caption {
  margin: 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 46ch;
}
.camera-presets {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.camera-presets button {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.camera-presets button:hover { background: rgba(255,255,255,0.12); border-color: var(--accent-green); }

/* ---------- Anchor markers ---------- */
.anchor-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  transition: opacity 0.25s ease;
}
.anchor-marker.dim { opacity: 0.55; }
.anchor-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #f3d9a8;
  border: 2px solid #0a0c0f;
  box-shadow: 0 0 0 2px rgba(243, 217, 168, 0.4), 0 2px 8px rgba(0,0,0,0.5);
}
.anchor-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #f3f5f7;
  background: rgba(10, 12, 15, 0.78);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  transform: translateY(-2px);
}

/* ---------- Popups ---------- */
.maplibregl-popup-content {
  background: var(--panel-bg-solid) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--panel-border);
  border-radius: 10px !important;
  box-shadow: var(--shadow);
  font-family: "Inter", sans-serif;
  padding: 12px 14px !important;
}
.maplibregl-popup-tip { border-top-color: var(--panel-border) !important; }
.popup-title { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.popup-row { font-size: 11.5px; color: var(--text-secondary); display: flex; justify-content: space-between; gap: 12px; }

/* ---------- Loading ---------- */
#loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.4s ease;
}
#loading p { color: var(--text-secondary); font-size: 13px; }
.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent-green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading.hidden { opacity: 0; pointer-events: none; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .brand p { display: none; }
  .badge { display: none; }
  .icon-btn { display: flex; }

  #sidebar {
    top: auto;
    bottom: 92px;
    left: 12px;
    right: 12px;
    width: auto;
    height: 62vh;
    transform: translateY(calc(100% + 12px));
    opacity: 0;
    pointer-events: none;
  }
  #sidebar.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  #bottombar { left: 12px; right: 12px; flex-wrap: wrap; }
  .caption { max-width: 100%; }
  .camera-presets { margin-left: 0; overflow-x: auto; width: 100%; }
}

@media (max-width: 520px) {
  .before-after { transform: scale(0.92); }
  #topbar { padding: 10px 12px; gap: 10px; }
}

/* ============================================================
   Version 2 additions
   ============================================================ */

/* ---------- Airflow mode pill (top bar) ---------- */
.mode-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.mode-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.mode-pill[aria-pressed="true"] {
  color: #eaf7ff;
  border-color: rgba(91, 147, 217, 0.55);
  background: rgba(91, 147, 217, 0.16);
}
.mode-pill[aria-pressed="true"] .dot {
  background: #5b93d9;
  box-shadow: 0 0 8px rgba(91, 147, 217, 0.9);
}

/* ---------- Airflow inline controls ---------- */
.airflow-controls {
  position: absolute;
  top: 72px;
  right: 20px;
  z-index: 9;
  width: 260px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.ac-row { margin-bottom: 10px; }
.ac-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.ac-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ac-btns button {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.ac-btns button.active {
  background: rgba(91, 147, 217, 0.22);
  border-color: rgba(91, 147, 217, 0.6);
  color: #eaf7ff;
}
.ac-caption {
  font-size: 10.5px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin: 8px 0 0;
}

/* ---------- Floating notes ---------- */
.floating-note {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: rgba(10, 12, 15, 0.85);
  border: 1px solid rgba(217, 164, 65, 0.4);
  color: #f3d9a8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
#cutaway-disclaimer { top: 116px; border-color: rgba(155,140,217,0.4); color: #d8d0f7; }

/* ---------- Compact camera control panel ---------- */
.camera-panel {
  position: absolute;
  top: 120px;
  right: 20px;
  z-index: 9;
  width: 178px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 14px;
  transition: top 0.25s ease;
}
.camera-panel.pushed-down { top: 312px; }
.cp-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.cp-slider {
  display: block;
  margin-bottom: 8px;
}
.cp-slider span {
  display: block;
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.cp-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent-green);
}
.cp-row {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}
.cp-row button {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.cp-row button:hover { background: rgba(255,255,255,0.12); }
.cp-divider { height: 1px; background: var(--divider); margin: 10px 0; }
.cp-row-label {
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.cp-walk-btn {
  width: 100%;
  margin-top: 10px;
  background: rgba(75, 171, 124, 0.14);
  border: 1px solid rgba(75, 171, 124, 0.4);
  color: #bfe9d3;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 7px;
  cursor: pointer;
}
.cp-walk-btn:hover { background: rgba(75, 171, 124, 0.24); }
.cp-walk-btn.active { background: rgba(217, 122, 106, 0.18); border-color: rgba(217,122,106,0.5); color: #f7cec6; }

/* ---------- Walk mode HUD ---------- */
.walk-hud {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: rgba(10, 12, 15, 0.85);
  border: 1px solid rgba(75, 171, 124, 0.4);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.walk-hud-title { font-size: 12px; font-weight: 700; color: #bfe9d3; white-space: nowrap; }
.walk-hud-keys { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.walk-hud button {
  background: rgba(217, 122, 106, 0.16);
  border: 1px solid rgba(217,122,106,0.4);
  color: #f7cec6;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- Tour bar ---------- */
.tour-bar {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 10px 10px 10px 18px;
}
.tour-status { display: flex; flex-direction: column; align-items: center; min-width: 160px; }
#tour-step-title { font-size: 12.5px; font-weight: 700; color: var(--text-primary); }
.tour-step-count { font-size: 10.5px; color: var(--text-tertiary); }
.tour-bar button {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.tour-bar button:hover { background: rgba(255,255,255,0.14); }
.tour-bar button:disabled { opacity: 0.4; cursor: default; }
.tour-bar button:disabled:hover { background: rgba(255,255,255,0.07); }
#tour-next.tour-next-final { background: var(--accent-green); color: #0a0c0f; border-color: var(--accent-green); font-weight: 700; }
#tour-exit { color: var(--accent-red); }

/* ---------- Camera tab: presets + tour ---------- */
.tour-start-btn {
  width: 100%;
  background: var(--accent-green-soft);
  border: 1px solid rgba(75, 171, 124, 0.45);
  color: #bfe9d3;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  margin-bottom: 6px;
}
.tour-start-btn:hover { background: rgba(75, 171, 124, 0.26); }

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.preset-grid button {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--divider);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
}
.preset-grid button:hover { background: rgba(255,255,255,0.09); border-color: var(--accent-green); }

/* ---------- Airflow tab list ---------- */
/* ---------- Extra swatches ---------- */
.swatch-urban { background: #8a94a0; }
.swatch-cutaway { background: transparent; border: 2px dashed #9b8cd9; }

/* ---------- Responsive: v2 floating panels ---------- */
@media (max-width: 880px) {
  .camera-panel { display: none; }
  .airflow-controls { top: auto; bottom: 100px; right: 12px; left: 12px; width: auto; }
  .walk-hud { flex-wrap: wrap; justify-content: center; text-align: center; top: 64px; }
  .tour-bar { left: 12px; right: 12px; transform: none; flex-wrap: wrap; justify-content: center; }
  .panel-show-btn { top: 76px; }
}

/* ============================================================
   Version 3 additions — welcome screen, presenter/free-roam
   polish, scene activity toggles, night mode
   ============================================================ */

/* ---------- Welcome / entry overlay ---------- */
.welcome-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(75,171,124,0.12) 0%, rgba(6,7,9,0) 55%),
    rgba(6, 7, 9, 0.86);
  backdrop-filter: blur(6px);
  transition: opacity 0.45s ease;
}
.welcome-overlay.closing { opacity: 0; pointer-events: none; }
.welcome-card {
  max-width: 520px;
  width: 100%;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 36px 32px;
  text-align: center;
}
.welcome-eyebrow {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-green);
}
.welcome-card h1 {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.welcome-desc {
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.welcome-btn {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.welcome-btn.primary {
  background: var(--accent-green);
  border: 1px solid var(--accent-green);
  color: #0a0c0f;
}
.welcome-btn.primary:hover { background: #5cc28d; transform: translateY(-1px); }
.welcome-btn.secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
}
.welcome-btn.secondary:hover { background: rgba(255,255,255,0.1); }
.welcome-foot {
  margin: 0;
  font-size: 11px;
  color: var(--text-tertiary);
}
@media (max-width: 520px) {
  .welcome-card { padding: 30px 22px 24px; }
  .welcome-card h1 { font-size: 23px; }
}

/* ---------- Cutaway callout ---------- */
.callout-note { top: 152px; border-color: rgba(75,171,124,0.4); color: #cdeedd; }
@media (max-width: 880px) { .callout-note { top: 96px; } }

/* the section view shows cutaway-callout and tunnel-label-callout together —
   each needs its own row so they stack instead of overlapping. */
#tunnel-label-callout { top: 196px; border-color: rgba(217,164,65,0.4); color: #f3d9a8; }
@media (max-width: 880px) { #tunnel-label-callout { top: 132px; } }

/* ---------- Scene activity / night swatches ---------- */
.swatch-activity-traffic { background: #b23a3a; }
.swatch-activity-peds { background: #e9dfcd; }
.swatch-night { background: #ffe6a3; }

/* ---------- Presenter step panel ---------- */
.presenter-panel {
  position: absolute;
  top: 78px;
  left: 20px;
  bottom: 92px;
  width: 340px;
  z-index: 9;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.pp-step {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-green);
}
.presenter-panel h2 {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
}
.pp-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

@media (max-width: 880px) {
  .presenter-panel {
    top: auto;
    bottom: 92px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 42vh;
  }
}

/* ---------- Night mode ---------- */
/* Was brightness(0.62) — combined with the dim viewport light already set
   in setNightMode(), that crushed the whole scene toward black instead of
   reading as "usable public space after dark." Less aggressive here, with
   the day/night contrast instead carried by the streetlight-glow layer
   (boosted opacity below) and the darker sky/light settings in app.js. */
#map.night-mode { filter: brightness(0.78) saturate(0.8) contrast(1.08); }
#map-vignette.night-mode {
  background:
    linear-gradient(180deg, rgba(2,3,6,0.72) 0%, rgba(2,3,6,0.05) 16%, rgba(2,3,6,0.05) 76%, rgba(2,3,6,0.78) 100%),
    radial-gradient(ellipse at 50% 50%, rgba(2,3,6,0.05) 50%, rgba(2,3,6,0.55) 100%);
}

.legend-divider { height: 1px; background: var(--divider); margin: 10px 0; }
.legend-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend-swatch { width: 16px; height: 3px; border-radius: 2px; flex-shrink: 0; background: #5fd8c4; }
.legend-swatch.dashed {
  background: repeating-linear-gradient(90deg, #aeb6c2 0 4px, transparent 4px 8px);
}

/* ---------- Presenter panel: data rows + species list (Part 11 slides) ---------- */
.pp-metrics { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--divider); }
.pp-metrics-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary, #9aa4b0); margin-bottom: 8px; }
.pp-metric-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pp-metric-row .pmr-name { color: var(--text-secondary); }
.pp-metric-row .pmr-value { font-family: "IBM Plex Mono", monospace; color: var(--text-primary); font-weight: 600; text-align: right; }
.pp-caption { font-size: 11.5px; color: var(--text-tertiary, #9aa4b0); margin-top: 8px; line-height: 1.4; }

/* ---------- Presenter final-step nav (Part 19) ---------- */
#tour-restart { display: none; }
.tour-bar.at-final #tour-next { display: none; }
.tour-bar.at-final #tour-restart { display: inline-flex; }
.tour-bar.at-final #tour-exit { font-weight: 700; }

/* ---- verified-analysis integration (2026-10-06) ---- */
.swatch-tree { background: #2f7d4f; border-radius: 50%; }
.swatch-candidate { background: #b6f06a; }
.swatch-footprint { background: transparent; border: 2px dashed #ffffff; }
.swatch-trees2026 { background: #7fe39a; border-radius: 50%; }
.swatch-canopy { background: #228b3c; }
.swatch-canyon { background: linear-gradient(90deg, #5fd8c4, #e8b04b, #e2574c); }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 6px 0 4px; }
.data-table th { text-align: left; font-weight: 600; color: var(--text-secondary); padding: 5px 6px 5px 0; border-bottom: 1px solid var(--divider); }
.data-table td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--divider); color: var(--text-primary); vertical-align: top; line-height: 1.35; }
.data-table td:not(:first-child) { font-family: "IBM Plex Mono", monospace; white-space: nowrap; }
.data-table td:last-child { white-space: normal; }
.flag-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.rule-status { color: var(--text-tertiary); font-size: 11px; }
.pp-bullets { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.pp-bullets li { margin-bottom: 7px; }
.presenter-panel .pp-metric-row .pmr-value { max-width: 58%; flex-shrink: 0; }
.presenter-panel .pp-metric-row { font-size: 12.5px; padding: 4px 0; }
.presenter-panel .pp-body { font-size: 13px; line-height: 1.5; }
.gap-marker .anchor-label { border-color: #e8a23f; }
/* nine Free Roam tabs: wrap onto two rows instead of hiding half of them behind a scroll */
.tabs { flex-wrap: wrap; overflow-x: visible; }
.tabs .tab-btn { flex: 1 0 18%; padding-top: 8px; padding-bottom: 8px; }

/* ---- presenter readability + deck surface key ---- */
.pp-chips { display: grid; grid-template-columns: 1fr; gap: 0; }
.pp-chips.two-col { grid-template-columns: 1fr 1fr; column-gap: 14px; }
.pp-chip { display: flex; align-items: center; gap: 2px; font-size: 12px; padding: 3px 0; line-height: 1.25; border-bottom: 1px solid rgba(255,255,255,0.06); }
.pp-chip .flag-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.pp-chip-label { color: var(--text-secondary); flex: 1; min-width: 0; }
.pp-chip-value { font-size: 11.5px; font-family: "IBM Plex Mono", monospace; font-weight: 600; color: var(--text-primary); text-align: right; white-space: nowrap; padding-left: 6px; }
.pp-details { margin-top: 10px; border-top: 1px solid var(--divider); padding-top: 8px; }
.pp-details summary { cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--accent-green); list-style-position: inside; }
.pp-details[open] summary { margin-bottom: 6px; }
.pp-details .pp-metric-row { font-size: 12px; }
.pp-compare { margin-top: 4px; }
.ppc-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); margin-bottom: 6px; }
.ppc-toggle { display: inline-flex; gap: 4px; flex-shrink: 0; }
.ppc-year { background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); color: var(--text-secondary); font: inherit; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.ppc-year.active { background: var(--accent-green-soft); border-color: var(--accent-green); color: var(--text-primary); }
.ppc-metric { margin-bottom: 9px; }
.ppc-label { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 3px; }
.ppc-bar-row { display: grid; grid-template-columns: 56px 1fr 96px; align-items: center; gap: 8px; font-size: 12px; margin: 2px 0; }
.ppc-who { color: var(--text-secondary); }
.ppc-track { height: 9px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; }
.ppc-fill { display: block; height: 100%; border-radius: 5px; }
.ppc-val { text-align: right; font-family: "IBM Plex Mono", monospace; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.surface-key { position: absolute; right: 20px; bottom: 96px; z-index: 8; width: 262px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; font-size: 11.5px; color: var(--text-secondary); backdrop-filter: blur(14px); }
.sk-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 5px; }
.sk-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; line-height: 1.25; }
.sk-swatch { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.18); }
@media (max-width: 880px) { .surface-key { display: none; } }
.sk-line { height: 4px; width: 18px; border-radius: 2px; border: none; }
#sk-canyon:not([hidden]) + #sk-zones:not([hidden]) { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--divider); }
