html, body {
  margin: 0; height: 100%; overflow: hidden; background: #f0e4c6;
  font-family: system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(70,25,50,.30) 100%);
}

#hud {
  position: fixed; z-index: 1; top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
  display: flex; gap: 10px; align-items: center; pointer-events: none;
}
#hud span {
  background: rgba(35,25,60,.5); border: 1px solid rgba(255,255,255,.18);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 5px 13px; border-radius: 999px; color: #fff; font-weight: 700;
  font-size: 14px; white-space: nowrap;
}
#hud #speed { font-size: 18px; }
#hud #drift { background: linear-gradient(90deg, #ffb300, #ff6d00); color: #2a1a00; border-color: rgba(255,255,255,.4); }
#hud #drift:empty { display: none; }

#pad {
  position: fixed; top: 0; bottom: 0; left: 0; width: 50%; z-index: 1;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(20px + env(safe-area-inset-bottom)); touch-action: none;
}
#wheel {
  width: min(150px, 34vh); height: min(150px, 34vh);
  pointer-events: none; opacity: 0.92;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.45));
}
#wheel svg { width: 100%; height: 100%; display: block; }

#btns {
  position: fixed; z-index: 2; display: flex; gap: 12px; align-items: flex-end;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
}
#btns button {
  width: 84px; height: 84px; border-radius: 50%; border: 3px solid rgba(255,255,255,.55);
  font-weight: 800; font-size: 12px; color: #fff; touch-action: none;
  box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 2px 6px rgba(255,255,255,.35);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
#btns #gas { width: 104px; height: 104px; font-size: 15px; background: radial-gradient(circle at 35% 30%, #7be07f, #2e9e4a); }
#btns #brake { background: radial-gradient(circle at 35% 30%, #ff8a80, #c62828); }
#btns #hand { background: radial-gradient(circle at 35% 30%, #ffd180, #ef8a00); }
#btns button.on { transform: scale(.92); filter: brightness(1.25); }

#rotate {
  display: none; position: fixed; inset: 0; z-index: 10; background: #3b2f4a; color: #fff;
  flex-direction: column; align-items: center; justify-content: center; font-size: 20px;
}
#rotate span { font-size: 64px; }
@media (orientation: portrait) { #rotate { display: flex; } }