/**
 * 361 Loading 共享样式（单一来源）
 * 用于 index.html bootstrap loading 与 LoadingSpinner 组件
 */

/* ========== 动画关键帧 ========== */
@keyframes dashArray {
  0% {
    stroke-dasharray: 0 1 359 0;
  }
  50% {
    stroke-dasharray: 0 359 1 0;
  }
  100% {
    stroke-dasharray: 359 1 0 0;
  }
}

@keyframes dashOffset {
  0% {
    stroke-dashoffset: 365;
  }
  100% {
    stroke-dashoffset: 5;
  }
}

/* ========== 361 描边动画（LoadingSpinner 与 bootstrap 共用） ========== */
.brand-loader-dash {
  animation:
    dashArray 2s ease-in-out infinite,
    dashOffset 2s linear infinite;
  will-change: stroke-dasharray, stroke-dashoffset;
}

/* ========== Bootstrap 阶段全屏 loading（index.html） ========== */
@keyframes appLoadingAmbientPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.94);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes appLoadingSpeedLine {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(175vw);
  }
}

@keyframes appLoadingOrbitRotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes appLoadingLogoBreathing {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.025);
  }
}

.app-loading {
  --app-loading-gold: #ffd51a;
  --app-loading-orange: #ff7900;
  --app-loading-red: #f20b21;
  --app-loading-background: #020305;

  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(
      ellipse 65% 48% at 50% 43%,
      rgba(62, 19, 0, 0.48) 0%,
      rgba(18, 7, 2, 0.42) 38%,
      var(--app-loading-background) 76%
    ),
    var(--app-loading-background);
}

.app-loading,
.app-loading * {
  box-sizing: border-box;
}

.app-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.72) 100%);
}

.app-loading-ambient {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(76vw, 620px);
  height: min(76vw, 620px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(255, 91, 0, 0.09),
    rgba(255, 22, 0, 0.025) 43%,
    transparent 70%
  );
  filter: blur(20px);
  animation: appLoadingAmbientPulse 2.6s ease-in-out infinite;
}

.app-loading-speed-line {
  position: absolute;
  left: -35%;
  width: min(26vw, 260px);
  height: 2px;
  opacity: 0.35;
  background: linear-gradient(
    90deg,
    transparent,
    var(--app-loading-orange),
    var(--app-loading-gold)
  );
  filter: drop-shadow(0 0 6px var(--app-loading-orange));
  animation: appLoadingSpeedLine 1.8s linear infinite;
}

.app-loading-line-1 {
  top: 31%;
  animation-delay: -0.9s;
}

.app-loading-line-2 {
  top: 57%;
  width: min(18vw, 190px);
  opacity: 0.25;
  animation-delay: -0.2s;
}

.app-loading-line-3 {
  top: 67%;
  width: min(13vw, 140px);
  opacity: 0.2;
  animation-delay: -1.35s;
}

.app-loading-content {
  position: relative;
  width: min(82vw, 560px);
  text-align: center;
  transform: translateY(-2vh);
}

.app-loading-logo-stage {
  position: relative;
  width: min(74vw, 480px);
  aspect-ratio: 1 / 0.75;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.app-loading-orbit-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 98%;
  height: 68%;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(255, 218, 33, 0.92);
  border-right-color: rgba(255, 30, 0, 0.75);
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 6px #ff9800) drop-shadow(0 0 15px rgba(255, 61, 0, 0.42));
  animation: appLoadingOrbitRotate 1.85s linear infinite;
}

.app-loading-orbit-ring::after {
  content: '';
  position: absolute;
  right: 8%;
  top: 7%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff3a2;
  box-shadow:
    0 0 7px #fff,
    0 0 16px #ffd51a,
    0 0 28px #ff6a00,
    -18px 4px 32px #ed1029;
}

.app-loading-logo {
  position: relative;
  z-index: 2;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(255, 106, 0, 0.25)) drop-shadow(0 0 24px rgba(255, 38, 0, 0.12));
  animation: appLoadingLogoBreathing 2.5s ease-in-out infinite;
}

.app-loading-status {
  margin-top: clamp(28px, 5vh, 58px);
  color: #fff;
  font-size: clamp(13px, 2.6vw, 18px);
  font-weight: 800;
  letter-spacing: 0.42em;
  transform: translateX(0.21em);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.app-loading-progress-track {
  position: relative;
  width: min(72vw, 420px);
  height: 6px;
  margin: 24px auto 0;
  overflow: hidden;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.12);
}

.app-loading-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--app-loading-gold) 0%,
    var(--app-loading-orange) 55%,
    var(--app-loading-red) 100%
  );
  box-shadow:
    0 0 8px rgba(255, 193, 0, 0.92),
    0 0 18px rgba(255, 90, 0, 0.72);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.app-loading-progress-light {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd527;
  box-shadow:
    0 0 7px #fff,
    0 0 14px #ffb000,
    0 0 22px #ff6200;
  transform: translate(-50%, -50%);
  will-change: left;
}

.app-loading-percentage {
  margin-top: 17px;
  color: #a4a6aa;
  font-size: 13px;
  letter-spacing: 0.15em;
}

.app-loading-motto {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(5vh, 28px);
  color: rgba(255, 255, 255, 0.25);
  font-size: 10px;
  letter-spacing: 0.38em;
  text-align: center;
}

@media (max-height: 650px) {
  .app-loading-logo-stage {
    width: min(58vw, 360px);
  }

  .app-loading-status {
    margin-top: 16px;
  }

  .app-loading-motto {
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading-ambient,
  .app-loading-speed-line,
  .app-loading-orbit-ring,
  .app-loading-logo {
    animation: none;
  }
}
