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

.stage {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* 背景：卡通格斗场 */
.bg-art {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, #FFB066 0%, #FF8A3D 34%, #C4471B 66%, #5A1B0C 100%);
}
.bg-art::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.28) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 16%, rgba(255,255,255,.22) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 40%, rgba(255,255,255,.18) 0 2px, transparent 3px);
  opacity: .8;
}
.bg-art::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 46%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.16) 0 2px, transparent 2px 46px),
    linear-gradient(180deg, #7A2A12 0%, #3A1207 100%);
  border-top: 3px solid rgba(255, 190, 130, .35);
  border-radius: 50% 50% 0 0 / 14% 14% 0 0;
}
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(30,8,2,.55) 100%);
}

/* HUD */
.hud {
  position: relative; z-index: 5;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px 0;
}
.hud-side { flex: 1; min-width: 0; }
.hud-side.right { text-align: right; }
.fighter-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: #FFF3E6; text-shadow: 0 1px 2px rgba(0,0,0,.5);
  max-width: 100%;
}
.fighter-tag span:first-child, .fighter-tag span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #FFD166; box-shadow: 0 0 6px #FFD166; flex: none; }
.fighter-tag.foe .dot { background: #FF5A5A; box-shadow: 0 0 6px #FF5A5A; }
.bar-wrap { margin-top: 5px; display: flex; flex-direction: column; gap: 4px; }
.bar {
  height: 11px; border-radius: 6px;
  background: rgba(24, 8, 2, .55);
  border: 1px solid rgba(255, 214, 170, .35);
  overflow: hidden;
}
.bar.en { height: 6px; }
.bar i {
  display: block; height: 100%; width: 100%;
  border-radius: 6px;
  transition: width .18s ease-out;
}
.bar.hp i { background: linear-gradient(90deg, #FFD166, #FF8A3D); }
.bar.hp.foe i { background: linear-gradient(90deg, #FF8A3D, #FF4D4D); }
.bar.en i { background: linear-gradient(90deg, #7FE3FF, #3FA9F5); }
.hud-side.right .bar i { margin-left: auto; }

.hud-mid { flex: none; text-align: center; padding-top: 2px; }
.round-chip {
  font-size: 10px; font-weight: 700; color: #FFE7CC;
  background: rgba(24, 8, 2, .5);
  border: 1px solid rgba(255, 214, 170, .3);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.timer {
  margin-top: 4px;
  font-size: 26px; font-weight: 800; line-height: 1;
  color: #FFF3E6; text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 14px rgba(255, 209, 102, .6);
  font-variant-numeric: tabular-nums;
}

/* 战斗区 */
.arena {
  position: relative; z-index: 4;
  flex: 1; min-height: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 6% 8px;
}
.floor-glow {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  width: 78%; height: 26px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 209, 102, .45), transparent);
  filter: blur(2px);
}

.fighter {
  position: relative;
  width: 42%; max-width: 190px;
  aspect-ratio: 1 / 1.55;
  transition: transform .12s ease-out;
  will-change: transform;
}
.fighter.enemy { transform: scaleX(-1); }
.fighter .shadow {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  width: 74%; height: 14px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20,6,2,.55), transparent);
}
.fighter .body { position: absolute; inset: 0; }

/* 卡通人形：用圆角块拼出剪影 */
.fighter .head {
  position: absolute; left: 50%; top: 2%; transform: translateX(-50%);
  width: 34%; aspect-ratio: 1/1.08;
  border-radius: 46% 46% 44% 44%;
  background: linear-gradient(160deg, #FFD9A8, #E8A96B);
  box-shadow: inset -4px -6px 0 rgba(150, 80, 30, .25);
}
.fighter .head .band {
  position: absolute; left: -8%; right: -8%; top: 26%; height: 22%;
  background: #E23B2E; border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.fighter .head .band::after {
  content: ""; position: absolute; right: -46%; top: 30%;
  width: 52%; height: 26%; background: #E23B2E; border-radius: 3px;
  transform: rotate(14deg);
}
.fighter .torso {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  width: 56%; height: 40%;
  border-radius: 34% 34% 26% 26%;
  background: linear-gradient(160deg, #FF8A3D, #C4471B);
  box-shadow: inset -6px -8px 0 rgba(90, 27, 12, .3);
}
.fighter .torso::after {
  content: ""; position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  width: 26%; height: 62%; border-radius: 40%;
  background: rgba(255, 243, 230, .35);
}
.fighter .arm {
  position: absolute; width: 15%; height: 34%;
  border-radius: 999px;
  background: linear-gradient(160deg, #FFD9A8, #E8A96B);
  transform-origin: 50% 8%;
  transition: transform .1s ease-out;
}
.fighter .arm.back { left: 12%; top: 34%; transform: rotate(24deg); }
.fighter .arm.front { right: 12%; top: 34%; transform: rotate(-24deg); }
.fighter .leg {
  position: absolute; width: 17%; height: 32%;
  border-radius: 999px;
  background: linear-gradient(160deg, #2B2B33, #14141A);
  transform-origin: 50% 6%;
  transition: transform .1s ease-out;
}
.fighter .leg.back { left: 26%; top: 66%; transform: rotate(9deg); }
.fighter .leg.front { right: 26%; top: 66%; transform: rotate(-9deg); }

/* 出拳/踢腿姿态 */
.fighter.act-punch .arm.front { transform: rotate(-96deg) scaleY(1.22); }
.fighter.act-punch .torso { transform: translateX(-50%) rotate(-6deg); }
.fighter.act-kick .leg.front { transform: rotate(-72deg) scaleY(1.2); }
.fighter.act-kick .torso { transform: translateX(-50%) rotate(7deg); }
.fighter.act-block .arm.front { transform: rotate(-52deg); }
.fighter.act-block .arm.back { transform: rotate(52deg); }
.fighter.act-dodge { opacity: .55; }
.fighter.act-hurt { transform: translateX(-10px) rotate(-4deg); }
.fighter.enemy.act-hurt { transform: scaleX(-1) translateX(-10px) rotate(-4deg); }
.fighter.enemy.act-punch .arm.front { transform: rotate(-96deg) scaleY(1.22); }
.fighter.enemy.act-kick .leg.front { transform: rotate(-72deg) scaleY(1.2); }

.fx-hit {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(.2);
  width: 62%; aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.95), rgba(255,209,102,.7) 45%, transparent 72%);
  opacity: 0; pointer-events: none;
}
.fx-hit.on { animation: hitPop .34s ease-out; }
@keyframes hitPop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.25); }
  60% { opacity: .9; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

.combo-pop {
  position: absolute; left: 50%; top: 18%; transform: translate(-50%, 0) scale(.6);
  font-size: 30px; font-weight: 900; font-style: italic;
  color: #FFD166; text-shadow: 0 3px 0 #A63A12, 0 0 18px rgba(255, 209, 102, .8);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.combo-pop.on { animation: comboPop .6s ease-out; }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.5) rotate(-6deg); }
  35% { opacity: 1; transform: translate(-50%, -6px) scale(1.1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1) rotate(0); }
}

.callout {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.7);
  font-size: 34px; font-weight: 900; letter-spacing: .06em;
  color: #FFF3E6; text-shadow: 0 4px 0 #A63A12, 0 0 24px rgba(255, 138, 61, .9);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.callout.on { animation: calloutPop .9s ease-out; }
@keyframes calloutPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.16); }
}

/* 操作区 */
.controls {
  position: relative; z-index: 6;
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px;
  padding: 6px 16px calc(14px + env(safe-area-inset-bottom));
}
.pad { display: flex; gap: 10px; align-items: flex-end; }
.btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  border: none; outline: none;
  font-family: inherit; font-weight: 800;
  cursor: pointer;
  transition: transform .08s ease-out, filter .12s;
}
.btn .mp-icon { font-size: 22px; }
.btn span { font-size: 11px; letter-spacing: .04em; }
.btn.ghost {
  width: 62px; height: 62px; border-radius: 50%;
  color: #FFE7CC;
  background: rgba(24, 8, 2, .5);
  border: 1.5px solid rgba(255, 214, 170, .45);
  box-shadow: 0 4px 0 rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
}
.btn.main {
  width: 84px; height: 84px; border-radius: 50%;
  color: #3A1207;
  background: radial-gradient(circle at 34% 28%, #FFD166, #FF8A3D 62%, #E2601F 100%);
  border: 2px solid rgba(255, 243, 230, .7);
  box-shadow: 0 6px 0 #A63A12, 0 10px 22px rgba(255, 138, 61, .45);
}
.btn.main .mp-icon { font-size: 30px; }
.btn.main span { font-size: 12px; }
.btn:active, .btn.press { transform: translateY(3px) scale(.96); filter: brightness(1.08); }
.btn.main:active, .btn.main.press { box-shadow: 0 2px 0 #A63A12, 0 6px 14px rgba(255, 138, 61, .4); }
.btn:disabled { opacity: .45; }

/* 遮罩 */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(20, 6, 2, .62);
  backdrop-filter: blur(6px);
  transition: opacity .25s;
}
.overlay.hide { opacity: 0; pointer-events: none; }
.ov-card {
  width: 100%; max-width: 340px;
  text-align: center;
  padding: 26px 22px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFF6EA 0%, #FFE7CC 100%);
  border: 2px solid rgba(255, 138, 61, .5);
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 1px 0 #fff;
  color: #3A1207;
}
.ov-badge {
  width: 62px; height: 62px; margin: -52px auto 10px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 34% 28%, #FFD166, #FF8A3D 70%);
  border: 3px solid #FFF6EA;
  box-shadow: 0 8px 18px rgba(166, 58, 18, .45);
  color: #3A1207;
}
.ov-badge .mp-icon { font-size: 30px; }
.ov-card h2 {
  margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .04em;
  color: #A63A12;
}
.ov-card p { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: #7A4A2A; }
.ov-stats {
  display: flex; justify-content: center; gap: 10px; margin-top: 14px;
}
.ov-stats > div {
  flex: 1; padding: 8px 4px; border-radius: 14px;
  background: rgba(255, 138, 61, .14);
  border: 1px solid rgba(255, 138, 61, .3);
}
.ov-stats b { display: block; font-size: 20px; color: #A63A12; font-variant-numeric: tabular-nums; }
.ov-stats span { font-size: 10px; color: #8A5A38; }
.btn.big {
  margin-top: 18px; width: 100%; height: 54px;
  flex-direction: row; gap: 8px;
  border-radius: 16px;
  color: #3A1207;
  background: linear-gradient(180deg, #FFC15E, #FF8A3D);
  border: 2px solid rgba(255, 243, 230, .8);
  box-shadow: 0 5px 0 #A63A12, 0 10px 20px rgba(255, 138, 61, .4);
}
.btn.big .mp-icon { font-size: 24px; }
.btn.big span { font-size: 16px; }
.ov-tip { margin-top: 12px !important; font-size: 11px !important; color: #9A6A48 !important; }

@media (max-height: 640px) {
  .btn.main { width: 72px; height: 72px; }
  .btn.ghost { width: 54px; height: 54px; }
  .timer { font-size: 22px; }
  .ov-card { padding: 20px 18px 18px; }
}
