* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0c10;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  color: #e6e6e6;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.ui-overlay {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 10;
  width: 340px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px;
  background: rgba(15, 16, 22, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.ui-overlay.light-theme {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.1);
}

.ui-overlay.light-theme h1 {
  background: linear-gradient(90deg, #1a1a1a 0%, #4a4a4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ui-overlay.light-theme .subtitle {
  color: #666;
}

.ui-header {
  position: relative;
  margin-bottom: 20px;
}

.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(30deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ui-overlay.light-theme .theme-toggle {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.ui-overlay.light-theme .step-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.15);
}

.ui-overlay.light-theme .step-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.25);
}

.ui-overlay.light-theme .step-desc {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.1), rgba(143, 122, 255, 0.08));
  color: #333;
}

.ui-overlay.light-theme .welcome-banner {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), rgba(143, 122, 255, 0.15));
  color: #333;
}

.ui-overlay.light-theme .welcome-banner strong {
  color: #000;
}

.ui-overlay.light-theme .tips-list li,
.ui-overlay.light-theme .parts-header,
.ui-overlay.light-theme .tips-title {
  color: #555;
}

.ui-overlay.light-theme .tips-list li strong {
  color: #000;
}

.ui-overlay h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #ffffff 0%, #a0a0a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 15px;
  color: #8b8d98;
  margin-bottom: 20px;
}

/* ===== 欢迎横幅 ===== */
.welcome-banner {
  margin-bottom: 22px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.12), rgba(143, 122, 255, 0.12));
  border: 1px solid rgba(74, 158, 255, 0.25);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.7;
  color: #c5c7d3;
}

.welcome-banner strong {
  color: #ffffff;
  font-size: 16px;
  display: block;
  margin-bottom: 6px;
}

/* ===== 步骤控制 ===== */
.control-group {
  margin-bottom: 16px;
}

.step-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

#step-number {
  font-size: 13px;
  color: #6e717c;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

#step-number::before {
  content: '🔧';
  font-size: 14px;
}

#step-name {
  font-size: 19px;
  color: #ffffff;
  font-weight: 600;
  line-height: 1.3;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a9eff, #8f7aff, #ff6b9d);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(74, 158, 255, 0.5);
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.step-desc {
  margin-top: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.08), rgba(143, 122, 255, 0.06));
  border-left: 4px solid #4a9eff;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.8;
  color: #c5c7d3;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: pre-line;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.15);
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-desc .highlight {
  color: #ffffff;
  font-weight: 500;
  text-shadow: 0 0 8px rgba(74, 158, 255, 0.5);
}

/* ===== 步骤按钮 ===== */
.step-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.step-buttons .step-btn:last-child {
  grid-column: span 2;
}

.step-btn {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.step-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.step-btn:hover::before {
  width: 300px;
  height: 300px;
}

.step-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.step-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
  transition: transform 0.1s;
}

.step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.step-btn.primary {
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  color: #0b0c10;
  border-color: transparent;
  font-weight: 600;
}

.step-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.2);
}

.step-btn.explode-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  grid-column: span 2;
}

.step-btn.explode-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff5252 0%, #d63031 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.step-btn.explode-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.step-btn.explode-btn.exploded {
  background: linear-gradient(135deg, #4a9eff 0%, #8f7aff 100%);
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 30px rgba(74, 158, 255, 0.6);
  }
}

.step-btn.explode-btn.exploded:hover:not(:disabled) {
  background: linear-gradient(135deg, #3a8eef 0%, #7f6aef 100%);
  box-shadow: 0 8px 24px rgba(74, 158, 255, 0.5);
}

/* ===== AR 按钮 ===== */
.step-btn.ar-btn {
  background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  grid-column: span 2;
  position: relative;
  overflow: hidden;
}

.step-btn.ar-btn::before {
  content: '📱';
  position: absolute;
  left: 12px;
  font-size: 16px;
}

.step-btn.ar-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #00e6b8 0%, #00c9a1 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 212, 170, 0.4);
}

.step-btn.ar-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.step-btn.ar-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* ===== 复选框 ===== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #b0b2bd;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4a9eff;
  cursor: pointer;
}

/* ===== 部件清单 ===== */
.parts-list {
  margin-top: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.parts-header {
  font-size: 13px;
  font-weight: 600;
  color: #8b8d98;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.parts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.part-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #9fa1ac;
  padding: 5px 8px;
  border-radius: 5px;
  transition: all 0.2s ease;
  cursor: default;
}

.part-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
}

.part-item.active {
  background: rgba(74, 158, 255, 0.15);
  color: #4a9eff;
  font-weight: 500;
}

.part-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== 文件上传 ===== */
.upload-section {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.08), rgba(143, 122, 255, 0.08));
  border: 2px solid rgba(74, 158, 255, 0.3);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.15);
}

.upload-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #4a9eff;
  margin-bottom: 6px;
}

.upload-formats {
  font-size: 13px;
  color: #8b8d98;
  margin-bottom: 14px;
}

.drop-zone {
  border: 2px dashed rgba(74, 158, 255, 0.5);
  border-radius: 10px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  background: rgba(74, 158, 255, 0.03);
}

.drop-zone:hover {
  border-color: #4a9eff;
  background: rgba(74, 158, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
}

.drop-zone-text {
  font-size: 14px;
  color: #b0b2bd;
  line-height: 1.6;
}

.drop-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.8;
  filter: drop-shadow(0 0 8px rgba(74, 158, 255, 0.4));
}

.upload-status {
  white-space: pre-line;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.upload-btn {
  width: 100%;
  margin-bottom: 8px;
  font-size: 15px;
  padding: 12px 16px;
}

#clear-model-btn {
  width: 100%;
  font-size: 15px;
  padding: 12px 16px;
}

#uploaded-file-name {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #4a9eff;
  text-align: center;
  font-weight: 500;
}

#part-count {
  color: #4a9eff;
  font-weight: 600;
}

/* ===== 操作提示 ===== */
.tips-box {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.tips-title {
  font-size: 13px;
  font-weight: 600;
  color: #8b8d98;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tips-list li {
  font-size: 14px;
  color: #9fa1ac;
  line-height: 1.4;
}

.tips-list li strong {
  color: #e6e6e6;
  font-weight: 500;
}

.hint {
  margin-top: 16px;
  font-size: 13px;
  color: #5d6070;
  line-height: 1.5;
  text-align: center;
}

/* ===== 加载/错误 ===== */
.loading, .error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  padding: 14px 22px;
  border-radius: 10px;
  background: rgba(15, 16, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 5;
}

.loading {
  color: #8b8d98;
  background: transparent;
  border: none;
  padding: 0;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.spinner-ring {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4a9eff;
  border-right-color: #8f7aff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 30px rgba(74, 158, 255, 0.3),
              inset 0 0 20px rgba(143, 122, 255, 0.1);
}

@keyframes spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.spinner-text {
  font-size: 14px;
  color: #e6e6e6;
  font-weight: 500;
  letter-spacing: 0.5px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.error {
  color: #ff6b6b;
  max-width: 80%;
  text-align: center;
  white-space: pre-line;
}

.hidden {
  display: none !important;
}

/* ===== 工具清单 ===== */
.tools-section {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.12), rgba(255, 152, 0, 0.08));
  border: 1px solid rgba(255, 193, 7, 0.35);
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tools-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ffc107, #ff9800, #ffc107);
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.tools-section:hover {
  border-color: rgba(255, 193, 7, 0.5);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.2);
  transform: translateY(-2px);
}

.tools-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #ffc107;
  margin-bottom: 12px;
}

.tools-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tools-none {
  font-size: 14px;
  color: #4caf50;
  font-weight: 500;
}

.tool-item {
  font-size: 14px;
  color: #e6e6e6;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border-left: 3px solid #ffc107;
  transition: all 0.2s ease;
}

.tool-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

/* ===== 爆炸深度滑块 ===== */
.control-group {
  margin-bottom: 16px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #b0b2bd;
  margin-bottom: 8px;
  font-weight: 500;
}

#explode-depth {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#explode-depth::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  transition: all 0.2s ease;
}

#explode-depth::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
}

#explode-depth::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  transition: all 0.2s ease;
}

#explode-depth::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
}

/* ===== 时间轴控制 ===== */
.timeline-control {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.timeline-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.timeline-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.timeline-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.timeline-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.timeline-select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.timeline-select:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.timeline-select option {
  background: #1e1e21;
  color: #e6e6e6;
}

.timeline-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

#timeline-step,
#timeline-total {
  font-size: 13px;
  color: #8b8d98;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

#timeline-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a9eff, #8f7aff);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(74, 158, 255, 0.4);
  transition: all 0.2s ease;
}

#timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(74, 158, 255, 0.6);
}

#timeline-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a9eff, #8f7aff);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(74, 158, 255, 0.4);
  transition: all 0.2s ease;
}

#timeline-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(74, 158, 255, 0.6);
}

/* ===== 部件信息卡片 ===== */
.part-tooltip {
  position: fixed;
  z-index: 1000;
  background: rgba(15, 16, 22, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.part-tooltip:not(.hidden) {
  opacity: 1;
}

.part-tooltip .tooltip-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.part-tooltip .tooltip-content {
  font-size: 13px;
  color: #b0b2bd;
  line-height: 1.6;
}

/* ===== 上传增强 ===== */
.upload-section.featured {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), rgba(143, 122, 255, 0.15));
  border: 2px solid rgba(74, 158, 255, 0.4);
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 4px 30px rgba(74, 158, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}

.upload-btn {
  background: linear-gradient(135deg, #4a9eff, #8f7aff);
  color: #ffffff;
  font-weight: 600;
  border: none;
  padding: 14px 20px;
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 158, 255, 0.4);
  background: linear-gradient(135deg, #5aaeff, #9f8bff);
}

.upload-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ===== 移动端优化 ===== */
.mobile-device .ui-overlay {
  top: 8px;
  left: 8px;
  right: 8px;
  width: auto;
  max-height: calc(100vh - 16px);
  padding: 16px;
}

.mobile-device h1 {
  font-size: 28px;
}

.mobile-device .step-btn {
  padding: 14px 16px;
  font-size: 16px;
  min-height: 48px;
}

.mobile-device .timeline-btn,
.mobile-device .timeline-select {
  padding: 10px 12px;
  font-size: 14px;
  min-height: 44px;
}

.mobile-device .tool-item {
  padding: 10px 14px;
  font-size: 15px;
}

.mobile-device #explode-depth {
  height: 8px;
}

.mobile-device #explode-depth::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
}

.mobile-device #explode-depth::-moz-range-thumb {
  width: 22px;
  height: 22px;
}

/* ===== 横屏优化 ===== */
@media (max-width: 480px) and (orientation: landscape) {
  .ui-overlay {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .step-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .step-btn.explode-btn {
    grid-column: span 2;
  }
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .ui-overlay {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    padding: 18px;
    max-height: calc(100vh - 24px);
  }
}

/* ===== 自定义滚动条 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ui-overlay.light-theme::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.ui-overlay.light-theme::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

.ui-overlay.light-theme::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* ===== AI 绘画面板 ===== */
.ai-paint-section {
  margin-bottom: 20px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 14px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.ai-paint-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #a5b4fc;
}

.ui-overlay.light-theme .ai-paint-section {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.05));
  border-color: rgba(99, 102, 241, 0.25);
}

.ui-overlay.light-theme .ai-paint-header {
  color: #4f46e5;
}

.ai-paint-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-paint-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: rgba(15, 16, 22, 0.6);
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 10px;
  color: #e6e6e6;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-paint-input::placeholder {
  color: rgba(165, 180, 252, 0.4);
}

.ai-paint-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

.ui-overlay.light-theme .ai-paint-input {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(99, 102, 241, 0.25);
  color: #1a1a1a;
}

.ui-overlay.light-theme .ai-paint-input::placeholder {
  color: rgba(99, 102, 241, 0.35);
}

.ai-paint-btn {
  white-space: nowrap;
  background: linear-gradient(135deg, #6366f1, #a855f7) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.ai-paint-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.ai-paint-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ai-paint-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-paint-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-preset-btn {
  padding: 6px 12px;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.2);
  border-radius: 8px;
  color: #c7d2fe;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-preset-btn:hover {
  background: rgba(129, 140, 248, 0.25);
  border-color: rgba(129, 140, 248, 0.5);
  transform: translateY(-1px);
}

.ui-overlay.light-theme .ai-preset-btn {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
}

.ui-overlay.light-theme .ai-preset-btn:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.ai-paint-status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.ai-paint-status.hidden {
  display: none;
}

.ai-paint-status.info {
  background: rgba(33, 150, 243, 0.15);
  border: 1px solid rgba(33, 150, 243, 0.3);
  color: #90caf9;
}

.ai-paint-status.success {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: #a5d6a7;
}

.ai-paint-status.error {
  background: rgba(244, 67, 54, 0.15);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ef9a9a;
}

/* AI 绘画进度动画 */
.ai-paint-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(129, 140, 248, 0.2);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: ai-paint-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* AI 绘画画廊 */
.ai-paint-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ai-paint-gallery:empty {
  display: none;
}

.ai-gallery-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 8px;
  font-size: 12px;
  color: #c7d2fe;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-gallery-item:hover {
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.5);
  transform: translateY(-1px);
}

.ai-gallery-item.active {
  background: rgba(129, 140, 248, 0.3);
  border-color: #818cf8;
}

.ai-gallery-item .gallery-icon {
  font-size: 16px;
}

.ai-gallery-item .gallery-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-gallery-item .gallery-parts {
  font-size: 10px;
  opacity: 0.6;
}

.ui-overlay.light-theme .ai-gallery-item {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
}
