/* ============================================================
   一键出片 Demo · 全部样式（移动端优先，卡片式）
   ============================================================ */

:root {
  --primary: #5b6cff;
  --primary-2: #8b5cf6;
  --primary-grad: linear-gradient(135deg, #5b6cff 0%, #8b5cf6 100%);
  --bg: #f3f4fb;
  --card: #ffffff;
  --text: #1f2333;
  --text-sub: #6b7280;
  --line: #e5e7f0;
  --success: #16a34a;
  --warn: #d97706;
  --info: #2563eb;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 35, 51, 0.06);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- 顶部 ---------- */
.app-header {
  background: var(--primary-grad);
  color: #fff;
  padding: 20px 18px 16px;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 16px rgba(91, 108, 255, 0.25);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.btn-auto {
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-auto:hover { filter: brightness(0.96); }
.btn-auto:disabled { opacity: 0.5; cursor: not-allowed; }
.app-title { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.app-subtitle { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.stepper {
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin-top: 16px;
  counter-reset: step;
}
.stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  opacity: 0.55;
  transition: opacity 0.2s;
}
.stepper-item .dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.stepper-item .label { font-size: 10px; }
.stepper-item.active { opacity: 1; }
.stepper-item.active .dot {
  background: #fff; color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.stepper-item.done { opacity: 0.85; }
.stepper-item.done .dot { background: rgba(255, 255, 255, 0.55); }

/* ---------- 主体 ---------- */
.app-main { flex: 1; padding: 18px 16px 90px; }

.step { display: none; animation: fadeIn 0.25s ease; }
.step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.step-title { font-size: 20px; font-weight: 800; }
.step-desc { font-size: 13px; color: var(--text-sub); margin: 6px 0 16px; line-height: 1.5; }

/* ---------- 表单分组与选择卡片 ---------- */
.form-group { margin-bottom: 18px; }
.group-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.choice-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.choice-card .icon { font-size: 24px; display: block; margin-bottom: 4px; }
.choice-card .name { font-size: 13px; font-weight: 600; }
.choice-card:hover { border-color: var(--primary-2); }
.choice-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.08), rgba(139, 92, 246, 0.08));
}
.choice-card.selected::after { content: "✓"; color: var(--primary); font-weight: 800; display: block; margin-top: 4px; }

/* ---------- 上传区 ---------- */
.upload-area {
  background: var(--card);
  border: 2px dashed #c7cdf5;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.upload-hint { text-align: center; color: var(--text-sub); font-size: 13px; padding: 8px 0; }
.upload-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.upload-preview .up-item { position: relative; aspect-ratio: 9/16; overflow: hidden; border-radius: 10px; }
.upload-preview .up-item.landscape { aspect-ratio: 16/9; }
.upload-preview img, .upload-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-preview .up-tag {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 10px; padding: 2px 6px; border-radius: 6px;
}

/* ---------- 进度条 ---------- */
.progress { margin: 14px 0; }
.progress-bar {
  height: 10px; background: #e8eaf6; border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: var(--primary-grad);
  border-radius: 999px;
  transition: width 0.15s linear;
}
.progress-text { font-size: 12px; color: var(--text-sub); margin-top: 6px; text-align: center; }

/* ---------- 分析结果 ---------- */
.analysis-result { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.result-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.result-class { font-size: 14px; font-weight: 700; color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #eef0ff; color: var(--primary);
  font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
}
.shot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shot-card { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; }
.shot-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-card .shot-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff; font-size: 10px; padding: 14px 6px 5px; text-align: center;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 4px 12px rgba(91,108,255,0.35); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: #fff; color: var(--text-sub); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.confirm-actions {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 18px;
}
.confirm-actions .btn { flex: 1; }

/* ---------- 高光片段 ---------- */
.clip-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.clip-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: all 0.15s;
}
.clip-card.unselected { opacity: 0.5; }
.clip-thumb {
  width: 92px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: #eef0ff;
}
.clip-thumb img, .clip-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-info { flex: 1; min-width: 0; }
.clip-info .clip-title { font-size: 14px; font-weight: 700; }
.clip-info .clip-meta { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.clip-type {
  font-size: 10px; background: #eef0ff; color: var(--primary);
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.clip-check {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #c7cdf5;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800; flex-shrink: 0;
  background: var(--primary-grad);
}

/* ---------- BGM ---------- */
.bgm-grid { display: flex; flex-direction: column; gap: 10px; }
.bgm-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow);
}
.bgm-cover {
  width: 48px; height: 48px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #a5b4fc, #c4b5fd);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.bgm-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bgm-info { flex: 1; min-width: 0; }
.bgm-name { font-size: 14px; font-weight: 700; }
.bgm-meta { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.bgm-card.selected { border-color: var(--primary); background: linear-gradient(135deg, rgba(91,108,255,0.08), rgba(139,92,246,0.08)); }
.bgm-card.selected::after { content: "✓"; color: var(--primary); font-weight: 800; font-size: 16px; }

/* ---------- 视频 ---------- */
.video-wrap {
  background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.result-video { width: 100%; aspect-ratio: 9/16; display: block; background: #000; }

/* ---------- 交付 ---------- */
.deliver-card {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 2px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.deliver-check { font-size: 42px; }
.deliver-heading { font-size: 18px; font-weight: 800; margin-top: 6px; color: var(--primary); }
.deliver-info { font-size: 13px; color: var(--text-sub); margin-top: 10px; line-height: 1.7; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  position: relative; padding: 8px 0 8px 22px;
  font-size: 12px; color: var(--text-sub);
}
.timeline-item::before {
  content: ""; position: absolute; left: 6px; top: 12px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--primary);
}
.timeline-item::after {
  content: ""; position: absolute; left: 10px; top: 22px; bottom: -6px;
  width: 1px; background: #dfe3f5;
}
.timeline-item:last-child::after { display: none; }
.timeline-item .tl-time { color: #9ca3af; margin-right: 6px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 84px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; z-index: 999; pointer-events: none;
}
.toast {
  background: rgba(31, 35, 51, 0.92); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
  max-width: 86%;
  text-align: center;
}
.toast.success { background: rgba(22, 163, 74, 0.95); }
.toast.info { background: rgba(37, 99, 235, 0.95); }
.toast.warn { background: rgba(217, 119, 6, 0.95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 1000; display: none; }
.modal-root.show { display: block; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45);
  animation: fadeIn 0.2s;
}
.modal-box {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  width: 86%; max-width: 380px;
  background: #fff; border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.modal-text { font-size: 13px; color: var(--text-sub); line-height: 1.6; }
.modal-input {
  width: 100%; margin-top: 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-family: inherit;
  resize: vertical;
}
.modal-input:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ---------- 全程操作记录 ---------- */
.log-panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 800;
  max-width: 480px; margin: 0 auto;
}
.log-toggle {
  width: 100%;
  background: rgba(31, 35, 51, 0.92); color: #fff;
  border: none; padding: 12px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.log-body {
  background: rgba(31, 35, 51, 0.97); color: #d1d5db;
  max-height: 200px; overflow-y: auto;
  padding: 12px;
}
.log-body.hidden { display: none; }
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-item { font-size: 11px; font-family: ui-monospace, Menlo, monospace; }
.log-item .log-time { color: #6b7280; margin-right: 6px; }

/* ---------- 占位块 ---------- */
.placeholder-box {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #e5e7f0, #d4d7ec);
  color: #6b7280;
  font-size: 12px; text-align: center;
  border-radius: 10px;
  padding: 8px;
  min-height: 56px;
}
.placeholder-box .ph-icon { font-size: 24px; }
.video-wrap .placeholder-box, .upload-preview .placeholder-box { aspect-ratio: 9/16; }

/* ---------- 底部导航 ---------- */
.app-footer {
  position: fixed; left: 0; right: 0; bottom: 44px;
  max-width: 480px; margin: 0 auto;
  display: flex; gap: 12px; padding: 10px 16px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  z-index: 700;
}
.app-footer .btn { flex: 1; }

/* ---------- 工具类 ---------- */
.hidden { display: none !important; }
