:root {
  --bg: #101216;
  --hud: #181b22;
  --text: #f3f4f6;
  --muted: #9aa3b2;
  --line: #2a303b;
  --ok: #78e0a8;
  --warn: #e7c36a;
  --bad: #f0a0a0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
body { display: flex; flex-direction: column; }
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--hud);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: #3cc86a; box-shadow: 0 0 0 6px rgba(60, 200, 106, 0.16);
}
h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: 0.04em; }
.slogan {
  margin: 3px 0 0;
  color: #c5cdd8;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
}
#subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill, .stat {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--muted);
}
button.pill {
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.pill.switch { cursor: pointer; user-select: none; }
.pill.warn { color: #2a2208; background: var(--warn); border-color: transparent; }
.pill.bad { color: #3a1010; background: var(--bad); border-color: transparent; }
main { flex: 1; min-height: 0; display: flex; }
#stage {
  position: relative;
  margin: 10px;
  flex: 1;
  min-width: 0;
  height: calc(100vh - 76px);
  background: #0b0d11;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
#still, #frame, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#still {
  object-fit: contain;
  background: #0b0d11;
  z-index: 1;
  image-rendering: -webkit-optimize-contrast;
}
#frame {
  display: none;
  background: #0b0d11;
  z-index: 2;
}
#overlay { pointer-events: none; z-index: 3; }
#toast {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 18px;
  transform: translate(-50%, -30px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(60, 200, 106, 0.94);
  color: #082012;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: opacity 180ms ease, transform 220ms ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#hint {
  position: absolute;
  z-index: 4;
  left: 16px;
  bottom: 14px;
  color: #d7dde6;
  font-size: 13px;
  background: rgba(16, 18, 22, 0.62);
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 70%;
}
#legend {
  position: absolute;
  z-index: 4;
  left: 16px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  background: rgba(16, 18, 22, 0.72);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #d7dde6;
}
#legend label, #legend .legend-always { display: flex; align-items: center; gap: 5px; }
#legend label { cursor: pointer; }
#legend .legend-always { color: #8ee0b0; }
#legend input { margin: 0; }
#ocr-panel {
  width: 360px;
  flex-shrink: 0;
  margin: 10px 10px 10px 0;
  height: calc(100vh - 76px);
  background: var(--hud);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ocr-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.ocr-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
#ocr-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.band-card {
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #162018;
  border: 1px solid #2a4a38;
  color: #c5e6d2;
  font-size: 13px;
  line-height: 1.45;
}
.band-card strong { color: #78e0a8; font-size: 15px; }
.band-card .band-meta { margin-top: 4px; font-size: 11px; color: var(--muted); }
.ocr-actions { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.ocr-actions button, .ocr-card button {
  border: 1px solid var(--line);
  background: #222733;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ocr-actions button { width: 100%; }
.ocr-actions button:disabled, .ocr-card button:disabled { opacity: 0.5; cursor: default; }
#ocr-engines { flex: 1; overflow: auto; padding: 0 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.ocr-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: #141820;
}
.ocr-card.active { border-color: #3cc86a; background: #162018; }
.ocr-card.preview { box-shadow: inset 3px 0 0 var(--accent, #ffd24a); }
.ocr-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ocr-card-top strong { font-size: 13px; }
.ocr-card-top span { font-size: 11px; color: var(--muted); }
.ocr-meta { margin: 4px 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.ocr-verdict {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}
.ocr-verdict.cut { background: #1f3d2c; color: #78e0a8; }
.ocr-verdict.slow { background: #3d3418; color: #e7c36a; }
.ocr-verdict.weak { background: #3d3418; color: #e7c36a; }
.ocr-verdict.blob, .ocr-verdict.layout, .ocr-verdict.qno, .ocr-verdict.read, .ocr-verdict.empty { background: #3a2222; color: #f0a0a0; }
.ocr-verdict.fail { background: #3a2222; color: #f0a0a0; }
.ocr-seq { margin: 4px 0 0; font-size: 11px; color: #c5cdd8; line-height: 1.35; }
.ocr-card-actions { display: flex; gap: 6px; margin-top: 6px; }
.ocr-card-actions button { flex: 1; }
#dwell-now { margin: 8px 0 0; color: var(--text); font-size: 13px; font-weight: 650; line-height: 1.4; }
#dwell-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
#paper-lib-hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.paper-lib-actions { display: flex; gap: 6px; margin-top: 8px; }
.paper-lib-actions button {
  flex: 1;
  border: 1px solid var(--line);
  background: #222733;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.paper-lib-actions button:disabled { opacity: 0.5; cursor: wait; }
#btn-paper-reset { color: #f0a0a0; }
.paper-album {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px 10px;
  max-height: 28vh;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}
.paper-album.empty {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.paper-shot {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12161d;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  overflow: hidden;
}
.paper-shot:hover { border-color: #4aa3d6; }
.paper-shot.current { border-color: #3cc86a; box-shadow: 0 0 0 2px rgba(60, 200, 106, 0.22); }
.paper-shot img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  background: #0b0d11;
  display: block;
}
.paper-shot figcaption { padding: 6px 7px 7px; }
.paper-shot .ttl { font-size: 12px; font-weight: 650; line-height: 1.3; }
.paper-shot .sub { margin-top: 2px; color: var(--muted); font-size: 11px; }
.paper-detail {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.62);
  z-index: 40;
  display: flex;
  justify-content: flex-end;
}
.paper-detail.hidden { display: none; }
.paper-detail-panel {
  width: min(520px, 96vw);
  height: 100%;
  background: #141820;
  border-left: 1px solid var(--line);
  padding: 16px 18px;
  overflow: auto;
}
.paper-detail-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.paper-detail-top h2 { margin: 0 0 4px; font-size: 16px; }
.paper-detail-top p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.paper-detail-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.paper-detail-panel h3 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); font-weight: 650; }
.paper-detail-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; }
.paper-detail-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #7dd3fc;
}
.paper-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.paper-detail-grid figure { margin: 0; }
.paper-detail-grid img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #0b0d11;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.paper-detail-grid figcaption { margin-top: 5px; font-size: 12px; color: var(--muted); }
#paper-detail-shots { margin: 0; padding: 0 0 0 18px; font-size: 13px; line-height: 1.7; }
#paper-detail-shots .muted { color: var(--muted); }
#dwell-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  max-height: 34vh;
  overflow: auto;
}
#dwell-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  margin: 0 0 6px;
  border-radius: 8px;
  background: #141820;
  border: 1px solid var(--line);
}
#dwell-list li.active { border-color: #3cc86a; background: #162018; }
#dwell-list li.hard { border-color: #c45c5c; background: #241616; }
#dwell-list li.watch { border-color: #8a7a3a; background: #221e12; }
#dwell-list .dwell-q { font-weight: 650; font-size: 13px; }
#dwell-list .dwell-ms { font-variant-numeric: tabular-nums; color: #c5e6d2; font-size: 12px; }
#dwell-list .dwell-flag { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
#dwell-list li.hard .dwell-flag { color: #f0a0a0; }
#dwell-list li.watch .dwell-flag { color: #e7c36a; }
#dwell-empty { color: var(--muted); font-size: 12px; padding: 4px 2px; }
#dwell-list li.dwell-empty {
  display: block;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  color: var(--muted);
  font-weight: 400;
}
#ocr-qnos {
  max-height: 28vh;
  overflow: auto;
  margin: 0;
  padding: 8px 18px 12px 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #d7dde6;
}
#ocr-qnos li { margin: 0 0 6px; line-height: 1.35; }
a.pill { text-decoration: none; }
a.pill.go {
  color: #082012;
  background: var(--ok);
  border-color: transparent;
  font-weight: 650;
}
button.pill.go {
  color: #082012;
  background: var(--ok);
  border: 1px solid transparent;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
}
button.pill.go:disabled {
  opacity: 0.55;
  cursor: default;
}
.dwell-open {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #3cc86a;
  color: #082012;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
body.dwell-page main {
  display: block;
  overflow: auto;
  padding: 16px 18px 32px;
}
#dwell-report { max-width: 880px; margin: 0 auto; }
.dwell-empty-page { color: var(--muted); font-size: 14px; }
.paper-card {
  margin: 0 0 16px;
  padding: 14px 16px 10px;
  background: var(--hud);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.paper-card.current { border-color: #3cc86a; }
.paper-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.paper-card h2 { margin: 0; font-size: 16px; }
.page-now {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #162018;
  color: #78e0a8;
  font-size: 11px;
  font-weight: 650;
}
.paper-total { color: #c5e6d2; font-variant-numeric: tabular-nums; font-size: 14px; }
.page-head { margin: 8px 0 0; color: #d7e4dc; font-size: 13px; }
.page-seq { margin: 4px 0 10px; color: var(--muted); font-size: 12px; }
.dwell-summary,
.paper-facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
}
.paper-facts { margin: 10px 0 8px; }
.dwell-summary li,
.paper-facts li {
  margin: 0;
  padding: 10px 12px;
  background: var(--hud);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.paper-facts li { background: #141820; padding: 8px 10px; }
.dwell-summary b,
.paper-facts b {
  display: block;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #c5e6d2;
  line-height: 1.3;
  word-break: break-word;
}
.paper-facts b { font-size: 13px; color: #e8edf4; }
.dwell-summary span,
.paper-facts span {
  color: var(--muted);
  font-size: 11px;
}
.paper-card ol { list-style: none; margin: 0; padding: 0; }
.paper-card ol li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  margin: 0 0 6px;
  border-radius: 8px;
  background: #141820;
  border: 1px solid var(--line);
}
.paper-card ol li.active { border-color: #3cc86a; background: #162018; }
.paper-card ol li.hard { border-color: #c45c5c; background: #241616; }
.paper-card ol li.watch { border-color: #8a7a3a; background: #221e12; }
.paper-card .dwell-q { font-weight: 650; font-size: 14px; }
.paper-card .dwell-stem {
  display: block;
  margin-top: 4px;
  font-weight: 400;
  font-size: 12px;
  color: #c5d4cc;
  line-height: 1.45;
}
.paper-brief {
  margin: 10px 0 8px;
  padding: 10px 12px;
  background: #141820;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.paper-subject {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1f3d2c;
  color: #78e0a8;
  font-size: 12px;
  font-weight: 650;
}
.paper-brief .paper-title { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.paper-brief .paper-summary { margin: 0; color: #d7e4dc; font-size: 13px; line-height: 1.5; }
.paper-brief .paper-sum-err { margin: 6px 0 0; color: #f0a0a0; font-size: 12px; }
.paper-card .dwell-flag {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.paper-card ol li.hard .dwell-flag { color: #f0a0a0; }
.paper-card ol li.watch .dwell-flag { color: #e7c36a; }
.paper-card .dwell-meta { color: var(--muted); font-size: 12px; }
.paper-card .dwell-ms { font-variant-numeric: tabular-nums; color: #c5e6d2; font-size: 14px; font-weight: 650; }
.dwell-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.dwell-subjects button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: #141820;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.dwell-subjects button.on {
  background: #1f3d2c;
  color: #78e0a8;
  border-color: #3cc86a;
}
.paper-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}
.paper-toolbar .paper-sum { margin: 0; }
.paper-pos-note { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.paper-sum-hint { margin: 4px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.q-head { margin: 12px 0 8px; font-size: 13px; font-weight: 650; color: #d7e4dc; }
.paper-sources { margin: 12px 0 8px; }
.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.source-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: #141820;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.source-tabs button.on {
  background: #1f3d2c;
  color: #78e0a8;
  border-color: #3cc86a;
}
.source-tabs em {
  font-style: normal;
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.75;
}
.source-detail {
  padding: 10px 12px;
  background: #141820;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.source-meta { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.source-llm .paper-title { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.source-llm .paper-summary { margin: 0; color: #d7e4dc; font-size: 13px; line-height: 1.5; }
.source-stems,
.source-vote {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.source-stems li,
.source-vote li {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
  color: #d7e4dc;
}
.source-stems b,
.source-vote b {
  margin-right: 8px;
  color: #c5e6d2;
}
.source-vote span { color: var(--muted); font-size: 12px; }
.source-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
}
.source-lines li {
  display: flex;
  gap: 10px;
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.45;
  color: #d7e4dc;
}
.source-lines code {
  flex: 0 0 9.5em;
  color: #8b9bb4;
  font-size: 11px;
}
.source-text {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: #d7e4dc;
}
#dwell-prev:disabled,
#dwell-next:disabled,
#dwell-now:disabled {
  opacity: 0.45;
  cursor: default;
}
