* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0d1a3a 0%, #1e4b96 30%, #2563eb 70%, #1e3a8a 100%);
    background-attachment: fixed;
    color: #ffffff;
    overflow: hidden;
    user-select: none;
    position: relative;
}

/* ByeBye FEVER Medical Grid Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 25% 25%, #fdd83518 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, #1e4b9618 1px, transparent 1px),
        linear-gradient(90deg, rgba(253, 216, 53, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(30, 75, 150, 0.05) 1px, transparent 1px);
    background-size: 60px 60px, 40px 40px, 20px 20px, 20px 20px;
    opacity: 0.5;
    z-index: -1;
    animation: medicalGridFlow 25s linear infinite;
}

@keyframes medicalGridFlow {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.5;
    }
    25% {
        transform: translate(15px, 10px) rotate(0.5deg);
        opacity: 0.4;
    }
    50% {
        transform: translate(30px, 20px) rotate(0deg);
        opacity: 0.6;
    }
    75% {
        transform: translate(45px, 30px) rotate(-0.5deg);
        opacity: 0.4;
    }
    100% {
        transform: translate(60px, 40px) rotate(0deg);
        opacity: 0.5;
    }
}

.container {
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Main display area */
.main-display {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#outputCanvas {
    max-width: 100%;
    max-height: 100%;
    border: 3px solid transparent;
    background: linear-gradient(45deg, #1e4b96, #fdd835, #2563eb, #1e4b96) border-box;
    border-radius: 15px;
    box-shadow:
        0 0 30px rgba(30, 75, 150, 0.4),
        0 0 60px rgba(253, 216, 53, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: borderGlow 3s ease-in-out infinite alternate;
}

@keyframes borderGlow {
    0% {
        box-shadow:
            0 0 30px rgba(30, 75, 150, 0.3),
            0 0 60px rgba(253, 216, 53, 0.2),
            inset 0 0 20px rgba(0, 0, 0, 0.3);
    }
    100% {
        box-shadow:
            0 0 40px rgba(30, 75, 150, 0.5),
            0 0 80px rgba(253, 216, 53, 0.3),
            inset 0 0 25px rgba(0, 0, 0, 0.4);
    }
}

#inputVideo {
    display: none;
}

/* ByeBye FEVER Logo */
.byebye-logo {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 15;
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 12px;
    background: rgba(253, 216, 53, 0.1);
    border: 2px solid rgba(253, 216, 53, 0.4);
    box-shadow: 0 8px 20px rgba(30, 75, 150, 0.3);
    transition: all 0.3s ease;
    animation: logoPulse 4s ease-in-out infinite;
}

.byebye-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(30, 75, 150, 0.5);
    background: rgba(253, 216, 53, 0.2);
}

.byebye-logo img {
    width: 120px;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: filter 0.3s ease;
}

.byebye-logo:hover img {
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

@keyframes logoPulse {
    0%, 100% {
        border-color: rgba(253, 216, 53, 0.4);
        box-shadow: 0 8px 20px rgba(30, 75, 150, 0.3);
    }
    50% {
        border-color: rgba(253, 216, 53, 0.7);
        box-shadow: 0 8px 25px rgba(30, 75, 150, 0.4), 0 0 20px rgba(253, 216, 53, 0.3);
    }
}

/* Status overlay */
.status-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fps-counter {
    background: linear-gradient(135deg, rgba(30, 75, 150, 0.9), rgba(13, 26, 58, 0.95));
    backdrop-filter: blur(12px);
    padding: 15px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    color: #fdd835;
    border: 2px solid rgba(253, 216, 53, 0.4);
    text-shadow: 0 0 10px rgba(253, 216, 53, 0.8);
    font-family: 'Courier New', monospace;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    min-height: 50px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    white-space: nowrap;
}

.status-badges {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.badge {
    background: linear-gradient(135deg, rgba(30, 75, 150, 0.85), rgba(13, 26, 58, 0.9));
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    border-left: 3px solid rgba(253, 216, 53, 0.6);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    font-family: 'Segoe UI', monospace;
    color: #ffffff;
    border: 1px solid rgba(253, 216, 53, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.badge.active {
    border-left-color: #fdd835;
    color: #fdd835;
    box-shadow: 0 0 15px rgba(253, 216, 53, 0.5);
    text-shadow: 0 0 8px rgba(253, 216, 53, 0.7);
}

.badge.detected {
    border-left-color: #1e4b96;
    color: #1e4b96;
    box-shadow: 0 0 15px rgba(30, 75, 150, 0.5);
    text-shadow: 0 0 8px rgba(30, 75, 150, 0.7);
}


/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 26, 58, 0.95), rgba(30, 75, 150, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-text {
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
}

.ai-logo {
    font-size: 4em;
    margin-bottom: 20px;
    animation: aiSpin 2s linear infinite;
}

.loading-text > div:nth-child(2) {
    font-size: 24px;
    font-weight: 700;
    color: #fdd835;
    text-shadow: 0 0 20px rgba(253, 216, 53, 0.9);
    margin-bottom: 10px;
    animation: loadingPulse 1.5s infinite;
}

.loading-subtext {
    font-size: 16px;
    color: #1e4b96;
    text-shadow: 0 0 15px rgba(30, 75, 150, 0.7);
    animation: loadingPulse 1.5s infinite 0.5s;
}

@keyframes aiSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes loadingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-overlay.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .status-overlay {
        font-size: 12px;
        padding: 8px;
    }
}

/* Heat visualization colors */
.heat-hot { color: #ff0000; }
.heat-warm { color: #ff8800; }
.heat-normal { color: #ffff00; }
.heat-cool { color: #00ff00; }
.heat-cold { color: #0088ff; }

/* Active mode display */
.active-mode {
    background: linear-gradient(135deg, #1e4b96, #2563eb, #3b82f6);
    color: #fdd835;
    border: 2px solid rgba(253, 216, 53, 0.8);
    box-shadow: 0 0 25px rgba(30, 75, 150, 0.6);
    text-shadow: 0 0 10px rgba(253, 216, 53, 0.8);
    font-family: 'Segoe UI', sans-serif;
    font-weight: 900;
    font-size: 18px;
    padding: 15px 30px;
    border-radius: 12px;
    text-align: center;
    animation: aiPulse 2s infinite;
    margin-bottom: 20px;
}

/* Reset button styles */
.reset-button {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #1e4b96;
    border: 2px solid #d97706;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    text-shadow: 0 1px 2px rgba(30, 75, 150, 0.3);
    width: 100%;
    margin-bottom: 10px;
}

.reset-button:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    transform: translateY(-2px);
}

.reset-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

.button-help {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Cooled state badge styling */
.badge.cooled {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8) !important;
    color: white !important;
    border-color: #0284c7 !important;
    animation: coolPulse 2s infinite;
}

@keyframes coolPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(14, 165, 233, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.7);
    }
}

/* Enhanced ByeBye FEVER Professional Animations */
@keyframes aiDataFlow {
    0% {
        background-position: 0% 50%;
        transform: scale(1);
    }
    25% {
        background-position: 25% 75%;
        transform: scale(1.02);
    }
    50% {
        background-position: 50% 50%;
        transform: scale(1);
    }
    75% {
        background-position: 75% 25%;
        transform: scale(0.98);
    }
    100% {
        background-position: 100% 50%;
        transform: scale(1);
    }
}

@keyframes medicalScanline {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes thermalWave {
    0%, 100% {
        background: linear-gradient(45deg,
            rgba(253, 216, 53, 0.1),
            rgba(30, 75, 150, 0.1),
            rgba(253, 216, 53, 0.1));
        transform: rotate(0deg) scale(1);
    }
    25% {
        background: linear-gradient(45deg,
            rgba(30, 75, 150, 0.15),
            rgba(253, 216, 53, 0.15),
            rgba(30, 75, 150, 0.15));
        transform: rotate(1deg) scale(1.01);
    }
    50% {
        background: linear-gradient(45deg,
            rgba(253, 216, 53, 0.2),
            rgba(30, 75, 150, 0.05),
            rgba(253, 216, 53, 0.2));
        transform: rotate(0deg) scale(1.02);
    }
    75% {
        background: linear-gradient(45deg,
            rgba(30, 75, 150, 0.15),
            rgba(253, 216, 53, 0.15),
            rgba(30, 75, 150, 0.15));
        transform: rotate(-1deg) scale(1.01);
    }
}

/* AI Processing Animation */
@keyframes aiProcessing {
    0% {
        background: linear-gradient(90deg,
            transparent 0%,
            rgba(253, 216, 53, 0.3) 50%,
            transparent 100%);
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

/* Legacy Cooling Effect (kept for compatibility) */
@keyframes coolFlowEffect {
    0% {
        background: radial-gradient(circle at center,
            rgba(14, 165, 233, 0.8) 0%,
            rgba(14, 165, 233, 0.4) 30%,
            rgba(14, 165, 233, 0.1) 60%,
            transparent 100%);
        transform: scale(0.5) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: scale(0.8) rotate(10deg);
    }
    50% {
        transform: scale(1.2) rotate(20deg);
        opacity: 0.8;
    }
    80% {
        transform: scale(1.8) rotate(30deg);
        opacity: 0.4;
    }
    100% {
        transform: scale(2.5) rotate(40deg);
        opacity: 0;
    }
}

/* Medical Scanner Effect */
.medical-scanner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(253, 216, 53, 0.8) 20%,
        rgba(253, 216, 53, 1) 50%,
        rgba(253, 216, 53, 0.8) 80%,
        transparent 100%);
    animation: medicalScanline 3s ease-in-out infinite;
    z-index: 100;
}

/* Enhanced Button Hover Effects for ByeBye FEVER */
.scan-btn, .reset-button {
    position: relative;
    overflow: hidden;
}

.scan-btn::before, .reset-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    transition: left 0.5s ease;
    z-index: 1;
}

.scan-btn:hover::before, .reset-button:hover::before {
    left: 100%;
}

/* Professional AI Status Indicators */
.badge.ai-active::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 8px;
    height: 8px;
    background: rgba(253, 216, 53, 0.8);
    border-radius: 50%;
    transform: translateY(-50%);
    animation: aiPulse 1.5s ease-in-out infinite;
}


/* Advanced Cooling Animation Effects */
@keyframes frostSpread {
    0% {
        background: radial-gradient(circle at center,
            rgba(173, 216, 230, 0.8) 0%,
            rgba(173, 216, 230, 0.4) 30%,
            rgba(173, 216, 230, 0.1) 60%,
            transparent 100%);
        transform: scale(0.3) rotate(0deg);
        opacity: 0;
        filter: blur(0px);
    }
    10% {
        opacity: 1;
        transform: scale(0.5) rotate(5deg);
    }
    30% {
        background: radial-gradient(circle at center,
            rgba(135, 206, 235, 0.9) 0%,
            rgba(173, 216, 230, 0.6) 40%,
            rgba(173, 216, 230, 0.2) 70%,
            transparent 100%);
        transform: scale(1.0) rotate(15deg);
        filter: blur(1px);
    }
    60% {
        background: radial-gradient(circle at center,
            rgba(176, 224, 230, 0.7) 0%,
            rgba(173, 216, 230, 0.4) 50%,
            rgba(173, 216, 230, 0.1) 80%,
            transparent 100%);
        transform: scale(1.8) rotate(25deg);
        filter: blur(2px);
    }
    80% {
        transform: scale(2.2) rotate(35deg);
        opacity: 0.6;
        filter: blur(3px);
    }
    100% {
        background: radial-gradient(circle at center,
            rgba(240, 248, 255, 0.3) 0%,
            rgba(173, 216, 230, 0.1) 60%,
            transparent 100%);
        transform: scale(3.0) rotate(45deg);
        opacity: 0;
        filter: blur(4px);
    }
}

@keyframes iceCrystals {
    0% {
        background: radial-gradient(circle at 20% 30%,
            rgba(255, 255, 255, 0.8) 1px, transparent 1px),
        radial-gradient(circle at 80% 60%,
            rgba(173, 216, 230, 0.6) 1px, transparent 1px),
        radial-gradient(circle at 40% 80%,
            rgba(135, 206, 235, 0.4) 1px, transparent 1px);
        background-size: 15px 15px, 20px 20px, 12px 12px;
        opacity: 0;
        transform: scale(0.5);
    }
    20% {
        opacity: 1;
        transform: scale(1);
    }
    80% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
        background-size: 25px 25px, 30px 30px, 18px 18px;
    }
}

@keyframes coolWaveRipple {
    0% {
        box-shadow: 0 0 0 0 rgba(173, 216, 230, 0.8),
                    0 0 0 0 rgba(135, 206, 235, 0.6),
                    0 0 0 0 rgba(176, 224, 230, 0.4);
        transform: scale(1);
    }
    25% {
        box-shadow: 0 0 0 10px rgba(173, 216, 230, 0.6),
                    0 0 0 0 rgba(135, 206, 235, 0.6),
                    0 0 0 0 rgba(176, 224, 230, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(173, 216, 230, 0.4),
                    0 0 0 10px rgba(135, 206, 235, 0.4),
                    0 0 0 0 rgba(176, 224, 230, 0.4);
        transform: scale(1.05);
    }
    75% {
        box-shadow: 0 0 0 30px rgba(173, 216, 230, 0.2),
                    0 0 0 20px rgba(135, 206, 235, 0.2),
                    0 0 0 10px rgba(176, 224, 230, 0.3);
    }
    100% {
        box-shadow: 0 0 0 40px rgba(173, 216, 230, 0),
                    0 0 0 30px rgba(135, 206, 235, 0),
                    0 0 0 20px rgba(176, 224, 230, 0);
        transform: scale(1.1);
    }
}

/* Cooling Effect Classes */
.cooling-effect {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
}

.frost-spread {
    animation: frostSpread 3s ease-out forwards;
}

.ice-crystals {
    animation: iceCrystals 2s ease-in-out forwards;
}

.cool-wave {
    animation: coolWaveRipple 2.5s ease-out forwards;
    border-radius: 50%;
}

/* Thermal Processing Animation */
.thermal-processing {
    animation: thermalWave 6s ease-in-out infinite;
}

/* Platform-specific optimizations */
.platform-windows {
    /* Windows-specific styling */
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.platform-windows .controls {
    /* Windows-style controls */
    border-radius: 4px;
}

.platform-macos {
    /* macOS-specific styling */
    font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.platform-macos .controls {
    /* macOS-style controls with rounded corners */
    border-radius: 8px;
}

/* High DPI display support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .platform-macos canvas {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Enhanced Loading Screen */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    text-align: center;
    animation: loadingFadeIn 0.8s ease-out;
}

.loading-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-image {
    width: 150px;
    height: auto;
    z-index: 2;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.loading-pulse-ring {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px solid rgba(253, 216, 53, 0.3);
    border-radius: 50%;
    animation: pulseRing 2s infinite ease-in-out;
}

.loading-title {
    margin: 10px 0;
}

.typewriter-text {
    font-size: 32px;
    font-weight: bold;
    color: #fdd835;
    text-shadow: 0 0 30px rgba(253, 216, 53, 0.8);
    font-family: 'Segoe UI', sans-serif;
    overflow: hidden;
    border-right: 2px solid #fdd835;
    white-space: nowrap;
    margin: 0 auto;
    animation: typewriter 2s steps(20, end), blink 0.8s step-end infinite;
}

.loading-progress {
    width: 400px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(30, 75, 150, 0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(253, 216, 53, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e4b96, #fdd835, #2563eb);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
    position: relative;
    animation: progressShimmer 2s infinite;
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(253, 216, 53, 0.4), transparent);
    animation: progressGlow 1.5s infinite;
}

.progress-percentage {
    font-size: 18px;
    font-weight: bold;
    color: #fdd835;
    text-shadow: 0 0 10px rgba(253, 216, 53, 0.6);
    min-width: 50px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 400px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: rgba(30, 75, 150, 0.2);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.loading-step.active {
    border-left-color: #fdd835;
    background: rgba(253, 216, 53, 0.1);
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(253, 216, 53, 0.3);
}

.loading-step.completed {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    opacity: 0.7;
}

.step-icon {
    font-size: 20px;
    width: 30px;
    text-align: center;
}

.step-text {
    font-size: 14px;
    color: #ffffff;
    flex: 1;
}

.loading-step.active .step-text {
    color: #fdd835;
    text-shadow: 0 0 8px rgba(253, 216, 53, 0.4);
}

.loading-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    background: #fdd835;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0; }

.loading-info {
    font-size: 14px;
    color: #1e4b96;
    text-shadow: 0 0 10px rgba(30, 75, 150, 0.5);
}

/* Spectacular Firework Celebration */
.firework-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out;
    visibility: hidden;
}

/* Smooth fade-in state */
.firework-overlay.fade-in {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* Smooth fade-out state */
.firework-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Ensure animations restart when overlay becomes visible */
.firework-overlay:not(.fade-in) .firework,
.firework-overlay:not(.fade-in) .sparkle-particle,
.firework-overlay:not(.fade-in) .celebration-text,
.firework-overlay:not(.fade-in) .celebration-subtitle {
    animation-play-state: paused;
}

.firework-overlay.fade-in .firework,
.firework-overlay.fade-in .sparkle-particle,
.firework-overlay.fade-in .celebration-text,
.firework-overlay.fade-in .celebration-subtitle {
    animation-play-state: running;
}

/* Animation reset class to restart animations */
.firework-overlay.animation-reset .firework,
.firework-overlay.animation-reset .sparkle-particle,
.firework-overlay.animation-reset .celebration-text,
.firework-overlay.animation-reset .celebration-subtitle {
    animation: none;
}

.firework-bg-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* Removed flashing animation */
}

.firework {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
}

.firework-1 {
    top: 15%; left: 15%;
    background: radial-gradient(circle, #fdd835, #f59e0b);
    animation: megaFireworkBurst 5s ease-out forwards;
}

.firework-2 {
    top: 25%; right: 20%;
    background: radial-gradient(circle, #1e4b96, #2563eb);
    animation: megaFireworkBurst 5s ease-out 0.2s forwards;
}

.firework-3 {
    top: 65%; left: 25%;
    background: radial-gradient(circle, #10b981, #34d399);
    animation: megaFireworkBurst 5s ease-out 0.4s forwards;
}

.firework-4 {
    top: 45%; right: 15%;
    background: radial-gradient(circle, #f59e0b, #fbbf24);
    animation: megaFireworkBurst 5s ease-out 0.6s forwards;
}

.firework-5 {
    top: 35%; left: 50%;
    background: radial-gradient(circle, #8b5cf6, #a78bfa);
    animation: megaFireworkBurst 5s ease-out 0.8s forwards;
}

.firework-6 {
    top: 55%; right: 45%;
    background: radial-gradient(circle, #ef4444, #f87171);
    animation: megaFireworkBurst 5s ease-out 1.0s forwards;
}

.firework-7 {
    top: 20%; left: 70%;
    background: radial-gradient(circle, #06b6d4, #67e8f9);
    animation: megaFireworkBurst 5s ease-out 1.2s forwards;
}

.firework-8 {
    top: 70%; left: 60%;
    background: radial-gradient(circle, #fdd835, #fde047);
    animation: megaFireworkBurst 5s ease-out 1.4s forwards;
}

.firework-9 {
    top: 40%; left: 25%;
    background: radial-gradient(circle, #1e4b96, #3b82f6);
    animation: megaFireworkBurst 5s ease-out 1.6s forwards;
}

.firework-10 {
    top: 60%; right: 30%;
    background: radial-gradient(circle, #ec4899, #f472b6);
    animation: megaFireworkBurst 5s ease-out 1.8s forwards;
}

.sparkle-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    animation: sparkleFloat 4s infinite ease-in-out;
}

.particle-1 { top: 20%; left: 30%; animation-delay: 0s; }
.particle-2 { top: 70%; left: 20%; animation-delay: 0.5s; }
.particle-3 { top: 30%; right: 25%; animation-delay: 1s; }
.particle-4 { top: 80%; right: 40%; animation-delay: 1.5s; }
.particle-5 { top: 40%; left: 60%; animation-delay: 2s; }
.particle-6 { top: 60%; left: 80%; animation-delay: 2.5s; }
.particle-7 { top: 50%; right: 20%; animation-delay: 3s; }
.particle-8 { top: 25%; left: 50%; animation-delay: 3.5s; }

.celebration-text {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    font-weight: 900;
    color: #fdd835;
    text-shadow:
        0 0 20px rgba(253, 216, 53, 0.6),
        0 0 40px rgba(253, 216, 53, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: spectacularText 5s ease-in-out forwards;
    z-index: 2001;
    text-align: center;
}

.celebration-subtitle {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #1e4b96;
    text-shadow:
        0 0 15px rgba(30, 75, 150, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: spectacularText 5s ease-in-out 0.5s forwards;
    z-index: 2001;
    text-align: center;
}

/* Enhanced Keyframe Animations */
@keyframes loadingFadeIn {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 0.4; }
    50% { transform: scale(1.1); opacity: 0.6; }
    100% { transform: scale(0.8); opacity: 0.4; }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: #fdd835; }
}

@keyframes progressShimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

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

@keyframes loadingDots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* All flashing animations removed for smooth visual experience */

@keyframes megaFireworkBurst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0.8;
        box-shadow:
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor,
            0 0 0 0 currentColor;
    }
    15% {
        transform: scale(1.5) rotate(45deg);
        opacity: 0.9;
        box-shadow:
            0 -60px 0 -2px currentColor,
            42px -42px 0 -2px currentColor,
            60px 0 0 -2px currentColor,
            42px 42px 0 -2px currentColor,
            0 60px 0 -2px currentColor,
            -42px 42px 0 -2px currentColor,
            -60px 0 0 -2px currentColor,
            -42px -42px 0 -2px currentColor,
            30px -30px 0 -1px currentColor,
            -30px 30px 0 -1px currentColor,
            30px 30px 0 -1px currentColor,
            -30px -30px 0 -1px currentColor;
    }
    30% {
        transform: scale(3) rotate(90deg);
        opacity: 0.8;
        box-shadow:
            0 -120px 0 -6px currentColor,
            85px -85px 0 -6px currentColor,
            120px 0 0 -6px currentColor,
            85px 85px 0 -6px currentColor,
            0 120px 0 -6px currentColor,
            -85px 85px 0 -6px currentColor,
            -120px 0 0 -6px currentColor,
            -85px -85px 0 -6px currentColor,
            60px -100px 0 -4px currentColor,
            -60px 100px 0 -4px currentColor,
            100px 60px 0 -4px currentColor,
            -100px -60px 0 -4px currentColor;
    }
    60% {
        transform: scale(5) rotate(180deg);
        opacity: 0.5;
        box-shadow:
            0 -200px 0 -8px currentColor,
            141px -141px 0 -8px currentColor,
            200px 0 0 -8px currentColor,
            141px 141px 0 -8px currentColor,
            0 200px 0 -8px currentColor,
            -141px 141px 0 -8px currentColor,
            -200px 0 0 -8px currentColor,
            -141px -141px 0 -8px currentColor,
            120px -160px 0 -6px currentColor,
            -120px 160px 0 -6px currentColor,
            160px 120px 0 -6px currentColor,
            -160px -120px 0 -6px currentColor;
    }
    100% {
        transform: scale(8) rotate(360deg);
        opacity: 0;
        box-shadow:
            0 -320px 0 -12px transparent,
            226px -226px 0 -12px transparent,
            320px 0 0 -12px transparent,
            226px 226px 0 -12px transparent,
            0 320px 0 -12px transparent,
            -226px 226px 0 -12px transparent,
            -320px 0 0 -12px transparent,
            -226px -226px 0 -12px transparent,
            200px -280px 0 -10px transparent,
            -200px 280px 0 -10px transparent,
            280px 200px 0 -10px transparent,
            -280px -200px 0 -10px transparent;
    }
}

@keyframes sparkleFloat {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) rotate(180deg) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-40px) rotate(360deg) scale(1.2);
        opacity: 0.7;
    }
    80% {
        transform: translateY(-60px) rotate(540deg) scale(0.8);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-80px) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

@keyframes spectacularText {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    10% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(0.95);
    }
    20% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.05);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    85% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.95);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}