:root {
  color-scheme: dark;
  --accent: #ff5db1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%; margin: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(117, 180, 206, 0.24), transparent 34%),
    linear-gradient(180deg, #181827 0%, #0a0a14 100%);
  overflow: hidden;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  touch-action: none;
  user-select: none;
}

#stage-wrap {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#game {
  display: block;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #090b11;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
}

/* ===== タッチ操作（.is-touch のときだけ表示） ===== */
.touch-controls { display: none; }

body.is-touch .touch-controls {
  display: block;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

body.is-touch .stick-zone,
body.is-touch .btn-zone,
body.is-touch .sys-btn { pointer-events: auto; }

/* 左: バーチャルスティック領域 */
.stick-zone {
  position: absolute;
  left: 0; bottom: 0;
  width: 42%; height: 60%;
  touch-action: none;
}
.stick-base {
  position: absolute;
  display: none;
  width: 112px; height: 112px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.stick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 52px; height: 52px;
  margin-left: -26px;
  border-radius: 50%;
  background: rgba(255, 93, 177, 0.85);
  border: 2px solid #fff;
  transform: translate(0, -50%);
}

/* 右: ジョイコン風ボタン */
.btn-zone {
  position: absolute;
  right: 14px; bottom: 16px;
  width: 200px; height: 170px;
  touch-action: none;
}
.joy-btn {
  position: absolute;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  font: 700 22px/1 system-ui, sans-serif;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(40, 40, 70, 0.7);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}
.joy-btn.pressed { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); filter: brightness(1.3); }
.btn-jump   { right: 8px;  bottom: 8px;  background: rgba(60, 160, 90, 0.8); }   /* A: ジャンプ */
.btn-attack { right: 78px; bottom: 38px; background: rgba(200, 70, 90, 0.8); }   /* B: 攻撃 */
.btn-special{ right: 40px; bottom: 104px; width: 52px; height: 52px; font-size: 18px; background: rgba(80, 90, 200, 0.8); } /* S: 特殊 */

.sys-btn {
  position: absolute;
  top: 10px; left: 50%; transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 14px;
  font: 700 12px/1 system-ui, sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ===== 縦持ち回転促し ===== */
#rotate-hint { display: none; }

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint {
    display: flex;
    position: fixed; inset: 0; z-index: 100;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 14px;
    background: #0a0a14;
    color: #fff; text-align: center;
  }
  .rotate-icon { font-size: 64px; animation: rot 1.6s ease-in-out infinite; }
  #rotate-hint p { font-size: 18px; margin: 0; }
  @keyframes rot { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
}
