/* 正文对比弹窗（二创，2026-12-01）：左原剧右我们，同样的排版（行的样式沿用 editor.css 的 .ln 那一套）。
   颜色、圆角、字号、时长全用 tokens.css 的变量，浅色深色一起好看；概览条和提醒条用小号低对比字，让视线落在正文上。 */

/* 逐拍表格的颜色：原剧棕、我们绿、深色条、红标签（浅色深色各一套） */
:root {
  --cmp-orig: #8a6d3b; --cmp-orig-line: #c9a66b;
  --cmp-ours: #2f6f5e; --cmp-ours-line: #5aa88f;
  --cmp-beat-bg: #2b2b2b; --cmp-beat-sub: #ddd;
  --cmp-tag: #e0533d;
  --ty-open: #c8961e; --ty-pay: #e0533d; --ty-pay2: #b8321f; --ty-rev: #7b4bb7; --ty-sus: #1f8a8a; --ty-hook: #2f6fd6; --ty-jab: #6b7a8f; --ty-flat: #9a9a9a;
  --cmp-scene: #7a3e00; --cmp-act: #555; --cmp-os: #7b3fa0; --cmp-vo: #b5652b; --cmp-dlg: #1f5f9e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cmp-orig: #a8874f; --cmp-orig-line: #8a6d3b;
    --cmp-ours: #3d8a74; --cmp-ours-line: #2f6f5e;
    --cmp-beat-bg: #3a3a3a; --cmp-beat-sub: #ccc;
    --ty-open: #e0b042; --ty-pay: #f06a55; --ty-pay2: #e2513c; --ty-rev: #a57be0; --ty-sus: #3db3b3; --ty-hook: #5b93ee; --ty-jab: #93a2b8; --ty-flat: #8a8a8a;
    --cmp-scene: #d9a066; --cmp-act: #b8b8b8; --cmp-os: #b98ad6; --cmp-vo: #d9925a; --cmp-dlg: #6ea3dc;
  }
}
:root[data-theme="dark"] {
  --cmp-orig: #a8874f; --cmp-orig-line: #8a6d3b;
  --cmp-ours: #3d8a74; --cmp-ours-line: #2f6f5e;
  --cmp-beat-bg: #3a3a3a; --cmp-beat-sub: #ccc;
  --ty-open: #e0b042; --ty-pay: #f06a55; --ty-pay2: #e2513c; --ty-rev: #a57be0; --ty-sus: #3db3b3; --ty-hook: #5b93ee; --ty-jab: #93a2b8; --ty-flat: #8a8a8a;
  --cmp-scene: #d9a066; --cmp-act: #b8b8b8; --cmp-os: #b98ad6; --cmp-vo: #d9925a; --cmp-dlg: #6ea3dc;
}

/* ───────── 弹窗变大：整个弹窗不出外层滚动条，两栏各自滚 ───────── */
.modal.modal--compare { max-width: min(1440px, 96vw) !important; height: min(92vh, 1100px); max-height: calc(100vh - 32px); }
.modal--compare .modal__head { padding: 8px 16px 2px; }
.modal--compare .modal__head h2 { font-size: var(--fs-md); }
.modal--compare .modal__body { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.modal--compare .modal__foot { padding: 8px 16px 10px; border-top: 1px solid var(--line); }

.cmp { flex: 1; min-height: 0; display: flex; flex-direction: column; font-family: var(--font-ui); }
.cmp-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cmp-main > .sk-stack { padding: 24px 20px; }
.cmp-fail { padding: 24px 20px; }

/* ───────── 顶栏：第一行是导航 + 依据，第二行是概览小表 + 提醒，第三行是页签 ───────── */
.cmp-top { padding: 0 16px; }
.cmp-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.cmp-nav__title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cmp-nav__title b { font-size: var(--fs-md); white-space: nowrap; }
.cmp-nav__name { color: var(--note); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.cmp-nav__swap { color: var(--muted); font-size: var(--fs-md); }
.cmp-srcname { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.cmp-oep { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.cmp-select.select { width: auto; min-height: 26px; height: 26px; max-width: 260px; font-size: var(--fs-sm); padding: 0 26px 0 10px; }
.cmp-basis { display: flex; align-items: center; gap: 4px; flex: 1 1 180px; min-width: 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.cmp-basis__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cmp-basis__reset.btn { flex: none; height: 22px; padding: 0 8px; font-size: var(--fs-xs); }

/* ───────── 概览小表、提醒 ───────── */
.cmp-row2 { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding: 2px 16px 4px; }
.cmp-ov { border-collapse: separate; border-spacing: 0; font-size: var(--fs-xs); line-height: 1.35; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cmp-ov th, .cmp-ov td { padding: 1px 10px; text-align: right; white-space: nowrap; font-weight: 400; }
.cmp-ov thead th { color: var(--muted); font-size: 11px; padding-bottom: 0; }
.cmp-ov thead th small { font-size: 10px; }
.cmp-ov tbody th { text-align: left; color: var(--muted); font-weight: 600; letter-spacing: .08em; padding-left: 0; }
.cmp-ov td { border-radius: 4px; min-width: 3.2em; cursor: default; }
.cmp-ov td.is-more, .cmp-ov td.is-less { background: var(--warn-soft); color: var(--ink); font-weight: 600; }
.cmp-alerts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; font-size: var(--fs-xs); color: var(--note); line-height: 1.5; }
.cmp-alert { display: inline-flex; align-items: center; gap: 6px; padding: 1px 4px 1px 10px; border-radius: 12px; border: 1px solid var(--warn-line); background: var(--warn-soft); color: var(--ink-2); }
.cmp-alert[data-kind="leaks"] { border-color: color-mix(in srgb, var(--bad) 32%, transparent); background: var(--bad-bg); }
.cmp-alert > .ic { color: var(--warn); }
.cmp-alert[data-kind="leaks"] > .ic { color: var(--bad); }
.cmp-alert__go { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--note); }
.cmp-alert__go:hover { background: var(--hover-2); color: var(--ink); }
.cmp-alert__n { min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }

/* ───────── 页签 ───────── */
.cmp-tabs { display: flex; align-items: flex-end; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmp-tabs__fill { flex: 1; }
.cmp-tab { padding: 4px 14px; margin-bottom: -1px; font-size: var(--fs-sm); color: var(--note); border-bottom: 2px solid transparent; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.cmp-tab:hover { color: var(--ink); }
.cmp-tab.is-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.cmp-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ───────── 页签行右边的对齐状态 ───────── */
.cmp-alignhost { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px 8px; padding: 0 0 3px; font-size: var(--fs-xs); color: var(--note); }
.cmp-alignhost:empty { display: none; }
.cmp-align__t { color: var(--ink-2); }
.cmp-align__s { color: var(--muted); }
.cmp-align__err { max-width: 36em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bad); }
.cmp-align__stale { padding: 1px 10px; border-radius: 12px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--ink-2); }
.cmp-align__sec { font-variant-numeric: tabular-nums; }
.cmp-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.cmp-note { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 6px 16px 0; padding: 4px 12px; border-radius: var(--r-sm); background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-2); }

/* ───────── 节拍条：滚动区外面，两条（原剧 / 我们），按字数画块、按类型上色 ───────── */
.cmp-tl { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; padding: 8px 16px 4px; }
.cmp-tl__lab { padding: 1px 10px; border-radius: 6px; color: #fff; font-size: var(--fs-xs); line-height: 22px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-tl__lab.is-orig { background: var(--cmp-orig); }
.cmp-tl__lab.is-ours { background: var(--cmp-ours); }
.cmp-tl__bar { display: flex; gap: 2px; min-width: 0; height: 22px; overflow: hidden; }
.cmp-blk { position: relative; flex: none; height: 22px; padding: 0 4px; border: 0; border-radius: 4px; color: #fff; font: 600 12px/22px var(--font-ui); white-space: nowrap; overflow: hidden; text-align: center; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color var(--t-fast) var(--ease), filter var(--t-fast) var(--ease); }
.cmp-blk:hover, .cmp-blk.is-hover { outline-color: var(--ink); }
.cmp-blk.is-cur { outline-color: var(--ink); filter: brightness(.88); }
.cmp-blk.is-cur::after { content: ""; position: absolute; left: 50%; bottom: 0; margin-left: -4px; border: 4px solid transparent; border-bottom-color: #fff; border-top: 0; }
.cmp-blk__t { margin-left: 4px; font-weight: 500; font-size: 11px; }
.cmp-blk.is-empty { display: block; cursor: default; background: repeating-linear-gradient(45deg, var(--line-2), var(--line-2) 2px, var(--line) 2px, var(--line) 4px); }
.cmp-tl__legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 14px; padding-top: 2px; font-size: var(--fs-xs); color: var(--note); }
.cmp-lg i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 3px; vertical-align: -1px; }

/* ───────── 滚动区：整页只有这一个会滚的东西，里面什么都不吸顶 ───────── */
.cmp-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 40px; scroll-behavior: smooth; }
.cmp-scroll:focus { outline: none; }
.cmp-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.cmp-hint { margin-bottom: 12px; padding: 10px 16px; border-radius: 10px; background: var(--hover); border: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-2); }
.cmp-sh { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 4px; }
.cmp-sh__o, .cmp-sh__w { display: flex; align-items: center; gap: 8px; padding: 8px 16px; color: #fff; font-size: var(--fs-md); line-height: 1.3; }
.cmp-sh__o { background: var(--cmp-orig); border-radius: 10px 0 0 10px; }
.cmp-sh__w { background: var(--cmp-ours); border-radius: 0 10px 10px 0; }
.cmp-sh__sub { font-size: var(--fs-xs); opacity: .85; }
.cmp-sh__sub::before { content: "·"; margin-right: 6px; }

.cmp-group { margin-top: 18px; scroll-margin-top: 4px; }
.cmp-sheet > .cmp-group:first-of-type { margin-top: 10px; }

/* 深色拍卡：这一拍演什么 */
.cmp-beat { padding: 12px 18px; border-radius: 10px; background: var(--cmp-beat-bg); color: #fff; margin-bottom: 6px; }
.cmp-beat__t { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 17px; font-weight: 600; line-height: 1.5; }
.cmp-beat__no { font-weight: 500; opacity: .9; }
.cmp-tag { display: inline-block; padding: 1px 11px; border-radius: 12px; background: var(--kt); color: #fff; font-size: 13px; font-weight: 500; line-height: 1.6; }
.cmp-beat__note { position: relative; margin-top: 3px; padding-left: 14px; font-size: 13px; line-height: 1.6; color: var(--cmp-beat-sub); }
.cmp-beat__note::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; }
.cmp-beat__note.is-orig::before { background: var(--cmp-orig-line); }
.cmp-beat__note.is-ours::before { background: var(--cmp-ours-line); }
.cmp-beat.flash { animation: cmp-pulse 900ms ease-out; }
@keyframes cmp-pulse { 0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--kt) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* 没逐拍时：一场对一场的浅灰细条 */
.cmp-sbar { margin-bottom: 6px; padding: 3px 14px; border-radius: 8px; background: var(--hover-2); color: var(--note); font-size: var(--fs-sm); }

/* 白卡片：左右两栏等宽，左棕线右绿线 */
.cmp-card { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cmp-col { min-width: 0; padding: 12px 18px; font-size: 15.5px; line-height: 1.75; color: var(--ink); }
.cmp-col.is-orig { border-left: 5px solid var(--cmp-orig-line); }
.cmp-col.is-ours { border-left: 5px solid var(--cmp-ours-line); }
.cmp-empty { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 56px; box-sizing: border-box; padding: 10px; border: 2px dashed var(--line-2); border-radius: 8px; color: var(--muted); font: italic var(--fs-sm)/1.6 var(--font-ui); text-align: center; }

/* 行：照导出页的紧凑写法，不再用正文栏那套胶囊排版 */
.cmp .r { position: relative; margin: 0 -8px; padding: 0 8px; border-radius: 4px; overflow-wrap: anywhere; transition: background var(--t-fast) var(--ease); }
.cmp .r-scene { margin-top: 6px; font-weight: 700; color: var(--cmp-scene); }
.cmp .cmp-col .r-scene:first-child { margin-top: 0; }
.cmp .r-cast { font-size: 14px; color: var(--muted); }
.cmp .r-act { color: var(--cmp-act); }
.cmp .r-dlg b { color: var(--cmp-dlg); }
.cmp .r-dlg.os b { color: var(--cmp-os); }
.cmp .r-dlg.vo b { color: var(--cmp-vo); }
.cmp .r-sfx { color: var(--muted); font-style: italic; }
.cmp-time { margin-right: 8px; font: 500 var(--fs-xs)/1 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp .r.flash { animation: flash 600ms ease-out; }

/* 关键句：整行类型色浅底 + 左边竖条 + 行尾类型标签；两边同一拍同色，停在一边另一边加深 */
.cmp .r.is-key { background: color-mix(in srgb, var(--kt) 12%, transparent); box-shadow: inset 3px 0 0 var(--kt); }
.cmp .r.is-key.is-keyhi { background: color-mix(in srgb, var(--kt) 24%, transparent); }
.cmp-kt { display: inline-block; margin-left: 8px; padding: 0 9px; border-radius: 12px; background: var(--kt); color: #fff; font: 500 12px/1.65 var(--font-ui); font-style: normal; white-space: nowrap; vertical-align: 1px; }

/* 原剧拆解标注：收敛成一句，行尾小号描边胶囊（只有边框和字是类型色，不加底色），跟 AI 关键句区分开 */
.cmp-mk { display: inline-block; margin-left: 8px; padding: 0 8px; border: 1px solid var(--kt); border-radius: 10px; color: var(--kt); background: transparent; font: 500 11px/1.6 var(--font-ui); white-space: nowrap; vertical-align: 1px; cursor: help; }

/* 像原剧的句子：我们这行右侧小胶囊，原剧那行一个同色小点；停一边，两边一起亮 */
.cmp-sim { display: inline-block; margin-left: 8px; padding: 0 9px; border: 0; border-radius: 10px; font: 500 var(--fs-xs)/1.7 var(--font-ui); letter-spacing: 0; white-space: nowrap; vertical-align: 1px; cursor: pointer; color: var(--nc-1); transition: background var(--t-fast) var(--ease); }
.cmp-sim.is-same { background: color-mix(in srgb, var(--nc-1) 24%, transparent); font-weight: 600; }
.cmp-sim.is-close { background: color-mix(in srgb, var(--nc-1) 11%, transparent); }
.cmp-sim:hover { background: color-mix(in srgb, var(--nc-1) 34%, transparent); }
.cmp-simdot { display: inline-block; width: 9px; height: 9px; margin-left: 8px; padding: 0; border: 0; border-radius: 50%; vertical-align: 1px; cursor: pointer; background: var(--nc-1); }
.cmp-simdot.is-close { opacity: .5; }
.cmp .r.is-pair { background: color-mix(in srgb, var(--nc-1) 13%, transparent); }

/* 原剧人名：红色波浪下划线（mark 自带的黄底去掉） */
.cmp-leak { background: transparent; color: inherit; text-decoration: underline wavy var(--bad); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }

/* ───────── 八栏对照 ───────── */
.cmp-lockpage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 20px 16px; }
.cmp-badges { font-size: var(--fs-sm); color: var(--ink-2); }
.cmp-lockwrap { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.cmp-lk { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.cmp-lk th, .cmp-lk td { padding: 10px 14px; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.cmp-lk thead th { background: var(--panel); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); white-space: normal; }
.cmp-lk thead th:first-child, .cmp-lk tbody th { width: 7.5em; }
.cmp-lk tbody th { background: var(--panel); font-size: var(--fs-sm); font-weight: 600; color: var(--note); letter-spacing: .06em; white-space: normal; }
.cmp-lk tbody td { font-family: var(--font-read); }
.cmp-lk tbody tr:nth-child(even) th, .cmp-lk tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }
.cmp-lk tbody tr:last-child th, .cmp-lk tbody tr:last-child td { border-bottom: 0; }
.cmp-lk td.cmp-lk__miss { background: var(--hover); color: var(--muted); text-align: center; vertical-align: middle; font-family: var(--font-ui); white-space: normal; }
.cmp-lk tbody tr:nth-child(even) td.cmp-lk__miss { background: var(--hover); }

/* ───────── 窄屏：每拍两栏上下叠（原剧在上、我们在下），栏头改用格子自己的小标签 ───────── */
@media (max-width: 899px) {
  .cmp-sh { display: none; }
  .cmp-card { grid-template-columns: 1fr; }
  .cmp-col.is-orig { border-bottom: 1px solid var(--line); }
  .cmp-col::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 600 var(--fs-xs)/1.6 var(--font-ui); letter-spacing: .1em; color: var(--note); }
  .cmp-scroll { padding-left: 12px; padding-right: 12px; }
  .cmp-top, .cmp-row2, .cmp-tabs, .cmp-lockpage, .cmp-tl { padding-left: 12px; padding-right: 12px; }
  .cmp-note { margin-left: 12px; margin-right: 12px; }
  .cmp-alerts { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-scroll { scroll-behavior: auto; }
  .cmp .r.flash { animation: none; background: color-mix(in srgb, var(--ok) 20%, transparent); }
  .cmp-beat.flash { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--kt) 55%, transparent); }
  .cmp-tab, .cmp-sim, .cmp-blk, .cmp .r { transition: none; }
  .cmp-spin { animation-duration: 3s; }
}
