:root {
  --bg-0: #04060e;
  --bg-1: #080d1c;
  --cyan: #3fe9ff;
  --indigo: #5c7cff;
  --violet: #a06bff;
  --text: #e6eeff;
  --ring-size: 300px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(63, 120, 255, 0.18), transparent 55%),
    radial-gradient(circle at 82% 100%, rgba(160, 107, 255, 0.14), transparent 50%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0) 72%);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 背景装饰 ---------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(110, 160, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 160, 255, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 65%);
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 65%);
  animation: gridShift 30s linear infinite;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.glow-1 {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle, rgba(63, 233, 255, 0.55), transparent 70%);
  animation: drift1 20s ease-in-out infinite;
}

.glow-2 {
  width: 480px;
  height: 480px;
  bottom: -200px;
  right: -120px;
  background: radial-gradient(circle, rgba(160, 107, 255, 0.5), transparent 70%);
  animation: drift2 24s ease-in-out infinite;
}

.glow-3 {
  width: 360px;
  height: 360px;
  top: 50%;
  left: 50%;
  margin: -180px 0 0 -180px;
  background: radial-gradient(circle, rgba(92, 124, 255, 0.32), transparent 70%);
  animation: drift3 16s ease-in-out infinite;
}

.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(150, 205, 255, 0.9);
  box-shadow: 0 0 6px rgba(63, 233, 255, 0.85);
  animation: rise linear infinite;
  will-change: transform, opacity;
}

/* ---------------- 主体 ---------------- */
.loader {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 46px;
  padding: 24px;
}

.orb {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  display: grid;
  place-items: center;
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 轨道 + 卫星光点 */
.orbit {
  position: absolute;
  border-radius: 50%;
  animation: spin 10s linear infinite;
}

.orbit::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.orbit-a {
  inset: 8px;
}

.orbit-a::before {
  width: 9px;
  height: 9px;
  background: #9df6ff;
  box-shadow: 0 0 14px 3px rgba(63, 233, 255, 0.75);
}

.orbit-b {
  inset: -16px;
  animation-duration: 17s;
  animation-direction: reverse;
}

.orbit-b::before {
  width: 6px;
  height: 6px;
  background: #cfb2ff;
  box-shadow: 0 0 12px 2px rgba(160, 107, 255, 0.75);
}

/* 圆环 */
.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring-track {
  fill: none;
  stroke: rgba(140, 180, 255, 0.1);
  stroke-width: 2;
}

.ring-dashed {
  fill: none;
  stroke: rgba(120, 170, 255, 0.28);
  stroke-width: 1;
  stroke-dasharray: 2 10;
  transform-origin: 50% 50%;
  animation: spin 26s linear infinite;
}

.ring-progress {
  fill: none;
  stroke: url(#progressGradient);
  stroke-width: 3;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 10px rgba(63, 233, 255, 0.6));
  transition: stroke-dashoffset 0.18s linear;
}

/* 中心数字 */
.core {
  position: relative;
  width: 186px;
  height: 186px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(
    circle at 50% 42%,
    rgba(90, 180, 255, 0.2),
    rgba(10, 18, 38, 0.55) 55%,
    rgba(10, 18, 38, 0) 74%
  );
  animation: corePulse 3.8s ease-in-out infinite;
}

.percent {
  display: flex;
  align-items: baseline;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.percent b {
  font-size: 52px;
  font-weight: 250;
  background: linear-gradient(180deg, #ffffff, #9ed8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.percent i {
  font-style: normal;
  font-size: 18px;
  margin-left: 3px;
  color: rgba(150, 215, 255, 0.85);
}

.state {
  font-size: 10px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(140, 175, 225, 0.6);
}

/* 提示文字 */
.tip {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-size: clamp(15px, 2.2vw, 18px);
  letter-spacing: 0.08em;
  color: rgba(228, 240, 255, 0.9);
  text-shadow: 0 0 24px rgba(90, 170, 255, 0.45);
  animation: fadeUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

.dots span {
  animation: blink 1.5s ease-in-out infinite;
}

/* 完成态 */
.loader.is-done .core {
  animation: corePulse 2.2s ease-in-out infinite;
  box-shadow: 0 0 90px rgba(63, 233, 255, 0.35);
}

.loader.is-done .dots span {
  animation: none;
  opacity: 0.45;
}

.loader.is-done .tip {
  color: #cbfff1;
}

/* ---------------- 动画 ---------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 1;
  }
}

@keyframes corePulse {
  0%,
  100% {
    box-shadow: 0 0 28px rgba(63, 233, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 64px rgba(63, 233, 255, 0.3);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  85% {
    opacity: 0.5;
  }
  100% {
    transform: translate3d(0, -108vh, 0);
    opacity: 0;
  }
}

@keyframes gridShift {
  to {
    transform: translate3d(56px, 56px, 0);
  }
}

@keyframes drift1 {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(80px, 60px, 0) scale(1.12);
  }
}

@keyframes drift2 {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-90px, -50px, 0) scale(1.1);
  }
}

@keyframes drift3 {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(40px, -40px, 0) scale(1.18);
  }
}

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 480px) {
  :root {
    --ring-size: 248px;
  }

  .loader {
    gap: 38px;
  }

  .core {
    width: 150px;
    height: 150px;
  }

  .percent b {
    font-size: 42px;
  }
}

/* ---------------- 无障碍：减少动态 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .grid,
  .glow,
  .particle,
  .orbit,
  .ring-dashed,
  .core,
  .orb,
  .tip {
    animation: none !important;
  }

  .dots span {
    animation: none !important;
    opacity: 0.85;
  }
}
