:root {
  --bg: #08070a; --panel: #100e13; --line: #231f29; --text: #ece7df; --dim: #7d7686;
  --venom: #ff2f4b; --silk: #cfc8bd; --ok: #7fe0a3; --warn: #f2b04a;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 var(--mono); display: flex; flex-direction: column; }
a { color: inherit; }
b { font-weight: 600; }
.dim { color: var(--dim); }

header { display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 46px; border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; letter-spacing: .04em; color: var(--venom); }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav a { padding: 5px 11px; text-decoration: none; color: var(--dim); border-radius: 4px; white-space: nowrap; }
nav a:hover { color: var(--text); }
nav a.on { color: var(--bg); background: var(--silk); }
.meters { margin-left: auto; display: flex; gap: 16px; color: var(--dim); white-space: nowrap; }
.meters b { color: var(--text); font-variant-numeric: tabular-nums; }
.dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.dot.off::before { background: var(--dim); }

main { flex: 1; min-height: 0; }
.tab { height: 100%; overflow: auto; }
#web { display: grid; grid-template-columns: minmax(0, 1fr) 380px; overflow: hidden; }
#web[hidden] { display: none; }
.webwrap { position: relative; min-height: 0; container-type: inline-size; }
@container (max-width: 900px) {
  .hero { top: 12px; left: 16px; }
  .hero h1 { font-size: 19px; }
  .hero h1 br, .hero p { display: none; }
}
#graph { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.hero { position: absolute; left: 24px; top: 20px; max-width: 400px; pointer-events: none; }
.hero h1 { font: 400 30px/1.12 var(--serif); margin: 0 0 10px; letter-spacing: -.01em; text-wrap: balance; }
.hero h1 em { color: var(--venom); }
.hero p { color: var(--dim); margin: 0; font-size: 12px; }
.hero p b { color: var(--text); }
.legend { position: absolute; left: 24px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--dim); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.tip { position: absolute; background: var(--panel); border: 1px solid var(--line); padding: 6px 9px; max-width: 320px; pointer-events: none; font-size: 11px; border-radius: 4px; z-index: 2; }

.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel { border-bottom: 1px solid var(--line); min-width: 0; }
.panel.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; border-bottom: 0; }
.phead { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--silk); border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.phead .dim, .phead a { text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
#spot { display: block; width: 100%; aspect-ratio: 960/600; background: #000; object-fit: cover; }
#feed { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; font-size: 11.5px; }
#feed li { padding: 3px 12px; display: grid; grid-template-columns: 86px 1fr auto; gap: 8px; cursor: pointer; }
#feed li:hover { background: var(--panel); }
#feed li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#feed .who { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#feed .n { color: var(--ok); font-variant-numeric: tabular-nums; }
#feed .rej { color: var(--dim); cursor: default; }
#feed .rej .n { color: var(--warn); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1px; background: var(--line); }
.screen { background: var(--bg); }
.screen img { display: block; width: 100%; aspect-ratio: 960/600; background: #000; object-fit: cover; }
.screen .cap { padding: 6px 10px; display: flex; gap: 8px; font-size: 11px; }
.screen .cap span:last-child { margin-left: auto; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.st-crawling { color: var(--venom); } .st-reading { color: var(--ok); } .st-idle, .st-hatching { color: var(--dim); } .st-dead { color: var(--warn); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1px; background: var(--line); min-height: 100%; }
.cols .panel { background: var(--bg); border: 0; }
.note { padding: 10px 12px; margin: 0; color: var(--dim); }
.note b { color: var(--text); }
form { display: flex; gap: 8px; padding: 12px; }
form.stack { flex-direction: column; max-width: 420px; }
input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); color: var(--text); font: inherit; padding: 8px 10px; border-radius: 4px; }
input:focus { outline: 1px solid var(--venom); }
button { background: var(--venom); color: #fff; border: 0; font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
button:hover { filter: brightness(1.1); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 5px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 400; font-size: 11px; }
td.r, th.r { text-align: right; }
.bar { display: inline-block; height: 6px; background: var(--venom); border-radius: 3px; vertical-align: middle; margin-right: 8px; }

.pipeline { list-style: none; margin: 0; padding: 6px 0; }
.pipeline li { display: grid; grid-template-columns: 22px 110px 1fr; padding: 4px 12px; }
.pipeline .done { color: var(--ok); } .pipeline .todo { color: var(--dim); }
#chapters div { display: grid; grid-template-columns: 110px 1fr 150px; gap: 10px; align-items: center; padding: 4px 12px; }
#chapters .track { height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden; }
#chapters .track i { display: block; height: 100%; }
#chapters span:last-child { color: var(--dim); text-align: right; }
.hit { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.hit a { color: var(--silk); }
.hit p { margin: 4px 0; color: var(--dim); font-family: var(--serif); font-size: 14px; line-height: 1.45; }
.hit mark { background: none; color: var(--text); border-bottom: 1px solid var(--venom); }
.hit small { color: var(--dim); cursor: pointer; }
.hit small:hover { color: var(--venom); }
.ver { margin: 0; padding: 12px; white-space: pre-wrap; word-break: break-all; color: var(--dim); font: inherit; font-size: 12px; }
.ver .ok { color: var(--ok); } .ver .bad { color: var(--venom); }
.man { margin: 0 auto; padding: 24px 16px; max-width: 86ch; white-space: pre-wrap; color: var(--silk); font: inherit; }
.man b { color: var(--text); }
.sealrow { padding: 6px 12px; border-bottom: 1px solid var(--line); word-break: break-all; }

@media (max-width: 860px) {
  header { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px 16px; }
  .meters { margin-left: 0; width: 100%; }
  #web { grid-template-columns: 1fr; grid-template-rows: 55vh auto; overflow: auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  #feed { max-height: 300px; }
  .hero h1 { font-size: 22px; }
  .hero p { display: none; }
}

/* ---------- home: stage + web + top ---------- */
#web { grid-template-columns: minmax(0, .68fr) minmax(0, 1.32fr); grid-template-rows: minmax(0, 1fr) 232px; }
#web > * { min-width: 0; min-height: 0; }
.left { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.hero { position: static; max-width: none; pointer-events: auto; padding: 18px 24px 10px; }
.hero h1 { font: italic 400 clamp(40px, 5.2vw, 76px)/.95 var(--serif); letter-spacing: -.03em; margin: 0 0 6px; color: var(--text); }
.hero .tag { font: 400 19px/1.25 var(--serif); color: var(--silk); margin: 0 0 8px; }
.hero .tag em { color: var(--venom); }
.hero .sub { color: var(--dim); font-size: 12px; max-width: 62ch; margin: 0 0 14px; }
.counters { display: flex; gap: 26px; flex-wrap: wrap; }
.counters b { display: block; font: 400 26px/1 var(--serif); font-variant-numeric: tabular-nums; }
.counters span { color: var(--dim); font-size: 11px; }
.webwrap { flex: 1; }
.right { display: flex; flex-direction: column; }
.stagehead { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stagehead a { color: var(--dim); overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.rec { color: var(--venom); animation: blink 1.2s steps(2) infinite; }
.rec.replay { color: var(--warn); }
@keyframes blink { 50% { opacity: .25; } }
.stage { flex: 1; position: relative; background: #000; overflow: hidden; }
.stage img, .stage canvas { position: absolute; display: block; }
.stage img:not([src]) { visibility: hidden; }
.verdict { padding: 8px 12px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.verdict .ok { color: var(--ok); } .verdict .bad { color: var(--warn); }
.bl, .br { border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.bl { border-right: 1px solid var(--line); }
.meters2 { padding: 8px 12px 4px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.meters2 .m { color: var(--ok); letter-spacing: -1px; }
.meters2 b { color: var(--text); font-weight: 400; }
.tablewrap { overflow: auto; flex: 1; }
#top { font-size: 11.5px; }
#top th { background: var(--silk); color: var(--bg); position: sticky; top: 0; padding: 2px 12px; }
#top td { border: 0; padding: 2px 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
#top tr { cursor: pointer; }
#top tr:hover td { background: var(--panel); }
#top tr.pin td { background: #1d1016; }
#top td.dim { color: var(--dim); }
@keyframes flash { from { background: rgba(127, 224, 163, .22); } }
#top tr.hit td { animation: flash .9s ease-out; }
@media (prefers-reduced-motion: reduce) { .rec, #top tr.hit td { animation: none; } }
@media (max-width: 860px) {
  #web { grid-template-columns: 1fr; grid-template-rows: auto 62vw auto auto; }
  .left { border-right: 0; }
  .webwrap { display: none; }
  .right { grid-row: 2; }
  .bl { border-right: 0; max-height: 240px; }
  .hero .sub { display: block; }
}

/* ---------- scanner view ---------- */
.stage { display: flex; background: #060508; }
.scan { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.stage .scan canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pip { position: absolute; right: 22px; bottom: 12px; width: 190px; margin: 0; border: 1px solid #3a3440; background: #000; transition: width .2s ease; z-index: 2; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.pip:hover { width: min(460px, 70%); }
.stage .pip img { position: static; display: block; width: 100%; aspect-ratio: 960/600; object-fit: cover; }
.pip figcaption { position: absolute; left: 0; top: 0; background: rgba(8,7,10,.85); color: var(--dim); font-size: 10px; padding: 1px 6px; }
.hud { width: 240px; flex: none; border-left: 1px solid var(--line); padding: 10px 12px; font-size: 11px; overflow: auto; background: var(--bg); }
.hud .row { margin-bottom: 9px; opacity: .18; transition: opacity .25s; }
.hud .row.on { opacity: 1; }
.hud label { display: block; color: var(--dim); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 1px; }
.hud .v { word-break: break-word; }
.hud .bar2 { height: 5px; background: var(--panel); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.hud .bar2 i { display: block; height: 100%; background: var(--ok); transition: width .15s linear; }
.hud .chip { display: inline-block; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; margin: 2px 3px 0 0; white-space: nowrap; }
.hud .chip b { color: var(--venom); font-weight: 400; }
.hud .ok { color: var(--ok); } .hud .bad { color: var(--warn); }
.hud a { color: var(--silk); }
@media (max-width: 1100px) { .hud { display: none; } }
@media (prefers-reduced-motion: reduce) { .pip, .hud .row, .hud .bar2 i { transition: none; } }

.bl, .br { overflow: hidden; }
.meters2 { overflow: hidden; }
.meters2 span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- calmer hero ---------- */
.hero { padding: 30px 32px 6px; }
.hero h1 { line-height: 1.02; margin: 0 0 16px; padding-bottom: .06em; }
.hero .tag { font-size: 21px; line-height: 1.35; margin: 0 0 12px; }
.hero .sub { font-size: 12.5px; line-height: 1.7; max-width: 52ch; margin: 0 0 26px; }
.counters { gap: 36px; row-gap: 16px; }
.counters b { font-size: 30px; margin-bottom: 6px; }
.legend { left: 32px; bottom: 14px; gap: 6px 18px; font-size: 11.5px; }

@media (max-width: 860px) { .hero .tag { display: block; } }

#web { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.left .legend { position: static; padding: 6px 32px 12px; }

.xlink { color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; }
.xlink:hover { border-color: var(--venom); color: var(--venom); }

.ca { display: flex; align-items: center; gap: 10px; margin-top: 22px; border: 1px solid var(--line); border-radius: 4px; padding: 6px 6px 6px 12px; max-width: 520px; }
.ca span { color: var(--venom); font-size: 11px; letter-spacing: .12em; }
.ca code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; font-size: 12px; }
.ca button { background: var(--silk); color: var(--bg); padding: 4px 12px; flex: none; }

.grid { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.screen .cap { padding: 9px 12px; font-size: 12.5px; }
