:root {
  --accent: #00667D;
  --accent-soft: rgba(0, 102, 125, 0.12);
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #111111;
  --muted: #6B6B70;
  --line: #D9D9DE;
  --green: #1E9E4F;
  --orange: #E8890C;
  --red: #D93636;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2E9EB0;
    --accent-soft: rgba(46, 158, 176, 0.18);
    --bg: #000000;
    --card: #1C1C1E;
    --text: #F2F2F7;
    --muted: #9A9AA0;
    --line: #38383A;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.logo { width: 40px; height: 40px; border-radius: 9px; }
.brand { font-weight: 700; font-size: 17px; }
.sub { color: var(--muted); font-size: 13px; }

.screen { max-width: 560px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border-radius: 18px; padding: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card.center { text-align: center; padding: 40px 20px; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fineprint { color: var(--muted); font-size: 12px; margin: 14px 4px 0; text-align: center; }
.caps { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.label { display: block; font-size: 14px; font-weight: 600; margin: 18px 0 6px; }
input {
  width: 100%; font: inherit; color: var(--text);
  padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.primary {
  width: 100%; min-height: 52px; margin-top: 14px;
  font: 600 17px/1 inherit; font-family: inherit; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0)) , var(--accent);
  border: 0; border-radius: 16px; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.primary:disabled { opacity: 0.6; cursor: default; }
.primary:active { transform: scale(0.98); }

.spinner {
  width: 32px; height: 32px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.spinner.done { animation: none; border: 0; font-size: 30px; line-height: 32px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tracking layout: map on top, panel below (scrolls) */
.screen.track { max-width: none; padding: 0; }
#map { height: 46vh; min-height: 260px; width: 100%; }
.mapbtn {
  position: absolute; right: 14px; margin-top: -58px; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--accent); font-size: 20px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.panel {
  max-width: 560px; margin: -18px auto 0; position: relative; z-index: 800;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.pill {
  font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
}
.pill.green { color: var(--green); background: rgba(30,158,79,0.12); }
.pill.red { color: var(--red); background: rgba(217,54,54,0.12); }
.pill.orange { color: var(--orange); background: rgba(232,137,12,0.14); }
.eta { font-size: 19px; font-weight: 700; }
.fresh { font-size: 13px; font-weight: 600; margin-top: 6px; }
.fresh.live { color: var(--green); }
.fresh.stale { color: var(--orange); }
.fresh.offline { color: var(--red); }

.driver { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--accent);
}
.driverName { font-size: 19px; font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 18px 4px; }
.timeline li { display: flex; align-items: center; gap: 12px; padding: 7px 0; color: var(--muted); }
.timeline li .mark {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; font-size: 12px; color: #fff;
}
.timeline li.reached { color: var(--text); }
.timeline li.reached .mark { background: var(--accent); border-color: var(--accent); }
.timeline li.current { font-weight: 600; }
.timeline li .time { margin-left: auto; font-size: 13px; color: var(--muted); }

.route .stop { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: none; }
.dot.pickup { border: 3px solid var(--orange); }
.dot.dest { background: var(--accent); }

/* Map markers */
.car {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); border: 3px solid #fff;
}
.car span { display: inline-block; transition: transform 0.6s linear; }
.car-label {
  background: var(--card); color: var(--text); font-weight: 600; font-size: 12px;
  padding: 2px 8px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.2); white-space: nowrap;
}
.leaflet-marker-icon.car-wrap { transition: transform 1s linear; }

/* "Open in the app" fallback when the link opened in Safari */
.appButton { display: block; margin-top: 12px; padding: 14px; text-align: center; border-radius: 999px;
  border: 1.5px solid #0A6BF5; color: #0A6BF5; font-weight: 600; text-decoration: none; }
.appButton:active { transform: scale(0.98); }
