:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #eef4fb;
  --line: #c8d4e2;
  --text: #17212f;
  --muted: #526173;
  --accent: #006fd6;
  --accent-2: #0b7a3b;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(21, 39, 64, 0.13);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101722;
  --panel: #17212f;
  --panel-2: #202c3b;
  --line: #334457;
  --text: #eef4fb;
  --muted: #aab7c6;
  --accent: #66b7ff;
  --accent-2: #6ee7a7;
  --danger: #ff8a80;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .ghost.active,
:root[data-theme="dark"] .station.active,
:root[data-theme="dark"] .favorite-stop-btn.active,
:root[data-theme="dark"] .map-test-point-control.active {
  background: #213a52;
}

:root[data-theme="dark"] .transport-filter-chip {
  background: var(--panel-2);
  color: var(--muted);
}

:root[data-theme="dark"] .transport-filter-chip.nearby-filter--bus.active,
:root[data-theme="dark"] .route-pill--bus,
:root[data-theme="dark"] .transport-button--bus,
:root[data-theme="dark"] .transport-group--bus {
  border-color: #8f4248;
  background: #3a2226;
  color: #ff9f9a;
}

:root[data-theme="dark"] .transport-filter-chip.nearby-filter--trolley.active,
:root[data-theme="dark"] .route-pill--trolley,
:root[data-theme="dark"] .transport-button--trolley,
:root[data-theme="dark"] .transport-group--trolley {
  border-color: #3d6f9b;
  background: #1d3148;
  color: #8dccff;
}

:root[data-theme="dark"] .transport-filter-chip.nearby-filter--tram.active,
:root[data-theme="dark"] .route-pill--tram,
:root[data-theme="dark"] .transport-button--tram,
:root[data-theme="dark"] .transport-group--tram {
  border-color: #3c7d58;
  background: #1d3828;
  color: #80e4a6;
}

:root[data-theme="dark"] .picker-letter {
  background: #22354a;
}

:root[data-theme="dark"] .distance,
:root[data-theme="dark"] .meta,
:root[data-theme="dark"] .nearby,
:root[data-theme="dark"] .small {
  color: #b8c5d4;
}

:root[data-theme="dark"] .direction {
  color: #dce8f5;
}

:root[data-theme="dark"] input::placeholder {
  color: #7f8fa3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 44px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 10px 0 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.title-locate-btn {
  display: grid;
  place-items: center;
  width: 62px;
  min-width: 62px;
  padding: 0;
  color: var(--accent);
}

.title-locate-btn svg {
  width: 32px;
  height: 32px;
}

.title-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.small {
  margin: 6px 0 0;
  font-size: 18px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary,
.ghost,
.icon {
  min-height: 58px;
  border-radius: 8px;
  padding: 0 22px;
  color: var(--text);
  font-weight: 800;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.ghost,
.icon {
  background: var(--panel);
  border: 2px solid var(--line);
}

.ghost.active {
  border-color: var(--accent);
  background: #e8f3ff;
  color: var(--accent);
}

.favorite-stop-btn {
  width: 58px;
  min-width: 58px;
  padding: 0;
  color: var(--muted);
}

.favorite-stop-btn svg {
  width: 32px;
  height: 32px;
}

.favorite-stop-btn.active {
  border-color: #d49a00;
  background: #fff5d6;
  color: #b77900;
}

.icon.title-locate-btn {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--accent);
}

.panel {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls,
.map-panel {
  margin-bottom: 12px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  gap: 10px;
  position: relative;
  overflow: visible;
  padding: 14px;
  background: var(--panel);
}

.controls label {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

input {
  display: block;
  width: 100%;
  height: 52px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 111, 214, 0.14);
}

.status {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.status.error {
  color: var(--danger);
  font-weight: 800;
}

.choose-stop {
  display: block;
  width: 100%;
  min-height: 58px;
  margin: 0;
  border-radius: 8px;
}

.controls > :last-child,
.controls > .choose-stop:last-of-type {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 2px solid var(--line);
}

.badge {
  min-width: 44px;
  border-radius: 999px;
  padding: 6px 12px;
  text-align: center;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
}

.transport-filter-chips {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
}

.transport-filter-chip {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  opacity: 0.55;
}

.transport-filter-chip.active {
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(0, 111, 214, 0.1);
}

.transport-filter-chip .route-icon {
  width: 28px;
  height: 28px;
}

.transport-filter-chip.nearby-filter--bus.active {
  border-color: #f09a9a;
  background: #ffeceb;
  color: #c62828;
}

.transport-filter-chip.nearby-filter--trolley.active {
  border-color: #91c8f8;
  background: #e8f3ff;
  color: #006fd6;
}

.transport-filter-chip.nearby-filter--tram.active {
  border-color: #8bd5a6;
  background: #e9f8ef;
  color: #128044;
}

.map {
  width: 100%;
  max-width: 100%;
  height: min(48vh, 460px);
  min-height: 330px;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
  background: var(--panel-2);
}

:root[data-theme="dark"] .leaflet-container {
  background: #101722;
}

:root[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.72) saturate(0.78) contrast(1.08);
}

:root[data-theme="dark"] .leaflet-control-zoom a,
:root[data-theme="dark"] .leaflet-control-attribution {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

.map.is-hidden {
  display: none;
}

.map-panel {
  overflow: hidden;
}

.map-actions-under {
  display: grid;
  gap: 10px;
  padding: 8px;
  background: var(--panel);
}

.map-actions-under .primary,
.map-actions-under .ghost {
  width: 100%;
}

.modal-map-actions {
  border-bottom: 2px solid var(--line);
}

.modal-map {
  height: 280px;
  min-height: 240px;
  border-radius: 0;
  border-bottom: 2px solid var(--line);
}

.list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.empty {
  color: var(--muted);
}

.station,
.arrival,
.route-fallback {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.station {
  position: relative;
  display: block;
}

.station--no-forecast {
  background: var(--panel-2);
}

.station-side {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  justify-items: end;
  gap: 6px;
  white-space: nowrap;
}

.station .distance {
  position: static;
  padding-top: 2px;
  white-space: nowrap;
}

.favorite-station .distance {
  position: static;
  padding-top: 0;
}

.favorite-station-star {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: #b77900;
}

.favorite-station-star svg {
  width: 100%;
  height: 100%;
}

.station > span:first-child {
  display: block;
  min-width: 0;
}

.station .station-name,
.station .direction {
  padding-right: 84px;
}

.station.active {
  border-color: var(--accent);
  background: #edf6ff;
}

.station-name,
.route-name {
  display: block;
  font-size: 24px;
  font-weight: 900;
}

.distance,
.meta {
  display: block;
  color: var(--muted);
  font-size: 18px;
}

.nearby {
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.direction {
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
}

.loading-line {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.loader {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 4px solid #c8d4e2;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.arrival {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.arrival:active {
  transform: translateY(1px);
}

.route-no-data {
  background: var(--panel-2);
}

.route-no-data--silent {
  grid-template-columns: auto minmax(0, 1fr);
}

.route-pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  border-radius: 8px;
  padding: 12px 14px;
  background: #e8f3ff;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  text-align: center;
  font-weight: 900;
}

.station-routes {
  display: block;
  line-height: 2.3;
  margin-top: 10px;
}

.station-route-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 9px;
  vertical-align: middle;
  white-space: normal;
}

.station-route-item--pill-only {
  margin-right: 6px;
}

.station-route-pills {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
}

.station-route-terminal {
  display: inline;
  min-width: 0;
  overflow: visible;
  font-size: 13px;
  font-weight: 750;
  hyphens: auto;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-overflow: clip;
  vertical-align: middle;
  -webkit-hyphens: auto;
  white-space: normal;
  word-break: normal;
}

.station-route-terminal--bus {
  color: #c62828;
}

.station-route-terminal--trolley {
  color: #006fd6;
}

.station-route-terminal--tram {
  color: #128044;
}

.search-suggestions {
  position: absolute;
  z-index: 30;
  top: 102px;
  right: 14px;
  left: 14px;
  max-height: min(52vh, 420px);
  overflow: auto;
  margin: 0;
  border: 2px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-suggestion {
  min-height: 78px;
}

#searchInput[readonly] {
  cursor: pointer;
}

.search-screen-fixed {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
}

.search-screen-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 2px solid var(--line);
}

.search-screen-actions {
  display: flex;
  justify-content: flex-end;
}

.search-screen-head h2 {
  margin: 0;
}

.search-screen-tools {
  padding: 14px;
  border-bottom: 2px solid var(--line);
}

#searchScreenSuggestions {
  position: static;
  width: 100%;
  max-width: 100%;
  max-height: none;
  overflow-x: hidden;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#searchScreen .screen-card {
  overflow-x: hidden;
}

#searchScreenSuggestions .station {
  max-width: 100%;
  min-width: 0;
}

#searchScreenSuggestions .station > span {
  min-width: 0;
}

.route-pill--small {
  min-width: auto;
  gap: 6px;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1.1;
  vertical-align: middle;
}

.route-pill--small .route-icon {
  width: 22px;
  height: 22px;
}

.route-pill--bus {
  background: #ffeceb;
  color: #c62828;
}

.route-pill--trolley {
  background: #e8f3ff;
  color: #006fd6;
}

.route-pill--tram {
  background: #e9f8ef;
  color: #128044;
}

.route-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.route-pill--small .route-icon {
  width: 22px;
  height: 22px;
}

.route-direction {
  display: inline-flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.32em;
  align-items: baseline;
}

.route-direction-from {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 750;
}

.route-direction-arrow {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  font-size: 0.82em;
  font-weight: 850;
  line-height: 1;
}

.route-direction-end {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.arrival .route-direction-end {
  flex-basis: 100%;
}

.route-direction-to {
  color: var(--text);
  font-weight: 950;
}

.vehicle-route-title {
  min-width: 0;
  vertical-align: middle;
}

.route-title-type {
  color: currentColor;
  font-size: 0.72em;
  font-weight: 950;
}

.minutes {
  color: var(--accent-2);
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

.station-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--marker-bg, #7c8a99);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.user-location-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #005bd1;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 91, 209, 0.36);
}

.user-location-marker svg {
  width: 23px;
  height: 23px;
}

.vehicle-marker {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 12px;
  color: #ffffff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  position: relative;
}

.vehicle-marker.route-pill--bus {
  background: #c62828;
}

.vehicle-marker.route-pill--tram {
  background: #128044;
}

.vehicle-marker.route-pill--trolley {
  background: #006fd6;
}

.vehicle-marker .route-icon {
  width: 19px;
  height: 19px;
}

.vehicle-marker strong {
  display: block;
  margin-top: -4px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.map-locate-control,
.map-test-point-control {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 3px 10px rgba(21, 39, 64, 0.24);
}

.map-test-point-control {
  color: var(--muted);
}

.map-test-point-control.active {
  border-color: var(--accent);
  background: #e8f3ff;
  color: var(--accent);
}

.map-locate-control svg,
.map-test-point-control svg {
  width: 28px;
  height: 28px;
}

.leaflet-top.leaflet-right {
  top: 50%;
  transform: translateY(-50%);
}

.leaflet-top.leaflet-right .leaflet-control {
  margin-top: 0;
  margin-right: 12px;
}

.leaflet-top.leaflet-right .map-zoom-value {
  margin-top: 6px;
  margin-right: 12px;
}

.map-zoom-value {
  min-width: 44px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 5px 7px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: 0 3px 10px rgba(21, 39, 64, 0.2);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  overflow: auto;
  padding: 18px;
  background: var(--bg);
}

.modal[hidden] {
  display: none;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 4800;
  overflow: auto;
  padding: 18px;
  background: var(--bg);
}

.vehicle-screen {
  z-index: 5400;
}

.vehicle-map {
  width: auto;
  max-width: calc(100% - 28px);
  margin: 0 14px 14px;
  height: 430px;
}

.vehicle-arrival {
  margin: 0 14px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  color: var(--accent-2);
  font-size: 26px;
  font-weight: 950;
}

.future-stop {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.route-stop--no-time {
  grid-template-columns: 1fr;
}

.past-stops {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
}

.past-stops summary {
  padding: 14px 18px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.route-stop--past {
  margin: 0 12px 12px;
  border-color: var(--line);
  background: var(--bg);
  color: var(--muted);
}

.route-stop--past .station-name,
.route-stop--past .minutes {
  font-size: 18px;
}

.screen[hidden] {
  display: none;
}

.screen-card {
  width: min(940px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  overflow-x: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.picker-tools {
  padding: 14px;
  border-bottom: 2px solid var(--line);
}

.station-picker-head {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 2px solid var(--line);
}

.station-picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.station-picker-actions #closeStationPickerBtn {
  margin-left: auto;
}

.station-picker-head h2 {
  margin: 0;
}

.letter-button {
  min-height: 86px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-size: 38px;
  font-weight: 950;
  text-align: center;
  padding: 16px;
}

.letter-grid {
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
}

.transport-button {
  min-height: 110px;
  font-size: 26px;
}

.transport-list-button {
  width: 100%;
  min-height: 78px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font-size: 28px;
  font-weight: 950;
}

.transport-button--bus {
  background: #ffeceb;
  color: #c62828;
}

.transport-button--tram {
  background: #e9f8ef;
  color: #128044;
}

.transport-button--trolley {
  background: #e8f3ff;
  color: #006fd6;
}

.picker-letter {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 12px 0 2px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #dce9f7;
  color: var(--accent);
  font-size: 34px;
  font-weight: 950;
  line-height: 1;
}

.picker-station {
  min-height: 76px;
  padding: 20px;
}

.picker-station .station-name {
  font-size: 28px;
}

.transport-group-title {
  margin: 14px 0 2px;
  border-radius: 8px;
  padding: 14px 18px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 28px;
  font-weight: 950;
}

.transport-group--bus {
  background: #ffeceb;
  color: #c62828;
}

.transport-group--trolley {
  background: #e8f3ff;
  color: #006fd6;
}

.transport-group--tram {
  background: #e9f8ef;
  color: #128044;
}

.transport-group--mixed,
.transport-group--loading,
.transport-group--empty {
  color: var(--muted);
}

.modal-card {
  width: min(940px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  overflow-x: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#modal .modal-actions {
  flex-direction: column;
  align-items: flex-end;
}

.leaflet-control-attribution {
  font-size: 12px;
}

@media (max-width: 820px) {
  body {
    font-size: 19px;
  }

  .shell {
    width: min(100% - 20px, 1160px);
    padding-top: 8px;
  }

  .actions {
    display: grid;
    justify-content: stretch;
  }

  .map {
    height: 390px;
  }

  .arrival {
    grid-template-columns: auto 1fr;
  }

  .vehicle-map {
    height: 390px;
  }

  .minutes {
    grid-column: 2;
  }
}
