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

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

#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

@media (max-width: 768px), (hover: none) {
  #mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }
}

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

.dpad-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 18px;
  border-radius: 6px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

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

#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: 3; }

#action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.25);
  border: 2px solid rgba(255, 215, 0, 0.5);
  color: #ffd700;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
  background: rgba(255, 215, 0, 0.5);
}

.action-btn.nc {
  background: rgba(100, 200, 255, 0.25);
  border-color: rgba(100, 200, 255, 0.5);
  color: #64c8ff;
}

#controls {
  display: none;
}