:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a25;
  --border: #2a2a35;
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --accent: #ff2d55;
  --accent-glow: rgba(255, 45, 85, 0.3);
  --cyan: #00d4ff;
  --green: #34c759;
  --purple: #bf5af2;
  --orange: #ff9f0a;
  --radius: 8px;
  --max-w: 1200px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* NAV */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--accent); }

.nav-links { display: flex; gap: 1.5rem; }

.nav-links a {
  color: var(--text-dim);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a.active,
.nav-links a:hover { color: var(--text); }

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* MAIN */
main { max-width: var(--max-w); margin: 0 auto; padding: 2rem; }

/* HERO */
.hero {
  text-align: center;
  padding: 4rem 0;
}

.hero-title {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero-title .accent { color: var(--accent); }

.hero-sub {
  font-size: 1.25rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.stat { display: flex; flex-direction: column; align-items: center; }

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.hero-nav { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #ff4d6f;
  box-shadow: 0 0 20px var(--accent-glow);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.btn-sm:hover { border-color: var(--cyan); color: var(--cyan); }

/* SECTIONS */
.section { margin-top: 3rem; }

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ARTICLE GRID */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.article-card {
  display: block;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.article-date {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: monospace;
}

.article-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.5rem 0;
  color: var(--text);
  line-height: 1.4;
}

.article-author {
  font-size: 0.8rem;
  color: var(--cyan);
}

/* LEADERBOARD PREVIEW */
.lb-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.lb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.lb-card h3 {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.lb-card ol {
  list-style: none;
  counter-reset: lb;
}

.lb-card li {
  counter-increment: lb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.lb-card li:last-child { border-bottom: none; }

.lb-card li::before {
  content: counter(lb);
  color: var(--text-dim);
  font-weight: 700;
  margin-right: 0.5rem;
  min-width: 1.2rem;
}

.lb-name { flex: 1; }
.lb-score { color: var(--cyan); font-family: monospace; font-size: 0.8rem; }

/* GRAPH PAGE */
.graph-page { padding-top: 1rem; }

.page-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.page-desc {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.graph-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.graph-legend {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
}

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

.dot-product { background: var(--cyan); }
.dot-person { background: var(--green); }
.dot-vc { background: var(--orange); }
.dot-company { background: var(--purple); }

#graph-container {
  width: 100%;
  height: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

#graph-container svg { width: 100%; height: 100%; }

.node-detail {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 320px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  z-index: 50;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.node-detail.hidden { display: none; }

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-btn:hover { color: var(--accent); }

.detail-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.detail-type { font-size: 0.8rem; color: var(--accent); margin-bottom: 0.75rem; text-transform: uppercase; }
.detail-desc { font-size: 0.9rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 1rem; }
.detail-stats { display: flex; gap: 1rem; margin-bottom: 1rem; }
.detail-stat { text-align: center; }
.detail-stat-val { font-size: 1.25rem; font-weight: 700; color: var(--cyan); }
.detail-stat-label { font-size: 0.7rem; color: var(--text-dim); }

/* LB TABS */
.lb-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.lb-tab {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.lb-tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

#lb-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.lb-full-list { list-style: none; }

.lb-full-item {
  display: grid;
  grid-template-columns: 2rem 1fr 4rem 4rem 4rem;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.lb-full-item:last-child { border-bottom: none; }
.lb-rank { color: var(--text-dim); font-weight: 700; }
.lb-full-name { font-weight: 600; }
.lb-full-desc { color: var(--text-dim); font-size: 0.75rem; grid-column: 2 / -1; }

/* ARTICLES PAGE */
.articles-page { padding-top: 1rem; }

.articles-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--cyan);
}

.filter-btns { display: flex; gap: 0.5rem; }

.filter-btn {
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
}

.filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.articles-list { display: flex; flex-direction: column; gap: 0.5rem; }

.article-list-item {
  display: grid;
  grid-template-columns: 3rem 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.article-list-item:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.article-list-id { color: var(--text-dim); font-family: monospace; font-weight: 700; }
.article-list-title { font-weight: 600; color: var(--text); }
.article-list-author { color: var(--cyan); font-size: 0.85rem; }
.article-list-date { color: var(--text-dim); font-size: 0.8rem; font-family: monospace; }
.articles-count { color: var(--text-dim); font-size: 0.85rem; margin-top: 1rem; }

/* ARTICLE DETAIL */
.article-detail { max-width: 720px; margin: 0 auto; }

.article-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }

.article-detail-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.meta-author { color: var(--cyan); }
.meta-id { color: var(--text-dim); font-family: monospace; }

.article-body {
  font-size: 1rem;
  line-height: 1.8;
}

.markdown-body h1 { font-size: 1.75rem; font-weight: 800; margin: 2rem 0 1rem; }
.markdown-body h2 { font-size: 1.4rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
.markdown-body h3 { font-size: 1.2rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }
.markdown-body p { margin-bottom: 1rem; }
.markdown-body ul, .markdown-body ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.markdown-body li { margin-bottom: 0.25rem; }
.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-dim);
}
.markdown-body code {
  background: var(--bg-card);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.markdown-body pre {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1rem;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.markdown-body strong { color: var(--text); font-weight: 700; }
.markdown-body em { color: var(--cyan); }
.markdown-body img { max-width: 100%; border-radius: var(--radius); }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.nav-prev, .nav-next {
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 45%;
  transition: all 0.2s;
}

.nav-prev:hover, .nav-next:hover { border-color: var(--accent); }
.nav-next { text-align: right; margin-left: auto; }

/* FOOTER */
.site-footer {
  text-align: center;
  padding: 3rem 2rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}

.site-footer p + p { margin-top: 0.25rem; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .site-nav { padding: 0.75rem 1rem; }
  main { padding: 1rem; }
  .hero-stats { gap: 1.5rem; }
  .stat-num { font-size: 1.75rem; }
  .article-grid { grid-template-columns: 1fr; }
  .lb-preview { grid-template-columns: 1fr; }
  .lb-full-item { grid-template-columns: 2rem 1fr 3rem; }
  .article-list-item { grid-template-columns: 2.5rem 1fr; gap: 0.5rem; }
  .article-list-author, .article-list-date { grid-column: 2; }
  #graph-container { height: 400px; }
  .node-detail { width: calc(100% - 40px); right: 20px; }
  .graph-legend { margin-left: 0; }
}
