#driving-inputs {
  --wheel-size: clamp(172px, 23vw, 254px);
  --pedal-height: clamp(98px, 13vw, 146px);
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  color: #f5f1dd;
  user-select: none;
  -webkit-user-select: none;
  font:
    12px/1.35 system-ui,
    sans-serif;
}
#driving-inputs[hidden] {
  display: none;
}
.steering-control {
  position: absolute;
  left: 20px;
  bottom: 10px;
  width: var(--wheel-size);
  text-align: center;
}
.wheel-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  text-shadow: 0 1px 5px #000;
}
.wheel-readout > span {
  font-size: 10px;
  color: #d1dace;
}
.wheel-readout output {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.wheel-readout small {
  width: 100%;
  font-size: 9px;
  color: #d1dace;
}
#steering-wheel {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 4px 7px #0007);
}
#steering-wheel.gripped {
  cursor: grabbing;
}
#steering-wheel:focus-visible,
.analog-pedal:focus-visible {
  outline: 2px solid #edc47d;
  outline-offset: 3px;
}
.wheel-graphic {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  will-change: transform;
}
.wheel-hint,
.pedal-hint {
  margin: 1px 0 0;
  color: #f1e9d4;
  font-size: 10px;
  text-shadow:
    0 1px 4px #000,
    0 1px 9px #000;
}
.wheel-contact,
.pedal-contact {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 2px solid #ffe1a2;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #f4cb7433;
  box-shadow:
    0 0 0 5px #f4cb7420,
    0 0 18px #ffd78b88;
  pointer-events: none;
  z-index: 3;
}
.wheel-contact[hidden],
.pedal-contact[hidden] {
  display: none;
}
.pedal-console {
  position: absolute;
  bottom: 12px;
  right: 24px;
  width: clamp(146px, 18vw, 200px);
  text-align: center;
  padding: 8px 9px 5px;
  border-radius: 14px;
  background: linear-gradient(155deg, #12231b85, #07120e40);
  border: 1px solid #dbe7d119;
  backdrop-filter: blur(4px);
}
.input-gears {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 7px;
}
.input-gears button {
  pointer-events: auto;
  touch-action: manipulation;
  width: 34px;
  height: 31px;
  padding: 0;
  border: 1px solid #d0dac535;
  border-radius: 6px;
  background: #14251fd9;
  color: #e8ecdd;
  font: 600 14px system-ui;
}
.input-gears button[aria-pressed="true"] {
  background: #e4c48b;
  color: #243428;
  border-color: #f8d9a2;
  box-shadow: 0 1px 10px #e5ba6e22;
}
#input-speed {
  margin-left: auto;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
#input-speed small {
  display: block;
  font-size: 8px;
  margin-top: 4px;
  color: #c7d2c2;
}
.pedal-pair {
  display: flex;
  justify-content: space-around;
  align-items: end;
  gap: 14px;
}
.pedal-column {
  width: 50%;
}
.pedal-column output {
  display: block;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 5px;
}
.brake-column output {
  color: #ffbca0;
}
.throttle-column output {
  color: #e5d294;
}
.analog-pedal {
  --pressure: 0;
  position: relative;
  height: var(--pedal-height);
  border-radius: 8px;
  pointer-events: auto;
  touch-action: none;
  cursor: ns-resize;
  background: #0b1511;
  box-shadow:
    inset 0 0 0 1px #9aa9983b,
    0 5px 9px #0007;
  -webkit-tap-highlight-color: transparent;
}
.brake-surface {
  height: calc(var(--pedal-height) * 0.83);
  margin-bottom: 0;
}
.pedal-metal {
  position: absolute;
  inset: 4px 12px 4px 4px;
  border-radius: 6px;
  border: 2px solid #9ba697;
  background: linear-gradient(
    110deg,
    #525f55 0%,
    #b4baaa 15%,
    #677568 35%,
    #acb29f 70%,
    #3c4b3f 100%
  );
  box-shadow:
    inset 0 0 0 1px #d5dbcd55,
    1px 2px 3px #000;
  transform: perspective(280px) rotateX(calc(var(--pressure) * -14deg))
    translateY(calc(var(--pressure) * 3px));
  transform-origin: center bottom;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 10px 5px;
}
.pedal-metal::before,
.pedal-metal::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: #25392a;
  box-shadow: 0 1px 0 #e4ead7aa;
}
.pedal-metal::before {
  top: 3px;
}
.pedal-metal::after {
  bottom: 3px;
}
.pedal-metal i {
  height: 5px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #1b281d 0 2px, #2a392c 2px 3px);
  border-top: 1px solid #0e1c15;
  box-shadow: 0 1px 0 #e0e7d06b;
}
.pedal-fill {
  position: absolute;
  inset: auto 1px 1px auto;
  width: 5px;
  height: calc(var(--pressure) * (100% - 2px));
  border-radius: 4px;
  background: #e1c57d;
  box-shadow: 0 0 7px #f0d89f66;
}
.brake-surface .pedal-fill {
  background: #e49173;
}
.pedal-scale {
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 6px;
  line-height: 0.7;
  color: #c8d3c1;
}
.pedal-scale b {
  font-size: 12px;
}
.pedal-label {
  display: block;
  font-size: 7px;
  letter-spacing: 1px;
  padding-top: 7px;
  color: #cbd5c4;
}
.pedal-label b {
  font-size: 10px;
  letter-spacing: 0;
  margin-left: 2px;
}
.pedal-hint {
  font-size: 9px;
  margin-top: 8px;
}
.input-status {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: #0e2119a6;
  border-radius: 5px;
  font-size: 10px;
  max-width: 35%;
  text-align: center;
}
#manual-controls .manual-instructions {
  margin: 4px 0 0;
  font-size: 11px;
  color: #667762;
}
@media (max-width: 700px) {
  #driving-inputs {
    --wheel-size: clamp(144px, 29vw, 192px);
    --pedal-height: clamp(88px, 15vw, 116px);
  }
  .steering-control {
    left: 9px;
    bottom: 9px;
  }
  .pedal-console {
    right: 10px;
    bottom: 9px;
    width: 141px;
    padding: 6px 7px 4px;
  }
  .wheel-readout output {
    font-size: 16px;
  }
  .input-status {
    bottom: auto;
    top: 43px;
    max-width: 68%;
    font-size: 9px;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  #driving-inputs {
    --wheel-size: clamp(138px, 38vh, 205px);
    --pedal-height: clamp(76px, 24vh, 112px);
  }
  .steering-control {
    bottom: 5px;
    left: max(12px, env(safe-area-inset-left));
  }
  .wheel-readout {
    gap: 0 7px;
  }
  .wheel-readout small,
  .wheel-hint {
    display: none;
  }
  .wheel-readout output {
    font-size: 15px;
  }
  .pedal-console {
    right: max(12px, env(safe-area-inset-right));
    bottom: 5px;
    width: 145px;
    padding-top: 5px;
  }
  .pedal-hint {
    display: none;
  }
  .input-gears {
    padding-bottom: 4px;
  }
  .input-gears button {
    height: 27px;
  }
  .pedal-column output {
    font-size: 11px;
    margin-bottom: 3px;
  }
  .pedal-label {
    padding-top: 4px;
  }
  .input-status {
    bottom: 7px;
    top: auto;
    font-size: 9px;
    max-width: 32%;
  }
}
@media (max-width: 400px) and (orientation: portrait) {
  #driving-inputs {
    --wheel-size: 142px;
    --pedal-height: 90px;
  }
  .pedal-console {
    width: 130px;
    right: 7px;
  }
  .steering-control {
    left: 6px;
  }
}

.gamepad-help {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  max-width: min(340px, calc(100vw - 24px));
  border: 1px solid #dbe7d135;
  border-radius: 8px;
  background: #10251ef2;
  font-size: 11px;
}
.gamepad-help summary { cursor: pointer; padding: 7px 10px; white-space: nowrap; }
.gamepad-help[open] { width: 320px; z-index: 10; }
.gamepad-content { padding: 0 12px 10px; max-height: 45vh; overflow: auto; }
.gamepad-content p { margin: 6px 0; }
.gamepad-content select { display: block; width: 100%; margin: 5px 0; color: #f5f1dd; background: #172d24; padding: 5px; }
#gamepad-response { display: block; color: #ffe0a4; font-variant-numeric: tabular-nums; }
.gamepad-tuning { font-size: 10px; color: #c5d0c3; }
@media (max-width: 700px) {
  .gamepad-help { bottom: auto; top: 72px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .gamepad-help { top: auto; bottom: 30px; }
}
