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

body {
  background: #0a0a0a;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  touch-action: none;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

#mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 160px;
  pointer-events: none;
  z-index: 100;
}

@media (pointer: coarse), (max-width: 768px) {
  #mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px 20px;
  }
}

#dpad {
  display: grid;
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: 50px 50px;
  gap: 4px;
  pointer-events: auto;
}

#btn-up { grid-column: 2; grid-row: 1; }
#btn-left { grid-column: 1; grid-row: 2; }
#btn-right { grid-column: 3; grid-row: 2; }
#btn-down { grid-column: 2; grid-row: 2; }

.dpad-btn, .action-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.7);
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

.dpad-btn:active, .action-btn:active {
  background: rgba(255,255,255,0.3);
}

#action-buttons {
  display: grid;
  grid-template-columns: 55px 55px;
  grid-template-rows: 55px 55px;
  gap: 6px;
  pointer-events: auto;
}

.action-btn {
  font-size: 9px;
  border-radius: 50%;
  width: 55px;
  height: 55px;
}