:root {
  color-scheme: light;
  --ink: #172235;
  --ink-soft: #526074;
  --paper: #f5f2eb;
  --glass: rgba(255, 255, 255, 0.88);
  --acid: #cbff27;
  --line-1: #149957;
  --line-2: #e63b49;
  --line-3: #1684d8;
  --shadow: 0 20px 60px rgba(18, 31, 47, 0.15);
  --radius-xl: 28px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

button,
input { font: inherit; }

button { color: inherit; }

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background: #dfe6df;
}

#map {
  position: absolute;
  inset: 0;
  background: #dfe6df;
}

.map-wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 110px rgba(52, 62, 70, 0.12);
}

.topbar {
  position: absolute;
  z-index: 10;
  top: max(18px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: auto minmax(280px, 600px) auto 92px;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand {
  border: 0;
  padding: 0 17px;
  min-height: 48px;
  display: flex;
  align-items: center;
  background: rgba(23, 34, 53, 0.96);
  color: white;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(23, 34, 53, 0.18);
  cursor: pointer;
  transition: color .35s ease, transform .2s ease;
}

.brand-copy {
  display: flex;
  gap: 6px;
  align-items: baseline;
  letter-spacing: -0.03em;
}

.brand strong,
.brand em { font-size: 13px; font-weight: 850; font-style: normal; }
.brand strong { color: white; }
.brand em { color: var(--acid); transition: color .35s ease; }
.brand.is-notes em { color: #ff8a24; }
.brand.is-notes em { animation: brand-word-in .35s cubic-bezier(.2,.9,.25,1.2); }

@keyframes brand-word-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-wrap { position: relative; min-width: 0; }

.search {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid rgba(23, 34, 53, 0.08);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.25);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(23, 34, 53, 0.12);
}

.search:focus-within { outline: 3px solid rgba(203, 255, 39, 0.55); }

.search svg,
.top-actions svg,
.sheet-stats svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.search input::placeholder { color: #7b8491; }

.search kbd {
  padding: 4px 7px;
  color: #7a8492;
  background: rgba(23, 34, 53, 0.06);
  border: 1px solid rgba(23, 34, 53, 0.08);
  border-radius: 7px;
  font-size: 11px;
  white-space: nowrap;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-result {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible { background: #f1f4ed; outline: 0; }
.search-result__dot { width: 12px; height: 12px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px rgba(23,34,53,.22); }
.search-result span:nth-child(2) { flex: 1; min-width: 0; }
.search-result strong { display: block; font-size: 14px; }
.search-result small { display: block; margin-top: 2px; color: #7a8492; }
.search-result b { font-size: 11px; color: #8a94a2; }

.top-actions { display: flex; gap: 8px; }

.action-button {
  height: 48px;
  border: 0;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  box-shadow: 0 9px 26px rgba(23, 34, 53, 0.11);
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.action-button--accent { background: var(--acid); }
.action-button svg { width: 17px; height: 17px; }
.action-button:hover { transform: translateY(-1px); }

.station-count {
  justify-self: end;
  min-width: 86px;
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: white;
  background: rgba(23, 34, 53, 0.94);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(23, 34, 53, 0.15);
}

.station-count strong { color: var(--acid); font-size: 16px; }
.station-count span { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }

.layers-panel {
  position: absolute;
  z-index: 12;
  top: 84px;
  right: 118px;
  width: 320px;
  padding: 11px;
  border: 1px solid rgba(23,34,53,.08);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.layers-panel[hidden] { display: none; }

.panel-heading { padding: 7px 9px 10px; display: flex; align-items: baseline; justify-content: space-between; }
.panel-heading span { font-weight: 800; font-size: 13px; }
.panel-heading small { color: #8a94a2; font-size: 10px; }

.line-toggle {
  width: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 16px 1fr 22px;
  align-items: center;
  gap: 10px;
  border-radius: 13px;
  text-align: left;
  cursor: pointer;
}

.line-toggle:hover { background: #f2f5ef; }
.line-toggle span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.line-toggle strong { font-size: 13px; }
.line-toggle small { color: #7b8593; font-size: 10px; }
.line-toggle b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: var(--ink); color: white; font-size: 11px; }
.line-toggle:not(.is-active) { opacity: .42; }
.line-toggle:not(.is-active) b { color: transparent; background: #dfe4e6; }

.line-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.line-dot--1 { background: var(--line-1); }
.line-dot--2 { background: var(--line-2); }
.line-dot--3 { background: var(--line-3); }

.zoom-story {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px 10px 10px;
  border: 1px solid rgba(23, 34, 53, 0.08);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(23, 34, 53, 0.12);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.zoom-story.is-hidden { opacity: 0; transform: translate(-50%, 12px); }
.zoom-story__eyebrow { padding: 7px 9px; border-radius: 9px; background: var(--acid); font-size: 10px; font-weight: 850; letter-spacing: .07em; }
.zoom-story strong { font-size: 13px; }
.zoom-story > span:last-child { color: #6c7786; font-size: 12px; }

.station-sheet {
  position: absolute;
  z-index: 8;
  left: 22px;
  bottom: 24px;
  width: min(390px, calc(100vw - 44px));
  padding: 24px;
  border: 1px solid rgba(23, 34, 53, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(24px) saturate(1.25);
  box-shadow: var(--shadow);
  animation: sheet-in .42s cubic-bezier(.2,.8,.2,1) both;
}

.station-sheet[hidden] { display: none; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  background: #eef1ed;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sheet-lines { display: flex; gap: 5px; margin-bottom: 17px; }
.sheet-line-badge { width: 26px; height: 26px; display: grid; place-items: center; color: white; border-radius: 50%; font-size: 12px; font-weight: 850; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.sheet-line-badge[data-line="1"] { background: var(--line-1); }
.sheet-line-badge[data-line="2"] { background: var(--line-2); }
.sheet-line-badge[data-line="3"] { background: var(--line-3); }
.sheet-eyebrow { margin: 0 0 5px; color: #7a8492; font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.station-sheet h1 { margin: 0; padding-right: 36px; font-size: clamp(30px, 4vw, 42px); line-height: 1; letter-spacing: -.055em; }
.sheet-subtitle { margin: 9px 0 0; color: var(--ink); font-size: 14px; font-weight: 740; }
.sheet-description { margin: 11px 0 18px; color: #657183; font-size: 13px; line-height: 1.55; }

.sheet-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.sheet-stats span { padding: 8px 10px; display: flex; align-items: center; gap: 5px; background: #eef2ec; border-radius: 10px; font-size: 11px; color: #536072; }
.sheet-stats svg { width: 14px; height: 14px; }
.sheet-stats b { color: var(--ink); }

.sheet-cta { width: 100%; height: 48px; padding: 0 15px 0 17px; border: 0; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: white; font-size: 13px; font-weight: 760; cursor: pointer; }
.sheet-cta span { width: 27px; height: 27px; display: grid; place-items: center; color: var(--ink); background: var(--acid); border-radius: 9px; font-size: 17px; }
.sheet-cta:hover span { transform: translateX(2px); }

.map-legend {
  position: absolute;
  z-index: 5;
  left: 20px;
  top: 88px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(15px);
  border-radius: 13px;
  box-shadow: 0 8px 24px rgba(23,34,53,.09);
}

.map-legend > span { height: 27px; padding: 0 7px; display: flex; align-items: center; gap: 4px; border-radius: 8px; color: #687486; font-size: 10px; font-weight: 780; }
.map-legend button { height: 27px; margin-left: 4px; padding: 0 9px; border: 0; border-left: 1px solid #e0e4e0; background: transparent; color: #677385; font-size: 10px; font-weight: 700; cursor: pointer; }

.prototype-note { position: absolute; z-index: 3; right: 20px; bottom: 12px; color: rgba(23,34,53,.56); font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.prototype-note span { color: var(--line-2); }

.map-error { position: absolute; z-index: 20; inset: 50% auto auto 50%; transform: translate(-50%,-50%); max-width: 420px; padding: 18px 20px; background: white; border-radius: 16px; box-shadow: var(--shadow); text-align: center; }

.active-station-marker { width: 30px; height: 30px; }
.active-station-marker::before,
.active-station-marker::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.active-station-marker::before { background: var(--active-color, var(--line-3)); border: 5px solid white; box-shadow: 0 4px 15px rgba(23,34,53,.35); z-index: 2; }
.active-station-marker::after { background: var(--active-color, var(--line-3)); animation: node-pulse 1.8s ease-out infinite; }

@keyframes node-pulse { 0% { transform: scale(.8); opacity: .65; } 100% { transform: scale(3.4); opacity: 0; } }

.poi-marker { display: block; }
.poi-marker.is-compact .poi-node__copy { display: none; }
.poi-marker.is-compact .poi-node { padding: 6px; border-radius: 12px; }
.poi-marker.is-compact .poi-node__time { padding: 4px 5px; }
.poi-marker.is-route-focus .poi-node { box-shadow: 0 0 0 3px var(--acid), 0 14px 32px rgba(23,34,53,.22); }

.poi-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 7px;
  border: 1px solid rgba(23,34,53,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(23,34,53,.14);
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px) scale(.88);
  animation: poi-in .5s cubic-bezier(.2,.9,.25,1.15) forwards;
  animation-delay: calc(var(--order) * 70ms + 260ms);
}

.poi-node:hover { z-index: 5; transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 30px rgba(23,34,53,.2); }

@keyframes poi-in { to { opacity: 1; transform: translateY(0) scale(1); } }

.poi-node__icon { width: 31px; height: 31px; display: grid; place-items: center; color: var(--ink); background: var(--acid); border-radius: 10px; }
.poi-node__icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.poi-node__copy { display: grid; gap: 2px; text-align: left; }
.poi-node__copy strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.poi-node__copy small { color: #788391; font-size: 9px; }
.poi-node__time { padding: 5px 6px; color: white; background: var(--ink); border-radius: 8px; font-size: 10px; font-weight: 800; }

.maplibregl-popup-content { padding: 14px 16px !important; border-radius: 15px !important; box-shadow: var(--shadow) !important; color: var(--ink); }
.maplibregl-popup-content strong { display: block; margin-bottom: 4px; font-size: 13px; }
.maplibregl-popup-content > span { color: #687486; font-size: 11px; }
.popup-routes { display: grid; gap: 5px; margin-top: 11px; padding-top: 9px; border-top: 1px solid #e5e9e5; }
.popup-route { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; color: #596678; font-size: 10px; }
.popup-route i { width: 8px; height: 8px; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px rgba(23,34,53,.16); }
.popup-route b { color: var(--ink); font-size: 10px; }
.maplibregl-popup-close-button { top: 4px !important; right: 6px !important; font-size: 17px; }
.maplibregl-ctrl-bottom-right { right: 14px !important; bottom: 25px !important; }
.maplibregl-ctrl-group { border-radius: 14px !important; overflow: hidden; box-shadow: 0 8px 28px rgba(23,34,53,.14) !important; }
.maplibregl-ctrl-attrib { border-radius: 9px 0 0 0; font-size: 9px !important; }
.maplibregl-canvas:focus { outline: none; }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: auto minmax(240px, 1fr) auto; }
  .station-count { display: none; }
  .action-button { padding: 0 12px; }
  .layers-panel { right: 20px; }
}

@media (max-width: 760px) {
  .topbar { top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; grid-template-columns: auto 1fr auto; gap: 7px; }
  .brand { width: auto; height: 48px; min-height: 48px; padding: 0 10px; justify-content: center; border-radius: 15px; }
  .brand-copy { gap: 4px; }
  .brand strong,
  .brand em { font-size: 10px; }
  .search { height: 48px; padding: 0 13px; border-radius: 15px; }
  .search input { font-size: 14px; }
  .search kbd { display: none; }
  .action-button { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .action-button span,
  .action-button { font-size: 0; }
  .action-button svg { width: 19px; height: 19px; }
  .layers-trigger { display: none; }
  .map-legend { top: 69px; left: 10px; }
  .layers-panel { top: 67px; right: 10px; left: 10px; width: auto; }
  .zoom-story { bottom: 30px; max-width: calc(100vw - 24px); white-space: normal; text-align: left; }
  .zoom-story > span:last-child { display: none; }
  .station-sheet { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 20px; border-radius: 22px; max-height: 48vh; overflow: auto; }
  .station-sheet h1 { font-size: 32px; }
  .sheet-description { display: none; }
  .prototype-note { display: none; }
  .maplibregl-ctrl-bottom-right { bottom: 18px !important; right: 8px !important; }
  .maplibregl-ctrl-attrib { display: none; }
  .poi-node { padding: 6px; border-radius: 12px; }
  .poi-node__copy { display: none; }
  .poi-node__time { padding: 4px 5px; }
}

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