/* ===== Loading Screen · AI 光学版 ===== */
/* 仅首页(index.html)显示启动动画，其余页面直接不渲染 */
body:not(.is-home) .wai-loader { display: none; }

.wai-loader {
  position: fixed; inset: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 50% 0%, rgba(124,58,237,0.16), transparent 62%),
    radial-gradient(900px 600px at 85% 100%, rgba(8,145,178,0.12), transparent 60%),
    var(--loader-bg);
  transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s ease;
}
.wai-loader.hide { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(1.05); }

/* ---- 紫青光束 ---- */
.wai-loader::before {
  content: ""; position: absolute; inset: -35%;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(124,58,237,0.22) 55deg,
    rgba(8,145,178,0.12) 110deg,
    transparent 160deg,
    transparent 200deg,
    rgba(124,58,237,0.16) 255deg,
    transparent 310deg);
  animation: wai-aurora-spin 18s linear infinite;
  filter: blur(70px);
  opacity: .55;
  pointer-events: none;
}
.wai-loader::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 90% at 50% 50%, transparent 42%, rgba(11,6,32,0.45) 100%);
  pointer-events: none;
}
[data-theme="dark"] .wai-loader::after { background: radial-gradient(ellipse 90% 90% at 50% 50%, transparent 42%, rgba(0,0,0,0.55) 100%); }

/* ---- 透视网格 ---- */
.wai-loader__grid {
  position: absolute; inset: -50%;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  transform: perspective(500px) rotateX(58deg);
  animation: wai-grid-drift 8s linear infinite;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 42%, #000 18%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 42%, #000 18%, transparent 72%);
}

/* ---- 扫描线 ---- */
.wai-loader__scanline {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.02) 3px, transparent 4px);
  pointer-events: none;
}

/* ---- 紫青光晕 ---- */
.wai-loader__glow {
  position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.24) 0%, rgba(8,145,178,0.10) 40%, transparent 68%);
  filter: blur(12px);
  animation: wai-glow-pulse 3.6s ease-in-out infinite;
}

/* ---- 双环轨道 ---- */
.wai-loader__ring {
  position: absolute; width: 250px; height: 250px; border-radius: 50%;
  border: 1px solid rgba(124,58,237,0.35);
  box-shadow: 0 0 44px rgba(124,58,237,0.12), inset 0 0 44px rgba(124,58,237,0.06);
  animation: wai-ring-spin 12s linear infinite;
}
.wai-loader__ring::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 1px dashed rgba(8,145,178,0.4);
  animation: wai-ring-spin 20s linear infinite reverse;
}
.wai-loader__ring::after {
  content: ""; position: absolute; inset: 26px; border-radius: 50%;
  border: 1px solid rgba(124,58,237,0.24);
  animation: wai-ring-spin 8s linear infinite reverse;
}

/* ---- 中心内容 ---- */
.wai-loader__center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; }
.wai-loader__logo {
  position: relative; width: 56px; height: 56px;
  filter: drop-shadow(0 0 18px rgba(124,58,237,0.4));
  animation: wai-logo-float 2.6s ease-in-out infinite;
}
/* ---- 环绕粒子 ---- */
.wai-loader__logo::before,
.wai-loader__logo::after {
  content: ""; position: absolute; top: 50%; left: 50%; border-radius: 50%;
}
.wai-loader__logo::before {
  width: 7px; height: 7px;
  background: #7C3AED; box-shadow: 0 0 12px rgba(124,58,237,0.9);
  animation: wai-orbit 2.4s linear infinite;
}
.wai-loader__logo::after {
  width: 5px; height: 5px;
  background: #0891B2; box-shadow: 0 0 10px rgba(8,145,178,0.9);
  animation: wai-orbit 3.4s linear infinite reverse;
}

/* ---- 品牌标题（紫青光流） ---- */
.wai-loader__brand {
  font-size: 28px; font-weight: 700; letter-spacing: 0.06em;
  background: linear-gradient(90deg, #7C3AED, #0891B2, #7C3AED);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: wai-text-shimmer 3.5s linear infinite;
}
.wai-loader__subtitle {
  font-size: 13px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--text-muted);
  animation: wai-subtitle-pulse 2s ease-in-out infinite;
}

/* ---- 进度条（紫青流光） ---- */
.wai-loader__progress {
  width: 230px; height: 4px; margin-top: 10px; border-radius: 999px;
  background: var(--loader-progress-bg);
  overflow: hidden; position: relative;
  box-shadow: 0 0 14px rgba(124,58,237,0.2);
}
.wai-loader__progress-bar {
  position: absolute; inset: 0; width: 46%; border-radius: inherit;
  background: linear-gradient(90deg, transparent, #7C3AED, #0891B2, transparent);
  animation: wai-progress-slide 1.4s ease-in-out infinite;
}

/* ===== Keyframes ===== */
@keyframes wai-grid-drift { from { transform: perspective(500px) rotateX(58deg) translateY(0); } to { transform: perspective(500px) rotateX(58deg) translateY(48px); } }
@keyframes wai-aurora-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes wai-glow-pulse { 0%,100% { transform: scale(0.92); opacity: 0.75; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes wai-ring-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes wai-logo-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wai-orbit {
  from { transform: translate(-50%, -50%) rotate(0deg) translateX(46px) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg) translateX(46px) rotate(-360deg); }
}
@keyframes wai-text-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@keyframes wai-subtitle-pulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes wai-progress-slide { 0% { left: -48%; } 100% { left: 108%; } }
