:root {
  --bg: #0d1117;
  --bg-soft: #121821;
  --panel: #161d27;
  --panel-2: #1c2431;
  --border: #293241;
  --border-soft: #222b38;
  --text: #e7edf5;
  --muted: #8b98aa;
  --muted-2: #647184;
  --accent: #4c9aff;
  --accent-soft: rgba(76, 154, 255, .14);
  --left: #ff6b6b;
  --left-soft: rgba(255, 107, 107, .14);
  --right: #3da9fc;
  --right-soft: rgba(61, 169, 252, .14);
  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---------- shared shell ---------- */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(180deg, #171f2b, #141b25);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: conic-gradient(from 210deg, var(--left), #b06bf5, var(--right), var(--left));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  flex: 0 0 auto;
}
.brand-title { font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: 11px; white-space: nowrap; }
.topbar .spacer { flex: 1 1 auto; }

.login-page { display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 380px); }
.login-card h1 { font-size: 18px; }
.account-form { display: grid; gap: 12px; max-width: 380px; }
.page.account-page { max-width: 960px; }
.account-page .card { margin-top: 16px; }
.account-page h2 { font-size: 16px; }
.account-admin { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 24px; }
.account-list { min-width: 0; overflow: auto; }
.account-list form { margin-top: 12px; }
.account-message { margin: 0; color: var(--ok); }
.account-error, #loginError { color: var(--danger); }
.claim-home p { margin: 0 0 12px; }
.claim-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.claim-history { margin-top: 16px; }
.claim-history .card-body { overflow: auto; }
.claim-history h2, .claim-title { font-size: 16px; }
.stat-row.claim-stats { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); }
.claim-controls + #workMessage { margin: 12px 0 0; }
@media (max-width: 680px) { .account-admin { grid-template-columns: 1fr; } }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.badge.accent { color: #b9d6ff; border-color: #2f5f9e; background: var(--accent-soft); }
.badge.ok { color: #9be6a8; border-color: #245c31; background: rgba(63,185,80,.12); }
.badge.warn { color: #f0cf8a; border-color: #66491a; background: rgba(210,153,34,.12); }
.badge.left { color: #ffb3b3; border-color: #6b2a2a; background: var(--left-soft); }
.badge.right { color: #a8d7ff; border-color: #22537c; background: var(--right-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.muted { background: var(--muted-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: #232d3c; border-color: #364357; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: #1f6feb; border-color: #2f81f7; color: #fff; }
.btn.primary:hover { background: #2b7cf0; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb3ae; border-color: #5c2a27; background: rgba(248,81,73,.08); }
.btn.warn { color: #f0cf8a; border-color: #66491a; background: rgba(210,153,34,.12); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.input, .select, textarea.input {
  height: 36px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--border); background: #0f151d; color: var(--text);
  outline: none;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 64px; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { border-color: #3a6ea8; box-shadow: 0 0 0 3px rgba(76,154,255,.12); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.card-head h3 { font-size: 13px; color: #c6d3e3; letter-spacing: .2px; }
.card-body { padding: 14px; }

/* ---------- index ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 26px 20px 60px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.hero h1 { font-size: 24px; letter-spacing: .2px; }
.hero p { color: var(--muted); margin: 6px 0 0; max-width: 720px; }
.grid-2 { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 104px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { min-width: 0; overflow-wrap: anywhere; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px 11px; }
.stat b { display: block; font-size: 18px; font-family: var(--mono); font-weight: 600; }
.stat span { color: var(--muted); font-size: 11px; }
.start-form { display: grid; grid-template-columns: minmax(180px, 1fr) 180px 160px auto; gap: 10px; align-items: end; }
@media (max-width: 900px) { .start-form { grid-template-columns: minmax(160px, 1fr) 160px; } }
@media (max-width: 640px) { .start-form { grid-template-columns: 1fr; } }
.view-table { width: 100%; border-collapse: collapse; }
.view-table th, .view-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.view-table th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }
.view-table tr:last-child td { border-bottom: none; }
.view-table tr:hover td { background: rgba(255,255,255,.018); }
.view-table .thumb { width: 54px; height: 54px; border-radius: 6px; object-fit: cover; background: #000; border: 1px solid var(--border); display: block; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.status-chip.ok { color: var(--ok); }
.status-chip.warn { color: var(--warn); }

.abc { display: grid; gap: 12px; }
.abc-item { border: 1px solid var(--border-soft); border-radius: 9px; padding: 11px 12px; background: var(--panel-2); }
.abc-item h4 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.abc-item p { margin: 0; color: var(--muted); font-size: 12.5px; }
.abc-key { display: inline-flex; width: 20px; height: 20px; border-radius: 5px; align-items: center; justify-content: center; background: var(--accent-soft); color: #9ec8ff; font-size: 11px; font-weight: 700; font-family: var(--mono); }

/* ---------- annotate ---------- */
.annotate-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.annotate-main { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 356px; min-height: 0; }
@media (max-width: 1180px) { .annotate-main { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 900px) { .annotate-main { grid-template-columns: minmax(0, 1fr) 300px; } }
#claimNext { grid-column: 1 / -1; }

.stage { position: relative; min-width: 0; min-height: 0; background: radial-gradient(circle at 50% 38%, #1a222e 0, #0d1117 70%); display: flex; flex-direction: column; }
.stage-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft); background: rgba(13,17,23,.6); backdrop-filter: blur(4px);
  flex: 0 0 auto;
}
.stage-toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.canvas-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.canvas-wrap.panning #canvas { cursor: grabbing; }
.canvas-hud { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 11px; pointer-events: none; }
.canvas-hud .legend { display: inline-flex; align-items: center; gap: 5px; }
.canvas-hud .swatch { width: 8px; height: 8px; border-radius: 50%; }
.canvas-hud .swatch.left { background: var(--left); }
.canvas-hud .swatch.right { background: var(--right); }
.canvas-hud .swatch.seed { border: 1.5px dashed var(--muted); background: transparent; }
.zoom-hud { position: absolute; right: 12px; bottom: 10px; color: var(--muted); font-size: 11px; font-family: var(--mono); pointer-events: none; }
.canvas-toast {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(13,17,23,.92); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-size: 12px; pointer-events: none;
  opacity: 0; transition: opacity .18s; max-width: 80%;
}
.canvas-toast.show { opacity: 1; }

.side { border-left: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side-section { padding: 12px; border-bottom: 1px solid var(--border-soft); min-height: 0; flex: 0 0 auto; }
.side-section.grow { flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; }
.side-section.grow .joint-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; }
.side-section:last-child { border-bottom: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.side-head h3 { font-size: 12px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.hand-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hand-tab {
  border: 1px solid var(--border); background: var(--panel-2); border-radius: 9px;
  padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; text-align: left;
}
.hand-tab .ht-name { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 13px; }
.hand-tab .ht-count { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.hand-tab.left.active { border-color: #7a3232; background: var(--left-soft); box-shadow: inset 0 0 0 1px rgba(255,107,107,.25); }
.hand-tab.right.active { border-color: #22537c; background: var(--right-soft); box-shadow: inset 0 0 0 1px rgba(61,169,252,.22); }
.hand-tab .ht-dot { width: 8px; height: 8px; border-radius: 50%; }
.hand-tab.left .ht-dot { background: var(--left); }
.hand-tab.right .ht-dot { background: var(--right); }

.current-joint { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px 11px; }
.current-joint .cj-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.current-joint .cj-name { font-weight: 650; font-size: 14px; }
.current-joint .cj-idx { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.current-joint .cj-coord { color: var(--muted); font-family: var(--mono); font-size: 11.5px; margin-top: 3px; }
.current-joint .cj-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

.joint-list { display: grid; gap: 2px; }
.joint-row {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center;
  padding: 5px 7px; border-radius: 6px; cursor: pointer; border: 1px solid transparent;
}
.joint-row:hover { background: var(--panel-2); }
.joint-row.active { background: var(--accent-soft); border-color: #2f5f9e; }
.joint-row .jr-idx { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); text-align: right; }
.joint-row .jr-name { font-size: 12.5px; display: flex; align-items: center; gap: 7px; min-width: 0; }
.joint-row .jr-name .en { color: var(--muted-2); font-size: 10.5px; font-family: var(--mono); }
.joint-row .jr-status { font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); }
.joint-row.has-point .jr-status { color: #9ec8ff; }
.joint-row.occluded .jr-status { color: var(--warn); }
.joint-row.skipped .jr-status { color: var(--muted-2); text-decoration: line-through; }
.joint-row.seed-only .jr-status { color: var(--muted); }
.jr-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: 0 0 auto; }
.joint-row.has-point .jr-dot { background: var(--accent); }
.joint-row.active .jr-dot { background: #b9d6ff; }
.joint-row.occluded .jr-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--warn); }
.joint-row.skipped .jr-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted-2); }

.notes { width: 100%; min-height: 58px; }
.nav-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nav-row .btn { width: 100%; }
.save-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.save-line .state.ok { color: var(--ok); }
.save-line .state.warn { color: var(--warn); }

.footbar {
  flex: 0 0 auto; height: 30px; display: flex; align-items: center; gap: 16px;
  padding: 0 14px; border-top: 1px solid var(--border); background: var(--bg-soft);
  color: var(--muted-2); font-size: 11px; overflow: hidden; white-space: nowrap;
}
.footbar kbd {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 1px 4px; background: #0f151d;
}

/* ---------- review ---------- */
.review-main { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 14px; padding: 14px; height: calc(100vh - 54px); min-height: 0; }
@media (max-width: 1000px) { .review-main { grid-template-columns: 1fr; height: auto; } }
.review-stage { position: relative; background: #0b0f15; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 420px; }
#reviewCanvas { display: block; width: 100%; height: 100%; cursor: grab; }
.review-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.review-side > * { flex: 0 0 auto; }
.review-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); user-select: none; }
.check input { accent-color: var(--accent); }
.review-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.review-stats .stat { padding: 8px 10px; }
.review-stats .stat b { font-size: 15px; }
.review-table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-family: var(--mono); }
.review-table th, .review-table td { padding: 4px 5px; border-bottom: 1px solid var(--border-soft); text-align: right; white-space: nowrap; }
.review-table th { color: var(--muted); font-weight: 500; font-size: 10px; }
.review-table td:first-child, .review-table th:first-child { text-align: left; }
.review-table tr.hand-sep td { border-top: 1px solid var(--border); }
.review-note { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; }
.legend-row .li { display: inline-flex; align-items: center; gap: 6px; }
.legend-row .mark { width: 9px; height: 9px; border-radius: 50%; }
.legend-row .mark.sq { border-radius: 2px; }
.legend-row .mark.cross { border-radius: 0; background: transparent; box-shadow: inset 0 0 0 1.5px #fff; transform: rotate(45deg); }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2c3646; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4659; }
::-webkit-scrollbar-track { background: transparent; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(4,7,11,.72); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { width: min(520px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal .card-body { padding: 18px; }
.modal h3 { margin-bottom: 8px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
.hidden { display: none !important; }

@media print {
  .topbar, .footbar, .review-side { display: none; }
  body { background: #fff; color: #000; }
}
/* ---------- v0.2 shared nav / home ---------- */
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav-links a {
  color: var(--muted); font-size: 12.5px; padding: 7px 10px; border-radius: 7px;
  text-decoration: none; white-space: nowrap;
}
.nav-links a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-links a.active { color: #cfe3ff; background: var(--accent-soft); }
@media (max-width: 900px) { .nav-links { display: none; } }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
.quick-card {
  display: flex; flex-direction: column; gap: 5px; padding: 15px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: border-color .12s, background .12s;
}
.quick-card:hover { border-color: #3a6ea8; background: var(--panel-2); text-decoration: none; }
.quick-card b { font-size: 14px; }
.quick-card span { color: var(--muted); font-size: 12px; }
.quick-card .qc-icon { color: var(--accent); font-size: 20px; line-height: 1; }

.assign-summary {
  margin-top: 12px; padding: 9px 11px; border: 1px solid var(--border-soft);
  border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 12px;
}
.set-mini { padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.set-mini:last-child { border-bottom: none; padding-bottom: 0; }
.set-mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.set-mini-meta { color: var(--muted); font-size: 11.5px; margin: 3px 0 7px; }
.set-mini-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.progress { height: 5px; background: #0f151d; border-radius: 999px; overflow: hidden; border: 1px solid var(--border-soft); }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #2f81f7, #58a6ff); }

.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 10.5px;
  color: var(--muted); text-decoration: none; font-family: var(--mono);
}
.mini-chip span { font-family: var(--sans); font-size: 10px; }
.mini-chip:hover { border-color: #3a6ea8; text-decoration: none; }
.mini-chip.ok { color: #9be6a8; border-color: #245c31; background: rgba(63,185,80,.08); }
.mini-chip.warn { color: #f0cf8a; border-color: #66491a; background: rgba(210,153,34,.08); }
.task-table td { vertical-align: middle; }

/* ---------- v0.2 browse ---------- */
.browse-body { min-height: 100vh; }
.browse-layout {
  display: grid; grid-template-columns: 258px minmax(0, 1fr);
  gap: 14px; padding: 14px; max-width: 1680px; margin: 0 auto;
}
@media (max-width: 900px) { .browse-layout { grid-template-columns: 1fr; } }
.browse-side { min-width: 0; }
.filter-stack { display: grid; gap: 10px; }
.browse-main { min-width: 0; }
.browse-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 2px 10px; }
.browse-head h2 { font-size: 17px; }
.browse-head > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.browse-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.browse-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 12px; align-items: start;
}
.browse-empty { padding: 40px; text-align: center; color: var(--muted); }
.pool-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s;
}
.pool-card:hover { border-color: #3a6ea8; transform: translateY(-1px); }
.pool-card.include { border-color: #245c31; }
.pool-card.exclude { opacity: .72; }
.pool-cover { position: relative; aspect-ratio: 1 / 1; background: #05080c; overflow: hidden; }
.pool-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pool-cover-top { position: absolute; top: 7px; left: 7px; right: 7px; display: flex; justify-content: space-between; gap: 6px; }
.pool-cover-top .badge { background: rgba(9,13,19,.82); backdrop-filter: blur(2px); }
.pool-progress {
  position: absolute; right: 7px; bottom: 7px; padding: 2px 7px; border-radius: 999px;
  background: rgba(9,13,19,.82); color: #cfe3ff; font-size: 10.5px; font-family: var(--mono);
}
.pool-body { padding: 9px 10px 10px; }
.pool-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pool-title b { font-family: var(--mono); font-size: 13px; }
.pool-title span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 10.5px; margin-top: 4px; }
.pool-flags { min-height: 19px; display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.pool-actions { display: flex; gap: 5px; margin-top: 7px; }
.pool-actions .btn { flex: 1 1 auto; padding: 0 5px; font-size: 11px; }
.flag-badge {
  display: inline-flex; align-items: center; height: 17px; padding: 0 5px;
  border-radius: 4px; font-size: 10px; font-family: var(--mono);
  border: 1px solid var(--border); color: var(--muted);
}
.flag-badge.good { color: #9be6a8; border-color: #245c31; background: rgba(63,185,80,.1); }
.flag-badge.unsure { color: #f0cf8a; border-color: #66491a; background: rgba(210,153,34,.1); }
.flag-badge.bad { color: #ffb3ae; border-color: #5c2a27; background: rgba(248,81,73,.1); }
.flag-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.flag-dot.good { background: var(--ok); }
.flag-dot.unsure { background: var(--warn); }
.flag-dot.bad { background: var(--danger); }

/* ---------- drawer ---------- */
body.drawer-open { overflow: hidden; }
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer.hidden { display: none; }
.drawer-back { position: absolute; inset: 0; background: rgba(3,6,10,.72); }
.drawer-panel {
  position: absolute; inset: 18px; display: flex; flex-direction: column;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0,0,0,.65); overflow: hidden;
}
@media (max-width: 760px) { .drawer-panel { inset: 4px; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
.drawer-title { font-size: 15px; font-weight: 650; }
.drawer-sub { color: var(--muted); font-size: 11.5px; }
.drawer-body { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 390px; min-height: 0; }
@media (max-width: 1000px) { .drawer-body { grid-template-columns: 1fr; overflow-y: auto; } }
.drawer-left { display: flex; flex-direction: column; min-height: 0; padding: 10px; gap: 8px; }
.drawer-stage { position: relative; flex: 1 1 auto; min-height: 300px; background: #070a0f; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.drawer-stage canvas { display: block; width: 100%; height: 100%; }
.drawer-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.view-strip { display: flex; gap: 5px; overflow-x: auto; padding: 2px 0 4px; }
.view-pill {
  position: relative; flex: 0 0 auto; width: 48px; height: 48px; padding: 0; border-radius: 6px;
  border: 1px solid var(--border); background: #05080c; overflow: hidden;
}
.view-pill img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .8; }
.view-pill span { position: absolute; left: 2px; bottom: 1px; font-size: 9px; font-family: var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.view-pill.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.view-pill.active img { opacity: 1; }
.view-pill .flag-dot { position: absolute; right: 2px; top: 2px; }
.drawer-right { border-left: 1px solid var(--border); background: var(--panel); overflow-y: auto; padding: 10px; }
@media (max-width: 1000px) { .drawer-right { border-left: none; border-top: 1px solid var(--border); } }
.decision-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.row-end { display: flex; justify-content: flex-end; }
.flag-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 11px; border-bottom: 1px solid var(--border-soft); }
.flag-row:last-child { border-bottom: none; }
.flag-view { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.flag-view b { font-family: var(--mono); }
.flag-view span { color: var(--muted); font-size: 10.5px; }
.flag-btns { display: flex; gap: 3px; }
.flag-btn {
  height: 22px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 10px;
}
.flag-btn.good.active { color: #9be6a8; border-color: #245c31; background: rgba(63,185,80,.14); }
.flag-btn.unsure.active { color: #f0cf8a; border-color: #66491a; background: rgba(210,153,34,.14); }
.flag-btn.bad.active { color: #ffb3ae; border-color: #5c2a27; background: rgba(248,81,73,.14); }
.flag-btn.none.active { color: #cfe3ff; border-color: #2f5f9e; background: var(--accent-soft); }
.sbs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.sbs-tile { position: relative; background: #05080c; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer; }
.sbs-tile canvas { display: block; width: 100%; height: auto; }
.sbs-label { position: absolute; left: 3px; right: 3px; bottom: 3px; display: flex; align-items: center; gap: 4px; font-size: 9.5px; color: #fff; text-shadow: 0 1px 3px #000; }
.sbs-label .mono { color: #cfe3ff; font-size: 9px; }
.sbs-label .flag-dot { margin-left: auto; }
.drawer-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- sets / assign ---------- */
.set-card + .set-card { margin-top: 16px; }
.set-stats { margin: 0 0 12px; }
.set-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.set-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 9px; }
.set-group {
  display: flex; gap: 8px; padding: 7px; border: 1px solid var(--border-soft);
  border-radius: 8px; color: var(--text); background: var(--panel-2); text-decoration: none;
}
.set-group:hover { border-color: #3a6ea8; text-decoration: none; }
.set-group img { width: 58px; height: 58px; border-radius: 6px; object-fit: cover; background: #000; flex: 0 0 auto; }
.set-group-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-group-body b { font-family: var(--mono); font-size: 12px; }
.set-group-body span { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); margin: 0 3px; }
.decision-dot.include { background: var(--ok); }
.decision-dot.exclude { background: var(--danger); }
.decision-dot.undecided { background: var(--warn); }

.assign-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.group-assign { margin-top: 12px; }
.assign-table .thumb.sm { width: 42px; height: 42px; }
.select.sm { height: 28px; padding: 0 26px 0 8px; font-size: 11.5px; border-radius: 6px; background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px; }

/* ---------- v0.4 hand-task ---------- */
.quality-row { display: flex; flex-wrap: wrap; gap: 5px; }
.quality-row .flag-btn { height: 26px; padding: 0 9px; font-size: 11px; }
.flag-badge.diff {
  color: #ffb3ae; border-color: #5c2a27; background: rgba(248,81,73,.12);
}
.diff-dot {
  position: absolute; right: 2px; top: 2px; font-style: normal;
  font-size: 9px; line-height: 13px; padding: 0 3px; border-radius: 3px;
  background: rgba(248,81,73,.9); color: #fff;
}
.task-flag-row { display: block; padding: 8px 11px; }
.task-flag-row .flag-view { margin-bottom: 5px; }
.task-flag-lines { display: grid; gap: 5px; }
.task-flag-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-flag-line .check { font-size: 10.5px; margin-left: 4px; }
.task-line { font-size: 12px; padding: 7px 9px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--panel-2); }
.pair-list { display: grid; }
.pair-row {
  display: grid; grid-template-columns: 92px 1fr auto auto; gap: 8px; align-items: center;
  padding: 6px 10px; border: 0; border-bottom: 1px solid var(--border-soft);
  background: transparent; color: var(--text); text-align: left; font-size: 11px;
}
.pair-row:hover { background: var(--panel-2); }
.pair-row:last-child { border-bottom: none; }
.pair-row .mono { font-size: 10.5px; }

.assign-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.assign-filters .field { min-width: 140px; }
.supplement-box { border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px 11px; background: var(--panel-2); }
.person-checks { display: flex; flex-wrap: wrap; gap: 12px; }
.person-checks .check { font-size: 12px; }

.group-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.group-manage { border: 1px solid var(--border-soft); border-radius: 9px; background: var(--panel-2); padding: 9px 10px; }
.gm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.gm-head > div:first-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gm-head b { font-family: var(--mono); font-size: 12.5px; }
.gm-head .spacer { flex: 1 1 auto; }
.gm-views { display: flex; flex-wrap: wrap; gap: 5px; }
.view-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 3px 3px 7px;
  border: 1px solid var(--border); border-radius: 6px; background: #0f151d; font-size: 10.5px;
}
.view-tag b { font-family: var(--mono); }
.view-tag .mono { color: var(--muted); }
.tag-x {
  width: 18px; height: 18px; padding: 0; border-radius: 4px; border: 1px solid transparent;
  background: transparent; color: var(--muted-2); font-size: 10px; line-height: 1;
}
.tag-x:hover { color: #ffb3ae; border-color: #5c2a27; background: rgba(248,81,73,.12); }
.gm-add { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.gm-add .select { min-width: 150px; }

.audit-row, .archive-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 13px;
  border-bottom: 1px solid var(--border-soft); font-size: 12px;
}
.audit-row:last-child, .archive-row:last-child { border-bottom: none; }
.archive-row { justify-content: space-between; }
.archive-row > b { font-family: var(--mono); }
.view-item .vi-title { white-space: nowrap; }
.view-item .vi-title b { font-family: var(--mono); font-weight: 600; }
.view-item .vi-title .badge { margin-left: auto; }

/* Whole-image annotation */
.image-annotate { min-height: 100dvh; display: flex; flex-direction: column; }
.image-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(315px, 370px); flex: 1; }
.image-stage { min-width: 0; background: var(--bg-soft); }
.image-tools, .image-section-title, .image-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.image-tools { padding: 10px 14px 0; }
.image-tools .spacer { flex: 1; }
.image-hint { margin: 8px 14px; color: var(--muted); font-size: 12px; }
.image-viewport { max-height: calc(100dvh - 135px); min-height: 200px; overflow: auto; padding: 12px; }
.image-frame { position: relative; margin-inline: auto; overflow: hidden; background: #0a0d12; }
.image-frame img { display: block; width: 100%; height: 100%; }
.image-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.image-box-guide { position: absolute; inset: 0; pointer-events: none; }
.image-box-guide::before, .image-box-guide::after {
  content: ""; position: absolute;
  filter: drop-shadow(0 0 1px rgba(12, 18, 29, .9));
}
.image-box-guide::before { left: var(--guide-x); top: 0; bottom: 0; width: 1px; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .9) 0 6px, transparent 6px 10px); }
.image-box-guide::after { top: var(--guide-y); left: 0; right: 0; height: 1px; background: repeating-linear-gradient(to right, rgba(255, 255, 255, .9) 0 6px, transparent 6px 10px); }
.image-inspector { min-width: 0; max-height: calc(100dvh - 54px); overflow-y: auto; background: var(--panel); border-left: 1px solid var(--border); }
.image-inspector section { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); }
.image-section-title { justify-content: space-between; margin-bottom: 8px; }
.image-section-title h2, .image-section-title h3 { font-size: 14px; }
.image-section-title h2 span { color: var(--muted); font-weight: 400; }
.image-hand-list { display: grid; gap: 5px; max-height: 175px; overflow: auto; }
.image-hand, .image-point { border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); text-align: left; padding: 5px 7px; }
.image-hand { display: flex; justify-content: space-between; }
.image-hand b { color: var(--accent); margin-right: 4px; }
.image-hand.active, .image-point.active { border-color: var(--accent); background: var(--accent-soft); }
.image-point-current { color: var(--text); font-size: 13px; font-weight: 600; }
.image-point-diagram { position: relative; width: min(100%, 240px); aspect-ratio: 240 / 230; margin: 8px auto 0; }
.image-point-diagram svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.image-point-diagram line { stroke: #60738c; stroke-width: 3; stroke-linecap: round; }
.diagram-point { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.diagram-point span { display: grid; place-items: center; width: 13px; height: 13px; border: 2px solid #b9c8d8; border-radius: 50%; background: #d9e6f2; color: #a8b5c5; font-size: 13px; line-height: 1; }
.diagram-point.occluded span { background: #e9b958; border-color: #e9b958; }
.diagram-point.skipped span { background: var(--panel); border-color: #8795a7; }
.diagram-point.pending span { background: var(--panel); border-style: dashed; }
.diagram-point.active { background: rgba(62, 153, 255, .28); box-shadow: 0 0 0 2px var(--accent); }
.diagram-point:hover { background: rgba(62, 153, 255, .22); }
.diagram-point:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.image-point-caption { margin: 2px 0 6px; text-align: center; color: var(--muted); font-size: 11px; }
.image-point-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.image-point-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 4px; border: 1px solid #b9c8d8; border-radius: 50%; background: #d9e6f2; }
.image-point-legend .legend-occluded::before { background: #e9b958; border-color: #e9b958; }
.image-point-legend .legend-skipped::before { content: '×'; background: transparent; text-align: center; line-height: 7px; }
.image-point-legend .legend-pending::before { background: transparent; border-style: dashed; }
.image-actions { margin-top: 8px; }
.shortcut-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.shortcut-dialog::backdrop { background: rgba(4, 7, 11, .72); }
.shortcut-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.shortcut-header h2 { font-size: 16px; }
.shortcut-list { margin: 16px 0; }
.shortcut-list div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.shortcut-list dt { white-space: nowrap; }
.shortcut-list dd { margin: 0; text-align: right; }
.shortcut-list kbd { display: inline-block; min-width: 24px; padding: 2px 5px; text-align: center; font: 12px var(--sans); background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; }
.shortcut-dialog p { margin: 0; }
.image-quality { margin-top: 12px; }
.image-quality > summary { cursor: pointer; }
.image-quality .field, .image-quality .check { margin-top: 8px; }
.image-message { margin: 0 0 8px; color: var(--ok); }
.image-error { color: var(--danger); }
@media (max-width: 780px) {
  .image-editor { grid-template-columns: 1fr; }
  .image-inspector { max-height: none; border-left: 0; }
  .image-viewport { max-height: 60dvh; }
}

.admission-guide section + section { border-top: 1px solid var(--border-soft); margin-top: 14px; padding-top: 14px; }
.admission-guide h3 { font-size: 14px; }
.admission-guide p { color: var(--muted); margin: 5px 0 0; }
.admission-comparison { position: relative; width: min(100%, 720px); }
.admission-comparison img { display: block; width: 100%; }
.admission-comparison canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.quality-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 780px) { .quality-review-grid { grid-template-columns: 1fr; } }

/* Local-only review reminders. */
.review-checklist summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.review-checklist p { margin: 6px 0 8px; }
.review-checklist-item { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; font-size: 13px; line-height: 1.4; }
.review-checklist-item input { flex: none; margin-top: 3px; accent-color: var(--accent); }

.review-checklist-float { position: fixed; left: 12px; top: 120px; z-index: 30; width: min(320px, calc(100vw - 24px)); max-height: min(70dvh, 520px); overflow-y: auto; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.review-checklist-float .review-checklist summary { cursor: grab; touch-action: none; user-select: none; }
.review-checklist-float .review-checklist summary:active { cursor: grabbing; }

.diagram-point.accessory span, .image-point-legend .legend-accessory::before { background: #b993ff; border-color: #b993ff; }
.diagram-point.other span, .image-point-legend .legend-other::before { background: #ff9d70; border-color: #ff9d70; }
.diagram-point.clothing span, .image-point-legend .legend-clothing::before { background: #63d6cb; border-color: #63d6cb; }

.diagram-point.skipped.reason-accessory span { border-color: #b993ff; color: #b993ff; }
.diagram-point.skipped.reason-other span { border-color: #ff9d70; color: #ff9d70; }
.diagram-point.skipped.reason-clothing span { border-color: #63d6cb; color: #63d6cb; }

.hand-difficulty { margin: 0 0 14px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); }
.hand-difficulty p { margin: 6px 0 0; line-height: 1.45; }
.hand-difficulty .field { margin-top: 8px; }
