/* ============================================================
   道清国学 · 暖金卡片风格（仿参考图）
   色系：暖米底 + 朱砂红主色 + 金色点缀 + 深棕文字
   ============================================================ */
:root {
  /* === 暖金主色调 === */
  --bg:         #FDF6EC;       /* 页面底色：暖米白 */
  --bg2:        #FFF8F0;       /* 卡片/区块底色：更浅的暖白 */
  --card:       #FFFFFF;       /* 纯白卡片 */
  --card2:      #FAF0E4;       /* 次级卡片（带微暖） */
  --line:       #E8DCC8;       /* 分割线：暖灰 */
  --line2:      #DCCFB8;       /* 强分割线 */

  /* === 文字 === */
  --txt:        #3D2B1F;       /* 主文字：深棕 */
  --txt2:       #5C4033;       /* 次级文字 */
  --muted:      #9B8477;       /* 弱化文字 */

  /* === 功能色 === */
  --red:        #C84A3C;       /* 朱砂红：主操作按钮 */
  --red-dark:   #A33828;       /* 深红：按钮按下态 */
  --red-light:  #E87A6E;       /* 浅红：hover */
  --gold:       #B8860B;       /* 暗金色：标题/强调 */
  --gold2:      #DAA520;       /* 亮金色 */
  --gold-bg:    #FFF3D6;       /* 金色背景块 */
  --accent:     #C84A3C;       /* 统一强调色=红 */

  /* === 五行色（结果区保留） === */
  --jin:        #8B7355;       /* 金-棕 */
  --mu:         #4A8C5E;       /* 木-绿 */
  --shui:       #3B7BA9;       /* 水-蓝 */
  --huo:        #C84A3C;       /* 火-红 */
  --tu:         #B8860B;       /* 土-黄 */

  /* === 圆角/阴影 === */
  --r:          14px;          /* 常规圆角 */
  --r-sm:       10px;          /* 小圆角 */
  --r-lg:       20px;          /* 大圆角 */
  --shadow:     0 2px 12px rgba(139,90,43,.08);
  --shadow-sm:  0 1px 4px rgba(139,90,43,.06);

  /* === 安全区域 === */
  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* ======== 顶部栏 ======== */
#topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, #FFF8F0, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 10px;
}
#title { font-size: 18px; font-weight: 700; letter-spacing: 3px; color: var(--gold); }
.sub { font-size: 11px; color: var(--muted); }
.home-btn {
  background: transparent; border: 1px solid var(--line); color: var(--gold);
  border-radius: 20px; padding: 4px 12px; font-size: 13px; cursor: pointer;
  visibility: hidden; margin-right: auto;
}

/* ======== 主内容区 ======== */
#view { flex: 1; padding: 0 0 calc(70px + var(--safe-bottom)); }
#tip { text-align: center; font-size: 11px; color: var(--muted); padding: 12px; border-top: 1px solid var(--line); }

/* ======== Hero Banner（模块页头图·紧凑横排版） ======== */
.hero-banner {
  position: relative;
  background: linear-gradient(160deg, #FFE8C8 0%, #F5DEB3 40%, #EDD1A8 70%, #DFBC8A 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
}
.hero-banner::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 70% 30%, rgba(255,255,255,.25) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(184,134,11,.08) 0%, transparent 40%);
}
.hero-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; gap: 12px;
}
.hero-text { flex-shrink: 1; min-width: 0; }
.hero-text .hero-title {
  font-size: 15px; font-weight: 900; color: var(--red);
  letter-spacing: 2px; line-height: 1.3;
  text-shadow: 0 2px 4px rgba(168,80,40,.15);
}
.hero-text .hero-sub {
  font-size: 11px; color: var(--red-dark);
  letter-spacing: 1px; margin-top: 2px;
  opacity: .85;
}
.hero-graphic {
  width: 44px; height: 44px; flex-shrink: 0;
  position: relative;
}
/* 默认八卦图 SVG 容器 */
.hero-graphic svg { width: 100%; height: 100%; }

/* ======== 子标签导航（如 八字排盘/财运/运势/学业） ======== */
.sub-tabs {
  display: flex; gap: 4px;
  padding: 10px 16px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  flex-shrink: 0; padding: 8px 16px;
  font-size: 14px; color: var(--muted);
  background: transparent; border: none;
  cursor: pointer; white-space: nowrap;
  position: relative;
  transition: color .2s;
}
.sub-tab.on { color: var(--red); font-weight: 700; }
.sub-tab.on::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--red); border-radius: 2px;
}

/* ======== 表单卡片 ======== */
.form-card {
  background: var(--card);
  margin: 12px 16px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.form-field {
  display: flex; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  min-height: 54px;
}
.form-field:last-child { border-bottom: none; }
.form-field label {
  font-size: 15px; color: var(--txt); font-weight: 500;
  min-width: 80px; flex-shrink: 0;
}
.form-field input,
.form-field select {
  flex: 1; border: none; background: transparent;
  font-size: 15px; color: var(--txt2);
  text-align: right; outline: none;
  padding: 4px 0;
  -webkit-appearance: none;
}
.form-field input::placeholder { color: var(--muted); }
.form-field .arrow {
  color: var(--muted); font-size: 18px; margin-left: 8px; flex-shrink: 0;
}
.form-field .field-right {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}

/* 性别切换 toggle */
.gender-toggle {
  display: flex; gap: 4px;
  background: var(--bg); border-radius: 20px; padding: 3px;
}
.gender-toggle span {
  padding: 4px 14px; border-radius: 17px; font-size: 13px;
  cursor: pointer; transition: all .2s; color: var(--muted);
}
.gender-toggle span.on {
  background: var(--red); color: #fff; font-weight: 600;
  box-shadow: 0 1px 4px rgba(200,74,60,.3);
}

/* 大测算按钮 */
.calc-btn {
  display: block; width: calc(100% - 32px); margin: 20px auto;
  padding: 15px; border-radius: 30px;
  border: 2px solid var(--red-dark);
  background: linear-gradient(180deg, var(--red-light), var(--red));
  color: #fff; font-size: 18px; font-weight: 700;
  letter-spacing: 4px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(200,74,60,.25), inset 0 1px 0 rgba(255,255,255,.2);
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .1s, box-shadow .1s;
  -webkit-tap-highlight-color: transparent;
}
.calc-btn:active { transform: scale(.97); box-shadow: 0 2px 8px rgba(200,74,60,.2); }

/* ======== 结果区 ======== */
.result-section {
  margin: 16px;
}
.section-header {
  text-align: center; margin-bottom: 14px;
  position: relative;
}
.section-header h3 {
  display: inline-block;
  font-size: 17px; color: var(--red);
  font-weight: 700; letter-spacing: 2px;
  padding: 8px 24px;
  background: linear-gradient(180deg, var(--card2), var(--bg));
  border: 1px solid var(--line2);
  border-radius: var(--r);
  position: relative;
}
.section-header h3::before,
.section-header h3::after {
  content: '◆'; position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 8px; color: var(--gold);
}
.section-header h3::before { left: 8px; }
.section-header h3::after { right: 8px; }

/* 功能卡片网格（参考图底部卡片列表） */
.feature-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.feature-card {
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 14px 12px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: transform .1s;
}
.feature-card:active { transform: scale(.97); }
.feature-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  background: var(--gold-bg); border: 1px solid rgba(184,134,11,.2);
}
.feature-icon.red { background: #FDECEA; border-color: rgba(200,74,60,.2); }
.feature-info { flex: 1; min-width: 0; }
.feature-info b { display: block; font-size: 14px; color: var(--txt); }
.feature-info span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ======== 首页模块网格 ======== */
.home-hero {
  background: linear-gradient(160deg, #FFE8C8, #EDD1A8);
  padding: 10px 16px;
  position: relative; overflow: hidden;
  text-align: left;
}
.home-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,.3), transparent 60%);
}
.home-hero-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.home-hero-text { min-width: 0; }
.home-hero h1 {
  position: relative; z-index: 1;
  font-size: 17px; color: var(--red);
  letter-spacing: 3px; margin: 0;
  text-shadow: 0 2px 4px rgba(168,80,40,.12);
}
.home-hero p {
  position: relative; z-index: 1;
  font-size: 11px; color: var(--muted); margin: 2px 0 0;
}
.home-logo {
  position: relative; z-index: 1;
  width: 38px; height: 38px; margin: 0; flex-shrink: 0;
}
.group-label {
  padding: 14px 16px 8px; font-size: 13px; color: var(--gold);
  font-weight: 600; letter-spacing: 1px;
}
.home-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  padding: 0 16px 16px;
}
.home-card {
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: transform .1s;
  text-decoration: none; color: inherit;
}
.home-card:active { transform: scale(.96); }
.home-card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: var(--gold-bg);
}
.home-card-title { font-size: 14px; font-weight: 600; color: var(--txt); }
.home-card-desc { font-size: 11px; color: var(--muted); text-align: center; }

/* ======== 底部导航栏 ======== */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
  padding: 6px 0 calc(6px + var(--safe-bottom));
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(139,90,43,.06);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  border: none; background: none; font: inherit;
  color: var(--muted); transition: color .15s; min-width: 52px;
}
.nav-item.on { color: var(--red); }
.nav-item .nav-icon { font-size: 22px; line-height: 1; }
.nav-item .nav-label { font-size: 10px; }

/* ======== 旧样式兼容（逐步淘汰，暂时保留防破版） ======== */
.lead { color: var(--muted); font-size: 13px; margin: 4px 2px 14px; }
.group-title { margin: 18px 2px 8px; font-size: 13px; color: var(--gold); letter-spacing: 1px; border-left: 3px solid var(--gold); padding-left: 8px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 12px; cursor: pointer; transition: .15s; min-height: 92px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-sm);
}
.card:active { transform: scale(.97); }
.card-icon { font-size: 26px; color: var(--gold); }
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* 表单旧兼容 */
.form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  border-radius: var(--r-sm); padding: 11px 12px; font-size: 15px; width: 100%;
}
.field.row { flex-direction: row; align-items: center; gap: 8px; }
.btn {
  background: linear-gradient(180deg, var(--red-light), var(--red));
  color: #fff; border: none; border-radius: 25px; padding: 13px;
  font-size: 16px; font-weight: 700; cursor: pointer; letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(200,74,60,.2);
}
.btn:active { opacity: .85; }
.btn.btn-ghost { background: var(--card2); color: var(--gold); border: 1px solid var(--line); font-weight: 600; box-shadow: none; }

/* 结果旧兼容 */
.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 6px; box-shadow: var(--shadow-sm); }
.result h3 { margin: 0 0 10px; color: var(--red); font-size: 16px; }
.result p { margin: 6px 0; }
.mt { margin-top: 14px; }
.muted { color: var(--muted); font-size: 12px; }
.note { color: var(--muted); font-size: 12px; background: var(--card2); border-radius: var(--r-sm); padding: 8px 10px; margin-top: 10px; line-height: 1.5; border: 1px solid var(--line); }
.err { color: var(--red); }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv b { color: var(--gold); font-weight: 600; }
.tag { display: inline-block; background: var(--card2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 2px; font-size: 12px; color: var(--jin); }
.tag.good { color: var(--mu); border-color: rgba(74,140,94,.3); }
.tag.bad { color: var(--red); border-color: rgba(200,74,60,.3); }

/* 奇门九宫 */
.qm-3x3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 0; }
.qm-row3 { display: contents; }
.qm-cell { background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 5px; min-height: 86px; font-size: 12px; }
.qm-cell.center { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.qm-gong { color: var(--gold); font-size: 12px; display: block; margin-bottom: 3px; }
.qm-row { display: flex; gap: 4px; align-items: baseline; }
.qm-row span { color: var(--muted); width: 14px; }
.qm-row b { font-weight: 600; }
.yongshen p { margin: 4px 0; font-size: 13px; }

/* 六爻卦 */
.gua { display: flex; flex-direction: column-reverse; gap: 3px; margin: 10px 0; }
.yaoline { height: 14px; border-radius: 2px; position: relative; }
.yaoline.yang { background: var(--jin); }
.yaoline.yin { background: transparent; border-top: 2px solid var(--jin); border-bottom: 2px solid var(--jin); height: 10px; }
.yaolabel { position: absolute; right: 4px; top: -2px; font-size: 11px; color: var(--bg); }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
table.tbl th, table.tbl td { border: 1px solid var(--line); padding: 7px 6px; text-align: center; }
table.tbl th { background: var(--card2); color: var(--gold); font-weight: 600; }
table.tbl td.good { color: var(--mu); }
table.tbl td.bad { color: var(--red); }

.section { margin: 14px 0; }
.section h4 { color: var(--gold); font-size: 14px; margin: 0 0 6px; border-left: 3px solid var(--gold); padding-left: 8px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* 档案列表 */
.rec { background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0; display: flex; justify-content: space-between; align-items: center; }
.rec .nm { font-weight: 600; }
.rec .meta { font-size: 12px; color: var(--muted); }

/* AI 对话 */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 10px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: linear-gradient(180deg, var(--red-light), var(--red)); color: #fff; }
.bubble.ai { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); color: var(--txt); }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input input { flex: 1; background: var(--card2); border: 1px solid var(--line); color: var(--txt); border-radius: var(--r-sm); padding: 11px; font-size: 15px; }

/* Toast 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(10px);
  background: rgba(61,43,31,.92); color: #fff; border: 1px solid rgba(255,255,255,.15);
  padding: 10px 20px; border-radius: 22px; font-size: 14px; z-index: 200;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 80%; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ======== 八字专用 ======== */
.bazi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.pill { background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 6px; text-align: center; }
.pill .pk { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.pill b { font-size: 20px; color: var(--gold); letter-spacing: 2px; }

.wx-bar { margin: 8px 0; }
.wx-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.wx-row > span:first-child { width: 18px; color: var(--muted); }
.wx-row .bar { flex: 1; height: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.wx-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); }
.wx-row > span:last-child { width: 30px; text-align: right; color: var(--jin); }

.dayun { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.dy { background: var(--card2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; min-width: 64px; text-align: center; }
.dy b { display: block; font-size: 16px; color: var(--gold); letter-spacing: 1px; }
.dy .muted { font-size: 11px; }
.dy-0 { border-style: dashed; opacity: .8; }

.qm-grid { margin: 10px 0; }

/* 占卜中心 tab */
.tabs { display: flex; gap: 6px; margin: 10px 0 12px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 64px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); border-radius: var(--r-sm); padding: 9px 6px; font-size: 13px; cursor: pointer; text-align: center; }
.tab.on { background: linear-gradient(180deg, var(--red-light), var(--red)); color: #fff; border-color: var(--red); font-weight: 700; }
.subview { margin-top: 4px; }

/* 六爻摇卦 */
.yao-pick { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.yao-pick .yaoline { display: flex; align-items: center; gap: 8px; height: auto; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.yao-pick .yaoline > span { font-size: 13px; color: var(--muted); min-width: 38px; }
.yao-pick .yaoline > b { color: var(--gold); }
.yaobtns { display: flex; gap: 4px; margin-left: auto; }
.mini { background: var(--card2); border: 1px solid var(--line); color: var(--jin); border-radius: 8px; padding: 6px 9px; font-size: 12px; cursor: pointer; }
.mini.on { background: linear-gradient(180deg, var(--red-light), var(--red)); color: #fff; border-color: var(--red); font-weight: 700; }

.yaotable { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.yaotable th, .yaotable td { border: 1px solid var(--line); padding: 7px 6px; text-align: center; }
.yaotable th { background: var(--card2); color: var(--gold); font-weight: 600; }
.yaotable .lq { color: var(--mu); }

.k { color: var(--muted); }
.v { color: var(--txt); }
.row2 { display: flex; gap: 8px; margin-top: 8px; }
.row2 .btn { flex: 1; }

.chat-box { display: flex; flex-direction: column; gap: 8px; }
.chat-msg { padding: 8px 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); }

/* ======== 动画 ======== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .35s ease-out both; }

/* ============================================================
   四维合参命理全案 · 报告样式（暖金国风）
   ============================================================ */
.siwei-report { padding: 0 2px; }
/* 封面 */
.sw-cover {
  background: linear-gradient(135deg, #B8860B 0%, #DAA520 55%, #8B6940 100%);
  color: #fff8f0; border-radius: var(--r-lg); padding: 30px 22px; text-align: center;
  box-shadow: 0 10px 30px rgba(139,90,43,.25); margin-bottom: 16px;
}
.sw-cover-sub { font-size: 12px; letter-spacing: 2px; opacity: .92; }
.sw-cover-name { font-size: 34px; font-weight: 800; letter-spacing: 6px; margin: 12px 0 6px; text-shadow: 1px 1px 3px rgba(0,0,0,.25); }
.sw-cover-info { font-size: 13px; opacity: .9; line-height: 1.7; }
.sw-cover-score { margin-top: 14px; font-size: 15px; opacity: .95; }
.sw-cover-score .num { font-size: 30px; font-weight: 800; color: #fff; }
/* 章节卡片 */
.sw-chapter { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 14px 10px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.sw-ch-no { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.sw-ch-body { flex: 1; min-width: 0; }
.sw-ch-body h3 { margin: 0 0 8px; font-size: 16px; color: var(--gold); border-left: 3px solid var(--gold); padding-left: 8px; }
.sw-txt { font-size: 14px; line-height: 1.85; color: var(--txt2); margin: 6px 0; }
.sw-txt.muted { color: var(--muted); }
.sw-list { margin: 4px 0 4px 18px; }
.sw-list li { font-size: 13.5px; line-height: 1.8; color: var(--txt2); }
/* 四柱 */
.sw-bz { margin: 4px 0 8px; }
.sw-bz .pill { background: var(--gold-bg); }
/* 神煞标签 */
.ss-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.ss-tag { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.ss-tag.hit { font-weight: 700; }
.ss-吉 { color: #2f7d4f; border-color: #bfe3cd; background: #eaf7ef; }
.ss-吉.hit { box-shadow: 0 0 0 1px #2f7d4f inset; }
.ss-中 { color: #b8860b; border-color: #ecd9a6; background: #fdf6e3; }
.ss-凶 { color: #b23a2e; border-color: #f0c9c4; background: #fbecea; }
/* 流年 */
.ln-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.ln { text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--card2); border: 1px solid var(--line); }
.ln b { display: block; font-size: 14px; color: var(--txt); }
.ln .muted { font-size: 11px; }
.ln span:last-child { font-size: 11px; color: var(--gold); }
.ln.chong { background: #fbecea; border-color: #f0c9c4; }
.ln.ben { background: var(--gold-bg); border-color: var(--gold); }
/* 交叉验证表 */
.cross { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.cross-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card2); }
.cr-dim { font-weight: 700; color: var(--gold); font-size: 14px; margin-bottom: 4px; }
.cr-cell { font-size: 12.5px; line-height: 1.6; color: var(--txt2); }
.cr-cell b { color: var(--red); margin-right: 4px; font-size: 12px; }
.cr-cons { font-size: 11.5px; color: var(--muted); margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 4px; }
/* 五格 */
.wuge { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 4px 0; }
.wg { display: flex; justify-content: space-between; align-items: center; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.wg b { color: var(--txt); }
.wg-j { font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.wg-j.j { color: #2f7d4f; background: #eaf7ef; }
.wg-j.b { color: #b8860b; background: #fdf6e3; }
.wg-j.x { color: #b23a2e; background: #fbecea; }
/* 综合评分环 */
.score-ring { text-align: center; padding: 14px 0 6px; }
.sr-num { font-size: 46px; font-weight: 800; color: var(--gold); line-height: 1; }
.sr-gr { font-size: 14px; color: var(--txt2); margin: 4px 0 10px; }
.sr-bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; max-width: 280px; margin: 0 auto; }
.sr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #B8860B, #DAA520); }
.sr-legend { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.sw-actions { display: flex; gap: 10px; margin: 16px 0 8px; }
.sw-actions .btn { flex: 1; }
.sw-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; letter-spacing: 1px; }
/* 桌面端适配（≥768px）：居中 app 浮窗 + 暖金氛围背景，手机端完全不受影响 */
@media (min-width: 768px) {
  html, body {
    background:
      radial-gradient(1100px 560px at 50% -8%, rgba(196,150,79,0.12), transparent 60%),
      radial-gradient(900px 520px at 92% 108%, rgba(196,150,79,0.10), transparent 60%),
      linear-gradient(160deg, #fbf3e6 0%, #f4e7cf 100%);
  }
  #app {
    max-width: 560px;
    margin: 30px auto;
    min-height: calc(100vh - 60px);
    border-radius: 22px;
    border: 1px solid rgba(196,150,79,0.28);
    box-shadow: 0 22px 64px rgba(120,90,40,0.20), 0 2px 10px rgba(120,90,40,0.10);
    overflow: hidden;
  }
  #bottomNav { max-width: 560px; }
  #view { padding-bottom: 12px; }
}
/* ======== 顶部分类切换条（吸顶横滑） ======== */
#topbar { flex-wrap: wrap; }
#bottomNav { display: none !important; }
#view { padding: 0 0 24px; }
.cat-tabs {
  flex-basis: 100%;
  display: flex; gap: 6px;
  padding: 10px 14px 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: 0 0 auto;
  padding: 7px 15px; border-radius: 18px;
  font-size: 13px; font-family: inherit;
  color: var(--muted); background: var(--card2);
  border: 1px solid var(--line); cursor: pointer;
  white-space: nowrap; transition: .15s;
}
.cat-tab.on {
  background: linear-gradient(180deg, var(--red-light), var(--red));
  color: #fff; border-color: transparent;
  box-shadow: var(--shadow-sm);
}

/* ======== 分类落地页 ======== */
.cat-hero {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px 0; padding: 9px 14px;
  border-radius: var(--r);
  background: linear-gradient(160deg, #FFE8C8 0%, #F5DEB3 55%, #E8C79C 100%);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.cat-hero::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,.18);
}
.cat-hero-icon {
  width: 40px; height: 40px; border-radius: 11px;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex-shrink: 0;
}
.cat-hero-title { font-size: 15px; font-weight: 900; color: var(--red); letter-spacing: 2px; }
.cat-hero-tag { font-size: 10px; color: var(--red-dark); margin-top: 1px; letter-spacing: 1px; }

.cat-intro {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px;
  margin: 12px 16px 0; box-shadow: var(--shadow-sm);
}
.cat-intro h3 { margin: 0 0 8px; font-size: 15px; color: var(--gold); letter-spacing: 1px; }
.cat-intro p { margin: 6px 0; font-size: 13px; line-height: 1.85; color: var(--txt2); text-align: justify; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-chip { font-size: 11px; color: var(--red-dark); background: var(--gold-bg); border-radius: 12px; padding: 3px 10px; }

.cat-sec { margin: 18px 18px 10px; font-size: 13px; color: var(--gold); letter-spacing: 2px; border-left: 3px solid var(--gold); padding-left: 8px; }

.cat-list { display: flex; flex-direction: column; gap: 10px; margin: 0 16px; }
.cat-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .1s;
}
.cat-item:active { transform: scale(.98); }
.cat-item-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.cat-item-info { flex: 1; min-width: 0; }
.cat-item-info b { display: block; font-size: 15px; color: var(--txt); }
.cat-item-info span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cat-item-arrow { color: var(--muted); font-size: 18px; }

/* ======== 首页：分类瓷片 ======== */
.home-hero-sub { position: relative; z-index: 1; font-size: 10px; color: var(--muted); margin: 8px 0 0; letter-spacing: .5px; }
.cat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 16px 0; }
.cat-tile {
  position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .1s;
}
.cat-tile:active { transform: scale(.97); }
.cat-tile-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 8px;
}
.cat-tile-name { font-size: 15px; font-weight: 700; color: var(--txt); }
.cat-tile-tag { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cat-tile-count {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; color: var(--gold); background: var(--gold-bg);
  border-radius: 10px; padding: 2px 8px;
}
.home-foot-note { text-align: center; font-size: 11px; color: var(--muted); margin: 18px 16px 0; }

/* ======== 自定义下拉框（替代原生 select 弹层） ======== */
.dd { position: relative; width: 100%; }
.dd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 14px; color: var(--txt); font-family: inherit;
  cursor: pointer; transition: border-color .15s;
}
.dd-btn:active { border-color: var(--gold); }
.dd-caret { color: var(--muted); font-size: 11px; transition: transform .15s; }
.dd.open .dd-caret { transform: rotate(180deg); }
.dd-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: 0 10px 28px rgba(139,90,43,.18);
  max-height: 216px; overflow-y: auto;
}
.dd.open .dd-list { display: block; }
.dd-item { padding: 9px 12px; font-size: 14px; color: var(--txt); cursor: pointer; }
.dd-item + .dd-item { border-top: 1px solid var(--line); }
.dd-item:hover { background: var(--gold-bg); }
.dd-item.on { color: var(--red); font-weight: 700; background: var(--gold-bg); }
.form-field .dd .dd-btn { justify-content: flex-end; }
.form-field .dd { max-width: 62%; margin-left: auto; }

/* ======== 分类「使用提示」卡 ======== */
.cat-tips {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 16px;
  margin: 12px 16px 0; box-shadow: var(--shadow-sm);
}
.cat-tips h3 { margin: 0 0 4px; font-size: 13px; color: var(--gold); letter-spacing: 1px; }
.cat-tips ul { margin: 0; padding-left: 17px; }
.cat-tips li { font-size: 12px; color: var(--txt2); line-height: 1.8; }

/* ======== 内页排版精修（第二轮 · 2026-09-12） ======== */
/* 带入档案按钮容器 */
.bring-wrap { padding: 0 16px; margin: -6px 0 4px; }
.bring-wrap .btn { width: 100%; padding: 11px; border-radius: 22px; font-size: 14px; letter-spacing: 1px; }
/* 自定义下拉：文字按钮部分 */
.dd-label { font-size: 15px; color: var(--txt2); }
.form-field .dd .dd-caret { color: var(--muted); font-size: 12px; margin-left: 6px; transition: transform .2s; }
.form-field .dd.open .dd-caret { transform: rotate(180deg); }
/* 流年格 */
.liu-nian { margin-top: 10px; }
/* 分类 hero 文字区 */
.cat-hero-text { min-width: 0; }

/* 结果区：统一成白卡容器，标题带金色竖条 */
.result-section {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 16px;
  margin: 14px 16px 0;
}
.result-section > h4 {
  margin: 6px 0 10px;
  font-size: 14px; color: var(--txt); font-weight: 700; letter-spacing: .5px;
  padding-left: 10px; position: relative;
}
.result-section > h4::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--red));
}
.result-section > h4:first-child { margin-top: 0; }
.result-section p { font-size: 13px; line-height: 1.85; color: var(--txt2); margin: 8px 0; }
.result-section .muted { color: var(--muted); font-size: 12px; line-height: 1.7; }
.result-section .note { margin-top: 12px; }
/* 结果区内的键值行：斑马底 + 去末行横线 */
.result-section .kv, .card .kv { padding: 8px 2px; font-size: 13.5px; }
.result-section .kv:nth-of-type(even), .card .kv:nth-of-type(even) { background: linear-gradient(90deg, transparent, rgba(184,134,11,.045), transparent); }
.result-section .kv:last-child { border-bottom: none; }
.kv .k { color: var(--txt2); }
.kv .v, .kv b { color: var(--gold); font-weight: 700; }
/* 计分明细折叠块 */
details {
  margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--card2); overflow: hidden;
}
details summary {
  padding: 9px 12px; font-size: 13px; color: var(--gold); font-weight: 600;
  cursor: pointer; list-style: none; position: relative;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '▾'; position: absolute; right: 12px; color: var(--muted); font-size: 12px; }
details[open] summary::after { content: '▴'; }
details p { margin: 0; padding: 0 12px 11px; }
/* 通用小工具类 */
.mt { margin-top: 8px; }
.err { color: var(--red); font-size: 13px; padding: 10px 16px; }
.muted { color: var(--muted); }
/* 功能卡信息区排版（补充：保持原有 flex:1 不被覆盖） */
.feature-info { flex: 1; min-width: 0; }
/* 空状态提示 */
.result-section .empty, .empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0; }
/* 表单区在窄屏的呼吸感 */
@media (max-width: 360px) {
  .form-field { padding: 12px 13px; min-height: 50px; }
  .form-field label { min-width: 68px; font-size: 14px; }
  .calc-btn { font-size: 17px; letter-spacing: 2px; }
}

/* 打印 */
@media print {
  #topbar, #bottomNav, #tip, .sw-actions, .home-btn { display: none !important; }
  .siwei-report { padding: 0; }
  .sw-chapter, .sw-cover { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ============ 首页品牌徽标（统一采用 logo 主视觉） ============ */
.home-logo-img {
  width: 100%; height: 100%; display: block;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 1px 5px rgba(184,134,11,.35), 0 0 0 1px rgba(184,134,11,.28);
}
