:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f6f8fc;
  --muted: #91a0b4;
  --panel: rgba(6, 13, 24, .92);
  --panel-border: rgba(148, 163, 184, .18);
  --blue: #2bb7ff;
  --cyan: #67e8f9;
  --amber: #f59e0b;
}

* { box-sizing: border-box; }
html, body, #map { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: #07101c; color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed; z-index: 50; top: 8px; left: 8px; padding: 8px 12px; border-radius: 8px;
  background: #fff; color: #08111e; transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }

.panel {
  position: absolute; z-index: 5; top: 18px; left: 18px; width: 344px; max-height: calc(100vh - 36px);
  overflow: auto; border: 1px solid var(--panel-border); border-radius: 17px; background: var(--panel);
  box-shadow: 0 22px 58px rgba(0, 0, 0, .48); backdrop-filter: blur(16px); scrollbar-width: thin;
}
.panel__header { padding: 18px 18px 12px; }
.eyebrow { margin: 0 0 7px; color: #55c9ff; font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; line-height: 1.08; }
.subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.status-badge { padding: 5px 8px; border: 1px solid rgba(43, 183, 255, .45); border-radius: 999px; color: #8fe0ff; background: rgba(43, 183, 255, .1); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }

.presentation-button {
  width: calc(100% - 36px); margin: 0 18px 14px; padding: 9px 12px; border: 1px solid rgba(43, 183, 255, .34);
  border-radius: 10px; background: linear-gradient(135deg, rgba(23, 105, 224, .24), rgba(34, 211, 238, .1));
  color: #dff7ff; font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; cursor: pointer;
}
.presentation-button:hover { border-color: rgba(103, 232, 249, .75); background-color: rgba(43, 183, 255, .17); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 14px; border-top: 1px solid var(--panel-border); border-bottom: 1px solid var(--panel-border); }
.tab { padding: 11px 4px 9px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #738197; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.tab.is-active { border-bottom-color: var(--blue); color: #e9f8ff; }
.tab-panel { padding: 14px 18px 16px; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { padding: 10px; border: 1px solid var(--panel-border); border-radius: 10px; background: rgba(148, 163, 184, .045); }
.metric span { display: block; margin-bottom: 4px; color: #75849a; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.metric strong { color: #f4f8ff; font-size: 16px; font-variant-numeric: tabular-nums; }
.panel-note { margin: 12px 0 0; color: #8795a9; font-size: 10.5px; line-height: 1.5; }

.control-group { margin: 0; padding: 0; border: 0; }
.control-group + .control-group { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--panel-border); }
.control-group legend { width: 100%; margin-bottom: 8px; color: #738197; font-size: 9px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-button { min-height: 32px; padding: 7px; border: 1px solid rgba(148, 163, 184, .18); border-radius: 8px; background: rgba(148, 163, 184, .05); color: #9aa7ba; font-size: 10px; font-weight: 750; cursor: pointer; }
.mode-button.is-active { border-color: rgba(43, 183, 255, .55); background: rgba(43, 183, 255, .14); color: #e7f8ff; }

.legend { display: grid; gap: 8px; margin-top: 13px; padding: 11px 12px; border: 1px solid var(--panel-border); border-radius: 10px; background: rgba(3, 8, 16, .34); }
.legend > div { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; color: #c8d1df; font-size: 11px; }
.legend output { color: #7f8da1; font-size: 10px; font-variant-numeric: tabular-nums; }
.legend.is-muted { opacity: .44; }
.legend-line { width: 28px; height: 4px; border-radius: 999px; }
.legend-line.retained { background: #708096; opacity: .75; }
.legend-line.added { background: #2bb7ff; box-shadow: 0 0 9px rgba(43, 183, 255, .78); }
.legend-line.removed { height: 2px; background: repeating-linear-gradient(90deg, var(--amber) 0 6px, transparent 6px 10px); }

.compact-controls { display: grid; gap: 7px; }
.switch-row { display: flex; align-items: center; gap: 8px; min-height: 26px; color: #cbd5e1; font-size: 11px; cursor: pointer; }
.switch-row input { width: 15px; height: 15px; margin: 0; accent-color: #1da8f5; }
.switch-row span { display: flex; align-items: center; gap: 7px; }
.switch-row output { margin-left: auto; color: #708096; font-size: 10px; font-variant-numeric: tabular-nums; }
.simulation-controls { display: grid; gap: 14px; }
.simulation-row { display: grid; gap: 7px; }
.bus-key { width: 9px; height: 9px; border: 1px solid rgba(255,255,255,.8); border-radius: 3px; }
.bus-key.existing { background: #64748b; }
.bus-key.proposed { background: #198bd8; }
.speed-row { display: grid; grid-template-columns: 46px 1fr 36px; align-items: center; gap: 7px; color: #718096; font-size: 9px; }
.speed-row input { width: 100%; accent-color: #1da8f5; }
.speed-row output { color: #b9c5d4; text-align: right; font-variant-numeric: tabular-nums; }
.panel__footer { min-height: 35px; padding: 10px 18px; border-top: 1px solid var(--panel-border); color: #66758a; font-size: 9.5px; }

.bus-marker { width: 38px; height: 38px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.92); border-radius: 50%; color: white; box-shadow: 0 0 0 4px rgba(6,13,24,.58), 0 0 18px currentColor; }
.bus-marker.existing { background: #556274; }
.bus-marker.proposed { background: #168bd3; }
.bus-marker svg { width: 22px; height: 22px; }
.stop-pulse-marker { width: 30px; height: 30px; display: grid; place-items: center; pointer-events: none; }
.stop-pulse-visual {
  width: 16px;
  height: 16px;
  border: 1.5px solid #fff3cd;
  border-radius: 50%;
  background: rgba(245, 158, 11, .84);
  box-shadow: 0 0 12px rgba(245, 158, 11, .48);
  animation: stop-pulse 1.05s ease-out forwards;
}
@keyframes stop-pulse {
  0% { opacity: 0; transform: scale(.5); }
  14% { opacity: .84; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.875); }
}
@media (prefers-reduced-motion: reduce) {
  .stop-pulse-visual { animation-duration: 1ms; }
}

.presentation { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
.presentation__close { position: absolute; top: 20px; right: 20px; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(6,13,24,.84); font-size: 25px; line-height: 1; cursor: pointer; pointer-events: auto; }
.presentation-content {
  position: absolute; top: 50%; left: max(24px, 3vw); width: min(520px, calc(100vw - 48px)); max-height: calc(100vh - 170px);
  overflow: auto; padding: 24px 26px; border: 1px solid rgba(148,163,184,.2); border-left: 3px solid var(--blue);
  border-radius: 15px; background: rgba(6,13,24,.9); box-shadow: 0 18px 48px rgba(0,0,0,.42); backdrop-filter: blur(14px);
  opacity: 1; transform: translateY(-50%); transition: opacity 240ms ease, transform 240ms ease; pointer-events: auto; scrollbar-width: thin;
}
.presentation-content.is-changing { opacity: 0; transform: translateY(calc(-50% + 8px)); }
.presentation-content--hero { width: min(500px, calc(100vw - 48px)); padding: 30px 31px; }
.presentation-content--metrics { width: min(550px, calc(100vw - 48px)); }
.presentation-content--narrative { width: min(520px, calc(100vw - 48px)); }
.presentation-content--map-focus { width: min(380px, calc(100vw - 48px)); padding: 20px 22px; }
.presentation-content__eyebrow { margin: 0 0 8px; color: #69d6ff; font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.presentation-content__title { margin: 0; font-size: 29px; line-height: 1.08; letter-spacing: -.035em; text-wrap: balance; }
.presentation-content--hero .presentation-content__title { max-width: 10ch; font-size: clamp(38px, 3.4vw, 52px); }
.presentation-content--map-focus .presentation-content__title { font-size: 25px; }
.presentation-content__subtitle { margin: 8px 0 0; color: #dce8f7; font-size: 17px; font-weight: 650; }
.presentation-content__status { display: inline-block; margin: 14px 0 0; padding: 6px 9px; border: 1px solid rgba(43,183,255,.4); border-radius: 999px; color: #9de6ff; background: rgba(43,183,255,.11); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.presentation-content__narrative { margin-top: 14px; color: #a8b5c7; font-size: 13px; line-height: 1.62; }
.presentation-content__narrative p { margin: 0; }
.presentation-content__narrative p + p { margin-top: 10px; }
.presentation-content--hero .presentation-content__narrative { max-width: 42ch; font-size: 14px; }
.presentation-content--narrative .presentation-content__narrative { color: #c1cad7; font-size: 14px; line-height: 1.7; }
.presentation-content--map-focus .presentation-content__narrative { font-size: 12px; }
.content-table { width: 100%; margin-top: 16px; overflow-x: auto; }
.content-table table, .content-chart__data { width: 100%; border-collapse: collapse; font-size: 12px; }
.content-table caption { margin-bottom: 8px; color: #dce8f7; text-align: left; }
.content-table th, .content-table td, .content-chart__data th, .content-chart__data td { padding: 8px 9px; border-bottom: 1px solid rgba(148,163,184,.2); text-align: left; white-space: nowrap; }
.content-table .align-center { text-align: center; }
.content-table .align-end { text-align: right; }
.content-chart { position: relative; min-height: 260px; margin-top: 16px; }
.content-chart canvas { width: 100%; min-height: 220px; }
.content-chart__data { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.content-image { margin: 16px 0 0; }
.content-image img { display: block; width: auto; max-width: 100%; height: auto; max-height: 48vh; border-radius: 10px; }
.content-image figcaption, .content-source { display: block; margin-top: 7px; color: #8291a5; font-size: 11px; }
.content-legend { margin-top: 14px; }
.content-legend ul { display: grid; gap: 7px; margin: 8px 0 0; padding: 0; list-style: none; }
.content-legend li { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; font-size: 12px; }
.content-legend__swatch { width: 18px; height: 12px; border-radius: 3px; }
.content-legend__line { width: 26px; height: 3px; border-radius: 999px; }
.content-legend__icon { width: 24px; height: 24px; object-fit: contain; }
.presentation-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 17px; }
.presentation-metric { min-height: 78px; padding: 12px 13px; border: 1px solid rgba(148,163,184,.18); border-radius: 11px; background: rgba(148,163,184,.055); }
.presentation-metric__label { display: block; margin-bottom: 7px; color: #8190a5; font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.presentation-metric__value { display: block; color: #f4f8ff; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.presentation-metric--proposed, .presentation-metric--added { border-color: rgba(43,183,255,.28); }
.presentation-metric--proposed .presentation-metric__value, .presentation-metric--added .presentation-metric__value { color: var(--cyan); }
.presentation-metric--removed { border-color: rgba(245,158,11,.28); }
.presentation-metric--removed .presentation-metric__value { color: #fbbf24; }
.presentation-metric--retained .presentation-metric__value, .presentation-metric--existing .presentation-metric__value { color: #cbd5e1; }
.presentation-callouts { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.presentation-callout { display: grid; gap: 3px; padding: 9px 11px; border-left: 2px solid #64748b; border-radius: 0 8px 8px 0; background: rgba(148,163,184,.055); color: #aab6c7; font-size: 11px; line-height: 1.45; }
.presentation-callout strong { color: #e4ebf4; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.presentation-callout--changed { border-left-color: var(--cyan); }
.presentation-content__source { display: block; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(148,163,184,.14); color: #748297; font-size: 9px; line-height: 1.45; }
.chapter-nav { position: absolute; bottom: 24px; left: 50%; display: flex; align-items: center; gap: 12px; padding: 7px 9px; border: 1px solid rgba(148,163,184,.2); border-radius: 999px; background: rgba(6,13,24,.9); transform: translateX(-50%); pointer-events: auto; }
.chapter-nav > button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(148,163,184,.09); cursor: pointer; }
.chapter-nav > button:disabled { opacity: .28; cursor: default; }
.chapter-dots { display: flex; align-items: center; gap: 1px; }
.chapter-dot { position: relative; width: 28px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.chapter-dot::before { content: ''; position: absolute; top: 50%; right: 3px; left: 3px; height: 5px; border-radius: 999px; background: #39475a; transform: translateY(-50%); }
.chapter-dot.is-active::before { background: var(--blue); box-shadow: 0 0 8px rgba(43,183,255,.7); }
body.is-presenting .panel { opacity: 0; transform: translateX(-20px); pointer-events: none; }
body.is-presenting .maplibregl-ctrl-top-right { opacity: .35; }
body.emphasize-pois .maplibregl-map { cursor: default; }

.transport-poi-beacon {
  position: relative;
  width: 24px;
  height: 64px;
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(177, 244, 255, .38));
}
.transport-poi-beacon__pillar {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 2px;
  height: 43px;
  border-radius: 999px;
  background: linear-gradient(to top, rgba(224, 251, 255, .98), rgba(161, 238, 255, .1));
  box-shadow: 0 0 6px rgba(190, 245, 255, .58);
  transform: translateX(-50%);
  transform-origin: bottom;
  opacity: .72;
  transition: height 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}
.transport-poi-beacon__anchor {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(235, 253, 255, .95);
  border-radius: 50%;
  background: #bdefff;
  box-shadow: 0 0 0 7px rgba(155, 231, 255, .1), 0 0 12px rgba(177, 244, 255, .55);
  transform: translateX(-50%);
  transition: box-shadow 180ms ease, background 180ms ease;
}
.transport-poi-beacon.is-emphasized .transport-poi-beacon__pillar {
  height: 52px;
  opacity: 1;
  box-shadow: 0 0 10px rgba(202, 249, 255, .9);
}
.transport-poi-beacon.is-emphasized .transport-poi-beacon__anchor {
  background: #e8fdff;
  box-shadow: 0 0 0 10px rgba(155, 231, 255, .18), 0 0 18px rgba(202, 249, 255, .88);
}
@media (prefers-reduced-motion: reduce) {
  .transport-poi-beacon__pillar,
  .transport-poi-beacon__anchor { transition-duration: 1ms; }
}

.maplibregl-popup-content { border: 1px solid rgba(148,163,184,.25); border-radius: 10px; background: #0a1422; color: #e7edf6; box-shadow: 0 12px 34px rgba(0,0,0,.42); font: 600 11px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; }
.maplibregl-popup-tip { border-top-color: #0a1422 !important; }
.maplibregl-popup-content a { color: #67d8ff; }

button:focus-visible, input:focus-visible, .maplibregl-ctrl button:focus-visible { outline: 2px solid #67e8f9; outline-offset: 2px; }

@media (max-width: 760px) {
  .panel { top: 10px; left: 10px; width: min(330px, calc(100vw - 20px)); max-height: min(65vh, 590px); }
  .panel__header { padding-top: 15px; }
  h1 { font-size: 21px; }
  .maplibregl-ctrl-top-right { top: 8px; right: 8px; }
  .presentation-content, .presentation-content--hero, .presentation-content--metrics, .presentation-content--narrative, .presentation-content--map-focus {
    top: auto; bottom: 76px; left: 14px; width: calc(100vw - 28px); max-height: calc(100vh - 150px); padding: 18px 19px; transform: none;
  }
  .presentation-content.is-changing { transform: translateY(8px); }
  .presentation-content__title, .presentation-content--map-focus .presentation-content__title { font-size: 24px; }
  .presentation-content--hero .presentation-content__title { font-size: 34px; }
  .chapter-nav { gap: 5px; }
  .chapter-dot { width: 23px; }
}

@media (max-height: 800px) and (min-width: 761px) {
  .presentation-content { max-height: calc(100vh - 140px); padding: 20px 22px; }
  .presentation-content--hero { padding: 24px 26px; }
  .presentation-content--hero .presentation-content__title { font-size: 40px; }
  .presentation-content__title { font-size: 26px; }
  .presentation-content__narrative { margin-top: 11px; line-height: 1.5; }
  .presentation-metrics { margin-top: 13px; }
  .presentation-metric { min-height: 68px; padding: 10px 11px; }
  .presentation-metric__value { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

body.is-story-shell { overflow-y: auto; overflow-x: hidden; }
body.is-story-shell #map { position: fixed; inset: 0; }
body.is-story-shell .panel { display: none; }
body.is-story-shell #presentation { opacity: 0; pointer-events: none; }

.story-shell { position: relative; z-index: 7; min-height: 100svh; pointer-events: none; }
.story-shell__toolbar {
  position: fixed; z-index: 9; top: 18px; right: 18px; left: 18px;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  pointer-events: none;
}
.story-shell__toolbar > *, .story-shell__navigation { pointer-events: auto; }
.story-shell__progress { margin: 0; padding: 10px 13px; border-radius: 999px; background: var(--panel); }
.story-shell button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--panel-border); border-radius: 999px; background: var(--panel); }
.story-shell__steps { width: min(420px, calc(100vw - 48px)); margin-left: 24px; }
.story-step { min-height: 100svh; display: flex; align-items: center; padding: 96px 0; pointer-events: none; }
.story-step__content {
  position: relative; top: auto; left: auto; width: 100%; max-height: calc(100svh - 192px);
  opacity: .62; transform: translateY(8px); pointer-events: auto;
}
.story-step.is-active .story-step__content { opacity: 1; transform: none; }
.story-shell__navigation {
  position: fixed; z-index: 9; right: 18px; bottom: 18px;
  display: flex; gap: 8px;
}

@media (max-width: 760px), (max-height: 640px) {
  .story-shell__toolbar { top: 10px; right: 10px; left: 10px; }
  .story-shell__steps { width: 100%; margin: 0; }
  .story-step { min-height: 100svh; align-items: flex-start; padding: 52svh 12px 96px; }
  .story-step__content,
  .story-step__content.presentation-content--hero,
  .story-step__content.presentation-content--metrics,
  .story-step__content.presentation-content--narrative,
  .story-step__content.presentation-content--map-focus {
    width: calc(100vw - 24px); max-width: none; max-height: none; padding: 18px 19px;
  }
  .story-step__content .presentation-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-shell__navigation { right: 10px; bottom: 10px; left: 10px; justify-content: space-between; }
}

@media (pointer: coarse) {
  .story-shell button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .story-step__content, .story-step.is-active .story-step__content { transition: none; transform: none; }
}
