* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a1020;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
}

canvas {
  display: block;
}

#hud {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 4;
  pointer-events: none;
}

.pill {
  background: rgba(10, 14, 26, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2px;
  backdrop-filter: blur(6px);
}

#message {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 6;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  padding: 24px;
}

#message h2 {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
}

#message p {
  margin: 0;
  opacity: 0.9;
}

#restartBtn {
  margin-top: 8px;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #031018;
  background: #5ce1ff;
}

.hidden {
  display: none !important;
}

#touchControls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}

.left-right,
.accel-brake {
  display: flex;
  gap: 10px;
}

#touchControls button {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 26, 0.55);
  color: #fff;
  border-radius: 14px;
  min-width: 64px;
  min-height: 56px;
  font-size: 20px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

#accelBtn {
  min-width: 90px;
  background: rgba(19, 104, 52, 0.62);
}

#brakeBtn {
  min-width: 90px;
  background: rgba(144, 25, 25, 0.62);
}

@media (hover: hover) and (pointer: fine) {
  #touchControls button:hover {
    filter: brightness(1.15);
  }
}
