/* ============================================================
 NEURON MAP : arc-HUD skin
 Deep near-black ground, teal signal, amber warn, red critical,
 violet brain layer. Hairlines, glow via layered shadows, mono numerics.
 ============================================================ */

:root {
 color-scheme: dark;
 --bg: #05080b;
 --bg-2: #0a0f14;
 --bg-3: #0f161d;
 --ink: #d7e2e6;
 --ink-2: #8fa3ab;
 --ink-3: #5b6c74;
 --line: rgba(94, 234, 212, 0.14);
 --line-2: rgba(215, 226, 230, 0.08);
 --teal: #5eead4;
 --teal-2: rgba(94, 234, 212, 0.55);
 --teal-3: rgba(94, 234, 212, 0.12);
 --amber: #f5a524;
 --red: #e5484d;
 --violet: #a78bfa;
 --blue: #60a5fa;
 --grey: #6b7280;
 --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
 --mono: "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, "SF Mono", Menlo, monospace;
 --panel: rgba(8, 13, 18, 0.88);
 --panel-edge: rgba(94, 234, 212, 0.18);
 --glow: 0 0 0 1px rgba(94, 234, 212, 0.10), 0 0 18px rgba(94, 234, 212, 0.10), 0 0 48px rgba(94, 234, 212, 0.05);
 --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
 --ease-spring: cubic-bezier(0.34, 1.35, 0.44, 1);
 --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
 --top-h: 56px;
 --rail-w: 300px;
 --detail-w: 400px;
 --r: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
 margin: 0;
 background: var(--bg);
 color: var(--ink);
 font-family: var(--sans);
 font-size: 14px;
 line-height: 1.45;
 overflow: hidden;
 -webkit-font-smoothing: antialiased;
 overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
b, strong { font-weight: 600; }
kbd {
 font-family: var(--mono);
 font-size: 11px;
 color: var(--ink-2);
 border: 1px solid var(--line-2);
 border-bottom-width: 2px;
 border-radius: 4px;
 padding: 1px 5px;
 background: rgba(255,255,255,0.02);
}
::selection { background: rgba(94,234,212,0.28); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
body.preload *, body.preload *::before, body.preload *::after { transition: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(94,234,212,0.25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(94,234,212,0.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: rgba(94,234,212,0.38); }

/* ------------------------------------------------------------
 STAGE / CANVAS
 ------------------------------------------------------------ */
.stage {
 position: fixed; inset: 0;
 background:
 radial-gradient(1200px 800px at 50% 45%, rgba(94,234,212,0.05), transparent 60%),
 radial-gradient(900px 600px at 80% 110%, rgba(167,139,250,0.06), transparent 60%),
 var(--bg);
}
.stage::before {
 /* fine grid, very quiet */
 content: ""; position: absolute; inset: 0; pointer-events: none;
 background-image:
 linear-gradient(rgba(215,226,230,0.025) 1px, transparent 1px),
 linear-gradient(90deg, rgba(215,226,230,0.025) 1px, transparent 1px);
 background-size: 48px 48px;
 mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%);
 -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%);
}
.stage::after {
 /* vignette */
 content: ""; position: absolute; inset: 0; pointer-events: none;
 background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}
#graph {
 position: absolute; inset: 0; width: 100%; height: 100%;
 display: block; touch-action: none; cursor: grab; z-index: 1;
}
#graph.grabbing { cursor: grabbing; }
#graph.pointing { cursor: pointer; }
#graph.crosshair { cursor: crosshair; }

.hud-bl {
 position: absolute; left: calc(var(--rail-w) + 32px); bottom: 14px; z-index: 2;
 display: flex; align-items: center; gap: 10px;
 font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--ink-3);
 text-transform: uppercase; pointer-events: none;
}
.hud-sep { width: 1px; height: 12px; background: var(--line); }
.hud-zoom { color: var(--teal-2); }

.banner {
 position: absolute; left: 50%; top: calc(var(--top-h) + 14px); transform: translateX(-50%) translateY(-6px);
 z-index: 3; pointer-events: none;
 font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
 color: var(--amber); padding: 7px 14px; border-radius: 999px;
 background: rgba(245,165,36,0.06); border: 1px solid rgba(245,165,36,0.35);
 box-shadow: 0 0 20px rgba(245,165,36,0.12);
 opacity: 0; transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-spring);
 white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.banner.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.banner.red { color: var(--red); border-color: rgba(229,72,77,0.45); background: rgba(229,72,77,0.07); box-shadow: 0 0 20px rgba(229,72,77,0.15); }

/* ------------------------------------------------------------
 TOP BAR
 ------------------------------------------------------------ */
.topbar {
 position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 20;
 display: flex; align-items: center; gap: 14px; padding: 0 14px;
 background: linear-gradient(180deg, rgba(5,8,11,0.96), rgba(5,8,11,0.82));
 border-bottom: 1px solid var(--line);
 box-shadow: 0 1px 0 rgba(94,234,212,0.04), 0 8px 30px rgba(0,0,0,0.35);
}
.topbar::after {
 content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
 background: linear-gradient(90deg, transparent, var(--teal-2) 30%, var(--violet) 70%, transparent);
 opacity: 0.55;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand h1 { font-size: 14px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; margin: 0; white-space: nowrap; }
.brand-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; white-space: nowrap; }
.brand-ring {
 width: 18px; height: 18px; border-radius: 50%; position: relative; flex: none;
 border: 1.5px solid var(--teal);
 box-shadow: 0 0 10px rgba(94,234,212,0.55), inset 0 0 6px rgba(94,234,212,0.35);
}
.brand-ring::before {
 content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--teal);
 box-shadow: 0 0 8px var(--teal);
 animation: brand-pulse 2.4s var(--ease-io) infinite;
}
.brand-ring::after {
 content: ""; position: absolute; inset: -5px; border-radius: 50%;
 border: 1px dashed rgba(94,234,212,0.45);
 animation: spin 14s linear infinite;
}
@keyframes brand-pulse { 0%,100% { transform: scale(0.7); opacity: 0.6; } 50% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.stats { display: flex; gap: 14px; align-items: baseline; font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; white-space: nowrap; }
.stats .st b { color: var(--ink); font-weight: 500; font-size: 13px; margin-right: 4px; }
.stats .st.ok b { color: var(--teal); }
.stats .st.warn b { color: var(--amber); }

.seg {
 display: inline-flex; align-items: center; gap: 2px; padding: 3px;
 border: 1px solid var(--line-2); border-radius: 999px; background: rgba(255,255,255,0.02);
}
.seg-label { white-space: nowrap; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 0 10px; }
.seg-btn {
 font-size: 12px; letter-spacing: 0.04em; color: var(--ink-2);
 padding: 5px 11px; border-radius: 999px; position: relative;
 transition: color 0.2s, background 0.25s var(--ease-out), box-shadow 0.25s;
 white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.seg-btn.on { color: #06110f; background: var(--teal); box-shadow: 0 0 14px rgba(94,234,212,0.45); font-weight: 600; }
.xray .seg-btn[data-xray="health"].on { background: var(--teal); }
.xray .seg-btn[data-xray="blast"].on { background: var(--red); color: #fff; box-shadow: 0 0 14px rgba(229,72,77,0.5); }
.xray .seg-btn[data-xray="quadrant"].on { background: var(--blue); color: #06110f; box-shadow: 0 0 14px rgba(96,165,250,0.5); }
.xray .seg-btn[data-xray="kind"].on { background: var(--violet); color: #0b0716; box-shadow: 0 0 14px rgba(167,139,250,0.5); }
.xray .seg-btn[data-xray="memory"].on { background: var(--amber); color: #160e02; box-shadow: 0 0 14px rgba(245,165,36,0.5); }

.modes { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top-actions { margin-left: auto; display: flex; gap: 4px; }
.ico {
 width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center;
 color: var(--ink-2); border: 1px solid transparent;
 transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.25s var(--ease-spring);
}
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico:hover { color: var(--teal); background: var(--teal-3); border-color: var(--line); }
.ico:active { transform: scale(0.92); }
.ico.sm { width: 26px; height: 26px; }
.ico.sm svg { width: 14px; height: 14px; }
.ico.on { color: var(--teal); border-color: var(--line); background: var(--teal-3); }
#btnRail { display: none; }

/* ------------------------------------------------------------
 PANELS (shared)
 ------------------------------------------------------------ */
.rail, .detail, .legend {
 background: var(--panel);
 border: 1px solid var(--panel-edge);
 box-shadow: var(--glow), 0 20px 60px rgba(0,0,0,0.5);
 border-radius: var(--r);
}
.rail::before, .detail::before {
 /* corner bracket accents */
 content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
 background:
 linear-gradient(var(--teal), var(--teal)) top left / 14px 1px no-repeat,
 linear-gradient(var(--teal), var(--teal)) top left / 1px 14px no-repeat,
 linear-gradient(var(--teal), var(--teal)) bottom right / 14px 1px no-repeat,
 linear-gradient(var(--teal), var(--teal)) bottom right / 1px 14px no-repeat;
 opacity: 0.6;
}

/* ------------------------------------------------------------
 RAIL (search + filters)
 ------------------------------------------------------------ */
.rail {
 position: fixed; z-index: 15;
 left: 14px; top: calc(var(--top-h) + 14px); bottom: 14px; width: var(--rail-w);
 display: flex; flex-direction: column;
 transform: translateX(0); opacity: 1;
 transition: transform 0.45s var(--ease-spring), opacity 0.3s;
}
.rail.hidden { transform: translateX(-120%); opacity: 0; pointer-events: none; }
.rail-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--line-2); }
.search {
 display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px; height: 38px;
 border: 1px solid var(--line-2); border-radius: 8px; background: rgba(0,0,0,0.35);
 transition: border-color 0.2s, box-shadow 0.25s;
}
.search:focus-within { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(94,234,212,0.10), 0 0 18px rgba(94,234,212,0.12); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13px; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.count { margin-top: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }
.count b { color: var(--teal); font-weight: 500; }

.results { flex: none; max-height: 0; overflow: hidden auto; transition: max-height 0.35s var(--ease-out); border-bottom: 0 solid var(--line-2); }
.results.on { max-height: 38vh; border-bottom-width: 1px; }
.res {
 display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center;
 width: 100%; text-align: left; padding: 8px 12px; border-left: 2px solid transparent;
 transition: background 0.15s, border-color 0.15s;
}
.res:hover, .res.active { background: rgba(94,234,212,0.06); border-left-color: var(--teal); }
.res .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; background: currentColor; }
.res .t { min-width: 0; }
.res .t b { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .t small { display: block; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.res mark { background: none; color: var(--teal); font-weight: 600; }

.rail-body { flex: 1; overflow: auto; padding: 6px 12px 14px; }
.fs { padding: 10px 0 4px; border-bottom: 1px solid var(--line-2); }
.fs:last-child { border-bottom: 0; }
.fs-head {
 display: flex; align-items: center; justify-content: space-between; width: 100%;
 font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
 padding: 4px 0 8px;
}
.fs-head .act { font-size: 10px; letter-spacing: 0.06em; color: var(--teal-2); text-transform: lowercase; }
.fs-head .act:hover { color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.chip {
 display: inline-flex; align-items: center; gap: 7px;
 font-size: 12px; padding: 4px 10px 4px 8px; border-radius: 999px;
 border: 1px solid var(--line-2); color: var(--ink-2); background: rgba(255,255,255,0.015);
 transition: all 0.2s var(--ease-out); position: relative; white-space: nowrap;
}
.chip .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--teal)); box-shadow: 0 0 8px var(--c, var(--teal)); transition: opacity 0.2s, transform 0.25s var(--ease-spring); }
.chip .n { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.chip:hover { color: var(--ink); border-color: rgba(215,226,230,0.2); }
.chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--c, var(--teal)) 55%, transparent); background: color-mix(in srgb, var(--c, var(--teal)) 10%, transparent); }
.chip:not(.on) .sw { opacity: 0.25; transform: scale(0.7); box-shadow: none; }
.chip:not(.on) { opacity: 0.7; text-decoration: line-through; text-decoration-color: rgba(215,226,230,0.35); }
.chip.sq .sw { border-radius: 2px; }

/* The close button lives in the head row beside the search, not floated over it.
   Absolutely positioning it at top-right dropped it straight onto the search box. */
.rail-row { display: flex; align-items: center; gap: 8px; }
.rail-row .search { flex: 1; min-width: 0; }
.rail-close { position: static; flex: none; display: inline-grid; }

/* ------------------------------------------------------------
 DETAIL PANEL
 ------------------------------------------------------------ */
.detail {
 position: fixed; z-index: 16;
 right: 14px; top: calc(var(--top-h) + 14px); bottom: 14px; width: var(--detail-w);
 transform: translateX(calc(100% + 30px)); opacity: 0;
 transition: transform 0.5s var(--ease-spring), opacity 0.3s;
 display: flex; flex-direction: column;
}
.detail.on { transform: translateX(0); opacity: 1; }
.detail-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.detail-body { flex: 1; overflow: auto; padding: 18px 18px 24px; }

.d-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; padding-right: 36px; }
.d-type { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.d-status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.d-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.d-status.online { color: var(--teal); }
.d-status.online .dot { animation: brand-pulse 2s var(--ease-io) infinite; }
.d-status.stopped { color: var(--red); }
.d-status.external { color: var(--ink-2); }
.d-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; line-height: 1.15; padding-right: 30px; }
.d-group { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); margin-bottom: 14px; }
.d-group .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.d-what { font-size: 14.5px; line-height: 1.55; color: var(--ink); margin: 0 0 14px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.fact { background: rgba(5,8,11,0.6); padding: 8px 10px; min-width: 0; }
.fact.wide { grid-column: 1 / -1; }
.fact small { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.fact span { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact span.dim { color: var(--ink-3); }
.fact span.mem { color: var(--amber); }
.qchip {
 display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
 padding: 3px 9px 3px 7px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
 background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c);
}
.qchip i { width: 16px; height: 16px; border-radius: 4px; background: var(--c); color: #06110f; font-style: normal; font-weight: 700; display: grid; place-items: center; font-size: 10px; }

.kills {
 position: relative; margin: 0 0 14px; padding: 10px 12px 10px 14px; border-radius: 8px;
 background: rgba(229,72,77,0.07); border: 1px solid rgba(229,72,77,0.35);
 box-shadow: inset 0 0 30px rgba(229,72,77,0.05), 0 0 20px rgba(229,72,77,0.08);
}
.kills::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); border-radius: 2px; }
.kills small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--red); margin-bottom: 4px; }
.kills p { margin: 0; font-size: 13.5px; }

.d-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.btn {
 display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px;
 border: 1px solid var(--line); color: var(--teal); font-size: 12.5px; letter-spacing: 0.02em;
 background: var(--teal-3); transition: all 0.2s var(--ease-out);
}
.btn:hover { background: rgba(94,234,212,0.2); box-shadow: 0 0 16px rgba(94,234,212,0.2); }
.btn.red { color: var(--red); border-color: rgba(229,72,77,0.4); background: rgba(229,72,77,0.08); }
.btn.red:hover { background: rgba(229,72,77,0.18); box-shadow: 0 0 16px rgba(229,72,77,0.25); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.d-sec { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.d-sec > summary, .d-sec-h {
 font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
 cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none;
}
.d-sec > summary::-webkit-details-marker { display: none; }
.d-sec > summary::before { content: ""; width: 5px; height: 5px; border-right: 1px solid var(--ink-3); border-bottom: 1px solid var(--ink-3); transform: rotate(-45deg); transition: transform 0.25s var(--ease-out); }
.d-sec[open] > summary::before { transform: rotate(45deg); }
.d-sec > summary:hover { color: var(--ink-2); }
.d-sec .n { font-size: 10px; color: var(--teal-2); }
.d-deep { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin: 10px 0 0; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stack span { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--ink-2); background: rgba(255,255,255,0.02); }
.hl { margin: 10px 0 0; padding: 0; list-style: none; }
.hl li { position: relative; padding-left: 16px; margin: 6px 0; font-size: 13px; color: var(--ink-2); }
.hl li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 1px; background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.cwd { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 10px; word-break: break-all; }

.links { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.link {
 display: grid; grid-template-columns: 8px auto 1fr auto; align-items: center; gap: 10px; width: 100%; text-align: left;
 padding: 7px 8px; border-radius: 7px; border: 1px solid transparent;
 transition: background 0.15s, border-color 0.15s;
}
.link:hover { background: rgba(94,234,212,0.05); border-color: var(--line-2); }
.link .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.link .kind { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--k); min-width: 62px; }
.link .kind::before { content: attr(data-dir); margin-right: 4px; color: var(--ink-3); }
.link .lbl { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link .el { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

/* commands explorer */
.cmds { margin-top: 10px; }
.cmds-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.cmds-tools .search { flex: 1; height: 34px; }
.cmds-tools .act { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--teal-2); white-space: nowrap; }
.cmds-tools .act:hover { color: var(--teal); }
.cg { border: 1px solid var(--line-2); border-radius: 8px; margin-bottom: 6px; overflow: hidden; background: rgba(0,0,0,0.25); }
.cg > summary {
 list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; user-select: none;
 font-size: 12.5px; color: var(--ink);
 transition: background 0.15s;
}
.cg > summary::-webkit-details-marker { display: none; }
.cg > summary:hover { background: rgba(94,234,212,0.05); }
.cg > summary .cn { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.cg > summary .sw { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 8px var(--violet); transition: transform 0.25s var(--ease-spring); }
.cg[open] > summary .sw { transform: scale(1.4); }
.cg[open] > summary { border-bottom: 1px solid var(--line-2); }
.cmd {
 display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 10px; align-items: baseline;
 width: 100%; text-align: left; padding: 7px 10px; border-top: 1px solid rgba(255,255,255,0.03);
 transition: background 0.15s;
}
.cmd:first-of-type { border-top: 0; }
.cmd:hover { background: rgba(167,139,250,0.07); }
.cmd code { font-family: var(--mono); font-size: 12px; color: var(--violet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd.long { grid-template-columns: 1fr; gap: 3px; }
.cmd.long code { white-space: normal; overflow: visible; line-height: 1.35; }
.cmd.long span { font-size: 12px; color: var(--ink-3); }
.cmd.long.copied::after { grid-column: 1; }
.cmd span { font-size: 12.5px; color: var(--ink-2); }
.cmd mark { background: none; color: var(--teal); font-weight: 600; }
.cmd.copied code { color: var(--teal); }
.cmd.copied::after { content: "copied"; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); grid-column: 2; justify-self: end; }
.cmds-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* ------------------------------------------------------------
 LEGEND
 ------------------------------------------------------------ */
.legend {
 position: fixed; z-index: 14; left: calc(var(--rail-w) + 32px); bottom: 44px; width: 300px; max-height: calc(100vh - var(--top-h) - 80px);
 display: flex; flex-direction: column;
 animation: rise 0.45s var(--ease-spring);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.legend-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line-2); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.legend-body { overflow: auto; padding: 10px 14px 14px; }
.lg-h { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin: 10px 0 6px; }
.lg-h:first-child { margin-top: 0; }
.lg-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--ink-2); margin: 4px 0; }
.lg-row .k { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-left: auto; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.lg-dot.hollow { background: transparent; border: 1.5px solid var(--c); box-shadow: none; }
.lg-dot.dashed { background: transparent; border: 1.5px dashed var(--c); box-shadow: none; }
.lg-dot.big { width: 16px; height: 16px; }
.lg-dot.small { width: 6px; height: 6px; }
.lg-line { width: 26px; height: 0; border-top: 1.5px solid var(--c); flex: none; position: relative; }
.lg-line::after { content: ""; position: absolute; left: 60%; top: -3px; width: 5px; height: 5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }

/* ------------------------------------------------------------
 OVERLAY (shortcuts)
 ------------------------------------------------------------ */
.overlay {
 position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
 background: rgba(3,5,8,0.7);
 animation: fade 0.25s var(--ease-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
 width: min(460px, 100%); background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 12px;
 box-shadow: var(--glow), 0 30px 80px rgba(0,0,0,0.6);
 animation: rise 0.4s var(--ease-spring);
}
.overlay-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px 18px; border-bottom: 1px solid var(--line-2); font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; padding: 16px 18px 18px; align-items: center; }
.keys dt { display: flex; gap: 4px; }
.keys dd { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ------------------------------------------------------------
 TOOLTIP
 ------------------------------------------------------------ */
.tooltip {
 position: fixed; z-index: 30; pointer-events: none; max-width: 280px;
 background: rgba(8,13,18,0.94); border: 1px solid var(--panel-edge); border-radius: 8px;
 box-shadow: var(--glow), 0 10px 30px rgba(0,0,0,0.5);
 padding: 8px 10px; font-size: 12px; color: var(--ink-2);
 animation: tip 0.18s var(--ease-out);
}
@keyframes tip { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tooltip .tt-h { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tooltip .tt-h b { color: var(--ink); font-weight: 600; font-size: 13px; }
.tooltip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.tooltip .tt-m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.tooltip .tt-m b { color: var(--teal); font-weight: 500; }
.tooltip .tt-m b.off { color: var(--red); }
.tooltip p { margin: 4px 0 0; line-height: 1.4; }
.tooltip .tt-k { margin-top: 5px; font-family: var(--mono); font-size: 10px; color: var(--red); letter-spacing: 0.06em; }

/* ------------------------------------------------------------
 BOOT
 ------------------------------------------------------------ */
.boot {
 position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
 background: radial-gradient(800px 600px at 50% 50%, rgba(94,234,212,0.06), transparent 60%), var(--bg);
 cursor: pointer; transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}
.boot.out { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-ring { position: relative; width: 240px; height: 240px; }
.boot-ring svg { width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.boot-ring circle { fill: none; }
.r-track { stroke: rgba(94,234,212,0.10); stroke-width: 1; }
.r-draw {
 stroke: url(#bg1); stroke-width: 2; stroke-linecap: round;
 stroke-dasharray: 653.5; stroke-dashoffset: 653.5;
 filter: drop-shadow(0 0 6px rgba(94,234,212,0.7));
 animation: draw 1.4s var(--ease-out) forwards;
}
.r-ticks { stroke: rgba(94,234,212,0.45); stroke-width: 6; stroke-dasharray: 1 13.45; opacity: 0; animation: fade-in 0.6s 0.5s forwards; }
.r-inner { stroke: rgba(167,139,250,0.35); stroke-width: 1; stroke-dasharray: 60 420; animation: spin-c 6s linear infinite; transform-origin: 120px 120px; }
.r-arc { stroke-width: 1.5; stroke-linecap: round; transform-origin: 120px 120px; opacity: 0; animation: fade-in 0.5s 0.3s forwards, spin-c 9s linear infinite; }
.r-arc.a1 { stroke: rgba(94,234,212,0.7); stroke-dasharray: 90 438; }
.r-arc.a2 { stroke: rgba(245,165,36,0.55); stroke-dasharray: 40 664; animation-direction: normal, reverse; animation-duration: 0.5s, 13s; }
.r-core { fill: var(--teal); stroke: none; filter: drop-shadow(0 0 8px var(--teal)); animation: brand-pulse 1.2s var(--ease-io) infinite; transform-origin: 120px 120px; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes spin-c { to { transform: rotate(360deg); } }
.boot-core { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; animation: fade-in 0.8s 0.4s both; }
.boot-title { font-size: 20px; font-weight: 600; letter-spacing: 0.34em; margin-left: 0.34em; }
.boot-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--teal-2); margin-top: 4px; }
.boot-counters { display: grid; grid-template-columns: repeat(6, auto); gap: 8px 28px; animation: fade-in 0.6s 0.35s both; }
.bc { text-align: center; }
.bc b { display: block; font-family: var(--mono); font-size: 26px; font-weight: 500; color: var(--teal); text-shadow: 0 0 18px rgba(94,234,212,0.45); font-variant-numeric: tabular-nums; }
.bc span { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.boot-hint { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); animation: fade-in 1s 1s both; }

/* ------------------------------------------------------------
 RESPONSIVE
 ------------------------------------------------------------ */
@media (max-width: 1640px) {
 .brand-sub { display: none; }
 .stats { gap: 10px; }
 .topbar { gap: 10px; }
}
@media (max-width: 1180px) {
 .stats .st:nth-child(n+4) { display: none; }
 :root { --detail-w: 360px; --rail-w: 270px; }
}
@media (max-width: 900px) {
 :root { --top-h: 96px; }
 .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; align-content: center; }
 .brand { order: 1; }
 .top-actions { order: 2; margin-left: auto; }
 .stats { display: none; }
 .modes { order: 3; width: 100%; overflow-x: auto; gap: 8px; scrollbar-width: none; padding-bottom: 2px; }
 .modes::-webkit-scrollbar { display: none; }
 .seg { flex: none; }
 #btnRail { display: inline-grid; }
 .rail { width: min(340px, calc(100vw - 28px)); }
 .rail.hidden { transform: translateX(-120%); }
 .rail-close { display: inline-grid; }
 /* Portrait split. The sheet used to take 68vh and leave a useless strip of graph,
     so you could read about a star but never watch its paths light up. It is now a
     resizable half: drag the grip, or tap it to cycle peek / half / tall. The graph
     keeps the rest and re-centres the selected node into it. */
 .detail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto;
   height: var(--sheet-h, 48vh); max-height: calc(100vh - var(--top-h) - 16px);
   transform: translateY(calc(100% + 30px)); }
 .detail.on { transform: translateY(0); }
 .sheet-grip { display: flex; }
 .detail.on { transform: translateY(0); }
 .legend { left: 8px; right: 8px; width: auto; bottom: 40px; max-height: 60vh; }
 .hud-bl { left: 10px; bottom: 10px; }
 .banner { top: calc(var(--top-h) + 8px); }
}
@media (max-width: 520px) {
 .brand-sub { display: none; }
 .brand h1 { font-size: 13px; letter-spacing: 0.12em; }
 .ico { width: 30px; height: 30px; }
 .seg-btn { padding: 5px 9px; font-size: 11.5px; }
 .seg-label { display: none; }
 .boot-counters { grid-template-columns: repeat(3, auto); gap: 10px 22px; }
 .bc b { font-size: 20px; }
 .boot-ring { width: 180px; height: 180px; }
 .facts { grid-template-columns: 1fr 1fr; }
 .detail-body { padding: 16px 14px 20px; }
 .d-title { font-size: 19px; }
 .cmd { grid-template-columns: 1fr; gap: 2px; }
}

/* ------------------------------------------------------------
 REDUCED MOTION
 ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; }
 .boot { display: none; }
}


/* ---- rail tab -------------------------------------------------------------
   The filters used to sit open and eat 300px of the stage. The map is the point,
   so the rail now starts out of the way behind a handle on the left edge. */
.railtab{position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:54;
  display:flex;flex-direction:column;align-items:center;gap:9px;
  padding:16px 9px;border:1px solid var(--line-2);border-left:0;
  border-radius:0 12px 12px 0;background:rgba(8,12,18,.88);backdrop-filter:blur(10px);
  color:#8ea0b5;cursor:pointer;box-shadow:6px 0 22px rgba(0,0,0,.45);
  transition:color .2s ease,background .2s ease,padding-right .2s ease}
.railtab:hover{color:#5eead4;background:rgba(94,234,212,.10);padding-right:13px}
.railtab:focus-visible{outline:2px solid #5eead4;outline-offset:2px}
.railtab-txt{writing-mode:vertical-rl;text-orientation:mixed;
  font:600 9.5px/1 "JetBrains Mono",ui-monospace,monospace;letter-spacing:.22em}
.railtab-bars{width:13px;height:9px;flex:none;
  border-top:1.5px solid currentColor;border-bottom:1.5px solid currentColor;
  position:relative}
.railtab-bars::after{content:"";position:absolute;left:0;right:0;top:50%;
  height:1.5px;background:currentColor;transform:translateY(-50%)}
.railtab[hidden]{display:none!important}
@media (max-width:900px){.railtab{padding:12px 7px}.railtab-txt{font-size:8.5px}}
@media (prefers-reduced-motion:reduce){.railtab{transition:none}}

/* ---- the sheet grip (portrait only) --------------------------------------- */
.sheet-grip{display:none;align-items:center;justify-content:center;gap:0;
  height:22px;flex:none;cursor:ns-resize;touch-action:none;position:relative;
  border-radius:16px 16px 0 0}
.sheet-grip::before{content:"";width:42px;height:4px;border-radius:99px;
  background:var(--line-2);transition:background .2s ease}
.sheet-grip:hover::before,.sheet-grip:active::before{background:var(--teal-2)}
.sheet-grip:focus-visible{outline:2px solid #5eead4;outline-offset:-2px}
@media (prefers-reduced-motion:reduce){.sheet-grip::before{transition:none}}

/* Must come after the base .sheet-grip rule above, which defaults it to none.
   The earlier copy inside the 900px block was being overridden by source order. */
@media (max-width: 900px){ .sheet-grip{ display:flex } }

/* Portrait: the sheet is opaque. It shares the screen with the map now rather than
   floating over it, and a translucent panel let node labels bleed up through the
   text, which read as a rendering fault rather than as depth. */
@media (max-width: 900px){
  .detail{
    background:#080c12;
    backdrop-filter:none;
    box-shadow:0 -14px 40px rgba(0,0,0,.72);
    border-color:rgba(94,234,212,.20);
  }
}

/* ---- landscape split ---------------------------------------------------------
   On a wide screen a bottom sheet is the wrong axis: it steals the short dimension
   and leaves a letterbox of map. Unfolded and turned sideways the panel becomes a
   right hand half instead, so the galaxy keeps the left. Keyed on orientation, not
   width, because the same device is portrait one second and landscape the next. */
@media (orientation: landscape) and (max-width: 1200px){
  .detail{
    left:auto; right:8px;
    top:calc(var(--top-h) + 8px); bottom:8px;
    width:min(46vw, 560px); height:auto; max-height:none;
    transform:translateX(calc(100% + 30px));
    background:#080c12; backdrop-filter:none;
    box-shadow:-14px 0 40px rgba(0,0,0,.72);
    border-color:rgba(94,234,212,.20);
  }
  .detail.on{ transform:translateX(0) }
  .sheet-grip{ display:none }   /* nothing to resize on this axis */
}

/* ---- x-ray explainer ---------------------------------------------------------
   Bottom left, clear of the toolbar, the filters handle, the zoom readout and the
   detail panel on either axis. Opaque rather than translucent, because a see
   through card over a starfield reads as a fault. pointer-events:none so it can
   never intercept a drag meant for the galaxy. */
.xraynote{
  position:fixed; left:14px; bottom:46px; z-index:52;
  width:min(268px, calc(100vw - 28px));
  padding:11px 13px 12px; border-radius:12px;
  background:#080c12; border:1px solid rgba(94,234,212,.20);
  box-shadow:0 10px 30px rgba(0,0,0,.6);
  pointer-events:none;
  opacity:0; transform:translateX(-10px);
  transition:opacity .32s var(--ease-out), transform .32s var(--ease-out);
}
.xraynote.on{ opacity:1; transform:none }
.xraynote h4{
  margin:0 0 5px; font:600 10px/1 "JetBrains Mono",ui-monospace,monospace;
  letter-spacing:.18em; text-transform:uppercase; color:var(--teal);
}
.xraynote p{ margin:0 0 9px; font-size:12px; line-height:1.45; color:var(--ink-3) }
.xraynote ul{ margin:0; padding:0; list-style:none; display:grid; gap:5px }
.xraynote li{ display:flex; align-items:center; gap:8px; font-size:11.5px; color:#c3d2df }
.xraynote li i{ width:9px; height:9px; border-radius:50%; flex:none; box-shadow:0 0 7px currentColor }

/* Landscape: the detail column owns the right, so the note stays left and shrinks. */
@media (orientation:landscape) and (max-width:1200px){
  .xraynote{ width:min(232px, 34vw); bottom:14px; font-size:11px }
}
/* Portrait: the sheet owns the bottom, so sit the note just above the graph edge. */
@media (orientation:portrait) and (max-width:900px){
  .xraynote{ left:8px; right:8px; width:auto; bottom:auto; top:calc(var(--top-h) + 8px) }
  .xraynote ul{ grid-auto-flow:column; grid-auto-columns:max-content; gap:12px; overflow:hidden }
}
@media (prefers-reduced-motion:reduce){ .xraynote{ transition:none } }

/* ---- active search chip ------------------------------------------------------
   Sits under the toolbar, centred, so it is impossible to miss that a filter is
   still narrowing the galaxy after the rail has closed. Only the X takes clicks;
   the chip body is inert so a drag aimed at the map is not swallowed. */
.querychip{
  position:fixed; left:50%; top:calc(var(--top-h) + 10px); z-index:56;
  transform:translate(-50%, -8px);
  display:flex; align-items:center; gap:9px;
  max-width:min(520px, calc(100vw - 32px));
  padding:6px 6px 6px 12px; border-radius:999px;
  background:#080c12; border:1px solid rgba(94,234,212,.28);
  box-shadow:0 8px 26px rgba(0,0,0,.6);
  opacity:0; pointer-events:none;
  transition:opacity .28s var(--ease-out), transform .28s var(--ease-out);
}
.querychip.on{ opacity:1; transform:translate(-50%, 0) }
.querychip svg{ width:14px; height:14px; flex:none; fill:none; stroke:var(--teal);
  stroke-width:1.9; stroke-linecap:round }
.querychip b{ font-weight:600; font-size:12.5px; color:var(--ink);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.querychip .qc-n{ font:500 10px/1 "JetBrains Mono",ui-monospace,monospace;
  letter-spacing:.1em; color:var(--ink-3); flex:none }
.querychip button{
  pointer-events:auto; flex:none; width:26px; height:26px; display:grid; place-items:center;
  border:0; border-radius:50%; cursor:pointer; background:rgba(255,255,255,.06); color:#9fb0c4;
  transition:background .2s ease, color .2s ease;
}
.querychip button svg{ width:13px; height:13px; stroke:currentColor }
.querychip button:hover{ background:rgba(229,72,77,.20); color:#ff9ea1 }
.querychip button:focus-visible{ outline:2px solid #5eead4; outline-offset:2px }

/* Portrait puts the x-ray note at the top too, so step it down out of the way. */
@media (orientation:portrait) and (max-width:900px){
  body.has-query .xraynote{ top:calc(var(--top-h) + 52px) }
  .querychip{ max-width:calc(100vw - 20px) }
}
@media (prefers-reduced-motion:reduce){ .querychip{ transition:none } }

/* A picked result gets the teal treatment: it names a thing, not a fragment. */
.querychip.picked b{ color:var(--teal) }
.querychip.picked svg{ stroke:var(--teal) }

/* ---- toolbar hierarchy -------------------------------------------------------
   Three groups sat at identical weight, so the eye had no idea which mattered.
   Neuron / Galaxy / Tree are the whole show: they get size, contrast and a rail
   of their own. The x-ray modes are a lens you reach for afterwards, so they
   recede. "All paths" is a modifier rather than a view and now stands apart. */
.topbar-tools{ gap:18px }

.seg-primary{
  padding:4px; border-radius:999px;
  border:1px solid rgba(94,234,212,.30);
  background:linear-gradient(180deg,rgba(94,234,212,.10),rgba(94,234,212,.03));
  box-shadow:0 0 0 1px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.45);
}
.seg-primary .seg-btn{
  font-size:13px; font-weight:600; letter-spacing:.005em; padding:8px 17px;
  color:#c7d7e6;
}
.seg-primary .seg-btn:hover{ color:#fff; background:rgba(94,234,212,.12) }
.seg-primary .seg-btn.on{
  color:#04120f; background:var(--teal);
  box-shadow:0 0 20px rgba(94,234,212,.55), 0 1px 0 rgba(255,255,255,.35) inset;
}

/* The modifier: related to the views, clearly not one of them. */
.seg-btn.solo{
  border:1px dashed rgba(94,234,212,.32); border-radius:999px;
  padding:7px 14px; font-size:11.5px; color:#8ea0b5; background:transparent;
}
.seg-btn.solo:hover{ color:var(--teal); background:rgba(94,234,212,.08) }
.seg-btn.solo.on{ color:#04120f; background:var(--teal); border-style:solid }
.seg-btn.solo[hidden]{ display:none !important }

/* The lens, deliberately quieter than the view switch. */
.seg.xray{ opacity:.86; transform:scale(.95); transform-origin:left center }
.seg.xray:hover, .seg.xray:focus-within{ opacity:1 }
.seg.xray .seg-btn{ font-size:11.5px }

/* A hairline between the two families so they read as separate decisions. */
.seg.xray::before{
  content:""; width:1px; align-self:stretch; margin:6px 14px 6px 0;
  background:linear-gradient(180deg,transparent,var(--line-2),transparent);
}
@media (max-width:900px){
  .seg-primary .seg-btn{ font-size:12px; padding:7px 13px }
  .seg.xray::before{ display:none }
  .seg.xray{ transform:none }
}
