:root {
  --bg: #f4f3ef; --panel: #ffffff; --ink: #1d1d1f; --muted: #66666c; --faint: #9b9ba1; --line: #e2e0da; --soft: #efeee9;
  --accent: #2f62c8; --accent-soft: #e5edfb; --ok: #1d7f46; --ok-soft: #e2f3e8; --bad: #b8382a; --bad-soft: #fbe6e3;
  --warn: #9a5a00; --warn-soft: #fdf0dc; --unsure: #6c45b8; --unsure-soft: #eee7fa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --left: 42%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.empty { padding: 40px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* top bar */
#topbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex-wrap: wrap; min-height: 48px; }
#topbar .title { font-weight: 650; }
#topbar .grow { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 11px; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn.bad { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 1px 8px; font-size: 12px; }
.pill { display: inline-block; border-radius: 999px; padding: 0 9px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
  background: var(--soft); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.unsure { background: var(--unsure-soft); color: var(--unsure); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.todo { background: var(--accent); color: #fff; }
/* still needs a reviewer click */
.need { box-shadow: 0 0 0 2px var(--accent); }
select.need { border-color: var(--accent); }
.save-state { font-size: 12px; }
.save-state.bad { color: var(--bad); font-weight: 600; }

/* task list / admin */
.page { padding: 16px 20px 60px; overflow: auto; flex: 1; }
table.list { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table.list th, table.list td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); position: sticky; top: 0; }
table.list tr.click:hover { background: var(--accent-soft); cursor: pointer; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }

/* review page */
.review { flex: 1; display: grid; grid-template-columns: var(--left) 6px 1fr; min-height: 0; }
.left, .right { overflow-y: auto; min-width: 0; }
.left { padding: 12px; background: var(--bg); }
.divider { cursor: col-resize; background: var(--line); }
.divider:hover { background: var(--accent); }
.right { padding: 12px 16px 0; display: flex; flex-direction: column; }
.right-scroll { flex: 1; }

.player-wrap { position: sticky; top: 0; z-index: 3; background: var(--bg); padding-bottom: 6px; }
.stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16/9; }
.stage video { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; }
.stage.zoomed video { cursor: zoom-in; }
.stage .notice { position: absolute; inset: 0; display: grid; place-items: center; color: #ddd; text-align: center; padding: 20px; }
.timeinfo { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin: 6px 0; align-items: center; }
.timeinfo b { font-family: var(--mono); }
.controls { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.controls select { border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--panel); }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.section h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.segchips { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 3px 8px; text-align: left; font-size: 12px; }
.seg .id { font-family: var(--mono); font-weight: 700; }
.seg .uses { color: var(--muted); }
.seg.hl { border-color: var(--accent); background: var(--accent-soft); }
.seg.playing { box-shadow: 0 0 0 2px var(--ok); }
.catrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.catpick { display: grid; gap: 2px; margin: 2px 0 6px; }
.catpick label { display: grid; grid-template-columns: 20px 1fr; gap: 4px; align-items: start; padding: 3px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.catpick label:hover { background: var(--soft); }
.catpick label:has(input:checked) { background: var(--accent-soft); }
.cattips { margin-top: 4px; }
.cattips ul { margin: 4px 0; padding-left: 18px; }
.catopts { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.catopts input { flex: 1; min-width: 140px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.note-box { background: var(--unsure-soft); color: var(--unsure); border-radius: 6px; padding: 5px 8px; font-size: 12px; margin: 6px 0; }

.banner { border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.banner.info { background: var(--accent-soft); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.anchors { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.turn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  scroll-margin-top: 8px; border-left: 4px solid var(--line); }
.turn.active { box-shadow: 0 0 0 2px var(--accent-soft); }
.turn.st-done { border-left-color: var(--ok); }
.turn.st-issue { border-left-color: var(--bad); }
.turn.st-recheck { border-left-color: var(--warn); }
.turn header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.turn .tid { font: 700 13px var(--mono); background: var(--ink); color: var(--panel); border-radius: 5px; padding: 1px 8px; }
.turn header .grow { flex: 1; }
.turn.folded { padding: 6px 14px; }
.turn header.fold { cursor: pointer; flex-wrap: nowrap; }
.turn .fold-q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.question { font-size: 15px; font-weight: 600; margin: 8px 0; white-space: pre-wrap; }
.history { margin: 6px 0; font-size: 13px; }
.history .h { border-left: 2px solid var(--line); padding: 2px 0 2px 8px; margin: 4px 0; }
.history .h b { font-family: var(--mono); }
.opts { list-style: none; margin: 6px 0; padding: 0; }
.opts li { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: start; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 7px; margin-bottom: 5px; }
.opts li.correct { border-color: var(--ok); background: var(--ok-soft); }
.opts li .letter { font: 700 13px var(--mono); }
.opts li label { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.opts li .sugg { font-size: 11px; color: var(--muted); }
.opts textarea, .question-edit { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; resize: vertical; }
.answer-status { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; font-size: 12px; }
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.was { color: var(--faint); text-decoration: line-through; font-size: 12px; display: block; }
.reason { display: flex; gap: 6px; align-items: center; margin: 4px 0; font-size: 12px; }
.reason input { flex: 1; border: 1px solid var(--warn); border-radius: 5px; padding: 2px 6px; }
.reason.missing input { background: var(--warn-soft); }
.blk { margin: 8px 0; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; }
.blk.b-ok { border-left-color: var(--ok); }
.blk.b-fixed { border-left-color: var(--accent); }
.blk.b-wrong { border-color: var(--bad); background: var(--bad-soft); }
.blk.b-recheck { border-left-color: var(--warn); }
.blk-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.btn.edit { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.edit.on { background: var(--accent); color: #fff; }
.blk-head .recheck { color: var(--warn); font-size: 12px; font-weight: 600; }
.blk > .help { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.edit-hint { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.wrong-hint { font-size: 12px; color: var(--bad); font-weight: 600; margin: 2px 0 4px; }
.field { display: grid; grid-template-columns: 110px 1fr; gap: 8px; margin: 6px 0; align-items: start; font-size: 13px; }
.field > .k { color: var(--muted); font-weight: 600; padding-top: 2px; }
.seg3 { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg3 button { border: 0; background: var(--panel); padding: 2px 10px; font-size: 12px; border-right: 1px solid var(--line); }
.seg3 button:last-child { border-right: 0; }
.seg3 button.on { background: var(--accent); color: #fff; }
.seg3 button.on.pass { background: var(--ok); }
.seg3 button.on.issue { background: var(--bad); }
.seg3 button.on.unsure { background: var(--unsure); }
.seg3 button.on.fixed { background: var(--accent); }
.seg3 button.on.cant_fix { background: var(--bad); }
.seg3 button:disabled { color: var(--faint); cursor: default; }
.tips { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 6px 8px 6px 24px; margin: 4px 0 0; }
.depcard ol { margin: 4px 0; padding-left: 18px; }
.depcard { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 6px 8px; margin-top: 4px; }
.issue-list .iss { border: 1px solid var(--bad-soft); background: #fff8f7; border-radius: 6px; padding: 4px 8px; font-size: 12px; margin: 4px 0;
  display: flex; gap: 6px; align-items: start; }
.issue-form { border: 1px dashed var(--bad); border-radius: 8px; padding: 8px; margin: 6px 0; }
.issue-form .types { display: grid; gap: 3px; font-size: 12px; margin: 6px 0; }
.issue-form .types label { display: block; padding-left: 20px; text-indent: -20px; }
.issue-form textarea, .note { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; min-height: 34px; }
.dialogue-check ul { margin: 4px 0 6px 18px; padding: 0; font-size: 13px; }

.submitbar { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); margin: 0 -16px; padding: 8px 16px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 4; }
.submitbar .grow { flex: 1; }
.submitbar .left-items ul { position: absolute; bottom: calc(100% + 4px); left: 16px; width: min(460px, calc(100% - 32px)); max-height: 260px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px 8px 24px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.errors { color: var(--bad); font-size: 12px; margin: 4px 0 0; padding-left: 18px; max-height: 120px; overflow: auto; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 20; }
.modal-box { background: var(--panel); border-radius: 10px; width: min(860px, 94vw); max-height: 88vh; overflow: auto; padding: 18px 22px; position: relative; }
.modal-x { position: absolute; right: 10px; top: 6px; border: 0; background: none; font-size: 22px; }
.guide h2 { margin-top: 0; }
.guide table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 6px 0 12px; }
.guide td, .guide th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }

.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.kv { font-size: 12px; }

/* evidence timeline under the full-video player */
.timeline { position: relative; height: 28px; background: var(--soft); border-radius: 5px; margin: 6px 0 2px; cursor: pointer; }
.timeline .blk { position: absolute; top: 3px; bottom: 3px; min-width: 4px; background: var(--accent); opacity: .45; border-radius: 3px; border: 0; padding: 0;
  color: #fff; font: 600 10px/22px var(--mono); overflow: hidden; text-align: center; }
.timeline .blk.hl { opacity: 1; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.timeline .blk.live { background: var(--ok); opacity: 1; }
.timeline .head { position: absolute; z-index: 1; top: -3px; bottom: -3px; width: 2px; background: var(--bad); pointer-events: none; }
.ticks { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--faint); }
.warn-text { color: var(--warn); }
.guide ul, .guide ol { padding-left: 22px; margin: 4px 0 10px; }
.guide li { margin: 3px 0; }
.catpick input { margin-top: 3px; }

/* worked examples */
.banner.example { background: var(--accent-soft); color: var(--ink); }
.example-note { font-size: 13px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 4px; padding: 5px 8px; margin: 4px 0 8px; }
mark.ins { background: var(--ok-soft); color: var(--ok); font-weight: 600; padding: 0 1px; border-radius: 2px; }
.was mark.del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; padding: 0 1px; border-radius: 2px; }
