html, body {
  margin: 0;
  height: 100%;
  background: #0b0e14;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated; /* scharfe Blockpixel, falls der Canvas gestreckt wird */
}

/* ---------- Touch-Steuerung: nur auf Touch-Geraeten ---------- */

#touch {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none; /* nur die Buttons selbst fangen Zeiger */
  z-index: 10;
}

@media (hover: none), (pointer: coarse) {
  #touch {
    display: block;
  }
}

.tgroup {
  position: absolute;
  bottom: calc(3vmin + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 3vmin;
}

.tgroup.left {
  left: 3vmin;
}

.tgroup.right {
  right: 3vmin;
  align-items: flex-end;
}

.tbtn {
  pointer-events: auto;
  width: 17vmin;
  height: 17vmin;
  min-width: 64px;
  min-height: 64px;
  border-radius: 0; /* Pixel-Art: harte Kanten */
  border: 3px solid rgba(255, 255, 255, 0.55);
  background: rgba(12, 18, 28, 0.55);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: ui-monospace, "Cascadia Mono", "Courier New", monospace;
  font-size: 6vmin;
  line-height: 1;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.tbtn.pressed {
  background: rgba(90, 130, 180, 0.65);
  transform: translateY(4px);
  box-shadow: none;
}

.tbtn.gas {
  border-color: rgba(127, 208, 255, 0.6);
}

.tbtn.brake {
  border-color: rgba(255, 100, 80, 0.6);
  width: 13vmin;
  height: 13vmin;
}
