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

body {
  background: #0a0a0a;
  color: #a0ffa0;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 320 / 200;
  border: 3px solid #33ff33;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(51, 255, 51, 0.15), inset 0 0 60px rgba(0,0,0,0.5);
  overflow: hidden;
  background: #000;
}

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

#scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
}

/* Touch Controls */
#touch-controls {
  display: none;
  width: 100%;
  max-width: 800px;
  margin-top: 16px;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

#dpad {
  display: grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px 56px;
  gap: 4px;
}

.dpad-btn {
  width: 56px;
  height: 56px;
  background: #1a2a1a;
  border: 2px solid #33ff33;
  border-radius: 8px;
  color: #33ff33;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.dpad-btn:active { background: #33ff33; color: #000; }
.dpad-center { border-color: #1a3a1a; background: #0a1a0a; }

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

#action-btns { display: flex; flex-direction: column; gap: 12px; }

.action-btn {
  width: 90px;
  height: 90px;
  background: #2a1a1a;
  border: 2px solid #ff5555;
  border-radius: 50%;
  color: #ff5555;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.1s;
}

.action-btn:active { background: #ff5555; color: #000; }

.quit-btn { background: #333333; color: #ff8888; border-color: #553333; }
.quit-btn:active { background: #ff8888; color: #000; }

/* Mobile */
@media (max-width: 600px) {
  body { padding: 6px; }
  #touch-controls { display: flex; }
  #game-container { border-width: 2px; }
}

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