:root {
  --bg: #05080c; --pane: #080c11; --pane2: #0b1016; --line: #141c25; --line2: #1e2a36;
  --text: #c9d4dd; --dim: #5e6c7a; --mute: #36424f;
  --green: #a970ff; --green2: #a970ff; --amber: #ffb84d; --red: #ff5468; --blue: #b48cff;
  --ice: #8cc3d4; --ink: #10081c; --edge: #35234f;
  --mono: 'IBM Plex 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; background-image: radial-gradient(1100px 420px at 50% -180px, rgba(169,112,255,.07), transparent 70%); background-repeat: no-repeat; }
a { color: var(--green); text-decoration: none; }
button { font: inherit; }
.red { color: var(--red); }

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

/* ---------- top bar: thin, one violet rule underneath ---------- */
.top { position: relative; display: flex; align-items: center; gap: 16px; height: 36px; margin: 0 -6px; padding: 0 0 0 12px; background: linear-gradient(180deg, #0a1119, var(--bg)); border-bottom: 1px solid rgba(169,112,255,.28); color: var(--ice); flex: none; font-size: 12px; white-space: nowrap; }
.top::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 168px; height: 1px; background: var(--green); }
.brand { display: flex; align-items: center; gap: 9px; height: 100%; color: var(--text); font-weight: 700; letter-spacing: .18em; font-size: 12.5px; }
.brand img { flex: none; border-radius: 4px; box-shadow: 0 0 10px rgba(169,112,255,.3); }
.brand b { color: var(--green); font-weight: 700; }
.wins { display: flex; gap: 4px; color: var(--dim); font-size: 11px; letter-spacing: .12em; }
.wins span { padding: 0 4px; }
.wins span::before { content: '[ '; color: var(--mute); }
.wins span::after { content: ' ]'; color: var(--mute); }
.wins .on { color: var(--green); }
.wins .on::before, .wins .on::after { color: var(--green2); }
.stats { display: flex; margin-left: auto; color: var(--dim); overflow: hidden; }
.stats span { padding: 0 12px; border-left: 1px solid var(--line2); }
.stats span:first-child { border-left: 0; }
.stats b { color: var(--green); font-weight: 500; }
.stats b.red { color: var(--red); }
.pill { flex: none; font-size: 10.5px; padding: 0 9px; height: 20px; display: flex; align-items: center; gap: 6px; color: var(--amber); border: 1px solid rgba(255,184,77,.7); background: rgba(255,184,77,.07); letter-spacing: .14em; font-weight: 600; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--green); border-color: var(--green2); background: rgba(169,112,255,.08); }
.mute { flex: none; width: 44px; height: 36px; display: grid; place-items: center; background: none; border: 0; border-left: 1px solid var(--line2); color: var(--ice); cursor: pointer; }
.mute.off .w { opacity: 0; }
.announce { border: 1px solid var(--amber); border-left-width: 3px; color: var(--amber); padding: 6px 10px; font-size: 12px; background: rgba(255,184,77,.05); }

/* ---------- the CA search: a target field ---------- */
.search { flex: none; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 4px 0 12px; border: 1px solid var(--line2); border-left: 2px solid var(--green); background: var(--pane2); }
.search:focus-within { border-color: var(--green2); border-left-color: var(--green); }
.search label { color: var(--dim); white-space: nowrap; font-size: 12px; }
.search label .p { color: var(--green); font-size: 10.5px; font-weight: 600; letter-spacing: .16em; margin-right: 6px; }
.search input { flex: 1; min-width: 0; height: 32px; 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 { background: rgba(169,112,255,.06); border-color: var(--edge); color: var(--green); letter-spacing: .06em; }
.search button:hover, .viewing button:hover { border-color: var(--green2); color: var(--green); }
.search.busy button { color: var(--amber); border-color: var(--amber); background: none; }
.viewing { flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid rgba(255,184,77,.6); border-left: 2px solid var(--amber); background: #14100a; 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(--edge); }
/* corner brackets on the two main panes */
.pane.stage::after, .pane.vis::after { content: ''; position: absolute; inset: -1px; pointer-events: none; z-index: 4;
  background:
    linear-gradient(var(--green), var(--green)) left top / 12px 1px no-repeat,
    linear-gradient(var(--green), var(--green)) left top / 1px 12px no-repeat,
    linear-gradient(var(--green), var(--green)) right top / 12px 1px no-repeat,
    linear-gradient(var(--green), var(--green)) right top / 1px 12px no-repeat,
    linear-gradient(var(--green), var(--green)) left bottom / 12px 1px no-repeat,
    linear-gradient(var(--green), var(--green)) left bottom / 1px 12px no-repeat,
    linear-gradient(var(--green), var(--green)) right bottom / 12px 1px no-repeat,
    linear-gradient(var(--green), var(--green)) right bottom / 1px 12px no-repeat; }
.ph { height: 24px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-bottom: 1px dashed var(--line2); background: var(--pane2); color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; }
.stage .ph, .vis .ph { border-bottom-color: var(--edge); background: linear-gradient(90deg, rgba(169,112,255,.07), rgba(169,112,255,0) 70%); }
.ph span { color: var(--mute); font-size: 10px; letter-spacing: .04em; }
.stage .ph span, .vis .ph span { color: var(--green2); }
.ph strong { color: var(--ice); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: 10.5px; }
.stage .ph strong, .vis .ph strong { color: var(--green); }
.ph i { font-style: normal; color: var(--text); opacity: .6; overflow: hidden; text-overflow: ellipsis; }
.ph i::before { content: '/ '; color: var(--mute); }
.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); } }

/* layout: rig | map on top, hex | jev | trace underneath */
.grid { flex: 1; min-height: 0; display: grid; gap: 6px; 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; }

/* ---------- map window ---------- */
#net { position: absolute; left: 0; top: 24px; width: 100%; height: calc(100% - 24px); display: block; }
.inset { position: absolute; left: 12px; top: 36px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
#dither { width: 80px; height: 80px; image-rendering: pixelated; border: 1px solid var(--edge); background: #03060a; }
.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: 12px; top: 126px; 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); background: rgba(255,84,104,.06); letter-spacing: .06em; animation: fin .3s ease-out both; }
.flags i.ok { border-color: var(--green2); color: var(--green); background: rgba(169,112,255,.06); }
@keyframes fin { from { opacity: 0; transform: translateY(4px); } }
.stamp { position: absolute; right: 14px; bottom: 14px; min-width: 220px; padding: 10px 14px; border: 1px solid rgba(255,84,104,.55); border-left: 3px solid var(--red); background: rgba(5,8,12,.92); display: flex; flex-direction: column; gap: 2px; }
.stamp small { color: var(--dim); font-size: 10px; letter-spacing: .16em; 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); border-left-color: var(--green); }
.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: 24px; width: 100%; height: calc(100% - 24px); display: block; }

pre { margin: 0; font: inherit; }
.dump { flex: 1; overflow: hidden; padding: 6px 10px; 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: #8a9db0; } .dump .a { color: var(--green2); } .dump .l { color: var(--amber); }
.bars { padding: 6px 10px 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 10px; 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; z-index: 5; border: 1px solid var(--amber); border-left-width: 3px; background: rgba(5,8,12,.96); padding: 6px 8px; font-size: 11px; }

/* ---------- botnet ---------- */
.botnet { flex: none; }
.nodes { padding: 4px 10px 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: #a970ff; } .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: 46px; padding: 0 6px 0 12px; border: 1px solid var(--edge); border-top-color: var(--green2); background: var(--pane2); }
.calabel { color: var(--green); font-weight: 600; letter-spacing: .08em; }
.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; font-family: var(--mono); }
.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; letter-spacing: .06em; }
#copy { border-color: var(--edge); }
.buy { background: var(--green); color: var(--ink); border-color: var(--green); font-weight: 700; text-transform: uppercase; }
.buy.off, #copy:disabled { opacity: .35; pointer-events: none; }

/* ---------- below the fold ---------- */
.below { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 6px 24px; }
.feed, .wanted { list-style: none; margin: 0; padding: 6px 10px 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: #a9b6c1; max-width: 900px; }
.how li { margin-bottom: 8px; } .how li::marker { color: var(--green2); } .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; }

/* desktop only: a soft vignette at the edges, no scanlines */
@media (min-width: 821px) {
  body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50; background: radial-gradient(ellipse at center, transparent 62%, rgba(0,0,0,.32)); }
}

/* ---------- phone first ---------- */
@media (max-width: 820px) {
  .app { height: auto; min-height: 100dvh; padding: 0 4px 58px; gap: 4px; }
  .top { gap: 8px; height: 44px; font-size: 11px; margin: 0 -4px; padding-left: 10px; }
  .top::after { width: 120px; }
  .brand { flex: none; font-size: 11px; letter-spacing: .04em; gap: 6px; }
  .top .hm, .wins { display: none; }
  .stats span { padding: 0 8px; }
  .mute { height: 44px; }
  .grid { display: flex; flex-direction: column; gap: 4px; }
  .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: 8px; top: 32px; gap: 8px; }
  .imeta b { font-size: 14px; } .imeta span { font-size: 10.5px; max-width: 190px; }
  /* phones: the rig window already prints flags and the verdict box, so the map keeps a small stamp only */
  .flags { display: none; }
  .stamp { left: auto; right: 8px; bottom: 8px; 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: auto; min-height: 48px; gap: 6px; padding-left: 10px; flex-wrap: wrap; }
  .search label .p { display: none; }
  .search input { font-size: 16px; height: 44px; }   /* 16px: iOS doesn't zoom into the field */
  .search button { height: 44px; }
  .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: 44px; }
  .cabar { position: fixed; left: 4px; right: 4px; bottom: 4px; z-index: 40; height: 52px; gap: 6px; }
  .calabel { font-size: 11px; letter-spacing: 0; }
  #ca { font-size: 11px; } .mc { display: none; }
  #copy, .buy { height: 44px; min-width: 56px; padding: 0 10px; }
  .below { grid-template-columns: 1fr; padding: 0 4px 72px; gap: 4px; }
  .how { grid-column: 1; }
}
@media (max-width: 400px) { .stats span:nth-child(2) { display: none; } .brand { letter-spacing: 0; } }
