/* ==========================================================================
   国学明镜 · 样式表
   纸墨配色：宣纸底 / 墨色字 / 朱砂点睛 / 赭金描边
   ========================================================================== */

:root {
  --paper: #f2ece1;
  --paper-2: #faf6ee;
  --paper-3: #e8dfd0;
  --ink: #211d1a;
  --ink-2: #4b443c;
  --ink-3: #857c70;
  --ink-4: #b3a99b;
  --line: rgba(33, 29, 26, .13);
  --line-2: rgba(33, 29, 26, .07);
  --zhu: #a3322a;
  --zhu-2: #c2503f;
  --zhu-soft: rgba(163, 50, 42, .08);
  --jin: #a8823f;
  --qing: #3c5a52;
  --shadow-s: 0 1px 2px rgba(60, 45, 30, .06), 0 2px 8px rgba(60, 45, 30, .05);
  --shadow-m: 0 2px 6px rgba(60, 45, 30, .07), 0 12px 32px -8px rgba(60, 45, 30, .18);
  --r: 4px;
  --max: 1120px;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "Georgia", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", var(--serif);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 700px at 12% -8%, rgba(255, 255, 255, .85), transparent 60%),
    radial-gradient(900px 600px at 92% 4%, rgba(168, 130, 63, .07), transparent 55%),
    radial-gradient(700px 500px at 50% 108%, rgba(60, 90, 82, .06), transparent 60%);
  background-attachment: fixed;
  line-height: 1.75;
  font-size: 16px;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

/* 纸纹 */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(163, 50, 42, .16); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 10px clamp(14px, 4vw, 40px);
  background: rgba(242, 236, 225, .82);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.seal {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--zhu); color: #fdf6ec;
  font-family: var(--kai); font-size: 20px; line-height: 1;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
  letter-spacing: 0;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-family: var(--kai); font-size: 19px; letter-spacing: .16em; font-weight: 600; }
.brand-txt i { font-style: normal; font-size: 9px; letter-spacing: .32em; color: var(--ink-3); text-transform: uppercase; }

.nav {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  flex: 1; min-width: 0;
}
.navrow {
  display: flex; align-items: center; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.navrow::-webkit-scrollbar { display: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; white-space: nowrap;
  padding: 7px 11px; font-size: 14.5px; color: var(--ink-2);
  border-radius: 3px; transition: color .18s, background .18s;
}
.nav a:hover { color: var(--ink); background: rgba(33, 29, 26, .045); }
.nav a.on { color: var(--zhu); }
.nav a.on::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px;
  height: 2px; background: var(--zhu); border-radius: 2px;
}

.user-slot { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  font-size: 14.5px; letter-spacing: .06em;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-s); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary {
  background: var(--zhu); border-color: var(--zhu); color: #fdf7ef;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 18px -8px rgba(163, 50, 42, .7);
}
.btn-primary:hover { background: #b23b31; }
.btn-ghost { background: transparent; }
/* 危险操作（如后台删除用户）：二次确认态用实心红，视觉上警醒 */
.btn-danger { background: var(--zhu); border-color: var(--zhu); color: #fdf7ef; }
.btn-danger:hover { background: #b23b31; }
.btn-gold { border-color: rgba(168, 130, 63, .5); color: #7a5b23; background: rgba(168, 130, 63, .07); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 15.5px; }
.btn-block { width: 100%; }

/* ---------------- 布局 ---------------- */
.wrap { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: 0 clamp(14px, 4vw, 32px); }
section { padding: clamp(28px, 5vw, 56px) 0; }
main { position: relative; z-index: 1; min-height: 70vh; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: .04em; margin: 0; line-height: 1.4; }
h1 { font-family: var(--kai); font-size: clamp(28px, 5vw, 42px); letter-spacing: .12em; }
h2 { font-family: var(--kai); font-size: clamp(21px, 3vw, 27px); letter-spacing: .1em; }
h3 { font-size: 17.5px; }
p { margin: 0 0 .85em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--zhu); margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--zhu); opacity: .5; }

.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.sec-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }

/* ---------------- 卡片 ---------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 253, 248, .92), rgba(250, 246, 238, .86));
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-s);
}
.card-pad { padding: clamp(18px, 3vw, 28px); }
.card-hover { transition: transform .2s, box-shadow .25s, border-color .2s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); border-color: rgba(168, 130, 63, .38); }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------------- 首页 ---------------- */
.hero { padding: clamp(30px, 6vw, 76px) 0 clamp(24px, 4vw, 48px); }
.hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(20px, 5vw, 56px); align-items: center; }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } }
.hero h1 { margin-bottom: 14px; }
.hero h1 em { font-style: normal; color: var(--zhu); }
.hero-lead { font-size: clamp(15px, 1.6vw, 17px); color: var(--ink-2); max-width: 34em; }
.hero-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.ink-disc {
  position: relative; aspect-ratio: 1; width: 100%; max-width: 340px; margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, .5), transparent 42%),
    radial-gradient(circle at 50% 50%, #2c2723 0%, #211d1a 58%, #171412 100%);
  box-shadow: 0 24px 60px -22px rgba(33, 29, 26, .65), inset 0 0 0 1px rgba(255, 255, 255, .07);
  display: grid; place-items: center;
  overflow: hidden;
}
.ink-disc::after {
  content: ""; position: absolute; inset: -12%;
  background: radial-gradient(circle at 68% 74%, rgba(163, 50, 42, .5), transparent 46%);
  filter: blur(6px);
}
.ink-disc span {
  position: relative; z-index: 1;
  font-family: var(--kai); font-size: clamp(48px, 9vw, 84px); color: #f6efe3;
  letter-spacing: .1em; line-height: 1; text-shadow: 0 2px 20px rgba(0, 0, 0, .5);
  writing-mode: vertical-rl; height: 70%;
}
.ink-disc small {
  position: absolute; bottom: 16%; z-index: 1;
  font-size: 10px; letter-spacing: .5em; color: rgba(246, 239, 227, .5);
}

.feature {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 18px; height: 100%;
}
.feature .fi { font-family: var(--kai); font-size: 22px; color: var(--zhu); line-height: 1; }
.feature h3 { font-family: var(--kai); font-size: 18px; letter-spacing: .1em; margin-top: 4px; }
.feature p { font-size: 13.5px; color: var(--ink-3); margin: 0; line-height: 1.65; }
.feature .go { font-size: 12.5px; color: var(--jin); letter-spacing: .1em; margin-top: auto; padding-top: 8px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .08em; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; background: rgba(255, 253, 248, .8);
  border: 1px solid var(--line); border-radius: 3px; outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  font-size: 15px;
}
.input:focus { border-color: rgba(163, 50, 42, .55); box-shadow: 0 0 0 3px var(--zhu-soft); background: #fffdf8; }
.input::placeholder { color: var(--ink-4); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23857c70'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.seg { display: inline-flex; padding: 3px; background: rgba(33, 29, 26, .055); border-radius: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 2px;
  cursor: pointer; color: var(--ink-2); font-size: 14px; transition: all .16s;
}
.seg button.on { background: var(--paper-2); color: var(--zhu); box-shadow: var(--shadow-s); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 100px; border: 1px solid var(--line);
  background: rgba(255, 253, 248, .6); font-size: 13px; cursor: pointer; color: var(--ink-2);
  transition: all .16s;
}
.chip:hover { border-color: rgba(168, 130, 63, .5); }
.chip.on { background: var(--zhu); border-color: var(--zhu); color: #fdf7ef; }

.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.err { color: var(--zhu); font-size: 12.5px; min-height: 1em; }

/* ---------------- 结果面板 ---------------- */
.panel {
  background: linear-gradient(180deg, rgba(255, 253, 247, .95), rgba(248, 243, 233, .9));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: clamp(18px, 3vw, 30px);
  box-shadow: var(--shadow-s);
}
.panel + .panel { margin-top: 14px; }
.panel-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-family: var(--kai); font-size: 18px; letter-spacing: .12em;
}
.panel-title::before { content: ""; width: 3px; height: 17px; background: var(--zhu); border-radius: 2px; }

.gua-row { display: flex; gap: clamp(14px, 3vw, 26px); flex-wrap: wrap; }
.gua-item { text-align: center; flex: none; }
.gua-item .gl { display: flex; flex-direction: column-reverse; gap: 5px; margin-bottom: 8px; }
.line { width: 78px; height: 8px; display: flex; gap: 8px; }
.line i { background: var(--ink); border-radius: 1px; height: 100%; flex: 1; }
.line.yin i:first-child { flex: 1; }
.line.yin i:last-child { flex: 1; }
.line.yang i { background: var(--ink); }
.line.yin i { background: var(--ink); }
.line.moving i { background: var(--zhu); }
.line.dim i { background: var(--ink-4); }
.gua-item .gn { font-family: var(--kai); font-size: 15px; letter-spacing: .1em; }
.gua-item .gs { font-size: 11.5px; color: var(--ink-3); letter-spacing: .1em; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 100px; font-size: 12px;
  border: 1px solid var(--line); color: var(--ink-2); background: rgba(255, 255, 255, .5);
  letter-spacing: .06em; white-space: nowrap;
}
.tag-zhu { color: var(--zhu); border-color: rgba(163, 50, 42, .3); background: var(--zhu-soft); }
.tag-jin { color: #7a5b23; border-color: rgba(168, 130, 63, .38); background: rgba(168, 130, 63, .09); }
.tag-qing { color: var(--qing); border-color: rgba(60, 90, 82, .3); background: rgba(60, 90, 82, .07); }
.ji-da { color: #8a2a22; border-color: rgba(163, 50, 42, .32); background: var(--zhu-soft); }
.ji-ji { color: #7a5b23; border-color: rgba(168, 130, 63, .35); background: rgba(168, 130, 63, .09); }
.ji-ping { color: var(--ink-2); }
.ji-xiong { color: #4a4a52; border-color: rgba(74, 74, 82, .28); background: rgba(74, 74, 82, .06); }

.kv { display: grid; grid-template-columns: 5.6em 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }

.quote {
  font-family: var(--kai); font-size: clamp(16px, 2vw, 19px); line-height: 2.1;
  letter-spacing: .1em; color: var(--ink); white-space: pre-wrap;
}
.prose { font-size: 15.5px; line-height: 1.95; color: var(--ink-2); }
.prose p { margin: 0 0 1em; }
.prose .lead { color: var(--ink); }

.bar { height: 7px; background: rgba(33, 29, 26, .07); border-radius: 100px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--jin), var(--zhu)); border-radius: 100px; }

/* 四柱表 */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pl { text-align: center; padding: 12px 6px; border: 1px solid var(--line-2); border-radius: 3px; background: rgba(255, 255, 255, .4); }
.pl .lab { font-size: 11.5px; color: var(--ink-3); letter-spacing: .16em; }
.pl .gz { font-family: var(--kai); font-size: clamp(24px, 4vw, 32px); line-height: 1.35; color: var(--ink); letter-spacing: .04em; }
.pl .sub { font-size: 11.5px; color: var(--ink-3); }
.pl .ss { font-size: 12px; color: var(--zhu); }

/* ---------------- 铜钱 ---------------- */
.coins { display: flex; gap: clamp(12px, 4vw, 28px); justify-content: center; padding: 8px 0 4px; }
.coin {
  width: clamp(56px, 14vw, 78px); aspect-ratio: 1; border-radius: 50%;
  position: relative; display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, #e8c87a, #b78b3c 52%, #8c6526 100%);
  box-shadow: 0 6px 16px -6px rgba(120, 85, 20, .6), inset 0 0 0 2px rgba(255, 255, 255, .22);
  color: #4a3410; font-family: var(--kai); font-size: clamp(20px, 5vw, 28px);
  transition: transform .1s;
}
.coin::before {
  content: ""; position: absolute; width: 30%; height: 30%; background: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(140, 101, 38, .5);
}
.coin span { position: relative; z-index: 1; opacity: .9; font-size: 13px; letter-spacing: .1em; }
.coin.back { background: radial-gradient(circle at 34% 28%, #d9c9a8, #a89372 55%, #7d6a4c 100%); }
.coin.flip { animation: flip .42s cubic-bezier(.3, .8, .4, 1) infinite; }
@keyframes flip {
  0% { transform: rotateY(0) translateY(0); }
  50% { transform: rotateY(540deg) translateY(-16px); }
  100% { transform: rotateY(1080deg) translateY(0); }
}

/* ---------------- 签 ---------------- */
.tube {
  width: min(240px, 60vw); margin: 0 auto; aspect-ratio: 1 / 1.35; position: relative;
  display: grid; place-items: center; cursor: pointer;
  transition: transform .2s;
}
.tube:hover { transform: translateY(-3px); }
.tube .body {
  width: 100%; height: 82%; border-radius: 8px 8px 46% 46% / 8px 8px 22% 22%;
  background: linear-gradient(155deg, #8e5a35, #6d3f22 55%, #4e2b15);
  box-shadow: 0 20px 40px -18px rgba(78, 43, 21, .8), inset 0 2px 0 rgba(255, 255, 255, .18);
  position: relative; overflow: hidden;
}
.tube .body::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 9px);
  opacity: .7;
}
.tube .stick {
  position: absolute; top: 4%; left: 50%; width: 8px; height: 46%;
  background: linear-gradient(180deg, #e6d6b4, #cfb98d);
  border-radius: 3px; transform-origin: bottom center;
  box-shadow: 0 0 0 1px rgba(120, 90, 40, .25);
}
.tube .label {
  position: absolute; bottom: 16%; left: 0; right: 0; text-align: center;
  font-family: var(--kai); color: #f0dcb4; font-size: 15px; letter-spacing: .4em;
}
.tube.shake { animation: shake .5s ease-in-out; }
/* 掷筊摇晃（灵签六签） */
.jiao-shake { animation: jiaoshake .6s ease-in-out; }
@keyframes jiaoshake {
  0%, 100% { transform: rotate(0) translateY(0); }
  20% { transform: rotate(-4deg) translateY(-3px); }
  45% { transform: rotate(5deg) translateY(-6px); }
  70% { transform: rotate(-3deg) translateY(-2px); }
  85% { transform: rotate(2deg); }
}
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-3deg) translateY(-2px); }
  40% { transform: rotate(3deg) translateY(-4px); }
  60% { transform: rotate(-2deg); }
  80% { transform: rotate(2deg); }
}

.qian-num {
  font-family: var(--kai); font-size: clamp(56px, 12vw, 92px); line-height: 1;
  color: var(--zhu); letter-spacing: .04em;
}

/* ---------------- 书架 ---------------- */
.shelf-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; height: 100%; }
.shelf-card .cat { font-size: 11px; letter-spacing: .28em; color: var(--jin); }
.shelf-card h3 { font-family: var(--kai); font-size: 20px; letter-spacing: .1em; }
.shelf-card .meta { font-size: 12.5px; color: var(--ink-3); }
.shelf-card .sum { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; flex: 1; }
.book-cover {
  aspect-ratio: 3 / 4; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  padding: 7% 5% 7% 12%; box-sizing: border-box;
  background: linear-gradient(160deg, #efe6d2, #e2d4ba 58%, #cbb794);
  box-shadow: inset 0 0 0 1px rgba(120, 90, 40, .24), inset 0 0 0 4px rgba(255, 252, 244, .5), 0 8px 20px -12px rgba(60, 45, 30, .55);
  position: relative; overflow: hidden;
  container-type: inline-size;
}
/* 竖排书脊线 */
.book-cover::after {
  content: ""; position: absolute; left: 7%; top: 0; bottom: 0; width: 1px;
  background: rgba(90, 65, 30, .22);
}
/* 书名：传统竖排，字大而清；字号按「列数 × 每列字数」算，不再一味缩小 */
.book-cover .bc-t {
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--kai); font-weight: 600; color: #2f2317;
  letter-spacing: .06em; line-height: 1.12; text-align: center;
  max-height: 100%; max-width: 100%; overflow: hidden;
  font-size: 18px; /* 不支持 cqw 时的兜底 */
  font-size: clamp(13px, calc(100cqw * var(--k, .24)), 46px);
}
/* 副题（· 之后）与作者：底部小字横排 */
.book-cover .bc-s {
  position: absolute; left: 8%; right: 8%; bottom: 13%;
  text-align: center; font-family: var(--kai); color: rgba(70, 52, 30, .82);
  font-size: clamp(7px, calc(100cqw * .075), 12px); line-height: 1.25;
  max-height: 2.6em; overflow: hidden;
}
.book-cover .bc-a {
  position: absolute; left: 8%; right: 8%; bottom: 4.5%;
  text-align: center; font-family: var(--kai); color: rgba(90, 65, 30, .72);
  letter-spacing: .14em; font-size: clamp(7px, calc(100cqw / 13), 11px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 小封面（列表 100px）放不下副题，只留书名 */
@container (max-width: 108px) {
  .book-cover .bc-s { display: none; }
}

/* 阅读器 */
.reader { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.reader .toc-details {
  position: sticky; top: 76px; max-height: calc(100vh - 110px); overflow: auto;
  border: 1px solid var(--line-2); border-radius: 12px; background: linear-gradient(180deg, rgba(255, 253, 248, .92), rgba(250, 246, 238, .86));
  box-shadow: var(--shadow-s);
}
.toc-details > summary {
  cursor: pointer; list-style: none; padding: 12px 14px;
  font-family: var(--kai); font-size: 15.5px; letter-spacing: .08em; font-weight: 600; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; user-select: none;
  border-bottom: 1px solid transparent;
}
.toc-details > summary::-webkit-details-marker { display: none; }
.toc-details > summary .arr { color: var(--jin); font-size: 12px; transition: transform .15s ease; }
.toc-details[open] > summary { border-bottom-color: var(--line-2); }
.toc-details[open] > summary .arr { transform: rotate(90deg); }
@media (max-width: 860px) {
  .reader { grid-template-columns: 1fr; }
  .reader .toc-details { position: static; max-height: none; }
  .reader .toc-details .toc { max-height: 52vh; overflow: auto; }
}
.toc a { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px; font-size: 14px; color: var(--ink-2); border-left: 2px solid transparent; border-radius: 0 2px 2px 0; }
.toc a:hover { background: rgba(33, 29, 26, .04); }
.toc a.on { border-left-color: var(--zhu); color: var(--zhu); background: var(--zhu-soft); }
/* 入世典籍多为公众号长标题：目录行限两行，尾部省略，避免撑破版式 */
.toc a .tt { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toc a .lk { flex: none; padding-top: 2px; font-size: 11px; color: var(--ink-4); }
.toc-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.nav-ch { max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article { max-width: 42em; }
.article h1 { font-size: clamp(24px, 3.4vw, 32px); margin-bottom: 6px; }
.article .content { font-size: 17px; line-height: 2.1; color: var(--ink); white-space: pre-wrap; letter-spacing: .02em; }
.article .content strong { color: var(--zhu); font-weight: 600; }

/* —— 典籍正文排版 —— */
.article .content { white-space: normal; }
.article .content p { margin: 0 0 1.05em; text-indent: 2em; text-align: justify; }
.article .content p:last-child { margin-bottom: 0; }

/* 经句原文：宣纸浅底 + 朱砂竖线 */
.article .content blockquote.yuanwen {
  margin: 28px 0 24px;
  padding: 18px 22px 18px 24px;
  font-family: var(--kai);
  font-size: 19px;
  line-height: 2.06;
  color: var(--ink);
  text-indent: 0;
  letter-spacing: .06em;
  background: linear-gradient(180deg, var(--paper-2), rgba(250, 246, 238, .55));
  border-left: 3px solid var(--zhu);
  border-radius: 0 3px 3px 0;
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-s);
}

/* 章内小节标题：朱字 + 细线延伸 */
.article .content h3.sec {
  display: flex; align-items: center; gap: 14px;
  margin: 42px 0 22px;
  font-family: var(--kai);
  font-size: 17px;
  font-weight: 400;
  color: var(--zhu);
  letter-spacing: .26em;
  text-indent: 0;
}
.article .content h3.sec::before {
  content: ''; flex: 0 0 20px; height: 1px; background: var(--zhu); opacity: .45;
}
.article .content h3.sec::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}
.article .content h3.sec:first-child { margin-top: 8px; }

@media (max-width: 640px) {
  .article .content { font-size: 16.5px; line-height: 2; }
  .article .content blockquote.yuanwen { font-size: 17.5px; padding: 15px 16px; margin: 22px 0 20px; }
}

/* 付费墙 */
.paywall { position: relative; overflow: hidden; border-radius: var(--r); }
.paywall .blurred { filter: blur(4px); opacity: .55; user-select: none; pointer-events: none; max-height: 320px; overflow: hidden; }
.paywall .mask {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: linear-gradient(180deg, rgba(242, 236, 225, .35), rgba(242, 236, 225, .96) 62%);
  padding: 20px;
}
.paywall .mask .inner { max-width: 26em; }

/* ---------------- 价格 ---------------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: stretch; }
@media (max-width: 820px) { .plans { grid-template-columns: 1fr; } }
.plan { display: flex; flex-direction: column; padding: 24px 20px; }
.plan.best { border-color: rgba(163, 50, 42, .45); box-shadow: 0 10px 40px -20px rgba(163, 50, 42, .55); }
.plan .pname { font-family: var(--kai); font-size: 19px; letter-spacing: .14em; }
.plan .price { font-family: var(--kai); font-size: 40px; line-height: 1.1; margin: 8px 0 2px; }
.plan .price small { font-size: 15px; color: var(--ink-3); margin-left: 2px; font-family: var(--serif); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; font-size: 13.5px; color: var(--ink-2); flex: 1; }
.plan li { padding: 5px 0 5px 18px; position: relative; }
.plan li::before { content: "·"; position: absolute; left: 6px; color: var(--zhu); font-weight: 700; }
.plan .badge {
  position: absolute; top: -10px; right: 14px; background: var(--zhu); color: #fdf7ef;
  font-size: 11px; padding: 2px 9px; border-radius: 100px; letter-spacing: .12em;
}

/* ---------------- 杂项 ---------------- */
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(33, 29, 26, .93); color: #f6efe3; padding: 10px 18px; border-radius: 3px;
  font-size: 14px; box-shadow: var(--shadow-m); animation: toastIn .22s ease; max-width: 84vw;
}
.toast.bad { background: rgba(163, 50, 42, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-back { position: fixed; inset: 0; background: rgba(30, 25, 20, .42); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(440px, 100%); max-height: 88vh; overflow: auto; background: var(--paper-2); border-radius: 5px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5); border: 1px solid var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-family: var(--kai); letter-spacing: .12em; }
.modal-body { padding: 20px; }
.x { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 4px 6px; }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(33, 29, 26, .15); border-top-color: var(--zhu); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .big { font-family: var(--kai); font-size: 30px; color: var(--ink-4); margin-bottom: 8px; }

.divider { height: 1px; background: var(--line-2); margin: 18px 0; border: 0; }
.divider-word { display: flex; align-items: center; gap: 12px; color: var(--ink-4); font-size: 12px; letter-spacing: .2em; margin: 18px 0; }
.divider-word::before, .divider-word::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 30px 0 40px; color: var(--ink-3); font-size: 13px; }
.footer .frow { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer a:hover { color: var(--zhu); }

.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { border: 0; background: none; padding: 10px 2px; cursor: pointer; color: var(--ink-3); position: relative; font-size: 15px; }
.tabs button.on { color: var(--zhu); }
.tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--zhu); }

table.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tb th, table.tb td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-2); }
table.tb th { font-weight: 500; color: var(--ink-3); font-size: 12.5px; letter-spacing: .1em; }
table.tb tr:hover td { background: rgba(33, 29, 26, .025); }
/* 用户管理操作列：取消会员 + 删除并排，窄屏也不换行 */
table.tb td.u-ops { text-align: right; white-space: nowrap; }
table.tb td.u-ops .btn + .btn { margin-left: 6px; }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--paper-3); display: grid; place-items: center; font-family: var(--kai); font-size: 15px; color: var(--ink-2); border: 1px solid var(--line); }

.loading-page { display: grid; place-items: center; min-height: 50vh; gap: 10px; color: var(--ink-3); font-size: 14px; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .nav a { padding: 6px 9px; font-size: 13.5px; }
  .brand-txt i { display: none; }
  .toast-wrap { bottom: 16px; }
}

/* ===== 敲木鱼 ===== */
.muyu-stage { position: relative; max-width: 420px; margin: 10px auto 0; text-align: center; }
.muyu-halo {
  position: absolute; inset: 12% 10%; border-radius: 50%;
  background: radial-gradient(circle, rgba(163, 50, 42, .08), transparent 70%);
  pointer-events: none;
}
.muyu-hit {
  position: relative; border: 0; background: none; padding: 0; margin: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  display: inline-block; width: min(78vw, 300px);
}
.muyu-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 14px 22px rgba(74, 44, 18, .28)); }
.muyu-body { transform-origin: 55% 52%; }
.muyu-body.knock { animation: muyuKnock .18s ease-out; }
@keyframes muyuKnock {
  0% { transform: scale(1); }
  35% { transform: scale(.94, .9) rotate(-.6deg); }
  100% { transform: scale(1); }
}
.muyu-ripple {
  position: absolute; left: 50%; top: 46%; width: 40px; height: 40px; margin: -20px;
  border: 2px solid rgba(163, 50, 42, .5); border-radius: 50%;
  opacity: 0; pointer-events: none;
}
.muyu-ripple.go { animation: muyuRipple .7s ease-out; }
@keyframes muyuRipple {
  0% { opacity: .8; transform: scale(1); }
  100% { opacity: 0; transform: scale(6); }
}
.muyu-float { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.muyu-gain {
  position: absolute; transform: translate(-50%, 0);
  font-family: var(--kai); color: var(--zhu); font-size: 15px; letter-spacing: .1em;
  animation: muyuGain 1.1s ease-out forwards; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 252, 245, .8);
}
@keyframes muyuGain {
  0% { opacity: 0; translate: 0 6px; }
  25% { opacity: 1; }
  100% { opacity: 0; translate: 0 -46px; }
}
.muyu-phrase {
  font-family: var(--kai); font-size: 17px; letter-spacing: .22em; color: var(--ink-2);
  min-height: 26px; margin-top: 6px;
}
.muyu-phrase.fresh { animation: muyuPhrase .8s ease-out; }
@keyframes muyuPhrase { 0% { opacity: 0; letter-spacing: .5em; } 100% { opacity: 1; letter-spacing: .22em; } }
.muyu-stats { display: flex; gap: 34px; justify-content: center; margin-top: 16px; }
.muyu-stat b { display: block; font-family: var(--kai); font-size: 26px; color: var(--zhu); font-weight: 600; }
.muyu-stat span { font-size: 12px; color: var(--ink-3); letter-spacing: .18em; }

/* ===== 居家风水 ===== */
.fs-upload {
  display: block; border: 1.5px dashed var(--line-3, #c9b896); border-radius: var(--r);
  padding: 18px 12px; text-align: center; cursor: pointer; background: rgba(255, 253, 247, .6);
  transition: border-color .2s, background .2s;
}
.fs-upload:hover { border-color: var(--zhu); background: rgba(255, 253, 247, .95); }
.fs-upload.drag { border-color: var(--zhu); background: rgba(163, 50, 42, .05); }
.fs-hint { color: var(--ink-2); font-size: 14px; }
.fs-preview { max-width: 100%; max-height: 340px; border-radius: 6px; box-shadow: 0 6px 18px -10px rgba(60, 45, 30, .5); }
.fs-orb {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 3px solid rgba(163, 50, 42, .2); border-top-color: var(--zhu);
  animation: fsSpin 1s linear infinite;
}
@keyframes fsSpin { to { transform: rotate(360deg); } }
.fs-score { text-align: center; margin-bottom: 14px; }
.fs-score .fs-num { font-family: var(--kai); font-size: 44px; color: var(--zhu); line-height: 1; }
.fs-score .fs-den { font-family: var(--kai); font-size: 18px; color: var(--ink-3); margin-left: 2px; }
.fs-score .fs-lab { display: block; font-size: 12px; letter-spacing: .3em; color: var(--ink-3); margin-top: 4px; }
.fs-result { font-size: 14.5px; line-height: 1.85; }
.fs-result h3, .fs-result h4, .fs-result h5 {
  font-family: var(--kai); letter-spacing: .08em; color: var(--zhu);
  margin: 18px 0 8px; font-size: 17px; font-weight: 600;
}
.fs-result h3:first-child, .fs-result h4:first-child { margin-top: 4px; }
.fs-result ul, .fs-result ol { margin: 6px 0 12px 1.4em; }
.fs-result li { margin: 5px 0; }
.fs-result code { background: rgba(163, 50, 42, .07); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* 路由切换进度条 */
#routeProg {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 999;
  background: linear-gradient(90deg, var(--zhu), var(--jin));
  transform: scaleX(0); transform-origin: 0 50%; opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
#routeProg.on { opacity: 1; animation: routeProgSlide 1.1s ease-in-out infinite; }
@keyframes routeProgSlide {
  0% { transform: scaleX(0); } 55% { transform: scaleX(.75); } 100% { transform: scaleX(1); }
}
.tag-bad { color: #8a2f28; border-color: rgba(163, 50, 42, .45); background: rgba(163, 50, 42, .1); }

/* 生肖选择九宫格 */
.sxgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sxgrid button {
  padding: 10px 0 8px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--paper-2); cursor: pointer; transition: border-color .15s, background .15s;
  font-size: 15px; color: var(--ink);
}
.sxgrid button .sxfont { font-family: var(--kai); }
.sxgrid button:hover { border-color: var(--line); }
.sxgrid button.on { border-color: var(--zhu); background: var(--zhu-soft); color: var(--zhu); }
@media (max-width: 380px) { .sxgrid { grid-template-columns: repeat(3, 1fr); } }

/* 灵签神像插画 */
.god-img {
  width: 100%; display: block; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(74, 52, 24, .18);
}

/* 导航二级菜单（点整项弹出竖向下拉面板。nav 是横向滚动容器会裁剪绝对定位，故用 fixed + JS 定位锚点） */
.navsub { display: inline-flex; align-items: center; position: relative; }
.navsub > a { display: inline-flex; align-items: center; gap: 5px; }
.navcaret {
  font-style: normal; font-size: 10px; line-height: 1; color: var(--ink-3);
  transition: transform .18s; margin-top: 1px;
}
.navsub > a:hover .navcaret { color: var(--ink); }
.navsub.open > a { color: var(--zhu); background: var(--zhu-soft); border-radius: 3px; }
.navsub.open .navcaret { transform: rotate(180deg); color: var(--zhu); }
.navsub .sub {
  display: none; position: fixed; z-index: 80;
  flex-direction: column; align-items: stretch; gap: 3px;
  min-width: 132px; padding: 6px;
  max-height: calc(100vh - 80px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(33, 29, 26, .16);
}
.navsub.open .sub { display: flex; animation: subDrop .16s ease both; }
@keyframes subDrop { from { opacity: 0; transform: translateY(-5px); } }
.navsub .sub a {
  font-size: 13.5px; padding: 8px 12px; margin: 0;
  border: 0; border-radius: 6px; background: none; color: var(--ink-2);
  text-align: left; white-space: nowrap;
}
.navsub .sub a:hover { color: var(--zhu); background: var(--zhu-soft); }
.navsub .sub a.on { color: var(--zhu); background: var(--zhu-soft); font-weight: 600; }
.navsub .sub a.on::after { display: none; }
