/* ===== 排盘结果面板 ===== */
.chart-panel {
  --chart-fs-xs: clamp(10px, 2.7vw, 12px);
  --chart-fs-sm: clamp(11px, 2.9vw, 13px);
  --chart-fs-base: clamp(12px, 3.1vw, 14px);
  --chart-fs-label: clamp(12px, 3.2vw, 14px);
  --chart-fs-side: clamp(11px, 3vw, 13px);
  margin: 0 -16px -16px;
  background: #fff;
  overflow: hidden;
  border-top: 1px solid #e0e0e0;
}
.form-card.has-chart { padding-bottom: 0; overflow: hidden; }
.form-card.has-chart .btn-primary { margin-bottom: 16px; }

/* ===== 头部 ===== */
.chart-header {
  padding: 12px;
  background: #1a1613;
  color: #fff;
}

.chart-lunar,
.chart-solar {
  font-size: var(--chart-fs-base);
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.7;
}
/* ===== 五行色块 ===== */
.gz-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-weight: 700;
  line-height: 1;
}

.gz-lg { width: 36px; height: 36px; font-size: 26px; border-radius: 5px; }
.gz-md { width: 26px; height: 26px; font-size: 17px; }
.gz-sm { width: 22px; height: 22px; font-size: 15px; }
.gz-xs { width: 17px; height: 17px; font-size: 12px; border-radius: 3px; }

.chart-panel .el-wood { color: #338833; background: #eef6ed; }
.chart-panel .el-fire { color: #e4393c; background: #f9ebeb; }
.chart-panel .el-earth { color: #966c2f; background: #faf5e9; }
.chart-panel .el-metal { color: #b58900; background: #faf5e9; }
.chart-panel .el-water { color: #3a82b8; background: #ebf2f9; }

.gz-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pillar-with-ss {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

.pillar-ss {
  font-size: var(--chart-fs-xs);
  color: #aaa;  line-height: 1.4;
  text-align: left;
  padding-top: 1px;
}

/* ===== 主表格 ===== */
.chart-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.chart-caption {
  caption-side: top;
  text-align: left;
  padding: 8px 12px 6px;
  font-size: var(--chart-fs-sm);
  color: #888;
  line-height: 1.5;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.chart-table th,
.chart-table td {
  border: 1px solid #e8e8e8;
  text-align: center;
  vertical-align: middle;
}

.chart-table thead th {
  background: #f7f7f7;
  color: #aaa;
  font-weight: 400;
  font-size: var(--chart-fs-label);
  padding: 8px 2px;
}

.chart-table tbody th {
  background: #f7f7f7;
  color: #aaa;
  font-weight: 400;
  width: 34px;
  font-size: var(--chart-fs-sm);
  padding: 5px 2px;
  position: relative;
}

.chart-table col.col-label { width: 34px; }
.chart-table col.col-data { width: calc((100% - 34px) / 6); }

.chart-table tr.row-zhuxing td,
.chart-table tr.row-zhuxing th {
  padding: 6px 2px;
  font-size: var(--chart-fs-sm);
  background: #fff;
}
.ss-name { color: #666; }
.ss-yuan { color: #d43030; font-weight: 600; }

.chart-table tr.row-gan td,
.chart-table tr.row-zhi td {
  padding: 7px 2px;
  background: #f8f8f8;
}

.chart-table tr.row-gan .gz-box,
.chart-table tr.row-zhi .gz-box {
  background: none !important;
  width: auto;
  height: auto;
  border-radius: 0;
  padding: 0;
}

.chart-table tr.row-hide td,
.chart-table tr.row-hide th {
  padding: 6px 2px;
  vertical-align: top;
  background: #fafafa;
}

.hide-stems {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.hide-stem-item {
  display: flex;
  align-items: center;
  gap: 2px;
}

.hide-stem-item .hs-ss {
  font-size: var(--chart-fs-xs);
  color: #888;
  white-space: nowrap;
}

.chart-table tr.row-sub td,
.chart-table tr.row-sub th {
  padding: 5px 2px;
  font-size: var(--chart-fs-xs);
  color: #888;
  background: #fff;
}
.chart-table tr.row-sub:nth-child(even) td,
.chart-table tr.row-sub:nth-child(even) th {
  background: #fafafa;
}

.chart-table tr.row-shensha td,
.chart-table tr.row-shensha th {
  padding: 6px 4px;
  vertical-align: top;
  height: 72px;
  background: #fff;
}

.ss-fold {
  display: block;
  font-size: 12px;
  color: #ccc;
  line-height: 1;
  margin-top: 2px;
  transform: rotate(90deg);
}

.shensha-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding-left: 2px;
}

.shensha-list span {
  font-size: var(--chart-fs-xs);
  color: #a08050;  line-height: 1.5;
  white-space: nowrap;
}

/* ===== 起运信息 ===== */
.chart-yun-info {
  padding: 9px 12px;
  background: #fff;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  font-size: var(--chart-fs-sm);
  color: #999;
  line-height: 1.7;
}
.yun-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.yun-text { flex: 1; }

.chart-yun-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chart-age-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-age {
  font-size: 16px;
  color: #333;
  font-weight: 700;
}

.cal-icon {
  width: 20px;
  height: 20px;
  border: 1px solid #ccc;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--chart-fs-xs);
  color: #888;
  background: #fff;
}

.chart-siling { font-size: var(--chart-fs-sm); color: #999; }
/* ===== 大运 / 流年 / 流月 ===== */
.chart-cycles {
  border-top: 1px solid #eee;
  background: #fff;
}

.chart-cycle {
  display: flex;
  border-bottom: 1px solid #eee;
}

.chart-cycle:last-child { border-bottom: none; }

.cycle-side {
  width: 26px;
  flex-shrink: 0;
  background: #f7f7f7;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  gap: 6px;
}

.cycle-side-split {
  justify-content: stretch;
  padding: 0;
  gap: 0;
}

.cycle-side-top,
.cycle-side-bottom {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: var(--chart-fs-side);
  color: #aaa;
  letter-spacing: 2px;
}

.cycle-side-bottom {
  border-top: 1px solid #eee;
  color: #a08050;
  font-size: var(--chart-fs-xs);
  letter-spacing: 1px;
}

.cycle-side-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: var(--chart-fs-side);
  color: #aaa;
  letter-spacing: 2px;
}
.cycle-switch {
  width: 30px;
  height: 16px;
  transform: rotate(90deg);
}

.cycle-switch .slider::before { width: 12px; height: 12px; }

.cycle-scroll {
  flex: 1;
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  align-items: stretch;
}

.cycle-scroll::-webkit-scrollbar { display: none; }

.cycle-scroll .ln-pillar-rows {
  align-items: center;
}

.cycle-scroll .ln-pillar-line {
  justify-content: center;
}

.cycle-scroll .ln-ss-tag {
  font-size: var(--chart-fs-xs);
  color: #aaa;
  min-width: 10px;
}
/* 周期区干支：仅文字色，无背景块 */
.chart-cycles .gz-box {
  background: none !important;
  border-radius: 0;
  width: auto;
  height: auto;
  padding: 0;
  font-weight: 600;
}

.chart-cycles .gz-md { font-size: 17px; }
.chart-cycles .gz-sm { font-size: 15px; }
.chart-cycles .gz-xs { font-size: 13px; }

.chart-cycles .el-wood { color: #338833; }
.chart-cycles .el-fire { color: #e4393c; }
.chart-cycles .el-earth { color: #966c2f; }
.chart-cycles .el-metal { color: #b58900; }
.chart-cycles .el-water { color: #3a82b8; }

/* 大运 */
.chart-cycle:first-child .cycle-scroll {
  min-height: 88px;
}

.dy-cell {
  flex-shrink: 0;
  width: 72px;
  border-right: 1px solid #f0f0f0;
  padding: 7px 4px 9px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dy-cell.active {
  background: #eeeeee;
}

.dy-cell.active .dy-year,
.dy-cell.active .dy-age {
  color: #444;
  font-weight: 600;
}

.dy-top {
  margin-bottom: 6px;
  line-height: 1.35;
}

.dy-year {
  font-size: var(--chart-fs-sm);
  font-weight: 600;
  color: #444;
  white-space: nowrap;
}

.dy-age {
  font-size: var(--chart-fs-xs);
  color: #aaa;
  margin-top: 1px;
}
/* 流年 / 小运 */
.chart-cycle-liunian .cycle-scroll {
  min-height: 108px;
}

.ln-cell {
  flex-shrink: 0;
  width: 58px;
  border-right: 1px solid #f0f0f0;
  padding: 6px 3px 8px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ln-cell.active {
  background: #eeeeee;
}

.ln-cell.active .gz-box {
  font-weight: 800;
}

.ln-year {
  font-size: var(--chart-fs-base);
  color: #444;  font-weight: 600;
  margin-bottom: 5px;
  position: relative;
  line-height: 1;
}

.ln-cell.active .ln-year {
  color: #e4393c;
  font-weight: 700;
}

.ln-mark-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #38a04c;
  margin: 3px auto 0;
}

.ln-cell.active .ln-liunian {
  background: #eeeeee;
}

.ln-liunian {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.ln-xiaoyun {
  width: 100%;
  padding-top: 5px;
  margin-top: 4px;
  border-top: 1px dashed #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  background: transparent;
}

.ln-cell.active .ln-xiaoyun {
  background: #eeeeee;
}

.ln-xiaoyun-empty {
  min-height: 36px;
  border-top-color: transparent;
}

.xy-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
}

.xy-gz {
  font-size: 13px;
  font-weight: 600;
  background: none !important;
  border-radius: 0;
  padding: 0;
}

.xy-gz.el-wood { color: #338833; }
.xy-gz.el-fire { color: #e4393c; }
.xy-gz.el-earth { color: #966c2f; }
.xy-gz.el-metal { color: #b58900; }
.xy-gz.el-water { color: #3a82b8; }

.ln-pillar-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.ln-pillar-line {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ln-ss-tag {
  font-size: var(--chart-fs-xs);
  color: #bbb;
}
/* 流月 / 流日 / 流时 */
.ly-cell,
.lr-cell,
.ls-cell {
  flex-shrink: 0;
  width: 50px;
  border-right: 1px solid #f0f0f0;
  padding: 6px 2px 8px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
}

.ly-cell.active,
.lr-cell.active,
.ls-cell.active {
  background: #eeeeee;
}

.ly-cell.active .gz-box,
.lr-cell.active .gz-box,
.ls-cell.active .gz-box {
  font-weight: 800;
}

.lr-cell.active .lr-head,
.ls-cell.active .ls-head {
  color: #e4393c;
  font-weight: 700;
}

#cycleLiuyue .cycle-scroll { min-height: 82px; }
#cycleLiuri .cycle-scroll { min-height: 82px; }
#cycleLiushi .cycle-scroll { min-height: 82px; }

.ly-head,
.lr-head,
.ls-head {
  font-size: var(--chart-fs-sm);
  color: #666;
  line-height: 1.45;
  margin-bottom: 5px;
}

.ly-head .ly-term { display: block; }

.ly-head .ly-date {
  display: block;
  font-size: var(--chart-fs-xs);
  color: #bbb;
}
.ly-head-active .ly-term {
  color: #e4393c;
  font-weight: 600;
  border-bottom: 2px solid #e4393c;
  display: inline-block;
  padding-bottom: 0;
  line-height: 1.2;
}

.ly-head-active .ly-date,
.lr-head-active,
.ls-head-active {
  color: #e4393c;
  font-weight: 600;
}

.lr-head-active,
.ls-head-active {
  border-bottom: 2px solid #e4393c;
  display: inline-block;
  line-height: 1.2;
}

.cycle-empty {
  padding: 12px;
  color: #ccc;
  font-size: var(--chart-fs-sm);
}
.dy-cell:active,
.ln-cell:active,
.ly-cell:active,
.lr-cell:active,
.ls-cell:active { opacity: 0.85; }
