:root {
  --bg: #0e1014;
  --panel: #161920;
  --panel2: #1d212a;
  --line: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --accent: #f59e0b;
  --input: #2dd4bf;
  --blue: #60a5fa;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.5 system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.loading, .error { padding: 40px; color: var(--muted); }
.error { color: #f87171; }
.pad { padding: 16px; }
.warn { color: #fbbf24; font-size: 12px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { font-size: 16px; }
.scene-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* buttons / chips */
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; cursor: pointer; font: inherit; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.btn:hover { border-color: #3f4655; text-decoration: none; }
.btn.small { padding: 2px 9px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; min-width: 84px; justify-content: center; }
.btn.disabled { opacity: 0.35; pointer-events: none; }
.chip { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { color: var(--text); border-color: #4b5363; background: var(--panel2); }
.chip.small { padding: 1px 9px; font-size: 12px; }
.chip .cnt { font-size: 12px; color: var(--muted); }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.preview { color: #fbbf24; border-color: #5c4a1a; background: #2a2210; }
.badge.res { color: #f9a8d4; border-color: #5b2a45; background: #2a1622; }
.badge.ok { color: #86efac; border-color: #1f4d33; background: #10241a; }
.badge.track { color: var(--blue); border-color: #23395c; background: #121c2c; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cb { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
select, input[type=search] { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font: inherit; }
input[type=range] { accent-color: var(--accent); }

/* home */
.home { padding: 16px 20px 60px; max-width: 1680px; margin: 0 auto; }
.status { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-row { display: flex; gap: 16px; align-items: center; }
.search { width: 300px; }
.group { margin-top: 24px; }
.group-head { display: flex; align-items: baseline; gap: 10px; }
.group-head h2 { margin: 0; font-size: 18px; }
.group-desc { margin: 2px 0 10px; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); display: flex; flex-direction: column; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: #4b5363; transform: translateY(-1px); text-decoration: none; }
.thumb { position: relative; aspect-ratio: 16/9; background: #0a0b0e; overflow: hidden; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tl { position: absolute; top: 6px; left: 6px; }
.thumb .tr { position: absolute; top: 6px; right: 6px; }
.nothumb { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); font-size: 13px; background: #0a0b0e; }
.card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.card-meta { font-size: 12px; color: var(--muted); }
.card-id { font-size: 11px; color: #5d6574; font-family: ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* scene layout */
.scene-page { padding: 12px 16px 40px; }
.scene-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 34%); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .scene-body { grid-template-columns: 1fr; } }
.main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.side-wrap { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 64px; }
.tb-line { display: flex; gap: 10px; align-items: baseline; }
.tb-title { font-size: 15px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg { background: transparent; color: var(--muted); border: 0; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.seg.on { background: var(--panel2); color: var(--text); }
.col-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { font-size: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.tab { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 5px 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; }
.tab span { font-size: 11px; }
.tab.on { border-color: var(--blue); background: #121c2c; }

/* stage */
.stage { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; user-select: none; }
.orbit-stage { cursor: grab; touch-action: none; }
.orbit-stage.dragging { cursor: grabbing; }
.stage-grid { display: grid; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.col-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.wipe-head { font-weight: 400; flex-wrap: wrap; }
.media { position: relative; width: 100%; background: #07080a; border-radius: 6px; overflow: hidden; }
.media > img, .media > video, .media .wipe-a > *, .media .wipe-b > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.media img.gone { opacity: 0.15; }
.missing { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.wipe-a, .wipe-b { position: absolute; inset: 0; }
.wipe-handle { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; transform: translateX(-1px); cursor: ew-resize; z-index: 2; touch-action: none; }
.wipe-handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: #111; border-radius: 999px; padding: 2px 7px; font-size: 13px; box-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.wipe-handle::before { content: ""; position: absolute; inset: 0 -10px; }

/* controls */
.controls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.counter { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-size: 13px; margin-left: 6px; }
.scrub { width: 100%; }
.readout { font-variant-numeric: tabular-nums; font-size: 13px; }
.sliders { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 14px; align-items: center; }
.sliders label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
@media (max-width: 800px) { .sliders { grid-template-columns: 1fr; } }

/* inputs strip */
.strip-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.strip-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; font-size: 13px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumb-in { margin: 0; flex: 0 0 auto; width: 150px; cursor: zoom-in; border: 2px solid transparent; border-radius: 6px; overflow: hidden; position: relative; background: #07080a; }
.thumb-in img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.thumb-in figcaption { position: absolute; left: 4px; bottom: 3px; font-size: 11px; background: rgba(0,0,0,0.6); padding: 0 5px; border-radius: 3px; }
.thumb-in.closest { border-color: #f472b6; }

/* side: 3d */
.side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.side-head .muted { font-size: 11px; flex: 1; }
.view3d { height: min(56vh, 520px); position: relative; }
.view3d canvas { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.info { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 2px; }
.info-title { font-weight: 600; margin-bottom: 2px; }
.info .k { color: var(--muted); display: inline-block; width: 64px; }
.notes { margin-top: 14px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.notes a { margin-left: 8px; }
.note { white-space: pre-wrap; }

/* showcase */
.showcase section { margin-bottom: 22px; }
.showcase h3 { font-size: 15px; margin: 8px 0; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.mcard { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.mcard.wide { grid-column: 1 / -1; }
.mmedia { aspect-ratio: 16/9; background: #07080a; position: relative; overflow: hidden; }
.mmedia img, .mmedia video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.mcard figcaption { padding: 6px 10px 8px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.cap { white-space: pre-wrap; color: #c7ccd6; font-size: 12px; }
.fname { font-size: 11px; font-family: ui-monospace, monospace; }
.row { display: flex; gap: 8px; align-items: center; }
.fplayer img { width: 100%; max-height: 70vh; object-fit: contain; display: block; background: #07080a; }
.fplayer .row { padding: 6px 10px; }
.fplayer input { flex: 1; }

/* lightbox / modal */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lb-inner { position: relative; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; gap: 6px; }
.lb-inner img, .lb-inner video { max-width: 94vw; max-height: 84vh; object-fit: contain; }
.lb-inner.wide { width: 90vw; height: 86vh; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.lb-cap { color: var(--muted); font-size: 13px; }
.lb-close { align-self: flex-end; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; cursor: pointer; font: inherit; }
.modal-head { display: flex; gap: 12px; align-items: center; padding: 6px 10px; }
.modal-head .lb-close { margin-left: auto; }
.modal-canvas { flex: 1; position: relative; min-height: 0; }
.modal-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.prompt { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0 12px; white-space: pre-wrap; }
.mgrid.single { grid-template-columns: minmax(0, 1fr); max-width: 1400px; }
.mgrid.single .mmedia { aspect-ratio: auto; max-height: 78vh; }
.mgrid.single .mmedia img, .mgrid.single .mmedia video { position: static; max-height: 78vh; height: auto; }
.overlay-btn { position: absolute; top: 8px; left: 8px; z-index: 3; }
.overlay-btn.second { left: auto; right: 8px; }
.card-cap { font-size: 12px; color: #b8bfcc; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notes summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.src-line { font-size: 12px; color: #b8bfcc; word-break: break-all; }
.anchor-picker { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.anchor-row { display: flex; gap: 10px; align-items: center; }
.anchor-label { width: 36px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.anchor-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.anchor { flex: 0 0 auto; width: 96px; padding: 0; background: #07080a; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; color: var(--muted); font: inherit; display: flex; flex-direction: column; }
.anchor img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.anchor small { font-size: 10px; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anchor.on { border-color: var(--accent); color: var(--text); }
.anchor.na { opacity: 0.35; }
.view3d.big { height: min(68vh, 760px); }

/* benchmark page */
.bench { max-width: 1100px; }
.bench-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-top: 16px; }
.bench-card h3 { margin: 0 0 4px; font-size: 16px; }
.bench-card h4 { margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.small { font-size: 12px; }
.hbar { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.hb-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 10px; min-height: 22px; }
.hb-row:hover .hb-label { color: var(--text); }
.hb-label { text-align: right; color: #c3c8d2; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-label.strong { color: var(--text); font-weight: 600; }
.hb-track { position: relative; height: 22px; border-left: 1px solid #3a404c; margin-right: 56px; }
.hb-bar { position: absolute; left: 0; top: 4px; height: 14px; border-radius: 0 4px 4px 0; }
.hb-ci { position: absolute; top: 10px; height: 2px; background: #e6e8ec; opacity: 0.85; }
.hb-ci::before, .hb-ci::after { content: ""; position: absolute; top: -4px; width: 2px; height: 10px; background: #e6e8ec; }
.hb-ci::before { left: 0; } .hb-ci::after { right: 0; }
.hb-val { position: absolute; top: 2px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.hb-ref { position: absolute; top: -4px; bottom: -4px; border-left: 1px dashed #8b93a3; }
.hb-row.axis { min-height: 14px; }
.hb-row.axis .hb-track { height: 14px; border-left-color: transparent; }
.hb-ref-label { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: #0b0c10; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.5; display: none; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.btable { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.btable th, .btable td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.btable th:first-child, .btable td:first-child { text-align: left; }
.btable th { color: var(--muted); font-weight: 500; }
.btable td.atlas { background: rgba(57, 135, 229, 0.10); }
.btable td.best { font-weight: 700; color: #fff; }
.btable tr.avg td { border-bottom: 2px solid #3a404c; }
.btable tbody tr:hover td { background: var(--panel2); }
.mtext { aspect-ratio: 16/9; overflow: auto; padding: 12px 14px; font-size: 13px; line-height: 1.6; color: #d7dbe3; background: #0b0c10; }
.thumb-in.unused { opacity: 0.3; }
