:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f6fde; --accent-ink: #ffffff; --warn: #c27b00; --bad: #c8382f; --good: #1f8a4c; --info: #6b7385;
  --stage: #0d0f14; --chip: #eef1f6;
  --lane-change: #8a63d2; --lane-pointer: #2f6fde; --lane-click: #e0533f; --lane-key: #1f8a4c; --lane-wheel: #c27b00;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1a1e26; --ink: #e6e9ef; --muted: #8d95a7; --line: #2a303b;
    --accent: #5b8ff0; --chip: #232934; --stage: #07080b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.error { color: var(--bad); }
button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; }
button.small { padding: 3px 10px; font-size: 13px; }
input, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--ink); white-space: nowrap; }
.crumbs { display: flex; gap: 6px; align-items: center; min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.crumbs a, .crumbs span { overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--muted); }
.search input { width: 240px; }
.queue { font-size: 12px; color: var(--muted); white-space: nowrap; }
.me { font-size: 13px; white-space: nowrap; }
main { padding: 16px; max-width: 1680px; margin: 0 auto; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--bg); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover { background: var(--chip); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.folder-name { font-family: var(--mono); font-weight: 500; }
.folder-name::before { content: "▸ "; color: var(--muted); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; white-space: nowrap; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.grade { font-weight: 600; }
.grade-A { color: var(--good); } .grade-B { color: var(--accent); } .grade-C { color: var(--warn); } .grade-Reject { color: var(--bad); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }

.session-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.s-title { margin: 0; font-size: 18px; }
.s-meta { font-size: 13px; }
.verdict { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grades { display: flex; gap: 4px; }
.grades button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.verdict .note { width: 260px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 14px; }
.tab.active { border-bottom-color: var(--accent); color: var(--accent); }

.pending { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.player-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
@media (max-width: 1100px) { .player-grid { grid-template-columns: 1fr; } }
.stage { position: relative; background: var(--stage); border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ctx-label { position: absolute; left: 10px; top: 8px; max-width: 70%; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-strip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 90%; padding: 4px 12px; border-radius: 8px; background: rgba(0,0,0,.65); color: #fff; font: 15px/1.4 var(--mono); white-space: nowrap; overflow: hidden; }
.key-strip:empty { display: none; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; }
.clock { font-size: 13px; min-width: 150px; }
.speeds { display: flex; gap: 2px; }
.speeds button { padding: 3px 7px; font-size: 12px; font-family: var(--mono); }
.speeds button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.toggle { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--muted); }
.timeline-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tl-caption { display: flex; justify-content: space-between; font-size: 12px; margin: 2px 0 4px; }
.timeline { display: block; width: 100%; cursor: crosshair; }
.timeline.overview { height: 150px; }
.timeline.detail { height: 150px; }

.side { display: grid; gap: 12px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.card-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summary .apps { margin-top: 8px; font-size: 12px; color: var(--muted); }
.flag-filter { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.flag-filter button { padding: 1px 8px; font-size: 12px; border-radius: 999px; }
.flag-filter button.off { opacity: .45; }
.flags { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.flags li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.flags li:hover { background: var(--chip); }
.flags li.current { background: var(--chip); }
.flags .sev-warn { border-left: 3px solid var(--warn); padding-left: 6px; }
.flags .sev-info { border-left: 3px solid var(--line); padding-left: 6px; }
.files-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.files td:first-child { font-family: var(--mono); font-size: 13px; word-break: break-all; }
