:root {
  --site-bg: #12151c;
  --site-fg: #e6e1d3;
  --site-accent: #d9a441;
  --site-on-accent: #1a1408;
  --site-surface: #1c212b;
  --site-muted: #b2ada2;
  --site-border: #2f3543;
  --site-font: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --site-body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --site-radius: 10px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;

  --accent-soft: rgba(217, 164, 65, 0.14);
  --accent-line: rgba(217, 164, 65, 0.4);
  --danger: #d86c6c;
  --ok: #7fc48a;
  --info: #7aa7d8;
  --quest-item-fg: #a7d3ff;
  --quest-item-bg: #223144;
  --quest-material-fg: #a9dfb7;
  --quest-material-bg: #20352c;
  --quest-reward-fg: #ffda8e;
  --quest-reward-bg: #392e1e;
  --content-width: 1180px;
  --header-height: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 20px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: var(--site-body-font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--site-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--site-font); font-weight: 600; line-height: 1.3; color: var(--site-fg); }
h1 { font-size: calc(36px * var(--site-type)); margin: 0 0 12px; }
h2 { font-size: calc(26px * var(--site-type)); margin: calc(48px * var(--site-space)) 0 calc(16px * var(--site-space)); padding-bottom: 8px; border-bottom: 1px solid var(--site-border); }
h3 { font-size: calc(20px * var(--site-type)); margin: calc(32px * var(--site-space)) 0 calc(12px * var(--site-space)); }
h4 { font-size: 17px; margin: 24px 0 8px; }
p { margin: 0 0 calc(14px * var(--site-space)); }
ul, ol { margin: 0 0 calc(14px * var(--site-space)); padding-left: 1.6em; }
li { margin-bottom: 4px; }
strong { color: #f3d58a; }
code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 0.92em; background: #0d1016; padding: 2px 6px; border-radius: 4px; color: #f0c674; }
hr { border: 0; border-top: 1px solid var(--site-border); margin: calc(32px * var(--site-space)) 0; }
blockquote { margin: 16px 0; padding: 10px 18px; border-left: 3px solid var(--accent-line); background: var(--accent-soft); border-radius: 0 var(--site-radius) var(--site-radius) 0; color: var(--site-fg); }
blockquote p:last-child { margin-bottom: 0; }

:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }
::selection { background: rgba(217, 164, 65, 0.35); }

/* ---------- layout ---------- */
.container { width: 100%; min-width: 0; max-width: var(--content-width); margin: 0 auto; padding: 0 calc(24px * var(--site-space)); }
.page { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: calc(40px * var(--site-space)); align-items: start; padding: calc(32px * var(--site-space)) 0 calc(64px * var(--site-space)); }
.page > * { min-width: 0; }
.page.full { grid-template-columns: minmax(0, 1fr); }
.content { min-width: 0; max-width: 860px; }
.content.wide { max-width: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(18, 21, 28, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--site-border);
}
.site-header .inner { max-width: var(--content-width); margin: 0 auto; padding: 0 calc(24px * var(--site-space)); display: flex; align-items: center; gap: calc(24px * var(--site-space)); height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--site-fg); font-family: var(--site-font); font-size: 20px; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--site-accent); }
.brand svg { width: 28px; height: 28px; }
.main-nav { display: flex; gap: calc(4px * var(--site-space)); flex: 1; flex-wrap: nowrap; overflow: hidden; }
.main-nav a { color: var(--site-muted); padding: 6px 10px; border-radius: var(--site-radius); font-size: 14px; white-space: nowrap; }
.main-nav a:hover { color: var(--site-fg); background: var(--site-surface); text-decoration: none; }
.main-nav a.active, .main-nav a[aria-current="page"] { color: var(--site-accent); background: var(--accent-soft); }
.nav-toggle { display: none; background: none; border: 1px solid var(--site-border); color: var(--site-fg); border-radius: var(--site-radius); padding: 6px 10px; font-size: 14px; cursor: pointer; }

.search-wrap { position: relative; min-width: 200px; }
.search-wrap input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: var(--site-radius);
  border: 1px solid var(--site-border); background: #0e1117; color: var(--site-fg); font-size: 14px;
  transition: border-color calc(180ms * var(--site-motion));
}
.search-wrap input:focus { border-color: var(--site-accent); outline: none; }
.search-wrap .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--site-muted); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 360px; max-height: 70vh; overflow: auto;
  background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); padding: 6px; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--site-fg); }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .t { display: block; font-weight: 600; font-size: 14px; }
.search-results .s { display: block; color: var(--site-muted); font-size: 12.5px; margin-top: 2px; }
.search-results .s mark { background: transparent; color: var(--site-accent); }
.search-results .empty { padding: 12px; color: var(--site-muted); font-size: 14px; }
.search-count { padding: 8px 12px; color: var(--site-muted); font-size: 12px; }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: calc(var(--header-height) + 24px); font-size: 14px; max-height: calc(100vh - var(--header-height) - 44px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--site-border) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--site-border); border-radius: 3px; }
.sidebar .group { margin-bottom: 20px; }
.sidebar .group h5 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--site-muted); font-family: var(--site-body-font); font-weight: 600; }
.sidebar a { display: block; color: var(--site-muted); padding: 5px 10px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; }
.sidebar a:hover { color: var(--site-fg); background: var(--site-surface); text-decoration: none; }
.sidebar a.active { color: var(--site-accent); border-left-color: var(--site-accent); background: var(--accent-soft); }
.sidebar.toc a { padding: 3px 10px; font-size: 13.5px; }
.toc-progress { height: 2px; background: var(--accent-line); width: 0; position: fixed; top: var(--header-height); left: 0; z-index: 51; }

/* ---------- cards / grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: calc(20px * var(--site-space)); }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: calc(24px * var(--site-space));
  background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius);
  color: var(--site-fg); position: relative; overflow: hidden;
  transition: transform calc(180ms * var(--site-motion)), border-color calc(180ms * var(--site-motion)), box-shadow calc(180ms * var(--site-motion));
}
.card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
.card h3 { margin: 0; font-size: 19px; color: var(--site-accent); }
.card p { margin: 0; color: var(--site-muted); font-size: 14.5px; line-height: 1.65; }
.card .meta { margin-top: auto; padding-top: 10px; font-size: 12.5px; color: var(--site-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.card .badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--site-accent); font-size: 12px; }

/* ---------- hero ---------- */
.hero { padding: calc(56px * var(--site-space)) 0 calc(40px * var(--site-space)); border-bottom: 1px solid var(--site-border); background: radial-gradient(ellipse at 20% 0%, rgba(217,164,65,0.12), transparent 55%), radial-gradient(ellipse at 80% 10%, rgba(90,120,200,0.10), transparent 50%); }
.hero h1 { font-size: calc(40px * var(--site-type)); margin-bottom: 14px; }
.hero .lead { font-size: 18px; color: var(--site-muted); max-width: 760px; margin-bottom: 24px; }
.hero-big { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-fg); font-size: 14px; }
.chip:hover { border-color: var(--accent-line); text-decoration: none; color: var(--site-accent); }
.chip .star { color: var(--site-accent); }

/* ---------- tables ---------- */
.table-wrap { max-width: 100%; overflow-x: auto; margin: 16px 0 calc(24px * var(--site-space)); }
.page.full .table-wrap table { min-width: 760px; }
.table-hint { display: none; color: var(--site-muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--site-border); text-align: left; vertical-align: top; }
th { background: #171b24; color: var(--site-accent); font-weight: 600; white-space: nowrap; font-family: var(--site-font); }
tr:hover td { background: rgba(255,255,255,0.02); }
td:first-child { white-space: nowrap; }

/* ---------- callouts ---------- */
.callout { padding: 14px 18px; border-radius: var(--site-radius); border: 1px solid var(--site-border); background: var(--site-surface); margin: 16px 0 calc(20px * var(--site-space)); }
.callout .label { display: block; font-weight: 700; font-size: 13px; letter-spacing: 0.08em; margin-bottom: 6px; text-transform: uppercase; font-family: var(--site-body-font); }
.callout.tip { border-color: rgba(127,196,138,0.4); }
.callout.tip .label { color: var(--ok); }
.callout.warn { border-color: rgba(216,108,108,0.4); }
.callout.warn .label { color: var(--danger); }
.callout.info { border-color: rgba(122,167,216,0.4); }
.callout.info .label { color: var(--info); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- figures ---------- */
figure { margin: 20px 0 calc(24px * var(--site-space)); }
figure img { border-radius: var(--site-radius); border: 1px solid var(--site-border); background: #0e1117; cursor: zoom-in; }
figure.tall img { max-height: 520px; width: auto; margin: 0 auto; object-fit: contain; }
figcaption { color: var(--site-muted); font-size: 13px; margin-top: 8px; text-align: center; }
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; z-index: 100; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; min-width: 64px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); color: var(--site-fg); font: inherit; cursor: pointer; }
.quest-figure img { max-height: 640px; width: auto; margin-inline: auto; object-fit: contain; }
.image-context, .source-note { color: var(--site-muted); font-size: 14px; overflow-wrap: anywhere; }
.quest-images { grid-column: 1 / -1; }
.quest-images > summary { min-height: 44px; display: flex; align-items: center; }

/* ---------- tags ---------- */
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--site-border); color: var(--site-muted); margin-right: 4px; }
.tag.gold { border-color: var(--accent-line); color: var(--site-accent); background: var(--accent-soft); }
.tag.free { border-color: rgba(127,196,138,0.4); color: var(--ok); }

/* ---------- ratings ---------- */
.stars { color: var(--site-accent); letter-spacing: 1px; white-space: nowrap; }

/* ---------- char grid ---------- */
.char { padding: calc(20px * var(--site-space)); background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius); margin-bottom: calc(16px * var(--site-space)); }
.char header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.char header h3 { margin: 0; }
.char .alias { color: var(--site-muted); font-size: 14px; }
.char .spec { font-size: 13.5px; color: var(--site-muted); margin-bottom: 10px; }
.char .pros, .char .cons { display: grid; grid-template-columns: 48px 1fr; gap: 8px; margin: 0; }
.char .pros li, .char .cons li { margin: 0; }
.char ul { margin: 6px 0; }
.pros strong { color: var(--ok); }
.cons strong { color: var(--danger); }

/* ---------- steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 18px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--site-accent); border: 1px solid var(--accent-line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--site-font); }

/* ---------- downloads ---------- */
.dl { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius); margin-bottom: 10px; color: var(--site-fg); transition: border-color calc(180ms * var(--site-motion)); }
.dl:hover { border-color: var(--accent-line); text-decoration: none; }
.dl .ext { font-family: var(--site-font); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; padding: 4px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--site-accent); text-transform: uppercase; min-width: 46px; text-align: center; }
.dl .pdf { background: rgba(216,108,108,0.15); color: #f0a0a0; }
.dl .n { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 15px; }
.dl .s { color: var(--site-muted); font-size: 13px; white-space: nowrap; }

/* ---------- collapsible chapters ---------- */
details.chapter { border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); margin: 0 0 14px; overflow: hidden; }
details.chapter > summary { cursor: pointer; padding: 16px 20px; list-style: none; display: flex; flex-direction: column; gap: 4px; user-select: none; transition: background calc(180ms * var(--site-motion)); }
details.chapter > summary::-webkit-details-marker { display: none; }
details.chapter > summary strong, details.chapter > summary h3 { font-family: var(--site-font); font-size: 19px; color: var(--site-accent); display: flex; align-items: center; gap: 10px; margin: 0; }
details.chapter > summary strong::after { content: "▸"; color: var(--site-muted); font-size: 14px; transition: transform calc(180ms * var(--site-motion)); display: inline-block; }
details.chapter[open] > summary strong::after { transform: rotate(90deg); }
details.chapter > summary span { color: var(--site-muted); font-size: 14px; }
details.chapter > summary:hover { background: rgba(255,255,255,0.02); }
.chapter-body { padding: 4px 20px 20px; border-top: 1px solid var(--site-border); }
.chapter-body h4 { font-size: 16.5px; color: #f3d58a; margin: 18px 0 8px; padding-left: 10px; border-left: 2px solid var(--accent-line); }
.chapter-body ul { padding-left: 1.3em; }
.chapter-body li { margin-bottom: 3px; font-size: 15px; }
.chapter-body p { font-size: 15px; }

/* 任务行：任务名在左，步骤在右 */
.task { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 24px 0; border-top: 1px solid var(--site-border); }
.task:first-of-type { border-top: 0; padding-top: 6px; }
.task-head h4 { margin: 0; padding: 0; border: 0; font-size: 18px; line-height: 1.6; color: var(--site-accent); font-weight: 600; }
.task-head h4 small { display: block; margin-top: 3px; font-family: var(--site-body-font); font-size: 12.5px; font-weight: 400; line-height: 1.5; color: var(--site-muted); }
.task-head .alt { margin: 5px 0 0; font-size: 14px; font-weight: 600; line-height: 1.45; color: #c9b98a; }
.task-head .alt small { display: block; font-size: 12.5px; font-weight: 400; color: var(--site-muted); }
.task-steps ul { list-style: none; margin: 0; padding: 0; }
.task-steps li, .flow li { position: relative; padding-left: 16px; margin-bottom: 4px; font-size: 15px; line-height: 1.75; color: #d6d0c2; }
.task-steps li::before { content: ""; position: absolute; left: 2px; top: 0.78em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-line); }
b.pos { padding: 0 5px; border-radius: 4px; background: rgba(126,176,255,0.1); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; font-weight: 600; white-space: nowrap; color: #9ecbff; }
b.item { font-weight: 500; color: #f1dca4; }
.chapter-body p.sub { margin: 24px 0 6px; font-family: var(--site-font); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: #f3d58a; }
.quest-text { margin: 8px 0 12px; padding: 10px 14px; border-left: 2px solid var(--site-border); background: rgba(255,255,255,0.025); font-size: 14.5px; line-height: 1.7; color: #c9c3b6; }
.quest-text p { font-size: 14.5px; }
.quest-text ul { margin: 4px 0; }
.quest-text li { font-size: 14.5px; }
.quest-end { margin: 14px 0 4px; text-align: center; font-size: 13px; letter-spacing: 0.3em; color: var(--site-muted); }
.callout ul { margin: 6px 0 0; padding-left: 1.2em; }
.callout li { font-size: 14px; margin-bottom: 2px; }

/* 流程式章节：整章按步骤编号 */
.quest-flow { counter-reset: step; }
.flow { list-style: none; margin: 0; padding: 0; }
.quest-flow .flow > li { padding-left: 38px; counter-increment: step; margin-bottom: 7px; }
.quest-flow .flow > li::before { content: counter(step); position: absolute; left: 0; top: 0.3em; min-width: 24px; height: 22px; line-height: 22px; text-align: center; font-family: var(--site-font); font-size: 12px; font-weight: 700; color: var(--site-accent); background: var(--accent-soft); border-radius: 4px; }
.flow li.hd, .quest-flow .flow > li.hd { counter-reset: step; padding: 0; margin: 18px 0 8px; font-family: var(--site-font); font-size: 15.5px; font-weight: 700; color: #f3d58a; }
.flow li.hd::before { display: none; }
.flow li li { padding-left: 16px; margin-bottom: 3px; font-size: 14px; }
.flow li li::before { content: ""; display: block; min-width: 0; width: 5px; height: 5px; top: 0.8em; line-height: 0; background: var(--accent-line); color: inherit; font-size: 12px; font-weight: 400; }
.quest-flow .callout { margin: 10px 0 14px; }

/* 自带序号与备注：放在流程规则之后，覆盖编号徽标 */
.task-steps li.num, .flow li.num, .quest-flow .flow > li.num { padding-left: 0; }
.task-steps li.num::before, .flow li.num::before { display: none; }
.task-steps .n, .flow .n { margin-right: 4px; font-family: var(--site-font); font-weight: 700; color: var(--site-accent); }
.task-steps li.note, .flow li.note, .quest-flow .flow > li.note { padding-left: 18px; font-size: 13.5px; color: var(--site-muted); }
.task-steps li.note::before, .flow li.note::before { content: "›"; left: 0; top: 0; width: auto; height: auto; background: none; color: var(--site-muted); }

details.src { margin: 14px 0 22px; }
details.src > summary { cursor: pointer; font-size: 13.5px; color: var(--site-muted); user-select: none; }
details.src[open] > summary { margin-bottom: 8px; }

@media (max-width: 720px) {
  .task { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 0; }
}
details.chapter:target { border-color: var(--accent-line); }

kbd { display: inline-block; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--site-border); border-bottom-width: 2px; background: #0e1117; color: var(--site-fg); font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; line-height: 1.5; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--site-border); padding: calc(32px * var(--site-space)) 0; color: var(--site-muted); font-size: 13.5px; margin-top: calc(48px * var(--site-space)); }
.site-footer .inner { max-width: var(--content-width); margin: 0 auto; padding: 0 calc(24px * var(--site-space)); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .page { grid-template-columns: 200px minmax(0, 1fr); gap: calc(24px * var(--site-space)); }
  .sidebar { top: calc(var(--header-height) + 16px); max-height: calc(100dvh - var(--header-height) - 32px); }
  .sidebar.toc a { padding: 2px 8px; font-size: 13px; }
}
@media (max-width: 760px) {
  .page { grid-template-columns: 1fr; }
  .sidebar.side-nav { display: none; }
  .sidebar.toc { position: static; max-height: 40vh; overflow-y: auto; border: 1px solid var(--site-border); border-radius: var(--site-radius); padding: 12px; background: var(--site-surface); margin-bottom: calc(20px * var(--site-space)); }
  .sidebar.toc .group { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 8px; margin-bottom: 0; }
  .sidebar.toc a.active { border-left-color: var(--site-accent); }
  .sidebar.toc .group h5 { display: none; }
}
@media (max-width: 1160px) {
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; flex-direction: column; background: #12151c; border-bottom: 1px solid var(--site-border); padding: 10px calc(16px * var(--site-space)); overflow: visible; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 10px 12px; font-size: 15px; }
  .nav-toggle { display: inline-flex; }
  .search-wrap { flex: 1; }
  .search-results { width: 100%; left: 0; right: 0; }
  .hero h1 { font-size: 30px; }
  .page { padding-top: 20px; }
}

@media (max-width: 760px) {
  .page:not(.full) { padding-inline: 16px; }
  .content { overflow-wrap: anywhere; }
  .table-hint { display: block; }
}

@media (max-width: 640px) {
  :root { --header-height: 112px; }
  .container { padding-inline: 16px; }
  .site-header .inner { height: auto; min-height: 60px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 8px 16px; }
  .brand { min-width: 0; gap: 8px; font-size: 18px; }
  .brand svg { width: 24px; height: 24px; flex-shrink: 0; }
  .nav-toggle { min-width: 64px; min-height: 44px; justify-content: center; align-items: center; }
  .search-wrap { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .search-wrap input { min-height: 44px; font-size: 16px; }
  .main-nav { top: 100%; max-height: calc(100dvh - var(--header-height)); overflow-y: auto; }
  .hero { padding-top: 24px; padding-bottom: 24px; }
  .hero .lead { font-size: 16px; }
  .hero-big { gap: 8px; }
  .chip { min-height: 44px; }
  .site-footer .inner { padding-inline: 16px; }
  .sidebar.toc .group { grid-template-columns: 1fr; }
  .sidebar.toc a { padding-block: 8px; }
}

/* ---------- Reading and source-aware quest library ---------- */
[hidden] { display: none !important; }
html { color-scheme: dark; }
.content { --reading-size: 1rem; }
.content > p, .chapter-body p, .chapter-body li, .task-steps li, .flow li { font-size: var(--reading-size); line-height: 1.9; }
.content > .source-note { font-size: 14px; }
input::placeholder { color: var(--site-muted); opacity: 1; }
.page-intro { max-width: 76ch; color: var(--site-fg); }
.chapter-body { padding: 16px 24px 24px; }
.task-steps, .guide-prose { max-width: 76ch; }
.chapter-body p.sub { margin-top: 32px; margin-bottom: 12px; font-size: 18px; }
.chapter-body .source-note, .chapter-body .image-context, .chapter-body .note, .chapter-body .quest-end { font-size: 14px; line-height: 1.8; }
.task-head h4 small { font-size: 14px; }
.guide-prose > :last-child { margin-bottom: 0; }
.guide-prose table { display: block; max-width: 100%; overflow-x: auto; }
.guide-prose td:first-child { white-space: normal; }
.source-block { margin-bottom: 16px; }
.imported-figure img { max-height: 680px; width: auto; margin-inline: auto; object-fit: contain; }
.imported-figure { margin-block: 24px; }
.quest-guide > .chapter-body > .source-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--site-border); }
details.chapter > summary { min-height: 72px; padding: 20px 24px; }
details.chapter > summary h3 { line-height: 1.65; }
details.chapter > summary h3::after { content: ""; width: 7px; height: 7px; flex-shrink: 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
details.chapter[open] > summary h3::after { transform: rotate(45deg); }
details.chapter > summary span { max-width: 78ch; line-height: 1.8; }
.chapter-pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--site-border); font-size: 14px; }
.chapter-pager a { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; overflow-wrap: anywhere; }
.legacy-links { margin-top: 32px; color: var(--site-muted); font-size: 14px; }
.legacy-links > summary { min-height: 44px; cursor: pointer; }
.legacy-links p { font-size: 14px; }
.quest-category-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-block: 12px; margin-block: 16px 24px; border-block: 1px solid var(--site-border); }
.quest-category-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; color: var(--site-muted); font-size: 15px; }
.quest-category-nav a[aria-current] { color: var(--site-accent); text-decoration: underline; text-underline-offset: 8px; text-decoration-thickness: 2px; }
.reading-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 24px; color: var(--site-muted); font-size: 14px; }
.reading-tools button, .library-filters button, .library-empty button { min-height: 44px; border: 1px solid var(--site-border); border-radius: 6px; padding: 8px 12px; background: var(--site-surface); color: var(--site-fg); font: inherit; cursor: pointer; }
.reading-tools button[aria-pressed="true"] { color: var(--site-accent); border-color: var(--accent-line); background: var(--accent-soft); }
.reading-tools button:hover, .library-filters button:hover, .library-empty button:hover { border-color: var(--site-accent); }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 200; padding: 12px 16px; background: var(--site-accent); color: var(--site-on-accent); border-radius: 6px; }
.skip-link:focus { top: 12px; }
.search-wrap input:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }
.sidebar .nav-heading { font: 600 14px/1.6 var(--site-body-font); color: var(--site-muted); margin: 0 0 8px; }
.sidebar.toc a { font-size: 14px; padding-block: 6px; }
.toc-chapter > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; border-radius: 6px; color: var(--site-muted); font-size: 14px; cursor: pointer; }
.toc-chapter > summary::-webkit-details-marker { display: none; }
.toc-chapter > summary::after { content: ""; width: 6px; height: 6px; flex: none; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.toc-chapter[open] > summary::after { transform: rotate(45deg); }
.toc-chapter > summary:hover { color: var(--site-fg); background: var(--site-surface); }
.toc-chapter > summary.active { color: var(--site-accent); background: var(--accent-soft); }
.toc-chapter > ul { list-style: none; margin: 4px 0 8px 12px; padding-inline-start: 8px; }
.toc-chapter li { margin: 0; }
.sidebar.toc .toc-chapter li a { border: 0; border-radius: 6px; line-height: 1.55; overflow-wrap: anywhere; }
.toc-disclosure > summary { font-size: 15px; font-weight: 600; color: var(--site-fg); cursor: pointer; }
.toc-disclosure > .group:first-of-type { margin-top: 12px; }
.toc-disclosure > summary { display: none; }
.quest-facts { display: grid; gap: 16px; margin: 8px 0 24px; }
.quest-facts > div { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 12px; }
.quest-facts dt { color: var(--site-muted); font-size: 14px; }
.quest-facts dd { margin: 0; font-size: var(--reading-size); overflow-wrap: anywhere; }
.version-note { padding: 16px; margin-block: 16px 24px; border: 1px solid var(--site-border); border-radius: 6px; background: var(--site-bg); color: var(--site-fg); }
.event-period { color: var(--site-fg); }
.event-period strong { display: block; margin-bottom: 4px; }
.event-status { display: block; color: var(--site-muted); font-size: 14px; margin-top: 8px; }
.library-filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(120px, 1fr)); gap: 16px; padding: 24px; border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); }
.library-filters label { display: block; margin-bottom: 8px; font-size: 14px; color: var(--site-muted); }
.library-filters input, .library-filters select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--site-border); border-radius: 6px; background: var(--site-bg); color: var(--site-fg); font: inherit; }
.library-filters select { padding-right: 32px; }
.library-filters > button { justify-self: start; grid-column: 1 / -1; font-size: 14px; }
.library-result-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-top: 40px; padding-bottom: 16px; border-bottom: 1px solid var(--site-border); }
.library-result-heading h2 { border: 0; padding: 0; margin: 0; font-size: 22px; }
.library-result-heading p { color: var(--site-muted); font-size: 14px; margin: 0; }
.quest-results { list-style: none; margin: 0; padding: 0; }
.quest-result { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 24px; margin: 0; padding: 24px 0; border-bottom: 1px solid var(--site-border); }
.quest-result h3 { font: 600 19px/1.6 var(--site-font); margin: 0 0 8px; }
.quest-result p { margin: 0 0 8px; font-size: 16px; line-height: 1.8; max-width: 72ch; }
.quest-result-tags { font-size: 14px; color: var(--site-muted); }
.quest-result-meta { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; color: var(--site-muted); font-size: 14px; padding-top: 4px; }
.library-empty { padding: 32px 0; }
.library-empty h3 { margin-top: 0; }
.library-sources { max-width: 86ch; }
.library-sources li { margin-bottom: 16px; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
@media (max-width: 1000px) {
  .library-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .page { gap: 16px; }
  .container > .page:not(.full) { padding-inline: 0; }
  .sidebar.toc { padding: 0; max-height: none; overflow: visible; margin-bottom: 8px; }
  .toc-disclosure > summary { display: list-item; min-height: 48px; padding: 12px 16px; }
  .toc-disclosure[open] { max-height: 55dvh; overflow-y: auto; padding-bottom: 8px; }
  .toc-disclosure > .group { display: block !important; margin: 12px 8px; }
  .sidebar.toc .group h5, .sidebar .nav-heading { display: block; margin-inline: 8px; font-size: 14px; }
  .sidebar.toc a, .toc-chapter > summary { min-height: 44px; padding-block: 10px; }
  .task { padding-block: 24px; gap: 10px; }
  .chapter-body { padding: 12px 16px 20px; }
  details.chapter > summary { padding: 16px; }
  .content > h1 { font-size: 30px; }
  .quest-result { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .quest-result-meta { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; align-items: flex-start; padding-top: 0; }
  .quest-category-nav { column-gap: 20px; row-gap: 0; }
}
@media (max-width: 480px) {
  .library-filters { padding: 16px; gap: 16px 12px; }
  .library-filters .library-search { grid-column: 1 / -1; }
  .library-filters select { font-size: 16px; }
  .quest-facts > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* Client task records keep the same reading layout and disclose raw fields on demand. */
.client-text { white-space: pre-line; overflow-wrap: anywhere; max-width: 76ch; }
.client-record .quest-facts dt { overflow-wrap: anywhere; }
details.client-record > summary h2 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; border: 0; font-size: 19px; line-height: 1.65; color: var(--site-accent); }
details.client-record > summary h2::after { content: ""; width: 7px; height: 7px; flex-shrink: 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
details.client-record[open] > summary h2::after { transform: rotate(45deg); }
.client-raw { max-height: 24rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; border: 1px solid var(--site-border); border-radius: 6px; background: var(--site-bg); color: var(--site-muted); font: 14px/1.75 Consolas, monospace; }
.client-stage + .client-stage { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--site-border); }
.client-pagination button:disabled { opacity: 0.5; cursor: default; }
.client-volume-list li, .client-system-list li { margin-block: 8px; overflow-wrap: anywhere; }
.client-detail-page .chapter-pager { margin-bottom: 24px; }
.client-detail-page .content > .page-intro { max-width: 76ch; }
.client-library-page .quest-result h3 a, .client-volume-list a, .client-system-list a { display: inline-flex; align-items: center; min-height: 44px; }
.client-library-page details.src > summary, .client-systems-page details.src > summary, .client-record details.src > summary { min-height: 44px; padding-block: 10px; }
@media (max-width: 480px) {
  #client-quest-filters { grid-template-columns: minmax(0, 1fr); }
  #client-quest-filters .library-search { grid-column: auto; }
}

/* Categories lead into the task itself; source fields remain a secondary view. */
.category-task-routes { margin-block: 24px 48px; }
.route-overview { list-style: none; padding: 0; margin: 16px 0; }
.route-overview li { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 24px; padding: 12px 0; border-bottom: 1px solid var(--site-border); }
.route-overview a { display: inline-flex; align-items: center; min-height: 44px; }
.route-overview span { color: var(--site-muted); font-size: 14px; }
.route-directory-filters.library-filters { grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr); padding: 16px; }
.route-directory-count, .route-directory-list p { font-size: 14px; color: var(--site-muted); }
.route-server-group > h3 { margin: 32px 0 16px; font-size: 20px; }
.route-region { margin-block: 12px; border: 1px solid var(--site-border); border-radius: 6px; background: var(--site-surface); }
.route-region > summary, .route-task-toc > summary { min-height: 48px; padding: 12px 16px; cursor: pointer; }
.route-directory-list { list-style: none; margin: 0; padding: 0 16px 12px; }
.route-directory-list > li { padding: 12px 0; border-top: 1px solid var(--site-border); }
.route-directory-list a { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; min-height: 44px; padding-block: 8px; }
.route-directory-list a > span:last-child { font-size: 14px; color: var(--site-muted); }
.route-directory-list p { margin: 0; overflow-wrap: anywhere; }
.recruit-roster .roster-region-title { margin: 0; padding: 12px 16px; color: var(--site-fg); font-size: 1rem; }
.recruit-roster section.route-region > .route-directory-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); column-gap: 24px; }
.recruit-roster section.route-region > .route-directory-list > li { padding-block: 8px; }
.recruit-roster .route-directory-list a { align-items: center; flex-direction: row; }
.route-system-list { padding: 0 24px 16px 40px; }
.route-region > .source-note { padding: 0 16px 16px; }
.route-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 16px; margin-block: 24px; border: 1px solid var(--site-border); border-radius: 6px; background: var(--site-surface); }
.route-progress p { margin: 0; }
.route-progress a { display: inline-flex; align-items: center; min-height: 44px; }
#route-save-note { flex-basis: 100%; color: var(--site-muted); font-size: 14px; }
.route-task-toc { margin-block: 24px; border: 1px solid var(--site-border); border-radius: 6px; }
.route-task-toc ol { margin: 0; padding: 0 24px 16px 48px; }
.route-task-toc a { display: inline-flex; align-items: center; min-height: 44px; }
.route-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--site-muted); }
.route-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }
.route-meta, .route-note { color: var(--site-muted); }
.route-note { font-size: 0.9375rem; }
.route-layout { display: grid; gap: 16px; align-items: start; }
.route-steps { min-width: 0; }
.route-sidebar > .route-task-toc { margin: 0; }
.route-task-toc li > a { padding-inline: 4px; overflow-wrap: anywhere; }
.route-task-toc a[aria-current="location"] { font-weight: 650; text-decoration: underline; text-underline-offset: 0.22em; }
.route-task-toc a[data-complete]::after { content: "（已完成）"; color: var(--site-muted); font-size: 0.875rem; }
.task-route-page details.task-flow { margin: 0; background: transparent; border: 0; border-bottom: 1px solid var(--site-border); border-radius: 0; }
.task-route-page details.task-flow > summary { min-height: 52px; padding: 12px 4px; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 18px; }
.task-route-page .task-flow > summary h3 { font-family: var(--site-body-font); font-size: 1.0625rem; overflow-wrap: anywhere; }
.task-route-page .task-flow > .chapter-body { border: 0; padding: 12px 4px 24px; }
.route-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 8px 0 12px; font-size: 0.9375rem; }
.route-facts > div { display: flex; min-width: 0; gap: 6px; }
.route-facts dt { color: var(--site-muted); white-space: nowrap; }
.route-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.route-extra { margin-block: 8px; }
.route-extra > summary { display: list-item; min-height: 44px; padding-block: 8px; cursor: pointer; color: var(--site-muted); }
.route-extra :is(p, dl) { margin-inline-start: 16px; white-space: pre-line; }
.route-preparation { margin-block: 12px 20px; border: 1px solid var(--site-border); border-radius: 6px; }
.route-preparation > summary { min-height: 44px; padding: 10px 14px; color: var(--quest-material-fg); cursor: pointer; font-weight: 650; }
.route-preparation-body { padding: 0 14px 12px; }
.route-preparation-body .route-note { margin: 0 0 8px; }
.route-preparation-body .route-targets { padding: 0; margin: 0; }
.route-preparation-task { margin: 12px 0 0; font-weight: 650; }
.route-preparation .route-entry { align-items: center; justify-content: space-between; margin: 0; gap: 6px 12px; }
.route-preparation .route-entry a { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9375rem; }
.route-targets { list-style: none; padding-inline-start: 0; margin-block: 8px 12px; }
.route-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  margin-block: 6px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.route-entry > .route-entry-label {
  display: inline-block;
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 4px;
  background: var(--entry-bg, var(--site-surface));
  color: var(--entry-fg, var(--site-muted));
  font: 650 0.875rem/1.45 var(--site-body-font);
}
.route-entry--item { --entry-fg: var(--quest-item-fg); --entry-bg: var(--quest-item-bg); }
.route-entry--material { --entry-fg: var(--quest-material-fg); --entry-bg: var(--quest-material-bg); }
.route-entry--reward { --entry-fg: var(--quest-reward-fg); --entry-bg: var(--quest-reward-bg); }
.route-entry > :last-child { min-width: 0; }
.route-entry:is(.route-entry--item, .route-entry--material) > span:last-child { font-weight: 600; }
.route-entry > ul { flex: 1 0 min(100%, 220px); margin-block: 0; padding-inline-start: 22px; }
.route-value { font-weight: 750; font-variant-numeric: tabular-nums; }
.route-entry .route-value { color: var(--entry-fg, var(--site-fg)); }
.route-mcc { color: var(--quest-reward-fg); font-weight: 750; }
.quest-stage-list > li > h4 .route-value { text-decoration: underline; text-decoration-color: var(--site-muted); text-underline-offset: 0.2em; }
.route-task-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-top: 16px; }
.route-task-actions .task-completion { margin: 0; }
.route-task-actions nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.route-task-actions nav a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.task-completion { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 8px 0; margin-bottom: 16px; cursor: pointer; }
.task-completion input { width: 20px; height: 20px; accent-color: var(--site-accent); flex-shrink: 0; }
.task-flow.is-complete > summary > span::after { content: " · 已标记完成"; }
.quest-stage-list { list-style: none; padding-inline-start: 0; margin-block: 12px 20px; }
.quest-stage-list > li { padding: 12px 0 16px; border-top: 1px solid var(--site-border); }
.quest-stage-list > li > h4 { border: 0; padding: 0; margin: 0; font: 600 var(--reading-size, 1rem)/1.7 var(--site-body-font); color: var(--site-fg); white-space: pre-line; overflow-wrap: anywhere; }
.quest-stage-list > li > h4 span { display: block; font-size: 0.875rem; color: var(--site-muted); }
.quest-stage-list .quest-stage-reward { margin-bottom: 0; }
.task-route-page .content { max-width: 1040px; margin-inline: auto; width: 100%; }
.task-route-page .chapter-pager { margin-bottom: 24px; }
@media (min-width: 900px) {
  .route-layout { grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 32px; }
  .route-sidebar { position: sticky; top: calc(var(--header-height) + 20px); max-height: calc(100dvh - var(--header-height) - 40px); overflow-y: auto; }
}
@media (max-width: 640px) {
  .route-directory-filters.library-filters { grid-template-columns: minmax(0, 1fr); }
  .route-overview li { flex-direction: column; }
  .route-directory-list a { align-items: flex-start; flex-direction: column; }
}
