:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1d2129; --muted: #86909c; --line: #e5e6eb;
  --accent: #3b6ef5; --accent-soft: #e8efff; --ok: #00a870; --err: #e5484d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121417; --panel: #1c1f24; --text: #e6e8eb; --muted: #8a919c; --line: #2c3036; --accent: #6b8fff; --accent-soft: #232c45; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand span { color: var(--accent); font-weight: 500; font-size: 12px; margin-left: 4px; }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav button { border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit; white-space: nowrap; }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 20px; padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; padding: 16px; } header { padding: 0 16px; gap: 12px; } }
.left, .right { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.left { display: flex; flex-direction: column; gap: 14px; align-self: start; }
.drop { display: grid; place-items: center; min-height: 200px; border: 2px dashed var(--line); border-radius: 8px; cursor: pointer; text-align: center; color: var(--muted); overflow: hidden; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop video { width: 100%; max-height: 300px; background: #000; display: block; }
.desc { margin: 0; color: var(--muted); font-size: 13px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opts label { display: flex; align-items: center; gap: 8px; }
select, input, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px; padding: 6px 14px; cursor: pointer; font: inherit; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.big { padding: 10px; font-size: 15px; font-weight: 600; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.facelib { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.facelib-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.facelib-head form { display: flex; gap: 6px; align-items: center; }
.facelib-head input[name=name] { width: 90px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { position: relative; width: 72px; text-align: center; font-size: 12px; cursor: pointer; }
.person img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; display: block; }
.person.sel img { border-color: var(--accent); }
.person .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--err); color: #fff; font-size: 11px; line-height: 18px; cursor: pointer; display: none; }
.person:hover .x { display: block; }
.muted { color: var(--muted); }
.status { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.status.err span { color: var(--err); }
.result { min-height: 400px; }
.empty { display: grid; place-items: center; height: 400px; color: var(--muted); }
.result h3 { margin: 0 0 12px; font-size: 15px; }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.ts { display: inline-block; min-width: 92px; color: var(--accent); cursor: pointer; font-variant-numeric: tabular-nums; font-size: 13px; }
.ts:hover { text-decoration: underline; }
.seg { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.seg .spk { color: var(--muted); font-size: 12px; white-space: nowrap; }
.seg .txt { flex: 1; white-space: pre-wrap; }
.seg img { width: 160px; border-radius: 4px; flex: none; }
@media (max-width: 600px) { .seg { flex-wrap: wrap; } .seg img { width: 100%; } }
.fulltext { background: var(--bg); padding: 12px; border-radius: 6px; white-space: pre-wrap; margin-bottom: 16px; max-height: 200px; overflow: auto; }
.person-res { margin-bottom: 20px; }
.timeline { position: relative; height: 18px; background: var(--bg); border-radius: 4px; margin: 6px 0 10px; }
.timeline i { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; min-width: 3px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px 4px 4px; cursor: pointer; font-size: 12px; }
.chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
.answer { white-space: pre-wrap; line-height: 1.8; }
.toolbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
#player { width: 100%; max-height: 300px; background: #000; border-radius: 8px; display: block; }
.drop { min-height: 72px; padding: 10px; }
.library { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.library-head { display: flex; justify-content: space-between; align-items: baseline; }
.videos { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.vitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.vitem:hover { background: var(--bg); }
.vitem.sel { border-color: var(--accent); background: var(--accent-soft); }
.vitem .vname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vitem .vmeta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vitem .tags { display: flex; gap: 3px; }
.vitem .tag { font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.vitem .tag.on { background: var(--accent-soft); color: var(--accent); }
.vitem .tag.run { background: #fff4e5; color: #c77700; }
.vitem .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.disk.low { color: var(--err); font-weight: 600; }
.vitem .del:hover { color: var(--err); }

/* ---- fill the viewport on desktop; panels scroll internally ---- */
@media (min-width: 861px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  header { flex: none; }
  main { flex: 1; min-height: 0; max-width: none; width: 100%; margin: 0;
         grid-template-columns: minmax(360px, 32%) 1fr; padding: 16px 20px; gap: 16px; }
  .left, .right { min-height: 0; overflow-y: auto; }
  .left { align-self: stretch; }
  .right { display: flex; flex-direction: column; }
  .result { flex: 1; min-height: 0; }
  .empty { height: 100%; min-height: 200px; }
  #player { max-height: 42vh; }
  .videos { max-height: none; }
}
.person-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-head > img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.person-head h3 { margin: 0; }
.name-form { display: flex; gap: 6px; margin-left: auto; }
.name-form input { width: 110px; }
h3.section { margin: 8px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
details.more > summary { cursor: pointer; color: var(--accent); margin: 4px 0 16px; }

