/* 智影工厂 · 移动端优先设计系统 */
:root {
  --primary: #1b6dff;
  --primary-dark: #0f56d8;
  --primary-soft: #e8f0ff;
  --aqua: #37bfe3;
  --bg: #f2f5fb;
  --card: #ffffff;
  --text: #12213a;
  --muted: #6b7a93;
  --line: #e3e9f4;
  --success: #12a150;
  --success-soft: #e3f7ec;
  --warning: #b97a06;
  --warning-soft: #fdf3dd;
  --danger: #d8393b;
  --danger-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(18, 33, 58, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #dfe6f2;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  touch-action: manipulation;
  overscroll-behavior: none;
}
.hidden { display: none !important; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 24px rgba(18, 33, 58, 0.08);
}
.page { padding: 16px 16px 92px; }
.page.no-tab { padding-bottom: 24px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
}
.tab-icon { font-size: 20px; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 12px; color: var(--primary); font-weight: 500; text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--aqua)); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field input[type="text"], .field input[type="datetime-local"], .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fbfcfe;
  color: var(--text);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-yellow { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: #eef1f7; color: var(--muted); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty .empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty .empty-hint { font-size: 13px; margin-top: 4px; }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  width: calc(100% - 48px);
  background: rgba(18, 33, 58, 0.92);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 200;
  text-align: center;
}
.toast.warning { background: #b97a06; }
.toast.success { background: var(--success); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 33, 58, 0.45);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  max-height: 82dvh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.modal h3 { font-size: 16px; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e6ebf5;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--aqua));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.topic { background: var(--primary-soft); border: none; color: var(--primary); }

/* ---------- 页头 ---------- */
.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.page-header .back {
  border: none;
  background: var(--card);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 17px;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow);
}
.page-header h2 { font-size: 18px; }
.page-header .spacer { flex: 1; }

/* ---------- 工作台 ---------- */
.hero {
  background: linear-gradient(135deg, #1b6dff, #37bfe3);
  border-radius: var(--radius);
  color: #fff;
  padding: 20px 18px;
  margin-bottom: 14px;
}
.hero .hero-title { font-size: 20px; font-weight: 800; }
.hero .hero-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.industry-switch { display: flex; gap: 8px; margin-top: 14px; }
.industry-switch .chip { background: rgba(255,255,255,0.18); border: none; color: #fff; }
.industry-switch .chip.active { background: #fff; color: var(--primary); font-weight: 700; }

.tpl-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.tpl-card {
  flex: 0 0 150px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  background: linear-gradient(160deg, #f6f9ff, #eef7fd);
}
.tpl-card .tpl-name { font-weight: 700; font-size: 14px; }
.tpl-card .tpl-style { font-size: 12px; color: var(--primary); margin: 2px 0 6px; }
.tpl-card .tpl-palette { font-size: 11px; color: var(--muted); line-height: 1.5; }

.work-card { display: flex; gap: 12px; align-items: center; }
.work-cover {
  width: 64px;
  height: 96px;
  border-radius: 10px;
  background: #dde5f2;
  object-fit: cover;
  flex-shrink: 0;
}
.work-card .work-info { flex: 1; min-width: 0; }
.work-card .work-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-card .work-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 资产库 ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.asset-card { border-radius: 12px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); position: relative; }
.asset-card img, .asset-card .asset-thumb-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dde5f2;
  font-size: 28px;
  color: var(--muted);
}
.asset-card .asset-name { font-size: 11px; padding: 6px 8px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .asset-tags { font-size: 10px; color: var(--muted); padding: 0 8px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card .asset-type-badge { position: absolute; top: 6px; left: 6px; }
.asset-card.selected { outline: 3px solid var(--primary); }
.asset-card .select-mark {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.85); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent;
}
.asset-card.selected .select-mark { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 录音 ---------- */
.recorder { text-align: center; padding: 12px 0; }
.recorder .read-text {
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  text-align: left;
  margin-bottom: 12px;
}
.record-btn {
  width: 76px; height: 76px; border-radius: 50%;
  border: none; font-size: 26px; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--aqua));
  color: #fff;
  box-shadow: 0 4px 14px rgba(27, 109, 255, 0.4);
}
.record-btn.recording { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.record-status { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ---------- 步进条 ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps .step-dot {
  flex: 1; height: 5px; border-radius: 999px; background: #dde5f2;
}
.steps .step-dot.done { background: var(--primary); }
.step-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ---------- 预览页 ---------- */
.player-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.player-wrap video { width: 100%; display: block; aspect-ratio: 9 / 16; object-fit: contain; }
.subtitle-overlay {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  text-align: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.9);
  pointer-events: none;
}
.subtitle-cue {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.subtitle-cue .cue-time { font-size: 11px; color: var(--muted); width: 74px; flex-shrink: 0; }
.subtitle-cue input {
  flex: 1; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 8px; font-size: 16px; font-family: inherit; background: transparent;
}
.subtitle-cue input:focus { border-color: var(--primary); background: #fbfcfe; outline: none; }
.cover-choices { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.cover-choices img {
  width: 84px; height: 132px; object-fit: cover; border-radius: 10px;
  border: 3px solid transparent; cursor: pointer; flex-shrink: 0;
}
.cover-choices img.active { border-color: var(--primary); }

/* ---------- 发布页 ---------- */
.platform-card { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.platform-card:last-child { border-bottom: none; }
.platform-logo {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; font-weight: 700;
}
.platform-logo.douyin { background: #161823; }
.platform-logo.shipinhao { background: #07c160; }
.platform-logo.xiaohongshu { background: #ff2442; }
.platform-card .platform-info { flex: 1; min-width: 0; }
.platform-card .platform-name { font-weight: 700; font-size: 14px; }
.platform-card .platform-status { font-size: 12px; color: var(--muted); }

/* ---------- 生成状态页 ---------- */
.gen-panel { text-align: center; padding: 30px 10px; }
.gen-icon { font-size: 52px; margin-bottom: 14px; }
.gen-stage { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.gen-tip { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* ---------- 表单行 ---------- */
.row { display: flex; gap: 10px; align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.tag-pill {
  display: inline-block; background: #eef1f7; color: var(--muted);
  font-size: 11px; border-radius: 999px; padding: 1px 8px; margin: 2px 4px 2px 0;
}
.agreement-box {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-size: 12px; color: var(--muted);
  max-height: 150px; overflow-y: auto; line-height: 1.7;
}
.check-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; }
.check-row input { margin-top: 4px; }
.warn-box {
  background: var(--warning-soft); border: 1px solid #f2ddae; color: var(--warning);
  border-radius: 12px; padding: 12px; font-size: 13px; margin-bottom: 12px;
}
.danger-box {
  background: var(--danger-soft); border: 1px solid #f3c1c2; color: var(--danger);
  border-radius: 12px; padding: 12px; font-size: 13px; margin-bottom: 12px;
}
.avatar-photo {
  width: 96px; height: 128px; border-radius: 14px; object-fit: cover;
  background: #dde5f2;
}
.knowledge-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.knowledge-item:last-child { border-bottom: none; }
.knowledge-item .k-title { font-weight: 700; font-size: 14px; }
.knowledge-item .k-content { font-size: 12px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
