* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  -webkit-user-select: none;
  user-select: none;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 800 / 500;
  background: #0a0a1a;
}

#touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 20px 20px;
  justify-content: space-between;
  pointer-events: none;
  z-index: 100;
}

.touch-btn {
  pointer-events: all;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(0, 220, 255, 0.5);
  background: rgba(0, 220, 255, 0.15);
  color: rgba(0, 220, 255, 0.8);
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.touch-btn:active {
  background: rgba(0, 220, 255, 0.4);
  border-color: rgba(0, 220, 255, 0.9);
}

.btn-action {
  width: 65px;
  height: 65px;
}

#touch-left, #touch-right {
  display: flex;
  gap: 15px;
  align-items: flex-end;
}

#dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dpad-mid-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  font-size: 14px;
}

.dpad-center {
  width: 20px;
  height: 20px;
  background: rgba(0, 220, 255, 0.08);
  border-radius: 4px;
}

@media (hover: none) and (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}

@media (max-width: 600px) {
  #touch-controls {
    display: flex;
  }
}

footer {
  margin-top: 10px;
  padding: 8px;
}

footer a {
  color: #444;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  text-decoration: none;
}

footer a:hover {
  color: #00dcff;
}