/* css/style.css - 最终版 */

/* Universal CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

body {
  background-color: #000;
}

#app {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  will-change: transform;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

canvas {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  outline: none;
  z-index: 1;
}

#animation_box {
  z-index: 10;
  /* ...其他样式保持不变... */
}

/* ...loader等其他样式保持不变... */
#animation_box>div:not(.loader) {
  display: none !important;
}

#animation_box {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #EFEFEF;
}

.loader {
  display: block;
  --height-of-loader: 4px;
  --loader-color: #5DB4D9;
  width: 90vw;
  height: var(--height-of-loader);
  border-radius: 30px;
  background-color: rgba(0, 0, 0, 0.2);
  position: absolute;
  top: 90%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
}

.loader::before {
  content: "";
  position: absolute;
  background: var(--loader-color);
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  border-radius: 30px;
  animation: moving 1s ease-in-out infinite;
}

@keyframes moving {
  50% {
    width: 100%;
  }

  100% {
    width: 0;
    right: 0;
    left: unset;
  }
}

/* ================================ */
/*       控制器 - 最终正确版本        */
/* ================================ */
.controls-container {
  display: none;
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 100;
  /* 允许事件穿透此容器的空白区域 */
  pointer-events: none;
}

#control-button,
.animation-player,
#progress-slider {
  /* 确保所有可交互的UI元素都能重新捕获事件 */
  pointer-events: auto;
}

/* 确保容器内的flex布局正常 */
.controls-container,
.animation-player {
  display: flex;
  align-items: center;
  gap: 15px;
}

.controls-container {
  gap: 25px;
  /* 修复display:flex被覆盖的问题 */
  display: none;
  /* 初始隐藏 */
}

.animation-player {
  display: none;
  /* 初始隐藏 */
}

/* ...所有其他按钮和播放器尺寸样式保持不变... */
button {
  border: none;
  color: #fff;
  background-image: linear-gradient(30deg, #12c8e0, #8dafdb);
  border-radius: 5px;
  background-size: 100% auto;
  font-family: inherit;
  font-size: 17px;
  padding: 0.6em 1.5em;
  cursor: pointer;
}

#control-button {
  display: block;
  position: static;
  padding: 0.8em 1.8em;
  font-size: 16px;
  transition: background-image 0.3s ease;
}

#control-button:disabled {
  background-image: linear-gradient(30deg, #555, #888);
  cursor: not-allowed;
  animation: none;
  box-shadow: none;
}

#control-button:disabled:hover {
  animation: none;
  background-size: 100% auto;
}

.animation-player {
  padding: 12px 20px;
  border-radius: 12px;
  background-color: rgba(40, 40, 40, 0.8);
  backdrop-filter: blur(5px);
}

.player-btn {
  background: transparent;
  border: none;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.player-btn svg {
  width: 30px;
  height: 30px;
  fill: #e0e0e0;
  transition: fill 0.2s ease;
}

.player-btn:hover svg {
  fill: #fff;
}

#progress-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 300px;
  height: 8px;
  background: linear-gradient(to right, #21d4fd 0%, #21d4fd var(--progress-percent, 0%), #555 var(--progress-percent, 0%), #555 100%);
  border-radius: 8px;
  outline: none;
  transition: background 0.1s linear;
}

#progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  margin-top: -6px;
  border: 1px solid #ddd;
}

#progress-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #ddd;
}