/* =============================================
   首屏加载动画样式
   — 纯 CSS，Vue 挂载前即生效，无需等待 JS
   ============================================= */

#page-loading {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    /* 深色默认背景，与 FOUC 防闪脚本保持一致 */
    background: #0f0f11;
    transition:
        opacity 0.45s ease,
        visibility 0.45s ease;
    animation: pl-fadein 0.2s ease forwards;
}

/* 浅色主题适配 */
:root:not([data-theme="dark"]) #page-loading {
    background: #fafafa;
}

/* 离场淡出类，由 main.ts 在 nextTick 后添加 */
#page-loading.is-hidden {
    opacity: 0;
    visibility: hidden;
}

/* ── Logo 文字 ── */
.pl-logo {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fafafa;
    user-select: none;
}

:root:not([data-theme="dark"]) .pl-logo {
    color: #09090b;
}

.pl-logo span {
    color: #ff3b30;
}

/* ── Spinner 外环 ── */
.pl-spinner {
    position: relative;
    width: 48px;
    height: 48px;
}

.pl-spinner::before,
.pl-spinner::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

/* 静态底环 */
.pl-spinner::before {
    border: 2px solid rgba(255, 255, 255, 0.08);
}

:root:not([data-theme="dark"]) .pl-spinner::before {
    border-color: rgba(0, 0, 0, 0.08);
}

/* 旋转品牌红弧 */
.pl-spinner::after {
    border: 2px solid transparent;
    border-top-color: #ff3b30;
    border-right-color: rgba(255, 59, 48, 0.35);
    animation: pl-spin 0.85s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

/* ── 中心光点 ── */
.pl-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #ff3b30;
    animation: pl-pulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 59, 48, 0.6);
}

/* ── 三个加载小点 ── */
.pl-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pl-dots i {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ff3b30;
    opacity: 0.3;
    animation: pl-dot-bounce 1.2s ease-in-out infinite;
}

.pl-dots i:nth-child(1) {
    animation-delay: 0s;
}

.pl-dots i:nth-child(2) {
    animation-delay: 0.18s;
}

.pl-dots i:nth-child(3) {
    animation-delay: 0.36s;
}

/* ── 关键帧 ── */
@keyframes pl-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pl-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

@keyframes pl-dot-bounce {

    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: scale(0.85);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes pl-fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}