/* 短剧工作台(drama.js 配套;复用设计系统变量与 gen.css 布局) */

/* ---------- 任务进度面板:所有 status 都进日志,常显最新一条,可展开看全部 ---------- */
#logPanel {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--panel); margin-bottom: 14px; overflow: hidden;
}
.log-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  cursor: pointer; user-select: none;
  background: rgba(255, 255, 255, .02);
}
.log-head .title { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.log-head .count { font-size: 12.5px; color: var(--text-3); }
.log-head .toggle { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.log-head:hover .toggle { color: var(--text-2); }
.log-latest {
  padding: 5px 12px 6px; font-size: 14px; color: var(--text-2);
  border-top: 1px solid var(--line); min-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.log-latest.err { color: var(--danger); }

/* 剧集 tabs:剧→集→镜的中间层;当前集高亮,已合成集带小圆点 */
.ep-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center;
}
.ep-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--fg2); font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.ep-tab b { font-weight: 600; color: var(--fg); font-size: 12.5px; }
.ep-tab span.n { font-size: 10.5px; color: var(--fg3); }
.ep-tab:hover { border-color: var(--accent); color: var(--fg); }
.ep-tab.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.ep-tab.on b { color: #fff; }
.ep-tab.on span.n { color: rgba(255,255,255,.75); }
.ep-tab.add { border-style: dashed; color: var(--fg3); }
.ep-tab.add:hover { color: var(--accent); border-color: var(--accent); }
.ep-tab.ops { padding: 5px 9px; font-size: 12px; }

/* 本集梗概行 */
.ep-syn { margin-bottom: 8px; }
.ep-syn textarea {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; resize: vertical; min-height: 36px;
}

/* ---------- 候片墙(抽卡择优)与成本角标(P1.2/P1.3) ---------- */
.take-strips { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.take-strip { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.take-strip .take-label { font-size: 12px; color: var(--text-3); flex: none; width: 64px; }
.take-thumb {
  position: relative; width: 64px; height: 44px; padding: 0; margin: 0;
  border: 2px solid var(--line); border-radius: 6px; overflow: hidden;
  background: #000; cursor: pointer; flex: none;
}
.take-thumb img, .take-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.take-thumb.on { border-color: var(--accent); }
.take-thumb.on::after {
  content: '✓'; position: absolute; right: 2px; bottom: 2px;
  font-size: 10px; color: #fff; background: var(--accent);
  border-radius: 50%; width: 14px; height: 14px; line-height: 14px; text-align: center;
}
.shot-cost {
  display: inline-block; margin-top: 6px; font-size: 11.5px; color: var(--text-3);
}
#costLine { color: var(--text-2); }
#remixBox video { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; background: #000; }
#remixBox .download {
  display: block; text-align: center; text-decoration: none;
  font-size: 13px; color: var(--accent);
  background: rgba(52, 211, 153, .1);
  border-radius: 6px; padding: 5px 6px; margin-top: 6px;
}
#remixBox .download:hover { background: rgba(52, 211, 153, .2); }
#remixBox .hint.err { color: var(--danger); }
.log-list {
  display: none; max-height: 260px; overflow-y: auto;
  border-top: 1px solid var(--line); padding: 4px 12px 8px;
}
#logPanel.open .log-list { display: block; }
.log-line {
  font-size: 13px; padding: 3px 0; color: var(--text-2);
  border-bottom: 1px dashed rgba(255, 255, 255, .04);
}
.log-line:last-child { border-bottom: 0; }
.log-line .t {
  color: var(--text-3); margin-right: 8px;
  font-family: Consolas, monospace; font-size: 12px;
}
.log-line.err { color: var(--danger); }

.f-label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13.5px; color: var(--text-2);
  margin-top: 8px;
}
.f-label input, .f-label textarea, .f-label select {
  font-size: 14px; padding: 6px 8px;
}

/* ---------- 角色行 ---------- */
.char {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 10px; margin-bottom: 8px;
  background: rgba(255, 255, 255, .02);
}
.char-face {
  width: 56px; height: 74px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line-strong);
  flex: none; cursor: zoom-in;
}
.char-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.char-main input, .char-main textarea { font-size: 13.5px; padding: 5px 8px; width: 100%; }
.char-ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.char-ops .btn { font-size: 13px; padding: 3px 10px; margin: 0; }
.char-status { font-size: 12.5px; color: var(--text-3); min-height: 14px; }
.char-status.err { color: var(--danger); }

/* ---------- 镜头卡 ---------- */
.shot {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 12px 14px; margin-bottom: 12px;
  background: rgba(255, 255, 255, .02);
}
.shot-head { display: flex; gap: 8px; align-items: center; }
.shot-head .idx { font-weight: 700; color: var(--accent); font-size: 14px; flex: none; }
.shot-head .scene { flex: 1; min-width: 0; font-size: 13.5px; padding: 4px 8px; }
.shot-head .st { flex: none; font-size: 12.5px; color: var(--text-3); }
.shot-head .st.busy { color: var(--accent); }
.shot .f-label { margin-top: 8px; }
.shot-ops { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.shot-ops .btn { font-size: 13px; padding: 3px 10px; margin: 0; }
.shot-ops select { font-size: 13px; padding: 3px 6px; }
.shot-media { display: flex; gap: 12px; margin-top: 10px; align-items: flex-start; flex-wrap: wrap; }
.shot-media img.frame {
  width: 110px; border-radius: 8px; display: block;
  border: 1px solid var(--line-strong); cursor: zoom-in;
}
.shot-media video {
  flex: 1; min-width: 200px; max-width: 420px; width: 100%;
  border-radius: 8px; border: 1px solid var(--line); background: #000;
}
.shot-status { font-size: 12.5px; margin-top: 6px; color: var(--text-3); min-height: 14px; }
.shot-status.err { color: var(--danger); }
/* 折叠:收起后只留首行(场景+状态+折叠钮),长剧浏览不滚屏 */
.shot-head .fold { font-size: 12.5px; padding: 2px 9px; margin: 0; }
.shot.collapsed > :not(.shot-head) { display: none; }
.shot.collapsed { padding-bottom: 8px; }

/* ---------- 成片 / 连播 ---------- */
#composedBox video { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; background: #000; }
#composedBox .download {
  display: block; text-align: center; text-decoration: none;
  font-size: 13px; color: var(--accent);
  background: rgba(52, 211, 153, .1);
  border-radius: 6px; padding: 5px 6px; margin-top: 6px;
}
#composedBox .download:hover { background: rgba(52, 211, 153, .2); }
#playBox { width: min(480px, 92vw); }
#playBox video { width: 100%; border-radius: 8px; background: #000; display: block; }
#playBox .hint { margin: 8px 0 0; }

/* ---------- 章节分组 ---------- */
.chapter-head {
  margin: 18px 0 10px;
  font-size: 13.5px; font-weight: 700;
  color: var(--accent-2);
  border-bottom: 1px dashed var(--line-strong);
  padding-bottom: 6px;
}
.chapter-head:first-child { margin-top: 0; }

/* ---------- 风格快选 chips ---------- */
.style-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-btn {
  cursor: pointer; padding: 3px 10px;
  transition: all .12s ease;
}
.chip-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(52, 211, 153, .08);
}

/* ---------- 角色参考图缩略条 ---------- */
.char-refs { display: flex; gap: 6px; flex-wrap: wrap; }
.char-ref { position: relative; width: 44px; height: 44px; }
.char-ref img {
  width: 44px; height: 44px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line-strong); display: block;
}
.char-ref button {
  position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 0; padding: 0; margin: 0; cursor: pointer;
  background: rgba(255, 123, 107, .9); color: #fff;
  font-size: 11.5px; line-height: 16px;
}
.char-ref.add {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-strong); border-radius: 6px;
  color: var(--text-3); font-size: 17px; cursor: pointer;
  box-sizing: border-box; user-select: none;
}
.char-ref.add:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 灵感弹层 ---------- */
.idea-box {
  width: min(560px, 92vw); max-height: 80vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 20px;
}
.idea-box h3 { margin: 0 0 12px; font-size: 16.5px; }
.idea-card {
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: rgba(255, 255, 255, .02);
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  transition: border-color .15s ease;
}
.idea-card:hover { border-color: rgba(52, 211, 153, .5); }
.idea-card b { font-size: 15px; }
.idea-card p { margin: 5px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.idea-style { display: inline-block; margin-top: 7px; font-size: 12px; color: var(--accent); }

@media (max-width: 900px) {
  .shot-media video { max-width: none; }
}