#drive-actions {
  grid-column: 1/-1;
  display: flex;
  gap: 1px;
}
#tool-panel:has(#routing[hidden]) #drive-actions {
  display: none;
}
#drive-actions button {
  flex: 1;
  min-width: 56px;
  min-height: 56px;
  background: #233845;
  color: #fff;
  font-size: 20px;
}
#drive-actions #start-drive {
  color: #0d2229;
  background: var(--gps-route);
}
#my-location {
  width: 100%;
  margin-top: 6px;
  min-height: 56px;
}
#drive-message {
  color: #fff;
  font-size: 18px;
}
#drive-notice {
  max-width: min(400px, 90vw);
  color: #fff;
  background: #112532;
  padding: 22px;
  border: 1px solid #9ab1bc;
}
#drive-notice p {
  font-size: 21px;
}
#drive-notice button,
#drive-hud button {
  min-height: 56px;
  min-width: 56px;
  padding: 5px 10px;
}
#drive-ok,
#end-drive {
  color: #0c2229;
  background: #81e4da;
}
#drive-hud {
  display: contents;
  pointer-events: none;
  color: #101e29;
  --drive-panel: #f1f5f6;
  --drive-ink: #102331;
  --drive-accent: #125952;
  --drive-stale: #475452;
}
#drive-hud.night {
  --drive-panel: #10212c;
  --drive-ink: #f1f5f6;
  --drive-accent: #81e4da;
  --drive-stale: #b2c2bf;
}
#drive-signal {
  display: block;
  font-size: 24px;
}
#drive-signal:not([hidden]) ~ .drive-turn {
  color: var(--drive-stale);
  --drive-accent: var(--drive-stale);
}
#drive-banner,
#drive-deck {
  background: var(--drive-panel);
  color: var(--drive-ink);
  box-shadow: 0 2px 10px #0e17224d;
}
#drive-banner {
  padding: 9px 14px;
  border-top: 4px solid var(--drive-accent);
}
#drive-provenance {
  display: inline-block;
  padding: 2px 8px;
  background: #244754;
  color: white;
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.drive-turn {
  display: flex;
  align-items: center;
  gap: 12px;
}
#drive-arrow {
  width: 48px;
  flex: none;
  color: var(--drive-accent);
}
.drive-turn b,
.drive-turn strong,
.drive-turn span {
  display: block;
  line-height: 1.1;
}
#drive-distance {
  font-size: clamp(44px, 5vw, 64px);
  color: var(--drive-accent);
}
#drive-instruction {
  font-size: clamp(24px, 3vw, 36px);
}
#drive-street,
#drive-then,
#drive-note,
#drive-road {
  font-size: 20px;
}
#drive-then:not(:empty),
#drive-note:not(:empty) {
  margin-top: 6px;
}
#drive-deck {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 15px;
  pointer-events: auto;
  padding: 4px max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
}
#drive-readout {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
#drive-readout div {
  line-height: 1;
  font-weight: 600;
}
#drive-readout small,
#drive-hud .drive-attribution {
  color: var(--drive-ink);
}
#drive-readout small {
  display: block;
  font-size: 15px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
#drive-readout b {
  font-size: 28px;
}
#drive-readout #drive-speed {
  font-size: 44px;
}
#drive-minutes {
  margin-left: 6px;
}
.drive-controls,
#drive-options {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  max-width: 100%;
}
#drive-hud .drive-controls button,
#drive-options button {
  flex: 1 0 auto;
  white-space: nowrap;
}
#drive-hud button {
  background: #263d4a;
  color: white;
  font-size: 18px;
}
#drive-hud #end-drive {
  background: #84e2d8;
  color: #10232d;
}
#drive-options {
  flex-wrap: wrap;
  background: var(--drive-panel);
}
.driving
  :is(
    #sidebar,
    .toolbar,
    #tool-panel,
    .tools,
    .navigation,
    #locator,
    .map-place,
    #map-hover,
    #map-scale,
    #relief-pop,
    #issue-link
  ) {
  visibility: hidden;
  pointer-events: none;
}
.driving footer {
  visibility: hidden;
  pointer-events: none;
}
.drive-attribution {
  width: 100%;
  font-size: 12px;
  line-height: 1;
}
.drive-marker {
  width: 54px;
  height: 58px;
  filter: drop-shadow(0 3px 4px #0e1722a6);
  pointer-events: none;
}
.drive-marker svg {
  width: 100%;
  height: 100%;
  position: relative;
}
.drive-marker i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--accuracy);
  height: var(--accuracy);
  transform: translate(-50%, -50%) scaleY(var(--flat, 1));
  border-radius: 50%;
  border: 2px solid #126764;
  background: #4cdfd23d;
}
@media (max-width: 720px) {
  #drive-road {
    text-align: center;
  }
  #drive-hud .drive-controls button { padding-inline: 4px; }
}
/* The camera uses the actual unobstructed map rectangle, including after rotation. */
.driving .map-frame {
  display: grid;
  grid-template: "banner" auto "road" minmax(0, 1fr) "deck" auto / minmax(0, 1fr);
}
.driving #map {
  grid-area: road;
  position: relative;
  min-width: 0;
  min-height: 0;
}
.driving #drive-banner,
.driving #drive-deck {
  position: relative;
  min-width: 0;
  pointer-events: auto;
}
.driving #drive-banner {
  grid-area: banner;
  max-height: 32dvh;
  overflow: auto;
  padding-top: max(6px, env(safe-area-inset-top));
}
.driving #drive-deck {
  grid-area: deck;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  align-content: start;
  max-height: 45dvh;
  overflow: auto;
}
@media (orientation: landscape) and (min-width: 540px) {
  .driving .map-frame {
    grid-template: "road banner" minmax(0, 1fr) "road deck" auto / minmax(0, 1fr) clamp(252px, 38%, 390px);
  }
  .driving #drive-banner {
    max-height: none;
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .driving #drive-deck {
    max-height: 58dvh;
    overflow: auto;
    align-content: start;
  }
  #drive-hud .drive-controls button {
    padding-inline: 4px;
  }
}
@media (min-width: 960px) {
  .drive-marker {
    width: 64px;
    height: 69px;
  }
}
@media (min-width: 960px) and (min-height: 540px) {
  .driving .map-frame {
    grid-template: "road" minmax(0, 1fr) "deck" auto / minmax(0, 1fr);
  }
  .driving #drive-banner {
    grid-area: road;
    align-self: start;
    justify-self: start;
    width: min(32%, 420px);
    max-height: 40dvh;
    margin: 10px;
    z-index: 1;
  }
  .driving #drive-deck {
    display: flex;
    justify-content: space-between;
  }
}
#drive-actions[hidden],
#drive-hud [hidden],
#drive-hud[hidden] {
  display: none;
}
