/* app.css — 全部工具页共用的样式（assets/app/app.css）。

   骨架和配色直接继承隔壁 imgkit 的 img.css（同一套 Tailwind v4 色板：
   stone-50 底、白卡片、zinc-200 边框、indigo-600 主色）：
     · 还没选文件：工作区居中摆大标题 + 副标题 + 虚线拖放区
     · 选了文件之后：左边工作区（预览/结果），右边 300px 设置栏，
       主操作按钮钉在栏底

   本站特有的三块：
     · 提取页：影片舞台 + 字幕区选框（.regbox）、进度条、cue 结果表
     · 编辑器：影片 + 字幕列表（.edrow）、时间轴条
     · 对比页：左右两栏 diff 高亮

   报错一律红色 + ⚠ 前缀（不只靠颜色）。 */
:root {
  --page: #fafaf9;
  --bg: #fff;           --bg-elevated: #fff;  --bg-sunken: #f5f5f4;
  --heading: #171717;
  --text: #404040;      --text-muted: #525252; --text-faint: #737373;
  --border: #e4e4e7;    --border-strong: #d4d4d8;
  --accent: #4f39f6;    --accent-hover: #432dd7; --accent-soft: #eef2ff;
  --ok: #16a34a;        --ok-soft: #dcfce7;
  --warn: #d97706;      --warn-soft: #fef3c7;
  --err: #dc2626;       --err-soft: #fee2e2;
  --radius: 16px;       --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px -1px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.10);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0a0a0a; --bg: #171717; --bg-elevated: #171717; --bg-sunken: #262626;
    --heading: #f5f5f5;
    --text: #d4d4d4; --text-muted: #a3a3a3; --text-faint: #737373;
    --border: #2e2e2e; --border-strong: #404040;
    --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e1b4b;
    --ok: #4ade80; --ok-soft: #052e16;
    --warn: #fbbf24; --warn-soft: #451a03;
    --err: #f87171; --err-soft: #450a0a;
    --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px -1px rgba(0,0,0,.5);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -4px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --page: #0a0a0a; --bg: #171717; --bg-elevated: #171717; --bg-sunken: #262626;
  --heading: #f5f5f5;
  --text: #d4d4d4; --text-muted: #a3a3a3; --text-faint: #737373;
  --border: #2e2e2e; --border-strong: #404040;
  --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e1b4b;
  --ok: #4ade80; --ok-soft: #052e16;
  --warn: #fbbf24; --warn-soft: #451a03;
  --err: #f87171; --err-soft: #450a0a;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px -1px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -4px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); overflow-x: clip; }
body {
  margin: 0; padding: 0;
  background: none; color: var(--text);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
h1 {
  margin: 10px 0 12px; font-size: 40px; font-weight: 800;
  letter-spacing: -.025em; text-align: center; color: var(--heading);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
h1 .h1ic { display: inline-flex; flex: none; }
h1 .h1ic svg { width: 36px; height: 36px; display: block; }
.lede {
  margin: 0 auto 26px; max-width: 64ch; text-align: center;
  font-size: 19px; line-height: 1.7; color: var(--text-muted);
}
h2 { margin: 30px 0 12px; font-size: 16px; font-weight: 600; color: var(--heading); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code, kbd { font-family: var(--mono); font-size: .9em; }
kbd {
  padding: 1px 6px; border: 1px solid var(--border-strong);
  border-radius: 5px; background: var(--bg-sunken);
}
button {
  font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-elevated);
  border-radius: 10px; padding: 8px 15px;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .14s, opacity .14s;
}
button:hover:not(:disabled) { background: var(--bg-sunken); }
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
  box-shadow: var(--shadow);
}
button.primary:hover:not(:disabled) {
  background: var(--accent-hover); border-color: var(--accent-hover); color: #fff;
}
button.danger:hover:not(:disabled) { background: var(--err-soft); color: var(--err); }
button .ic { display: inline-flex; flex: none; }
button .ic svg { width: 17px; height: 17px; display: block; }
button.on, button[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
select, input[type="number"], input[type="text"], textarea {
  font: inherit; color: inherit; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 7px 10px;
}
select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input[type="range"] { accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ================= 工具页骨架：工作区 + 右侧设置栏 ================= */
.tool { display: flex; align-items: stretch; min-height: 70vh; }
.workarea {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column;
  padding: 26px 26px 0;
}
.side {
  flex: 0 0 300px; width: 300px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 20px 20px;
  position: sticky; top: 60px; align-self: flex-start;
  height: calc(100vh - 60px); overflow: hidden;
}
.side__panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.side__body { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.side__panel h2 { margin: 0 0 18px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.side .opts { flex-direction: column; align-items: stretch; gap: 14px; }
.side .opts > * { min-width: 0; max-width: 100%; }
.side .opt input[type="text"], .side .opt select, .side .opt input[type="number"],
.side .opt input[type="file"] { width: 100%; max-width: 100%; }
.side .opt .inline { justify-content: space-between; }
.side__foot { margin-top: auto; padding-top: 16px; }
.side__body + .side__foot { border-top: 1px solid var(--border); }
.side__foot .primary {
  width: 100%; height: 56px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 600; letter-spacing: .01em;
}
.side__foot .hint { margin: 8px 0 0; text-align: center; }
.side__foot button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.side__foot button .ic { display: inline-flex; flex: none; }
.side__foot button .ic svg { width: 17px; height: 17px; display: block; }
.side__foot .zipbtn { width: 100%; margin-top: 8px; }

/* 侧栏只在设置面板露出来的时候才占位。欢迎态（还没选文件）里 #panel 是
   hidden 的，整条 aside 就该收掉 —— 否则右边会空出一条 300px 的灰栏
   （用户报的就是这个）。imgkit 的做法是 JS 里连同 aside 一起 hidden；
   这里站点 18 个页面的 aside 都只装一个 #panel，用 :has() 一条规则
   一处生效，页面脚本一行都不用改（面板一显示，栏自己就回来了）。 */
.tool:has(> .side > .side__panel[hidden]) > .side { display: none; }

/* 空状态：工作区居中摆标题 + 拖放区 */
.welcome { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.workspace { flex: 1 1 auto; min-width: 0; }
.wstools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; min-height: 46px; }
.wstools .grow { flex: 1 1 auto; }
.addbtn, .wstools > button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
}
.addbtn .ic, .wstools > button .ic { display: inline-flex; flex: none; color: var(--text-muted); }
.addbtn .ic svg, .wstools > button .ic svg { width: 17px; height: 17px; display: block; }
#zipBtn:not(:disabled), .zipbtn:not(:disabled) {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600; box-shadow: var(--shadow);
}
#zipBtn:not(:disabled) .ic, .zipbtn:not(:disabled) .ic { color: #fff; }
.addbtn {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--accent); font-weight: 600;
}
.addbtn .ic { color: var(--accent); }
.addbtn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-elevated));
  border-color: var(--accent); color: var(--accent);
}

/* ---------- 拖放区 ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 30px 20px 34px; margin: 0 auto 20px; max-width: 760px;
  cursor: pointer; text-align: center;
  background: var(--bg-elevated);
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 16px;
  transition: background .15s, border-color .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop__btn {
  display: inline-block; padding: 20px 48px; min-width: 285px;
  border-radius: 12px; line-height: 1.4;
  background: var(--accent); color: #fff;
  font-size: 20px; font-weight: 600;
  box-shadow: var(--shadow);
  transition: background .14s, box-shadow .14s, transform .14s;
}
.drop:hover .drop__btn, .drop.over .drop__btn {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}
.drop__sub { color: var(--text-muted); font-size: 15px; }
.drop__sub kbd { font-size: .92em; }
.drop-formats { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.welcome .sub { font-size: 14px; color: var(--text-faint); margin-top: 6px; text-align: center; }

/* ---------- 设置面板 ---------- */
.panel {
  background: var(--bg-elevated); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 22px;
}
.opts { display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-end; }
.opts + .opts { margin-top: 18px; }
.opt { display: flex; flex-direction: column; gap: 6px; }
.opt > span { font-size: 13.5px; color: var(--text-muted); }
.opt .inline { display: flex; align-items: center; gap: 8px; }
.opt input[type="number"] { width: 92px; }
.opt input[type="range"] { width: 100%; accent-color: var(--accent); }
.opt input[type="color"] {
  width: 46px; height: 34px; padding: 2px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer;
}
.range { display: flex; align-items: center; gap: 9px; width: 100%; }
.range > span:first-child { flex: 0 0 auto; font-size: 14px; color: var(--text-muted); min-width: 4.2em; }
.range input[type="range"] { flex: 1 1 auto; width: auto; min-width: 0; margin: 0; accent-color: var(--accent); }
.range .qval { flex: 0 0 auto; font-size: 13.5px; color: var(--text-faint); min-width: 2.8em; text-align: right; }
.range .qval--edit, .side .opt .range .qval--edit, .side .opts > .range .qval--edit {
  width: 4.6em; min-width: 0; padding: 3px 5px;
  font-size: 13px; text-align: right; color: var(--text);
}
.range .qval-unit { flex: none; font-size: 13.5px; color: var(--text-faint); }
.hint { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.hint.err { color: var(--err); }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }

/* 三档速度药丸（提取页的每秒采样数） */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1 1 0; font-size: 13px; padding: 7px 4px; line-height: 1.35; white-space: nowrap;
  background: var(--bg-sunken); color: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--radius-sm);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- 引擎状态条 / 进度 ---------- */
.engine {
  display: flex; flex-direction: column; gap: 8px;
  margin: 16px 0 0; padding: 12px 15px;
  background: var(--bg-elevated); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 14.5px;
}
.engine__text { color: var(--text-muted); overflow-wrap: anywhere; }
.engine--busy .engine__text { color: var(--text); }
.engine--ok { background: var(--ok-soft); }
.engine--ok .engine__text { color: var(--ok); font-weight: 600; }
.engine--bad { background: var(--err-soft); }
.engine--bad .engine__text { color: var(--err); font-weight: 600; }
.engine__bar { height: 6px; border-radius: 99px; overflow: hidden; background: var(--bg-sunken); }
.engine__bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .18s linear; }

.status { margin: 14px 0 0; font-size: 14.5px; color: var(--text-muted); }
.status.err { color: var(--err); }
.empty { color: var(--text-muted); font-size: 15px; }

/* =====================================================================
   提取页：影片舞台 + 字幕区选框
   ===================================================================== */
.stage-wrap {
  position: relative; margin-bottom: 16px;
  display: flex; justify-content: center;
}
.stage {
  position: relative; margin: 0 auto; max-width: 100%;
  background: #000; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; line-height: 0;
}
.stage video { display: block; max-width: 100%; max-height: 44vh; height: auto; }

/* 提取页的播放舞台：**贴着画面本身**。舞台是个块级元素，默认撑满整列 ——
   横屏素材恰好占满看不出问题，竖屏（720×960 这类）就会在右边留出一大片
   黑，叠字还居中到黑边上（用户截的就是这个）。改成 fit-content + 居中：
   黑框跟着画面走，叠字、选框的坐标原点也和画面左边缘对齐。
   高度上限提到 52vh：竖屏素材由此能多占一截，宽了也不亏（横屏撞的是
   max-width 那条线）。 */
/* 舞台撑满整格：黑底盒子，视频在里面**居中**（横屏上下留黑边、竖屏左右留黑边），
   和参考站的播放器一个样子。没视频的时候就是一块黑的。 */
#stage {
  width: auto; height: 100%; flex: 1 1 auto; min-height: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
}
#stage video {
  max-width: 100%; max-height: 100%; width: auto; height: auto; flex: none;
}
/* 侧栏页签（编辑 / 翻译 / 校对 / 统计） */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 9px 8px 0; border-bottom: 1px solid var(--border); }
.tabs button {
  padding: 6px 7px; font-size: 12px; border-radius: 8px 8px 0 0;
  color: var(--text-muted); border: 1px solid transparent; border-bottom: none;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] {
  color: var(--heading); background: var(--bg-elevated);
  border-color: var(--border); font-weight: 600;
}

/* 结果列表顶上那条（条数 + 显示模式） */
.edbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 2px 8px;
}
.seg--sm button { padding: 3px 9px; font-size: 12.5px; border-radius: 8px; }

/* 校对结果：一条一行，点击跳到该行 */
.chk { display: flex; flex-direction: column; gap: 8px; }
.chk__row {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 11px; cursor: pointer;
  background: var(--bg-elevated);
}
.chk__row:hover { border-color: var(--accent); }
.chk__row .lvl { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.chk__row .lvl.warn { background: var(--warn-soft); color: var(--warn); }
.chk__row .lvl.info { background: var(--bg-sunken); color: var(--text-muted); }
.chk__row .what { flex: 1 1 auto; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.chk__row .what b { color: var(--heading); }
.chk__row .at { flex: 0 0 auto; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* 统计表 */
.stats { display: flex; flex-direction: column; gap: 2px; }
.stats__row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.stats__row b { color: var(--heading); font-variant-numeric: tabular-nums; }
.stats__row span { color: var(--text-muted); }
.stats h3 { margin: 14px 2px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }

/* 编辑器的行内动作按钮：和提取页的 .cacts 一套（细分割线 + 圆形小按钮） */
.edrow .eacts {
  display: inline-flex; align-items: center; gap: 1px; align-self: start;
  padding-left: 6px; border-left: 1px solid var(--border);
}
.edrow .eacts button {
  border: 0; background: none; padding: 3px 5px; line-height: 1; border-radius: 6px;
  color: var(--text-faint); display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s;
}
.edrow .eacts button svg { width: 14px; height: 14px; flex: none; display: block; }
.edrow .eacts button:hover { color: var(--text); background: var(--bg-sunken); }
.edrow .eacts button[disabled] { opacity: .28; cursor: default; }
.edrow .eacts button[disabled]:hover { background: none; color: var(--text-faint); }
.edrow .eacts .eplay { color: var(--accent); }
.edrow .eacts .eplay:hover { background: var(--accent-soft); }
.edrow .eacts .edel { font-size: 12px; }
.edrow .eacts .edel:hover { color: var(--err); background: var(--err-soft); }

/* 翻译后的第二行（双语显示） */
.edrow .tr {
  grid-column: 2 / -1; margin: -2px 0 0; font: inherit; font-size: 13px; color: var(--text-muted);
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); padding-left: 8px;
  border-top: 1px solid transparent; border-right: 1px solid transparent; border-bottom: 1px solid transparent;
  background: transparent; resize: none; overflow: hidden; field-sizing: content;
  border-radius: 0 6px 6px 0; width: 100%; display: block;
}
.edrow .tr:hover { border-color: var(--border-strong); border-left-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.edrow .tr:focus { border-color: var(--accent); background: var(--bg); }

/* 首次使用的「拖拽框选」指引条：放在播放舞台**下面**（画面外）——
   原来浮在画面上，竖屏素材里它会盖住大半个画面和选框。放在这里既不
   挡画面，又正好占用竖屏旁边/下面的空地。拖过一次就永久收起。 */
.regcall {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 10px 0 0; padding: 11px 13px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px;
}
.regcall .ic { flex: none; color: var(--accent); display: inline-flex; margin-top: 2px; }
.regcall .ic svg { width: 15px; height: 15px; display: block; }
.regcall p { flex: 1 1 auto; margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }
.regcall p b { color: var(--heading); }
.regcall button {
  flex: none; padding: 5px 11px; font-size: 12.5px; border-radius: 8px;
  border: 1px solid var(--border-strong); color: var(--text-muted); background: var(--bg-elevated);
}
.regcall button:hover { color: var(--text); }

/* =====================================================================
   播放器控制条（player-bar.js）：压在画面底部，深色半透明。
   容器一律 pointer-events:none，只有按钮和进度条吃事件 —— 这样它不会
   挡住下面那个「字幕区域」选框的把手（鼠标压到框上时它还会自动让开）。
   ===================================================================== */
.pbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 26px 10px 8px; line-height: 1.4;      /* 舞台 line-height:0，这里要回来 */
  background: linear-gradient(to top, rgba(6, 8, 12, .86), rgba(6, 8, 12, .5) 52%, transparent);
  pointer-events: none;
  transition: opacity .18s ease;
}
.pbar--hide { opacity: 0; }
.pbar__row { display: flex; align-items: center; gap: 5px; margin-top: 4px; pointer-events: none; }
.pbar__row button, .pbar__row .pbmenu, .pbar__row .pbwrap { pointer-events: auto; }
.pbar__sp { flex: 1 1 auto; }
.pbar__time {
  color: #fff; font-size: 12.5px; padding: 0 6px; white-space: nowrap;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
/* 进度条 */
.pbar__seek { position: relative; height: 16px; cursor: pointer; pointer-events: auto; touch-action: none; }
.pbar__seek::before {
  content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 4px;
  border-radius: 99px; background: rgba(255, 255, 255, .28);
}
.pbar__buf, .pbar__fill {
  position: absolute; left: 0; top: 6px; height: 4px; border-radius: 99px; width: 0;
}
.pbar__buf { background: rgba(255, 255, 255, .22); }
.pbar__fill { background: var(--accent); }
.pbar__knob {
  position: absolute; top: 1.5px; left: 0; width: 13px; height: 13px; margin-left: -6.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .55);
  transform: scale(.85); transition: transform .12s;
}
.pbar__seek:hover .pbar__knob { transform: scale(1.1); }
.pbar__bub {
  position: absolute; bottom: 18px; transform: translateX(-50%);
  background: rgba(10, 12, 16, .94); color: #fff; font-size: 11.5px;
  padding: 3px 8px; border-radius: 7px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5); pointer-events: none;
}
/* 按钮 */
.pbar .pb {
  width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; padding: 0;
  background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, transform .12s;
}
/* flex:none 不能省：全局 button 样式带内边距，SVG 作为 flex 子项会被压扁
   （图标渲染成 4px 宽的一根线，踩过） */
.pbar .pb svg { width: 17px; height: 17px; flex: none; display: block; }
.pbar .pb:hover { background: rgba(255, 255, 255, .18); }
.pbar .pb:active { transform: scale(.94); }
.pbar .pb--main { background: #fff; color: #101216; margin: 0 2px; }
.pbar .pb--main:hover { background: #e9ebf1; }
/* 逐帧：装在一颗小胶囊里，和主播放键区分开（精调工具 vs 走带） */
.pbar__step {
  display: inline-flex; gap: 2px; padding: 2px; margin-left: 4px;
  background: rgba(255, 255, 255, .13); border-radius: 99px; pointer-events: auto;
}
.pbar .pb--sm { width: 26px; height: 26px; color: rgba(255, 255, 255, .92); }
.pbar .pb--sm svg { width: 15px; height: 15px; }
.pbar .pb--rate {
  width: auto; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 650;
  border: 1px solid rgba(255, 255, 255, .38); letter-spacing: .01em;
}
.pbwrap { position: relative; display: inline-flex; }
.pbmenu {
  position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 6;
  background: rgba(14, 16, 22, .97); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 11px; padding: 5px; display: flex; flex-direction: column; gap: 1px;
  min-width: 128px; box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
}
.pbmenu button {
  text-align: left; color: #fff; font-size: 13px; padding: 6px 10px;
  border-radius: 7px; border: 0; background: none; white-space: nowrap;
}
.pbmenu button:hover { background: rgba(255, 255, 255, .14); }

/* 舞台窄（竖屏素材）时收一号：控制条在 351px 宽的竖屏里塞不下，
   时间会折行、最右边的全屏键被挤出画面（player-bar 按舞台宽度加这个类）。 */
.pbar--narrow { padding: 18px 6px 6px; }
.pbar--narrow .pbar__row { gap: 2px; }
.pbar--narrow .pb { width: 28px; height: 28px; }
.pbar--narrow .pb svg { width: 15px; height: 15px; }
.pbar--narrow .pb--main { width: 32px; height: 32px; margin: 0; }
.pbar--narrow .pb--sm { width: 22px; height: 22px; }
.pbar--narrow .pb--sm svg { width: 13px; height: 13px; }
.pbar--narrow .pbar__step { padding: 1px; margin-left: 1px; }
.pbar--narrow .pb--rate { padding: 0 7px; font-size: 11.5px; }
.pbar--narrow .pbar__time { font-size: 11.5px; padding: 0 3px; }

/* 处理范围：两个 mm:ss 输入 + 一颗小按钮 */
.range--times { gap: 7px; }
.range--times input[type="text"] { width: 5.2em; text-align: center; font-variant-numeric: tabular-nums; }
.range--times .qval-unit { font-size: 13px; }
.mini {
  padding: 4px 9px; font-size: 12.5px; border-radius: 8px; white-space: nowrap;
  color: var(--text-muted); border: 1px solid var(--border);
}
.mini:hover { color: var(--text); }

/* 选框层：盖在画面上，本身不吃事件（和 imgkit 的 .overlay 一个教训），
   只有选框自己收 */
.stage .overlay { position: absolute; inset: 0; line-height: 1.4; pointer-events: none; }
.regbox {
  position: absolute; cursor: move; touch-action: none; pointer-events: auto;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 9999px rgba(16, 17, 20, .55);
  border-radius: 3px;
}
.regbox::before {
  content: ""; position: absolute; inset: 0;
  border: 1px dashed rgba(20,20,22,.5); border-radius: 2px; pointer-events: none;
}
.regbox .hd {
  position: absolute; width: 14px; height: 14px; z-index: 2;
  background: #fff; border: 1px solid rgba(20,20,22,.5); border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.regbox .hd-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.regbox .hd-n  { left: 50%; top: -7px; margin-left: -7px; cursor: ns-resize; }
.regbox .hd-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.regbox .hd-w  { left: -7px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.regbox .hd-e  { right: -7px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.regbox .hd-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.regbox .hd-s  { left: 50%; bottom: -7px; margin-left: -7px; cursor: ns-resize; }
.regbox .hd-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.regbox .sz {
  /* 尺寸角标放**右上**：右下角现在归播放器控制条（两者叠一起糊成一团） */
  position: absolute; right: 4px; top: 4px;
  padding: 1px 8px; border-radius: 99px; white-space: nowrap;
  background: rgba(20,20,22,.72); color: #fff;
  font: 500 11px/1.7 var(--sans); font-variant-numeric: tabular-nums;
}

/* 影片下面那条播放控制（原生 controls 太窄的时候够用，宽屏用这条） */
.vbar { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; flex-wrap: wrap; }
.vbar .tnow { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--text-muted); min-width: 7.5em; }
.vbar .grow { flex: 1 1 auto; }

/* 文件条（批量时切换当前片） */
.filebar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fchip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px;
  padding: 7px 12px; border-radius: 10px; cursor: pointer;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  font-size: 13.5px;
}
.fchip:hover { border-color: var(--accent); }
.fchip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.fchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip .st { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--bg-sunken); color: var(--text-muted); font-weight: 500; }
.fchip .st.done { background: var(--ok-soft); color: var(--ok); }
.fchip .st.busy { background: var(--accent-soft); color: var(--accent); }
.fchip .st.err { background: var(--err-soft); color: var(--err); }
.fchip .x { border: 0; background: none; padding: 0 2px; color: var(--text-faint); font-size: 14px; line-height: 1; }
.fchip .x:hover { color: var(--err); background: none; }

/* ---------- 结果：cue 表 ---------- */
#results { scroll-margin-top: 84px; }
.reshead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 12px; }
.reshead h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.reshead .grow { flex: 1 1 auto; }
.statline { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 12px; border-radius: 99px; font-size: 13px;
  background: var(--bg-sunken); color: var(--text-muted);
}
.stat b { color: var(--heading); font-variant-numeric: tabular-nums; }
.stat.ok b { color: var(--ok); }
.stat.warn b { color: var(--warn); }

.cues { display: flex; flex-direction: column; gap: 6px; }
.cues .crow {
  display: grid; grid-template-columns: 118px 1fr 34px; gap: 10px; align-items: start;
  padding: 8px 10px; border-radius: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  transition: border-color .12s, box-shadow .12s;
}
.cues .crow:hover { border-color: var(--border-strong); }
.cues .crow.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cues .crow .tm {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); line-height: 1.7;
  display: flex; flex-direction: column; gap: 2px; padding-top: 3px;
}
.cues .crow .tm input {
  font: inherit; padding: 2px 5px; width: 100%; border-radius: 5px;
  border: 1px solid transparent; background: transparent; color: inherit;
}
.cues .crow .tm input:hover { border-color: var(--border-strong); }
.cues .crow .tm input:focus { border-color: var(--accent); background: var(--bg); box-shadow: none; }
.cues .crow .tx {
  font: inherit; font-size: 15px; line-height: 1.55; color: var(--text);
  width: 100%; border-radius: 6px; padding: 4px 7px; min-height: 34px;
  border: 1px solid transparent; background: transparent; resize: vertical;
  display: block;
}
.cues .crow .tx:hover { border-color: var(--border-strong); }
.cues .crow .tx:focus { border-color: var(--accent); background: var(--bg); box-shadow: none; }
.cues .crow .rm {
  border: 0; background: none; padding: 4px; color: var(--text-faint); font-size: 15px;
  border-radius: 6px; line-height: 1.2;
}
.cues .crow .rm:hover { color: var(--err); background: var(--err-soft); }
.cues .crow .cnf { font-size: 10.5px; color: var(--text-faint); }
.cues .crow .cnf.low { color: var(--warn); }
@media (max-width: 640px) {
  .cues .crow { grid-template-columns: 1fr 34px; }
  .cues .crow .tm { grid-column: 1; flex-direction: row; gap: 8px; }
}

/* 进度面板 */
.prog {
  margin: 18px 0 0; padding: 16px 18px;
  background: var(--bg-elevated); border-radius: var(--radius); box-shadow: var(--shadow);
}
.prog__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.prog__t { font-size: 14.5px; color: var(--text-muted); }
.prog__t b { color: var(--heading); }
.prog__pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.prog__bar { height: 8px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
/* 不确定态：引擎/模型下载阶段没有确定进度，条纹来回跑比定格 0% 诚实 */
.prog__bar.indet i { width: 34%; animation: prog-slide 1.1s ease-in-out infinite alternate; }
@keyframes prog-slide { from { margin-left: 0; } to { margin-left: 66%; } }
.prog__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 99px; transition: width .2s ease; }
.prog__foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.prog__foot .grow { flex: 1 1 auto; }

/* 预览条：设置变了能当场看裁出来的样子。
   两张小图横着排、限高 84px —— 它们是「确认一眼」，不是主角；
   之前按原尺寸铺开，把下面的结果表整个顶到屏幕外面。 */
.preview-strip { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; }
/* 平时它是空的（只有「Test on this frame」会往里放一张裁图）——空的时候不占高度 */
.preview-strip:empty { display: none; }
.pv {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-sunken); padding: 8px 8px 6px;
}
.pv canvas { display: block; max-width: min(100%, 420px); max-height: 84px; width: auto; background: #000; border-radius: 4px; }
.pv figcaption { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }

/* 结果里「刚才这一条从哪里来的」的缩略图（提取页可点开看） */
.crow figure { margin: 0; }

/* ---------- 引擎徽章（提取/识别页顶部那颗「需联网取语言数据」） ---------- */
.pgbadge {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px; padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.pgbadge i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pgbadge i::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; animation: pgbadge-ping 1.9s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes pgbadge-ping { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
.workarea > .pgbadge { display: flex; width: fit-content; margin: 0 auto 18px; }


/* =====================================================================
   提取页的审阅台：左播放器 / 右字幕列表 / 底部时间轴
   ===================================================================== */
/* 审阅台：**左右等宽、上排等高**（参考截图：左半边是黑底播放器盒子，
   右半边列表同高，时间轴通栏在下面）。 */
.review {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: min(64vh, 660px) auto;
  grid-template-areas: 'left right' 'tl tl';
  align-items: stretch;
}
.review__left {
  grid-area: left; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.review__right {
  grid-area: right; min-width: 0; height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  /* 设置弹层是从这条列里弹出来的（绝对定位）——不能 overflow:hidden 裁掉它，
     圆角改由内部各段自己收（见下）。 */
  overflow: visible;
}
/* 右列顶栏：设置（齿轮）+ 提取按钮。原来「Extract subtitles」在侧栏最底下，
   要滚到底才看得见；现在摆在字幕列表正上方，动线顺。 */
.review__top {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-elevated);
}
.review__top .grow { flex: 1 1 auto; }
.review__top .primary { height: 38px; padding: 0 15px; border-radius: 11px; font-size: 14.5px; }
.ghostbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-muted); font-size: 13.5px;
}
.ghostbtn .ic { display: inline-flex; }
.ghostbtn .ic svg { width: 15px; height: 15px; display: block; }
.ghostbtn:hover { color: var(--text); border-color: var(--border-strong); }
.ghostbtn[aria-expanded="true"] {
  color: var(--heading); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
/* 设置弹层：从顶栏下拉，盖在列表上 */
.setpop {
  position: absolute; right: 10px; top: calc(100% - 4px); z-index: 25;
  width: min(336px, calc(100% - 20px));
  max-height: min(72vh, 640px); overflow: auto;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px 14px 16px;
}
.setpop__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.setpop__head b { flex: 1 1 auto; font-size: 15px; color: var(--heading); }
.setpop__head button {
  border: 0; background: none; color: var(--text-faint); font-size: 13px;
  padding: 2px 6px; border-radius: 6px;
}
.setpop__head button:hover { color: var(--text); background: var(--bg-sunken); }
/* 弹层里的控件和侧栏那套一样铺满 */
.setpop .opts { flex-direction: column; align-items: stretch; gap: 13px; }
.setpop .opts > * { min-width: 0; max-width: 100%; }
.setpop .opt input[type="text"], .setpop .opt select, .setpop .opt input[type="number"] { width: 100%; max-width: 100%; }
.setpop .opt .inline { justify-content: space-between; }
.setpop .seg button { flex: 1 1 auto; }
.review__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.review__count { font-size: 12.5px; color: var(--text-muted); }
.review__count.err { color: var(--err); font-weight: 600; }
.review__search {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  color: var(--text-faint);
}
.review__search .ic svg { width: 14px; height: 14px; display: block; }
.review__search input {
  border: 0; background: none; outline: none; color: var(--text);
  font: inherit; font-size: 13px; width: 130px; padding: 2px 0;
}
/* 字幕列表：**无框表格** —— 一行一条，行间一条细线，没有卡片边框
   （参考站的列表就是这样：时间做成小胶囊、当前行浅色高亮、行间细线）。 */
.cuelist {
  /* 和左列同高，内容多了自己滚（外层 .review__right 的高度由网格行给定） */
  overflow-y: auto; flex: 1 1 auto; min-height: 0; max-height: none;
  padding: 0; display: flex; flex-direction: column; gap: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
/* 审阅列表里那条操作提示（可点性说明） */
.review__hint {
  padding: 8px 12px 9px; font-size: 12px; line-height: 1.55;
  color: var(--text-faint); border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}
.review__hint b { color: var(--text-muted); font-weight: 600; }

.cuelist .crow {
  position: relative;
  border: 0; border-radius: 0; background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 9px 14px 11px 15px;
  transition: background .12s;
  cursor: pointer;                 /* 整行可点 = 跳到这条字幕 */
}
.cuelist .crow:last-child { border-bottom: 0; }
/* 左边那条指示条：悬停/当前行亮起来，「这行能点」一眼可见 */
.cuelist .crow::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0;
  transition: opacity .12s;
}
.cuelist .crow:hover { background: var(--bg-sunken); }
.cuelist .crow:hover::before { opacity: .45; }
/* 当前播放到的那条：浅强调底色 + 左条实心（和参考站一样的浅色高亮） */
.cuelist .crow.on { background: var(--accent-soft); }
.cuelist .crow.on::before { opacity: 1; }
.cuelist .crow__head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.cuelist .crow__head .grow { flex: 1 1 auto; }
/* 每行的动作按钮：播放/加一条/并入下一条/删除 */
/* 三颗动作按钮一组，左侧一条细分割线，和「时间/时长/置信度」分开 */
.cuelist .crow__head .cacts {
  display: inline-flex; align-items: center; gap: 1px;
  margin-left: 4px; padding-left: 6px; border-left: 1px solid var(--border);
}
.cuelist .crow__head button {
  border: 0; background: none; padding: 3px 5px; line-height: 1; border-radius: 6px;
  color: var(--text-faint); display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s;
}
.cuelist .crow__head button svg { width: 14px; height: 14px; display: block; }
.cuelist .crow__head button:hover { color: var(--text); background: var(--bg-sunken); }
.cuelist .crow__head button[disabled] { opacity: .28; cursor: default; }
.cuelist .crow__head button[disabled]:hover { background: none; color: var(--text-faint); }
.cuelist .crow__head .cplay { color: var(--accent); }
.cuelist .crow__head .cplay:hover { background: var(--accent-soft); }
/* 时间和时长是小胶囊：浅底、圆角、等宽数字 —— 扫读时一眼分得开 */
.cuelist .ctime {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; cursor: pointer;
  background: var(--bg-sunken); border-radius: 6px; padding: 2px 8px;
}
.cuelist .crow.on .ctime { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cuelist .ctime:hover { color: var(--accent); text-decoration: underline; }
.cuelist .cdur, .cuelist .cconf {
  font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums;
  background: var(--bg-sunken); border-radius: 6px; padding: 2px 7px;
}
.cuelist .crow.on .cdur, .cuelist .crow.on .cconf { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cuelist .cconf.low { color: var(--warn); }
.cuelist .crow__head .crm { font-size: 12px; }
.cuelist .crow__head .crm:hover { color: var(--err); background: var(--err-soft); }
.cuelist .ctext {
  display: block; width: 100%; border: 0; border-radius: 4px; box-sizing: border-box;
  background: transparent; color: var(--text); font: inherit; font-size: 14.5px;
  line-height: 1.5; padding: 0; resize: none; overflow: hidden;
  /* Chrome 123+ 按内容自适应高度；老浏览器靠 JS 的 autoGrow 兜底 */
  field-sizing: content;
}
/* 编辑时给个清晰的焦点框，但不改变尺寸（整行不会跳一下） */
.cuelist .ctext:focus { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 视频上的实时叠字：**放顶部**（字幕区域的选框在下半屏，叠字原来贴底，
   两个正好叠在一起），黑底半透明 + 白字 —— 字看得清，底下的画面还透得出来。
   它不是「播放预览」，不需要模仿原生字幕的位置，别挡住选框才是正事。 */
.review__sub {
  /* left/top/width 由 JS 按视频在舞台里的实际位置给（layoutOverlays） */
  position: absolute; left: 0; right: auto; top: 0; width: 100%;
  text-align: center; pointer-events: none; padding: 9px 6% 0;
  /* 舞台自己 line-height: 0（为了消掉视频下面的基线缝隙），叠字得把行高
     要回来 —— 否则黑底背景会塌成一条细线（字还能画出来，但底没了） */
  line-height: 1.4;
}
.review__sub span {
  display: inline-block; white-space: pre-wrap;
  font-size: clamp(15px, 3vh, 28px); font-weight: 700; letter-spacing: .01em;
  color: #fff;
  background: rgba(8, 10, 14, .66);
  border-radius: 9px; padding: 3px 13px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .35);
  backdrop-filter: blur(2px);
  margin: 0 auto;
  max-width: 100%;
}

/* 操作反馈：固定在视口底部居中（原来跟在内容流里，页面一长就飘到屏幕外，
   「点了没反应」多半是它没被看见）。 */
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 60; max-width: min(560px, 92vw); margin: 0;
  padding: 10px 16px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); text-align: center;
}

/* ---------- 底部时间轴 ---------- */
/* 提取进行中：右边的旧结果先留着看，但明确「暂时不能点」（扫描在拉播放头） */
.review__right.is-busy .cuelist,
.review__right.is-busy .review__bar,
.review__right.is-busy .review__hint { opacity: .5; pointer-events: none; }
.review__right.is-busy .cuelist::after {
  content: 'Reading the video — the list unlocks when it finishes';
  display: block; padding: 14px 16px; font-size: 12.5px; color: var(--text-muted);
}

/* 时间轴：整条通到窗口两边（参考截图里它就是一条通栏）——页面的 26px
   内边距用负 margin 抵掉，不用 100vw（vw 会把滚动条宽度也算进去，
   横向会多出一条滚动条）。 */
.review__tl {
  grid-area: tl;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 10px 26px 14px;
  margin: 2px -26px 0;
}
.tl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tl-head #tlNow b { color: var(--text-faint); font-weight: 600; margin-right: 4px; }
.tl-head #tlNow { font-variant-numeric: tabular-nums; }
.tl-head .grow { flex: 1 1 auto; }
.tl-head input[type="range"] { width: 130px; accent-color: var(--accent); }
.tl-strip {
  position: relative; height: 78px; overflow-x: auto; overflow-y: hidden;
  background: var(--bg-sunken); border-radius: 8px;
  cursor: crosshair; touch-action: none;      /* 拖 = 擦洗播放头 */
}
.tl-strip::-webkit-scrollbar { height: 8px; }
.tl-ruler {
  position: relative; height: 26px; min-width: 100%;
  /* 右端最后一个标签会超出轨道宽度 —— 不裁掉的话会把滚动容器撑出「假可滚动」
     宽度，播放头自动跟随就会莫名滚动（拖动擦洗时尤其致命） */
  overflow: hidden;
}
/* 主刻度：长线 + 时间文字；次刻度：短线（只有拉开距离才画） */
.tl-tick {
  position: absolute; top: 0; height: 100%;
  padding-left: 5px; font-size: 10.5px; color: var(--text-muted);
  border-left: 1px solid var(--border-strong);
  font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.5;
}
.tl-tick.minor {
  border-left-color: color-mix(in srgb, var(--border-strong) 55%, transparent);
  height: 7px; top: 19px; padding: 0;
}
/* 悬停时的竖直参考线 + 时间气泡 */
.tl-hover {
  position: absolute; top: 0; bottom: 0; width: 1px; z-index: 2;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  pointer-events: none;
}
.tl-bub {
  position: absolute; top: 2px; z-index: 3; transform: translateX(-50%);
  background: var(--heading); color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 6px; pointer-events: none;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  box-shadow: var(--shadow);
}
.tl-track { position: relative; height: 48px; min-width: 100%; }
.tl-cue {
  position: absolute; top: 2px; height: 40px; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 6px; cursor: pointer;
  font-size: 11.5px; line-height: 1.25; color: var(--text);
  padding: 3px 6px; white-space: nowrap; text-overflow: ellipsis;
  transition: background .12s;
}
.tl-cue:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.tl-play {
  position: absolute; top: 0; bottom: 0; width: 2px; z-index: 3;
  background: var(--err); pointer-events: none;
}
.tl-play::before {
  content: ''; position: absolute; top: -1px; left: -4px;
  border: 5px solid transparent; border-top-color: var(--err); border-bottom: 0;
}
@media (max-width: 1100px) {
  .review { grid-template-columns: 1fr; grid-template-areas: 'left' 'right' 'tl'; }
  .cuelist { max-height: 40vh; }
}

/* =====================================================================
   编辑器
   ===================================================================== */
/* 编辑器和提取页**同一套布局**：左右等宽等高（左黑盒播放器 / 右列表），
   时间轴通栏在下面，设置收进右上角的齿轮。 */
.edwrap {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: min(62vh, 640px) auto;
  grid-template-areas: 'left right' 'tl tl';
  align-items: stretch;
}
.edleft {
  grid-area: left; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.edright {
  grid-area: right; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  /* 设置弹层从这里弹出来，不能裁掉 */
  overflow: visible;
}
/* 右列顶栏：齿轮 +（导出/复制）——和提取页一样的排法 */
.edtop {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-elevated);
}
.edtop .grow { flex: 1 1 auto; }
.edbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px 6px;
}
.edbar .grow { flex: 1 1 auto; }
.edtl {
  grid-area: tl;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 10px 26px 14px; margin: 2px -26px 0;
}
.edstage {
  position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-lg); line-height: 0;
  /* 和提取页一致：黑底盒子撑满整格，视频在里面居中（横屏上下留黑边、
     竖屏左右留黑边）。字幕叠层的位置由 editor-page.js 按画面实际坐标摆。 */
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.edstage video { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; flex: none; }
.edlist {
  display: flex; flex-direction: column; gap: 0;
  flex: 1 1 auto; min-height: 0; overflow: auto; padding-right: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.edrow {
  position: relative;
  display: grid; grid-template-columns: 26px 118px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 8px 10px 10px 13px; border-radius: 0; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
}
.edrow:last-child { border-bottom: 0; }
.edrow:hover { background: var(--bg-sunken); }
.edrow.on { background: var(--accent-soft); box-shadow: none; }
.edrow.on::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.edrow .n { font-size: 11.5px; color: var(--text-faint); text-align: right; padding-top: 4px; font-variant-numeric: tabular-nums; }
.edrow .tm { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
/* 时间也做成小胶囊：浅底圆角，扫读时和正文分得开 */
.edrow .tm input {
  font: inherit; padding: 2px 6px; width: 100%; border-radius: 6px;
  border: 1px solid transparent; background: var(--bg-sunken); color: inherit;
}
.edrow .tm input:hover { border-color: var(--border-strong); }
.edrow .tm input:focus { border-color: var(--accent); background: var(--bg); }
.edrow .tx {
  font: inherit; font-size: 14px; line-height: 1.5; width: 100%;
  border-radius: 6px; padding: 3px 6px; min-height: 30px; display: block;
  border: 1px solid transparent; background: transparent;
  resize: none;          /* 高度跟着内容自己长（autoGrow），不要右下角的拖拽手柄 */
  overflow: hidden; field-sizing: content;
}
.edrow .tx:hover { border-color: var(--border); }
.edrow .tx:focus { border-color: transparent; background: transparent; outline: 2px solid var(--accent); outline-offset: 2px; }
.edrow.split { border-style: dashed; }

.edtools { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.edtools button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; font-size: 13.5px; }
.edtools button svg { width: 15px; height: 15px; }

/* 空编辑器欢迎条 */
.edempty {
  padding: 34px 20px; text-align: center; color: var(--text-muted);
  background: var(--bg-sunken); border-radius: var(--radius);
}

.linkbtn {
  border: 0; background: none; padding: 0; color: var(--accent);
  font: inherit; text-decoration: underline; cursor: pointer;
}
.linkbtn:hover { color: var(--accent-hover); background: none; }

/* =====================================================================
   转换/清理类工具：文件卡 + 结果
   ===================================================================== */
.filecard {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--bg-elevated); box-shadow: var(--shadow); margin-bottom: 12px;
}
.filecard .fic {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.filecard .fic svg { width: 20px; height: 20px; }
.filecard .fb { min-width: 0; flex: 1 1 auto; }
.filecard .fb b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.filecard .fb span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.filecard .fa { flex: none; display: flex; gap: 8px; align-items: center; }
.filecard .fa button { padding: 7px 12px; font-size: 13.5px; }

.result {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  margin-top: 16px; padding: 13px 16px; border-radius: var(--radius);
  background: var(--accent-soft); font-size: 14.5px;
}
.result .nm { font-weight: 600; }
.result .meta { color: var(--text-muted); flex: 1 1 260px; }
.result .meta b { color: var(--text); }
.result button { padding: 6px 13px; font-size: 14px; background: var(--bg-elevated); }

/* 预览区（转换结果先看一眼） */
.textprev {
  margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elevated); overflow: hidden;
}
.textprev__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.textprev__head .grow { flex: 1 1 auto; }
.textprev pre {
  margin: 0; padding: 14px 16px; max-height: 46vh; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

/* diff 页 */
.difftable { display: flex; flex-direction: column; gap: 6px; }
.difftable .dhead { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 12.5px; color: var(--text-faint); padding: 0 4px; }
.drow {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 8px 10px; border-radius: 10px; background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 14px; line-height: 1.55;
}
.drow .side-a, .drow .side-b { min-width: 0; white-space: pre-wrap; }
.drow .t { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; }
.drow.same { opacity: .62; }
.drow.changed { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.drow.add { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.drow.del { border-color: color-mix(in srgb, var(--err) 40%, transparent); background: var(--err-soft); }
.drow .none { color: var(--text-faint); font-style: italic; }
mark.ins { background: var(--ok-soft); color: var(--ok); border-radius: 3px; padding: 0 2px; font-weight: 600; }
mark.del { background: var(--err-soft); color: var(--err); border-radius: 3px; padding: 0 2px; text-decoration: line-through; }
mark.chg { background: var(--warn-soft); color: var(--warn); border-radius: 3px; padding: 0 2px; }

/* 字幕样式预览（颜色/位置页） */
.subprev {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(150deg, #1e293b, #0f172a 55%, #312e81);
  min-height: 200px; display: grid; place-items: center;
}
.subprev.light { background: linear-gradient(150deg, #f8fafc, #e2e8f0 55%, #c7d2fe); }
.subprev .sample {
  position: absolute; left: 6%; right: 6%; text-align: center;
  font-size: 26px; font-weight: 700; line-height: 1.3;
  font-family: var(--sans);
}
.subprev .sample span { padding: 2px 12px; }

/* ---------- 广告位 / 细页脚 ---------- */
.adslot {
  display: flex; align-items: center; justify-content: center;
  width: 100%; max-width: 970px; height: 90px;
  margin: 26px auto 0; padding: 0 8px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-faint); font-size: 13px; letter-spacing: .1em;
}
.adslot span { pointer-events: none; }
@media (max-width: 760px) { .adslot { max-width: 320px; height: 100px; } }
.page-foot {
  margin: 26px calc(50% - 50vw) 0; width: 100vw; box-sizing: border-box;
  padding: 18px 24px; background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-faint); text-align: center;
}
.page-foot a { color: var(--text-muted); }

/* 窄屏：审阅台从两列改成一列堆叠 —— 两列硬挤的时候字幕卡片会挤成一团
   （用户截图里就是这个）。980 这条管工具页的侧栏，900 这条管审阅台。 */
@media (max-width: 980px) {
  /* 窄屏页面内边距是 16px，通栏的负 margin 要跟着改 */
  .review__tl, .edtl { margin-left: -16px; margin-right: -16px; padding: 10px 16px 12px; }
}
@media (max-width: 900px) {
  .review {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: 'left' 'right' 'tl';
  }
  #stage { height: min(52vh, 420px); }
  .edwrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: 'left' 'right' 'tl'; }
  .edstage { height: min(52vh, 420px); }
  .review__right { margin-top: 2px; }
  .setpop { right: 8px; width: min(340px, calc(100vw - 60px)); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 980px) {
  .tool { flex-direction: column; min-height: 0; }
  .workarea { padding: 18px 16px 0; }
  .side {
    width: auto; flex: none; border-left: 0;
    position: static; align-self: stretch;
    height: auto; overflow: visible;
    border-top: 1px solid var(--border); padding: 18px 16px 22px;
  }
  h1 { font-size: 28px; }
  h1 .h1ic svg { width: 28px; height: 28px; }
  .lede { font-size: 15.5px; }
  .edwrap { flex-direction: column; }
  .edleft { position: static; width: 100%; }
  .edright { width: 100%; }
  .edlist { max-height: 46vh; }
}
@media print {
  .drop, .panel, .side, .wstools, .stage-wrap, .vbar, .edbar, .adslot, .page-foot, .prog { display: none !important; }
}

/* 套餐用量 chip（提取页顶栏）—— 链到定价页，Free 用完时变警示色 */
.planchip { font-size: 12.5px; color: var(--text-muted); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; margin-right: 4px; }
.planchip:hover { border-color: var(--accent); color: var(--accent); }
.planchip--out { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
