:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #151515;
  --fg: #ececec;
  --fg-muted: #9b9b9b;
  --accent: #ff2a2a;
  --accent-hover: #ff5252;
  --border: #252525;
  --product: #ff4d4d;
  --company: #4dabf7;
  --person: #f1f3f5;
  --vc: #be4bdb;
  --radius: 6px;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--fg); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-family: var(--mono);
}
.brand-text { letter-spacing: -0.02em; }
.site-nav { display: flex; gap: 24px; }
.nav-link {
  font-size: 0.95rem;
  color: var(--fg-muted);
  position: relative;
  padding: 6px 0;
}
.nav-link:hover, .nav-link.active { color: var(--fg); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

main { min-height: calc(100vh - 64px); }
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}
.section-narrow { max-width: 760px; }

.hero {
  padding: 80px 20px 60px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,42,42,0.12), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(77,171,247,0.08), transparent 35%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  margin: 0 0 16px;
  letter-spacing: -0.04em;
  line-height: 1.05;
  position: relative;
}
.hero .tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  color: var(--fg-muted);
  max-width: 680px;
  margin: 0 auto 40px;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 28px;
  min-width: 140px;
  text-align: center;
}
.stat-card .num {
  display: block;
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-card .label {
  display: block;
  margin-top: 8px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: #3a3a3a; }
.card h3 { margin: 0 0 10px; font-size: 1.3rem; }
.card p { color: var(--fg-muted); margin: 0; }

.section-title {
  font-size: 1.6rem;
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  width: 4px; height: 24px;
  background: var(--accent);
  border-radius: 2px;
}

.latest-list { display: grid; gap: 14px; }
.latest-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.latest-item a { font-weight: 600; font-size: 1.05rem; }
.latest-item a:hover { color: var(--accent-hover); }
.latest-item .meta { color: var(--fg-muted); font-size: 0.85rem; white-space: nowrap; font-family: var(--mono); }

/* Articles list */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}
.search-bar input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 1rem;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 18px;
}
.articles-list { display: grid; gap: 16px; }
.article-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s;
}
.article-row:hover { border-color: var(--accent); }
.article-row a { font-size: 1.1rem; font-weight: 600; }
.article-row .info { color: var(--fg-muted); font-size: 0.85rem; white-space: nowrap; font-family: var(--mono); }
.article-row .author { color: var(--accent-hover); }

.empty-state { color: var(--fg-muted); padding: 40px 0; text-align: center; }

/* Article detail */
.article-header {
  padding: 50px 20px 30px;
  border-bottom: 1px solid var(--border);
  max-width: 760px;
  margin: 0 auto;
}
.article-header h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 16px; line-height: 1.2; }
.article-meta { color: var(--fg-muted); font-size: 0.95rem; display: flex; gap: 18px; flex-wrap: wrap; }
.article-meta .author { color: var(--accent-hover); font-weight: 600; }
.article-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  font-size: 1.08rem;
  line-height: 1.85;
}
.article-body h2, .article-body h3, .article-body h4 { margin-top: 2em; margin-bottom: 0.6em; line-height: 1.3; }
.article-body p { margin: 0 0 1.2em; }
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.article-body blockquote {
  margin: 1.5em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: rgba(255,42,42,0.05);
  color: #d0d0d0;
}
.article-body ul, .article-body ol { padding-left: 1.6em; margin-bottom: 1.2em; }
.article-body li { margin-bottom: 0.4em; }
.article-body code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.92em;
}
.article-body pre {
  background: var(--bg-elevated);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
}
.article-body pre code { background: transparent; padding: 0; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }
.article-body a { color: var(--accent-hover); text-decoration: underline; }

.article-nav {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 60px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.article-nav a { color: var(--fg-muted); }
.article-nav a:hover { color: var(--accent-hover); }

/* Graph page */
.graph-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.graph-main { flex: 1; position: relative; overflow: hidden; background: var(--bg); }
#graph-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graph-canvas:active { cursor: grabbing; }

.graph-overlay {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
}
.panel {
  background: rgba(17,17,17,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(8px);
}
.panel h3 { margin: 0 0 12px; font-size: 1rem; }
.panel p { margin: 0 0 10px; color: var(--fg-muted); font-size: 0.9rem; }
.graph-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.graph-controls input {
  flex: 1;
  min-width: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.graph-controls button { padding: 8px 12px; font-size: 0.85rem; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--fg-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

.node-detail {
  position: absolute;
  bottom: 16px; left: 16px;
  z-index: 10;
  width: 320px;
  max-height: 40vh;
  overflow-y: auto;
  display: none;
}
.node-detail.visible { display: block; }
.node-detail .close {
  float: right;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 1.2rem;
  line-height: 1;
}
.node-detail h4 { margin: 0 0 8px; font-size: 1.15rem; }
.node-detail .type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.node-detail .metrics { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.node-detail .metric { font-size: 0.85rem; color: var(--fg-muted); }
.node-detail .metric strong { color: var(--fg); }
.node-detail .desc { font-size: 0.9rem; color: #c0c0c0; margin-bottom: 12px; }
.node-detail .article-links { list-style: none; margin: 0; padding: 0; }
.node-detail .article-links li { margin-bottom: 6px; }
.node-detail .article-links a { font-size: 0.9rem; color: var(--accent-hover); }

.leaderboard-panel {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 10;
  width: 360px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.lb-tab {
  flex: 1;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.lb-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lb-table-wrap { overflow-y: auto; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lb-table th, .lb-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.lb-table th { color: var(--fg-muted); font-weight: 600; position: sticky; top: 0; background: rgba(17,17,17,0.95); }
.lb-table tr:hover td { background: rgba(255,255,255,0.04); cursor: pointer; }
.lb-rank { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.lb-name { font-weight: 600; }
.lb-score { color: var(--fg-muted); font-family: var(--mono); }

@media (max-width: 860px) {
  .graph-overlay { max-width: calc(100% - 32px); }
  .leaderboard-panel { position: static; width: 100%; max-height: none; border-top: 1px solid var(--border); }
  .graph-main { min-height: 60vh; }
  .node-detail { width: calc(100% - 32px); }
  .site-nav { gap: 16px; }
}

@media (max-width: 560px) {
  .article-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .latest-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .header-inner { height: 56px; }
  .brand-text { display: none; }
}
