:root {
  --bg: #0b1321; --card: #131f32; --card2: #19283f; --line: #283a56; --text: #eef3fa; --muted: #8b97ab;
  --accent: #40c8ff; --lime: #c8ff3a; --red: #ff4d4d; --green: #3ce682; --orange: #ff9a2e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
header.top { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 800; letter-spacing: .08em; color: var(--text); }
header.top .brand b { color: var(--accent); }
header.top nav { margin-left: auto; display: flex; gap: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 26px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #04121f; }
button.danger { color: var(--red); }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.err { color: var(--red); white-space: pre-wrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--card2); color: var(--muted); }
.pill.done { color: var(--lime); } .pill.error { color: var(--red); } .pill.annotate { color: var(--orange); }
.pill.detecting, .pill.rendering, .pill.queued_detect, .pill.queued_render { color: var(--accent); }
table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.list th { color: var(--muted); font-weight: 600; font-size: 13px; }
.progress { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
pre.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12px; }
video.result { width: 100%; max-width: 420px; border-radius: 12px; background: #000; }
.login { max-width: 360px; margin: 12vh auto; }

/* annotation */
.steps { display: flex; gap: 8px; margin-bottom: 14px; }
.steps span { padding: 4px 12px; border-radius: 99px; background: var(--card2); color: var(--muted); font-weight: 600; font-size: 13px; }
.steps span.on { background: var(--accent); color: #04121f; }
.court-wrap { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
@media (max-width: 900px) { .court-wrap { grid-template-columns: 1fr; } }
.frame-box { position: relative; }
.frame-box canvas { width: 100%; display: block; border-radius: 8px; cursor: crosshair; }
.loupe { position: absolute; top: 8px; right: 8px; width: 180px; height: 180px; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; display: none; background: #000; }
.kp-list { display: flex; flex-direction: column; gap: 4px; max-height: 520px; overflow-y: auto; }
.kp { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.kp:hover { background: var(--card2); }
.kp.cur { background: var(--card2); outline: 1px solid var(--accent); }
.kp i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.kp.set i { background: var(--lime); }
.kp .x { margin-left: auto; color: var(--muted); }
.shots-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .shots-wrap { grid-template-columns: 1fr; } }
.player { position: sticky; top: 10px; }
.player video { width: 100%; border-radius: 8px; background: #000; display: block; }
.vbar { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.vbar .fr { font-variant-numeric: tabular-nums; min-width: 92px; }
.cands { display: flex; flex-direction: column; gap: 6px; max-height: 78vh; overflow-y: auto; padding-right: 4px; }
.cand { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.cand.cur { border-color: var(--accent); }
.cand.shot { border-left: 4px solid var(--lime); }
.cand.no { opacity: .5; }
.cand .head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cand .ser { font-size: 12px; font-weight: 700; color: var(--orange); }
.cand .bar { height: 6px; background: var(--accent); border-radius: 3px; }
.cand .acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.cand .acts button { padding: 4px 10px; font-size: 13px; }
.cand .acts button.on { background: var(--lime); border-color: var(--lime); color: #0b1321; }
.cand .acts button.on.no { background: var(--line); border-color: var(--line); color: var(--text); }
.cand .acts select { padding: 3px 6px; font-size: 13px; }
.keys { font-size: 12px; color: var(--muted); }
kbd { background: var(--card2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; }
input[type=file] { max-width: 100%; }
