:root {
  color-scheme: light;
  font-family: "Google Sans", "Product Sans", Roboto, Arial, Helvetica, sans-serif;
  --text: #162033;
  --muted: #4d5c70;
  --surface: #ffffff;
  --border: #d7dde7;
}

@font-face {
  font-family: "Redonda";
  src: url("/assets/fonts/Redonda-Test/Redonda Test/RedondaTest-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

button {
  font-family: "Redonda", "Google Sans", "Product Sans", Roboto, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #eef2f7;
  color: var(--text);
}

.app-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  z-index: 500;
}

.controls-panel {
  display: block;
  align-items: stretch;
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-bottom: 1px solid rgba(215, 221, 231, 0.95);
  border-radius: 0;
  box-shadow: 0 3px 14px rgba(23, 32, 51, 0.18);
  pointer-events: auto;
}

.topbar-alert {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f3ed;
  border: 1px solid #d7cfc1;
  color: #494949;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 720px) {
  .topbar-alert {
    font-size: 14px;
    padding: 10px 12px;
  }
}

.filters {
  display: grid;
  grid-template-columns: repeat(var(--line-count, 4), minmax(0, 1fr));
  gap: 10px;
  pointer-events: auto;
}

.line-filter {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  padding: 0 10px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  opacity: 0.5;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 14px rgba(23, 32, 51, 0.24);
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.line-filter:hover {
  transform: translateY(-1px);
}

.line-filter.active {
  opacity: 1;
  box-shadow: 0 5px 18px rgba(23, 32, 51, 0.34);
}

.schedule-toggle {
  position: absolute;
  right: 14px;
  bottom: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 154px;
  min-height: 70px;
  padding: 0 22px;
  border: 2px solid rgba(15, 42, 74, 0.18);
  border-radius: 6px;
  background: #ffffff;
  color: #0f2a4a;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 5px 18px rgba(15, 42, 74, 0.24);
  transition: transform 120ms ease, box-shadow 120ms ease;
  z-index: 650;
}

.schedule-toggle:hover {
  box-shadow: 0 7px 22px rgba(15, 42, 74, 0.44);
  transform: translateY(-1px);
}

.schedule-toggle-icon {
  position: relative;
  display: block;
  width: 34px;
  height: 38px;
  border: 3px solid #0f2a4a;
  border-radius: 5px;
}

.schedule-toggle-icon::before {
  position: absolute;
  top: 8px;
  right: -3px;
  left: -3px;
  height: 3px;
  background: #0f2a4a;
  content: "";
}

.schedule-toggle-icon::after {
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 12px;
  height: 12px;
  border: 3px solid #0f2a4a;
  border-top: 0;
  border-left: 0;
  content: "";
  transform: rotate(-45deg);
}

.line-filter:focus-visible {
  outline: 3px solid #111827;
  outline-offset: 2px;
}

.line-1 {
  background: #dc2626;
}

.line-2 {
  background: #2563eb;
}

.line-3 {
  background: #16a34a;
}

.line-4 {
  background: #eab308;
  color: #1f2937;
  text-shadow: none;
}

.line-5 {
  background: #9333ea;
}

.line-schedule {
  background: #DAD7D5;
  color: #494949;
  text-shadow: none;
  opacity: 1;
}

.line-schedule:hover,
.line-schedule:active,
.line-schedule:focus-visible {
  background: #DAD7D5;
  color: #494949;
  opacity: 1;
}

#map {
  display: block;
  height: 100vh;
  height: 100dvh;
  min-height: 320px;
  width: 100%;
}

.schedule-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97);
  z-index: 1200;
}

.schedule-overlay.open {
  display: flex;
}

.schedule-toolbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 14px rgba(23, 32, 51, 0.16);
}

.schedule-tabs {
  display: grid;
  grid-template-columns: repeat(var(--line-count, 4), minmax(0, 1fr));
  gap: 8px;
}

.schedule-tab,
.schedule-close,
.schedule-nav {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
}

.schedule-tab {
  min-height: 64px;
  padding: 0 10px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  color: #ffffff;
  font-size: 19px;
  opacity: 0.55;
  text-transform: uppercase;
  text-align: center;
  white-space: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 14px rgba(23, 32, 51, 0.24);
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.schedule-tab:hover {
  transform: translateY(-1px);
}

.schedule-tab.active {
  opacity: 1;
  box-shadow: 0 5px 18px rgba(23, 32, 51, 0.34);
}

.schedule-tab:focus-visible {
  outline: 3px solid #111827;
  outline-offset: 2px;
}

.schedule-close {
  min-height: 46px;
  background: #111827;
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
}

.schedule-overlay img {
  max-width: 100vw;
  max-height: calc(100vh - 78px);
  object-fit: contain;
  padding: 78px 74px 18px;
}

.schedule-nav {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 72px;
  background: rgba(17, 24, 39, 0.86);
  color: #ffffff;
  font-size: 48px;
  line-height: 1;
  transform: translateY(-50%);
}

.schedule-prev {
  left: 12px;
}

.schedule-next {
  right: 12px;
}

.bus-marker-wrapper {
  background: transparent;
  border: 0;
}

.bus-marker {
  display: block;
  width: 22px;
  height: 22px;
  background: var(--marker-color);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.user-marker-wrapper {
  background: transparent;
  border: 0;
}

.user-marker {
  position: relative;
  display: block;
  width: 30px;
  height: 38px;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.35));
}

.user-marker::after {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #111827;
  border: 2px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  content: "";
  transform: translateX(-50%) rotate(-45deg);
}

.user-marker-head {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #111827;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translateX(-50%);
}

.user-marker-body {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 20px;
  height: 17px;
  background: #111827;
  border: 2px solid #ffffff;
  border-radius: 10px 10px 5px 5px;
  transform: translateX(-50%);
}

.leaflet-popup-content {
  min-width: 210px;
}

.leaflet-popup-content dl {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 4px 8px;
  margin: 10px 0 0;
}

.leaflet-popup-content dt {
  color: var(--muted);
  font-weight: 700;
}

.leaflet-popup-content dd {
  margin: 0;
}

@media (max-width: 720px) {
  .topbar {
    top: 0;
    right: 0;
    left: 0;
  }

  .controls-panel {
    padding: 6px;
  }

  .filters {
    gap: 6px;
  }

  .line-filter {
    min-height: 58px;
    padding: 0 5px;
    font-size: 15px;
    white-space: normal;
  }

  .line-word {
    display: block;
  }

  .schedule-toggle {
    right: 10px;
    bottom: 22px;
    min-width: 132px;
    min-height: 62px;
    padding: 0 16px;
    font-size: 19px;
  }

  .schedule-toggle-icon {
    width: 30px;
    height: 34px;
  }

  .schedule-toolbar {
    grid-template-columns: 1fr 46px;
    gap: 6px;
    padding: 6px;
  }

  .schedule-tabs {
    gap: 5px;
  }

  .schedule-tab {
    min-height: 42px;
    font-size: 12px;
    white-space: normal;
  }

  .schedule-close {
    min-height: 42px;
    font-size: 26px;
  }

  .schedule-overlay img {
    max-height: calc(100vh - 58px);
    padding: 58px 46px 10px;
  }

  .schedule-nav {
    width: 36px;
    height: 60px;
    font-size: 36px;
  }

  .schedule-prev {
    left: 5px;
  }

  .schedule-next {
    right: 5px;
  }
}
