:root {
  --bg: #0d0e10; --panel: #121316; --panel2: #16171b; --line: #222428; --line2: #2d3035;
  --text: #d9d4c7; --dim: #7b786f; --faint: #4a4943;
  --amber: #c8913a; --amber2: #e6b766; --copper: #b8693f; --teal: #6f9c9a; --ok: #7fa37a; --bad: #c45a3c;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --top: 30px; --tele: 64px; --side: 300px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 11px/1.45 var(--mono); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
b { font-weight: 500; }

/* ---------- top instrumentation bar ---------- */
#top { position: fixed; inset: 0 0 auto 0; height: var(--top); display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--panel); z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 14px; font-weight: 700; letter-spacing: .28em; border-right: 1px solid var(--line); }
.brand { color: inherit; text-decoration: none; white-space: nowrap; }
#top .stat, nav.pages a { white-space: nowrap; }
@media (max-width: 1440px) { .brand .sub { display: none; } }
@media (max-width: 1240px) { #top .stat.wide { display: none; } }
nav.pages { display: flex; border-right: 1px solid var(--line); }
nav.pages a { display: flex; align-items: center; padding: 0 13px; color: var(--dim); text-decoration: none; font-size: 10px; letter-spacing: .16em; border-right: 1px solid var(--line); position: relative; }
nav.pages a:last-child { border-right: 0; }
/* DOCS: boxed in amber with a blinking beacon so first-time visitors find it */
nav.pages a.hl { margin: 5px 8px; padding: 0 10px; border: 1px solid var(--amber); color: var(--amber2); gap: 7px; }
nav.pages a.hl:hover { background: #1d1810; color: var(--amber2); }
nav.pages a.hl.on::after { display: none; }
nav.pages a.hl.on { background: #1d1810; }
.beacon { width: 6px; height: 6px; background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: beacon 1.1s steps(1) infinite; }
@keyframes beacon { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .15; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .beacon { animation: none; } }
nav.pages a:hover { color: var(--text); background: var(--panel2); }
nav.pages a.on { color: var(--amber); }
nav.pages a.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--amber); }
.brand .mark { width: 9px; height: 9px; background: var(--amber); box-shadow: inset -3px -3px 0 var(--copper); }
.brand .sub { font-weight: 400; letter-spacing: .14em; color: var(--dim); font-size: 9px; }
#top .stat { display: flex; align-items: center; gap: 7px; padding: 0 12px; border-right: 1px solid var(--line); white-space: nowrap; }
#top .stat span { color: var(--dim); font-size: 9px; letter-spacing: .14em; }
#top .stat b { font-variant-numeric: tabular-nums; }
#top .stat em { font-style: normal; font-size: 8.5px; letter-spacing: .1em; padding: 1px 4px; border: 1px solid var(--line2); color: var(--amber); }
#top .stat em.live { color: var(--ok); }
#top .spacer { flex: 1; }
#top .spacer ~ .stat { border-right: 0; border-left: 1px solid var(--line); }
#top .stat:last-of-type { border-right: 0; border-left: 1px solid var(--line); }
#top .follow { display: flex; align-items: center; gap: 7px; margin: 5px 8px; padding: 0 10px; border: 1px solid var(--amber); color: var(--amber2); text-decoration: none; font-size: 10px; letter-spacing: .16em; white-space: nowrap; }
#top .follow:hover { background: #1d1810; }
#top .follow svg { width: 11px; height: 11px; fill: currentColor; flex: none; }
.dot { width: 6px; height: 6px; background: var(--faint); display: inline-block; }
#s-sys.on .dot { background: var(--ok); animation: blink 2s steps(2) infinite; }
#s-sys.off .dot { background: var(--bad); }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- layout ---------- */
#main { position: fixed; top: var(--top); bottom: var(--tele); left: 0; right: 0; display: flex; }
#side { width: var(--side); display: flex; border-right: 1px solid var(--line); background: var(--panel); flex: none; transition: width .18s; }
body.collapsed #side { width: 41px; }
body.collapsed #panel { display: none; }
#tabs { width: 40px; display: flex; flex-direction: column; border-right: 1px solid var(--line); flex: none; }
#tabs button { height: 38px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 10px; letter-spacing: .08em; position: relative; }
#tabs button:hover { color: var(--text); background: var(--panel2); }
#tabs button.on { color: var(--amber); background: var(--bg); }
#tabs button.on::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--amber); }
#tabs .grow { flex: 1; }
#tabs #collapse { border-top: 1px solid var(--line); border-bottom: 0; font-size: 14px; }
body.collapsed #collapse span { display: inline-block; transform: scaleX(-1); }
#panel { flex: 1; overflow-y: auto; overflow-x: hidden; min-width: 0; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }

/* panel content */
.sec { border-bottom: 1px solid var(--line); padding: 10px 12px; }
.sec h3 { margin: 0 0 8px; font-size: 9px; font-weight: 500; letter-spacing: .18em; color: var(--dim); display: flex; justify-content: space-between; }
.sec h3 i { font-style: normal; color: var(--amber); letter-spacing: .08em; }
.big { font-size: 26px; font-weight: 500; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.big small { font-size: 10px; color: var(--dim); letter-spacing: .1em; margin-left: 6px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; }
.kv span { color: var(--dim); }
.kv b { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 8.5px; letter-spacing: .1em; padding: 0 4px; border: 1px solid var(--line2); color: var(--dim); }
.tag.demo { color: var(--amber); border-color: #4a3a1f; }
.tag.ok { color: var(--ok); border-color: #2f4030; }
.tag.off { color: var(--faint); }
.note { color: var(--dim); font-size: 10px; margin-top: 6px; }
.stack { display: flex; height: 6px; margin: 8px 0 6px; background: var(--line); }
.stack i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 10px; }
.legend div { display: flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; display: inline-block; }
.legend b { margin-left: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 10px; }
table.t { table-layout: fixed; }
table.t td, table.t th { overflow: hidden; text-overflow: ellipsis; padding: 3px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; white-space: nowrap; }
table.t th { color: var(--dim); font-size: 8.5px; letter-spacing: .14em; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { color: var(--amber2); }
table.t tr.dimrow td { color: var(--faint); }
.bar { height: 3px; background: var(--line); margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--amber); }
.skill { display: grid; grid-template-columns: 18px 1fr auto; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--line); align-items: start; }
.skill .n { color: var(--faint); }
.skill .nm { letter-spacing: .06em; }
.skill .fx { grid-column: 2 / 4; color: var(--dim); font-size: 10px; }
.skill.on .n, .skill.on .nm { color: var(--amber); }
.skill.next .nm { color: var(--text); }
.skill.next .n { color: var(--text); }
.ops { font-size: 10px; }
.ops div { display: grid; grid-template-columns: 62px 60px 1fr 34px; gap: 6px; padding: 2px 0; align-items: center; cursor: pointer; }
.ops div:hover { color: var(--amber2); }
.ops .g { font-size: 8.5px; letter-spacing: .1em; padding: 0 3px; border: 1px solid var(--line2); text-align: center; }
.ops .pb { height: 3px; background: var(--line); }
.ops .pb i { display: block; height: 100%; background: var(--dim); }
input.search { width: 100%; background: var(--bg); border: 1px solid var(--line2); color: var(--text); font: inherit; padding: 5px 7px; outline: none; }
input.search:focus { border-color: var(--amber); }
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.filters button { font-size: 9px; letter-spacing: .1em; border: 1px solid var(--line2); padding: 1px 5px; color: var(--dim); }
.filters button.on { color: var(--amber); border-color: #4a3a1f; }
.log { font-size: 10px; }
.log div { padding: 2px 0; border-bottom: 1px solid #18191c; display: grid; grid-template-columns: 54px 1fr; gap: 6px; }
.log div.click { cursor: pointer; }
.log div.click:hover { color: var(--amber2); }
.log time { color: var(--faint); }

/* ---------- viewport ---------- */
#viewport { flex: 1; position: relative; overflow: hidden; background: #0b0c0e; min-width: 0; }
#view { position: absolute; inset: 0; overflow: hidden; cursor: crosshair; touch-action: none; }
#view.drag { cursor: grabbing; }
#cv { image-rendering: pixelated; image-rendering: crisp-edges; display: block; will-change: transform; }
#hud-tl { position: absolute; left: 12px; top: 10px; pointer-events: none; background: rgba(13,14,16,.82); border: 1px solid var(--line2); padding: 5px 9px; }
#hud-depth { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
#hud-sub { font-size: 9px; letter-spacing: .14em; color: var(--dim); }
#rail { position: absolute; right: 10px; top: 10px; bottom: 120px; width: 46px; border: 1px solid var(--line2); background: #101114; cursor: pointer; }
#rail canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#rail-lbl { position: absolute; bottom: -16px; right: 0; font-size: 9px; color: var(--dim); white-space: nowrap; }
#cam { position: absolute; right: 64px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
#cam button, .zoom { background: rgba(13,14,16,.88); border: 1px solid var(--line2); padding: 4px 9px; font-size: 9.5px; letter-spacing: .12em; text-align: left; }
#cam button:hover { border-color: var(--amber); color: var(--amber2); }
#cam button.on { border-color: var(--amber); color: var(--amber); }
.zoom { display: flex; align-items: center; justify-content: space-between; padding: 0 !important; }
.zoom button { border: 0 !important; padding: 3px 10px !important; font-size: 13px !important; background: none !important; }
.zoom span { font-variant-numeric: tabular-nums; }
#insp { position: absolute; left: 12px; bottom: 12px; width: 280px; background: rgba(15,16,18,.95); border: 1px solid var(--line2); border-top: 2px solid var(--amber); }
#insp .hd { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); }
#insp .hd b { letter-spacing: .1em; }
#insp .hd span { color: var(--dim); font-size: 9px; letter-spacing: .14em; }
#insp .bd { padding: 8px 10px; }
#insp .acts { display: flex; gap: 4px; padding: 0 10px 9px; }
#insp .acts button { border: 1px solid var(--line2); padding: 2px 7px; font-size: 9px; letter-spacing: .12em; }
#insp .acts button:hover { border-color: var(--amber); color: var(--amber2); }
#insp .task { color: var(--amber2); margin-bottom: 6px; }
#toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 4px; align-items: center; pointer-events: none; }
#toast div { background: rgba(13,14,16,.94); border: 1px solid var(--line2); border-left: 2px solid var(--amber); padding: 5px 10px; font-size: 10.5px; max-width: 520px; animation: tin .25s ease-out; }
#toast div.skill { border-left-color: var(--teal); }
#toast div.disc { border-left-color: #7fd6cf; }
#toast div.layer { border-left-color: var(--copper); }
@keyframes tin { from { opacity: 0; transform: translateY(-4px); } }
#conn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 1px solid var(--bad); color: var(--bad); padding: 8px 14px; letter-spacing: .2em; background: rgba(13,14,16,.94); }

/* ---------- launch panel (right) ---------- */
#launch { width: 290px; flex: none; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
body.lclosed #launch { display: none; }
#l-open { display: none; position: fixed; right: 0; top: calc(var(--top) + 60px); writing-mode: vertical-rl; background: var(--panel); border: 1px solid var(--line2); border-right: 0; padding: 10px 5px; letter-spacing: .2em; font-size: 9.5px; color: var(--amber); z-index: 4; }
body.lclosed #l-open { display: block; }
.lhd { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.lhd b { letter-spacing: .18em; font-size: 10.5px; }
.lhd button { margin-left: auto; color: var(--dim); font-size: 14px; }
#l-body { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.price { display: flex; align-items: baseline; gap: 6px; }
.price span { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.price em { font-style: normal; color: var(--amber); letter-spacing: .12em; }
#l-classes { display: grid; grid-template-columns: 1fr; gap: 4px; }
.cls { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; border: 1px solid var(--line2); padding: 5px 7px; text-align: left; }
.cls:hover { border-color: #4a3a1f; }
.cls.on { border-color: var(--amber); background: #19160f; }
.cls canvas { width: 42px; height: 27px; image-rendering: pixelated; background: #24211d; }
.cls b { display: block; letter-spacing: .1em; font-size: 10px; }
.cls span { color: var(--dim); font-size: 9.5px; line-height: 1.3; display: block; }
.wbtn, .go { width: 100%; padding: 8px; border: 1px solid var(--line2); letter-spacing: .16em; font-size: 10px; margin-bottom: 6px; }
.wbtn:hover { border-color: var(--amber); }
.go { background: var(--amber); color: #15120c; border-color: var(--amber); font-weight: 700; }
.go:disabled { background: transparent; color: var(--faint); border-color: var(--line2); cursor: not-allowed; }
.go:not(:disabled):hover { background: var(--amber2); }
.note.warn { color: #a8a395; border-left: 2px solid #4a3a1f; padding-left: 7px; }
#l-status.err { color: var(--bad); } #l-status.ok { color: var(--ok); }
.alist .note.err { color: var(--bad); line-height: 1.5; } .alist .note code { word-break: break-all; color: var(--fg, #d9d4c7); } .alist .note a { color: var(--amber); }
.alist .ag { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; padding: 5px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 10px; }
.alist .ag:hover b { color: var(--amber2); }
.alist .ag em { font-style: normal; color: var(--dim); }
.alist .ag .r { text-align: right; font-variant-numeric: tabular-nums; }
.alist .ag .sh { grid-column: 1 / 3; height: 2px; background: var(--line); }
.alist .ag .sh i { display: block; height: 100%; background: var(--amber); }
.alist .ag.mine b { color: #9fe08f; }

/* ---------- bottom telemetry ---------- */
#tele { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tele); border-top: 1px solid var(--line); background: var(--panel); display: flex; }
#tele .cell { width: 150px; flex: none; padding: 7px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
#tele .cell span { color: var(--dim); font-size: 8.5px; letter-spacing: .16em; }
#tele .cell b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tele .cell em { font-style: normal; color: var(--dim); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tele .spark { width: 120px; height: 18px; margin-top: 2px; }
#feed { flex: 1; min-width: 0; padding: 4px 12px; font-size: 10px; line-height: 13.5px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#feed div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
#feed div:last-child { color: var(--text); }
#feed time { color: var(--faint); margin-right: 6px; }
.k-layer { color: var(--copper) !important; } .k-skill { color: var(--teal) !important; } .k-disc { color: #7fd6cf !important; }
.k-haz { color: var(--bad) !important; } .k-build { color: var(--amber2) !important; } .k-brain { color: #a8a395 !important; }

@media (max-width: 1100px) { #top .stat:nth-child(n+6):not(:last-of-type) { display: none; } #launch { position: fixed; right: 0; top: var(--top); bottom: var(--tele); z-index: 6; box-shadow: -8px 0 24px rgba(0,0,0,.4); } #tele .cell:nth-child(5), #tele .cell:nth-child(6) { display: none; } .brand .sub { display: none; } #top .stat.wide { display: none; } }
@media (max-width: 760px) {
  :root { --side: 100vw; --tele: 52px; }
  body:not(.collapsed) #viewport { display: none; }
  #tele .cell:nth-child(n+3) { display: none; } #feed { display: none; }
  #top .stat:nth-child(n+5):not(:last-of-type) { display: none; }
  #top .follow { padding: 0 8px; } #top .follow span { display: none; }
  #rail { display: none; } #cam { right: 10px; }
}
