/* 高级加载动画样式 */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  visibility: visible;
  opacity: 1;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* 移动端加载动画优化 */
@media (max-width: 768px) {
  #loading-screen {
    transition: opacity 0.5s ease, visibility 0.5s ease;
  }
  .loading-container {
    width: 160px;
    height: 120px;
  }
  .loading-circle {
    width: 60px;
    height: 60px;
    left: 50px;
  }
  .loading-circle::before,
  .loading-circle::after {
    border-width: 3px;
  }
  .loading-text {
    font-size: 14px;
    letter-spacing: 0.4em;
    top: 75px;
  }
  .loading-particles {
    width: 100px;
    height: 100px;
    top: 30px;
  }
  .loading-particle {
    width: 3px;
    height: 3px;
  }
  .loading-progress {
    height: 8px;
  }
}

@media (max-width: 480px) {
  .loading-container {
    width: 140px;
    height: 110px;
  }
  .loading-circle {
    width: 50px;
    height: 50px;
    left: 45px;
  }
  .loading-circle::before,
  .loading-circle::after {
    border-width: 2px;
  }
  .loading-text {
    font-size: 12px;
    letter-spacing: 0.3em;
    top: 65px;
  }
  .loading-particles {
    width: 80px;
    height: 80px;
    top: 25px;
  }
  .loading-particle {
    width: 2px;
    height: 2px;
  }
  .loading-progress {
    height: 6px;
  }
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* 加载动画容器 */
.loading-container {
  position: relative;
  width: 200px; /* 与进度条宽度一致 */
  height: 140px; /* 足够容纳所有元素 */
  margin: 0 auto;
}

/* 圆形加载动画 - 确保圆心居中 */
.loading-circle {
  width: 80px;
  height: 80px;
  position: absolute;
  top: 0;
  left: 60px; /* 容器宽度200px，进度条中心在100px位置，圆宽度80px，所以left=100px-40px=60px */
  margin: 0;
  padding: 0;
  border: none;
  /* 确保圆本身没有任何偏移 */
  box-sizing: border-box;
}

.loading-circle::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-sizing: border-box;
  /* 确保伪元素以圆心为锚点 */
  top: 0;
  left: 0;
  transform-origin: center center;
}

.loading-circle::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: #c00000;
  border-radius: 50%;
  box-sizing: border-box;
  /* 确保伪元素以圆心为锚点 */
  top: 0;
  left: 0;
  transform-origin: center center;
  animation: rotate 1.5s linear infinite;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 加载粒子效果 */
.loading-particles {
  position: absolute;
  top: 40px; /* 红圈中心位置 */
  left: 50%;
  transform: translateX(-50%); /* 确保粒子在红圈中心 */
  width: 120px;
  height: 120px;
  pointer-events: none;
  z-index: -1;
}

.loading-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(200, 0, 0, 0.6);
  border-radius: 50%;
  animation: particle-float 2s ease-in-out infinite;
}

.loading-particle:nth-child(1) { animation-delay: 0s; left: 50%; top: -10px; }
.loading-particle:nth-child(2) { animation-delay: 0.3s; right: -10px; top: 50%; }
.loading-particle:nth-child(3) { animation-delay: 0.6s; left: 50%; bottom: -10px; }
.loading-particle:nth-child(4) { animation-delay: 0.9s; left: -10px; top: 50%; }
.loading-particle:nth-child(5) { animation-delay: 1.2s; right: 20%; top: 20%; }
.loading-particle:nth-child(6) { animation-delay: 1.5s; left: 20%; bottom: 20%; }

@keyframes particle-float {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0; }
  50% { transform: translate(0, -15px) scale(1.5); opacity: 1; }
}

/* 加载文字 */
.loading-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  color: #c00000;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  animation: text-pulse 1.5s ease-in-out infinite;
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%); /* 确保文字在进度条正上方居中 */
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

@keyframes text-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 进度条 - 直线形状 */
.loading-progress {
  width: 100%; /* 与容器宽度一致 */
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  position: absolute;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0; /* 确保是直线 */
}

.loading-progress-bar {
  height: 100%;
  background: #c00000;
  width: 0%;
  animation: progress 2s ease-in-out forwards; /* 只执行一次，不循环 */
  transition: width 0.5s ease;
  border-radius: 0; /* 确保是直线 */
}

@keyframes progress {
  0% { width: 0%; }
  25% { width: 20%; }
  50% { width: 50%; }
  75% { width: 80%; }
  100% { width: 100%; }
}
