/* 灵境 AI 加载层 · 宇宙星象风格 */
.lj-ai-loader {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
    font-family: inherit;
}

.lj-ai-loader.is-active {
    opacity: 1;
    visibility: visible;
}

.lj-ai-loader__backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #04030c;
    pointer-events: none;
}

.lj-ai-loader.is-theme-daily .lj-ai-loader__backdrop {
    background: #060412;
}

.lj-ai-loader.is-theme-tarot .lj-ai-loader__backdrop {
    background: #03020a;
}

.lj-ai-loader__veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 75% 58% at 50% 38%, rgba(124, 58, 237, 0.28) 0%, transparent 62%),
        radial-gradient(ellipse 50% 42% at 78% 72%, rgba(251, 191, 36, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 45% 38% at 12% 68%, rgba(56, 189, 248, 0.12) 0%, transparent 48%);
    opacity: 0.85;
}

.lj-ai-loader.is-theme-tarot .lj-ai-loader__veil {
    background:
        radial-gradient(ellipse 75% 58% at 50% 38%, rgba(67, 56, 202, 0.32) 0%, transparent 64%),
        radial-gradient(ellipse 45% 40% at 15% 70%, rgba(6, 182, 212, 0.18) 0%, transparent 52%);
}

/* 塔罗 / 神谕 · 柔和汇聚粒子（对齐神谕揭晓，无 warp 星场） */
.lj-ai-loader.is-effect-soft .lj-ai-loader__backdrop {
    background: rgba(4, 2, 14, 0.94);
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__veil {
    opacity: 1;
    background:
        radial-gradient(ellipse 70% 55% at 50% 38%, rgba(168, 85, 247, 0.22) 0%, transparent 62%),
        radial-gradient(ellipse 50% 45% at 20% 78%, rgba(236, 72, 153, 0.1) 0%, transparent 52%);
    backdrop-filter: blur(12px) saturate(1.08);
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__star-canvas {
    display: none;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__particle-canvas {
    z-index: 2;
    opacity: 0.85;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__orb {
    background: radial-gradient(circle at 35% 30%, #f3e8ff 0%, #a78bfa 38%, #5b21b6 72%, #1e1033 100%);
    box-shadow:
        0 0 28px rgba(168, 85, 247, 0.35),
        0 0 48px rgba(124, 58, 237, 0.18),
        inset 0 -6px 16px rgba(0, 0, 0, 0.35);
    animation: lj-ai-pulse-soft 3.2s ease-in-out infinite;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__orb-core {
    opacity: 0.55;
    filter: blur(3px);
    animation: lj-ai-core-soft 2.6s ease-in-out infinite;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__ring::before {
    color: rgba(196, 181, 253, 0.38);
    font-size: 10px;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__ring-2 {
    border-color: rgba(216, 180, 254, 0.14);
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__title {
    text-shadow: 0 0 16px rgba(167, 139, 250, 0.28);
    letter-spacing: 0.1em;
}

.lj-ai-loader.is-effect-soft .lj-ai-loader__progress-fill {
    background: linear-gradient(90deg, #7c3aed, #c084fc, #a78bfa);
    background-size: 100% 100%;
    animation: none;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.35);
}

@keyframes lj-ai-pulse-soft {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.03); filter: brightness(1.05); }
}

@keyframes lj-ai-core-soft {
    0%, 100% { opacity: 0.45; transform: scale(0.92); }
    50% { opacity: 0.65; transform: scale(1.02); }
}

.lj-ai-loader__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.lj-ai-loader__star-canvas {
    z-index: 2;
}

.lj-ai-loader__particle-canvas {
    z-index: 3;
}

.lj-ai-loader__scan {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(167, 139, 250, 0.04) 48%,
        transparent 52%,
        transparent 100%
    );
    background-size: 100% 220%;
    animation: lj-ai-scan 5.5s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes lj-ai-scan {
    0% { background-position: 0 -120%; }
    100% { background-position: 0 120%; }
}

.lj-ai-loader__stage {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: min(92vw, 440px);
    text-align: center;
    border-radius: 20px;
    border: 1px solid rgba(167, 139, 250, 0.22);
    background: linear-gradient(165deg, rgba(30, 20, 55, 0.72) 0%, rgba(8, 5, 18, 0.55) 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 60px rgba(124, 58, 237, 0.15);
    backdrop-filter: blur(16px) saturate(1.2);
    animation: lj-ai-stage-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lj-ai-stage-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lj-ai-loader.is-theme-tarot .lj-ai-loader__stage {
    border-color: rgba(6, 182, 212, 0.28);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 60px rgba(6, 182, 212, 0.18);
}

.lj-ai-loader.is-theme-oracle .lj-ai-loader__stage {
    border-color: rgba(236, 72, 153, 0.22);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 56px rgba(168, 85, 247, 0.2);
}

.lj-ai-loader.is-theme-zodiac .lj-ai-loader__stage {
    border-color: rgba(99, 102, 241, 0.28);
}

.lj-ai-loader__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0.15rem 0 0.35rem;
    min-height: 28px;
}

.lj-ai-loader__chip {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.2);
    color: rgba(196, 181, 253, 0.55);
    background: rgba(255, 255, 255, 0.03);
    transition: color 0.35s ease, border-color 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
}

.lj-ai-loader__chip.is-active {
    color: rgba(253, 230, 138, 0.95);
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(124, 58, 237, 0.25);
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
}

.lj-ai-loader__chip.is-done {
    color: rgba(167, 139, 250, 0.75);
    border-color: rgba(167, 139, 250, 0.35);
}

.lj-ai-loader.is-complete .lj-ai-loader__orb-wrap {
    animation: lj-ai-complete-pulse 0.5s ease-out;
}

@keyframes lj-ai-complete-pulse {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.08); filter: brightness(1.25); }
    100% { transform: scale(1); filter: brightness(1); }
}

.lj-ai-loader.is-exiting {
    opacity: 0;
    transition: opacity 0.42s ease;
}

.lj-ai-loader.is-reduced-motion .lj-ai-loader__star-canvas,
.lj-ai-loader.is-reduced-motion .lj-ai-loader__particle-canvas,
.lj-ai-loader.is-reduced-motion .lj-ai-loader__scan {
    display: none;
}

.lj-ai-loader__orb-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lj-ai-loader__ring {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    border: 1px solid rgba(167, 139, 250, 0.25);
    animation: lj-ai-spin 18s linear infinite;
}

.lj-ai-loader__ring::before {
    content: '☉ ☽ ✦ ☿ ♀ ♂ ♃ ♄ ✧ ☊ ☋';
    position: absolute;
    inset: -4px;
    font-size: 11px;
    letter-spacing: 0.35em;
    color: rgba(196, 181, 253, 0.55);
    animation: lj-ai-spin-rev 24s linear infinite;
    white-space: nowrap;
    width: 200%;
    left: -50%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

.lj-ai-loader__ring-2 {
    position: absolute;
    inset: -32px;
    border-radius: 50%;
    border: 1px dashed rgba(34, 211, 238, 0.18);
    animation: lj-ai-spin-rev 28s linear infinite;
}

.lj-ai-loader__orb {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #e9d5ff 0%, #7c3aed 35%, #312e81 70%, #0f0a1e 100%);
    box-shadow:
        0 0 40px rgba(124, 58, 237, 0.55),
        0 0 80px rgba(124, 58, 237, 0.25),
        inset 0 -8px 20px rgba(0, 0, 0, 0.4);
    animation: lj-ai-pulse 2.4s ease-in-out infinite;
}

.lj-ai-loader.is-theme-tarot .lj-ai-loader__orb {
    background: radial-gradient(circle at 35% 30%, #a5f3fc 0%, #0891b2 40%, #1e1b4b 72%, #030712 100%);
    box-shadow:
        0 0 45px rgba(6, 182, 212, 0.5),
        0 0 90px rgba(99, 102, 241, 0.3),
        inset 0 -8px 20px rgba(0, 0, 0, 0.45);
}

.lj-ai-loader__orb-core {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    filter: blur(2px);
    animation: lj-ai-core 1.8s ease-in-out infinite;
}

.lj-ai-loader__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: rgba(237, 233, 254, 0.95);
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

.lj-ai-loader__status {
    margin: 0;
    min-height: 1.5em;
    font-size: 0.88rem;
    color: rgba(196, 181, 253, 0.82);
    letter-spacing: 0.06em;
    transition: opacity 0.35s ease;
}

.lj-ai-loader__status.is-fading {
    opacity: 0.35;
}

.lj-ai-loader__progress {
    width: min(280px, 80vw);
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
}

.lj-ai-loader__progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #22d3ee, #fbbf24, #7c3aed);
    background-size: 200% 100%;
    animation: lj-ai-shimmer 2s linear infinite;
    transition: width 0.4s ease;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.6);
}

.lj-ai-loader__dots {
    display: flex;
    gap: 6px;
    margin-top: -0.25rem;
}

.lj-ai-loader__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.5);
    animation: lj-ai-dot 1.2s ease-in-out infinite;
}

.lj-ai-loader__dot:nth-child(2) { animation-delay: 0.15s; }
.lj-ai-loader__dot:nth-child(3) { animation-delay: 0.3s; }

body.lj-ai-loader-open {
    overflow: hidden;
}

@keyframes lj-ai-spin {
    to { transform: rotate(360deg); }
}

@keyframes lj-ai-spin-rev {
    to { transform: rotate(-360deg); }
}

@keyframes lj-ai-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.06); filter: brightness(1.15); }
}

@keyframes lj-ai-core {
    0%, 100% { opacity: 0.7; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes lj-ai-shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes lj-ai-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
    .lj-ai-loader__ring,
    .lj-ai-loader__ring::before,
    .lj-ai-loader__ring-2,
    .lj-ai-loader__orb,
    .lj-ai-loader__orb-core,
    .lj-ai-loader__progress-fill,
    .lj-ai-loader__dot,
    .lj-ai-loader__scan {
        animation: none;
    }
    .lj-ai-loader__star-canvas,
    .lj-ai-loader__particle-canvas {
        display: none;
    }
}
