:root {
  --paper: #efeafd;
  --ink: #231942;
  --ink-2: #4a3f6b;
  --berry: #e0457b;
  --berry-deep: #b8285c;
  --line: #d4c9f5;
  --surface: #faf8ff;
  --r-lg: 24px;
  --r-sm: 14px;
  --lat: Corbel, "Segoe UI", "Helvetica Neue", sans-serif;
  --cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --wrap: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--cjk);
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

a { color: var(--berry-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; display: block; }
code { font-family: var(--lat); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0 .35em; font-size: .95em; }

.to-route { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: var(--r-sm); z-index: 10; }
.to-route:focus { left: 12px; }

/* ── 页头 ── */
.hd { border-bottom: 1px solid var(--line); background: var(--paper); }
.hd-in { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.hd-brand { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }
.kjmark { display: block; width: 118px; height: 34px; }
.hd-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.hd-nav a { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: 999px; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.hd-nav a:hover { background: var(--surface); }
.hd-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--berry); border-radius: 0; }

main { display: block; }

/* ── 首页首屏：横向路线 ── */
.hero { max-width: var(--wrap); margin: 0 auto; padding: 36px 32px 28px; }
.hero h1 { font-size: 50px; line-height: 1.16; margin: 0 0 12px; letter-spacing: -.5px; max-width: 21em; font-weight: 800; }
.lede { margin: 0 0 30px; font-size: 17px; color: var(--ink-2); max-width: 46em; }

.routebox { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 0; row-gap: 26px; }
.route { display: contents; list-style: none; margin: 0; padding: 0; }
.node { grid-row: 1; position: relative; text-align: center; padding: 0 6px; }
.node::after { content: ""; position: absolute; top: 18px; left: 50%; width: 100%; height: 4px; background: var(--line); }
.route .node:last-child::after { display: none; }
.node-no { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); font-family: var(--lat); font-weight: 700; font-size: 18px; }
.node-t { display: block; font-weight: 700; font-size: 16px; margin-top: 8px; }
.node-s { display: block; font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
.node-code .node-no { background: var(--berry); border-color: var(--berry); color: #fff; }
.node-code .node-t { color: var(--berry-deep); }

.hang { grid-row: 2; grid-column: 4 / 7; list-style: none; position: relative; padding: 0 10px; }
.hang::before { content: ""; position: absolute; top: -26px; left: calc(50% - 1px); width: 2px; height: 26px; background: var(--berry); }
.rec { grid-row: 2; grid-column: 1 / 4; align-self: start; padding: 20px 24px; border-left: 4px solid var(--ink); margin-right: 18px; }
.rec-k { margin: 0; font-size: 14px; font-weight: 700; color: var(--berry-deep); }
.rec-t { display: block; font-size: 21px; font-weight: 800; line-height: 1.4; color: var(--ink); margin: 4px 0 8px; text-decoration: none; }
.rec-t:hover { text-decoration: underline; }
.rec-d { margin: 0; font-size: 15px; color: var(--ink-2); }

/* ── 邀请码卡 ── */
.cc { background: var(--surface); border: 2px solid var(--berry); border-radius: var(--r-lg); padding: 18px 22px 16px; }
.cc-k { margin: 0; font-size: 14px; color: var(--ink-2); }
.cc-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; flex-wrap: wrap; }
.cc-code { font-family: var(--lat); font-size: 34px; font-weight: 700; letter-spacing: 2px; border: 0; background: none; padding: 0; color: var(--ink); user-select: all; }
.cc-btn { font: inherit; font-size: 15px; font-weight: 700; min-height: 44px; min-width: 88px; padding: 0 18px; border-radius: var(--r-sm); border: 2px solid var(--ink); background: var(--ink); color: var(--surface); cursor: pointer; }
.cc-btn:hover { background: var(--ink-2); }
.cc-btn.is-done { background: var(--surface); color: var(--ink); }
.cc-gain { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.6; }
.cc-star { text-decoration: none; color: var(--berry-deep); padding: 0 4px; }
.cc-note { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.cc-go { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; margin-top: 12px; padding: 0 22px; border-radius: var(--r-sm); background: var(--berry); color: #fff; font-weight: 700; text-decoration: none; }
.cc-go:hover { background: var(--berry-deep); color: #fff; }
.cc-disc { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.cc-wrap { margin: 28px 0; }

/* ── 首页下半 ── */
.home-rest { max-width: var(--wrap); margin: 0 auto; padding: 20px 32px 56px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; align-items: start; }
.kjtext-home h2 { font-size: 24px; margin: 30px 0 10px; padding-left: 14px; border-left: 4px solid var(--berry); line-height: 1.4; }
.kjtext-home h2:first-child { margin-top: 8px; }
.stack { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; position: sticky; top: 18px; }
.stack h2 { margin: 0 0 8px; font-size: 18px; }
.stack-list { list-style: none; margin: 0; padding: 0; }
.stack-list li { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.stack-list a { font-weight: 700; font-size: 17px; line-height: 1.5; }
.stack-list p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.stack .stack-meta { font-size: 13px; }
.stack-more { font-size: 14px; margin: 12px 0 0; color: var(--ink-2); }

/* ── 正文通用 ── */
.kjtext { font-size: 17px; line-height: 1.85; }
.kjtext p, .kjtext ul, .kjtext ol { max-width: 38em; }
.kjtext ul, .kjtext ol { padding-left: 1.4em; }
.kjtext li { margin: 4px 0; }
.kjtext h3 { font-size: 19px; margin: 28px 0 8px; line-height: 1.5; }
.kjtext blockquote { margin: 18px 0; padding: 4px 18px; border-left: 4px solid var(--line); color: var(--ink-2); }
.kjtext strong { color: var(--ink); }
.kjtext .note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px; }
.kjtext .warn { border-left: 4px solid var(--berry); padding: 4px 0 4px 14px; }

.trail { font-size: 14px; color: var(--ink-2); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.trail a { color: var(--ink-2); padding: 10px 8px; margin: 0 -8px; min-height: 44px; display: inline-flex; align-items: center; }
.trail-sep { color: var(--line); }

/* ── 文章页 ── */
.guide { max-width: 860px; margin: 0 auto; padding: 26px 32px 60px; }
.guide-head h1 { font-size: 40px; line-height: 1.25; margin: 0 0 12px; font-weight: 800; }
.guide-dek { font-size: 18px; color: var(--ink-2); margin: 0 0 14px; max-width: 38em; }
.sig { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--ink-2); margin: 0 0 22px; }
.lead-fig { margin: 0 0 26px; }
.lead-fig img { border-radius: var(--r-lg); border: 1px solid var(--line); }
.lead-fig figcaption, .snap figcaption { font-size: 14px; color: var(--ink-2); margin-top: 8px; line-height: 1.6; }

.legmap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 24px 14px; margin: 0 0 30px; }
.legmap-h { margin: 0 0 6px; font-weight: 800; }
.legmap ol { margin: 0; padding: 0; list-style: none; counter-reset: leg; }
.legmap li { counter-increment: leg; position: relative; padding: 6px 0 6px 40px; border-left: 2px solid var(--line); margin-left: 12px; }
.legmap li::before { content: counter(leg); position: absolute; left: -13px; top: 7px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); font-family: var(--lat); font-weight: 700; font-size: 13px; text-align: center; line-height: 20px; }
.legmap li:last-child { border-left-color: transparent; }
.legmap a { color: var(--ink); text-decoration: none; display: inline-block; padding: 4px 0; }
.legmap a:hover { color: var(--berry-deep); text-decoration: underline; }

.kjtext-guide h2 { font-size: 27px; line-height: 1.4; margin: 6px 0 14px; scroll-margin-top: 16px; }
.leg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 46px 0 0; font-size: 13px; color: var(--ink-2); max-width: none; }
.leg-l { font-weight: 700; }
.leg-dots { display: inline-flex; align-items: center; position: relative; gap: 12px; }
.leg-dots::before { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: var(--line); }
.leg-dots i { position: relative; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink-2); background: var(--paper); }
.leg-dots i.on { background: var(--berry); border-color: var(--berry); }
.leg-n { color: var(--berry-deep); font-weight: 700; }

.snap { margin: 22px 0 26px; max-width: 100%; }
.snap-frame { display: inline-block; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); max-width: 100%; }
.snap-frame img { border-radius: var(--r-sm); }

.tabw { overflow-x: auto; margin: 18px 0 24px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.tabw table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 15px; line-height: 1.6; }
.tabw th, .tabw td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tabw th { background: var(--paper); font-weight: 700; }
.tabw tr:last-child td { border-bottom: 0; }

.askbox { margin-top: 44px; padding-top: 10px; border-top: 2px solid var(--ink); }
.askbox h2 { font-size: 24px; margin: 18px 0 8px; }
.ask-i h3 { font-size: 18px; margin: 20px 0 6px; }
.ask-i p { margin: 0; max-width: 38em; font-size: 16px; }

.after { margin-top: 44px; display: grid; gap: 18px; }
.after-k { font-weight: 800; margin: 0 0 6px; }
.labelrow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.labelrow li span, .labelrow li a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--ink); text-decoration: none; }
.tag-n { font-size: 13px; color: var(--ink-2); margin-left: 6px; }
.after-next ul { margin: 0; padding-left: 1.2em; }
.after-next li { margin: 6px 0; }

/* ── 栏目页 / 标签页 ── */
.sec { max-width: 860px; margin: 0 auto; padding: 26px 32px 60px; }
.sec-head h1 { font-size: 40px; margin: 0 0 12px; line-height: 1.25; }
.sec-pn { font-size: 18px; margin-left: 12px; color: var(--ink-2); font-weight: 400; }
.sec-intro p { max-width: 38em; font-size: 17px; line-height: 1.85; }
.sec-count { font-family: var(--lat); font-size: 15px; color: var(--ink-2); margin: 0 0 18px; }
.kj-entries { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.kj-entry { padding: 20px 0 20px 30px; border-bottom: 1px solid var(--line); position: relative; }
.kj-entry::before { content: ""; position: absolute; left: 4px; top: 30px; width: 12px; height: 12px; border-radius: 50%; background: var(--berry); }
.kj-entry-t { font-size: 22px; font-weight: 800; color: var(--ink); text-decoration: none; line-height: 1.45; }
.kj-entry-t:hover { text-decoration: underline; }
.kj-entry-d { margin: 6px 0; color: var(--ink-2); max-width: 38em; }
.kj-entry-m { margin: 0; font-size: 14px; color: var(--ink-2); }
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin-top: 26px; font-size: 15px; }
.pager a { padding: 10px 6px; }
.term-syn { color: var(--ink-2); font-size: 14px; }

/* ── 站务页 ── */
.notepage { max-width: 820px; margin: 0 auto; padding: 26px 32px 60px; }
.notepage-head h1 { font-size: 38px; margin: 0 0 6px; line-height: 1.3; }
.notepage-upd { font-size: 14px; color: var(--ink-2); margin: 0 0 18px; }
.kjtext-memo h2 { font-size: 22px; margin: 30px 0 8px; padding-left: 14px; border-left: 4px solid var(--line); }

/* ── 搜索 ── */
.seek { max-width: 820px; margin: 0 auto; padding: 26px 32px 60px; }
.seek-form label { display: block; font-weight: 700; margin-bottom: 6px; }
.seek-row { display: flex; gap: 10px; }
.seek-row input { flex: 1; min-width: 0; font: inherit; font-size: 16px; min-height: 48px; padding: 0 16px; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.seek-row input:focus { border-color: var(--ink); }
.seek-row button { font: inherit; font-weight: 700; min-height: 48px; padding: 0 20px; border-radius: var(--r-sm); border: 0; background: var(--ink); color: var(--surface); cursor: pointer; }
.seek-state { color: var(--ink-2); font-size: 15px; }
.seek-out { list-style: none; padding: 0; margin: 0; }
.seek-out li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.seek-out a { font-weight: 700; font-size: 18px; }
.seek-out p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }

/* ── 404 ── */
.nowhere { max-width: 720px; margin: 0 auto; padding: 60px 32px 80px; }
.nowhere-no { font-family: var(--lat); font-size: 64px; font-weight: 700; color: var(--berry); margin: 0; line-height: 1; }
.nowhere h1 { font-size: 34px; margin: 10px 0; }
.nowhere li { margin: 8px 0; }

/* ── 页脚 ── */
.endbar { background: var(--ink); color: #e9e4fb; margin-top: 20px; }
.endbar a { color: #fff; }
.endbar-in { max-width: var(--wrap); margin: 0 auto; padding: 36px 32px 28px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px 48px; font-size: 14px; line-height: 1.75; }
.endbar-brand { color: #fff; display: inline-flex; min-height: 44px; align-items: center; }
.endbar-id p { margin: 8px 0 0; max-width: 36em; }
.endbar-links { display: flex; flex-wrap: wrap; gap: 0 4px; align-content: start; }
.endbar-links a { padding: 10px 10px; min-height: 44px; display: inline-flex; align-items: center; }
.endbar-feed, .endbar-yr { grid-column: 1 / -1; margin: 0; }
.endbar-yr { font-family: var(--lat); color: #bfb5e4; }

/* ── 窄屏 ── */
@media (max-width: 860px) {
  .home-rest { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .stack { position: static; }
  .endbar-in { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hd-in { padding: 0 16px; min-height: 56px; gap: 6px; }
  .kjmark { width: 84px; height: 24px; }
  .hd-nav { gap: 0; flex-wrap: nowrap; }
  .hd-nav a { padding: 8px 4px; font-size: 14px; white-space: nowrap; min-width: 44px; justify-content: center; }
  .hero { padding: 14px 16px 18px; }
  .hero h1 { font-size: 32px; line-height: 1.22; margin-bottom: 6px; letter-spacing: 0; }
  .lede { font-size: 15px; margin-bottom: 12px; line-height: 1.6; }
  .routebox { display: block; }
  .route { display: block; }
  .node { text-align: left; padding: 0 0 4px 40px; min-height: 36px; display: flex; align-items: center; gap: 8px; }
  .node::after { top: 28px; left: 13px; width: 2px; height: calc(100% - 22px); }
  .node-no { position: absolute; left: 0; top: 2px; width: 28px; height: 28px; font-size: 14px; }
  .node-t { margin: 0; font-size: 15px; line-height: 32px; }
  .node-s { display: none; }
  .hang { padding: 2px 0 6px 40px; }
  .hang::before { top: 0; left: 13px; width: 2px; height: 100%; background: var(--berry); }
  .cc { padding: 10px 14px 10px; border-radius: var(--r-sm); }
  .cc-k { font-size: 13px; }
  .cc-row { margin: 0 0 2px; gap: 10px; }
  .cc-code { font-size: 26px; }
  .cc-gain { font-size: 14px; }
  .cc-note { font-size: 13px; margin-top: 2px; }
  .rec { margin: 12px 0 0; padding: 8px 0 0 14px; border-left-width: 3px; }
  .rec-k { font-size: 13px; }
  .rec-t { font-size: 17px; margin: 0 0 2px; line-height: 1.45; }
  .rec-d { display: none; }
  .home-rest { padding: 10px 16px 40px; }
  .kjtext { font-size: 16px; line-height: 1.8; }
  .guide, .sec, .notepage, .seek { padding: 16px 16px 44px; }
  .guide-head h1, .sec-head h1 { font-size: 30px; }
  .notepage-head h1 { font-size: 28px; }
  .guide-dek { font-size: 16px; }
  .kjtext-guide h2 { font-size: 23px; }
  .leg { margin-top: 36px; }
  .legmap { padding: 14px 16px 10px; }
  .snap-frame { padding: 6px; border-radius: var(--r-sm); }
  .cc-wrap .cc-code { font-size: 28px; }
  .endbar-in { padding: 28px 16px 22px; }
  .nowhere { padding: 36px 16px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
