
.data-load-progress { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.78); overflow: visible; pointer-events: none; }
.data-load-progress > i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .18s ease; box-shadow: 0 0 8px rgba(18,109,117,.35); }
.data-load-progress > span { position: absolute; right: 10px; top: 7px; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--accent-2); box-shadow: 0 2px 9px rgba(20,50,60,.12); font-size: 9px; white-space: nowrap; }
.data-load-progress[hidden] { display: none; }

:root {
  --panel: rgba(250,252,252,.92);
  --panel-solid: #fbfdfd;
  --line: rgba(40,65,74,.14);
  --text: #263742;
  --muted: #6d7d86;
  --accent: #126d75;
  --accent-2: #0b555d;
  --shadow: 0 16px 44px rgba(21,44,55,.16);
  --radius: 18px;
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body, #map { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--text); background: #f4f7f7; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(18,109,117,.2); outline-offset: 2px; }
.glass { background: var(--panel); border: 1px solid rgba(255,255,255,.72); box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(1.08); }

.topbar { position: fixed; z-index: 20; top: 14px; left: 16px; right: 16px; min-height: 64px; border-radius: 18px; display: flex; align-items: center; gap: 14px; padding: 10px 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small, .sidebar-head small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.brand-mark { width: 31px; height: 28px; position: relative; transform: skew(-10deg); }
.brand-mark i { position: absolute; display: block; width: 6px; border-radius: 6px; background: var(--accent); bottom: 0; }
.brand-mark i:nth-child(1) { left: 2px; height: 18px; }
.brand-mark i:nth-child(2) { left: 12px; height: 27px; background: #25a2a6; }
.brand-mark i:nth-child(3) { left: 22px; height: 13px; background: #e48238; }
.menu-button { flex: 0 0 auto; }
.search-wrap { position: relative; flex: 1; max-width: 720px; margin: 0 auto; }
.search-wrap input { width: 100%; height: 43px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.72); padding: 0 42px 0 43px; color: var(--text); transition: .18s ease; }
.search-wrap input:focus { border-color: rgba(18,109,117,.55); box-shadow: 0 0 0 4px rgba(18,109,117,.1); background: #fff; }
.search-icon { position: absolute; z-index: 2; left: 15px; top: 8px; font-size: 24px; color: var(--muted); transform: rotate(-18deg); }
.clear-search { position: absolute; z-index: 2; right: 8px; top: 8px; border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 26px; cursor: pointer; }
.search-results { position: absolute; top: 51px; left: 0; right: 0; max-height: min(430px, 62vh); overflow: auto; border-radius: 14px; background: rgba(255,255,255,.98); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 6px; }
.search-result { width: 100%; border: 0; background: transparent; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; text-align: left; cursor: pointer; }
.search-result:hover, .search-result.active { background: #edf5f4; }
.result-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #e6eeef; font-size: 14px; }
.result-title { font-weight: 650; font-size: 14px; }
.result-sub { color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-tag { color: var(--muted); font-size: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; }

.text-button, .icon-button, .mini-button, .secondary-button, .segmented button { border: 0; cursor: pointer; }
.text-button { white-space: nowrap; background: #e8f0f0; color: var(--accent-2); border-radius: 11px; height: 42px; padding: 0 16px; font-weight: 650; }
.text-button:hover { background: #dceaea; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; background: transparent; color: var(--text); font-size: 22px; display: inline-grid; place-items: center; }
.icon-button:hover { background: rgba(20,50,60,.08); }

.sidebar { position: fixed; z-index: 18; top: 96px; bottom: 22px; left: 16px; width: 330px; border-radius: var(--radius); overflow: auto; padding: 16px; scrollbar-width: thin; transition: transform .22s ease, opacity .18s ease; }
.sidebar.collapsed { transform: translateX(calc(-100% - 28px)); opacity: 0; pointer-events: none; }
.sidebar-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 1px 2px 12px; border-bottom: 1px solid var(--line); }
.sidebar-head > div { display: flex; flex-direction: column; min-width: 0; }
.sidebar-head strong { font-size: 15px; }
.sidebar-head small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 245px; }
.sidebar-module { padding: 16px 1px 14px; }
.sidebar-module + .sidebar-module { border-top: 1px solid var(--line); }
.sidebar h2 { margin: 0 0 10px; color: #41515c; font-size: 11px; letter-spacing: .11em; text-transform: uppercase; font-weight: 750; }
.sidebar-tab { position: fixed; z-index: 18; top: 106px; left: 12px; border-radius: 0 13px 13px 0; border-left: 0; padding: 11px 10px 11px 12px; color: var(--accent-2); font-weight: 700; cursor: pointer; writing-mode: vertical-rl; letter-spacing: .12em; }
.sidebar-tab span { font-size: 18px; margin-top: 5px; }

.section-title-row { display: flex; justify-content: space-between; align-items: center; }
.mini-button { background: transparent; color: var(--accent); font-size: 11px; padding: 2px 0 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; min-height: 35px; cursor: pointer; font-size: 13px; }
.switch-row span { display: flex; align-items: center; gap: 9px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row > i { width: 31px; height: 18px; border-radius: 999px; background: #b7c2c8; position: relative; transition: .18s; }
.switch-row > i::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; top: 2px; left: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .18s; }
.switch-row input:checked + i { background: var(--accent); }
.switch-row input:checked + i::after { transform: translateX(13px); }
.legend-line { display: inline-block; width: 24px; height: 5px; border-radius: 4px; background: #60707d; box-shadow: 0 0 0 2px #fff; }
.legend-line.service { background: linear-gradient(90deg,#ef4444,#f59e0b,#10b981,#3b82f6,#8b5cf6); }
.legend-line.intercity { background: #00a6b2; }
.legend-line.national { background: #e64848; }
.legend-line.tram { background: #8d5ac7; }
.legend-line.construction { background: repeating-linear-gradient(90deg,#8a9298 0 5px,transparent 5px 9px); box-shadow: none; }
.legend-line.minor { height: 2px; background: #82909a; box-shadow: none; }
.legend-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

.display-options { margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.46); overflow: hidden; }
.display-options summary { cursor: pointer; padding: 10px 11px; font-size: 12px; font-weight: 680; list-style: none; }
.display-options summary::-webkit-details-marker { display: none; }
.display-options summary::after { content: "+"; float: right; color: var(--muted); font-size: 17px; line-height: 14px; }
.display-options[open] summary::after { content: "−"; }
.display-options[open] summary { border-bottom: 1px solid var(--line); }
.control-row { display: block; padding: 9px 11px 5px; }
.control-row > span { display: flex; justify-content: space-between; color: #4c5e68; font-size: 11px; margin-bottom: 5px; }
.control-row output { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.control-row input[type="range"] { width: 100%; height: 18px; accent-color: var(--accent); cursor: pointer; }
.select-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 11px; color: #4c5e68; font-size: 11px; }
.select-row select { max-width: 145px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; background: #fff; color: var(--text); }
.style-divider { margin: 7px 11px 2px; padding-top: 9px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.update-row { margin-top: 11px; display: grid; grid-template-columns: 118px 1fr; gap: 9px; align-items: center; }
.secondary-button { min-height: 36px; border-radius: 10px; background: #e8edef; color: var(--text); font-weight: 650; font-size: 11px; }
.secondary-button:hover { background: #dce5e7; }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.update-status { color: var(--muted); font-size: 9px; line-height: 1.35; }
.update-status[data-state="ok"] { color: var(--accent); }
.update-status[data-state="error"] { color: #b25548; }

.segmented { background: #e8edef; padding: 3px; border-radius: 11px; display: grid; grid-template-columns: repeat(2,1fr); margin-bottom: 7px; }
.segmented button { border-radius: 8px; padding: 8px 4px; background: transparent; font-size: 12px; }
.segmented button.active { background: #fff; box-shadow: 0 2px 7px rgba(20,50,60,.12); font-weight: 650; }
.module-note { color: var(--muted); font-size: 9px; line-height: 1.55; margin: 8px 11px 0; }

.status-toast { position: fixed; z-index: 30; left: 50%; bottom: 26px; transform: translateX(-50%); border-radius: 13px; padding: 10px 15px; font-size: 12px; max-width: min(520px, calc(100vw - 32px)); text-align: center; }
.backdrop { position: fixed; z-index: 17; inset: 0; background: rgba(13,27,34,.28); }
.about-dialog { border: 0; padding: 0; background: transparent; width: min(700px, calc(100vw - 26px)); max-height: calc(100vh - 30px); }
.about-dialog::backdrop { background: rgba(13,27,34,.38); backdrop-filter: blur(3px); }
.dialog-card { margin: 0; border-radius: 20px; background: var(--panel-solid); box-shadow: 0 30px 80px rgba(10,25,35,.3); overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.dialog-head > div { display: flex; flex-direction: column; }
.dialog-head small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.dialog-body { padding: 18px 22px 24px; overflow: auto; max-height: calc(100vh - 130px); }
.dialog-body h3 { margin: 10px 0 5px; font-size: 14px; }
.dialog-body p { margin: 0 0 10px; font-size: 12px; line-height: 1.75; color: #50606b; }
.dialog-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.dialog-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dialog-links a { color: var(--accent-2); background: #e7efef; text-decoration: none; font-size: 12px; padding: 8px 10px; border-radius: 9px; }

.maplibregl-ctrl-top-right { top: 91px; right: 15px; }
.maplibregl-ctrl-bottom-right { right: 9px; }
.maplibregl-ctrl-scale { border-color: #35444e; color: #263742; background: rgba(255,255,255,.78); }
.maplibregl-popup-content { border-radius: 13px; box-shadow: var(--shadow); padding: 13px 15px; font-family: inherit; min-width: 190px; }
.popup-title { font-weight: 750; font-size: 14px; margin-bottom: 5px; }
.popup-meta { color: var(--muted); font-size: 11px; line-height: 1.55; }
.popup-chip { display: inline-block; color: #fff; border-radius: 999px; font-size: 10px; padding: 2px 7px; margin: 6px 3px 0 0; }

@media (min-width: 761px) {
  body:not(.sidebar-collapsed) .menu-button { display: none; }
}

@media (max-width: 760px) {
  .topbar { top: 8px; left: 8px; right: 8px; min-height: 58px; padding: 7px; gap: 7px; flex-wrap: wrap; }
  .brand { min-width: 0; flex: 1; }
  .brand small { display: none; }
  .brand strong { font-size: 15px; }
  .brand-mark { width: 24px; transform: scale(.86) skew(-10deg); }
  .text-button { width: 38px; overflow: hidden; padding: 0; color: transparent; position: relative; }
  .text-button::after { content: "ⓘ"; color: var(--accent-2); position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; }
  .search-wrap { order: 4; flex-basis: 100%; max-width: none; }
  .search-wrap input { height: 40px; }
  .search-icon, .clear-search { top: 6px; }
  .search-results { top: 45px; }
  .sidebar { top: 8px; bottom: 8px; left: 8px; width: min(340px, calc(100vw - 16px)); transform: translateX(calc(-100% - 20px)); opacity: 1; transition: transform .22s ease; z-index: 25; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(calc(-100% - 20px)); opacity: 1; pointer-events: auto; }
  .sidebar-tab { display: none; }
  .backdrop:not([hidden]) { display: block; }
  .maplibregl-ctrl-top-right { top: 128px; right: 7px; }
  .status-toast { bottom: 14px; }
}

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

#map,
#map:fullscreen,
#map:-webkit-full-screen,
#map .maplibregl-canvas-container,
#map .maplibregl-canvas { background: #f4f7f7 !important; }
#map::backdrop { background: #f4f7f7; }
