:root {
  --paper: #f3eee4;
  --card: #fffdf8;
  --ink: #2b2620;
  --ink-soft: #6d635a;
  --ink-mute: #9a8f84;
  --line: #e5dccc;
  --accent: #a8452f;
  --accent-soft: #f6e7e1;
  --gold: #b3892f;
  --wood: #3f7d4f;
  --fire: #b8382b;
  --earth: #8a6134;
  --metal: #9a7b1f;
  --water: #2f6c94;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(90, 70, 40, .06), 0 12px 30px rgba(90, 70, 40, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, #fbf7ee 0%, rgba(251, 247, 238, 0) 60%),
    var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 560px; margin: 0 auto; padding: 22px 16px 60px; }

.view { display: none; animation: fade .28s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 首屏 */
.hero { text-align: center; padding: 10px 0 22px; }
.seal {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff8f4;
  border-radius: 12px; font-size: 26px; font-weight: 700;
  letter-spacing: 0; box-shadow: 0 6px 18px rgba(168, 69, 47, .28);
}
.hero h1 { margin: 0; font-size: 26px; letter-spacing: 6px; font-weight: 700; }
.hero .sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; letter-spacing: 2px; }
.hero-note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-mute); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 14px;
}

/* ── 表单 */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 7px; letter-spacing: .5px; }
.row { display: flex; gap: 8px; }

.input {
  appearance: none;
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239a8f84' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.seg { display: flex; background: #f4efe5; border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn {
  flex: 1; border: 0; background: transparent; padding: 9px 0;
  font-size: 14px; font-family: inherit; color: var(--ink-soft);
  border-radius: 8px; cursor: pointer; transition: .18s;
}
.seg-btn.active { background: #fff; color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(120, 90, 50, .12); }

.check { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 12.5px; color: var(--ink-soft); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-mute); line-height: 1.6; }

.btn-primary {
  width: 100%; border: 0; cursor: pointer;
  padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, #b84c33, #993d29);
  color: #fff8f3; font-size: 16px; font-weight: 600; letter-spacing: 2px;
  font-family: inherit; box-shadow: 0 8px 20px rgba(168, 69, 47, .24);
  transition: .18s;
}
.btn-primary:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(168, 69, 47, .22); }
.btn-primary:disabled { opacity: .6; box-shadow: none; cursor: default; }

.btn-ghost {
  width: 100%; margin-top: 8px; padding: 12px;
  background: transparent; border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink-soft); font-size: 14px; font-family: inherit; cursor: pointer;
}

.legal { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-mute); text-align: center; line-height: 1.6; }

.how h3, .history h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: 1px; }
.how ul { margin: 0; padding: 0; list-style: none; }
.how li { font-size: 13px; color: var(--ink-soft); padding: 7px 0; border-bottom: 1px dashed var(--line); }
.how li:last-child { border-bottom: 0; }
.how b { color: var(--accent); font-weight: 600; margin-right: 4px; }

.foot { margin-top: 26px; font-size: 11.5px; color: var(--ink-mute); line-height: 1.75; }
.foot p { margin: 0 0 8px; }
.foot-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px !important; }
.foot-links a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.legal a { color: var(--accent); text-decoration: none; }

/* ── 顶栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.link { border: 0; background: transparent; color: var(--accent); font-size: 13.5px; font-family: inherit; cursor: pointer; padding: 4px 0; }
.topbar-title { font-size: 13px; color: var(--ink-mute); letter-spacing: 1px; }

/* ── 结果页 */
.summary-card { background: linear-gradient(160deg, #fffdf8, #fbf5ea); }
.summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.summary-head h2 { margin: 0; font-size: 17px; letter-spacing: 1px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

.meta-line { font-size: 12px; color: var(--ink-mute); margin: 8px 0 0; line-height: 1.7; }
.meta-line b { color: var(--ink-soft); font-weight: 500; }

.wuxing { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.wx-chip { font-size: 12px; padding: 4px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.wx-chip i { font-style: normal; font-weight: 700; margin-left: 3px; }
.wx-木 { color: var(--wood); } .wx-火 { color: var(--fire); } .wx-土 { color: var(--earth); }
.wx-金 { color: var(--metal); } .wx-水 { color: var(--water); }

/* 报告正文（markdown 渲染） */
.report h2 { font-size: 16px; margin: 26px 0 10px; padding-left: 10px; border-left: 3px solid var(--accent); letter-spacing: 1px; }
.report h2:first-child { margin-top: 4px; }
.report h3 { font-size: 14px; margin: 18px 0 8px; color: var(--ink); }
.report h4 { font-size: 13.5px; margin: 14px 0 6px; color: var(--ink-soft); }
.report p { margin: 8px 0; font-size: 13.5px; color: var(--ink-soft); }
.report strong { color: var(--accent); font-weight: 600; }
.report ul { margin: 8px 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.report li { margin: 5px 0; }
.report blockquote { margin: 10px 0; padding: 9px 12px; background: #f5efe3; border-left: 3px solid var(--line); border-radius: 6px; font-size: 12.5px; color: var(--ink-soft); }

.tbl-wrap { overflow-x: auto; margin: 10px -4px; padding: 0 4px; }
.report table, .preview table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; }
.report th, .report td, .preview th, .preview td {
  border: 1px solid #e8e0d2; padding: 7px 8px; text-align: left; vertical-align: top; line-height: 1.55;
}
.report th, .preview th { background: #f2ece1; font-weight: 600; color: #4a423a; white-space: nowrap; font-size: 12px; }
.report td:first-child { color: var(--ink-soft); }

/* 付费墙 */
.paywall { position: relative; margin-top: 6px; }
.locked-list { list-style: none; margin: 0; padding: 0; }
.locked-list li {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--ink-mute); padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.locked-list li:last-child { border-bottom: 0; }
.lock-ico { width: 15px; height: 15px; flex: 0 0 15px; opacity: .55; }
.blur-teaser {
  position: relative; overflow: hidden; border-radius: 10px;
  max-height: 96px; margin-top: 4px;
  -webkit-mask-image: linear-gradient(#000 30%, transparent 96%);
  mask-image: linear-gradient(#000 30%, transparent 96%);
  filter: blur(2.4px); opacity: .55; pointer-events: none;
}
.blur-teaser p { font-size: 13px; color: var(--ink-soft); margin: 6px 0; }

.tiers { display: grid; gap: 10px; margin-top: 4px; }
.tier {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: #fff; cursor: pointer; transition: .18s; position: relative;
}
.tier:hover { border-color: #d9c9b4; transform: translateY(-1px); }
.tier.hot { border-color: var(--accent); box-shadow: 0 6px 18px rgba(168, 69, 47, .1); }
.tier-top { display: flex; align-items: center; justify-content: space-between; }
.tier-name { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.tier-price { font-size: 19px; color: var(--accent); font-weight: 700; }
.tier-price small { font-size: 12px; font-weight: 400; color: var(--ink-mute); margin-left: 2px; }
.tier-desc { font-size: 12.5px; color: var(--ink-soft); margin: 7px 0 0; line-height: 1.65; }
.tier-tag {
  position: absolute; top: -9px; right: 12px;
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--accent); color: #fff8f4;
}
.tier-buy { margin-top: 11px; width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 14px; font-family: inherit; cursor: pointer; }
.tier.hot .tier-buy { background: var(--accent); color: #fff8f4; }

/* ── 报告页工具条 */
.report-tools { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tool-btn { flex: 1; min-width: 120px; padding: 10px; font-size: 13px; font-family: inherit; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer; }
.tool-btn.primary { border-color: var(--accent); color: var(--accent); }

.code-box { background: #f5efe3; border: 1px dashed #d9c9b4; border-radius: 10px; padding: 11px 12px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }
.code-box b { color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; }

/* ── 弹层 */
.modal { position: fixed; inset: 0; background: rgba(38, 30, 22, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal[hidden], .toast[hidden] { display: none !important; }
.modal-card { position: relative; width: 100%; max-width: 340px; background: var(--card); border-radius: 18px; padding: 22px 20px; text-align: center; box-shadow: 0 20px 50px rgba(40, 30, 20, .25); }
.modal-card h3 { margin: 0 0 4px; font-size: 15px; letter-spacing: 1px; }
.modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 22px; color: var(--ink-mute); cursor: pointer; line-height: 1; }
.pay-amount { font-size: 26px; font-weight: 700; color: var(--accent); margin: 6px 0 14px; }
.qr-box { display: grid; place-items: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.pay-tip { font-size: 11.5px; color: var(--ink-mute); margin: 10px 0 14px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(43, 38, 32, .92); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: 22px; z-index: 99; max-width: 80vw;
}

/* ── 加载 */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 46px 0; color: var(--ink-mute); font-size: 13.5px; }
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.history .hitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; color: var(--ink-soft);
}
.history .hitem:last-child { border-bottom: 0; }
.history .hitem button { border: 0; background: transparent; color: var(--accent); font-size: 13px; font-family: inherit; cursor: pointer; }

@media print {
  body { background: #fff; }
  .topbar, .report-tools, .foot, .modal, .toast { display: none !important; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .page { max-width: none; padding: 0; }
}

/* ══════════ 白话解读层 ══════════ */

/* 每章开头的「说白了」结论卡 */
.plain {
  position: relative;
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fdf8ee, #faf2e3);
  border: 1px solid #ecdfc9;
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.85;
  color: #4a3f34;
}
.plain-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  letter-spacing: .5px;
  vertical-align: 1px;
}
.plain strong, .plain b { color: #7a5c2e; }

/* 术语：虚线下划线，可点 */
.gl {
  border-bottom: 1px dashed rgba(179, 137, 47, .65);
  color: #8a6a35;
  cursor: pointer;
  padding-bottom: 1px;
}
.gl:active { background: #f6ecd8; }

/* 引擎里那堆「不据此推断」的合规括注：弱化成灰色小字，不再打断阅读 */
.fine { color: #a89c8f; font-size: 12px; }

/* 章末术语速查（原生折叠，不依赖 JS） */
details.terms {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
details.terms summary {
  cursor: pointer;
  color: var(--ink-mute);
  list-style: none;
  user-select: none;
}
details.terms summary::-webkit-details-marker { display: none; }
details.terms summary::before { content: '＋ '; }
details.terms[open] summary::before { content: '－ '; }
details.terms dl {
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 12px;
  align-items: baseline;
}
details.terms dt { font-weight: 700; color: #6b5b48; white-space: nowrap; }
details.terms dd { margin: 0; color: #7a6c5c; line-height: 1.65; }

/* 报告目录 */
.toc { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.toc a {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 20px;
  background: #f7f1e5;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: none;
}
.toc a:active { background: var(--accent-soft); }

/* 报告章节卡片 */
.sec-card { scroll-margin-top: 12px; }
.sec-card > h2 {
  font-size: 16px;
  margin: 0 0 12px;
  padding-left: 9px;
  border-left: 3px solid var(--gold);
  line-height: 1.4;
}
.sec-idx {
  display: inline-block;
  margin-right: 6px;
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 400;
}

/* 术语解释弹层 */
#gl-modal {
  position: fixed;
  inset: 0;
  background: rgba(38, 30, 22, .45);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 60;
}
#gl-modal[hidden] { display: none; }
.gl-box {
  width: 100%;
  max-width: 420px;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  box-shadow: 0 20px 50px rgba(60, 40, 20, .25);
}
.gl-box h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--ink);
}
.gl-box .gl-sub {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--gold);
}
.gl-box p {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-soft);
}
.gl-box button {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf5ea;
  color: var(--ink-soft);
  font-size: 14px;
  font-family: inherit;
}

/* 导读专用排版 */
.sec-card.guide h4 { font-size: 14.5px; margin: 22px 0 8px; color: var(--accent); }
.sec-card.guide h4:first-of-type { margin-top: 6px; }
.sec-card.guide p { margin: 0 0 10px; }
.sec-card.guide ul { margin: 0 0 10px; }
.sec-card.guide blockquote { font-size: 12.5px; }

/* ══════════ 分享海报 ══════════ */
.poster-btn {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  border: 1.5px dashed var(--gold);
  border-radius: 10px;
  background: #fbf6ea;
  color: var(--accent);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
}
.poster-btn:active { background: #f5ecd8; }

#poster-modal {
  position: fixed;
  inset: 0;
  background: rgba(38, 30, 22, .62);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 70;
}
#poster-modal[hidden] { display: none; }
.poster-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.poster-box img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .38);
  display: block;
}
.poster-tip {
  margin: 12px 0 10px;
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
}
.poster-box button {
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, .9);
  font-size: 14px;
  font-family: inherit;
}

/* ══════════ 今日运势日签 ══════════ */
.card.daily { padding: 16px 16px 14px; }
.daily-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.dlabel {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .5px;
}
.ddate {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: .3px;
}
.dtone {
  flex: none;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tone-good { background: #e8f0e4; color: #3f6b3c; border: 1px solid #cfe0c8; }
.tone-steady { background: #f4eddd; color: #8a6a35; border: 1px solid #e6d8bd; }
.tone-tough { background: #f6e8e4; color: #9c4a3c; border: 1px solid #ecd3cc; }
.dsummary {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #4a3f34;
}
.drow { display: grid; gap: 10px; }
.dcol b {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 1px;
}
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
}
.dchip.yi { background: #eef3ea; color: #4b6b46; }
.dchip.ji { background: #f7ece8; color: #95564a; }
.dextra {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: #fbf3e6;
  border-left: 2px solid var(--gold);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #7a6a55;
}
.dmeta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
}
.dnote {
  margin: 8px 0 0;
  font-size: 11px;
  color: #b0a598;
  line-height: 1.6;
}
.dlink {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf5e9;
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
}

/* ── 合婚：对方信息分隔 ─────────────────── */
.match-divider { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; color: var(--gold); font-size: 12.5px; letter-spacing: 2px; }
.match-divider::before, .match-divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #ddd0b8, transparent); }
.match-pair { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 4px; font-size: 15px; }
.match-pair .who { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbf7ee; }
.match-pair .heart { color: var(--accent); font-size: 13px; }

/* ── 追问答疑 ─────────────────── */
.ask-bar { display: flex; gap: 8px; margin-top: 10px; }
.ask-bar .input { flex: 1; }
.ask-qa { border-top: 1px dashed var(--line); padding: 10px 0 2px; margin-top: 10px; }
.ask-q { font-size: 13.5px; color: var(--accent); margin-bottom: 6px; }
.ask-a { font-size: 13.5px; line-height: 1.75; color: var(--ink); white-space: pre-wrap; }

[hidden] { display: none !important; }

/* ── 真实支付弹层 ─────────────────── */
.pay-qr-img { display: block; width: 180px; height: 180px; margin: 0 auto 8px; border-radius: 8px; background: #fff; }
a.pay-open { display: block; text-align: center; text-decoration: none; margin: 0 0 10px; box-sizing: border-box; }
.pay-wx-tip { font-size: 12px; line-height: 1.6; color: #8a4a00; background: #fff4e0; border: 1px solid #f0d3a0; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; text-align: left; }
