:root {
  --bg: #07090a; --pane: #090c0d; --pane2: #0c1012; --line: #172024; --line2: #223035;
  --text: #c9d1d5; --dim: #5f6b72; --mute: #39434a;
  --green: #4dffa6; --green2: #1f8f5c; --amber: #ffb84d; --red: #ff5468; --blue: #7cc8ff;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 var(--mono); -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
a { color: var(--green); text-decoration: none; }
button { font: inherit; }
.red { color: var(--red); }

/* a faint scanline layer and a soft vignette: a monitor, not a light show */
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.35)); }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 4px; }

/* ---------- tmux status line ---------- */
.top { display: flex; align-items: center; gap: 14px; height: 30px; padding: 0 0 0 8px; background: #0f1f17; color: var(--green); flex: none; font-size: 12px; white-space: nowrap; }
.brand { color: #04110a; background: var(--green); font-weight: 700; padding: 0 8px; height: 100%; display: grid; place-items: center; margin-left: -8px; }
.wins { display: flex; gap: 10px; color: #6fae8d; }
.wins .on { color: #04110a; background: #6fae8d; padding: 0 6px; }
.stats { display: flex; gap: 14px; margin-left: auto; color: #6fae8d; overflow: hidden; }
.stats b { color: var(--green); font-weight: 500; }
.stats b.red { color: var(--red); }
.pill { font-size: 11px; padding: 0 8px; height: 100%; display: grid; place-items: center; color: #04110a; background: var(--amber); letter-spacing: .08em; font-weight: 700; }
.pill.live { background: var(--green); }
.mute { width: 44px; height: 30px; display: grid; place-items: center; background: none; border: 0; border-left: 1px solid #1d3528; color: #6fae8d; cursor: pointer; }
.mute.off .w { opacity: 0; }
.announce { border: 1px solid var(--amber); color: var(--amber); padding: 6px 10px; font-size: 12px; }

/* ---------- the CA search: a prompt line ---------- */
.search { flex: none; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 4px 0 10px; border: 1px solid var(--line2); background: var(--pane2); }
.search label { color: var(--text); white-space: nowrap; font-size: 12.5px; }
.search label .p { color: var(--green); }
.search input { flex: 1; min-width: 0; height: 30px; background: transparent; border: 0; outline: 0; color: var(--green); font: 13px var(--mono); caret-color: var(--green); }
.search input::placeholder { color: var(--mute); }
.search .msg { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.search .msg.err { color: var(--red); } .search .msg.ok { color: var(--amber); }
.search button, .viewing button { height: 30px; min-width: 44px; padding: 0 12px; background: none; border: 1px solid var(--line2); color: var(--text); cursor: pointer; white-space: nowrap; }
.search button:hover, .viewing button:hover { border-color: var(--green2); color: var(--green); }
.search.busy button { color: var(--amber); border-color: var(--amber); }
.viewing { flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--amber); background: #15110a; font-size: 12px; }
.viewing .vt { flex: 1; min-width: 0; color: var(--amber); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewing .go { background: var(--amber); color: #120c02; border-color: var(--amber); font-weight: 600; }
.feed [data-mint], .wanted [data-mint] { cursor: pointer; }
.feed [data-mint]:hover b, .feed [data-mint]:hover span, .wanted [data-mint]:hover b { text-decoration: underline; text-decoration-color: var(--mute); }

/* ---------- panes ---------- */
.pane { border: 1px solid var(--line); background: var(--pane); position: relative; min-width: 0; min-height: 0; }
.pane.stage, .pane.vis { border-color: var(--green2); }
.ph { height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; }
.stage .ph, .vis .ph { border-bottom-color: #14301f; color: #6fae8d; }
.ph span { color: var(--mute); }
.stage .ph span, .vis .ph span { color: var(--green); }
.ph i { font-style: normal; color: var(--text); opacity: .7; overflow: hidden; text-overflow: ellipsis; }
.ph em { font-style: normal; margin-left: auto; color: var(--dim); }
.ph em b { color: var(--green); font-weight: 500; }
.pane.alert { animation: alert 1.4s ease-out; }
@keyframes alert { 0% { border-color: var(--amber); } 100% { border-color: var(--line); } }

/* tmux layout: code | visual on top, hexdump | jev | trace underneath */
.grid { flex: 1; min-height: 0; display: grid; gap: 4px; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(0, 1.75fr) minmax(0, 1fr); }
.stage { grid-column: 1 / 4; grid-row: 1; }
.vis { grid-column: 4 / 7; grid-row: 1; }
.hex { grid-column: 1 / 3; grid-row: 2; display: flex; flex-direction: column; }
.jev { grid-column: 3 / 5; grid-row: 2; }
.intr { grid-column: 5 / 7; grid-row: 2; display: flex; flex-direction: column; }

/* ---------- visual window ---------- */
#net { position: absolute; left: 0; top: 22px; width: 100%; height: calc(100% - 22px); display: block; }
.inset { position: absolute; left: 10px; top: 32px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
#dither { width: 80px; height: 80px; image-rendering: pixelated; border: 1px solid var(--line2); background: #050607; }
.imeta { display: flex; flex-direction: column; gap: 1px; max-width: 220px; }
.imeta b { font-size: 16px; font-weight: 600; color: var(--text); }
.imeta span { font-size: 11.5px; color: var(--text); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imeta span.dim { color: var(--dim); opacity: 1; }
.flags { position: absolute; left: 10px; top: 122px; display: flex; gap: 5px; flex-wrap: wrap; max-width: 55%; pointer-events: none; }
.flags i { font-style: normal; font-size: 10.5px; padding: 1px 6px; border: 1px solid var(--red); color: var(--red); letter-spacing: .06em; animation: fin .3s ease-out both; }
.flags i.ok { border-color: var(--green2); color: var(--green); }
@keyframes fin { from { opacity: 0; transform: translateY(4px); } }
.stamp { position: absolute; right: 12px; bottom: 12px; min-width: 220px; padding: 10px 14px; border: 1px solid var(--red); background: rgba(7,9,10,.92); display: flex; flex-direction: column; gap: 2px; }
.stamp small { color: var(--dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.stamp b { font-size: 26px; line-height: 1.1; font-weight: 700; color: var(--red); letter-spacing: .06em; }
.stamp span { color: var(--text); font-size: 11.5px; }
.stamp.clean { border-color: var(--green2); }
.stamp.clean b { color: var(--green); }
.stamp.in { animation: stampIn .5s cubic-bezier(.2,.9,.25,1) both; }
@keyframes stampIn { 0% { opacity: 0; clip-path: inset(0 100% 0 0); } 100% { opacity: 1; clip-path: inset(0 0 0 0); } }

#tty { position: absolute; left: 0; top: 22px; width: 100%; height: calc(100% - 22px); display: block; }

pre { margin: 0; font: inherit; }
.dump { flex: 1; overflow: hidden; padding: 6px 8px; font-size: 11.5px; line-height: 1.5; color: var(--dim); display: flex; flex-direction: column; justify-content: flex-end; white-space: pre; }
.dump .o { color: var(--mute); } .dump .h { color: #8fa3ad; } .dump .a { color: var(--green2); } .dump .l { color: var(--amber); }
.bars { padding: 6px 8px 8px; font-size: 12px; line-height: 1.55; color: var(--dim); white-space: pre; overflow: hidden; }
.bars .w { color: var(--text); } .bars .r { color: var(--red); } .bars .g { color: var(--green); } .bars .m { color: var(--mute); } .bars .a { color: var(--amber); }

/* ---------- trace ---------- */
.trace { flex: 1; padding: 6px 8px; overflow: hidden; font-size: 12px; white-space: pre; }
.trace .idle { color: var(--dim); margin: 0; white-space: normal; }
.trace .ln { overflow: hidden; text-overflow: ellipsis; min-height: 18px; color: var(--text); }
.trace .p { color: var(--green); } .trace .d { color: var(--dim); } .trace .m { color: var(--mute); } .trace .g { color: var(--green); } .trace .a { color: var(--amber); } .trace .r { color: var(--red); } .trace .w { color: var(--text); }
.sheet { position: absolute; left: 6px; right: 6px; bottom: 6px; border: 1px solid var(--amber); background: rgba(7,9,10,.96); padding: 6px 8px; font-size: 11px; }

/* ---------- botnet ---------- */
.botnet { flex: none; }
.nodes { padding: 4px 8px 6px; height: 38px; overflow: hidden; font-size: 12px; line-height: 14px; letter-spacing: 1px; word-break: break-all; color: var(--mute); }
.nodes .empty { color: var(--dim); letter-spacing: 0; font-size: 12px; }
.nodes i { font-style: normal; }
.nodes .on { color: var(--green2); } .nodes .l3 { color: #2fbf7c; } .nodes .l4, .nodes .l5 { color: var(--green); }
.nodes .new { color: var(--amber); animation: blinkn .25s steps(1) 6; }
@keyframes blinkn { 50% { opacity: 0; } }

/* ---------- CA bar ---------- */
.cabar { flex: none; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 10px; border: 1px solid var(--line2); background: var(--pane2); }
.calabel { color: var(--green); font-weight: 600; }
.calabel::after { content: ' ▸'; color: var(--mute); }
#ca { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12.5px; }
.mc { color: var(--dim); white-space: nowrap; } .mc b { color: var(--text); font-weight: 500; }
#copy, .buy { height: 34px; min-width: 64px; display: grid; place-items: center; padding: 0 14px; border: 1px solid var(--line2); background: none; color: var(--text); cursor: pointer; }
.buy { background: var(--green); color: #04110a; border-color: var(--green); font-weight: 700; }
.buy.off, #copy:disabled { opacity: .35; pointer-events: none; }

/* ---------- below the fold ---------- */
.below { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 0 4px 24px; }
.feed, .wanted { list-style: none; margin: 0; padding: 6px 8px 10px; max-height: 420px; overflow: auto; font-size: 12px; }
.feed li, .wanted li { display: flex; gap: 10px; padding: 2px 0; align-items: baseline; }
.feed time { color: var(--mute); flex: none; }
.feed .v-bad { color: var(--red); } .feed .v-ok { color: var(--green); } .feed .v-am { color: var(--amber); } .feed .dim { color: var(--dim); }
.feed .empty, .wanted .empty { color: var(--dim); }
.wanted li b { min-width: 86px; font-weight: 500; } .wanted li span { color: var(--dim); }
.wanted li .v { color: var(--red); min-width: 120px; }
.how { grid-column: 1 / 3; }
.how ol { margin: 0; padding: 10px 14px 0 30px; color: #aeb8bd; max-width: 900px; }
.how li { margin-bottom: 8px; } .how li b { color: var(--text); font-weight: 600; }
.how .sched { color: var(--amber); padding: 0 14px; font-size: 12px; }
.how .fine { color: var(--dim); padding: 0 14px 6px; font-size: 12px; max-width: 900px; }

body.stream .below, body.stream .announce, body.stream .search, body.stream .viewing { display: none; }

/* ---------- phone first ---------- */
@media (max-width: 820px) {
  .app { height: auto; min-height: 100dvh; padding: 3px 3px 56px; gap: 3px; }
  .top { gap: 8px; height: 32px; font-size: 11px; }
  .top .hm, .wins { display: none; }
  .stats { gap: 8px; }
  .grid { display: flex; flex-direction: column; gap: 3px; }
  .vis { order: 1; height: 40vh; min-height: 270px; max-height: 380px; }
  .stage { order: 2; height: 50vh; min-height: 340px; max-height: 480px; }
  .intr { order: 3; }
  #dither { width: 56px; height: 56px; }
  .inset { left: 6px; top: 28px; gap: 8px; }
  .imeta b { font-size: 14px; } .imeta span { font-size: 10.5px; max-width: 190px; }
  /* phones: the code window already prints flags and the verdict box, so the graph keeps a small stamp only */
  .flags { display: none; }
  .stamp { left: auto; right: 6px; bottom: 6px; min-width: 0; padding: 4px 10px; }
  .stamp small, .stamp span { display: none; }
  .stamp b { font-size: 16px; }
  .hex, .jev { display: none; }
  .intr .trace { min-height: 170px; }
  .search { height: 46px; gap: 6px; padding-left: 8px; }
  .search label .p { display: none; }
  .search input { font-size: 16px; height: 40px; }   /* 16px: iOS doesn't zoom into the field */
  .search button { height: 38px; }
  .search { height: auto; min-height: 46px; flex-wrap: wrap; }
  .search .msg { order: 3; flex-basis: 100%; max-width: none; padding: 0 0 6px; }
  .search .msg:empty { display: none; }
  .viewing { flex-wrap: wrap; }
  .viewing .vt { flex-basis: 100%; }
  .viewing button { flex: 1; height: 38px; }
  .cabar { position: fixed; left: 3px; right: 3px; bottom: 3px; z-index: 40; height: 50px; gap: 6px; }
  #ca { font-size: 11px; } .mc { display: none; }
  #copy, .buy { height: 42px; min-width: 56px; padding: 0 10px; }
  .below { grid-template-columns: 1fr; padding: 0 3px 70px; gap: 3px; }
  .how { grid-column: 1; }
}
@media (max-width: 400px) { .stats span:nth-child(2) { display: none; } .brand { padding: 0 6px; } }
