/* ===================================================================
   Animations: XP bars, level-up, scroll reveal
   =================================================================== */

/* --- XP Bar Animation --- */
@keyframes xpFill {
    from { width: 0; }
}

.progress-bar__fill.animate {
    animation: xpFill 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Level Up Burst --- */
@keyframes levelUpBurst {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes levelUpGlow {
    0% { box-shadow: 0 0 0 0 rgba(200, 168, 78, 0.6); }
    50% { box-shadow: 0 0 30px 10px rgba(200, 168, 78, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(200, 168, 78, 0); }
}

.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.level-up-overlay.visible {
    opacity: 1;
}

.level-up-content {
    position: relative;
    background: var(--color-bg-card);
    border: var(--border-ornate);
    border-radius: var(--border-radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    animation: levelUpBurst 0.6s ease-out, levelUpGlow 1.5s ease-out;
}

/* Close (×) button in the top-right of the level-up modal. */
.level-up-x {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 var(--space-xs);
}

.level-up-x:hover { color: var(--color-text-primary); }

.level-up-stars {
    font-size: 1.5rem;
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
    letter-spacing: 8px;
}

.level-up-content h2 {
    color: var(--color-gold);
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.level-up-skill {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.level-up-content .level-number {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-gold);
    margin: var(--space-md) 0;
}

.level-up-xp {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-green);
    font-weight: 600;
    margin-bottom: var(--space-lg);
}

.level-up-close {
    margin-top: var(--space-sm);
}

/* --- Scroll Reveal --- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Fade In --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* --- Slide In From Left --- */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

/* --- Stat Counter Animation --- */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-animate {
    animation: countUp 0.5s ease-out;
}

/* --- Pulse (for notifications) --- */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* --- XP Gain Float --- */
@keyframes xpFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

.xp-float {
    position: fixed;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-green);
    font-size: 1.1rem;
    pointer-events: none;
    animation: xpFloat 1.5s ease-out forwards;
}
