* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #14161C;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  color: #fff;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

#stage { position: fixed; inset: 0; overflow: hidden; background: #14161C; }

#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: 10px 14px 0;
  pointer-events: none; z-index: 3;
}
.hud-side { flex: 1 1 0; min-width: 0; }
.hud-side.right { text-align: right; }
.hp-wrap { display: inline-block; width: 100%; max-width: 250px; }
.hp-name {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: #FFF3E6; text-shadow: 0 1px 3px rgba(0,0,0,.6);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp-bar {
  height: 12px; border-radius: 999px;
  background: rgba(10,12,18,.62);
  border: 1px solid rgba(255,255,255,.22);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.hp-bar i {
  display: block; height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(180deg, #FFC46B, #FF8A3D 55%, #E96A1D);
  transition: width .18s ease-out;
}
.hp-bar.enemy i { background: linear-gradient(180deg, #8FD8FF, #3FA9F5 55%, #1E7BC4); }
.hp-bar i.low { background: linear-gradient(180deg, #FF9A9A, #F0453F 60%, #B92A26); }

.hud-mid { flex: 0 0 auto; text-align: center; padding-top: 2px; }
.round {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  color: #FFD9B8; text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.score {
  font-size: 20px; font-weight: 800; line-height: 1.1; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.55), 0 0 14px rgba(255,138,61,.55);
  font-variant-numeric: tabular-nums;
}

/* ---------- 操作区 ---------- */
.pad {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  z-index: 4; pointer-events: none;
}
.pad-left, .pad-right { display: flex; align-items: flex-end; gap: 10px; pointer-events: auto; }

.btn-move {
  width: 62px; height: 62px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.28), rgba(28,32,44,.72) 70%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .08s ease, background .12s ease;
}
.btn-move .mp-icon { width: 26px; height: 26px; }
.btn-move:active, .btn-move.on {
  transform: scale(.93);
  background: radial-gradient(circle at 35% 28%, rgba(255,196,140,.55), rgba(255,138,61,.85) 70%);
}

.btn-act {
  width: 66px; height: 66px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 11px; font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .08s ease, filter .12s ease;
}
.btn-act .mp-icon { width: 20px; height: 20px; }
.btn-act:active, .btn-act.on { transform: scale(.9); filter: brightness(1.18); }
.btn-act.jump {
  width: 58px; height: 58px;
  background: radial-gradient(circle at 35% 28%, #9FE3FF, #3FA9F5 62%, #1E6FB4);
}
.btn-act.punch { background: radial-gradient(circle at 35% 28%, #FFD08A, #FF8A3D 62%, #D95F14); }
.btn-act.kick { background: radial-gradient(circle at 35% 28%, #FFB3C7, #F0453F 62%, #A8241F); }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(20,22,28,.55), rgba(10,11,16,.88));
  z-index: 6; transition: opacity .22s ease;
}
.overlay.hide { opacity: 0; pointer-events: none; }

.panel {
  width: min(420px, 92vw); max-height: 92vh; overflow: auto;
  text-align: center; padding: 20px 22px 18px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(38,42,56,.96), rgba(22,25,34,.97));
  border: 1px solid rgba(255,138,61,.45);
  box-shadow: 0 22px 50px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.12);
}
.panel-badge {
  width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(160deg, #FFB067, #FF8A3D 55%, #E96A1D);
  box-shadow: 0 8px 20px rgba(255,138,61,.45), inset 0 1px 0 rgba(255,255,255,.4);
}
.panel-badge .mp-icon { width: 30px; height: 30px; }
.panel-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .02em; color: #fff; }
.panel-sub { margin: 6px 0 0; font-size: 12px; color: #A9B0C2; line-height: 1.5; }
.panel-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.panel-keys span {
  font-size: 11px; color: #D6DBE6; padding: 5px 9px; border-radius: 999px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
}
.panel-keys b { color: #FFB067; }
.btn-start {
  margin-top: 14px; width: 100%; height: 50px;
  border: 0; border-radius: 14px;
  font-size: 16px; font-weight: 800; letter-spacing: .06em; color: #2A1608;
  background: linear-gradient(180deg, #FFC078, #FF8A3D 60%, #EE7420);
  box-shadow: 0 10px 22px rgba(255,138,61,.4), inset 0 1px 0 rgba(255,255,255,.55);
  transition: transform .08s ease, filter .12s ease;
}
.btn-start:active { transform: scale(.97); filter: brightness(1.06); }
.panel-foot { margin-top: 10px; font-size: 11px; color: #8E96A8; line-height: 1.5; }

@media (max-height: 400px) {
  .panel { padding: 14px 18px 12px; }
  .panel-badge { width: 42px; height: 42px; margin-bottom: 6px; }
  .panel-badge .mp-icon { width: 24px; height: 24px; }
  .panel-title { font-size: 18px; }
  .panel-keys { margin: 10px 0 2px; }
  .btn-start { height: 44px; margin-top: 10px; }
  .btn-move { width: 54px; height: 54px; }
  .btn-act { width: 58px; height: 58px; }
  .btn-act.jump { width: 52px; height: 52px; }
}
