/* The drive: the whole page is the app's own map in 3D. Scrolling drives your route; everything
   else floats over it in the Crew Lineup's own objects (tickets, the bill, the turn card). */
.drive-page { background: var(--mint); color: var(--ink); overflow-x: hidden; }
.drive-page .map { position: fixed; inset: 0; opacity: 0; transition: opacity .9s; }
.drive-page.map-on .map { opacity: 1; }
.map-load {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--ink); font-weight: 700; font-size: 14px; transition: opacity .4s; pointer-events: none;
}
.map-load span { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(5, 46, 43, .18); border-top-color: var(--ink); animation: spin .9s linear infinite; }
.map-on .map-load, .map-failed .map-load { opacity: 0; }
.map-failed .map-load span { animation: none; }
.track { width: 1px; }

/* HUD */
.hud { position: fixed; z-index: 5; }
.hud-top { top: 0; left: 0; right: 0; height: 72px; padding: 0 var(--pad-x); display: flex; align-items: center; gap: 18px; }
.hud-top .wordmark { color: var(--ink); }
.trip-card {
  display: grid; gap: 2px; padding: 8px 14px; border-radius: 14px; background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 3px rgba(0,0,0,.1), 0 18px 36px -20px rgba(0,0,0,.32);
  font-size: .85rem; line-height: 1.2;
}
.trip-card b { font-weight: 800; font-stretch: 104%; }
.trip-card span { color: var(--deep-text); font-weight: 700; }
.hud-links { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.hud-links a:not(.btn) { color: var(--ink); font-weight: 800; font-stretch: 108%; text-decoration: none; }
.hud-links .btn { min-height: 44px; }
.view-toggle {
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 800; font-stretch: 108%;
  transition: background-color .3s, color .3s;
}
.view-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
/* Night: the page goes dark with the map. Paper becomes deep ink, ink becomes paper, mint stays mint. */
.night { --night-paper: #07211E; --night-paper-2: #0B2D29; }
.night .hud-top .wordmark, .night .hud-links a:not(.btn) { color: var(--paper); }
.night .btn-ink { background: var(--mint); color: var(--ink); }
.night .view-toggle { border-color: var(--paper); background: transparent; color: var(--paper); }
.night .view-toggle[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.night .trip-card { background: var(--night-paper); color: var(--paper); }
.night .trip-card span { color: var(--mint); }
.night .hud-crew .bill-row { background: rgba(7, 33, 30, .8); color: var(--paper); border-color: var(--paper); }
.night .hud-crew .bill { border-top-color: var(--paper); }
.night .hud-crew .bill-mode { color: var(--on-ink-2); }
.night .hud-crew .bill-note { color: var(--paper); }
.night .hud-stops > ol { background: var(--night-paper); }
.night .hud-stops a { color: var(--paper); }
.night .hud-stops a[aria-current="step"] { background: var(--mint); color: var(--ink); }
.night .stop { background: var(--night-paper); color: var(--paper); }
.night .stop p, .night .crew-list li, .night .stop details p { color: var(--on-ink-2); }
.night .stop .lede, .night .crew-list b, .night .stats dd, .night .mode-list, .night .stop summary, .night .drive-go, .night .end-links a { color: var(--paper); }
.night .drive-go { border-color: var(--paper); }
.night .stats dt { color: var(--mint); }
.night .stats, .night .mode-list, .night .mode-list li, .night .crew-list, .night .crew-list li, .night .stop .faq-list, .night .stop details, .night .stop .stub { border-color: var(--paper); }
.night .stop .stub-label { color: var(--mint); }
.night .stop .stub input { background: var(--night-paper-2); color: var(--paper); border-color: rgba(251, 251, 254, .25); }
.night .stop .stub input::placeholder { color: var(--on-ink-2); }
.night .react-row button { background: var(--night-paper-2); color: var(--paper); border-color: rgba(251, 251, 254, .25); }
.night .stop .code-ticket::before, .night .stop .code-ticket::after { background: var(--night-paper); }
.night .toasts p { background: var(--paper); color: var(--ink); }
.night .map-load { color: var(--paper); }
.night.drive-page { background: var(--ink); }

.hud-nav {
  top: 88px; right: var(--pad-x);
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 18px;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 2px 3px rgba(0,0,0,.1), 0 18px 36px -20px rgba(0,0,0,.32);
  opacity: 0; transform: translateY(-8px); transition: opacity .4s, transform .6s var(--ease);
}
.driving .hud-nav { opacity: 1; transform: none; }
.hud-nav .nav-arrow { width: 44px; height: 44px; border-radius: 12px; background: var(--mint); color: var(--ink); display: grid; place-items: center; }
.hud-nav .nav-arrow svg { transition: transform .5s var(--ease); }
.hud-nav div { display: grid; line-height: 1.15; }
.hud-nav b { font-size: 1.05rem; font-weight: 800; font-stretch: 104%; }
.hud-nav div span { font-size: .85rem; color: var(--on-ink-2); }
.hud-nav .nav-dist { margin-left: 8px; font-weight: 900; font-stretch: 112%; font-variant-numeric: tabular-nums; }

.hud-crew { left: var(--pad-x); bottom: 92px; width: min(380px, calc(100vw - 2 * var(--pad-x))); }
.hud-crew .bill { display: flex; flex-direction: column; border-top-color: var(--ink); }
.hud-crew .bill-name { font-size: clamp(1.4rem, 2vw, 2rem); }
.hud-crew .bill-row[data-rank="1"] .bill-name { font-size: clamp(2.1rem, 3.2vw, 3.2rem); font-stretch: 70%; }
.hud-crew .bill-row[data-rank="2"] .bill-name { font-size: clamp(1.7rem, 2.5vw, 2.5rem); font-stretch: 86%; }
.hud-crew .bill-row { background: rgba(251, 251, 254, .72); backdrop-filter: blur(6px); padding: 6px 10px 4px; }
.hud-crew .bill-note { margin-top: 8px; font-variant-numeric: tabular-nums; }

.hud-stops { left: 0; right: 0; bottom: 0; padding: 10px var(--pad-x) 14px; display: flex; justify-content: center; }
.hud-stops > ol { list-style: none; margin: 0; padding: 6px; display: flex; gap: 2px; border-radius: 999px; background: var(--paper); box-shadow: 0 2px 3px rgba(0,0,0,.1), 0 18px 36px -20px rgba(0,0,0,.32); max-width: 100%; overflow-x: auto; }
.hud-stops a {
  display: block; min-height: 40px; padding: 10px 12px; border-radius: 999px; text-decoration: none; color: var(--ink);
  font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: .95rem; font-stretch: 92%; line-height: 1; opacity: .7;
  transition: font-stretch .5s var(--ease), opacity .3s, background-color .3s;
}
.hud-stops a:hover { opacity: 1; }
.hud-stops a[aria-current="step"] { opacity: 1; font-stretch: 66%; background: var(--mint); }
.hud-stops a.is-done { opacity: 1; }

/* Stops: one paper sheet at a time, pinned to the left of the road */
.stops { position: fixed; z-index: 4; left: var(--pad-x); top: 96px; bottom: 300px; width: min(520px, calc(100vw - 2 * var(--pad-x))); pointer-events: none; }
.stop {
  position: absolute; inset: 0; display: grid; align-content: start; gap: 18px; overflow: auto; overscroll-behavior: contain;
  padding: clamp(22px, 3vw, 34px); border-radius: var(--r-sheet); background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 30px 60px -30px rgba(0,0,0,.35);
  opacity: 0; visibility: hidden; transform: translateY(18px); pointer-events: none;
  transition: opacity .5s, transform .9s var(--ease), visibility .5s;
}
.stop.is-on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.stop h1, .stop h2 {
  font-family: var(--display); font-weight: 900; font-stretch: 70%; text-transform: uppercase;
  font-size: clamp(2.4rem, 4.6vw, 4.6rem); line-height: .88; letter-spacing: -.015em; text-wrap: balance;
}
.stop h1 span, .stop h2 span { display: block; }
.stop h3 { margin-top: 10px; font-weight: 800; font-stretch: 104%; font-size: 1.15rem; }
.stop p { color: var(--muted); max-width: 46ch; }
.stop .lede { color: var(--ink); font-weight: 500; font-size: 1.08rem; }
/* Objects inside a sheet lie flat on it: no second layer of depth. */
.stop .stub { max-width: none; background: transparent; box-shadow: none; padding: 14px 0 0; border-top: 2px solid var(--ink); border-radius: 0; }
.stop .stub::before, .stop .stub::after { display: none; }
.stop .code-ticket { box-shadow: none; }
.drive-go { justify-self: start; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-stretch: 108%; border-bottom: 2px solid var(--ink); padding-bottom: 2px; }
.drive-go svg { animation: nudge 2.4s var(--ease) infinite; }
.stop .code-ticket { background: var(--mint); }
.stop .code-ticket::before, .stop .code-ticket::after { background: var(--paper); }
.stop .code-ticket-label { color: var(--ink-2); }
.stop .code-ticket-code { font-size: clamp(2.2rem, 4vw, 4rem); }
.mode-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.mode-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 2px solid var(--ink); font-weight: 700; font-stretch: 108%; }
.mode-list b { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-stretch: 80%; font-size: 1.3rem; }
.react-row { display: flex; flex-wrap: wrap; gap: 8px; }
.react-row button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 800; font-stretch: 108%; cursor: pointer; transition: transform .4s var(--ease), border-color .3s; }
.react-row button:hover { border-color: var(--deep); transform: translateY(-1px); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0; border-top: 2px solid var(--ink); padding-top: 14px; }
.stats dt { font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--deep-text); font-stretch: 112%; }
.stats dd { margin: 2px 0 0; font-family: var(--display); font-weight: 900; font-stretch: 80%; font-size: 1.8rem; line-height: 1; font-variant-numeric: tabular-nums; }
.crew-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.crew-list li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 2px solid var(--ink); color: var(--muted); font-size: .95rem; }
.crew-list b { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-stretch: 78%; font-size: 1.4rem; line-height: .95; color: var(--ink); }
.stop .faq-list { border-top: 2px solid var(--ink); }
.stop details { border-bottom: 2px solid var(--ink); }
.stop summary { list-style: none; cursor: pointer; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; font-weight: 800; font-stretch: 104%; }
.stop summary::-webkit-details-marker { display: none; }
.stop summary::after { content: "+"; font-weight: 900; font-size: 1.4rem; transition: transform .3s; }
.stop details[open] summary::after { transform: rotate(45deg); }
.stop details p { padding: 0 0 14px; }
.end-links { font-size: .85rem; }
.end-links a { color: var(--ink); font-weight: 700; }

/* Floating reactions and toasts, as in the app */
.floats { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.floats span { position: absolute; font-size: 2.4rem; animation: floatUp 3.4s var(--ease) forwards; }
@keyframes floatUp { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 12% { opacity: 1; transform: translate(0, -30px) scale(1.1); } 100% { transform: translate(var(--dx, 0), -420px) scale(1); opacity: 0; } }
.toasts { position: fixed; right: var(--pad-x); bottom: 92px; z-index: 6; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toasts p { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: .9rem; font-weight: 700; box-shadow: 0 2px 3px rgba(0,0,0,.1), 0 18px 36px -20px rgba(0,0,0,.32); animation: toastIn .5s var(--ease); transition: opacity .5s; }
.toasts p i { font-style: normal; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--c, var(--mint)); vertical-align: middle; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.map-failed .map { display: none; }
.map-failed .hud-nav, .map-failed .hud-crew { display: none; }

@media (max-width: 1080px) {
  .hud-top { height: 64px; gap: 10px; }
  .trip-card { display: none; }
  .hud-links a:not(.btn) { display: none; }
  .view-toggle { padding: 0 12px; font-size: .9rem; }
  .hud-nav { top: 76px; right: 12px; left: 12px; padding: 10px 12px 10px 10px; }
  .hud-nav .nav-arrow { width: 38px; height: 38px; }
  .hud-crew { display: none; }
  .stops { left: 12px; right: 12px; width: auto; top: auto; bottom: 74px; height: min(52vh, 460px); }
  .stop { padding: 20px; gap: 14px; }
  .stop h1, .stop h2 { font-size: clamp(2rem, 9vw, 2.8rem); }
  .hud-stops { padding: 8px 12px 10px; }
  .hud-stops a { padding: 10px 10px; font-size: .85rem; }
  .toasts { right: 12px; left: 12px; bottom: auto; top: 140px; justify-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .stop { transition: none; transform: none; }
  .drive-go svg { animation: none; }
}
/* Neutral surfaces let the map and small turquoise controls carry the colour. */
.drive-page { background: #edf6f3; }
.drive-page .hud-stops a[aria-current="step"], .drive-page .hud-nav .nav-arrow { background: #c9eee4; }
.drive-page .stop .code-ticket { background: #e1f4ed; }
.drive-page.night { background: var(--ink); }
.drive-page.night .hud-stops a[aria-current="step"] { background: #b5e6d9; }
.drive-page .stop h1, .drive-page .stop h2 {
  font-size: clamp(2rem, 3.5vw, 3.4rem);
  font-weight: 700; font-stretch: 100%; text-transform: none;
  letter-spacing: -.035em; line-height: 1.08;
}
.drive-page .hud-stops a, .drive-page .hud-stops a[aria-current="step"],
.drive-page .hud-links a:not(.btn), .drive-page .view-toggle,
.drive-page .stop h3, .drive-page .stop summary { font-weight: 650; font-stretch: 100%; }
.drive-page .hud-stops a { text-transform: none; }
.drive-page .mode-list b, .drive-page .crew-list b,
.drive-page .hud-crew .bill-name, .drive-page .hud-crew .bill-row[data-rank] .bill-name {
  font-size: 1.25rem; font-weight: 700; font-stretch: 100%; text-transform: none; line-height: 1.2;
}
.drive-page .stop .code-ticket-code { font-weight: 700; font-stretch: 100%; font-size: clamp(2rem, 3vw, 3rem); }

/* Match the classic page's quieter type scale and glass surfaces. */
.drive-page { line-height: 1.6; }
.drive-page .hud-top {
  background: rgba(251, 253, 252, .88);
  border-bottom: 1px solid rgba(5, 46, 43, .09);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.drive-page .wordmark { font-weight: 700; font-stretch: 100%; }
.drive-page .hud-links { gap: 14px; }
.drive-page .hud-links a:not(.btn), .drive-page .view-toggle, .drive-page .btn { font-size: .95rem; font-weight: 650; font-stretch: 100%; }
.drive-page .btn-ink { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 24px -14px rgba(5,46,43,.5); }
.drive-page .view-toggle { border: 1px solid rgba(5,46,43,.2); background: rgba(255,255,255,.75); }
.drive-page .trip-card, .drive-page .stop, .drive-page .hud-stops > ol {
  background: rgba(251, 253, 252, .94);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 18px 45px -25px rgba(5,46,43,.32), inset 0 1px 0 rgba(255,255,255,.8);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}
.drive-page .stop { gap: 16px; padding: clamp(22px, 2.5vw, 30px); }
.drive-page .stop h1 { font-size: clamp(2.35rem, 3.5vw, 3.25rem); line-height: 1.1; }
.drive-page .stop h2 { font-size: clamp(2rem, 3.2vw, 3rem); line-height: 1.12; }
.drive-page .stop h3 { font-size: 1.125rem; line-height: 1.35; }
.drive-page .stop p, .drive-page .stop .lede { font-size: 1rem; line-height: 1.6; }
.drive-page .stop .lede { font-weight: 500; }
.drive-page .hud-crew .bill { gap: 4px; border: 0; }
.drive-page .hud-crew .bill-row {
  border: 1px solid rgba(255,255,255,.8); border-radius: 12px;
  background: rgba(251,253,252,.92); padding: 8px 12px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.drive-page .hud-crew .bill-meta { font-size: .8rem; font-weight: 650; font-stretch: 100%; text-transform: none; letter-spacing: 0; }
.drive-page .hud-crew .bill-note { display: inline-block; padding: 5px 9px; border-radius: 9px; background: rgba(251,253,252,.92); }
.drive-page .hud-stops a { font-size: .9rem; line-height: 1.2; }
.drive-page .stop .stub { padding: 18px 0 0; border: 0; border-top: 1px solid #dce9e5; }
.drive-page .stop .stub-label, .drive-page .code-ticket-label { font-size: .875rem; font-weight: 700; font-stretch: 100%; letter-spacing: .04em; }
.drive-page .stop .code-ticket { border: 1px solid #cce6dd; border-radius: 20px; padding: 20px 24px; }
.drive-page .stop .code-ticket::before, .drive-page .stop .code-ticket::after { display: none; }
.drive-page .mode-list, .drive-page .crew-list, .drive-page .stats, .drive-page .stop .faq-list { border-top: 1px solid #dce9e5; }
.drive-page .mode-list li, .drive-page .crew-list li, .drive-page .stop details { border-bottom: 1px solid #dce9e5; }
.drive-page .mode-list b, .drive-page .crew-list b { font-size: 1.05rem; font-weight: 650; }
.drive-page .stats dd { font-size: 1.5rem; font-weight: 700; font-stretch: 100%; }
.drive-page .stats dt { font-weight: 700; font-stretch: 100%; }
.drive-page .react-row button { font-weight: 650; font-stretch: 100%; }
.drive-page .stop summary { font-size: 1rem; line-height: 1.4; }
.drive-page .drive-go { font-weight: 650; font-stretch: 100%; border-bottom-width: 1px; }
.drive-page .drive-go svg { animation: none; }
.drive-page.night .hud-top { background: rgba(7,33,30,.94); border-color: rgba(255,255,255,.1); }
.drive-page.night .stop, .drive-page.night .trip-card, .drive-page.night .hud-stops > ol,
.drive-page.night .hud-crew .bill-row { background: rgba(7,33,30,.96); border-color: rgba(255,255,255,.14); box-shadow: 0 18px 45px -25px rgba(0,0,0,.6); }
.drive-page.night .hud-crew .bill-note { background: rgba(7,33,30,.96); }
.drive-page.night .view-toggle { background: transparent; border-color: rgba(255,255,255,.55); }
.drive-page.night .view-toggle[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.drive-page.night .stop .code-ticket { background: #15483e; border-color: rgba(255,255,255,.2); }
.drive-page.night .stop .code-ticket-label, .drive-page.night .stop .code-ticket-code { color: var(--paper); }
.drive-page.night .mode-list, .drive-page.night .mode-list li, .drive-page.night .crew-list,
.drive-page.night .crew-list li, .drive-page.night .stats, .drive-page.night .stop .faq-list,
.drive-page.night .stop details, .drive-page.night .stop .stub { border-color: rgba(255,255,255,.2); }
@media (max-width: 1080px) {
  .drive-page .stop { padding: 20px; gap: 14px; }
  .drive-page .stop h1 { font-size: clamp(2.15rem, 8vw, 2.7rem); }
  .drive-page .stop h2 { font-size: clamp(1.9rem, 7vw, 2.5rem); }
  .drive-page .hud-stops a { font-size: .85rem; }
}

/* Trip stages: compact, readable cards that grow only as much as they need. */
.drive-page .stops { width: min(440px, calc(100vw - 2 * var(--pad-x))); top: 92px; bottom: 280px; }
.drive-page .stop {
  inset: 0 0 auto; max-height: 100%; height: auto; overflow-x: hidden; overflow-y: auto;
  padding: 26px; gap: 14px; border-radius: 24px;
  scrollbar-width: thin; scrollbar-color: #a8c8be transparent;
  overscroll-behavior: contain;
}
.drive-page .stop::-webkit-scrollbar { width: 7px; }
.drive-page .stop::-webkit-scrollbar-track { background: transparent; margin: 18px 0; }
.drive-page .stop::-webkit-scrollbar-thumb { background: #a8c8be; border: 2px solid transparent; background-clip: padding-box; border-radius: 10px; }
.drive-page .stop .stage-label {
  margin: 0; color: #08735f; font-size: .75rem; line-height: 1.3;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.drive-page .stop h1, .drive-page .stop h2 {
  font-size: clamp(1.8rem, 2.7vw, 2.5rem); font-weight: 700; line-height: 1.12; letter-spacing: -.035em;
}
.drive-page .stop h1 span, .drive-page .stop h2 span { display: inline; }
.drive-page .stop p, .drive-page .stop .lede { font-size: .975rem; line-height: 1.6; }
.drive-page .stop .lede { color: var(--ink); }
.drive-page .stop h3 { margin: 6px 0 0; font-size: 1.05rem; }
.drive-page .drive-go { margin-top: 4px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--ink); color: #c9eee4; text-decoration: none; }
.drive-page .stop .code-ticket { justify-content: space-between; gap: 12px; padding: 16px 18px; }
.drive-page .stop .code-ticket-code { font-size: clamp(1.8rem, 2.5vw, 2.4rem); letter-spacing: .06em; }
.drive-page .mode-list { border-top: 0; display: grid; gap: 6px; }
.drive-page .mode-list li { padding: 9px 12px; border: 1px solid #e1ebe7; border-radius: 12px; background: rgba(255,255,255,.65); font-size: .9rem; font-weight: 500; }
.drive-page .mode-list b { font-size: .95rem; }
.drive-page .react-row button { padding: 0 13px; font-size: .9rem; border-color: #d7e5df; }
.drive-page .stats { border: 0; padding: 0; gap: 8px; }
.drive-page .stats div { padding: 12px; border-radius: 14px; background: #edf6f3; }
.drive-page .stats dt { font-size: .75rem; letter-spacing: .04em; }
.drive-page .stats dd { margin-top: 6px; font-size: 1.15rem; line-height: 1.2; }
.drive-page .stop .stub { padding-top: 12px; }
.drive-page .stop .stub-row { flex-wrap: wrap; }
.drive-page .stop .stub input { min-width: min(100%, 150px); }
.drive-page .stop .form-help, .drive-page .stop .form-msg, .drive-page .stop .end-links { font-size: .875rem; line-height: 1.45; }
.drive-page.night .stop { scrollbar-color: #557b70 transparent; }
.drive-page.night .stop::-webkit-scrollbar-thumb { background-color: #557b70; }
.drive-page.night .stop .stage-label { color: #a9e1d2; }
.drive-page.night .drive-go { background: #c9eee4; color: var(--ink); }
.drive-page.night .mode-list li, .drive-page.night .stats div { background: #123b34; border-color: rgba(255,255,255,.14); }
@media (max-width: 1080px) {
  .drive-page .stops { left: 12px; right: 12px; top: auto; bottom: 74px; width: auto; height: min(54svh, 460px); }
  .drive-page .stop { top: auto; bottom: 0; padding: 20px; gap: 12px; border-radius: 22px; }
  .drive-page .stop h1, .drive-page .stop h2 { font-size: clamp(1.8rem, 6vw, 2.25rem); }
}

/* Keep the crew available without taking room from the trip details. */
@media (min-width: 1081px) {
  .drive-page .stops { width: min(470px, calc(100vw - 2 * var(--pad-x))); bottom: 96px; }
  .drive-page .hud-crew { left: auto; right: var(--pad-x); bottom: 92px; width: min(320px, calc(100vw - 2 * var(--pad-x))); }
}
.drive-page .crew-disclosure {
  border: 1px solid rgba(255,255,255,.85); border-radius: 18px;
  background: rgba(251,253,252,.94); box-shadow: 0 18px 45px -25px rgba(5,46,43,.32);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 4px 10px 10px;
}
.drive-page .crew-disclosure:not([open]) { padding-bottom: 4px; }
.drive-page .crew-disclosure summary {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px;
  list-style: none; cursor: pointer; font-weight: 650; font-size: .95rem; color: var(--ink);
}
.drive-page .crew-disclosure summary::-webkit-details-marker { display: none; }
.drive-page .crew-disclosure summary span { margin-left: auto; font-size: .85rem; font-weight: 500; color: var(--muted); }
.drive-page .crew-disclosure summary::after { content: "+"; font-size: 1.2rem; font-weight: 500; line-height: 1; }
.drive-page .crew-disclosure[open] summary::after { content: "−"; }
.drive-page .crew-disclosure .bill-row { box-shadow: none; }
.drive-page .crew-disclosure .bill-note { margin-top: 7px; font-size: .8rem; }
.drive-page.night .crew-disclosure { background: rgba(7,33,30,.96); border-color: rgba(255,255,255,.14); }
.drive-page.night .crew-disclosure summary { color: var(--paper); }
.drive-page.night .crew-disclosure summary span { color: var(--on-ink-2); }
@media (max-width: 1080px) {
  .drive-page .stops { height: min(68svh, 620px); }
}

/* Group stays beside the stage navigation; its details open above it. */
.drive-page .hud-stops { align-items: flex-end; gap: 8px; }
.drive-page .hud-stops > ol { min-width: 0; }
.drive-page .hud-stops .hud-crew { display: block; position: relative; inset: auto; flex: none; width: auto; }
.drive-page .crew-disclosure { position: relative; padding: 4px; border-radius: 999px; }
.drive-page .crew-disclosure summary { padding: 0 12px; min-height: 44px; white-space: nowrap; }
.drive-page .crew-disclosure .bill, .drive-page .crew-disclosure .bill-note { position: absolute; right: 0; width: min(300px, calc(100vw - 24px)); }
.drive-page .crew-disclosure .bill { bottom: calc(100% + 42px); padding: 10px; border: 1px solid rgba(255,255,255,.8); border-radius: 18px; background: rgba(251,253,252,.97); box-shadow: 0 18px 45px -25px rgba(5,46,43,.32); }
.drive-page .crew-disclosure .bill-note { bottom: calc(100% + 5px); margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(251,253,252,.97); }
.drive-page.night .crew-disclosure .bill, .drive-page.night .crew-disclosure .bill-note { background: rgba(7,33,30,.98); border-color: rgba(255,255,255,.15); }
.drive-page .maplibregl-ctrl-bottom-right { left: 0; right: auto; }
.drive-page .maplibregl-ctrl-bottom-right .maplibregl-ctrl { float: left; margin: 0 0 10px 10px; }
.drive-page .maplibregl-ctrl-attrib { transform: scale(.7); transform-origin: bottom left; background-color: rgba(255,255,255,.55); }
.drive-page .maplibregl-ctrl-attrib:hover, .drive-page .maplibregl-ctrl-attrib:focus-within { background-color: rgba(255,255,255,.95); }
@media (max-width: 1080px) {
  .drive-page .hud-stops { gap: 6px; }
  .drive-page .crew-disclosure summary { padding: 0 10px; font-size: .85rem; }
}

/* Keep the trip stages centered and the group control at the right edge. */
.drive-page .hud-stops { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; }
.drive-page .hud-stops > ol { grid-column: 2; max-width: 100%; }
.drive-page .hud-stops .hud-crew { grid-column: 3; justify-self: end; }
@media (max-width: 1080px) {
  .drive-page .hud-stops { grid-template-columns: minmax(0, 1fr) auto; }
  .drive-page .hud-stops > ol { grid-column: 1; justify-self: center; }
  .drive-page .hud-stops .hud-crew { grid-column: 2; }
}

/* Frosted panels retain readable text against the moving map. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .drive-page .stop, .drive-page .crew-disclosure,
  .drive-page .crew-disclosure .bill, .drive-page .crew-disclosure .bill-note {
    background: rgba(248, 253, 251, .53);
    border-color: rgba(255, 255, 255, .65);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
    backdrop-filter: blur(24px) saturate(135%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 16px 40px -24px rgba(5,46,43,.35);
  }
  .drive-page .crew-disclosure .bill-row { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.35); }
  .drive-page .mode-list li, .drive-page .stats div { background: rgba(255,255,255,.3); }
  .drive-page.night .stop, .drive-page.night .crew-disclosure,
  .drive-page.night .crew-disclosure .bill, .drive-page.night .crew-disclosure .bill-note {
    background: rgba(7, 33, 30, .64);
    border-color: rgba(255,255,255,.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 16px 40px -24px rgba(0,0,0,.65);
  }
  .drive-page.night .crew-disclosure .bill-row { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); }
  .drive-page.night .mode-list li, .drive-page.night .stats div { background: rgba(255,255,255,.07); }
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .drive-page .hud-stops > ol {
    background: rgba(248, 253, 251, .53);
    border-color: rgba(255, 255, 255, .65);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
    backdrop-filter: blur(24px) saturate(135%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 16px 40px -24px rgba(5,46,43,.35);
  }
  .drive-page.night .hud-stops > ol {
    background: rgba(7, 33, 30, .64);
    border-color: rgba(255,255,255,.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 16px 40px -24px rgba(0,0,0,.65);
  }
}

/* Compact day/night switch with a stable accessible name. */
.drive-page .view-toggle {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  width: 70px; height: 44px; min-height: 44px; padding: 0 10px; flex: none;
  border: 1px solid rgba(5,46,43,.2); border-radius: 999px;
  background: rgba(255,255,255,.75); color: #345f55;
}
.drive-page .view-toggle .theme-sun, .drive-page .view-toggle .theme-moon { position: relative; z-index: 1; font-size: 16px; line-height: 1; }
.drive-page .view-toggle .theme-thumb {
  position: absolute; z-index: 0; left: 5px; top: 5px; width: 32px; height: 32px;
  border-radius: 50%; background: #c9eee4; box-shadow: 0 2px 8px rgba(5,46,43,.16);
  transition: transform .25s ease;
}
.drive-page .view-toggle[aria-pressed="true"] .theme-thumb { transform: translateX(26px); }
.drive-page.night .view-toggle[aria-pressed="true"] { background: rgba(7,33,30,.7); border-color: rgba(255,255,255,.3); color: #eaf8f4; }
.drive-page.night .view-toggle .theme-thumb { background: #245b50; }
@media (prefers-reduced-motion: reduce) { .drive-page .view-toggle .theme-thumb { transition: none; } }
.drive-page .view-toggle .theme-sun, .drive-page .view-toggle .theme-moon { display: grid; place-items: center; width: 18px; height: 18px; }
.drive-page .view-toggle svg { display: block; width: 18px; height: 18px; }
