/* 动物大作战 · 森林擂台 — 移动端优先，竖屏铺满 */
:root {
  --theme: #FF8A3D;
  --theme-deep: #E86813;
  --theme-light: #FFC07A;
  --ink: #2E2115;
  --cream: #FFF6E4;
  --hud-bg: rgba(17, 33, 44, .72);
  --hud-line: rgba(255, 255, 255, .3);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0B170F;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font-family: inherit; border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(255, 214, 140, .9); outline-offset: 3px; }
.hidden { display: none !important; }

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0B170F;
  touch-action: none;
}
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(110% 85% at 50% 50%, rgba(255, 40, 20, 0) 45%, rgba(255, 46, 20, .62) 100%);
}
.app.hurt::after { animation: hurtFlash .38s ease-out; }
@keyframes hurtFlash {
  0% { opacity: .95; }
  45% { opacity: .55; }
  100% { opacity: 0; }
}

/* ---------- 场景 ---------- */
.world {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.world.is-shaking { animation: worldShake .26s ease-out; }
.scene { position: absolute; inset: 0; overflow: hidden; }
.scene-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(1.05);
}
.scene-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 31, 48, .18) 0%, rgba(8, 31, 48, 0) 18%, rgba(20, 46, 17, 0) 58%, rgba(13, 32, 12, .18) 100%),
    radial-gradient(120% 70% at 50% 42%, rgba(255, 244, 200, .08) 0%, rgba(255, 244, 200, 0) 70%);
}
.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(115% 88% at 50% 46%, rgba(0, 0, 0, 0) 52%, rgba(4, 14, 8, .42) 100%);
}

.cloud-a { animation: cloudDrift 22s ease-in-out infinite alternate; }
.cloud-b { animation: cloudDrift 29s ease-in-out infinite alternate-reverse; }
.cloud-c { animation: cloudDrift 34s ease-in-out infinite alternate; }
@keyframes cloudDrift { from { transform: translateX(-9px); } to { transform: translateX(15px); } }

.waterfall-streaks { animation: waterFlow 1.15s linear infinite; }
.water-ripples { animation: rippleShift 2.6s ease-in-out infinite alternate; }
@keyframes rippleShift { from { transform: translateY(-4px); opacity: .35; } to { transform: translateY(4px); opacity: .7; } }
@keyframes waterFlow {
  from { transform: translateY(-46px); opacity: .55; }
  45% { opacity: .9; }
  to { transform: translateY(52px); opacity: .5; }
}

/* ---------- 角色 ---------- */
.actors { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.actor {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 130px;
  transform-origin: 50% 100%;
  will-change: transform;
  pointer-events: none;
}
.actor-shadow {
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 62%;
  height: 15%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(20, 44, 12, .42) 0%, rgba(20, 44, 12, .24) 52%, rgba(20, 44, 12, 0) 100%);
  filter: blur(1.5px);
}
.sprite-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  transform: scaleX(var(--dir, 1));
}
.sprite { display: block; width: 100%; height: 100%; overflow: visible; }
.sprite svg { display: block; width: 100%; height: 100%; overflow: visible; }
.actor .sprite { animation: idleBreath 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
.actor[data-kind="rabbit"] .sprite { animation-duration: 2.2s; }
.actor.is-walking .sprite { animation: walkBob .36s ease-in-out infinite; }
.actor[data-kind="panda"].is-walking .sprite { animation: pandaWalk .34s ease-in-out infinite; }
.actor.is-attacking .sprite { animation: attackLunge .28s cubic-bezier(.2, .9, .3, 1); }
.actor.is-windup .sprite { animation: enemyWindup .44s ease-in-out; }
.actor.is-hit .sprite { filter: brightness(1.9) saturate(.55) drop-shadow(0 0 8px rgba(255, 255, 255, .9)); transition: filter .05s; }
.actor.is-dead .sprite { animation: deathPop .4s ease-in forwards; }
.actor.is-spawning .sprite { animation: spawnPop .42s cubic-bezier(.2, 1.5, .4, 1); }
.actor.is-dead .actor-hp { opacity: 0; }

@keyframes idleBreath {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-2.5px) scale(1.006, 1.014); }
}
@keyframes walkBob {
  0%, 100% { transform: translateY(0) rotate(-1.6deg); }
  50% { transform: translateY(-5px) rotate(1.6deg); }
}
@keyframes pandaWalk {
  0%, 100% { transform: translateY(0) rotate(-2.2deg) scale(1, 1); }
  50% { transform: translateY(-6px) rotate(2.2deg) scale(1.012, .99); }
}
@keyframes attackLunge {
  0% { transform: translateY(0) scale(1); }
  26% { transform: translateY(-4px) scale(1.1, .92); }
  48% { transform: translateY(-8px) scale(.94, 1.07); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes enemyWindup {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(2px) scale(1.1, .9) rotate(-3deg); }
  70% { transform: translateY(-2px) scale(.95, 1.06) rotate(3deg); }
}
@keyframes deathPop {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  40% { transform: scale(1.16, .84) rotate(-8deg); opacity: 1; }
  100% { transform: scale(.35) rotate(24deg) translateY(18px); opacity: 0; }
}
@keyframes spawnPop {
  0% { transform: scale(.1); opacity: 0; }
  65% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.actor-hp {
  position: absolute;
  left: 50%;
  top: -13px;
  width: 58px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: rgba(38, 27, 21, .82);
  border: 2px solid rgba(255, 250, 235, .92);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .32), inset 0 1px 2px rgba(0, 0, 0, .4);
  overflow: hidden;
  transition: opacity .2s;
}
.actor-hp i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(180deg, #A6F36C, #62C62C 55%, #3A9A16);
  transition: width .16s ease-out;
}
.actor-hp.player { display: none; }
.actor-hp.low i { background: linear-gradient(180deg, #FF9B7A, #F0442A 58%, #B71E0B); }
.actor-hp.player::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .4), transparent 55%);
  pointer-events: none;
}
.actor-hp .hp-badge {
  position: absolute;
  top: 50%;
  left: -9px;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  border-radius: 50%;
  background: #2E2115;
  border: 2px solid #FFF0D0;
  color: #FFD37E;
  font-size: 9px;
  line-height: 13px;
  text-align: center;
  font-weight: 900;
  z-index: 2;
}
.actor .alert {
  position: absolute;
  left: 50%;
  top: -44px;
  width: 25px;
  height: 25px;
  transform: translateX(-50%) scale(0);
  border-radius: 50%;
  background: linear-gradient(180deg, #FF6B57, #D7301E);
  border: 2px solid #FFE9D6;
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  line-height: 21px;
  text-align: center;
  box-shadow: 0 3px 8px rgba(120, 20, 0, .45);
  opacity: 0;
  transition: transform .12s ease-out, opacity .12s;
  z-index: 3;
}
.actor.is-windup .alert { transform: translateX(-50%) scale(1); opacity: 1; animation: alertPulse .34s ease-in-out infinite alternate; }
@keyframes alertPulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.16); } }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease .12s;
}
.app.in-game .hud { opacity: 1; }
.hud button, .hud .joystick { pointer-events: auto; }
.hud-top {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--safe-top) + 12px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 15px;
  gap: 10px;
}
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 14px 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(31, 54, 67, .88), rgba(12, 25, 33, .82));
  border: 2px solid var(--hud-line);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  color: #FFF9EC;
  font-variant-numeric: tabular-nums;
}
.kills-pill { min-width: 100px; }
.pill-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFF9EE, #FFE2BC);
  color: #E87522;
  box-shadow: inset 0 -2px 3px rgba(180, 90, 10, .3), 0 1px 3px rgba(0, 0, 0, .3);
  flex: 0 0 auto;
}
.pill-icon .mp-icon { width: 19px; height: 19px; }
.kills-pill b { font-size: 20px; font-weight: 900; letter-spacing: -.02em; }
.kills-pill .kill-total { font-size: 13px; font-weight: 800; opacity: .68; margin-left: -2px; }
.kills-pill.pop b { animation: scorePop .28s ease-out; display: inline-block; }
@keyframes scorePop { 0% { transform: scale(1); } 40% { transform: scale(1.4); color: #FFD36E; } 100% { transform: scale(1); } }
.hud-right { display: flex; align-items: center; gap: 8px; }
.timer-pill { padding: 0 13px 0 11px; gap: 6px; min-width: 92px; justify-content: center; }
.timer-pill .mp-icon { width: 19px; height: 19px; color: #FFD98F; }
.timer-pill b { font-size: 17px; font-weight: 900; letter-spacing: .01em; }
.timer-pill.low { animation: timerLow .8s ease-in-out infinite alternate; border-color: rgba(255, 133, 90, .9); }
.timer-pill.low b { color: #FF8B6C; }
@keyframes timerLow { from { box-shadow: 0 5px 14px rgba(0, 0, 0, .3); } to { box-shadow: 0 0 18px rgba(255, 82, 42, .7); } }
.round-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(31, 54, 67, .88), rgba(12, 25, 33, .82));
  border: 2px solid var(--hud-line);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  color: #FFF6E6;
  transition: transform .1s;
}
.round-btn:active { transform: scale(.9); }
.round-btn .mp-icon { width: 21px; height: 21px; }
.pause-btn .ic-play { display: none; }
.pause-btn.is-play .ic-pause { display: none; }
.pause-btn.is-play .ic-play { display: inline-block; }

.player-health {
  position: absolute;
  left: 15px;
  top: calc(var(--safe-top) + 62px);
  width: 126px;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(31, 54, 67, .82), rgba(12, 25, 33, .76));
  border: 1.5px solid rgba(255, 255, 255, .24);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .16);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ph-heart { display: grid; place-items: center; width: 15px; height: 15px; color: #FF8F7C; flex: 0 0 auto; }
.ph-heart .mp-icon { width: 15px; height: 15px; filter: drop-shadow(0 1px 1px rgba(100, 10, 0, .4)); }
.ph-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: rgba(8, 15, 12, .6);
  border: 1px solid rgba(255, 255, 255, .18);
  overflow: hidden;
}
.ph-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(180deg, #B4F77A, #6BCB32 58%, #3E9B18);
  transition: width .18s ease-out;
}
.player-health.low .ph-track i { background: linear-gradient(180deg, #FF9B7A, #F0442A 58%, #B71E0B); }
.player-health.low { animation: hpLow .7s ease-in-out infinite alternate; }
@keyframes hpLow { from { box-shadow: 0 4px 10px rgba(0, 0, 0, .24); } to { box-shadow: 0 0 14px rgba(255, 70, 40, .6); } }

.hint.show { opacity: 1; }

/* ---------- 摇杆 ---------- */
.controls { position: absolute; inset: 0; pointer-events: none; }
.joystick {
  position: absolute;
  left: 16px;
  bottom: calc(var(--safe-bottom) + 22px);
  width: 136px;
  height: 136px;
  border-radius: 50%;
  touch-action: none;
  pointer-events: auto;
  z-index: 2;
}
.joy-base {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .16), rgba(18, 42, 22, .26) 72%),
    radial-gradient(circle at 50% 50%, rgba(9, 22, 12, .16), rgba(9, 22, 12, .3));
  border: 2.5px solid rgba(255, 255, 255, .48);
  box-shadow: inset 0 3px 10px rgba(255, 255, 255, .15), inset 0 -6px 14px rgba(0, 0, 0, .2), 0 6px 18px rgba(0, 0, 0, .2);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}
.joystick.active .joy-base { border-color: rgba(255, 214, 140, .95); box-shadow: 0 0 0 5px rgba(255, 160, 70, .16), inset 0 3px 10px rgba(255, 255, 255, .2); }
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 28%, #FFFFFF, #FFF3D9 48%, #F2D6A8 100%);
  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 5px 12px rgba(0, 0, 0, .3), inset 0 -4px 7px rgba(190, 120, 45, .28);
  color: #E77C25;
  transform: translate(var(--jx, 0px), var(--jy, 0px));
  transition: transform .06s linear;
}
.joystick.active .joy-knob { transition: none; }
.joy-knob .mp-icon { width: 27px; height: 27px; }
.joy-arrow {
  position: absolute;
  width: 11px;
  height: 11px;
  border-top: 2.5px solid rgba(255, 255, 255, .55);
  border-left: 2.5px solid rgba(255, 255, 255, .55);
  border-radius: 2px;
  pointer-events: none;
}
.joy-up { left: 50%; top: 11px; transform: translateX(-50%) rotate(45deg); }
.joy-down { left: 50%; bottom: 11px; transform: translateX(-50%) rotate(225deg); }
.joy-left { left: 11px; top: 50%; transform: translateY(-50%) rotate(-45deg); }
.joy-right { right: 11px; top: 50%; transform: translateY(-50%) rotate(135deg); }

/* ---------- 动作按钮 ---------- */
.actions {
  position: absolute;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 20px);
  width: 166px;
  height: 158px;
  pointer-events: none;
}
.action-btn {
  position: absolute;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: none;
  overflow: hidden;
  transition: transform .08s ease-out, filter .08s;
  -webkit-user-select: none;
  user-select: none;
}
.action-btn:active, .action-btn.pressed { transform: scale(.9); filter: brightness(1.08); }
.action-btn .mp-icon { position: relative; z-index: 2; color: #FFFDF6; }
.btn-shine {
  position: absolute;
  z-index: 1;
  inset: 4px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0) 46%);
  pointer-events: none;
}
.attack-btn {
  right: 0;
  bottom: 0;
  width: 92px;
  height: 92px;
  background: radial-gradient(circle at 36% 26%, #FFCB82 0%, #FFA44E 32%, #FF822F 60%, #E65D0C 100%);
  border: 3px solid #FFE6C4;
  box-shadow:
    0 0 0 6px rgba(255, 138, 61, .24),
    0 0 26px rgba(255, 140, 50, .45),
    0 9px 0 #B94A09,
    0 15px 22px rgba(40, 14, 2, .38),
    inset 0 4px 9px rgba(255, 255, 255, .5);
}
.attack-btn .mp-icon { width: 42px; height: 42px; filter: drop-shadow(0 3px 2px rgba(130, 50, 0, .35)); }
.attack-btn.ready { animation: attackReady 2.4s ease-in-out infinite; }
@keyframes attackReady {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255, 138, 61, .24), 0 0 22px rgba(255, 140, 50, .38), 0 9px 0 #B94A09, 0 15px 22px rgba(40, 14, 2, .38), inset 0 4px 9px rgba(255, 255, 255, .5); }
  50% { box-shadow: 0 0 0 9px rgba(255, 160, 80, .14), 0 0 34px rgba(255, 150, 60, .6), 0 9px 0 #B94A09, 0 15px 22px rgba(40, 14, 2, .38), inset 0 4px 9px rgba(255, 255, 255, .5); }
}
.dash-btn {
  right: 100px;
  bottom: 4px;
  width: 64px;
  height: 64px;
  background: radial-gradient(circle at 36% 26%, #B9D97A 0%, #7FAE45 40%, #4A7F2C 100%);
  border: 3px solid #E6F3C2;
  box-shadow: 0 0 0 4px rgba(90, 150, 55, .2), 0 7px 0 #2F571C, 0 10px 18px rgba(20, 40, 8, .35), inset 0 3px 7px rgba(255, 255, 255, .38);
}
.dash-btn .mp-icon { width: 30px; height: 30px; filter: drop-shadow(0 2px 2px rgba(30, 60, 10, .35)); }
.cooldown {
  position: absolute;
  z-index: 3;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(8, 18, 9, .58) 0 var(--cd, 0%), transparent var(--cd, 0%) 100%);
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.action-btn.cooling .cooldown { opacity: 1; }
.action-btn.cooling { filter: saturate(.7); }

/* ---------- 浮动文字 / 特效 ---------- */
.fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fx-text { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.dmg {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 23px;
  font-weight: 900;
  color: #FFFCF0;
  letter-spacing: -.03em;
  text-shadow: 0 2px 0 #A23B08, 0 0 9px rgba(255, 120, 30, .8), 0 4px 10px rgba(0, 0, 0, .45);
  -webkit-text-stroke: 1px rgba(150, 48, 4, .45);
  white-space: nowrap;
  animation: dmgFloat .78s cubic-bezier(.2, .8, .3, 1) forwards;
  will-change: transform, opacity;
}
.dmg.crit { font-size: 30px; color: #FFE36E; text-shadow: 0 2px 0 #B84A00, 0 0 14px rgba(255, 180, 40, .95), 0 4px 12px rgba(0, 0, 0, .4); }
.dmg.kill { font-size: 18px; color: #FFD88E; letter-spacing: .06em; }
.dmg.heal { font-size: 18px; color: #A9F37D; text-shadow: 0 2px 0 #2E6E14; }
.dmg.hurt { color: #FF8E7A; text-shadow: 0 2px 0 #7E1B0A, 0 0 10px rgba(255, 70, 30, .8); }
@keyframes dmgFloat {
  0% { transform: translate(-50%, -40%) scale(.6); opacity: 0; }
  18% { transform: translate(-50%, -70%) scale(1.16); opacity: 1; }
  36% { transform: translate(-50%, -78%) scale(1); }
  100% { transform: translate(-50%, -168%) scale(.92); opacity: 0; }
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
}
.countdown.show { opacity: 1; }
.countdown span {
  display: block;
  color: #FFF7E3;
  font-size: clamp(94px, 27vw, 156px);
  font-weight: 900;
  letter-spacing: -.04em;
  text-shadow: 0 7px 0 #C05B10, 0 0 22px rgba(255, 174, 74, .55), 0 18px 40px rgba(0, 0, 0, .5);
  -webkit-text-stroke: 2px rgba(255, 255, 255, .32);
}
.countdown span.pop { animation: countPop .5s cubic-bezier(.16, 1.3, .36, 1); }
@keyframes countPop {
  0% { transform: scale(.35); opacity: 0; }
  45% { transform: scale(1.1); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.22); opacity: 0; }
}
.countdown span.go { font-size: clamp(64px, 18vw, 104px); color: #FFD48B; }

.toast {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + 70px);
  transform: translate(-50%, -8px);
  z-index: 17;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(28, 18, 8, .82);
  border: 1.5px solid rgba(255, 205, 130, .55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  color: #FFE8BC;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 首页 ---------- */
.splash {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #0D2016;
  cursor: pointer;
  transition: opacity .58s ease, transform .58s cubic-bezier(.3, .7, .3, 1);
}
.splash.gone { opacity: 0; transform: scale(1.045); pointer-events: none; }
.splash-bg {
  position: absolute;
  inset: -2.5%;
  background-image: url("images/gen/gptimg_1795383559_look.jpg");
  background-size: cover;
  background-position: 50% 48%;
  background-repeat: no-repeat;
  background-color: #3B8FC4;
  transform: scale(1.02);
  animation: kenburns 16s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.075) translate3d(-1.2%, -1%, 0); } }
.splash-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 19, 29, .18) 0%, rgba(5, 19, 29, 0) 22%, rgba(7, 22, 13, 0) 40%, rgba(6, 19, 11, .5) 62%, rgba(4, 14, 8, .94) 100%),
    radial-gradient(90% 48% at 50% 96%, rgba(255, 128, 42, .18) 0%, rgba(255, 128, 42, 0) 100%);
}
.splash-grain {
  position: absolute;
  inset: 0;
  opacity: .1;
  background-image: radial-gradient(rgba(255, 255, 255, .8) .6px, transparent .7px);
  background-size: 4px 4px;
  mix-blend-mode: overlay;
}
.splash-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px calc(var(--safe-bottom) + 24px);
  text-align: center;
}
.splash-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 222, 172, .84);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .34em;
  text-indent: .34em;
  margin-bottom: 9px;
}
.splash-kicker span { width: 24px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 206, 140, .8)); }
.splash-kicker span:last-child { background: linear-gradient(90deg, rgba(255, 206, 140, .8), transparent); }
.splash-title {
  margin: 0;
  font-size: clamp(40px, 11.6vw, 62px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: .055em;
  text-indent: .055em;
  color: #FFF8E8;
  background: linear-gradient(180deg, #FFFDF4 0%, #FFE8B4 42%, #FFB35D 76%, #F28A2C 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(157, 66, 8, .85)) drop-shadow(0 9px 18px rgba(0, 0, 0, .55)) drop-shadow(0 0 26px rgba(255, 152, 62, .28));
}
.splash-sub {
  margin: 10px 0 20px;
  color: rgba(255, 246, 225, .88);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.start-btn {
  position: relative;
  width: min(76vw, 286px);
  height: 60px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  background: linear-gradient(180deg, #FFC47B 0%, #FF9A48 42%, #FF822F 100%);
  border: 2.5px solid rgba(255, 242, 220, .95);
  box-shadow: 0 7px 0 #B64C0D, 0 15px 26px rgba(0, 0, 0, .46), inset 0 3px 8px rgba(255, 255, 255, .55);
  color: #4A2208;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .12em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .32);
  transition: transform .1s ease-out, box-shadow .1s;
}
.start-btn .mp-icon { width: 24px; height: 24px; color: #4A2208; }
.start-btn:active { transform: translateY(5px) scale(.985); box-shadow: 0 2px 0 #B64C0D, 0 6px 12px rgba(0, 0, 0, .4), inset 0 3px 8px rgba(255, 255, 255, .5); }
.start-btn::after {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, .55) 48%, transparent 58%);
  transform: translateX(-70%);
  animation: btnSweep 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnSweep { 0%, 55% { transform: translateX(-78%); } 82%, 100% { transform: translateX(78%); } }
.splash-tip {
  margin: 13px 0 0;
  color: rgba(255, 247, 230, .62);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  animation: tipPulse 2.2s ease-in-out infinite;
}
@keyframes tipPulse { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
.splash-corner {
  position: absolute;
  z-index: 2;
  right: 14px;
  top: calc(var(--safe-top) + 14px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(14, 29, 24, .55);
  border: 1px solid rgba(255, 255, 255, .2);
  color: rgba(255, 246, 228, .88);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.splash-corner .mp-icon { width: 15px; height: 15px; color: #FFD08A; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.overlay-mask {
  position: absolute;
  inset: 0;
  background: rgba(5, 15, 10, .62);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fadeIn .25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: min(88vw, 356px);
  border-radius: 28px;
  padding: 26px 20px 20px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, .9), transparent 38%),
    linear-gradient(180deg, #FFFCF2 0%, #FFF4DC 55%, #FFEAC8 100%);
  border: 3px solid #E8C28A;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .5), inset 0 2px 0 #fff, inset 0 -4px 0 rgba(197, 137, 63, .16);
  text-align: center;
  animation: modalIn .38s cubic-bezier(.18, 1.25, .35, 1);
}
.modal::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 21px;
  border: 1px dashed rgba(192, 143, 83, .32);
  pointer-events: none;
}
@keyframes modalIn { 0% { transform: translateY(24px) scale(.9); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
.modal-badge {
  position: relative;
  width: 70px;
  height: 70px;
  margin: -60px auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 36% 26%, #FFCB82, #FF9A47 48%, #EA6C14 100%);
  border: 4px solid #FFF8E9;
  box-shadow: 0 8px 0 #B8510C, 0 14px 22px rgba(0, 0, 0, .28), inset 0 3px 6px rgba(255, 255, 255, .5);
  color: #FFFDF6;
}
.modal-badge .mp-icon { width: 34px; height: 34px; filter: drop-shadow(0 2px 2px rgba(120, 50, 0, .35)); }
.modal-badge.badge-pause { background: radial-gradient(circle at 36% 26%, #BBD98B, #7FB153 48%, #4F7E2E 100%); box-shadow: 0 8px 0 #35591F, 0 14px 22px rgba(0, 0, 0, .28), inset 0 3px 6px rgba(255, 255, 255, .5); }
.modal-badge.badge-lose { background: radial-gradient(circle at 36% 26%, #C9B9A5, #8E7A63 48%, #6A5743 100%); box-shadow: 0 8px 0 #4B3A2A, 0 14px 22px rgba(0, 0, 0, .28), inset 0 3px 6px rgba(255, 255, 255, .4); }
.modal-title {
  margin: 0 0 5px;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: .04em;
  color: #3B2A18;
  text-shadow: 0 1px 0 #fff;
}
.modal-desc {
  margin: 0 0 17px;
  font-size: 12.5px;
  font-weight: 600;
  color: #967C5B;
  letter-spacing: .02em;
}
.result-stats {
  display: flex;
  align-items: stretch;
  margin: 0 0 18px;
  padding: 11px 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .55);
  border: 1.5px solid rgba(208, 162, 101, .35);
}
.stat { flex: 1; display: flex; flex-direction: column; gap: 2px; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px; background: rgba(198, 152, 91, .3); }
.stat-label { font-size: 10.5px; font-weight: 700; color: #A78A65; letter-spacing: .08em; }
.stat b { font-size: 17px; font-weight: 900; color: #4A331B; font-variant-numeric: tabular-nums; }
.stat b i { font-style: normal; font-size: 11px; color: #A98B62; }
.modal-actions { display: flex; flex-direction: column; gap: 9px; }
.btn-primary, .btn-ghost {
  position: relative;
  height: 51px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .06em;
  transition: transform .09s, box-shadow .09s;
}
.btn-primary {
  background: linear-gradient(180deg, #FFBE72 0%, #FF9743 45%, #F77B24 100%);
  border: 2px solid rgba(255, 243, 222, .95);
  color: #4A2208;
  box-shadow: 0 5px 0 #B64C0D, 0 10px 17px rgba(120, 55, 8, .25), inset 0 2px 6px rgba(255, 255, 255, .5);
}
.btn-ghost {
  background: rgba(255, 255, 255, .5);
  border: 1.5px solid rgba(198, 151, 92, .5);
  color: #7A5A35;
  box-shadow: inset 0 1px 0 #fff;
}
.btn-primary:active, .btn-ghost:active { transform: translateY(3px) scale(.99); }
.btn-primary:active { box-shadow: 0 1px 0 #B64C0D, inset 0 2px 6px rgba(255, 255, 255, .45); }
.btn-primary .mp-icon, .btn-ghost .mp-icon { width: 20px; height: 20px; }

/* ---------- 响应式 ---------- */
@media (max-width: 370px) {
  .hud-pill { height: 38px; }
  .kills-pill b { font-size: 18px; }
  .timer-pill b { font-size: 15.5px; }
  .round-btn { width: 38px; height: 38px; }
  .joystick { width: 120px; height: 120px; left: 12px; }
  .joy-knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .actions { right: 12px; width: 152px; height: 146px; }
  .attack-btn { width: 84px; height: 84px; }
  .attack-btn .mp-icon { width: 38px; height: 38px; }
  .dash-btn { width: 58px; height: 58px; right: 92px; }
  .actor-hp { width: 52px; }
  .actor-hp.player { width: 84px; }
}
@media (max-height: 640px) {
  .hud-top { top: calc(var(--safe-top) + 8px); }
  .joystick { width: 112px; height: 112px; bottom: calc(var(--safe-bottom) + 14px); }
  .joy-knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .actions { height: 132px; bottom: calc(var(--safe-bottom) + 12px); }
  .attack-btn { width: 78px; height: 78px; }
  .attack-btn .mp-icon { width: 35px; height: 35px; }
  .dash-btn { width: 56px; height: 56px; right: 84px; }
  .splash-sub { margin: 7px 0 14px; }
  .start-btn { height: 54px; }
}
@media (min-aspect-ratio: 4/3) and (min-width: 720px) {
  .scene-svg { filter: saturate(1.06) brightness(1.02); }
  .hud-top { padding: 0 26px; top: calc(var(--safe-top) + 18px); }
  .joystick { left: 30px; bottom: calc(var(--safe-bottom) + 30px); width: 150px; height: 150px; }
  .joy-knob { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .actions { right: 30px; bottom: calc(var(--safe-bottom) + 28px); }
  .attack-btn { width: 102px; height: 102px; }
  .attack-btn .mp-icon { width: 46px; height: 46px; }
  .dash-btn { width: 70px; height: 70px; right: 112px; }
  .splash-bottom { padding-bottom: calc(var(--safe-bottom) + 38px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .splash-bg { animation: none; transform: scale(1.03); }
}


/* 桌面预览：把竖屏游戏放进居中机位，避免横屏把场景裁坏 */
@media (min-width: 900px) and (min-height: 560px) and (min-aspect-ratio: 1/1) {
  body { background: radial-gradient(120% 100% at 50% 20%, #173322 0%, #08120C 70%); }
  .app {
    left: 50%;
    right: auto;
    width: min(100vw, 500px);
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 0 90px rgba(0, 0, 0, .7);
  }
}
