/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f6fa;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 32px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: #2563eb;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active { opacity: 0.7; transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }

.btn-danger  { background: #ef4444; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-ghost   { background: #f3f4f6; color: #374151; }
.btn-ghost:hover:not(:disabled) { background: #e5e7eb; }

.btn-full { width: 100%; }

/* ── Toggle group ─────────────────────────────────────────────────────────── */
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
}

.toggle-btn:active { opacity: 0.7; }

.toggle-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

/* ── Badge / Status ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-created   { background: #e0e7ff; color: #3730a3; }
.badge-queued    { background: #fef3c7; color: #92400e; }
.badge-running   { background: #fef9c3; color: #854d0e; }
.badge-done      { background: #dcfce7; color: #166534; }
.badge-failed    { background: #fee2e2; color: #991b1b; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.app-header .logo {
  font-size: 16px;
  font-weight: 700;
  color: #2563eb;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #555;
}

/* ── Alert / Error ────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }

.hidden { display: none !important; }

/* ── File upload zone ─────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fafafa;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.upload-zone p { color: #6b7280; font-size: 13px; margin-top: 6px; }

/* ── Task card ────────────────────────────────────────────────────────────── */
.task-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  padding: 16px;
  margin-bottom: 12px;
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.task-brief {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
  line-height: 1.4;
}

.task-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 10px;
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.download-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  color: #166534;
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.download-link:hover { opacity: 0.8; }

/* ── Style tag buttons ────────────────────────────────────────────────────── */
.style-tag {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
  font-family: inherit;
}

.style-tag:active { opacity: 0.7; }

.style-tag.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.style-tag:hover:not(.active) {
  border-color: #2563eb;
  color: #2563eb;
}

/* ── Style card (风格模板卡片) ──────────────────────────────────────────────── */
.style-card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
}

.style-card-emoji {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
}

.style-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  min-height: 78px;
  padding-top: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.style-card:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.12); }
.style-card:active { opacity: 0.8; transform: scale(0.97); }

.style-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

.style-card-name {
  font-size: 13px;
  font-weight: 700;
  color: inherit;
  line-height: 1.2;
}

.style-card-sub {
  font-size: 10px;
  color: #6b7280;
  margin-top: 3px;
  line-height: 1;
}

/* ── Number input row ─────────────────────────────────────────────────────── */
.num-row {
  display: flex;
  gap: 16px;
}

.num-row .form-group { flex: 1; }

/* ── Login page specific ──────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: #2563eb;
}

.login-logo p {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #9ca3af;
}

.empty-state p { margin-top: 8px; font-size: 13px; }

/* ── Skeleton loading ─────────────────────────────────────────────────────── */
.skeleton-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #f3f4f6;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  animation: skelFadeIn 0.3s ease both;
}

.skeleton-card:nth-child(2) { animation-delay: 0.06s; }
.skeleton-card:nth-child(3) { animation-delay: 0.12s; }

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

.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e9eaec 50%, #f3f4f6 75%);
  background-size: 300% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}

/* ── UI-6 Task card thumbnail ─────────────────────────────────────────────── */
.task-thumb {
  width: 54px;
  height: 96px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.task-thumb-placeholder {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #9ca3af;
}

.task-thumb-clickable {
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  position: relative;
}
.task-thumb-clickable:hover {
  opacity: 0.82;
  transform: scale(1.04);
}

/* ── UI-8 Inline video player ────────────────────────────────────────────── */
@keyframes inlinePlayerIn {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 600px; }
}
.inline-player {
  margin: 10px 0 4px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  animation: inlinePlayerIn 0.3s ease forwards;
}
.inline-player video {
  width: 100%;
  max-height: 70vh;
  display: block;
  border-radius: 10px 10px 0 0;
}
.inline-player-close {
  display: block;
  width: 100%;
  padding: 9px 0;
  background: #1f2937;
  color: #d1d5db;
  border: none;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.3px;
  border-radius: 0 0 10px 10px;
  transition: background 0.15s;
}
.inline-player-close:hover {
  background: #374151;
  color: #fff;
}

/* ── UI-1 Step progress indicator ────────────────────────────────────────── */
.step-progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 0 2px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #d1d5db;
  background: #fff;
  color: #9ca3af;
  transition: all 0.3s ease;
}

.step-dot.active {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
  animation: stepPulse 1.4s ease-in-out infinite;
}

.step-dot.done {
  border-color: #10b981;
  background: #10b981;
  color: #fff;
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
  50%       { box-shadow: 0 0 0 6px rgba(99,102,241,0.08); }
}

.step-label {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  transition: color 0.3s;
}

.step-label.active { color: #6366f1; font-weight: 600; }
.step-label.done   { color: #10b981; }

.step-connector {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin: 0 4px;
  margin-bottom: 14px;
  border-radius: 1px;
  transition: background 0.3s;
  min-width: 20px;
}

.step-connector.done { background: #10b981; }

/* ── Tag auto-fill flash ──────────────────────────────────────────────────── */
@keyframes tagFlash {
  0%   { transform: scale(1);    box-shadow: none; }
  30%  { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
  100% { transform: scale(1);    box-shadow: none; }
}
.tag-flash {
  animation: tagFlash 0.35s ease both;
}

/* ── Task adjust section ─────────────────────────────────────────────────── */
.task-adjust {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adjust-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.adjust-toggle:hover { color: #374151; }

.adjust-arrow {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 400;
}

.adjust-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.adjust-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adjust-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  width: 32px;
  flex-shrink: 0;
}

/* ── Music picker ─────────────────────────────────────────────────────────── */
.music-picker {
  padding: 4px 0 2px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
}

.music-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.music-track:hover { background: #f3f4f6; }
.music-track.selected { background: #eff6ff; border: 1px solid #bfdbfe; }

.music-preview-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #374151;
  line-height: 1;
}

.music-preview-btn:hover { background: #f3f4f6; border-color: #9ca3af; }

.music-track-name {
  font-size: 12px;
  color: #374151;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Voice actor cards (6.13) ────────────────────────────────────────────── */
.voice-actor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px 8px 12px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  min-width: 72px;
  transition: all 0.15s;
  user-select: none;
}

.voice-actor-card:hover:not(.active) {
  border-color: #93c5fd;
  background: #f0f9ff;
}

.voice-actor-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.14);
}

.voice-name {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  line-height: 1.3;
}

.voice-actor-card.active .voice-name { color: #1d4ed8; }

.voice-desc {
  font-size: 10px;
  color: #9ca3af;
  line-height: 1;
}

.voice-preview-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 8px;
  color: #6b7280;
  padding: 0;
  line-height: 1;
  transition: all 0.12s;
}

.voice-preview-btn:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; }
.voice-preview-btn.playing { background: #dbeafe; border-color: #3b82f6; color: #2563eb; }

/* ── Script / voiceover section ──────────────────────────────────────────── */
.task-script {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.script-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .num-row { flex-direction: column; gap: 0; }
  .task-card-header { flex-direction: column; }
}
