/* ============================================== */
/*              SPLASH SCREEN (STARTUP)           */
/* ============================================== */

body.splash-active {
    overflow: hidden;
}

#app-splash {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 35%, #121a2e 0%, #080c14 45%, #05070d 100%);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-splash::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, rgba(52, 211, 153, 0.12) 0%, transparent 42%),
        radial-gradient(circle at 20% 80%, rgba(45, 212, 191, 0.06) 0%, transparent 35%);
    pointer-events: none;
}

#app-splash.splash-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: min(88vw, 320px);
    transform: translateY(0) scale(1);
    filter: blur(0);
    opacity: 1;
    will-change: transform, opacity, filter;
}

#app-splash.splash-exiting .splash-content {
    animation: splashContentExit 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#app-splash.splash-exiting {
    animation: splashBackdropExit 0.82s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.splash-logo-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    animation: splashLogoIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
    background: transparent;
}

.splash-logo-wrap::after {
    content: '';
    position: absolute;
    inset: -28%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.38) 0%, rgba(45, 212, 191, 0.14) 38%, transparent 72%);
    filter: blur(16px);
    opacity: 0.95;
    pointer-events: none;
}

.splash-logo {
    position: relative;
    z-index: 1;
    width: min(58vw, 240px);
    height: auto;
    object-fit: contain;
    filter:
        drop-shadow(0 0 10px rgba(52, 211, 153, 0.75))
        drop-shadow(0 0 24px rgba(52, 211, 153, 0.45))
        drop-shadow(0 0 42px rgba(45, 212, 191, 0.28))
        drop-shadow(0 10px 28px rgba(0, 0, 0, 0.45));
}

.splash-spinner {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border: 4px solid rgba(0, 255, 128, 0.2);
    border-top: 4px solid #00ff80;
    border-radius: 50%;
    flex-shrink: 0;
    animation: splashSpin 1s linear infinite, splashSpinnerFadeIn 0.5s ease 0.15s both;
}

.splash-loading-text {
    margin: 0 0 20px;
    color: #00ff80;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    animation: splashSpinnerFadeIn 0.5s ease 0.2s both;
}

.splash-progress-container {
    width: min(72vw, 280px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: splashProgressIn 0.65s ease 0.25s both;
}

.splash-progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(52, 211, 153, 0.18);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.splash-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #34d399, #2dd4bf);
    border-radius: 999px;
    transition: width 0.08s linear;
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.55);
}

.splash-progress-fill.splash-progress-complete {
    box-shadow: 0 0 22px rgba(52, 211, 153, 0.85);
}

.splash-progress-text {
    color: #6ee7b7;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

@keyframes splashLogoIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes splashSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes splashSpinnerFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes splashProgressIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splashContentExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-18px) scale(1.05);
        filter: blur(8px);
    }
}

@keyframes splashBackdropExit {
    0% {
        opacity: 1;
        backdrop-filter: blur(0);
        -webkit-backdrop-filter: blur(0);
    }
    100% {
        opacity: 0;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

@media (min-width: 901px) {
    .splash-logo {
        width: min(26vw, 280px);
    }

    .splash-spinner {
        width: 60px;
        height: 60px;
    }

    .splash-progress-container {
        width: min(36vw, 320px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-logo-wrap,
    .splash-progress-container {
        animation: none;
    }

    .splash-spinner {
        animation: splashSpin 1s linear infinite;
    }

    #app-splash.splash-exiting .splash-content,
    #app-splash.splash-exiting {
        animation: none;
    }

    #app-splash.splash-hidden {
        transition-duration: 0.2s;
    }
}
