:root {
  --ink: #10251d;
  --ink-soft: #34493f;
  --muted: #708179;
  --faint: #93a29b;
  --accent: #0e7a5f;
  --accent-strong: #075c46;
  --accent-bright: #1eaa80;
  --accent-soft: #e2f5ed;
  --amber: #d47b12;
  --amber-soft: #fdf1de;
  --blue: #1b6ca8;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --bg: #eef4f0;
  --line: #dce7e1;
  --shadow-sm: 0 1px 2px rgba(16, 37, 29, .05), 0 8px 24px rgba(16, 37, 29, .06);
  --shadow-lg: 0 2px 8px rgba(16, 37, 29, .06), 0 24px 60px rgba(16, 37, 29, .12);
  --radius-lg: 26px;
  --radius-md: 18px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 8% -10%, #dff2e8 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e8f0e9 0%, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */

.topbar {
  height: 78px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  position: relative;
  z-index: 900;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #118565, #075c46);
  box-shadow: 0 8px 18px rgba(7, 92, 70, .25), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  fill: #fff;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 18px; letter-spacing: .02em; }
.brand-text small { margin-top: 5px; font-size: 11px; color: var(--muted); letter-spacing: .08em; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 460px;
  max-width: 520px;
  height: 46px;
  padding: 0 7px 0 14px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(16, 37, 29, .06), inset 0 0 0 1px rgba(16, 37, 29, .03);
  backdrop-filter: blur(14px);
  transition: box-shadow .2s, background .2s, border-color .2s;
}

.search:focus-within {
  background: #fff;
  border-color: rgba(14, 122, 95, .35);
  box-shadow: 0 0 0 4px rgba(14, 122, 95, .1), 0 10px 30px rgba(16, 37, 29, .08);
}

.search-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.9;
  stroke-linecap: round;
}

#search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

#search-input::placeholder { color: #9baaa3; }
#search-input::-webkit-search-cancel-button { display: none; }

.search-submit {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .2s, transform .1s;
}

.search-submit:hover { background: var(--accent-strong); }
.search-submit:active { transform: scale(.97); }

.search-results {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  right: 0;
  max-height: 370px;
  padding: 6px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
}

.search-results[hidden] { display: none; }

.result-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.result-item:hover, .result-item.is-active { background: var(--surface-soft); }

.result-badge {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 6px 7px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  letter-spacing: .01em;
}

.result-copy { min-width: 0; }
.result-copy strong { display: block; font-size: 13px; font-weight: 600; }
.result-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-dir { flex: 0 0 auto; margin-left: auto; color: var(--faint); font-size: 11px; }
.result-empty { padding: 18px 12px; color: var(--muted); font-size: 13px; text-align: center; }

.live-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding: 8px 13px;
  background: rgba(255, 255, 255, .66);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 13px;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b3c1ba;
  box-shadow: 0 0 0 4px rgba(179, 193, 186, .18);
  flex: 0 0 auto;
}

.live-status.is-live .status-dot {
  background: var(--accent-bright);
  box-shadow: 0 0 0 4px rgba(30, 170, 128, .15);
  animation: dot-pulse 2.4s ease-in-out infinite;
}

.live-status.is-demo .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(212, 123, 18, .14);
}

.live-status.is-error .status-dot { background: #c6534d; }

.status-copy { display: flex; flex-direction: column; line-height: 1.15; }
.status-copy strong { font-size: 12px; }
.status-copy small { margin-top: 4px; font-size: 10.5px; color: var(--muted); }

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(30, 170, 128, .14); }
  50% { box-shadow: 0 0 0 7px rgba(30, 170, 128, .02); }
}

/* ---------- Layout ---------- */

.app-shell {
  height: calc(100dvh - 78px);
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 16px;
}

.map-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #dce7df;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, .85);
}

.map { position: absolute; inset: 0; z-index: 1; }

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #e7efe9;
  color: var(--muted);
  font-size: 13px;
  transition: opacity .35s;
}

.map-loading.is-done { opacity: 0; pointer-events: none; }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid #c6d6cd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Map HUD ---------- */

.map-hud {
  position: absolute;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-hud-top { top: 15px; left: 15px; }
.map-hud-right { top: 15px; right: 15px; }

.line-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px 0 12px;
  color: #fff;
  background: rgba(9, 51, 38, .92);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(9, 51, 38, .24);
  backdrop-filter: blur(12px);
}

.line-chip-number { font-size: 20px; font-weight: 800; letter-spacing: .01em; }

.line-chip-dir {
  max-width: 150px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .78);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-btn {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 13px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(16, 37, 29, .12);
  backdrop-filter: blur(12px);
  transition: background .2s, transform .12s;
}

.hud-btn:hover { background: #fff; }
.hud-btn:active { transform: scale(.96); }
.hud-btn:disabled { opacity: .45; cursor: not-allowed; }
.hud-btn:disabled:hover { background: rgba(255, 255, 255, .9); }
.hud-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.hud-btn-icon { width: 42px; padding: 0; }
.hud-btn-icon.is-spinning svg { animation: spin .8s linear infinite; }

.countdown {
  min-width: 34px;
  padding: 5px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  backdrop-filter: blur(8px);
}

.map-zoom {
  position: absolute;
  z-index: 500;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 6px 18px rgba(16, 37, 29, .12);
  backdrop-filter: blur(12px);
  transition: opacity .18s ease;
}

.map-zoom button {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
}

.map-zoom button + button { border-top: 1px solid var(--line); }
.map-zoom button:hover { background: #fff; }

.locate-btn {
  position: absolute;
  z-index: 500;
  right: 15px;
  bottom: 52px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(16, 37, 29, .12);
  backdrop-filter: blur(12px);
  transition: opacity .18s ease;
}

.locate-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.locate-btn:hover { background: #fff; }
.locate-btn.is-locating svg { animation: spin 1s linear infinite; }

.map-legend {
  position: absolute;
  z-index: 500;
  left: 14px;
  bottom: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 29px;
  padding: 0 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .82);
  color: var(--muted);
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-bus { width: 9px; height: 9px; border-radius: 3px; background: var(--accent-bright); box-shadow: 0 0 0 2px rgba(30, 170, 128, .18); }
.legend-stop { width: 9px; height: 9px; border-radius: 50%; background: #f0a12c; box-shadow: 0 0 0 2px rgba(240, 161, 44, .2); }

.map-source {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8fa098;
  font-family: var(--font);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.map-source:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Leaflet ---------- */

.leaflet-container {
  font-family: var(--font);
  background: #dfe9e2;
}

.leaflet-control-attribution {
  padding: 1px 6px !important;
  background: rgba(255, 255, 255, .65) !important;
  color: #82928a !important;
  font-size: 9px !important;
  border-radius: 6px 0 0 0;
}

.leaflet-control-attribution a { color: #6b7d75 !important; }
.leaflet-control-zoom { display: none; }

.leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 37, 29, .18);
}

.leaflet-popup-content { margin: 13px 15px; font-size: 12px; line-height: 1.5; }
.leaflet-popup-tip { box-shadow: none; }

/* 自定义 divIcon 去掉 Leaflet 默认白底 */
.bus-marker-wrap,
.stop-pin-wrap,
.stop-label-wrap,
.stop-dot-wrap,
.route-arrow-wrap,
.user-marker-wrap {
  background: transparent;
  border: 0;
}

.route-arrow {
  display: block;
  width: 0;
  height: 0;
  margin: -4px 0 0 -5px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid rgba(255, 255, 255, .96);
  transform-origin: 50% 50%;
  filter: drop-shadow(0 1px 2px rgba(7, 92, 70, .35));
}

.stop-tooltip {
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(16, 37, 29, .88);
  color: #fff;
  font-size: 10px;
  box-shadow: 0 4px 12px rgba(16, 37, 29, .18);
}

.stop-tooltip::before { border-top-color: rgba(16, 37, 29, .88); }

.route-popup strong { display: block; font-size: 13px; margin-bottom: 4px; }
.route-popup small { color: var(--muted); }
.route-popup .popup-eta { margin-top: 8px; color: var(--accent-strong); font-weight: 700; }

/* 点击站点后，锚定在站点上方的车辆卡片 */

.station-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 37, 29, .22), 0 2px 8px rgba(16, 37, 29, .08);
}

.station-popup .leaflet-popup-content {
  width: 248px !important;
  margin: 0;
  line-height: 1.35;
}

.station-popup .leaflet-popup-tip { background: #fff; }

.station-popup .leaflet-popup-close-button {
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f0f5f2;
  color: #6b7d75;
  font: 16px/22px Tahoma, Verdana, sans-serif;
}

.station-popup .leaflet-popup-close-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.station-card { padding: 13px 14px 9px; }

.station-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 20px;
}

.station-card-route {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}

.station-card-mode {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f2f6f4;
  color: var(--faint);
  font-size: 9px;
}

.station-card-title {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.station-metro {
  display: inline-flex;
  align-items: center;
  height: 14px;
  padding: 0 4px;
  border-radius: 3px;
  background: #e5f0f8;
  color: var(--blue);
  font-size: 8px;
  font-weight: 600;
}

.station-card-list {
  margin-top: 9px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.station-bus-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f4f2;
}

.station-bus-row:last-child { border-bottom: 0; }

.station-bus-plate {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-bus-eta {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1px;
  color: var(--accent-strong);
  white-space: nowrap;
}

.station-bus-eta strong { font-size: 21px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.station-bus-eta span { font-size: 9px; color: var(--muted); }
.station-bus-eta strong.is-arriving { color: var(--amber); font-size: 14px; }

.station-bus-meta {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: #9aa8a1;
  font-size: 9px;
}

.station-card-empty {
  padding: 14px 0 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.station-card-foot {
  margin-top: 6px;
  color: #a4b2aa;
  font-size: 9px;
  text-align: center;
}

/* Bus marker */

.bus-marker {
  position: relative;
  width: 44px;
  height: 52px;
  pointer-events: auto;
}

.bus-body {
  position: absolute;
  left: 50%;
  top: 0;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 12px;
  background: linear-gradient(145deg, #22b58a, #0b6f55);
  border: 2px solid #fff;
  box-shadow: 0 5px 14px rgba(7, 92, 70, .38);
  transform: rotate(var(--rot, 0deg));
  transition: transform .6s ease, left .6s linear, top .6s linear;
}

.bus-body svg { width: 19px; height: 19px; fill: #fff; transform: rotate(calc(var(--rot, 0deg) * -1)); }

.bus-pulse {
  position: absolute;
  left: 50%;
  top: 17px;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  background: rgba(30, 170, 128, .18);
  animation: bus-pulse 2.6s ease-out infinite;
}

@keyframes bus-pulse {
  0% { transform: scale(.55); opacity: .9; }
  70%, 100% { transform: scale(1.25); opacity: 0; }
}

.bus-plate {
  position: absolute;
  top: 37px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(9, 51, 38, .92);
  color: #fff;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(9, 51, 38, .2);
}

.bus-marker.is-selected .bus-body {
  background: linear-gradient(145deg, #f5b54a, #d47b12);
  box-shadow: 0 5px 16px rgba(212, 123, 18, .45);
}

.bus-marker.is-selected .bus-pulse { background: rgba(240, 161, 44, .2); }

/* Stop markers */

.stop-dot {
  width: 12px;
  height: 12px;
  margin: 0 !important;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #7e9388;
  box-shadow: 0 1px 4px rgba(16, 37, 29, .25);
  cursor: pointer;
  transition: transform .18s;
}

.stop-dot:hover { transform: scale(1.25); }

.stop-pin {
  position: relative;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.stop-pin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #f0a12c;
  box-shadow: 0 2px 8px rgba(16, 37, 29, .32);
}

.stop-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 31px;
  margin: -15.5px 0 0 -15.5px;
  border-radius: 50%;
  border: 2px solid rgba(240, 161, 44, .55);
  animation: stop-ring 2s ease-out infinite;
}

@keyframes stop-ring {
  0% { transform: scale(.6); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.stop-pin-label, .stop-label {
  position: absolute;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .95);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(16, 37, 29, .16);
  pointer-events: none;
}

.stop-label { top: 8px; font-weight: 500; color: var(--ink-soft); }

.user-marker {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 8px rgba(37, 99, 235, .18), 0 2px 8px rgba(37, 99, 235, .4);
}

/* ---------- Side panel ---------- */

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.panel-head { padding: 20px 20px 15px; border-bottom: 1px solid var(--line); }

.panel-line-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.panel-line { display: flex; align-items: center; gap: 9px; }
.panel-line > span:first-child { font-size: 30px; line-height: 1; font-weight: 850; letter-spacing: -.01em; color: var(--accent-strong); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
}

.panel-price {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.panel-terminals {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-soft);
}

.panel-meta {
  display: flex;
  gap: 0;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.panel-meta span + span::before {
  content: "·";
  margin: 0 7px;
  color: #b4c2bb;
}

.tabs {
  display: flex;
  gap: 5px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  height: 40px;
  padding: 0 11px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background .18s;
}

.tab.is-active { color: var(--accent-strong); }
.tab.is-active::after { background: var(--accent); }

.tab-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 3px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent-strong); }

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 22px;
  scrollbar-width: thin;
  scrollbar-color: #c7d5ce transparent;
}

.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #c7d5ce; border-radius: 5px; }

.panel-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: #fbfdfc;
  color: var(--faint);
  font-size: 9.5px;
}

.panel-foot span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-foot a { flex: 0 0 auto; color: var(--accent-strong); text-decoration: none; font-weight: 600; }
.panel-foot a:hover { text-decoration: underline; }
.foot-dot { width: 5px; height: 5px; border-radius: 50%; background: #9fb2a8; }

.tab-panel.is-hidden { display: none; }

/* Focus card */

.focus-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 17px;
  color: #fff;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(40, 190, 145, .55) 0%, transparent 48%),
    radial-gradient(120% 120% at 100% 100%, rgba(217, 154, 53, .3) 0%, transparent 45%),
    linear-gradient(135deg, #0d5e49, #082f24 78%);
  box-shadow: 0 14px 30px rgba(7, 58, 43, .22);
}

.focus-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -38px;
  top: -44px;
  border-radius: 50%;
  border: 20px solid rgba(255, 255, 255, .055);
}

.focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.focus-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .68);
  font-size: 10px;
  letter-spacing: .08em;
}

.focus-eyebrow::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #6fe0b8; }

.focus-change {
  border: 0;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .11);
  color: rgba(255, 255, 255, .82);
  font-size: 10px;
}

.focus-change:hover { background: rgba(255, 255, 255, .18); }

.focus-name {
  margin: 9px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-etas {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.eta-block {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .09);
}

.eta-block strong {
  display: inline-block;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.eta-block .eta-unit { margin-left: 2px; font-size: 10px; color: rgba(255, 255, 255, .68); }
.eta-block small { display: block; margin-top: 5px; color: rgba(255, 255, 255, .58); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eta-block.is-arriving strong { color: #ffd58a; font-size: 19px; }

.focus-foot {
  margin-top: 10px;
  color: rgba(255, 255, 255, .62);
  font-size: 9.5px;
  line-height: 1.5;
}

.focus-empty {
  min-height: 122px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed #cfdcd5;
  border-radius: 17px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  background: var(--surface-soft);
}

.eta-block.is-empty strong { color: rgba(255, 255, 255, .5); }
.eta-block.is-empty small { color: rgba(255, 255, 255, .45); }

/* Section label */

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 1px 9px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.section-label span:last-child {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* Bus cards */

.bus-list { display: flex; flex-direction: column; gap: 9px; }

.bus-card {
  display: flex;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s, transform .12s;
}

.bus-card:hover {
  border-color: #b9d8ca;
  box-shadow: 0 8px 20px rgba(16, 37, 29, .07);
}

.bus-card.is-selected {
  border-color: #e6b56a;
  background: #fffaf1;
}

.bus-card:active { transform: scale(.995); }

.bus-card-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.bus-card-icon svg { width: 21px; height: 21px; fill: currentColor; }

.bus-card-main { flex: 1; min-width: 0; display: block; }

.bus-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bus-card-top strong { font-size: 13.5px; font-weight: 700; letter-spacing: .02em; }
.bus-card-top .bus-speed { color: var(--faint); font-size: 9.5px; font-variant-numeric: tabular-nums; }

.bus-card-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bus-card-sub b { color: var(--ink-soft); font-weight: 600; }

.bus-progress {
  height: 3px;
  margin-top: 9px;
  border-radius: 3px;
  background: #edf2ef;
  overflow: hidden;
}

.bus-progress i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #1eaa80, #0e7a5f);
}

.bus-empty {
  padding: 20px 14px;
  border: 1px dashed #cfdcd5;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

/* Skeleton */

.skeleton {
  height: 75px;
  border-radius: 14px;
  background: linear-gradient(90deg, #f0f4f2 25%, #f8faf9 37%, #f0f4f2 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

.skeleton-short { height: 75px; width: 82%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Stop list */

.stop-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.stop-filter svg { width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 1.9; stroke-linecap: round; }
.stop-filter input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.stop-filter input::placeholder { color: #9baaa3; }

.stop-list { list-style: none; margin: 0; padding: 0; }

.stop-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 4px 6px 4px 2px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background .15s;
}

.stop-item:hover { background: var(--surface-soft); }
.stop-item.is-selected { background: #fff7e9; }

.stop-rail { position: relative; align-self: stretch; display: grid; place-items: center; }

.stop-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #dfe9e3;
  transform: translateX(-50%);
}

.stop-item:first-child .stop-rail::before { top: 50%; }
.stop-item:last-child .stop-rail::before { bottom: 50%; }

.stop-node {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9aada3;
  box-shadow: 0 0 0 1.5px #cfdcd5;
}

.stop-item.is-selected .stop-node { width: 12px; height: 12px; background: #f0a12c; box-shadow: 0 0 0 2px #f6d6a4; }
.stop-item.is-transfer .stop-node { background: var(--blue); box-shadow: 0 0 0 1.5px #b9d3e8; }

.stop-name { min-width: 0; font-size: 12px; line-height: 1.4; }
.stop-name > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-item.is-selected .stop-name { font-weight: 700; }

.stop-tags { display: flex; align-items: center; gap: 4px; margin-top: 2px; }

.metro-tag {
  display: inline-flex;
  align-items: center;
  height: 14px;
  padding: 0 4px;
  border-radius: 3px;
  background: #e5f0f8;
  color: var(--blue);
  font-size: 8px;
  font-weight: 600;
}

.stop-order { color: #b0bdb6; font-size: 9px; font-variant-numeric: tabular-nums; }

.stop-eta {
  min-width: 44px;
  text-align: right;
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stop-item.is-past .stop-eta { color: #a9b6af; font-weight: 400; }
.stop-item.is-selected .stop-eta { color: #b56c0b; }

.stop-empty { padding: 28px 10px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 2000;
  max-width: min(90vw, 460px);
  transform: translateX(-50%);
  padding: 10px 15px;
  border-radius: 10px;
  background: rgba(16, 37, 29, .93);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 14px 32px rgba(16, 37, 29, .26);
  animation: toast-in .22s ease;
}

.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fff;
  color: var(--ink);
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) 350px; }
  .panel-line > span:first-child { font-size: 27px; }
  .brand-text small { display: none; }
}

@media (max-width: 900px) {
  body { overflow: auto; }

  .topbar {
    height: auto;
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(238, 244, 240, .88);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(220, 231, 225, .8);
  }

  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .brand-text strong { font-size: 16px; }
  .brand-text small { display: block; margin-top: 3px; font-size: 9.5px; }

  .live-status { padding: 6px 9px; }
  .status-copy small { display: none; }

  .search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    height: 44px;
  }

  .app-shell {
    height: auto;
    padding: 0 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .map-card { height: 52dvh; min-height: 360px; border-radius: 21px; }

  .panel { border-radius: 21px; overflow: visible; }
  .panel-scroll { overflow: visible; max-height: none; }
  .panel-head { padding: 16px 16px 13px; }
  .panel-line > span:first-child { font-size: 26px; }
  .panel-terminals { font-size: 12px; }
  .focus-card { padding: 14px; }

  .map-hud-top { top: 11px; left: 11px; }
  .map-hud-right { top: 11px; right: 11px; }
  .line-chip { height: 40px; padding: 0 11px 0 10px; }
  .line-chip-number { font-size: 17px; }
  .line-chip-dir { max-width: 96px; font-size: 10px; }
  .hud-btn { height: 38px; }
  .hud-btn-icon { width: 38px; }
  .countdown { display: none; }
  .map-zoom { right: 11px; }
  .locate-btn { right: 11px; bottom: 48px; }
  .locate-btn span { display: none; }
  .locate-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .map-legend { left: 10px; bottom: 10px; gap: 9px; }
  .stop-list { padding-bottom: 4px; }

  /* 手机端卡片展开时，先收起右侧缩放/定位按钮，避免遮住到站数字。 */
  .map-card.is-card-open .map-zoom,
  .map-card.is-card-open .locate-btn {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .brand-text small { display: none; }
  .live-status { margin-left: auto; }
  .map-card { height: 40dvh; min-height: 300px; }
  .panel-head { padding: 14px 14px 12px; }
  .tabs { padding: 7px 10px 0; }
  .panel-scroll { padding: 13px 13px 18px; }
  .focus-etas { gap: 7px; }
  .eta-block { padding: 8px; }
  .eta-block strong { font-size: 21px; }
  .search-submit { padding: 0 12px; }
}

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