.drive {
  --ink: #172e2c;
  --mint: #caff80;
  --panel: #102c2c;
  color: var(--ink);
  border-radius: 28px;
  background: #edf2ea;
  padding: 24px;
  box-shadow: 0 20px 80px #143f3420;
  margin-bottom: 48px;
}
.drive button,
.drive select,
.drive input {
  font: inherit;
}
.drive button {
  cursor: pointer;
  border: 1px solid #bacbbd;
  border-radius: 10px;
  padding: 12px 18px;
  color: var(--ink);
  background: #fff;
}
.drive button:hover,
.drive button:focus-visible {
  background: #dcfbbf;
  outline: 2px solid #708c4a;
}
.drive-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.drive-top h2 {
  font-size: clamp(24px, 4vw, 42px);
  margin: 8px 0 20px;
  letter-spacing: -1px;
}
.drive-kicker {
  font: 11px monospace;
  letter-spacing: 3px;
}
.drive-badge {
  border: 1px solid #b7cbb4;
  padding: 8px 12px;
  border-radius: 20px;
  font: 12px monospace;
}
.drive-search label {
  font-size: 12px;
  display: block;
  margin: 6px 0;
}
.drive-search > div {
  display: flex;
  gap: 8px;
}
.drive input {
  flex: 1;
  min-width: 100px;
}
.drive input,
.drive select {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid #b7c6b3;
  background: #fff;
  color: var(--ink);
}
.drive-notice {
  font-size: 13px;
  min-height: 20px;
  margin: 12px 0;
}
.drive-world {
  height: clamp(360px, 56vw, 660px);
  position: relative;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  background: #dddcd0;
  touch-action: none;
  isolation: isolate;
  direction: ltr;
}
.drive-world:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(35deg, #d4dbcc, #ece9d7);
}
#tileLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#tileLayer img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none !important;
  width: 256px;
  height: 256px;
  user-select: none;
}
.drive-maptools {
  position: absolute;
  right: 14px;
  top: 14px;
  display: flex;
  gap: 5px;
  z-index: 5;
}
.drive-maptools button {
  padding: 10px;
  background: #fffffff0;
  box-shadow: 0 2px 10px #163b321a;
}
.drive-attribution {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #fffffff2;
  padding: 3px 8px;
  font:
    11px Arial,
    sans-serif;
  z-index: 8;
  color: #183e42;
}
.drive-attribution a {
  color: #164f63;
}
.vehicle {
  position: absolute;
  width: 25px;
  height: 48px;
  left: 50%;
  top: 50%;
  z-index: 4;
  pointer-events: none;
  border-radius: 9px 9px 7px 7px;
  background: linear-gradient(
    90deg,
    #9a3422,
    #f47342 24%,
    #fa9c62 50%,
    #e35a35 75%,
    #8c291e
  );
  border: 2px solid #9c3b2c;
  box-shadow:
    3px 5px 3px #0006,
    -3px 9px 0 -1px #10252c,
    3px 9px 0 -1px #10252c,
    -3px -9px 0 -1px #10252c,
    3px -9px 0 -1px #10252c;
}
.vehicle:before,
.vehicle:after {
  content: "";
  position: absolute;
  top: 2px;
  width: 6px;
  height: 4px;
  background: #fff2ae;
  border-radius: 2px;
}
.vehicle:before {
  left: 1px;
}
.vehicle:after {
  right: 1px;
}
.vehicle .window {
  position: absolute;
  left: 3px;
  right: 3px;
  height: 10px;
  background: #19373f;
  border: 1px solid #acb5aa;
  border-radius: 4px;
}
.vehicle .front {
  top: 11px;
}
.vehicle .rear {
  bottom: 8px;
  height: 7px;
}
.vehicle.bus {
  width: 30px;
  height: 86px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #aa8d38,
    #ffdc6a 20%,
    #fff0b0 50%,
    #d5ac40
  );
  border-color: #a5842a;
}
.vehicle.bus .front {
  top: 4px;
}
.vehicle.bus .rear {
  bottom: 4px;
}
.vehicle.bus b {
  position: absolute;
  top: 22px;
  left: 7px;
  right: 7px;
  height: 42px;
  border-radius: 3px;
  background: repeating-linear-gradient(#d9c67e 0 8px, #b5a257 9px 11px);
}
.drive-start {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #102e2b91;
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 20px;
}
.drive-start[hidden] {
  display: none;
}
.drive-start > span {
  font-size: 58px;
  color: var(--mint);
}
.drive-start h3 {
  font-size: 36px;
  margin: 8px;
}
.drive-start p {
  max-width: 330px;
}
.drive-start button {
  background: var(--mint);
  font-weight: bold;
  padding: 16px 28px;
}
.drive-dashboard {
  display: flex;
  gap: 28px;
  align-items: center;
  background: var(--panel);
  color: #fff;
  padding: 24px;
  border-radius: 0 0 18px 18px;
  direction: ltr;
}
.drive-garage small {
  font: 10px monospace;
  letter-spacing: 2px;
  color: #c4d1bd;
}
.drive-garage > div {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}
.drive-garage button {
  background: #244342;
  color: #fff;
  border-color: #45635a;
  padding: 9px 14px;
}
.drive button.active,
.drive button.held {
  background: var(--mint);
  color: #19372b;
}
.drive-speed {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 10px;
  align-items: center;
  min-width: 110px;
}
.drive-speed strong {
  font: 60px monospace;
  font-weight: 700;
  color: var(--mint);
  grid-row: span 2;
}
.drive-speed span {
  font: 11px monospace;
}
.drive-speed small {
  font-size: 20px;
}
.drive-dials {
  display: grid;
  gap: 8px;
  font: 12px monospace;
  color: #b3c9bf;
  flex: 1;
}
.drive-wheel {
  width: 110px;
  height: 110px;
  border: 10px solid #0a1c1e;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, #314c4d 0 15px, transparent 16px);
  box-shadow:
    0 2px 0 #6b8282,
    inset 0 2px 0 #6b8282;
  flex-shrink: 0;
}
.drive-wheel:before,
.drive-wheel:after,
.drive-wheel i {
  content: "";
  position: absolute;
  background: #0a1c1e;
  width: 40px;
  height: 12px;
  top: 40px;
  left: 0;
  transform: rotate(18deg);
}
.drive-wheel:after {
  left: 49px;
  transform: rotate(-18deg);
}
.drive-wheel i {
  transform: rotate(90deg);
  top: 65px;
  left: 26px;
}
.drive-wheel b {
  position: absolute;
  inset: 33px;
  text-align: center;
  color: #d2e2ce;
}
.drive-touch {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  direction: ltr;
}
.drive-touch button {
  touch-action: none;
  user-select: none;
  min-height: 56px;
  flex: 1;
  font-weight: bold;
}
.drive-touch button:last-child {
  background: #caff80;
  flex: 2;
}
.drive-help,
.drive details {
  font-size: 13px;
  line-height: 1.8;
  margin-top: 16px;
}
.drive summary {
  cursor: pointer;
}
.drive:fullscreen {
  overflow: auto;
  border-radius: 0;
  padding: 16px;
  background: #edf2ea;
}
.drive:fullscreen .drive-world {
  height: calc(100dvh - 330px);
  min-height: 270px;
}
@media (max-width: 650px) {
  .drive {
    padding: 12px;
    border-radius: 18px;
  }
  .drive-top {
    display: block;
  }
  .drive-badge {
    display: inline-block;
    margin-bottom: 10px;
  }
  .drive-search > div {
    flex-wrap: wrap;
  }
  .drive-search select {
    width: 100%;
  }
  .drive-world {
    height: 440px;
  }
  .drive-maptools {
    gap: 3px;
    right: 8px;
    top: 8px;
  }
  .drive-maptools button {
    padding: 9px;
  }
  .drive-dashboard {
    gap: 14px;
    padding: 14px;
    flex-wrap: wrap;
  }
  .drive-wheel {
    width: 74px;
    height: 74px;
    border-width: 7px;
    display: none;
  }
  .drive-speed strong {
    font-size: 48px;
  }
  .drive-dials {
    flex-basis: 100%;
    grid-template-columns: 1fr 1fr;
  }
  .drive-dials code {
    grid-column: span 2;
  }
  .drive-touch {
    gap: 5px;
  }
  .drive-touch button {
    padding: 10px 6px;
    font-size: 12px;
  }
  .drive-garage {
    flex: 1;
  }
  .drive-start h3 {
    font-size: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .drive * {
    scroll-behavior: auto;
  }
}

.drive-search input {
  flex: 1 1 300px !important;
  width: auto !important;
}
.drive-search select {
  flex: 0 0 230px;
  width: 230px;
}
.drive.expanded {
  position: fixed;
  inset: 0;
  z-index: 100000;
  overflow: auto;
  margin: 0;
  border-radius: 0;
  padding: 16px;
}
.drive.expanded .drive-world {
  height: calc(100dvh - 330px);
  min-height: 270px;
}
@media (max-width: 650px) {
  .drive-search input {
    flex-basis: 180px !important;
  }
  .drive-search select {
    flex: 1 1 100%;
    width: 100%;
  }
}

body.drive-expanded .site-header,
body.drive-expanded .site-header-space,
body.drive-expanded .site-footer,
body.drive-expanded #site-ai-launcher {
  display: none !important;
}
body.drive-expanded {
  overflow: hidden;
}
body.drive-expanded #main {
  position: relative;
  z-index: 2147483000;
}
.drive.expanded {
  background: #edf2ea !important;
  width: 100vw;
  height: 100dvh;
  box-sizing: border-box;
}
.drive.expanded .drive-top h2 {
  font-size: 24px;
  margin: 4px 0 8px;
}
.drive.expanded .drive-top {
  margin: 0;
}
.drive.expanded .drive-help,
.drive.expanded details {
  display: none;
}
.drive.expanded .drive-world {
  height: calc(100dvh - 380px);
  min-height: 160px;
}
.drive.expanded .drive-dashboard {
  padding: 10px 20px;
}
.drive.expanded .drive-wheel {
  width: 74px;
  height: 74px;
  display: none;
}
.drive.expanded .drive-touch {
  margin-top: 8px;
}
.drive.expanded .drive-search label {
  margin: 0;
}
.drive.expanded .drive-notice {
  margin: 4px 0;
}
@media (max-width: 650px) {
  .drive.expanded .drive-world {
    height: calc(100dvh - 450px);
  }
}

/* Separate tyre geometry: no spread shadows around the vehicle body. */
.drive .vehicle {
  box-shadow: none;
  filter: drop-shadow(1px 2px 2px #0005);
  will-change: transform;
}
.drive .vehicle > span {
  position: absolute;
  left: -4px;
  top: 8px;
  width: 4px;
  height: 10px;
  border-radius: 2px;
  background: #172326;
  box-shadow:
    27px 0 #172326,
    0 23px #172326,
    27px 23px #172326;
  z-index: -1;
}
.drive .vehicle.bus > span {
  top: 14px;
  box-shadow:
    32px 0 #172326,
    0 50px #172326,
    32px 50px #172326;
}
.drive .vehicle.car > b {
  display: none;
}

.drive-sources {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.drive-sources small {
  font-size: 12px;
  color: #4c6257;
}
.drive.expanded .drive-sources {
  margin: 4px 0;
}
.drive.expanded .drive-world {
  height: calc(100dvh - 440px);
}
.drive.expanded .drive-sources button {
  padding: 6px 12px;
}
.drive-attribution {
  max-width: 100%;
  box-sizing: border-box;
}

.drive-boundary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}
.drive-boundary label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: bold;
}
.drive-boundary input {
  flex: none !important;
  width: 20px !important;
  min-width: 20px;
  height: 20px;
  accent-color: #315c3c;
}
.drive-boundary span {
  color: #3b6546;
}
.drive.expanded .drive-boundary {
  margin-top: 5px;
}
.drive.expanded .drive-world {
  height: calc(100dvh - 475px);
  min-height: 160px;
}

.drive-location {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.drive-location button {
  background: #caff80;
  font-weight: bold;
}
.drive-location span {
  font-size: 12px;
  max-width: 660px;
  color: #415d50;
}
.drive-location button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.drive.expanded .drive-location {
  margin-top: 5px;
}
.drive.expanded .drive-location button {
  padding: 6px 12px;
}
.drive.expanded .drive-world {
  height: calc(100dvh - 525px);
  min-height: 160px;
}
