:root {
  --bg: #050816;
  --bg-elevated: rgba(15, 23, 42, 0.92);
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.1);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --warning: #facc15;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.65);
  --blur-strong: blur(22px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f172a 0, #020617 45%, #000 100%);
  color: var(--text-main);
  height: 100dvh;
  overflow: hidden;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #0f172a 0, #020617 45%, #000 100%);
  z-index: 30;
  pointer-events: none;
  animation: splashFade 3s ease-out forwards;
}

.splash-inner {
  text-align: center;
  padding: 20px 32px;
  border-radius: 20px;
  background: radial-gradient(circle at top, rgba(34, 197, 94, 0.18), transparent 55%),
    rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.75);
}

.splash-logo {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 14px;
  object-fit: contain;
  animation: splashLogo 3s ease-out forwards;
}

.splash-logo-fallback {
  width: 120px;
  height: 80px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.08em;
  animation: splashLogo 3s ease-out forwards;
}

@keyframes splashLogo {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  85% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.9;
    transform: scale(1);
  }
}

.splash-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.splash-title .splash-title-green {
  color: #d1e231;
}

.splash-title .splash-title-light {
  color: #3eb1e5;
}

.splash-subtitle {
  margin-top: 6px;
  font-size: 0.88rem;
  color: #9ca3af;
}

@keyframes splashFade {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  85% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.02);
    visibility: hidden;
  }
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.top-panel {
  position: absolute;
  inset: 0 0 auto 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

.top-card {
  pointer-events: auto;
  backdrop-filter: var(--blur-strong);
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.15), transparent 55%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 55%),
    var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 12px 18px 12px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.title-badge {
  font-size: 0.7rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.subtitle span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.subtitle-separator {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.9);
}

.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.location-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.35);
}

.top-toggle {
  pointer-events: auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.top-toggle span:last-child {
  font-size: 0.9rem;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.top-panel.collapsed .subtitle,
.top-panel.collapsed .legend-row,
.top-panel.collapsed .banner,
.top-panel.collapsed .how-button,
.top-panel.collapsed .demo-button {
  display: none;
}

.top-panel.collapsed .top-card {
  padding: 12px 14px;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(30, 64, 175, 0.45);
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-dot.green {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
}

.legend-dot.yellow {
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.3);
}

.legend-dot.red {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
}

.legend-arrow {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-arrow-leaving {
  color: #22c55e;
}

.legend-arrow-going {
  color: #ef4444;
}

.status-pill {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.banner {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  padding: 8px 11px;
  font-size: 0.75rem;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.96);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, 100vw - 32px);
}

.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4);
}

.banner strong {
  color: #e5e7eb;
  font-weight: 500;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  opacity: 0;
  transform-origin: center center;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 12;
}

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

.toast-indicator {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.45);
}

.empty-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px dashed rgba(148, 163, 184, 0.7);
  color: var(--text-muted);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  z-index: 9;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.empty-chip.visible {
  opacity: 1;
}

/* How it works sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.9));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.info-sheet {
  width: 100%;
  max-width: 520px;
  margin-bottom: env(safe-area-inset-bottom, 8px);
  border-radius: 18px 18px 0 0;
  background: radial-gradient(circle at top, rgba(34, 197, 94, 0.25), transparent 55%),
    rgba(15, 23, 42, 0.98);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.65);
  padding: 10px 16px 14px;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sheet-backdrop.open .info-sheet {
  transform: translateY(0);
}

.sheet-grabber {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
  margin: 4px auto 8px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sheet-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.sheet-close {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.98);
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
}

.sheet-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  margin-bottom: 4px;
}

.sheet-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: #d1d5db;
}

.sheet-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.sheet-list strong {
  font-weight: 600;
}

.sheet-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.sheet-dot.green {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.sheet-dot.yellow {
  background: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.35);
}

.sheet-dot.red {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

.sheet-arrow {
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2em;
}

.sheet-arrow-leaving {
  color: #22c55e;
}

.sheet-arrow-going {
  color: #ef4444;
}

.sheet-note {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 4px;
}

.sheet-note strong {
  color: #e5e7eb;
  font-weight: 500;
}

.sheet-footer-link {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #bfdbfe;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.6);
  background: rgba(15, 23, 42, 0.96);
}

.sheet-footer-link span:last-child {
  font-size: 0.9rem;
}

.how-button {
  pointer-events: auto;
  align-self: flex-start;
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.how-button span {
  font-size: 0.9rem;
}

.demo-button {
  pointer-events: auto;
  align-self: flex-start;
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(30, 41, 59, 0.96);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.demo-button span {
  font-size: 0.9rem;
}

.demo-button.demo-active {
  background: rgba(71, 85, 105, 0.96);
  border-color: rgba(148, 163, 184, 0.8);
}

/* Active cabs bar – bottom left corner */
.active-cabs-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 12;
  width: auto;
  max-width: min(360px, calc(100vw - 24px));
  padding: 6px 10px 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  margin-bottom: 8px;
  margin-left: 8px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.active-cabs-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-left: 2px;
}

.active-cabs-list {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  min-height: 36px;
}

.active-route-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  cursor: default;
  min-width: 0;
}

.active-route-cab-logo {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.active-route-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.active-cabs-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.active-cabs-bar.empty .active-cabs-list {
  min-height: 36px;
}

/* Mobile: raise active cabs bar slightly so it doesn't overlap map attribution */
@media (max-width: 600px) {
  .active-cabs-bar {
    bottom: 8px;
    margin-bottom: 0;
    margin-left: 8px;
  }
}

/* Leaflet overrides for a slightly cleaner look */
.leaflet-container {
  background: #020617;
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.9);
  color: #6b7280;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.leaflet-control-zoom a {
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.98);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: var(--shadow-soft);
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(148, 163, 184, 0.6);
  border-left: 1px solid rgba(148, 163, 184, 0.6);
}

.popup-title {
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

.popup-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.popup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  font-size: 0.72rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.popup-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.popup-pill-dot.green {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.popup-pill-dot.yellow {
  background: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.35);
}

.popup-pill-dot.red {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

@media (min-width: 768px) {
  .top-panel {
    padding: 18px 22px 12px;
    align-items: center;
  }

  .top-card {
    max-width: 540px;
    width: 100%;
  }

  .banner {
    align-self: center;
  }
}

@media (max-width: 480px) {
  .top-card {
    padding: 9px 12px 8px;
    border-radius: 14px;
  }

  .top-title-row {
    gap: 6px;
  }

  .title {
    font-size: 0.88rem;
    gap: 5px;
  }

  .title-badge {
    font-size: 0.58rem;
    padding: 3px 5px;
    letter-spacing: 0.06em;
  }

  .subtitle {
    font-size: 0.7rem;
    line-height: 1.2;
  }

  .location-chip {
    padding: 4px 6px;
    font-size: 0.65rem;
    max-width: 100px;
  }

  .top-toggle {
    padding: 4px 6px;
    font-size: 0.65rem;
  }

  .top-toggle span:last-child {
    font-size: 0.8rem;
  }

  .legend {
    font-size: 0.7rem;
  }

  .how-button,
  .demo-button {
    font-size: 0.72rem;
  }
}

