/* ==========================================================================
   Hero Up (勇者爬塔) - 动画与打击粒子反馈系统 (animations.css)
   ========================================================================== */

/* 1. 可行击破房间呼吸光晕 */
@keyframes pulseValidRoom {
    0% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.4), inset 0 0 6px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.75), inset 0 0 12px rgba(16, 185, 129, 0.45);
    }
    100% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.4), inset 0 0 6px rgba(16, 185, 129, 0.2);
    }
}

/* 2. 预测战力气泡弹跳 */
@keyframes bouncePreview {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-4px);
    }
}

/* 3. 勇者弧线跳跃斩击 */
@keyframes heroLeap {
    0% {
        transform: translate(0, 0) scale(1);
    }
    40% {
        transform: translate(var(--leap-x, 0), calc(var(--leap-y, 0) - 30px)) scale(1.15);
    }
    100% {
        transform: translate(var(--leap-x, 0), var(--leap-y, 0)) scale(1);
    }
}

.anim-hero-leap {
    animation: heroLeap 0.35s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    z-index: 100 !important;
}

.anim-hero-leap-fast {
    animation: heroLeap 0.18s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    z-index: 100 !important;
}

/* 4. 斩击光刃撕裂动效 (Slash FX) */
.slash-fx {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, #ffffff 30%, #60a5fa 70%, transparent 100%);
    box-shadow: 0 0 14px #60a5fa, 0 0 24px #ffffff;
    transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
    transform-origin: center;
    pointer-events: none;
    z-index: 80;
    animation: slashBeam 0.25s cubic-bezier(0.1, 1, 0.1, 1) forwards;
}

@keyframes slashBeam {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(1.3);
        opacity: 0;
    }
}

/* 5. 敌人被击溃碎裂飞散 */
.anim-shatter {
    animation: enemyShatter 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.anim-shatter-fast {
    animation: enemyShatter 0.16s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes enemyShatter {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(2) contrast(1.5);
    }
    50% {
        transform: scale(1.3) rotate(15deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.1) rotate(45deg);
        opacity: 0;
    }
}

/* 6. 战力数值弹簧暴增反馈 */
.anim-power-bounce {
    animation: powerBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes powerBounce {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.35);
        color: #fbbf24;
    }
    100% {
        transform: scale(1);
    }
}

/* 7. 屏幕打击震颤 (Screen Shake) */
.shake-screen {
    animation: screenShake 0.28s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, -2px, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 3px, 0); }
    40%, 60% { transform: translate3d(3px, -1px, 0); }
}

/* 8. 战力浮字上浮消隐 (Floating Power Text) */
.floating-text {
    position: absolute;
    font-size: 1.15rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 90;
    animation: floatUpFade 0.75s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.floating-text.gain {
    color: #34d399;
}

.floating-text.loss {
    color: #f87171;
}

.floating-text.mult {
    color: #c084fc;
}

@keyframes floatUpFade {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.7);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -15px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -45px) scale(1);
    }
}

/* 9. 时光倒流撤回全屏滤镜 (Time Rewind Flash) */
.rewind-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
    pointer-events: none;
    z-index: 120;
    animation: rewindFlashAnim 0.35s ease-out forwards;
}

@keyframes rewindFlashAnim {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* 10. 胜利通关礼花纸屑 (Confetti) */
.confetti-particle {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 95;
    animation: confettiFall var(--fall-duration, 1.8s) ease-in forwards;
}

@keyframes confettiFall {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--drift-x, 40px), var(--fall-y, 300px)) rotate(720deg);
        opacity: 0;
    }
}

/* 11. 连击 Combo 浮空酷炫动效 */
.floating-combo {
    position: fixed;
    transform: translate(-50%, 0);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #fef08a;
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.9), 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 110;
    animation: comboPopUp 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes comboPopUp {
    0% {
        opacity: 0;
        transform: translate(-50%, 10px) scale(0.6);
    }
    25% {
        opacity: 1;
        transform: translate(-50%, -10px) scale(1.35);
    }
    75% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -35px) scale(0.9);
    }
}

/* 12. 提示战术高亮光环脉冲 */
.hint-pulse-aura {
    animation: hintPulse 1s ease-in-out infinite !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.85), inset 0 0 12px rgba(245, 158, 11, 0.5) !important;
    z-index: 40 !important;
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 14px rgba(245, 158, 11, 0.6), inset 0 0 8px rgba(245, 158, 11, 0.35);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 28px rgba(245, 158, 11, 0.95), inset 0 0 16px rgba(245, 158, 11, 0.65);
        transform: scale(1.04);
    }
}

/* 13. 无厘头香蕉皮 360° 旋转滑倒 */
@keyframes bananaSpin {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    30% {
        transform: translate(0, -25px) rotate(180deg) scale(1.25);
    }
    70% {
        transform: translate(0, -10px) rotate(360deg) scale(1.1);
    }
    100% {
        transform: translate(0, 0) rotate(360deg) scale(1);
    }
}

.anim-banana-spin {
    animation: bananaSpin 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
}

/* 14. 拖鞋/咸鱼抽脸扇耳光爆裂光效 */
.comic-slap-fx {
    position: fixed;
    transform: translate(-50%, -50%) rotate(-12deg);
    font-size: 2.2rem;
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 0 16px rgba(239, 68, 68, 0.95), 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
    pointer-events: none;
    z-index: 120;
    animation: slapPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slapPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(20deg); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.4) rotate(-15deg); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(-10deg); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(0.8) rotate(-10deg); }
}

/* 15. 浮动搞怪对话气泡 */
.comic-quip-bubble {
    position: fixed;
    transform: translate(-50%, -100%);
    background: #ffffff;
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 12px;
    border: 2px solid #0f172a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 130;
    white-space: nowrap;
    animation: quipBubbleAnim 1.4s ease forwards;
}

.comic-quip-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #fff transparent;
    display: block;
    width: 0;
}

@keyframes quipBubbleAnim {
    0% { opacity: 0; transform: translate(-50%, -80%) scale(0.7); }
    15% { opacity: 1; transform: translate(-50%, -105%) scale(1.08); }
    30% { transform: translate(-50%, -100%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.85); }
}

/* 16. Boss 搞笑台词胶囊 (求饶白旗) */
.boss-quip-pill {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid #f59e0b;
    color: #fde047;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 30;
}

.boss-quip-pill.surrender {
    border-color: #ef4444;
    color: #fca5a5;
    background: rgba(69, 10, 10, 0.94);
    animation: surrenderShake 0.4s ease-in-out infinite alternate;
}

@keyframes surrenderShake {
    0% { transform: translateX(-53%) rotate(-3deg); }
    100% { transform: translateX(-47%) rotate(3deg); }
}

/* 17. 逆天金币喷泉暴雨 */
.coin-particle {
    position: fixed;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 115;
    animation: coinDrop var(--fall-duration, 1.2s) ease-in forwards;
}

@keyframes coinDrop {
    0% { transform: translate(0, 0) rotate(0deg) scale(0.6); opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translate(var(--drift-x, 20px), 85vh) rotate(540deg) scale(1.1); opacity: 0; }
}

/* 18. 尖叫鸡爆散小黄鸭 */
.duck-burst-particle {
    position: fixed;
    font-size: 1.6rem;
    pointer-events: none;
    z-index: 115;
    animation: duckBurst 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes duckBurst {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
    60% { transform: translate(calc(-50% + var(--vx, 40px)), calc(-50% + var(--vy, -60px))) scale(1.2); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--vx, 40px)), calc(-50% + var(--vy, -60px) + 30px)) scale(0.8); opacity: 0; }
}
