:root {
  --bg: #171a20;
  --panel: #1f232b;
  --text: #f4f4f4;
  --muted: #8e939c;
  --accent: #3e6ae1;
  --danger: #d9534f;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Gotham SSm", "Universal Sans", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 12px;
  background: linear-gradient(to bottom, rgba(23, 26, 32, 0.96), rgba(23, 26, 32, 0));
  pointer-events: none;
}
#vehicle-name { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; }
#vehicle-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

#map {
  position: fixed;
  inset: 0;
  background: #e9e9e4;
  z-index: 1;
}
.leaflet-container { background: #e9e9e4; font: inherit; }

#sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: linear-gradient(to top, rgba(23, 26, 32, 0.98) 70%, rgba(23, 26, 32, 0));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button {
  font: inherit;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#pullover {
  height: 96px;
  width: 100%;
  background: #fff;
  color: #171a20;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, opacity 0.2s ease;
}
#pullover:active { transform: scale(0.97); }
#pullover:disabled { opacity: 0.35; }

#cancel {
  height: 52px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

#reset {
  height: 52px;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

#progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px;
  min-height: 40px;
}
#progress-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
#progress-sub { font-size: 12px; color: var(--muted); flex: 1; text-align: right; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
#progress.done .spinner { animation: none; border-color: #4caf7d; }

#footer-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
#relocate {
  flex-shrink: 0;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}
#relocate.active { color: #fff; border-color: var(--accent); background: rgba(62, 106, 225, 0.25); }
#disclaimer {
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.hidden { display: none !important; }

/* Map markers */
.car-marker {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 6px rgba(62, 106, 225, 0.9));
}
.car-marker svg { transform-origin: center; }

.stop-marker {
  width: 30px; height: 38px;
  display: grid;
  place-items: center;
}

.cand-dot {
  border-radius: 50%;
  opacity: 0.85;
}

.pulse {
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { filter: drop-shadow(0 0 0 rgba(62, 106, 225, 0.9)); }
  60% { filter: drop-shadow(0 0 12px rgba(62, 106, 225, 0.4)); }
  100% { filter: drop-shadow(0 0 0 rgba(62, 106, 225, 0.0)); }
}

#toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(31, 35, 43, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 12.5px;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 86vw;
  text-align: center;
  transition: opacity 0.3s ease;
}
