/* 葬AI Web4 — Design System
   ------------------------------------------------------------------
   调性：中文 AI 行业评论、独立、尖锐、有态度
   风格：暗色、像素感、紫罗兰主色 + 琥珀重音
   ------------------------------------------------------------------ */

/* ============ Reset ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-bright);
}

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

/* ============ Tokens ============ */
:root {
  /* Colors — dark base */
  --bg: #0a0710;
  --bg-elev: #120d1c;
  --bg-card: #181126;
  --bg-elev-2: #221836;
  --bg-overlay: rgba(10, 7, 16, 0.85);

  /* Foregrounds */
  --fg: #ebe5f5;
  --fg-muted: #9b93b3;
  --fg-dim: #6b6485;

  /* Brand: violet / purple */
  --primary: #9b7de8;
  --primary-bright: #c4b5fd;
  --primary-dim: #7351cf;
  --primary-glow: rgba(155, 125, 232, 0.4);
  --primary-soft: rgba(155, 125, 232, 0.12);
  --primary-soft-2: rgba(155, 125, 232, 0.22);

  /* Accent: amber */
  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --accent-dim: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.16);

  /* Entity type colors (matches leaderboards) */
  --type-product: #10b981;
  --type-person: #f59e0b;
  --type-vc: #ec4899;
  --type-company: #6366f1;

  /* Borders */
  --border: rgba(155, 125, 232, 0.18);
  --border-bright: rgba(155, 125, 232, 0.4);
  --border-dim: rgba(155, 125, 232, 0.08);

  /* Pixel-style border helpers */
  --pixel-border: 1px solid var(--border);
  --pixel-bg: var(--bg-card);

  /* Layout */
  --max-w: 1240px;
  --max-w-narrow: 760px;
  --nav-h: 56px;
  --gap: 16px;
  --gap-lg: 28px;

  /* Typography */
  --font-pixel: "Fusion Pixel", "Fusion Pixel 12px Proportional", ui-monospace,
    "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 150ms;
  --t-med: 280ms;
}

/* ============ Fonts ============ */
@font-face {
  font-family: "Fusion Pixel";
  src: url("../lib/fusion-pixel-12px-proportional.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.font-pixel {
  font-family: var(--font-pixel);
  letter-spacing: 0.02em;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ Background subtle grid ============ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(155, 125, 232, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 125, 232, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 0%, #000 60%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, #000 60%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(155, 125, 232, 0.15), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(245, 158, 11, 0.08), transparent 40%);
  pointer-events: none;
}

/* ============ Layout primitives ============ */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  width: 100%;
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  padding: 0 24px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap);
}

/* ============ Navigation ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--bg);
  font-weight: bold;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(transparent 4px, rgba(0,0,0,0.15) 4px, rgba(0,0,0,0.15) 5px, transparent 5px),
    linear-gradient(90deg, transparent 4px, rgba(0,0,0,0.15) 4px, rgba(0,0,0,0.15) 5px, transparent 5px);
  background-size: 5px 5px;
  opacity: 0.4;
}

.brand-mark span {
  position: relative;
  z-index: 1;
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 3px;
}

.brand-text .sub {
  font-size: 8px;
  color: var(--fg-dim);
  letter-spacing: 0.2em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--fg-muted);
  border: 1px solid transparent;
  border-radius: 2px;
  transition: all var(--t-fast) var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-link:hover {
  color: var(--fg);
  border-color: var(--border);
  background: var(--bg-card);
}

.nav-link.is-active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

@media (max-width: 540px) {
  .nav-link {
    padding: 6px 8px;
    font-size: 10px;
  }
}

/* ============ Footer ============ */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.footer-text {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--fg-muted);
}

.footer-text a {
  color: var(--primary);
  border-bottom: 1px dashed var(--primary);
}

.footer-meta {
  font-size: 10px;
  color: var(--fg-dim);
}

/* ============ Hero (home) ============ */
.hero {
  padding: 80px 0 60px;
  position: relative;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--primary);
  border-radius: 2px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.1;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  text-shadow: 0 0 24px var(--primary-glow);
}

.hero-title .accent {
  color: var(--primary);
  display: inline-block;
}

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

.hero-desc {
  max-width: 720px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg-muted);
  margin-bottom: 36px;
}

.hero-desc strong {
  color: var(--fg);
  font-weight: 600;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--border-bright);
  background: var(--bg-card);
  color: var(--fg);
  font-family: var(--font-pixel);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 2px;
  transition: all var(--t-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(155, 125, 232, 0.2) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary-bright);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 125, 232, 0.2);
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-bright);
  border-color: var(--primary-bright);
  color: var(--bg);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-accent:hover {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

/* ============ Stats ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding: 32px 0;
  margin: 32px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  padding: 8px 16px;
  position: relative;
}

.stat-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-pixel);
  font-size: 36px;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-value .unit {
  font-size: 14px;
  color: var(--fg-muted);
  margin-left: 4px;
}

.stat-desc {
  font-size: 12px;
  color: var(--fg-dim);
}

/* ============ Section ============ */
.section {
  padding: 48px 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: "//";
  color: var(--primary);
  font-weight: normal;
  opacity: 0.6;
}

.section-subtitle {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ============ Cards ============ */
.card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  padding: 20px;
  transition: all var(--t-med) var(--ease);
  position: relative;
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--primary-soft);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-meta .sep {
  color: var(--fg-dim);
}

.card-excerpt {
  font-size: 13px;
  line-height: 1.65;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ Tag / Chip ============ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.tag-product { color: var(--type-product); }
.tag-person  { color: var(--type-person); }
.tag-vc      { color: var(--type-vc); }
.tag-company { color: var(--type-company); }

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ============ Leaderboard ============ */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.leaderboard {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.leaderboard-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elev);
}

.leaderboard-title {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-count {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-dim);
}

.leaderboard-list {
  padding: 4px 0;
  max-height: 520px;
  overflow-y: auto;
}

.leaderboard-list::-webkit-scrollbar {
  width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
  background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-dim);
  transition: background var(--t-fast) var(--ease);
  cursor: pointer;
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-item:hover {
  background: var(--bg-elev);
}

.leaderboard-rank {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.leaderboard-item:nth-child(1) .leaderboard-rank { color: var(--accent); }
.leaderboard-item:nth-child(2) .leaderboard-rank { color: var(--accent-bright); }
.leaderboard-item:nth-child(3) .leaderboard-rank { color: var(--primary-bright); }

.leaderboard-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.leaderboard-name .name {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-name .desc {
  font-size: 11px;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-metric {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ============ Article list ============ */
.article-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--fg);
  font-size: 13px;
  transition: border-color var(--t-fast) var(--ease);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-dim);
  font-family: var(--font-pixel);
  font-size: 12px;
  pointer-events: none;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-muted);
  font-family: var(--font-pixel);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 2px;
  transition: all var(--t-fast) var(--ease);
}

.pill:hover {
  border-color: var(--primary);
  color: var(--fg);
}

.pill.is-active {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.article-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 20px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--t-med) var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.article-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--t-med) var(--ease);
}

.article-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.article-card:hover::before {
  transform: scaleY(1);
}

.article-card .id {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.1em;
}

.article-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-muted);
  flex-wrap: wrap;
}

.article-card .meta .sep {
  color: var(--fg-dim);
}

.article-card .excerpt {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

.article-card .footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--border-dim);
  margin-top: 4px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.no-results {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
  font-family: var(--font-pixel);
  font-size: 12px;
}

/* ============ Article detail ============ */
.article-page {
  padding: 40px 0 64px;
}

.article-breadcrumb {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-dim);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-breadcrumb a {
  color: var(--fg-muted);
}

.article-breadcrumb a:hover {
  color: var(--primary);
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-header .id-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-header h1 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.3;
  color: var(--fg);
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--fg-muted);
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.article-meta-item .label {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

.prose {
  font-size: 16px;
  line-height: 1.85;
  color: var(--fg);
}

.prose p {
  margin-bottom: 1.4em;
  color: var(--fg);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2em;
  margin-bottom: 0.8em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fg);
}

.prose h1 { font-size: 28px; }
.prose h2 {
  font-size: 22px;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 18px; color: var(--primary-bright); }
.prose h4 { font-size: 16px; }

.prose a {
  color: var(--primary);
  border-bottom: 1px dashed var(--primary);
}

.prose a:hover {
  color: var(--primary-bright);
  border-bottom-style: solid;
}

.prose strong {
  color: var(--accent-bright);
  font-weight: 600;
}

.prose em {
  font-style: italic;
  color: var(--primary-bright);
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  color: var(--fg);
  border-radius: 0 4px 4px 0;
}

.prose blockquote p {
  margin-bottom: 0.5em;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  margin: 1em 0 1em 1.5em;
}

.prose ul li {
  list-style: disc;
  margin-bottom: 0.4em;
}

.prose ol li {
  list-style: decimal;
  margin-bottom: 0.4em;
}

.prose code {
  background: var(--bg-elev-2);
  padding: 2px 6px;
  border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.9em;
  color: var(--accent-bright);
  border: 1px solid var(--border-dim);
}

.prose pre {
  margin: 1.5em 0;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.5;
}

.prose hr {
  margin: 2.5em 0;
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-bright), transparent);
}

.prose img {
  margin: 1.5em 0;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.prose table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 14px;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--primary);
}

/* Sidebar */
.article-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  padding: 16px;
}

.sidebar-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title .count {
  color: var(--fg-dim);
  font-weight: normal;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entity-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--fg);
  border: 1px solid transparent;
  transition: all var(--t-fast) var(--ease);
}

.entity-link:hover {
  border-color: currentColor;
  background: var(--bg-elev);
}

.entity-link .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.entity-link .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.relation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.relation-item {
  font-size: 12px;
  line-height: 1.5;
}

.relation-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.relation-pair .name {
  color: var(--fg);
  font-weight: 500;
}

.relation-arrow {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--accent);
  padding: 2px 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.relation-why {
  font-size: 11px;
  color: var(--fg-muted);
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

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

.article-nav-link {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  transition: all var(--t-fast) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.article-nav-link:hover {
  border-color: var(--primary);
}

.article-nav-link.next {
  text-align: right;
  align-items: flex-end;
}

.article-nav-link .label {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.article-nav-link .title {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============ Knowledge Graph ============ */
.graph-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  height: calc(100vh - var(--nav-h) - 80px);
  min-height: 540px;
}

@media (max-width: 1024px) {
  .graph-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .graph-sidebar {
    position: static !important;
    max-height: 480px;
  }
}

.graph-canvas-wrap {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  min-height: 540px;
}

#graph-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
}

.graph-toolbar .pill {
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  font-size: 9px;
  padding: 4px 8px;
}

.graph-toolbar .pill .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 5px;
  vertical-align: middle;
}

.graph-toolbar .pill.is-active {
  background: var(--primary);
}

.graph-search {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 240px;
}

@media (max-width: 640px) {
  .graph-search { width: calc(100% - 24px); top: 60px; }
}

.graph-search .search-input {
  padding-left: 32px;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  font-size: 12px;
}

.graph-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.graph-search-results.is-open {
  display: block;
}

.graph-search-result {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-dim);
  font-size: 12px;
  transition: background var(--t-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.graph-search-result:last-child { border-bottom: none; }
.graph-search-result:hover, .graph-search-result.is-focused {
  background: var(--bg-elev);
  color: var(--primary);
}

.graph-search-result .meta {
  margin-left: auto;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-dim);
}

.graph-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.graph-legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.graph-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.graph-zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.graph-zoom-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  color: var(--fg);
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: bold;
  transition: all var(--t-fast);
}

.graph-zoom-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.graph-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  z-index: 100;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.graph-loading.is-hidden { display: none; }

.graph-sidebar {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 4px;
  padding: 16px;
  overflow-y: auto;
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px);
}

.graph-sidebar::-webkit-scrollbar { width: 6px; }
.graph-sidebar::-webkit-scrollbar-track { background: transparent; }
.graph-sidebar::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

.detail-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.7;
}

.detail-empty::before {
  content: "◇";
  display: block;
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 12px;
  opacity: 0.4;
}

.detail-card .name {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-card .type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-pixel);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.detail-card .description {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-elev);
  border-radius: 2px;
  border: 1px solid var(--border-dim);
}

.detail-stat .label {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-stat .value {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.detail-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-dim);
}

.detail-section .title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.alias-list,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.alias {
  padding: 2px 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--fg-muted);
}

.neighbor-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.neighbor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 2px;
  font-size: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
}

.neighbor:hover {
  background: var(--bg-elev);
  border-color: currentColor;
}

.neighbor .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.neighbor .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.neighbor .rel {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--accent);
  padding: 1px 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ Banner for home ============ */
.banner {
  margin-top: 32px;
  padding: 24px;
  border: 1px dashed var(--primary-dim);
  background: var(--primary-soft);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.banner-text {
  flex: 1;
  min-width: 240px;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.6;
}

.banner-text strong {
  color: var(--primary-bright);
}

/* ============ Loading / Misc ============ */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-bright), transparent);
  margin: 32px 0;
}

@media (max-width: 720px) {
  .container,
  .container-narrow {
    padding: 0 16px;
  }
  .hero { padding: 48px 0 32px; }
  .section { padding: 32px 0; }
  .article-grid { grid-template-columns: 1fr; }
  .leaderboard-grid { grid-template-columns: 1fr; }
}

/* Selection */
::selection {
  background: var(--primary-soft-2);
  color: var(--primary-bright);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-dim); }
