* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100svh;
  overflow: hidden;
}

/* Width is the tightest of: 98vw, 800px, or height×(800/600) so the
   canvas never overflows vertically — handles landscape mobile too. */
#wrapper {
  display: flex;
  flex-direction: column;
  width: min(98vw, 800px, 133.34svh);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 800 / 600;
  touch-action: none;
}

#controls {
  display: flex;
  width: 100%;
}

.ctrl-btn {
  flex: 1;
  height: 56px;
  background: rgba(0, 255, 136, 0.06);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-top: none;
  color: rgba(0, 255, 136, 0.5);
  font-size: 1.5rem;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

#btn-left  { border-left: none;  border-radius: 0 0 0 8px; }
#btn-fire  { font-size: 0.85rem; letter-spacing: 0.12em; font-family: monospace; }
#btn-right { border-right: none; border-radius: 0 0 8px 0; }

/* Hide controls on desktop and in tight landscape (canvas already fills height) */
@media (hover: hover) and (pointer: fine)               { #controls { display: none; } }
@media (orientation: landscape) and (max-height: 480px) { #controls { display: none; } }
