/**
 * ============================================================
 *  问真八字排盘 — 深色古风样式  style.css
 *  布局结构对齐问真八字，配色采用深色古风
 *  主背景：深墨色  强调色：金铜色
 *  五行配色：木青 火红 土黄 金白 水蓝
 * ============================================================
 */

/* ==================== 全局重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-main: #0e1117;
  --bg-panel: #161b22;
  --bg-card: #1c2333;
  --bg-input: #0d1520;
  --bg-header: #b2955d;
  --gold: #c9a84c;
  --gold-dim: #8a7430;
  --gold-bright: #e6c860;
  --wz-gold: #b2955d;
  --border: #2d3548;
  --border-light: #3d4860;
  --text: #e0d5c1;
  --text-dim: #8b9bb4;
  --text-muted: #5a6a82;
  --wx-mu: #4ec9b0;
  --wx-huo: #f44747;
  --wx-tu: #dcb67a;
  --wx-jin: #e0e0e0;
  --wx-shui: #569cd6;
  --danger: #f44747;
  --success: #4ec9b0;
}

html, body {
  width: 100%;
  min-height: 100vh;
}

body {
  background: var(--bg-main);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "微软雅黑", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(201, 168, 76, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(78, 201, 176, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== 页面容器 ==================== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ==================== 顶部标题 ==================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  color: var(--gold);
}

.logo-title {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 24px;
  color: var(--gold);
  letter-spacing: 4px;
  text-shadow: 0 0 16px rgba(201, 168, 76, 0.3);
}

.header-subtitle {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 2px;
}

/* ==================== 表单卡片 ==================== */
.form-card {
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* 输入框 */
.form-input {
  width: 100%;
  height: 42px;
  padding: 0 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 14px;
}

.form-input:focus {
  border-color: var(--gold);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input-sm {
  width: 90px;
  height: 36px;
  margin-bottom: 0;
}

/* 下拉选择 */
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0 12px;
  height: 42px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: auto;
  appearance: auto;
}

.form-select:focus {
  border-color: var(--gold);
}

.form-select option {
  background: var(--bg-input);
  color: var(--text);
}

.form-select-sm {
  height: 36px;
  min-width: 64px;
  padding: 0 8px;
}

/* ==================== Tab 行（性别 + 历法） ==================== */
.tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.tab-group {
  display: flex;
  gap: 0;
}

/* 性别单选（保留 .gender-radio 类名供 form.js 使用） */
.gender-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 28px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
  user-select: none;
}

.gender-radio input {
  display: none;
}

.gender-radio:first-child {
  border-radius: 8px 0 0 8px;
}

.gender-radio:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.gender-radio.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  font-weight: 600;
}

/* 历法切换（保留 .cal-tab 类名供 form.js 使用） */
.cal-tab {
  padding: 8px 24px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
  user-select: none;
}

.cal-tab:first-child {
  border-radius: 8px 0 0 8px;
}

.cal-tab:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.cal-tab.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  font-weight: 600;
}

/* ==================== 日期时间行 ==================== */
.datetime-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.dt-unit {
  color: var(--text-dim);
  font-size: 13px;
}

.zhi-badge {
  color: var(--gold);
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  background: rgba(201, 168, 76, 0.06);
  margin-left: 6px;
}

/* 闰月 */
.leap-month-box {
  display: none;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  margin-left: 8px;
}

.leap-month-box input {
  cursor: pointer;
  accent-color: var(--gold);
}

/* ==================== 城市选择行 ==================== */
.city-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.city-row .form-select {
  flex: 1;
  min-width: 0;
}

/* ==================== 经纬度行 ==================== */
.lnglat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.lnglat-row .form-input-sm {
  flex: 0 0 90px;
}

/* ==================== 预览信息栏 ==================== */
.preview-bar {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 0;
  font-size: 13px;
}

.preview-label {
  color: var(--text-dim);
  white-space: nowrap;
}

.preview-value {
  color: var(--gold-bright);
  font-family: "Consolas", "Courier New", monospace;
}

.preview-diff {
  color: var(--gold);
  font-size: 12px;
  margin-left: 4px;
}

/* ==================== 按钮 ==================== */
.btn-paipan {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 30px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 4px;
  margin-bottom: 10px;
}

.btn-paipan:hover {
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.4);
  transform: translateY(-1px);
}

.btn-paipan:active {
  transform: translateY(0);
}

.btn-clear {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 4px;
}

.btn-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ==================== 四柱反查按钮 ==================== */
.btn-reverse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  margin-top: 14px;
  border: 1px dashed var(--gold-dim);
  border-radius: 30px;
  background: rgba(201, 168, 76, 0.04);
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  position: relative;
}

.btn-reverse:hover {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.btn-reverse .reverse-icon {
  font-size: 14px;
}

.btn-reverse .reverse-text {
  font-weight: 700;
  letter-spacing: 2px;
}

.btn-reverse .reverse-hint {
  position: absolute;
  right: 16px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* 错误提示 */
.error-box {
  display: none;
  background: rgba(244, 71, 71, 0.1);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}

/* ==================== 排盘结果区域 ==================== */
.result-area {
  display: none;
  margin-top: 28px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.result-area.show {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* ==================== 信息头卡片 ==================== */
.result-header-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 24px 30px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

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

.result-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: "STKaiti", "KaiTi", serif;
}

.result-gender {
  font-size: 13px;
  color: var(--gold);
  padding: 2px 12px;
  border: 1px solid var(--gold);
  border-radius: 12px;
}

.result-header-info {
  flex: 1;
  max-width: 500px;
  font-size: 13px;
  color: var(--text-dim);
}

.info-row {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-row .info-label {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 60px;
}

.info-row .info-value {
  color: var(--text);
}

.info-row .time-diff {
  color: var(--gold);
  font-size: 12px;
}

/* ==================== 结果卡片 ==================== */
.result-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 24px 30px;
  margin-bottom: 16px;
}

.result-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "STKaiti", "KaiTi", serif;
  letter-spacing: 2px;
}

.result-card-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
}

/* ==================== 四柱命盘表（CSS Grid） ==================== */
.bazi-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bazi-table {
  display: grid;
  grid-template-columns: 60px repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 480px;
}

.bazi-cell {
  background: var(--bg-card);
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

/* 表头：年柱/月柱/日柱/时柱 */
.bazi-cell.col-header {
  background: var(--wz-gold);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 4px;
  letter-spacing: 2px;
}

/* 行标签 */
.bazi-cell.row-label {
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
}

/* 十神 */
.bazi-cell.shishen-cell {
  font-size: 13px;
  color: var(--gold-bright);
  font-weight: 500;
}

/* 天干地支大字 */
.bazi-cell.gan-cell,
.bazi-cell.zhi-cell {
  font-size: 30px;
  font-weight: 700;
  padding: 12px 4px;
  line-height: 1.2;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
}

/* 藏干 */
.bazi-cell.hidegan-cell {
  font-size: 15px;
  letter-spacing: 3px;
}

.bazi-cell.hidegan-cell span {
  display: inline-block;
  margin: 0 1px;
}

/* 藏干十神 */
.bazi-cell.hideshishen-cell {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* 纳音 */
.bazi-cell.nayin-cell {
  font-size: 12px;
  color: var(--text-dim);
}

/* 神煞 */
.bazi-cell.shensha-cell {
  font-size: 11px;
  color: var(--gold);
  line-height: 1.6;
  padding: 6px 4px;
  flex-direction: column;
  gap: 2px;
}

/* 空亡 */
.bazi-cell.xunkong-cell {
  font-size: 12px;
  color: var(--text-dim);
}

/* 长生/地势 */
.bazi-cell.changsheng-cell {
  font-size: 12px;
  color: var(--success);
}

/* ==================== 五行颜色类 ==================== */
.wx-木 { color: var(--wx-mu) !important; }
.wx-火 { color: var(--wx-huo) !important; }
.wx-土 { color: var(--wx-tu) !important; }
.wx-金 { color: var(--wx-jin) !important; }
.wx-水 { color: var(--wx-shui) !important; }

/* ==================== 五行统计 ==================== */
.wuxing-section {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.wuxing-bar-chart {
  flex: 1;
  min-width: 300px;
}

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

.wuxing-bar-label {
  width: 28px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  font-family: "STKaiti", "KaiTi", serif;
}

.wuxing-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.wuxing-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.wuxing-value {
  width: 40px;
  text-align: right;
  font-family: "Consolas", monospace;
  font-size: 13px;
  color: var(--text);
}

.day-marker {
  font-size: 10px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
}

.wuxing-summary {
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wx-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.wx-summary-item .label {
  color: var(--text-dim);
}

.wx-summary-item .value {
  font-weight: 600;
  color: var(--text);
}

/* ==================== 大运流年 ==================== */
.dayun-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dayun-scroll::-webkit-scrollbar {
  height: 6px;
}

.dayun-scroll::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.dayun-row {
  display: flex;
  gap: 0;
}

.dayun-cell {
  flex: 1;
  min-width: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.dayun-cell:last-child {
  border-right: 1px solid var(--border);
}

.dayun-cell.row-header {
  background: var(--bg-input);
  color: var(--text-dim);
  font-weight: 500;
  min-width: 70px;
  position: sticky;
  left: 0;
  z-index: 2;
}

.dayun-cell.ganzhi-cell {
  font-size: 20px;
  font-weight: 700;
  padding: 10px 6px;
  font-family: "STKaiti", "KaiTi", serif;
}

.dayun-cell.ganzhi-cell span {
  display: inline-block;
  margin: 0 1px;
}

.dayun-cell .age {
  color: var(--text-muted);
  font-size: 11px;
}

.dayun-cell .year {
  color: var(--text-muted);
  font-size: 11px;
}

.dayun-cell.current {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold);
}

.dayun-cell .liunian {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.6;
  letter-spacing: 1px;
}

.dayun-cell .liunian span {
  display: inline-block;
  margin: 0 1px;
}

/* ==================== 胎元命宫 ==================== */
.aux-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.aux-item {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 16px 12px;
  background: var(--bg-input);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.aux-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.aux-ganzhi {
  font-size: 24px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", serif;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.aux-ganzhi span {
  text-shadow: 0 0 8px currentColor;
}

.aux-nayin {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ==================== 通用 ==================== */
.muted {
  color: var(--text-muted);
}

/* ==================== 主Tab切换：公历｜农历 ==================== */
.main-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 30px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}

.main-tab {
  flex: 1;
  text-align: center;
  padding: 11px 18px;
  font-size: 15px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 24px;
  transition: all 0.25s;
  font-weight: 500;
  user-select: none;
  letter-spacing: 3px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
}

.main-tab:hover {
  color: var(--text);
}

.main-tab.active {
  background: var(--gold);
  color: #1a1a2e;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(201, 168, 76, 0.35);
}

/* ==================== 四柱反查触发按钮 ==================== */
.btn-reverse-trigger {
  padding: 8px 18px;
  font-size: 14px;
  color: var(--gold);
  background: transparent;
  border: 1px dashed var(--gold-dim);
  border-radius: 24px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 2px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-weight: 600;
  transition: all 0.2s;
  user-select: none;
}

.btn-reverse-trigger:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold);
  border-style: solid;
  color: var(--gold-bright);
}

.btn-reverse-trigger:active {
  transform: scale(0.96);
}

/* ==================== 四柱反查 Modal 弹窗 ==================== */
.rs-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
  overflow-y: auto;
  animation: rsFadeIn 0.2s ease;
}

@keyframes rsFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.rs-modal-card {
  width: 480px;
  max-width: calc(100vw - 24px);
  background: var(--bg-panel);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  padding: 22px 22px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6),
              0 0 24px rgba(201, 168, 76, 0.1);
  animation: rsSlideIn 0.25s ease;
}

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

/* ==================== 四柱反查面板 ==================== */

/* 顶部标题+关闭 */
.rs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.rs-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
}

.rs-header-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.rs-header-close:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(244, 71, 71, 0.08);
}

/* 4个柱子容器（年柱/月柱/日柱/时柱） */
.rs-pillars-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 12px;
}

.rs-pillar-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: border-color 0.2s;
}

.rs-pillar-box:hover {
  border-color: var(--gold-dim);
}

.rs-pillar-label {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 3px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-weight: 700;
}

.rs-pillar-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 干 / 支 触发器（大字号、可点击） */
.rs-pillar-gan,
.rs-pillar-zhi {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  line-height: 1;
}

.rs-pillar-gan:hover,
.rs-pillar-zhi:hover {
  background: rgba(201, 168, 76, 0.14);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.18);
}

.rs-pillar-gan:active,
.rs-pillar-zhi:active {
  transform: translateY(0);
}

/* 五行配色（按干支所在五行着色） */
.rs-pillar-gan[data-wx="木"],
.rs-pillar-zhi[data-wx="木"] { color: var(--wx-mu); }
.rs-pillar-gan[data-wx="火"],
.rs-pillar-zhi[data-wx="火"] { color: var(--wx-huo); }
.rs-pillar-gan[data-wx="土"],
.rs-pillar-zhi[data-wx="土"] { color: var(--wx-tu); }
.rs-pillar-gan[data-wx="金"],
.rs-pillar-zhi[data-wx="金"] { color: var(--wx-jin); }
.rs-pillar-gan[data-wx="水"],
.rs-pillar-zhi[data-wx="水"] { color: var(--wx-shui); }

/* popover 触发器高亮（被点击打开popover时） */
.rs-pillar-gan.active-cell,
.rs-pillar-zhi.active-cell {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.18);
  box-shadow: 0 0 0 1.5px var(--gold),
              0 4px 16px rgba(201, 168, 76, 0.35);
}

/* 初始值灰色占位（用户未选择前） */
.rs-pillar-gan.placeholder,
.rs-pillar-zhi.placeholder {
  color: var(--text-muted) !important;
  opacity: 0.5;
}

/* 操作提示 */
.rs-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 18px;
  letter-spacing: 1px;
}
.rs-tip b {
  color: var(--gold);
  font-weight: 700;
}

/* ==================== 天干/地支 popover ==================== */
.rs-popover {
  position: absolute;
  background: var(--bg-panel);
  border: 1.5px solid var(--gold-dim);
  border-radius: 12px;
  padding: 14px 18px 16px;
  z-index: 2000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55),
              0 0 18px rgba(201, 168, 76, 0.12);
  min-width: 240px;
}

.rs-pop-title {
  text-align: center;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 3px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
}

.rs-pop-grid {
  display: grid;
  gap: 10px;
  justify-items: center;
}

/* 5列（天干） / 4列（地支） */
.rs-pop-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.rs-pop-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.rs-pop-cell {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  line-height: 1;
}

.rs-pop-cell:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: var(--gold);
  transform: scale(1.08);
  color: var(--text) !important;
}

.rs-pop-cell.selected {
  background: var(--gold);
  border-color: var(--gold-bright);
  color: #1a1a2e !important;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(201, 168, 76, 0.5);
}

/* popover内的五行着色（未选中态） */
.rs-pop-cell[data-wx="木"] { color: var(--wx-mu); }
.rs-pop-cell[data-wx="火"] { color: var(--wx-huo); }
.rs-pop-cell[data-wx="土"] { color: var(--wx-tu); }
.rs-pop-cell[data-wx="金"] { color: var(--wx-jin); }
.rs-pop-cell[data-wx="水"] { color: var(--wx-shui); }

/* popover箭头（小三角） */
.rs-pop-arrow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  background: var(--bg-panel);
  border-right: 1.5px solid var(--gold-dim);
  border-bottom: 1.5px solid var(--gold-dim);
  border-radius: 0 0 4px 0;
}

.rs-pop-arrow.top {
  bottom: auto;
  top: -8px;
  border-right: none;
  border-bottom: none;
  border-left: 1.5px solid var(--gold-dim);
  border-top: 1.5px solid var(--gold-dim);
  border-radius: 4px 0 0 0;
}

/* 性别 行 */
.rs-gender-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

/* 查询范围 行（参考图：胶囊容器，左右内缩） */
.rs-range-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 0 28px;
}

.rs-range-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(201, 168, 76, 0.06);
  border: 1.5px solid var(--gold-dim);
  border-radius: 22px;
  padding: 6px 14px 6px 14px;
  flex: 1;
  max-width: 280px;
  min-width: 200px;
}

.rs-range-dash {
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  padding: 0 2px;
  flex-shrink: 0;
}

.rs-range-unit {
  color: var(--text-dim);
  font-size: 13px;
  flex-shrink: 0;
}

.rs-option-label {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: 1px;
}

.rs-year-input {
  width: 78px !important;
  min-width: 78px;
  max-width: 78px;
  text-align: center;
  font-family: "Consolas", monospace;
  font-size: 14px;
  padding: 6px 4px;
  flex-shrink: 0;
  flex-grow: 1;
  margin-bottom: 0;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text);
}
.rs-year-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.rs-year-input::-webkit-outer-spin-button,
.rs-year-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rs-year-input[type=number] {
  -moz-appearance: textfield;
}

/* 反查中的性别选择 */
#rs-gender-tabs .gender-radio {
  padding: 6px 16px;
  font-size: 13px;
}

/* 查找范围提示 */
.rs-range-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 18px;
  letter-spacing: 1px;
}

/* 大黑色"确定"按钮 */
.rs-confirm-btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 30px;
  background: #1a1a2e;
  color: var(--gold);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 10px;
  text-indent: 10px;
  transition: all 0.2s;
  box-shadow: inset 0 0 0 1.5px var(--gold-dim),
              0 2px 12px rgba(0, 0, 0, 0.4);
}

.rs-confirm-btn:hover {
  background: var(--gold);
  color: #1a1a2e;
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.5),
              0 4px 14px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.rs-confirm-btn:active {
  transform: translateY(0);
}

.rs-confirm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 状态提示 */
.rs-status {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  min-height: 20px;
  color: var(--text-dim);
}

.rs-status.searching { color: var(--gold); }
.rs-status.error     { color: var(--danger); }
.rs-status.success   { color: var(--success); }

/* 反查spinner */
.rs-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: rs-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes rs-spin { to { transform: rotate(360deg); } }

/* ==================== 反查结果列表 ==================== */
.rs-result-summary {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.rs-result-summary strong {
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
}

.rs-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: all 0.15s;
  cursor: pointer;
}

.rs-result-item:hover {
  border-color: var(--gold-dim);
  background: rgba(201, 168, 76, 0.05);
}

.rs-result-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.rs-result-item-date {
  font-family: "Consolas", monospace;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.rs-result-item-lunar {
  font-size: 12px;
  color: var(--text-dim);
}

.rs-result-item-zhi {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  margin-left: 6px;
}

.rs-result-item-zhi.night-zi {
  color: var(--wx-shui);
  border-color: var(--wx-shui);
}

.rs-result-item-use {
  background: var(--gold);
  color: #1a1a2e;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  margin-left: 12px;
}

.rs-result-item-use:hover {
  background: var(--gold-bright);
  transform: scale(1.04);
}

.rs-result-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.rs-result-empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.4;
}

/* ==================== 反查结果选择 Modal ==================== */
/* ==================== 排盘结果 Modal（点击排盘后弹出新页面） ==================== */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  animation: rs-fade-in 0.2s ease-out;
  padding: 16px;
}

.result-overlay[style*="display: flex"] {
  display: flex;
}

.result-modal-card {
  width: 760px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  background: var(--bg-panel);
  border: 1.5px solid var(--gold-dim);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
              0 0 24px rgba(201, 168, 76, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rs-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-modal-body {
  padding: 4px 22px 22px;
  overflow-y: auto;
}

.rs-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  animation: rs-fade-in 0.2s ease-out;
  padding: 16px;
}

.rs-result-overlay[style*="display: flex"],
.rs-result-overlay.show {
  display: flex;
}

.rs-result-card {
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  background: var(--bg-panel);
  border: 1.5px solid var(--gold-dim);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
              0 0 24px rgba(201, 168, 76, 0.15);
  animation: rs-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.rs-result-count {
  font-size: 12px;
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid var(--gold-dim);
  letter-spacing: 1px;
  white-space: nowrap;
}

.rs-result-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
  letter-spacing: 1px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.rs-result-list {
  flex: 1;
  overflow-y: auto;
  max-height: 50vh;
  padding-right: 4px;
  margin-bottom: 12px;
}

/* 列表项 - 紧凑卡片 */
.rs-result-list .rs-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: all 0.15s;
  cursor: pointer;
  gap: 10px;
}

.rs-result-list .rs-result-item:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  transform: translateX(2px);
}

.rs-result-list .rs-result-item:active {
  transform: scale(0.99);
}

.rs-result-back {
  width: 100%;
  margin-top: 6px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .app-container {
    padding: 0 10px 40px;
  }

  .form-card {
    padding: 20px 16px;
  }

  .logo-title {
    font-size: 20px;
  }

  .tabs-row {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .tab-group {
    justify-content: center;
  }

  .gender-radio, .cal-tab {
    flex: 1;
    text-align: center;
  }

  .datetime-row {
    flex-wrap: wrap;
  }

  .form-select {
    min-width: 60px;
  }

  .city-row {
    flex-direction: column;
  }

  .bazi-table {
    grid-template-columns: 50px repeat(4, 1fr);
    min-width: 360px;
  }

  .bazi-cell.gan-cell,
  .bazi-cell.zhi-cell {
    font-size: 24px;
  }

  .result-header-card {
    flex-direction: column;
  }

  .result-header-info {
    max-width: 100%;
  }

  .wuxing-section {
    flex-direction: column;
  }

  .wuxing-summary {
    width: 100%;
  }

  .aux-grid {
    flex-direction: column;
  }

  /* 反查表单响应式：始终保持 4 列横排，只缩尺寸 */
  .rs-modal-overlay {
    padding-top: 16px;
  }

  .rs-modal-card {
    padding: 18px 16px;
  }

  .btn-reverse-trigger {
    padding: 6px 12px;
    font-size: 13px;
  }

  .rs-pillars-wrap {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .rs-pillar-box {
    padding: 10px 4px;
    gap: 8px;
  }

  .rs-pillar-gan,
  .rs-pillar-zhi {
    width: 48px;
    height: 48px;
    font-size: 28px;
    border-radius: 8px;
  }

  .rs-pop-cell {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .rs-gender-row {
    gap: 10px;
    margin: 12px 0 10px;
  }

  .rs-range-row {
    padding: 0 8px;
    gap: 8px;
  }

  .rs-range-pill {
    padding: 4px 10px;
    max-width: 100%;
    min-width: 0;
  }

  .rs-year-input {
    width: 64px !important;
    min-width: 64px;
    max-width: 100%;
    font-size: 13px;
    padding: 4px 2px;
    height: 28px;
  }

  .rs-range-dash,
  .rs-range-unit {
    font-size: 12px;
  }

  .rs-result-card {
    padding: 18px 16px;
    max-height: calc(100vh - 32px);
  }

  .rs-result-list {
    max-height: 55vh;
  }

  .rs-result-list .rs-result-item {
    padding: 8px 10px;
    font-size: 12px;
    gap: 8px;
  }

  .rs-result-list .rs-result-item-date {
    font-size: 13px;
  }

  .rs-result-list .rs-result-item-lunar {
    font-size: 11px;
  }

  .rs-result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .rs-result-item-use {
    margin-left: 0;
    align-self: flex-end;
  }
}


/* ==================== 主布局：左右两栏 ==================== */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.left-col {
  min-width: 0;       /* 防止 grid 列被内容撑开 */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-col {
  min-width: 0;
  position: sticky;
  top: 16px;
}

/* 主Tab 移到左栏内后，重新居左 */
.left-col .main-tabs {
  justify-content: flex-start;
}

.left-col .main-tab {
  min-width: 80px;
}

/* 区块标题（与右栏"今日黄历"对应：左侧金色竖条 + 标题） */
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
  padding-left: 12px;
  margin-top: -4px;
}

.section-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--gold);
  border-radius: 2px;
}

.section-title {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 3px;
  font-weight: 600;
}

/* 表单卡片宽度调整：左栏允许更宽，所以取消原本的 max-width:520px 限制 */
.left-col .form-card {
  max-width: none;
}


/* ==================== 今日黄历面板 ==================== */
.huangli-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 18px 20px 22px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* 顶部标题（带左侧金色竖条） */
.hl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
  padding-left: 12px;
}

/* 日期切换按钮组 */
.hl-nav {
  display: flex;
  gap: 4px;
  padding-right: 2px;
}

.hl-nav-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--gold);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.hl-nav-btn:hover {
  background: var(--gold);
  color: #1a1a1a;
}

.hl-today-btn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

.hl-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--gold);
  border-radius: 2px;
}

.hl-title {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 3px;
  font-weight: 600;
}

/* 公历日期 */
.hl-solar-date {
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

/* 三栏主区域：左侧生肖星座 + 中间大字日 + 右侧干支年月 */
.hl-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 0 18px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

.hl-hero-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.hl-hero-left {
  text-align: right;
  padding-right: 4px;
}

.hl-hero-right {
  text-align: left;
  padding-left: 4px;
}

.hl-shengxiao,
.hl-xingzuo {
  color: var(--text);
}

.hl-shengxiao {
  font-weight: 600;
  color: var(--gold);
}

.hl-xingzuo {
  font-size: 12px;
  color: var(--text-dim);
}

.hl-gz-line {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 14px;
  color: var(--text);
}

/* 中间大字"日" + 两侧椭圆装饰 */
.hl-hero-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  position: relative;
}

/* 左侧椭圆装饰 */
.hl-hero-center::before,
.hl-hero-center::after {
  content: '';
  width: 14px;
  height: 78px;
  background: #000;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.hl-hero-center::before {
  left: 0px;
}

.hl-hero-center::after {
  right: 0px;
}

.hl-day {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 56px;
  line-height: 1;
  color: var(--danger);
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(244, 71, 71, 0.2);
  position: relative;
  z-index: 1;
}

/* 农历日期 */
.hl-lunar {
  text-align: center;
  font-size: 14px;
  color: var(--text);
  margin-top: 14px;
  margin-bottom: 8px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  letter-spacing: 2px;
}

/* 节气 / 节日 标记 */
.hl-meta {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.hl-jieqi,
.hl-festival {
  display: inline-block;
  font-size: 12px;
  color: var(--gold);
  padding: 3px 10px;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  background: rgba(201, 168, 76, 0.06);
  letter-spacing: 1px;
}

/* 宜 / 忌 块 */
.hl-yiji-block {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.hl-yi-block {
  background: rgba(244, 71, 71, 0.06); /* 宜 = 红底 */
  border: 1px solid rgba(244, 71, 71, 0.2);
}

.hl-ji-block {
  background: rgba(86, 156, 214, 0.06); /* 忌 = 蓝底 */
  border: 1px solid rgba(86, 156, 214, 0.2);
}

/* 广告位（黄历下方占位，可换成实际图片） */
.ad-banner {
  margin-top: 16px;
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: 15px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}

.ad-banner:hover {
  border-color: var(--gold-dim);
}

.ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ad-placeholder {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 4px;
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.hl-yiji-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.hl-yi-block .hl-yiji-icon {
  background: var(--danger);
}

.hl-ji-block .hl-yiji-icon {
  background: var(--wx-shui);
}

.hl-yiji-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  letter-spacing: 1px;
  word-spacing: 2px;
}


/* ==================== 响应式：小屏切换为单列 ==================== */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .right-col {
    position: static;
  }

  .huangli-panel {
    max-width: 500px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .huangli-panel {
    padding: 16px;
  }

  .hl-day {
    font-size: 42px;
  }

  .hl-shengxiao,
  .hl-xingzuo,
  .hl-gz-line {
    font-size: 12px;
  }

  .left-col .form-card {
    padding: 20px;
  }
}

/* ==================== paipan / xipan 新版布局（v2） ==================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: #0a0a0a;
}

/* 左侧导航栏 */
.sidebar-nav {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 200px;
  background: #141414;
  border-right: 1px solid #2d3548;
  padding-top: 18px;
  z-index: 20;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 18px;
  border-bottom: 1px solid #2d3548;
}
.logo-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #C9A84C;
  background: radial-gradient(circle, rgba(201,168,76,0.25), transparent);
}
.sidebar-logo-text { color: #C9A84C; font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.sidebar-list { list-style: none; margin: 12px 0 0; padding: 0; }
.sidebar-item a {
  display: block;
  padding: 14px 20px;
  color: #c7d0e0;
  font-size: 14px;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-item a:hover { background: rgba(201,168,76,0.06); color: #fff; }
.sidebar-item.active a {
  color: #C9A84C;
  border-left-color: #C9A84C;
  background: rgba(201,168,76,0.08);
  font-weight: 600;
}

/* 主内容区 */
.main-content { margin-left: 200px; flex: 1; min-width: 0; padding: 0 24px 32px; }

/* 顶部 header */
.page-header {
  height: 60px;
  background: #0a0a0a;
  border-bottom: 1px solid #2d3548;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  margin: 0 -24px 20px;
  position: sticky; top: 0; z-index: 10;
}
.ph-left { display: flex; align-items: center; gap: 14px; }
.ph-logo {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #C9A84C;
  background: radial-gradient(circle, rgba(201,168,76,0.3), transparent);
}
.ph-case { color: #C9A84C; font-size: 18px; font-weight: 700; font-family: KaiTi, STKaiti, serif; }
.ph-cal { display: flex; flex-direction: column; line-height: 1.4; }
.ph-lunar { font-size: 14px; color: #e0d5c1; }
.ph-solar { font-size: 13px; color: #8b9bb4; }
.ph-right { display: flex; align-items: center; gap: 14px; }
.ph-btn {
  border: 1px solid #C9A84C;
  color: #C9A84C;
  background: transparent;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
}
.ph-btn:hover { background: rgba(201,168,76,0.1); }

/* 内容栅格 */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}
.right-col { position: sticky; top: 84px; }

/* 命盘表（11 行 × 5/7 列） */
.bazi-table {
  display: grid;
  gap: 1px;
  background: #2d3548;
  border: 1px solid #2d3548;
  border-radius: 10px;
  overflow: hidden;
}
.bazi-cell {
  background: #1c2333;
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  color: #d7deea;
}
.bazi-cell.col-header {
  background: #b2955d;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  font-family: KaiTi, STKaiti, serif;
  padding: 10px 4px;
}
.bazi-cell.row-label {
  background: #161d2b;
  color: #8b9bb4;
  text-align: left;
  padding-left: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.bazi-cell.gan-cell, .bazi-cell.zhi-cell { font-size: 26px; font-weight: 700; font-family: KaiTi, STKaiti, serif; }
.bazi-cell.shishen-cell { color: #e6c860; font-size: 13px; }
.bazi-cell.hidegan-cell { font-size: 15px; font-family: KaiTi, STKaiti, serif; letter-spacing: 2px; }
.bazi-cell.hideshishen-cell { color: #5a6a82; font-size: 11px; }
.bazi-cell.xingyun-cell, .bazi-cell.zizuo-cell { color: #4ec9b0; font-size: 12px; }
.bazi-cell.xunkong-cell, .bazi-cell.nayin-cell { color: #8b9bb4; font-size: 12px; }
.bazi-cell.shensha-cell { color: #C9A84C; font-size: 11px; line-height: 1.6; }
.bazi-cell.date-cell { color: #8b9bb4; font-size: 12px; }
.bazi-cell .muted { color: #5a6a82; }

/* 古籍参考面板 */
.guji-panel {
  background: #1c2333;
  border: 1px solid #2d3548;
  border-radius: 15px;
  padding: 22px;
}
.guji-title {
  font-size: 18px; font-weight: 600; font-family: KaiTi, STKaiti, serif;
  color: #C9A84C;
  border-left: 4px solid #C9A84C;
  padding-left: 10px;
  margin-bottom: 16px;
}
.guji-tabs {
  display: flex; gap: 14px; overflow-x: auto;
  border-bottom: 1px solid #2d3548;
  padding-bottom: 8px; margin-bottom: 14px;
}
.guji-tab { font-size: 13px; color: #8b9bb4; cursor: pointer; white-space: nowrap; padding: 4px 2px; }
.guji-tab.active { color: #C9A84C; font-weight: 700; border-bottom: 2px solid #C9A84C; }
.guji-label { font-size: 13px; color: #8b9bb4; }
.guji-tiaohou { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-tags { display: inline-flex; gap: 6px; }
.th-tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px;
  border: 1px solid #C9A84C; color: #C9A84C; border-radius: 6px; font-size: 13px;
}
.guji-bazi { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: #c7d0e0; }
.bazi-checks { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.bazi-check { font-size: 12px; color: #8b9bb4; }
.info-icon { color: #C9A84C; cursor: help; }
.guji-lunming {
  display: inline-block;
  background: rgba(201,168,76,0.12);
  border: 1px solid #C9A84C;
  color: #C9A84C;
  font-size: 12px; padding: 4px 10px; border-radius: 12px;
  margin-bottom: 12px;
}
.guji-body { font-size: 14px; line-height: 1.8; color: #e0d5c1; max-height: calc(100vh - 320px); overflow-y: auto; }
.guji-body p { text-indent: 2em; margin: 0 0 12px; }
.guji-placeholder { color: #8b9bb4; text-indent: 0 !important; }

/* 专业细盘右栏 */
.xipan-meta { font-size: 12px; color: #8b9bb4; margin-bottom: 14px; line-height: 1.9; }
.xp-card {
  background: #1c2333; border: 1px solid #2d3548;
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.xp-card-title { font-size: 15px; font-weight: 600; color: #C9A84C; margin-bottom: 10px; font-family: KaiTi, STKaiti, serif; }
.xp-scroll { overflow-x: auto; }
.xp-row { display: flex; min-width: max-content; }
.xp-cell {
  flex: 0 0 auto; min-width: 64px; padding: 8px 6px; text-align: center;
  border: 1px solid #2d3548; margin: -0.5px;
  font-size: 13px; color: #d7deea; font-family: KaiTi, STKaiti, serif;
}
.xp-cell.xp-head { background: #161d2b; color: #8b9bb4; font-size: 12px; min-width: 56px; }
.xp-cell.xp-col-head { background: #232c3d; font-size: 12px; color: #c7d0e0; }
.xp-cell.current { background: rgba(201,168,76,0.12); border-color: #C9A84C; }

/* 五行能量条（旺相休囚死） */
.wx-bar-row { display: flex; gap: 8px; flex-wrap: wrap; }
.wx-bar-item {
  flex: 1; min-width: 48px; text-align: center;
  padding: 8px 4px; border-radius: 8px;
  background: #161d2b; border: 1px solid #2d3548;
  font-size: 13px; color: #8b9bb4;
}
.wx-bar-item.active { background: rgba(201,168,76,0.14); border-color: #C9A84C; font-weight: 700; }

/* 响应式 */
@media (max-width: 1080px) {
  .content-grid { grid-template-columns: 1fr; }
  .right-col { position: static; }
}
@media (max-width: 768px) {
  .sidebar-nav { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .main-content { padding: 0 12px 24px; }
  .page-header { margin: 0 -12px 16px; padding: 0 12px; }
  .bazi-cell.gan-cell, .bazi-cell.zhi-cell { font-size: 20px; }
}

/* ============================================================
 *  v3.1 视觉规格 —— cell 多层 + 古籍参考右栏 + 底部总结区
 *  保留深色皮肤（#1c2333 表格底 + #141414 侧栏 + 黑底 header）
 * ============================================================ */

/* ---------- header "+" 按钮 ---------- */
.ph-icon-btn {
  width: 32px; height: 32px;
  border: 1px solid #C9A84C;
  color: #C9A84C;
  background: transparent;
  border-radius: 50%;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  font-family: inherit;
  transition: background 0.15s;
}
.ph-icon-btn:hover { background: rgba(201,168,76,0.12); }

/* ---------- cell 多层布局（bci-wrap 容器） ---------- */
.bazi-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 60px;
}
.bazi-cell.row-label {
  justify-content: flex-start;
  padding: 10px 12px;
  font-size: 13px;
  color: #8b9bb4;
  background: #161d2b;
  font-weight: 500;
  letter-spacing: 1px;
  white-space: nowrap;
}
.bazi-cell.col-header {
  background: linear-gradient(180deg, #b2955d, #a08545);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  font-family: KaiTi, STKaiti, serif;
  padding: 10px 4px;
  letter-spacing: 4px;
  min-height: 40px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

/* 嵌套 wrap：垂直 flex column，corner absolute top-right */
.bci-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 16px 4px 8px;
  gap: 2px;
}
.bci-wrap > .bc-main { flex-shrink: 0; }
.bci-wrap > .bc-lines { flex: 1; }

/* 右上角附注（绝对定位） */
.bc-corner {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--gold);
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 0.5px;
  pointer-events: none;
  white-space: nowrap;
}
.bc-corner .wx-nm {
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
}
.bc-corner .wx-ss {
  color: #8b9bb4;
  font-size: 10px;
}
.bc-corner .bc-row-tag {
  font-size: 9px;
  padding: 2px 5px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.28);
  border-radius: 8px;
  color: #C9A84C;
  font-family: inherit;
  letter-spacing: 1px;
}

/* 主元素：垂直居中 */
.bc-main {
  font-family: KaiTi, STKaiti, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  margin: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 28px;
}
.bc-main .bc-shishen-main {
  font-size: 16px;
  color: #e6c860;
  font-family: KaiTi, STKaiti, serif;
}
.bc-main .bc-cy-name {
  font-size: 18px;
  color: #4ec9b0;
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 2px;
}
.bc-main .bc-ny-name {
  font-size: 16px;
  color: #C9A84C;
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 2px;
}
.bc-main .bc-main-text {
  font-size: 12px;
  color: #8b9bb4;
  font-family: inherit;
}

/* 副元素（小字） */
.bc-sub {
  font-size: 10px;
  color: #5a6a82;
  margin-top: auto;
  font-family: Consolas, monospace;
  letter-spacing: 1px;
}

/* 多行容器（藏干 / 副星 / 神煞） */
.bc-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: stretch;
  width: 100%;
  padding: 14px 6px 6px;
}
.bc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 1px 0;
  line-height: 1.2;
}
.bc-line-label {
  font-family: KaiTi, STKaiti, serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}
.bc-line-value {
  font-size: 11px;
  color: #8b9bb4;
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 1px;
}
.bc-line-value .bc-shishen-mini {
  color: #5a6a82;
  font-size: 11px;
}
.bc-line-value .bc-ss-line {
  color: #C9A84C;
  font-size: 10px;
  letter-spacing: 0.5px;
  display: block;
  text-align: right;
  line-height: 1.5;
}

/* cell 空状态居中 */
.bc-empty {
  font-size: 11px;
  color: #5a6a82;
  margin: auto 0;
  letter-spacing: 1px;
}

/* 各种 cell 类型仍可挂原颜色 token（兼容 JS 中 wx-* 类） */
.bazi-cell .wx-木 { color: #4ec9b0; }
.bazi-cell .wx-火 { color: #f44747; }
.bazi-cell .wx-土 { color: #dcb67a; }
.bazi-cell .wx-金 { color: #e0e0e0; }
.bazi-cell .wx-水 { color: #569cd6; }

/* 兼容老 style.css 里的 wx-类挂在外层 cell 的场景 */
.bazi-cell.shishen-cell .bci-wrap .bc-main { color: #e6c860; }
.bazi-cell.shensha-cell .bci-wrap .bc-lines .bc-ss-line { color: #C9A84C; }

/* ---------- 古籍参考面板：标题 + +按钮（横排） ---------- */
.guji-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  position: relative;
  padding-left: 12px;
}
.guji-panel-head::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 4px;
  background: var(--gold);
  border-radius: 2px;
}
.guji-panel-head .guji-title {
  margin: 0;
  border-left: none;
  padding-left: 0;
}
.guji-add-btn {
  width: 26px; height: 26px;
  border: 1px solid #C9A84C;
  color: #C9A84C;
  background: transparent;
  border-radius: 50%;
  font-size: 16px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  font-family: inherit;
  transition: all 0.15s;
}
.guji-add-btn:hover {
  background: rgba(201,168,76,0.14);
  transform: scale(1.06);
}

/* "本八字" 行小调整 */
.guji-bazi {
  margin-bottom: 14px;
}

/* ---------- 底部总结区 ---------- */
.bottom-summary {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 2px;
}
.summary-section {
  background: #1c2333;
  border: 1px solid #2d3548;
  border-radius: 12px;
  padding: 14px 18px;
}
.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.8;
  color: #c7d0e0;
}
.summary-row + .summary-row {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #2d3548;
}
.summary-label {
  flex-shrink: 0;
  width: 76px;
  font-size: 13px;
  color: #C9A84C;
  letter-spacing: 1px;
  font-weight: 600;
}
.summary-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.rel-none {
  color: #8b9bb4;
  font-size: 13px;
}
.rel-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 12px;
  letter-spacing: 1px;
  font-family: KaiTi, STKaiti, serif;
}
.rel-tag-he     { background: rgba(78,201,176,0.12); color: #4ec9b0; border: 1px solid rgba(78,201,176,0.4); }
.rel-tag-chong  { background: rgba(244,71,71,0.10);  color: #f44747; border: 1px solid rgba(244,71,71,0.4); }
.rel-tag-六合,
.rel-tag-三合   { background: rgba(86,156,214,0.12); color: #569cd6; border: 1px solid rgba(86,156,214,0.4); }
.rel-tag-六冲   { background: rgba(244,71,71,0.10);  color: #f44747; border: 1px solid rgba(244,71,71,0.4); }
.rel-tag-六害,
.rel-tag-三刑   { background: rgba(220,182,122,0.14); color: #dcb67a; border: 1px solid rgba(220,182,122,0.4); }

/* ---------- 智能四柱图示 ---------- */
.sizhu-chart {
  background: #1c2333;
  border: 1px solid #2d3548;
  border-radius: 12px;
  padding: 18px 20px 22px;
}
.sizhu-head {
  margin-bottom: 12px;
  padding-left: 12px;
  position: relative;
}
.sizhu-head::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 4px;
  background: var(--gold);
  border-radius: 2px;
}
.sizhu-title {
  font-size: 18px;
  font-weight: 600;
  font-family: KaiTi, STKaiti, serif;
  color: #C9A84C;
  letter-spacing: 3px;
}
.sizhu-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid #2d3548;
  padding-bottom: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.sz-tab {
  font-size: 13px;
  color: #8b9bb4;
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 2px;
  font-family: KaiTi, STKaiti, serif;
  letter-spacing: 2px;
  transition: color 0.15s;
}
.sz-tab:hover { color: #c7d0e0; }
.sz-tab.active {
  color: var(--gold);
  font-weight: 700;
  border-bottom: 2px solid var(--gold);
}
.sizhu-body {
  min-height: 80px;
  padding: 4px 0;
}
.sz-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.sz-col {
  background: #161d2b;
  border: 1px solid #2d3548;
  border-radius: 10px;
  padding: 16px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 100px;
}
.sz-col-head {
  font-size: 11px;
  color: #8b9bb4;
  letter-spacing: 2px;
  margin-bottom: 4px;
  font-family: KaiTi, STKaiti, serif;
}
.sz-big {
  font-size: 32px;
  font-weight: 700;
  font-family: KaiTi, STKaiti, serif;
  line-height: 1;
}
.sz-mid {
  font-size: 18px;
  color: #c7d0e0;
  font-family: KaiTi, STKaiti, serif;
}
.sz-sub, .sz-sub-l {
  font-size: 11px;
  color: #8b9bb4;
  text-align: center;
  letter-spacing: 1px;
}
.sz-sub-l {
  line-height: 1.6;
  word-break: keep-all;
}

/* ---------- 响应式（小屏） ---------- */
@media (max-width: 768px) {
  .ph-icon-btn { width: 28px; height: 28px; font-size: 16px; }
  .bazi-cell { min-height: 50px; }
  .bci-wrap { min-height: 50px; padding: 14px 3px 6px; }
  .bc-main { font-size: 22px; }
  .bc-main .bc-shishen-main,
  .bc-main .bc-ny-name { font-size: 14px; }
  .bc-line-label { font-size: 13px; }
  .sz-grid { grid-template-columns: repeat(2, 1fr); }
  .sz-col { min-height: 90px; padding: 12px 4px 10px; }
  .sz-big { font-size: 26px; }
  .summary-label { width: 60px; font-size: 12px; }
  .summary-row { font-size: 12px; }
}

