/* 问真风格 UI：暗红 + 鎏金 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3ede1;
  color: #4a3728;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 58px; background: #f3ede1; }
.page { display: none; }
.page.active { display: block; }

/* ===== 顶部：仿古暗红 + 金色 ===== */
.header {
  background: linear-gradient(160deg, #7a1f1f 0%, #5c1414 100%);
  color: #f0d9a8;
  padding: 14px 16px;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: 3px;
  text-align: center;
  position: relative;
  border-bottom: 2px solid #c9a063;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
}
.header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, transparent, #e8c882 20%, #e8c882 80%, transparent);
}
.header .logo-coin {
  display: inline-block; width: 26px; height: 26px; line-height: 26px;
  border: 2px solid #e8c882; border-radius: 50%;
  font-size: 15px; margin-right: 8px; vertical-align: -5px;
  color: #e8c882;
}
.header.sub { text-align: left; padding-left: 12px; cursor: pointer; position: sticky; top: 0; z-index: 10; }
.header.sub .back { margin-right: 6px; color: #e8c882; }

.banner {
  text-align: center; padding: 26px 0 8px;
  color: #9e7b3f; font-size: 13px; letter-spacing: 5px;
  font-family: "STKaiti", "KaiTi", serif;
}
.banner .taiji { font-size: 40px; display: block; margin-bottom: 6px; color: #7a1f1f; }

/* ===== 首页宫格 ===== */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 14px; }
.menu-item {
  background: linear-gradient(180deg, #fffdf8, #faf4e6);
  border: 1px solid #e0cba4;
  border-radius: 8px;
  padding: 16px 4px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s;
  font-size: 13px;
  color: #5c4326;
  box-shadow: 0 2px 6px rgba(122,31,31,.07);
  position: relative;
}
.menu-item::before {
  content: '';
  position: absolute; inset: 3px;
  border: 1px solid #eedfbf;
  border-radius: 5px;
  pointer-events: none;
}
.menu-item:active { transform: scale(.94); }
.menu-item .icon { font-size: 28px; margin-bottom: 8px; filter: sepia(.3); }
.menu-item .name { font-family: "STKaiti", "KaiTi", serif; letter-spacing: 2px; font-weight: bold; }

/* ===== 表单 ===== */
.form { padding: 14px; }
.form-row {
  display: flex; align-items: center;
  background: #fffdf8;
  border: 1px solid #e0cba4;
  border-radius: 6px;
  margin-bottom: 10px; padding: 12px 14px;
}
.form-row label:first-child { width: 84px; color: #9e7b3f; font-size: 14px; flex-shrink: 0; font-family: "STKaiti", "KaiTi", serif; letter-spacing: 1px; }
.form-row input, .form-row select { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: #4a3728; }
.radio { margin-right: 20px; font-size: 15px; accent-color: #7a1f1f; }

.btn {
  width: 100%; padding: 12px;
  border: 1px solid #a8842e;
  border-radius: 6px;
  background: linear-gradient(180deg, #9e2a22, #7a1f1f);
  color: #f0d9a8;
  font-size: 17px;
  letter-spacing: 6px;
  cursor: pointer;
  margin-bottom: 14px;
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: 0 3px 0 #4a0f0f, 0 4px 8px rgba(0,0,0,.2);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #4a0f0f; }
/* 微信一键登录按钮 */
.btn.wechat {
  background: linear-gradient(180deg, #2aae67, #1d8f52);
  border-color: #1d8f52;
  box-shadow: 0 3px 0 #0e6b3a, 0 4px 8px rgba(0,0,0,.2);
  color: #fff;
}
.btn.wechat:active { box-shadow: 0 1px 0 #0e6b3a; }
.btn-group { display: flex; gap: 10px; margin-bottom: 14px; }
.btn-group .btn { flex: 1; margin-bottom: 0; letter-spacing: 2px; }
.btn-secondary {
  background: linear-gradient(180deg, #f5e8c8, #e8d5a3);
  color: #6b4a1f;
  border: 1px solid #c9a063;
  box-shadow: 0 3px 0 #a8842e, 0 4px 8px rgba(0,0,0,.15);
  text-shadow: none;
}
.btn-secondary:active { box-shadow: 0 1px 0 #a8842e; }
.tip {
  background: #faf4e6; border: 1px dashed #c9a063;
  border-radius: 6px; padding: 12px; font-size: 13px;
  color: #8a6d3b; margin-bottom: 14px; line-height: 1.7;
}

/* ===== 结果卡片 ===== */
.result-card {
  background: #fffdf8;
  border: 1px solid #e0cba4;
  border-radius: 8px;
  margin: 0 14px 14px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(122,31,31,.08);
  position: relative;
}
.result-card h3 {
  color: #7a1f1f; font-size: 15px; margin-bottom: 12px;
  font-family: "STKaiti", "KaiTi", serif; letter-spacing: 2px;
  display: flex; align-items: center;
}
.result-card h3::before {
  content: '◆'; font-size: 10px; color: #c9a063; margin-right: 6px;
}
.info-line { font-size: 13px; color: #7a6a52; margin-bottom: 6px; line-height: 1.7; }
.info-line b { color: #5c1414; font-weight: 600; }

/* ===== 四柱（参考图中道排盘：纵向分层卡片）===== */
.pillars { display: flex; gap: 6px; margin: 10px 0; }
.pillar {
  flex: 1;
  background: #fffdf8;
  border: 1px solid #d8bf8a;
  border-radius: 6px;
  padding: 8px 2px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.pillar.day-pillar {
  background: linear-gradient(180deg, #fbe9dc, #f6d9c4);
  border: 2px solid #b03a2e;
  box-shadow: 0 2px 8px rgba(176,58,46,.25);
}
.pillar .label {
  font-size: 11px; color: #9e7b3f; margin-bottom: 6px;
  font-family: "STKaiti", "KaiTi", serif; letter-spacing: 2px;
  border-bottom: 1px solid #e0cba4; padding-bottom: 4px; width: 90%;
}
.pillar.day-pillar .label { color: #b03a2e; border-bottom-color: #e8b09a; }
.pillar .ss { font-size: 11px; color: #6b4a1f; margin-bottom: 4px; }
.pillar .gz {
  font-size: 30px; font-weight: bold; line-height: 1.25;
  font-family: "STKaiti", "KaiTi", serif;
}
.pillar .gz.gan { color: #1f4e79; }
.pillar .gz.zhi { color: #1f4e79; margin-bottom: 4px; }
.pillar.day-pillar .gz { color: #b03a2e; }
.pillar .zg { font-size: 10px; color: #8a6d3b; min-height: 14px; line-height: 1.4; border-top: 1px dashed #e0cba4; padding-top: 4px; width: 90%; }
.pillar .ny { font-size: 10px; color: #5a7247; margin-top: 2px; }

/* ===== 四柱表格（参考图中道排盘）===== */
.bazi-table {
  width: 100%; border-collapse: collapse; margin: 10px 0;
  table-layout: fixed;
  background: #fffdf8;
}
.bazi-table td {
  border: 1px solid #d8bf8a;
  text-align: center; padding: 6px 2px;
  font-size: 12px; color: #5c4a2e;
}
/* 四柱与扩展列（大运/流年/流月）之间的分隔线：第4列右缘加粗 */
.bazi-table.no-head td:nth-child(4) { border-right: 2px solid #a8894f; }
.bazi-table td:first-child {
  width: 17%; background: #f3e9d2; color: #9e7b3f;
  font-size: 11px; font-family: "STKaiti", "KaiTi", serif; letter-spacing: 1px;
}
/* 无标签列（记录详情页：大运/流年/流月+四柱）：取消首列特殊样式，各列格式一致 */
.bazi-table.no-head td:first-child:not(.gz-cell) { width: auto; background: none; color: inherit; font-size: inherit; font-family: inherit; letter-spacing: 0; }
.bazi-table.no-head td.gz-cell:first-child { background: none; width: auto; font-size: 19px; font-weight: bold; color: #1f4e79; font-family: "STKaiti", "KaiTi", serif; letter-spacing: 0; padding: 3px 1px; }
.bazi-table.no-head td.gz-cell.day-col:first-child { color: #b03a2e; }
.bazi-table.no-head tr.hd td:first-child { background: #f3e9d2; color: #7a1f1f; }
.bazi-table.no-head tr.hd td { font-size: 12px; }
.bazi-table tr.hd td { background: #f3e9d2; color: #7a1f1f; font-family: "STKaiti", "KaiTi", serif; letter-spacing: 1px; font-size: 11px; }
.bazi-table .gz-cell { font-size: 19px; font-weight: bold; color: #1f4e79; font-family: "STKaiti", "KaiTi", serif; padding: 3px 1px; }
.bazi-table .day-col { color: #b03a2e; }
.bazi-table .gz-cell.day-col { color: #b03a2e; }
.bazi-table .zg-cell { font-size: 11px; color: #8a6d3b; }
.bazi-table .ny-cell { font-size: 10px; color: #5a7247; }
/* 十神小标签：干上方 / 支下方，无底色 */
.bazi-table .ss-tag {
  display: block;
  font-size: 10px;
  font-weight: normal;
  color: #8a6d3b;
  background: none;
  line-height: 1.2;
}
.bazi-table .ss-tag.top { margin-bottom: 0; }
/* 六亲：竖排贴单元格左侧，干支字保持居中 */
.bazi-table .gz-cell { text-align: center; position: relative; }
.bazi-table .lq-vert {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: normal;
  color: #9a7b4f;
  line-height: 1.1;
  text-align: center;
}
.bazi-table .day-col .ss-tag { color: #b03a2e; }
/* 年干定位财 / 年支定位印标签 */
.bazi-table .dw-tag {
  display: block;
  font-size: 9px;
  color: #7a1f1f;
  background: none;
  margin-top: 2px;
  line-height: 1.3;
}
/* 年干短板（撑/饿）：贴单元格右缘垂直居中，竖排 */
.bazi-table .dw-tag.short-tag {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  width: 1em;
  word-break: break-all;
  line-height: 1.15;  text-align: center;
}

/* ===== 每日方位 ===== */
.fw-cards { display: flex; gap: 10px; margin: 10px 0; }
.fw-card { flex: 1; background: #faf7f2; border: 1px solid #e8ddc8; border-radius: 10px; text-align: center; padding: 12px 4px; }
.fw-name { font-size: 12px; color: #7a5c3e; margin-bottom: 6px; }
.fw-dir { font-size: 20px; font-weight: 700; font-family: 'KaiTi', 'STKaiti', serif; }
.fw-table td { font-size: 12px; }

/* 会员卡片 */
.vip-card {
  margin: 16px auto 0; max-width: 300px; padding: 12px 16px;
  background: linear-gradient(135deg, #fdf6e9, #f7e9cf);
  border: 1px solid #e3c98f; border-radius: 12px;
}
.vip-card.vip-on { background: linear-gradient(135deg, #2b2417, #4a3a1a); border-color: #c9a86a; }
.vip-card .vip-title { font-size: 15px; font-weight: bold; color: #8a6a1f; }
.vip-card.vip-on .vip-title { color: #ffd98a; }
.vip-card .vip-sub { font-size: 12px; color: #a08a55; margin-top: 4px; }
.vip-card.vip-on .vip-sub { color: #d8c08a; }
.vip-card .vip-buy { margin-top: 10px; width: 100%; }

/* 大运/流年/流月/流日/流时表格：fixed 布局不横向滚动 */
.ln-table { width: 100%; table-layout: fixed; }
.ln-table td { font-size: 10px; padding: 3px 0; word-break: break-all; overflow-wrap: anywhere; max-width: 0; }
.ln-table td:first-child { width: 13%; min-width: 0; }
.ln-table td:not(:first-child) { width: auto; }
.ln-table tr.hd td { letter-spacing: 0; }
.ln-table .gz-cell { font-size: 13px; padding: 2px 0; }
.ln-table .dy-cell, .ln-table .ln-cell, .ln-table .ly-cell, .ln-table .lr-cell { cursor: pointer; }
.ln-table .dy-cell.active, .ln-table .ln-cell.active, .ln-table .ly-cell.active, .ln-table .lr-cell.active {
  background: #b03a2e; color: #f5e8c8; font-weight: bold;
}
/* 当前大运整列加强 */
.dy-table .cur-dy { background: #f6d9c4; font-weight: bold; color: #7a1f1f; }
.dy-table td.cur-dy-hd { background: #b03a2e; color: #f5e8c8; font-weight: bold; font-size: 14px; }
/* 当前流年/流月/流日/流时整列突出 */
.ln-table td.cur-col { background: #f6d9c4; font-weight: bold; color: #7a1f1f; }
.ln-table tr.hd td.cur-col { background: #b03a2e; color: #f5e8c8; }

.wx-bar { display: flex; gap: 6px; margin-top: 10px; }
.wx-item { flex: 1; text-align: center; background: #faf4e6; border-radius: 6px; padding: 8px 2px; border: 1px solid #eedfbf; }
.wx-item .cnt { font-weight: bold; color: #7a1f1f; }
.wx-item .name { font-size: 12px; color: #8a6d3b; }

.liri-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.liri-item .ln-year { font-size: 11px; }

/* ===== 记录筛选 ===== */
.filter-row { display: flex; gap: 8px; padding: 0 0 10px; }
.filter-chip {
  font-size: 13px; padding: 4px 16px; border-radius: 14px;
  background: #fff; border: 1px solid #d8c9a5; color: #6a5842; cursor: pointer;
}
.filter-chip.active { background: #7a1f1f; color: #e8c882; border-color: #7a1f1f; }

/* ===== 历史 ===== */
.rec-item {
  background: #fffdf8; border: 1px solid #e0cba4; border-radius: 6px;
  margin: 0 14px 10px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.rec-item .del { color: #a03a2a; font-size: 12px; cursor: pointer; }
.rec-item .type-badge {
  background: linear-gradient(180deg, #9e2a22, #7a1f1f);
  color: #f0d9a8; border-radius: 3px; padding: 1px 7px; font-size: 11px; margin-right: 6px;
}
.rec-item .info { flex: 1; font-size: 13px; color: #6a5842; }
.rec-item .time { font-size: 11px; color: #b3a284; }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: linear-gradient(180deg, #5c1414, #4a0f0f);
  display: flex; z-index: 20;
  border-top: 2px solid #c9a063;
}
.tab {
  flex: 1; text-align: center; padding: 9px 0 8px;
  font-size: 11px; color: #c9a888; cursor: pointer;
}
.tab .t-icon { display: block; font-size: 18px; margin-bottom: 2px; filter: grayscale(.6); }
.tab.active { color: #e8c882; font-weight: bold; }
.tab.active .t-icon { filter: none; }

.loading { text-align: center; padding: 30px; color: #9e7b3f; }

/* ===== 用户栏 / 登录 ===== */
.user-bar {
  text-align: center; padding: 6px 14px 16px;
  font-size: 13px; color: #8a6d3b;
}
.user-bar .ub-link { color: #7a1f1f; margin: 0 10px; cursor: pointer; text-decoration: underline; }
.user-bar .ub-hello { font-weight: bold; color: #5c1414; margin-right: 6px; }
.btn.alt { background: linear-gradient(180deg, #b08a3e, #8a6a2a); box-shadow: 0 3px 0 #5c431a, 0 4px 8px rgba(0,0,0,.2); }
.avatar {
  width: 64px; height: 64px; line-height: 64px; margin: 0 auto;
  border-radius: 50%; background: linear-gradient(160deg, #7a1f1f, #5c1414);
  color: #e8c882; font-size: 28px; font-weight: bold;
  border: 2px solid #c9a063;
  font-family: "STKaiti", "KaiTi", serif;
}

/* ===== 登录页 ===== */
.login-hero {
  text-align: center;
  padding: 36px 0 22px;
  background: linear-gradient(180deg, #7a1f1f 0%, #8a2620 70%, #f3ede1 100%);
  position: relative;
}
.taiji-spin {
  font-size: 52px; color: #e8c882;
  width: 92px; height: 92px; line-height: 92px;
  margin: 0 auto 12px;
  background: radial-gradient(circle, rgba(0,0,0,.25), rgba(0,0,0,0) 70%);
  border: 2px solid #c9a063; border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(201,160,99,.15), 0 4px 14px rgba(0,0,0,.3);
  animation: taijiFloat 3.5s ease-in-out infinite;
}
@keyframes taijiFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(180deg); }
}
.login-title {
  font-size: 24px; font-weight: bold; letter-spacing: 6px;
  color: #f0d9a8; text-shadow: 0 2px 4px rgba(0,0,0,.5);
  font-family: "STKaiti", "KaiTi", serif;
}
.login-sub { font-size: 12px; color: #d9bd8a; letter-spacing: 2px; margin-top: 6px; }
.login-form { padding-top: 18px; }
.login-form .form-row { border-radius: 25px; padding: 13px 20px; transition: box-shadow .2s, border-color .2s; }
.login-form .form-row:focus-within {
  border-color: #c9a063;
  box-shadow: 0 0 0 3px rgba(201,160,99,.18);
}
.login-divider {
  display: flex; align-items: center; margin: 4px 0 14px;
  color: #b3a284; font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, #d8bf8a);
}
.login-divider::after { background: linear-gradient(90deg, #d8bf8a, transparent); }
.login-divider span { padding: 0 12px; }
.login-skip {
  text-align: center; color: #9e7b3f; font-size: 13px;
  padding: 8px 0 16px; cursor: pointer; letter-spacing: 1px;
}
.login-skip:active { color: #7a1f1f; }

/* ===== 排盘记录查看弹窗 ===== */
.view { color: #8a6a2a; font-size: 12px; cursor: pointer; margin-right: 10px; text-decoration: underline; }
#rec-mask {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(40, 20, 10, .55);
  align-items: flex-end; justify-content: center;
}
.rec-modal {
  width: 100%; max-width: 480px; max-height: 82vh;
  background: #f3ede1;
  border-radius: 14px 14px 0 0;
  border-top: 2px solid #c9a063;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.rec-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(160deg, #7a1f1f, #5c1414);
  color: #f0d9a8; padding: 13px 16px; font-size: 14px;
  font-family: "STKaiti", "KaiTi", serif; letter-spacing: 1px;
  flex-shrink: 0;
}
.rec-close { font-size: 17px; cursor: pointer; color: #e8c882; padding: 0 4px; }
.rec-modal-body { overflow-y: auto; padding: 14px; }
.rec-modal-body .result-card, .rec-modal-body h3 { margin-left: 0; margin-right: 0; }

/* ===== 神煞标签 ===== */
.ss-tag {
  display: inline-block; background: #7a1f1f; color: #e8c882;
  font-size: 11px; padding: 1px 8px; border-radius: 10px; margin: 2px 2px;
}

/* ===== 大运列表 ===== */
.dayun-list {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px;
}
.dayun-item {
  background: #faf6ec; border: 1px solid #d8bf8a; border-radius: 8px;
  padding: 8px 2px; text-align: center;
}
.dayun-item .gz {
  font-family: "STKaiti", "KaiTi", serif; font-size: 17px; font-weight: bold;
  color: #7a1f1f; letter-spacing: 2px; margin-bottom: 4px;
}
.dayun-item .age { font-size: 11px; color: #8a6a2a; }
.dayun-item .year { font-size: 10px; color: #999; margin-top: 1px; }
.dayun-item.active { background: #7a1f1f; border-color: #7a1f1f; }
.dayun-item.active .gz { color: #e8c882; }
.dayun-item.active .age, .dayun-item.active .year { color: #d8bf8a; }

/* ===== 流年 / 流月 ===== */
#liunian-panel, #liuyue-panel { margin-top: 12px; }
.liunian-list {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px;
}
.liuyue-grid { grid-template-columns: repeat(3, 1fr); }
.liushi-grid { grid-template-columns: repeat(4, 1fr); }
.liunian-item {
  background: #faf6ec; border: 1px solid #d8bf8a; border-radius: 8px;
  padding: 8px 2px; text-align: center; cursor: pointer;
}
.liunian-item.active { background: #7a1f1f; border-color: #7a1f1f; }
.liunian-item .ln-year { font-size: 11px; color: #8a6a2a; }
.liunian-item .ln-gz {
  font-family: "STKaiti", "KaiTi", serif; font-size: 16px; font-weight: bold;
  color: #7a1f1f; letter-spacing: 2px; margin: 3px 0;
}
.liunian-item .ln-ss { font-size: 10px; color: #c0392b; }
.liunian-item.active .ln-year, .liunian-item.active .ln-ss { color: #d8bf8a; }
.liunian-item.active .ln-gz { color: #e8c882; }
