/* ===== 全屏加载动画 ===== */

/* 隐藏 pace 顶部进度条 */
.pace {
    display: none !important;
}

/* 覆盖 Butterfly 默认加载样式 */
#loading-box .loading-bg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: linear-gradient(160deg, #0b0b1a 0%, #12122a 40%, #0d1b2a 100%);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#loading-box .loading-img {
    display: none !important;
}

#loading-box .loading-image-dot {
    display: none !important;
}

/* 加载内容容器 */
.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

/* ===== SVG 星座动画 ===== */
.preloader-svg {
    width: 140px;
    height: 160px;
    filter: drop-shadow(0 0 12px rgba(100, 160, 255, 0.5));
}

/* 星座连线 —— 描边动画 */
.preloader-svg .constellation-line {
    stroke: rgba(140, 180, 255, 0.7);
    stroke-width: 1.5;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawLine 0.6s ease forwards;
    stroke-linecap: round;
}

.preloader-svg .constellation-line:nth-child(1) { animation-delay: 0.1s; }
.preloader-svg .constellation-line:nth-child(2) { animation-delay: 0.2s; }
.preloader-svg .constellation-line:nth-child(3) { animation-delay: 0.3s; }
.preloader-svg .constellation-line:nth-child(4) { animation-delay: 0.4s; }
.preloader-svg .constellation-line:nth-child(5) { animation-delay: 0.45s; }
.preloader-svg .constellation-line:nth-child(6) { animation-delay: 0.5s; }
.preloader-svg .constellation-line:nth-child(7) { animation-delay: 0.55s; }
.preloader-svg .constellation-line:nth-child(8) { animation-delay: 0.6s; }
.preloader-svg .constellation-line:nth-child(9) { animation-delay: 0.65s; }

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* 星点 —— 缩放发光出现 */
.preloader-svg .star-dot {
    fill: #fff;
    opacity: 0;
    transform-origin: center;
    animation: starAppear 0.4s ease forwards;
}

.preloader-svg .star-dot:nth-child(1) { animation-delay: 0.15s; }
.preloader-svg .star-dot:nth-child(2) { animation-delay: 0.3s; }
.preloader-svg .star-dot:nth-child(3) { animation-delay: 0.4s; }
.preloader-svg .star-dot:nth-child(4) { animation-delay: 0.5s; }
.preloader-svg .star-dot:nth-child(5) { animation-delay: 0.55s; }
.preloader-svg .star-dot:nth-child(6) { animation-delay: 0.65s; }

@keyframes starAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    60% {
        opacity: 1;
        transform: scale(1.4);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 星点光晕 */
.preloader-svg .star-glow {
    fill: rgba(140, 180, 255, 0.35);
    opacity: 0;
    animation: glowPulse 0.5s ease forwards;
}

.preloader-svg .star-glow:nth-child(1) { animation-delay: 0.15s; }
.preloader-svg .star-glow:nth-child(2) { animation-delay: 0.3s; }
.preloader-svg .star-glow:nth-child(3) { animation-delay: 0.4s; }
.preloader-svg .star-glow:nth-child(4) { animation-delay: 0.5s; }
.preloader-svg .star-glow:nth-child(5) { animation-delay: 0.55s; }
.preloader-svg .star-glow:nth-child(6) { animation-delay: 0.65s; }

@keyframes glowPulse {
    0% {
        opacity: 0;
        r: 2;
    }
    100% {
        opacity: 1;
        r: 6;
    }
}

/* ===== 品牌文字 ===== */
.preloader-brand {
    font-family: 'xwWenKai', 'Georgia', serif;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 8px;
    text-shadow: 0 0 20px rgba(100, 160, 255, 0.6),
                 0 0 40px rgba(100, 160, 255, 0.3),
                 0 0 80px rgba(100, 160, 255, 0.15);
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.8s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 加载点动画 ===== */
.preloader-dots {
    display: flex;
    gap: 10px;
    opacity: 0;
    animation: fadeInUp 0.5s ease 0.9s forwards;
}

.preloader-dots span {
    width: 6px;
    height: 6px;
    background: rgba(140, 180, 255, 0.8);
    border-radius: 50%;
    animation: dotBreathe 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(1) { animation-delay: 0s; }
.preloader-dots span:nth-child(2) { animation-delay: 0.2s; }
.preloader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBreathe {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* ===== 加载百分比（可选显示） ===== */
.preloader-progress {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(140, 180, 255, 0.5);
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeInUp 0.5s ease 0.95s forwards;
}

/* ===== 加载完成 → 退出动画 ===== */
#loading-box.loaded .loading-bg {
    opacity: 0;
    transform: scale(1.05) translateY(-10px);
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s,
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s;
}

/* 隐藏原百分比文字 */
#loading-percentage {
    display: none;
}

/* ===== 暗色模式微调 ===== */
[data-theme="dark"] #loading-box .loading-bg {
    background: linear-gradient(160deg, #060613 0%, #0c0c20 40%, #081018 100%);
}
