/* 渡己探源 · 视觉系统
   主题：宣纸（暖白底）/ 墨（深褐墨色）/ 朱砂（印红）/ 描金
   原则：移动端优先、留白充足、衬线字体承载古典感 */

:root {
  /* 纸（对齐小程序：暖米白底） */
  --paper: #f7f4ef;
  --paper-2: #fdfaf4;
  --card: #fffdf8;
  /* 墨 */
  --ink: #33302b;
  --ink-2: #5b4c41;
  --sub: #9a8c7a;
  --line: #ece3d5;
  --line-2: #f5efe4;
  /* 主色（深棕，替代原朱砂红） */
  --zhu: #8a5a3b;
  --zhu-2: #5b3a29;
  --zhu-soft: #f3ead9;
  /* 金 */
  --gold: #b8860b;
  --gold-soft: #fbf3e0;

  /* 五行（对齐小程序） */
  --mu: #3d8b4f;
  --huo: #c0392b;
  --tu: #8d6e4a;
  --jin: #b8860b;
  --shui: #3d6fa8;

  --ok: #2e7d43;
  --warn: #b8860b;
  --bad: #c0392b;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(91, 58, 41, .06);
  --shadow-lg: 0 10px 30px rgba(72, 54, 36, .12);

  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.7 var(--font-sans);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

/* 宣纸底纹：暖色晕染 + 极淡噪点 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, #fffdf7 0%, rgba(255, 253, 247, 0) 60%),
    radial-gradient(80% 50% at 100% 100%, #f2e6d4 0%, rgba(242, 230, 212, 0) 70%),
    var(--paper);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--gold-soft); color: var(--ink); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 10px;
  background: rgba(247, 242, 232, .82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(236, 226, 210, .9);
}
.topbar .title {
  flex: 1; text-align: center;
  font: 500 17px/1 var(--font-serif); letter-spacing: 4px; color: var(--ink);
}
.topbar .back {
  min-width: 44px; height: 34px; border: 0; background: none; padding: 0 6px;
  color: var(--ink-2); font-size: 14px; display: flex; align-items: center; gap: 2px;
}
.topbar .back::before {
  content: ""; width: 8px; height: 8px; border-left: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor; transform: rotate(45deg); margin-right: 4px;
}
.topbar .back[hidden] { visibility: hidden; }
.topbar-right { min-width: 52px; display: flex; justify-content: flex-end; }

.user-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 4px; border: 1px solid var(--line);
  background: #fffdf8; border-radius: 999px; color: var(--ink);
  font-size: 12.5px; font-family: var(--font-serif); letter-spacing: .5px;
}
.user-chip .av {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(140deg, #6a4a35, #3d2c20); color: #f3e4c8; font-size: 11px;
}
.user-chip:active { background: var(--line-2); }

.login-btn {
  padding: 6px 14px; border: 1px solid var(--zhu); border-radius: 999px;
  background: var(--zhu); color: #fff5ea; font-size: 13px; letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(168, 50, 42, .2);
}

.user-menu {
  position: fixed; top: 56px; right: 12px; z-index: 60;
  min-width: 160px; background: #fffdf8; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
  animation: sheetUp .18s ease;
}
.user-menu a {
  display: block; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink); text-decoration: none;
}
.user-menu a:active { background: var(--line-2); }
.user-menu a.lo { color: var(--zhu); }

main { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }

/* ---------------- 首屏 ---------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 26px 18px 20px; margin-bottom: 14px;
  text-align: center; color: #f6ead6;
  background: linear-gradient(155deg, #33291f 0%, #55392a 52%, #8e4a33 100%);
  box-shadow: 0 14px 34px rgba(64, 42, 28, .22);
}
.hero::before,
.hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.hero::before {
  width: 260px; height: 260px; right: -110px; top: -130px;
  border: 1px solid rgba(226, 190, 130, .22);
  box-shadow: inset 0 0 0 28px rgba(226, 190, 130, .06);
}
.hero::after {
  width: 150px; height: 150px; left: -70px; bottom: -80px;
  background: radial-gradient(circle, rgba(226, 190, 130, .16) 0%, rgba(226, 190, 130, 0) 70%);
}
.hero .taiji {
  width: 54px; height: 54px; display: block; margin: 0 auto 12px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .3));
}
.hero-title {
  margin: 0; font: 400 27px/1.2 var(--font-serif);
  letter-spacing: 8px; text-indent: 8px;
}
.hero-rule {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 12px auto 8px; max-width: 260px;
  font-size: 11px; letter-spacing: 2px; color: rgba(246, 234, 214, .78);
}
.hero-rule i { flex: 1; height: 1px; background: rgba(246, 234, 214, .28); }
.hero-sub {
  margin: 0; font-size: 12.5px; letter-spacing: 1.5px; color: rgba(246, 234, 214, .68);
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font: 500 15px/1 var(--font-serif); letter-spacing: 2px; color: var(--zhu-2);
}
.card-head::before {
  content: ""; width: 4px; height: 15px; border-radius: 2px;
  background: var(--gold);
}
.card-head .tail { margin-left: auto; font: 400 12px/1 var(--font-sans); letter-spacing: 0; color: var(--sub); }

/* ---------------- 积分卡 ---------------- */
.points-card {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(120deg, #fffdf8 0%, #fdf6e9 100%);
  border-color: rgba(189, 151, 87, .3);
}
.pc-icon {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px;
  background: radial-gradient(circle at 30% 30%, #f6e6c2, #d9b779);
  color: #6b4a1e; box-shadow: inset 0 -2px 6px rgba(120, 84, 30, .25);
}
.pc-left { flex: 1; min-width: 0; }
.pc-num { font: 500 22px/1.2 var(--font-serif); color: var(--ink); }
.pc-num span { font-size: 26px; color: var(--zhu); margin-right: 3px; }
.pc-tip { font-size: 12px; color: var(--sub); margin-top: 2px; }
.tip-link {
  color: var(--zhu); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(168, 50, 42, .4); font-weight: 500; padding: 2px 0;
}

/* 恢复码展示 */
.rc-box {
  text-align: center; padding: 14px 12px; margin-bottom: 14px;
  border: 1px dashed rgba(189, 151, 87, .6); border-radius: 12px;
  background: linear-gradient(160deg, #fffdf7, #f8f0df);
}
.rc-title { font: 500 15px/1.4 var(--font-serif); color: var(--ink); letter-spacing: 1px; }
.rc-code {
  margin: 10px 0 8px; padding: 10px 6px; border-radius: 10px;
  background: #33291f; color: #f3e4c8;
  font: 600 19px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px;
}
.rc-tip { font-size: 12px; color: var(--sub); line-height: 1.7; margin-bottom: 12px; }
.rc-tip b { color: var(--zhu); }
.pc-btn {
  flex: 0 0 auto; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--zhu);
  background: var(--zhu); color: #fff5ea; font-size: 13.5px; letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(168, 50, 42, .22);
}
.pc-btn:active { transform: translateY(1px); }

/* ---------------- 表单 ---------------- */
.seg {
  display: flex; gap: 3px; padding: 3px; margin-bottom: 12px;
  background: var(--line-2); border-radius: 12px; border: 1px solid var(--line);
}
.seg-btn {
  flex: 1; padding: 9px 4px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-2); font: 400 14px/1 var(--font-sans); letter-spacing: 2px;
  transition: all .18s ease;
}
.seg-btn.on {
  background: #fff; color: var(--zhu); font-weight: 600;
  box-shadow: 0 1px 5px rgba(72, 54, 36, .12);
}
.seg-label { font-size: 12px; color: var(--sub); margin: 0 0 6px 2px; letter-spacing: 1px; }

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

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; letter-spacing: 1px; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fffdf9; color: var(--ink); font: 400 16px/1.3 var(--font-sans);
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus {
  outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(189, 151, 87, .14);
}
.lunar-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.lunar-row input { text-align: center; padding: 10px 4px; }
.row { display: flex; align-items: center; gap: 7px; font-size: 14px; margin-bottom: 12px; color: var(--ink-2); }
.row input { accent-color: var(--zhu); width: 16px; height: 16px; }

.adv {
  font-size: 13px; color: var(--sub); margin-bottom: 14px;
  border-top: 1px dashed var(--line); padding-top: 10px;
}
.adv summary { cursor: pointer; padding: 2px 0; letter-spacing: 1px; }
.adv[open] summary { color: var(--ink); }
.adv .field { margin-top: 10px; }

/* ---------------- 按钮 ---------------- */
.btn {
  width: 100%; padding: 13px; border-radius: 12px; border: 0; font-size: 16px;
  font-family: var(--font-sans); transition: transform .12s, box-shadow .18s;
}
.btn.primary {
  background: linear-gradient(135deg, var(--zhu) 0%, var(--zhu-2) 100%);
  color: #fff6ea; letter-spacing: 4px; text-indent: 4px;
  box-shadow: 0 8px 18px rgba(91, 58, 41, .26);
}
.btn.primary:active { transform: translateY(1px); box-shadow: 0 4px 10px rgba(91, 58, 41, .22); }
.btn.primary[disabled] { opacity: .6; box-shadow: none; }
.btn.ghost {
  background: #fffdf8; color: var(--ink-2); border: 1px solid var(--line); letter-spacing: 2px;
}
.btn.ghost:active { background: var(--line-2); }
.btn.link { background: none; color: var(--sub); font-size: 13px; margin-top: 8px; }

.err { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }
/* 底部备案区：命理声明 + ICP 备案号 + 公安联网备案号。
   放在 main 之外 → 首页/排盘/对话所有页面底部都在，符合备案「所有页面底部显著位置」要求 */
.site-foot { max-width: 560px; margin: 0 auto; padding: 12px 14px 26px; text-align: center; }
.footer-note {
  text-align: center; color: #b5a593; font-size: 11.5px; letter-spacing: 1px; padding: 0;
}
.footer-note::before, .footer-note::after { content: "·"; margin: 0 6px; opacity: .6; }
/* ICP 备案号（须链接工信部备案系统） */
.icp-note {
  font-size: 11.5px; letter-spacing: .5px; padding: 6px 0 0;
}
.icp-note a { color: #b5a593; text-decoration: none; }
.icp-note a:hover { color: var(--zhu); text-decoration: underline; text-underline-offset: 3px; }
/* 公安联网备案号（须「官方图标 + 编号」并链接公安备案查询页） */
.police-note {
  font-size: 11.5px; letter-spacing: .5px; padding: 6px 0 0;
}
.police-note a {
  color: #b5a593; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.police-note a:hover { color: var(--zhu); text-decoration: underline; text-underline-offset: 3px; }
.police-note .police-icon { display: block; width: 20px; height: 20px; }
.loading { text-align: center; color: var(--sub); padding: 48px 0; font-size: 13px; letter-spacing: 2px; }

/* ---------------- 排盘：命主信息 ---------------- */
.info-row {
  display: flex; font-size: 13.5px; line-height: 1.9; color: var(--ink-2);
}
.info-label {
  color: var(--sub); width: 108px; flex-shrink: 0;
}
.info-tip {
  font-size: 11px; color: #b3a89a; padding-top: 8px;
  border-top: 1px dashed var(--line); margin-top: 8px;
}

/* ---------------- 排盘：四柱（含大运/流年对照列） ---------------- */
.pillar-grid { display: flex; gap: 6px; align-items: stretch; }
.pillar-divider {
  flex-shrink: 0; width: 1.5px; background: #d9c8a8; border-radius: 2px;
}
.pillar-col {
  flex: 1; min-width: 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #fffdf8;
}
.pillar-head {
  text-align: center; font-size: 12px; padding: 6px 0;
  color: #7a5c3e; background: #f3ead9; letter-spacing: 1px;
}
.pillar-col.day .pillar-head { background: #5b3a29; color: #f7e9c9; }
.pillar-body {
  padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center;
}
.ss-gan { font-size: 11px; color: var(--sub); height: 18px; line-height: 18px; }
.gan-zhi { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 70px; }
.gz-char { position: relative; font: 600 24px/1.35 var(--font-serif); }

/* 五行文字配色（干支大字/藏干/五行标签共用） */
.mu-text { color: #3d8b4f; }
.huo-text { color: #c0392b; }
.tu-text { color: #8d6e4a; }
.jin-text { color: #b8860b; }
.shui-text { color: #3d6fa8; }

.hide-list {
  height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hide-item { font-size: 10.5px; color: var(--sub); line-height: 18px; white-space: nowrap; }
.hide-item i { font-style: normal; }
.na-yin { font-size: 10px; color: #b3a89a; height: 18px; line-height: 18px; }

.meta-list {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding-top: 4px; border-top: 1px dashed #eee4d4; width: 100%; margin-top: 4px;
}
.meta-row { display: flex; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 17px; line-height: 17px; }
.meta-label { font-size: 9px; color: #c4b8a8; flex-shrink: 0; }
.meta-val { font-size: 10px; color: #7a5c3e; font-weight: 600; white-space: nowrap; }
.meta-val.meta-long { font-size: 9px; font-weight: 400; }

.pillar-ss {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px;
  padding-top: 5px; border-top: 1px dashed #eee4d4; width: 100%; margin-top: 5px;
  min-height: 24px;
}
.pillar-ss-item { font-size: 9px; line-height: 1.8; padding: 0 4px; border-radius: 4px; }
.ss-ji { color: #2e7d43; background: #eef7f0; }
.ss-xiong { color: #c0392b; background: #fdf3f1; }
.ss-zhong { color: #b8860b; background: #fbf3e0; }

.pillar-note { font-size: 11px; color: #b3a89a; padding: 8px 2px 0; text-align: center; }

/* ---------------- 排盘：命局摘要 ---------------- */
.summary-row { display: flex; gap: 8px; margin-bottom: 10px; }
.summary-item {
  flex: 1; background: #f3ead9; border-radius: 10px;
  padding: 10px 0; text-align: center;
}
.summary-label { font-size: 11px; color: var(--sub); }
.summary-val { font-size: 15px; font-weight: 600; color: var(--zhu-2); padding-top: 3px; }
.summary-note { font-size: 12px; color: var(--sub); line-height: 1.7; }
.summary-note b { color: var(--zhu-2); font-weight: 600; }

/* ---------------- 排盘：五行（竖向柱状图） ---------------- */
.wx-chart { display: flex; align-items: flex-end; gap: 10px; }
.wx-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.wx-bar-track {
  width: 100%; height: 110px; display: flex; align-items: flex-end; justify-content: center;
}
.wx-bar {
  width: 30px; border-radius: 8px 8px 3px 3px; opacity: .85; transition: height .5s ease;
}
.wx-bar.mu { background: #4caf50; }
.wx-bar.huo { background: #e05a4e; }
.wx-bar.tu { background: #a9846a; }
.wx-bar.jin { background: #d4af37; }
.wx-bar.shui { background: #4a86c5; }
.wx-bar.dominant { opacity: 1; box-shadow: 0 0 0 3px rgba(184, 134, 11, .25); }
.wx-bar.bar-lacking { opacity: .25; }
.wx-label { font-size: 13px; font-weight: 600; line-height: 1.9; }
.wx-score { font-size: 12px; font-weight: 600; line-height: 1.7; }
.wx-score.mu-score { color: #4caf50; }
.wx-score.huo-score { color: #e05a4e; }
.wx-score.tu-score { color: #a9846a; }
.wx-score.jin-score { color: #d4af37; }
.wx-score.shui-score { color: #4a86c5; }
.wx-sum { margin-top: 8px; font-size: 12px; color: var(--ink-2); letter-spacing: .5px; }
.wx-sum b { color: var(--zhu-2); }

/* ---------------- 排盘：神煞 ---------------- */
.ss-block { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ss-title { font-size: 13px; color: #7a5c3e; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ss-list { display: flex; flex-direction: column; gap: 6px; }
.ss-item { background: #faf6ec; border-radius: 8px; padding: 7px 10px; }
.ss-item-line { display: flex; align-items: center; gap: 8px; }
.ss-name { font-size: 13px; font-weight: 600; }
.ss-t-ji { color: #2e7d43; }
.ss-t-xiong { color: #c0392b; }
.ss-t-zhong { color: #b8860b; }
.ss-pillar { font-size: 11px; color: #b3a89a; }
.ss-brief { font-size: 12px; color: var(--sub); line-height: 1.6; margin-top: 2px; }

/* ---------------- 排盘：干支关系 ---------------- */
.group-title {
  font: 400 12.5px/1 var(--font-serif); letter-spacing: 2px; color: var(--gold);
  margin: 14px 0 8px; display: flex; align-items: center; gap: 8px;
}
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.card > .group-title:first-of-type { margin-top: 2px; }
.rel-item {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 13px; line-height: 1.5; padding: 7px 0;
  border-bottom: 1px dashed var(--line-2);
}
.rel-item:last-child { border-bottom: 0; }
.rel-item b { font: 400 14px/1 var(--font-serif); color: var(--ink); }
.rel-tag {
  padding: 1px 7px; border-radius: 5px; font-size: 11px; letter-spacing: 1px; flex: 0 0 auto;
  font-family: var(--font-serif);
}
.rel-tag.he { background: #edf6f0; color: var(--ok); }
.rel-tag.chong { background: var(--zhu-soft); color: var(--bad); }
.rel-tag.xing { background: #fbeee9; color: #a8452f; }
.rel-tag.hai { background: var(--gold-soft); color: #a97f34; }
.rel-tag.po { background: #f0ece6; color: var(--ink-2); }
.rel-desc { color: var(--sub); font-size: 12px; flex: 1 1 100%; padding-left: 2px; }

/* ---------------- 排盘：大运流年（横向滑动选择条） ---------------- */
.dy-scroll, .ln-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.dy-scroll::-webkit-scrollbar, .ln-scroll::-webkit-scrollbar { display: none; }
.dy-track, .ln-track { display: inline-flex; align-items: stretch; gap: 6px; padding: 4px 2px 8px; }

.dy-card {
  position: relative; width: 54px; flex-shrink: 0; border-radius: 10px;
  background: #fffdf8; border: 1px solid var(--line);
  padding: 8px 4px 7px; display: flex; flex-direction: column; align-items: center;
}
.dy-card.current { border-color: #b8860b; background: #fdf6e7; }
.dy-card.selected {
  border-color: #8a5a3b; background: #f1e6d2;
  box-shadow: 0 0 0 2px rgba(138, 90, 59, .38), 0 4px 14px rgba(91, 58, 41, .22);
}
.dy-card.pre { opacity: .55; }
.dy-gz-v { display: flex; flex-direction: column; align-items: center; min-height: 64px; justify-content: center; }
.dy-gz-char { font: 600 22px/1.4 var(--font-serif); color: #5b3a29; }
.pre-gz .dy-gz-char { color: #b3a89a; }
.dy-ss { font-size: 10px; color: var(--sub); line-height: 1.6; }
.dy-ss.zhi { color: #b08d57; }
.dy-nayin { font-size: 9px; color: #b3a89a; line-height: 1.5; margin-top: 1px; }
.dy-age { font-size: 10px; color: #7a5c3e; line-height: 1.7; margin-top: 2px; }
.dy-year { font-size: 9px; color: #b3a89a; line-height: 1.6; }
.dy-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 4px; background: #c4b8a8; }
.dy-cur {
  position: absolute; top: -1px; right: -1px; font-size: 9px; color: #fff;
  background: #b8860b; border-radius: 0 10px 0 8px; padding: 1px 5px;
}

.ln-track { align-items: center; padding-top: 2px; }
.ln-caption {
  align-self: center; font-size: 11px; color: #7a5c3e; font-weight: 600;
  padding: 0 4px; writing-mode: vertical-rl; letter-spacing: 2px; white-space: nowrap;
}
.ln-card {
  width: 48px; flex-shrink: 0; border-radius: 9px; background: #fffdf8;
  border: 1px solid var(--line); padding: 6px 3px; display: flex;
  flex-direction: column; align-items: center;
}
.ln-card.selected { border-color: #8a5a3b; background: #f1e6d2; box-shadow: 0 0 0 2px rgba(138, 90, 59, .38), 0 3px 10px rgba(91,58,41,.2); }
.ln-year { font-size: 10px; color: var(--sub); line-height: 1.6; }
.ln-gz-v { display: flex; flex-direction: column; align-items: center; min-height: 56px; justify-content: center; }
.ln-gz-char { font: 600 20px/1.4 var(--font-serif); color: #5b3a29; }
.ln-ss { font-size: 9px; color: var(--sub); line-height: 1.5; }
.ln-ss.zhi { color: #b08d57; }
.ln-age { font-size: 9px; color: #b3a89a; line-height: 1.5; }
.ln-gz-char.mu-text, .dy-gz-char.mu-text { color: #3d8b4f; }
.ln-gz-char.huo-text, .dy-gz-char.huo-text { color: #c0392b; }
.ln-gz-char.tu-text, .dy-gz-char.tu-text { color: #8d6e4a; }
.ln-gz-char.jin-text, .dy-gz-char.jin-text { color: #b8860b; }
.ln-gz-char.shui-text, .dy-gz-char.shui-text { color: #3d6fa8; }

/* ---------------- 底部操作条 ---------------- */
.actionbar {
  position: sticky; bottom: 10px; z-index: 12;
  display: flex; gap: 10px; padding: 10px; margin-top: 6px;
  border-radius: 16px; border: 1px solid var(--line);
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}
.actionbar .btn { padding: 12px; }
.actionbar .btn.primary { flex: 1; }
.actionbar .btn.ghost { flex: 0 0 96px; width: auto; font-size: 14px; letter-spacing: 1px; }

/* ---------------- 历史 ---------------- */
.hist-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 2px;
  border-bottom: 1px dashed var(--line); font-size: 14px; cursor: pointer;
}
.hist-item:last-child { border-bottom: 0; }
.hist-item::before {
  content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}
.hist-item .t { font-family: var(--font-serif); letter-spacing: .5px; }
.hist-item .d { margin-left: auto; color: var(--sub); font-size: 12px; }

/* ---------------- 对话 ---------------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 60px); }
body.chat-mode { overflow: hidden; }
body.chat-mode main { padding-top: 8px; padding-bottom: 0; }
body.chat-mode .chat-wrap { height: calc(100dvh - 60px - var(--foot-h, 0px)); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; }
.chat-hint {
  text-align: center; font-size: 11px; color: #b5a593; letter-spacing: 1px;
  padding: 8px 0 14px;
}
.chat-hint::before { content: "❖ "; opacity: .7; }
.msg { display: flex; gap: 9px; margin-bottom: 16px; align-items: flex-start; }
.msg .avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 14px; font-family: var(--font-serif);
}
.msg .avatar.ai {
  background: linear-gradient(140deg, #6a4a35, #3d2c20); color: #f3e4c8;
  box-shadow: 0 3px 8px rgba(61, 44, 32, .2);
}
.msg .avatar.me { background: var(--zhu-soft); color: var(--zhu); }
.msg .bubble {
  max-width: calc(100% - 52px); padding: 11px 14px; border-radius: 4px 14px 14px 14px;
  font-size: 14.5px; line-height: 1.85; white-space: pre-wrap; word-break: break-word;
  background: #fffdf8; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble {
  border-radius: 14px 4px 14px 14px; border-color: transparent;
  background: linear-gradient(135deg, var(--zhu), var(--zhu-2)); color: #fff6ea;
  box-shadow: 0 4px 14px rgba(168, 50, 42, .2);
}
.bubble.typing { color: var(--sub); }
.bubble.typing i {
  display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%;
  background: var(--sub); animation: blink 1.2s infinite;
}
.bubble.typing i:nth-child(2) { animation-delay: .2s; }
.bubble.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-input {
  display: flex; gap: 8px; align-items: center; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: rgba(247, 242, 232, .9);
}
.chat-input input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 15px; background: #fffdf9; color: var(--ink);
}
.chat-input input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(189, 151, 87, .14); }
.chat-input .send {
  flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--zhu), var(--zhu-2)); color: #fff6ea; font-size: 15px;
  box-shadow: 0 4px 12px rgba(168, 50, 42, .24);
}

[hidden] { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 68px; transform: translateX(-50%);
  background: rgba(47, 40, 35, .93); color: #f6ead6; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; letter-spacing: .5px; z-index: 99; box-shadow: var(--shadow-lg);
}

/* ---------------- 充值弹层（底部 sheet） ---------------- */
.pmask {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  background: rgba(38, 30, 24, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.pmodal {
  position: relative; width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--paper-2); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(40, 30, 20, .28);
  animation: sheetUp .26s cubic-bezier(.2, .8, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pmodal::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 4px; border-radius: 2px; background: var(--line);
}
.ptitle {
  font: 400 17px/1 var(--font-serif); letter-spacing: 4px; text-align: center;
  color: var(--ink); padding: 18px 0 16px;
}
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tier {
  text-align: center; padding: 15px 6px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fffdf8; transition: all .18s;
}
.tier:active { transform: scale(.97); }
.tier .t-p { font: 400 17px/1.3 var(--font-serif); color: var(--ink); }
.tier .t-m { font-size: 12.5px; color: var(--zhu); margin-top: 4px; letter-spacing: .5px; }
.tier:last-child { border-color: rgba(189, 151, 87, .5); background: linear-gradient(160deg, #fffaf0, var(--gold-soft)); }
.pnote { font-size: 12px; color: var(--sub); text-align: center; margin: 14px 0 4px; letter-spacing: .5px; }

.qr-box {
  width: 210px; height: 210px; margin: 0 auto 12px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: var(--shadow);
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-miss { font-size: 12px; color: var(--sub); text-align: center; padding: 10px; line-height: 1.9; }
.qr-miss code { background: var(--line-2); padding: 2px 5px; border-radius: 4px; font-size: 11px; }
.qr-tip { font-size: 13px; text-align: center; margin-bottom: 8px; color: var(--ink-2); }
.qr-tip b { font-size: 16px; color: var(--zhu); font-family: var(--font-serif); }
.order-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 4px 0 14px; font-size: 13px; color: var(--ink-2);
}
.order-row b { font-family: var(--font-serif); letter-spacing: 1.5px; color: var(--ink); }
.copy {
  padding: 3px 10px; font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2);
}
#payStep2 .btn.ghost { margin-top: 10px; }
#payStep2 .btn.primary { letter-spacing: 2px; }

/* ---------------- 小屏微调 ---------------- */
@media (max-width: 360px) {
  .pillars { gap: 6px; }
  .pcol-gan, .pcol-zhi { font-size: 24px; }
  .hero-title { font-size: 24px; letter-spacing: 6px; }
}
@media (min-width: 720px) {
  main { padding-top: 20px; }
  .hero { padding: 34px 18px 26px; }
}

/* ---------------- 登录 / 注册 / 订单 / 轮询 ---------------- */
.pmodal.am { padding-top: 14px; }
.pmodal .x {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
  border: 0; background: none; font-size: 22px; color: var(--sub);
}
.pmodal .x:active { color: var(--ink); }
.auth-tip { font-size: 12px; color: var(--sub); text-align: center; margin: 8px 0 0; letter-spacing: .5px; }
.qr-hint { font-size: 12px; color: var(--gold); text-align: center; margin-top: 8px; letter-spacing: .5px; }
.ord-item {
  padding: 12px 4px; border-bottom: 1px dashed var(--line);
}
.ord-item:last-child { border-bottom: 0; }
.o-top { display: flex; justify-content: space-between; align-items: center; }
.o-id { font: 400 12.5px/1 var(--font-serif); color: var(--ink); letter-spacing: 1px; }
.o-tag { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; }
.o-tag.ok { background: #edf6f0; color: var(--ok); }
.o-tag.wait { background: var(--gold-soft); color: #a97f34; }
.o-tag.no { background: var(--line-2); color: var(--sub); }
.o-mid { font-size: 13.5px; color: var(--ink); margin: 4px 0 2px; }
.o-bot { font-size: 11.5px; color: var(--sub); }
.poll-line {
  text-align: center; font-size: 12.5px; color: var(--gold);
  margin: 10px 0 6px; letter-spacing: .5px;
}

/* ---------------- 排盘表单（对齐小程序 form 页） ---------------- */
.privacy-tip {
  font-size: 11px; color: #b3a89a; line-height: 1.6;
  padding-bottom: 8px; border-bottom: 1px solid #f0e9dd; margin-bottom: 2px;
}
.form-row {
  display: flex; align-items: center; padding: 11px 0;
  border-bottom: 1px solid #f0e9dd;
}
.form-row:last-child { border-bottom: none; }
.form-label {
  width: 72px; font-size: 14px; color: #5b3a29; flex-shrink: 0;
  display: flex; align-items: center;
}
.form-label.required::after { content: '*'; color: #c0392b; margin-left: 4px; }
.form-input {
  flex: 1; font-size: 15px; height: 30px; line-height: 30px;
  border: 0; background: transparent; color: #33302b; min-width: 0;
}
.form-input::placeholder { color: #c4b8a8; }
.form-input:focus { outline: none; }

.gender-group { display: flex; flex: 1; gap: 26px; }
.gender-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #33302b; cursor: pointer; }
.gender-item input { accent-color: #5b3a29; width: 16px; height: 16px; margin: 0; }

.form-row .seg { flex: 1; margin-bottom: 0; }
.form-row .seg-label { display: none; }

.lunar-pickers { flex: 1; display: flex; gap: 8px; }
.lunar-picker { flex: 1; min-width: 0; }
.solar-pickers { flex: 1; display: flex; gap: 8px; }
.solar-pickers select { flex: 1; min-width: 0; }
.lunar-year-input {
  flex: 1; min-width: 0; text-align: center; height: 30px; line-height: 30px;
  background: #faf6ef; border-radius: 8px; padding: 0 6px;
}
select.form-input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: #faf6ef; border-radius: 8px; padding: 0 20px 0 8px; text-align: center;
  text-align-last: center; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b3a89a' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}

.leap-wrap { flex: 1; display: flex; align-items: center; }
.leap-wrap input { accent-color: #b8860b; width: 16px; height: 16px; margin: 0; }
.leap-tip { margin-left: 8px; font-size: 12px; color: #9a8c7a; }

.city-matches {
  margin-top: 6px; border: 1px solid #f0e9dd; border-radius: 8px;
  background: #fffdf9; overflow: hidden;
}
.city-match-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid #f5efe3; font-size: 14px; cursor: pointer;
}
.city-match-item:active { background: #f6efe2; }
.city-match-item:last-child { border-bottom: none; }
.city-match-name { color: #33302b; }
.city-match-prov { font-size: 12px; color: #b3a89a; }
.city-match-more { padding: 8px 12px; font-size: 12px; color: #b3a89a; text-align: center; }

.time-tip { font-size: 11px; color: #b3a89a; padding: 8px 0 0; line-height: 1.6; }
