.game-area {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.stage {
  /* The embedded stage is a scroll container. Apply the gesture policy here as well. */
  touch-action: manipulation;
}
.touch-controls.driving-pad {
  --wheel-size: clamp(88px, 22vw, 124px);
  --pedal-size: clamp(54px, 12vw, 76px);
  position: absolute;
  z-index: 1;
  inset: auto max(var(--hud-inset), env(safe-area-inset-right)) max(var(--hud-inset), env(safe-area-inset-bottom)) max(var(--hud-inset), env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0;
  pointer-events: none;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.driving-pad .steering-wheel, .driving-pad button { pointer-events: auto; }
.driving-pad .steering-wheel {
  display: grid;
  place-items: center;
  width: var(--wheel-size);
  height: var(--wheel-size);
  flex: none;
  touch-action: none;
  border-radius: 50%;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle, #272e32 0 45%, #15191c 48% 63%, #31383c 65%, #161b1e 68% 70%, transparent 71%);
}

.driving-pad .steering-wheel:focus-visible { outline: 2px solid var(--acid); outline-offset: 1px; }
.driving-pad .steering-wheel.held { cursor: grabbing; }
.driving-pad .steering-wheel svg { display:block; width:100%; height:100%; transform:rotate(var(--wheel-angle,0deg)); pointer-events:none; }
.wheel-rim { fill:none; stroke:#758087; stroke-width:10; }
.wheel-spokes { fill:#627078; stroke:#313a40; stroke-width:1.5; stroke-linejoin:round; }
.wheel-hub { fill:#353f45; stroke:#8b969a; stroke-width:1.3; }
.wheel-marker { fill:none; stroke:var(--acid); stroke-width:10; stroke-linecap:butt; }
.steering-wheel.held .wheel-rim { stroke:#919c9f; }

.driving-pad .pedal-bank {
  display: grid;
  grid-template-columns: repeat(2, var(--pedal-size));
  grid-template-rows: 44px var(--pedal-size);
  gap: 5px;
  align-items: stretch;
}
.driving-pad .pedal-bank button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: auto;
  min-height: 44px;
  min-width: 0;
  padding: 3px;
  border: 1px solid #485358;
  border-radius: 8px;
  font-weight: 650;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.driving-pad .pedal-bank .hand {
  grid-column: 1 / -1;
  color: #cbd2d5;
  background: #252d31;
  border: 1px solid #414b50;
  font-weight: 550;
  font-size: 12px;
}
.driving-pad .pedal-bank .brake,.driving-pad .pedal-bank .gas {
  border-bottom-width: 3px;
  font-size: 15px;
  gap: 4px;
}
.driving-pad .pedal-bank .brake { background:#3a4246; border-color:#5a666c; color:#f1f3ef; gap:1px; line-height:1.05; }
.driving-pad .pedal-bank .brake > span { font-size:clamp(11px, calc(var(--pedal-size) / 4.25), 15px); }
.driving-pad .pedal-bank .brake small { font-size:10px; font-weight:550; line-height:1.1; }
.driving-pad .pedal-bank .gas { background:var(--acid); border-color:#a8bc50; color:#28320c; }
.driving-pad .pedal-bank .brake::before,.driving-pad .pedal-bank .gas::before {
  content: ""; width: 26px; height: 5px;
  background: repeating-linear-gradient(118deg,transparent 0 3px,currentColor 3px 5px,transparent 5px 7px);
  opacity: .48;
}
.driving-pad .pedal-bank button.held { filter:brightness(.82); transform:translateY(1px); }
.driving-pad .pedal-bank .gas {
  --pedal-depth: 0;
  position:relative;isolation:isolate;overflow:hidden;
  border-bottom-width:1px;background:#22291b;color:#ecf8be;
  box-shadow:inset 0 -3px 0 #12190d;
}
.driving-pad .pedal-bank .gas::after {
  content:"";position:absolute;inset:0;z-index:-1;background:#607627;
  transform-origin:bottom;transform:scaleY(var(--pedal-depth));pointer-events:none;
}
.driving-pad .pedal-bank .gas .pedal-face {
  display:grid;justify-items:center;align-content:center;gap:4px;width:100%;
  transform:perspective(130px) translateY(calc(4px * var(--pedal-depth))) rotateX(calc(-17deg * var(--pedal-depth)));
}
.driving-pad .pedal-bank .gas::before{display:none}
.pedal-face::before{content:"";width:26px;height:5px;background:repeating-linear-gradient(115deg,transparent 0 3px,currentColor 3px 5px,transparent 5px 7px);opacity:.7}
.driving-pad .pedal-bank .gas.held{filter:none;transform:none}

.driving-pad[inert] .steering-wheel,.driving-pad[inert] .pedal-bank { opacity: .64; }

@media (max-height:530px) and (orientation:landscape) {
  .driving-pad .pedal-bank { grid-template: var(--pedal-size) / repeat(3, var(--pedal-size)); align-items: end; }
  .driving-pad .pedal-bank .hand { grid-column: auto; height: 44px; }
  .driving-pad .pedal-bank :is(.brake,.gas) { height: var(--pedal-size); }
}
.in-frame.host-landscape .driving-pad .pedal-bank { grid-template: var(--pedal-size) / repeat(3, var(--pedal-size)); align-items: end; }
.in-frame.host-landscape .driving-pad .pedal-bank .hand { grid-column: auto; height: 44px; }
.in-frame.host-landscape .driving-pad .pedal-bank :is(.brake,.gas) { height: var(--pedal-size); }

.stage #chaseScene{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.stage #chaseScene[hidden]{display:none}

.stage #groundScene{position:absolute;left:0;top:0;max-width:none;pointer-events:none;transform-origin:0 0;will-change:transform}
.stage #groundScene[hidden]{display:none}
