/* ============================================================
   ui-refine.css — 前端体验优化层 v2（最后加载，只做增强不改结构）
   1) 按钮体系：渐变主按钮 / 描边次按钮 / 状态齐全
   2) 表格与列表：任务历史卡片、搜索、分页、空状态、表单网格
   3) UI 布局：页头、流程侧栏、区块图标、上传区、底部操作栏
   ============================================================ */

:root {
  --ui-radius: 10px;
  --ui-radius-lg: 14px;
  --ui-btn-h: 44px;
  --ui-green-1: #0c9468;
  --ui-green-2: #087a5b;
  --ui-green-3: #06704f;
  --ui-green-soft: #e7f3ed;
  --ui-green-softer: #f0f8f3;
  --ui-focus-ring: 0 0 0 4px rgb(11 110 174 / 16%);
  --ui-ease: 180ms ease;
}

/* ============================================================
   1. 按钮体系
   ============================================================ */

.primary-button,
.secondary-button {
  min-height: var(--ui-btn-h);
  padding: 0 20px;
  gap: 8px;
  border-radius: var(--ui-radius);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: background var(--ui-ease), border-color var(--ui-ease),
    color var(--ui-ease), box-shadow var(--ui-ease), transform 120ms ease,
    opacity var(--ui-ease);
}

/* 主按钮：绿色渐变 + 投影，页面里最显眼的元素 */
.primary-button {
  border: 1px solid var(--ui-green-3);
  background: linear-gradient(180deg, var(--ui-green-1) 0%, var(--ui-green-2) 100%);
  color: #fff;
  box-shadow: 0 2px 4px rgb(8 122 91 / 24%), 0 8px 20px rgb(8 122 91 / 18%);
  text-shadow: 0 1px 1px rgb(0 0 0 / 8%);
}

.primary-button:hover:not(:disabled) {
  border-color: #055a3f;
  background: linear-gradient(180deg, #0da473 0%, #098764 100%);
  box-shadow: 0 3px 6px rgb(8 122 91 / 26%), 0 12px 26px rgb(8 122 91 / 22%);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  background: linear-gradient(180deg, #087a5b 0%, #06704f 100%);
  box-shadow: 0 1px 2px rgb(8 122 91 / 20%);
  transform: translateY(0);
  opacity: 1;
}

/* 次按钮：白底描边，hover 变绿 */
.secondary-button {
  border: 1.5px solid #c6d6ce;
  background: #fff;
  color: #2b3a33;
  box-shadow: 0 1px 2px rgb(20 35 30 / 5%);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--ui-green-2);
  background: var(--ui-green-softer);
  color: var(--ui-green-2);
  box-shadow: 0 2px 6px rgb(8 122 91 / 10%);
}

.secondary-button:active:not(:disabled) {
  background: var(--ui-green-soft);
  transform: translateY(0);
  opacity: 1;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  border-color: #d5ded9;
  background: #eef2ef;
  color: #93a29a;
  box-shadow: none;
  opacity: 1;
  text-shadow: none;
  transform: none;
}

.primary-button:disabled img,
.secondary-button:disabled img {
  filter: none;
  opacity: 0.5;
}

.primary-button img,
.secondary-button img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.primary-button img {
  filter: brightness(0) invert(1);
}

/* 宽度归位：这些容器里的按钮按内容取宽，不再撑满整行 */
.settings-actions .primary-button,
.settings-actions .secondary-button,
.settings-section > .secondary-button,
.task-history-search-control .secondary-button,
.task-history-pagination .secondary-button,
.generation-dialog-actions .primary-button,
.generation-dialog-actions .secondary-button,
.result-actions .primary-button,
.result-actions .secondary-button,
.wizard-action-inner .primary-button,
.wizard-action-inner .secondary-button {
  width: auto;
}

/* 底部操作栏主按钮：加大加重，一眼看到下一步 */
.wizard-action-inner .primary-button {
  min-height: 52px;
  padding: 0 34px;
  border-radius: 12px;
  font-size: 15px;
}

.wizard-action-inner .secondary-button {
  min-height: 52px;
  padding: 0 24px;
  border-radius: 12px;
}

/* 设置页「获取模型」按钮：绿色描边小按钮 */
.settings-section > .secondary-button {
  margin-top: 20px;
  padding: 0 16px;
  border-color: #9fc7b6;
  color: var(--ui-green-2);
}

.settings-section > .secondary-button:hover:not(:disabled) {
  border-color: var(--ui-green-2);
  background: var(--ui-green-soft);
}

.settings-section > .secondary-button img {
  filter: invert(32%) sepia(79%) saturate(746%) hue-rotate(126deg)
    brightness(91%) contrast(92%);
}

/* 设置页底部操作 */
.settings-actions {
  gap: 12px;
}

.settings-actions .secondary-button,
.settings-actions .primary-button {
  min-width: 132px;
  padding: 0 26px;
}

/* 生成结果操作：并排排列 */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-actions .primary-button,
.result-actions .secondary-button {
  flex: 0 0 auto;
}

/* 生成弹窗里的操作按钮 */
.generation-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.generation-dialog-actions .primary-button,
.generation-dialog-actions .secondary-button {
  min-width: 136px;
}

/* 各步骤确认区按钮 */
.review-actions .primary-button,
.review-actions .secondary-button {
  min-height: 44px;
  font-size: 13px;
}

/* 文字型按钮 / 危险操作 */
.text-action {
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 600;
  transition: background var(--ui-ease), color var(--ui-ease);
}

.text-action:hover {
  background: var(--ui-green-softer);
}

.danger-action,
.text-action.danger-action {
  color: var(--ag-danger);
}

.danger-action:hover,
.text-action.danger-action:hover {
  background: #fff0ee;
  color: #8f1d13;
}

/* 图标按钮 hover */
.icon-button:hover {
  background: var(--ui-green-softer);
}

/* ============================================================
   2. 表格与列表（生成任务 / 表单网格）
   ============================================================ */

/* —— 计数器：绿色胶囊徽标 —— */
.task-history-heading {
  align-items: center;
}

.task-history-count {
  min-width: 0;
  padding: 10px 20px;
  border: 1px solid #cfe2d8;
  border-left: 1px solid #cfe2d8;
  border-radius: 999px;
  background: linear-gradient(180deg, #f2faf5 0%, #e7f3ed 100%);
  box-shadow: 0 2px 6px rgb(8 122 91 / 8%);
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.task-history-count strong {
  color: var(--ui-green-2);
  font-size: 22px;
}

.task-history-count span {
  margin-top: 0;
  color: #4c6353;
  font-size: 13px;
}

/* —— 搜索行 —— */
.task-history-search > label {
  color: var(--ag-ink);
}

.task-history-search-control {
  align-items: stretch;
}

.task-history-search-control input {
  min-height: 46px;
  border: 1.5px solid #c6d6ce;
  border-radius: var(--ui-radius);
  background: #fbfdfc;
}

.task-history-search-control input:hover {
  border-color: #9db3a9;
}

.task-history-search-control input:focus {
  border-color: var(--ui-green-2);
  background: #fff;
  box-shadow: 0 0 0 4px rgb(8 122 91 / 12%);
}

.task-history-search-control .secondary-button {
  min-height: 46px;
  padding: 0 24px;
  white-space: nowrap;
}

/* —— 任务卡片网格 —— */
.task-history-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.task-history-card {
  border: 1px solid var(--ag-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: 0 1px 3px rgb(20 35 30 / 6%);
}

.task-history-card:hover {
  border-color: var(--ui-green-2);
  box-shadow: 0 14px 30px rgb(8 122 91 / 14%);
  transform: translateY(-3px);
}

.task-history-card > a:focus-visible {
  outline: 3px solid rgb(8 122 91 / 26%);
  outline-offset: -3px;
  border-radius: var(--ui-radius-lg);
}

.task-history-card-media {
  border-bottom-color: var(--ag-border);
  background: linear-gradient(180deg, #f6faf7 0%, #eef5f0 100%);
}

.task-history-card-media > span {
  border-color: #cfe2d8;
  border-radius: var(--ui-radius);
  background: #fff;
}

.task-history-card-content h2 {
  color: var(--ag-ink);
  font-size: 16px;
  font-weight: 650;
}

.task-history-card-content > p {
  color: var(--ag-muted);
}

.task-history-card-meta {
  border-top-color: #edf2ee;
  color: var(--ag-muted);
}

/* 时长胶囊：实心绿底白字，列表里最醒目的标记 */
.task-history-card-meta span {
  background: var(--ui-green-2);
  color: #fff;
  font-weight: 650;
}

/* —— 分页：胶囊按钮 —— */
.task-history-pagination {
  display: flex;
  margin-top: 28px;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.task-history-pagination .secondary-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
}

.task-history-pagination .secondary-button img {
  width: 16px;
  height: 16px;
}

#taskHistoryPageLabel {
  color: var(--ag-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* —— 空状态与加载状态 —— */
.task-history-empty > span {
  width: 68px;
  height: 68px;
  border: 1px solid #cfe2d8;
  border-radius: 50%;
  background: var(--ui-green-soft);
}

.task-history-empty strong {
  color: var(--ag-ink);
}

.task-history-empty p {
  color: var(--ag-muted);
}

.task-history-status {
  color: var(--ag-muted);
}

/* —— 表单网格（信息“表格”） —— */
.field-grid {
  gap: 18px;
}

.field label {
  margin-bottom: 8px;
  color: #22332b;
  font-weight: 650;
}

.field input,
.field textarea,
.settings-form .field select {
  min-height: 46px;
  border: 1.5px solid #c6d6ce;
  border-radius: var(--ui-radius);
  background: #fbfdfc;
}

.field input:hover,
.field textarea:hover,
.settings-form .field select:hover {
  border-color: #9db3a9;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--ui-green-2);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgb(8 122 91 / 12%);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9aa8a1;
}

/* 卖点行：输入框与删除键严格对齐 */
.selling-point-row {
  align-items: stretch;
}

.selling-point-row input {
  min-height: var(--ui-btn-h);
}

.selling-point-remove {
  width: var(--ui-btn-h);
  min-height: var(--ui-btn-h);
  border-radius: var(--ui-radius);
}

/* 添加卖点按钮：虚线描边，像是"再加一行" */
.selling-points-add {
  border-style: dashed !important;
  border-color: #9fc7b6 !important;
  color: var(--ui-green-2) !important;
}

.selling-points-add:hover:not(:disabled) {
  border-color: var(--ui-green-2) !important;
  background: var(--ui-green-softer) !important;
}

/* ============================================================
   3. UI 布局
   ============================================================ */

/* —— 页头：轻投影 + 胶囊导航 —— */
.app-header {
  box-shadow: 0 1px 8px rgb(20 35 30 / 6%);
}

.task-history-button,
.restart-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.task-history-button:hover,
.restart-button:hover {
  border-color: #cfe2d8;
  background: var(--ui-green-softer);
  color: var(--ui-green-2);
}

.task-history-button[aria-current="page"] {
  border-color: #cfe2d8;
  background: var(--ui-green-soft);
  color: var(--ui-green-2);
}

/* —— 页面眉线：绿色小胶囊 —— */
.eyebrow {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ui-green-soft);
  color: var(--ui-green-2);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* —— 流程侧栏（桌面端）：圆形序号 + 左高亮条 —— */
@media (min-width: 1024px) {
  .workflow-steps,
  .viewing-task .workflow-steps {
    padding: 14px 12px 16px;
    border: 1px solid var(--ag-border);
    border-radius: var(--ui-radius-lg);
    background: #fff;
    box-shadow: 0 2px 10px rgb(20 35 30 / 6%);
  }

  .workflow-steps::before {
    padding: 2px 12px 12px;
    color: var(--ag-muted);
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  .editor .workflow-steps button {
    min-height: 54px;
    padding: 8px 12px;
    grid-template-columns: 34px minmax(0, 1fr) 16px;
    border-radius: var(--ui-radius);
  }

  .editor .workflow-steps button:hover:not(:disabled) {
    background: var(--ui-green-softer);
  }

  /* 序号：圆形芯片 */
  .editor .workflow-steps span,
  .viewing-task .editor .workflow-steps span {
    width: 34px;
    height: 34px;
    border: 1.5px solid #ccd8d2;
    border-radius: 50%;
    background: #fff;
    color: var(--ag-muted);
    font-weight: 700;
  }

  /* 普通步骤文字：清晰可读 */
  .editor .workflow-steps strong,
  .viewing-task .editor .workflow-steps strong {
    color: #3d4a44;
    font-weight: 600;
  }

  /* 锁定步骤：淡但仍可辨认 */
  .editor .workflow-steps li.locked button {
    opacity: 0.72;
  }

  .editor .workflow-steps li.locked strong {
    color: #6b7873;
    font-weight: 500;
  }

  /* 当前步：绿底 + 左侧高亮条 + 实心绿序号 */
  .editor .workflow-steps li.current button {
    background: var(--ui-green-soft);
    box-shadow: inset 3px 0 0 var(--ui-green-2);
  }

  .editor .workflow-steps li.current span {
    border-color: var(--ui-green-2);
    background: linear-gradient(180deg, var(--ui-green-1) 0%, var(--ui-green-2) 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgb(8 122 91 / 30%);
  }

  .editor .workflow-steps li.current strong {
    color: var(--ui-green-2);
    font-weight: 700;
  }

  /* 已完成步：浅绿序号 */
  .editor .workflow-steps li.complete span {
    border-color: #b8decf;
    background: #e7f5ee;
    color: var(--ui-green-2);
  }

  .editor .workflow-steps li.complete strong {
    color: #315f4e;
  }

  .editor .workflow-steps li.complete + li::before {
    background: #b8decf;
  }

  /* 步骤小图标 */
  .step-nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.42;
  }

  .editor .workflow-steps li.current .step-nav-icon {
    opacity: 1;
    filter: invert(32%) sepia(79%) saturate(746%) hue-rotate(126deg)
      brightness(91%) contrast(92%);
  }
}

/* —— 区块标题图标：绿底白图标，成为视觉锚点 —— */
.section-heading > .section-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ui-green-3);
  border-radius: var(--ui-radius);
  background: linear-gradient(180deg, var(--ui-green-1) 0%, var(--ui-green-2) 100%);
  box-shadow: 0 2px 6px rgb(8 122 91 / 22%);
}

.section-heading > .section-icon img {
  width: 19px;
  height: 19px;
  filter: brightness(0) invert(1);
}

/* 覆盖 accents 层里按区块 ID 定义的浅色底（ID 优先级更高，需点名覆盖） */
#productFactsSection .section-heading > .section-icon {
  border-color: #0b5f59;
  background: linear-gradient(180deg, #14a393 0%, #0f766e 100%);
  box-shadow: 0 2px 6px rgb(15 118 110 / 22%);
}

#creativeSettingsSection .section-heading > .section-icon {
  border-color: #9a4f08;
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 2px 6px rgb(180 83 9 / 22%);
}

/* 子区块图标（场景参考等）：浅绿底 + 深绿图标 */
.material-subheading .section-icon {
  border: 1px solid #cfe2d8;
  border-radius: var(--ui-radius);
  background: var(--ui-green-soft);
}

.material-subheading .section-icon img {
  filter: invert(32%) sepia(79%) saturate(746%) hue-rotate(126deg)
    brightness(91%) contrast(92%);
}

/* —— 上传区：更明显的虚线框 + 悬停变绿 —— */
.dropzone {
  border: 2px dashed #a9c4b7;
  border-radius: var(--ui-radius-lg);
  background: linear-gradient(180deg, #fbfdfc 0%, #f4faf6 100%);
  transition: border-color var(--ui-ease), background var(--ui-ease),
    box-shadow var(--ui-ease);
}

.dropzone:hover {
  border-color: var(--ui-green-2);
  background: var(--ui-green-softer);
  box-shadow: 0 4px 14px rgb(8 122 91 / 8%);
}

/* —— 底部操作栏 —— */
.wizard-action-bar {
  border-top-color: rgb(20 35 30 / 8%);
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 -6px 24px rgb(20 35 30 / 6%);
}

/* —— 设置页区块图标 —— */
.settings-section-title > span {
  border: 1px solid var(--ui-green-3);
  border-radius: var(--ui-radius);
  background: linear-gradient(180deg, var(--ui-green-1) 0%, var(--ui-green-2) 100%);
  box-shadow: 0 2px 6px rgb(8 122 91 / 22%);
}

.settings-section-title > span img {
  filter: brightness(0) invert(1);
}

.settings-form .field select:focus {
  border-color: var(--ui-green-2);
  box-shadow: 0 0 0 4px rgb(8 122 91 / 12%);
}

.password-control .icon-button:hover {
  border-color: #9db3a9;
}

/* —— 细滚动条（桌面指针设备） —— */
@media (pointer: fine) {
  * {
    scrollbar-width: thin;
    scrollbar-color: #c3d1ca transparent;
  }
}

/* —— 小屏兜底：底部按钮平分宽度 —— */
@media (max-width: 640px) {
  .wizard-action-inner .primary-button,
  .wizard-action-inner .secondary-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 12px;
  }

  .settings-actions {
    flex-direction: column-reverse;
  }

  .settings-actions .secondary-button,
  .settings-actions .primary-button {
    width: 100%;
  }
}

/* ============================================================
   v3 丰富层：页面氛围 / 区块卡片化 / 分区配色 / 视觉元素
   ============================================================ */

/* —— 页面背景：浅色基调上叠两束装饰光 —— */
body {
  background:
    radial-gradient(1100px 480px at 88% -8%, rgb(8 122 91 / 8%), transparent 62%),
    radial-gradient(880px 420px at -8% 4%, rgb(11 110 174 / 6%), transparent 58%),
    var(--ag-bg);
}

/* —— 品牌标：渐变 + 投影 —— */
.brand-mark {
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ui-green-1), var(--ui-green-2));
  box-shadow: 0 2px 8px rgb(8 122 91 / 30%);
}

/* —— 标题区能力徽章（新增元素） —— */
.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  margin: 16px 0 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.hero-highlights li {
  display: inline-flex;
  padding: 7px 14px;
  align-items: center;
  gap: 7px;
  border: 1px solid #cfe2d8;
  border-radius: 999px;
  background: #fff;
  color: #3d4a44;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(20 35 30 / 6%);
}

.hero-highlights img {
  width: 15px;
  height: 15px;
  filter: invert(32%) sepia(79%) saturate(746%) hue-rotate(126deg)
    brightness(91%) contrast(92%);
}

/* —— 布局重排：表单不再是"一整张白纸"，每个区块独立成卡 —— */
.editor {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.page-heading {
  margin-bottom: 24px;
  padding: 8px 4px 0;
  border-bottom: 0;
}

.form-section {
  position: relative;
  margin: 0 0 20px;
  padding: 26px 30px 28px;
  border: 1px solid var(--ag-border);
  border-top: 3px solid var(--ui-green-2);
  border-radius: var(--ui-radius-lg);
  background: #fff;
  box-shadow: 0 2px 12px rgb(20 35 30 / 6%);
}

/* 分区配色：商品事实 = 青，剧情方向 = 橙 */
#productFactsSection.form-section {
  border-top-color: #0f766e;
}

#creativeSettingsSection.form-section {
  border-top-color: #c2610c;
}

/* —— 卡片头：图标 + 编号胶囊 + 标题 + 分割线 —— */
.section-heading {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf2ee;
}

.section-step {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ui-green-soft);
  color: var(--ui-green-2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

#productFactsSection .section-step {
  background: #e6f4f2;
  color: #0f766e;
}

#creativeSettingsSection .section-step {
  background: #fdf1e2;
  color: #b45309;
}

/* —— 表单区加宽，减少两侧死白 —— */
#productFactsSection .field-grid {
  width: min(100%, 880px);
}

.product-upload-shell {
  width: min(100%, 880px);
}

/* —— 场景参考子区块：虚线内嵌面板，层次更清楚 —— */
.material-subsection {
  margin-top: 24px;
  padding: 20px 22px 22px;
  border: 1px dashed #cfe2d8;
  border-radius: var(--ui-radius-lg);
  background: #fbfdfc;
}

/* —— 卖点行：自动序号圆点（纯 CSS，不动 JS） —— */
.selling-points-list {
  counter-reset: selling-point;
}

.selling-point-row {
  grid-template-columns: 30px minmax(0, 1fr) 44px;
  counter-increment: selling-point;
}

.selling-point-row::before {
  display: grid;
  width: 26px;
  height: 26px;
  align-self: center;
  place-items: center;
  border: 1px solid #cfe2d8;
  border-radius: 50%;
  background: var(--ui-green-soft);
  color: var(--ui-green-2);
  content: counter(selling-point);
  font-size: 12px;
  font-weight: 750;
}

/* —— 剧情方向选项：更立体的卡片 + 橙色选中态 —— */
.story-option {
  border: 1.5px solid var(--ag-border);
  border-radius: var(--ui-radius-lg);
  background: #fff;
  box-shadow: 0 1px 3px rgb(20 35 30 / 4%);
  transition: border-color var(--ui-ease), box-shadow var(--ui-ease),
    transform 120ms ease, background var(--ui-ease);
}

.story-option:hover {
  border-color: #d9a566;
  box-shadow: 0 6px 16px rgb(194 97 12 / 10%);
  transform: translateY(-1px);
}

.story-option:has(input:checked) {
  border-color: #c2610c;
  background: #fdf3e3;
  box-shadow: inset 0 0 0 1px #c2610c, 0 4px 12px rgb(194 97 12 / 10%);
}

.story-option:has(input:checked) span {
  color: #9a4f08;
}

/* —— 生成设置区：开关行与折叠面板卡片化 —— */
.advanced-settings {
  margin-top: 18px;
  padding: 6px 18px;
  border: 1px solid var(--ag-border);
  border-radius: var(--ui-radius-lg);
  background: #fbfdfc;
}

.toggle-row {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--ag-border);
  border-radius: var(--ui-radius);
  background: #fff;
}

/* —— 右侧预览面板：卡片加重 + 空状态更精致 —— */
.preview-panel {
  border: 1px solid var(--ag-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: 0 4px 20px rgb(20 35 30 / 8%);
}

.preview-heading {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf2ee;
}

.status-label {
  border-radius: 999px;
  font-weight: 650;
}

.empty-preview .preview-play {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--ui-green-1), var(--ui-green-2));
  box-shadow: 0 8px 18px rgb(8 122 91 / 28%);
}

.empty-preview .preview-play img {
  filter: brightness(0) invert(1);
}

.empty-preview strong {
  color: #2b3a33;
}

.video-stage {
  border-radius: var(--ui-radius-lg);
}

/* —— 成片时长：紧凑的三段式选择器 —— */
.duration-setting {
  display: block;
  min-height: 0;
  margin-top: 20px;
  padding-top: 18px;
}

.duration-setting legend {
  width: 100%;
  margin-bottom: 10px;
  color: #34443d;
  font-size: 13px;
  font-weight: 700;
}

.duration-options {
  display: grid;
  width: min(100%, 320px);
  padding: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 0;
  border-radius: 18px;
  background: #eef1f6;
  box-shadow: inset 0 1px 2px rgb(79 70 229 / 4%);
}

.duration-options label {
  min-width: 0;
  border-radius: 14px;
}

.editor .duration-options input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
  white-space: nowrap;
}

.duration-options span {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  color: #5f6b80;
  font-size: 14px;
  font-weight: 650;
  transition: color 200ms ease-in-out, background 200ms ease-in-out,
    box-shadow 200ms ease-in-out, transform 200ms ease-in-out;
}

.duration-options label:hover input:not(:checked):not(:disabled) + span {
  background: rgb(255 255 255 / 64%);
  color: #4b5568;
  box-shadow: 0 8px 20px rgb(99 102 241 / 10%);
  transform: translateY(-1px);
}

.duration-options input:checked + span {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 10px 24px rgb(79 70 229 / 16%),
    0 3px 8px rgb(148 163 184 / 22%);
}

.duration-options label:active input:not(:disabled) + span {
  box-shadow: inset 0 2px 5px rgb(79 70 229 / 10%);
  transform: scale(0.98);
}

.duration-options label:has(input:disabled) {
  cursor: not-allowed;
}

.duration-options input:disabled + span {
  background: transparent;
  color: #a3aea9;
  box-shadow: none;
}

.duration-options label:has(input:disabled):active span {
  transform: none;
}

.duration-options input:focus-visible + span {
  outline: 0;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 22%),
    0 10px 24px rgb(79 70 229 / 16%);
}

/* ============================================================
   8. 人物设置：清晰的工具条、角色编辑区和人物库入口
   ============================================================ */

.creative-control-grid {
  max-width: 660px;
  margin-top: 24px;
  padding: 0;
  grid-template-columns: minmax(340px, 420px) 200px;
  align-items: end;
  justify-content: start;
  gap: 24px;
}

.creative-control-grid .choice-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.creative-control-grid legend,
.creative-control-grid > .field > label {
  display: block;
  margin: 0 0 8px;
  color: #34443d;
  font-size: 13px;
  font-weight: 700;
}

.creative-control-grid .segmented-options {
  padding: 6px;
  gap: 4px;
  border: 0;
  border-radius: 18px;
  background: #eef1f6;
  box-shadow: inset 0 1px 2px rgb(79 70 229 / 4%);
}

.creative-control-grid .segmented-options label {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  color: #5f6b80;
  transition: color 200ms ease-in-out, background 200ms ease-in-out,
    box-shadow 200ms ease-in-out, transform 200ms ease-in-out;
}

.creative-control-grid .segmented-options label span {
  color: inherit;
}

.creative-control-grid .segmented-options label:hover:not(:has(input:disabled)) {
  color: #4b5568;
  background: rgb(255 255 255 / 64%);
  box-shadow: 0 8px 20px rgb(99 102 241 / 10%);
  transform: translateY(-1px);
}

.creative-control-grid .segmented-options label:has(input:checked) {
  background: #fff;
  color: #4f46e5;
  box-shadow: 0 10px 24px rgb(79 70 229 / 16%),
    0 3px 8px rgb(148 163 184 / 22%);
}

.creative-control-grid .segmented-options label:active:not(:has(input:disabled)) {
  box-shadow: inset 0 2px 5px rgb(79 70 229 / 10%);
  transform: scale(0.98);
}

.creative-control-grid .segmented-options label:has(input:focus-visible) {
  outline: 0;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 22%),
    0 10px 24px rgb(79 70 229 / 16%);
}

@media (prefers-reduced-motion: reduce) {
  .duration-options span,
  .creative-control-grid .segmented-options label {
    transition: none;
  }

  .duration-options label:hover input:not(:checked):not(:disabled) + span,
  .duration-options label:active input:not(:disabled) + span,
  .creative-control-grid .segmented-options label:hover:not(:has(input:disabled)),
  .creative-control-grid .segmented-options label:active:not(:has(input:disabled)) {
    transform: none;
  }
}

.creative-control-grid #language {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 12px;
  border: 1px solid #c6d6ce;
  border-radius: 9px;
  background-color: #fff;
  color: #25362f;
  font: inherit;
}

.character-role-section {
  margin-top: 30px;
  padding: 26px 0 0;
  border: 0;
  border-top: 1px solid #dce6e1;
  border-radius: 0;
  background: transparent;
}

.character-role-heading {
  align-items: flex-start;
  gap: 24px;
}

.character-role-heading > div {
  max-width: 620px;
}

.character-role-heading strong {
  color: #1d2d26;
  font-size: 18px;
  line-height: 1.4;
}

.character-role-heading p {
  margin-top: 5px;
  max-width: 580px;
  color: #66756e;
  line-height: 1.6;
}

#addCharacterRoleButton.secondary-button {
  width: auto;
  min-width: 132px;
  min-height: 44px;
  padding: 0 16px;
  flex: 0 0 auto;
  border-color: var(--ui-green-2);
  background: var(--ui-green-2);
  color: #fff;
  box-shadow: 0 3px 8px rgb(8 122 91 / 16%);
}

#addCharacterRoleButton.secondary-button img {
  filter: brightness(0) invert(1);
}

#addCharacterRoleButton.secondary-button:hover:not(:disabled) {
  border-color: var(--ui-green-3);
  background: var(--ui-green-3);
  color: #fff;
  box-shadow: 0 5px 12px rgb(8 122 91 / 20%);
}

.character-role-list {
  margin-top: 18px;
  gap: 16px;
  counter-reset: character-role;
}

.character-role-row {
  position: relative;
  padding: 58px 18px 18px;
  grid-template-columns: minmax(210px, 0.8fr) minmax(320px, 1.7fr);
  grid-template-rows: auto auto;
  align-items: start;
  gap: 14px 20px;
  counter-increment: character-role;
  border: 1px solid #dfe6e2;
  border-radius: 8px;
  background: #fbfcfc;
  box-shadow: 0 1px 3px rgb(20 35 30 / 4%);
}

.character-role-row::before {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 0;
  color: #26362f;
  content: "角色 " counter(character-role);
  font-size: 14px;
  font-weight: 700;
  line-height: 22px;
}

.character-role-row > label:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
}

.character-role-row > label:nth-of-type(2) {
  grid-column: 1;
  grid-row: 2;
}

.character-role-row > label:nth-of-type(3) {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
}

.character-role-row[data-character-source-mode="library"] {
  grid-template-columns: minmax(210px, 0.8fr) minmax(320px, 1.7fr);
  grid-template-rows: auto;
}

.character-role-row[data-character-source-mode="library"] > label:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
}

.character-role-row[data-character-source-mode="library"] > label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 1;
}

.character-prompt-field[hidden] {
  display: none;
}

.character-role-row label,
.character-library-row label {
  gap: 7px;
  color: #53645c;
  font-size: 12px;
  font-weight: 700;
}

.character-role-row input,
.character-role-row select,
.character-role-row textarea,
.character-library-row input,
.character-library-row textarea {
  border-color: #c7d5ce;
  border-radius: 8px;
  background: #fbfdfc;
  transition: border-color var(--ui-ease), background var(--ui-ease),
    box-shadow var(--ui-ease);
}

.character-role-row :is(input, select, textarea):hover,
.character-library-row :is(input, textarea):hover {
  border-color: #9fb4aa;
  background: #fff;
}

.character-role-row :is(input, select, textarea):focus,
.character-library-row :is(input, textarea):focus {
  border-color: var(--ui-green-2);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 3px rgb(8 122 91 / 12%);
}

.character-role-row textarea {
  min-height: 130px;
  height: 100%;
}

.character-role-row-actions {
  position: absolute;
  top: 8px;
  right: 12px;
  min-height: 44px;
  padding: 0;
  justify-content: flex-end;
  border: 0;
}

.character-role-row-actions .secondary-button {
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
}

.character-role-row-actions .secondary-button:first-child {
  border-color: transparent;
  color: #285e4a;
}

.character-role-row-actions .secondary-button:first-child:hover:not(:disabled) {
  border-color: #d9e6e0;
  background: #f0f6f3;
}

.character-role-row-actions .secondary-button:last-child {
  width: 44px;
  padding: 0;
  border-color: #e3d5d2;
}

.character-role-row-actions .secondary-button:last-child:hover:not(:disabled) {
  border-color: #d39b93;
  background: #fff4f2;
  color: var(--ag-danger);
}

.character-role-empty {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed #c7d8d0;
  border-radius: 9px;
  background: #fafcfb;
  text-align: center;
}

.character-library-details {
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

.character-library-details summary {
  width: max-content;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #52635b;
  transition: border-color var(--ui-ease), background var(--ui-ease),
    color var(--ui-ease);
}

.character-library-details summary:hover {
  background: #f1f5f3;
  color: var(--ui-green-2);
}

.character-library-details[open] summary {
  background: #f1f5f3;
  color: var(--ui-green-2);
}

.character-library-body {
  padding: 14px 2px 2px;
}

.character-library-row {
  grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 2fr) max-content;
  border-radius: 9px;
  border-color: #dce6e1;
  box-shadow: none;
}

@media (max-width: 1040px) {
  .creative-control-grid {
    grid-template-columns: minmax(280px, 1fr) 200px;
  }

  .character-role-row {
    grid-template-columns: minmax(190px, 0.8fr) minmax(280px, 1.5fr);
  }
}

@media (max-width: 900px) {
  .creative-control-grid,
  .character-role-row,
  .character-role-row[data-character-source-mode="library"],
  .character-library-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .character-role-row-actions {
    position: static;
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }

  .character-role-row {
    padding-top: 48px;
  }

  .character-role-row > label:nth-of-type(1),
  .character-role-row > label:nth-of-type(2),
  .character-role-row > label:nth-of-type(3),
  .character-role-row[data-character-source-mode="library"] > label:nth-of-type(1),
  .character-role-row[data-character-source-mode="library"] > label:nth-of-type(2) {
    grid-column: 1;
    grid-row: auto;
  }
}
