:root {
  color-scheme: light;
  --font-scale: 1;
  --page: #f5f5f7;
  --page-elevated: #fbfbfd;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-muted: rgba(246, 246, 248, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.16);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.10);
  --cyan: #20a4f3;
  --indigo: #5856d6;
  --purple: #8e5af7;
  --gold: #b77a24;
  --red: #d92d20;
  --green: #16803d;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 8px 24px rgba(0,0,0,.06);
  --shadow-md: 0 18px 50px rgba(0,0,0,.10);
  --shadow-lg: 0 28px 90px rgba(0,0,0,.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --nav-h: 52px;
  --content-max: 780px;
  --layout-max: 1480px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-serif: "New York", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000;
  --page-elevated: #0c0c0d;
  --surface: rgba(28, 28, 30, 0.76);
  --surface-solid: #1c1c1e;
  --surface-muted: rgba(44, 44, 46, 0.76);
  --surface-strong: rgba(30, 30, 32, 0.94);
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #8e8e93;
  --line: rgba(255,255,255,.11);
  --line-strong: rgba(255,255,255,.19);
  --blue: #2997ff;
  --blue-hover: #40a9ff;
  --blue-soft: rgba(41,151,255,.15);
  --gold: #d5a24a;
  --red: #ff6961;
  --green: #4cd964;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.24);
  --shadow-sm: 0 10px 28px rgba(0,0,0,.28);
  --shadow-md: 0 22px 62px rgba(0,0,0,.36);
  --shadow-lg: 0 34px 110px rgba(0,0,0,.50);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); font-size: calc(16px * var(--font-scale)); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(0,113,227,.10), transparent 32rem),
    radial-gradient(circle at 88% 2%, rgba(142,90,247,.08), transparent 28rem),
    var(--page);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(127,127,127,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(127,127,127,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration-thickness: .08em; text-underline-offset: .18em; }
button, input, select { font: inherit; }
button { color: inherit; }
::selection { background: rgba(0,113,227,.20); }

.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 2000;
  background: var(--surface-solid); color: var(--text); padding: 10px 14px;
  border-radius: 10px; box-shadow: var(--shadow-md); transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

.reading-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 1500; pointer-events: none;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  transform: scaleX(0); transform-origin: left center;
}

.global-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 1000; height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background: rgba(250,250,252,.72);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}
html[data-theme="dark"] .global-nav { background: rgba(0,0,0,.70); }
.global-nav__inner {
  width: min(calc(100% - 32px), 1180px); height: 100%; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; min-width: max-content;
}
.brand-mark {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px;
  color: #fff; font-weight: 750; font-size: 14px; letter-spacing: -.03em;
  background: linear-gradient(145deg, #52b6ff, #006edc 56%, #5546d8);
  box-shadow: 0 5px 14px rgba(0,113,227,.28), inset 0 1px 0 rgba(255,255,255,.45);
}
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.global-tabs { display: flex; align-items: center; justify-content: center; gap: 2px; }
.global-tabs a {
  color: var(--text-secondary); text-decoration: none; font-size: 12px; font-weight: 520;
  padding: 7px 10px; border-radius: 999px; transition: color .18s ease, background .18s ease;
}
.global-tabs a:hover, .global-tabs a[aria-current="page"] { color: var(--text); background: var(--surface-muted); }
.nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.icon-button, .pill-button {
  border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, color .18s ease;
}
.icon-button { width: 34px; height: 34px; border-radius: 50%; color: var(--text-secondary); }
.icon-button:hover { color: var(--text); background: var(--surface-muted); }
.icon-button:active, .pill-button:active { transform: scale(.96); }
.icon-button svg, .pill-button svg, .tool-button svg, .sidebar-link svg, .search-shortcut svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.search-shortcut {
  min-width: 168px; height: 34px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--text-secondary);
  background: var(--surface-muted); cursor: pointer; text-align: left;
}
.search-shortcut .label { font-size: 12px; flex: 1; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px;
  color: var(--text-tertiary); background: var(--surface-solid); font: 10px/1 var(--font-sans); box-shadow: var(--shadow-xs);
}
.mobile-menu-button { display: none; }

.wiki-layout {
  width: min(calc(100% - 48px), var(--layout-max)); margin: 0 auto; padding: calc(var(--nav-h) + 32px) 0 64px;
  display: grid; grid-template-columns: 236px minmax(0, 840px) 224px; gap: 28px; align-items: start;
}
body.page-home .wiki-layout { grid-template-columns: 220px minmax(0, 1fr); max-width: 1380px; }
body.page-home .right-rail { display: none; }
.left-sidebar, .right-rail { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow: auto; scrollbar-width: thin; }
.left-sidebar { padding: 6px 0 20px; }
.sidebar-section + .sidebar-section { margin-top: 24px; }
.sidebar-label { font-size: 11px; color: var(--text-tertiary); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; padding: 0 12px 7px; }
.sidebar-list { display: grid; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: 11px;
  color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 520;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sidebar-link:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-link[aria-current="page"] { color: var(--text); background: var(--surface-solid); box-shadow: var(--shadow-xs); }
.sidebar-link svg { width: 17px; height: 17px; flex: 0 0 17px; }
.sidebar-link .count { margin-left: auto; color: var(--text-tertiary); font-size: 11px; }
.sidebar-card {
  padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-xs); font-size: 12px; color: var(--text-secondary);
}
.sidebar-card strong { color: var(--text); display: block; margin-bottom: 4px; }
.sidebar-mini-list { display: grid; gap: 8px; margin-top: 10px; }
.sidebar-mini-list a { color: var(--text-secondary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-mini-list a:hover { color: var(--blue); }
.sidebar-empty { color: var(--text-tertiary); }

.wiki-main { min-width: 0; }
.article-chrome { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; }
.breadcrumbs { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text-tertiary); font-size: 12px; }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs .current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-tools { display: flex; align-items: center; gap: 6px; }
.tool-button {
  height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-secondary);
  cursor: pointer; font-size: 12px; box-shadow: var(--shadow-xs); transition: all .16s ease;
}
.tool-button:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-solid); }
.tool-button.is-active { color: var(--blue); background: var(--blue-soft); border-color: rgba(0,113,227,.2); }
.tool-button .tool-label { display: none; }

.wiki-article {
  min-width: 0; padding: clamp(26px, 4.5vw, 58px); border: 1px solid var(--line); border-radius: var(--radius-xl);
  background: var(--surface-strong); box-shadow: var(--shadow-sm); overflow: hidden;
}
.article-hero { margin: -6px 0 42px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.article-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .04em; margin-bottom: 13px; }
.article-hero h1 { margin: 0; max-width: 18ch; font-size: clamp(36px, 6vw, 62px); line-height: 1.04; letter-spacing: -.045em; font-weight: 720; }
.article-tagline { margin: 16px 0 0; max-width: 46rem; color: var(--text-secondary); font-size: 16px; line-height: 1.65; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 20px; color: var(--text-tertiary); font-size: 12px; }
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.wiki-article h2, .wiki-article h3, .wiki-article h4 { color: var(--text); scroll-margin-top: calc(var(--nav-h) + 22px); position: relative; }
.wiki-article h2 { margin: 56px 0 20px; font-size: clamp(26px, 3.8vw, 36px); line-height: 1.18; letter-spacing: -.028em; font-weight: 710; }
.wiki-article h2:first-of-type { margin-top: 0; }
.wiki-article h2::after { content: ""; display: block; width: 42px; height: 3px; margin-top: 13px; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--purple)); }
.wiki-article h3 { margin: 38px 0 14px; font-size: 21px; line-height: 1.3; letter-spacing: -.016em; font-weight: 690; }
.wiki-article h4 { margin: 24px 0 8px; font-size: 16px; line-height: 1.4; font-weight: 680; }
.wiki-article .ch-num { display: inline-flex; align-items: center; margin-right: 8px; color: var(--blue); font-family: var(--font-mono); font-size: .42em; vertical-align: .25em; letter-spacing: .02em; }
.wiki-article p { margin: 12px 0; color: var(--text); }
.wiki-article li { margin: 6px 0; }
.wiki-article ul, .wiki-article ol { padding-left: 1.45rem; }
.wiki-article strong { font-weight: 680; }
.wiki-article blockquote { margin: 24px 0; padding: 18px 22px; border-left: 3px solid var(--blue); background: var(--blue-soft); border-radius: 0 14px 14px 0; color: var(--text-secondary); }
.wiki-article hr { border: 0; border-top: 1px solid var(--line); margin: 38px 0; }
.anchor-copy {
  opacity: 0; position: absolute; left: -27px; top: .15em; border: 0; background: none; color: var(--text-tertiary); cursor: pointer; padding: 4px;
  transition: opacity .16s ease, color .16s ease;
}
.wiki-article h2:hover .anchor-copy, .wiki-article h3:hover .anchor-copy, .anchor-copy:focus { opacity: 1; }
.anchor-copy:hover { color: var(--blue); }

.entry-card, .relation-card, .def-box, .cross-ref, .note-box {
  border: 1px solid var(--line); background: var(--surface-muted); border-radius: var(--radius-md);
}
.entry-card { margin: 16px 0; padding: 20px 22px; box-shadow: var(--shadow-xs); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.entry-card:hover { transform: translateY(-1px); border-color: var(--line-strong); background: var(--surface-solid); }
.entry-card h4 { margin-top: 0; font-size: 17px; }
.entry-card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--text-tertiary); font-size: 12px; margin: -2px 0 10px; }
.entry-card .meta span { display: inline-flex; gap: 4px; }
.def-box { margin: 18px 0; padding: 18px 20px; border-left: 4px solid var(--blue); background: var(--blue-soft); }
.def-box .term { color: var(--blue); font-weight: 700; margin-right: 4px; }
.def-box .also { margin-top: 7px; font-size: 12px; color: var(--text-tertiary); }
.cross-ref { margin: 18px 0; padding: 14px 16px; color: var(--text-secondary); font-size: 13px; }
.cross-ref::before { content: "关联词条"; display: block; color: var(--blue); font-weight: 700; font-size: 11px; letter-spacing: .04em; margin-bottom: 3px; }
.relation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px,100%), 1fr)); gap: 12px; margin: 18px 0; }
.relation-card { padding: 17px 18px; transition: border-color .18s ease, transform .18s ease; }
.relation-card:hover { border-color: rgba(0,113,227,.35); transform: translateY(-2px); }
.relation-card .rel-title { font-weight: 690; margin-bottom: 5px; }
.relation-card .rel-body { color: var(--text-secondary); font-size: 13px; }

.tag { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 720; letter-spacing: .03em; }
.tag.gold { background: rgba(183,122,36,.12); color: var(--gold); }
.tag.warn { background: rgba(217,45,32,.10); color: var(--red); }

.table-wrap { width: 100%; overflow: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-solid); scrollbar-width: thin; }
table.wiki-table { width: 100%; min-width: 580px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.wiki-table th { position: sticky; top: 0; z-index: 1; padding: 12px 14px; background: var(--surface-solid); border-bottom: 1px solid var(--line-strong); text-align: left; color: var(--text-secondary); font-size: 11px; letter-spacing: .03em; font-weight: 700; }
table.wiki-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.wiki-table tr:last-child td { border-bottom: 0; }
table.wiki-table tbody tr:hover td, table.wiki-table tr:hover td { background: var(--surface-muted); }

.diagram { margin: 24px 0; padding: 18px; overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-solid); }
.diagram figcaption { margin-bottom: 14px; color: var(--text-tertiary); font-size: 12px; }
.diagram .mermaid { display: flex; justify-content: center; min-width: 620px; }
.diagram svg { max-width: 100%; height: auto; }

.detail-btn-wrap { display: flex; justify-content: flex-end; margin: 14px 0 30px; }
.detail-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); text-decoration: none; font-size: 12px; font-weight: 680; transition: transform .18s ease, background .18s ease; }
.detail-btn:hover { transform: translateX(2px); background: rgba(0,113,227,.16); }

.article-end { margin-top: 54px; padding-top: 28px; border-top: 1px solid var(--line); }
.article-end__heading { margin: 0 0 13px; font-size: 15px; font-weight: 680; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.related-link { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface-muted); text-decoration: none; transition: transform .18s ease, border-color .18s ease; }
.related-link:hover { transform: translateY(-2px); border-color: rgba(0,113,227,.35); }
.related-link small { display: block; color: var(--text-tertiary); margin-top: 3px; }

.right-rail { padding: 8px 0 20px; }
.toc-card { padding: 16px 0 14px; }
.toc-title { padding: 0 12px 9px; color: var(--text-tertiary); font-size: 11px; font-weight: 720; letter-spacing: .06em; text-transform: uppercase; }
.toc-list { display: grid; gap: 1px; max-height: calc(100vh - 170px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.toc-list a { display: block; padding: 6px 10px; border-left: 2px solid transparent; color: var(--text-tertiary); text-decoration: none; font-size: 12px; line-height: 1.35; border-radius: 0 8px 8px 0; transition: all .16s ease; }
.toc-list a:hover { color: var(--text); background: var(--surface-muted); }
.toc-list a.level-3 { padding-left: 20px; font-size: 11px; }
.toc-list a.is-active { color: var(--blue); border-left-color: var(--blue); background: var(--blue-soft); }
.toc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 10px 0; }
.toc-actions button { height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-secondary); font-size: 11px; cursor: pointer; }
.toc-actions button:hover { color: var(--text); background: var(--surface-solid); }
.mobile-toc { display: none; }

/* Homepage */
.home-main { min-width: 0; }
.home-hero {
  position: relative; min-height: min(660px, 72vh); overflow: hidden; border-radius: 38px; color: #fff;
  box-shadow: var(--shadow-lg); isolation: isolate; background: #10233d;
}
.home-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, rgba(3,10,22,.82) 0%, rgba(3,10,22,.55) 43%, rgba(3,10,22,.12) 78%), linear-gradient(0deg, rgba(3,8,18,.52), transparent 55%); }
.home-hero__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 64% center; z-index: -2; transform: scale(1.015); }
.home-hero__content { position: relative; min-height: inherit; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(28px, 6vw, 72px); max-width: 780px; }
.hero-kicker { display: inline-flex; width: fit-content; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.26); border-radius: 999px; background: rgba(255,255,255,.12); backdrop-filter: blur(12px); font-size: 11px; font-weight: 650; letter-spacing: .03em; }
.home-hero h1 { margin: 20px 0 0; font-size: clamp(58px, 9vw, 112px); line-height: .94; letter-spacing: -.065em; font-weight: 730; text-shadow: 0 8px 34px rgba(0,0,0,.24); }
.home-hero__subtitle { margin: 22px 0 0; max-width: 610px; font-size: clamp(16px, 2vw, 21px); line-height: 1.55; color: rgba(255,255,255,.88); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 680; transition: transform .18s ease, background .18s ease; }
.hero-button:hover { transform: translateY(-1px); }
.hero-button.primary { color: #0b0b0c; background: #fff; }
.hero-button.secondary { color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(12px); }
.hero-stats { position: absolute; right: clamp(24px, 4vw, 50px); bottom: clamp(24px, 4vw, 48px); display: grid; grid-template-columns: repeat(2, 110px); gap: 10px; }
.hero-stat { padding: 14px; border-radius: 18px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(18px); }
.hero-stat strong { display: block; font-size: 25px; line-height: 1; letter-spacing: -.03em; }
.hero-stat span { display: block; margin-top: 5px; color: rgba(255,255,255,.72); font-size: 10px; }

.home-section { margin-top: 56px; }
.home-section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 4px 20px; }
.home-section__head h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
.home-section__head p { margin: 8px 0 0; color: var(--text-secondary); }
.section-link { color: var(--blue); text-decoration: none; font-size: 13px; white-space: nowrap; }
.bento-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 16px; }
.bento-card { position: relative; grid-column: span 4; min-height: 250px; overflow: hidden; padding: 26px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface-strong); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease; }
.bento-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(0,113,227,.25); }
.bento-card.large { grid-column: span 8; min-height: 380px; }
.bento-card.tall { min-height: 380px; }
.bento-card.wide { grid-column: span 6; }
.bento-card__num { color: var(--text-tertiary); font: 11px/1 var(--font-mono); }
.bento-card h3 { margin: 14px 0 7px; font-size: 25px; line-height: 1.12; letter-spacing: -.025em; }
.bento-card p { margin: 0; max-width: 34rem; color: var(--text-secondary); font-size: 13px; }
.bento-card__arrow { position: absolute; right: 22px; bottom: 20px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-muted); color: var(--blue); transition: transform .2s ease; }
.bento-card:hover .bento-card__arrow { transform: translate(2px,-2px); }
.bento-card__orb { position: absolute; width: 190px; height: 190px; right: -48px; bottom: -64px; border-radius: 50%; filter: blur(1px); opacity: .9; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(0,113,227,.36) 32%, rgba(88,86,214,.15) 68%, transparent 70%); }
.bento-card[data-tone="purple"] .bento-card__orb { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(142,90,247,.42) 32%, rgba(88,86,214,.14) 68%, transparent 70%); }
.bento-card[data-tone="gold"] .bento-card__orb { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(210,149,54,.42) 32%, rgba(183,122,36,.12) 68%, transparent 70%); }
.bento-card.featured { color: #fff; background: linear-gradient(135deg, #071b38, #113d72 52%, #362e86); border-color: rgba(255,255,255,.15); }
.bento-card.featured p, .bento-card.featured .bento-card__num { color: rgba(255,255,255,.72); }
.bento-card.featured .bento-card__arrow { color: #fff; background: rgba(255,255,255,.14); }
.feature-graphic { position: absolute; width: 310px; height: 310px; right: -30px; bottom: -60px; border-radius: 50%; background: radial-gradient(circle at 44% 42%, #bce8ff 0 2%, #5fc2ff 3% 7%, rgba(70,176,255,.70) 9% 12%, rgba(75,100,244,.30) 28%, transparent 62%), repeating-radial-gradient(circle, rgba(255,255,255,.20) 0 1px, transparent 1px 22px); box-shadow: 0 0 90px rgba(66,157,255,.42); }
.feature-graphic::before, .feature-graphic::after { content: ""; position: absolute; inset: 30px; border: 1px solid rgba(255,255,255,.30); border-radius: 50%; transform: rotate(17deg) scaleY(.42); }
.feature-graphic::after { transform: rotate(-35deg) scaleY(.62); }

.utility-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.utility-card { min-height: 150px; padding: 20px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-xs); }
.utility-card h3 { margin: 0 0 6px; font-size: 16px; }
.utility-card p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.utility-card button, .utility-card a { display: inline-flex; margin-top: 16px; color: var(--blue); background: transparent; border: 0; padding: 0; cursor: pointer; text-decoration: none; font-size: 12px; font-weight: 650; }
.recent-home-list { display: grid; gap: 9px; margin-top: 14px; }
.recent-home-list a { display: flex; justify-content: space-between; gap: 10px; color: var(--text); text-decoration: none; font-size: 12px; }
.recent-home-list span { color: var(--text-tertiary); }

/* Directory / system pages */
.directory-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 24px; }
.directory-search { flex: 1 1 260px; height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--text); background: var(--surface-muted); outline: none; }
.directory-search:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip { border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); padding: 7px 11px; cursor: pointer; font-size: 11px; }
.filter-chip.is-active { background: var(--text); color: var(--page); border-color: var(--text); }
.article-directory { display: grid; gap: 10px; }
.directory-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); text-decoration: none; color: var(--text); }
.directory-item:hover { border-color: rgba(0,113,227,.34); background: var(--surface-solid); }
.directory-item strong { display: block; }
.directory-item p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; }
.directory-item .directory-category { align-self: start; color: var(--text-tertiary); font-size: 11px; }
.change-list { display: grid; gap: 14px; }
.change-item { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.change-date { color: var(--text-tertiary); font: 11px/1.5 var(--font-mono); }
.change-item h3 { margin: 0 0 5px; font-size: 16px; }
.change-item p { margin: 0; color: var(--text-secondary); font-size: 13px; }

/* Search dialog */
.modal-backdrop { position: fixed; inset: 0; z-index: 1800; display: none; place-items: start center; padding: 8vh 20px 20px; background: rgba(0,0,0,.26); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.modal-backdrop.is-open { display: grid; }
.search-dialog { width: min(680px, 100%); max-height: min(720px, 84vh); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface-strong); box-shadow: var(--shadow-lg); animation: dialogIn .18s ease-out; }
@keyframes dialogIn { from { opacity: 0; transform: translateY(-12px) scale(.985); } to { opacity: 1; transform: none; } }
.search-dialog__input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.search-dialog__input-wrap svg { width: 22px; height: 22px; color: var(--text-tertiary); fill: none; stroke: currentColor; stroke-width: 1.8; }
.search-dialog input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 18px; }
.search-dialog__results { max-height: 570px; overflow: auto; padding: 9px; scrollbar-width: thin; }
.search-result { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px; border-radius: 13px; color: var(--text); text-decoration: none; }
.search-result:hover, .search-result.is-selected { background: var(--blue-soft); }
.search-result__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--blue); background: var(--surface-muted); font-size: 14px; font-weight: 700; }
.search-result strong { display: block; font-size: 13px; }
.search-result p { margin: 2px 0 0; color: var(--text-secondary); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result__category { color: var(--text-tertiary); font-size: 10px; }
.search-empty { padding: 46px 24px; text-align: center; color: var(--text-secondary); }
.search-empty strong { display: block; color: var(--text); margin-bottom: 5px; }
.search-dialog__footer { display: flex; gap: 14px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--text-tertiary); font-size: 10px; }
.search-dialog__footer span { display: inline-flex; align-items: center; gap: 5px; }
mark { background: rgba(255,204,0,.32); color: inherit; border-radius: 3px; padding: 0 1px; }

.settings-popover { position: fixed; z-index: 1700; top: 58px; right: max(16px, calc((100vw - 1180px)/2)); width: 290px; display: none; padding: 16px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface-strong); box-shadow: var(--shadow-md); backdrop-filter: blur(24px); }
.settings-popover.is-open { display: block; animation: popIn .16s ease-out; }
@keyframes popIn { from { opacity: 0; transform: translateY(-7px) scale(.98); } to { opacity: 1; transform: none; } }
.settings-row + .settings-row { margin-top: 16px; }
.settings-label { display: block; color: var(--text-secondary); font-size: 11px; font-weight: 650; margin-bottom: 8px; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-muted); }
.segmented button { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 11px; }
.segmented button.is-active { color: var(--text); background: var(--surface-solid); box-shadow: var(--shadow-xs); }

.mobile-drawer { position: fixed; inset: var(--nav-h) auto 0 0; z-index: 1200; width: min(340px, 88vw); padding: 18px; overflow: auto; background: var(--surface-strong); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(-104%); transition: transform .26s cubic-bezier(.2,.8,.2,1); backdrop-filter: blur(24px); }
.mobile-drawer.is-open { transform: none; }
.drawer-scrim { position: fixed; inset: var(--nav-h) 0 0; z-index: 1190; display: none; background: rgba(0,0,0,.28); }
.drawer-scrim.is-open { display: block; }

.toast { position: fixed; z-index: 2100; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 10px 14px; border-radius: 999px; background: var(--text); color: var(--page); box-shadow: var(--shadow-md); font-size: 12px; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }

.site-footer { width: min(calc(100% - 48px), var(--layout-max)); margin: 0 auto; padding: 0 0 48px; color: var(--text-tertiary); font-size: 11px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--blue); }

.reveal { opacity: 0; transform: translateY(13px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.8,.2,1); }
.reveal.is-visible { opacity: 1; transform: none; }
body.is-focus .left-sidebar, body.is-focus .right-rail, body.is-focus .article-chrome { display: none; }
body.is-focus .wiki-layout { display: block; width: min(calc(100% - 32px), 900px); }
body.is-focus .wiki-article { box-shadow: none; }

@media (max-width: 1180px) {
  .wiki-layout { grid-template-columns: 220px minmax(0, 1fr); max-width: 1160px; }
  .right-rail { display: none; }
  .mobile-toc { display: block; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
  .mobile-toc summary { cursor: pointer; padding: 12px 14px; font-size: 12px; color: var(--text-secondary); font-weight: 650; }
  .mobile-toc .toc-list { max-height: 300px; padding: 0 10px 10px; }
  .hero-stats { display: none; }
}

@media (max-width: 900px) {
  .global-tabs { display: none; }
  .global-nav__inner { grid-template-columns: auto 1fr auto; }
  .brand { justify-self: center; }
  .brand-name { display: none; }
  .mobile-menu-button { display: inline-flex; justify-self: start; }
  .nav-actions { justify-self: end; }
  .search-shortcut { min-width: 34px; width: 34px; padding: 0; justify-content: center; border-radius: 50%; background: transparent; border-color: transparent; }
  .search-shortcut .label, .search-shortcut kbd { display: none; }
  .wiki-layout, body.page-home .wiki-layout { display: block; width: min(calc(100% - 28px), 840px); padding-top: calc(var(--nav-h) + 22px); }
  .left-sidebar { display: none; }
  .home-hero { border-radius: 28px; min-height: 620px; }
  .home-hero__content { justify-content: flex-end; }
  .bento-card, .bento-card.large, .bento-card.wide { grid-column: span 6; }
  .utility-grid { grid-template-columns: 1fr 1fr; }
  .site-footer { width: min(calc(100% - 28px), 840px); }
}

@media (max-width: 640px) {
  html { font-size: calc(15.5px * var(--font-scale)); }
  body::before { display: none; }
  .global-nav__inner { width: calc(100% - 20px); }
  .wiki-layout, body.page-home .wiki-layout { width: calc(100% - 20px); padding-bottom: 38px; }
  .article-chrome { margin-bottom: 8px; }
  .breadcrumbs { font-size: 11px; }
  .article-tools .tool-button:nth-child(n+4) { display: none; }
  .wiki-article { padding: 24px 20px 32px; border-radius: 24px; }
  .article-hero { margin-top: 0; margin-bottom: 32px; }
  .article-hero h1 { font-size: 38px; }
  .article-tagline { font-size: 14px; }
  .anchor-copy { display: none; }
  .entry-card { padding: 17px; }
  .related-grid { grid-template-columns: 1fr; }
  .home-hero { min-height: 560px; border-radius: 24px; }
  .home-hero::after { background: linear-gradient(0deg, rgba(3,10,22,.90), rgba(3,10,22,.18) 80%); }
  .home-hero__image { object-position: 68% center; }
  .home-hero__content { padding: 26px 22px; }
  .home-hero h1 { font-size: 58px; }
  .home-hero__subtitle { font-size: 15px; }
  .home-section { margin-top: 42px; }
  .home-section__head { align-items: flex-start; }
  .home-section__head h2 { font-size: 30px; }
  .bento-grid { gap: 11px; }
  .bento-card, .bento-card.large, .bento-card.wide { grid-column: span 12; min-height: 210px; padding: 22px; border-radius: 22px; }
  .bento-card.large { min-height: 330px; }
  .utility-grid { grid-template-columns: 1fr; }
  .search-dialog { border-radius: 20px; }
  .modal-backdrop { padding: 12px; place-items: start center; }
  .settings-popover { top: 58px; left: 12px; right: 12px; width: auto; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .change-item { grid-template-columns: 1fr; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  :root { --page: #fff; --surface-strong: #fff; --text: #000; --text-secondary: #333; --line: #ddd; }
  body { background: #fff; }
  .global-nav, .left-sidebar, .right-rail, .article-chrome, .mobile-toc, .article-end, .site-footer, .reading-progress { display: none !important; }
  .wiki-layout { display: block; width: 100%; padding: 0; }
  .wiki-article { border: 0; box-shadow: none; padding: 0; }
  .entry-card, .relation-card, .diagram { break-inside: avoid; }
}

/* Legacy content modules retained by the rebuilt article templates */
.quote-box {
  margin: 18px 0; padding: 16px 20px; border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0; background: rgba(183,122,36,.08);
  color: var(--text-secondary); font-family: var(--font-serif); font-style: italic;
}
.continent-grid, .continent-row, .risk-grid, .sacrifice-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px,100%), 1fr)); gap: 12px; margin: 18px 0;
}
.continent-card, .continent-mini, .risk-card, .sacrifice-card {
  padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-muted);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.continent-card:hover, .continent-mini:hover, .risk-card:hover, .sacrifice-card:hover {
  transform: translateY(-2px); border-color: rgba(0,113,227,.30); background: var(--surface-solid);
}
.continent-card .c-name, .continent-mini .cm-name, .risk-card .rc-title, .sacrifice-card .sc-title { font-weight: 700; color: var(--text); margin-bottom: 5px; }
.continent-card .c-epithet { color: var(--gold); font-size: 12px; font-style: italic; margin-bottom: 9px; }
.continent-card .c-info, .continent-mini .cm-text, .risk-card .rc-body, .sacrifice-card .sc-body { color: var(--text-secondary); font-size: 13px; }
.continent-mini .cm-status { color: var(--red); font-size: 11px; font-weight: 700; }
.continent-card .c-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.sacrifice-card .sc-title { color: var(--red); }
.causal-chain {
  margin: 20px 0; padding: 20px; border: 1px solid rgba(0,113,227,.25); border-radius: 18px;
  background: var(--blue-soft); font-size: 13px; line-height: 2.15;
}
.causal-chain .step { display: inline-block; padding: 3px 9px; border-radius: 8px; background: var(--surface-solid); font-weight: 650; box-shadow: var(--shadow-xs); }
.causal-chain .arrow { color: var(--gold); font-weight: 800; margin: 0 5px; }
.premise-box {
  margin: 20px 0; padding: 20px; border: 1px solid rgba(217,45,32,.30); border-radius: 18px; background: rgba(217,45,32,.07);
}
.premise-box h4 { color: var(--red); margin-top: 0; }
.timeline-nav {
  position: sticky; top: calc(var(--nav-h) + 8px); z-index: 20; display: flex; gap: 7px; flex-wrap: wrap;
  margin: 24px -8px; padding: 10px 8px; border-radius: 14px; background: var(--surface-strong); backdrop-filter: blur(18px);
}
.timeline-nav a { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); color: var(--text-secondary); text-decoration: none; font-size: 11px; font-weight: 650; }
.timeline-nav a:hover, .timeline-nav a.active { border-color: var(--blue); background: var(--blue); color: white; }
.time-period { margin: 28px 0; padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-muted); }
.time-period .tp-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.time-period .tp-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: var(--blue-soft); font-size: 24px; }
.time-period .tp-title { font-size: 18px; font-weight: 720; }
.time-period .tp-sub { color: var(--text-tertiary); font-size: 12px; font-style: italic; }
.judge-grid { display: grid; grid-template-columns: 124px minmax(0,1fr); margin: 16px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; }
.judge-grid .jg-label, .judge-grid .jg-content { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.judge-grid .jg-label { display: flex; align-items: center; background: var(--surface-muted); color: var(--text-secondary); font-size: 11px; font-weight: 720; letter-spacing: .03em; }
.judge-grid .jg-content { background: var(--surface-solid); font-size: 13px; }
.judge-grid .jg-label:nth-last-child(-n+2), .judge-grid .jg-content:last-child { border-bottom: 0; }
.highlight { color: var(--red); font-weight: 700; }
.accent-text { color: var(--blue); font-weight: 650; }
.search-result-section-label { padding: 8px 11px 5px; color: var(--text-tertiary); font-size: 10px; font-weight: 720; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-list button.sidebar-link { width: 100%; border: 0; text-align: left; font-family: inherit; cursor: pointer; background: transparent; }
.sidebar-list button.sidebar-link:hover { background: var(--surface-muted); }

@media (max-width: 640px) {
  .judge-grid { grid-template-columns: 1fr; }
  .judge-grid .jg-label { border-bottom: 0; padding-bottom: 3px; }
  .judge-grid .jg-content { padding-top: 5px; }
  .timeline-nav { position: static; }
  .time-period { padding: 17px; }
}
.hero-button svg, .bento-card__arrow svg {
  width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.anchor-alias { display: block; position: relative; top: calc(-1 * var(--nav-h) - 18px); visibility: hidden; }
