/* ============================================================
   通玄 TONGXUAN · 策天飞星页
   形制：generic page-hero + 庚帖（geng-card 全托管 base.css）
   + 盘头印玺 + 飞星十二宫 4×4 环列（紫微家法：巳午未申列上）
   + 古籍段式折叠卡（36 段，Python sections 单一真值）。
   ============================================================ */

.ct-hero-divider {
  margin-top: 26px;
  animation: pageUp 1s var(--ease-out) 0.28s both;
}

/* ================= 盘头 ================= */
.ct-head-card {
  max-width: 980px;
  margin: 0 auto 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(150, 114, 58, 0.45);
  background:
    radial-gradient(ellipse 130% 100% at 50% -30%, rgba(212, 175, 106, 0.14), transparent 60%),
    linear-gradient(160deg, var(--ink-800), var(--ink-950));
  box-shadow: 0 22px 56px rgba(20, 16, 8, 0.28);
  padding: 26px 32px 22px;
  text-align: center;
}
.ct-lunar {
  font-family: var(--font-serif);
  font-size: clamp(17px, 2.6vw, 22px); font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-300);
}
.ct-head-seals {
  margin-top: 16px;
  display: flex; flex-wrap: wrap; gap: 12px 18px;
  justify-content: center;
}
.ct-seal {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 16px 7px 7px;
  border: 1px solid rgba(212, 175, 106, 0.35);
  border-radius: 999px;
  background: rgba(240, 234, 214, 0.06);
}
.ct-seal i {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  font-style: normal; font-family: var(--font-serif);
  font-size: 14px; font-weight: 700;
  color: #fdf8ea;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--gold-600), #8a6a30);
}
.ct-seal-zi i { background: linear-gradient(150deg, #7a68b0, #4a3d78); }
.ct-seal b {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 700; letter-spacing: 0.08em;
  color: #f0ead6;
}
.ct-head-note {
  margin-top: 14px;
  font-size: 12.5px; letter-spacing: 0.06em; line-height: 1.8;
  color: var(--text-low);
}

/* ================= 飞星十二宫 ================= */
.ct-board-panel, .ct-sections-panel { max-width: 980px; margin: 0 auto; }
.ct-sections-panel { margin-top: 28px; }
.ct-panel-cap {
  font-family: var(--font-serif);
  font-size: 15px; font-weight: 700; letter-spacing: 0.22em;
  color: var(--paper-ink);
  margin-bottom: 14px;
}
.ct-panel-cap span { font-size: 12px; font-weight: 400; letter-spacing: 0.08em; color: var(--paper-ink-soft); }
.ct-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(120px, auto));
  gap: 7px;
  border: 1px solid rgba(150, 114, 58, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 246, 0.5);
  box-shadow: 0 14px 36px rgba(60, 48, 22, 0.1);
  padding: 12px;
}
.ct-cell {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 10px 9px;
  border: 1px solid rgba(150, 114, 58, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 246, 0.68);
  min-width: 0;
}
.ct-cell.ming { border-color: var(--gold-600); border-width: 1.6px; box-shadow: 0 6px 18px rgba(150, 114, 58, 0.18); }
.ct-cell-head { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.ct-cell-xian { margin: 2px 0 0; font-size: 11px; letter-spacing: 0.04em; color: var(--paper-ink-soft); font-variant-numeric: tabular-nums; }
.ct-head-err { margin: 6px 0 0; }
/* 书法口径面板（2026-09-04） */
.ct-school { margin-top: 18px; border: 1px dashed rgba(150, 114, 58, 0.4); border-radius: var(--radius-sm); padding: 10px 14px; }
.ct-school > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.ct-school > summary::-webkit-details-marker { display: none; }
.ct-school > summary b { font-family: var(--font-serif); font-size: 14px; letter-spacing: 0.3em; color: var(--gold-700); }
.ct-school > summary span { font-size: 12.5px; color: var(--paper-ink-soft); }
.ct-school-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
.ct-school-grid label { display: block; font-size: 12.5px; letter-spacing: 0.08em; color: var(--paper-ink-soft); }
.ct-school-grid select { margin-top: 6px; }
.ct-cell-head b {
  font-family: var(--font-serif);
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--paper-ink);
}
.ct-cell-head span { font-size: 11px; color: var(--paper-ink-soft); }
.ct-shen-tag {
  margin-left: auto;
  font-style: normal; font-family: var(--font-serif);
  font-size: 11px; font-weight: 700;
  color: #fdf8ea;
  background: linear-gradient(150deg, #4a5d84, #232f4c);
  border-radius: 5px;
  padding: 1px 6px;
}
.ct-cell-stars { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ct-cell-stars b {
  font-family: var(--font-serif);
  font-size: 14.5px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--gold-700);
  white-space: nowrap;
}
.ct-cell-stars b sup, .ct-cell-aux b sup {
  font-size: 9.5px; font-weight: 500;
  color: var(--cinnabar);
  margin-left: 1px;
}
.ct-cell-empty { font-style: normal; font-size: 11.5px; color: var(--paper-ink-soft); }
.ct-cell-aux {
  display: flex; flex-wrap: wrap; gap: 2px 8px;
  font-size: 11.5px; letter-spacing: 0.08em; line-height: 1.7;
  color: var(--paper-ink-soft);
}
.ct-cell-aux b { font-family: var(--font-serif); font-weight: 600; color: var(--paper-ink-soft); white-space: nowrap; }
.ct-center {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid rgba(150, 114, 58, 0.4);
  border-radius: var(--radius-md);
  background:
    radial-gradient(ellipse 120% 100% at 50% 0%, rgba(212, 175, 106, 0.16), transparent 70%),
    linear-gradient(165deg, var(--ink-800), var(--ink-950));
  padding: 14px;
  text-align: center;
}
.ct-center-cap {
  font-family: var(--font-serif);
  font-size: 12px; letter-spacing: 0.4em; text-indent: 0.4em;
  color: var(--gold-500);
}
.ct-center-lunar {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--gold-300);
  line-height: 1.6;
}
.ct-center-trio { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
.ct-center-trio span {
  font-family: var(--font-serif);
  font-size: 12.5px; letter-spacing: 0.06em;
  color: #f0ead6;
}
.ct-center-note { font-size: 11px; letter-spacing: 0.12em; color: rgba(240, 234, 214, 0.55); }

/* ================= 古籍段式 ================= */
.ct-sections { display: grid; gap: 10px; }
.ct-sec {
  border: 1px solid rgba(150, 114, 58, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 246, 0.66);
  overflow: hidden;
}
.ct-sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ct-sec-head::-webkit-details-marker { display: none; }
.ct-sec-caret {
  flex: none;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--gold-600); border-bottom: 1.5px solid var(--gold-600);
  transform: rotate(-45deg);
  transition: transform 0.3s var(--ease-out);
}
.ct-sec[open] .ct-sec-caret { transform: rotate(45deg); }
.ct-sec-head b {
  font-family: var(--font-serif);
  font-size: 14.5px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--paper-ink);
}
.ct-sec-count {
  margin-left: auto;
  font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--paper-ink-soft);
}
.ct-sec-body {
  border-top: 1px solid rgba(150, 114, 58, 0.22);
  padding: 12px 16px 14px;
  display: grid; gap: 8px;
}
/* 复查 A3：每行各自成 grid 时标签列按自身内容定宽，值列起点逐行漂移——grid 提到 .ct-sec-body，行 display:contents 即整段对齐 */
.ct-sec-body { grid-template-columns: minmax(72px, max-content) minmax(0, 1fr); gap: 8px 14px; align-items: baseline; }
.ct-sec-row { display: contents; }
.ct-sec-row i {
  font-style: normal; font-family: var(--font-serif);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--gold-700);
  white-space: nowrap;
}
.ct-sec-row span {
  font-size: 13.5px; line-height: 1.85; letter-spacing: 0.03em;
  color: var(--paper-ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

.ct-again { margin-top: 30px; text-align: center; }

/* ================= 法门源流 ================= */
.ct-lore { padding-bottom: 110px; }
.ct-lore-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.ct-lore-card {
  position: relative;
  border: 1px solid rgba(150, 114, 58, 0.35);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 246, 0.66);
  padding: 26px 26px 24px;
  box-shadow: 0 10px 26px rgba(60, 48, 22, 0.08);
}
.ct-lore-seal {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 700;
  color: #fdf8ea;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--ink-700), var(--ink-950));
  box-shadow: 0 6px 14px rgba(13, 20, 38, 0.25);
}
.ct-lore-card h3 {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--paper-ink);
}
.ct-lore-card p {
  margin-top: 10px;
  font-size: 13.5px; line-height: 2; letter-spacing: 0.04em;
  color: var(--paper-ink-soft);
}

/* ================= 手机档（375/390 实测口径） ================= */
@media (max-width: 720px) {
  .ct-head-card { padding: 18px 14px 16px; }
  .ct-head-seals { gap: 8px 10px; }
  .ct-seal { padding: 5px 12px 5px 5px; gap: 7px; }
  .ct-seal i { width: 24px; height: 24px; font-size: 12px; }
  .ct-seal b { font-size: 14px; }

  .ct-grid { grid-template-rows: repeat(4, minmax(96px, auto)); gap: 5px; padding: 8px; }
  .ct-cell { padding: 6px 6px 5px; gap: 4px; }
  .ct-cell-head b { font-size: 11.5px; }
  .ct-cell-stars b { font-size: 12px; }
  .ct-cell-aux { font-size: 10px; letter-spacing: 0.02em; }
  .ct-center-lunar { font-size: 12.5px; }
  .ct-center-trio span { font-size: 11px; }
  .ct-center-note { display: none; }

  .ct-sec-body { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ct-sec-row i { margin-top: 6px; }
  .ct-school-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* 复查 U5：身宫格「財帛宮+支+身」＞64px 格宽时宫名逐字竖排——照紫微方盘纪律裁切 */
  .ct-grid { overflow-x: clip; }
  .ct-cell { min-width: 0; overflow: hidden; }
  .ct-cell-head { flex-wrap: nowrap; gap: 4px; }
  .ct-cell-head b { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ct-cell-head span, .ct-shen-tag { flex: none; }
  .ct-lore-grid { grid-template-columns: 1fr; gap: 16px; }
  .ct-lore { padding-bottom: 70px; }
}

/* ================= 绣色（xiu）皮 ================= */
html[data-theme="xiu"] .ct-head-card { border-color: rgba(122, 104, 176, 0.5); }
html[data-theme="xiu"] .ct-cell,
html[data-theme="xiu"] .ct-grid,
html[data-theme="xiu"] .ct-sec,
html[data-theme="xiu"] .ct-lore-card { border-color: rgba(88, 74, 133, 0.35); }
html[data-theme="xiu"] .ct-cell-stars b,
html[data-theme="xiu"] .ct-sec-row i { color: var(--zi-700, #584a85); }
html[data-theme="xiu"] .ct-cell.ming { border-color: var(--zi-500, #7f6fae); }
/* 复查 A7：theme-xiu 只重映射 ink/paper/zi，不动 gold——金色件逐个转紫 */
html[data-theme="xiu"] .ct-lunar, html[data-theme="xiu"] .ct-center-cap, html[data-theme="xiu"] .ct-center-lunar,
html[data-theme="xiu"] .ct-text-sub, html[data-theme="xiu"] .ct-school > summary b, html[data-theme="xiu"] .ct-sec-caret { color: var(--zi-700, #584a85); }
html[data-theme="xiu"] .ct-seal i { background: linear-gradient(150deg, var(--zi-500, #7f6fae), var(--zi-700, #584a85)); }
html[data-theme="xiu"] .ct-liunian-switch select, html[data-theme="xiu"] .ct-school { border-color: rgba(122, 104, 176, 0.5); }

/* ================= 打印 ================= */
/* ===== 流年切换 + 典籍十三卷（2026-09-01 七检 2c） ===== */
/* 不挂 .date-grid——geng-form.js 会把每个 .date-grid 转成生辰转轮（流年单选曾被误捕成四位年轮） */
.ct-liunian-grid { display: grid; grid-template-columns: minmax(0, 240px); }
.ct-school-liunian { margin-top: 12px; }
.ct-school-liunian .field-label { margin-bottom: 6px; }
.ct-liunian-switch {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 6px; font-size: 13px; letter-spacing: 0.08em; color: var(--text-mid);   /* 深底盘头卡上：--paper-ink-soft 仅 2.3:1 */
}
.ct-liunian-switch select {
  font: inherit; font-size: 16px; min-height: 44px; padding: 4px 30px 4px 10px;
  border: 1px solid rgba(184, 145, 75, 0.45); border-radius: 8px;
  background: rgba(255, 252, 245, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b8914b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 8px;
  color: var(--paper-ink); appearance: none; -webkit-appearance: none; cursor: pointer;
}
.ct-liunian-switch select:disabled { opacity: 0.55; cursor: progress; }
.ct-texts-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.ct-texts-note { margin: 0; font-size: 12.5px; letter-spacing: 0.06em; color: var(--paper-ink-soft); text-align: center; }
.ct-texts-mount { max-width: 860px; margin: 0 auto; }
.ct-text-sec + .ct-text-sec { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(184, 145, 75, 0.3); }
.ct-text-sub { margin: 0 0 6px; font-size: 14px; letter-spacing: 0.1em; color: var(--gold-700); }
.ct-text-body { margin: 0; white-space: pre-wrap; line-height: 1.9; font-size: 14.5px; color: var(--paper-ink); }

/* ===== 触屏（G18）：页级触控底线（生辰控件由 base.css 的 .input-line/.date-grid 兜底） ===== */
/* 书法口径逐档注（W1-1b） */
.ct-school-note { margin: 8px 0 2px; font-size: 12.5px; line-height: 1.7; color: var(--paper-ink-soft); }
@media print {
  .ct-lore, .ct-texts-actions, .ct-texts-mount, .ct-school { display: none !important; }   /* 复查 A8：展过卷再打印会附 9 千字典籍与营销卡 */
  .ct-liunian-switch, .ct-texts-actions { display: none !important; }
  .ct-head-card, .ct-center {
    background: #fff !important;
    border-color: #b9a06a;
    box-shadow: none;
  }
  .ct-lunar, .ct-center-lunar, .ct-center-cap { color: #7a5c1e; }
  .ct-seal b, .ct-center-trio span { color: #333; }
  .ct-head-note, .ct-center-note { color: #666; }
  .ct-sec { break-inside: avoid; }
  /* 打印全展由 cetian.js beforeprint 落实（合拢的 details 内容根本不渲染，CSS 展不开） */
}

/* 打印补遗（2026-09-02 九术复审）：身标/印章皆白字渐变底，背景被丢即隐——纸上平铺深底 */
@media print {
  .ct-shen-tag, .ct-seal i, .ct-seal-zi i, .ct-lore-seal { color: #fff !important; background: #4a5d84 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ⚠ 触屏块居文末（G18h 2026-09-06）：同优先级后源取胜——挪到 720 / print / 绣色块之前即被反杀 */
@media (pointer: coarse) {
  .ct-liunian-switch select { min-height: 44px; }
  .ct-sec-head { min-height: 44px; }
}
