* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #0b0c14; color: #dfe3ea;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
#wrapper {
  display: flex; flex-direction: column; align-items: center;
  height: 100%; width: 100%;
}
#topbar {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 4px 10px; font-size: 13px; color: #9aa3b5; flex: 0 0 auto;
}
#topbar-right { display: flex; gap: 6px; }
.bar-btn {
  background: #1b1e2c; color: #dfe3ea; border: 1px solid #3a4058; border-radius: 4px;
  padding: 2px 8px; font-size: 12px; cursor: pointer;
}
.bar-btn:hover { background: #2a2f44; }
#stage {
  position: relative; flex: 1 1 auto; width: 100%;
  display: flex; align-items: center; justify-content: center; min-height: 0;
}
#game {
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #000; max-width: 100%; max-height: 100%;
}
#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; color: #fff; font-size: 14px; text-shadow: 0 1px 2px #000;
}
#overlay.hidden { display: none; }
#controller {
  display: none; width: 100%; justify-content: space-between; align-items: flex-end;
  padding: 8px 14px 14px; flex: 0 0 auto;
}
#dpad { display: flex; flex-direction: column; align-items: center; }
.dpad-row { display: flex; }
.ctrl-btn {
  width: 52px; height: 52px; margin: 2px; border-radius: 10px;
  background: #1b1e2c; border: 1px solid #3a4058; color: #dfe3ea; font-size: 18px;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:active, .ctrl-btn.pressed { background: #3a4058; }
#action-pad { display: flex; gap: 10px; }
.ctrl-btn.act { width: 60px; height: 60px; border-radius: 50%; font-weight: bold; }
#help { font-size: 11px; color: #6c7590; padding: 2px 0 6px; text-align: center; }
@media (pointer: coarse) {
  #controller { display: flex; }
  #help { display: none; }
}
#movie {
  display: none; position: absolute; inset: 0; margin: auto;
  width: 100%; height: 100%; object-fit: contain; background: #000;
}
