/* ===== 全局重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== 视频元素 ===== */
#video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transform: scaleX(-1);
}

/* ===== 主画布 ===== */
#mainCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== 覆盖层 ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  transition: opacity 0.4s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== 加载动画 ===== */
.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loadingText {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a9eff, #7bc8ff);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== 错误提示 ===== */
.error-content {
  text-align: center;
  max-width: 320px;
  padding: 32px;
  background: rgba(30, 30, 30, 0.95);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.error-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

#errorText {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===== 单手提示 ===== */
.one-hand-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.one-hand-hint.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

/* ===== 控制面板 ===== */
.control-panel {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.5s ease;
}

.control-panel.faded {
  opacity: 0.25;
  pointer-events: none;
}

.control-panel:hover {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.controls-row {
  display: flex;
  gap: 10px;
}

/* ===== 按钮 ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  outline: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #4a9eff, #3d7dd8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(74, 158, 255, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.96) translateY(0);
}

.btn-primary.running {
  background: linear-gradient(135deg, #e04040, #c03030);
  box-shadow: 0 4px 16px rgba(224, 64, 64, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

.btn-secondary.active {
  background: rgba(74, 158, 255, 0.2);
  border-color: rgba(74, 158, 255, 0.4);
  color: #4a9eff;
}

.btn-small {
  padding: 8px 24px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== 平滑度滑块 ===== */
.smoothness-control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.smoothness-control label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

#smoothnessSlider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

#smoothnessSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4a9eff;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#smoothnessValue {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  min-width: 24px;
  text-align: right;
}

/* ===== 状态栏 ===== */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 70;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
  transition: opacity 0.5s ease;
}

.status-bar.faded {
  opacity: 0;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .control-panel {
    bottom: 16px;
    padding: 12px 16px;
    gap: 8px;
    border-radius: 16px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 10px;
  }

  .smoothness-control label {
    font-size: 11px;
  }
}