.drive-launch {
  border-color: #d6a938;
  background: #272116;
  color: #fff4cf;
  font-weight: 800;
}

.drive-launch:hover:not(:disabled) {
  border-color: #f4c95d;
  background: #3b3019;
}

.drive-launch:disabled {
  cursor: wait;
  opacity: 0.58;
}

.drive-hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  color: #f5fbfd;
  font-family: inherit;
}

.drive-hud[hidden] {
  display: none;
}

.drive-dashboard {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 54px;
  padding: 0.45rem 0.55rem 0.45rem 0.85rem;
  border: 1px solid rgba(166, 223, 232, 0.34);
  border-radius: 7px;
  background: rgba(7, 17, 23, 0.88);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.drive-mode-label {
  color: #8ee8dc;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drive-speed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 118px;
}

.drive-speed strong {
  min-width: 3ch;
  font-size: 1.65rem;
  line-height: 1;
  text-align: right;
}

.drive-units {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  border: 1px solid #3e5962;
  border-radius: 4px;
}

.drive-units button {
  min-width: 34px;
  min-height: 26px;
  padding: 0 0.3rem;
  border: 0;
  border-right: 1px solid #3e5962;
  background: #111c22;
  color: #aebdc2;
  font: inherit;
  font-size: 0.58rem;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}

.drive-units button:last-child {
  border-right: 0;
}

.drive-units button[aria-pressed="true"] {
  background: #176d72;
  color: #ffffff;
}

.drive-units button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #54d6c3;
  outline-offset: -2px;
}

.drive-gear {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #3e5962;
  border-radius: 4px;
  color: #f4c95d;
  font-weight: 900;
}

.drive-boost {
  color: #8b9ba1;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drive-boost.is-active {
  color: #ff8e78;
}

.drive-command,
.drive-touch button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #49616a;
  border-radius: 6px;
  background: #111c22;
  color: #f5fbfd;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.drive-command:hover,
.drive-command:focus-visible,
.drive-touch button:hover,
.drive-touch button:focus-visible {
  border-color: #54d6c3;
  outline: 2px solid rgba(84, 214, 195, 0.35);
  outline-offset: 2px;
}

.drive-exit {
  border-color: #a5524d;
  background: #321b1c;
}

.drive-camera {
  border-color: #427d86;
  background: #10272d;
}

.drive-camera[aria-pressed="true"] {
  border-color: #54d6c3;
  color: #8ee8dc;
}

.drive-gps[aria-pressed="true"] {
  border-color: #f4c95d;
  color: #f4c95d;
}

.drive-route-cue {
  position: absolute;
  top: max(5.4rem, calc(env(safe-area-inset-top) + 4.4rem));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.48rem 0.78rem;
  border: 1px solid rgba(244, 201, 93, 0.65);
  border-radius: 6px;
  background: rgba(7, 17, 23, 0.86);
  color: #f5fbfd;
  font-size: 0.82rem;
  font-weight: 800;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.drive-route-cue[hidden] {
  display: none;
}

.drive-route-arrow {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #f4c95d;
  border-radius: 50%;
  color: #f4c95d;
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 120ms linear;
}

.drive-gps-panel {
  position: absolute;
  top: max(5.4rem, calc(env(safe-area-inset-top) + 4.4rem));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 6;
  display: grid;
  width: min(330px, calc(100vw - 2rem));
  max-height: calc(100dvh - 7rem);
  gap: 0.42rem;
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid rgba(166, 223, 232, 0.4);
  border-radius: 7px;
  background: rgba(7, 17, 23, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.drive-gps-panel[hidden] {
  display: none;
}

.drive-gps-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.drive-gps-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.drive-gps-heading button,
.drive-gps-actions button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #49616a;
  border-radius: 6px;
  background: #111c22;
  color: #f5fbfd;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.drive-gps-heading button {
  width: 44px;
  padding: 0;
  font-size: 1rem;
}

.drive-gps-panel label {
  color: #b9c8cd;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drive-gps-panel input {
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #49616a;
  border-radius: 4px;
  background: #101b21;
  color: #f5fbfd;
  padding: 0 0.7rem;
  font: inherit;
}

.drive-gps-panel input:focus {
  border-color: #54d6c3;
  outline: 2px solid rgba(84, 214, 195, 0.28);
}

.drive-gps-status {
  min-height: 1.15rem;
  margin: 0.2rem 0 0;
  color: #8ee8dc;
  font-size: 0.76rem;
}

.drive-gps-status.is-error {
  color: #ff9d8c;
}

.drive-gps-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.drive-gps-actions button:first-child {
  border-color: #54d6c3;
  background: #123b3f;
}

.drive-bonnet {
  position: absolute;
  right: 50%;
  bottom: -6.5rem;
  z-index: 4;
  display: none;
  width: min(32rem, 48vw);
  height: 9rem;
  border: 2px solid rgba(200, 245, 248, 0.42);
  border-radius: 48% 48% 0 0;
  background: #168d9a;
  box-shadow: inset 0 1.2rem 0 rgba(213, 250, 252, 0.2), 0 -1rem 4rem rgba(0, 0, 0, 0.24);
  transform: translateX(50%);
  pointer-events: none;
}

.drive-bonnet span {
  position: absolute;
  top: 1.1rem;
  left: 50%;
  width: 38%;
  height: 2px;
  background: rgba(230, 255, 255, 0.35);
  transform: translateX(-50%);
}

.map-shell.drive-first-person .drive-bonnet {
  display: block;
}

.map-shell.drive-collision::after {
  position: absolute;
  inset: 0;
  z-index: 18;
  border: 5px solid rgba(255, 112, 92, 0.78);
  content: "";
  pointer-events: none;
}

.drive-touch {
  position: absolute;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 0.65rem;
  pointer-events: auto;
}

.drive-touch-steering {
  left: max(1rem, env(safe-area-inset-left));
}

.drive-touch-motion {
  right: max(1rem, env(safe-area-inset-right));
}

.drive-stick {
  position: relative;
  width: 124px;
  height: 124px;
  border: 2px solid rgba(238, 248, 249, 0.25);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(84, 214, 195, 0.13) 0 24%, transparent 25%),
    repeating-conic-gradient(from 45deg, rgba(238, 248, 249, 0.09) 0 2deg, transparent 2deg 90deg),
    rgba(7, 18, 24, 0.72);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.46), 0 8px 28px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.drive-stick:focus-visible {
  outline: 3px solid rgba(84, 214, 195, 0.58);
  outline-offset: 3px;
}

.drive-stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: #54d6c3;
  box-shadow: 0 0 22px rgba(84, 214, 195, 0.4), 0 7px 16px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.drive-touch-motion {
  display: grid;
  grid-template-columns: repeat(2, minmax(66px, 82px));
  gap: 8px;
}

.drive-touch button {
  width: auto;
  height: 58px;
  border-color: rgba(179, 220, 228, 0.48);
  background: rgba(8, 20, 27, 0.84);
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
}

.drive-touch button span {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
}

.drive-accelerate {
  box-shadow: inset 0 3px 0 rgba(84, 214, 195, 0.8);
}

.drive-brake {
  box-shadow: inset 0 3px 0 rgba(255, 142, 120, 0.82);
}

.drive-boost-action {
  grid-column: span 2;
  background: rgba(55, 44, 18, 0.9) !important;
  box-shadow: inset 0 3px 0 rgba(244, 201, 93, 0.9);
}

.drive-touch button:active {
  border-color: #f4c95d;
  background: rgba(54, 45, 22, 0.94);
  transform: translateY(1px);
}

.cerulean-drive-active {
  overflow: hidden;
}

.map-shell.drive-active {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.map-shell.drive-active .control-panel,
.map-shell.drive-active .layer-panel,
.map-shell.drive-active .inspector-panel,
.map-shell.drive-active .attribution-toggle,
.map-shell.drive-active .attribution-panel,
.map-shell.drive-active .maplibregl-control-container {
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 821px) {
  .drive-touch {
    display: none;
  }
}

@media (max-width: 700px) {
  .drive-dashboard {
    right: max(0.6rem, env(safe-area-inset-right));
    left: max(0.6rem, env(safe-area-inset-left));
    justify-content: center;
    gap: 0.42rem;
    transform: none;
  }

  .drive-mode-label,
  .drive-boost {
    display: none;
  }

  .drive-speed {
    min-width: 108px;
  }

  .drive-command {
    padding: 0 0.65rem;
  }

  .drive-camera {
    min-width: 52px;
  }

  .drive-route-cue {
    top: max(5rem, calc(env(safe-area-inset-top) + 4.1rem));
    max-width: calc(100vw - 1.2rem);
  }

  .drive-gps-panel {
    top: max(5rem, calc(env(safe-area-inset-top) + 4.1rem));
    right: max(0.6rem, env(safe-area-inset-right));
    left: max(0.6rem, env(safe-area-inset-left));
    width: auto;
    max-height: min(48dvh, 24rem);
  }

  .drive-touch {
    gap: 0.4rem;
  }

  .drive-stick {
    width: 116px;
    height: 116px;
  }

  .drive-touch-motion {
    grid-template-columns: repeat(2, minmax(62px, 76px));
  }
}

@media (max-width: 430px) {
  .drive-dashboard {
    justify-content: space-between;
  }

  .drive-gear {
    display: none;
  }

  .drive-command {
    padding: 0 0.52rem;
    font-size: 0.82rem;
  }

  .drive-speed {
    min-width: 98px;
  }

  .drive-speed strong {
    min-width: 2ch;
    font-size: 1.45rem;
  }

  .drive-units button {
    min-width: 31px;
    padding: 0 0.2rem;
    font-size: 0.54rem;
  }

  .drive-gps {
    min-width: 46px;
  }

  .drive-bonnet {
    bottom: -5.5rem;
    width: min(11rem, 44vw);
    height: 7rem;
  }

  .drive-stick {
    width: 106px;
    height: 106px;
  }

  .drive-stick-knob {
    width: 38px;
    height: 38px;
  }

  .drive-touch-motion {
    grid-template-columns: repeat(2, minmax(58px, 68px));
  }

  .drive-touch button {
    height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drive-touch button,
  .drive-command {
    transition: none;
  }
}
