:root {
  --bg-0: #0a0e27;
  --bg-1: #1a1f3a;
  --bg-2: #232850;
  --gold: #ffd166;
  --purple: #b794f4;
  --green: #4ade80;
  --red: #ef4444;
  --gray: #6b7280;
  --text: #e6e8f0;
  --text-dim: #9aa1b8;
  --line: rgba(183, 148, 244, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: radial-gradient(ellipse at top, var(--bg-1) 0%, var(--bg-0) 60%, #04060f 100%);
  color: var(--text);
  font-family: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Source Han Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.7  0 0 0 0 0.6  0 0 0 0 0.95  0 0 0 0.04 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  opacity: 0.5; pointer-events: none; z-index: 0; mix-blend-mode: screen;
}

.grid-overlay {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(183,148,244,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(183,148,244,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none; z-index: 0;
}

.cursor-glow {
  position: fixed; width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(183,148,244,0.18), transparent 70%);
  pointer-events: none; z-index: 1;
  transform: translate(-50%,-50%);
  transition: opacity .3s;
}

/* Hero */
.hero {
  position: relative; z-index: 2;
  padding: 70px 60px 36px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(183,148,244,0.06), transparent);
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.3em;
  color: var(--purple); margin-bottom: 14px;
}
.hero-title {
  font-size: 96px; font-weight: 900;
  background: linear-gradient(135deg, #fff 0%, var(--gold) 50%, var(--purple) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.02em;
  filter: drop-shadow(0 0 24px rgba(255,209,102,0.18));
}
.hero-sub {
  font-size: 18px; color: var(--text-dim);
  margin-top: 6px; letter-spacing: 0.15em;
}
.hero-meta {
  margin-top: 20px;
  display: flex; gap: 12px; align-items: center;
  font-size: 13px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.hero-meta .dot { color: var(--purple); }

/* Main layout */
.main {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  padding: 32px 40px;
  min-height: 75vh;
}
.graph-wrap {
  position: relative;
  background: rgba(10,14,39,0.4);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  height: 78vh;
  min-height: 640px;
}
#graph { width: 100%; height: 100%; display: block; cursor: grab; }
#graph:active { cursor: grabbing; }

.legend {
  position: absolute; top: 18px; left: 18px;
  background: rgba(10,14,39,0.7);
  backdrop-filter: blur(10px);
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 12px; color: var(--text-dim);
  z-index: 5;
}
.legend-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.lg-line { display: inline-block; width: 28px; height: 2px; }
.lg-line.owner { background: var(--gold); height: 3px; }
.lg-line.bot-peer { background: linear-gradient(90deg, var(--purple) 50%, transparent 50%); background-size: 8px 2px; }
.lg-line.threat { background: var(--red); }
.lg-line.human-peer { background: var(--gray); height: 1px; }

.hint {
  position: absolute; bottom: 14px; right: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-dim);
  background: rgba(10,14,39,0.6);
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--line);
}

/* Panel */
.panel {
  background: rgba(20,26,55,0.55);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  position: relative;
  height: 78vh;
  min-height: 640px;
  overflow-y: auto;
}
.panel-empty[hidden] { display: none !important; }
.panel-content[hidden] { display: none !important; }
.panel-empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.6; }
.empty-text { font-size: 14px; letter-spacing: 0.1em; }

.panel-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  color: var(--text); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.panel-close:hover { background: var(--red); border-color: var(--red); }

.panel-portrait-wrap {
  position: relative; width: 168px; height: 168px;
  margin: 8px auto 16px;
}
.panel-portrait-wrap img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--gold);
  filter: drop-shadow(0 0 24px rgba(255,209,102,0.35));
}
.panel.bot .panel-portrait-wrap img {
  border-color: var(--purple);
  filter: drop-shadow(0 0 24px rgba(183,148,244,0.4));
}
.panel-kind {
  position: absolute; bottom: -4px; left: 50%;
  transform: translateX(-50%);
  background: var(--gold); color: #0a0e27;
  font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 12px;
  letter-spacing: 0.15em;
  font-family: 'JetBrains Mono', monospace;
}
.panel.bot .panel-kind { background: var(--purple); }

.panel-name {
  text-align: center; font-size: 32px; font-weight: 800;
  letter-spacing: 0.04em;
}
.panel-alias {
  text-align: center; font-size: 13px;
  color: var(--text-dim); margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.panel-role {
  text-align: center; font-size: 14px;
  color: var(--gold); margin-top: 10px; letter-spacing: 0.05em;
}
.panel.bot .panel-role { color: var(--purple); }

.panel-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center; margin-top: 14px;
}
.tag-chip {
  font-size: 11px; padding: 4px 10px;
  background: rgba(183,148,244,0.12);
  border: 1px solid var(--line);
  border-radius: 12px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.panel-section { margin-top: 22px; }
.section-title {
  font-size: 11px; letter-spacing: 0.3em;
  color: var(--purple); margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.panel-bio {
  font-size: 14px; line-height: 1.7;
  color: var(--text);
}
.panel-quotes { display: flex; flex-direction: column; gap: 8px; }
.quote-card {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,209,102,0.06), rgba(183,148,244,0.06));
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  font-size: 14px; font-style: italic;
  color: var(--text);
}
.panel.bot .quote-card { border-left-color: var(--purple); }

.panel-rels { display: flex; flex-direction: column; gap: 6px; }
.rel-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.rel-item:hover {
  background: rgba(183,148,244,0.12);
  transform: translateX(4px);
}
.rel-name { font-weight: 600; }
.rel-tag {
  font-size: 10px; padding: 2px 8px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.rel-tag.owner { background: rgba(255,209,102,0.2); color: var(--gold); }
.rel-tag.bot-peer { background: rgba(183,148,244,0.2); color: var(--purple); }
.rel-tag.threat { background: rgba(239,68,68,0.2); color: var(--red); }
.rel-tag.human-peer { background: rgba(107,114,128,0.2); color: var(--gray); }
.rel-tag.spouse { background: rgba(236,72,153,0.2); color: #ec4899; }
.rel-tag.sibling { background: rgba(20,184,166,0.2); color: #14b8a6; }
.rel-tag.hosts { background: rgba(183,148,244,0.18); color: var(--purple); }

/* Graph nodes/links */
.node-circle { transition: stroke-width .2s; }
.node-label {
  font-size: 12px; font-weight: 700;
  fill: var(--text); text-anchor: middle;
  pointer-events: none;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
}
.link {
  fill: none;
  transition: opacity .25s;
}
.link.owner { stroke: var(--gold); stroke-width: 2.5; }
.link.bot-peer { stroke: var(--purple); stroke-width: 1.5; stroke-dasharray: 6 4; }
.link.threat { stroke: var(--red); stroke-width: 1.8; }
.link.human-peer { stroke: var(--gray); stroke-width: 1; opacity: 0.12; }
.link.human-peer.highlight { opacity: 0.85; }
.link.spouse { stroke: #ec4899; stroke-width: 2.5; opacity: 0.9; }
.link.sibling { stroke: #14b8a6; stroke-width: 2.2; opacity: 0.85; }
.link.hosts { stroke: #b794f4; stroke-width: 1.5; stroke-dasharray: 2 6; opacity: 0.6; }
.dimmed { opacity: 0.08 !important; }
.highlight { opacity: 1 !important; }

/* Footer */
.footer {
  position: relative; z-index: 2;
  padding: 50px 60px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.lyrics-wrap {
  height: 36px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}
.lyrics-line {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  font-size: 16px;
  background: linear-gradient(90deg, var(--gold), var(--purple));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.1em;
  opacity: 0;
  white-space: nowrap;
}
.lyrics-line.active { opacity: 1; }
.footer-meta {
  font-size: 12px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
}

@media (max-width: 1100px) {
  .main { grid-template-columns: 1fr; }
  .panel { height: auto; min-height: 400px; }
  .hero-title { font-size: 64px; }
}
