* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: Arial, sans-serif;
}

#wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

canvas {
  display: block;
  background: #111;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#touchControls {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(12px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  gap: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  z-index: 10;
}

.touch-device #touchControls {
  display: flex;
}

#centerButtons {
  display: flex;
  gap: 10px;
}

#touchControls button {
  padding: 16px 24px;
  font-size: 24px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: white;
  cursor: pointer;
  min-width: 60px;
  touch-action: manipulation;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.08s, border-color 0.08s, transform 0.08s;
}

#touchControls button:active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  transform: scale(0.94);
}

@media (max-width: 500px) {
  #touchControls button {
    padding: 18px 26px;
    font-size: 26px;
    min-width: 64px;
  }
}
