:root {
  --bg: #0a0c10;
  --surface: #141820;
  --panel: #1a2030;
  --border: #2a3348;
  --text: #eef1f6;
  --muted: #8b95a8;
  --user: #34d399;
  --user-dim: rgba(52, 211, 153, 0.15);
  --admin: #fbbf24;
  --admin-dim: rgba(251, 191, 36, 0.12);
  --accent: #60a5fa;
  --mono: ui-monospace, monospace;
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-size: 15px; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: var(--topbar-h);
}
.topbar h1 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { text-decoration: underline; }
.stats { font-size: 0.85rem; color: var(--muted); flex: 1; }

.legend {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
}
.leg { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.leg i {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.leg.user i { background: var(--user); }
.leg.admin i { background: var(--admin); }

.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--topbar-h));
}

#cy {
  flex: 1;
  min-width: 0;
  background:
    radial-gradient(circle at 50% 50%, #12161f 0%, var(--bg) 70%);
}

.panel {
  width: min(420px, 38vw);
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem 1.1rem 1.5rem;
}
.panel .hint { color: var(--muted); font-size: 0.9rem; margin: 0; }

.panel-head { margin-bottom: 1rem; }
.panel-head h2 {
  margin: 0 0 0.25rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
  word-break: break-word;
}
.panel-head .label { font-size: 0.88rem; color: var(--muted); line-height: 1.4; }
.panel-head .lane {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
}

.section { margin-bottom: 1.25rem; }
.section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.section.user h3 { color: var(--user); }
.section.admin h3 { color: var(--admin); }

.edge-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.4rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}
.edge-card:hover { border-color: var(--accent); }
.edge-card .to {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.edge-card .sum { font-size: 0.85rem; line-height: 1.4; color: var(--muted); }
.edge-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.empty { font-size: 0.85rem; color: var(--muted); font-style: italic; }

.meaning {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 1rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  border-radius: 6px;
  border-left: 3px solid var(--border);
}

@media (max-width: 900px) {
  .workspace { flex-direction: column; }
  .panel { width: 100%; max-height: 42vh; border-left: none; border-top: 1px solid var(--border); }
  #cy { min-height: 50vh; }
}
