* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a0a0f;
  font-family: system-ui, -apple-system, sans-serif;
}
body {
  background: url('bg.jpg') center/cover no-repeat fixed;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%; height: 100%;
}

#main-row {
  display: flex;
  flex: 1;
  min-height: 0;
}

#graph-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

canvas { display: block; cursor: grab; position: absolute; top: 0; left: 0; }
canvas:active { cursor: grabbing; }

#badge {
  position: absolute;
  bottom: 8px; right: 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  pointer-events: auto;
  z-index: 5;
}
#badge a {
  color: rgba(180,200,255,0.4);
  text-decoration: none;
}
#badge a:hover {
  color: rgba(180,200,255,0.7);
  text-decoration: underline;
}

/* Leaderboard */
#leaderboard {
  width: 260px;
  flex-shrink: 0;
  background: rgba(12, 12, 20, 0.95);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  padding: 16px 0;
}

#leaderboard h2 {
  color: #e0c868;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 4px;
}

#leaders {
  list-style: none;
  counter-reset: rank;
}

#leaders li {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

#leaders li {
  cursor: pointer;
}
#leaders li:hover {
  background: rgba(255,255,255,0.06);
}

#leaders .leader-rank {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

#leaders .leader-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #555;
}

#leaders li:nth-child(1) .leader-avatar { border-color: #e0c868; }
#leaders li:nth-child(2) .leader-avatar { border-color: #b0b0b8; }
#leaders li:nth-child(3) .leader-avatar { border-color: #c08040; }

#leaders .leader-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#leaders .leader-name {
  color: #ddd;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#leaders .leader-name a {
  color: inherit;
  text-decoration: none;
}
#leaders .leader-name a:hover {
  color: #7eb8ff;
  text-decoration: underline;
}

#leaders .leader-handle {
  color: #666;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#leaders .leader-count {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #666;
}

#leaders li:nth-child(1) .leader-count { color: #e0c868; }
#leaders li:nth-child(2) .leader-count { color: #b0b0b8; }
#leaders li:nth-child(3) .leader-count { color: #c08040; }

#leaders .leader-rank-num {
  font-size: 13px;
  font-weight: 700;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  color: #555;
}

/* Recent connections ticker — bottom bar */
#sidebar {
  flex-shrink: 0;
  background: rgba(12, 12, 20, 0.92);
  border-top: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  padding: 0;
  height: 56px;
  width: 100%;
  position: relative;
}

#sidebar h2 { display: none; }

#recent-list {
  list-style: none;
  display: flex;
  gap: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#recent-list::-webkit-scrollbar { display: none; }

#recent-list li {
  padding: 8px 18px;
  border-right: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  animation: slideIn 0.4s ease;
}

#recent-list li:hover {
  background: rgba(255,255,255,0.06);
}

#recent-list .conn-avatars img,
#recent-list .conn-names a {
  cursor: pointer;
}

#recent-list .conn-avatars {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#recent-list .conn-avatars img {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}

#recent-list .conn-names {
  display: flex;
  align-items: center;
  gap: 4px;
}

#recent-list .conn-names a {
  color: #ccc;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
}

#recent-list .conn-names a:hover {
  color: #7eb8ff;
  text-decoration: underline;
}

#recent-list .conn-arrow {
  color: #555;
  flex-shrink: 0;
  font-size: 11px;
}

#recent-list .conn-time {
  color: #444;
  font-size: 10px;
  margin-left: 4px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

#status {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  color: #888; font-size: 11px;
  background: rgba(10,10,15,0.7); padding: 5px 12px; border-radius: 5px;
  pointer-events: none; z-index: 10; line-height: 1.4;
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.04);
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
#status.hidden { opacity: 0; }
#status .count { color: #7eb8ff; font-weight: 600; }

#tooltip {
  position: fixed; display: none; pointer-events: none; z-index: 20;
  background: rgba(15,15,25,0.92); color: #ddd; padding: 8px 12px;
  border-radius: 8px; font-size: 13px; max-width: none; white-space: nowrap;
  backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#tooltip .handle { color: #7eb8ff; font-weight: 600; }
#tooltip .did { color: #666; font-size: 11px; }
#tooltip img { width: 40px; height: 40px; border-radius: 50%; float: left; margin-right: 8px; }

/* Mobile */
@media (max-width: 768px) {
  #main-row {
    flex-direction: column;
    min-height: 0;
  }
  #leaderboard {
    width: 100%;
    height: auto;
    max-height: 35vh;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  #leaders li { padding: 8px 16px; }
  #graph-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
  }
  #sidebar {
    height: 48px;
  }
}
