/* 奇门遁甲 · 专业排盘 —— 深色罗盘主题 */
:root {
  --bg: #0b1220;
  --bg2: #0d1626;
  --surface: #121d33;
  --surface2: #16233d;
  --border: #24324f;
  --border2: #2e3f63;
  --text: #dbe5f5;
  --muted: #8ba0c0;
  --gold: #e8b566;
  --cyan: #35d0c6;
  --red: #ef6b6b;
  --green: #4ad07a;
  --el-mu: #4ad07a;
  --el-huo: #ef6b6b;
  --el-tu: #e0b155;
  --el-jin: #d3dde9;
  --el-shui: #5aa9f0;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
/* 顶栏外层：桌面端承接原顶栏布局，手机端改为块级，让时间条脱离吸顶区 */
.topbar-wrap {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  background: linear-gradient(180deg, #101c31, #0c1523);
  border-bottom: 1px solid var(--border);
}
.topbar { display: contents; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { font-size: 26px; color: var(--cyan); display: inline-flex; filter: drop-shadow(0 0 6px rgba(53,208,198,.5)); }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 3px; color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 1px; border-left: 1px solid var(--border2); padding-left: 10px; }
.nowbox { margin-left: auto; font-size: 12.5px; color: var(--muted); text-align: right; line-height: 1.6; }
.nowbox b { color: var(--text); font-weight: 600; }
.nowbox .nb-gold { color: var(--gold); }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 18px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.tb-group.grow { flex: 1; min-width: 220px; }
.tb-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ipt {
  background: var(--surface); color: var(--text); border: 1px solid var(--border2);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; outline: none;
}
.ipt:focus { border-color: var(--cyan); }
.ipt.grow { flex: 1; }
.ipt:disabled { opacity: .45; }
/* 浏览器自动填充会把输入框刷成白底，这里强制沿用深色主题 */
.ipt:-webkit-autofill,
.ipt:-webkit-autofill:hover,
.ipt:-webkit-autofill:focus,
.ipt:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: var(--text);
}
.ipt-sm { width: 86px; padding: 6px 8px; font-size: 12px; }
.ipt-name { width: 120px; }
#baziProv { width: 88px; }
#baziCity { width: 104px; }
.tb-group[hidden] { display: none !important; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; overflow: hidden; }
.seg-btn {
  background: transparent; border: 0; color: var(--muted); font-size: 13px; font-family: inherit;
  padding: 7px 12px; cursor: pointer; transition: .12s;
}
.seg-btn.active { background: var(--cyan); color: #06222a; font-weight: 700; }
.seg-btn:not(.active):hover { color: var(--text); }
.btn {
  border: 1px solid var(--border2); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; font-family: inherit; cursor: pointer; transition: .12s;
}
.btn:hover { border-color: var(--cyan); color: #fff; }
.btn-primary { background: linear-gradient(180deg, #2fbfb4, #1f9a92); border-color: #2fbfb4; color: #04201f; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.08); color: #04201f; }
.btn-ghost { background: transparent; }
.btn-mini { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.err { color: var(--red); font-size: 12.5px; }

/* ---------- 主体 ---------- */
/* 五个术数视图容器：接入 body 纵向 flex 链，内部 main 才能撑满剩余高度 */
#qimenView, #liuyaoView, #meihuaView, #daliurenView, #baziView, #ziweiView {
  flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0;
}
.layout { flex: 1; display: flex; gap: 14px; padding: 14px 18px; min-height: 0; }
.stage-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.side-col { width: 348px; flex: none; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.side-col::-webkit-scrollbar { width: 8px; }
.side-col::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ---------- 排盘信息条 ---------- */
.chart-head {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; margin-bottom: 10px; font-size: 12.5px;
}
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); white-space: nowrap; }
.chip .k { color: var(--muted); }
.chip .v { color: var(--text); font-weight: 600; }
.chip.gold .v { color: var(--gold); }
.chip.cyan .v { color: var(--cyan); }
.chip.red .v { color: var(--red); }
.chip.lead { background: #1a2b20; border-color: #2f6a44; }
.chip.lead .v { color: var(--green); }

/* ---------- 视图切换 ---------- */
.view-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
/* 奇门视图切换按钮与六爻/梅花的 .view-switch 按钮同款小尺寸 */
#viewMode .seg-btn { font-size: 12px; padding: 4px 10px; }
.s3d-tools { display: flex; align-items: center; gap: 8px; }
.s3d-tools input[type=range] { width: 110px; accent-color: var(--cyan); }
/* 操作提示：浮动在排盘视图底部居中（与六爻/梅花 iframe 内 hint 同位置） */
.view-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); pointer-events: none; z-index: 5; white-space: nowrap;
}

/* ---------- 2D 九宫 ---------- */
/* 排盘容器与六爻/梅花/大六壬/八字的 .bazi-pan 统一：同款卡片+边框+圆角+overflow 裁切 */
.chart-wrap {
  flex: 1; position: relative; min-height: 0; display: flex;
  background: linear-gradient(160deg, var(--surface), var(--bg2));
  border: 1px solid var(--border2); border-radius: var(--radius);
  overflow: hidden; padding: 10px;
}
.pan2d {
  margin: 0 auto; width: min(100%, 840px); height: 100%; max-height: 620px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pal {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 7px 9px; display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: .12s; overflow: hidden; min-height: 0;
}
.pal:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(53,208,198,.16); }
.pal.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 20px rgba(232,181,102,.22); }
.pal[data-el="木"] { background: rgba(74,208,122,.055); }
.pal[data-el="火"] { background: rgba(239,107,107,.055); }
.pal[data-el="土"] { background: rgba(224,177,85,.055); }
.pal[data-el="金"] { background: rgba(211,221,233,.05); }
.pal[data-el="水"] { background: rgba(90,169,240,.06); }
.pal.mid { background: #0f1828; border-style: dashed; }
.pal-hd { display: flex; align-items: center; gap: 6px; }
.pnum { font-size: 13px; font-weight: 800; color: var(--gold); letter-spacing: .5px; }
.pzhi { font-size: 11px; color: var(--muted); }
.pbadges { margin-left: auto; display: flex; gap: 3px; flex-wrap: wrap; }
.bdg { font-size: 10px; padding: 1px 5px; border-radius: 4px; border: 1px solid; line-height: 1.5; }
.bdg-kong { color: #7fb6ff; border-color: #2f5a8f; background: rgba(90,169,240,.12); }
.bdg-ma { color: #f0b46a; border-color: #8a6224; background: rgba(240,180,106,.12); }
.bdg-day { color: #7fe3a3; border-color: #2f6a44; background: rgba(74,208,122,.12); }
.bdg-hour { color: #ffd98a; border-color: #8a6a24; background: rgba(232,181,102,.14); }
.bdg-zf { color: #c9b6ff; border-color: #4a3a78; background: rgba(169,140,240,.14); }
.bdg-zs { color: #9fd8ff; border-color: #2f5a8f; background: rgba(120,190,255,.12); }

.pal-main { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; min-height: 0; }
.pm-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; justify-content: center; }
.pm-r { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.pm-l > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.god { font-size: 12.5px; font-weight: 700; }
.star { font-size: 13px; font-weight: 600; }
.door { font-size: 13.5px; font-weight: 700; }
.gan { font-size: clamp(18px, 2vw, 24px); font-weight: 800; line-height: 1; }
.gan.small { font-size: clamp(13px, 1.2vw, 16px); font-weight: 600; color: var(--muted); }
.el-mu { color: var(--el-mu); }
.el-huo { color: var(--el-huo); }
.el-tu { color: var(--el-tu); }
.el-jin { color: var(--el-jin); }
.el-shui { color: var(--el-shui); }
.god-zhifu { color: var(--gold); }
.god-ts { color: #e879b9; }
.god-ty { color: #a98cf0; }
.god-lh { color: #4ad07a; }
.god-bh { color: #ef6b6b; }
.god-xw { color: #7b93bd; }
.god-jd { color: #b6d94a; }
.god-jt { color: #4fc3f7; }
.star-ji { color: #8fe0b0; }
.star-xiong { color: #f09a9a; }
.star-ping { color: #cdd8e8; }
.door-ji { color: var(--green); }
.door-xiong { color: var(--red); }
.door-ping { color: #b9c6da; }
.pal-foot { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mk { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid; }
.mk-xiong { color: #ff9b9b; border-color: #7a3a3a; background: rgba(239,107,107,.12); }
.mk-ji { color: #7fe3a3; border-color: #2f6a44; background: rgba(74,208,122,.12); }
.gj { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid; }
.gj-ji { color: #7fe3a3; border-color: #2f6a44; background: rgba(74,208,122,.1); }
.gj-xiong { color: #ffb27a; border-color: #7a5224; background: rgba(240,160,106,.1); }
.mid-note { font-size: 12px; color: var(--muted); }

/* ---------- 3D 立体 ---------- */
.pan3d { position: absolute; inset: 0; }
.stage3d {
  position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 56%;
  cursor: grab; touch-action: none; overflow: hidden;
}
.stage3d:active { cursor: grabbing; }
.stage3d-inner {
  position: absolute; left: 50%; top: 62%; width: 0; height: 0;
  transform-style: preserve-3d;
  transform: scale(var(--sc, 1)) rotateX(var(--rx, 58deg)) rotateZ(var(--rz, 0deg));
}
.col3d {
  position: absolute; width: 96px; height: 46px; margin-left: -48px; margin-top: -23px;
  transform-style: preserve-3d;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
}
.plate3d {
  position: absolute; inset: 0; border-radius: 9px; border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 14px; font-weight: 600; backface-visibility: hidden;
  background: var(--surface2); color: var(--text);
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--gap, 66px) * var(--z))) rotateZ(calc(var(--rz, 0deg) * -1)) rotateX(calc(var(--rx, 58deg) * -1));
  transition: box-shadow .12s, border-color .12s;
}
.col3d.sel .plate3d { border-color: var(--gold); box-shadow: 0 0 14px rgba(232,181,102,.45); }
.col3d:not(.sel):hover .plate3d { border-color: var(--cyan); }
.p-god { background: #211a38; border-color: #443572; color: #c9b6ff; }
.p-star { background: #2a2213; border-color: #64521f; color: #f0cc85; }
.p-star.star-xiong { color: #f09a9a; }
.p-door-ji { background: #11281c; border-color: #2d6542; color: #7fe3a3; }
.p-door-xiong { background: #2a1518; border-color: #743636; color: #ff9b9b; }
.p-door-ping { background: #182234; border-color: #37496a; color: #b9c6da; }
.p-tpan { background: #0e282a; border-color: #2a6560; color: #7fe8dd; }
.p-dpan { background: #181e2e; border-color: #353f57; color: #cbd6e8; }
.plate3d .z { font-size: 10px; color: var(--muted); font-weight: 500; }
.plate3d .big { font-size: 17px; font-weight: 800; }
.plate3d small.pn { font-size: 10px; color: var(--gold); font-weight: 700; }
.stage3d-hint { position: absolute; left: 12px; bottom: 10px; font-size: 11.5px; color: var(--muted); }
/* 3D 视图内浮动按钮（回正/自转），位置与六爻/梅花 iframe 内 .bar 按钮一致：顶部靠右 */
.s3d-float { position: absolute; top: 8px; right: 10px; z-index: 5; display: flex; gap: 8px; }

/* ---------- 侧栏 ---------- */
.side-sec {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 13px; font-size: 12.5px;
}
.side-title { font-size: 13px; font-weight: 700; color: var(--gold); letter-spacing: 1px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.side-title::before { content: ''; width: 3px; height: 13px; background: var(--cyan); border-radius: 2px; }
.kv { display: grid; grid-template-columns: 68px 1fr; gap: 5px 8px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); }
/* 起局要素：主区排盘下方横排多列（与六爻/梅花主区信息卡同款容器） */
#qmBlocks { margin-top: 10px; }
.kv-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 5px 14px; }
.kv-wide .kv-pair { display: flex; gap: 8px; min-width: 0; }
.kv-wide .k { color: var(--muted); flex: none; }
.kv-wide .v { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-wide .v.gold { color: var(--gold); font-weight: 600; }
.kv-wide .v.cyan { color: var(--cyan); font-weight: 600; }
.kv .v.gold { color: var(--gold); font-weight: 600; }
.kv .v.cyan { color: var(--cyan); font-weight: 600; }
.plist { display: flex; flex-direction: column; gap: 6px; }
.pitem { display: flex; gap: 7px; align-items: flex-start; padding: 6px 8px; border-radius: 7px; background: var(--surface2); border: 1px solid var(--border); }
.pitem .name { font-weight: 700; white-space: nowrap; }
.pitem.ji .name { color: var(--green); }
.pitem.xiong .name { color: #ff9b9b; }
.pitem .desc { color: var(--muted); line-height: 1.55; }
.analysis-verdict { font-size: 14px; font-weight: 700; color: var(--gold); margin-bottom: 7px; }
.analysis-pts { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 5px; line-height: 1.62; color: #c8d4e6; }
.analysis-pts li::marker { color: var(--cyan); }
.disclaimer { margin-top: 9px; font-size: 11px; color: var(--muted); line-height: 1.6; border-top: 1px dashed var(--border2); padding-top: 8px; }

/* ---------- 事类断语面板 ---------- */
#dyCategory { width: 100%; margin-bottom: 8px; }
.dy-verdict-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; }
.dy-verdict { font-size: 18px; font-weight: 800; padding: 3px 12px; border-radius: 6px; letter-spacing: 2px; }
.dy-verdict.verdict-ji { background: rgba(74,208,122,.15); color: var(--green); border: 1px solid rgba(74,208,122,.3); box-shadow: 0 0 10px rgba(74,208,122,.15); }
.dy-verdict.verdict-xiong { background: rgba(239,107,107,.15); color: var(--red); border: 1px solid rgba(239,107,107,.3); box-shadow: 0 0 10px rgba(239,107,107,.15); }
.dy-verdict.verdict-ping { background: rgba(139,160,192,.12); color: var(--muted); border: 1px solid var(--border2); }
.dy-core { font-size: 11px; color: var(--muted); }
.dy-points { list-style: none; padding: 0; margin: 0; }
.dy-points li { padding: 6px 10px; margin-bottom: 4px; border-radius: 6px; font-size: 12px; line-height: 1.55; border-left: 3px solid transparent; background: var(--surface2); }
.dy-points li.dy-ji { border-left-color: var(--green); background: rgba(74,208,122,.06); }
.dy-points li.dy-xiong { border-left-color: var(--red); background: rgba(239,107,107,.06); }
.dy-points li.dy-ping { border-left-color: var(--muted); background: rgba(139,160,192,.04); }
/* 三术数事类断语面板新增元素 */
.dy-sumline { padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; font-size: 13px; font-weight: 700; line-height: 1.6; background: rgba(53,208,198,.08); border: 1px solid rgba(53,208,198,.22); color: var(--cyan); }
.side-hint { font-style: normal; font-size: 11px; color: var(--muted); margin-left: auto; }
.dy-foot { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border2); font-size: 11.5px; color: var(--muted); line-height: 1.9; }
.dy-foot .dy-label { display: inline-block; width: 34px; color: var(--gold); font-weight: 600; }
.dy-gp { margin-top: 8px; padding: 6px 8px; background: var(--surface); border: 1px dashed var(--border2); border-radius: 6px; }
.dy-gp-title { font-size: 11px; color: var(--gold); font-weight: 600; margin-bottom: 4px; }
.dy-gp-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; }
.gp-tag { font-size: 10px; padding: 2px 6px; border-radius: 3px; border: 1px solid; }
.gp-tag.gp-吉 { color: var(--green); border-color: rgba(74,208,122,.35); background: rgba(74,208,122,.08); }
.gp-tag.gp-凶 { color: var(--red); border-color: rgba(239,107,107,.35); background: rgba(239,107,107,.08); }
.gp-tag.gp-平 { color: var(--muted); border-color: var(--border2); background: rgba(139,160,192,.06); }

/* 选中宫详情 */
.sel-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sel-name { font-size: 16px; font-weight: 800; color: var(--gold); }
.sel-dir { font-size: 11.5px; color: var(--muted); }
.sel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.sel-cell { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; }
.sel-cell .ck { font-size: 10.5px; color: var(--muted); }
.sel-cell .cv { font-size: 14px; font-weight: 700; margin-top: 2px; }
.ws { font-size: 10px; padding: 0 4px; border-radius: 3px; border: 1px solid var(--border2); color: var(--muted); margin-left: 4px; }
.ws-旺 { color: #7fe3a3; border-color: #2f6a44; }
.ws-相 { color: #bce89f; border-color: #4a6a33; }
.ws-休 { color: #9fb6d4; border-color: #3a4d6b; }
.ws-囚 { color: #e0b155; border-color: #6a5626; }
.ws-死 { color: #ff9b9b; border-color: #7a3a3a; }

/* ---------- 卦例抽屉 ---------- */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 380px; background: var(--bg2);
  border-left: 1px solid var(--border2); box-shadow: -12px 0 32px rgba(0,0,0,.5);
  display: flex; flex-direction: column; z-index: 20;
}
.drawer-hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: 14px; font-weight: 700; color: var(--gold); margin-right: auto; }
.hist-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.hist-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; cursor: pointer; transition: .12s; position: relative; }
.hist-item:hover { border-color: var(--cyan); }
.hist-item .ht { font-size: 12px; color: var(--text); font-weight: 600; }
.hist-item .hn { color: var(--cyan); }
.hist-item .hs { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.hist-item .hq { font-size: 11px; color: #a98cf0; margin-top: 3px; }
.hist-del { position: absolute; right: 8px; top: 8px; font-size: 11px; color: var(--muted); border: 1px solid var(--border2); border-radius: 5px; padding: 1px 6px; background: transparent; cursor: pointer; }
.hist-del:hover { color: var(--red); border-color: #7a3a3a; }

/* ---------- 占位 ---------- */
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.placeholder[hidden] { display: none; }
.ph-mark { font-size: 52px; color: var(--cyan); opacity: .5; }

@media (max-width: 1180px) {
  .layout { flex-direction: column; overflow-y: auto; }
  .stage-col { flex: none; min-height: 620px; }
  .side-col { width: 100%; flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .side-sec { flex: 1 1 320px; }
  .pan2d { width: 100%; }
}

/* ---------- 罗盘同心环视图 ---------- */
.panCompass { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 42%; overflow: hidden; cursor: grab; touch-action: none; }
.panCompass:active { cursor: grabbing; }
.cp-assembly { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.cp-ring { position: absolute; left: 0; top: 0; transform-style: preserve-3d; border-radius: 50%; }
.cp-disc {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,.028) 0deg 22.4deg, rgba(0,0,0,0) 22.4deg 45deg),
    radial-gradient(circle at 50% 42%, #1a2742 0%, #121d33 58%, #0d1626 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.05) inset, 0 0 30px rgba(0,0,0,.45);
}
.cp-sector { position: absolute; left: 50%; top: 50%; width: 0; height: 0; cursor: pointer; }
.cp-slot { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; text-shadow: 0 1px 3px rgba(0,0,0,.8); user-select: none; }
.cp-sector.sel .cp-slot { filter: drop-shadow(0 0 8px rgba(232,181,102,.9)); }
.cp-rtag { position: absolute; left: 50%; top: 0; transform: translate(-50%,-50%); font-size: 10.5px; letter-spacing: 2px; color: var(--muted); background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px; white-space: nowrap; pointer-events: none; }
.cp-bezel { pointer-events: none; }

/* ============ AI 解读 ============ */
.side-title { display: flex; justify-content: space-between; align-items: center; }
.ai-btn { width: 100%; margin-top: 8px; font-weight: 600; letter-spacing: 1px; }
.ai-btn:disabled { opacity: .55; cursor: not-allowed; background: var(--surface); color: var(--muted); }
.ai-result { margin-top: 10px; padding: 10px 12px; background: linear-gradient(135deg, rgba(232,181,102,.08) 0%, rgba(97,142,207,.06) 100%); border: 1px solid rgba(232,181,102,.25); border-radius: 8px; max-height: 420px; overflow-y: auto; }
.ai-loading { text-align: center; color: var(--muted); padding: 20px 0; font-size: 20px; letter-spacing: 4px; }
.ai-loading .dot { animation: aiBlink 1.2s infinite; }
.ai-loading .dot:nth-child(2) { animation-delay: .2s; }
.ai-loading .dot:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.ai-text { font-size: 12.5px; line-height: 1.75; color: var(--text); }
.ai-text .ai-title { font-weight: 700; color: var(--gold); margin-top: 10px; margin-bottom: 4px; font-size: 13px; }
.ai-text .ai-title:first-child { margin-top: 0; }
.ai-text .ai-h { font-weight: 700; color: var(--gold); font-size: 13px; margin-top: 10px; }
.ai-text .ai-p { margin: 4px 0; text-align: justify; }
.ai-text .ai-li { margin: 3px 0 3px 14px; color: var(--text); opacity: .92; }
.ai-text b { color: var(--gold); }
.ai-err { color: var(--red); font-size: 12px; padding: 6px 0; }

/* ---------- 五术数通用 AI 多轮问答 ---------- */
.ai-chat-log { margin-top: 10px; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.ai-chat-log::-webkit-scrollbar { width: 7px; }
.ai-chat-log::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.ai-msg { font-size: 12.5px; line-height: 1.75; border-radius: 10px; padding: 9px 12px; max-width: 100%; word-break: break-word; }
.ai-msg.assistant { background: linear-gradient(135deg, rgba(232,181,102,.09) 0%, rgba(97,142,207,.06) 100%); border: 1px solid rgba(232,181,102,.25); }
.ai-msg.user { align-self: flex-end; background: rgba(53,208,198,.12); border: 1px solid rgba(53,208,198,.35); color: var(--text); max-width: 88%; }
.ai-msg.sys { color: var(--muted); text-align: center; background: transparent; border: 1px dashed var(--border2); }
.ai-msg.err { color: var(--red); background: rgba(239,107,107,.08); border: 1px solid rgba(239,107,107,.3); }
.ai-msg.pending { animation: aiPulse 1.4s ease-in-out infinite; }
.ai-msg .streaming { white-space: pre-wrap; }
@keyframes aiPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.ai-chat-row { display: flex; gap: 8px; margin-top: 10px; }
.ai-chat-row .ipt { flex: 1; min-width: 0; }
.ai-chat-row .btn { flex: none; white-space: nowrap; }
.ai-chat-tip { margin-top: 6px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- 视图切换 ---------- */
.view-switch { display: inline-flex; margin-bottom: 8px; }
.view-switch .seg-btn { font-size: 12px; padding: 4px 10px; }

/* ---------- 三术数通用 3D 舞台 ---------- */
.stage3d-box { position: absolute; inset: 0; perspective: 1400px; perspective-origin: 50% 50%; cursor: grab; overflow: hidden; }
.stage3d-box:active { cursor: grabbing; }
.stage3d-box .s3d-inner { position: absolute; left: 50%; top: 55%; width: 0; height: 0; transform-style: preserve-3d; }
.stage3d-box .s3d-inner { transform: scale(var(--sc,1)) rotateX(var(--rx,52deg)) rotateZ(var(--rz,0deg)); }

/* ---------- 六爻塔 ---------- */
.ly-tower { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.ly-yao3d {
  position: absolute; left: -180px; top: -14px; width: 360px; height: 28px;
  transform-style: preserve-3d;
  background: linear-gradient(90deg, #1a2744, #243a62, #1a2744);
  border: 1px solid var(--border2);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; font-size: 12px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 12px rgba(53,208,198,.06);
  transition: box-shadow .2s;
}
.ly-yao3d.ly-move { box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 22px rgba(239,107,107,.55); animation: lyPulse 1.2s ease-in-out infinite; border-color: #9a4040; }
@keyframes lyPulse { 0%,100% { box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 12px rgba(239,107,107,.3); } 50% { box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 30px rgba(239,107,107,.8); } }
.ly-yao3d.ly-shi { box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 18px rgba(232,181,102,.6); border-color: var(--gold); }
.ly-yao3d.ly-ying { box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 14px rgba(53,208,198,.6); border-color: var(--cyan); }
.ly-yao3d.ly-kong { opacity: .55; }
.ly-yao3d .ly3d-yy { font-size: 15px; font-weight: 800; letter-spacing: 1px; width: 80px; }
.ly-yao3d .ly3d-shen { font-size: 11px; color: var(--muted); width: 46px; text-align: center; }
.ly-yao3d .ly3d-qin { font-size: 11px; color: var(--gold); width: 40px; text-align: center; }
.ly-yao3d .ly3d-nj { font-size: 12px; width: 80px; text-align: center; }
.ly-yao3d .ly3d-tags { font-size: 10px; width: 60px; text-align: right; }
.ly-bian3d {
  position: absolute; width: 140px; height: 22px;
  background: linear-gradient(90deg, #172a2f, #1f5853, #172a2f);
  border: 1px solid #2fbfb4; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--cyan); font-weight: 700;
  transform-style: preserve-3d;
  box-shadow: 0 0 14px rgba(53,208,198,.4);
}

/* ---------- 梅花三卦柱 ---------- */
.mh-tri-col { position: absolute; transform-style: preserve-3d; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mh-hex3d {
  position: relative; width: 120px; height: 200px;
  background: linear-gradient(180deg, #1a2a48, #0e1830);
  border: 1px solid var(--border2);
  border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform-style: preserve-3d;
  box-shadow: 0 2px 0 rgba(0,0,0,.5);
  padding: 10px 0;
}
.mh-hex3d.mh-ti { border-color: var(--cyan); box-shadow: 0 0 18px rgba(53,208,198,.5), 0 2px 0 rgba(0,0,0,.5); }
.mh-hex3d.mh-yong { border-color: var(--gold); box-shadow: 0 0 18px rgba(232,181,102,.5), 0 2px 0 rgba(0,0,0,.5); }
.mh-hex3d.mh-dong { box-shadow: 0 0 28px rgba(239,107,107,.55), 0 2px 0 rgba(0,0,0,.5); animation: lyPulse 1.2s ease-in-out infinite; }
.mh-hex3d .mh3d-name { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.mh-hex3d .mh3d-line { font-size: 14px; font-weight: 700; font-family: serif; line-height: 1.3; letter-spacing: 2px; color: #e8efff; }
.mh-hex3d .mh3d-line.mh3d-yin { letter-spacing: 3px; }
.mh-hex3d .mh3d-line.mh3d-dong { color: var(--red); text-shadow: 0 0 6px rgba(239,107,107,.7); }
.mh-hex3d .mh3d-label { font-size: 10px; color: var(--muted); margin-top: 4px; }
.mh-hex3d .mh3d-el { font-size: 11px; font-weight: 700; }

/* ---------- 六壬天地盘 ---------- */
.lr-stage { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.lr-disk {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0c1a30, #0a1325 70%);
  border: 2px solid var(--border2);
  transform-style: preserve-3d;
}
.lr-disk .lr-sector {
  position: absolute; left: 50%; top: 50%; transform-origin: 0 0;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.lr-disk .lr-sector.lr-shen { color: var(--cyan); font-size: 11px; }
.lr-disk.lr-dipan { border-color: #5a6d92; }
.lr-disk.lr-tianpan { border-color: var(--cyan); background: radial-gradient(circle at 50% 50%, rgba(53,208,198,.06), transparent 70%); }
.lr-jiangzhu {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%;
  background: radial-gradient(circle, #2a8f89, #1a2a48);
  border: 2px solid var(--cyan);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 0 22px rgba(53,208,198,.5); z-index: 5;
}
.lr-jiangzhu .lr-jz-z { font-size: 18px; font-weight: 800; }
.lr-jiangzhu .lr-jz-label { font-size: 9px; color: var(--muted); }
.lr-chuan3d {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 0; height: 0; transform-style: preserve-3d;
}
.lr-chuan3d .lr-cz-bar {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 70px;
  border-radius: 4px; font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  transform-origin: center top;
}
.lr-chuan3d .lr-cz-chu { background: linear-gradient(180deg, #1a4830, #2fbfb4); }
.lr-chuan3d .lr-cz-zhong { background: linear-gradient(180deg, #483a1a, #e8b566); }
.lr-chuan3d .lr-cz-mo { background: linear-gradient(180deg, #481a2a, #ef6b6b); }
.lr-chuan3d .lr-cz-bar.lr-cz-kong { opacity: .45; filter: grayscale(.5); }
.lr-meta3d { position: absolute; font-size: 11px; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-bg { position: absolute; inset: 0; background: rgba(10,15,25,.72); backdrop-filter: blur(4px); }
.modal-body { position: relative; width: 440px; max-width: 90vw; max-height: 88vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-hd { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-title { font-weight: 700; font-size: 14px; color: var(--gold); }
.modal-bd { padding: 14px 16px; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
.cp-bezel-slot { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; color: #5f7396; font-size: 11px; letter-spacing: 2px; user-select: none; }
.cp-bezel-tick { position: absolute; left: 50%; top: 50%; width: 2px; height: 10px; background: #2e3f63; transform-origin: 50% 0; }
.cp-core {
  position: absolute; left: 0; top: 0; border-radius: 50%; transform-style: preserve-3d; pointer-events: none;
  background: radial-gradient(circle at 50% 38%, #1e2c4a, #0d1626 75%);
  border: 1px solid var(--border2);
  box-shadow: 0 0 26px rgba(53,208,198,.18), 0 0 0 1px rgba(255,255,255,.04) inset;
  display: flex; align-items: center; justify-content: center;
}
.cp-core svg { width: 62%; height: 62%; animation: cpCoreSpin 24s linear infinite; }
@keyframes cpCoreSpin { to { transform: rotate(360deg); } }
.cp-billboard { position: absolute; left: 0; top: 0; text-align: center; pointer-events: none; white-space: nowrap; }
.cp-bb-ju { font-size: 26px; font-weight: 800; color: var(--gold); letter-spacing: 6px; text-shadow: 0 0 18px rgba(232,181,102,.45); }
.cp-bb-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; letter-spacing: 1px; }
.cp-sub { font-size: 10px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .cp-core svg { animation: none; } }

/* ============================================================
   八字排盘视图
   ============================================================ */
.main-switch { margin-left: auto; }
.main-switch .seg-btn { padding: 7px 18px; font-size: 14px; }
#nowbox { margin-left: 0; }

/* 新视图复用全局 .layout flex 体系（主区 flex:1 自适应全屏，侧栏定宽；奇门侧栏与其他四视图对齐） */
#baziView .toolbar, #liuyaoView .toolbar, #meihuaView .toolbar, #daliurenView .toolbar { border-bottom: 1px solid var(--border); }
#baziView .side-col, #liuyaoView .side-col, #meihuaView .side-col, #daliurenView .side-col, #qimenView .side-col { width: 400px; }
@media (min-width: 1700px) {
  #baziView .side-col, #liuyaoView .side-col, #meihuaView .side-col, #daliurenView .side-col, #qimenView .side-col { width: 460px; }
}
/* 窄窗口竖排时侧栏占满整行（须置于上方定宽规则之后，同优先级靠后胜出） */
@media (max-width: 1180px) {
  #baziView .side-col, #liuyaoView .side-col, #meihuaView .side-col, #daliurenView .side-col, #qimenView .side-col { width: 100%; }
}

/* ---- 四柱盘 / 三术数排盘容器 ---- */
.bazi-pan {
  flex: 1; min-height: 0;
  background: linear-gradient(160deg, var(--surface), var(--bg2));
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.bz-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.bz-dm { font-size: 34px; font-weight: 800; color: var(--gold); text-shadow: 0 0 16px rgba(232,181,102,.4); line-height: 1; }
.bz-dm i { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 2px; margin-top: 3px; font-style: normal; text-align: center; }
.bz-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.bz-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border2); color: var(--muted);
}
.bz-tag.t-good { color: var(--green); border-color: rgba(74,208,122,.4); background: rgba(74,208,122,.08); }
.bz-tag.t-bad { color: var(--red); border-color: rgba(239,107,107,.4); background: rgba(239,107,107,.08); }
.bz-meta { margin-left: auto; font-size: 12px; color: var(--muted); }

.bz-basis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 2px; font-size: 12px; }
.bz-basis-tag {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border2);
  color: var(--muted); background: var(--surface); white-space: nowrap;
}
.bz-basis-tag.on { color: var(--cyan); border-color: rgba(53,208,198,.45); background: rgba(53,208,198,.10); font-weight: 600; }
.bz-basis-note { color: var(--muted); }
.bz-basis-ok { color: #6fcf97; }
.bz-basis-warn { color: #e8b566; font-weight: 600; }
.bz-basis-stale { color: var(--muted); font-style: italic; }

.bz-pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
/* 八字/紫微排盘区：大窗口卡片拉伸撑满不留空白，小窗口保持内容高度+纵向滚动不压扁不遮挡 */
#baziView .stage-col, #ziweiView .stage-col { overflow-y: auto; }
#baziView .bazi-pan, #ziweiView .bazi-pan { flex: 1 0 auto; }
/* 八字/紫微主区滚动条与右侧解读栏同款：细窄深色 */
#baziView .stage-col::-webkit-scrollbar, #ziweiView .stage-col::-webkit-scrollbar { width: 8px; }
#baziView .stage-col::-webkit-scrollbar-thumb, #ziweiView .stage-col::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
/* 八字/紫微真太阳时出生地下拉框滚动条同款 */
#baziProv::-webkit-scrollbar, #baziCity::-webkit-scrollbar, #zwProv::-webkit-scrollbar, #zwCity::-webkit-scrollbar { width: 8px; }
#baziProv::-webkit-scrollbar-thumb, #baziCity::-webkit-scrollbar-thumb, #zwProv::-webkit-scrollbar-thumb, #zwCity::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* 命盘解读区底部免责声明 */
.reading-disclaimer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.bz-col {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 8px; text-align: center;
}
.bz-col.bz-day { border-color: var(--gold); box-shadow: 0 0 14px rgba(232,181,102,.12); }
.bz-colname { font-size: 11px; color: var(--muted); letter-spacing: 3px; margin-bottom: 8px; }
.bz-gz { display: flex; flex-direction: column; gap: 2px; }
.bz-gz .bz-gan, .bz-gz .bz-zhi { font-size: 30px; font-weight: 800; line-height: 1.15; }
.bz-gz i { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); font-style: normal; letter-spacing: 1px; }
.bz-cang { display: flex; justify-content: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bz-cang span { font-size: 13px; color: var(--text); }
.bz-cang em { font-size: 10px; color: var(--muted); font-style: normal; margin-left: 1px; }
.bz-nayin { font-size: 10.5px; color: var(--muted); margin-top: 8px; letter-spacing: 1px; }

/* ---- 五行条 ---- */
.bz-wxbar { display: flex; flex-direction: column; gap: 6px; }
.bz-wxrow { display: grid; grid-template-columns: 20px 1fr 34px; align-items: center; gap: 8px; }
.bz-wxk { font-size: 13px; font-weight: 700; }
.bz-wxtrack { height: 9px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bz-wxfill { height: 100%; border-radius: 999px; opacity: .85; }
.bz-wxv { font-size: 11.5px; color: var(--muted); text-align: right; }

/* ---- 大运 ---- */
.bz-dayun { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bz-dy {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 6px; text-align: center;
}
.bz-dy b { display: block; font-size: 17px; color: var(--text); }
.bz-dy span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.bz-dy em { display: block; font-size: 10px; color: var(--muted); font-style: normal; }
.bz-dy u { display: inline-block; margin-top: 4px; font-size: 10px; text-decoration: none; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.bz-dy.dy-xi { border-color: rgba(74,208,122,.45); }
.bz-dy.dy-xi u { color: var(--green); }
.bz-dy.dy-ji { border-color: rgba(239,107,107,.45); }
.bz-dy.dy-ji u { color: var(--red); }

/* ---- 流年 ---- */
.bz-ln { display: flex; flex-wrap: wrap; gap: 8px; }
.bz-lni { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; text-align: center; font-size: 12px; }
.bz-lni b { color: var(--gold); margin-right: 4px; }
.bz-lni em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }

/* ---- 解读（复用断语样式类名结构） ---- */
#baziReading .side-title { margin-bottom: 8px; }
#baziReadingBody { display: flex; flex-direction: column; gap: 8px; }
.dz-verdict {
  font-size: 14px; line-height: 1.65; padding: 10px 12px; border-radius: 8px;
  background: rgba(232,181,102,.08); border: 1px solid rgba(232,181,102,.3); color: var(--gold);
}
.dy-point { display: flex; gap: 8px; padding: 9px 11px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); }
.pt-good { border-left: 3px solid var(--green); }
.pt-bad { border-left: 3px solid var(--red); }
.pt-mid { border-left: 3px solid var(--border2); }
.dy-mark { font-size: 13px; line-height: 1.5; }
.dy-body { min-width: 0; flex: 1; }
.dy-text { font-size: 13px; line-height: 1.6; color: var(--text); }
.dy-src { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* ---- AI 按钮/结果（复用奇门 ai-* 类） ---- */
#baziAiResult { margin-top: 10px; }

@media (max-width: 1080px) {
  .bz-pillars { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bz-dayun { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   六爻 / 梅花易数 / 大六壬 视图
   ============================================================ */
.ipt-n { width: 90px; }

/* ---- 六爻 ---- */
.ly-arrow { color: var(--muted); font-size: 20px; }
.ly-yaos { display: flex; flex-direction: column; gap: 4px; }
.ly-yao {
  display: grid; grid-template-columns: 90px 52px 60px 90px 1fr auto;
  align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 12px;
}
.ly-yao.ly-move { border-color: rgba(232,181,102,.55); background: rgba(232,181,102,.06); }
.ly-yy { font-size: 15px; letter-spacing: 3px; color: var(--text); }
.ly-shen { font-size: 12px; color: var(--cyan); }
.ly-qin { font-size: 15px; font-weight: 700; }
.ly-nj { font-size: 14px; font-weight: 600; }
.ly-tag { display: flex; gap: 4px; }
.ly-bian { font-size: 12.5px; color: var(--gold); }
.ly-fushen { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ly-toss { display: flex; flex-wrap: wrap; gap: 8px; }
.ly-tossi { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.ly-tossi em { font-style: normal; color: var(--gold); margin-left: 4px; }

/* ---- 梅花 ---- */
.mh-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mh-hex {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; text-align: center;
}
.mh-hex.mh-hu { border-color: rgba(90,169,240,.4); }
.mh-hex.mh-bian { border-color: rgba(232,181,102,.5); }
.mh-hexname { display: block; font-size: 22px; font-weight: 800; color: var(--text); }
.mh-label { display: block; font-size: 11px; color: var(--muted); letter-spacing: 2px; margin: 4px 0 8px; }
.mh-sym { font-size: 17px; line-height: 1.25; color: var(--gold); letter-spacing: 2px; }
.mh-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; }
.mh-xiang { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }

/* ---- 大六壬 ---- */
.lr-chuan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.lr-chuani {
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 10px;
  padding: 10px; text-align: center;
}
.lr-chuani b { display: block; font-size: 26px; font-weight: 800; }
.lr-chuani.lr-kong { border-color: rgba(239,107,107,.45); }
.lr-pos { display: block; font-size: 11px; color: var(--muted); }
.lr-jiang { display: block; font-size: 13px; color: var(--cyan); margin-top: 3px; }
.lr-sub { display: block; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.lr-lessons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lr-lesson {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 6px; text-align: center;
}
.lr-lname { display: block; font-size: 10.5px; color: var(--muted); }
.lr-lgz { display: block; font-size: 16px; font-weight: 700; margin: 2px 0; }
.lr-lfull { display: block; font-size: 10px; color: var(--muted); }
.lr-plate { display: grid; grid-template-rows: repeat(4, 1fr); gap: 6px; }
.lr-plate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lr-cell {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 4px; text-align: center;
}
.lr-cell.lr-yj { border-color: rgba(232,181,102,.55); }
.lr-cell.lr-zs { border-color: rgba(90,169,240,.55); }
.lr-tian { display: block; font-size: 15px; font-weight: 700; }
.lr-tian i { font-style: normal; font-size: 9.5px; color: var(--red); margin-left: 2px; }
.lr-di { display: block; font-size: 10px; color: var(--muted); }
.lr-jiang2 { display: block; font-size: 10.5px; color: var(--cyan); }

@media (max-width: 1080px) {
  .mh-row { grid-template-columns: 1fr; }
  .lr-lessons { grid-template-columns: repeat(2, 1fr); }
  .lr-chuan { grid-template-columns: 1fr; }
}

/* ---------- 三术数 WebGL 3D 视图（定稿效果嵌入） ---------- */
.three3d-box { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #080e18; }
.three3d-frame { display: block; width: 100%; height: 100%; border: 0; background: #080e18; }

/* ---------- 奇门 3D 立体视图出场动画（九宫柱自下而上升起落位） ---------- */
@keyframes qm-col-in {
  0%   { opacity: 0; transform: translate3d(var(--cx, 0px), calc(var(--cy, 0px) + 150px), -200px) rotateY(-34deg) scale(.74); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0) rotateY(0deg) scale(1); }
}
.stage3d-inner.entering .col3d { animation: qm-col-in .9s cubic-bezier(.18, .9, .22, 1) both; }
.stage3d-inner.entering .col3d:nth-child(1) { animation-delay: .16s; }
.stage3d-inner.entering .col3d:nth-child(2) { animation-delay: .20s; }
.stage3d-inner.entering .col3d:nth-child(3) { animation-delay: .24s; }
.stage3d-inner.entering .col3d:nth-child(4) { animation-delay: .08s; }
.stage3d-inner.entering .col3d:nth-child(5) { animation-delay: .12s; }
.stage3d-inner.entering .col3d:nth-child(6) { animation-delay: .16s; }
.stage3d-inner.entering .col3d:nth-child(7) { animation-delay: 0s; }
.stage3d-inner.entering .col3d:nth-child(8) { animation-delay: .04s; }
.stage3d-inner.entering .col3d:nth-child(9) { animation-delay: .08s; }

/* ---------- 六爻手动摇卦（铜钱逐爻，照玄学四式样式） ---------- */
/* 六爻手动摇卦气泡提示：悬停或点击时出现，独立挂载在 body 上以避开 .seg 的 overflow 裁剪 */
.ly-tip-bubble {
  position: fixed; left: 0; top: 0; z-index: 60; display: none;
  width: 220px; padding: 9px 12px;
  background: #10243c; color: var(--text);
  border: 1px solid var(--cyan); border-radius: 9px;
  font-size: 12px; line-height: 1.65; text-align: left;
  box-shadow: 0 12px 28px rgba(0,0,0,.55);
  pointer-events: none;
}
.manual-box { margin: 0 18px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); }
.lm-hint { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.lm-hint b { color: var(--gold); }
.lm-slots { display: flex; gap: 6px; margin-bottom: 10px; max-width: 460px; }
.lm-slot {
  flex: 1; text-align: center; font-size: 13px; padding: 7px 0; line-height: 1.5;
  border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.02);
}
.lm-slot.filled { color: var(--gold); border-color: var(--gold); background: rgba(232,181,102,.1); font-weight: 600; }

/* ---------- 网站版：账号 / 登录层 / 账户弹窗 / AI 只读信息 ---------- */
.userbox { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 999px; border: 1px solid var(--border2);
  background: rgba(255,255,255,.03); color: var(--muted); cursor: pointer; font-size: 12.5px;
}
.user-chip:hover { border-color: var(--gold); color: var(--gold); }
.userbox .user-name { color: var(--gold); font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-balance { color: var(--cyan); font-weight: 700; font-size: 13.5px; }
.user-bal-unit { color: var(--muted); font-size: 11px; }

.login-mask {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 10, 18, .58);
}
.login-card {
  position: relative;
  width: 340px; max-width: 90vw; padding: 22px 22px 16px; text-align: center;
  background: var(--bg); border: 1px solid var(--border2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
}
.login-close {
  position: absolute; top: 8px; right: 10px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.login-close:hover { background: var(--surface2); color: var(--text); }
.login-mark { font-size: 30px; color: var(--cyan); display: inline-flex; filter: drop-shadow(0 0 8px rgba(53,208,198,.55)); line-height: 1; }
.login-title { margin-top: 6px; font-size: 17px; font-weight: 800; letter-spacing: 4px; color: var(--gold); }
.login-sub { margin: 6px 0 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.login-tabs { display: flex; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.login-tab {
  flex: 1; padding: 8px 0 10px; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; border-bottom: 2px solid transparent;
}
.login-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 700; }
.login-card .login-ipt { margin-top: 10px; }
.login-ipt { width: 100%; text-align: center; letter-spacing: 1px; }
.login-code-row { display: flex; gap: 8px; margin-top: 10px; }
.login-code-row .login-ipt { margin-top: 0; flex: 1; min-width: 0; letter-spacing: 2px; }
.login-code-row .code-btn { flex: 0 0 auto; white-space: nowrap; align-self: stretch; }
.login-btn { width: 100%; margin-top: 14px; }
.login-err { min-height: 18px; margin-top: 10px; font-size: 12.5px; color: var(--red); }
.login-tip { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.login-later { width: 100%; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* 我的账户 */
.acct-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.acct-line > label { width: 44px; flex: none; color: var(--muted); font-size: 12px; }
.acct-name { color: var(--text); font-weight: 600; }
.acct-balance { color: var(--gold); font-size: 18px; font-weight: 800; }
.acct-wechat { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; font-weight: 600; color: var(--gold); word-break: break-all; }
.acct-wechat.off { color: var(--muted); font-weight: 400; font-family: inherit; }
.acct-redeem .ipt { flex: 1; min-width: 0; }
.acct-tip { margin: -2px 0 4px 54px; font-size: 11.5px; color: var(--muted); line-height: 1.6; min-height: 18px; }
.acct-install-entry { margin-top: 8px; }
.acct-install-link { color: var(--cyan); text-decoration: none; font-size: 13px; }
.acct-install-link:hover { text-decoration: underline; }
.acct-tx-title { margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.acct-tx { max-height: 200px; overflow-y: auto; }

/* 年命填写说明：悬停或输入聚焦时显示 */
.qm-birth { position: relative; }
.qm-birth-tip {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 8px; z-index: 60;
  width: 268px; max-width: calc(100vw - 32px); padding: 8px 10px;
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px;
  font-size: 11.5px; line-height: 1.7; color: var(--muted);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5); white-space: normal;
}
.qm-birth:hover .qm-birth-tip,
.qm-birth:focus-within .qm-birth-tip { display: block; }
.acct-tx::-webkit-scrollbar, .modal-account::-webkit-scrollbar { width: 8px; }
.acct-tx::-webkit-scrollbar-thumb, .modal-account::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.acct-tx-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.06); font-size: 12.5px; }
.tx-note { flex: 1; color: var(--text); }
.tx-time { color: var(--muted); font-size: 11.5px; }
.tx-amt { width: 52px; text-align: right; font-weight: 700; }
.tx-amt.plus { color: var(--green); }
.tx-amt.minus { color: var(--red); }
.acct-empty { padding: 10px 0; color: var(--muted); font-size: 12.5px; }
.acct-admin { margin-top: 14px; text-align: right; }
.acct-admin a { color: var(--cyan); font-size: 12.5px; text-decoration: none; }

/* 找回码 / 忘记密码 */
.login-forgot {
  display: inline-block; margin-top: 8px; padding: 2px 4px;
  background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 11.5px;
}
.login-forgot:hover { color: var(--cyan); text-decoration: underline; }
.rc-title { margin: 10px 0 6px; font-size: 15px; font-weight: 800; color: var(--gold); letter-spacing: 1px; }
.rc-desc { font-size: 11.5px; color: var(--muted); line-height: 1.65; margin-bottom: 12px; text-align: left; }
.rc-code {
  font-family: monospace; font-size: 15px; letter-spacing: 1px; color: var(--gold);
  padding: 10px 6px; border: 1px dashed var(--border2); border-radius: 8px;
  background: var(--bg2); margin-bottom: 10px; user-select: all;
}
.rc-inline { color: var(--gold); font-family: monospace; letter-spacing: .5px; }

/* 账户：会员 / 找回码 */
.acct-member { flex: 1; font-size: 12.5px; color: var(--muted); }
.acct-member.on { color: var(--gold); font-weight: 600; }
.acct-buy { flex: none; }
.acct-recovery { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px 54px; flex-wrap: wrap; }
.acct-recv-tip { font-size: 11.5px; color: var(--muted); }

/* 开通会员 / 支付 */
.modal-plans { width: 640px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.plan-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 14px 13px; border-radius: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, background .15s;
}
.plan-card:hover { border-color: var(--border2); }
.plan-card.active {
  border-color: var(--gold); background: rgba(232,181,102,.07);
  box-shadow: 0 0 0 1px rgba(232,181,102,.28) inset;
}
.plan-name { font-size: 13.5px; color: var(--gold); font-weight: 700; margin-bottom: 6px; }
.plan-price { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1.1; }
.plan-price .cur { font-size: 13px; font-weight: 600; margin-right: 2px; color: var(--muted); }
.plan-origin { margin-left: 7px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: line-through; }
.plan-tag { margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; vertical-align: 2px; background: rgba(233,178,86,.16); color: #e9b256; }
.plan-credits { margin-top: 6px; font-size: 12.5px; color: var(--cyan); font-weight: 600; }
.plan-days { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.plan-per { margin-top: 6px; font-size: 11px; color: var(--muted); }
.plan-desc { margin-top: 8px; font-size: 11px; color: var(--green); line-height: 1.5; }
.plan-empty { color: var(--muted); font-size: 12.5px; padding: 12px 0; }
.pay-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pay-label { font-size: 12px; color: var(--muted); }
.pay-ch {
  padding: 7px 16px; border-radius: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px;
}
.pay-ch.active { border-color: var(--cyan); color: var(--cyan); background: rgba(53,208,198,.08); font-weight: 600; }
.pay-buy { width: 100%; }
.pay-tip { min-height: 18px; margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.pay-qr { margin-top: 12px; text-align: center; }
.pay-qr img { width: 220px; height: 220px; background: #fff; border-radius: 10px; padding: 6px; }
.pay-qr-tip { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.scan-pay { margin-top: 14px; text-align: center; }
.scan-qr-img { display: block; width: 230px; height: 230px; object-fit: contain; margin: 0 auto; background: #fff; border-radius: 10px; padding: 6px; }
.scan-channel { margin-top: 8px; font-size: 13px; color: var(--text); font-weight: 600; }
.scan-amount { margin-top: 5px; font-size: 13px; color: var(--muted); }
.scan-amount b { color: #e5484d; font-size: 22px; margin-left: 5px; }
.scan-expire, .scan-help { margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.scan-claim-row { display: flex; gap: 8px; margin-top: 12px; }
.scan-claim-row input { flex: 1; min-width: 0; padding: 9px 11px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; outline: none; }
.scan-claim-row input:focus { border-color: var(--cyan); }
.scan-claim-row .btn { flex: 0 0 auto; }
.scan-claim-msg { min-height: 18px; margin-top: 8px; color: var(--muted); font-size: 11.5px; line-height: 1.6; text-align: left; }
.scan-claim-msg.err { color: #e5484d; }
.pay-wait { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pay-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(53,208,198,.55); animation: payPulse 1.4s infinite;
}
@keyframes payPulse {
  0% { box-shadow: 0 0 0 0 rgba(53,208,198,.5); }
  70% { box-shadow: 0 0 0 8px rgba(53,208,198,0); }
  100% { box-shadow: 0 0 0 0 rgba(53,208,198,0); }
}
.pay-link { color: var(--cyan); font-size: 12px; text-decoration: none; }
.pay-link:hover { text-decoration: underline; }

/* ---------- 手机端适配 ---------- */
@media (max-width: 900px) {
  .topbar-wrap { flex-wrap: wrap; gap: 10px; padding: 8px 12px; }
  .brand .mark { font-size: 22px; }
  .brand-name { font-size: 17px; letter-spacing: 2px; }
  .brand { min-width: 0; overflow: hidden; }
  .brand-name { flex: none; }
  .brand-sub {
    flex: 0 1 auto; min-width: 0;
    font-size: 10.5px; letter-spacing: 0; padding-left: 7px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .main-switch { order: 3; width: 100%; margin-left: 0; }
  .main-switch .seg-btn { flex: 1 1 0; min-width: 0; padding: 6px 0; font-size: 11.5px; white-space: nowrap; text-align: center; }
  /* 手机端保留时间/农历/四柱/节气信息，独占一整行，排在术数切换按钮下方 */
  .nowbox {
    order: 4; width: 100%; margin-left: 0; padding-top: 6px;
    font-size: 11.5px; line-height: 1.5; text-align: left;
    border-top: 1px solid var(--border);
  }
  .userbox { margin-left: auto; }
  .search-box, .hist-search { width: 100%; }
  .toolbar { padding: 8px 12px; gap: 8px; }
  .tb-group { flex-wrap: wrap; }
  .tb-group.grow { flex: 1 1 100%; }
  .chart-head { padding: 8px 10px; gap: 5px 8px; font-size: 12px; }
  .chip { padding: 2px 7px; font-size: 11.5px; }
}
@media (max-width: 720px) {
  .layout { padding: 10px 10px 18px; gap: 10px; }
  .stage-col { min-height: 520px; }
  /* 排盘区在手机上定高，避免被下方信息块挤压 */
  .chart-wrap { flex: none; height: 40vh; min-height: 260px; max-height: 420px; }
  .side-col { gap: 10px; }
  .side-sec { flex: 1 1 100%; }
  /* 起卦/卦例等操作按钮：手机端独占一行并自适应平分 */
  .toolbar .tb-actions { flex: 1 1 100%; }
  .toolbar .tb-actions .btn { flex: 1 1 0; text-align: center; }
  .modal-body { width: 94vw; max-width: 560px; max-height: 90vh; }
  .modal-account { width: 94vw; }
  .acct-tip { margin-left: 0; }
  .acct-recovery { margin-left: 0; }
  .modal-plans { width: 94vw; }
  .plan-grid { grid-template-columns: 1fr; gap: 8px; }
  .plan-card { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; }
  .plan-name { margin-bottom: 0; flex: 0 0 100%; }
  .plan-price { font-size: 20px; }
  .plan-credits { margin-top: 0; }
  .plan-days { margin-top: 0; }
  .plan-per { margin-top: 0; margin-left: auto; }
  .plan-desc { flex: 0 0 100%; margin-top: 0; }
  .pay-qr img { width: 190px; height: 190px; }
  .login-card { padding: 24px 18px 18px; }
  .login-mark { font-size: 38px; }
  .login-title { font-size: 18px; }
  .acct-tx { max-height: 160px; }
  .sidebar, .right-panel { width: 100%; }
  /* 输入框字号不得小于 16px：否则 iOS/微信聚焦时会自动放大整页，收键盘后不回缩 */
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 480px) {
  .brand-name { font-size: 15px; }
  .user-chip { padding: 3px 8px; font-size: 11.5px; }
  .userbox .user-name { max-width: 76px; font-size: 11.5px; }
  .tb-label { display: none; }
  .btn { padding: 6px 10px; font-size: 12.5px; }
  .stage-col { min-height: 430px; }
  .chart-wrap { height: 38vh; min-height: 250px; padding: 6px; }
  .pan2d { gap: 5px; }
  .pal { padding: 5px 6px; border-radius: 8px; }
  .login-ipt { font-size: 15px; }  /* 避免 iOS 聚焦自动放大 */
}


/* ---------- 紫微斗数 · 十二宫方盘 ---------- */
.zw-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, minmax(148px, 1fr));
  gap: 5px; padding: 10px; height: 100%; box-sizing: border-box;
}
.zw-palace {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  padding: 6px 7px 5px; font-size: 12px; line-height: 1.45; position: relative;
  display: flex; flex-direction: column; min-height: 148px;
}
.zw-palace.zw-ming { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232,181,102,.35), 0 0 14px rgba(232,181,102,.12); }
.zw-palace.zw-shen .zw-pname::after { content: " · 身宫"; color: var(--cyan); font-weight: 600; }
.zw-phd { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.zw-pname { font-size: 12.5px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.zw-pgz { font-size: 11px; color: var(--muted); }
.zw-pstars { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-bottom: 2px; }
.zw-star { font-size: 14.5px; font-weight: 700; color: var(--text); }
.zw-star .zw-bri { font-size: 10px; font-weight: 400; margin-left: 1px; }
.zw-bri.miao { color: var(--green); }
.zw-bri.wang { color: var(--cyan); }
.zw-bri.li { color: var(--gold); }
.zw-bri.xian { color: var(--red); }
.zw-sihua { font-size: 10.5px; font-weight: 700; padding: 0 3px; border-radius: 4px; margin-left: 3px; }
.zw-sihua.lu { color: #ffd97a; background: rgba(232,181,102,.16); }
.zw-sihua.quan { color: #7ae0ff; background: rgba(53,208,198,.14); }
.zw-sihua.ke { color: #9df0b6; background: rgba(74,208,122,.14); }
.zw-sihua.ji { color: #ff9d9d; background: rgba(239,107,107,.16); }
.zw-paux { flex: 1; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 1px 6px; align-content: flex-start; }
.zw-paux .aux-ji { color: #9dc8ff; }
.zw-paux .aux-sha { color: #d98a8a; }
.zw-paux .aux-tao { color: #e8a0d0; }
.zw-pft { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.zw-gods { display: flex; flex-direction: column; gap: 1px; }
.zw-daxian { color: var(--gold); font-weight: 600; }
.zw-center {
  grid-row: 2 / 4; grid-column: 2 / 4; border: 1px solid var(--border2); border-radius: 10px;
  background: radial-gradient(circle at 50% 32%, #182747, var(--bg2));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 12px; text-align: center;
}
.zw-c-name { font-size: 16px; font-weight: 800; color: var(--gold); letter-spacing: 3px; }
.zw-c-line { font-size: 12.5px; color: var(--text); }
.zw-c-line b { color: var(--cyan); font-weight: 600; }
.zw-c-sub { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.zw-c-geju { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 2px; }
.zw-geju { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border2); color: var(--muted); }
.zw-geju.ji { color: var(--green); border-color: rgba(74,208,122,.5); background: rgba(74,208,122,.08); }
.zw-geju.xiong { color: var(--red); border-color: rgba(239,107,107,.5); background: rgba(239,107,107,.08); }


/* ===== 推运控件（新增） ===== */
.query-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.query-row .ipt-sm { width: 62px; }
.query-result { font-size: 12px; line-height: 1.75; max-height: 340px; overflow-y: auto; }
.query-result .ln-card { border-left: 3px solid var(--gold); padding: 6px 9px; margin-bottom: 8px; background: rgba(232,181,102,.06); border-radius: 0 6px 6px 0; }
.query-result .ln-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.query-result .ln-cross { font-size: 11.5px; color: var(--muted); }
.query-result .ln-cross b { color: var(--gold); }
.query-result .dy-item { padding: 3px 9px; border-radius: 4px; margin: 2px 0; font-size: 11.5px; }
.query-result .dy-item.warn { background: rgba(220,80,60,.1); color: #d05040; }
.query-result .dy-item.good { background: rgba(80,160,100,.1); color: #40a060; }
.query-result .dy-item.neu { background: rgba(120,120,120,.06); color: var(--muted); }

/* ===== 八字合化/冲刑徽章（BZ_NEW 前端展示） ===== */
.bz-pillar-marks { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.bz-pillar-mk { font-size: 9.5px; padding: 1px 4px; border-radius: 3px; font-weight: 600; line-height: 1.4; }
.bz-pillar-mk.mk-he { background: rgba(80,160,100,.18); color: #3da55c; }       /* 合 */
.bz-pillar-mk.mk-chong { background: rgba(220,80,60,.18); color: #d04030; }    /* 冲 */
.bz-pillar-mk.mk-xing { background: rgba(200,140,60,.18); color: #b07030; }    /* 刑 */
.bz-pillar-mk.mk-hai { background: rgba(170,110,190,.18); color: #9050b0; }    /* 害 */
.bz-pillar-mk.mk-po { background: rgba(140,140,140,.18); color: #888; }        /* 破 */
.bz-pillar-mk.mk-hua { background: rgba(232,181,102,.25); color: #b08030; }   /* 化 */
.bz-pillar-mk.mk-truthua { background: rgba(232,181,102,.4); color: #6a4818; } /* 真化 */
/* 紫微流年12宫对比 */
.zw-perpal { font-size: 11px; line-height: 1.6; padding: 4px 8px; }
.zw-perpal .zw-p { padding: 2px 6px; border-radius: 4px; margin: 1px 0; }
.zw-perpal .zw-p.t-chong { background: rgba(220,80,60,.1); color: #d04030; }
.zw-perpal .zw-p.t-he { background: rgba(80,160,100,.1); color: #3da55c; }
.zw-perpal .zw-p.t-dieh { background: rgba(232,181,102,.15); color: #b08030; }
.zw-perpal .zw-p.t-samemain { background: rgba(120,160,220,.1); color: #5080c0; }

/* ---------- 网站底部备案 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 0;
  padding: 8px 20px;
  text-align: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
/* 备案栏全部文字压成一行，栏高只占一行 */
.site-footer .footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: center; align-items: baseline; white-space: nowrap; }
.site-footer .footer-copy { color: var(--muted); }
.site-footer .footer-copy::after { content: "|"; margin: 0 10px; opacity: .4; }
.site-footer .footer-beian a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.site-footer .footer-beian a:hover { color: var(--cyan); }
.site-footer .footer-sep { margin: 0 10px; opacity: .4; }
.site-footer .footer-safety { color: var(--muted); opacity: .7; font-size: 11px; }
/* 支付审核用：页脚新增协议链接后，窄桌面屏允许换行，避免横向溢出（可整段删除） */
@media (min-width: 721px) and (max-width: 1080px) {
  .site-footer .footer-inner { white-space: normal; flex-wrap: wrap; }
}
/* 手机端：底部栏整体隐藏（备案栏与版权行都不显示） */
@media (max-width: 720px) {
  .site-footer { display: none; }
  .site-footer .footer-beian { display: none; }
  .site-footer .footer-copy::after { display: none; }
}
/* 手机端下拉刷新提示条 */
.pull-refresh {
  position: fixed; left: 50%; top: 0; z-index: 9999;
  transform: translate(-50%, -46px);
  padding: 7px 18px; border-radius: 0 0 12px 12px;
  background: rgba(17, 28, 48, .96); border: 1px solid var(--border2); border-top: none;
  color: var(--cyan); font-size: 12.5px; letter-spacing: .5px; white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
  pointer-events: none; transition: transform .2s ease;
}
.pull-refresh.on { transition: none; }

/* ---------- 首次进入：欢迎引导弹窗 ---------- */
.welcome-mask {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(5, 10, 20, .66); backdrop-filter: blur(3px);
  animation: welcomeFade .2s ease;
}
.welcome-card {
  position: relative; width: min(100%, 500px); max-height: 88vh; overflow-y: auto;
  padding: 26px 24px 20px;
  background: radial-gradient(circle at 50% -8%, rgba(53, 208, 198, .13), transparent 62%), linear-gradient(165deg, #17253f, #0d1626);
  border: 1px solid var(--border2); border-radius: 20px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(53, 208, 198, .05) inset;
  animation: welcomePop .26s cubic-bezier(.2, .8, .3, 1.08);
}
.welcome-x {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.welcome-x:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.welcome-mark {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--cyan);
  background: rgba(53, 208, 198, .1); border: 1px solid rgba(53, 208, 198, .35);
  box-shadow: 0 0 24px rgba(53, 208, 198, .25);
}
.welcome-title { text-align: center; font-size: 19px; font-weight: 800; color: var(--gold); letter-spacing: 1px; }
.welcome-sub { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.welcome-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.welcome-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.7; color: var(--text);
}
.welcome-list b {
  flex: none; padding: 1px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; color: var(--cyan); line-height: 1.7;
  background: rgba(53, 208, 198, .1); border: 1px solid rgba(53, 208, 198, .3);
}
.welcome-list span { color: var(--muted); }
.welcome-link { color: var(--cyan); font-weight: 600; border-bottom: 1px solid rgba(53, 208, 198, .45); }
.welcome-link:hover { border-bottom-color: var(--cyan); }
.welcome-tip { margin-top: 12px; font-size: 11.5px; color: var(--muted); opacity: .8; text-align: center; }
.welcome-actions { display: flex; gap: 10px; margin-top: 16px; }
.welcome-actions .btn { flex: 1; }
@keyframes welcomeFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes welcomePop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .welcome-card { padding: 22px 16px 16px; max-height: 84vh; }
  .welcome-list li { flex-direction: column; gap: 6px; }
  .welcome-actions { flex-direction: column; }
}

/* ---------- 本地版补齐：八字神煞/长生/大运流年徽章等 ---------- */
.qwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.qwrap .ipt { flex: 1; min-width: 0; width: 100%; padding-right: 28px; }
.qx {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border: none; border-radius: 50%; padding: 0;
  background: rgba(139,160,192,.25); color: var(--muted);
  font-size: 13px; line-height: 18px; text-align: center; cursor: pointer;
}
.qx:hover { background: rgba(139,160,192,.5); color: var(--text); }
.hint { color: var(--gold); font-size: 12px; line-height: 1.6; flex-basis: 100%; }
.dy-hint { margin-bottom: 8px; padding: 7px 9px; border-radius: 6px; background: rgba(232,181,102,.06); border: 1px dashed rgba(232,181,102,.3); font-size: 11.5px; line-height: 1.75; color: var(--muted); }
.dy-hint b { color: var(--gold); }
.ai-set-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-set-row label { font-size: 12px; color: var(--muted); min-width: 80px; }
.ai-set-row .ipt { flex: 1; min-width: 180px; }
.ai-status { font-size: 11px; padding: 2px 8px; border-radius: 3px; background: var(--surface); color: var(--muted); }
.ai-status.ok { color: var(--green); background: rgba(74,208,122,.1); }
.ai-status.bad { color: var(--red); background: rgba(239,107,107,.1); }
.ai-link { font-size: 11px; color: var(--gold); opacity: .7; text-decoration: none; }
.ai-link:hover { opacity: 1; }
.ai-set-tips { margin-top: 12px; padding: 10px 12px; background: var(--surface); border-radius: 6px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.ai-set-tips b { color: var(--text); }
.ai-set-tips a { color: var(--gold); text-decoration: none; }
.ai-set-tips code { background: rgba(232,181,102,.15); padding: 1px 6px; border-radius: 3px; color: var(--gold); font-family: monospace; }
.bz-basis-bar { flex-basis: 100%; }
.bz-basis-bar .bz-basis { margin: 0; }
.bz-changsheng { font-size: 10px; color: var(--cyan); margin-top: 4px; letter-spacing: 1px; opacity: .9; }
.bz-shas { margin-top: 6px; display: grid; grid-template-columns: repeat(4, max-content); gap: 3px 4px; justify-content: center; }
/* 窄窗口神煞自适应减列：4 → 3 → 2 → 1 个一行，不挤压 */
@media (max-width: 1440px) { .bz-shas { grid-template-columns: repeat(3, max-content); } }
@media (max-width: 1160px) { .bz-shas { grid-template-columns: repeat(2, max-content); } }
@media (max-width: 880px) { .bz-shas { grid-template-columns: max-content; } }
.bz-sha {
  font-size: 10px; padding: 1px 5px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08); line-height: 1.5;
}
.bz-sha-good { color: var(--green); border-color: rgba(74,208,122,.35); background: rgba(74,208,122,.06); }
.bz-sha-bad  { color: var(--red);   border-color: rgba(239,107,107,.35); background: rgba(239,107,107,.06); }
.bz-dy i { display: inline-block; margin-left: 4px; font-size: 10px; font-style: normal; color: var(--cyan); opacity: .85; }
.bz-lni i { display: inline-block; margin-left: 2px; font-size: 10px; font-style: normal; color: var(--cyan); opacity: .85; }
.p-item.bad { border-color: rgba(239,107,107,.35); background: rgba(239,107,107,.06); }
.p-item.bad b { color: var(--red); }

/* ---------- 手机端适配补充 ---------- */
@media (max-width: 720px) {
  /* 招牌栏 + 术数切换栏吸顶；时间/农历/节气条留在外层，随页面滚动 */
  .topbar-wrap { display: contents; }
  .topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 15;
    padding: 8px 12px;
    background: linear-gradient(180deg, #101c31, #0c1523);
    border-bottom: 1px solid var(--border);
  }
  .nowbox { order: 0; width: 100%; margin-left: 0; padding: 6px 12px 0; }
  /* 手机端整页滚动：备案栏随页面滑动，滑到最底才可见 */
  body { height: auto; min-height: 0; overflow-y: auto; }
  /* 各术数容器不再拉伸占高，避免内容结束后留出一段空白 */
  #qimenView, #liuyaoView, #meihuaView, #daliurenView, #baziView, #ziweiView { flex: none; }
  .layout { overflow-y: visible; flex: none; padding-bottom: 0; }
  /* 底部备案栏：允许换行，不再强行一行；紧贴内容，下方不留白 */
  .site-footer { padding: 8px 10px; margin-top: 8px; margin-bottom: 0; }
  .site-footer .footer-inner { white-space: normal; flex-wrap: wrap; justify-content: center; line-height: 1.8; }
  /* 历史抽屉不超出屏幕 */
  .drawer { width: min(380px, 100vw); }
  /* 紫微十二宫盘：保持 4x4 传统布局，窄屏压缩字号间距直接放下 */
  .zw-grid { gap: 3px; padding: 6px; grid-template-rows: repeat(4, minmax(120px, 1fr)); }
  .zw-palace { min-height: 120px; padding: 4px 5px 4px; border-radius: 6px; font-size: 11px; line-height: 1.35; }
  .zw-pname { font-size: 11px; }
  .zw-pgz { font-size: 9.5px; }
  .zw-pstars { gap: 1px 5px; }
  .zw-star { font-size: 12.5px; }
  .zw-star .zw-bri { font-size: 8.5px; }
  .zw-sihua { font-size: 9px; padding: 0 2px; margin-left: 2px; }
  .zw-paux { font-size: 9.5px; gap: 1px 4px; }
  /* 六爻/梅花/大六壬 手机端始终 2D，整个视图切换条隐藏（奇门无 data-target 不受影响） */
  .view-switch:has(.seg-btn[data-target]) { display: none; }
  .view-switch .seg-btn[data-target] { display: none; } /* 不支持 :has 的旧浏览器兜底 */
  /* 六爻/梅花/大六壬 手机端起卦成功：排盘区淡入上移，提示已重新生成 */
  @keyframes panFlash { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }
  .pan-flash { animation: panFlash .45s ease; }
  /* 六爻爻位行压缩，避免溢出 */
  .ly-yao { grid-template-columns: 62px 42px 50px 66px 1fr auto; gap: 5px; padding: 6px 8px; }
  .ly-yy { font-size: 13px; letter-spacing: 2px; }
  .ly-qin { font-size: 13.5px; }
  .ly-nj { font-size: 12.5px; }
}
@media (max-width: 480px) {
  /* 工具栏标签保留显示（覆盖旧版隐藏规则） */
  .tb-label { display: inline; }
  /* iOS 输入框小于 16px 聚焦会自动放大页面，统一防缩放 */
  input, select, textarea { font-size: 16px; }
  .btn { font-size: 13px; }
  .bz-dm { font-size: 26px; }
  .bazi-pan { padding: 10px; }
}
