/* ===================================
   CỔ TIÊN KỶ ONLINE - Animations
   HD Xianxia Watercolor Remaster
   =================================== */

/* ───────── Title & Branding ───────── */
@keyframes titlePulse {
    0%, 100% { filter: brightness(1) drop-shadow(0 2px 8px rgba(246, 201, 78, 0.3)); }
    50% { filter: brightness(1.25) drop-shadow(0 4px 16px rgba(246, 201, 78, 0.5)); }
}

@keyframes borderGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(246, 201, 78, 0.15);
        border-color: rgba(246, 201, 78, 0.25);
    }
    50% {
        box-shadow: 0 0 20px rgba(246, 201, 78, 0.3), 0 0 40px rgba(246, 201, 78, 0.08);
        border-color: rgba(246, 201, 78, 0.45);
    }
}

/* ───────── Panel / Modal ───────── */
@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(0);
    }
}

@keyframes overlayFadeIn {
    from { opacity: 0; backdrop-filter: blur(0); }
    to { opacity: 1; backdrop-filter: blur(4px); }
}

/* ───────── Dialog ───────── */
@keyframes dialogSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(24px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        filter: blur(0);
    }
}

/* ───────── Notifications ───────── */
@keyframes notifySlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notifySlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notifyFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* ───────── Damage Text ───────── */
@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.6);
    }
    15% {
        opacity: 1;
        transform: translateY(-12px) scale(1.3);
    }
    40% {
        transform: translateY(-28px) scale(1.0);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.85);
    }
}

@keyframes critFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(-5deg);
    }
    10% {
        opacity: 1;
        transform: translateY(-8px) scale(1.6) rotate(2deg);
    }
    25% {
        transform: translateY(-18px) scale(1.1) rotate(-1deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-70px) scale(0.8) rotate(0deg);
    }
}

/* ───────── Tooltip ───────── */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ───────── Screen Effects ───────── */
@keyframes screenShake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-4px, 3px); }
    20% { transform: translate(4px, -3px); }
    30% { transform: translate(-3px, 4px) rotate(-0.3deg); }
    40% { transform: translate(3px, -2px) rotate(0.3deg); }
    50% { transform: translate(-2px, 3px); }
    60% { transform: translate(2px, -1px); }
    70% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, 0); }
    90% { transform: translate(0, 1px); }
}

@keyframes screenFlash {
    0% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* ───────── Level Up ───────── */
@keyframes levelUpGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(246, 201, 78, 0.7);
        filter: brightness(1);
    }
    30% {
        box-shadow: 0 0 50px 25px rgba(246, 201, 78, 0.35);
        filter: brightness(1.4);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(246, 201, 78, 0);
        filter: brightness(1);
    }
}

@keyframes levelUpPillar {
    0% {
        transform: scaleY(0);
        opacity: 1;
    }
    30% {
        transform: scaleY(1);
        opacity: 1;
    }
    100% {
        transform: scaleY(1.2);
        opacity: 0;
    }
}

/* ───────── Core Animations ───────── */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ───────── Slide Animations ───────── */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ───────── Loading Screen ───────── */
@keyframes particleFloat {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    8% { opacity: 0.8; }
    85% { opacity: 0.8; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* ───────── Beast Capture ───────── */
@keyframes beastCapture {
    0% { transform: scale(1); opacity: 1; filter: brightness(1); }
    20% { transform: scale(1.25); filter: brightness(1.5); }
    50% { transform: scale(0.7); opacity: 0.7; filter: brightness(1.2); }
    75% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; filter: brightness(3); }
}

/* ───────── Cultivation Breakthrough ───────── */
@keyframes breakthrough {
    0% {
        opacity: 0;
        transform: scale(0.3);
        filter: brightness(0.5);
    }
    20% {
        opacity: 1;
        transform: scale(1.4);
        filter: brightness(2);
    }
    50% {
        transform: scale(0.9);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* ───────── Menu Button Entrance ───────── */
@keyframes menuBtnEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ───────── Xianxia Specific ───────── */

/* Lotus petal floating */
@keyframes lotusFloat {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 0;
    }
    15% { opacity: 0.8; }
    50% {
        transform: translateY(-40px) rotate(180deg) translateX(20px);
        opacity: 0.6;
    }
    85% { opacity: 0.3; }
    100% {
        transform: translateY(-80px) rotate(360deg) translateX(-10px);
        opacity: 0;
    }
}

/* Rune circle rotation */
@keyframes runeGlow {
    0%, 100% {
        opacity: 0.3;
        transform: rotate(0deg);
        filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.3));
    }
    50% {
        opacity: 0.6;
        filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.5));
    }
}

/* Qi flow / energy circulation */
@keyframes qiFlow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Ink wash spread */
@keyframes inkWash {
    0% {
        clip-path: circle(0% at 50% 50%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        clip-path: circle(100% at 50% 50%);
        opacity: 0.8;
    }
}

/* Aura breathing pulse */
@keyframes auraPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(167, 139, 250, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 24px rgba(167, 139, 250, 0.4), 0 0 48px rgba(167, 139, 250, 0.1);
        transform: scale(1.02);
    }
}

/* Star twinkle */
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Prompt animation */
@keyframes promptPulse {
    0% {
        box-shadow: 0 0 5px rgba(246, 201, 78, 0.15);
        transform: translate(-50%, 0);
    }
    100% {
        box-shadow: 0 0 18px rgba(246, 201, 78, 0.35);
        transform: translate(-50%, -3px);
    }
}

/* Button glow pulse */
@keyframes btnPulseGlow {
    0% {
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.3);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.8), inset 0 0 16px rgba(255, 255, 255, 0.6);
        transform: scale(1.06);
    }
}

/* Interact button pulse */
@keyframes interactBtnPulse {
    0% { transform: scale(1.0); box-shadow: 0 0 5px rgba(16, 185, 129, 0.3); }
    100% { transform: scale(1.06); box-shadow: 0 0 18px rgba(16, 185, 129, 0.6); }
}

/* ───────── Utility Classes ───────── */
.anim-pulse { animation: pulse 2.5s ease-in-out infinite; }
.anim-float { animation: float 3.5s ease-in-out infinite; }
.anim-spin { animation: spin 1s linear infinite; }
.anim-spin-slow { animation: spinSlow 8s linear infinite; }
.anim-fade-in { animation: fadeIn 0.3s ease-out; }
.anim-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.anim-shake { animation: screenShake 0.5s ease-out; }
.anim-level-up { animation: levelUpGlow 1.5s ease-out; }
.anim-twinkle { animation: twinkle 2s ease-in-out infinite; }
.anim-qi-flow { animation: qiFlow 3s linear infinite; }

/* ───────── Notification Area ───────── */
/* Vị trí thật được quản lý ở main.css (.notification-area: top-center).
   Rule cũ dùng #id đã gây xung đột (bottom-left + transform) làm toast
   bị đẩy tràn ra mép màn hình nên đã được loại bỏ. */
