* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background: #0d1117;
  color: #e6edf3;
  overflow: hidden;
}

#app { display: flex; height: 100vh; width: 100vw; }

#sidebar {
  width: 340px;
  min-width: 340px;
  height: 100%;
  overflow-y: auto;
  background: #11161f;
  border-right: 1px solid #21262d;
  padding: 16px;
}

.brand { margin-bottom: 16px; }
.brand-title { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { font-size: 12px; color: #8b949e; margin-top: 2px; }

.panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 7px;
  color: #e6edf3;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus { border-color: #4f9dff; }

.btn {
  width: 100%;
  margin-top: 8px;
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 7px;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { background: #2d333b; }
.btn.primary { background: #1f6feb; border-color: #1f6feb; }
.btn.primary:hover { background: #388bfd; }

/* search */
#search-box { position: relative; }
.search-drop {
  display: none;
  position: absolute;
  left: 12px; right: 12px;
  top: 64px;
  background: #1c2129;
  border: 1px solid #30363d;
  border-radius: 8px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.drop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; font-size: 13px; cursor: pointer;
}
.drop-item:hover { background: #2d333b; }
.drop-type { margin-left: auto; font-size: 11px; color: #8b949e; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* type filter */
.type-filter { display: flex; flex-direction: column; gap: 6px; }
.type-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.type-chip input { accent-color: #4f9dff; }

/* path */
.path-inputs { display: flex; flex-direction: column; gap: 8px; }
.path-result { margin-top: 10px; font-size: 13px; }
.path-msg { padding: 6px 0; line-height: 1.5; }
.path-msg.warn { color: #ff7b72; }
.path-summary { color: #8b949e; margin-bottom: 6px; }
.path-nodes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.path-node {
  background: #3a2f14;
  border: 1px solid #ffd166;
  color: #ffe08a;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
}
.path-node:hover { background: #4d3e1a; }
.path-arrow { color: #ffd166; }

/* stats */
.stats-top { display: flex; flex-direction: column; gap: 4px; }
.rank-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.rank-row:hover { background: #21262d; }
.rank-no { width: 18px; color: #8b949e; font-size: 12px; text-align: right; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-deg {
  background: #1f6feb33; color: #79b8ff; border-radius: 10px;
  padding: 1px 8px; font-size: 12px; font-weight: 600;
}

.stats-counts { display: flex; flex-direction: column; gap: 4px; }
.count-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; font-size: 13px; border-radius: 6px;
}
.count-row:hover { background: #21262d; }
.count-row .rel-name { flex: 1; }
.count-val {
  margin-left: auto; background: #21262d; border-radius: 10px;
  padding: 1px 8px; font-size: 12px; color: #8b949e;
}

/* stage */
#stage { position: relative; flex: 1; height: 100%; overflow: hidden; }
#graph-canvas { display: block; cursor: grab; }
.hint {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 12px; color: #8b949e;
  background: #161b2299; padding: 5px 10px; border-radius: 6px;
  border: 1px solid #21262d; pointer-events: none;
}

.info-panel {
  position: absolute; right: 12px; top: 12px;
  width: 300px; max-height: calc(100% - 24px);
  overflow-y: auto;
  background: #161b22ee;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  backdrop-filter: blur(4px);
}
.muted { color: #8b949e; }
.info-head { display: flex; align-items: center; gap: 8px; }
.info-name { font-size: 16px; font-weight: 700; }
.tag {
  margin-left: auto; font-size: 11px; color: #8b949e;
  border: 1px solid #30363d; border-radius: 10px; padding: 1px 8px;
}
.info-id { font-size: 11px; margin-top: 4px; }
.info-desc { line-height: 1.55; color: #c9d1d9; margin: 10px 0; }
.info-meta { display: flex; gap: 8px; margin-bottom: 10px; }
.meta-item {
  flex: 1; text-align: center; background: #0d1117;
  border-radius: 8px; padding: 6px 2px;
}
.meta-val { font-size: 15px; font-weight: 700; color: #79b8ff; }
.meta-lbl { font-size: 10px; color: #8b949e; margin-top: 2px; }
.info-aliases { font-size: 12px; margin-bottom: 10px; }
.nb-title { font-size: 12px; color: #8b949e; margin-bottom: 6px; }
.nb-list { display: flex; flex-direction: column; gap: 3px; }
.nb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
}
.nb-item:hover { background: #21262d; }
.nb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-rel { font-size: 11px; color: #8b949e; }
