
:root {
  --bg: #faf7f2;
  --bg2: #f2ede4;
  --border: #d9cfc0;
  --text: #2c1f0e;
  --muted: #7a6a54;
  --accent: #8b3a1e;
  --accent2: #c4622d;
  --link: #5c3d1e;
  --nav-bg: #2c1f0e;
  --nav-text: #e8dcc8;
  --nav-hover: #c4622d;
  --tag-bg: #e8dcc8;
  --wiki: #8b3a1e;
  --sans: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: Georgia, "Noto Serif SC", "Source Han Serif SC", serif;
}

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

body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.8;
}

/* ── 侧边栏 ── */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#sidebar-header a {
  text-decoration: none;
  color: #e8dcc8;
}

#sidebar-header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

#sidebar-header p {
  font-size: 11px;
  color: rgba(232,220,200,0.5);
  font-family: var(--sans);
}

#search-box {
  margin: 12px 16px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: var(--nav-text);
  font-size: 13px;
  font-family: var(--sans);
  width: calc(100% - 32px);
  outline: none;
}
#search-box::placeholder { color: rgba(232,220,200,0.35); }
#search-box:focus { border-color: var(--nav-hover); }

#search-results {
  display: none;
  position: absolute;
  left: 16px;
  right: 16px;
  top: 110px;
  background: #3d2a14;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}
#search-results a {
  display: block;
  padding: 8px 12px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#search-results a:hover { background: rgba(196,98,45,0.3); }
#search-results .sr-sub { font-size: 11px; color: rgba(232,220,200,0.45); }

nav { flex: 1; padding: 8px 0 24px; }

.nav-section { margin-bottom: 4px; }

.nav-section-title {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(232,220,200,0.4);
  text-transform: uppercase;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(232,220,200,0.7);
  font-family: var(--sans);
  user-select: none;
  transition: color 0.15s;
}
.nav-group-toggle:hover { color: var(--nav-hover); }
.nav-group-toggle .arrow { font-size: 9px; transition: transform 0.2s; }
.nav-group-toggle.open .arrow { transform: rotate(90deg); }

.nav-items { display: none; }
.nav-items.open { display: block; }

.nav-items a {
  display: block;
  padding: 4px 20px 4px 32px;
  font-size: 13px;
  color: rgba(232,220,200,0.6);
  text-decoration: none;
  font-family: var(--sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}
.nav-items a:hover { color: var(--nav-hover); }
.nav-items a.active { color: var(--nav-hover); font-weight: 600; }

/* graph 链接 */
.nav-graph a {
  padding-left: 20px;
}

/* ── 主内容区 ── */
#main {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 48px 80px;
  min-width: 0;
}

/* ── 面包屑 ── */
.breadcrumb {
  font-size: 12px;
  font-family: var(--sans);
  color: var(--muted);
  margin-bottom: 28px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--border); }

/* ── 文章头 ── */
.article-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  color: var(--text);
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--sans);
  background: var(--tag-bg);
  color: var(--muted);
  text-decoration: none;
}
.tag:hover { background: var(--accent2); color: white; }
.tag.genre { background: var(--accent); color: white; }

.stats-row {
  font-size: 13px;
  font-family: var(--sans);
  color: var(--muted);
}
.stats-row strong { color: var(--accent); }

/* ── 文章正文 ── */
.article-body {
  font-size: 17px;
  line-height: 1.95;
  color: #1e1408;
}

.article-body h2 {
  font-size: 22px;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.article-body h3 {
  font-size: 18px;
  margin: 28px 0 10px;
  color: var(--text);
}

.article-body h4 {
  font-size: 16px;
  margin: 20px 0 8px;
  color: var(--muted);
}

.article-body p {
  margin-bottom: 1.1em;
  text-indent: 2em;
}

.article-body p:first-child { text-indent: 0; }
.article-body h2 + p,
.article-body h3 + p { text-indent: 0; }

.article-body blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent2);
  background: var(--bg2);
  border-radius: 0 6px 6px 0;
  font-size: 15px;
  color: var(--muted);
}

.article-body blockquote p { text-indent: 0; margin-bottom: 0.5em; }

.article-body li {
  margin: 6px 0 6px 24px;
  font-size: 15px;
}

.article-body sup.note {
  font-size: 11px;
  color: var(--muted);
  cursor: default;
}

.wiki-link {
  color: var(--wiki);
  text-decoration: none;
  border-bottom: 1px solid rgba(139,58,30,0.3);
  transition: border-color 0.15s;
}
.wiki-link:hover { border-color: var(--wiki); }

.wiki-ref {
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
}

/* ── 图谱节点页 ── */
.node-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.node-header h1 { font-size: 36px; margin-bottom: 12px; }
.node-type {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--sans);
  background: var(--accent);
  color: white;
  margin-bottom: 14px;
}
.node-desc {
  font-size: 16px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  border-left: 3px solid var(--accent2);
  padding-left: 16px;
  margin-top: 14px;
}

/* ── 首页 ── */
.home-hero {
  text-align: center;
  padding: 60px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.home-hero h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.home-hero p {
  font-size: 16px;
  color: var(--muted);
  font-family: var(--sans);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.stat-card .num {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat-card .label {
  font-size: 12px;
  font-family: var(--sans);
  color: var(--muted);
  margin-top: 4px;
}

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

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}
.card:hover {
  border-color: var(--accent2);
  box-shadow: 0 2px 12px rgba(139,58,30,0.08);
}
.card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}
.card p {
  font-size: 12px;
  font-family: var(--sans);
  color: var(--muted);
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}
.entity-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s;
}
.entity-item:hover { border-color: var(--accent2); }
.entity-item .name { font-size: 15px; }
.entity-item .count {
  font-size: 11px;
  font-family: var(--sans);
  color: var(--muted);
  margin-top: 2px;
}
