:root {
  color-scheme: light;
  font-family: Inter, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --surface: rgba(250, 250, 247, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --text: #202124;
  --muted: #6f7479;
  --border: rgba(25, 31, 35, 0.12);
  --shadow: 0 16px 50px rgba(25, 33, 38, 0.14);
  --accent: #d71920;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

html,
body {
  overflow: hidden;
  background: #edf0ee;
}

button {
  font: inherit;
}

#map {
  position: fixed;
  inset: 0;
  background: #e9ece9;
}

.leaflet-tile-pane {
  filter: grayscale(0.88) saturate(0.45) brightness(1.055) contrast(0.93);
}

.leaflet-control-attribution {
  border-radius: 8px 0 0 0;
  background: rgba(255, 255, 255, 0.76) !important;
  backdrop-filter: blur(12px);
}

.leaflet-control-zoom {
  margin-top: 92px !important;
  margin-left: 16px !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 8px 30px rgba(25, 33, 38, 0.12) !important;
}

.leaflet-control-zoom a {
  border: 0 !important;
  color: #2b3034 !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
}

.topbar {
  position: fixed;
  z-index: 1000;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  width: min(720px, calc(100% - 28px));
  min-height: 64px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px 10px 14px;
  border-radius: 19px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.brand h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0.015em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.soft-button,
.icon-button,
.text-button,
.filter-chip,
.line-button {
  border: 0;
  cursor: pointer;
  color: inherit;
}

.soft-button,
.icon-button {
  height: 38px;
  border-radius: 11px;
  background: rgba(31, 37, 41, 0.07);
  transition: 150ms ease;
}

.soft-button {
  padding: 0 13px;
  font-size: 12px;
  font-weight: 650;
}

.soft-button[aria-pressed="true"] {
  color: white;
  background: #282d31;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.soft-button:hover,
.icon-button:hover {
  background: rgba(31, 37, 41, 0.12);
}

.line-panel {
  position: fixed;
  z-index: 990;
  top: 96px;
  right: 14px;
  width: 286px;
  max-height: calc(100vh - 116px);
  display: flex;
  flex-direction: column;
  padding: 15px;
  border-radius: 20px;
}

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

.panel-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eyebrow {
  color: #989da1;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.panel-head strong {
  font-size: 18px;
}

.text-button {
  padding: 6px 0 6px 8px;
  color: #6f7479;
  background: transparent;
  font-size: 11px;
}

.text-button:hover {
  color: #202124;
}

.filter-row {
  display: flex;
  gap: 6px;
  margin: 13px 0 10px;
}

.filter-chip {
  padding: 6px 9px;
  border-radius: 999px;
  color: #6c7175;
  background: rgba(30, 35, 39, 0.055);
  font-size: 11px;
  font-weight: 650;
}

.filter-chip.is-active {
  color: white;
  background: #282d31;
}

.line-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  overflow: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

.line-item.is-filtered {
  display: none;
}

.line-button {
  position: relative;
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.61);
  box-shadow: inset 0 0 0 1px rgba(25, 31, 35, 0.07);
  text-align: left;
  transition: transform 130ms ease, opacity 130ms ease, background 130ms ease;
}

.line-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.95);
}

.line-button.is-hidden {
  opacity: 0.36;
  filter: grayscale(0.7);
}

.line-button.is-loading::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9aa0a4;
  animation: pulse 900ms ease-in-out infinite alternate;
}

.line-button.has-error::after {
  content: "!";
  position: absolute;
  top: 4px;
  right: 7px;
  color: #c12e2e;
  font-size: 11px;
  font-weight: 900;
}

@keyframes pulse {
  to {
    opacity: 0.2;
  }
}

.line-badge {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.line-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
}

.panel-foot {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 7px 2px 0;
  border-top: 1px solid rgba(25, 31, 35, 0.08);
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #6eae62;
  box-shadow: 0 0 0 3px rgba(110, 174, 98, 0.13);
}

.toast {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 18px);
  max-width: min(440px, calc(100vw - 28px));
  padding: 9px 13px;
  border-radius: 999px;
  color: white;
  background: rgba(32, 36, 39, 0.88);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  font-size: 11px;
  transition: 180ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.rail-station-icon {
  background: transparent;
  border: 0;
}

.rail-station-icon > span {
  display: block;
  width: 9px;
  height: 9px;
  margin: 3px;
  border: 2px solid #34393d;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.rail-station-icon.is-transfer > span {
  width: 13px;
  height: 13px;
  margin: 1px;
  border-width: 3px;
}

.station-popup {
  min-width: 150px;
}

.station-popup strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.station-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.station-line-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.96);
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(25, 31, 35, 0.11);
  border-radius: 14px;
  box-shadow: 0 12px 38px rgba(20, 26, 30, 0.17);
}

@media (max-width: 720px) {
  .topbar {
    top: max(9px, env(safe-area-inset-top));
    width: calc(100% - 18px);
    min-height: 58px;
    padding: 8px 9px 8px 10px;
    border-radius: 17px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    flex-basis: 35px;
    font-size: 17px;
  }

  .brand h1 {
    font-size: 14px;
  }

  .brand p {
    display: none;
  }

  .soft-button {
    padding: 0 10px;
  }

  .line-panel {
    top: auto;
    right: 9px;
    bottom: calc(9px + env(safe-area-inset-bottom));
    left: 9px;
    width: auto;
    max-height: min(43vh, 370px);
    padding: 12px;
    border-radius: 19px;
  }

  .line-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .line-button {
    min-height: 39px;
    padding: 5px 6px;
  }

  .line-badge {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
    font-size: 10px;
  }

  .line-name {
    display: none;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .leaflet-control-attribution {
    bottom: calc(43vh + 7px) !important;
    max-width: calc(100vw - 18px);
    font-size: 8px !important;
  }
}
