/* AI 漫剧工坊 SPA 样式 */
* { box-sizing: border-box; }
body {
  margin: 0; background: #f5f6f8; color: #2c3e50;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
#app { min-height: 100vh; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; background: #1f2937; color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: bold; cursor: pointer; }
.crumb { color: #9ca3af; font-size: 14px; }
.toplink { margin-left: auto; color: #d1d5db; font-size: 14px; cursor: pointer; }
.toplink:hover { color: #fff; }

.container { max-width: 1100px; margin: 0 auto; padding: 16px 20px 60px; }
h2 { margin: 10px 0; }
h3 { margin: 0 0 10px; }
.meta { color: #6b7280; font-size: 14px; }
.dim { color: #9ca3af; font-size: 13px; }
.empty { color: #9ca3af; padding: 14px; text-align: center; }
.brief { white-space: pre-wrap; line-height: 1.7; font-size: 14px; }

/* 工具条与按钮 */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
button {
  padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px;
}
button:hover { background: #f3f4f6; }
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px;
  font-family: inherit;
}
input.num { width: 60px; }
.grow { flex: 1; min-width: 120px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
label.inline.disabled { color: #9ca3af; cursor: not-allowed; }

/* 卡片 */
.card {
  background: #fff; border-radius: 10px; padding: 14px 16px;
  margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card.clickable { cursor: pointer; transition: box-shadow .15s; }
.card.clickable:hover { box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.subcard { border-top: 1px dashed #e5e7eb; margin-top: 12px; padding-top: 10px; }
.form { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
/* 重试面板：历史提示词下拉（每项一行文本，超出省略号；可点选、可删除） */
.hist-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.hist-item {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px;
  font-size: 12px; cursor: pointer;
}
.hist-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.hist-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-del { flex-shrink: 0; color: #9ca3af; cursor: pointer; padding: 0 3px; }
.hist-del:hover { color: #dc2626; }
/* 重试面板：参考图列表字段（图编辑/图生视频面板，逐张可替换/添加/删除） */
.field-images { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
.imgpick-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.imgpick {
  width: 110px; border: 1px solid #e5e7eb; border-radius: 8px;
  overflow: hidden; background: #f9fafb;
}
.imgpick img { width: 100%; height: 108px; object-fit: cover; display: block; background: #eee; }
.imgpick-bar { display: flex; align-items: center; gap: 2px; padding: 3px 4px; }
.imgpick-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.imgpick-bar button { padding: 1px 6px; font-size: 11px; line-height: 1.4; }
.imgpick-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; height: 138px; cursor: pointer; border-style: dashed;
}
.imgpick-plus { font-size: 22px; }
.imgpick-add:hover { border-color: #2563eb; background: #eff6ff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; background: #eee; }
.thumbs.big img { width: 160px; height: 160px; cursor: zoom-in; border: 3px solid transparent; }
.thumbs.big img.picked { border-color: #2563eb; }
video { max-width: 100%; margin-top: 8px; border-radius: 8px; background: #000; }
audio { width: 100%; }
.script { width: 100%; font-family: Consolas, monospace; font-size: 12px; }

/* 行列表 */
.list { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid #f1f2f4; font-size: 14px;
}
.row:last-child { border-bottom: none; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: #eff6ff; }
.row .main { font-weight: 600; min-width: 260px; }

/* 状态标签 */
.tag {
  padding: 2px 10px; border-radius: 20px; font-size: 12px; background: #e5e7eb; color: #374151;
  white-space: nowrap;
}
.tag.s-1, .s-1 { color: #dc2626; }
.tag.s0 { background: #f3f4f6; color: #6b7280; }
.tag.s1 { background: #fef3c7; color: #92400e; }
.tag.s2 { background: #e0e7ff; color: #3730a3; }
.tag.s3 { background: #cffafe; color: #155e75; }
.tag.s4 { background: #d1fae5; color: #065f46; }
.tag.s5 { background: #ede9fe; color: #5b21b6; }
.tag.s6 { background: #dcfce7; color: #14532d; }

/* 卡片网格（角色/场景/资产） */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 10px 0; }
.ccard {
  background: #fff; border-radius: 10px; overflow: hidden; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); border: 3px solid transparent;
}
.ccard.clickable { cursor: pointer; }
.ccard.clickable:hover { box-shadow: 0 3px 10px rgba(0,0,0,.16); }
.ccard.active { border-color: #2563eb; }
.ccard img { width: 100%; height: 150px; object-fit: cover; background: #eee; display: block; }
.ccard .noimg { height: 150px; display: flex; align-items: center; justify-content: center; background: #f3f4f6; color: #9ca3af; }
.cname { padding: 6px 4px; font-size: 13px; font-weight: 600; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 8px 10px; border-bottom: 1px solid #f1f2f4; text-align: left; }
th { background: #f9fafb; color: #6b7280; font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #eff6ff; }
tr.active { background: #dbeafe; }

/* 分页 */
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 14px 0; font-size: 14px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 99;
  max-width: 80vw;
}
.toast.ok { background: #16a34a; }
.toast.err { background: #dc2626; }

/* 整体布局：左侧任务队列 + 右侧主内容 */
.layout { display: flex; align-items: flex-start; gap: 0; }
.maincol { flex: 1; min-width: 0; }

/* 左侧任务队列面板 */
.sidepanel {
  width: 280px; flex-shrink: 0; padding: 14px 10px 40px;
  background: #fff; border-right: 1px solid #e5e7eb;
  position: sticky; top: 45px; max-height: calc(100vh - 45px); overflow-y: auto;
}
.sidepanel h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.tasklist { display: flex; flex-direction: column; gap: 8px; }
.taskitem {
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px;
  background: #fafafa; font-size: 12px;
}
.taskitem.clickable { cursor: pointer; }
.taskitem:hover { background: #eff6ff; }
.taskitem.st-running, .taskitem.st-cancelling { border-color: #93c5fd; background: #eff6ff; }
.taskitem.st-failed { border-color: #fca5a5; }
.taskitem .trow { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.taskitem .ttitle { flex: 1; font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbtns { display: inline-flex; gap: 4px; }
.tbtns button { padding: 1px 6px; font-size: 11px; line-height: 1.4; }

/* loading 占位 */
.loading {
  display: flex; align-items: center; gap: 10px; padding: 18px;
  color: #6b7280; font-size: 14px; background: #fff; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin: 10px 0;
}
.loading.sm { padding: 8px; font-size: 13px; box-shadow: none; background: #f9fafb; border-radius: 8px; }
.spinner {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
  border: 3px solid #d1d5db; border-top-color: #2563eb;
  animation: spin .8s linear infinite; display: inline-block; vertical-align: middle;
}
.spinner.sm { width: 12px; height: 12px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ccard.loading-card {
  height: 180px; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; color: #9ca3af; background: #f9fafb;
}
.ccard img { cursor: zoom-in; }
/* 项目页预览入口卡片：仅导航不放大 */
.thumbs img { cursor: pointer; }

/* 任务详情弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 12px; padding: 18px 22px;
  width: min(720px, 92vw); max-height: 86vh; overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.artifact-text {
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 12px; font-size: 12px; max-height: 40vh; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 8px 0; }
.artifact-grid img { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: #eee; }
.artifact-grid video { width: 100%; margin: 0; }
.artifact-grid audio { grid-column: 1 / -1; }

/* v-cloak：Vue 挂载前隐藏模板，避免刷新瞬间闪现视频/音频控件 */
[v-cloak] { display: none; }

/* 灯箱（支持 ←/→ 切换媒体列表） */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 99;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 6px; transition: transform .1s; }
.lb-media { display: flex; align-items: center; justify-content: center; cursor: default; }
.lb-media video { max-width: 88vw; max-height: 88vh; border-radius: 6px; background: #000; }
.lb-media audio { width: min(560px, 88vw); }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.15); color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0;
}
.lb-btn:hover { background: rgba(255,255,255,.3); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-open { top: 16px; right: 20px; transform: none; font-size: 20px; }
.lb-count {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  color: #d1d5db; font-size: 14px; background: rgba(0,0,0,.4);
  padding: 2px 12px; border-radius: 12px;
}

/* 任务详情弹窗：入参展示 */
.args { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.argitem { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.arglabel {
  flex-shrink: 0; width: 88px; color: #6b7280; text-align: right;
}
.argvalue { flex: 1; word-break: break-all; color: #374151; }
/* 任务详情：入参参考图缩略图（点击进灯箱放大） */
.argthumbs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.argthumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 6px;
  cursor: zoom-in; background: #eee;
}
.filecard {
  display: inline-block; padding: 6px 12px; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; color: #1d4ed8; cursor: pointer; font-size: 13px;
}
.filecard:hover { background: #dbeafe; }

/* 设置页 */
.setrow {
  display: flex; align-items: baseline; gap: 14px; padding: 9px 0;
  border-bottom: 1px dashed #f1f2f4; font-size: 13px;
}
.setrow:last-child { border-bottom: none; }
.setrow label.inline { flex-shrink: 0; min-width: 320px; }
.setrow .dim { flex: 1; line-height: 1.6; }
/* LLM 接口设置：文本输入行（接口地址/Key/模型名）与测试连接行 */
.setrow label.inline.wide { min-width: 460px; max-width: 640px; }
.setrow.llm-test { align-items: center; flex-wrap: wrap; }
.modelchip {
  display: inline-block; margin: 0 6px 2px 0; padding: 1px 8px; background: #eff6ff;
  border: 1px solid #bfdbfe; border-radius: 10px; color: #1d4ed8; cursor: pointer; font-size: 12px;
}
.modelchip:hover { background: #dbeafe; }
.loading-inline { display: inline-flex; align-items: center; gap: 6px; color: #6b7280; font-size: 13px; }

/* 左右两栏：基准图左，其余网格右（角色/场景） */
.layout-two-column {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.left-column {
  flex-shrink: 0;
  width: 320px;
  min-width: 0;
}
.right-column {
  flex: 1;
  min-width: 0;
}

/* 右侧非基准照网格：固定 2×2 */
.right-column .cardgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0;
}

/* 基准标签 */
.base-tag { background: #2563eb; color: #fff; }

/* 版本弹窗 */
.version-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin: 12px 0;
}
.version-item {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer;
  background: #f9fafb;
}
.version-item.active { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.version-item img { width: 100%; height: 100px; object-fit: cover; display: block; background: #eee; }
.ver-index {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px;
  padding: 2px 6px; text-align: center;
}

/* ConfirmModal 通用弹窗 */
.confirm-modal h3 { margin: -18px -22px 18px; padding: 18px 22px; font-size: 16px; border-bottom: 1px solid #e5e7eb; }
.confirm-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.confirm-btns button { min-width: 70px; }
.confirm-btns .danger { background: #dc2626; color: #fff; }
.confirm-btns .primary { background: #2563eb; color: #fff; }
label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.confirm-modal input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; margin-bottom: 12px; font-size: 14px; box-sizing: border-box; }

/* 资产卡片：生成中进度徽章 */
.progress-badge {
  position: absolute; top: 6px; right: 6px;
  background: rgba(37,99,235,.9); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 12px;
  font-weight: 600;
}
/* 任务进度条（任务面板/详情弹窗）：细蓝条 + 百分比 */
.progress-track {
  height: 5px; border-radius: 3px; background: #e5e7eb;
  overflow: hidden; margin-top: 6px;
}
.progress-fill {
  height: 100%; border-radius: 3px; background: #2563eb;
  transition: width .6s ease;
}
/* 未知进度时脉冲动画 */
.progress-fill.indeterminate {
  width: 30% !important;
  animation: pulse-progress 1.5s ease-in-out infinite;
}
@keyframes pulse-progress {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(400%); }
}
.progress-block { margin: 8px 0; }
/* 镜头行内小百分比 */
.pct { color: #2563eb; font-weight: 600; font-size: 11px; margin-left: 4px; }
.noimg { position: relative; }
.asset-actions { margin-top: 6px; display: flex; gap: 6px; justify-content: center; }
