/* ── Ziwei 4x4 Board, SanFang SVG, 4-Layer Overlay & LiuYue ── */
.ziwei-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(132px, auto));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.ziwei-board > * { min-width: 0; max-width: 100%; }
.ziwei-center {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.sanfang-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.ziwei-center-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
}
.ziwei-summary-card, .ziwei-selected-detail {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e7e2d8;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 1px 4px rgba(41, 39, 35, 0.06);
}
.ziwei-summary-card h4, .ziwei-selected-detail h4 {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.ziwei-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 10px;
}
.ziwei-summary-grid p, .ziwei-selected-detail p { margin: 2px 0; }
.sanfang-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.sanfang-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.sanfang-dot.self { background: var(--purple); }
.sanfang-dot.opp { background: var(--teal); }
.sanfang-dot.trine { background: var(--amber); }

.palace-b5 { grid-column: 1; grid-row: 1; }
.palace-b6 { grid-column: 2; grid-row: 1; }
.palace-b7 { grid-column: 3; grid-row: 1; }
.palace-b8 { grid-column: 4; grid-row: 1; }
.palace-b4 { grid-column: 1; grid-row: 2; }
.palace-b9 { grid-column: 4; grid-row: 2; }
.palace-b3 { grid-column: 1; grid-row: 3; }
.palace-b10 { grid-column: 4; grid-row: 3; }
.palace-b2 { grid-column: 1; grid-row: 4; }
.palace-b1 { grid-column: 2; grid-row: 4; }
.palace-b0 { grid-column: 3; grid-row: 4; }
.palace-b11 { grid-column: 4; grid-row: 4; }

.palace {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  min-height: 132px;
  min-width: 0;
  max-width: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.palace:hover { border-color: #b7b0e8; }
.palace:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.palace.ming { border-color: #aba4df; }
.palace.sanfang-self {
  border: 2px solid var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.14);
}
.palace.sanfang-opp {
  border: 2px solid var(--teal);
  background: var(--teal-soft);
}
.palace.sanfang-trine {
  border: 2px solid var(--amber);
  background: var(--amber-soft);
}
.palace-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 4px;
}
.palace h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.palace-meta { font-size: 11px; color: var(--muted); white-space: normal; }
.palace-badges { display: flex; flex-wrap: wrap; gap: 3px; }
.palace-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.4;
}
.empty-tag { background: #e8eef7; color: #2b4c7e; }
.shen-tag { background: var(--purple); color: #fff; }
.self-sihua-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fdf2f2;
  color: var(--red);
  border: 1px solid #f2c4c4;
}
.stars { display: flex; flex-wrap: wrap; gap: 3px; }
.star {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1efe8;
  color: var(--text);
  line-height: 1.4;
}
.star.major { background: #e6e3fc; color: #31297a; font-weight: 500; }
.star-bright { font-size: 10px; color: var(--muted); margin-left: 1px; }
.sihua-badge {
  display: inline-block;
  margin-left: 2px;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.sihua-lu { background: #d6f5e3; color: #0e603b; }
.sihua-quan { background: #fde6cc; color: #8c4806; }
.sihua-ke { background: #dcebfa; color: #19518a; }
.sihua-ji { background: #fad8d8; color: #9c1f1f; }
.palace-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 11px;
  color: var(--muted);
}
.palace-foot .ask-btn { padding: 2px 7px; font-size: 11px; }

.ziwei-layer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f6;
  min-width: 0;
}
.ziwei-layer-pills, .ziwei-layer-controls {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.ziwei-layer-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.ziwei-layer-controls input { width: 84px; padding: 4px 7px; font-size: 12px; }
.ziwei-layer-controls select { width: auto; max-width: 100%; padding: 4px 7px; font-size: 12px; }
.layer-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f1efe8;
  color: var(--text);
}
.layer-chip.layer-natal.active {
  background: #31297a;
  border-color: #31297a;
  color: #fff;
}
.layer-toggle.active {
  font-weight: 600;
  color: #fff;
}
.layer-toggle-dx.active { background: #1d4ed8; border-color: #1d4ed8; }
.layer-toggle-ln.active { background: #b45309; border-color: #b45309; }
.layer-toggle-ly.active { background: #6d28d9; border-color: #6d28d9; }

.overlay-palace-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.overlay-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}
.overlay-tag-dx { background: #dbeafe; color: #1e40af; }
.overlay-tag-ln { background: #fef3c7; color: #92400e; }
.overlay-tag-ly { background: #ede9fe; color: #5b21b6; }
.overlay-tag-xx { background: #ccfbf1; color: #0f766e; }

.layer-sihua-dx { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.layer-sihua-ln { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.layer-sihua-ly { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }

.ziwei-overlay-summary {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d5d0f2;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11px;
  line-height: 1.5;
}
.ziwei-overlay-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  color: var(--purple);
}
.ziwei-overlay-legend { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.ziwei-overlay-rows { display: grid; gap: 3px; }
.ziwei-overlay-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.ziwei-liuyue-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f6;
}
.ziwei-liuyue-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.ziwei-liuyue-bar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.ziwei-liuyue-bar input { width: 92px; padding: 5px 8px; }
.ziwei-liuyue-bar select { width: auto; max-width: 100%; padding: 5px 8px; }
.ziwei-liuyue-out { margin-top: 10px; font-size: 12px; }
.ziwei-liuyue-out:empty { display: none; }
.ziwei-liuyue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ziwei-liuyue-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.ziwei-liuyue-item strong { color: var(--purple); }

/* ── Bazi WuXing Chart, SVG Relations & Tables ── */
.subhead { margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: var(--purple); }
.ganzhi { font-size: 15px; font-weight: 600; }
.bazi-interpret { background: #fafaff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.bazi-interpret p { margin: 4px 0; }
.bazi-table .col-nowrap { white-space: nowrap; }
.bazi-table .col-wide { min-width: 180px; white-space: normal; }

.bazi-viz-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bazi-viz-head .subhead { margin: 0; }
.bazi-wuxing-chart {
  margin: 14px 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfbf8;
}
.bazi-wuxing-list { display: grid; gap: 9px; }
.bazi-wuxing-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 175px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.bazi-wuxing-label { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.wx-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
}
.wx-wood { background: #dff4e7; color: #166534; }
.wx-fire { background: #fde5e5; color: #991b1b; }
.wx-earth { background: #f8edd4; color: #854f0b; }
.wx-metal { background: #eceef2; color: #475569; }
.wx-water { background: #dff0fb; color: #1d4ed8; }
.wx-role-pill {
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
}
.wx-role-favorable { background: var(--teal-soft); color: var(--teal); }
.wx-role-unfavorable { background: var(--red-soft); color: var(--red); }
.wx-role-neutral { background: var(--amber-soft); color: var(--amber); }
.wx-role-dm { background: var(--purple-soft); color: var(--purple); }
.bazi-wuxing-bar-wrap { width: 100%; height: 14px; display: flex; align-items: center; }
.bazi-wuxing-bar-svg { width: 100%; height: 12px; display: block; }
.wx-bar-bg { fill: #ece8df; }
.wx-bar-stem { opacity: 0.95; }
.wx-bar-branch { opacity: 0.45; }
.wx-fill-wood { fill: #2e8b57; }
.wx-fill-fire { fill: #cf3c3c; }
.wx-fill-earth { fill: #b57b1b; }
.wx-fill-metal { fill: #64748b; }
.wx-fill-water { fill: #2563eb; }
.wx-fill-neutral { fill: #8b857b; }
.bazi-wuxing-meta {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.bazi-rel-svg {
  margin: 14px 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfbf8;
}
.bazi-rel-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.rel-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.rel-dot.harmony { background: var(--teal); }
.rel-dot.clash { background: var(--red); }
.rel-dot.caution { background: var(--amber); }
.bazi-rel-diagram {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
  margin: 6px auto;
}
.rel-pillar-card { fill: #fff; stroke: #d6d0c4; stroke-width: 1.2; }
.rel-pillar-title { font-size: 10px; fill: #6e6a63; }
.rel-pillar-gan { font-size: 18px; font-weight: 700; fill: #31297a; }
.rel-pillar-zhi { font-size: 18px; font-weight: 700; fill: #292723; }
.rel-pillar-ss { font-size: 9px; fill: #6e6a63; }
.rel-arc.rel-harmony path { stroke: #0f6e56; }
.rel-arc.rel-harmony circle { fill: #0f6e56; }
.rel-arc.rel-harmony .rel-pill-bg { fill: #e1f5ee; stroke: #0f6e56; stroke-width: 0.8; }
.rel-arc.rel-harmony .rel-pill-text { fill: #0f6e56; font-size: 9.5px; font-weight: 600; }
.rel-arc.rel-clash path { stroke: #a32d2d; stroke-dasharray: 4 2; }
.rel-arc.rel-clash circle { fill: #a32d2d; }
.rel-arc.rel-clash .rel-pill-bg { fill: #fcebeb; stroke: #a32d2d; stroke-width: 0.8; }
.rel-arc.rel-clash .rel-pill-text { fill: #a32d2d; font-size: 9.5px; font-weight: 600; }
.rel-arc.rel-caution path { stroke: #854f0b; stroke-dasharray: 2 2; }
.rel-arc.rel-caution circle { fill: #854f0b; }
.rel-arc.rel-caution .rel-pill-bg { fill: #faeeda; stroke: #854f0b; stroke-width: 0.8; }
.rel-arc.rel-caution .rel-pill-text { fill: #854f0b; font-size: 9.5px; font-weight: 600; }
.bazi-rel-triples, .bazi-rel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.rel-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.rel-chip.rel-harmony { background: var(--teal-soft); color: var(--teal); }
.rel-chip.rel-clash { background: var(--red-soft); color: var(--red); }
.rel-chip.rel-caution { background: var(--amber-soft); color: var(--amber); }

.protruded-badge {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 11px;
  font-weight: 500;
}
.tendency-badge {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.tendency-fav { background: var(--teal-soft); color: var(--teal); }
.tendency-unfav { background: var(--red-soft); color: var(--red); }
.tendency-mixed { background: var(--amber-soft); color: var(--amber); }
.liunian-special-badge {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
  font-size: 11px;
}

/* ── Qimen 3x3 Grid, Topic Highlight & Status Badges ── */
.qimen-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qcell { border: 1px solid var(--line); border-radius: 9px; padding: 9px; min-height: 105px; min-width: 0; max-width: 100%; }
.qcell strong { color: var(--purple); }
.qcell p { margin: 3px 0; font-size: 12px; }

.qimen-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.qimen-meta-row p { margin: 0; }
.qimen-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.qimen-badge {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.qimen-badge-yinpan { background: #ede9fe; color: #4c1d95; }
.qimen-badge-zhirun { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.qimen-badge-term { background: var(--amber-soft); color: var(--amber); }
.qimen-topic-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f6;
}
.qimen-topic-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.qimen-topic-note { font-size: 11px; }
.qcell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.qcell-highlight {
  border: 2px solid var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.12);
}
.qcell-reasons { display: flex; gap: 4px; flex-wrap: wrap; }
.qcell-reason-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--purple);
  color: #fff;
}
.qcell-mark {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}
.qcell-mark-kong {
  background: #f3f0ea;
  color: #6b5e4c;
  border: 1px solid #d7cbb8;
}
.qcell-mark-ma {
  background: #e9f4ee;
  color: #206a45;
  border: 1px solid #b5dcc6;
}

/* ── Meihua Hexagrams, Ti/Yong Card & Guaci ── */
.hex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hex { border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; max-width: 100%; }
.hex .lines, .lines {
  white-space: pre-line;
  font-family: ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.08em;
  margin: 10px 0;
}

.meihua-tiyong-card {
  margin: 10px 0 14px;
  padding: 13px 16px;
  border: 1px solid #d5d0f2;
  border-left: 4px solid var(--purple);
  border-radius: 10px;
  background: #faf9ff;
}
.meihua-tiyong-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.meihua-tiyong-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.meihua-tiyong-grid > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.meihua-tiyong-grid span { display: block; font-size: 11px; }
.meihua-tiyong-grid strong { display: block; margin-top: 2px; font-size: 14px; color: var(--purple); }
.meihua-tiyong-card p { margin: 4px 0; font-size: 13px; }
.meihua-chain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.meihua-chain-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
}
.meihua-chain-step span { display: block; font-size: 11px; }
.meihua-chain-step strong { display: block; margin: 2px 0; font-size: 13px; color: var(--text); }
.meihua-chain-rel { color: var(--purple); font-weight: 600; }
.meihua-meta-strip { margin-top: 10px; font-size: 12px; }
.meihua-guaci {
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfbf8;
}
.meihua-guaci summary { cursor: pointer; font-weight: 500; color: var(--purple); }
.meihua-guaci-list { display: grid; gap: 10px; margin-top: 10px; }
.meihua-guaci-item {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.meihua-guaci-item:first-child { border-top: 0; padding-top: 0; }
.meihua-guaci-item h4 { margin: 0 0 4px; font-size: 13px; color: var(--purple); }
.meihua-guaci-item p { margin: 3px 0; font-size: 12px; }
.meihua-trend-banner {
  background: #fff;
  border: 1px solid #dcd6f7;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 10px;
}
.meihua-trend-banner strong {
  display: block;
  font-size: 14px;
  color: var(--purple);
  margin-bottom: 3px;
}
.meihua-trend-banner p { margin: 0; font-size: 12px; color: var(--text); }
.meihua-yaoci-box {
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid #e6dfcf;
  border-left: 4px solid #8a6d3b;
  border-radius: 10px;
  background: #fdfbf6;
  display: grid;
  gap: 8px;
}
.meihua-yaoci-item strong { display: block; font-size: 13px; color: #5c4620; margin-bottom: 2px; }
.meihua-yaoci-item p { margin: 2px 0; font-size: 12px; }
.qimen-yongshen-box {
  margin: 0 0 12px;
  padding: 10px 13px;
  border: 1px solid #d5d0f2;
  border-radius: 10px;
  background: #faf9ff;
}
.qimen-yongshen-box strong { color: var(--purple); font-size: 13px; }
.qimen-yongshen-box p { margin: 4px 0 0; font-size: 12px; }

.meihua-topic-box {
  border-left: 4px solid var(--purple);
}
.meihua-topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.meihua-topic-principle {
  font-style: normal;
}
.meihua-topic-actions {
  margin-top: 8px;
}
.meihua-yingqi-box {
  margin: 8px 0 4px;
  padding: 8px 11px;
  border: 1px dashed #c8c1ee;
  border-radius: 8px;
  background: #fff;
}
.meihua-yingqi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.meihua-yingqi-head strong {
  font-size: 13px;
  color: var(--purple);
}
.meihua-yingqi-box p {
  margin: 0;
  font-size: 12px;
}
.meihua-wanwu-section {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfbf8;
}
.meihua-wanwu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.meihua-wanwu-head h4 {
  margin: 0;
  font-size: 14px;
  color: var(--purple);
}
.meihua-wanwu-head span {
  font-size: 12px;
}
.meihua-wanwu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.meihua-wanwu-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
}
.meihua-wanwu-title {
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 7px;
}
.meihua-wanwu-title span {
  display: block;
  font-size: 11px;
}
.meihua-wanwu-title strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--purple);
}
.meihua-wanwu-dl {
  margin: 0;
  display: grid;
  gap: 5px;
}
.meihua-wanwu-dl > div {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px;
  font-size: 12px;
}
.meihua-wanwu-dl dt {
  color: var(--muted);
  font-weight: 500;
}
.meihua-wanwu-dl dd {
  margin: 0;
  color: var(--text);
}

/* ── V3.1 Bazi Chenggu Folk Reference Card ── */
.chenggu-card {
  margin-top: 16px;
  border: 1px dashed #cfc9bb;
  background: #fcfbf8;
}
.chenggu-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}
.chenggu-formula {
  margin: 0;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}
.chenggu-formula strong {
  color: var(--purple);
  font-size: 15px;
}
.chenggu-boundary {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  border-radius: 6px;
  font-size: 12px;
}
.chenggu-verses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.chenggu-verse-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.chenggu-verse-box.is-active {
  border-color: var(--purple);
  background: #faf9ff;
}
.chenggu-verse-box h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.chenggu-poem {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: #2c2822;
  letter-spacing: 0.02em;
}
.chenggu-disclaimer {
  margin: 0;
  font-size: 11.5px;
}

/* ── V3.1 Da Liu Ren Three Transmissions, Four Lessons & 4x4 Shi Board ── */
.lr-chuan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.lr-chuan-card {
  border: 1px solid #dcd6f7;
  border-top: 3px solid var(--purple);
  border-radius: 9px;
  background: #faf9ff;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}
.lr-chuan-head, .lr-chuan-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.lr-stage-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--purple);
}
.lr-liuqin-pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}
.lr-chuan-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.lr-dungan {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.lr-branch {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.lr-element {
  font-size: 12px;
}
.lr-jiang-badge {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.lr-jiang-auspicious {
  background: var(--teal-soft);
  color: var(--teal);
}
.lr-jiang-caution {
  background: var(--amber-soft);
  color: var(--amber);
}
.lr-ke-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.lr-ke-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 9px 10px;
  text-align: center;
  display: grid;
  gap: 6px;
}
.lr-ke-card.is-ke-active {
  border-color: #d9b88c;
  background: #fffcf7;
}
.lr-ke-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.lr-ke-stack {
  display: grid;
  gap: 2px;
  justify-items: center;
}
.lr-ke-jiang {
  font-size: 11px;
}
.lr-ke-top, .lr-ke-bot {
  font-size: 17px;
  color: var(--text);
}
.lr-ke-top small, .lr-ke-bot small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
}
.lr-ke-divider {
  font-size: 10px;
  color: #ccc6b8;
  line-height: 1;
}
.lr-board {
  margin-top: 6px;
}
.lr-cell {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 9px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  min-height: 98px;
}
.lr-cell-top, .lr-cell-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 11px;
}
.lr-cell-mid {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.lr-cell-dungan {
  font-size: 12px;
  color: var(--muted);
}
.lr-cell-heaven {
  font-size: 19px;
  font-weight: 700;
  color: var(--purple);
}
.lr-cell-god {
  font-size: 11px;
}
.lr-cell-marks {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.lr-mini-tag {
  font-size: 10px;
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 600;
}
.lr-tag-gan { background: var(--purple-soft); color: var(--purple); }
.lr-tag-zhi { background: var(--teal-soft); color: var(--teal); }
.lr-tag-chuan { background: #fef3c7; color: #92400e; }
.lr-tag-ming { background: #e0f2fe; color: #0369a1; }
.lr-tag-kong { background: #f3f0ea; color: #6b5e4c; }
.lr-center {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lr-center-box h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--purple);
}
.lr-center-box p {
  margin: 4px 0;
  font-size: 12px;
}
.lr-rationale {
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.lr-shensha-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.lr-quick-ai {
  margin-top: 10px;
}
