/* =========================================================
   css/loading.css —— 加载页样式
   液态玻璃(Liquid Glass) + 通透效果 + 全屏动态背景
   ========================================================= */

:root {
  --c1: #8ef0ff;            /* 冰蓝 */
  --c2: #b18cff;            /* 紫罗兰 */
  --c3: #ff9ad5;            /* 粉 */
  --c4: #ffd27a;            /* 暖金 */
  --glass-bg: linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.07) 45%, rgba(255,255,255,.14));
  --glass-border: rgba(255,255,255,.4);
  --text: #f4f8ff;
  --text-dim: rgba(244,248,255,.66);
  --duration: 6400ms;       /* 与 js/loading.js 中的 TOTAL_MS 保持一致 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 1. 通透的动态背景 ---------- */
.scene {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(135deg, #0e1246 0%, #1d1557 38%, #331a74 70%, #16236b 100%);
  overflow: hidden;
}

/* 极光色带：背景缓慢流动 */
.scene::before {
  content: "";
  position: absolute; inset: -40%;
  background:
    radial-gradient(circle at 22% 28%, rgba(120, 200, 255, .5), transparent 42%),
    radial-gradient(circle at 78% 22%, rgba(255, 130, 200, .44), transparent 45%),
    radial-gradient(circle at 78% 78%, rgba(255, 190, 110, .38), transparent 46%),
    radial-gradient(circle at 25% 78%, rgba(150, 130, 255, .46), transparent 44%);
  filter: blur(26px);
  background-size: 160% 160%;
  animation: aurora 22s ease-in-out infinite alternate;
}

@keyframes aurora {
  0%   { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1);   background-position: 0% 0%; }
  50%  { transform: translate3d(3%, 4%, 0)  rotate(6deg) scale(1.12);  background-position: 60% 40%; }
  100% { transform: translate3d(-2%, 2%, 0) rotate(-4deg) scale(1.06); background-position: 100% 100%; }
}

/* 液态水滴/色团：变形 + 漂移，产生“液体玻璃”流动感 */
.blob {
  position: absolute;
  filter: blur(46px);
  opacity: .62;
  will-change: transform, border-radius;
  animation: liquid 16s ease-in-out infinite alternate;
}
.blob.b1 { width: 34vmax; height: 34vmax; left: -8vmax;  top: -6vmax;  background: radial-gradient(circle at 35% 35%, rgba(90,210,255,.75), rgba(90,210,255,0) 70%); animation-duration: 15s; }
.blob.b2 { width: 28vmax; height: 28vmax; right: -6vmax; top: 6vmax;   background: radial-gradient(circle at 60% 40%, rgba(230,120,255,.72), rgba(230,120,255,0) 70%); animation-duration: 19s; animation-delay: -6s; }
.blob.b3 { width: 26vmax; height: 26vmax; left: 14vmax; bottom: -10vmax; background: radial-gradient(circle at 40% 60%, rgba(255,170,110,.65), rgba(255,170,110,0) 70%); animation-duration: 21s; animation-delay: -11s; }
.blob.b4 { width: 22vmax; height: 22vmax; right: 16vmax; bottom: 4vmax; background: radial-gradient(circle at 55% 55%, rgba(150,255,200,.6), rgba(150,255,200,0) 70%); animation-duration: 17s; animation-delay: -3s; }

@keyframes liquid {
  0%   { border-radius: 42% 58% 62% 38% / 45% 44% 56% 55%; transform: translate3d(0, 0, 0) scale(1); }
  33%  { border-radius: 63% 37% 40% 60% / 55% 62% 38% 45%; transform: translate3d(3vmax, -2.4vmax, 0) scale(1.08); }
  66%  { border-radius: 55% 45% 55% 45% / 48% 58% 42% 52%; transform: translate3d(-2vmax, 2vmax, 0) scale(.94); }
  100% { border-radius: 40% 60% 44% 56% / 58% 40% 60% 42%; transform: translate3d(1.4vmax, -1vmax, 0) scale(1.03); }
}

/* 漂浮的小光点 */
.orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  filter: blur(1px);
  animation: orbFloat 9s ease-in-out infinite;
}
.orb.o1 { width: 5px; height: 5px; left: 18%; top: 24%; }
.orb.o2 { width: 3px; height: 3px; left: 72%; top: 16%; animation-duration: 7s; animation-delay: -2s; }
.orb.o3 { width: 4px; height: 4px; left: 84%; top: 62%; animation-duration: 11s; animation-delay: -5s; }
.orb.o4 { width: 3px; height: 3px; left: 34%; top: 78%; animation-duration: 8s; animation-delay: -1s; }
.orb.o5 { width: 6px; height: 6px; left: 8%;  top: 60%; animation-duration: 12s; animation-delay: -7s; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1);   opacity: .35; }
  50%      { transform: translateY(-26px) scale(1.5); opacity: .9; }
}

/* 柔和的边缘过渡（不再压暗中央） */
.scene::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(5, 6, 20, .34) 100%);
}

/* ---------- 2. 玻璃面板（通透核心） ---------- */
.stage {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  padding: 24px;
}

/* 液态玻璃卡片：低透明度 + backdrop 模糊，可看到背后动效（纯通透） */
.glass-card {
  position: relative;
  width: min(430px, 92vw);
  padding: 42px 34px 34px;
  border-radius: 34px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px) saturate(210%);
  backdrop-filter: blur(12px) saturate(210%);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 26px 60px rgba(6, 8, 34, .32),
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -1px 0 rgba(255,255,255,.06);
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
  text-align: center;
  animation: cardFloat 7s ease-in-out infinite;
}
@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* 高光扫过，像玻璃受光 */
.glass-card::after {
  content: "";
  position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-18deg);
  animation: shine 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine {
  0%, 55%  { left: -80%; }
  75%, 100% { left: 130%; }
}

/* ---------- 3. 卡片内容 ---------- */
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.brand .logo {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  font-size: 30px;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(140,240,255,.5), rgba(180,140,255,.45));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 10px 26px rgba(120,180,255,.35), inset 0 1px 0 #fff;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 10px 26px rgba(120,180,255,.35), inset 0 1px 0 #fff, 0 0 0 0 rgba(255,255,255,.0); }
  50%      { box-shadow: 0 10px 26px rgba(120,180,255,.35), inset 0 1px 0 #fff, 0 0 0 14px rgba(255,255,255,0); }
}
.brand h1 {
  font-size: 22px; font-weight: 600; letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.brand .sub {
  font-size: 12px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--text-dim);
}

/* 进度环 */
.ring-box {
  position: relative;
  width: 168px; height: 168px;
  margin-top: 4px;
}
.ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  /* 整圈渐变色，仅由 mask 露出 0 → --p 的弧段 */
  background: conic-gradient(from 0deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  /* 第一层：抠出环形；第二层：按 --p 截断的扇形；两层相交 = 环形进度弧 */
  -webkit-mask:
    radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)),
    conic-gradient(from 0deg, #000 0deg, #000 var(--p, 0deg), transparent var(--p, 0deg) 360deg);
          mask:
    radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)),
    conic-gradient(from 0deg, #000 0deg, #000 var(--p, 0deg), transparent var(--p, 0deg) 360deg);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
  filter: drop-shadow(0 0 8px rgba(140,240,255,.4));
}
.ring-core {
  position: absolute; inset: 20px;
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,.08));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.32);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.ring-core .pct {
  font-size: 40px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(140,240,255,.6);
}
.ring-core .cap {
  font-size: 10px; letter-spacing: 3px; color: var(--text-dim);
}

/* 底部细进度条 */
.bar-track {
  width: min(300px, 70vw); height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.25);
}
.bar-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3), var(--c4));
  background-size: 300% 100%;
  animation: barShine 2.4s linear infinite;
  box-shadow: 0 0 12px rgba(140,240,255,.7);
}
@keyframes barShine { to { background-position: 300% 0; } }

.status {
  font-size: 13px; letter-spacing: 1px; color: var(--text-dim);
  min-height: 20px;
}

.hint-foot {
  font-size: 11px; letter-spacing: 2px;
  color: rgba(244,248,255,.4);
  text-align: center;
}

/* ---------- 进场（页面自动播放，动画结束即交还样式控制，不干扰离场） ---------- */
.stage { animation: riseIn .95s cubic-bezier(.16, 1, .3, 1) .1s backwards; }
.scene { animation: sceneBreathe 1.2s ease .1s backwards; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes sceneBreathe {
  from { opacity: .55; transform: scale(1.05); filter: blur(12px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* 离场（跳转前淡出 → 更顺滑） */
body.leaving .stage {
  opacity: 0;
  transform: translateY(-16px) scale(1.035);
  filter: blur(6px);
}
body.leaving .scene { filter: blur(9px); }
.stage, .scene { transition: opacity .9s ease, transform .9s cubic-bezier(.5, 0, .22, 1), filter .9s ease; }

/* 旧浏览器无 backdrop-filter 时给出半透明兜底，保证可读 */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .glass-card { background: linear-gradient(135deg, rgba(40,45,90,.82), rgba(28,28,66,.86)); }
}

/* 动效偏好：减少动态 */
@media (prefers-reduced-motion: reduce) {
  .scene::before, .blob, .orb, .glass-card, .glass-card::after, .logo, .bar-fill, .stage, .scene { animation: none !important; }
  .ring, .bar-fill { transition: none; }
  body.leaving .stage { transition: none !important; opacity: 1 !important; }
}

@media (max-width: 520px) {
  .glass-card { padding: 30px 20px 26px; border-radius: 26px; }
  .ring-box { width: 140px; height: 140px; }
  .ring-core .pct { font-size: 32px; }
}
