html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #181820;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border-radius: 2px;
  box-shadow: 0 0 0 6px #303040, 0 0 60px rgba(0, 0, 0, 0.8);
}

/* touch controls — phones only (coarse pointers), played in landscape.
   The controls live in side gutters so they never cover the game. */
#touch { display: none; }
#rotate { display: none; }

@media (pointer: coarse) {
  #touch { display: block; }
  #stage { left: 150px; right: 150px; }
}

@media (pointer: coarse) and (orientation: portrait) {
  #rotate {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: #181820;
    color: #f0d048;
    font: bold 18px monospace;
    text-align: center;
    align-items: center;
    justify-content: center;
    padding: 40px;
  }
}

#dpad {
  position: fixed;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 132px;
  height: 132px;
}

#dpad .tbtn[data-key="up"]    { position: absolute; left: 44px; top: 0; }
#dpad .tbtn[data-key="left"]  { position: absolute; left: 0; top: 44px; }
#dpad .tbtn[data-key="down"]  { position: absolute; left: 44px; top: 88px; }
#dpad .tbtn[data-key="right"] { position: absolute; left: 88px; top: 44px; }

#ab {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tbtn {
  width: 44px;
  height: 44px;
  border: 2px solid #505060;
  border-radius: 8px;
  background: rgba(80, 80, 100, 0.45);
  color: #d8d8e8;
  font: bold 14px monospace;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.tbtn.round {
  border-radius: 50%;
  width: 52px;
  height: 52px;
  margin-left: 10px;
}

.tbtn:active { background: rgba(140, 140, 170, 0.6); }
