/* Tutorial Spotlight Pulse */
@keyframes spotlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 30px 8px rgba(250, 204, 21, 0.9), 0 0 60px 20px rgba(250, 204, 21, 0.4);
        border-color: #fde047;
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 45px 15px rgba(250, 204, 21, 1), 0 0 80px 30px rgba(250, 204, 21, 0.6);
        border-color: #fef08a;
    }
}

/* Celebration Animations */

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 1);
    }
}

@keyframes rune-glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(147, 51, 234, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(147, 51, 234, 1),
                     0 0 30px rgba(147, 51, 234, 0.8);
    }
}

/* Animation Classes */
.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 9999;
    animation: confetti-fall 3s linear forwards;
}

.sparkle-particle {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    animation: sparkle 0.6s ease-out forwards;
}

.active-spell {
    animation: pulse-glow 2s ease-in-out infinite;
}

.rune-text {
    animation: rune-glow 2s ease-in-out infinite;
}

/* ===== ENHANCED SPELL CASTING ANIMATIONS ===== */

/* Full-screen flash on cast */
.spell-cast-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9996;
    animation: spell-flash 0.8s ease-out forwards;
}

@keyframes spell-flash {
    0% { opacity: 0; }
    15% { opacity: 0.6; }
    100% { opacity: 0; }
}

.spell-cast-flash.arcane { background: radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.5), rgba(88, 28, 135, 0.2), transparent 70%); }
.spell-cast-flash.gold { background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.5), rgba(180, 83, 9, 0.2), transparent 70%); }
.spell-cast-flash.fire { background: radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.5), rgba(185, 28, 28, 0.2), transparent 70%); }
.spell-cast-flash.ice { background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.5), rgba(14, 116, 144, 0.2), transparent 70%); }
.spell-cast-flash.nature { background: radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.5), rgba(21, 128, 61, 0.2), transparent 70%); }

/* Enhanced magic circle - outer ring with rune marks */
.spell-circle-outer {
    position: fixed;
    width: 280px;
    height: 280px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: spell-circle-outer-spin 1.5s ease-out forwards;
}

.spell-circle-outer::before {
    content: '✦ ✧ ✦ ✧ ✦ ✧ ✦ ✧';
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    letter-spacing: 8px;
    border-radius: 50%;
    animation: spell-runes-counter-spin 1.5s ease-out forwards;
}

.spell-circle-outer.arcane { border: 3px solid rgba(147, 51, 234, 0.8); box-shadow: 0 0 30px rgba(147, 51, 234, 0.5), inset 0 0 30px rgba(147, 51, 234, 0.2); }
.spell-circle-outer.arcane::before { color: rgba(167, 139, 250, 0.9); }
.spell-circle-outer.gold { border: 3px solid rgba(251, 191, 36, 0.8); box-shadow: 0 0 30px rgba(251, 191, 36, 0.5), inset 0 0 30px rgba(251, 191, 36, 0.2); }
.spell-circle-outer.gold::before { color: rgba(253, 224, 71, 0.9); }
.spell-circle-outer.fire { border: 3px solid rgba(239, 68, 68, 0.8); box-shadow: 0 0 30px rgba(239, 68, 68, 0.5), inset 0 0 30px rgba(239, 68, 68, 0.2); }
.spell-circle-outer.fire::before { color: rgba(252, 165, 165, 0.9); }
.spell-circle-outer.ice { border: 3px solid rgba(56, 189, 248, 0.8); box-shadow: 0 0 30px rgba(56, 189, 248, 0.5), inset 0 0 30px rgba(56, 189, 248, 0.2); }
.spell-circle-outer.ice::before { color: rgba(125, 211, 252, 0.9); }
.spell-circle-outer.nature { border: 3px solid rgba(34, 197, 94, 0.8); box-shadow: 0 0 30px rgba(34, 197, 94, 0.5), inset 0 0 30px rgba(34, 197, 94, 0.2); }
.spell-circle-outer.nature::before { color: rgba(134, 239, 172, 0.9); }

@keyframes spell-circle-outer-spin {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.1) rotate(90deg); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1) rotate(200deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.8) rotate(360deg); opacity: 0; }
}

@keyframes spell-runes-counter-spin {
    0% { transform: rotate(0deg); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: rotate(-360deg); opacity: 0; }
}

/* Inner magic circle */
.spell-circle-inner {
    position: fixed;
    width: 160px;
    height: 160px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: spell-circle-inner-spin 1.5s ease-out forwards;
}

.spell-circle-inner.arcane { border: 2px dashed rgba(167, 139, 250, 0.7); box-shadow: 0 0 20px rgba(147, 51, 234, 0.4); }
.spell-circle-inner.gold { border: 2px dashed rgba(253, 224, 71, 0.7); box-shadow: 0 0 20px rgba(251, 191, 36, 0.4); }
.spell-circle-inner.fire { border: 2px dashed rgba(252, 165, 165, 0.7); box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }
.spell-circle-inner.ice { border: 2px dashed rgba(125, 211, 252, 0.7); box-shadow: 0 0 20px rgba(56, 189, 248, 0.4); }
.spell-circle-inner.nature { border: 2px dashed rgba(134, 239, 172, 0.7); box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }

@keyframes spell-circle-inner-spin {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.2) rotate(-60deg); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1) rotate(-180deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.5) rotate(-360deg); opacity: 0; }
}

/* Floating spell icon in center */
.spell-cast-icon {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    pointer-events: none;
    z-index: 9999;
    animation: spell-icon-float 1.5s ease-out forwards;
    filter: drop-shadow(0 0 15px currentColor);
}

@keyframes spell-icon-float {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 0; }
    20% { transform: translate(-50%, -50%) scale(1.5) rotate(10deg); opacity: 1; }
    40% { transform: translate(-50%, -50%) scale(1.2) rotate(0deg); opacity: 1; }
    70% { transform: translate(-50%, -60%) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -120%) scale(0.6) rotate(0deg); opacity: 0; }
}

/* Spell energy particles that orbit outward */
.spell-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: spell-particle-burst 1.2s ease-out forwards;
}

.spell-particle.arcane { background: #a78bfa; box-shadow: 0 0 8px #a78bfa, 0 0 15px rgba(167, 139, 250, 0.5); }
.spell-particle.gold { background: #fde047; box-shadow: 0 0 8px #fde047, 0 0 15px rgba(253, 224, 71, 0.5); }
.spell-particle.fire { background: #fca5a5; box-shadow: 0 0 8px #ef4444, 0 0 15px rgba(239, 68, 68, 0.5); }
.spell-particle.ice { background: #7dd3fc; box-shadow: 0 0 8px #38bdf8, 0 0 15px rgba(56, 189, 248, 0.5); }
.spell-particle.nature { background: #86efac; box-shadow: 0 0 8px #22c55e, 0 0 15px rgba(34, 197, 94, 0.5); }

@keyframes spell-particle-burst {
    0% {
        transform: translate(var(--start-x), var(--start-y)) scale(1);
        opacity: 1;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y)) scale(0);
        opacity: 0;
    }
}

/* Spell name text that fades up */
.spell-cast-name {
    position: fixed;
    left: 50%;
    top: 55%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.8rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    animation: spell-name-reveal 2s ease-out forwards;
    text-shadow: 0 0 20px currentColor, 0 2px 4px rgba(0, 0, 0, 0.8);
}

.spell-cast-name.arcane { color: #c4b5fd; }
.spell-cast-name.gold { color: #fde68a; }
.spell-cast-name.fire { color: #fca5a5; }
.spell-cast-name.ice { color: #bae6fd; }
.spell-cast-name.nature { color: #bbf7d0; }

@keyframes spell-name-reveal {
    0% { transform: translateX(-50%) translateY(0) scale(0.5); opacity: 0; letter-spacing: -5px; }
    20% { transform: translateX(-50%) translateY(0) scale(1.1); opacity: 1; letter-spacing: 2px; }
    40% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; letter-spacing: 1px; }
    80% { transform: translateX(-50%) translateY(-10px) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-30px) scale(0.9); opacity: 0; }
}

/* ===== ENHANCED BOSS DEFEAT ANIMATIONS ===== */

/* Screen shake */
.boss-defeat-shake {
    animation: boss-screen-shake 0.6s ease-out;
}

@keyframes boss-screen-shake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-8px, 4px); }
    20% { transform: translate(8px, -4px); }
    30% { transform: translate(-6px, -6px); }
    40% { transform: translate(6px, 6px); }
    50% { transform: translate(-4px, 2px); }
    60% { transform: translate(4px, -2px); }
    70% { transform: translate(-2px, 4px); }
    80% { transform: translate(2px, -2px); }
    90% { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}

/* Full-screen dramatic flash */
.boss-defeat-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9996;
    animation: boss-defeat-flash 1.5s ease-out forwards;
    background: radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0.5), rgba(127, 29, 29, 0.3), rgba(0, 0, 0, 0.4), transparent 80%);
}

@keyframes boss-defeat-flash {
    0% { opacity: 0; }
    8% { opacity: 1; }
    25% { opacity: 0.7; }
    50% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* Boss icon that shakes, cracks, and shatters */
.boss-defeat-icon {
    position: fixed;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    pointer-events: none;
    z-index: 10000;
    animation: boss-icon-shatter 2s ease-out forwards;
    filter: drop-shadow(0 0 30px rgba(220, 38, 38, 0.8));
}

@keyframes boss-icon-shatter {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    8% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    12% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    16% { transform: translate(-50%, -50%) scale(1) rotate(-5deg); }
    20% { transform: translate(-50%, -50%) scale(1) rotate(5deg); }
    24% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
    28% { transform: translate(-50%, -50%) scale(1) rotate(3deg); }
    32% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    40% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; filter: brightness(2); }
    50% { transform: translate(-50%, -50%) scale(1.6); opacity: 0.6; filter: brightness(3); }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; filter: brightness(4); }
}

/* "BOSS DEFEATED!" text */
.boss-defeat-text {
    position: fixed;
    left: 50%;
    top: 28%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 2rem;
    font-weight: bold;
    color: #fca5a5;
    text-transform: uppercase;
    letter-spacing: 6px;
    text-shadow: 0 0 30px rgba(220, 38, 38, 0.8), 0 0 60px rgba(220, 38, 38, 0.4), 0 3px 6px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    animation: boss-defeat-text-reveal 2.8s ease-out forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

@keyframes boss-defeat-text-reveal {
    0% { transform: translateX(-50%) scale(0.3); opacity: 0; letter-spacing: 0px; }
    15% { transform: translateX(-50%) scale(1.2); opacity: 1; letter-spacing: 10px; }
    25% { transform: translateX(-50%) scale(1); opacity: 1; letter-spacing: 6px; }
    75% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-15px) scale(0.95); opacity: 0; }
}

/* Boss name text */
.boss-defeat-name {
    position: fixed;
    left: 50%;
    top: 60%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.4rem;
    color: #fecaca;
    text-shadow: 0 0 15px rgba(220, 38, 38, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    animation: boss-name-fade 2.5s ease-out forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

@keyframes boss-name-fade {
    0% { transform: translateX(-50%) translateY(10px); opacity: 0; }
    15% { transform: translateX(-50%) translateY(0); opacity: 1; }
    75% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-10px); opacity: 0; }
}

/* Skull/sword burst particles */
.boss-defeat-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 1.6rem;
    animation: boss-particle-burst 1.6s ease-out forwards;
    filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.6));
}

@keyframes boss-particle-burst {
    0% {
        transform: translate(var(--bp-start-x, 0), var(--bp-start-y, 0)) scale(0) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translate(calc(var(--bp-end-x, 0) * 0.2), calc(var(--bp-end-y, 0) * 0.2)) scale(1.3) rotate(60deg);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--bp-end-x, 0), var(--bp-end-y, 0)) scale(0) rotate(180deg);
        opacity: 0;
    }
}

/* Victory expanding shockwave rings */
.boss-defeat-ring {
    position: fixed;
    left: 50%;
    top: 42%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(220, 38, 38, 0.7);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: boss-ring-expand 1.8s ease-out forwards;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4), inset 0 0 15px rgba(220, 38, 38, 0.2);
}

.boss-defeat-ring.ring-2 {
    animation-delay: 0.2s;
    opacity: 0;
    border-color: rgba(239, 68, 68, 0.5);
}

.boss-defeat-ring.ring-3 {
    animation-delay: 0.4s;
    opacity: 0;
    border-color: rgba(248, 113, 113, 0.3);
}

@keyframes boss-ring-expand {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(8); opacity: 0; }
}

/* Reward text items floating up */
.boss-reward-item {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    animation: boss-reward-pop 2s ease-out forwards;
    opacity: 0;
}

.boss-reward-item.xp { color: #a78bfa; text-shadow: 0 0 12px rgba(167, 139, 250, 0.6), 0 2px 4px rgba(0,0,0,0.8); }
.boss-reward-item.gold { color: #fde68a; text-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 2px 4px rgba(0,0,0,0.8); }
.boss-reward-item.spell { color: #93c5fd; text-shadow: 0 0 12px rgba(147, 197, 253, 0.6), 0 2px 4px rgba(0,0,0,0.8); }

@keyframes boss-reward-pop {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    20% { transform: translateX(-50%) scale(1.2); opacity: 1; }
    30% { transform: translateX(-50%) scale(1); opacity: 1; }
    75% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-25px) scale(0.9); opacity: 0; }
}

/* Ember particles floating upward */
.boss-ember {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: boss-ember-rise 2.5s ease-out forwards;
}

.boss-ember.red { background: #ef4444; box-shadow: 0 0 8px #ef4444, 0 0 16px rgba(239, 68, 68, 0.4); }
.boss-ember.orange { background: #f97316; box-shadow: 0 0 8px #f97316, 0 0 16px rgba(249, 115, 22, 0.4); }
.boss-ember.yellow { background: #eab308; box-shadow: 0 0 8px #eab308, 0 0 16px rgba(234, 179, 8, 0.4); }

@keyframes boss-ember-rise {
    0% {
        transform: translate(var(--ember-x, 0), 0) scale(1);
        opacity: 0;
    }
    10% { opacity: 1; }
    100% {
        transform: translate(calc(var(--ember-x, 0) + var(--ember-drift, 0)), var(--ember-y, -200px)) scale(0);
        opacity: 0;
    }
}

/* ===== BOSS COMBAT HIT ANIMATIONS ===== */

/* Card shake when boss takes damage */
.boss-hit-shake {
    animation: boss-hit-shake 0.4s ease-out;
}

@keyframes boss-hit-shake {
    0% { transform: translate(0, 0); }
    15% { transform: translate(-6px, 3px); }
    30% { transform: translate(6px, -3px); }
    45% { transform: translate(-4px, -2px); }
    60% { transform: translate(4px, 2px); }
    75% { transform: translate(-2px, 1px); }
    100% { transform: translate(0, 0); }
}

/* Floating damage number */
.boss-damage-float {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.8rem;
    font-weight: bold;
    color: #fca5a5;
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.8), 0 2px 4px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 100;
    animation: boss-damage-float-up 1.2s ease-out forwards;
}

.boss-damage-float.crit {
    font-size: 2.4rem;
    color: #fbbf24;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.8), 0 0 30px rgba(220, 38, 38, 0.5), 0 2px 6px rgba(0, 0, 0, 0.9);
}

@keyframes boss-damage-float-up {
    0% { transform: translateX(-50%) translateY(0) scale(0.5); opacity: 0; }
    15% { transform: translateX(-50%) translateY(-10px) scale(1.3); opacity: 1; }
    30% { transform: translateX(-50%) translateY(-20px) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-80px) scale(0.8); opacity: 0; }
}

/* Slash attack overlay */
.boss-slash-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.boss-slash-mark {
    position: absolute;
    top: -20%;
    left: 50%;
    width: 4px;
    height: 140%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 15%,
        rgba(255, 200, 100, 0.9) 40%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 200, 100, 0.9) 60%,
        rgba(255, 255, 255, 0.1) 85%,
        transparent 100%
    );
    transform-origin: center center;
    animation: boss-slash-swing 0.35s ease-out forwards;
    filter: blur(0.5px);
    box-shadow: 0 0 12px 4px rgba(255, 200, 100, 0.6), 0 0 30px 8px rgba(255, 150, 50, 0.3);
    border-radius: 2px;
}

.boss-slash-mark.crit {
    width: 6px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 100, 50, 0.2) 15%,
        rgba(255, 220, 50, 1) 40%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 220, 50, 1) 60%,
        rgba(255, 100, 50, 0.2) 85%,
        transparent 100%
    );
    box-shadow: 0 0 20px 8px rgba(255, 200, 50, 0.8), 0 0 50px 15px rgba(255, 100, 50, 0.4);
    animation: boss-slash-swing-crit 0.4s ease-out forwards;
}

/* Slash trail afterglow */
.boss-slash-trail {
    position: absolute;
    top: -20%;
    left: 50%;
    width: 20px;
    height: 140%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 200, 100, 0.05) 30%,
        rgba(255, 200, 100, 0.15) 50%,
        rgba(255, 200, 100, 0.05) 70%,
        transparent 100%
    );
    transform-origin: center center;
    animation: boss-slash-trail 0.5s ease-out forwards;
    filter: blur(4px);
}

/* Flash on hit */
.boss-slash-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    animation: boss-slash-flash 0.25s ease-out forwards;
    pointer-events: none;
}

@keyframes boss-slash-swing {
    0% { transform: translateX(-50%) rotate(55deg) scaleY(0); opacity: 0; }
    20% { transform: translateX(-50%) rotate(45deg) scaleY(0.6); opacity: 1; }
    50% { transform: translateX(-50%) rotate(35deg) scaleY(1); opacity: 1; }
    100% { transform: translateX(-50%) rotate(30deg) scaleY(1); opacity: 0; }
}

@keyframes boss-slash-swing-crit {
    0% { transform: translateX(-50%) rotate(55deg) scaleY(0); opacity: 0; }
    15% { transform: translateX(-50%) rotate(42deg) scaleY(0.7); opacity: 1; }
    40% { transform: translateX(-50%) rotate(30deg) scaleY(1.1); opacity: 1; }
    60% { transform: translateX(-50%) rotate(28deg) scaleY(1); opacity: 0.9; }
    100% { transform: translateX(-50%) rotate(25deg) scaleY(1); opacity: 0; }
}

@keyframes boss-slash-trail {
    0% { transform: translateX(-50%) rotate(55deg) scaleY(0); opacity: 0; }
    30% { transform: translateX(-50%) rotate(40deg) scaleY(0.8); opacity: 0.6; }
    60% { transform: translateX(-50%) rotate(32deg) scaleY(1); opacity: 0.3; }
    100% { transform: translateX(-50%) rotate(30deg) scaleY(1); opacity: 0; }
}

@keyframes boss-slash-flash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== ENHANCED LEVEL UP ANIMATIONS ===== */

/* Full-screen golden flash */
.levelup-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.5), rgba(245, 158, 11, 0.2), transparent 70%);
    pointer-events: none;
    z-index: 9996;
    animation: levelup-flash 1.2s ease-out forwards;
}

@keyframes levelup-flash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    40% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* Big level number */
.levelup-number {
    position: fixed;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    font-family: 'MedievalSharp', serif;
    font-size: 8rem;
    font-weight: bold;
    color: #fde68a;
    text-shadow: 0 0 40px rgba(251, 191, 36, 0.8), 0 0 80px rgba(251, 191, 36, 0.4), 0 4px 8px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10000;
    animation: levelup-number-pop 2.2s ease-out forwards;
}

@keyframes levelup-number-pop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    12% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
    20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -55%) scale(0.9); opacity: 0; }
}

/* "LEVEL UP!" text above the number */
.levelup-text {
    position: fixed;
    left: 50%;
    top: 32%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 8px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10000;
    animation: levelup-text-reveal 2.2s ease-out forwards;
}

@keyframes levelup-text-reveal {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; letter-spacing: 0px; }
    15% { transform: translateX(-50%) scale(1.1); opacity: 1; letter-spacing: 12px; }
    25% { transform: translateX(-50%) scale(1); opacity: 1; letter-spacing: 8px; }
    70% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-10px) scale(0.9); opacity: 0; }
}

/* Title text below the number */
.levelup-title {
    position: fixed;
    left: 50%;
    top: 58%;
    transform: translateX(-50%);
    font-family: 'MedievalSharp', serif;
    font-size: 1.6rem;
    color: #fef3c7;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    animation: levelup-title-fade 2.2s ease-out forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

@keyframes levelup-title-fade {
    0% { transform: translateX(-50%) translateY(10px); opacity: 0; }
    20% { transform: translateX(-50%) translateY(0); opacity: 1; }
    70% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(-10px); opacity: 0; }
}

/* Expanding golden ring burst */
.levelup-ring {
    position: fixed;
    left: 50%;
    top: 45%;
    width: 100px;
    height: 100px;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(251, 191, 36, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: levelup-ring-expand 1.5s ease-out forwards;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4), inset 0 0 20px rgba(251, 191, 36, 0.2);
}

.levelup-ring.ring-2 {
    animation-delay: 0.15s;
    opacity: 0;
    border-color: rgba(245, 158, 11, 0.6);
}

.levelup-ring.ring-3 {
    animation-delay: 0.3s;
    opacity: 0;
    border-color: rgba(217, 119, 6, 0.4);
}

@keyframes levelup-ring-expand {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(6); opacity: 0; }
}

/* Star particles */
.levelup-star {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 1.5rem;
    animation: levelup-star-burst 1.4s ease-out forwards;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8));
}

@keyframes levelup-star-burst {
    0% {
        transform: translate(var(--star-start-x, 0), var(--star-start-y, 0)) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translate(calc(var(--star-end-x, 0) * 0.3), calc(var(--star-end-y, 0) * 0.3)) scale(1.2) rotate(90deg);
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--star-end-x, 0), var(--star-end-y, 0)) scale(0) rotate(180deg);
        opacity: 0;
    }
}

/* Vertical light pillars */
.levelup-pillar {
    position: fixed;
    bottom: 0;
    width: 60px;
    height: 0;
    pointer-events: none;
    z-index: 9997;
    animation: levelup-pillar-rise 1.8s ease-out forwards;
    opacity: 0;
}

.levelup-pillar.left {
    left: 30%;
    background: linear-gradient(to top, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.1), transparent);
    animation-delay: 0.2s;
}

.levelup-pillar.right {
    right: 30%;
    background: linear-gradient(to top, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.1), transparent);
    animation-delay: 0.35s;
}

@keyframes levelup-pillar-rise {
    0% { height: 0; opacity: 0; }
    30% { height: 70vh; opacity: 0.8; }
    60% { height: 100vh; opacity: 0.5; }
    100% { height: 100vh; opacity: 0; }
}

/* Gold shimmer particles */
.levelup-shimmer {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24, 0 0 16px rgba(251, 191, 36, 0.5);
    pointer-events: none;
    z-index: 9998;
    animation: levelup-shimmer-float 2s ease-out forwards;
}

@keyframes levelup-shimmer-float {
    0% {
        transform: translate(var(--shimmer-x, 0), 0) scale(0);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translate(var(--shimmer-x, 0), 0) scale(1);
    }
    100% {
        transform: translate(var(--shimmer-x, 0), var(--shimmer-y, -100px)) scale(0);
        opacity: 0;
    }
}

/* ===== ENHANCED CHEST OPENING ANIMATIONS ===== */

/* Chest tier colors */
.chest-tier-bronze { --chest-color: 205, 133, 63; --chest-glow: #cd853f; }
.chest-tier-silver { --chest-color: 192, 192, 192; --chest-glow: #c0c0c0; }
.chest-tier-gold { --chest-color: 251, 191, 36; --chest-glow: #fbbf24; }
.chest-tier-royal { --chest-color: 147, 51, 234; --chest-glow: #9333ea; }

/* Full-screen chest flash */
.chest-open-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9996;
    animation: chest-flash 1s ease-out forwards;
}

.chest-open-flash.bronze { background: radial-gradient(circle at 50% 50%, rgba(205, 133, 63, 0.4), rgba(139, 90, 43, 0.15), transparent 70%); }
.chest-open-flash.silver { background: radial-gradient(circle at 50% 50%, rgba(192, 192, 192, 0.5), rgba(148, 163, 184, 0.2), transparent 70%); }
.chest-open-flash.gold { background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.5), rgba(180, 83, 9, 0.2), transparent 70%); }
.chest-open-flash.royal { background: radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.5), rgba(88, 28, 135, 0.2), transparent 70%); }

@keyframes chest-flash {
    0% { opacity: 0; }
    20% { opacity: 0.7; }
    100% { opacity: 0; }
}

/* Chest icon that shakes then bursts open */
.chest-open-icon {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    pointer-events: none;
    z-index: 9999;
    animation: chest-icon-sequence 1.8s ease-out forwards;
    filter: drop-shadow(0 0 20px var(--chest-glow, #fbbf24));
}

@keyframes chest-icon-sequence {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    10% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    15% { transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
    20% { transform: translate(-50%, -50%) scale(1) rotate(8deg); }
    25% { transform: translate(-50%, -50%) scale(1) rotate(-10deg); }
    30% { transform: translate(-50%, -50%) scale(1) rotate(10deg); }
    35% { transform: translate(-50%, -50%) scale(1) rotate(-12deg); }
    40% { transform: translate(-50%, -50%) scale(1) rotate(12deg); }
    45% { transform: translate(-50%, -50%) scale(1.3) rotate(0deg); }
    55% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Light beam shooting upward from chest */
.chest-light-beam {
    position: fixed;
    left: 50%;
    bottom: 50%;
    width: 80px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 9997;
    animation: light-beam-rise 1.5s ease-out forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.chest-light-beam.bronze { background: linear-gradient(to top, rgba(205, 133, 63, 0.6), rgba(205, 133, 63, 0.1), transparent); }
.chest-light-beam.silver { background: linear-gradient(to top, rgba(192, 192, 192, 0.7), rgba(192, 192, 192, 0.1), transparent); }
.chest-light-beam.gold { background: linear-gradient(to top, rgba(251, 191, 36, 0.7), rgba(251, 191, 36, 0.1), transparent); }
.chest-light-beam.royal { background: linear-gradient(to top, rgba(147, 51, 234, 0.7), rgba(167, 139, 250, 0.1), transparent); }

@keyframes light-beam-rise {
    0% { height: 0; opacity: 0; }
    20% { height: 40vh; opacity: 0.9; }
    60% { height: 60vh; opacity: 0.7; }
    100% { height: 80vh; opacity: 0; }
}

/* Chest aura glow ring */
.chest-aura {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    animation: chest-aura-pulse 1.5s ease-out forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.chest-aura.bronze { box-shadow: 0 0 40px rgba(205, 133, 63, 0.6), 0 0 80px rgba(205, 133, 63, 0.3), inset 0 0 40px rgba(205, 133, 63, 0.2); }
.chest-aura.silver { box-shadow: 0 0 40px rgba(192, 192, 192, 0.6), 0 0 80px rgba(192, 192, 192, 0.3), inset 0 0 40px rgba(192, 192, 192, 0.2); }
.chest-aura.gold { box-shadow: 0 0 50px rgba(251, 191, 36, 0.7), 0 0 100px rgba(251, 191, 36, 0.3), inset 0 0 50px rgba(251, 191, 36, 0.2); }
.chest-aura.royal { box-shadow: 0 0 60px rgba(147, 51, 234, 0.7), 0 0 120px rgba(147, 51, 234, 0.4), inset 0 0 60px rgba(147, 51, 234, 0.3); }

@keyframes chest-aura-pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Chest coin burst particles */
.chest-coin-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: coin-burst 1s ease-out forwards;
}

.chest-coin-particle.bronze { background: #cd853f; box-shadow: 0 0 6px #cd853f; }
.chest-coin-particle.silver { background: #c0c0c0; box-shadow: 0 0 6px #c0c0c0; }
.chest-coin-particle.gold { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }
.chest-coin-particle.royal { background: #a78bfa; box-shadow: 0 0 6px #a78bfa; }

@keyframes coin-burst {
    0% {
        transform: translate(var(--coin-start-x, 0), var(--coin-start-y, 0)) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--coin-end-x, 0), var(--coin-end-y, 0)) scale(0);
        opacity: 0;
    }
}

/* Loot panel animations */
@keyframes lootPanelIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes lootItemIn {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* ===== Onboarding Slides ===== */
.onboarding-slide {
    transition: opacity 0.5s ease-in-out;
}

.onboarding-dot {
    transition: background-color 0.3s ease;
    cursor: pointer;
}

/* ===== Loading Overlay ===== */
#loading-overlay {
    animation: fadeIn 0.3s ease;
}

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

/* Pulse animation for loading text */
#loading-text {
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ===== Empty State Animations ===== */
.empty-state-icon {
    animation: float 3s ease-in-out infinite;
}

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

/* ===== Toast Notification Animations ===== */
.animate-slide-down {
    animation: slideDown 0.3s ease-out forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ===== XP Bar Fill Animation ===== */
#xp-progress {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#xp-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
}

#xp-progress.xp-gaining::after {
    animation: xp-shimmer 0.8s ease-out forwards;
}

#xp-progress.xp-gaining {
    animation: xp-glow 0.8s ease-out;
}

@keyframes xp-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes xp-glow {
    0% { 
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.5);
        filter: brightness(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(168, 85, 247, 1), 0 0 30px rgba(147, 51, 234, 0.8);
        filter: brightness(1.3);
    }
    100% { 
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.5);
        filter: brightness(1);
    }
}

/* XP Gain floating text */
.xp-gain-float {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.5rem;
    color: #a855f7;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: xp-float-up 1.5s ease-out forwards;
}

@keyframes xp-float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* ===== Quest Complete Animation ===== */
.quest-complete-burst {
    position: relative;
}

.quest-complete-burst::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 2rem;
    color: #22c55e;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
    animation: checkmark-burst 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes checkmark-burst {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* Particle burst effect container */
.completion-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 99;
}

.completion-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: particle-burst 0.8s ease-out forwards;
}

@keyframes particle-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Task card completion flash */
.task-completing {
    animation: task-complete-flash 0.5s ease-out;
}

@keyframes task-complete-flash {
    0% {
        background-color: inherit;
        box-shadow: inherit;
    }
    30% {
        background-color: rgba(34, 197, 94, 0.3);
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.5), inset 0 0 20px rgba(34, 197, 94, 0.2);
    }
    100% {
        background-color: inherit;
        box-shadow: inherit;
    }
}

/* Checkbox custom animation */
input[type="checkbox"]:checked {
    animation: checkbox-pop 0.3s ease-out;
}

@keyframes checkbox-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Period Transition Slideshow Animations */
@keyframes fade-in {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes count-up {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slide-in-right {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.5s ease-out forwards;
}

.animate-bounce-slow {
    animation: bounce-slow 2s ease-in-out infinite;
}

.animate-count-up {
    animation: count-up 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slide-in-right 0.4s ease-out forwards;
}

/* ===== THEME BACKGROUND PARTICLES ===== */

/* Particle container */
#theme-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.theme-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}



/* Floating ember animation (Volcanic) */
@keyframes ember-rise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    30% {
        transform: translateY(-30vh) translateX(15px) scale(0.9);
    }
    60% {
        transform: translateY(-60vh) translateX(-10px) scale(0.6);
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) translateX(5px) scale(0.2);
        opacity: 0;
    }
}

@keyframes ember-flicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    25% { opacity: 0.7; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
    75% { opacity: 0.8; transform: scale(0.95); }
}

.particle-ember {
    width: 6px;
    height: 10px;
    background: linear-gradient(to top, #dc2626 0%, #ef4444 30%, #fbbf24 60%, #fef3c7 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: ember-rise linear forwards, ember-flicker 0.3s ease-in-out infinite;
    box-shadow: 
        0 0 8px #fbbf24,
        0 0 15px #ef4444,
        0 0 25px rgba(239, 68, 68, 0.6),
        0 -5px 10px rgba(254, 243, 199, 0.4);
}





/* Sand drift animation (Desert) */
@keyframes sand-drift {
    0% {
        transform: translateX(-20px) translateY(50vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    25% {
        transform: translateX(25vw) translateY(48vh) rotate(90deg);
    }
    50% {
        transform: translateX(50vw) translateY(52vh) rotate(180deg);
    }
    75% {
        transform: translateX(75vw) translateY(46vh) rotate(270deg);
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateX(100vw) translateY(50vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes sand-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.particle-sand {
    width: 3px;
    height: 3px;
    background: linear-gradient(135deg, #fef9c3 0%, #fde047 50%, #eab308 100%);
    border-radius: 50%;
    animation: sand-drift linear forwards, sand-shimmer 0.5s ease-in-out infinite;
    box-shadow: 0 0 4px #fde047, 0 0 8px rgba(234, 179, 8, 0.5);
}

/* Shadow smoke animation (Shadow Realm) */
@keyframes smoke-rise {
    0% {
        transform: translateY(0) translateX(0) scaleX(1) scaleY(1);
        opacity: 0;
        filter: blur(2px);
    }
    10% {
        opacity: 0.6;
    }
    30% {
        transform: translateY(-25vh) translateX(15px) scaleX(1.2) scaleY(1.3);
        filter: blur(4px);
    }
    50% {
        transform: translateY(-50vh) translateX(-10px) scaleX(1.5) scaleY(1.8);
        opacity: 0.5;
        filter: blur(6px);
    }
    70% {
        transform: translateY(-70vh) translateX(20px) scaleX(2) scaleY(2.2);
        filter: blur(8px);
    }
    100% {
        transform: translateY(-100vh) translateX(-5px) scaleX(2.5) scaleY(3);
        opacity: 0;
        filter: blur(12px);
    }
}

@keyframes smoke-curl {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.particle-shadow {
    width: 20px;
    height: 40px;
    background: linear-gradient(to top, 
        rgba(30, 30, 35, 0.9) 0%,
        rgba(50, 50, 60, 0.7) 30%,
        rgba(70, 70, 80, 0.5) 60%,
        rgba(100, 100, 110, 0.3) 80%,
        transparent 100%
    );
    border-radius: 50% 50% 30% 30% / 60% 60% 40% 40%;
    animation: smoke-rise 12s ease-out forwards, smoke-curl 2s ease-in-out infinite;
    filter: blur(3px);
}



/* GIF-based particle animation */
@keyframes gif-fall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    25% {
        transform: translateY(25vh) rotate(15deg) translateX(20px);
    }
    50% {
        transform: translateY(50vh) rotate(-10deg) translateX(-15px);
    }
    75% {
        transform: translateY(75vh) rotate(20deg) translateX(25px);
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) rotate(-5deg) translateX(-10px);
        opacity: 0;
    }
}

.particle-gif {
    animation: gif-fall linear forwards;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

/* Rising GIF animation (for mystic/magic themes) */
@keyframes gif-rise {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translateY(-15vh) scale(1) translateX(10px);
    }
    40% {
        transform: translateY(-40vh) scale(1.1) translateX(-15px);
    }
    65% {
        transform: translateY(-65vh) scale(0.9) translateX(20px);
    }
    85% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100vh) scale(0.7) translateX(-10px);
        opacity: 0;
    }
}

.particle-gif-rise {
    animation: gif-rise linear forwards !important;
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.8));
}

/* Theme Video Background - LOWEST layer */
#theme-video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 1;
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

#theme-video-bg.hidden {
    display: none !important;
}

#theme-video-bg.active {
    display: block !important;
}

/* GIF background layer - sits behind all content */
body.has-theme-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: var(--theme-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    z-index: -1;
    pointer-events: none;
}

/* When animated bg is active, make main content area transparent so GIF shows */
/* This selector is more specific than themes.css to override the !important */
body.has-theme-bg .flex-1.overflow-y-auto,
body.has-theme-bg .bg-stone-800 {
    background: transparent !important;
}

/* ===== FOREST THEME ANIMATED BG ===== */
body.has-theme-bg.theme-forest #main-sidebar {
    background: linear-gradient(to bottom, #064e3b, #022c22, #0f1510) !important;
}
body.has-theme-bg.theme-forest .quest-card {
    background: linear-gradient(to bottom right, #033026, #011812) !important;
}

/* ===== DESERT THEME ANIMATED BG ===== */
body.has-theme-bg.theme-desert #main-sidebar {
    background: linear-gradient(to bottom, #7c2d12, #431407, #1a0f0a) !important;
}
body.has-theme-bg.theme-desert .quest-card {
    background: linear-gradient(to bottom right, #3d1508, #1f0a03) !important;
}

/* ===== ICE THEME ANIMATED BG ===== */
body.has-theme-bg.theme-ice #main-sidebar {
    background: linear-gradient(to bottom, #0c4a6e, #082f49, #0a1929) !important;
}
body.has-theme-bg.theme-ice .quest-card {
    background: linear-gradient(to bottom right, #042d44, #041928) !important;
}

/* ===== VOLCANIC THEME ANIMATED BG ===== */
body.has-theme-bg.theme-volcanic #main-sidebar {
    background: linear-gradient(to bottom, #7f1d1d, #450a0a, #1a0505) !important;
}
body.has-theme-bg.theme-volcanic .quest-card {
    background: linear-gradient(to bottom right, #3d0b0b, #1f0505) !important;
}

/* ===== MYSTIC THEME ANIMATED BG ===== */
body.has-theme-bg.theme-mystic #main-sidebar {
    background: linear-gradient(to bottom, #5b21b6, #3b0764, #1a0533) !important;
}
body.has-theme-bg.theme-mystic .quest-card {
    background: linear-gradient(to bottom right, #2d1160, #1a0330) !important;
}

/* ===== GOLDEN THEME ANIMATED BG ===== */
body.has-theme-bg.theme-golden #main-sidebar {
    background: linear-gradient(to bottom, #854d0e, #422006, #1a0f03) !important;
}
body.has-theme-bg.theme-golden .quest-card {
    background: linear-gradient(to bottom right, #402804, #1f0f03) !important;
}

/* ===== SHADOW THEME ANIMATED BG ===== */
body.has-theme-bg.theme-shadow #main-sidebar {
    background: linear-gradient(to bottom, #1f2937, #111827, #030712) !important;
}
body.has-theme-bg.theme-shadow .quest-card {
    background: linear-gradient(to bottom right, #1f2937, #0f1623) !important;
}

/* Gold shimmer animation (Golden Empire) */
@keyframes gold-shimmer {
    0% {
        transform: translateY(-20px) scale(0.5) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translateY(20vh) scale(1) rotate(72deg);
    }
    40% {
        transform: translateY(40vh) scale(1.1) rotate(144deg);
    }
    60% {
        transform: translateY(60vh) scale(0.9) rotate(216deg);
    }
    80% {
        opacity: 0.9;
        transform: translateY(80vh) scale(1) rotate(288deg);
    }
    100% {
        transform: translateY(100vh) scale(0.7) rotate(360deg);
        opacity: 0;
    }
}

@keyframes gold-twinkle {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 5px #fde047); }
    25% { filter: brightness(1.5) drop-shadow(0 0 10px #fbbf24); }
    50% { filter: brightness(1.2) drop-shadow(0 0 8px #f59e0b); }
    75% { filter: brightness(1.6) drop-shadow(0 0 12px #fde047); }
}

.particle-gold {
    width: 12px;
    height: 12px;
    background: transparent;
    position: relative;
    animation: gold-shimmer linear forwards, gold-twinkle 0.4s ease-in-out infinite;
}

.particle-gold::before {
    content: '◆';
    position: absolute;
    font-size: 16px;
    color: #fde047;
    text-shadow: 
        0 0 5px #fbbf24,
        0 0 10px #f59e0b,
        0 0 20px rgba(251, 191, 36, 0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===== THEME TRANSITION ANIMATIONS ===== */

/* Smooth transitions for all theme-affected elements */
body,
body #main-sidebar,
body .quest-card,
body .flex-1.overflow-y-auto,
body .bg-stone-800 {
    transition: background 0.6s ease-in-out, 
                background-color 0.6s ease-in-out,
                border-color 0.4s ease-in-out,
                color 0.4s ease-in-out;
}

/* Theme transition overlay */
#theme-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#theme-transition-overlay.active {
    opacity: 1;
}

/* Ripple effect from center */
@keyframes theme-ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.theme-ripple {
    position: absolute;
    border-radius: 50%;
    animation: theme-ripple 0.8s ease-out forwards;
    pointer-events: none;
}

/* Fade flash effect */
@keyframes theme-flash {
    0% { opacity: 0; }
    30% { opacity: 0.6; }
    100% { opacity: 0; }
}

.theme-flash {
    animation: theme-flash 0.5s ease-out forwards;
}

/* Particles burst on theme change */
@keyframes theme-particle-burst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(1);
        opacity: 0;
    }
}

.theme-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: theme-particle-burst 0.8s ease-out forwards;
    pointer-events: none;
}

/* ===== ENHANCED CARD HOVER EFFECTS ===== */

/* Base card hover setup */
.quest-card {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease !important;
    overflow: hidden;
}

/* Lift and enhanced shadow on hover */
.quest-card:hover {
    transform: translateY(-6px) scale(1.02);
    z-index: 10;
}

/* Shimmer overlay effect */
.quest-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
    pointer-events: none;
}

.quest-card:hover::after {
    left: 100%;
}

/* Icon bounce on hover */
@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Icon bounce on hover - exclude calendar navigation */
.quest-card:hover .text-2xl:not([class*="ri-arrow"]),
.quest-card:hover .text-3xl,
.quest-card:hover .text-4xl {
    animation: icon-bounce 0.5s ease;
}

/* XP badge pulse */
@keyframes xp-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* XP badge pulse - exclude calendar days */
.quest-card:hover [class*="bg-green"]:not(.calendar-day):not(#calendar-days *),
.quest-card:hover [class*="bg-amber"]:not(.calendar-day):not(#calendar-days *) {
    animation: xp-pulse 0.6s ease infinite;
}

/* Progress bar shimmer */
@keyframes progress-shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.quest-card:hover [class*="bg-gradient"][class*="rounded-full"] {
    background-size: 200% 100%;
    animation: progress-shimmer 1.5s linear infinite;
}

/* Action buttons fade in */
.quest-card .card-actions {
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.quest-card:hover .card-actions {
    opacity: 1;
    transform: scale(1.05);
}

/* ===== THEME-SPECIFIC HOVER GLOWS ===== */

/* Default/Amber theme */
.quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(251, 191, 36, 0.3);
}

/* Forest theme */
body.theme-forest .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
                0 0 25px rgba(16, 185, 129, 0.4),
                inset 0 0 20px rgba(16, 185, 129, 0.1);
    border-color: #34d399 !important;
}

/* Desert theme */
body.theme-desert .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
                0 0 25px rgba(251, 146, 60, 0.4),
                inset 0 0 20px rgba(251, 146, 60, 0.1);
    border-color: #fb923c !important;
}

/* Ice theme */
body.theme-ice .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
                0 0 25px rgba(56, 189, 248, 0.4),
                inset 0 0 20px rgba(56, 189, 248, 0.1);
    border-color: #38bdf8 !important;
}

/* Volcanic theme */
body.theme-volcanic .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(239, 68, 68, 0.5),
                inset 0 0 25px rgba(239, 68, 68, 0.15);
    border-color: #ef4444 !important;
}

/* Mystic theme */
body.theme-mystic .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
                0 0 25px rgba(167, 139, 250, 0.4),
                inset 0 0 20px rgba(167, 139, 250, 0.1);
    border-color: #a78bfa !important;
}

/* Golden theme */
body.theme-golden .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(250, 204, 21, 0.5),
                inset 0 0 25px rgba(250, 204, 21, 0.15);
    border-color: #facc15 !important;
}

/* Shadow theme */
body.theme-shadow .quest-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6),
                0 0 25px rgba(148, 163, 184, 0.3),
                inset 0 0 20px rgba(148, 163, 184, 0.05);
    border-color: #94a3b8 !important;
}

/* ===== PRIORITY-BASED HOVER INTENSITY ===== */

/* High priority - more dramatic */
.quest-card[data-priority="high"]:hover,
.quest-card.priority-high:hover {
    transform: translateY(-8px) scale(1.03);
    filter: brightness(1.1);
}

/* Low priority - subtle */
.quest-card[data-priority="low"]:hover,
.quest-card.priority-low:hover {
    transform: translateY(-3px) scale(1.01);
}
