/* ============ 古风主题 ============ */
:root {
  --paper: #f6f1e4;        /* 宣纸 */
  --paper-dark: #ede5d0;
  --ink: #2f2a25;          /* 墨色 */
  --ink-light: #6b625a;
  --cinnabar: #9e2b25;     /* 朱砂 */
  --cinnabar-light: #b5483f;
  --bamboo: #5f7a5a;       /* 竹青 */
  --gold: #a8842c;
  --border: #d8cdb4;
  --shadow: 0 2px 12px rgba(80, 62, 40, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "楷体", serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.9;
  /* 宣纸纹理 */
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(178, 158, 122, 0.12), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 120, 90, 0.10), transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.008) 4px);
  min-height: 100vh;
}

a { color: var(--cinnabar); text-decoration: none; }
a:hover { color: var(--cinnabar-light); }

/* 键盘导航焦点：虚线朱砂框，与主题一致；鼠标点击不触发 */
:focus-visible { outline: 2px dashed var(--cinnabar); outline-offset: 3px; border-radius: 2px; }

::selection { background: rgba(158, 43, 37, 0.18); }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶部 ============ */
.site-header {
  position: relative;
  text-align: center;
  padding: 48px 20px 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(158, 43, 37, 0.05), transparent 60%);
}

/* 右上角钤印：低调的后台入口 */
.corner-seal {
  width: 32px;
  height: 32px;
  line-height: 32px;
  border: 1.5px solid var(--cinnabar);
  border-radius: 4px;
  color: var(--cinnabar);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  transform: rotate(6deg);
  background: rgba(158, 43, 37, 0.05);
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.corner-seal:hover {
  opacity: 1;
  transform: rotate(-4deg) scale(1.08);
  color: var(--cinnabar);
}

.site-date {
  margin-top: 6px;
  color: var(--ink-light);
  font-size: 0.84rem;
  letter-spacing: 0.3em;
  opacity: 0.85;
}


/* 右上角：寻印 + 登阁印 */
.header-corner {
  position: absolute;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-drop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fffcf4;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  box-shadow: 0 6px 24px rgba(80, 62, 40, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 70;
}
.search-drop.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.search-drop input {
  width: 168px;
  border: none;
  outline: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 2px 2px 4px;
}
.search-drop input:focus { border-color: var(--cinnabar); }
.search-drop button {
  font-family: inherit;
  border: none;
  background: none;
  color: var(--cinnabar);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 4px;
}
.search-drop button:hover { opacity: 0.75; }
button.corner-seal { font-family: inherit; cursor: pointer; }

/* 横向门类题签 */
.cat-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 26px;
}
.cat-bar .cat-chip {
  font-family: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  padding: 4px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 252, 244, 0.65);
  color: var(--ink-light);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-bar .cat-chip:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.cat-bar .cat-chip.active {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fdf8ec;
}

/* 页脚题词 */
.footer-motto {
  color: rgba(107, 98, 90, 0.75);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  margin-bottom: 6px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 0.82rem;
}
.footer-links span { color: var(--border); }

/* ============ 关于小筑 ============ */
.about-shell { padding-top: 34px; padding-bottom: 64px; }
.about-paper {
  position: relative;
  overflow: hidden;
  background: rgba(255, 252, 244, .76);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.about-hero {
  min-height: 300px;
  padding: 56px 13% 48px 32%;
  border-radius: 8px 8px 34px 8px;
}
.about-hero::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -76px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(95, 122, 90, .2);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(95, 122, 90, .035), 0 0 0 56px rgba(158, 43, 37, .025);
  pointer-events: none;
}
.about-emblem {
  position: absolute;
  left: 9%;
  top: 58px;
  width: 148px;
  height: 148px;
  border: 2px solid var(--cinnabar);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cinnabar);
  background: radial-gradient(circle, rgba(158, 43, 37, .08), transparent 68%);
  transform: rotate(-7deg);
}
.about-emblem::before,
.about-emblem::after { content: ""; position: absolute; border-radius: 50%; }
.about-emblem::before { inset: 10px; border: 1px solid rgba(158, 43, 37, .55); }
.about-emblem::after { inset: 20px; border: 1px dashed rgba(158, 43, 37, .4); }
.about-emblem span { font-size: 4.2rem; font-weight: 700; line-height: 1; }
.about-kicker, .about-label { color: var(--cinnabar); font-size: .76rem; letter-spacing: .28em; }
.about-hero h2 { margin: 8px 0 12px; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: .12em; line-height: 1.45; }
.about-hero > p:last-child { max-width: 560px; color: var(--ink-light); }
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; margin-top: 22px; }
.about-intro, .about-letter { min-height: 280px; padding: 34px 36px; border-radius: 7px; }
.about-intro h3, .about-letter h3, .about-subscribe h3 { margin: 7px 0 14px; font-size: 1.28rem; letter-spacing: .12em; }
.about-intro > p:not(.about-label), .about-letter > p:not(.about-label), .about-subscribe p { color: var(--ink-light); }
.about-topic-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.about-topic-list a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-light);
  font-size: .88rem;
  transition: .18s ease;
}
.about-topic-list a:hover { color: var(--cinnabar); border-color: var(--cinnabar); transform: translateY(-2px); }
.about-topic-list span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(158, 43, 37, .08); color: var(--cinnabar); font-weight: 700; }
.about-letter { background: linear-gradient(145deg, rgba(255, 252, 244, .9), rgba(237, 229, 208, .64)); }
.about-mail { margin: 20px 0 16px; color: var(--ink) !important; font-family: "JetBrains Mono", Consolas, monospace; font-size: 1.02rem; letter-spacing: .02em; word-break: break-all; }
.about-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.about-mail-btn, .about-copy-btn, .about-rss-link {
  border: 1px solid var(--cinnabar);
  border-radius: 4px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: .9rem;
  cursor: pointer;
  transition: .18s ease;
}
.about-mail-btn { background: var(--cinnabar); color: #fdf8ec; }
.about-copy-btn { background: transparent; color: var(--cinnabar); }
.about-mail-btn:hover, .about-copy-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(80, 62, 40, .12); }
.about-mail-btn:hover { color: #fffaf0; background: var(--cinnabar-light); }
.about-copy-btn:hover { color: var(--cinnabar); background: rgba(158, 43, 37, .06); }
.about-note { margin-top: 20px; font-size: .82rem; line-height: 1.7; }
.subscribe-steps { display: grid; gap: 12px; margin-top: 22px; }
.subscribe-steps p { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--ink-light); }
.subscribe-steps span { display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border: 1px solid rgba(158, 43, 37, .35); border-radius: 50%; color: var(--cinnabar); font-weight: 700; font-size: .82rem; }
.about-subscribe { margin-top: 22px; padding: 28px 36px; border-radius: 7px 7px 24px 7px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.about-subscribe h3 { margin-bottom: 6px; }
.about-rss-link { flex-shrink: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--cinnabar); background: rgba(158, 43, 37, .045); }
.about-rss-link span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff7eb; background: var(--cinnabar); font-family: Georgia, serif; font-size: .7rem; font-weight: 700; }
.about-rss-link:hover { color: var(--cinnabar); border-color: var(--gold); background: rgba(168, 132, 44, .1); transform: translateY(-2px); }

/* 微信公众号联系卡片 */
.about-wechat {
  margin-top: 22px;
  padding: 28px 36px;
  border-radius: 7px 7px 24px 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
}
.wechat-copy h3 { margin-bottom: 10px; }
.wechat-copy strong { color: var(--cinnabar); font-weight: 700; }
.wechat-copy .about-note { max-width: 520px; margin-top: 14px; }
.wechat-qr { margin: 0; text-align: center; }
.wechat-qr-frame {
  width: 176px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 7px 18px rgba(80, 62, 40, .12);
}
.wechat-qr img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.wechat-qr figcaption { margin-top: 10px; color: var(--ink-light); font-size: .78rem; letter-spacing: .06em; white-space: nowrap; }

.mountain-divider {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 16px;
}

.site-title {
  font-size: 2.4rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em; /* 抵消最后一个字的间距，视觉居中 */
  color: var(--ink);
  font-weight: 700;
}

.site-title a { color: inherit; }

.site-subtitle {
  margin-top: 10px;
  color: var(--ink-light);
  font-size: 0.95rem;
  letter-spacing: 0.3em;
}

/* 朱砂印章 */
.seal {
  display: inline-block;
  vertical-align: middle;
  margin-left: 14px;
  width: 34px; height: 34px;
  line-height: 34px;
  border: 2px solid var(--cinnabar);
  border-radius: 4px;
  color: var(--cinnabar);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-indent: 0;
  transform: rotate(-4deg);
  background: rgba(158, 43, 37, 0.06);
}

/* 导航 */
.site-nav {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 8px 34px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--ink-light);
  font-size: 1.02rem;
  letter-spacing: 0.2em;
  padding: 4px 2px;
  position: relative;
}

.site-nav a:hover, .site-nav a.active { color: var(--cinnabar); }
.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: -4px;
  width: 1.6em; height: 2px;
  background: var(--cinnabar);
}

/* ============ 主体布局 ============ */
.layout { display: flex; gap: 36px; padding: 36px 0 60px; align-items: flex-start; }

.main { flex: 1; min-width: 0; }

/* ============ 侧栏 ============ */
.sidebar { width: 240px; flex-shrink: 0; position: sticky; top: 24px; }

.panel {
  background: rgba(255, 252, 244, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.panel h3 {
  font-size: 1.02rem;
  letter-spacing: 0.25em;
  color: var(--ink);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3::before { content: "❖"; color: var(--cinnabar); font-size: 0.8em; }

.category-list { list-style: none; }
.category-list li { margin: 4px 0; }
.category-list a {
  display: flex;
  justify-content: space-between;
  color: var(--ink-light);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.95rem;
}
.category-list a:hover, .category-list a.active {
  background: rgba(158, 43, 37, 0.07);
  color: var(--cinnabar);
}

.motto { color: var(--ink-light); font-size: 0.92rem; }
.motto p { margin: 6px 0; }

/* 搜索 */
.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 253, 247, 0.9);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}
.search-box input:focus { outline: none; border-color: var(--cinnabar); }

/* ============ 文章卡片 ============ */
.post-item {
  background: rgba(255, 252, 244, 0.78);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 26px 30px;
  margin-bottom: 26px;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(80, 62, 40, 0.16);
}

.post-item::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  background: linear-gradient(var(--cinnabar), transparent);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.post-item:hover::before { opacity: 1; }

.tag-private {
  color: var(--gold);
  border-color: rgba(168, 132, 44, 0.45);
  background: rgba(168, 132, 44, 0.07);
}

/* ============ 私密解锁卡 ============ */
.lock-card {
  background: rgba(255, 252, 244, 0.9);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 46px 40px;
  text-align: center;
  box-shadow: var(--shadow);
}
.lock-card .lock-icon { font-size: 2.2rem; margin-bottom: 10px; }
.lock-card h2 { font-size: 1.2rem; letter-spacing: 0.25em; margin-bottom: 8px; }
.lock-card p { color: var(--ink-light); font-size: 0.92rem; margin-bottom: 22px; }
.lock-card input {
  font-family: inherit;
  width: 300px;
  max-width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 253, 247, 0.9);
  text-align: center;
  letter-spacing: 0.1em;
  font-size: 1rem;
  margin-bottom: 16px;
}
.lock-card input:focus { outline: none; border-color: var(--gold); }
.lock-card .btn { min-width: 140px; }

.post-cover {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 4px 4px 0 0;
  margin: -26px -30px 20px;
  width: calc(100% + 60px);
  display: block;
  border-bottom: 1px solid var(--border);
}

.post-item h2 { font-size: 1.35rem; margin-bottom: 8px; }
.post-item h2 a { color: var(--ink); }
.post-item h2 a:hover { color: var(--cinnabar); }

.post-meta {
  color: var(--ink-light);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.tag {
  display: inline-block;
  padding: 1px 10px;
  border: 1px solid rgba(158, 43, 37, 0.35);
  border-radius: 999px;
  color: var(--cinnabar);
  font-size: 0.78rem;
  background: rgba(158, 43, 37, 0.05);
}

.post-summary { color: var(--ink-light); font-size: 0.97rem; }

.read-more {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 0; /* 扩大触控热区，移动端不易点空 */
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}

.read-more::after { content: " →"; }

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 34px;
  align-items: center;
}

.pagination button, .btn {
  font-family: inherit;
  background: rgba(255, 252, 244, 0.9);
  border: 1px solid var(--border);
  color: var(--ink-light);
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  transition: all 0.15s ease;
}

.pagination button:hover:not(:disabled), .btn:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: rgba(158, 43, 37, 0.05);
}

.pagination button:disabled { opacity: 0.4; cursor: default; }

.btn-primary {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fdf8ec;
}
.btn-primary:hover { background: var(--cinnabar-light); color: #fff; }

/* ============ 文章详情页 ============ */
.article {
  background: rgba(255, 252, 244, 0.82);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 44px 56px;
  box-shadow: var(--shadow);
}

.article-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ============ 文章目录（宽屏右栏 · 古风题签卡） ============ */
/* 目录与正文列解耦：正文 840px 居中，目录浮在右侧留白，仅 ≥1440px 展开；
   1080–1359px 与窄屏共用正文开头的折叠目录（.toc-inline） */
.toc-wrap {
  position: fixed;
  /* 左缘跟随正文卡（两者作为整体居中）：= 卡片右缘 + 40px = 50% + 420px - 目录半宽。
     clamp 公式与 .article-container 的 margin-left 保持配对，改动须同步 */
  right: auto;
  left: calc(50% + 420px - clamp(127px, 25vw - 233px, 173px));
  width: clamp(248px, calc(50vw - 466px), 340px);
  top: 50%;
  transform: translateY(-50%);
  max-height: 76vh;
  overflow-y: auto;
  z-index: 60;
  display: none;
  padding: 4px 3px; /* 给卡片边框与投影留出绘制空间 */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
@media (min-width: 1440px) {
  .toc-wrap.has-items { display: block; }
}

.toc-panel {
  display: flex;
  gap: 10px;
  align-items: stretch;
  padding: 16px 8px 16px 10px;
  background: rgba(255, 252, 244, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0.78;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
}
.toc-wrap:hover .toc-panel {
  opacity: 1;
  box-shadow: 0 10px 26px rgba(47, 42, 37, 0.14);
}

.toc-list { flex: 1; min-width: 0; }

.toc-panel a {
  display: block;
  color: #55493c;
  padding: 7px 12px;
  line-height: 1.8;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  border-radius: 5px;
  position: relative;
  overflow-wrap: anywhere;
}
.toc-panel a:hover { color: var(--cinnabar); background: rgba(158, 43, 37, 0.04); }
.toc-panel a.active { color: var(--cinnabar); font-weight: 700; background: rgba(158, 43, 37, 0.07); }
.toc-panel a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.2em;
  border-radius: 2px;
  background: var(--cinnabar);
}
a.toc-lv-3 { padding-left: 28px; font-size: 0.86rem; }
a.toc-lv-4 { padding-left: 44px; font-size: 0.82rem; }

/* 题签：竖排「目錄」+ 朱砂小印 */
.toc-ornament {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 4px 0 4px 10px;
  border-left: 1px solid var(--border);
}
.toc-seal {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--cinnabar);
  border-radius: 3px;
  color: var(--cinnabar);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(6deg);
  background: rgba(158, 43, 37, 0.05);
}
.toc-mark {
  writing-mode: vertical-rl;
  letter-spacing: 0.38em;
  color: var(--cinnabar);
  font-size: 0.82rem;
  font-weight: 700;
  padding-top: 2px;
}

/* 左下角月相阅读进度：月随读盈，读至卷末恰成满月 */
.read-progress-wrap {
  position: fixed;
  right: 46px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 90;
  cursor: default;
}
.read-progress-wrap svg { width: 60px; height: 60px; display: block; }

/* 古卷书签：阅读进度左侧的回顶入口 */
.back-to-top {
  width: 62px;
  height: 70px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: transform .22s ease, filter .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top img {
  width: 62px;
  height: 70px;
  display: block;
  object-fit: contain;
  opacity: .96;
  filter: contrast(1.18) saturate(.88) brightness(.94);
  pointer-events: none;
}
.back-to-top:hover,
.back-to-top:focus-visible {
  transform: translateY(-3px) scale(1.04);
  filter: drop-shadow(0 5px 8px rgba(59, 77, 75, .2));
  outline: none;
}
.back-to-top:active { transform: translateY(-1px); }

.moon-base {
  fill: rgba(122, 108, 84, 0.32);
  stroke: rgba(107, 94, 72, 0.6);
  stroke-width: 0.9;
}
.moon-lit {
  fill: #e3cd90;
  filter: drop-shadow(0 0 2.5px rgba(226, 199, 140, 0.9));
}
.moon-halo { transition: opacity 0.3s ease; }

.moon-stars circle {
  fill: #6b6250;
  animation: star-twinkle 3.4s ease-in-out infinite;
}
.moon-stars circle:nth-child(2) { animation-delay: 1.2s; }
.moon-stars circle:nth-child(3) { animation-delay: 2.1s; }
@keyframes star-twinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.85; }
}

.moon-cloud {
  fill: rgba(122, 108, 84, 0.28);
  animation: cloud-drift 26s linear infinite;
}
@keyframes cloud-drift {
  0% { transform: translateX(-16px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(16px); opacity: 0; }
}

.read-progress-wrap.complete .moon-lit {
  fill: #f7f0da;
  filter: drop-shadow(0 0 6px rgba(242, 232, 207, 1));
}

.rp-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.3;
}
.read-progress-wrap .rp-text {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: #55493c;
  font-family: inherit;
}
.read-progress-wrap .rp-phase {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: #55493c;
  opacity: 0.9;
  font-family: inherit;
}
.read-progress-wrap.complete .rp-phase {
  color: var(--cinnabar);
  opacity: 1;
}

/* 目录浮栏需要右侧留白 ≥ 320px（1440px 视口起），不足时改用正文内折叠目录 */
@media (max-width: 1439px) {
  .toc-wrap { display: none !important; }
}

@media (max-width: 1079px) {
  .read-progress-wrap { right: 26px; bottom: 16px; }
  .read-progress-wrap svg { width: 46px; }
  .back-to-top { width: 50px; height: 58px; }
  .back-to-top img { width: 50px; height: 58px; }
  .read-progress-wrap .rp-text { font-size: 0.8rem; }
}

/* ============ 窄屏与中屏折叠目录 ============ */
.toc-inline {
  display: none;
  margin: 6px 0 20px;
  background: rgba(255, 252, 244, 0.7);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 0.92rem;
}
@media (max-width: 1439px) {
  .toc-inline.has-items { display: block; }
}
.toc-inline summary {
  cursor: pointer;
  color: var(--ink-light);
  letter-spacing: 0.3em;
  font-size: 0.86rem;
  padding: 4px 0;
  list-style-position: inside;
}
.toc-inline[open] { padding-bottom: 14px; }
.toc-inline a {
  display: block;
  color: var(--ink-light);
  padding: 5px 8px;
  border-radius: 4px;
  line-height: 1.7;
}
.toc-inline a:hover { color: var(--cinnabar); }
.toc-inline a.active { color: var(--cinnabar); font-weight: 700; }
.toc-inline a.toc-lv-3 { padding-left: 22px; font-size: 0.88rem; }
.toc-inline a.toc-lv-4 { padding-left: 36px; font-size: 0.84rem; }

/* 宽屏下首页列表同步放宽，与文章页观感一致 */
@media (min-width: 1080px) {
  body.home .container { max-width: 1100px; }
}

/* 文章页：正文列 840px 居中（文字列约 730px），阅读更聚焦；目录不再挤占正文宽度 */
.article-container {
  max-width: 840px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

/* 宽屏（≥1440px）：目录在右侧留白展开，正文字号微升；
   正文与目录作为整体视觉居中——消除目录占位造成的左侧大留白 */
@media (min-width: 1440px) {
  .article-container {
    margin-left: calc(50% - 440px - clamp(127px, 25vw - 233px, 173px));
    margin-right: auto;
  }
  .article .article-body { font-size: 1.12rem; }
}

.article-cover {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  margin-bottom: 26px;
}

.article h1 {
  font-size: 1.8rem;
  text-align: center;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}

.article .meta {
  text-align: center;
  color: var(--ink-light);
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.article .meta::after {
  content: "❦";
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: -13px;
  background: rgba(255, 252, 244, 1);
  padding: 0 12px;
  color: var(--cinnabar);
}

.article-body { font-size: 1.05rem; }
.article-body h1, .article-body h2, .article-body h3 {
  margin: 1.5em 0 0.6em;
  letter-spacing: 0.1em;
}
.article-body h2 { border-left: 4px solid var(--cinnabar); padding-left: 12px; }
.article-body p { margin: 0.9em 0; text-align: justify; }
.article-body blockquote {
  margin: 1.2em 0;
  padding: 10px 20px;
  border-left: 3px solid var(--gold);
  background: rgba(168, 132, 44, 0.07);
  color: var(--ink-light);
}
.article-body code {
  font-family: "JetBrains Mono", Consolas, monospace;
  background: var(--paper-dark);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}
.article-body pre {
  background: #2f2a25;
  color: #e8e0cd;
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.2em 0;
  line-height: 1.6;
}
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body img { max-width: 100%; border-radius: 4px; margin: 8px 0; }
.article-body hr { border: none; border-top: 1px dashed var(--border); margin: 2em auto; width: 60%; }
.article-body table { border-collapse: collapse; margin: 1.2em 0; width: 100%; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 14px; }

/* ---- Markdown 扩展语法（任务列表 / 高亮 / 上下标 / 脚注 / 定义列表） ---- */
.article-body ul li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.2em; }
.article-body li > input[type="checkbox"] {
  accent-color: var(--cinnabar);
  width: 15px; height: 15px;
  vertical-align: -2px;
  margin-right: 6px;
}
.article-body mark {
  background: linear-gradient(transparent 55%, rgba(192, 57, 43, 0.22) 55%);
  color: inherit;
  padding: 0 2px;
}
.article-body sub, .article-body sup { font-size: 0.72em; line-height: 0; }
.article-body sup.md-fnref { margin: 0 1px; }
.article-body sup.md-fnref a {
  color: var(--cinnabar);
  text-decoration: none;
  font-weight: 700;
  padding: 0 2px;
}
.article-body .md-footnotes { margin-top: 2.4em; }
.article-body .md-footnotes hr { width: 100%; margin: 0 0 0.8em; }
.article-body .md-footnotes ol { padding-left: 1.4em; color: var(--ink-light); font-size: 0.92em; }
.article-body .md-footnotes li { margin: 0.4em 0; }
.article-body .md-fn-back { text-decoration: none; color: var(--ink-light); margin-left: 4px; }
.article-body .md-emoji { font-style: normal; }
.article-body dl { margin: 1.2em 0; }
.article-body dl dt { font-weight: 700; color: var(--ink); }
.article-body dl dd { margin: 0.2em 0 0.8em 1.4em; color: var(--ink-light); border-left: 2px solid var(--border); padding-left: 12px; }

.back-link { display: inline-block; margin-bottom: 18px; color: var(--ink-light); letter-spacing: 0.1em; }
.back-link::before { content: "← "; }

/* ============ 评论 ============ */
.comments-section { margin-top: 34px; }
.comments-section h2 {
  font-size: 1.15rem;
  letter-spacing: 0.25em;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comments-section h2::before { content: "❖"; color: var(--cinnabar); font-size: 0.8em; }

.comment-item {
  background: rgba(255, 252, 244, 0.78);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 12px;
}
.comment-item .c-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ink-light);
  margin-bottom: 6px;
}
.comment-item .c-name { color: var(--cinnabar); font-weight: 700; }
.comment-item .c-body { font-size: 0.96rem; }

.comment-form {
  background: rgba(255, 252, 244, 0.78);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
.comment-form input, .comment-form textarea {
  width: 100%;
  font-family: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 253, 247, 0.9);
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.comment-form textarea { min-height: 90px; resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--cinnabar);
}

/* ============ 分享：一印展开 ============ */
#share-dock {
  margin-top: 34px;
  text-align: center;
  position: relative;
}

.share-toggle {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 10px;
  background: rgba(255, 252, 244, 0.9);
  border: 1.5px solid rgba(158, 43, 37, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.share-toggle:hover {
  border-color: var(--cinnabar);
  box-shadow: 0 3px 12px rgba(158, 43, 37, 0.18);
  transform: translateY(-1px);
}
.st-seal {
  width: 30px;
  height: 30px;
  line-height: 30px;
  border: 1.5px solid var(--cinnabar);
  border-radius: 5px;
  color: var(--cinnabar);
  font-size: 15px;
  font-weight: 700;
  background: rgba(158, 43, 37, 0.06);
  transform: rotate(-4deg);
}
.st-label {
  color: var(--cinnabar);
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
}

.share-card {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  transform: translateX(-50%) translateY(8px) scale(0.97);
  width: min(430px, calc(100vw - 48px));
  background: #fffcf4;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 36px rgba(80, 62, 40, 0.22);
  padding: 18px 20px 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 80;
}
#share-dock.open .share-card {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}
.share-card::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fffcf4;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.sc-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.sc-item {
  font-family: inherit;
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.95);
  color: #55493c;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sc-item:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: rgba(158, 43, 37, 0.05);
}
.sc-item.wechat { border-color: rgba(42, 174, 103, 0.5); color: #2aae67; }
.sc-item.wechat:hover { background: rgba(42, 174, 103, 0.07); }

.sc-tip {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.78rem;
  color: var(--ink-light);
  line-height: 1.7;
}


/* 二维码弹层 */
.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 42, 37, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.qr-card {
  background: #fffcf4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 34px;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.qr-card h4 { font-size: 1.05rem; letter-spacing: 0.2em; margin-bottom: 6px; }
.qr-card .qr-box { display: flex; justify-content: center; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 6px; margin: 12px 0; }
.wechat-account-qr { display: block; width: 200px; height: 200px; object-fit: contain; }
.qr-card p { font-size: 0.85rem; color: var(--ink-light); line-height: 1.7; margin-bottom: 14px; }
.qr-card .btn { margin-top: 4px; }

/* ============ 页脚 ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 20px 34px;
  text-align: center;
  color: var(--ink-light);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
}
.footer-filing { margin: 10px 0 0; font-size: 0.78rem; letter-spacing: 0.08em; }
.footer-filing a { color: inherit; text-decoration: none; }
.footer-filing a:hover, .footer-filing a:focus-visible { color: var(--cinnabar); text-decoration: underline; }

/* ============ 提示 ============ */
.empty { text-align: center; color: var(--ink-light); padding: 70px 0; letter-spacing: 0.2em; }

.toast {
  position: fixed;
  top: 26px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--ink);
  color: #f6f1e4;
  padding: 10px 26px;
  border-radius: 4px;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 820px) {
  .layout { flex-direction: column; align-items: stretch; }
  .main, .sidebar { width: 100%; }
  .sidebar { position: static; }
  .site-title { font-size: 1.7rem; }
  .article { padding: 30px 22px; }
  .cat-bar .cat-chip { padding: 9px 18px; } /* 触控目标加大到约 44px 高 */
  .about-hero { padding: 44px 10% 42px 30%; }
  .about-emblem { left: 7%; width: 124px; height: 124px; }
  .about-emblem span { font-size: 3.5rem; }
}

/* 手机端细节 */
@media (max-width: 480px) {
  body { -webkit-tap-highlight-color: transparent; }

  /* 长标题在窄屏下左对齐、缩小，避免居中排五六行 */
  .article h1 { font-size: 1.4rem; text-align: left; letter-spacing: 0.06em; line-height: 1.6; }
  .article .meta { text-align: left; }

  .site-header { padding: 34px 14px 0; }
  .header-corner { top: 14px; right: 12px; gap: 8px; }
  .search-drop input { width: 120px; }
  .corner-seal { width: 28px; height: 28px; line-height: 28px; font-size: 12px; }
  .site-title { font-size: 1.5rem; letter-spacing: 0.32em; text-indent: 0.32em; }
  .site-title .seal { width: 28px; height: 28px; line-height: 28px; font-size: 11px; margin-left: 8px; }
  .site-subtitle { font-size: 0.84rem; letter-spacing: 0.18em; }
  .site-date { font-size: 0.74rem; letter-spacing: 0.2em; }
  .mountain-divider { height: 32px; margin-top: 10px; }

  .container { padding: 0 12px; }
  .layout { padding: 22px 0 44px; gap: 0; }

  .post-item { padding: 20px 18px; margin-bottom: 18px; }
  .post-item h2 { font-size: 1.15rem; }
  .post-cover { height: 170px; margin: -20px -18px 16px; width: calc(100% + 36px); }
  .post-summary { font-size: 0.92rem; }

  .article { padding: 26px 18px 30px; }
  .article h1 { font-size: 1.4rem; }
  .article-body { font-size: 1rem; }
  .article-cover { max-height: 240px; }

  .share-toggle { padding: 6px 16px 6px 8px; }
  .st-label { font-size: 0.88rem; }
  .sc-item { padding: 6px 12px; font-size: 0.84rem; }

  .lock-card { padding: 34px 20px; }
  .lock-card input { width: 100%; }

  .qr-card { padding: 22px 16px; max-width: 300px; }

  .panel { padding: 14px 16px; }
  .pagination { flex-wrap: wrap; }
  .site-nav { margin-top: 16px; gap: 8px 22px; }
  .site-nav a { font-size: .92rem; }
  .about-shell { padding-top: 22px; padding-bottom: 44px; }
  .about-hero { min-height: 0; padding: 154px 22px 30px; border-radius: 7px 7px 24px 7px; }
  .about-emblem { top: 24px; left: 50%; width: 108px; height: 108px; transform: translateX(-50%) rotate(-7deg); }
  .about-emblem span { font-size: 3rem; }
  .about-grid { grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
  .about-intro, .about-letter { min-height: 0; padding: 26px 22px; }
  .about-subscribe { margin-top: 16px; padding: 26px 22px; align-items: flex-start; flex-direction: column; gap: 18px; }
  .about-rss-link { width: 100%; justify-content: center; }
  .about-wechat { margin-top: 16px; padding: 26px 22px; grid-template-columns: 1fr; gap: 22px; text-align: center; }
  .wechat-copy .about-note { margin-right: auto; margin-left: auto; }
  .wechat-qr { justify-self: center; }
}

/* 平板竖屏：文章页留白适中 */


/* ============ 文末互动：言 / 赠 双印 ============ */
.interact-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 34px;
}
.interact-dock { position: relative; }
.share-toggle.active .st-seal {
  background: var(--cinnabar);
  color: #fdf8ec;
}
.st-label #cmt-count {
  font-style: normal;
  font-size: 0.8em;
  opacity: 0.75;
  letter-spacing: 0.05em;
}

.comments-card {
  max-width: 640px;
  margin: 16px auto 0;
  background: rgba(255, 252, 244, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.comments-card .comment-form { margin-bottom: 6px; }
.comments-card .comment-item { background: rgba(255, 253, 247, 0.95); }

/* ============ 主题切换 ============ */
.theme-trigger {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  line-height: 32px;
  border: 1.5px solid var(--cinnabar);
  border-radius: 4px;
  padding: 0;
  background: rgba(158, 43, 37, 0.05);
  color: var(--cinnabar);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0.5;
  transform: rotate(-4deg);
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease, transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}
.theme-trigger:hover, .theme-trigger[aria-expanded="true"] {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: rgba(255, 252, 244, 0.96);
  opacity: 1;
  transform: rotate(4deg) scale(1.08);
  box-shadow: 0 4px 12px rgba(158, 43, 37, .14);
}
.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 42px;
  width: 190px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 252, 244, 0.98);
  box-shadow: 0 10px 28px rgba(80, 62, 40, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px) scale(.98);
  transform-origin: top right;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
  z-index: 80;
}
.theme-menu.open { opacity: 1; visibility: visible; transform: none; }
.theme-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  padding: 8px;
  background: transparent;
  color: var(--ink-light);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.theme-option:hover, .theme-option.active { background: rgba(158, 43, 37, .07); color: var(--cinnabar); }
.theme-option-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: .78rem;
}
.theme-option-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 1px; }
.theme-option-copy strong { font-size: .85rem; font-weight: 700; }
.theme-option-copy small { font-size: .68rem; opacity: .68; letter-spacing: .04em; }
.theme-option-check { opacity: 0; font-size: .8rem; }
.theme-option.active .theme-option-check { opacity: 1; }

/* 水墨：原创太极山水作为远景，装饰层缓慢呼吸 */
html[data-theme="ink"] {
  --paper: #f3fafc;
  --paper-dark: #e5f1f5;
  --ink: #294c57;
  --ink-light: #648692;
  --cinnabar: #4f8ea0;
  --cinnabar-light: #6fa8b7;
  --bamboo: #79a9b3;
  --gold: #7faebb;
  --border: #c4dce3;
  --shadow: 0 5px 22px rgba(77, 131, 147, .1);
}
html[data-theme="ink"] body {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(247, 252, 253, .31), rgba(247, 252, 253, .31)),
    url('/images/theme-ink-taiji.webp');
  background-position: 50% 0, 50% 46%;
  background-size: 100% 100%, cover;
  background-attachment: fixed, fixed;
  animation: ink-backdrop-drift 22s ease-in-out infinite alternate;
}
html[data-theme="ink"] .site-header {
  background: linear-gradient(180deg, rgba(249, 253, 254, .55), rgba(242, 250, 252, .2));
}
html[data-theme="ink"] .site-header::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 84px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(155, 204, 216, .13);
  filter: blur(22px);
  transform: translateX(-50%);
  animation: ink-taiji-aura 8s ease-in-out infinite;
  pointer-events: none;
}
html[data-theme="ink"] .mountain-divider path:first-child { fill: rgba(103, 164, 181, .22); }
html[data-theme="ink"] .mountain-divider path:last-child { fill: rgba(74, 123, 139, .11); }
html[data-theme="ink"] .post-item,
html[data-theme="ink"] .article,
html[data-theme="ink"] .panel,
html[data-theme="ink"] .comment-item,
html[data-theme="ink"] .comment-form,
html[data-theme="ink"] .comments-card,
html[data-theme="ink"] .lock-card {
  background: rgba(252, 254, 255, .78);
  border-color: rgba(159, 196, 205, .6);
}
html[data-theme="ink"] .post-item:hover { box-shadow: 0 10px 28px rgba(78, 134, 150, .16); }
html[data-theme="ink"] .post-item::before { background: linear-gradient(var(--cinnabar), transparent); }
html[data-theme="ink"] .article .meta::after { background: rgba(252, 254, 255, .98); }
html[data-theme="ink"] .search-drop,
html[data-theme="ink"] .theme-menu,
html[data-theme="ink"] .share-card,
html[data-theme="ink"] .qr-card { background: rgba(250, 254, 255, .98); }
html[data-theme="ink"] .article-body blockquote { background: rgba(126, 179, 193, .1); }
html[data-theme="ink"] .article-body code { background: var(--paper-dark); color: #315764; }
html[data-theme="ink"] .article-body pre {
  background: #28434b;
  color: #f1fbfd;
  border: 1px solid rgba(126, 179, 193, .72);
  box-shadow: 0 8px 20px rgba(51, 105, 119, .12);
}
html[data-theme="ink"] .article-body pre code {
  background: transparent;
  color: inherit;
  font-family: "JetBrains Mono", "Cascadia Mono", Consolas, "Microsoft YaHei", "Noto Sans SC", monospace;
  font-size: .94em;
  letter-spacing: 0;
}
html[data-theme="ink"] .read-progress-wrap .rp-text,
html[data-theme="ink"] .read-progress-wrap .rp-phase { color: #416b77; }
html[data-theme="ink"] .site-footer { background: rgba(242, 250, 252, .35); }
html[data-theme="ink"] .about-paper { background: rgba(252, 254, 255, .78); border-color: rgba(159, 196, 205, .6); }
html[data-theme="ink"] .about-letter { background: linear-gradient(145deg, rgba(253, 255, 255, .9), rgba(222, 242, 247, .64)); }
html[data-theme="ink"] .about-emblem { border-color: #5f9eb0; color: #477d8c; background: radial-gradient(circle, rgba(123, 184, 199, .14), transparent 68%); }
html[data-theme="ink"] .about-emblem::before { border-color: rgba(95, 158, 176, .55); }
html[data-theme="ink"] .about-emblem::after { border-color: rgba(95, 158, 176, .38); }

/* 科技：石墨金属底色 + 赛博朋克霓虹细节 */
html[data-theme="cyber"] {
  --paper: #15191c;
  --paper-dark: #252c30;
  --ink: #edf4f3;
  --ink-light: #a4b5b7;
  --cinnabar: #ff7650;
  --cinnabar-light: #ff9a72;
  --bamboo: #6ee2d3;
  --gold: #ffbd54;
  --border: #4b575b;
  --shadow: 0 7px 24px rgba(0, 0, 0, .38);
}
html[data-theme="cyber"] body {
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background-color: #15191c;
  background-image:
    linear-gradient(180deg, rgba(9, 14, 22, .46), rgba(9, 14, 19, .72)),
    url('/images/theme-cyber.webp');
  background-position: center, center;
  background-size: cover, cover;
  background-attachment: fixed, fixed;
  color: var(--ink);
}
html[data-theme="cyber"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 11% 18%, rgba(110, 226, 211, .12), transparent 24%), radial-gradient(circle at 88% 70%, rgba(255, 78, 137, .09), transparent 26%);
  animation: cyber-glow 9s ease-in-out infinite alternate;
}
html[data-theme="cyber"] .site-header,
html[data-theme="cyber"] .site-footer { background: rgba(12, 15, 17, .36); }
html[data-theme="cyber"] .site-title,
html[data-theme="cyber"] .site-title a { color: #f7fffe; font-family: Consolas, "Microsoft YaHei", sans-serif; text-shadow: 0 0 14px rgba(110, 226, 211, .22); }
html[data-theme="cyber"] .site-subtitle,
html[data-theme="cyber"] .site-date { color: #9fb3b5; }
html[data-theme="cyber"] .seal,
html[data-theme="cyber"] .corner-seal { border-color: var(--cinnabar); color: var(--cinnabar); background: rgba(255, 118, 80, .08); }
html[data-theme="cyber"] .site-title .seal { color: #ffb39a; background: rgba(255, 118, 80, .16); text-shadow: none; opacity: 1; }
html[data-theme="cyber"] .corner-seal:hover { color: #fff; box-shadow: 0 0 14px rgba(255, 118, 80, .32); }
html[data-theme="cyber"] .theme-trigger,
html[data-theme="cyber"] .search-drop,
html[data-theme="cyber"] .theme-menu,
html[data-theme="cyber"] .share-card,
html[data-theme="cyber"] .qr-card { background: rgba(24, 29, 31, .97); border-color: #566568; color: #d8e5e5; }
html[data-theme="cyber"] .theme-trigger:hover,
html[data-theme="cyber"] .theme-trigger[aria-expanded="true"] { border-color: var(--bamboo); color: var(--bamboo); background: #20282a; }
html[data-theme="cyber"] .theme-option { color: #b5c4c5; }
html[data-theme="cyber"] .theme-option:hover,
html[data-theme="cyber"] .theme-option.active { color: var(--bamboo); background: rgba(110, 226, 211, .09); }
html[data-theme="cyber"] .theme-option-mark { text-shadow: 0 0 8px currentColor; }
html[data-theme="cyber"] .search-drop input,
html[data-theme="cyber"] .search-drop button { color: var(--ink); }
html[data-theme="cyber"] .search-drop input { border-bottom-color: #566568; }
html[data-theme="cyber"] .cat-bar .cat-chip,
html[data-theme="cyber"] .pagination button,
html[data-theme="cyber"] .btn,
html[data-theme="cyber"] .share-toggle,
html[data-theme="cyber"] .sc-item { background: rgba(27, 33, 35, .82); border-color: #536164; color: #bbc9ca; }
html[data-theme="cyber"] .cat-bar .cat-chip:hover,
html[data-theme="cyber"] .cat-bar .cat-chip.active,
html[data-theme="cyber"] .pagination button:hover:not(:disabled),
html[data-theme="cyber"] .btn:hover,
html[data-theme="cyber"] .sc-item:hover { color: #fff; border-color: var(--cinnabar); background: rgba(255, 118, 80, .12); }
html[data-theme="cyber"] .cat-bar .cat-chip.active,
html[data-theme="cyber"] .btn-primary { background: var(--cinnabar); color: #181c1e; border-color: var(--cinnabar); box-shadow: 0 0 14px rgba(255, 118, 80, .2); }
html[data-theme="cyber"] .post-item,
html[data-theme="cyber"] .article,
html[data-theme="cyber"] .panel,
html[data-theme="cyber"] .comment-item,
html[data-theme="cyber"] .comment-form,
html[data-theme="cyber"] .comments-card,
html[data-theme="cyber"] .lock-card { background: linear-gradient(135deg, rgba(20, 25, 27, .93), rgba(54, 62, 65, .74)); border-color: #59686b; }
html[data-theme="cyber"] .post-item { box-shadow: inset 0 0 26px rgba(110, 226, 211, .035), var(--shadow); }
html[data-theme="cyber"] .post-item:hover { box-shadow: inset 0 0 26px rgba(110, 226, 211, .07), 0 12px 30px rgba(0,0,0,.5); }
html[data-theme="cyber"] .post-item::before { background: linear-gradient(var(--bamboo), var(--cinnabar)); }
html[data-theme="cyber"] .post-item h2 a,
html[data-theme="cyber"] .article h1,
html[data-theme="cyber"] .article-body h1,
html[data-theme="cyber"] .article-body h2,
html[data-theme="cyber"] .article-body h3,
html[data-theme="cyber"] .panel h3 { color: #eff8f7; }
html[data-theme="cyber"] .article-body h2 { border-left-color: var(--bamboo); }
html[data-theme="cyber"] .article-body blockquote { background: rgba(110, 226, 211, .08); border-left-color: var(--cinnabar); color: #afc0c1; }
html[data-theme="cyber"] .article-body code { background: #252d30; color: #a9f3e8; }
html[data-theme="cyber"] .article-body pre { background: #0b0f11; color: #dff8f4; border: 1px solid #3e5558; }
html[data-theme="cyber"] .article-body th,
html[data-theme="cyber"] .article-body td { border-color: #536164; }
html[data-theme="cyber"] .article .meta::after { background: #252c2f; }
html[data-theme="cyber"] .read-progress-wrap .rp-text,
html[data-theme="cyber"] .read-progress-wrap .rp-phase { color: #b7c7c8; }
html[data-theme="cyber"] .moon-base { fill: rgba(99, 115, 118, .48); stroke: rgba(201, 220, 219, .6); }
html[data-theme="cyber"] .moon-lit { fill: #73e8d8; filter: drop-shadow(0 0 6px rgba(110, 226, 211, .72)); }
html[data-theme="cyber"] .moon-stars circle { fill: #ff9a72; }
html[data-theme="cyber"] .site-footer { border-top-color: #4b575b; color: #94a7a9; }
html[data-theme="cyber"] .toast { background: #e8f5f3; color: #15191c; }
html[data-theme="cyber"] .about-paper { background: linear-gradient(135deg, rgba(20, 25, 27, .93), rgba(54, 62, 65, .74)); border-color: #59686b; }
html[data-theme="cyber"] .about-letter { background: linear-gradient(145deg, rgba(24, 31, 33, .94), rgba(50, 60, 62, .82)); }
html[data-theme="cyber"] .about-emblem { border-color: var(--bamboo); color: var(--bamboo); background: radial-gradient(circle, rgba(110, 226, 211, .14), transparent 68%); box-shadow: 0 0 30px rgba(110, 226, 211, .12); }
html[data-theme="cyber"] .about-emblem::before { border-color: rgba(110, 226, 211, .55); }
html[data-theme="cyber"] .about-emblem::after { border-color: rgba(255, 118, 80, .45); }
html[data-theme="cyber"] .about-topic-list a { color: #b5c4c5; border-color: #536164; }
html[data-theme="cyber"] .about-topic-list a:hover { color: var(--bamboo); border-color: var(--bamboo); background: rgba(110, 226, 211, .08); }
html[data-theme="cyber"] .about-mail { color: #e9f7f5 !important; }
html[data-theme="cyber"] .subscribe-steps span { border-color: rgba(110, 226, 211, .65); color: var(--bamboo); }
html[data-theme="cyber"] .about-copy-btn, html[data-theme="cyber"] .about-rss-link { color: var(--bamboo); border-color: var(--bamboo); background: rgba(110, 226, 211, .05); }
html[data-theme="cyber"] .about-mail-btn { color: #15191c; background: var(--cinnabar); }
html[data-theme="cyber"] .wechat-copy strong,
html[data-theme="cyber"] .wechat-qr figcaption { color: var(--bamboo); }
html[data-theme="cyber"] .wechat-qr-frame { border-color: #6b7b7e; box-shadow: 0 8px 22px rgba(0, 0, 0, .34); }

/* 科技主题目录：移动端使用深色金属底，确保标题与选中状态清晰可读 */
html[data-theme="cyber"] .toc-panel {
  opacity: .86;
  filter: none;
}
html[data-theme="cyber"] .toc-panel a {
  color: #dcebea;
}
html[data-theme="cyber"] .toc-panel a:hover {
  color: var(--cinnabar-light);
}
html[data-theme="cyber"] .toc-panel a.active {
  color: var(--bamboo);
  background: rgba(110, 226, 211, .13);
}
html[data-theme="cyber"] .toc-panel a.active::before {
  background: var(--bamboo);
  box-shadow: 0 0 8px rgba(110, 226, 211, .55);
}
html[data-theme="cyber"] .toc-ornament {
  border-left-color: #536164;
}
html[data-theme="cyber"] .toc-seal,
html[data-theme="cyber"] .toc-mark {
  color: var(--bamboo);
}
html[data-theme="cyber"] .toc-seal {
  border-color: var(--bamboo);
  background: rgba(110, 226, 211, .08);
}
html[data-theme="cyber"] .toc-inline {
  background: rgba(18, 24, 27, .94);
  border-color: #536164;
  box-shadow: inset 0 0 18px rgba(110, 226, 211, .04);
}
html[data-theme="cyber"] .toc-inline summary,
html[data-theme="cyber"] .toc-inline a {
  color: #dcebea;
}
html[data-theme="cyber"] .toc-inline summary {
  text-shadow: 0 0 10px rgba(110, 226, 211, .18);
}
html[data-theme="cyber"] .toc-inline a:hover {
  color: var(--cinnabar-light);
  background: rgba(255, 118, 80, .08);
}
html[data-theme="cyber"] .toc-inline a.active {
  color: var(--bamboo);
  background: rgba(110, 226, 211, .12);
}

@keyframes ink-backdrop-drift {
  from { background-position: 50% 0, 49% 46%; }
  to { background-position: 50% 0, 51% 48%; }
}
@keyframes ink-taiji-aura {
  0%, 100% { opacity: .45; transform: translateX(-50%) scale(.94); }
  50% { opacity: .85; transform: translateX(-50%) scale(1.08); }
}
@keyframes cyber-glow {
  from { opacity: .58; transform: translateX(-1%); }
  to { opacity: 1; transform: translateX(1%); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="ink"] body,
  html[data-theme="ink"] .site-header::before,
  html[data-theme="cyber"] body::before { animation: none; }
}

/* 减少动态效果：关闭首页开卷入场动画 */
@media (prefers-reduced-motion: reduce) {
  body.home .site-title, body.home .site-title .seal, body.home .site-subtitle,
  body.home .site-date, body.home .site-nav, body.home .mountain-divider,
  body.home .cat-bar, body.home .post-item { animation: none; }
}

@media (max-width: 480px) {
  .theme-menu { right: 34px; width: 174px; }
}

/* 科技主题移动端：取消彩色重影，优先保证标题与印章文字清晰 */
@media (max-width: 480px) {
  html[data-theme="cyber"] .site-title,
  html[data-theme="cyber"] .site-title a {
    color: #f7fffe;
    text-shadow: 0 0 10px rgba(110, 226, 211, .18);
  }
  html[data-theme="cyber"] .site-title .seal {
    color: #ffb39a;
    border-color: var(--cinnabar);
    background: rgba(255, 118, 80, .16);
    text-shadow: none;
    opacity: 1;
    font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  }
}

/* Markdown 扩展：删除线 / 下划线 / 高亮 */
.article-body mark, .preview-pane mark {
  background: linear-gradient(transparent 55%, rgba(226, 199, 140, 0.75) 55%);
  color: inherit;
  padding: 0 2px;
}
.article-body u, .preview-pane u {
  text-decoration-color: rgba(158, 43, 37, 0.65);
  text-underline-offset: 4px;
}

/* Markdown 扩展：话题标签章 */
.md-tag {
  display: inline-block;
  color: var(--cinnabar);
  background: rgba(158, 43, 37, 0.07);
  border: 1px solid rgba(158, 43, 37, 0.3);
  border-radius: 4px;
  padding: 0 7px;
  font-size: 0.88em;
  line-height: 1.7;
  letter-spacing: 0.04em;
}

/* ============ 首页开卷入场动画 ============ */
/* 标题如墨迹晕开；印章后落；副题、日期、导航依次显影；山水横卷展开；卡片逐张升起。
   仅 from 定义起始态，动画结束回落到各元素的自然样式（fill: backwards 补delay空窗）。 */
@keyframes ink-in {
  from { opacity: 0; filter: blur(8px); letter-spacing: 0.9em; text-indent: 0.9em; }
}
@keyframes seal-stamp {
  0%   { opacity: 0; transform: rotate(10deg) scale(2.1); }
  62%  { opacity: 1; transform: rotate(-7deg) scale(0.94); }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); } /* 与 .seal 原始 rotate(-4deg) 一致 */
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
}
@keyframes brush-line {
  from { opacity: 0; transform: scaleX(0.55); }
}

body.home .site-title { animation: ink-in 1s cubic-bezier(.2, .6, .2, 1) backwards; }
body.home .site-title .seal { animation: seal-stamp .42s cubic-bezier(.25, .6, .3, 1.1) .72s backwards; }
body.home .site-subtitle { animation: fade-up .7s ease-out .38s backwards; }
body.home .site-date { animation: fade-up .7s ease-out .52s backwards; }
body.home .site-nav { animation: fade-up .7s ease-out .66s backwards; }
body.home .mountain-divider { animation: brush-line .9s ease-out .5s backwards; transform-origin: center; }
body.home .cat-bar { animation: fade-up .6s ease-out .82s backwards; }
body.home .post-item { animation: fade-up .55s ease-out backwards; }
body.home .post-item:nth-child(1) { animation-delay: .92s; }
body.home .post-item:nth-child(2) { animation-delay: 1.0s; }
body.home .post-item:nth-child(3) { animation-delay: 1.08s; }
body.home .post-item:nth-child(4) { animation-delay: 1.16s; }
body.home .post-item:nth-child(5) { animation-delay: 1.24s; }
body.home .post-item:nth-child(6) { animation-delay: 1.32s; }
body.home .post-item:nth-child(7) { animation-delay: 1.4s; }
body.home .post-item:nth-child(8) { animation-delay: 1.48s; }
body.home .post-item:nth-child(n+9) { animation-delay: 1.52s; }

/* ============ 麒麟：透明实时 3D，不对身体部件做 CSS 变换 ============ */
.qilin-pet {
  position: fixed; right: 10px; top: 84px; width: 184px; height: 218px;
  z-index: 40; cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.qilin-pet:active, .qilin-pet.qilin-follow { cursor: grabbing; }
.qilin-pet:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: -12px; border-radius: 40%; }
.qilin-canvas, .qilin-fallback {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; object-fit: contain;
}
.qilin-canvas { opacity: 0; transition: opacity .25s ease; }
.qilin-ready .qilin-canvas { opacity: 1; }
.qilin-ready .qilin-fallback { visibility: hidden; }
.qilin-bubble {
  position: absolute; z-index: 1; right: 6px; bottom: calc(100% - 14px);
  width: max-content; max-width: min(200px, 80vw); padding: 9px 13px;
  background: rgba(255, 252, 245, .97); border: 1px solid var(--border);
  border-radius: 14px 14px 4px 14px; box-shadow: 0 5px 22px rgba(35, 50, 50, .09);
  color: #38433f; font-size: .78rem; line-height: 1.65; letter-spacing: .03em;
  opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.qilin-bubble.show { opacity: 1; transform: none; }
.qilin-bubble-below .qilin-bubble { bottom: auto; top: calc(100% - 14px); }
html[data-theme="ink"] .qilin-bubble { background: rgba(246, 250, 251, .97); color: #2a444f; border-color: #bacdd0; }
html[data-theme="cyber"] .qilin-bubble { background: rgba(20, 34, 46, .97); color: #e2f7fc; border-color: #447d8c; }
@media (max-width: 600px) {
  .qilin-pet { width: 110px; height: 132px; top: auto; bottom: 66px; right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .qilin-canvas, .qilin-bubble { transition: none; }
}

/* 麒麟抚摸爱心粒子（位置由 JS 内联给定） */
.qilin-heart {
  position: absolute;
  color: var(--cinnabar);
  font-size: 13px;
  pointer-events: none;
  animation: q-heart-float 1.15s ease-out forwards;
  text-shadow: 0 1px 2px rgba(158, 43, 37, .25);
}
@keyframes q-heart-float {
  0% { opacity: 0; transform: translateY(6px) scale(.5); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-52px) scale(1.15); }
}
