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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
  font-family: 'Press Start 2P', monospace;
}

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

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #1a1a2e;
}

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

#dpad {
  position: absolute;
  bottom: 30px;
  left: 30px;
  width: 140px;
  height: 140px;
  pointer-events: auto;
}

.dpad-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  background: rgba(200, 180, 150, 0.25);
  border: 2px solid rgba(200, 180, 150, 0.4);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}

.dpad-btn:active {
  background: rgba(200, 180, 150, 0.5);
}

#btn-up { top: 0; left: 50%; transform: translateX(-50%); }
#btn-down { bottom: 0; left: 50%; transform: translateX(-50%); }
#btn-left { top: 50%; left: 0; transform: translateY(-50%); }
#btn-right { top: 50%; right: 0; transform: translateY(-50%); }

#btn-attack {
  position: absolute;
  bottom: 50px;
  right: 40px;
  width: 70px;
  height: 70px;
  background: rgba(220, 80, 60, 0.3);
  border: 2px solid rgba(220, 80, 60, 0.5);
  border-radius: 50%;
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

#btn-attack:active {
  background: rgba(220, 80, 60, 0.6);
}

#footer-wrap {
  position: fixed;
  bottom: 8px;
  text-align: center;
  z-index: 50;
}

#remix-link {
  color: rgba(150, 140, 130, 0.5);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  letter-spacing: 1px;
}

#remix-link:hover {
  color: rgba(200, 180, 150, 0.8);
}

@media (pointer: coarse) {
  #mobile-controls {
    display: block;
  }
}