/* 长视频时间轴：一整块剪辑台。播放器在深色里看；选中要换的段、AI 轨和 AI 片用同一个蓝，一眼看出哪几段会被换掉。
   例外：轨道/片段内部的刻度字、角标、时间码用 10–11px 原值——剪辑台密度要求，不换 --fs-* token。 */
:root {
  --tl-bg: #eceef1;
  --tl-track: #232427;
  --tl-clip: #c9cdd4;
  --tl-clip-line: rgba(22, 23, 26, .18);
  --tl-sel: var(--accent);
  --tl-head: #e5383b;
  --tl-ai: var(--accent);
  --tl-wave: #7c828d;
  --tl-scene: #5e626b; /* 同一镜头的括号：不用蓝，蓝只留给 AI 替换 */
}

body.tl-mode main { overflow: hidden; display: flex; flex-direction: column; padding: 12px 16px 16px; }
body.tl-mode #view-task { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
body.tl-mode #t-error:empty { display: none; }
body.tl-mode .chrome { display: none; }

#timeline-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tl { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.tl button { width: auto; padding: 4px 12px; font-size: var(--fs-sm); text-align: center; }

/* 上：播放器 + 检视栏 */
.tl-top { flex: 1; min-height: 180px; display: flex; gap: 0; }
.tl-player {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  background: var(--monitor); padding: 12px;
}
.tl-screen { position: relative; height: 100%; max-width: 100%; background: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
.tl-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.tl-screen video.off { visibility: hidden; }
.tl-screen video.tl-ai { pointer-events: none; }
.tl-badge {
  position: absolute; top: 8px; left: 8px; padding: 1px 8px; border-radius: 4px;
  background: var(--tl-ai); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.tl-badge.off { display: none; }

.tl-insp {
  width: 300px; flex-shrink: 0; overflow: auto; padding: 16px 16px;
  background: var(--panel); border-left: 1px solid var(--line);
}
.tl-insp h3 { margin: 0 0 8px; font-size: var(--fs-lg); font-weight: 600; }
.tl-insp h3 small { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; margin-left: 8px; }
.tl-insp p { margin: 4px 0; font-size: var(--fs-sm); }
.tl-insp .bad, #tl-note .bad { color: var(--fail); }
.tl-state.ok { color: var(--ok); }
.tl-state.run { color: var(--run); display: flex; align-items: center; gap: 8px; }
.tl-speed { margin-left: 8px; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.tl-links a, #tl-note a { color: var(--accent-ink); }
.tl-prompt { display: block; margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); }
.tl-prompt textarea {
  width: 100%; margin-top: 4px; resize: vertical; font: 12px/1.5 var(--font);
  background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 8px;
}
.tl-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.tl-row a.btn { box-sizing: border-box; text-align: center; text-decoration: none; }
.tl-row .btn { min-width: 0; padding-left: 4px; padding-right: 4px; white-space: nowrap; text-align: center; justify-content: center; }
.tl-sec { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.tl-sec-h { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-xs); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tl-sec-h .tl-state { margin: 0; font-weight: 500; }

/* 中：工具条 */
.tl-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-1) var(--sp-2); background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
/* 工具条上的编辑按钮做成无框文字按钮，只把导出和生成留成实心 */
.tl-bar-l, .tl-bar-c, .tl-bar-r { display: flex; align-items: center; gap: 4px; }
.tl-bar-r { gap: var(--sp-2); margin-left: auto; }
.tl-bar-r > .off { display: none; }
.tl-bar-c > .tl-play { min-width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--text); color: #fff; font-size: var(--fs-xs); }
.tl-bar-c > .tl-play:hover:not(:disabled) { background: #000; }
.tl-clock { font-size: var(--fs-sm); color: var(--faint); margin: 0 8px; font-variant-numeric: tabular-nums; }
.tl-clock b { color: var(--text); font-weight: 600; font-size: var(--fs-md); }
/* AI 预览分段选中态用 AI 蓝 */
.seg button[data-tl-mode="ai"].on { background: var(--tl-ai); color: #fff; }
.tl-zoom { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-sm); }
.tl-zoom input { width: 110px; }

/* 下：多轨 */
.tl-tl { position: relative; display: flex; background: var(--tl-bg); }
.tl-heads { width: 72px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--panel); }
.tl-head { height: 36px; display: flex; align-items: center; padding-left: 12px; font-size: var(--fs-xs); color: var(--muted); }
.tl-heads .tl-head:nth-child(2) { color: var(--accent-ink); font-weight: 500; }
.tl-heads .tl-head:nth-child(3) { height: 74px; }
.tl-heads .tl-head:nth-child(4) { height: 44px; }
.tl-head-ruler { height: 24px !important; }
.tl-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.tl-inner { position: relative; padding: 0 12px; min-width: 100%; user-select: none; }

.tl-ruler { position: relative; height: 24px; border-bottom: 1px solid var(--line); cursor: text; background: var(--panel); margin: 0 -12px; padding: 0 12px; }
/* 标尺和 AI 轨向两边出血 12px 铺底色，里面的绝对定位件要补回这 12px，才跟视频轨同一个 0 点 */
.tl-tick, .tl-aiclip { margin-left: 12px; }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--line-strong); }
.tl-tick.major { height: 9px; background: var(--faint); }
.tl-tick em { position: absolute; bottom: 10px; left: 3px; font-size: 10px; font-style: normal; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.tl-track { position: relative; }
.tl-track-ai { height: 36px; background: rgba(22, 70, 255, .05); margin: 0 -12px; padding: 0 12px; border-bottom: 1px dashed rgba(22, 70, 255, .22); }
.tl-track-v { height: 74px; }
.tl-track-a { height: 44px; }
.tl-track-a canvas { position: absolute; top: 0; }
.tl-track .empty { position: absolute; left: 16px; top: 9px; padding: 0; display: block; font-size: var(--fs-xs); color: var(--accent-ink); opacity: .7; white-space: nowrap; }

.tl-clip {
  position: absolute; top: 4px; height: 52px; border-radius: 4px; overflow: hidden; cursor: pointer;
  background: var(--tl-clip); border: 1px solid var(--tl-clip-line);
}
.tl-clip .tl-thumbs { position: absolute; inset: 0; opacity: .9; }
.tl-clip .tl-thumbs i { position: absolute; top: 0; height: 100%; background-repeat: no-repeat; }
.tl-clip-lab {
  position: absolute; left: 4px; top: 3px; padding: 0 4px; border-radius: 3px;
  background: rgba(20, 21, 23, .72); font-size: 10px; line-height: 15px; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* 段上标「缺图 / 对不上」：勾段时就能看到，悬停看原因，点段看右侧详情。
   时间轴段卡左下（标签在左上、勾选框在右上、角色色条贴底）；镜头总览卡里跟随标题行 */
.tl-need {
  display: inline-block; padding: 0 4px; border-radius: 3px; font-size: 10px; line-height: 15px;
  font-style: normal; color: #fff; white-space: nowrap;
}
.tl-clip .tl-need { position: absolute; left: 4px; bottom: 3px; }
.tl-need.miss { background: var(--fail); }
.tl-need.mism { background: var(--run); }
.tl-clip-warn {
  position: absolute; right: 4px; bottom: 3px; padding: 0 4px; border-radius: 3px;
  background: var(--fail); color: #fff; font-size: 10px;
}
.tl-clip.long { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(224, 112, 88, .18) 6px 12px); }
.tl-clip.has-done { border-color: var(--tl-ai); }
/* 选中 = 要被换掉：蓝幕描边 + 画面罩一层蓝 */
.tl-clip.sel { border: 2px solid var(--tl-sel); }
.tl-clip.sel::after { content: ""; position: absolute; inset: 0; background: rgba(22, 70, 255, .22); pointer-events: none; }
.tl-clip.focus { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.tl-clip:hover .tl-thumbs { opacity: 1; }
/* 同一镜头：段下面的细括号，中间写字 */
.tl-scene {
  position: absolute; top: 59px; height: 5px; border: 1.5px solid var(--tl-scene); border-top: 0; border-radius: 0 0 3px 3px;
  display: flex; justify-content: center; cursor: help;
}
.tl-scene span {
  position: relative; top: 1px; max-width: 100%; overflow: hidden; padding: 0 4px; background: var(--tl-bg);
  font-size: 10px; line-height: 12px; color: var(--tl-scene); white-space: nowrap;
}

.tl-edge { position: absolute; top: 0; width: 12px; height: 60px; cursor: ew-resize; z-index: 2; }
.tl-edge::after { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: transparent; }
.tl-edge:hover::after, .tl-edge.on::after { background: var(--accent); }

.tl-aiclip {
  position: absolute; top: 5px; height: 26px; border-radius: 5px; padding: 0 8px; overflow: hidden;
  display: flex; align-items: center; font-size: 11px; white-space: nowrap; cursor: pointer;
  background: var(--tl-ai); color: #fff; font-weight: 500;
}
.tl-aiclip.queued, .tl-aiclip.running {
  background: repeating-linear-gradient(90deg, #5f7fff 0 10px, #7d96ff 10px 20px);
  background-size: 40px 100%; animation: tl-stripe 1s linear infinite;
}
.tl-aiclip.failed { background: var(--fail); }
.tl-aiclip.focus { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
@keyframes tl-stripe { to { background-position: 40px 0; } }

.tl-playhead { position: absolute; top: 0; bottom: 0; width: 0; margin-left: 12px; pointer-events: none; z-index: 5; }
.tl-playhead::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--tl-head); }
.tl-playhead i { position: absolute; top: 0; left: -6px; width: 12px; height: 10px; background: var(--tl-head); clip-path: polygon(0 0, 100% 0, 50% 100%); }

.tl-mask {
  position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(236, 238, 241, .88); color: var(--text); font-size: var(--fs-md);
}
.tl-mask.off { display: none; }
.tl-spin {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--run); border-top-color: transparent;
  animation: tl-rot .8s linear infinite; display: inline-block;
}
@keyframes tl-rot { to { transform: rotate(360deg); } }

#tl-note { padding: var(--sp-2) var(--sp-3); display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px solid var(--line); }
.tl-keys { color: var(--faint); }
.tl-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
  padding: 8px 16px; border-radius: 8px; background: var(--text); color: #fff; font-size: var(--fs-sm); box-shadow: var(--shadow-pop);
  transition: opacity var(--ease), transform var(--ease); pointer-events: none; z-index: 70;
}
.tl-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .tl-top { flex-direction: column; overflow-y: auto; }
  .tl-insp { width: auto; max-height: 40vh; }
}

/* 镜头总览：每段开头 / 中间 / 结尾三帧 */
.tl-player { position: relative; }
.tl-screen.off { display: none; }
.tl-grid {
  position: absolute; inset: 12px; overflow: auto; color: #e9eaec;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; align-content: start;
}
.tl-grid.off { display: none; }
.tl-card {
  background: var(--tl-track); border: 2px solid transparent; border-radius: 8px; padding: 8px; cursor: pointer;
}
.tl-card:hover { border-color: #4a4c52; }
.tl-card.sel { border-color: var(--tl-sel); }
.tl-card.focus { box-shadow: 0 0 0 2px #fff; }
.tl-card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: var(--fs-xs); color: #a3a7af; }
.tl-card-h b { color: #fff; font-size: var(--fs-md); min-width: 18px; }
.tl-card-h span { font-variant-numeric: tabular-nums; }
.tl-card-b { margin-left: auto; padding: 0 8px; border-radius: 4px; font-size: 11px; font-family: var(--font) !important; color: #fff; background: var(--tl-ai); }
.tl-card-b.failed, .tl-card-b.long { background: var(--fail); }
.tl-card-b.queued, .tl-card-b.running { background: var(--run); color: #fff; }
.tl-card-f { display: flex; gap: 4px; }
.tl-card-f i { display: block; flex-shrink: 0; border-radius: 3px; background-repeat: no-repeat; background-color: #000; }
.tl-bar-l > #tl-view.on { background: var(--text); border-color: var(--text); color: #fff; }

/* 勾选框：不用记快捷键也能多选 */
.tl-check {
  position: relative; display: inline-block; flex-shrink: 0; width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, .75); background: rgba(0, 0, 0, .45); cursor: pointer;
}
.tl-check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.tl-check[aria-checked="true"]::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.tl-clip .tl-check { position: absolute; right: 4px; top: 3px; z-index: 1; }
.tl-clip:not(.sel):not(:hover) .tl-check { opacity: .55; }

/* 页内对话框 */
.tl-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(22, 23, 26, .45);
}
.tl-modal.off { display: none; }
.tl-dlg {
  width: min(440px, calc(100vw - 32px)); padding: 20px 20px 16px; border-radius: var(--radius-lg);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.tl-dlg h3 { margin: 0 0 8px; font-size: var(--fs-lg); }
.tl-dlg-p { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; }
.tl-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.tl-choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff;
}
.tl-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-choice.dis { opacity: .5; cursor: not-allowed; }
.tl-choice input { margin-top: 4px; accent-color: var(--accent); }
.tl-choice b { display: block; font-size: var(--fs-md); }
.tl-choice small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.tl-dlg-b { display: flex; justify-content: flex-end; gap: 8px; }
.tl-dlg-b .btn { min-width: 88px; }

.tl-why { margin-top: 4px; font-size: var(--fs-xs); color: var(--muted); }
.tl-why summary { cursor: pointer; }
.tl-why p { white-space: pre-wrap; word-break: break-all; }
.tl-notes { margin: 4px 0; padding-left: 18px; }
.tl-notes li { margin: 2px 0; white-space: pre-wrap; word-break: break-all; }

/* 左上：素材库面板（剪映的「媒体」区） */
.tl-lib {
  width: 320px; flex-shrink: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
}
.ap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ap-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px; border-bottom: 1px solid var(--line); }
.ap-h b { font-size: var(--fs-md); }
.ap-h .seg button { font-size: var(--fs-xs); }
.ap-b { flex: 1; min-height: 0; display: grid; grid-template-columns: 112px 1fr; }
.ap-tree { border: 0 !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important; padding: 8px 4px !important; background: var(--sunk); }
.ap-tree .as-node { padding: 4px 8px; font-size: var(--fs-xs); }
.ap-tree .as-node.d2 { padding-left: 12px; }
.ap-tree .as-node.d3 { padding-left: 20px; }
.ap-grid { overflow: auto; padding: 8px; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)) !important; gap: 8px !important; }
.ap-grid > .empty { padding: var(--sp-8) var(--sp-2); font-size: var(--fs-sm); }
.ap-grid .as-meta { padding: 4px 4px 4px; }
.ap-grid .as-meta b { font-size: 11px; }
.ap-grid .as-meta small { display: none; }
.ap-grid .as-card { cursor: grab; }
.ap-grid .as-card:active { cursor: grabbing; }

/* 素材预览：盖在播放器上 */
.tl-apv { position: absolute; inset: 12px; display: flex; flex-direction: column; gap: 8px; color: #e9eaec; }
.tl-apv.off { display: none; }
.tl-apv video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; border-radius: 4px; }
.tl-apv-bar { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.tl-apv-bar span { margin-right: auto; color: #a3a7af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-apv-bar button { width: auto; }

/* 拖素材到段上 */
.tl-clip.drop { border: 2px dashed var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 1200px) {
  .tl-lib { width: 280px; }
  .ap-b { grid-template-columns: 1fr; }
  .ap-tree { max-height: 120px; border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
}

/* 角色：钩子 / 产品展示 / 使用过程 / 效果展示 / 转场 / 其他 */
:root {
  /* 不用蓝：蓝只留给 AI 替换 */
  --r-hook: #e0632a; --r-product: #8a56d8; --r-use: #1f8f58; --r-effect: #d0458f; --r-trans: #8b8f98; --r-other: #5e626b;
}
.tl-clip::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 1; background: transparent; }
.tl-clip.role-hook::before { background: var(--r-hook); }
.tl-clip.role-product::before { background: var(--r-product); }
.tl-clip.role-use::before { background: var(--r-use); }
.tl-clip.role-effect::before { background: var(--r-effect); }
.tl-clip.role-trans::before { background: var(--r-trans); }
.tl-clip.role-other::before { background: var(--r-other); }
.tl-role {
  display: inline-block; flex-shrink: 0; padding: 0 8px; border-radius: 4px; font-style: normal; font-size: 11px; line-height: 18px; color: #fff;
}
.tl-role:empty { width: 10px; height: 10px; padding: 0; border-radius: 3px; }
.r-hook { background: var(--r-hook); } .r-product { background: var(--r-product); } .r-use { background: var(--r-use); }
.r-effect { background: var(--r-effect); } .r-trans { background: var(--r-trans); } .r-other { background: var(--r-other); }

.tl-insp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tl-insp-h h3 { margin: 0; white-space: nowrap; }
.tl-insp-h select {
  width: 110px; font: 13px var(--font); color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
}
.tl .tl-playseg { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; }
.tl-playseg span { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.tl .tl-link { display: block; margin-top: 12px; padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--fs-xs); text-decoration: underline; text-underline-offset: 2px; }
.tl .tl-link:hover { color: var(--accent-ink); }
.tl-debug { margin-top: 16px; font-size: var(--fs-xs); color: var(--muted); }
.tl-debug summary { cursor: pointer; }

/* 按类别选 */
.tl-pop-wrap { position: relative; }
.tl-pop {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30; width: 280px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
.tl-pop.off { display: none; }
.tl-pop-h { padding: 8px 8px 4px; font-size: 11px; color: var(--muted); }
.tl-pop-i {
  display: flex !important; align-items: center; gap: 8px; width: 100% !important; padding: 8px 8px !important;
  border: 0; border-radius: 6px; background: transparent; text-align: left !important; font-size: var(--fs-sm) !important;
}
.tl-pop-i:hover:not(:disabled) { background: var(--sunk); }
.tl-pop-i span { flex: 1; }
.tl-pop-i em { font-style: normal; font-size: 11px; color: var(--muted); }
.tl-pop-i b { color: var(--accent-ink); font-size: var(--fs-xs); }
.tl-pop-note { display: flex; align-items: center; gap: 8px; margin: 4px 8px; font-size: var(--fs-xs); color: var(--run); }
.tl-pop-f { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.tl-pop-f button { width: 100%; font-size: var(--fs-xs); border: 0; background: transparent; color: var(--muted); }

/* 用素材替换 */
.tl-dlg.tl-fill { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.tl-fill-h { display: flex; align-items: center; justify-content: space-between; }
.tl-fill-h h3 { margin: 0; }
.tl-fill .tl-x { width: 30px; height: 30px; padding: 0; border: 0; background: none; font-size: var(--fs-xl); color: var(--muted); cursor: pointer; }
.tl-fill-modes { margin: 12px 0 4px; align-self: flex-start; }
.tl-frows { flex: 1; min-height: 0; overflow: auto; margin: 4px -4px 0; padding: 0 4px; }
.tl-frow { padding: 12px 0; border-top: 1px solid var(--line); }
.tl-frow-h { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); margin-bottom: 8px; }
.tl-frow-h span { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.tl-fcards { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.tl-fill .tl-fc {
  flex-shrink: 0; width: 72px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--sunk);
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer; text-align: left; opacity: .55;
}
.tl-fc:hover { opacity: .85; }
.tl-fc.on { border-color: var(--accent); opacity: 1; box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-fc img, .tl-fc-ph { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: flex; align-items: center; justify-content: center; background: #d9dce1; color: var(--muted); font-size: var(--fs-xs); }
.tl-fc-ph.ai { background: var(--accent-soft); color: var(--accent-ink); }
.tl-fc small { padding: 4px 4px; font-size: 10px; line-height: 1.4; color: var(--text); white-space: nowrap; overflow: hidden; }
.tl-fc small em { display: block; font-style: normal; color: var(--muted); }
.tl-fc small em.ok { color: var(--ok); }
.tl-fc small em.warn { color: var(--fail); }
.tl-fc-none { align-self: center; font-size: var(--fs-xs); color: var(--muted); }
.tl-fill-f { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.tl-fill-f label { display: inline-flex; align-items: center; gap: 4px; margin: 0; white-space: nowrap; font-size: var(--fs-sm); color: var(--text); }
.tl-fill-f input[type=number] { width: 56px; margin: 0; padding: 4px 8px; font: 13px var(--font); border: 1px solid var(--line); border-radius: 6px; }
.tl-fill-note { flex: 1; min-width: 200px; font-size: var(--fs-xs); color: var(--muted); }
.tl-fill button { width: auto; text-align: center; }
.tl-fill-f button { min-width: 96px; }

.tl-talk { font-style: normal; font-size: 11px; padding: 0 4px; border-radius: 3px; background: var(--run-soft); color: var(--run); }
.tl-speech { margin-top: 12px; }
.tl-speech pre { margin: 4px 0; padding: 8px; background: var(--sunk); border-radius: var(--radius); font: 12px/1.6 var(--font); white-space: pre-wrap; }
.tl-speech-note { margin-top: var(--sp-1); color: var(--run); }

/* 改法：选中的一段或几段一起改人物、「想怎么改」 */
.tl-chg .tl-sec-h em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 8px; font-weight: 400; }
.tl-chg-n { font-size: var(--fs-xs); color: var(--accent-ink); margin-left: 8px; }
.tl-chg-f { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); }
.tl-chg-f input, .tl-chg-f select, .tl-chg-f textarea { width: 100%; box-sizing: border-box; font-size: var(--fs-sm); }
.tl-chg-f textarea { resize: vertical; font-family: inherit; line-height: 1.5; }
.tl-chg-hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.tl-chg-tag { background: var(--accent-soft); color: var(--accent-ink); }
.tl-voice { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.tl-voice > span:first-child { color: var(--muted); font-size: var(--fs-sm); }

/* 素材栏收起：只留一条竖向入口 */
.tl-lib.closed { display: none; }
.tl-lib-rail {
  flex-shrink: 0; width: 44px !important; padding: 12px 0 !important; display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--panel); color: var(--muted);
}
.tl-lib-rail[hidden] { display: none; }
.tl-lib-rail span { writing-mode: vertical-rl; letter-spacing: .2em; font-size: var(--fs-sm); }
.tl-lib-rail:hover { color: var(--text); background: var(--sunk); }
.as-fold { display: inline-grid; place-items: center; width: 28px !important; height: 28px; padding: 0 !important; border: 0; background: none; color: var(--muted); }
.as-fold:hover { color: var(--text); background: var(--sunk); }
.ap-h b { margin-right: auto; }

/* 检查器没选段：概览（统计条用 ui.css 的 .stats） */
.tl-ovstats { margin: var(--sp-1) 0 var(--sp-4); grid-template-columns: repeat(3, minmax(0, 1fr)); }  /* 检查器窄，三格并排 */
.tl-ovstats .stat { padding: var(--sp-3); }
.tl-insp-h { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 8px; font-size: var(--fs-sm); font-weight: 600; }
.tl-insp-h span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; color: var(--muted); }
.tl-insp .ip { margin: 0; }
.tl-insp .ip-list { flex-direction: row; flex-wrap: wrap; }
.tl-insp .ip-item > .thumb { width: 56px; border-radius: 6px; overflow: hidden; background: #fff; }
.tl-insp .ip-item > .thumb img { aspect-ratio: 1; object-fit: contain; background: #fff; }
.tl-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); color: var(--muted); }
.tl-steps li::marker { color: var(--faint); font-variant-numeric: tabular-nums; }
