#vehicle-overlay .vehicle-label {
  position: absolute;

  /* 🔑 THIS IS THE IMPORTANT PART */
  top: 25%;                 /* was too low before */
  left: 50%;
  transform: translateX(-50%);

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;

  color: #000;
  white-space: nowrap;
  pointer-events: none;
}

/* =========================
   Shared route typography
   ========================= */

.route {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.route-via {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 2px;
  line-height: 1.2;
}

.stop-map-label {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  color: #0f1114;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
  width: max-content;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  z-index: 5;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.45s ease,
    border-color 0.45s ease;
  transform-origin: left center;
  will-change: transform;
}

.stop-map-label--platform {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #2d2100;
  background: rgba(242, 201, 76, 0.68);
  border-color: rgba(58, 42, 0, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1;
}

.stop-map-label:hover {
  transform: scale(1.06);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stop-map-label:active {
  transform: scale(0.93);
}

.stop-map-label.is-hover {
  transform: scale(1.07);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stop-map-label.is-pressed {
  transform: scale(0.86);
}

body.map-moving .stop-map-label {
  transition: none;
  transform: none;
}

.stop-map-label--group.is-selected {
  z-index: 8;
}


body.night .stop-map-label {
  color: #f2f2f2;
  background: rgba(18, 22, 26, 0.7);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.night .stop-map-label--platform {
  color: #f3d68a;
  background: rgba(62, 46, 0, 0.7);
  border-color: rgba(242, 201, 76, 0.3);
}

body.night .route-via {
  color: #b8bcc4;
}
#vehicle-overlay .vehicle-label {
  position: absolute;

  /* 🔑 THIS IS THE IMPORTANT PART */
  top: 25%;                 /* was too low before */
  left: 50%;
  transform: translateX(-50%);

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;

  color: #000;
  white-space: nowrap;
  pointer-events: none;
}

/* =========================
   Bus popup styling
   ========================= */

.bus-popup {
  position: absolute;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  padding: 8px 10px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.3;
  pointer-events: auto;
  z-index: 10;
  text-align: left;          /* 🔑 prevents inherited centering */
  overflow: hidden;
}

.bus-popup::before {
  content: none;
}

.bus-popup-inner .route {
  margin-bottom: 8px;
}

.bus-popup-inner .route strong {
  margin-right: 6px;
  font-weight: 800;
}

/* =========================
   Route badge (popup only)
   ========================= */

.bus-popup-inner .route-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 25px;
  min-width: 20px;
  padding: 0 6px;

  background: var(--route-color);
  border-radius: 5px;

  /* 🔒 lock typography */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;

  color: #fff;

  transform: skewX(16deg);
  pointer-events: auto;
  touch-action: manipulation;
  transform-origin: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bus-popup-inner .route-badge:hover,
.bus-popup-inner .route-badge.is-hover {
  transform: skewX(16deg) scale(1.06);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--route-color) 40%, transparent);
}

.bus-popup-inner .route-badge:active,
.bus-popup-inner .route-badge.is-pressed {
  transform: skewX(16deg) scale(0.92);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--route-color) 55%, transparent);
}

.bus-popup-inner .route-badge-text {
  transform: skewX(-16deg);

  /* 🔒 prevent inheritance surprises */
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* =========================
   Train glyph (popup only)
   ========================= */

.bus-popup-inner .vehicle-glyph.train {
  width: 28px;
  height: 28px;
  margin-left: 10px;

  stroke: currentColor;
  fill: none;
  stroke-width: 2;

  opacity: 0.9;
  vertical-align: middle;
}

/* Night mode – train glyph */
.bus-popup.night .vehicle-glyph.train {
  opacity: 1;
}

.route-via {
  margin-left: 0;
}

.bus-popup-inner .route-destination-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-left: 0;
  margin-top: -1px; /* align top with badge */
}
.bus-popup-inner .route.no-via .route-destination-block {
  justify-content: center;
}
.bus-popup-inner .route-row {
  display: flex;
  align-items: flex-start;
  gap: 4px; /* slightly closer to badge */
  pointer-events: auto;
}

.bus-popup-inner .route.has-via .route-row {
  gap: 6px;
}
.bus-popup-inner .route.no-via .route-row {
  align-items: center;
}

.bus-popup-inner .next-stop {
  display: block;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 6px;   /* restore original separation */
  font-size: 13px;
  color: rgba(0, 0, 0, 0.75);
  clear: both;              /* 🚨 brute-force clear */
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease,
    color 0.2s ease;
}

.bus-popup-inner .next-stop-target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bus-popup-inner .next-stop--clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: -4px;
  margin-right: -4px;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease,
    color 0.2s ease;
}

.bus-popup-inner .next-stop--clickable:hover {
  color: rgba(0, 0, 0, 0.95);
  background: rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.bus-popup-inner .next-stop--clickable:active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.1);
}

body.night .bus-popup-inner .next-stop--clickable:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.08);
}

body.night .bus-popup-inner .next-stop--clickable:active {
  background: rgba(255, 255, 255, 0.12);
}

.bus-popup-inner .occupancy-indicator {
  display: inline-flex;
  align-items: center;
  margin-top: -2px;
  margin-bottom: 6px;
}

.bus-popup-inner .occupancy-people {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
}

.bus-popup-inner .occupancy-person {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 16px;
  opacity: 0.25;
}

.bus-popup-inner .occupancy-person svg {
  width: 14px;
  height: 14px;
  fill: var(--occ-color);
}

.bus-popup-inner .occupancy-person.active {
  opacity: 1;
}

.bus-popup-inner .next-stop strong {
  font-weight: 500;
  color: #000000;
}
.bus-popup.night .next-stop strong {
  color: #ffffff;
}
.bus-popup.night .occupancy-indicator {
  color: rgba(255, 255, 255, 0.7);
}

.bus-popup.night .occupancy-people {
  background: rgba(255, 255, 255, 0.12);
}
.bus-popup-inner .next-stop-label {
  margin-right: 4px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 500;
}

/* Italicise "Tidigare" when finished */
.bus-popup-inner .next-stop.finished .next-stop-label {
  font-style: italic;
  color: #888;
}
.bus-popup-inner .vehicle-meta {
  display: block;
  width: 100%;
  margin-top: 0;        /* remove extra gap above border */
  padding-top: 6px;       /* even gap from border to operator */
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 11px;
  line-height: 1.3;
  clear: both;
}

.bus-popup-inner .vehicle-meta strong {
  display: block;
  position: static;
  width: 100%;
  font-size: 13px;
  margin-bottom: 4px;   /* slightly larger gap to vehicle details */
}

.bus-popup-inner .vehicle-meta .vehicle-details {
  line-height: 1.25;
}

.bus-popup-inner .platform-muted {
  font-size: 11px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.42);
  margin-left: 4px;
  white-space: nowrap;
}

.bus-popup-inner .muted {
  opacity: 0.6;
}

.bus-popup-inner .vehicle-meta-label {
  margin-right: 4px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 500;
}

.bus-popup-inner .vehicle-meta-value {
  color: #000;
  font-weight: 500;
}

.bus-popup-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;          /* 🔑 CRITICAL */
}

/* =========================
   Finished trip styling
   ========================= */

.bus-popup-inner .finished {
  color: #888;
}

.bus-popup-inner .finished .route-via {
  opacity: 0.7;
}

.bus-popup-inner .finished-footer {
  margin-top: 6px;
  padding-top: 0;
  font-size: 11px;
  color: #999;
}
/* Grey out entire next-stop line when finished */
.bus-popup-inner .next-stop.finished {
  color: #888;
}

.bus-popup.night {
  background: #1b1f26;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e6e6e6;
}

body.night .bus-popup::before {
  content: none;
}

.bus-popup.night .route-destination {
  color: #e6e6e6
}

.bus-popup.night .route-via,
.bus-popup.night .vehicle-details,
.bus-popup.night .finished-footer {
  color: #b8bcc4;
}

.bus-popup.night .next-stop {
  color: #e0e0e0;
}

.bus-popup.night .popup-divider {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Night mode – next stop */
.bus-popup.night .next-stop {
  color: #e6e6e6;
}

.bus-popup.night .platform-muted {
  font-size: 11px;
  font-weight: 400;
  color: #9aa0a6;
  margin-left: 4px;
  white-space: nowrap;
}

.bus-popup.night .next-stop-label {
  color: #9aa0a6;   /* lighter "Nästa / Tidigare" */
}

.bus-popup.night .next-stop strong {
  color: #E0E0E0;  /* actual stop name */
}

/* Night mode – operator & fleet */
.bus-popup.night .vehicle-operator {
  color: #e0e0e0;
}

.bus-popup.night .vehicle-meta-label {
  color: #9aa0a6;
}

.bus-popup.night .vehicle-meta-value {
  color: #E0E0E0;
}

.bus-popup.night .finished {
  opacity: 0.7;
}

/* Night mode – divider lines */
.bus-popup.night .popup-divider {
  border-color: rgba(255, 255, 255, 0.28);
}

/* Night mode – route number inside popup badge */
.bus-popup.night .route-badge-text {
  color: #1a1d22;
}

.bus-popup.night .vehicle-meta {
  display: block;
  width: 100%;
  margin-top: 0;        /* remove extra gap above border */
  padding-top: 6px;       /* even gap from border to operator */
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 11px;
  line-height: 1.3;
  clear: both;
}

#map-fade {
  position: fixed;
  inset: 0;
  background: #0f1216;
  pointer-events: none;
  opacity: 0;
  z-index: 999;
}

/* Fade OUT (day → night, night → day) */
#map-fade.active {
  opacity: 1;
  transition: opacity 5000ms ease;
}

/* Fade IN (reveal map) */
#map-fade.leaving {
  opacity: 0;
  transition: opacity 8000ms ease;
}


#theme-toggle {
  cursor: pointer;
  font-size: 18px;
  transition:
    transform 0.4s ease,
    opacity 0.3s ease;
}

#theme-toggle.switching {
  transform: rotate(180deg) scale(1.15);
  opacity: 0.7;
}

/* pill styling */

#map-controls-pill {
  position: absolute;
  bottom: 56px;
  left: 12px;

  display: flex;
  flex-direction: column;
  align-items: center;

  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(16px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;

  padding: 6px 4px;
  gap: 5px;

  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  z-index: 10;
}

#map-controls-pill button {
  border: none;
  background: transparent;

  width: 34px;
  height: 34px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

#map-controls-pill .icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  vector-effect: non-scaling-stroke;
  color: #444;
}

.user-location-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1f7bff;
  box-shadow:
    0 0 0 6px rgba(31, 123, 255, 0.18),
    0 0 12px rgba(31, 123, 255, 0.35);
  border: 2px solid #ffffff;
}

#map-controls-pill button:hover {
  background: rgba(0, 0, 0, 0.08);
}

#map-controls-pill button:active {
  transform: scale(0.95);
}

.pill-divider {
  width: 18px;
  height: 1px;
  background: rgba(0, 0, 0, 0.15);
}

body.night #map-controls-pill {
  background:
    linear-gradient(135deg, rgba(28, 32, 40, 0.78), rgba(16, 18, 24, 0.5));
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.night #map-controls-pill button {
  color: #ddd;
}

body.night #map-controls-pill .icon {
  color: #ddd;
}

body.night .pill-divider {
  background: rgba(255, 255, 255, 0.2);
}

body.night #map-controls-pill button:hover {
  background: rgba(255, 255, 255, 0.1);
}

#zoom-controls-pill {
  position: absolute;
  bottom: 56px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(16px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 4px;
  gap: 5px;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  z-index: 10;
}

#zoom-controls-pill button {
  border: none;
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  font-size: 20px;
  font-weight: 600;
  color: #444;
}

#zoom-controls-pill .icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  vector-effect: non-scaling-stroke;
}

#zoom-controls-pill button:hover {
  background: rgba(0, 0, 0, 0.08);
}

#zoom-controls-pill button:active {
  transform: scale(0.95);
}

body.night #zoom-controls-pill {
  background:
    linear-gradient(135deg, rgba(28, 32, 40, 0.78), rgba(16, 18, 24, 0.5));
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.night #zoom-controls-pill button {
  color: #ddd;
}

body.night #zoom-controls-pill .icon {
  color: #ddd;
}
/* =========================
   Map attribution (pill)
   ========================= */

.maplibregl-ctrl-attrib {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22));
  backdrop-filter: blur(16px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 12px;

  font-size: 11px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.01em;

  box-shadow:
    0 2px 8px rgba(0,0,0,0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

body.night .maplibregl-ctrl-attrib {
  background:
    linear-gradient(135deg, rgba(28, 32, 40, 0.78), rgba(16, 18, 24, 0.5));
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.maplibregl-ctrl-attrib:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}


/* Night mode */

body.night .maplibregl-ctrl-attrib {
  background: rgba(20, 22, 28, 0.88);
  color: #cfd3da;
}

body.night .maplibregl-ctrl-attrib a {
  color: #e4e7ec;
  text-decoration: underline;
}

body.night .maplibregl-ctrl-attrib a:hover {
  color: #ffffff;
}

body.night .maplibregl-ctrl-attrib span,
body.night .maplibregl-ctrl-attrib i {
  color: #cfd3da;
}


body.night .maplibregl-ctrl-attrib:hover {
  background: rgba(28, 30, 36, 0.95);
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
/* =========================
   Route list panel
   ========================= */

.hidden {
  display: none !important;
}

.route-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: max-content;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 720px);
  background: #f7f8fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--panel-text, #111);
  border-radius: 14px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.route-panel.hidden {
  display: none;
}

.route-panel-header {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

#route-search {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 14px;
}

#bus-search {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 15px;
}

#stop-search {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 15px;
}

#route-panel-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    color 0.2s ease;
}

#bus-panel-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    color 0.2s ease;
}

#stop-panel-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    color 0.2s ease;
}

#route-panel-close:hover,
#bus-panel-close:hover,
#stop-panel-close:hover {
  transform: scale(1.08);
  color: rgba(0, 0, 0, 0.75);
}

#route-panel-close:active,
#bus-panel-close:active,
#stop-panel-close:active {
  transform: scale(0.9);
}

body.night #route-panel-close:hover,
body.night #bus-panel-close:hover,
body.night #stop-panel-close:hover {
  color: rgba(255, 255, 255, 0.8);
}

.route-results {
  overflow-y: auto;
  padding: 8px 0;
}

/* Toggle button */

.route-panel {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Night mode */

body.night .route-panel {
  background: #1b1f26;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #f2f2f2;
}

body.night #route-search {
  background: #121418;
  color: #f2f2f2;
  border-color: rgba(255, 255, 255, 0.15);
}

body.night #bus-search {
  background: #121418;
  color: #f2f2f2;
  border-color: rgba(255, 255, 255, 0.15);
}

body.night #stop-search {
  background: #121418;
  color: #f2f2f2;
  border-color: rgba(255, 255, 255, 0.15);
}

body.night .route-panel-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.bus-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 12px;
  position: relative;
}

.bus-filter-btn {
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease;
}

.bus-sort-btn {
  margin-left: auto;
}

.bus-sort-controls {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}

.bus-sort-dir {
  padding: 8px 10px;
  min-width: 36px;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease;
}

.bus-filter-menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 12px;
  min-width: 200px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  z-index: 30;
}

.bus-sort-controls + .bus-filter-menu {
  left: auto;
  right: 12px;
  min-width: 180px;
}

.bus-filter-section + .bus-filter-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.bus-filter-title {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
  margin-bottom: 6px;
}

.bus-filter-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.bus-filter-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease;
}

.bus-filter-option.is-selected {
  background: rgba(0, 0, 0, 0.22);
}

.bus-sort-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease;
}

.bus-filter-btn:hover,
.bus-sort-btn:hover,
.bus-sort-dir:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.05);
}

.bus-filter-btn:active,
.bus-sort-btn:active,
.bus-sort-dir:active {
  transform: scale(0.94);
}

.bus-filter-option:hover,
.bus-sort-option:hover {
  background: rgba(0, 0, 0, 0.14);
  transform: scale(1.05);
}

.bus-filter-option:active,
.bus-sort-option:active {
  transform: scale(0.94);
}

.bus-sort-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

body.night .bus-filter-row {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

body.night .bus-filter-btn {
  background: rgba(255, 255, 255, 0.08);
}

body.night .bus-filter-btn:hover,
body.night .bus-sort-btn:hover,
body.night .bus-sort-dir:hover {
  background: rgba(255, 255, 255, 0.14);
}

body.night .bus-filter-menu {
  background: rgba(23, 26, 32, 0.98);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

body.night .bus-filter-section + .bus-filter-section {
  border-top-color: rgba(255, 255, 255, 0.12);
}

body.night .bus-sort-option:hover {
  background: rgba(255, 255, 255, 0.12);
}

body.night .bus-filter-option {
  background: rgba(255, 255, 255, 0.08);
}

body.night .bus-filter-option.is-selected {
  background: rgba(255, 255, 255, 0.22);
}

body.night .bus-sort-option {
  background: rgba(255, 255, 255, 0.08);
}

.route-panel-search-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  color: #111;
  cursor: pointer;
  z-index: 21;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.route-panel-search-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.route-panel-search-toggle:active {
  transform: scale(0.92);
}

.route-panel-search-toggle.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.route-panel-search-toggle .icon-search {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

body.night .route-panel-search-toggle {
  background: rgba(20, 22, 28, 0.85);
  backdrop-filter: blur(8px);
  color: #f2f2f2;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}

.search-menu {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 22;
}

body.night .search-menu {
  background: rgba(23, 26, 32, 0.95);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.search-menu-btn {
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.search-menu-btn:hover {
  transform: scale(1.04);
  background: rgba(0, 0, 0, 0.12);
}

.search-menu-btn:active {
  transform: scale(0.92);
}

body.night .search-menu-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f2;
}

body.night .search-menu-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
