:root {
  color-scheme: light;
  --ink: #12201d;
  --muted: #6e7b77;
  --hairline: rgba(24, 48, 42, 0.1);
  --paper: #f7f9f6;
  --green: #0b5c4a;
  --lime: #d9f46f;
  --sidebar-width: 390px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: minmax(0, 1fr); width: 100vw; height: 100vh; }
.sidebar { position: relative; z-index: 900; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; overflow: hidden; background: rgba(250, 251, 248, .98); border-right: 1px solid var(--hairline); box-shadow: 18px 0 50px rgba(24, 48, 42, .07); }
.brand-block { display: flex; align-items: center; gap: 13px; padding: 24px 25px 18px; }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--green); box-shadow: 0 7px 18px rgba(11, 92, 74, .24); transform: rotate(-2deg); }
.brand-mark span { display: block; width: 5px; border-radius: 5px; background: var(--lime); }
.brand-mark span:nth-child(1) { height: 12px; }.brand-mark span:nth-child(2) { height: 21px; }.brand-mark span:nth-child(3) { height: 16px; }
.eyebrow, .section-kicker { margin: 0 0 2px; color: #88938f; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.brand-block h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 600; letter-spacing: -.03em; }

.city-switcher { display: flex; align-items: stretch; gap: 7px; margin: 0 20px 18px; }
.city-switcher label { position: relative; display: grid; flex: 1; padding: 7px 35px 7px 12px; border: 1px solid var(--hairline); border-radius: 12px; background: #fff; box-shadow: 0 3px 13px rgba(25,50,43,.05); }
.city-select-label { color: #899590; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.city-switcher select { width: 100%; margin-top: 1px; border: 0; outline: 0; appearance: none; color: var(--ink); background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; }
.city-switcher label svg { position: absolute; top: 50%; right: 11px; width: 17px; fill: none; stroke: #76837e; stroke-width: 1.8; transform: translateY(-50%); }
.city-total { display: grid; place-items: center; width: 45px; border-radius: 12px; color: #dff47c; background: var(--green); font: 600 17px Georgia, serif; box-shadow: 0 5px 15px rgba(11,92,74,.18); }

.city-intro { display: flex; align-items: center; justify-content: space-between; padding: 0 25px 14px; }
.city-intro h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 34px; font-weight: 500; letter-spacing: -.04em; }
.city-intro p:last-child { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.city-actions { display: flex; align-items: center; gap: 7px; }
.archive-button { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid rgba(11,92,74,.16); border-radius: 17px; color: var(--green); background: #eef7f3; cursor: pointer; font-size: 9px; font-weight: 800; white-space: nowrap; }
.archive-button svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--hairline); border-radius: 50%; background: #fff; cursor: pointer; }
.icon-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 25px 18px; padding: 13px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.stats-row div { display: flex; flex-direction: column; align-items: center; gap: 2px; border-right: 1px solid var(--hairline); }
.stats-row div:last-child { border: 0; }
.stats-row strong { font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.stats-row span { color: var(--muted); font-size: 9px; }

.controls-panel { padding: 0 20px 14px; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 40px; border: 1px solid var(--hairline); border-radius: 11px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: rgba(11, 92, 74, .4); box-shadow: 0 0 0 3px rgba(11, 92, 74, .08); }
.search-box svg { width: 16px; fill: none; stroke: #8c9793; stroke-width: 1.7; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box kbd { padding: 2px 5px; border: 1px solid #dfe4df; border-radius: 4px; color: #a0aaa6; background: #f6f8f5; font: 9px ui-monospace, monospace; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.filter-chip { display: flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--hairline); border-radius: 99px; background: #fff; color: #7d8985; cursor: pointer; font-size: 10px; font-weight: 700; }
.filter-chip i { flex: 0 0 auto; }
.filter-chip.active { border-color: rgba(11, 92, 74, .2); color: var(--green); background: #edf7f3; }
.list-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 25px 10px; color: #7f8c87; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.list-heading button { border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: 10px; letter-spacing: 0; }

.line-list { min-height: 0; flex: 1; overflow: auto; padding: 0 14px 14px; scrollbar-width: thin; scrollbar-color: #d1d8d3 transparent; }
.line-card { display: grid; grid-template-columns: 39px 1fr auto; align-items: center; gap: 11px; width: 100%; margin-bottom: 5px; padding: 10px; border: 1px solid transparent; border-radius: 13px; background: transparent; text-align: left; cursor: pointer; transition: .18s ease; }
.line-card:hover { border-color: var(--hairline); background: #fff; box-shadow: 0 4px 16px rgba(25, 50, 43, .06); }
.line-card.active { border-color: rgba(11, 92, 74, .14); background: #fff; box-shadow: 0 5px 20px rgba(25, 50, 43, .09); }
.line-badge { display: grid; place-items: center; min-height: 34px; padding: 3px; border-radius: 9px; color: #fff; font-size: 10px; font-weight: 900; line-height: 1; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.line-copy { min-width: 0; }
.line-copy strong { display: block; overflow: hidden; color: #24312d; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.line-copy small { display: block; overflow: hidden; margin-top: 3px; color: #8a9591; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.line-count { color: #9ba5a1; font-size: 9px; white-space: nowrap; }
.loading-card, .empty-state { display: flex; align-items: center; gap: 12px; margin: 12px 10px; padding: 18px; border: 1px dashed rgba(11, 92, 74, .2); border-radius: 14px; background: rgba(255,255,255,.7); }
.loading-card strong, .loading-card small { display: block; }.loading-card strong { font-size: 11px; }.loading-card small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.empty-state { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); }
.empty-state button { margin-top: 10px; padding: 7px 12px; border: 0; border-radius: 8px; background: var(--green); color: white; cursor: pointer; font-size: 10px; }
.spinner { width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid #dbe4df; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }.spinner.small { width: 13px; height: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-footer { display: flex; align-items: center; gap: 6px; padding: 11px 20px; border-top: 1px solid var(--hairline); color: #9aa5a0; font-size: 9px; }
.sidebar-footer a { margin-left: auto; color: #7f8c87; text-decoration: none; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #3ab27b; box-shadow: 0 0 0 3px rgba(58, 178, 123, .13); }

.map-stage { position: relative; min-width: 0; min-height: 0; height: 100vh; overflow: hidden; background: #e7ebe7; }
#map { position: absolute; inset: 0; background: #e8ece8; }
body[data-basemap="osm"] .leaflet-tile-pane { filter: saturate(.72) contrast(.94) brightness(1.035); }
body[data-basemap="positron"] .leaflet-tile-pane { filter: saturate(.82) contrast(.96); }
body[data-basemap="dark"] .leaflet-tile-pane { filter: saturate(.75) contrast(1.05); }
.leaflet-control-attribution { padding: 3px 7px !important; border-radius: 7px 0 0 0; background: rgba(255,255,255,.86) !important; color: #6f7c77 !important; font-size: 9px !important; backdrop-filter: blur(10px); }
.leaflet-control-attribution a { color: #4d6c62 !important; }
.leaflet-control-zoom { overflow: hidden; border: 0 !important; border-radius: 12px !important; box-shadow: 0 5px 20px rgba(22, 48, 41, .14) !important; }
.leaflet-control-zoom a { width: 34px !important; height: 34px !important; color: var(--ink) !important; line-height: 32px !important; border-color: var(--hairline) !important; }
.transit-line { cursor: pointer; transition: opacity .18s; }
.station-dot { transition: opacity .18s; }
.station-popup .leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 12px 36px rgba(20, 43, 37, .2); }
.station-popup .leaflet-popup-content { margin: 13px 15px; }
.popup-kicker { color: #84908c; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.popup-title { margin: 3px 0 7px; color: var(--ink); font-size: 13px; }.popup-lines { display: flex; flex-wrap: wrap; gap: 4px; }
.popup-line { padding: 3px 6px; border-radius: 5px; color: white; font-size: 8px; font-weight: 800; }

.glass-panel { border: 1px solid rgba(255,255,255,.75); background: rgba(251, 253, 250, .84); box-shadow: 0 9px 32px rgba(23, 49, 42, .14); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); }
.map-topbar { position: absolute; z-index: 700; top: 18px; left: 20px; right: 64px; display: flex; align-items: center; min-height: 58px; padding: 8px 10px 8px 15px; border-radius: 16px; }
.mobile-menu { display: none; width: 34px; height: 34px; border: 0; background: transparent; }.mobile-menu svg { fill: none; stroke: currentColor; stroke-width: 1.8; }
.location-label { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.location-label div { display: flex; flex-direction: column; }.location-label small { color: #84918d; font-size: 9px; }.location-label strong { margin-top: 1px; font-family: Georgia, serif; font-size: 16px; font-weight: 500; }
.location-pulse { position: relative; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #e0554d; box-shadow: 0 0 0 3px rgba(224, 85, 77, .16); }
.topbar-separator { align-self: stretch; width: 1px; margin: 3px 16px; background: var(--hairline); }
.network-summary { flex: 1; color: #65736e; font-size: 11px; }
.layer-button { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--hairline); border-radius: 10px; background: rgba(255,255,255,.68); cursor: pointer; font-size: 10px; font-weight: 700; }
.layer-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.layer-button[aria-pressed="true"] { border-color: rgba(11,92,74,.25); color: var(--green); background: #e9f5f0; }

.map-legend { position: absolute; z-index: 700; left: 20px; bottom: 24px; width: 176px; padding: 12px 14px; border-radius: 14px; }
.legend-title { display: flex; justify-content: space-between; color: #7c8984; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }.legend-title button { border: 0; background: transparent; cursor: pointer; }
.legend-items { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; margin-top: 10px; }
.legend-items span { display: flex; align-items: center; gap: 7px; color: #51605b; font-size: 9px; }
.legend-line { width: 16px; height: 4px; border-radius: 4px; background: var(--green); }.legend-line.light-rail { background: #d77434; }.legend-line.tram { background: #7d62a8; }
.legend-station { width: 8px; height: 8px; border: 2px solid var(--green); border-radius: 50%; background: white; }
.map-legend.collapsed { width: auto; }.map-legend.collapsed .legend-items { display: none; }

.line-detail { position: absolute; z-index: 710; right: 24px; bottom: 24px; display: grid; grid-template-columns: 54px minmax(170px, 1fr) auto; align-items: center; gap: 14px; width: min(520px, calc(100% - 240px)); padding: 15px 18px; border-radius: 18px; }
.line-detail[hidden] { display: none; }
.detail-close { position: absolute; top: 6px; right: 8px; width: 24px; height: 24px; border: 0; background: transparent; color: #84908c; cursor: pointer; font-size: 18px; }
.detail-route-badge { display: grid; place-items: center; width: 52px; height: 52px; padding: 4px; border-radius: 14px; background: var(--green); color: white; font-size: 13px; font-weight: 900; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.detail-copy { min-width: 0; }.detail-copy p { margin: 0 0 2px; color: #87938f; font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }.detail-copy h3 { overflow: hidden; margin: 0; font: 500 19px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.detail-journey { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #65736e; font-size: 9px; }.detail-journey i { min-width: 18px; height: 1px; flex: 1; background: #b9c3bf; }.detail-journey span { overflow: hidden; max-width: 110px; text-overflow: ellipsis; white-space: nowrap; }
.detail-meta { display: flex; padding-right: 16px; }.detail-meta div { min-width: 56px; padding: 0 10px; border-left: 1px solid var(--hairline); text-align: center; }.detail-meta strong,.detail-meta span { display: block; }.detail-meta strong { overflow: hidden; max-width: 85px; font-family: Georgia, serif; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }.detail-meta span { margin-top: 2px; color: #8b9692; font-size: 8px; }
.map-status { position: absolute; z-index: 720; top: 90px; left: 50%; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 99px; color: #586660; font-size: 10px; transform: translateX(-50%); transition: opacity .25s, transform .25s; }.map-status.done { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }.map-status.error { color: #9e413b; background: rgba(255,244,242,.93); }
.scrim { display: none; }

/* Transport modes use both shape and line pattern, so they remain distinct without colour. */
.mode-glyph { position: relative; display: inline-block; width: 18px; height: 8px; }
.mode-glyph::after { content: ""; position: absolute; top: 50%; right: 0; left: 0; height: 3px; border-radius: 4px; background: #87938e; transform: translateY(-50%); }
.mode-train::after { background: repeating-linear-gradient(90deg, #256a62 0 6px, transparent 6px 9px); }
.mode-subway::after { height: 4px; background: #176d91; }
.mode-light_rail::after { height: 5px; border-top: 2px solid #d4772f; border-bottom: 1px solid #d4772f; border-radius: 0; background: transparent; }
.mode-tram::after { height: 2px; border-radius: 3px; background: #7d57a4; }
.filter-chip:not(.active) .mode-glyph { filter: grayscale(1); opacity: .55; }

.line-card { grid-template-columns: 42px 1fr auto; }
.line-card.active { border-color: color-mix(in srgb, var(--green) 24%, transparent); box-shadow: 0 6px 24px rgba(18,50,42,.12); }
.line-badge { position: relative; min-height: 36px; background: var(--line-color); }
.mode-card-train { border: 2px solid #fff; border-radius: 7px; outline: 1px solid var(--line-color); }
.mode-card-train::after { content: ""; position: absolute; right: 4px; bottom: 4px; left: 4px; border-bottom: 2px dashed rgba(255,255,255,.78); }
.mode-card-subway { border-radius: 50%; }
.mode-card-light_rail { border-radius: 5px 12px 5px 12px; }
.mode-card-tram { width: 34px; min-height: 34px; justify-self: center; border: 2px solid var(--line-color); border-radius: 8px; color: var(--line-color); background: #fff; text-shadow: none; }
.line-mode-label { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; color: #87928e; font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.line-mode-label .mode-glyph { width: 14px; transform: scale(.78); transform-origin: left center; }

.transit-station-icon { display: grid !important; place-items: center; border: 0 !important; background: transparent !important; transition: opacity .18s; }
.transit-station-icon span { display: block; width: 8px; height: 8px; border: 1.5px solid #fff; background: var(--station-color); box-shadow: 0 1px 4px rgba(17,40,34,.3); transition: transform .2s, box-shadow .2s; }
.station-train span { border-radius: 1px; transform: rotate(45deg); }
.station-subway span { border-radius: 50%; }
.station-light_rail span { border: 2px solid var(--station-color); border-radius: 50%; background: #fff; }
.station-tram span { width: 7px; height: 7px; border-radius: 1px; }
.transit-station-icon.selected-station span { width: 11px; height: 11px; border-width: 2px; border-color: #fff; background: var(--selected-color, var(--station-color)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--selected-color, #155f52) 30%, transparent), 0 2px 8px rgba(0,0,0,.24); }
.station-light_rail.selected-station span { border-color: var(--selected-color); background: #fff; }

.popup-line { padding: 4px 7px; border: 0; border-radius: 5px; color: white; background: var(--badge-color); cursor: pointer; font-size: 8px; font-weight: 900; }

.map-actions { display: flex; gap: 7px; }
.basemap-menu { position: absolute; z-index: 730; top: 88px; right: 64px; width: 260px; padding: 13px; border-radius: 16px; }
.basemap-menu[hidden] { display: none; }
.basemap-menu > p { margin: 0 0 8px 3px; color: #7a8782; font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.basemap-menu > small { display: block; padding: 8px 4px 1px; color: #8a9691; font-size: 8px; line-height: 1.5; }
.basemap-option { display: grid; grid-template-columns: 42px 1fr 16px; align-items: center; gap: 9px; width: 100%; padding: 7px; border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left; cursor: pointer; }
.basemap-option:hover { background: rgba(255,255,255,.72); }
.basemap-option.active { border-color: rgba(11,92,74,.15); background: #edf6f2; }
.basemap-option span { min-width: 0; }.basemap-option strong,.basemap-option small { display: block; }.basemap-option strong { font-size: 10px; }.basemap-option small { margin-top: 2px; color: #88938f; font-size: 8px; }
.basemap-option b { visibility: hidden; color: var(--green); font-size: 12px; }.basemap-option.active b { visibility: visible; }
.basemap-preview { display: block; width: 42px; height: 32px; border: 1px solid rgba(25,50,43,.1); border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.preview-osm { background: linear-gradient(145deg,#dbe8cf,#f3e6c8 55%,#b8dce8); }
.preview-positron { background: linear-gradient(145deg,#f8f9f7,#e9ece9 54%,#d9e4e8); }
.preview-voyager { background: linear-gradient(145deg,#dfe9dc,#f3e5d5 48%,#b9dfe3); }
.preview-dark { background: linear-gradient(145deg,#202728,#364043 52%,#182d35); }
.preview-topo { background: repeating-radial-gradient(ellipse at 60% 20%,#d7e2c1 0 4px,#c6d6ae 5px 7px,#f1e4c3 8px 12px); }

.map-legend { width: 220px; }
.legend-items { grid-template-columns: 1fr 1fr; gap: 10px 13px; }
.legend-line { width: 25px; height: 5px; border-radius: 0; }
.legend-line.commuter { background: repeating-linear-gradient(90deg,#256a62 0 8px,transparent 8px 12px); }
.legend-line.subway { height: 5px; border-radius: 5px; background: #176d91; }
.legend-line.light-rail { height: 6px; border-top: 2px solid #d4772f; border-bottom: 1px solid #d4772f; background: transparent; }
.legend-line.tram { height: 2px; border-radius: 3px; background: #7d57a4; }
.legend-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline); color: #929c98; font-size: 8px; }
.map-legend.collapsed .legend-note { display: none; }

.line-detail { grid-template-columns: 62px minmax(0,1fr); align-items: start; width: min(650px, calc(100% - 270px)); padding: 17px 20px; }
.detail-main { min-width: 0; }
.detail-route-badge { width: 58px; height: 58px; background: var(--line-color); }
.detail-copy p { display: flex; align-items: center; gap: 7px; }
.detail-mode-swatch { display: inline-block; width: 23px; height: 5px; background: var(--line-color); }
.swatch-train { background: repeating-linear-gradient(90deg,#256a62 0 7px,transparent 7px 10px); }
.swatch-subway { border-radius: 5px; background: #176d91; }
.swatch-light_rail { height: 6px; border-top: 2px solid #d4772f; border-bottom: 1px solid #d4772f; background: transparent; }
.swatch-tram { height: 2px; border-radius: 3px; background: #7d57a4; }
.detail-meta { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px 0; margin-top: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.detail-meta div { min-width: 0; padding: 0 10px; border-left: 1px solid var(--hairline); text-align: left; }.detail-meta div:first-child { padding-left: 0; border-left: 0; }
.detail-meta strong { max-width: 120px; font-family: inherit; font-size: 10px; font-weight: 750; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 9px; }
.detail-footer a { color: var(--green); font-size: 8px; font-weight: 700; text-decoration: none; }
.focus-indicator { display: flex; align-items: center; gap: 6px; color: #788580; font-size: 8px; }.focus-indicator i { width: 6px; height: 6px; border-radius: 50%; background: #38a976; box-shadow: 0 0 0 3px rgba(56,169,118,.13); }

.city-archive { position: absolute; z-index: 840; inset: 0 0 0 auto; width: min(760px, calc(100% - 64px)); color: var(--ink); background: rgba(248,250,247,.985); box-shadow: -24px 0 70px rgba(15,38,31,.2); backdrop-filter: blur(22px); }
.city-archive[hidden] { display: none; }
.archive-header { display: flex; align-items: center; justify-content: space-between; gap: 30px; min-height: 116px; padding: 24px 34px; border-bottom: 1px solid var(--hairline); background: linear-gradient(120deg,rgba(218,244,111,.18),transparent 45%); }
.archive-kicker { margin: 0 0 6px; color: #7d8b86; font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.archive-header h2 { margin: 0; font: 500 31px Georgia, "Songti SC", serif; letter-spacing: -.035em; }
.archive-header > div > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.archive-header button { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--hairline); border-radius: 50%; color: #6f7d78; background: #fff; cursor: pointer; font-size: 22px; }
.archive-scroll { height: calc(100vh - 116px); overflow: auto; padding: 8px 34px 36px; }
.archive-scroll section { padding: 26px 0; border-bottom: 1px solid var(--hairline); }
.archive-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.archive-section-heading > div { display: flex; align-items: center; gap: 10px; }
.archive-section-heading span { color: #a4afaa; font: italic 12px Georgia, serif; }
.archive-section-heading h3 { margin: 0; font: 500 20px Georgia, "Songti SC", serif; }
.archive-section-heading small { color: #909b97; font-size: 8px; text-align: right; }
.archive-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--hairline); border-radius: 15px; background: #fff; overflow: hidden; }
.archive-stat { min-width: 0; padding: 15px; border-left: 1px solid var(--hairline); }
.archive-stat:first-child { border-left: 0; }
.archive-stat strong,.archive-stat span { display: block; }.archive-stat strong { overflow: hidden; font: 500 21px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }.archive-stat span { margin-top: 4px; color: #87938e; font-size: 8px; }
.archive-operators { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.archive-network-chip { padding: 6px 9px; border: 1px solid rgba(11,92,74,.12); border-radius: 99px; color: #436259; background: #eef6f2; font-size: 9px; }
.archive-copy { color: #42514c; font-size: 12px; line-height: 1.75; }
.archive-copy.loading { display: flex; align-items: center; gap: 10px; }
.archive-copy p { margin: 0; }.archive-copy a { display: inline-block; margin-top: 12px; color: var(--green); font-size: 10px; font-weight: 800; text-decoration: none; }
.archive-gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.archive-gallery-loading { grid-column: 1/-1; display: flex; align-items: center; gap: 10px; min-height: 120px; color: var(--muted); font-size: 11px; }
.archive-photo { overflow: hidden; border: 1px solid var(--hairline); border-radius: 13px; background: #fff; }
.archive-photo a { display: block; color: inherit; text-decoration: none; }
.archive-photo img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #e5eae6; transition: transform .25s ease; }.archive-photo:hover img { transform: scale(1.025); }
.archive-photo figcaption { min-height: 82px; padding: 9px 10px 10px; }
.archive-photo strong { display: -webkit-box; overflow: hidden; font-size: 9px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.archive-photo small { display: block; overflow: hidden; margin-top: 5px; color: #87938e; font-size: 7.5px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.archive-empty { grid-column: 1/-1; padding: 22px; border: 1px dashed rgba(11,92,74,.2); border-radius: 13px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.archive-sources { padding: 18px 0 0; color: #929d99; font-size: 8px; line-height: 1.65; }

body[data-basemap="dark"] .glass-panel { border-color: rgba(255,255,255,.18); background: rgba(27,35,35,.84); color: #eef5f1; }
body[data-basemap="dark"] .network-summary, body[data-basemap="dark"] .location-label small, body[data-basemap="dark"] .legend-items span, body[data-basemap="dark"] .legend-note, body[data-basemap="dark"] .detail-journey { color: #bdc9c4; }
body[data-basemap="dark"] .layer-button { border-color: rgba(255,255,255,.16); color: #eef5f1; background: rgba(255,255,255,.08); }
body[data-basemap="dark"] .leaflet-control-zoom a { color: #eef5f1 !important; background: #252e2e !important; }

@media (max-width: 900px) {
  :root { --sidebar-width: 340px; }
  .map-topbar { right: 16px; }
  .network-summary, .topbar-separator { display: none; }
  .line-detail { width: min(450px, calc(100% - 48px)); }
  .city-archive { width: min(680px, calc(100% - 30px)); }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: absolute; inset: 0 auto 0 0; width: min(88vw, 370px); transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .map-stage { width: 100%; height: 100%; }
  .mobile-menu { display: block; flex: 0 0 auto; }
  .map-topbar { top: 12px; left: 12px; right: 12px; min-height: 52px; padding-left: 8px; }
  .location-label { min-width: 0; flex: 1; }
  .layer-button span { display: none; }
  .map-legend { left: 12px; bottom: 12px; }
  .line-detail { right: 12px; bottom: 12px; left: 12px; width: auto; grid-template-columns: 46px 1fr; padding: 12px; }
  .detail-route-badge { width: 44px; height: 44px; }
  .detail-meta { display: none; }
  .archive-button span { display: none; }
  .archive-button { width: 34px; padding: 0; justify-content: center; }
  .city-archive { width: 100%; }
  .archive-header { min-height: 102px; padding: 20px; }
  .archive-header h2 { font-size: 25px; }
  .archive-scroll { height: calc(100vh - 102px); padding: 5px 20px 28px; }
  .archive-section-heading { align-items: start; flex-direction: column; gap: 5px; }
  .archive-section-heading small { text-align: left; }
  .archive-stats { grid-template-columns: 1fr 1fr; }
  .archive-stat:nth-child(3) { border-top: 1px solid var(--hairline); border-left: 0; }
  .archive-stat:nth-child(4) { border-top: 1px solid var(--hairline); }
  .archive-gallery { grid-template-columns: 1fr 1fr; }
  .map-legend:has(+ .line-detail:not([hidden])) { display: none; }
  .scrim { position: absolute; z-index: 850; inset: 0; display: block; background: rgba(18,32,29,.28); opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(2px); }
  .scrim.show { opacity: 1; pointer-events: auto; }
}
