/**
 * 三元九运页专属样式
 * 用于：/sanyuanjiuyun/（默认当年）与 /sanyuanjiuyun/YYYY（按年伪静态）
 *
 * 表单 / 面板 / 表格走公用 .cx-*；续查走 .cx-tip；
 * 本文件：元色点、口诀引文、口诀+九宫双栏、洛书九宫格。
 */

/* 数字列等宽，起止年对齐 */
.cx-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 三元着色：上元黛蓝、中元青绿、下元朱红——只染「三元」列字色 */
.sy-yuan--shang { color: #2b5f8a; font-weight: 700; }
.sy-yuan--zhong { color: #2c6e52; font-weight: 700; }
.sy-yuan--xia { color: #b0232f; font-weight: 700; }

/* 口诀引文：整栏全宽；PC 单行不折，窄屏允许换行 */
.sy-song {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--gilt);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--field);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 2;
  letter-spacing: 0.06em;
  text-align: center;
}

@media (min-width: 769px) {
  .sy-song {
    white-space: nowrap;
    overflow-x: auto; /* 极端窄桌面仍可读，不硬挤破 panel */
  }
}

/* 口诀表 + 九宫：宽屏两栏，写死列数（勿 auto-fit） */
.sy-duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (min-width: 769px) {
  .sy-duo {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 20px 24px;
  }
}

/* ---- 洛书九宫（南在上）---- */
.sy-palace {
  margin: 0 auto;
  max-width: 360px;
}

/* 方位标只相对棋盘定位，勿包进 figcaption，否则「北」会贴底边 */
.sy-palace__board {
  position: relative;
  padding: 26px;
}

.sy-palace__lab {
  position: absolute;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  line-height: 1;
}
.sy-palace__lab--n { top: 6px; left: 50%; transform: translateX(-50%); }
.sy-palace__lab--s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.sy-palace__lab--e { left: 6px; top: 50%; transform: translateY(-50%); }
.sy-palace__lab--w { right: 6px; top: 50%; transform: translateY(-50%); }

.sy-palace__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  aspect-ratio: 1;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--rule);
}

.sy-palace__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: var(--field);
  text-align: center;
  min-width: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sy-palace__num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.sy-palace__name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.sy-palace__dir {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* 九星淡底：只作辨识，当前格再加重（实色，避开 color-mix / Chrome < 111） */
.sy-palace__cell--1 { background: #e6e5dc; } /* #2b5f8a 8% + field */
.sy-palace__cell--2 { background: #e3dfd2; } /* #3a3a3a 10% + field */
.sy-palace__cell--3 { background: #e1e4d6; } /* #1f6b5c 10% + field */
.sy-palace__cell--4 { background: #dee1d2; } /* jade 12% + field */
.sy-palace__cell--5 { background: #e5dcc5; } /* gilt 18% + field */
.sy-palace__cell--6 { background: #ebe5d4; } /* #8a7a4a 10% + field */
.sy-palace__cell--7 { background: #efdcd1; } /* cinnabar 10% + field */
.sy-palace__cell--8 { background: #e8e2d3; } /* #6b5a3e 10% + field */
.sy-palace__cell--9 { background: #e5dbd3; } /* #6b3a5c 12% + field */

/* 当前运飞星：墨底反白 + 细鎏金描边
 * 写在 .sy-palace__cell--1…9 之后，同特异度靠源序盖掉运色底，不必 !important */
.sy-palace__cell--on {
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--gilt);
  z-index: 1;
}
.sy-palace__cell--on .sy-palace__num,
.sy-palace__cell--on .sy-palace__name {
  color: #fff;
}
.sy-palace__cell--on .sy-palace__dir {
  color: #b8a379; /* gilt 70% + white */
}

.sy-palace__cap {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .sy-song { text-align: left; line-height: 1.9; }
  .sy-palace { max-width: 300px; }
  .sy-palace__board { padding: 24px; }
  .sy-palace__num { font-size: 18px; }
  .sy-palace__name { font-size: 12px; }
  .sy-palace__dir { font-size: 10px; }
}

@media (max-width: 480px) {
  .sy-palace__dir { display: none; } /* 窄屏只留数字+星名，方位靠四周标注 */
}
