/* ============================================================================
   天机阁 · 至尊八字命理推演系统 - 新中式东方玄学高定样式表 (styles.css)
   支持【暗夜玄金】与【古籍宣纸】双主题切换，五行标准色系，全响应式布局
   ============================================================================ */

:root {
  /* 古籍宣纸主题（全站默认） */
  --bg-primary: #f5efe2;
  --bg-secondary: #ebe2ce;
  --bg-card: rgba(252, 248, 239, 0.95);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(245, 239, 226, 0.9);
  --text-primary: #261e16;
  --text-secondary: #5c4d3c;
  --text-muted: #8a7965;
  --gold-primary: #9c6b16;
  --gold-light: #7c520a;
  --gold-dark: #634005;
  --cinnabar: #b3241a;
  --cinnabar-light: #d1362b;
  --border-gold: rgba(156, 107, 22, 0.28);
  --border-gold-strong: rgba(156, 107, 22, 0.65);
  --shadow-card: 0 8px 28px rgba(72, 52, 25, 0.12);

  /* 五行专色 */
  --el-wood: #18794e;
  --el-wood-bg: rgba(24, 121, 78, 0.11);
  --el-fire: #c92a2a;
  --el-fire-bg: rgba(201, 42, 42, 0.11);
  --el-earth: #8c5a18;
  --el-earth-bg: rgba(140, 90, 24, 0.12);
  --el-metal: #b47d08;
  --el-metal-bg: rgba(180, 125, 8, 0.13);
  --el-water: #0b6bcb;
  --el-water-bg: rgba(11, 107, 203, 0.11);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(212, 175, 55, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(200, 50, 40, 0.06) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: "PingFang SC", "Noto Serif SC", "Microsoft YaHei", "Source Han Serif SC", serif;
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 顶部天机阁导航栏 */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-gold);
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.taiji-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  color: var(--gold-primary);
  background: radial-gradient(circle, rgba(212,175,55,0.18), transparent);
  animation: slowSpin 28s linear infinite;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.25);
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-title {
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.seal-stamp {
  display: inline-block;
  background: var(--cinnabar);
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(200, 50, 40, 0.4);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* 通用按钮样式 */
.btn {
  cursor: pointer;
  border: 1px solid var(--border-gold);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.48rem 0.95rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #a87517, #7c5106);
  color: #fff !important;
  border-color: #634005;
  box-shadow: 0 4px 14px rgba(124, 82, 10, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b8821c, #8a5b08);
  color: #fff !important;
  box-shadow: 0 6px 20px rgba(124, 82, 10, 0.42);
}

/* 印章徽标配色变体（保证文字与底色对比度达到可读标准） */
.seal-stamp.seal-green {
  background: #18794e;
  box-shadow: 0 2px 6px rgba(24, 121, 78, 0.35);
}
.seal-stamp.seal-amber {
  background: #8a5a00;
  box-shadow: 0 2px 6px rgba(138, 90, 0, 0.35);
}
.seal-stamp.seal-soft {
  background: var(--bg-secondary);
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  border-color: var(--border-gold-strong);
  box-shadow: none;
}

.btn-cinnabar {
  background: linear-gradient(135deg, var(--cinnabar-light), var(--cinnabar));
  color: #fff !important;
  border-color: rgba(255, 180, 170, 0.5);
}

/* 主容器 */
.main-container {
  max-width: 1400px;
  margin: 1.5rem auto 4rem;
  padding: 0 1.25rem;
}

/* 卡片样式 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  opacity: 0.65;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed var(--border-gold);
}

.section-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.section-badge {
  font-size: 0.75rem;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--border-gold);
  color: var(--text-secondary);
  background: rgba(212, 175, 55, 0.08);
}

/* 输入控制面板 */
.input-mode-tabs {
  display: inline-flex;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  box-shadow: inset 0 1px 3px rgba(72, 52, 25, 0.08);
  flex-wrap: wrap;
  gap: 3px;
}

.mode-tab {
  cursor: pointer;
  padding: 0.45rem 1.08rem;
  border-radius: 7px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.mode-tab:hover:not(.active) {
  color: var(--gold-light);
  background: rgba(156, 107, 22, 0.08);
}

.mode-tab.active {
  background: linear-gradient(135deg, #ab7819, #7e5307);
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(126, 83, 7, 0.28);
}

.span-2-col {
  grid-column: span 2;
}

.auto-shichen-box {
  background: rgba(156, 107, 22, 0.1) !important;
  border-color: var(--gold-primary) !important;
  color: var(--gold-light) !important;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 41px;
}

.live-convert-box {
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(180deg, rgba(235, 226, 206, 0.72), rgba(235, 226, 206, 0.42));
  border: 1px solid var(--border-gold);
  border-left: 4px solid var(--gold-primary);
  border-radius: 10px;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* 命局核心速览一言堂（5卡高定概览） */
.hero-verdict-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.hero-verdict-card {
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 11px;
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 16px rgba(72, 52, 25, 0.07);
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-verdict-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-primary), var(--cinnabar));
  opacity: 0.75;
}

.hero-verdict-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 10px 24px rgba(72, 52, 25, 0.14);
  background: #ffffff;
}

.hv-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.hv-main {
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
}

.hv-sub {
  font-size: 0.76rem;
  color: var(--gold-light);
  margin-top: 0.28rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.reverse-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.synastry-form-grid {
  grid-template-columns: repeat(3, 1fr);
}

.inner-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-control {
  width: 100%;
  max-width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.18);
}

.options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px dashed var(--border-gold);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1 1 auto;
  min-width: 0;
}

.checkbox-group .chk-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.sect-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

.sect-select {
  padding: 4px 8px;
  font-size: 0.82rem;
  width: auto;
  max-width: 100%;
}

.calc-submit-btn {
  padding: 0.65rem 1.7rem;
  font-size: 0.98rem;
  white-space: nowrap;
}

/* 主功能分页导航栏（吸顶毛玻璃导航） */
.main-nav-tabs {
  position: sticky;
  top: 63px;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  background: rgba(245, 239, 226, 0.92);
  backdrop-filter: blur(12px);
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--border-gold);
  box-shadow: 0 6px 20px rgba(72, 52, 25, 0.08);
  margin-bottom: 1.35rem;
}

.nav-tab-btn {
  cursor: pointer;
  padding: 0.68rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.22s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
}

.nav-tab-btn:hover:not(.active) {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: #ffffff;
  transform: translateY(-1px);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, #a87517, #7c5106);
  border-color: #634005;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(124, 82, 10, 0.32);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.28s ease;
}

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

/* 命主头部档案摘要栏 */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 1rem 1.15rem;
  border-radius: 9px;
  border: 1px solid var(--border-gold);
  margin-bottom: 1.2rem;
  font-size: 0.87rem;
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.meta-label {
  color: var(--text-muted);
  white-space: nowrap;
}

.meta-val {
  color: var(--text-primary);
  font-weight: 600;
}

/* 核心四柱八字全息大表 */
.bazi-table-wrap {
  overflow-x: auto;
}

.bazi-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  border: 1px solid var(--border-gold);
}

.bazi-table th,
.bazi-table td {
  border: 1px solid var(--border-gold);
  padding: 0.7rem 0.6rem;
}

.bazi-table th {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.92rem;
}

.bazi-table .row-label {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  width: 110px;
  font-size: 0.86rem;
}

/* 天干地支大字 */
.gz-char {
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1.15;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 10px;
  position: relative;
}

.gz-sub {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.88;
}

/* 五行颜色类 */
.el-木 { color: var(--el-wood) !important; }
.el-火 { color: var(--el-fire) !important; }
.el-土 { color: var(--el-earth) !important; }
.el-金 { color: var(--el-metal) !important; }
.el-水 { color: var(--el-water) !important; }

.bg-el-木 { background: var(--el-wood-bg); border: 1px solid rgba(46, 204, 113, 0.35); }
.bg-el-火 { background: var(--el-fire-bg); border: 1px solid rgba(255, 94, 87, 0.35); }
.bg-el-土 { background: var(--el-earth-bg); border: 1px solid rgba(212, 155, 75, 0.35); }
.bg-el-金 { background: var(--el-metal-bg); border: 1px solid rgba(247, 201, 72, 0.35); }
.bg-el-水 { background: var(--el-water-bg); border: 1px solid rgba(56, 189, 248, 0.35); }

/* 藏干列表 */
.hidden-stem-list {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: center;
  font-size: 0.85rem;
}

.hidden-stem-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg-secondary);
}

/* 神煞标签带悬浮提示 */
.shensha-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.shensha-tag {
  font-size: 0.76rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: help;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.15s;
}

.shensha-tag:hover {
  transform: scale(1.06);
}

.shensha-good {
  background: rgba(46, 204, 113, 0.14);
  color: var(--el-wood);
  border-color: rgba(46, 204, 113, 0.35);
}

.shensha-bad {
  background: rgba(255, 94, 87, 0.14);
  color: var(--el-fire);
  border-color: rgba(255, 94, 87, 0.35);
}

.shensha-neutral {
  background: rgba(212, 175, 55, 0.13);
  color: var(--gold-light);
  border-color: var(--border-gold);
}

/* 双栏布局 */
.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.4rem;
}

@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

/* 干支刑冲合会关系列表 */
.relation-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.relation-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  background: var(--bg-secondary);
  border-left: 3px solid var(--gold-primary);
}

.relation-item.good { border-left-color: var(--el-wood); }
.relation-item.warn { border-left-color: var(--el-metal); }
.relation-item.bad  { border-left-color: var(--el-fire); }

.rel-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  background: rgba(212, 175, 55, 0.16);
  color: var(--gold-light);
}

/* 五行能量进度条 */
.element-bar-row {
  margin-bottom: 0.85rem;
}

.element-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.87rem;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.element-bar-track {
  height: 11px;
  background: var(--bg-secondary);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.element-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 喜用神五维徽章卡片 */
.yongshen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.yongshen-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 9px;
  padding: 0.75rem;
  text-align: center;
}

.yongshen-box .ys-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.yongshen-box .ys-val {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 0.25rem;
}

/* 大运横排选择卡 */
.dayun-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.dayun-card {
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 9px;
  padding: 0.7rem 0.5rem;
  text-align: center;
  transition: all 0.2s;
}

.dayun-card:hover,
.dayun-card.active {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);
}

.dayun-gz {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.25rem 0;
}

/* 流年 10 格矩阵 */
.liunian-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.liunian-card {
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.6rem;
  text-align: center;
  transition: all 0.18s;
}

.liunian-card:hover,
.liunian-card.active {
  border-color: var(--cinnabar-light);
  background: rgba(200, 50, 40, 0.14);
}

/* 流月 12 格、流日 30 格、流时 12 格联动矩阵 */
.liuyue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.liuyue-cell {
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.55rem 0.4rem;
  text-align: center;
  font-size: 0.82rem;
  transition: all 0.18s;
}

.liuyue-cell:hover,
.liuyue-cell.active {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.liuri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.48rem;
  margin-top: 0.75rem;
}

.liuri-cell {
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 7px;
  padding: 0.5rem 0.35rem;
  text-align: center;
  font-size: 0.8rem;
  transition: all 0.18s;
  position: relative;
}

.liuri-cell:hover,
.liuri-cell.active {
  border-color: var(--cinnabar-light);
  background: rgba(200, 50, 40, 0.15);
  transform: translateY(-1px);
}

.liuri-cell.today-cell {
  border-color: var(--el-wood);
  box-shadow: 0 0 0 1px var(--el-wood);
}

.liushi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.liushi-cell {
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.6rem 0.45rem;
  text-align: center;
  font-size: 0.82rem;
  transition: all 0.18s;
}

.liushi-cell:hover,
.liushi-cell.active {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.18);
  transform: translateY(-1px);
}

/* 古籍经典卷轴块 */
.classic-scroll {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.07), rgba(212, 175, 55, 0.02));
  border: 1px solid var(--border-gold);
  border-left: 4px solid var(--gold-primary);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.classic-quote {
  font-family: "Kaiti", "STKaiti", "Noto Serif SC", serif;
  font-size: 1.08rem;
  color: var(--gold-light);
  margin: 0.45rem 0;
  line-height: 1.75;
}

/* 画布包裹器 */
.canvas-box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* 弹窗 Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--gold-primary);
  border-radius: 12px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
}

/* 五级时空推演实时面包屑路径条 */
.drilldown-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 0.95rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, rgba(156, 107, 22, 0.11), rgba(179, 36, 26, 0.07));
  border: 1px solid var(--border-gold);
  border-radius: 9px;
  font-size: 0.84rem;
}

.crumb-pill {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  font-weight: 700;
  transition: all 0.18s;
}

.crumb-pill:hover {
  border-color: var(--gold-primary);
  background: #ffffff;
  transform: translateY(-1px);
}

.crumb-pill small {
  color: var(--gold-primary);
  font-weight: 700;
}

.crumb-arrow {
  color: var(--gold-primary);
  font-weight: 900;
}

.drill-step-title {
  font-size: 0.86rem;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* 悬浮回顶按钮 */
.floating-top-btn {
  position: fixed;
  right: 1.5rem;
  bottom: 1.6rem;
  z-index: 120;
  cursor: pointer;
  padding: 0.58rem 0.95rem;
  border-radius: 99px;
  background: linear-gradient(135deg, #ab7819, #7e5307);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(92, 68, 28, 0.32);
  transition: all 0.22s ease;
}

.floating-top-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(92, 68, 28, 0.45);
}

/* 回顶按钮默认隐藏，滚过排盘台后才出现，避免遮挡「排盘」按钮 */
.floating-top-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}
.floating-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.floating-top-btn.visible:hover {
  transform: translateY(-3px);
}

/* 卡片标题可点击折叠 */
.card > .section-header {
  cursor: pointer;
  user-select: none;
}
.card > .section-header .section-title::after {
  content: "▾";
  font-size: 0.8em;
  margin-left: 0.35rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.card.collapsed > .section-header .section-title::after {
  transform: rotate(-90deg);
  display: inline-block;
}
.card.collapsed > :not(.section-header) {
  display: none !important;
}
.card.collapsed > .section-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
/* 排盘台本身不参与折叠 */
.input-card > .section-header {
  cursor: default;
}
.input-card > .section-header .section-title::after {
  content: none;
}

/* 防止任何内容撑破手机屏幕产生横向滚动 */
.th-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}
.rl-extra {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}
.col-w90 { width: 90px; }
.col-w120 { width: 120px; }
.col-w150 { width: 150px; }
.col-w185 { width: 185px; }

@media (max-width: 768px) {
  /* 四柱大表：紧凑排版，4 柱 + 标题列尽量一屏看全 */
  .bazi-table .row-label {
    width: 62px;
    min-width: 62px;
    font-size: 0.72rem;
    line-height: 1.35;
    padding: 0.45rem 0.25rem;
  }
  .bazi-table .row-label small {
    display: none;
  }
  .bazi-table th,
  .bazi-table td {
    padding: 0.45rem 0.25rem;
    font-size: 0.8rem;
  }
  .th-sub {
    font-size: 0.64rem;
    line-height: 1.3;
  }
  .gz-char {
    font-size: 1.45rem;
    padding: 0.2rem 0.4rem;
  }
  .gz-sub {
    font-size: 0.62rem;
    line-height: 1.25;
  }
  .gz-size {
    display: block;
  }
  .hidden-stem-list {
    gap: 0.2rem;
  }
  .hidden-stem-item {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem;
    padding: 2px 4px;
    font-size: 0.7rem;
    line-height: 1.3;
  }
  .hidden-stem-item small {
    display: none;
  }
  .shensha-wrap {
    gap: 0.2rem;
  }
  .shensha-tag {
    font-size: 0.66rem;
    padding: 1px 4px;
  }

  /* 「旺 vs 多」诊断表：手机上每个五行变成一张卡片，标签在左、内容在右 */
  .stack-table,
  .stack-table tbody,
  .stack-table tr,
  .stack-table td {
    display: block;
    width: 100%;
  }
  .stack-table {
    border: none;
  }
  .stack-table thead {
    display: none;
  }
  .stack-table tr {
    border: 1px solid var(--border-gold);
    border-radius: 10px;
    background: var(--bg-card);
    margin-bottom: 0.7rem;
    overflow: hidden;
  }
  .stack-table td {
    border: none;
    border-bottom: 1px dashed var(--border-gold);
    text-align: left !important;
    padding: 0.5rem 0.75rem !important;
    display: grid;
    grid-template-columns: 4.6rem 1fr;
    gap: 0.5rem;
    align-items: start;
    font-size: 0.84rem;
  }
  .stack-table td:last-child {
    border-bottom: none;
  }
  .stack-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
  }
  .stack-table td.stack-head {
    display: block;
    background: var(--bg-secondary);
    font-size: 1rem !important;
  }
  .stack-table td.stack-head br {
    display: none;
  }
  .stack-table td.stack-head small {
    margin-left: 0.5rem;
  }
  .stack-table td.stack-wide {
    grid-template-columns: 1fr;
  }
  .stack-table td.stack-wide::before {
    margin-bottom: 0.1rem;
  }
  .stack-table .seal-stamp {
    justify-self: start;
    white-space: normal;
    line-height: 1.4;
  }
}

/* 防止任何内容撑破手机屏幕产生横向滚动 */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.two-col-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}
.two-col-grid > *,
.form-grid > *,
.hero-verdict-grid > * {
  min-width: 0;
}
.main-nav-tabs {
  max-width: 100%;
}

/* 四维得令得地核验网格 */
.de-check-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  text-align: center;
  margin-bottom: 1rem;
}

/* 全尺寸响应式适配（平板 / 大屏手机 / 小屏手机） */
@media (max-width: 1180px) {
  .hero-verdict-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .main-nav-tabs {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  /* 手机版 Header 极简紧凑单行设计（高度仅 46px，绝不遮挡屏幕） */
  .top-header {
    padding: 0.38rem 0.75rem;
  }
  .header-inner {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }
  .brand-wrap {
    gap: 0.45rem;
    min-width: 0;
  }
  .taiji-logo {
    width: 28px;
    height: 28px;
    font-size: 0.98rem;
    border-width: 1.5px;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 1.02rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
  }
  .brand-title .seal-stamp,
  .brand-subtitle {
    display: none;
  }
  .header-actions {
    flex-shrink: 0;
  }
  #history-select {
    padding: 0.28rem 0.45rem !important;
    font-size: 0.76rem !important;
    max-width: 138px;
  }

  .main-container {
    margin: 0.75rem auto 3.5rem;
    padding: 0 0.65rem;
  }
  .card {
    padding: 0.95rem 0.88rem;
    border-radius: 10px;
    margin-bottom: 1rem;
  }
  .section-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.55rem;
    gap: 0.5rem;
  }
  .section-title {
    font-size: 1.02rem;
  }
  .span-2-col,
  .span-full-mobile {
    grid-column: 1 / -1 !important;
  }
  .inner-two-col {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .synastry-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }
  .sect-select-wrap {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .sect-select {
    width: 100%;
    font-size: 0.8rem;
  }
  .calc-submit-btn {
    width: 100%;
    justify-content: center;
  }
  .hero-verdict-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
    margin-bottom: 0.9rem;
  }
  .hero-verdict-card {
    padding: 0.68rem 0.8rem;
  }
  .hv-main {
    font-size: 0.95rem;
  }
  .main-nav-tabs {
    top: 43px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow-x: visible;
    padding: 0.38rem;
    gap: 0.35rem;
    margin-bottom: 1rem;
  }
  .nav-tab-btn {
    padding: 0.48rem 0.3rem;
    font-size: 0.8rem;
    min-width: 0;
  }
  .de-check-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .meta-grid {
    grid-template-columns: 1fr;
    padding: 0.8rem 0.85rem;
    gap: 0.5rem;
  }
  .meta-item {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  /* 手机端四柱大表首列固定，方便左右滑动比对四柱（尺寸见上方表格专用规则） */
  .bazi-table .row-label {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 6px rgba(72, 52, 25, 0.08);
  }
  .floating-top-btn {
    right: 0.9rem;
    bottom: 1rem;
    padding: 0.48rem 0.8rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 480px) {
  .hero-verdict-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }
  .form-control {
    padding: 0.48rem 0.55rem;
    font-size: 0.86rem;
  }
  .input-mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .mode-tab {
    padding: 0.42rem 0.25rem;
    font-size: 0.78rem;
    text-align: center;
  }
  .dayun-strip {
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.45rem;
  }
  .liunian-grid,
  .liuyue-grid,
  .liuri-grid,
  .liushi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.42rem;
  }
}

/* 打印优化 */
@media print {
  .top-header,
  .input-card,
  .main-nav-tabs {
    display: none !important;
  }
  .tab-panel {
    display: block !important;
    page-break-after: always;
  }
  body {
    background: #fff;
    color: #000;
  }
}
