/* 锤爆老板 · 横版卡通解压对战 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E4611B;
  --yellow: #FFD64D;
  --red: #F0442E;
  --ink: #2A1409;
  --cream: #FFF3DA;
  --brown: #5A2B14;
  --brown-dark: #2E150A;
  --hud-card-h: clamp(44px, 7.1vh, 72px);
  --hud-btn: clamp(44px, 7.1vh, 72px);
  --hud-pad-x: clamp(8px, 1.5vw, 20px);
  --scrim-h: clamp(132px, 15.6vh, 176px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #170b06;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button { font-family: inherit; }
img { -webkit-user-drag: none; user-select: none; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid rgba(255, 227, 150, .9); outline-offset: 3px; }

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 25%, #6b3d22 0%, #33190d 45%, #150a05 100%);
  isolation: isolate;
}

/* ---------- 场景 ---------- */
.scene-wrap {
  position: absolute;
  inset: -2px;
  z-index: 0;
  will-change: transform;
}

.scene-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 47%;
  transform-origin: 52% 46%;
  animation: scene-breathe 16s ease-in-out infinite alternate;
  filter: saturate(1.06) contrast(1.02);
}

.scene-grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(48, 20, 8, .24) 0%, rgba(255, 132, 54, .06) 35%, rgba(60, 24, 8, .18) 100%),
    radial-gradient(120% 80% at 72% 26%, rgba(255, 188, 96, .14) 0%, transparent 55%);
  mix-blend-mode: soft-light;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(115% 85% at 50% 44%, transparent 44%, rgba(24, 10, 4, .34) 100%),
    linear-gradient(180deg, rgba(17, 8, 3, .32) 0%, transparent 18%, transparent 82%, rgba(17, 8, 3, .38) 100%);
}

.boss-glow {
  position: absolute;
  right: -4%;
  top: 12%;
  width: 54%;
  height: 76%;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 60% 44%, rgba(255, 70, 30, .55) 0%, rgba(255, 110, 30, .22) 38%, transparent 68%);
  filter: blur(10px);
  mix-blend-mode: screen;
  transition: opacity .18s ease-out;
}
.boss-glow.on { opacity: 1; }

.aura {
  position: absolute;
  right: 5%;
  top: 29%;
  width: 40%;
  height: 58%;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
  filter: blur(7px) saturate(1.2);
}
.aura .flame {
  position: absolute;
  bottom: 0;
  width: 17%;
  height: 46%;
  border-radius: 52% 48% 44% 56% / 72% 68% 32% 28%;
  background: linear-gradient(180deg, #FFF083 0%, #FFB62E 32%, #FF5A12 68%, rgba(224, 48, 8, 0) 100%);
  filter: blur(5px);
  transform-origin: 50% 100%;
  animation: flame-flicker .62s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}
.aura .f1 { left: 12%; height: 38%; animation-delay: -.2s; }
.aura .f2 { left: 38%; height: 54%; animation-delay: -.45s; }
.aura .f3 { left: 66%; height: 42%; animation-delay: -.1s; }
.stage.phase-angry .aura { opacity: .5; }
.stage.phase-rage .aura { opacity: .95; }
.stage.phase-rage .aura .flame { animation-duration: .34s; }
.stage.phase-low .aura { opacity: .6; }

/* ---------- 顶部 HUD ---------- */
.hud-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--scrim-h) + var(--safe-top));
  z-index: 20;
  pointer-events: none;
  background:
    radial-gradient(120% 130% at 50% 0%, rgba(255, 146, 60, .12) 0%, transparent 62%),
    repeating-linear-gradient(115deg, rgba(255, 216, 150, .022) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, rgba(22, 10, 4, .985) 0%, rgba(30, 14, 7, .975) 62%, rgba(33, 15, 7, .96) 88%, rgba(36, 17, 8, .6) 95%, rgba(36, 17, 8, 0) 100%);
  -webkit-backdrop-filter: blur(12px) saturate(.82);
  backdrop-filter: blur(12px) saturate(.82);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 94%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 94%, transparent 100%);
  box-shadow: 0 10px 26px rgba(12, 5, 2, .28);
}
.hud-scrim::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 94, .35), transparent);
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  gap: clamp(6px, .95vw, 14px);
  padding:
    calc(var(--safe-top) + clamp(8px, 1.5vh, 16px))
    calc(env(safe-area-inset-right, 0px) + var(--hud-pad-x))
    10px
    calc(env(safe-area-inset-left, 0px) + var(--hud-pad-x));
}

.hud-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--hud-card-h);
  border: 2px solid rgba(255, 205, 122, .6);
  border-radius: clamp(9px, 1.2vh, 14px);
  background:
    linear-gradient(180deg, rgba(89, 47, 24, .96) 0%, rgba(52, 25, 12, .97) 64%, rgba(38, 17, 8, .98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 232, 184, .3),
    inset 0 -3px 8px rgba(0, 0, 0, .28),
    0 4px 0 rgba(22, 9, 3, .55),
    0 8px 16px rgba(0, 0, 0, .26);
}

.hud-btn {
  flex: 0 0 auto;
  width: var(--hud-btn);
  height: var(--hud-btn);
  display: grid;
  place-items: center;
  padding: 0;
  border: clamp(2px, .35vh, 3px) solid #123867;
  border-radius: 30%;
  color: #fff;
  background: linear-gradient(180deg, #83CBFF 0%, #3E96EE 48%, #246FCB 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .62),
    inset 0 -4px 8px rgba(9, 46, 95, .38),
    0 4px 0 #10325d,
    0 7px 14px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.hud-btn .mp-icon { width: 48%; height: 48%; }
.hud-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .45),
    inset 0 -2px 6px rgba(9, 46, 95, .35),
    0 1px 0 #10325d,
    0 3px 7px rgba(0, 0, 0, .28);
}

.weapon-card {
  padding: 0 clamp(8px, 1.1vw, 14px);
  gap: clamp(3px, .5vw, 8px);
  flex: 0 0 auto;
  min-width: clamp(72px, 8.2vw, 120px);
  color: #FFE8B3;
}
.slipper-icon {
  width: clamp(33px, 5vh, 50px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}
.weapon-count {
  font-size: clamp(18px, 2.6vh, 28px);
  font-weight: 900;
  font-family: "Arial Black", "PingFang SC", sans-serif;
  letter-spacing: -.02em;
  color: #FFF7E6;
  text-shadow: 0 2px 0 #5A2A0F, 0 0 8px rgba(255, 188, 78, .35);
  line-height: 1;
}

.score-card {
  flex: 0 1 auto;
  margin-left: auto;
  min-width: clamp(96px, 10.8vw, 176px);
  max-width: 30vw;
  flex-direction: column;
  gap: 0;
  padding: 2px clamp(9px, 1.2vw, 16px) 3px;
  border-color: #4A240E;
  background: linear-gradient(180deg, #FFE7A8 0%, #F6CC70 56%, #E9AE47 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .8),
    inset 0 -3px 0 rgba(168, 94, 19, .35),
    0 4px 0 rgba(58, 24, 7, .62),
    0 8px 16px rgba(0, 0, 0, .25);
  transform: rotate(-.8deg);
}
.score-label {
  font-size: clamp(9px, 1.45vh, 13px);
  font-weight: 900;
  letter-spacing: .18em;
  color: #79431A;
  line-height: 1.1;
}
.score-val {
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(21px, 3.55vh, 40px);
  font-weight: 900;
  line-height: .96;
  letter-spacing: .01em;
  color: #3A1A08;
  text-shadow: 0 1px 0 #FFF3C8;
  font-variant-numeric: tabular-nums;
}
.score-val.pop { animation: score-pop .22s ease-out; }

.boss-hud {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(41vw, 430px);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(6px, .8vw, 11px);
}
.boss-face {
  position: relative;
  flex: 0 0 auto;
  width: clamp(44px, 7.1vh, 72px);
  height: clamp(44px, 7.1vh, 72px);
  border: 2px solid rgba(255, 205, 122, .72);
  border-radius: 22%;
  overflow: hidden;
  background: #1A0C06;
  box-shadow:
    inset 0 0 0 2px rgba(38, 15, 5, .8),
    0 3px 0 rgba(22, 9, 3, .6),
    0 6px 12px rgba(0, 0, 0, .24);
}
.boss-face-img {
  position: absolute;
  inset: 0;
  background-image: url("images/gen/scene.webp");
  background-repeat: no-repeat;
  background-size: 2200% auto;
  background-position: 65.5% 4%;
  transform: scale(1.02);
  transition: filter .4s ease;
}
.stage.phase-angry .boss-face-img { filter: saturate(1.22) contrast(1.05) brightness(1.04); }
.stage.phase-rage .boss-face-img {
  filter: saturate(1.55) contrast(1.1) hue-rotate(-7deg);
  animation: boss-face-rage .42s ease-in-out infinite alternate;
}
.stage.phase-low .boss-face-img { filter: saturate(.62) brightness(1.14) contrast(.96); }
.boss-tag {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  padding: 1px 5px 0;
  border-radius: 4px;
  background: #E34321;
  color: #FFEAC0;
  font-size: clamp(5px, .85vh, 8px);
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  white-space: nowrap;
}
.boss-hp-wrap { flex: 1; min-width: 0; }
.boss-hp-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: clamp(2px, .4vh, 4px);
  font-size: clamp(8px, 1.35vh, 12px);
  font-weight: 900;
  line-height: 1;
  color: #FFDB9D;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}
.boss-hp-label span:last-child {
  font-variant-numeric: tabular-nums;
  color: #FFF3D2;
}
.boss-hp {
  position: relative;
  height: clamp(14px, 2vh, 24px);
  overflow: hidden;
  border: 2px solid #180a04;
  border-radius: 999px;
  background: linear-gradient(180deg, #1D0B05 0%, #421A0C 55%, #200C05 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, .86),
    0 1px 0 rgba(255, 213, 152, .22);
}
.boss-hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #FF8A72 0%, #F23824 34%, #D4130B 72%, #A80A07 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .4),
    inset 0 -2px 4px rgba(96, 0, 0, .5),
    0 0 10px rgba(255, 62, 30, .45);
  transition: width .18s cubic-bezier(.2, .8, .3, 1);
}
.boss-hp-fill::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 17%;
  height: 28%;
  border-radius: 999px;
  background: rgba(255, 255, 255, .3);
}
.boss-hp.hit { animation: hp-hit .2s ease-out; }
.boss-hp.low .boss-hp-fill { animation: hp-low 1s ease-in-out infinite alternate; }

/* ---------- 连击看板 ---------- */
.combo-badge {
  position: absolute;
  left: max(4.5vw, calc(env(safe-area-inset-left, 0px) + 14px));
  top: calc(var(--scrim-h) + var(--safe-top) - 10px);
  z-index: 24;
  width: min(37vw, 540px);
  min-height: clamp(96px, 17.5vh, 186px);
  display: flex;
  align-items: center;
  padding: clamp(10px, 1.8vh, 20px) clamp(14px, 2vw, 26px);
  border: 3px solid #FFC85C;
  border-radius: 20px 30px 24px 30px;
  background:
    radial-gradient(140% 150% at 14% 4%, rgba(120, 56, 26, .95) 0%, rgba(58, 26, 12, .98) 44%, rgba(33, 14, 6, .99) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(92, 43, 19, .9),
    inset 0 0 30px rgba(255, 133, 46, .16),
    0 6px 0 rgba(29, 12, 4, .7),
    0 12px 26px rgba(0, 0, 0, .35);
  transform: rotate(-2.4deg);
  pointer-events: none;
  overflow: hidden;
}
.combo-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 185, 95, .05) 22px 24px),
    radial-gradient(circle at 84% 18%, rgba(255, 198, 88, .18) 0 3px, transparent 4px);
  background-size: auto, 18px 18px;
  opacity: .8;
}
.combo-badge::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 5px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 200, 92, .7), transparent);
}
.combo-badge.pop { animation: combo-pop .26s ease-out; }

.combo-zero {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, .6vh, 6px);
  transform: rotate(2deg);
  text-align: center;
}
.combo-zero-title {
  font-size: clamp(34px, 6.8vh, 72px);
  font-weight: 900;
  line-height: .95;
  color: #FFE05A;
  -webkit-text-fill-color: #FFE05A;
  -webkit-text-stroke: 1.5px #471B06;
  paint-order: stroke fill;
  text-shadow:
    0 3px 0 #B84A0D,
    0 7px 12px rgba(0, 0, 0, .5),
    0 0 24px rgba(255, 183, 63, .45);
  letter-spacing: .02em;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.combo-zero-sub {
  font-size: clamp(11px, 1.8vh, 16px);
  font-weight: 800;
  color: #FFE6B5;
  letter-spacing: .04em;
  text-shadow: 0 1px 2px #000;
}
.combo-weapon {
  position: absolute;
  right: 3%;
  top: 50%;
  width: 23%;
  height: auto;
  transform: translateY(-50%) rotate(10deg);
  opacity: .96;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 14px rgba(255, 178, 60, .28));
}

.combo-live {
  position: relative;
  z-index: 1;
  display: none;
  width: 100%;
  flex-direction: column;
  gap: clamp(3px, .7vh, 8px);
}
.combo-badge.live .combo-zero { display: none; }
.combo-badge.live .combo-live { display: flex; }
.combo-line {
  display: flex;
  align-items: baseline;
  gap: clamp(3px, .7vw, 10px);
  line-height: .84;
  transform: rotate(1.5deg);
}
.combo-num {
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(52px, 10.6vh, 112px);
  font-weight: 900;
  line-height: .8;
  letter-spacing: -.04em;
  color: #FFD64D;
  -webkit-text-fill-color: #FFD64D;
  -webkit-text-stroke: clamp(1px, .2vh, 2.5px) #4A1C07;
  paint-order: stroke fill;
  text-shadow:
    0 5px 0 #B84A0D,
    0 10px 18px rgba(0, 0, 0, .55),
    0 0 28px rgba(255, 190, 63, .42);
  font-variant-numeric: tabular-nums;
}
.combo-word {
  font-size: clamp(30px, 5.8vh, 64px);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.03em;
  color: #FF7B3C;
  -webkit-text-fill-color: #FF7B3C;
  -webkit-text-stroke: clamp(1px, .16vh, 2px) #FFF2CB;
  paint-order: stroke fill;
  text-shadow:
    0 3px 0 #7E1F08,
    0 7px 14px rgba(0, 0, 0, .45);
  transform: skewX(-5deg);
}
.combo-meter {
  width: 100%;
  height: clamp(5px, .8vh, 9px);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(14, 5, 2, .72);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8);
}
.combo-meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF9A3C, #FFD64D);
  box-shadow: 0 0 8px rgba(255, 180, 60, .55);
  transform-origin: left center;
}
.combo-meter span.run {
  animation: combo-drain 1.5s linear forwards;
}
.combo-gain {
  position: absolute;
  right: 10px;
  top: 7px;
  z-index: 1;
  font-size: clamp(12px, 1.9vh, 18px);
  font-weight: 900;
  color: #FFE9B3;
  opacity: 0;
  text-shadow: 0 1px 2px #000;
}
.combo-gain.show { animation: gain-pop .6s ease-out; }

/* ---------- 老板台词 ---------- */
.boss-bubble {
  position: absolute;
  z-index: 25;
  top: calc(var(--scrim-h) + var(--safe-top) + 4px);
  right: max(4vw, calc(env(safe-area-inset-right, 0px) + 14px));
  max-width: min(36vw, 380px);
  padding: clamp(9px, 1.4vh, 15px) clamp(13px, 1.7vw, 22px);
  border: 3px solid #38180A;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(180deg, #FFF9E9 0%, #FFE8BD 100%);
  color: #47200C;
  font-size: clamp(13px, 1.85vh, 19px);
  font-weight: 900;
  line-height: 1.35;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, .65),
    0 5px 0 rgba(43, 18, 6, .35),
    0 10px 20px rgba(0, 0, 0, .3);
  transform: rotate(1.4deg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boss-bubble::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -13px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 4px solid transparent;
  border-top: 15px solid #38180A;
}
.boss-bubble.show {
  visibility: visible;
  animation: bubble-in 2.3s ease both;
}

/* ---------- 操作提示 ---------- */
.tap-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + clamp(14px, 2.6vh, 24px));
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: clamp(9px, 1.4vh, 13px) clamp(15px, 2vw, 22px);
  border: 2px solid rgba(255, 207, 102, .55);
  border-radius: 999px;
  background: rgba(36, 17, 8, .72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #FFE8B8;
  font-size: clamp(12px, 1.7vh, 16px);
  font-weight: 800;
  letter-spacing: .03em;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  transform: translateX(-50%);
  animation: hint-bob 1.7s ease-in-out infinite;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.tap-hint.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}
.tap-hint .tap-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FFD64D;
  box-shadow: 0 0 0 0 rgba(255, 214, 77, .65);
  animation: tap-dot 1.4s ease-out infinite;
}

/* ---------- 打击特效 ---------- */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 28;
  overflow: hidden;
  pointer-events: none;
}
.impact-star {
  position: absolute;
  width: clamp(70px, 11vw, 172px);
  height: clamp(70px, 11vw, 172px);
  margin-left: calc(clamp(70px, 11vw, 172px) / -2);
  margin-top: calc(clamp(70px, 11vw, 172px) / -2);
  transform-origin: center;
  animation: impact-pop .34s cubic-bezier(.16, 1.3, .3, 1) forwards;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 14px rgba(255, 225, 80, .8));
}
.impact-star svg { display: block; width: 100%; height: 100%; overflow: visible; }
.impact-star.crit {
  width: clamp(110px, 17vw, 260px);
  height: clamp(110px, 17vw, 260px);
  margin-left: calc(clamp(110px, 17vw, 260px) / -2);
  margin-top: calc(clamp(110px, 17vw, 260px) / -2);
}
.dmg-num {
  position: absolute;
  z-index: 2;
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(28px, 4.8vh, 50px);
  font-weight: 900;
  line-height: 1;
  color: #FFF7D4;
  -webkit-text-stroke: clamp(1px, .18vh, 2px) #7A2507;
  text-shadow:
    0 3px 0 #D03A10,
    0 6px 12px rgba(0, 0, 0, .5);
  animation: dmg-fly .72s cubic-bezier(.15, .8, .3, 1) forwards;
  white-space: nowrap;
  will-change: transform, opacity;
}
.dmg-num.crit {
  font-size: clamp(36px, 6.3vh, 66px);
  color: #FFE446;
  -webkit-text-stroke: clamp(1.5px, .25vh, 3px) #5A1605;
  text-shadow:
    0 4px 0 #C32A07,
    0 8px 18px rgba(0, 0, 0, .55),
    0 0 18px rgba(255, 201, 54, .75);
}
.dmg-num .crit-tag {
  display: block;
  margin-top: 3px;
  font-size: .34em;
  letter-spacing: .18em;
  color: #FFB43D;
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .5);
}
.spark {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #FFE04C;
  clip-path: polygon(50% 0%, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0% 50%, 38% 36%);
  animation: spark-fly .48s ease-out forwards;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 4px rgba(255, 190, 50, .8));
}
.spark.orange { background: #FF8B35; }
.spark.white { background: #FFF6DC; width: 8px; height: 8px; }
.swoosh {
  position: absolute;
  width: clamp(110px, 19vw, 290px);
  height: clamp(26px, 4.4vw, 64px);
  border-top: clamp(4px, .7vw, 9px) solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  transform-origin: right center;
  filter: blur(.4px) drop-shadow(0 0 8px rgba(255, 255, 255, .45));
  animation: swoosh-out .3s ease-out forwards;
  pointer-events: none;
}
.whack-ring {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 5px solid rgba(255, 235, 140, .92);
  border-radius: 50%;
  animation: ring-out .36s ease-out forwards;
}
.hit-flash {
  position: absolute;
  inset: 0;
  z-index: 27;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--ix, 60%) var(--iy, 44%), rgba(255, 246, 196, .92) 0%, rgba(255, 202, 80, .38) 18%, transparent 46%);
  mix-blend-mode: screen;
}
.hit-flash.on { animation: flash-out .18s ease-out; }

.rage-vignette {
  position: absolute;
  inset: 0;
  z-index: 23;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(105% 90% at 50% 50%, transparent 44%, rgba(212, 32, 12, .48) 100%);
  transition: opacity .45s ease;
}
.stage.phase-rage .rage-vignette { opacity: .7; animation: rage-pulse 1.1s ease-in-out infinite alternate; }
.stage.phase-low .rage-vignette { opacity: .4; }

.coin {
  position: absolute;
  width: clamp(18px, 2.6vh, 28px);
  height: clamp(18px, 2.6vh, 28px);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #FFF7B0 0%, #FFD33D 38%, #E19A13 76%, #A85E06 100%);
  border: 2px solid #7B4206;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), 0 2px 5px rgba(0, 0, 0, .3);
  color: #7A4204;
  font-size: clamp(9px, 1.4vh, 14px);
  font-weight: 900;
  display: grid;
  place-items: center;
  animation: coin-fall .95s cubic-bezier(.3, .7, .4, 1) forwards;
  will-change: transform, opacity;
}
.coin::after { content: "¥"; }

/* ---------- 锤飞出场 ---------- */
.boss-flyer {
  position: absolute;
  z-index: 41;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform-origin: 48% 45%;
  will-change: transform, opacity;
  filter: saturate(1.06) contrast(1.02);
}
.boss-flyer img {
  display: block;
  width: 100%;
  height: 100%;
  filter:
    drop-shadow(3px 0 0 rgba(255, 249, 218, .95))
    drop-shadow(-3px 0 0 rgba(255, 249, 218, .95))
    drop-shadow(0 3px 0 rgba(255, 249, 218, .95))
    drop-shadow(0 -3px 0 rgba(255, 249, 218, .95))
    drop-shadow(-24px 22px 20px rgba(255, 154, 48, .4))
    drop-shadow(0 16px 18px rgba(34, 12, 4, .32));
}
.boss-flyer::before {
  content: "";
  position: absolute;
  right: 82%;
  top: 18%;
  width: 135%;
  height: 66%;
  pointer-events: none;
  background: repeating-linear-gradient(96deg, rgba(255, 252, 232, .85) 0 5px, rgba(255, 213, 120, .2) 5px 9px, transparent 9px 30px);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 42%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 42%, #000 100%);
  filter: blur(2px);
  opacity: .55;
  transform: skewY(-9deg);
}
.stage.ko-mode .boss-flyer {
  visibility: visible;
  animation: boss-fly 1.35s cubic-bezier(.36, .05, .26, 1) .05s both;
}
@keyframes boss-fly {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  7% { opacity: 1; transform: translate3d(1.5%, -2.5%, 0) rotate(-5deg) scale(1.02); }
  18% { opacity: 1; transform: translate3d(-1.5%, -9%, 0) rotate(8deg) scale(1.03); }
  100% { opacity: .96; transform: translate3d(var(--fly-x, 120vw), var(--fly-y, -80vh), 0) rotate(560deg) scale(.46); }
}
.stage.ko-mode .hud { opacity: .3; transition: opacity .16s ease-out; }
.stage.ko-mode .combo-badge,
.stage.ko-mode .boss-bubble,
.stage.ko-mode .tap-hint,
.stage.ko-mode .aura,
.stage.ko-mode .boss-glow,
.stage.ko-mode .rage-vignette { opacity: 0 !important; transition: opacity .14s ease-out; }
.stage.ko-mode .scene-img { filter: saturate(1.18) contrast(1.04) blur(2.2px); }

/* ---------- KO 演出 ---------- */
.ko-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
  visibility: hidden;
}
.ko-layer.on { visibility: visible; }
.ko-flash {
  position: absolute;
  inset: 0;
  background: #FFF9E3;
  opacity: 0;
}
.ko-layer.on .ko-flash { animation: ko-flash .8s ease-out .05s both; }
.ko-burst {
  position: absolute;
  left: 67%;
  top: 46%;
  width: min(54vw, 660px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.2) rotate(-8deg);
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, #FFFCE0 0 7%, #FFE34A 8% 21%, #FFA92E 22% 48%, #F0641E 49% 74%, #D83812 75% 100%);
  clip-path: polygon(50% 0%, 57% 29%, 78% 5%, 69% 35%, 98% 24%, 74% 47%, 100% 62%, 70% 63%, 86% 94%, 61% 70%, 50% 100%, 40% 70%, 14% 94%, 30% 62%, 0% 62%, 27% 47%, 2% 25%, 31% 35%, 22% 5%, 43% 29%);
  filter: drop-shadow(0 0 32px rgba(255, 211, 73, .8));
}
.ko-layer.on .ko-burst { animation: ko-burst .75s cubic-bezier(.16, 1.2, .3, 1) both; }
.ko-burst-word {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%) rotate(-7deg);
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(50px, 14vh, 124px);
  font-weight: 900;
  letter-spacing: -.04em;
  color: #FFE34A;
  -webkit-text-fill-color: #FFE34A;
  -webkit-text-stroke: clamp(1.5px, .28vh, 3px) #6A1A05;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #D63C0C, 0 13px 26px rgba(0, 0, 0, .42);
  white-space: nowrap;
}
.speed-lines {
  position: absolute;
  right: -10%;
  top: 8%;
  width: 75%;
  height: 84%;
  opacity: 0;
  background:
    repeating-linear-gradient(174deg, transparent 0 17px, rgba(255, 239, 190, .38) 17px 20px, transparent 20px 46px);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 52%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 52%, #000 100%);
}
.ko-layer.on .speed-lines { animation: speed-lines .8s ease-out .05s both; }
.dust-cloud {
  position: absolute;
  left: 34%;
  bottom: 3%;
  width: 56%;
  height: 26%;
  opacity: 0;
  background:
    radial-gradient(ellipse at 20% 70%, rgba(255, 239, 214, .72) 0 12%, transparent 45%),
    radial-gradient(ellipse at 44% 55%, rgba(255, 231, 196, .78) 0 16%, transparent 50%),
    radial-gradient(ellipse at 68% 72%, rgba(255, 239, 214, .64) 0 14%, transparent 46%),
    radial-gradient(ellipse at 86% 58%, rgba(255, 231, 196, .58) 0 12%, transparent 42%);
  filter: blur(7px);
}
.ko-layer.on .dust-cloud { animation: dust .85s ease-out both; }

/* ---------- 遮罩层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--safe-top) + 16px)
    max(18px, env(safe-area-inset-right, 0px))
    calc(var(--safe-bottom) + 16px)
    max(18px, env(safe-area-inset-left, 0px));
  background: rgba(22, 10, 4, .58);
  -webkit-backdrop-filter: blur(10px) saturate(.9);
  backdrop-filter: blur(10px) saturate(.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s;
  overflow-y: auto;
  z-index: 70;
}
.overlay.show { opacity: 1; visibility: visible; }

.pause-card {
  position: relative;
  width: min(88vw, 390px);
  padding: clamp(20px, 3.4vh, 30px) clamp(20px, 4vw, 30px);
  border-radius: 26px;
  border: 4px solid #3B1A08;
  background: linear-gradient(180deg, #FFF8E6 0%, #FFE6BA 100%);
  box-shadow:
    inset 0 0 0 4px #FFC865,
    0 9px 0 #7B3A11,
    0 22px 50px rgba(0, 0, 0, .52);
  text-align: center;
  transform: translateY(14px) scale(.97);
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.1);
}
.overlay.show .pause-card { transform: translateY(0) scale(1); }
.pause-kicker {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FCE0A4;
  color: #8B4C17;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
}
.pause-card h2 {
  margin: 8px 0 4px;
  font-size: clamp(27px, 5vh, 38px);
  font-weight: 900;
  letter-spacing: -.03em;
  color: #42200C;
}
.pause-card p {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  color: #8E643E;
}
.btn-primary {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: 3px solid #3B1907;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFA657 0%, #FF812F 48%, #EE5D13 100%);
  color: #FFF7E2;
  font-size: clamp(17px, 2.5vh, 22px);
  font-weight: 900;
  letter-spacing: .02em;
  text-shadow: 0 2px 0 #8C3208;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .48),
    0 5px 0 #A53E08,
    0 10px 18px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-primary .mp-icon { width: 22px; height: 22px; }
.btn-primary:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .35),
    0 1px 0 #A53E08,
    0 4px 9px rgba(0, 0, 0, .2);
}
.btn-ghost {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 2px solid #C69157;
  border-radius: 14px;
  background: rgba(255, 251, 239, .7);
  color: #7A4520;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn-ghost .mp-icon { width: 18px; height: 18px; }
.btn-ghost:active { background: #F6E2BF; transform: translateY(1px); }
.sound-row {
  width: 100%;
  margin-top: 14px;
  padding: 11px 3px 0;
  border: 0;
  border-top: 1px dashed #D9B785;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6F411F;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sound-state {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #B05B1B;
}
.sound-state .mp-icon { width: 19px; height: 19px; }
.sound-row[aria-pressed="false"] .sound-state { color: #9C927E; }

/* ---------- 结算 ---------- */
.result-overlay {
  background:
    radial-gradient(circle at 50% 35%, rgba(72, 34, 13, .42), rgba(18, 8, 3, .78) 72%),
    rgba(22, 10, 4, .6);
}
.result-card {
  position: relative;
  z-index: 2;
  width: min(92vw, 520px);
  margin: auto;
  padding: clamp(20px, 3vh, 28px) clamp(18px, 4vw, 28px) clamp(17px, 2.6vh, 24px);
  border: 4px solid #3B1A08;
  border-radius: 28px;
  background:
    radial-gradient(120% 70% at 50% 0%, #FFFDF3 0%, #FFF4D8 36%, #FFE1A9 100%);
  box-shadow:
    inset 0 0 0 4px #FFC45B,
    inset 0 0 0 7px rgba(255, 249, 220, .65),
    0 10px 0 #7B3A11,
    0 26px 60px rgba(0, 0, 0, .55);
  text-align: center;
  transform: translateY(24px) scale(.96) rotate(-.4deg);
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.1);
  overflow: hidden;
}
.overlay.show .result-card { transform: translateY(0) scale(1) rotate(-.4deg); }
.result-card::before {
  content: "";
  position: absolute;
  left: -30%;
  right: -30%;
  top: -72%;
  height: 100%;
  background: conic-gradient(from 0deg, rgba(255, 187, 73, .16), transparent 18%, rgba(255, 187, 73, .16) 32%, transparent 50%, rgba(255, 187, 73, .14) 66%, transparent 82%, rgba(255, 187, 73, .16));
  pointer-events: none;
}
.ko-stamp {
  position: absolute;
  top: clamp(16px, 2.4vh, 24px);
  right: clamp(16px, 3vw, 24px);
  padding: 1px 8px 3px;
  border: 4px solid #E03C1D;
  border-radius: 8px;
  color: #E03C1D;
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(16px, 2.6vh, 24px);
  font-weight: 900;
  letter-spacing: .06em;
  transform: rotate(11deg);
  opacity: .86;
  background: rgba(255, 255, 255, .28);
}
.result-kicker {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: #F7D995;
  color: #8B4C17;
  font-size: clamp(9px, 1.3vh, 11px);
  font-weight: 900;
  letter-spacing: .2em;
}
.result-card h2 {
  position: relative;
  margin: clamp(7px, 1.2vh, 10px) 0 0;
  font-size: clamp(32px, 6.4vh, 56px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.04em;
  color: #D9401B;
  -webkit-text-stroke: 1px #4A1A07;
  text-shadow:
    0 2px 0 #FFD36B,
    0 4px 0 rgba(117, 50, 12, .14);
}
.result-sub {
  margin: clamp(5px, 1vh, 9px) 0 clamp(13px, 2.2vh, 19px);
  color: #916641;
  font-size: clamp(11px, 1.65vh, 14px);
  font-weight: 700;
  letter-spacing: .02em;
}
.result-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: clamp(13px, 2.1vh, 18px);
}
.rank-label {
  color: #A0764A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}
.rank-badge {
  width: clamp(43px, 6.6vh, 60px);
  height: clamp(43px, 6.6vh, 60px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid #4A1B07;
  background: linear-gradient(180deg, #FFD64D 0%, #FF9C34 100%);
  color: #5B2408;
  font-family: "Arial Black", sans-serif;
  font-size: clamp(23px, 3.9vh, 34px);
  font-weight: 900;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .7),
    0 4px 0 #A44E0D;
  transform: rotate(-6deg);
}
.rank-words {
  color: #B15C22;
  font-size: clamp(12px, 1.8vh, 15px);
  font-weight: 900;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 1vw, 9px);
  margin-bottom: clamp(10px, 1.8vh, 14px);
}
.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: clamp(9px, 1.4vh, 13px) 4px clamp(8px, 1.2vh, 11px);
  border: 2px solid #F0CF95;
  border-radius: 14px;
  background: rgba(255, 252, 240, .72);
  box-shadow: inset 0 1px 0 #fff;
}
.stat-value {
  font-family: "Arial Black", "PingFang SC", sans-serif;
  font-size: clamp(20px, 3.4vh, 32px);
  font-weight: 900;
  line-height: 1;
  color: #4A220C;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: clamp(9px, 1.3vh, 11px);
  font-weight: 800;
  color: #A47849;
  letter-spacing: .04em;
}
.best-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: clamp(13px, 2.2vh, 18px);
  color: #9A6F46;
  font-size: clamp(11px, 1.55vh, 13px);
  font-weight: 700;
}
.best-line strong {
  color: #6F3713;
  font-size: clamp(14px, 2.1vh, 18px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.best-new {
  display: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: #E34321;
  color: #FFF3D2;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  animation: best-pop 1.1s ease-in-out infinite alternate;
}
.best-new.show { display: inline-block; }
.result-restart { min-height: clamp(50px, 7vh, 62px); }
.result-foot {
  display: block;
  margin-top: 12px;
  color: #B08C67;
  font-size: clamp(9px, 1.3vh, 11px);
  font-weight: 600;
  letter-spacing: .03em;
}
.confetti {
  position: absolute;
  top: -24px;
  z-index: 1;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  animation: confetti-fall linear forwards;
  will-change: transform, opacity;
}

/* ---------- 动画 ---------- */
@keyframes scene-breathe {
  from { transform: scale(1.002) translate3d(0, 0, 0); }
  to { transform: scale(1.018) translate3d(0, -0.4%, 0); }
}
@keyframes flame-flicker {
  from { transform: scaleY(.86) scaleX(.94) rotate(-3deg); opacity: .75; }
  to { transform: scaleY(1.08) scaleX(1.04) rotate(3deg); opacity: 1; }
}
@keyframes score-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes hp-hit {
  0%, 100% { transform: translateX(0); filter: brightness(1); }
  30% { transform: translateX(-3px); filter: brightness(1.7); }
  60% { transform: translateX(2px); }
}
@keyframes hp-low {
  from { filter: brightness(1) saturate(1); }
  to { filter: brightness(1.4) saturate(1.3); }
}
@keyframes boss-face-rage {
  from { filter: saturate(1.42) contrast(1.08) hue-rotate(-4deg) brightness(1.02); }
  to { filter: saturate(1.7) contrast(1.14) hue-rotate(-11deg) brightness(1.1); }
}
@keyframes combo-pop {
  0% { transform: rotate(-2.4deg) scale(1); }
  40% { transform: rotate(-1deg) scale(1.035); }
  100% { transform: rotate(-2.4deg) scale(1); }
}
@keyframes combo-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
@keyframes gain-pop {
  0% { opacity: 0; transform: translateY(5px) scale(.8); }
  25% { opacity: 1; transform: translateY(-2px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-15px) scale(1); }
}
@keyframes bubble-in {
  0% { opacity: 0; transform: rotate(1.4deg) translateY(8px) scale(.92); }
  10% { opacity: 1; transform: rotate(1.4deg) translateY(0) scale(1.02); }
  16% { transform: rotate(1.4deg) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: rotate(1.4deg) translateY(-5px) scale(.99); }
}
@keyframes hint-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}
@keyframes tap-dot {
  0% { box-shadow: 0 0 0 0 rgba(255, 214, 77, .7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 214, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 214, 77, 0); }
}
@keyframes impact-pop {
  0% { transform: scale(.16) rotate(-16deg); opacity: 0; }
  35% { transform: scale(1.14) rotate(4deg); opacity: 1; }
  65% { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: scale(1.3) rotate(8deg); opacity: 0; }
}
@keyframes dmg-fly {
  0% { transform: translate(-50%, 0) scale(.55); opacity: 0; }
  16% { transform: translate(-50%, -10px) scale(1.16); opacity: 1; }
  40% { transform: translate(-50%, -28px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -82px) scale(.92); opacity: 0; }
}
@keyframes spark-fly {
  0% { transform: translate(0, 0) rotate(0) scale(.4); opacity: 1; }
  65% { opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) rotate(var(--sr)) scale(.1); opacity: 0; }
}
@keyframes swoosh-out {
  0% { transform: rotate(var(--rot, -24deg)) scaleX(.3); opacity: 0; }
  30% { opacity: .9; }
  100% { transform: rotate(var(--rot, -24deg)) scaleX(1.12) translateX(-12px); opacity: 0; }
}
@keyframes ring-out {
  0% { transform: scale(.3); opacity: 1; }
  100% { transform: scale(3.4); opacity: 0; }
}
@keyframes flash-out {
  0% { opacity: 0; }
  22% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes rage-pulse {
  from { opacity: .45; }
  to { opacity: .85; }
}
@keyframes coin-fall {
  0% { transform: translate(0, 0) rotate(0) scale(.4); opacity: 0; }
  15% { opacity: 1; transform: translate(0, -10px) rotate(30deg) scale(1); }
  100% { transform: translate(var(--cx, 20px), var(--cy, 180px)) rotate(var(--cr, 360deg)) scale(.85); opacity: 0; }
}
@keyframes ko-flash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  55% { opacity: .35; }
  100% { opacity: 0; }
}
@keyframes ko-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(-8deg); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(2deg); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(.98) rotate(1deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.14) rotate(4deg); }
}
@keyframes speed-lines {
  0% { opacity: 0; transform: translateX(4%) scaleX(.8); }
  18% { opacity: .9; }
  100% { opacity: 0; transform: translateX(28%) scaleX(1.06); }
}
@keyframes dust {
  0% { opacity: 0; transform: scale(.6) translateY(10%); }
  25% { opacity: .96; }
  100% { opacity: 0; transform: scale(1.2) translateY(-20%); }
}
@keyframes best-pop {
  from { transform: scale(1) rotate(-2deg); }
  to { transform: scale(1.08) rotate(1deg); }
}
@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0, -20px, 0) rotate(0deg); }
  8% { opacity: .95; }
  100% { opacity: 0; transform: translate3d(var(--drift, 0px), 104vh, 0) rotate(var(--spin, 360deg)); }
}
@keyframes shake-scene {
  0% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-9px, 4px) rotate(-.5deg) scale(1.008); }
  32% { transform: translate(7px, -5px) rotate(.45deg) scale(1.005); }
  52% { transform: translate(-6px, 3px) rotate(-.35deg); }
  72% { transform: translate(5px, -2px) rotate(.2deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
.stage.shake .scene-wrap { animation: shake-scene .25s cubic-bezier(.36, .07, .19, .97); }
.stage.ko-mode .scene-wrap { animation: ko-zoom .9s cubic-bezier(.18, .8, .3, 1) both; }
.stage.ko-mode .scene-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 31% 48% at 78% 47%, rgba(31, 13, 5, .9) 0 32%, rgba(31, 13, 5, .48) 58%, rgba(31, 13, 5, 0) 82%);
  filter: blur(5px);
  animation: ko-void .34s ease-out .06s forwards;
}
@keyframes ko-zoom {
  0% { transform: scale(1); filter: brightness(1); }
  18% { transform: scale(1.075) translateX(-1.5%) rotate(-.5deg); filter: brightness(1.35); }
  52% { transform: scale(1.02) translateX(-.5%); filter: brightness(1.05); }
  100% { transform: scale(1.02); filter: brightness(.52) blur(5px); }
}
@keyframes ko-void {
  from { opacity: 0; }
  to { opacity: 1; }
}
.stage.paused .scene-img,
.stage.paused .aura .flame,
.stage.paused .hud-scrim { animation-play-state: paused !important; }
.stage.paused .tap-hint { display: none; }

/* ---------- 横屏宽屏微调 ---------- */
@media (min-aspect-ratio: 16/9) {
  .combo-badge { top: calc(var(--scrim-h) + var(--safe-top) - 14px); min-height: clamp(92px, 16vh, 172px); }
  .boss-bubble { top: calc(var(--scrim-h) + var(--safe-top) - 2px); }
}
@media (min-aspect-ratio: 2/1) {
  .hud { padding-top: calc(var(--safe-top) + 7px); }
  .combo-badge { top: calc(var(--scrim-h) + var(--safe-top) - 20px); min-height: clamp(88px, 15vh, 160px); }
  .combo-zero-title { font-size: clamp(30px, 6vh, 62px); }
}

/* ---------- 竖屏兜底：仍是同一套横版对战，只是收拢 HUD ---------- */
@media (max-aspect-ratio: 1/1) {
  :root {
    --hud-card-h: 44px;
    --hud-btn: 42px;
    --hud-pad-x: 10px;
    --scrim-h: 120px;
  }
  .scene-img { object-position: 54% 46%; }
  .hud { gap: 6px; }
  .weapon-card { min-width: 60px; padding: 0 7px; }
  .slipper-icon { width: 30px; }
  .weapon-count { font-size: 18px; }
  .score-card { min-width: 78px; max-width: 25vw; padding: 2px 8px 3px; }
  .score-label { font-size: 8px; letter-spacing: .09em; }
  .score-val { font-size: 21px; }
  .boss-hud { max-width: 44vw; gap: 5px; }
  .boss-face { width: 44px; height: 44px; border-radius: 11px; }
  .boss-tag { font-size: 5px; padding: 0 4px; }
  .boss-hp-label { font-size: 8px; gap: 3px; }
  .boss-hp-label span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .boss-hp { height: 13px; }
  .combo-badge {
    top: calc(var(--scrim-h) + var(--safe-top) - 2px);
    left: 13px;
    width: min(58vw, 290px);
    min-height: 0;
    padding: 9px 13px 10px;
    border-width: 2px;
    border-radius: 15px 20px 16px 20px;
    transform: rotate(-2deg);
  }
  .combo-badge.pop { animation-name: combo-pop-portrait; }
  .combo-zero-title { font-size: clamp(28px, 4.5vh, 40px); }
  .combo-zero-sub { font-size: 10px; }
  .combo-weapon { width: 21%; right: 2%; }
  .combo-line { gap: 4px; }
  .combo-num { font-size: clamp(40px, 6.4vh, 58px); }
  .combo-word { font-size: clamp(22px, 3.6vh, 32px); }
  .combo-meter { height: 5px; }
  .boss-bubble {
    top: calc(var(--scrim-h) + var(--safe-top) + 102px);
    right: 12px;
    max-width: 68vw;
    padding: 8px 12px;
    border-width: 2px;
    border-radius: 13px 13px 4px 13px;
    font-size: 12px;
    line-height: 1.32;
  }
  .boss-bubble::after { right: 20px; bottom: -10px; border-top-width: 12px; }
  .tap-hint { font-size: 11px; padding: 8px 14px; bottom: calc(var(--safe-bottom) + 12px); }
  .overlay { padding-left: 16px; padding-right: 16px; }
  .pause-card { width: min(90vw, 360px); padding: 20px 20px 18px; }
  .pause-card h2 { font-size: 27px; }
  .result-card { width: min(92vw, 390px); padding: 18px 16px 16px; border-radius: 24px; }
  .result-card h2 { font-size: clamp(29px, 4.7vh, 42px); }
  .ko-stamp { top: 14px; right: 14px; font-size: 15px; border-width: 3px; }
  .result-sub { margin-bottom: 12px; font-size: 10.5px; }
  .result-rank { margin-bottom: 11px; }
  .stat-value { font-size: 21px; }
  .stat-label { font-size: 9px; }
  .best-line { margin-bottom: 12px; }
  .result-foot { margin-top: 9px; font-size: 9px; }
  .ko-burst { left: 53%; top: 44%; width: 86vw; }
  .ko-burst-word { font-size: clamp(40px, 8.5vh, 68px); }
}
@keyframes combo-pop-portrait {
  0% { transform: rotate(-2deg) scale(1); }
  40% { transform: rotate(-.5deg) scale(1.04); }
  100% { transform: rotate(-2deg) scale(1); }
}

@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  :root { --hud-card-h: 40px; --hud-btn: 38px; --scrim-h: 74px; }
  .combo-badge { min-height: 88px; padding: 7px 14px; }
  .combo-num { font-size: 54px; }
  .combo-word { font-size: 32px; }
  .combo-zero-title { font-size: 36px; }
  .result-card { padding: 14px 18px 12px; }
  .result-card h2 { font-size: 32px; }
  .result-sub { margin-bottom: 9px; }
  .result-rank { margin-bottom: 9px; }
  .result-stats { margin-bottom: 8px; }
  .stat-cell { padding: 7px 4px; }
  .best-line { margin-bottom: 8px; }
  .result-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-img, .tap-hint, .tap-hint .tap-dot, .aura .flame, .best-new { animation: none !important; }
}

/* ---------- 竖屏成品态：主角放大，分享链接直接打开也能玩 ---------- */
.portrait-cast { display: none; }

@media (max-aspect-ratio: 1/1) {
  .portrait-cast {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
  }
  .portrait-cast::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    background: linear-gradient(180deg, rgba(24, 11, 5, 0) 0%, rgba(24, 11, 5, .5) 46%, rgba(20, 9, 4, .86) 100%);
    pointer-events: none;
  }
  .cast-boss {
    position: absolute;
    right: -2vw;
    top: 24vh;
    width: 74vw;
    height: auto;
    filter:
      drop-shadow(0 2px 1px rgba(255, 246, 214, .35))
      drop-shadow(0 18px 22px rgba(30, 12, 5, .38));
    animation: cast-bob 3.8s ease-in-out infinite alternate;
    transform-origin: 55% 60%;
  }
  .cast-boy {
    position: absolute;
    left: -16vw;
    bottom: 29vh;
    width: 100vw;
    height: auto;
    filter: drop-shadow(0 22px 20px rgba(30, 12, 5, .42));
    animation: cast-boy-bob 2.6s ease-in-out infinite alternate;
    transform-origin: 55% 85%;
  }
  @keyframes cast-bob {
    from { transform: translateY(0) rotate(-1deg); }
    to { transform: translateY(-1.4vh) rotate(1deg); }
  }
  @keyframes cast-boy-bob {
    from { transform: translateY(0) rotate(.4deg); }
    to { transform: translateY(-.7vh) rotate(-.6deg); }
  }
  .scene-img {
    filter: blur(20px) saturate(1.16) brightness(.5);
    opacity: .86;
    object-position: 50% 42%;
  }
  .scene-grade {
    background:
      radial-gradient(90% 55% at 62% 34%, rgba(255, 164, 82, .18) 0%, transparent 62%),
      linear-gradient(180deg, rgba(48, 20, 8, .2) 0%, rgba(255, 132, 54, .05) 42%, rgba(24, 10, 4, .55) 100%);
    mix-blend-mode: normal;
  }
  .boss-glow {
    right: -10vw;
    top: 13vh;
    width: 82vw;
    height: 36vh;
  }
  .aura {
    right: -8vw;
    top: 12vh;
    width: 80vw;
    height: 37vh;
  }
  .boss-bubble {
    top: calc(var(--scrim-h) + var(--safe-top) + 2px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
    max-width: 62vw;
  }
  .combo-badge {
    top: auto;
    left: calc(env(safe-area-inset-left, 0px) + 5vw);
    right: calc(env(safe-area-inset-right, 0px) + 5vw);
    bottom: calc(var(--safe-bottom) + 68px);
    width: auto;
    min-height: 0;
    padding: 9px 16px 10px;
    border-width: 2px;
    border-radius: 17px 24px 18px 24px;
    transform: rotate(-1.4deg);
  }
  .combo-zero-title { font-size: clamp(26px, 4.2vh, 36px); }
  .combo-zero-sub { font-size: 10px; }
  .combo-weapon { width: 19%; }
  .combo-num { font-size: clamp(38px, 6vh, 52px); }
  .combo-word { font-size: clamp(20px, 3.4vh, 28px); }
  .combo-badge.pop { animation-name: combo-pop-portrait; }
  .tap-hint {
    bottom: calc(var(--safe-bottom) + 14px);
    font-size: 11px;
    padding: 7px 13px;
  }
  .stage.ko-mode .cast-boss { opacity: 0; transition: opacity .1s ease-out; }
  .stage.ko-mode .cast-boy { animation-play-state: paused; }
  .stage.ko-mode .scene-img { filter: blur(20px) saturate(1.2) brightness(.42); }
}

@media (prefers-reduced-motion: reduce) {
  .cast-boss, .cast-boy { animation: none !important; }
}
