/* --- Modern Loading Animation CSS --- */

:root {
  /* 定义主题色,方便修改 */
  --theme-color: #839dff;
  --theme-glow: rgba(131, 157, 255, 0.6);
}

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #1a1a1a;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 1.5s ease;
  overflow: hidden;
  contain: layout style paint;
}

/* 粒子背景容器 */
#particlesBackground {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* 粒子样式 */
.particle {
  position: absolute;
  font-family: 'Gochi Hand', "Segoe Script", "Segoe UI", sans-serif;
  font-weight: 400;
  color: rgba(131, 157, 255, 0.35);
  text-shadow:
    0 0 10px rgba(131, 157, 255, 0.35),
    0 0 20px rgba(131, 157, 255, 0.15);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  will-change: transform, opacity;
}

/* 粒子动画 - 飘动效果 */
@keyframes particleFloat {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.6;
  }

  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rotate));
    opacity: 0;
  }
}

/* 粒子脉搏效果 - 降低强度，更柔和 */
@keyframes particlePulse {

  0%,
  100% {
    text-shadow:
      0 0 10px rgba(131, 157, 255, 0.35),
      0 0 20px rgba(131, 157, 255, 0.15);
  }

  50% {
    text-shadow:
      0 0 12px rgba(131, 157, 255, 0.5),
      0 0 25px rgba(131, 157, 255, 0.25),
      0 0 35px rgba(167, 183, 255, 0.15);
  }
}

#loadingOverlay.fadeOut {
  opacity: 0;
  pointer-events: none;
  /* 淡出后不再响应鼠标事件 */
}

#loadingContainer {
  text-align: center;
  width: 80%;
  max-width: 400px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

#loadingText {
  color: #fff;
  font-size: 2.5em;
  font-family: 'Gochi Hand', "Segoe Script", "Segoe UI";
  text-shadow: 0 0 10px var(--theme-glow);
  margin-bottom: 25px;
  user-select: none;
  font-size-adjust: 0.35;
  opacity: 0;
  transform: translateY(20px);
  animation: slideInFromBottom 0.8s ease-out 0.2s forwards;
  white-space: nowrap;
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#progressBar {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  /* 确保填充条不会超出边框 */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  animation: scaleInFromLeft 0.6s ease-out 0.6s forwards;
}

@keyframes scaleInFromLeft {
  from {
    opacity: 0;
    transform: scaleX(0);
  }

  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

#progressBarFill {
  width: 0%;
  /* 初始宽度为0,由JS控制 */
  height: 100%;
  background: linear-gradient(90deg, #a7b7ff, var(--theme-color));
  /* 漂亮的渐变色 */
  border-radius: 4px;
  transition: width 0.7s ease-out;
}

#progressText {
  color: #ccc;
  font-size: 1em;
  font-family: "Arial", "Segoe UI", "Microsoft Yahei", "黑体", "sans-serif";
  margin-top: 15px;
  user-select: none;
  letter-spacing: 1px;
  opacity: 0;
  transform: translateY(-15px);
  animation: slideInFromTop 0.6s ease-out 0.9s forwards;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#progress {
  font-weight: bold;
  color: #fff;
}

/* 适配移动端 */
@media only screen and (max-width: 767px) {
  #loadingText {
    font-size: 1.8em;
  }

  .particle {
    font-size: 0.9em;
  }
}

/* 加载自定义字体 */
@font-face {
  font-family: 'Gochi Hand';
  src: url('https://lib.baomitu.com/fonts/gochi-hand/gochi-hand-regular.woff2') format('woff2'),
    url('/assets/fonts/gochi-hand-regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}