/* 审片页样式。思路：左边是暗色的「放映台」（视频 + 时间轴），右边是一张安静的台本；
   唯一的强调色是琥珀色——剪辑师在胶片上画记号的那支油性笔：当前句、标了问题的句、时间轴上的记号都用它。 */

:root {
  --paper: #f2f3f5;
  --card: #ffffff;
  --ink: #1b2130;
  --muted: #5e6678;
  --rule: #dde0e6;
  --stage: #171a21;
  --stage-2: #232833;
  --stage-ink: #e7e9ee;
  --mark: #e9a21b;
  --mark-ink: #7a4d00;
  --mark-soft: #fdf3dc;
  --ok: #1f8a6a;
  --ok-soft: #e2f3ec;
  --danger: #c2413b;
  --focus: #2f6fdb;
  --radius-s: 6px;
  --radius-m: 10px;
  /* 不用外部网页字体：国内连不上 Google Fonts 时，<head> 里的样式表会把整页卡成白屏（09-28 owner 实际遇到）。只用系统字体。 */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font); font-feature-settings: "tnum" 0;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; outline: none; }
main:focus-visible { outline: none; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.lead { color: var(--muted); max-width: 62ch; }
kbd {
  font: 600 0.7rem/1 var(--font); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--muted); min-width: 1.4em; text-align: center; display: inline-block;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */
button, .button {
  cursor: pointer; border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius-s);
  padding: 8px 14px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; transition: background-color .12s, border-color .12s;
}
button:hover, .button:hover { border-color: #c3c8d1; }
.primary, .button.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.primary:hover, .button.primary:hover { background: #2c3446; }
.ghost { background: transparent; border-color: transparent; }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--focus); text-decoration: underline;
  text-underline-offset: 2px; font-weight: 500; }
.link.danger { color: var(--danger); }
.tool { min-height: 34px; padding: 5px 10px; font-size: 0.875rem; }
.tool.small { min-height: 28px; padding: 3px 8px; font-size: 0.8rem; }
.tool[aria-pressed="true"] { background: var(--mark-soft); border-color: var(--mark); color: var(--mark-ink); }

/* ---------- 顶栏 / 底栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--rule); min-height: 56px;
}
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.crumbs { display: flex; gap: 8px; align-items: center; min-width: 0; flex: 1; color: var(--muted); font-size: 0.95rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .here { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.demo-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.lang { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius-s); overflow: hidden; }
.lang button { border: 0; border-radius: 0; min-height: 34px; padding: 4px 10px; background: var(--card); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.appfoot { padding: 18px 20px 24px; color: var(--muted); font-size: 0.8rem; text-align: center; }

.loading, .empty { padding: 48px 20px; max-width: 640px; margin: 0 auto; }
.empty h1 { margin-bottom: 12px; }
.invite form { margin-top: 20px; }

/* ---------- 首页 ---------- */
.home { max-width: 880px; margin: 0 auto; padding: 36px 20px 20px; }
.home > h1 { font-size: 2rem; margin-bottom: 8px; }
.home > .lead { margin-bottom: 28px; font-size: 1.05rem; }
.series { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.series-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; padding: 20px 22px 16px; flex-wrap: wrap; }
.series-head h2 { font-size: 1.4rem; }
.ru-title { display: block; font-size: 0.95rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.progress { display: flex; gap: 3px; min-width: 180px; flex: 0 1 280px; }
.progress .seg { flex: 1; height: 8px; border-radius: 2px; background: var(--rule); }
.progress .st-draft { background: var(--mark); opacity: .55; }
.progress .st-submitted { background: var(--mark); }
.progress .st-approved { background: var(--ok); }
.next-task {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 2px 16px; align-items: center;
  margin: 0 22px 18px; padding: 16px 18px; border-radius: var(--radius-m); background: var(--stage); color: var(--stage-ink);
  text-decoration: none;
}
.next-task .nt-label { font-size: 1.2rem; font-weight: 600; }
.next-task .nt-meta { grid-row: 2; color: #a9b0bf; font-size: 0.9rem; }
.next-task .button { grid-row: 1 / span 2; grid-column: 2; background: var(--mark); border-color: var(--mark); color: #1b1200; }
.episodes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.ep a {
  display: grid; grid-template-columns: 7.5em 1fr auto 13em auto; gap: 14px; align-items: center;
  padding: 12px 22px; text-decoration: none; border-bottom: 1px solid var(--rule);
}
.ep:last-child a { border-bottom: 0; }
.ep a:hover { background: #f8f9fa; }
.ep-no { font-weight: 600; }
.ep-syn { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-meta, .ep-ver, .ep-team { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.ep-state { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); flex: none; }
.st-draft .dot { background: var(--mark); opacity: .55; }
.st-submitted .dot { background: var(--mark); }
.st-approved .dot { background: var(--ok); }
.ts-feedback { color: var(--mark-ink); }
.ts-approved { color: var(--ok); }
.about-link { display: block; padding: 16px 22px; border-top: 1px solid var(--rule); text-decoration: none; background: #fafbfc; }
.about-link > span { display: flex; flex-direction: column; gap: 2px; }
.about-link:hover strong { text-decoration: underline; }

/* ---------- 单集页 ---------- */
.episode {
  display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 28px;
  max-width: 1400px; margin: 0 auto; padding: 20px;
}
.left { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.stage { background: var(--stage); color: var(--stage-ink); border-radius: var(--radius-m); padding: 12px; }
.video-wrap { display: flex; justify-content: center; background: #000; border-radius: var(--radius-s); overflow: hidden; }
.video-wrap video { display: block; width: 100%; max-height: calc(100vh - 330px); aspect-ratio: 9 / 16; object-fit: contain; background: #000; }
.stage-tools { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tools-right { display: flex; gap: 6px; }
.stage .tool { background: var(--stage-2); border-color: #343a48; color: var(--stage-ink); }
.stage .tool[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #1b1200; }
.seg-toggle { display: inline-flex; border-radius: var(--radius-s); overflow: hidden; border: 1px solid #343a48; }
.seg-toggle button { border: 0; border-radius: 0; background: var(--stage-2); color: #b9bfcc; min-height: 34px; padding: 4px 12px; font-size: 0.875rem; }
.seg-toggle button[aria-pressed="true"] { background: var(--stage-ink); color: var(--stage); font-weight: 600; }

/* 时间轴：每句一段，打勾绿、标了问题琥珀；竖线是播放头；小三角是画面/声音问题 */
.timeline { position: relative; height: 26px; margin-top: 12px; background: var(--stage-2); border-radius: 4px; }
.tl-seg { position: absolute; top: 7px; height: 12px; min-height: 0; padding: 0; border: 0; border-radius: 2px; background: #4a5162; }
.tl-seg:hover { background: #6b7385; }
.tl-seg.ok { background: var(--ok); }
.tl-seg.issue { background: var(--mark); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.tl-pin { position: absolute; top: -2px; width: 0; height: 0; margin-left: -5px; border: 5px solid transparent;
  border-top: 7px solid var(--mark); pointer-events: none; }

.extra-col { display: flex; flex-direction: column; gap: 16px; }
.script .av { margin-top: 16px; }
.av, .keys-box { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 14px 16px; }
.av h2 { font-size: 1rem; margin-bottom: 4px; }
.av-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.av-kind { font-size: 0.85rem; min-height: 32px; padding: 4px 10px; text-align: left; }
.av-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.av-item { border-left: 3px solid var(--mark); background: var(--mark-soft); padding: 8px 10px; border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: 0.9rem; }
.av-item p { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.av-item.old { border-left-color: var(--rule); background: var(--paper); }
.av-item input { flex: 1; min-width: 0; }
.keys-box summary { cursor: pointer; font-weight: 600; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: 0.875rem; }
.keys dt { text-align: right; }
.keys dd { margin: 0; color: var(--muted); }

.script { min-width: 0; }
.ep-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ep-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ver { font-size: 0.9rem; color: var(--muted); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 3px 8px; background: var(--card); }
.about-mini { margin-left: auto; font-size: 0.9rem; color: var(--muted); }
.notice { background: var(--mark-soft); border: 1px solid #f3d58f; padding: 10px 14px; border-radius: var(--radius-s); }
.notice.ok { background: var(--ok-soft); border-color: #b9e2d3; }
.synopsis { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px 14px; }
.synopsis summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.synopsis p { margin-top: 6px; max-width: 70ch; }

/* 制作说明 / 本版改进（notes/*.md） */
.notes { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px 14px; margin: 10px 0; }
.notes summary { cursor: pointer; font-weight: 600; }
.notes.ver-notes summary { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.md { max-width: 72ch; }
.md p { margin: 8px 0; white-space: pre-line; }
.md h3, .md h4, .md h5 { margin: 14px 0 6px; font-size: 1rem; }
.md h3 { font-size: 1.1rem; }
.md ul, .md ol { margin: 6px 0; padding-left: 1.4em; }
.md li { margin: 3px 0; }
.md code { font-size: 0.9em; background: var(--rule); padding: 0 4px; border-radius: 3px; }
.md hr { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }

.lines { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m); }
.line { position: relative; padding: 16px 20px 14px 22px; border-bottom: 1px solid var(--rule); scroll-margin-top: 80px; }
.line:last-child { border-bottom: 0; }
.line::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.line.is-ok::before { background: var(--ok); }
.line.has-issue::before { background: var(--mark); }
.line.current { background: #fbfaf5; box-shadow: inset 0 0 0 2px var(--mark); }
.line-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; font-size: 0.875rem; }
.t { min-height: 30px; padding: 2px 10px 2px 8px; font-variant-numeric: tabular-nums; font-weight: 600; gap: 6px; }
.play { width: 0; height: 0; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.line.current .t { background: var(--mark); border-color: var(--mark); color: #1b1200; }
.who { min-height: 30px; padding: 2px 10px 2px 3px; border-radius: 999px; gap: 7px; }
.who-name { font-weight: 600; }
.who-g { color: var(--muted); font-size: 0.8rem; }
.ava { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.ava.ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.8rem; background: #e8eaef; color: var(--muted); }
.ava.ph.g-female { background: #f4e6ee; color: #8a3e64; }
.ava.ph.g-male { background: #e4ecf6; color: #36577f; }
.voice { color: var(--muted); }
.flag { border-radius: 4px; padding: 2px 7px; font-size: 0.78rem; background: var(--paper); color: var(--muted); border: 1px solid var(--rule); }
.flag.f-stress { background: var(--mark-soft); border-color: #f3d58f; color: var(--mark-ink); }
.flag.f-kind { background: #e6f2f5; border-color: #bfdde6; color: #1f5f70; font-weight: 600; }
.flag.f-machine { background: #efe9fb; border-color: #d6c8f3; color: #4b3587; }
.flag.f-kind.k-card { background: #fdf1e3; border-color: #f0cfa4; color: #7a4a12; }   /* 画面字卡 */
.flag.f-card { background: #fdf1e3; border-color: #f0cfa4; color: #7a4a12; }
.flag.f-voiced { background: #fdecec; border-color: #f2c4c4; color: #8a2a2a; }   /* 按人声轨响度判定配音：请核对 */
.machine summary { color: #4b3587; }
.medit { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 8px 14px; font-size: 0.92rem; }
.medit dt { color: var(--muted); font-size: 0.8rem; font-weight: 600; padding-top: 2px; }
.medit dd { margin: 0; }
.medit .msrc { grid-column: 2; color: var(--muted); font-size: 0.75rem; }
.machine .kind { margin: 0 0 6px 14px; }
.pending-badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--mark-soft); color: var(--mark-ink); border: 1px solid #f3d58f; vertical-align: middle; }
.about-link.pending { background: var(--mark-soft); }
.pending-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mark); margin-left: 6px; vertical-align: middle; }
.flag.changed { background: #e7effc; border-color: #c4d6f5; color: #274f94; }
.voice-only { margin-left: auto; }

.ru { font-size: 1.3rem; line-height: 1.45; margin: 10px 0 6px; max-width: 46ch; font-weight: 500; }
.ru .w.suspect { text-decoration: underline dotted var(--mark); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ru button.w { font: inherit; border: 0; padding: 0 2px; margin: 0 -2px; min-height: 0; background: none; border-radius: 3px;
  display: inline; box-shadow: inset 0 -2px 0 #c9cdd6; }
.ru button.w:hover { background: var(--mark-soft); }
.ru .w.marked { background: var(--mark-soft); box-shadow: inset 0 -2px 0 var(--mark); }
.extra { display: flex; flex-direction: column; gap: 4px; font-size: 0.925rem; }
.literal { color: var(--muted); max-width: 70ch; }
.lbl { font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.mini summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; width: max-content; }
.mini p { margin: 4px 0 2px 14px; }
.mini.zh p { font-size: 1rem; }
.tc { font-variant-numeric: tabular-nums; color: var(--muted); }

.kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.kind, .ok-toggle { min-height: 36px; padding: 5px 11px; font-size: 0.9rem; }
.kind[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #1b1200; font-weight: 600; }
.kind[aria-pressed="true"] kbd { background: rgba(255,255,255,.5); border-color: transparent; color: #1b1200; }
.ok-toggle { margin-left: auto; }
.ok-toggle[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.ok-toggle[aria-pressed="true"] kbd { background: rgba(255,255,255,.2); border-color: transparent; color: #fff; }
.hint { margin-top: 8px; color: var(--mark-ink); font-size: 0.9rem; font-weight: 500; }
.speaker-note:not(:empty) { margin-top: 8px; font-size: 0.9rem; color: var(--mark-ink); font-weight: 500; }
.writes { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.note, .suggest, .writes-foot input, .about-sec textarea, .about-sec input, .reply-form input, .reply-form select, .role-card select, .name-fb input {
  width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 8px 10px; background: #fcfcfd; resize: vertical;
}
.note { min-height: 40px; line-height: 1.4; }
.note:focus, .suggest:focus { background: #fff; border-color: #9aa3b5; }
.suggest { font-size: 1.05rem; }
.writes-foot { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.save { font-size: 0.8rem; color: var(--muted); min-height: 1.2em; white-space: nowrap; }
.save[data-state="saved"] { color: var(--ok); }
.save[data-state="saved"]::before { content: "✓ "; }
.save[data-state="error"] { color: var(--danger); white-space: normal; }

.history { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hist { background: var(--paper); border-radius: var(--radius-s); padding: 8px 12px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.hist-head { color: var(--muted); }
.hist-note { color: var(--ink); }
.reply { font-weight: 400; }
.reply.r-fixed strong { color: var(--ok); }
.reply.r-wontfix strong { color: var(--mark-ink); }
.reply-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; width: 100%; }
.reply-form input { flex: 1; min-width: 160px; width: auto; }
.reply-form select { width: auto; }

.finishbar {
  position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 16px; padding: 12px 16px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m);
  box-shadow: 0 -6px 18px -12px rgba(27, 33, 48, .35);
}
.fb-left { flex: 1; min-width: 0; }
.meter { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; margin-bottom: 6px; max-width: 360px; }
.meter span { display: block; height: 100%; background: var(--ok); }

/* ---------- 弹层 ---------- */
.popover {
  position: absolute; z-index: 50; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m);
  box-shadow: 0 12px 32px -8px rgba(27, 33, 48, .35); padding: 14px;
}
.popover > p { font-weight: 600; margin-bottom: 10px; }
.syll { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 1.6rem; font-weight: 500; }
.syll .c { padding: 0 1px; color: var(--muted); }
.syll .v { min-height: 48px; min-width: 40px; justify-content: center; font-size: 1.6rem; padding: 2px 8px; border-color: #c9cdd6; }
.syll .v:hover { background: var(--mark-soft); border-color: var(--mark); }
.syll .v[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #1b1200; }
.stress-pop .link { margin-top: 12px; }
.speaker-pop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; }
.speaker-pop li button { width: 100%; justify-content: flex-start; gap: 10px; }
.speaker-pop li button[aria-pressed="true"] { border-color: var(--mark); background: var(--mark-soft); }
.speaker-pop .special { color: var(--muted); }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(23, 26, 33, .55); display: flex; align-items: flex-start;
  justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.sheet { background: var(--card); border-radius: 14px; padding: 28px 30px; width: min(720px, 100%); box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
.sheet h1 { margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.help-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.help-steps li { counter-increment: s; display: grid; grid-template-columns: 2em 1fr; column-gap: 8px; }
.help-steps li::before { content: counter(s); grid-row: 1 / span 9; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--mark-soft);
  color: var(--mark-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.help-steps h2 { font-size: 1.02rem; margin-bottom: 2px; }
.help-steps p { color: #3b4254; max-width: 64ch; }
.keys-inline { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.keys-inline h2 { font-size: 1rem; }
.summary { margin: 14px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.done h1 { font-size: 1.5rem; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-s); transition: opacity .2s, transform .2s; z-index: 70; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

/* ---------- 剧名 / 角色 ---------- */
.about { max-width: 880px; margin: 0 auto; padding: 32px 20px; display: flex; flex-direction: column; gap: 22px; }
.about > .lead { margin-top: -12px; }
.about-sec { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.orig { font-size: 1.1rem; }
.cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cand { display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 14px 16px; flex-wrap: wrap; }
.cand-main { flex: 1 1 320px; }
.cand-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 2px; }
.cand-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rate { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius-s); overflow: hidden; }
.rate button { border: 0; border-radius: 0; min-height: 36px; font-size: 0.875rem; }
.rate button + button { border-left: 1px solid var(--rule); }
.rate .r-like[aria-pressed="true"] { background: var(--ok); color: #fff; }
.rate .r-meh[aria-pressed="true"] { background: #e8eaef; font-weight: 600; }
.rate .r-no[aria-pressed="true"] { background: var(--danger); color: #fff; }
.choose[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.cast, .terms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.role-card { border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rc-id { display: flex; gap: 14px; align-items: center; }
.rc-id .ava { width: 64px; height: 64px; font-size: 1.4rem; }
.rc-name { font-size: 1.15rem; font-weight: 600; }
.role-issue summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; width: max-content; }
.role-issue[open] { display: flex; flex-direction: column; gap: 8px; }
.role-issue[open] summary { color: var(--ink); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 4px 10px; font-size: 0.875rem; }
.chip[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #1b1200; font-weight: 600; }
.name-fb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.name-fb input { flex: 1; min-width: 180px; width: auto; }
.term { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--rule); padding: 8px 0; flex-wrap: wrap; }
.term:last-child { border-bottom: 0; }
.term-ru { font-weight: 500; }

/* ---------- 手机：视频在上（吸顶）、台本在下 ---------- */
@media (max-width: 900px) {
  .topbar { padding: 8px 12px; gap: 10px; }
  .brand { display: none; }
  .episode { grid-template-columns: 1fr; padding: 0 0 16px; gap: 0; }
  .left { display: contents; }
  .stage { position: sticky; top: 52px; z-index: 20; border-radius: 0; padding: 8px 10px 10px; order: 0; }
  .video-wrap video { max-height: 36vh; width: auto; }
  .stage-tools { margin-top: 8px; }
  .timeline { margin-top: 8px; height: 22px; }
  .tl-seg { top: 6px; height: 10px; }
  .script { order: 1; padding: 12px 12px 0; }
  .extra-col { order: 2; padding: 16px 12px 0; }
  .line { padding: 14px 14px 12px 16px; }
  .ru { font-size: 1.2rem; }
  .ok-toggle { margin-left: 0; }
  .voice-only { margin-left: 0; }
  .finishbar { margin: 12px -12px 0; border-radius: 0; border-left: 0; border-right: 0; padding: 8px 12px; gap: 10px; }
  .finishbar .fb-left p { font-size: 0.85rem; }
  .finishbar .fb-left .muted { display: none; }
  .finishbar .primary { min-height: 38px; padding: 6px 12px; }
  .ep a { grid-template-columns: 1fr auto; grid-template-areas: "no state" "syn syn" "meta ver"; row-gap: 2px; padding: 12px 16px; }
  .ep-no { grid-area: no; } .ep-state { grid-area: state; }
  .ep-syn { grid-area: syn; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .ep-meta { grid-area: meta; } .ep-ver, .ep-team { grid-area: ver; }
  .series-head, .about-link { padding-left: 16px; padding-right: 16px; }
  .next-task { margin: 0 16px 16px; }
  .home { padding-top: 24px; }
  .sheet { padding: 22px 18px; }
  .overlay { padding: 12px; }
}
@media (max-width: 900px) {
  .crumbs a, .crumbs .sep { display: none; }
  .crumbs .here { font-size: 0.9rem; }
  #helpBtn { padding: 4px 8px; font-size: 0.9rem; }
  .stage-tools { flex-wrap: nowrap; gap: 6px; }
  .stage .tool, .seg-toggle button { font-size: 0.8rem; padding: 3px 8px; min-height: 30px; }
  .tool .long { display: none; }
  .video-wrap video { max-height: 32vh; }
}
@media (min-width: 901px) { .tool .short { display: none; } }
@media (max-width: 520px) {
  .kinds { display: grid; grid-template-columns: 1fr 1fr; }
  .kind, .ok-toggle { font-size: 0.82rem; padding: 4px 8px; min-height: 38px; justify-content: flex-start; text-align: left; line-height: 1.2; }
  .kind kbd, .ok-toggle kbd { display: none; }
  .ok-toggle { grid-column: 1 / -1; justify-content: center; }
  .line-head { gap: 6px; }
  .voice { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* 昵称 */
.nick-form { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.nick-form input { flex: 1 1 220px; max-width: 320px; padding: 9px 10px; border: 1px solid var(--rule); border-radius: var(--radius-s); font: inherit; }
.nick-form .err { flex-basis: 100%; }
.nick-change { font-size: 0.85rem; font-weight: 400; color: var(--muted); }
