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

body {
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: monospace;
  color: #888;
  overflow: hidden;
  touch-action: none;
}

#screen-container {
  border: 4px solid #333;
  border-radius: 8px;
  background: #0f380f;
  padding: 8px;
  box-shadow: 0 0 40px rgba(15, 56, 15, 0.3);
}

canvas {
  display: block;
  width: 480px;
  height: 432px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#controls-hint {
  margin-top: 16px;
  font-size: 12px;
}

#controls-hint kbd {
  background: #333;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #555;
}

/* Mobile controls */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  justify-content: space-between;
  align-items: flex-end;
}

#dpad {
  position: relative;
  width: 120px;
  height: 120px;
}

.dpad-btn {
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(50, 50, 50, 0.8);
  border: 2px solid #555;
  border-radius: 6px;
  color: #ccc;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.dpad-btn:active { background: rgba(100, 100, 100, 0.9); }
.dpad-up { top: 0; left: 40px; }
.dpad-down { bottom: 0; left: 40px; }
.dpad-left { top: 40px; left: 0; }
.dpad-right { top: 40px; right: 0; }

#ab-buttons {
  display: flex;
  gap: 12px;
}

.ab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(50, 50, 50, 0.8);
  border: 2px solid #555;
  color: #ccc;
  font-size: 16px;
  font-weight: bold;
  font-family: monospace;
  -webkit-tap-highlight-color: transparent;
}
.ab-btn:active { background: rgba(100, 100, 100, 0.9); }

#start-select {
  position: fixed;
  bottom: 150px;
  right: 20px;
}

.start-btn {
  padding: 6px 16px;
  background: rgba(50, 50, 50, 0.8);
  border: 2px solid #555;
  border-radius: 12px;
  color: #ccc;
  font-size: 10px;
  font-family: monospace;
  letter-spacing: 2px;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 520px) {
  canvas { width: 320px; height: 288px; }
  #screen-container { padding: 4px; border-width: 2px; }
  #controls-hint { display: none; }
  #mobile-controls { display: flex; }
  body { justify-content: flex-start; padding-top: 20px; }
}

@media (max-width: 360px) {
  canvas { width: 280px; height: 252px; }
}
