:root {
  --fg: #1a1a1a;
  --fg-muted: #666;
  --bg: #fafaf7;
  --bg-box: #f0ece0;
  --accent: #7a1f1f;
  --link: #1a5490;
  --link-broken: #c44;
  --border: #d8d2bf;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.75;
  font-size: 17px;
}

.topnav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: .6em 1.2em;
  display: flex;
  align-items: center;
  gap: 1em;
}
.topnav .brand { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 15px; }
.topnav .crumb { color: var(--fg-muted); }
.topnav .spacer { flex: 1; }
.topnav-search { display: flex; align-items: center; }
.topnav-search input { width: 160px; padding: .3em .6em; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: var(--sans); outline: none; background: var(--bg-code); color: var(--fg); }
.topnav-search input:focus { border-color: var(--accent); width: 220px; transition: width .2s; }
body.is-home .topnav-search { display: none; }
.topnav .status { color: var(--fg-muted); font-style: italic; font-size: 12px; }

.page {
  max-width: 1440px;
  margin: 2em auto;
  padding: 0 1.2em;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2em;
}
@media (min-width: 1200px) {
  .page { grid-template-columns: minmax(0, 1fr) 380px; }
  .page > article { grid-column: 1; grid-row: 1; }
  .page > aside.sidebar { grid-column: 2; grid-row: 1; }
}

article h1 {
  font-size: 2em;
  margin-top: 0;
  padding-bottom: .3em;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}
article h2 {
  font-size: 1.35em;
  margin-top: 1.8em;
  padding-bottom: .2em;
  border-bottom: 1px solid var(--border);
}
article h3 {
  font-size: 1.1em;
  margin-top: 1.4em;
  color: var(--accent);
}
article p { margin: .4em 0; }
article ul, article ol { padding-left: 1.4em; }
article li { margin: .3em 0; }
article blockquote p { margin: 0; }
article blockquote {
  margin: .8em 0;
  padding: 0 1em;
  border-left: 3px solid var(--accent);
  background: var(--bg-box);
  color: var(--fg-muted);
  font-size: .95em;
  white-space: pre-line;
}
article table {
  border-collapse: collapse;
  margin: 1em 0;
  font-size: .93em;
}
article th, article td {
  padding: .35em .8em;
  border: 1px solid var(--border);
  text-align: left;
}
article th { background: var(--bg-box); font-weight: 600; }
article hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
article em { color: var(--fg-muted); font-style: normal; }
article img { max-width: 100%; height: auto; display: block; margin: .8em 0 .2em; border-radius: 4px; }
article img + em { display: block; font-size: .85em; color: var(--fg-muted); margin-bottom: .8em; }

/* 右侧栏：可容纳 infobox、人物画像等多个 box */
aside.sidebar {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: .8em;
}
.infobox {
  background: var(--bg-box);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1em;
  font-size: .9em;
}
.infobox h2 {
  margin: 0 0 .6em 0;
  font-size: 1.1em;
  padding-bottom: .3em;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.infobox table { width: 100%; border: none; margin: 0; }
.infobox th, .infobox td {
  border: none;
  padding: .25em .3em;
  vertical-align: top;
  background: transparent;
}
.infobox th { color: var(--fg-muted); font-weight: 500; width: 4.5em; }

/* 右侧栏人物画像 */
.sidebar-portrait {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #f0ece4;
}
.sidebar-portrait img {
  width: 100%;
  display: block;
  transition: opacity .15s;
}
.portrait-zoom:hover img { opacity: .85; cursor: zoom-in; }
.sidebar-portrait figcaption {
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
  padding: .3em .5em;
  font-style: italic;
  line-height: 1.3;
}
.portrait-item--sep {
  border-top: 1px solid var(--border);
  margin-top: 0;
}
.portrait-item figcaption { /* same as sidebar-portrait figcaption */
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
  padding: .3em .5em;
  font-style: italic;
  line-height: 1.3;
}

/* 地名地图（place-map 插件） */
.sidebar-map {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.map-caption {
  font-size: .8rem;
  color: var(--fg-muted, #666);
  padding: .25rem .5rem;
  background: var(--bg-subtle, #f7f7f7);
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  align-items: center;
}
.map-source {
  font-size: .7rem;
  color: var(--fg-muted, #999);
  margin-left: auto;
}

.wikilink.resolved { color: var(--link); text-decoration: none; }
.wikilink.resolved:hover { text-decoration: underline; }
.wikilink.self {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}
.wikilink.broken {
  color: var(--link-broken);
  text-decoration: underline dashed;
  cursor: help;
}

/* ---------- 首页 ---------- */

body.is-home .page { grid-template-columns: 1fr; }

.wiki-home .tagline {
  color: var(--fg-muted);
  font-size: .95em;
  margin-top: -.4em;
}

.home-disclaimer {
  font-size: .88em;
  color: var(--fg-muted);
  background: var(--bg-alt, #f8f6f0);
  border-left: 3px solid var(--accent, #b5a37a);
  padding: .5em .8em;
  margin: 1.2em 0;
  border-radius: 0 4px 4px 0;
}
.home-disclaimer a { color: inherit; text-decoration: underline; }

.search-box { margin: 2em 0 2.5em; position: relative; }
.wiki-home .search-box { max-width: 520px; }
.search-box input {
  width: 100%;
  padding: .55em 1em;
  font-size: 1.1em;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: white;
  font-family: var(--serif);
  color: var(--fg);
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122,31,31,.1);
}
.search-box input::placeholder {
  color: var(--fg-muted);
  opacity: .7;
}

#search-results {
  list-style: none;
  margin: .4em 0 0;
  padding: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 420px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  position: absolute;
  left: 0; right: 0;
  z-index: 5;
}
.search-result-item a {
  font-size: 1.05em;
  padding: .7em 1em;
}
.search-result-item { border-bottom: 1px solid var(--border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item a {
  display: flex; align-items: center; gap: .6em;
  padding: .5em .8em;
  text-decoration: none;
  color: inherit;
}
.search-result-item a:hover { background: var(--bg-box); }
.match-label { font-weight: 600; color: var(--accent); }
.match-alt { color: var(--fg-muted); font-size: .9em; }
.match-meta { margin-left: auto; color: var(--fg-muted); font-size: .85em; }
.search-empty {
  padding: .6em .8em;
  color: var(--fg-muted);
  font-style: italic;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1em;
  margin: 1em 0 2em;
}
.featured-card {
  display: block;
  padding: 1em 1.1em;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  overflow: hidden;
}
.featured-card.has-thumb {
  padding: 0;
  display: flex;
  flex-direction: column;
}
.featured-card:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(122,31,31,.1);
  transform: translateY(-1px);
}
.featured-card h3 {
  margin: 0 0 .35em 0;
  font-size: 1.2em;
  color: var(--accent);
  border: none;
  padding: 0;
}
.card-thumb {
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: #f0ece4;
  flex-shrink: 0;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform .2s;
}
.featured-card:hover .card-thumb img {
  transform: scale(1.04);
}
.card-body {
  padding: 1em 1.1em;
}
.card-life {
  font-size: .85em;
  color: var(--fg-muted);
  margin-bottom: .35em;
}
.card-meta { font-size: .9em; margin-bottom: .35em; }
.card-meta strong { color: var(--accent); font-weight: 600; }
.card-aliases {
  font-size: .85em;
  color: var(--fg-muted);
  margin-top: .3em;
  padding-top: .3em;
  border-top: 1px dashed var(--border);
}

.all-pages {
  margin-top: 2em;
  border-top: 1px solid var(--border);
  padding-top: 1em;
}
.all-pages summary {
  cursor: pointer;
  font-weight: 600;
  padding: .3em 0;
  color: var(--fg-muted);
  list-style: none;
}
.all-pages summary::-webkit-details-marker { display: none; }
.all-pages summary:hover { color: var(--accent); }
.all-pages summary::before {
  content: '▶'; display: inline-block;
  width: 1.2em; font-size: .75em;
  transition: transform .15s;
}
.all-pages[open] summary::before { transform: rotate(90deg); }

.list-meta { color: var(--fg-muted); font-size: .85em; margin-left: .5em; }
.list-score { color: var(--accent); font-size: .8em; margin-left: .4em;
              background: var(--bg-box); padding: 1px 6px; border-radius: 3px; }
.list-tags { color: var(--fg-muted); font-size: .8em; margin-left: .5em; }

/* ---------- 主页导航链接 ---------- */
.home-links {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1.5em;
  font-family: var(--sans);
}
.home-link {
  color: var(--accent);
  text-decoration: none;
  font-size: .95em;
  padding: .3em .6em;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all .15s;
}
.home-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.muted { color: var(--fg-muted); font-weight: normal; font-size: .85em; }

/* ---------- 翻页条 ---------- */
.pager {
  margin: 1.5em 0 2em;
  display: flex;
  justify-content: center;
  gap: .3em;
  font-family: var(--sans);
  font-size: .9em;
}
.pager-link, .pager-current {
  padding: .3em .7em;
  border: 1px solid var(--border);
  border-radius: 3px;
  min-width: 2em;
  text-align: center;
}
.pager-link {
  color: var(--link);
  text-decoration: none;
  background: white;
}
.pager-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.pager-current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.pager-gap { color: var(--fg-muted); padding: .3em .4em; }

/* ---------- 版本 diff 页 ---------- */
.diff-meta {
  background: var(--bg-box);
  padding: .8em 1em;
  border-radius: 4px;
  margin: 1em 0 1.5em;
  font-family: var(--sans);
  font-size: .9em;
  line-height: 1.6;
}
.diff-meta code { background: white; padding: 1px 4px; border-radius: 2px; }
.diff-meta .diff-summary { margin-top: .4em; color: var(--fg-muted); }
.diff-added { color: #22863a; font-weight: 600; }
.diff-removed { color: #cb2431; font-weight: 600; }
.diff-body {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
}
.diff-line {
  display: flex;
  padding: 1px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-sign {
  flex: 0 0 1.5em;
  color: var(--fg-muted);
  -webkit-user-select: none;
  user-select: none;
  text-align: center;
}
.diff-text { flex: 1; }
.diff-same { background: #fff; color: var(--fg); }
.diff-add  { background: #e6ffed; color: #22863a; }
.diff-add .diff-sign { color: #22863a; font-weight: 600; }
.diff-del  { background: #ffeef0; color: #cb2431; }
.diff-del .diff-sign { color: #cb2431; font-weight: 600; }
.sep { color: var(--border); margin: 0 .4em; }

/* ---------- All 页 ---------- */
.all-group {
  margin: 1.8em 0;
}

/* B: 折叠/展开标题 */
.all-group-header {
  font-size: 1.2em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: .2em;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  align-items: baseline;
  gap: .4em;
  list-style: none;
}
.all-group-header:hover { color: #5a0f0f; }
.all-group-header small {
  color: var(--fg-muted);
  font-weight: normal;
  font-size: .8em;
  margin-left: .3em;
}
.all-group-chevron {
  font-size: .75em;
  width: 1em;
  display: inline-block;
  text-align: center;
  color: var(--fg-muted);
}

/* B: 折叠时隐藏 body */
.all-group-body {
  overflow: hidden;
}
.all-group.is-collapsed .all-group-body {
  display: none;
}

.all-list {
  list-style: none;
  padding: 0;
  margin: .5em 0;
  columns: 2;
  column-gap: 2em;
}
.all-list li {
  padding: .25em 0;
  break-inside: avoid;
}
.all-list li[hidden] { display: none; }
.all-list li a {
  font-weight: 500;
  color: var(--link);
  text-decoration: none;
}
.all-list li a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 700px) {
  .all-list { columns: 1; }
}

/* A: 首字过滤栏 */
.firstchar-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .3em;
  margin: .6em 0 .8em;
}
.firstchar-btn {
  font-family: var(--sans);
  font-size: .82em;
  min-width: 1.9em;
  padding: .15em .4em;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-box);
  color: var(--fg-muted);
  cursor: pointer;
  text-align: center;
  transition: background .1s, color .1s;
}
.firstchar-btn:hover {
  background: #e8e2cc;
  color: var(--fg);
}
.firstchar-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- 分类页 (Category) ---------- */

.category-crumb {
  font-size: .9em;
  margin: 0 0 1em 0;
}
.category-crumb a {
  color: var(--fg-muted);
  text-decoration: none;
}
.category-crumb a:hover { color: var(--accent); text-decoration: underline; }

.category-summary {
  color: var(--fg-muted);
  font-size: .95em;
  margin: 0 0 1.5em 0;
}
.category-summary strong { color: var(--accent); }

/* ── Special:AllPages 分面浏览器 ─────────────────────────────────── */
.allpages-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5em;
  align-items: start;
}
@media (max-width: 700px) {
  .allpages-layout { grid-template-columns: 1fr; }
}

/* 移动端 AllPages */
.allpages-mobile { padding: 0; }
.ap-mobile-filters {
  display: flex;
  flex-direction: column;
  gap: .5em;
  margin-bottom: 1em;
}
.ap-type-select {
  width: 100%;
  padding: .45em .7em;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .95em;
  background: var(--bg);
  color: var(--fg);
  box-sizing: border-box;
}
.ap-type-select:focus { outline: none; border-color: var(--accent); }

/* 分面侧栏 */
.facet-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75em;
  font-size: .9em;
  position: sticky;
  top: 1em;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}
.facet-reset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .6em;
}
.facet-reset-btn {
  font-size: .8em;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: none;
  cursor: pointer;
  color: var(--fg-muted);
}
.facet-reset-btn:hover { color: var(--accent); border-color: var(--accent); }
.facet-group {
  margin-bottom: .5em;
}
.facet-group-title {
  font-weight: 600;
  font-size: .85em;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-muted);
  cursor: pointer;
  padding: .3em 0;
  list-style: none;
}
.facet-group-title::marker { display: none; }
.facet-group summary::-webkit-details-marker { display: none; }
.facet-group-title {
  -webkit-user-select: none;
  user-select: none;
}
.facet-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: .25em 0 .5em 0;
}
.facet-tags { max-height: 240px; overflow-y: auto; }
.facet-item {
  display: flex;
  align-items: center;
  gap: .4em;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.35;
}
.facet-item:hover { background: var(--bg-alt, #f8f4f0); }
.facet-item.active { background: var(--bg-alt, #f8f4f0); }
.facet-item input { accent-color: var(--accent); flex-shrink: 0; }
.facet-label { flex: 1; }
.facet-count {
  font-size: .8em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* 搜索栏 */
.allpages-search-row { margin-bottom: .8em; }
.allpages-search {
  width: 100%;
  padding: .45em .7em;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .95em;
  background: var(--bg);
  color: var(--fg);
  box-sizing: border-box;
}
.allpages-search:focus { outline: none; border-color: var(--accent); }

/* 结果列表 */
.res-header {
  font-size: .88em;
  color: var(--fg-muted);
  margin-bottom: .6em;
}
.res-header strong { color: var(--fg); }
.res-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.res-item {
  padding: .5em 0;
  border-bottom: 1px solid var(--border);
}
.res-title {
  font-weight: 500;
  text-decoration: none;
  color: var(--link, #7a1a1a);
}
.res-title:hover { text-decoration: underline; color: var(--accent); }
.res-star { margin-right: .2em; font-size: .85em; }
.res-meta {
  margin-top: .2em;
  font-size: .82em;
  color: var(--fg-muted);
  display: flex;
  flex-wrap: wrap;
  gap: .35em;
  align-items: center;
}
.res-type {
  background: var(--bg-alt, #f0ece8);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .9em;
}
.res-score { color: var(--fg-muted); }
.res-tag {
  background: var(--bg-alt, #f0ece8);
  border-radius: 3px;
  padding: 1px 5px;
}
.res-empty { color: var(--fg-muted); padding: 1.5em 0; font-style: italic; }

/* 分页 */
.pager {
  display: flex;
  gap: .3em;
  margin-top: 1em;
  flex-wrap: wrap;
  align-items: center;
}
.pager-btn, .pager-num {
  display: inline-block;
  padding: .3em .65em;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  font-size: .88em;
  color: var(--link, #7a1a1a);
  background: var(--bg);
}
.pager-btn:hover, .pager-num:hover { border-color: var(--accent); }
.pager-btn.active, .pager-num.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pager-ellipsis { color: var(--fg-muted); padding: .3em .2em; }

.category-list {
  list-style: decimal;
  padding-left: 2em;
  margin: 0;
}
.category-list li {
  padding: .45em 0;
  border-bottom: 1px solid var(--border);
}
.category-list li:last-child { border-bottom: none; }
.category-list .cat-link {
  font-size: 1.05em;
  color: var(--link);
  text-decoration: none;
  margin-right: .8em;
}
.category-list .cat-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.category-list .cat-life {
  color: var(--fg-muted);
  font-size: .85em;
  margin-right: .8em;
}
.category-list .cat-meta {
  color: var(--fg-muted);
  font-size: .85em;
  float: right;
}
.category-empty {
  color: var(--fg-muted);
  font-style: italic;
  padding: 2em 0;
  text-align: center;
}

/* ---------- 页底分类 tag (语义化) ---------- */

.entity-tags {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  display: flex;
  flex-wrap: wrap;
  gap: .5em;
  align-items: center;
}
.entity-tags .tag-label {
  color: var(--fg-muted);
  font-size: .85em;
  margin-right: .3em;
}
.entity-tags .tag {
  display: inline-block;
  padding: .25em .75em;
  background: var(--bg-box);
  color: var(--fg);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: .85em;
  text-decoration: none;
  transition: all .12s;
}
.entity-tags .tag:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.entity-tags .tag.tag-type {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.entity-tags .tag.tag-type:hover {
  background: var(--accent);
  color: white;
}

/* ---------- 旧版列表 (404 页等复用) ---------- */

.page-list { list-style: none; padding: 0; }
.page-list li { padding: .3em 0; }
.type-tag {
  display: inline-block;
  min-width: 3em;
  padding: 1px 6px;
  margin-right: .6em;
  font-size: .8em;
  background: var(--bg-box);
  color: var(--fg-muted);
  border-radius: 3px;
  text-align: center;
  font-family: var(--sans);
}

.loading { color: var(--fg-muted); font-style: italic; }
.error { color: var(--link-broken); }

footer {
  max-width: 1440px;
  margin: 3em auto 2em;
  padding: 1em 1.2em;
  color: var(--fg-muted);
  font-family: var(--sans);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
footer code {
  background: var(--bg-box);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--link-broken);
  margin-right: 4px;
}

/* —— 反向引用 —— */
.backlinks {
  margin-top: 2em; padding-top: .8em;
  border-top: 1px solid var(--border);
  font-family: var(--sans); font-size: 13px;
}
.bl-heading {
  font-size: 13px; font-weight: 600;
  color: var(--fg-muted); margin: 0 0 .5em;
  text-transform: none; letter-spacing: 0;
  border: none; padding: 0;
}
.bl-body {
  display: flex; flex-wrap: wrap; gap: .4em .8em;
  line-height: 1.8;
}
.bl-group {
  display: inline-flex; align-items: baseline; gap: .3em; flex-wrap: wrap;
}
.bl-group-label {
  font-size: 11px; color: var(--fg-muted);
  background: var(--bg-box); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px;
  white-space: nowrap;
}
.bl-link {
  color: var(--link); text-decoration: none; font-size: 13px;
}
.bl-link:hover { text-decoration: underline; }

/* —— 修订/历史相关 —— */
.topnav-link {
  color: var(--link); text-decoration: none;
  font-family: var(--sans); font-size: 13px;
}
.topnav-link:hover { text-decoration: underline; }

.page-history-link {
  margin-top: 2em; padding-top: .8em;
  border-top: 1px dashed var(--border);
  font-family: var(--sans); font-size: 13px;
  color: var(--fg-muted);
}
.page-history-link a { color: var(--link); text-decoration: none; }
.page-history-link a:hover { text-decoration: underline; }

.recent-changes {
  width: 100%; border-collapse: collapse;
  font-family: var(--sans); font-size: 14px;
  margin-top: 1em;
}
.recent-changes th, .recent-changes td {
  text-align: left; padding: .5em .8em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.recent-changes th {
  background: var(--bg-box); font-weight: 600;
}
.recent-changes .rc-time { white-space: nowrap; color: var(--fg-muted); width: 11em; }
.recent-changes .rc-page { font-weight: 500; }
.recent-changes .rc-author { color: var(--fg-muted); width: 7em; }
.recent-changes .rc-size { color: var(--fg-muted); white-space: nowrap; width: 5em; }
.recent-changes .rc-rev { font-family: ui-monospace, monospace; font-size: 12px; white-space: nowrap; }
.recent-changes a { color: var(--link); text-decoration: none; }
.recent-changes a:hover { text-decoration: underline; }

.rev-badge {
  background: var(--accent); color: #fff;
  padding: 1px 6px; border-radius: 2px;
  font-size: 11px; font-family: var(--sans);
}

.rev-banner {
  background: #fff8e1; border-left: 4px solid #d4a017;
  padding: .8em 1em; margin-bottom: 1.5em;
  font-family: var(--sans); font-size: 14px;
}
.rev-banner code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 2px; }
.rev-banner a { color: var(--link); margin-left: .5em; }

/* 知识量仪表板 (主页 footer, v8) */
.k-panel {
  margin-top: 2.5em;
  padding: 1.1em 1.3em;
  border-top: 2px solid var(--accent);
  background: #fbfaf5;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
}
.k-panel h3 {
  margin: 0 0 .6em 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-muted);
}
.k-panel .k-value {
  font-size: 20px;
  color: var(--accent);
  font-weight: 700;
  font-family: ui-monospace, monospace;
  margin-left: .4em;
}
.k-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4em;
  margin-bottom: .3em;
}
.k-row.k-top { gap: .5em; align-items: baseline; }
.k-row.muted { font-size: 12px; color: var(--fg-muted); margin-top: .5em; }
.k-row a { color: var(--link); text-decoration: none; }
.k-row a:hover { text-decoration: underline; }

/* Hero image (精品页可选) */
.hero-image {
  margin: 0 0 1.5em 0;
  padding: 0;
}
.hero-image img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.hero-image figcaption {
  margin-top: .4em;
  font-size: 13px;
  color: var(--fg-muted);
  font-family: var(--sans);
  font-style: italic;
}
.hero-image .credit {
  font-size: 12px;
  opacity: .8;
}


/* K sparkline (提案 25) */
.k-spark {
  vertical-align: middle;
  margin-left: .8em;
  opacity: .85;
}

/* 源码查看面板 */
.src-link { color: var(--fg-muted); font-size: 13px; }
/* 标题右侧 "查看源码" 标签 */
.src-tab {
  float: right;
  font-size: 13px;
  font-weight: normal;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 2px 10px;
  text-decoration: none;
  background: var(--bg-box);
  position: relative;
  top: 4px;
}
.src-tab:hover { color: var(--accent); border-color: var(--accent); }
.hist-tab { margin-right: 6px; }
.orig-tab {
  float: right;
  font-size: 13px;
  font-weight: normal;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 2px 10px;
  text-decoration: none;
  background: var(--bg-box);
  position: relative;
  top: 4px;
  margin-right: 6px;
}
.orig-tab:hover { color: #c0392b; border-color: #c0392b; }
/* 专用源码页 */
.src-view-title { margin-bottom: 0.2em; }
.src-view-badge {
  font-size: 0.5em; font-weight: normal;
  background: var(--bg-box); border: 1px solid var(--border);
  border-radius: 3px; padding: 2px 6px;
  color: var(--fg-muted); vertical-align: middle;
}
.src-pre {
  margin: 0;
  padding: 1em;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono, monospace);
}

.k-title-link { color: inherit; text-decoration: none; }
.k-title-link:hover { text-decoration: underline; color: var(--accent); }

/* Special: 系统页 */
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th, .settings-table td { padding: .6em .8em; border-bottom: 1px solid var(--border); vertical-align: top; }
.toggle-label { cursor: pointer; display: flex; align-items: center; gap: .4em; justify-content: center; }
.toggle-label input { width: 1.1em; height: 1.1em; cursor: pointer; }

/* K 值页 */
.k-stat-bar {
  display: flex; gap: 1.5em; flex-wrap: wrap;
  margin: 1.2em 0 2em;
}
.k-stat {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-box); border: 1px solid var(--border);
  border-radius: 8px; padding: 1em 1.5em; min-width: 100px;
}
.k-stat-val { font-size: 2em; font-weight: 700; color: var(--accent); line-height: 1.1; }
.k-stat-label { font-size: 0.78em; color: var(--fg-muted); margin-top: .3em; }
.k-chart-wrap {
  background: var(--bg-box); border: 1px solid var(--border);
  border-radius: 8px; padding: 1em; margin: 0.5em 0 1.5em;
}
.chart-desc {
  margin: 0.2em 0 0.5em;
  font-size: 0.92em;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ── 想要按钮 (仅 localhost 显示) ─────────────────── */
.want-btn {
  display: inline-flex; align-items: center; gap: .4em;
  margin: 2em 0 1em;
  padding: .55em 1.2em;
  background: var(--bg-box);
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: .9em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.want-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.want-btn:disabled { cursor: default; }
.want-btn--done    { border-color: #2e7d32; color: #2e7d32; }
.want-btn--exists  { border-color: var(--fg-muted); color: var(--fg-muted); }
