:root {
  color-scheme: light;
  --asphalt: #0f1013;
  --asphalt-2: #202228;
  --paper: #f5f5f2;
  --white: #ffffff;
  --steel: #777c86;
  --line: #d9dad7;
  --red: #d81920;
  --red-dark: #a81218;
  --green: #16845b;
  --green-soft: #e6f4ee;
  --yellow: #d58a12;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--asphalt); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--asphalt); background: var(--paper); }
button, input { font: inherit; }
button { touch-action: manipulation; }

.driver-screen {
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom));
  background: var(--paper);
}

.driver-auth-screen { display: grid; align-content: start; background: var(--asphalt); }
.driver-brand { min-height: 58px; display: flex; align-items: center; gap: 8px; color: var(--asphalt); font-size: 12px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }
.driver-auth-screen .driver-brand { color: var(--white); }
.driver-mark { display: inline-grid; place-items: center; min-width: 54px; min-height: 34px; padding: 0 8px; color: var(--white); background: var(--red); border-radius: 2px; font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif; font-size: 22px; font-stretch: condensed; letter-spacing: -.04em; transform: skewX(-5deg); }
.driver-link { margin-left: auto; padding: 10px 0 10px 14px; color: var(--steel); background: transparent; border: 0; font-size: 12px; font-weight: 750; }

.driver-auth-card { margin-top: 7vh; padding: 28px 22px; background: var(--white); border-top: 5px solid var(--red); border-radius: 4px 4px 18px 4px; box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.driver-kicker, .driver-state-card > span { color: var(--red); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 7px 0 8px; font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif; font-size: clamp(30px, 9vw, 44px); line-height: .98; letter-spacing: -.035em; }
p { margin: 0; color: #5b5f67; font-size: 14px; line-height: 1.5; }
#driver-login { display: grid; gap: 14px; margin-top: 25px; }
#driver-login label { display: grid; gap: 6px; color: #4d5158; font-size: 11px; font-weight: 800; }
#driver-login input { width: 100%; min-height: 49px; padding: 12px 13px; color: var(--asphalt); background: #fafaf8; border: 1px solid #c9cac7; border-radius: 8px; font-size: 16px; }
#driver-login input:focus { outline: 3px solid rgba(216,25,32,.2); border-color: var(--red); }

.driver-primary, .driver-stop, .driver-secondary { width: 100%; min-height: 54px; padding: 13px 16px; border-radius: 8px; font-size: 15px; font-weight: 850; }
.driver-primary { color: var(--white); background: var(--red); border: 1px solid var(--red); box-shadow: 0 7px 0 var(--red-dark); }
.driver-primary:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--red-dark); }
.driver-secondary { color: var(--asphalt); background: var(--white); border: 1px solid var(--line); }
.driver-stop { margin-top: 18px; color: var(--red); background: var(--white); border: 2px solid var(--red); }

.driver-heading { padding: 26px 2px 18px; }
.driver-heading p { max-width: 38ch; }
.driver-run-list { display: grid; gap: 14px; }
.driver-run-ticket { position: relative; overflow: hidden; padding: 19px; background: var(--white); border: 1px solid var(--line); border-radius: 4px 4px 18px 4px; box-shadow: 0 9px 25px rgba(15,16,19,.08); }
.driver-run-ticket::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--red); }
.driver-run-number { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; }
.driver-run-number span, .driver-run-meta span, .driver-signal-card span { color: var(--steel); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.driver-run-number strong { font-family: "Arial Narrow", "Avenir Next Condensed", sans-serif; font-size: 23px; }
.driver-route { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin: 24px 0; }
.route-stop { position: relative; display: grid; gap: 2px; }
.route-stop:last-child { text-align: right; }
.route-stop i { width: 11px; height: 11px; margin-bottom: 5px; background: var(--white); border: 3px solid var(--red); border-radius: 50%; }
.route-stop:last-child i { justify-self: end; background: var(--red); }
.route-stop small { color: var(--steel); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.route-stop strong { max-width: 120px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.route-line { height: 2px; margin-top: -25px; background: repeating-linear-gradient(90deg, var(--red) 0 8px, transparent 8px 13px); }
.driver-run-meta { display: flex; gap: 18px; padding-top: 14px; border-top: 1px solid #e5e5e2; }
.driver-run-meta b { display: block; margin-top: 3px; color: var(--asphalt); font-size: 13px; letter-spacing: 0; text-transform: none; }
.driver-run-ticket .driver-primary { margin-top: 20px; }

.driver-consent, .driver-live-strip { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; padding: 17px; background: var(--asphalt); border-radius: 4px 4px 14px 4px; }
.driver-consent strong, .driver-live-strip strong { display: block; color: var(--white); font-size: 13px; }
.driver-consent p { margin-top: 4px; color: #b8bbc2; font-size: 12px; }
.gps-beacon { position: relative; width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; color: var(--yellow); border: 2px solid currentColor; border-radius: 50%; }
.gps-beacon i { width: 8px; height: 8px; background: currentColor; border-radius: 50%; }
.gps-beacon.is-live { color: #35b981; box-shadow: 0 0 0 7px rgba(53,185,129,.12); }
.gps-beacon.is-searching { margin: 0 auto 16px; animation: gps-pulse 1.5s infinite; }
.gps-beacon.is-stopping { margin: 0 auto 16px; color: var(--steel); }

.driver-live-strip { align-items: center; margin: 12px 0 16px; background: var(--asphalt); }
.driver-live-strip small { display: block; margin-bottom: 3px; color: #35b981; font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.driver-state-card, .driver-loading { margin-top: 10vh; padding: 28px 20px; text-align: center; background: var(--white); border: 1px solid var(--line); border-radius: 4px 4px 18px 4px; }
.driver-state-card p { max-width: 36ch; margin: 0 auto; }
.driver-state-card .driver-secondary { margin-top: 20px; }
.driver-error { border-top: 5px solid var(--red); }
.driver-loading { display: grid; gap: 12px; place-items: center; color: var(--steel); }
.driver-loading i { width: 24px; height: 24px; border: 3px solid #d7d8d5; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
.driver-signal-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 14px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.driver-signal-card > div { padding: 15px; background: var(--white); }
.driver-signal-card strong { display: block; margin-top: 5px; font-size: 14px; }
.driver-foreground-note { margin-top: 14px; padding: 0 4px; font-size: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gps-pulse { 50% { box-shadow: 0 0 0 12px rgba(213,138,18,0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (min-width: 600px) { body { padding: 24px; background: var(--asphalt); } .driver-screen { min-height: calc(100vh - 48px); border-radius: 18px; } }
