/* ============================================================
   BaZi Result Page (八字排盘结果)
   Professional Chinese Fortune-Telling Stylesheet
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f0e8;
  color: #2d1b0e;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---------- Five Elements Color System ---------- */
.elem-wood  { color: #2d8a4e; }
.elem-fire  { color: #c41e3a; }
.elem-earth { color: #b8860b; }
.elem-metal { color: #d4a017; }
.elem-water { color: #1a73e8; }

.elem-wood.bg  { background: #2d8a4e; color: #fff; }
.elem-fire.bg  { background: #c41e3a; color: #fff; }
.elem-earth.bg { background: #b8860b; color: #fff; }
.elem-metal.bg { background: #d4a017; color: #fff; }
.elem-water.bg { background: #1a73e8; color: #fff; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  position: relative;
  z-index: 10;
}

/* Page Navigation */
.page-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e8d5b7;
  padding: 10px 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.nav-link {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  color: #6b4c3b;
  text-decoration: none;
  padding: 8px 28px;
  border-radius: 20px;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(139, 0, 0, 0.06);
  border-color: #e8d5b7;
}

.nav-link.active {
  background: linear-gradient(135deg, #8b0000, #c41e3a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 28px;
  color: #d4a017;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.4));
  width: 32px;
  height: 32px;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

.logo-text {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 700;
  color: #d4a017;
  letter-spacing: 2px;
}

.header-center {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.subject-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 26px;
  font-weight: 700;
  color: #d4a017;
  letter-spacing: 4px;
  text-shadow: 0 1px 8px rgba(212, 160, 23, 0.3);
  margin-bottom: 2px;
}

.subject-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 1px;
}

.subject-gender {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #d4a017;
  border: 1px solid rgba(212, 160, 23, 0.5);
  border-radius: 20px;
  letter-spacing: 2px;
  background: rgba(212, 160, 23, 0.08);
}

/* 真太阳时 badge — marks displayed birth time as auto-adjusted */
.true-solar-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #d4a017;
  background: rgba(212, 160, 23, 0.14);
  border: 1px solid rgba(212, 160, 23, 0.55);
  border-radius: 10px;
  letter-spacing: 1px;
  cursor: help;
  vertical-align: middle;
  white-space: nowrap;
}
.true-solar-badge:hover {
  background: rgba(212, 160, 23, 0.25);
  color: #b8860b;
}

.header-right {
  flex-shrink: 0;
}

.btn-edit {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 1px;
}

.btn-edit:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #d4a017;
  color: #d4a017;
}

/* ---------- No Data State ---------- */
.no-data-message {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
}

.no-data-inner {
  text-align: center;
  padding: 60px 40px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8d5b7;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.no-data-icon {
  display: block;
  font-size: 48px;
  color: #d4a017;
  margin-bottom: 16px;
}

.no-data-inner p {
  font-size: 16px;
  color: #6b4c3b;
  margin-bottom: 24px;
}

.btn-back {
  display: inline-block;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 32px;
  background: linear-gradient(135deg, #d4a017, #b8860b);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-back:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 160, 23, 0.35);
}

/* ---------- Main Content ---------- */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.content-columns {
  display: grid;
  /* 用 minmax(0, 1fr) 而不是 1fr — 否则当右列内容 (tabs / 表格) 的最小宽
     大于 1fr 分配时, grid 会扩列, 导致右列超出 banner 右边. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
/* 两列都不能因内部固定宽内容撑破自己 */
.col-left, .col-right {
  min-width: 0;
}

/* ---------- Section Titles ---------- */
.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 2px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d4a017;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, #d4a017, #b8860b);
  border-radius: 2px;
}

.subsection-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  color: #2d1b0e;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* ============================================================
   FOUR PILLARS TABLE (排盘表格)
   ============================================================ */
.bazi-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8d5b7;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding: 18px 18px 10px;
}

/* Section title inside a framed card (四柱排盘 = 在卡片框内) */
.bazi-table-wrapper > .section-title {
  margin: 0 0 14px;
}

.bazi-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 460px;
}

.bazi-table thead th {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 600;
  color: #6b4c3b;
  text-align: center;
  padding: 12px 8px;
  border-bottom: 2px solid #e8d5b7;
  background: rgba(212, 160, 23, 0.04);
  letter-spacing: 2px;
}

.bazi-table .row-label {
  width: 60px;
  min-width: 60px;
  max-width: 72px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #6b4c3b;
  text-align: right;
  padding: 10px 8px 10px 10px;
  background: rgba(245, 240, 232, 0.5);
  letter-spacing: 1px;
  white-space: nowrap;
}

.bazi-table tbody td {
  text-align: center;
  padding: 10px 6px;
  border-bottom: 1px solid #f0e6d6;
  vertical-align: middle;
  transition: background 0.2s;
}

.bazi-table tbody tr:last-child td {
  border-bottom: none;
}

.bazi-table tbody tr:nth-child(even) td:not(.row-label) {
  background: rgba(245, 240, 232, 0.3);
}

.bazi-table tbody tr:hover td:not(.row-label) {
  background: rgba(212, 160, 23, 0.05);
}

/* Tiangan & Dizhi: large characters */
.row-tiangan td:not(.row-label),
.row-dizhi td:not(.row-label) {
  font-family: 'Noto Serif SC', serif;
  font-size: 30px;
  font-weight: 700;
  padding: 14px 6px;
  line-height: 1.3;
  letter-spacing: 2px;
}

/* Zhuxing row */
.row-zhuxing td:not(.row-label) {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 600;
  color: #2d1b0e;
  letter-spacing: 1px;
}

/* Canggan row: smaller, multi-line */
.row-canggan td:not(.row-label) {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.8;
  padding: 8px 6px;
}

/* Fuxing / Xingyun rows */
.row-fuxing td:not(.row-label),
.row-xingyun td:not(.row-label) {
  font-size: 13px;
  color: #6b4c3b;
}

/* Zizuo row */
.row-zizuo td:not(.row-label) {
  font-size: 13px;
  color: #6b4c3b;
}

/* Kongwang row */
.row-kongwang td:not(.row-label) {
  font-size: 13px;
  color: #999;
  font-style: italic;
}

/* Nayin row */
.row-nayin td:not(.row-label) {
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-style: italic;
  color: #6b4c3b;
  letter-spacing: 1px;
}

/* Shensha row: badge-style tags */
.row-shensha td:not(.row-label) {
  font-size: 0;
  padding: 8px 4px;
  line-height: 1;
}

.row-shensha td:not(.row-label) span,
.shensha-tag {
  display: inline-block;
  font-size: 11px;
  font-family: 'Noto Sans SC', sans-serif;
  padding: 2px 8px;
  margin: 2px;
  border-radius: 10px;
  background: rgba(212, 160, 23, 0.1);
  color: #6b4c3b;
  border: 1px solid rgba(212, 160, 23, 0.2);
  white-space: nowrap;
  line-height: 1.5;
}

.shensha-tag.good {
  background: rgba(45, 138, 78, 0.08);
  border-color: rgba(45, 138, 78, 0.25);
  color: #2d8a4e;
}

.shensha-tag.bad {
  background: rgba(196, 30, 58, 0.06);
  border-color: rgba(196, 30, 58, 0.2);
  color: #c41e3a;
}

/* ---------- Notes Section ---------- */
.notes-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8d5b7;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.note-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
}

.note-row + .note-row {
  border-top: 1px solid #f0e6d6;
}

.note-label {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #6b4c3b;
  flex-shrink: 0;
  white-space: nowrap;
}

.note-content {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  color: #2d1b0e;
  line-height: 1.8;
}

/* ============================================================
   PILLAR DIAGRAM (四柱图示)
   ============================================================ */
.pillar-diagram-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8d5b7;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.pillar-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px 0 10px;
}

.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 70px;
}

.pillar-label {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #6b4c3b;
  letter-spacing: 1px;
}

.pillar-stem,
.pillar-branch {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif SC', serif;
  font-size: 24px;
  font-weight: 700;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  background: #fff;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pillar-stem:hover,
.pillar-branch:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.pillar-stem {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pillar-branch {
  border-style: dashed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Relationship connectors between pillars */
.pillar-relations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  gap: 20px;
  padding: 24px 0;
}

.relation-line {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: 'Noto Sans SC', sans-serif;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  position: relative;
}

.relation-line::before,
.relation-line::after {
  content: '';
  display: block;
  width: 10px;
  height: 2px;
}

.relation-line.sheng {
  color: #2d8a4e;
  background: rgba(45, 138, 78, 0.08);
}

.relation-line.sheng::before,
.relation-line.sheng::after {
  background: #2d8a4e;
}

.relation-line.ke {
  color: #c41e3a;
  background: rgba(196, 30, 58, 0.06);
}

.relation-line.ke::before,
.relation-line.ke::after {
  background: #c41e3a;
  height: 2px;
  border-top: 1px dashed #c41e3a;
}

.relation-line.he {
  color: #d4a017;
  background: rgba(212, 160, 23, 0.08);
}

.relation-line.he::before,
.relation-line.he::after {
  background: #d4a017;
}

/* ============================================================
   RIGHT COLUMN
   ============================================================ */
.col-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Classics Reference Panel ---------- */
.classics-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8d5b7;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.classics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid #f0e6d6;
  padding-bottom: 10px;
}

.tab-btn {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: #6b4c3b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  position: relative;
  letter-spacing: 0.5px;
}

.tab-btn:hover {
  background: rgba(212, 160, 23, 0.08);
  color: #2d1b0e;
}

.tab-btn.active {
  color: #d4a017;
  background: rgba(212, 160, 23, 0.1);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: #d4a017;
  border-radius: 1px;
}

/* Hints */
.classics-hints {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.06), rgba(184, 134, 11, 0.04));
  border-radius: 8px;
  border-left: 3px solid #d4a017;
}

.hint-line {
  font-size: 13px;
  color: #2d1b0e;
  line-height: 1.8;
}

.hint-line strong {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 600;
  color: #6b4c3b;
}

.hint-line span {
  font-family: 'Noto Serif SC', serif;
}

.hint-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 500;
  margin: 0 2px;
}

.hint-badge.elem-wood  { background: rgba(45, 138, 78, 0.1);  border: 1px solid rgba(45, 138, 78, 0.25);  }
.hint-badge.elem-fire  { background: rgba(196, 30, 58, 0.08); border: 1px solid rgba(196, 30, 58, 0.2);   }
.hint-badge.elem-earth { background: rgba(184, 134, 11, 0.1); border: 1px solid rgba(184, 134, 11, 0.25); }
.hint-badge.elem-metal { background: rgba(212, 160, 23, 0.1); border: 1px solid rgba(212, 160, 23, 0.25); }
.hint-badge.elem-water { background: rgba(26, 115, 232, 0.1); border: 1px solid rgba(26, 115, 232, 0.25); }

/* Classics content */
.classics-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(245, 240, 232, 0.4);
  border-radius: 8px;
  border: 1px solid #f0e6d6;
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 2;
  color: #2d1b0e;
}

.classics-content::-webkit-scrollbar {
  width: 6px;
}

.classics-content::-webkit-scrollbar-track {
  background: transparent;
}

.classics-content::-webkit-scrollbar-thumb {
  background: rgba(212, 160, 23, 0.3);
  border-radius: 3px;
}

.classics-content::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 160, 23, 0.5);
}

.classics-placeholder {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 40px 0;
}

.classics-content p {
  margin-bottom: 10px;
  text-indent: 2em;
}

.classics-content p:last-child {
  margin-bottom: 0;
}

.classics-content .quote {
  display: block;
  padding: 10px 16px;
  margin: 10px 0;
  background: rgba(212, 160, 23, 0.06);
  border-left: 3px solid #d4a017;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  text-indent: 0;
}

/* ============================================================
   DAYUN & LIUNIAN (大运 & 流年)
   ============================================================ */
.dayun-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8d5b7;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.dayun-row-wrapper,
.liunian-row-wrapper {
  margin-bottom: 18px;
}

.dayun-row,
.liunian-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.dayun-row::-webkit-scrollbar,
.liunian-row::-webkit-scrollbar {
  height: 4px;
}

.dayun-row::-webkit-scrollbar-thumb,
.liunian-row::-webkit-scrollbar-thumb {
  background: rgba(212, 160, 23, 0.25);
  border-radius: 2px;
}

/* DaYun card */
.dayun-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(245, 240, 232, 0.5);
  border: 1px solid #f0e6d6;
  border-radius: 10px;
  scroll-snap-align: start;
  transition: all 0.25s ease;
  min-width: 72px;
  cursor: default;
}

.dayun-card:hover {
  background: rgba(212, 160, 23, 0.06);
  border-color: rgba(212, 160, 23, 0.3);
}

.dayun-card.current {
  border: 2px solid #d4a017;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.1), rgba(212, 160, 23, 0.04));
  box-shadow: 0 2px 12px rgba(212, 160, 23, 0.2);
}

.dayun-card .age {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 11px;
  color: #999;
  font-weight: 500;
}

.dayun-card .stem-branch {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.3;
}

.dayun-card .years {
  font-size: 10px;
  color: #999;
}

/* LiuNian card: smaller variant */
.liunian-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: rgba(245, 240, 232, 0.3);
  border: 1px solid #f0e6d6;
  border-radius: 8px;
  scroll-snap-align: start;
  transition: all 0.25s ease;
  min-width: 58px;
}

.liunian-card:hover {
  border-color: rgba(212, 160, 23, 0.3);
}

.liunian-card.current {
  border: 2px solid #d4a017;
  background: rgba(212, 160, 23, 0.06);
}

.liunian-card .year-num {
  font-size: 10px;
  color: #999;
}

.liunian-card .stem-branch {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* ============================================================
   FIVE ELEMENT STRENGTH BARS (五行旺衰)
   ============================================================ */
.wuxing-bar-section {
  margin-top: 6px;
}

.wuxing-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wuxing-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wuxing-label {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 700;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.wuxing-bar {
  flex: 1;
  height: 20px;
  background: rgba(245, 240, 232, 0.8);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #f0e6d6;
}

.wuxing-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.wuxing-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent);
  border-radius: 10px 10px 0 0;
}

.wuxing-fill.wood  { background: linear-gradient(90deg, #2d8a4e, #3da862); }
.wuxing-fill.fire  { background: linear-gradient(90deg, #c41e3a, #e83553); }
.wuxing-fill.earth { background: linear-gradient(90deg, #b8860b, #d4a017); }
.wuxing-fill.metal { background: linear-gradient(90deg, #d4a017, #e8b830); }
.wuxing-fill.water { background: linear-gradient(90deg, #1a73e8, #4a90e8); }

.wuxing-status {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #6b4c3b;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: #1a1a2e;
  color: rgba(255, 255, 255, 0.5);
  padding: 24px 20px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
}

.disclaimer {
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.4);
}

.copyright {
  font-size: 12px;
  color: rgba(212, 160, 23, 0.6);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.col-left,
.col-right {
  animation: fadeInUp 0.5s ease both;
}

.col-right {
  animation-delay: 0.1s;
}

.bazi-table tbody tr {
  animation: fadeInUp 0.35s ease both;
}

.bazi-table tbody tr:nth-child(1)  { animation-delay: 0.05s; }
.bazi-table tbody tr:nth-child(2)  { animation-delay: 0.08s; }
.bazi-table tbody tr:nth-child(3)  { animation-delay: 0.11s; }
.bazi-table tbody tr:nth-child(4)  { animation-delay: 0.14s; }
.bazi-table tbody tr:nth-child(5)  { animation-delay: 0.17s; }
.bazi-table tbody tr:nth-child(6)  { animation-delay: 0.20s; }
.bazi-table tbody tr:nth-child(7)  { animation-delay: 0.23s; }
.bazi-table tbody tr:nth-child(8)  { animation-delay: 0.26s; }
.bazi-table tbody tr:nth-child(9)  { animation-delay: 0.29s; }
.bazi-table tbody tr:nth-child(10) { animation-delay: 0.32s; }

/* Gold shimmer on header name */
.subject-name {
  background: linear-gradient(
    90deg,
    #d4a017 0%,
    #f0d060 40%,
    #d4a017 60%,
    #f0d060 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

/* ============================================================
   PDF EXPORT MODE — disable all animations/transforms
   Applied temporarily during PDF capture to prevent fade-in
   opacity:0 from appearing in html2canvas output.
   ============================================================ */
body.pdf-export-mode *,
body.pdf-export-mode *::before,
body.pdf-export-mode *::after {
  animation: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition: none !important;
  transform: none !important;
  opacity: 1 !important;
  filter: none !important;
  -webkit-filter: none !important;
  backdrop-filter: none !important;
  text-shadow: none !important;
}
body.pdf-export-mode .subject-name {
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: #d4a017 !important;
  color: #d4a017 !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets & narrow desktops */
@media (max-width: 960px) {
  .content-columns {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .header-left {
    width: 100%;
    justify-content: center;
  }

  .header-center {
    width: 100%;
  }

  .header-right {
    position: absolute;
    top: 12px;
    right: 16px;
  }

  .bazi-table .row-tiangan td:not(.row-label),
  .bazi-table .row-dizhi td:not(.row-label) {
    font-size: 26px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  .header-inner {
    padding: 12px 16px;
  }

  .subject-name {
    font-size: 22px;
    letter-spacing: 2px;
  }

  .main-content {
    padding: 16px 12px 32px;
  }

  .section-title {
    font-size: 16px;
  }

  .bazi-table-wrapper {
    border-radius: 8px;
  }

  .bazi-table .row-tiangan td:not(.row-label),
  .bazi-table .row-dizhi td:not(.row-label) {
    font-size: 22px;
    padding: 10px 4px;
  }

  .bazi-table .row-label {
    width: 50px;
    min-width: 50px;
    font-size: 11px;
    padding: 8px 6px 8px 6px;
  }

  .pillar-stem,
  .pillar-branch {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .pillar-relations {
    min-width: 28px;
  }

  .classics-tabs {
    gap: 2px;
  }

  .tab-btn {
    font-size: 12px;
    padding: 5px 10px;
  }

  .classics-content {
    max-height: 300px;
    font-size: 13px;
    line-height: 1.9;
  }

  .dayun-card .stem-branch {
    font-size: 18px;
  }

  .liunian-card .stem-branch {
    font-size: 14px;
  }

  .site-footer {
    padding: 20px 16px;
  }

  /*
   * ====== MOBILE: edge-to-edge layout ======
   * 1. Page locked to 100vw — NO horizontal scroll at page level
   * 2. Bazi table has LOCAL horizontal scroll if too wide
   * 3. Everything else fills screen width with zero side gaps
   */

  /* LOCK page width — prevent zoom/pan breaking layout */
  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* -- Header: full width -- */
  .site-header {
    width: 100% !important;
    max-width: 100% !important;
  }
  .header-inner {
    max-width: 100% !important;
    padding: 10px 12px !important;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .header-left { width: 100%; justify-content: center; }
  .header-center { width: 100%; }
  .header-right {
    position: static !important;
    display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  }
  .btn-edit, .btn-download { font-size: 11px !important; padding: 5px 10px !important; }
  .subject-name { font-size: 20px; letter-spacing: 2px; }
  .subject-meta { font-size: 11px; }

  /* -- Main content: zero side padding -- */
  .main-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden !important;
  }
  .content-columns {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding: 0 !important;
  }
  .col-left, .col-right {
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .section-title {
    font-size: 15px;
    padding-left: 12px;
    margin: 10px 0 6px;
  }

  /* -- ALL containers: zero side border/margin -- */
  .bazi-table-wrapper,
  .notes-section,
  .pillar-diagram-section,
  .classics-section,
  .dayun-section,
  .wuxing-bar-section,
  .reading-card,
  .reading-markdown .reading-card,
  .pm-paywall-card,
  .pm-gated-section,
  .mini-card {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
  }

  /*
   * BAZI TABLE: local horizontal scroll
   * Table uses small fixed font sizes so it fits most phones.
   * If screen is very narrow, user can swipe the table area only.
   */
  .bazi-table-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    width: 100% !important;
  }
  .bazi-table {
    min-width: 360px;  /* ensure 4 columns always visible */
    width: 100%;
    table-layout: auto;
  }
  .bazi-table .row-tiangan td:not(.row-label),
  .bazi-table .row-dizhi td:not(.row-label) {
    font-size: 24px;
    padding: 6px 2px;
  }
  .bazi-table .row-label {
    width: 36px;
    min-width: 36px;
    font-size: 11px;
    padding: 4px 3px;
    white-space: nowrap;
  }
  .bazi-table thead th {
    font-size: 12px;
    padding: 6px 2px;
    letter-spacing: 0;
  }
  .bazi-table td {
    padding: 4px 2px;
    font-size: 11px;
  }
  .shensha-tag {
    font-size: 10px !important;
    padding: 1px 3px !important;
    margin: 1px !important;
  }

  /* -- Pillar diagram -- */
  .pillar-diagram-section {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .pillar-diagram {
    transform: scale(0.7);
    transform-origin: center top;
    margin-bottom: -24px;
  }
  .pillar-stem, .pillar-branch {
    width: 36px; height: 36px; font-size: 17px;
  }
  .pillar-relations {
    min-width: 22px; font-size: 9px;
  }

  /* Notes — full width */
  .notes-section {
    padding: 10px 14px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* All card-like sections — no side border-radius */
  .pillar-diagram-section,
  .classics-section,
  .dayun-section,
  .wuxing-bar-section {
    border-radius: 0 !important;
  }

  /* Dayun / Liunian */
  .dayun-row, .liunian-row {
    gap: 6px;
    padding-bottom: 6px;
  }
  .dayun-card {
    min-width: 85px;
    padding: 6px 6px;
  }
  .liunian-card {
    min-width: 52px;
    padding: 4px 4px;
  }
  .dayun-card .stem-branch {
    font-size: 16px;
  }
  .liunian-card .stem-branch {
    font-size: 13px;
  }

  /* Wuxing bars */
  .wuxing-bar-section {
    padding: 0;
  }

  /* Reading section — ZERO padding */
  .reading-section {
    padding: 0;
  }
  .reading-inner {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .reading-section-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }
  .reading-section-header h2 {
    font-size: 20px;
  }
  .reading-section-header p {
    font-size: 12px;
  }

  /* Reading cards — full width, no gaps */
  .reading-card {
    padding: 16px 14px;
    border-radius: 0;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    border-left: none;
    border-right: none;
  }
  .reading-card h2 {
    font-size: 17px !important;
    margin-bottom: 8px;
  }
  .reading-card h3 {
    font-size: 14px !important;
  }
  .reading-text, .reading-card p {
    font-size: 14px !important;
    line-height: 1.8 !important;
  }
  .reading-text-sm {
    font-size: 13px !important;
  }
  .reading-card-icon {
    font-size: 22px;
  }
  .reading-two-col {
    flex-direction: column;
    gap: 10px;
  }
  .reading-four-col {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  .mini-card {
    padding: 10px 8px !important;
  }

  /* Markdown reading */
  .reading-markdown .reading-card {
    padding: 14px 12px;
    margin-bottom: 10px;
  }
  .reading-markdown .reading-text {
    font-size: 14px !important;
    line-height: 1.8 !important;
  }
  .reading-markdown blockquote {
    margin: 8px 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Paywall card — full width, no side gaps */
  .pm-paywall-card {
    padding: 20px 14px !important;
    margin: 0 !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
  .pm-paywall-title {
    font-size: 17px !important;
  }

  /* Gated content */
  .pm-gated-section {
    margin: 0 !important;
  }

  /* Footer — full width, zero gaps */
  .site-footer {
    padding: 16px 14px;
    margin: 0;
  }
  .footer-inner {
    max-width: 100% !important;
    padding: 0;
  }

  /* Classics panel */
  .classics-tabs {
    gap: 2px;
  }
  .tab-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
  .classics-content {
    max-height: 250px;
    font-size: 12px;
    line-height: 1.8;
  }
}

/* Extra small phones (iPhone SE 320px) */
@media (max-width: 380px) {
  .header-inner { padding: 8px !important; }
  .subject-name { font-size: 17px !important; }
  .main-content { padding: 0 !important; }
  .bazi-table .row-tiangan td:not(.row-label),
  .bazi-table .row-dizhi td:not(.row-label) { font-size: 5vw; }
  .bazi-table .row-label { width: 8vw; min-width: 26px; font-size: 2vw; }
  .reading-card { padding: 12px 10px; }
  .reading-card h2 { font-size: 15px !important; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  body {
    background: #fff;
  }

  .site-header {
    position: static;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .btn-edit,
  .site-footer {
    display: none;
  }

  .content-columns {
    grid-template-columns: 1fr;
  }

  .classics-content {
    max-height: none;
    overflow: visible;
  }

  .dayun-row,
  .liunian-row {
    overflow: visible;
    flex-wrap: wrap;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-muted  { color: #6b4c3b; }
.text-gold   { color: #d4a017; }
.text-sm     { font-size: 12px; }
.text-lg     { font-size: 18px; }
.font-serif  { font-family: 'Noto Serif SC', serif; }
.font-sans   { font-family: 'Noto Sans SC', sans-serif; }
.mt-sm       { margin-top: 8px; }
.mt-md       { margin-top: 16px; }
.mb-sm       { margin-bottom: 8px; }
.mb-md       { margin-bottom: 16px; }
.hidden      { display: none !important; }

/* ============================================================
   白话解读区域 (Plain Language Reading Section)
   ============================================================ */

.reading-section {
  background: linear-gradient(180deg, #f5f0e8 0%, #fdf8f0 100%);
  padding: 48px 0 60px;
}

.reading-inner {
  /* 对齐上方 .main-content 的宽度约束 (1280 + 左右 20px padding = 1240px 内容宽),
     让"命盘白话解读"卡片的左右边和上面 四柱排盘 / 智能古籍 卡片左右边严格对齐 */
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.reading-section-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid #d4a017;
}

.reading-section-header h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 28px;
  font-weight: 700;
  color: #8b0000;
  margin-bottom: 8px;
}

.reading-section-header p {
  font-size: 14px;
  color: #6b4c3b;
}

.reading-card {
  background: #fff;
  border: 1px solid #e8d5b7;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(139, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.reading-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4a017, #c41e3a, #d4a017);
  opacity: 0.6;
}

.reading-card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.reading-card h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: #2d1b0e;
  margin-bottom: 16px;
}

.reading-text {
  font-size: 16px;
  line-height: 2;
  color: #3d2b1e;
  white-space: pre-wrap;
}

.reading-text-sm {
  font-size: 14px;
  line-height: 1.9;
  color: #3d2b1e;
  white-space: pre-wrap;
}

/* Two-column layout */
.reading-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.reading-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reading-list li {
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.7;
  color: #3d2b1e;
  position: relative;
  padding-left: 40px;
}

.reading-list li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 16px;
}

.strengths-list li {
  background: rgba(45, 138, 78, 0.06);
  border-left: 3px solid #2d8a4e;
}

.strengths-list li::before {
  content: '✓';
  color: #2d8a4e;
  font-weight: 700;
}

.risks-list li {
  background: rgba(196, 30, 58, 0.05);
  border-left: 3px solid #c41e3a;
}

.risks-list li::before {
  content: '!';
  color: #c41e3a;
  font-weight: 700;
}

/* Phase card */
.phase-badge {
  display: inline-block;
  background: linear-gradient(135deg, #d4a017, #f5d060);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 14px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 8px;
}

.phase-theme {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  color: #8b0000;
  font-weight: 600;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(139, 0, 0, 0.04);
  border-radius: 8px;
  border-left: 3px solid #8b0000;
}

.phase-years {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.phase-year-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.phase-year-tag.opportunity {
  background: rgba(45, 138, 78, 0.1);
  color: #2d8a4e;
  border: 1px solid rgba(45, 138, 78, 0.3);
}

.phase-year-tag.caution {
  background: rgba(196, 30, 58, 0.08);
  color: #c41e3a;
  border: 1px solid rgba(196, 30, 58, 0.2);
}

/* Four-column mini cards */
.reading-four-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.mini-card {
  padding: 24px 20px;
  text-align: center;
}

.mini-card::before {
  display: none;
}

.mini-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.mini-card h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  color: #8b0000;
  margin-bottom: 12px;
}

.mini-card .reading-text-sm {
  text-align: left;
}

/* Annual forecast */
.reading-annual {
  background: linear-gradient(135deg, #fff 0%, #fefbf3 100%);
}

/* Life advice */
.reading-advice,
.reading-markdown .reading-card.reading-advice {
  background: linear-gradient(135deg, #fefbf3 0%, #fff8e8 100%);
  color: #2d1b0e;
}

.reading-advice::before,
.reading-markdown .reading-card.reading-advice::before {
  background: linear-gradient(90deg, #d4a017, #f5d060, #d4a017);
}

.reading-advice h2,
.reading-markdown .reading-card.reading-advice h2 {
  color: #8b0000;
}

.reading-advice .reading-text,
.reading-markdown .reading-card.reading-advice .reading-text {
  color: #3d2b1e;
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  line-height: 2.2;
}

/* Responsive */
@media (max-width: 768px) {
  .reading-two-col {
    grid-template-columns: 1fr;
  }
  .reading-four-col {
    grid-template-columns: 1fr 1fr;
  }
  .reading-card {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .reading-four-col {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   术语解释气泡 (Glossary Tooltip)
   ============================================================ */

/* ============================================================
   大运/流年详情面板 + 评分/主题标签
   ============================================================ */

.has-detail {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.has-detail:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.has-detail.active-detail {
  outline: 2px solid #d4a017;
  outline-offset: 2px;
}

.fortune-rating {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
}

.rating-good { background: rgba(45,138,78,0.15); color: #2d8a4e; }
.rating-mid { background: rgba(212,160,23,0.15); color: #b8860b; }
.rating-bad { background: rgba(196,30,58,0.12); color: #c41e3a; }

.fortune-theme {
  font-size: 10px;
  color: #6b4c3b;
  margin-top: 4px;
  padding: 2px 8px;
  background: rgba(212,160,23,0.08);
  border-radius: 10px;
  display: inline-block;
}

.fortune-detail-panel {
  background: #fff;
  border: 1px solid #e8d5b7;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 12px;
  box-shadow: 0 2px 12px rgba(139,0,0,0.06);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-header {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 600;
  color: #2d1b0e;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8d5b7;
}

.detail-header span {
  font-size: 22px;
}

.fortune-rating-inline {
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.detail-body {
  font-size: 15px;
  line-height: 2;
  color: #3d2b1e;
}

.dayun-card, .liunian-card {
  position: relative;
}

/* Markdown reading cards */
.reading-markdown .reading-card {
  margin-bottom: 24px;
}

.reading-markdown .reading-card h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: #8b0000;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8d5b7;
}

.reading-markdown .reading-card h3 {
  font-size: 17px;
  color: #2d1b0e;
  margin: 16px 0 8px;
}

.reading-markdown .reading-text {
  font-size: 16px;
  line-height: 2;
  color: #3d2b1e;
}

.reading-markdown .reading-text strong {
  color: #8b0000;
}

.reading-markdown .reading-text ul {
  padding-left: 20px;
  margin: 12px 0;
}

.reading-markdown .reading-text li {
  margin-bottom: 8px;
  line-height: 1.8;
}

/* ============================================================
   PDF Download Button
   ============================================================ */

.btn-download {
  background: linear-gradient(135deg, #d4a017, #f5d060);
  color: #1a1a2e;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Noto Sans SC', sans-serif;
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.2s;
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 12px rgba(212, 160, 23, 0.4);
}

/* ============================================================
   Print / PDF Styles
   ============================================================ */

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff !important;
    font-size: 12px;
  }

  .site-header {
    position: relative !important;
    background: #1a1a2e !important;
    color: #fff !important;
  }

  .btn-download, .btn-edit, .page-nav, .glossary-tip {
    display: none !important;
  }

  .reading-section, .main-content {
    display: block !important;
  }

  .content-columns {
    display: block !important;
  }

  .col-left, .col-right {
    width: 100% !important;
    max-width: 100% !important;
  }

  .reading-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 16px;
  }

  .bazi-table-wrapper, .classics-panel, .dayun-liunian {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .site-footer {
    margin-top: 24px;
    border-top: 1px solid #ccc;
  }

  /* Ensure element colors print */
  .elem-wood { color: #2d8a4e !important; }
  .elem-fire { color: #c41e3a !important; }
  .elem-earth { color: #b8860b !important; }
  .elem-metal { color: #d4a017 !important; }
  .elem-water { color: #1a73e8 !important; }

  .reading-advice {
    background: #fefbf3 !important;
    color: #2d1b0e !important;
  }

  .reading-advice h2 {
    color: #8b0000 !important;
  }
}

.glossary-term {
  cursor: help;
  border-bottom: 1px dashed #d4a017;
  transition: background 0.15s;
}

.glossary-term:hover {
  background: rgba(212, 160, 23, 0.12);
  border-radius: 2px;
}

.glossary-tip {
  position: absolute;
  z-index: 9999;
  background: #1a1a2e;
  color: #f5f0e8;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 340px;
  line-height: 1.6;
}

.glossary-tip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.glossary-tip.above {
  transform: translateY(-100%) translateY(-16px);
}

.glossary-tip.above.visible {
  transform: translateY(-100%) translateY(-16px);
}

.glossary-tip-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 700;
  color: #f5d060;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(245, 208, 96, 0.2);
}

.glossary-tip-body {
  font-size: 14px;
  color: #d8cbb8;
  line-height: 1.8;
  margin-bottom: 10px;
}

.glossary-tip-source {
  font-size: 12px;
  color: #a89b82;
  line-height: 1.7;
  padding-top: 10px;
  border-top: 1px dashed rgba(245, 208, 96, 0.25);
  font-family: 'Noto Serif SC', serif;
  font-style: italic;
}

.glossary-tip-source::before {
  content: '📜 ';
  font-style: normal;
}
