#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

#preloader.hidden {
    display: none;
}

.preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.preloader-gif {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.preloader-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preloader-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    animation: logoBreath 2s ease-in-out infinite;
}

@keyframes logoBreath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.preloader-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.preloader-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 220px;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--sakura-1), var(--sakura-3));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    min-width: 32px;
    text-align: right;
}

.preloader-status {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-align: center;
    min-height: 1.2em;
}

.preloader-status.error {
    color: var(--danger);
}

[data-theme="dark"] #preloader {
    background: var(--bg-primary);
}

@media (max-width: 480px) {
    .preloader-gif {
        width: 120px;
        height: 120px;
    }

    .preloader-logo {
        width: 32px;
        height: 32px;
    }

    .preloader-title {
        font-size: 1.2rem;
    }

    .preloader-progress {
        width: 180px;
    }
}
