*, *::before, *::after { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #080d12;
  --panel: #0d141b;
  --panel-2: #111b24;
  --line: #20303b;
  --line-soft: #17232c;
  --text: #e7eef2;
  --muted: #7e929e;
  --dim: #52636e;
  --acid: #b8f13a;
  --acid-soft: rgba(184, 241, 58, .12);
  --company: #ffb547;
  --person: #f377a8;
  --product: #61d7e6;
  --vc-firm: #ae8cff;
  --danger: #ff6b6b;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; }
button, input { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(8, 13, 18, .96); }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { position: relative; width: 34px; height: 34px; transform: rotate(30deg); }
.brand-mark i { position: absolute; inset: 4px; border: 1px solid var(--acid); }
.brand-mark i:nth-child(2) { inset: 9px; transform: rotate(45deg); }
.brand-mark i:nth-child(3) { inset: 14px; background: var(--acid); box-shadow: 0 0 13px var(--acid); }
.brand h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: .04em; }
.brand h1 strong { color: var(--acid); font-weight: inherit; }
.brand p { margin: 2px 0 0; color: var(--dim); font: 9px/1.2 var(--font-mono); letter-spacing: .22em; }
.dataset-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 11px var(--font-mono); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 9px var(--acid); }

.workspace { height: calc(100% - 72px); display: grid; grid-template-columns: 300px minmax(320px, 1fr) 324px; }
.sidebar { min-height: 0; background: var(--panel); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.controls { border-right: 1px solid var(--line); }
.insights { border-left: 1px solid var(--line); }
.panel-block { padding: 18px; border-bottom: 1px solid var(--line-soft); }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.section-index { color: var(--acid); font: 9px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.section-heading h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .08em; }

.search-field { height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); background: #091016; transition: border-color .15s; }
.search-field:focus-within { border-color: var(--acid); }
.search-field svg { width: 17px; color: var(--dim); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-field input::placeholder, .path-inputs input::placeholder { color: var(--dim); }
.icon-button { width: 22px; height: 22px; padding: 0; background: transparent; color: var(--dim); font-size: 18px; line-height: 1; }
.icon-button:hover { color: var(--text); }
.microcopy { min-height: 16px; margin-top: 7px; color: var(--dim); font: 10px/1.5 var(--font-mono); }

.type-filters { display: grid; gap: 7px; }
.filter-button { --type-color: var(--text); min-height: 36px; display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line-soft); background: #0a1117; color: var(--muted); text-align: left; transition: border-color .15s, opacity .15s; }
.filter-button:hover { border-color: var(--line); }
.filter-button[aria-pressed="false"] { opacity: .38; }
.filter-button .type-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--type-color); box-shadow: 0 0 8px color-mix(in srgb, var(--type-color) 60%, transparent); }
.filter-button .type-name { flex: 1; font-size: 11px; color: var(--text); }
.filter-button .type-count { color: var(--type-color); font: 10px var(--font-mono); }

.path-inputs { display: grid; grid-template-columns: 1fr 16px 1fr; align-items: end; gap: 5px; }
.path-inputs label span { display: block; margin-bottom: 5px; color: var(--dim); font: 9px var(--font-mono); letter-spacing: .08em; }
.path-inputs input { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line); outline: 0; background: #091016; font: 11px var(--font-mono); }
.path-inputs input:focus { border-color: var(--acid); }
.path-arrow { padding-bottom: 8px; color: var(--acid); text-align: center; }
.primary-button, .secondary-button { width: 100%; height: 38px; margin-top: 10px; border: 1px solid var(--acid); background: var(--acid); color: #11190a; font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.primary-button:hover { background: #ccff54; }
.path-result { margin-top: 10px; padding: 9px; border-left: 2px solid var(--line); background: #091016; color: var(--muted); font: 10px/1.65 var(--font-mono); overflow-wrap: anywhere; }
.path-result[data-bench-path-status="ok"] { border-color: var(--acid); color: var(--text); }
.path-result[data-bench-path-status="invalid"], .path-result[data-bench-path-status="unreachable"] { border-color: var(--danger); }
.path-result[data-bench-path-status="same"] { border-color: var(--company); }
.path-result .path-node { display: inline; color: var(--acid); }
.path-result .path-separator { margin: 0 4px; color: var(--dim); }
.secondary-button { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; border-color: var(--line); background: transparent; color: var(--muted); }
.secondary-button svg { width: 16px; }
.secondary-button:hover { border-color: var(--muted); color: var(--text); }

.graph-shell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #070c10; }
.graph-shell::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .23; background-image: linear-gradient(rgba(126,146,158,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(126,146,158,.08) 1px, transparent 1px); background-size: 32px 32px; }
#graph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; touch-action: none; cursor: grab; }
#graph-canvas.dragging { cursor: grabbing; }
.graph-toolbar { position: absolute; top: 14px; left: 14px; display: flex; border: 1px solid var(--line); background: rgba(13, 20, 27, .9); backdrop-filter: blur(8px); }
.graph-toolbar button { width: 34px; height: 34px; padding: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font: 18px var(--font-mono); }
.graph-toolbar button:last-child { border-right: 0; }
.graph-toolbar button:hover { color: var(--acid); background: var(--acid-soft); }
.graph-toolbar svg { width: 15px; margin: auto; }
.canvas-hint { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 12px; color: var(--dim); font: 9px var(--font-mono); letter-spacing: .05em; }
.canvas-hint span::before { content: "·"; margin-right: 5px; color: var(--acid); }
.viewport-status { position: absolute; top: 17px; right: 16px; color: var(--muted); font: 10px var(--font-mono); }
.loading-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; background: #070c10; transition: opacity .3s, visibility .3s; }
.loading-state.hidden { opacity: 0; visibility: hidden; }
.loading-state strong { font-size: 12px; letter-spacing: .08em; }
.loading-state small { color: var(--dim); font: 10px var(--font-mono); }
.loader { width: 34px; height: 34px; border: 1px solid var(--line); border-top-color: var(--acid); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-block { min-height: 245px; }
.detail-empty { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--dim); text-align: center; }
.detail-empty p { margin: 15px 0 3px; color: var(--muted); font-size: 11px; }
.detail-empty span { font: 9px var(--font-mono); }
.empty-orbit { position: relative; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; }
.empty-orbit::after { content: ""; position: absolute; width: 5px; height: 5px; top: 3px; left: 4px; border-radius: 50%; background: var(--acid); }
.empty-orbit i { position: absolute; width: 6px; height: 6px; top: 15px; left: 15px; border-radius: 50%; background: var(--dim); }
.node-card-head { display: flex; align-items: center; gap: 7px; }
.detail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--detail-color); box-shadow: 0 0 9px var(--detail-color); }
.detail-type { color: var(--detail-color); font: 9px var(--font-mono); text-transform: uppercase; letter-spacing: .1em; }
.detail-name { margin: 10px 0 3px; font-size: 21px; line-height: 1.25; }
.detail-id { color: var(--dim); font-size: 9px; overflow-wrap: anywhere; }
.detail-description { margin: 12px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.detail-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-soft); }
.detail-metric { padding: 8px 5px; border-right: 1px solid var(--line-soft); text-align: center; }
.detail-metric:last-child { border-right: 0; }
.detail-metric strong { display: block; color: var(--text); font: 13px var(--font-mono); }
.detail-metric span { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; }
.detail-aliases { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.alias-chip { padding: 3px 5px; border: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.neighbors-head { display: flex; align-items: center; justify-content: space-between; margin: 15px 0 7px; }
.neighbors-head h4 { margin: 0; font-size: 10px; letter-spacing: .08em; }
.neighbors-count { color: var(--detail-color); font: 9px var(--font-mono); }
.neighbor-list { max-height: 238px; overflow-y: auto; }
.neighbor-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 7px 4px; border-top: 1px solid var(--line-soft); background: transparent; text-align: left; }
.neighbor-row:hover { background: var(--panel-2); }
.neighbor-name { overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.neighbor-relation { color: var(--dim); font: 8px var(--font-mono); }

.list-title { display: flex; justify-content: space-between; margin: 16px 0 8px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.list-title:first-of-type { margin-top: 0; }
.list-title span { color: var(--acid); font-family: var(--font-mono); }
.top-list { counter-reset: ranking; }
.top-row { --row-color: var(--muted); counter-increment: ranking; width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 6px 3px; border-top: 1px solid var(--line-soft); background: transparent; text-align: left; }
.top-row::before { content: counter(ranking, decimal-leading-zero); color: var(--dim); font: 8px var(--font-mono); }
.top-row:hover { background: var(--panel-2); }
.top-name { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.top-degree { color: var(--row-color); font: 10px var(--font-mono); }
.type-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.type-stat { --stat-color: var(--text); padding: 8px; border: 1px solid var(--line-soft); }
.type-stat strong { display: block; color: var(--stat-color); font: 14px var(--font-mono); }
.type-stat span { color: var(--muted); font-size: 9px; }
.relation-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
.relation-stat { min-width: 0; display: flex; justify-content: space-between; gap: 4px; padding: 6px; background: var(--panel); font: 8px var(--font-mono); }
.relation-stat span:first-child { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.relation-stat span:last-child { color: var(--acid); }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 265px minmax(300px, 1fr) 280px; }
}
@media (max-width: 780px) {
  html, body { height: auto; min-height: 100%; overflow: auto; }
  .topbar { position: sticky; top: 0; z-index: 10; height: 62px; padding: 0 14px; }
  .dataset-status { font-size: 9px; }
  .workspace { height: auto; display: flex; flex-direction: column; }
  .graph-shell { order: 1; height: 62vh; min-height: 440px; border-bottom: 1px solid var(--line); }
  .controls { order: 2; border-right: 0; }
  .insights { order: 3; border-left: 0; }
  .sidebar { overflow: visible; }
  .canvas-hint { display: none; }
}
@media (max-width: 460px) {
  .brand p { display: none; }
  .dataset-status { max-width: 45%; text-align: right; }
  .graph-shell { height: 56vh; min-height: 380px; }
}
@media (prefers-reduced-motion: reduce) { .loader { animation: none; } }
