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

#stage {
  position: fixed; inset: 0;
  overflow: hidden;
  background: #1B1420;
}

#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;
  padding: 10px 14px;
  pointer-events: none;
  gap: 10px;
}
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hp-wrap { display: flex; align-items: center; gap: 6px; }
.hp-wrap .mp-icon { font-size: 16px; }
.hp-bar {
  width: 132px; height: 12px;
  border-radius: 8px;
  background: rgba(20, 12, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #FF6B6B, #FF3D6E);
  border-radius: 8px;
  transition: width 0.18s ease-out;
}
.enemy-fill { background: linear-gradient(90deg, #FFC24A, #FF8A3D); }
.hud-right { display: flex; align-items: center; gap: 8px; }
.score-chip, .wave-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(20, 12, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.score-chip .mp-icon { font-size: 15px; }
.wave-chip { color: #FFD9B8; font-weight: 600; }

/* ---------- 操作区 ---------- */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 18px 16px;
  pointer-events: none;
}
.pad, .acts { display: flex; gap: 12px; pointer-events: auto; }
.btn-move, .btn-act {
  display: flex; align-items: center; justify-content: center;
  border: none; outline: none;
  color: #FFF6EC;
  background: rgba(38, 24, 44, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.08s ease, background 0.12s ease;
  cursor: pointer;
}
.btn-move {
  width: 62px; height: 62px; border-radius: 50%;
  font-size: 26px;
}
.btn-act {
  width: 68px; height: 68px; border-radius: 50%;
  font-size: 28px;
}
.btn-act.jump {
  background: rgba(255, 138, 61, 0.28);
  border-color: rgba(255, 176, 58, 0.65);
  color: #FFD9B8;
}
.btn-act.punch {
  width: 78px; height: 78px;
  background: linear-gradient(160deg, #FF9A4D, #FF6A2B);
  border-color: rgba(255, 214, 170, 0.8);
  color: #FFF6EC;
  box-shadow: 0 8px 20px rgba(255, 106, 43, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-move:active, .btn-act:active,
.btn-move.pressed, .btn-act.pressed {
  transform: scale(0.93);
  background: rgba(255, 138, 61, 0.5);
}
.btn-act.punch:active, .btn-act.punch.pressed {
  background: linear-gradient(160deg, #FFB066, #FF7A3D);
}

/* ---------- 遮罩 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(30, 18, 36, 0.72), rgba(14, 8, 18, 0.92));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
  transition: opacity 0.22s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.panel {
  width: min(78vw, 380px);
  padding: 20px 22px 22px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(170deg, rgba(58, 36, 62, 0.96), rgba(32, 20, 38, 0.98));
  border: 1.5px solid rgba(255, 176, 58, 0.4);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.panel-badge {
  width: 54px; height: 54px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: linear-gradient(160deg, #FF9A4D, #FF6A2B);
  box-shadow: 0 8px 18px rgba(255, 106, 43, 0.45);
  font-size: 28px; color: #FFF6EC;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 21px; font-weight: 800;
  letter-spacing: 0.01em;
  color: #FFF6EC;
}
.panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #C9B6C4;
}
.stat-row {
  display: flex; justify-content: center; gap: 26px;
  margin: 14px 0 2px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 22px; font-weight: 800; color: #FFB03A; }
.stat em { font-style: normal; font-size: 11px; color: #A995A6; letter-spacing: 0.08em; }
.btn-start {
  margin-top: 16px;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 0;
  border: none; outline: none;
  border-radius: 14px;
  font-size: 16px; font-weight: 800;
  color: #2A1620;
  background: linear-gradient(160deg, #FFC24A, #FF8A3D);
  box-shadow: 0 10px 24px rgba(255, 138, 61, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.btn-start .mp-icon { font-size: 20px; }
.btn-start:active { transform: scale(0.96); }

@media (max-height: 380px) {
  .btn-move { width: 54px; height: 54px; font-size: 22px; }
  .btn-act { width: 58px; height: 58px; font-size: 24px; }
  .btn-act.punch { width: 66px; height: 66px; }
  .hp-bar { width: 108px; height: 10px; }
  .panel { padding: 14px 18px 16px; }
  .panel-badge { width: 44px; height: 44px; font-size: 22px; margin-bottom: 6px; }
  .panel h2 { font-size: 18px; }
}
