:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #55504a;
  --muted: #8a837a;
  --line: #ece7e0;
  --line-soft: #f3efe9;
  --gold: #b08d57;
  --radius: 12px;
  --wrap: 1080px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 248, 245, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand-mark {
  width: 9px;
  height: 9px;
  background: var(--gold);
  transform: rotate(45deg);
  border-radius: 1px;
  flex: none;
}

.brand-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 12px;
  color: var(--gold);
  border: 1px solid #e3d5bc;
  background: #fdfaf4;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- 头部 ---------- */

.hero { padding: 40px 0 24px; }

.hero h1 {
  margin: 0 0 10px;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.hero-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 46em;
}

/* ---------- 搜索 ---------- */

.searchbar {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.searchbar input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.12);
}

.searchbar button {
  flex: none;
  padding: 0 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.searchbar button:hover { border-color: #ddd4c6; }

/* ---------- 模块 ---------- */

.module { margin-bottom: 44px; }

.module-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.module-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}

.module-head h2 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.module-head .count {
  font-size: 12px;
  color: var(--muted);
  background: var(--line-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.module-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ---------- 卡片 ---------- */

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: 0 6px 20px rgba(28, 26, 23, 0.07);
}

.card-main { display: block; }

.card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover h3 { color: var(--accent); }

.card .meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover { opacity: 0.88; }

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-line);
}

.btn.ghost:hover { background: var(--accent-bg); opacity: 1; }

/* ---------- 状态 / 页脚 ---------- */

.state {
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  margin-top: 24px;
}

.footer-line {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--ink-soft);
}

.footer-line.muted { color: var(--muted); }

/* ---------- 桌面 ---------- */

@media (min-width: 720px) {
  .hero { padding: 56px 0 28px; }
  .hero h1 { font-size: 36px; }
  .hero-sub { font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .module { margin-bottom: 52px; }
}

/* ---------- 面包屑 ---------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 20px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--accent); }
.crumbs i { font-style: normal; color: #d8d2c8; }

/* ---------- 头部元信息 ---------- */

.hero-meta {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 分类卡 ---------- */

.grid-cat { grid-template-columns: 1fr; }

.cat {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 18px 24px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.cat-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.35;
  transition: opacity 0.16s ease, width 0.16s ease;
}

.cat:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: 0 8px 26px rgba(28, 26, 23, 0.07);
}

.cat:hover .cat-bar { opacity: 1; width: 4px; }

.cat-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cat h3 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.cat:hover h3 { color: var(--accent); }

.cat-n {
  flex: none;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.cat-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.peek {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--line);
}

.peek li {
  position: relative;
  padding: 2px 0 2px 15px;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peek li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-line);
}

/* ---------- 条目列表 ---------- */

.list { border-top: 1px solid var(--line); }

.group-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 38px 0 0;
}

.group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.group-head span {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 10px 15px 4px;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s ease;
}

.row:hover { background: var(--accent-bg); }

.row-n {
  flex: none;
  width: 30px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #b9b2a8;
  font-variant-numeric: tabular-nums;
  transition: color 0.14s ease;
}

.row:hover .row-n { color: var(--accent); }

.row-main { flex: 1; min-width: 0; display: block; }
.row-main::after { content: ""; position: absolute; inset: 0; }

.row-title {
  display: block;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.14s ease;
}

.row:hover .row-title { color: var(--accent); }

.row-desc,
.row-meta {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta { font-variant-numeric: tabular-nums; }

.row-actions {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tag {
  font-size: 11.5px;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  padding: 3px 8px;
  transition: background 0.14s ease;
}

.tag:hover { background: var(--accent-bg); }

.go {
  font-size: 12.5px;
  color: #b9b2a8;
  white-space: nowrap;
  transition: color 0.14s ease;
}

.row:hover .go { color: var(--accent); }

.module[hidden], .search-results[hidden] { display: none; }

@media (min-width: 720px) {
  .grid-cat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 46px;
    align-content: start;
  }
}

@media (max-width: 560px) {
  .row { gap: 11px; padding-right: 4px; }
  .row-n { width: 22px; }
  .row-title { white-space: normal; }
  .row-desc { display: none; }
  .go { display: none; }
  .cat { padding: 18px 16px 16px 20px; }
}

/* ---------- markdown 文档页 ---------- */

.doc {
  max-width: 46em;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-soft);
  padding-bottom: 40px;
}

.doc h2, .doc h3, .doc h4 {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  color: var(--ink);
  font-weight: 500;
  margin: 1.8em 0 0.6em;
  line-height: 1.4;
}

.doc h2 { font-size: 20px; }
.doc h3 { font-size: 17px; }
.doc h4 { font-size: 15px; }
.doc p { margin: 0 0 1em; }
.doc ul, .doc ol { margin: 0 0 1em; padding-left: 1.4em; }
.doc li { margin-bottom: 0.35em; }

.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--line-soft);
  padding: 1px 5px;
  border-radius: 4px;
  color: #7a4a1e;
}

.doc pre {
  background: #f7f4ef;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 0 0 1.2em;
}

.doc pre code {
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
}

.doc blockquote {
  margin: 0 0 1.2em;
  padding: 10px 14px;
  border-left: 3px solid var(--accent-line);
  background: var(--line-soft);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}

.doc th, .doc td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  white-space: nowrap;
}

.doc th { background: var(--line-soft); font-weight: 500; color: var(--ink); }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.doc strong { color: var(--ink); font-weight: 500; }

/* ---------- 关于页 ---------- */

.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 34em;
}

.about-card p { margin: 0 0 0.9em; font-size: 14px; color: var(--ink-soft); line-height: 1.75; }
.about-card p:last-child { margin-bottom: 0; }
.about-qr { width: 168px; height: 168px; border-radius: 10px; border: 1px solid var(--line); margin: 4px 0 14px; }
.about-label { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
