html, body {
  margin: 0;
  padding: 0;
  background: #000;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#app {
  height: 100%;
  display: block;
}

#game-container {
  display: flex;
  justify-content: center;
  align-items: flex-start; /* ★上寄せ */
  padding-top: 8px;       /* ★好みで微調整 */
}

canvas {
  /* Canvasは常に正方形：内部360×360。外側はCSSで拡大 */
  width: min(92vw, 420px);
  height: auto;
  image-rendering: pixelated;
}

#ui {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  gap: 12px;
}

#dpad {
  display: grid;
  gap: 8px;
}

#dpad .row {
  display: flex;
  gap: 8px;
}

#ui button {
  width: 64px;
  height: 48px;
  font-size: 18px;
  background: #111;
  color: #fff;
  border: 2px solid #444;
  border-radius: 10px;
  touch-action: manipulation;
}

#btnA {
  width: 86px;
  height: 86px;
  font-size: 24px;
}

/* ===== 画像ベース 十字キー + Aボタン ===== */

#pad {
  position: fixed;
  bottom: 20px;
  left: 20px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  z-index: 10;
}

#abtn {
  position: fixed;
  bottom: 36px;
  right: 24px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  z-index: 10;
}

.pad-row {
  display: flex;
  justify-content: center;
  align-items: center;
}

#pad img,
#abtn img {
  width: 56px;
  height: 56px;
  margin: 6px;
}

.pad-spacer {
  width: 56px;
  height: 56px;
}

.pad-center {
  opacity: 0.25;
  pointer-events: none;
}

/* ===== スマホ操作UI ===== */

#pad {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#abtn {
  position: fixed;
  right: 12px;
  bottom: 24px;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}


#pad img,
#abtn img {
  width: 42px;          /* ← ここでボタンサイズ調整 */
  height: 42px;
  pointer-events: auto;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none; /* iOS長押しメニュー禁止 */
  touch-action: none;
}


