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

body {
  background: #0a0a0f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16/9;
}

#canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  border: 4px solid #222;
  box-shadow: 0 0 40px rgba(255, 80, 20, 0.15), inset 0 0 80px rgba(0,0,0,0.3);
}

/* CRT Scanline Overlay */
#game-wrapper::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.08) 0px,
    rgba(0,0,0,0.08) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 2;
}

#touch-controls {
  display: none;
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0 15px;
  justify-content: space-between;
  align-items: flex-end;
}

#dpad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  grid-template-columns: 48px 48px 48px;
  grid-template-rows: 48px 48px 48px;
  gap: 2px;
}

#btn-up { grid-area: up; }
#btn-left { grid-area: left; }
#btn-right { grid-area: right; }
#btn-down { grid-area: down; }

.dpad-btn, .action-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.dpad-btn {
  background: rgba(60, 60, 100, 0.7);
  width: 48px;
  height: 48px;
}

.dpad-btn:active {
  background: rgba(100, 100, 180, 0.9);
}

#action-buttons {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

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

#btn-punch { background: rgba(200, 60, 60, 0.7); }
#btn-kick { background: rgba(60, 160, 60, 0.7); }
#btn-special { background: rgba(200, 160, 30, 0.7); }

.action-btn:active {
  filter: brightness(1.5);
  transform: scale(0.95);
}

@media (max-width: 768px), (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
  #game-wrapper {
    aspect-ratio: auto;
    height: 100vh;
  }
  #canvas {
    height: calc(100vh - 120px);
    border: 2px solid #222;
  }
}

#game-footer {
  padding: 10px;
  z-index: 100;
}

#game-footer a {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #555;
  text-decoration: none;
}

#game-footer a:hover {
  color: #f80;
}