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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

header { text-align: center; margin-bottom: 28px; }
header h1 { font-size: 1.6rem; color: #fff; margin-bottom: 6px; }
.subtitle { font-size: 0.85rem; color: #888; }

.warning {
  background: #3a2a00;
  border: 1px solid #f5a623;
  color: #f5a623;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* 上传区域 */
.upload-area {
  border: 2px dashed #444;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: #6c5ce7;
  background: rgba(108, 92, 231, 0.06);
}
.upload-icon { font-size: 2.4rem; margin-bottom: 12px; }
.upload-hint { font-size: 0.8rem; color: #666; margin-top: 8px; }

/* 视频预览 */
.preview-section { margin-top: 20px; }
.video-wrapper {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video-wrapper video {
  width: 100%;
  display: block;
  border-radius: 8px;
}
.video-wrapper canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}
.video-info {
  font-size: 0.8rem;
  color: #888;
  margin-top: 8px;
  text-align: center;
}

/* 控制面板 */
.controls { margin-top: 20px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #bbb;
  margin-bottom: 14px;
  cursor: pointer;
}
.checkbox-item input { accent-color: #f39c12; }
.btn-group, .action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #6c5ce7; color: #fff; }
.btn-secondary { background: #2d2d44; color: #e0e0e0; }
.btn-outline { background: transparent; border: 1px solid #444; color: #aaa; }
.btn-success { background: #00b894; color: #fff; }

/* 选区信息 */
.selection-info {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #1a1a2e;
  border-radius: 6px;
}

/* 选区列表 */
.rect-list {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.rect-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 8px;
}
.btn-icon {
  width: 28px;
  height: 28px;
  border: 1px solid #555;
  border-radius: 6px;
  background: transparent;
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.btn-icon:hover { background: #2d2d44; color: #fff; }

.rect-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #bbb;
  cursor: pointer;
  transition: background 0.15s;
}
.rect-list-item:hover { background: rgba(108, 92, 231, 0.1); }
.rect-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rect-label { font-weight: 500; color: #ddd; min-width: 28px; }
.rect-coords { color: #888; font-family: monospace; font-size: 0.78rem; }
.rect-time { color: #6c5ce7; font-size: 0.78rem; margin-left: auto; }
.rect-time-edit {
  color: #6c5ce7;
  font-size: 0.78rem;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.time-input {
  width: 36px;
  padding: 1px 3px;
  border: 1px solid #444;
  border-radius: 3px;
  background: #1a1a2e;
  color: #a29bfe;
  font-size: 0.75rem;
  text-align: center;
  -moz-appearance: textfield;
}
.time-input::-webkit-inner-spin-button,
.time-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.time-input:focus { border-color: #6c5ce7; outline: none; }
.btn-rect-del {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-rect-del:hover { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }

/* 去除方式 */
.method-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.method-label { font-size: 0.9rem; color: #ccc; }
.radio-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}
.radio-item input { accent-color: #6c5ce7; }

/* 进度条 */
.progress-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: #2d2d44;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-text { font-size: 0.85rem; color: #aaa; min-width: 40px; }

/* 状态消息 */
.status-msg {
  font-size: 0.85rem;
  color: #888;
  min-height: 1.2em;
  margin-top: 8px;
}
.status-msg.error { color: #e74c3c; }
.status-msg.success { color: #00b894; }

/* 结果预览 */
.result-section {
  margin-top: 24px;
}
.result-section h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #ccc;
}
.result-section video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .container { padding: 16px 10px; }
  header h1 { font-size: 1.2rem; }
  .upload-area { padding: 32px 16px; }
  .btn { padding: 8px 14px; font-size: 0.82rem; }
  .method-group { flex-direction: column; align-items: flex-start; gap: 8px; }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
  .rect-coords { display: none; }
  .batch-item-meta { display: none; }
  .batch-item { font-size: 0.78rem; }
}

/* ========== 批量处理 ========== */
.batch-section { margin-top: 20px; }
.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.batch-header h3 { font-size: 1rem; color: #ccc; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

.batch-list {
  max-height: 320px;
  overflow-y: auto;
  background: #1a1a2e;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 16px;
}

.batch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: #bbb;
  transition: background 0.15s;
}
.batch-item:hover { background: rgba(108, 92, 231, 0.08); }
.batch-item + .batch-item { border-top: 1px solid #252540; }

.batch-item-icon { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }
.batch-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ddd;
}
.batch-item-meta { font-size: 0.78rem; color: #666; white-space: nowrap; }
.batch-item-status {
  font-size: 0.78rem;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}
.batch-item-status.waiting { color: #666; }
.batch-item-status.detecting { color: #f39c12; }
.batch-item-status.processing { color: #6c5ce7; }
.batch-item-status.done { color: #00b894; }
.batch-item-status.detected { color: #a29bfe; }
.batch-item-status.error { color: #e74c3c; }

.batch-item-progress {
  width: 80px;
  height: 4px;
  background: #2d2d44;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.batch-item-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border-radius: 2px;
  transition: width 0.3s;
}

.batch-item-actions { flex-shrink: 0; display: flex; gap: 4px; }
.batch-item-actions .btn-sm { padding: 3px 10px; }

.batch-edit-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #1a1a2e;
  border-radius: 8px;
  border: 1px solid #6c5ce7;
}
.batch-edit-name {
  font-size: 0.85rem;
  color: #a29bfe;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-controls { margin-bottom: 16px; }
.batch-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* 页脚 */
.site-footer {
  margin-top: 40px;
  padding: 20px 16px;
  border-top: 1px solid #252540;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.footer-links a {
  color: #666;
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: #a29bfe; }
.footer-copy { font-size: 0.75rem; color: #555; }
