/* ===========================================================
   长景·中华黄历 · 太极历盘
   玄夜 · 星流 · 太极 · 金篆
   =========================================================== */

:root {
  --bg: #06060a;
  --bg-2: #0a0a11;
  --panel: rgba(255, 255, 255, 0.028);
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(201, 169, 97, 0.16);
  --line-2: rgba(255, 255, 255, 0.07);
  --line-3: rgba(255, 255, 255, 0.045);

  --txt: #e9e3d5;
  --txt-2: #a49c8c;
  --txt-3: #6f6a60;
  --txt-4: #4a463e;

  --red: #d2453c;
  --red-2: #e86a5e;
  --red-dim: rgba(210, 69, 60, 0.12);

  --gold: #c9a961;
  --gold-2: #e6cd93;
  --gold-dim: rgba(201, 169, 97, 0.12);

  /* 清冷月白 / 银蓝：用于新增模块，避免金光 */
  --moon: #dcdfe4;
  --ice: #8fa8c4;
  --ice-2: #a9c0d6;
  --ice-dim: rgba(143, 168, 196, 0.12);
  --ice-line: rgba(143, 168, 196, 0.26);
  /* 吉凶语义配色：吉/宜=朱砂红  黄道吉日=金  凶/忌/黑道=清冷银蓝  可=灰 */

  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
  --sans: "HarmonyOS Sans SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;

  /* 常驻顶栏：底色比页面更深一档，滚动时内容从其下方穿过 */
  --bar-bg: rgba(8, 8, 13, 0.86);
  --bar-h: 0px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: #2a2a33 #08080c;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--txt);
  font-family: var(--serif);
  font-size: clamp(14.5px, 0.18vw + 14px, 15.5px);
  line-height: 1.7;
  background:
    radial-gradient(120% 80% at 50% -20%, #12121c 0%, #08080d 45%, #050508 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  /* 用 clip 而非 hidden：hidden 会让 body 成为滚动容器，
     顶部常驻栏的 position:sticky 就失效了。clip 只裁切、不建滚动容器。 */
  overflow-x: clip;
}

::selection { background: rgba(210, 69, 60, 0.35); color: #fff; }

/* ---------------- 背景层 ---------------- */

/* 分享封面图：供微信/QQ 等抓取首图用，视觉上不能占位。
   不能用 display:none 或 visibility:hidden —— 那样部分抓取器会直接跳过。
   做法是保留真实渲染、只是移出可视区（body 已 overflow-x:clip，不会产生滚动条）。 */
.share-thumb {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 512px;
  height: 512px;
  pointer-events: none;
}

.stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.aura {
  position: fixed;
  inset: -10% -10% auto -10%;
  height: 70vh;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(50% 60% at 22% 12%, rgba(201, 169, 97, 0.10), transparent 70%),
    radial-gradient(45% 55% at 82% 4%, rgba(96, 108, 168, 0.12), transparent 72%),
    radial-gradient(60% 70% at 50% 100%, rgba(210, 69, 60, 0.06), transparent 70%);
  filter: blur(6px);
  transition: transform 0.9s cubic-bezier(0.22, 0.68, 0.35, 1);
}

.taiji-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(78vh, 760px);
  height: min(78vh, 760px);
  margin: calc(min(78vh, 760px) / -2) 0 0 calc(min(78vh, 760px) / -2);
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  animation: spinSlow 200s linear infinite;
}

.taiji-watermark .tj-yang { fill: #e9e3d5; }
.taiji-watermark .tj-yin { fill: #06060a; }

@keyframes spinSlow { to { transform: rotate(360deg); } }

/* 月球式呼吸：光晕明暗与尺度微变 */
@keyframes moonBreath {
  0%, 100% { opacity: 0.6; transform: scale(0.97); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: clamp(1080px, 92vw, 1340px);
  margin: 0 auto;
  padding: 0 clamp(16px, 2.6vw, 34px) 60px;
  padding-left: max(clamp(16px, 2.6vw, 34px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 2.6vw, 34px), env(safe-area-inset-right));
}

/* ---------------- 顶部常驻栏 ---------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.26s cubic-bezier(0.22, 0.68, 0.35, 1);
}

/* 离开顶部才落影，避免首屏有多余的一条暗边 */
.site-head.stuck { box-shadow: 0 18px 50px -30px #000; }

.bar-inner {
  max-width: clamp(1080px, 92vw, 1340px);
  margin: 0 auto;
  padding-left: max(clamp(16px, 2.6vw, 34px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 2.6vw, 34px), env(safe-area-inset-right));
}

.bar-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 6px 0;
}

/* 当前日期胶囊：随时知道在看哪天，点了跳到月历 */
.bar-date {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.028);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: clamp(11.5px, 1vw, 12.5px);
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.26s cubic-bezier(0.22, 0.68, 0.35, 1);
  white-space: nowrap;
  overflow: hidden;
}

.bar-date b {
  font-weight: 500;
  color: var(--gold-2);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.bar-date i {
  font-style: normal;
  color: var(--txt-4);
}

.bar-date em {
  font-style: normal;
  color: var(--txt-3);
  font-size: 0.92em;
}

.bar-date:hover {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.5);
  background: var(--gold-dim);
}

/* 前一日 / 今日 / 后一日：分段控件，常驻栏里最常用的一组 */
.bar-quick {
  flex: none;
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  overflow: hidden;
}

.bar-quick button {
  appearance: none;
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.022);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: clamp(11.5px, 1vw, 12.5px);
  letter-spacing: 0.1em;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.24s ease;
}

.bar-quick button:first-child { border-left: 0; }

.bar-quick button:hover {
  color: var(--gold-2);
  background: var(--gold-dim);
}

/* 「今日」是回位动作，给一点金边提示 */
.bar-quick #btn-today {
  color: var(--gold);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  min-width: 52px;
}

.bar-quick #btn-today.is-on {
  color: #17130a;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 0 22px -8px rgba(201, 169, 97, 0.9);
}

/* 版面锚点导航：第二行，下滑后自动收起 */
.bar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: max-height 0.28s cubic-bezier(0.22, 0.68, 0.35, 1),
              opacity 0.22s ease,
              padding 0.28s cubic-bezier(0.22, 0.68, 0.35, 1);
  max-height: 46px;
  opacity: 1;
}

.bar-nav::-webkit-scrollbar { display: none; }
/* 右侧渐隐：提示此条可横向滑动（内容未滚到尽头时可见） */
.bar-nav {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.bar-nav button {
  appearance: none;
  flex: none;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: clamp(11px, 0.95vw, 12px);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  transition: all 0.24s ease;
}

.bar-nav button:hover {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.32);
  background: var(--gold-dim);
}

/* 当前所在版块 */
.bar-nav button.is-on {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.42);
  background: rgba(201, 169, 97, 0.1);
}

/* 下滑后只让第一行略微收紧，版块导航行常驻可见 —— 方便随时切版块 */
.site-head.compact .bar-top { min-height: 50px; }

/* 锚点落位时避开常驻栏 */
#almanac,
#bazi-panel,
#xiu-panel,
#shensha-panel,
#fangwei-panel,
#gua-panel,
#dress-panel,
#hours-panel,
#zeri-panel,
#jieqi-month,
#shengxiao-panel {
  scroll-margin-top: calc(var(--bar-h) + 14px);
}

.brand { display: flex; align-items: center; gap: clamp(10px, 1.4vw, 16px); min-width: 0; }

/* 标准太极图：左阳右阴，白鱼头在上、黑鱼头在下 */
.taiji-svg { display: block; width: 100%; height: 100%; }
.tj-yang { fill: #e9e3d5; }
.tj-yin { fill: #14141c; }

.brand-taiji {
  position: relative;
  width: clamp(34px, 3.4vw, 46px);
  height: clamp(34px, 3.4vw, 46px);
  flex: none;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(226, 236, 250, 0.38),
    0 0 9px rgba(232, 240, 252, 0.20),
    0 0 24px rgba(190, 208, 236, 0.15);
}

.brand-taiji .taiji-svg { animation: spinSlow 40s linear infinite; }

.brand-taiji::before {
  content: "";
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(232, 240, 252, 0.16) 0%,
    rgba(200, 216, 240, 0.08) 45%,
    transparent 72%);
  filter: blur(4px);
  animation: moonBreath 6.5s ease-in-out infinite;
  pointer-events: none;
}

.brand-taiji .tj-yang { fill: #e9e3d5; }
.brand-taiji .tj-yin { fill: #14141c; }

.brand-txt h1 {
  margin: 0;
  font-size: clamp(16px, 1.1vw + 8px, 23px);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: #f1ebdc;
  text-shadow: 0 0 30px rgba(201, 169, 97, 0.28);
  white-space: nowrap;
}

/* 名称中的间隔号：略小、压暗，避免与汉字抢视线 */
.brand-dot {
  display: inline-block;
  margin: 0 0.05em;
  font-size: 0.8em;
  vertical-align: 0.06em;
  color: var(--txt-4);
}

.brand-txt p {
  margin: 5px 0 0;
  font-size: clamp(9.5px, 0.9vw, 10.5px);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--txt-3);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

/* 常驻栏里的次级按钮压紧一档，给日期胶囊留位置 */
.site-head .ghost-btn {
  min-height: 34px;
  padding: 0 clamp(10px, 1.1vw, 14px);
  font-size: clamp(11.5px, 1vw, 12.5px);
}

.ghost-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: clamp(12px, 1vw, 13px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  padding: 8px clamp(12px, 1.4vw, 16px);
  min-height: 38px;
  border-radius: 2px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.28s ease;
}

.ghost-btn:hover {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.55);
  background: var(--gold-dim);
  box-shadow: 0 0 24px -8px rgba(201, 169, 97, 0.55);
}

/* ---------------- 布局 ---------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(292px, 25vw, 344px);
  gap: clamp(16px, 1.9vw, 28px);
  align-items: start;
  margin-top: clamp(16px, 1.9vw, 26px);
}

.card {
  position: relative;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line-2);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 40px 90px -60px #000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.card:hover {
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 90px -60px #000, 0 0 40px -18px rgba(201, 169, 97, 0.35);
}

/* ---------------- 主历 ---------------- */

.almanac {
  position: relative;
  padding: clamp(16px, 2.2vw, 28px) clamp(14px, 2.4vw, 32px) clamp(18px, 2.2vw, 30px);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background:
    radial-gradient(120% 90% at 50% -30%, rgba(201, 169, 97, 0.09), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.008));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 50px 120px -70px #000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.almanac::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 169, 97, 0.55), transparent);
}

.day-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
}

.nav-btn {
  appearance: none;
  width: clamp(34px, 3.2vw, 40px);
  height: clamp(34px, 3.2vw, 40px);
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.26s ease;
}

.nav-btn:hover {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.5);
  box-shadow: 0 0 22px -6px rgba(201, 169, 97, 0.6);
  background: var(--gold-dim);
}

.nav-btn:active { transform: scale(0.93); }
.nav-btn.sm { width: 30px; height: 30px; font-size: 15px; padding-bottom: 2px; }

.day-main { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 24px); min-width: 0; }

.dh-solar { display: flex; align-items: flex-end; gap: 12px; flex: none; }
/* 中等宽度（侧栏 300px 那一档）：大数字与日期按钮上下堆叠，给太极盘让位，避免「月历」按钮压到盘上 */
@media (max-width: 1240px) and (min-width: 901px) {
  .dh-solar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dh-pick { padding-bottom: 6px; }
}

.dh-day {
  font-family: var(--serif);
  font-size: clamp(44px, 4.6vw + 16px, 74px);
  line-height: 0.84;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #f4efe2;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.14);
  transition: opacity 0.35s ease;
}

.dh-lunar { min-width: 0; border-left: 1px solid var(--line-3); padding-left: clamp(12px, 1.6vw, 22px); }

.dh-lunar-big {
  font-family: var(--kai);
  font-size: clamp(22px, 2.3vw + 12px, 37px);
  line-height: 1.3;
  letter-spacing: 0.12em;
  white-space: nowrap;
  background: linear-gradient(100deg, #f6e7c4, #c9a961 45%, #f2d9a4 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(201, 169, 97, 0.35));
}

.dh-ganzhi {
  margin-top: 5px;
  font-size: clamp(11.5px, 1.1vw, 13px);
  letter-spacing: 0.16em;
  color: var(--txt-2);
  white-space: nowrap;
}

.dh-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.tag {
  font-family: var(--serif);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--txt-2);
  border: 1px solid var(--line-2);
  border-radius: 1px;
  padding: 2px 8px 3px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
}

.tag.red {
  color: var(--red-2);
  border-color: rgba(210, 69, 60, 0.35);
  background: var(--red-dim);
}

/* 太极历盘 */
.dial {
  position: relative;
  width: clamp(96px, 9.4vw, 140px);
  height: clamp(96px, 9.4vw, 140px);
  flex: none;
  display: grid;
  place-items: center;
}

.dial-face {
  position: relative;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  /* 多层外辉光：月白描边 → 近距冷白 → 中距银蓝 → 远距弥散 */
  box-shadow:
    0 0 0 1px rgba(226, 236, 250, 0.40),
    0 0 6px rgba(232, 240, 252, 0.26),
    0 0 18px rgba(200, 216, 240, 0.20),
    0 0 38px rgba(184, 203, 234, 0.13),
    0 0 72px rgba(168, 190, 224, 0.075);
}

/* 图案自转，光照固定 —— 像被照亮的球体 */
.dial-face .taiji-svg { animation: spinSlow 48s linear infinite; }

/* 扩散光晕：呼吸 */
.dial-face::before {
  content: "";
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(232, 240, 252, 0.18) 0%,
    rgba(200, 216, 240, 0.10) 38%,
    rgba(184, 203, 234, 0.04) 62%,
    transparent 76%);
  filter: blur(5px);
  animation: moonBreath 7.5s ease-in-out infinite;
  pointer-events: none;
}

/* 月面：左上受光、右下暗边、两处淡环形山 */
.dial-face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(248, 251, 255, 0.42), rgba(248, 251, 255, 0) 46%),
    radial-gradient(circle at 68% 76%, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 54%),
    radial-gradient(circle at 63% 33%, rgba(0, 0, 0, 0.10), transparent 17%),
    radial-gradient(circle at 37% 63%, rgba(0, 0, 0, 0.08), transparent 13%);
  pointer-events: none;
}

.dial-face .tj-yang { fill: #e2e8f3; }
.dial-face .tj-yin { fill: #0f0f16; }

.dial-dots { position: absolute; inset: 0; pointer-events: none; }

.dial-dots span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: all 0.35s ease;
  pointer-events: auto;
  cursor: pointer;
}

.dial-dots span:hover { background: rgba(226, 236, 250, 0.75); }

.dial-dots span.on {
  background: #eaf1ff;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  box-shadow: 0 0 12px 2px rgba(214, 228, 250, 0.85);
}

.dial-dots span.ji { background: rgba(210, 69, 60, 0.55); }
.dial-dots span.ji:hover, .dial-dots span.ji.on { background: var(--red-2); box-shadow: 0 0 14px 2px rgba(210, 69, 60, 0.8); }

.dial-label {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--kai);
  font-size: clamp(10px, 0.9vw, 11.5px);
  letter-spacing: 0.14em;
  color: var(--gold-2);
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(201, 169, 97, 0.5);
}

.dial-label.xiong { color: var(--txt-3); text-shadow: none; }

/* 节气条 */
.jieqi-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px clamp(12px, 1.8vw, 24px);
  margin-top: clamp(14px, 1.8vw, 22px);
  padding: clamp(10px, 1.2vw, 13px) clamp(12px, 1.4vw, 18px);
  border-top: 1px solid var(--line-3);
  border-bottom: 1px solid var(--line-3);
  background: linear-gradient(90deg, rgba(201, 169, 97, 0.07), rgba(201, 169, 97, 0.01));
  font-size: clamp(11.5px, 1.05vw, 12.5px);
  color: var(--txt-2);
}

.jq-item { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; min-width: 0; }
.jq-item .k { font-size: 10px; letter-spacing: 0.2em; color: var(--txt-4); }
.jq-item .n { font-family: var(--kai); font-size: 14.5px; letter-spacing: 0.1em; color: var(--txt); }
.jq-item .t { font-size: 11px; color: var(--txt-3); font-variant-numeric: tabular-nums; }
.jq-item .d { font-size: 10.5px; color: var(--gold); letter-spacing: 0.08em; }

.jq-today {
  font-family: var(--kai);
  font-size: 13.5px;
  letter-spacing: 0.12em;
  color: var(--red-2);
  padding: 1px 10px;
  border: 1px solid rgba(210, 69, 60, 0.35);
  border-radius: 1px;
  background: var(--red-dim);
  box-shadow: 0 0 22px -8px rgba(210, 69, 60, 0.8);
}

/* 宜忌 */
.yiji {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: clamp(14px, 1.8vw, 22px);
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  overflow: hidden;
}

.yiji-col {
  display: grid;
  grid-template-columns: clamp(38px, 4vw, 50px) minmax(0, 1fr);
  gap: clamp(10px, 1.4vw, 16px);
  padding: clamp(14px, 1.7vw, 20px) clamp(12px, 1.8vw, 22px);
}
.yiji-col + .yiji-col { border-left: 1px solid var(--line-3); }

.seal-box {
  width: clamp(38px, 3.8vw, 48px);
  height: clamp(38px, 3.8vw, 48px);
  display: grid;
  place-items: center;
  font-family: var(--kai);
  font-size: clamp(21px, 2.2vw, 27px);
  line-height: 1;
  border-radius: 2px;
  transition: transform 0.45s cubic-bezier(0.22, 0.68, 0.35, 1), box-shadow 0.45s ease;
}

.seal-yi {
  color: #fff2ec;
  background: linear-gradient(150deg, #d2453c, #93231d);
  box-shadow: 0 0 26px -6px rgba(210, 69, 60, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.seal-ji {
  color: #cfc7b6;
  background: linear-gradient(150deg, #26262f, #101017);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.yiji-col:hover .seal-yi { transform: rotate(-4deg) scale(1.04); box-shadow: 0 0 36px -4px rgba(210, 69, 60, 0.9); }
.yiji-col:hover .seal-ji { transform: rotate(4deg) scale(1.04); }

.yiji-title {
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--txt-4);
  margin-bottom: 6px;
}

.yiji-list {
  font-size: clamp(13.5px, 1.2vw, 15px);
  line-height: 2;
  letter-spacing: 0.05em;
  color: var(--txt);
  word-break: break-word;
}

.yiji-col.ji .yiji-list { color: var(--txt-2); }
.yiji-empty { color: var(--txt-3); font-size: 13.5px; }

/* 信息网格 */
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(12px, 1.6vw, 20px);
  border-top: 1px solid var(--line-3);
}

.fact {
  padding: clamp(11px, 1.3vw, 14px) clamp(10px, 1.4vw, 18px) clamp(12px, 1.4vw, 15px);
  border-bottom: 1px solid var(--line-3);
  transition: background 0.35s ease;
}

.fact:hover { background: rgba(255, 255, 255, 0.022); }
.fact + .fact { border-left: 1px solid var(--line-3); }
.fact:nth-child(3n + 1) { border-left: none; padding-left: 2px; }
.fact:nth-child(3n) { padding-right: 2px; }
.fact .v { overflow-wrap: anywhere; }

.fact .k {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--txt-4);
  margin-bottom: 3px;
}

.fact .v {
  font-size: 14px;
  line-height: 1.6;
  color: var(--txt);
  letter-spacing: 0.03em;
  word-break: break-word;
}

.fact .v small { font-size: 11px; color: var(--txt-3); letter-spacing: 0.04em; }
.fact .v .hot { color: var(--gold-2); }

/* 面板 */
.panel { margin-top: 24px; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--gold);
  white-space: nowrap;
}

.panel-head .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.panel-head .sub { font-size: 10.5px; color: var(--txt-4); letter-spacing: 0.12em; white-space: nowrap; }

/* 二十八宿 */
.xiu-box {
  display: grid;
  grid-template-columns: clamp(66px, 7.6vw, 96px) minmax(0, 1fr);
  gap: clamp(12px, 1.8vw, 22px);
  align-items: center;
  padding: clamp(13px, 1.5vw, 18px) clamp(13px, 1.6vw, 20px);
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: radial-gradient(120% 140% at 0% 50%, rgba(201, 169, 97, 0.09), transparent 60%);
}

.xiu-mark {
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px 0;
  border-right: 1px solid var(--line-3);
}

.xiu-mark .zi {
  font-family: var(--kai);
  font-size: 32px;
  line-height: 1;
  color: #f2ecdd;
  text-shadow: 0 0 22px rgba(201, 169, 97, 0.45);
}

.xiu-mark .nm { font-size: 10.5px; letter-spacing: 0.2em; color: var(--txt-3); }

.xiu-body { font-size: 13px; line-height: 1.9; color: var(--txt-2); }
.xiu-body .meta { letter-spacing: 0.08em; }
.xiu-body .meta b { color: var(--txt); font-weight: 500; }
.xiu-body .meta .lucky { color: var(--red-2); }
.xiu-body .poem { margin-top: 6px; font-size: 12px; line-height: 1.85; color: var(--txt-3); }

/* 神煞 */
.shensha { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.shensha-col .k {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--txt-4);
  margin-bottom: 8px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 2px 9px 3px;
  border: 1px solid var(--line-2);
  border-radius: 1px;
  color: var(--txt-2);
  background: rgba(255, 255, 255, 0.025);
  transition: all 0.28s ease;
}

.chip:hover { transform: translateY(-1px); }

.chip.good {
  color: var(--red-2);
  border-color: rgba(210, 69, 60, 0.32);
  background: var(--red-dim);
}

.chip.good:hover { box-shadow: 0 0 20px -8px rgba(210, 69, 60, 0.9); }

.chip.bad { color: var(--ice-2); border-color: var(--ice-line); background: var(--ice-dim); }

/* 时辰 */
.hours {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(82px, 8vw, 106px), 1fr));
  gap: clamp(6px, 0.8vw, 8px);
}

.hour {
  appearance: none;
  text-align: center;
  padding: 10px 5px 11px;
  min-height: 62px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.022);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.3s cubic-bezier(0.22, 0.68, 0.35, 1);
  font-family: var(--serif);
  color: var(--txt-2);
}

.hour:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -18px #000;
}

.hour.active {
  border-color: rgba(201, 169, 97, 0.55);
  background: var(--gold-dim);
  box-shadow: 0 0 30px -12px rgba(201, 169, 97, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.hour .hz { font-family: var(--kai); font-size: 18px; line-height: 1.2; color: var(--txt); }
.hour .hg { font-size: 10px; letter-spacing: 0.1em; color: var(--txt-4); margin-top: 1px; }
.hour .hs { font-size: 11px; letter-spacing: 0.04em; margin-top: 5px; }
.hour .hs .ji { color: var(--red-2); }
.hour .hs .xiong { color: var(--ice-2); }

.hour-detail {
  margin-top: 12px;
  padding: 14px 18px;
  border-left: 2px solid var(--red);
  background: linear-gradient(90deg, rgba(210, 69, 60, 0.09), transparent 70%);
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--txt-2);
  min-height: 58px;
}

.hour-detail b { color: var(--txt); font-weight: 500; }
.hour-detail .lbl { color: var(--txt-4); letter-spacing: 0.14em; font-size: 10.5px; margin-right: 4px; }
.hour-detail .sep { color: var(--txt-4); margin: 0 10px; }

/* ---------------- 侧栏 ---------------- */

/* 侧栏吸顶要避开常驻顶栏，否则滚到卡片会被顶栏盖住；
   --bar-h 由脚本按实际栏高写入，未滚动时是首屏栏高。 */
.side { display: grid; gap: clamp(12px, 1.4vw, 18px); position: sticky; top: calc(var(--bar-h, 0px) + 18px); align-content: start; }

/* ---------------- 日期选择器（年·月·日） ---------------- */

.dh-pick { display: flex; flex-direction: column; gap: 7px; padding-bottom: 3px; min-width: 0; }

.dp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }

.dp-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: clamp(11.5px, 1vw, 12.5px);
  letter-spacing: 0.08em;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

.dp-chip:hover,
.dp-chip[aria-expanded="true"] {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.5);
  background: var(--gold-dim);
}

.dp-caret {
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.5;
  transition: transform 0.24s ease;
}

.dp-chip[aria-expanded="true"] .dp-caret { transform: rotate(180deg); opacity: 0.85; }

.dp-week {
  font-size: clamp(10.5px, 0.95vw, 11.5px);
  letter-spacing: 0.14em;
  color: var(--txt-3);
  white-space: nowrap;
}

.dp-week b { color: var(--gold); font-weight: 400; }

/* 面板用 position:fixed：.almanac 是 overflow:hidden，
   放在里面的下拉层会被整块裁掉。z-index 低于详情层(90)与命盘(95)。 */
.dp-panel {
  position: fixed;
  z-index: 45;
  width: 292px;
  max-width: calc(100vw - 20px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(12, 12, 18, 0.97);
  box-shadow: 0 28px 70px -30px #000, inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dp-panel[hidden] { display: none; }

.dp-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-3);
}

.dp-tab {
  appearance: none;
  padding: 6px 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.22s ease;
}

.dp-tab:hover { color: var(--gold-2); }
.dp-tab.on { color: var(--gold-2); border-color: rgba(201, 169, 97, 0.42); background: rgba(201, 169, 97, 0.1); }

.dp-body { padding-top: 9px; }

.dp-grid { display: grid; gap: 3px; }
.dp-grid-y { grid-template-columns: repeat(6, 1fr); max-height: 232px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.dp-grid-m { grid-template-columns: repeat(4, 1fr); }
.dp-grid-d { grid-template-columns: repeat(7, 1fr); }

.dp-cell {
  appearance: none;
  padding: 7px 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--txt-2);
  font-family: var(--serif);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.dp-cell:hover { color: var(--gold-2); border-color: rgba(201, 169, 97, 0.4); background: var(--gold-dim); }
.dp-cell.is-today { color: var(--gold); border-color: rgba(201, 169, 97, 0.38); }
.dp-cell.on { color: #17130a; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; font-weight: 500; }
.dp-cell[disabled] { opacity: 0.28; cursor: not-allowed; }

.dp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line-3);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--txt-4);
}

.dp-foot-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dp-now {
  appearance: none;
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.22s ease;
}

.dp-now:hover { color: var(--gold-2); border-color: rgba(201, 169, 97, 0.5); background: var(--gold-dim); }

/* 前后一天到了历法边界就禁用 */
.nav-btn[disabled],
.bar-quick button[disabled] { opacity: 0.28; cursor: not-allowed; }
.nav-btn[disabled]:hover,
.bar-quick button[disabled]:hover { color: var(--txt-2); border-color: var(--line-2); background: transparent; box-shadow: none; }

/* 说明 */
.note-card { padding: 16px 18px 18px; }

.note-card h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.26em;
  color: var(--gold);
}

.note-card p { margin: 0; font-size: 11.5px; line-height: 1.95; color: var(--txt-3); letter-spacing: 0.01em; }

.jq-list { display: grid; gap: 8px; }

.jq-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--txt-2);
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-3);
}

.jq-row:last-child { border-bottom: none; padding-bottom: 0; }
.jq-row .nm { font-family: var(--kai); letter-spacing: 0.1em; color: var(--txt); }
.jq-row .tm { font-size: 11px; color: var(--txt-3); font-variant-numeric: tabular-nums; }

/* ---------------- 页脚 ---------------- */

.site-foot {
  margin-top: clamp(26px, 3vw, 42px);
  padding-top: 18px;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-3);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--txt-4);
}

/* ---------------- 动效 ---------------- */

.fade-in { animation: fadeUp 0.5s cubic-bezier(0.22, 0.68, 0.35, 1) both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.68, 0.35, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
}


/* ===========================================================
   扩充模块：八字 / 方位 / 卦象 / 穿衣 / 择日 / 节气年表 / 术语
   =========================================================== */

/* ---------------- 宜忌词条 ---------------- */

.yiji-title em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--txt-4);
  margin-left: 10px;
}

.yiji-list { display: flex; flex-wrap: wrap; gap: 5px 6px; align-items: center; }

.tchip {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--serif);
  font-size: clamp(12.5px, 1.02vw, 14px);
  line-height: 1.5;
  letter-spacing: 0.04em;
  padding: 2px 9px 3px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--txt);
  cursor: pointer;
  transition: background 0.26s ease, border-color 0.26s ease, color 0.26s ease;
}

.tchip.has {
  border-bottom-color: rgba(143, 168, 196, 0.42);
  border-bottom-width: 1px;
}

.tchip.yi.has { border-bottom-color: rgba(210, 69, 60, 0.45); }

.tchip:hover {
  background: rgba(143, 168, 196, 0.1);
  border-color: var(--ice-line);
  color: var(--moon);
}

.tchip:active { transform: translateY(0.5px); }

/* ---------------- 四柱八字 ---------------- */

.bazi-wrap { display: grid; gap: 14px; }

.bz-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-3);
  border-radius: 2px;
  overflow: hidden;
}

.bz-col {
  padding: clamp(10px, 1.2vw, 15px) 6px clamp(11px, 1.3vw, 16px);
  text-align: center;
  /* 每列是 <button>，必须先清掉 UA 默认的 2px outset 边框。
     否则只有首列被 :first-child 归零了 border-left，左边只剩表框那 1px 淡线，
     而其余三面仍是 2px 亮线——视觉上就是「左侧少了边框」。 */
  border: 0;
  border-left: 1px solid var(--line-3);
  background: rgba(255, 255, 255, 0.014);
}

.bz-col:first-child { border-left: none; }

.bz-col.bz-day {
  background: linear-gradient(180deg, rgba(143, 168, 196, 0.09), rgba(143, 168, 196, 0.02));
}

.bz-h {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--txt-4);
  margin-bottom: 7px;
}

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

.bz-gz .bz-g {
  font-family: var(--kai);
  font-size: clamp(21px, 2.1vw, 27px);
  line-height: 1.15;
  color: var(--moon);
}

.bz-gz .bz-z {
  font-family: var(--kai);
  font-size: clamp(21px, 2.1vw, 27px);
  line-height: 1.15;
  color: var(--txt-2);
}

.bz-col.bz-day .bz-gz .bz-g { color: var(--red-2); }
.bz-col.bz-day .bz-gz .bz-z { color: var(--red); }

.bz-s {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--txt-2);
}

.bz-s.dim { color: var(--txt-4); margin-top: 1px; }

.bz-ny {
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--txt-3);
}

.bz-wx {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ice);
  opacity: 0.85;
}

.bz-wxbox {
  padding: 12px 14px 13px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
}

.wx-title {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--txt-3);
  margin-bottom: 9px;
}

.wx-title em {
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--ice-2);
  margin-left: 8px;
}

.wx-rows { display: grid; gap: 6px; }

.wx-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 9px;
}

.wx-k {
  font-family: var(--kai);
  font-size: 13px;
  color: var(--txt-2);
  text-align: center;
}

.wx-bar {
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
}

.wx-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  opacity: 0.82;
  transition: width 0.5s cubic-bezier(0.22, 0.68, 0.35, 1);
}

.wx-n {
  font-size: 11px;
  color: var(--txt-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wx-note {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--txt-4);
  letter-spacing: 0.04em;
}

.bz-hint {
  margin-top: 9px;
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--ice);
  opacity: 0.75;
}

/* ---------------- 吉神方位罗盘 ---------------- */

.fw-wrap {
  display: grid;
  grid-template-columns: clamp(150px, 19vw, 210px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 26px);
  align-items: center;
}

.compass {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 210px;
}

.compass svg { width: 100%; height: 100%; display: block; }

.cp-ring {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 0.7;
}

.cp-ring-2 { stroke: var(--line-3); stroke-dasharray: 2 4; }

.cp-core {
  fill: var(--ice);
  opacity: 0.5;
}

.cp-dir {
  fill: var(--txt-3);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.cp-dir.major { fill: var(--txt-2); font-size: 8.6px; }

.cp-god circle {
  fill: rgba(143, 168, 196, 0.13);
  stroke: var(--ice-line);
  stroke-width: 0.8;
}

.cp-god text {
  fill: var(--moon);
  font-family: var(--kai);
  font-size: 9px;
  letter-spacing: 0;
}

.cp-cai circle {
  fill: rgba(210, 69, 60, 0.16);
  stroke: rgba(210, 69, 60, 0.5);
}

.cp-cai text { fill: var(--red-2); }

.fw-side { display: grid; gap: 12px; }

.fw-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }

.cp-lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--txt-2);
}

.cp-lg i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ice);
  opacity: 0.75;
  flex: none;
}

.cp-lg.cp-cai i { background: var(--red); opacity: 0.9; }

.fw-taisui {
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: var(--txt-4);
  padding-top: 2px;
  border-top: 1px dashed var(--line-3);
}

.pz-box {
  padding: 11px 13px 12px;
  border-left: 2px solid rgba(143, 168, 196, 0.4);
  background: rgba(143, 168, 196, 0.045);
}

.pz-title {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--txt-4);
  margin-bottom: 5px;
}

.pz-line {
  margin: 0;
  font-family: var(--kai);
  font-size: clamp(13px, 1.2vw, 15px);
  line-height: 1.85;
  letter-spacing: 0.08em;
  color: var(--txt-2);
}

/* ---------------- 每日卦象 ---------------- */

.gua-box {
  display: grid;
  grid-template-columns: clamp(74px, 9vw, 100px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 26px);
  align-items: center;
  padding: clamp(12px, 1.5vw, 18px) clamp(13px, 1.6vw, 20px);
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
}

.gua-body { min-width: 0; }

.gua-svg { width: 100%; height: auto; display: block; }

.gua-line {
  fill: var(--txt-2);
  opacity: 0.82;
}

.gua-line.dong {
  fill: var(--red-2);
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(232, 106, 94, 0.45));
}

.gua-name {
  font-family: var(--kai);
  font-size: clamp(19px, 1.9vw, 24px);
  letter-spacing: 0.14em;
  color: var(--moon);
  line-height: 1.3;
}

.gua-meta {
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--txt-4);
}

.gua-desc {
  margin-top: 9px;
  font-size: clamp(12.5px, 1.1vw, 13.5px);
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--txt-2);
}

/* ---------------- 五行穿衣 ---------------- */

.dress { display: grid; gap: 1px; border: 1px solid var(--line-3); border-radius: 2px; overflow: hidden; }

.dr-row {
  display: grid;
  grid-template-columns: 14px 34px 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.014);
  font-size: 12px;
}

.dr-row + .dr-row { border-top: 1px solid var(--line-3); }

.dr-chip {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.dr-lv {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--txt-4);
  white-space: nowrap;
}

.dr-row.dr-top .dr-lv { color: var(--red-2); }
.dr-row.dr-top { background: rgba(210, 69, 60, 0.05); }
.dr-row.dr-good .dr-lv { color: var(--red-2); }
.dr-row.dr-bad .dr-lv { color: var(--ice-2); }

.dr-wx {
  font-family: var(--kai);
  font-size: 13px;
  color: var(--txt);
  letter-spacing: 0.06em;
}

.dr-words { font-size: 11.5px; color: var(--txt-3); letter-spacing: 0.05em; }

.dr-note { font-size: 11px; color: var(--txt-4); white-space: nowrap; }

.dress-note {
  margin-top: 9px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--txt-4);
  letter-spacing: 0.04em;
}

/* ---------------- 择日检索 ---------------- */

.zeri-card { padding: clamp(15px, 1.8vw, 20px) clamp(15px, 1.8vw, 20px) clamp(16px, 1.9vw, 21px); }

.zeri-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.zeri-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--txt-2);
  white-space: nowrap;
}

.zeri-head.sub2 { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-3); }

.zeri-sub { font-size: 10px; letter-spacing: 0.1em; color: var(--txt-4); white-space: nowrap; }

.zchips { display: flex; flex-wrap: wrap; gap: 5px; }

.zchip {
  appearance: none;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 3px 10px 4px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--txt-2);
  cursor: pointer;
  transition: all 0.24s ease;
}

.zchip:hover { border-color: var(--ice-line); color: var(--moon); }

.zchip.on {
  border-color: rgba(143, 168, 196, 0.55);
  background: rgba(143, 168, 196, 0.14);
  color: var(--moon);
}

.zrange { display: flex; gap: 6px; margin-top: 11px; }

.zbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }

.zbar .zr-btn { flex: 1 1 0; min-width: 0; }
.zbar .zr-btn[data-range="custom"] { flex: 0 0 auto; padding: 5px 10px; }

.zbar-grade { margin-top: 7px; }

/* 自定义起止日期 */
.z-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line-3);
  border-radius: 3px;
  background: rgba(143, 168, 196, 0.04);
}
.z-custom input[type="date"] {
  flex: 1 1 132px;
  min-width: 0;
  appearance: none;
  font-family: var(--serif);
  font-size: 11px;
  color: var(--txt-2);
  padding: 5px 7px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
.z-custom input[type="date"]:focus { outline: none; border-color: rgba(143, 168, 196, 0.5); }
.zc-sep { font-size: 11px; color: var(--txt-4); }
.z-custom button {
  appearance: none;
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  cursor: pointer;
  transition: all 0.24s ease;
}
.z-custom .zc-go { color: var(--gold-2); border-color: rgba(201, 169, 97, 0.42); }
.z-custom .zc-go:hover { background: rgba(201, 169, 97, 0.1); }
.z-custom button:hover { color: var(--moon); }
.zc-err { flex: 1 1 100%; min-height: 0; font-size: 10.5px; color: var(--red-2); }

.zg-btn {
  appearance: none;
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  cursor: pointer;
  transition: all 0.24s ease;
}

.zg-btn:hover { color: var(--txt-2); border-color: var(--line-2); }

.zg-btn.on {
  color: var(--gold-2);
  border-color: rgba(201, 169, 97, 0.45);
  background: rgba(201, 169, 97, 0.1);
}

/* 锚定按钮：把检索起点固定在某个日期 */
.z-anchor {
  appearance: none;
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--serif);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  border: 1px dashed var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-4);
  cursor: pointer;
  transition: all 0.24s ease;
}

.z-anchor:hover { color: var(--txt-2); border-color: var(--ice-line); }

.z-anchor.on {
  color: var(--ice-2);
  border-style: solid;
  border-color: rgba(143, 168, 196, 0.42);
  background: rgba(143, 168, 196, 0.09);
}

/* 检索结果摘要行 */
.z-sum {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--txt-4);
  letter-spacing: 0.02em;
}

.z-sum b { color: var(--gold-2); font-weight: 400; }

.zr-btn {
  flex: 1;
  appearance: none;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 5px 0;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  cursor: pointer;
  transition: all 0.24s ease;
}

.zr-btn:hover { color: var(--txt-2); border-color: var(--line-2); }

.zr-btn.on {
  color: var(--moon);
  border-color: rgba(143, 168, 196, 0.5);
  background: rgba(143, 168, 196, 0.1);
}

.z-list {
  margin-top: 11px;
  max-height: 258px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 168, 196, 0.3) transparent;
}

.z-list::-webkit-scrollbar { width: 3px; }
.z-list::-webkit-scrollbar-thumb { background: rgba(143, 168, 196, 0.28); border-radius: 2px; }

.z-item {
  width: 100%;
  appearance: none;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: none;
  border-bottom: 1px solid var(--line-3);
  background: transparent;
  font-family: var(--serif);
  text-align: left;
  cursor: pointer;
  transition: background 0.22s ease;
}

.z-item:hover { background: rgba(143, 168, 196, 0.07); }

/* 主行：日期 · 周 · 农历 · 等级 */
.z-main {
  display: grid;
  grid-template-columns: 48px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.z-date {
  font-size: 12.5px;
  color: var(--moon);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.z-week { font-size: 10.5px; color: var(--txt-4); }

.z-lunar {
  font-size: 11.5px;
  color: var(--txt-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 等级徽标 */
.z-badge {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  padding: 1px 6px 2px;
  border-radius: 2px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.z-badge1 { color: var(--txt-4); border-color: var(--line-3); }
.z-badge2 { color: var(--red-2); border-color: rgba(210, 69, 60, 0.42); background: var(--red-dim); }
.z-badge3 { color: #17130a; border-color: transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }

/* 标签行：黄道/建除/吉神/凶煞 */
.z-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-left: 2px;
}

.zt {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  padding: 1px 5px 2px;
  border-radius: 2px;
  border: 1px solid transparent;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zt-good { color: rgba(232, 106, 94, 0.95); border-color: rgba(210, 69, 60, 0.3); background: var(--red-dim); }
.zt-bad { color: var(--ice-2); border-color: var(--ice-line); background: var(--ice-dim); }

/* 等级着色的日期数字 */
.z-g3 .z-date { color: var(--gold-2); }
.z-g2 .z-date { color: var(--red-2); }

.z-empty, .z-more {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--txt-4);
  letter-spacing: 0.05em;
  line-height: 1.7;
}

.hchips { display: flex; flex-wrap: wrap; gap: 5px; }

.hchip {
  appearance: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 40px;
  padding: 4px 8px 5px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(210, 69, 60, 0.06);
  color: var(--red-2);
  font-family: var(--serif);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.22s ease;
}

.hchip em {
  font-style: normal;
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.02em;
  color: var(--txt-4);
  transform: scale(0.95);
}

.hchip:hover { border-color: rgba(210, 69, 60, 0.45); background: rgba(210, 69, 60, 0.13); }

/* 本月吉日按等级着色：3=上吉 2=吉 1=平（平 日已不计入本月吉日，样式保留） */
.hchip.h-g1 { background: rgba(255, 255, 255, 0.03); color: var(--txt-3); border-color: var(--line-3); }
.hchip.h-g2 { background: var(--red-dim); color: var(--red-2); border-color: rgba(210, 69, 60, 0.34); }
.hchip.h-g3 { background: rgba(201, 169, 97, 0.14); color: var(--gold-2); border-color: rgba(201, 169, 97, 0.42); }

/* ---------------- 全年节气 ---------------- */

.fold-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.fold-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.26em;
  color: var(--txt-2);
}

.fold-arrow { font-size: 10.5px; letter-spacing: 0.1em; color: var(--txt-4); transition: color 0.24s ease; }

.fold-head:hover .fold-arrow { color: var(--ice); }

.jq-row.cur .nm { color: var(--red-2); }
.jq-row.cur .tm { color: var(--red); opacity: 0.8; }

/* ---------------- 可点击解读方块（统一按钮化） ---------------- */

/* 这些方块原本是 div/span/p，改为 button 后必须清掉浏览器默认样式，
   并给出「可点」的视觉线索：右下角微光 + hover 描边 + active 压下 */
.fact,
.xiu-box,
.chip,
.dr-row,
.bz-col,
.gua-box,
.ts-item,
.cp-lg,
.pz-line,
.fw-taisui,
.hd-link,
.zeri-info,
.wx-row,
.tag-btn,
.jq-btn,
.wn-btn,
.k-btn,
.dress-note-btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* facts 13 格 */
.fact {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line-3);
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 0 0 0 rgba(201, 169, 97, 0);
  transition: background 0.32s ease, box-shadow 0.32s ease;
}

.fact:active { background: rgba(201, 169, 97, 0.075); }

/* 神煞 chip */
.chip { display: inline-block; }

.chip.good:active,
.chip.bad:active { transform: translateY(0); background: rgba(201, 169, 97, 0.2); }

/* 二十八宿整块 */
.xiu-box {
  width: 100%;
  margin: 0;
  text-align: left;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.xiu-box:active { background: rgba(201, 169, 97, 0.12); }

/* 吉神方位图例 / 太岁行 */
.cp-lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 2px;
  padding: 2px 4px 2px 0;
  background: transparent;
  transition: background 0.26s ease, color 0.26s ease;
}

.cp-lg:active { background: rgba(255, 255, 255, 0.06); }

.fw-taisui {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px dashed var(--line-3);
  background: transparent;
  transition: color 0.26s ease;
}

.fw-taisui:active { color: var(--gold-2); }

/* 彭祖百忌两条 */
.pz-line {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  transition: color 0.26s ease;
}

.pz-line:active { color: var(--gold-2); }

/* 卦象整块 */
.gua-box {
  width: 100%;
  margin: 0;
  text-align: left;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.gua-box:active { background: rgba(255, 255, 255, 0.045); }

/* 五行穿衣每行 */
.dr-row {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  transition: background 0.26s ease;
}

.dr-row:active { background: rgba(255, 255, 255, 0.06); }

/* 四柱每列 */
.bz-col {
  border-radius: 0;
  text-align: center;
  transition: background 0.26s ease;
}

.bz-col:active { background: rgba(255, 255, 255, 0.06); }

/* 犯太岁每行 */
.ts-item {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  transition: background 0.26s ease;
}

.ts-item:active { background: rgba(255, 255, 255, 0.06); }

/* 时辰详情抬头（点开时辰详解） */
.hd-link {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  position: relative;
  padding-right: 74px;
  transition: color 0.26s ease;
}

.hd-more {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--gold);
  opacity: 0.82;
}

/* 时辰详情里的宜忌两行 */
.hd-yiji {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  margin-top: 6px;
}

.hd-yiji .lbl {
  flex: none;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--txt-4);
  margin-right: 2px;
}

/* 择日「事项说明」 */
.zeri-info {
  flex: none;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 2px 8px 3px;
  border: 1px solid var(--line-2);
  border-radius: 1px;
  background: rgba(201, 169, 97, 0.07);
  color: var(--gold);
  transition: all 0.26s ease;
}

.zeri-info:hover { background: rgba(201, 169, 97, 0.16); color: var(--gold-2); }

/* 节气行可点 */
.jq-row { cursor: pointer; transition: background 0.24s ease; }
.jq-row:active { background: rgba(255, 255, 255, 0.055); }

/* 罗盘上的吉神圆点可点 */
.cp-god { cursor: pointer; }
.cp-god:active circle { opacity: 0.72; }

/* 节日标签（宜忌之外的岁时节日，可点开释义） */
.tag-fests {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px 6px 3px;
  max-width: 100%;
}

.tag-btn {
  padding: 0 2px;
  font-family: var(--serif);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--red-2);
  border: 0;
  border-bottom: 1px dashed rgba(232, 106, 94, 0.5);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.24s ease, border-color 0.24s ease;
}

.tag-btn:active { color: #fff; border-color: var(--red-2); }

.tag-sep {
  font-style: normal;
  font-size: 10px;
  color: rgba(232, 106, 94, 0.55);
  padding: 0 1px;
}

/* 节气条里的物候 / 数九 / 三伏（可点） */
.jq-btn {
  padding: 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.24s ease;
}

.jq-btn:active { border-bottom-color: var(--gold); }
.jq-btn:active .n { color: var(--gold-2); }

/* 八字缺项（五行）可点 */
.wn-btn {
  display: inline;
  padding: 0 1px;
  border: 0;
  border-bottom: 1px dashed rgba(201, 169, 97, 0.55);
  border-radius: 0;
  background: transparent;
  color: var(--gold-2);
  font-size: inherit;
  letter-spacing: inherit;
}

.wn-btn:active { background: rgba(201, 169, 97, 0.16); }

/* 神煞分组标题可点 */
.shensha-col .k-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--txt-4);
  transition: color 0.26s ease;
}

.shensha-col .k-btn:active { color: var(--gold-2); }

/* 本月吉日标题可点；「另有 N 日平」的说明另起一行，不与标题抢宽度 */
.zeri-head .hd-note {
  flex-basis: 100%;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--txt-4);
  letter-spacing: 0.04em;
}
.zeri-head.sub2 { flex-wrap: wrap; }
.zeri-head .hd-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--txt-3);
  transition: color 0.26s ease;
}

.zeri-head .hd-btn:active { color: var(--gold-2); }

.zeri-head .hd-n {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--txt-4);
}

.zeri-head .hd-btn .k-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--gold);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 50%;
}

.shensha-col .k-more {
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--gold);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

@media (hover: hover) {
  .wn-btn:hover { background: rgba(201, 169, 97, 0.12); }
  .shensha-col .k-btn:hover { color: var(--gold); }
  .zeri-head .hd-btn:hover { color: var(--gold); }
}

/* 五行穿衣脚注可点 */
.dress-note-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--txt-4);
  text-align: left;
  transition: color 0.26s ease;
}

.dress-note-btn:active { color: var(--gold-2); }

.dn-more {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--gold);
  opacity: 0.8;
  margin-left: 4px;
}

@media (hover: hover) {
  .dress-note-btn:hover { color: var(--txt-3); }
  .dress-note-btn:hover .dn-more { opacity: 1; }
}

/* 节气列表行（月/年）已带 data-jq-name，指针提示 */
.jq-list .jq-row { cursor: pointer; }

@media (hover: hover) {
  .tag-btn:hover { color: #fff; border-color: var(--red-2); }
  .jq-btn:hover { border-bottom-color: var(--gold-dim); }
  .jq-btn:hover .n { color: var(--gold-2); }
}

/* ---------------- 命盘内可点解读方块 ---------------- */

.ch-kv,
.ch-strength[role="button"],
.wchip,
.nc,
.wg-cell,
.sancai,
.ch-fit,
.bz-col[role="button"],
.wx-row,
.ch-inl,
.bz-inl {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 原本是 div 的，改成按钮后要显式清掉原生边框，再补回各自的样子 */
button.ch-kv {
  border: 0;
  border-radius: 2px;
  background: transparent;
  padding: 2px 4px 3px;
  margin: -2px -4px -3px;
}
button.ch-kv:active { background: rgba(255, 255, 255, 0.05); }

button.wchip {
  border: 1px solid var(--line-3);
  border-radius: 2px;
  /* 忌用色 chip 没有自己的底色，必须显式声明透明，否则会透出原生灰底 */
  background: transparent;
}
button.wchip.xi { border-color: rgba(143, 168, 196, 0.4); }
button.wchip:active { background: rgba(255, 255, 255, 0.06); }

button.nc {
  border: 1px solid var(--line-3);
  border-radius: 2px;
}
button.nc:active { background: rgba(255, 255, 255, 0.05); }

button.wg-cell {
  border: 0;
  border-left: 1px solid var(--line-3);
}
button.wg-cell:active { background: rgba(255, 255, 255, 0.05); }

button.sancai {
  border: 1px solid var(--line-3);
  border-left-width: 2px;
  border-radius: 2px;
}
button.sancai:active { background: rgba(255, 255, 255, 0.05); }

button.ch-fit {
  display: block;
  width: 100%;
  border: 0;
  border-left: 2px solid var(--line-2);
  text-align: left;
}
button.ch-fit:active { background: rgba(255, 255, 255, 0.05); }

button.wx-row {
  width: 100%;
  margin: 0;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  transition: none;
}
button.wx-row:active { background: transparent; }

/* 柱与强弱：整体可点，内部保持原布局 */
.bz-col[role="button"] { transition: background 0.26s ease; }
.bz-col[role="button"]:active { background: rgba(255, 255, 255, 0.06); }
.ch-strength[role="button"] { transition: background 0.26s ease, border-color 0.26s ease; }
.ch-strength[role="button"]:active { background: rgba(255, 255, 255, 0.045); }

/* 柱内十神与纳音：小一号的可点内联 */
.bz-inl {
  display: inline-block;
  padding: 0 2px;
  border-bottom: 1px dashed rgba(201, 169, 97, 0.28);
  line-height: 1.5;
}
.bz-inl:active { color: var(--gold-2); border-bottom-color: var(--gold); }

/* 概览里的内联链接 */
.ch-inl {
  display: inline;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed rgba(201, 169, 97, 0.32);
  background: transparent;
  font-size: inherit;
  letter-spacing: inherit;
  color: var(--txt-2);
}
.ch-inl:active { color: var(--gold-2); border-bottom-color: var(--gold); }

/* 姓名相配框里的「看推法」提示 */
.ch-more {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
}

@media (hover: hover) {
  button.ch-kv:hover { background: rgba(255, 255, 255, 0.035); }
  button.wchip:hover { background: rgba(255, 255, 255, 0.045); }
  button.nc:hover,
  button.wg-cell:hover,
  button.sancai:hover,
  button.ch-fit:hover { background: rgba(255, 255, 255, 0.038); }
  /* 五行分布整行仍可点，但不做底色反馈，避免看起来像灰底输入框 */
  button.wx-row:hover { background: transparent; }
  button.wx-row:hover .wx-bar i { opacity: 1; }
  button.wx-row:hover .wx-k { color: var(--gold-2); }
  .bz-col[role="button"]:hover { background: rgba(255, 255, 255, 0.032); }
  .ch-strength[role="button"]:hover { background: rgba(255, 255, 255, 0.028); }
  .bz-inl:hover { color: var(--gold-2); border-bottom-color: var(--gold); }
  .ch-inl:hover { color: var(--gold-2); border-bottom-color: var(--gold); }
}

/* ---------------- 详情浮层（通用解读） ---------------- */

.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  /* 从命盘弹层里打开时抬到其上方（.above 由 app.js 动态加） */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.detail-sheet.open { opacity: 1; visibility: visible; }

.detail-sheet.above { z-index: 96; }

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 8, 0.74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.detail-body {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(492px, 100%);
  max-height: min(78vh, 660px);
  border: 1px solid var(--ice-line);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(18, 20, 26, 0.975), rgba(10, 10, 16, 0.975));
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9), 0 0 60px -30px rgba(143, 168, 196, 0.35);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.34s cubic-bezier(0.22, 0.68, 0.35, 1);
}

.detail-sheet.open .detail-body { transform: translateY(0) scale(1); }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px 13px;
  border-bottom: 1px solid var(--line-3);
}

.detail-titles { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.detail-kicker {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold-dim);
  text-transform: uppercase;
}

.detail-title {
  font-family: var(--kai);
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  color: var(--moon);
}

.detail-close {
  appearance: none;
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line-3);
  border-radius: 50%;
  background: transparent;
  color: var(--txt-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.24s ease;
}

.detail-close:hover { color: var(--red-2); border-color: rgba(210, 69, 60, 0.45); }

.detail-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 15px 20px 4px;
}

.detail-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.85;
  letter-spacing: 0.02em;
  color: var(--gold-2);
}

.detail-lead:empty { display: none; }

.detail-main p {
  margin: 0 0 11px;
  font-size: 13.5px;
  line-height: 1.95;
  letter-spacing: 0.03em;
  color: var(--txt);
  text-align: justify;
}

.detail-main .d-sec {
  margin: 16px 0 9px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--txt-3);
  border-left: 2px solid var(--gold-dim);
  padding-left: 8px;
}

.detail-main .d-sec:first-child { margin-top: 2px; }

.detail-main .d-kv { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-3); font-size: 12.5px; }
.detail-main .d-kv:first-of-type { border-top: none; }
.detail-main .d-kv .k { flex: none; width: 4.6em; color: var(--txt-3); letter-spacing: 0.08em; }
.detail-main .d-kv .v { flex: 1; color: var(--txt); line-height: 1.75; }

.detail-main .d-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 11px; }

.detail-main .d-tag {
  appearance: none;
  padding: 4px 10px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--txt-2);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.22s ease;
}

.detail-main .d-tag:hover { color: var(--gold-2); border-color: rgba(201, 169, 97, 0.42); }
.detail-main .d-tag.good { color: var(--red-2); border-color: rgba(210, 69, 60, 0.3); }
.detail-main .d-tag.bad { color: var(--ice-2); border-color: var(--ice-line); }

.detail-main .d-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 2px;
  padding: 7px 14px;
  border: 1px solid rgba(201, 169, 97, 0.42);
  border-radius: 999px;
  background: rgba(201, 169, 97, 0.08);
  color: var(--gold-2);
  font: 500 13px/1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.detail-main .d-jump:active { background: rgba(201, 169, 97, 0.18); }

.detail-hint {
  margin: 0;
  padding: 11px 20px calc(13px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-3);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--txt-4);
}

@media (max-width: 560px) {
  .detail-sheet { align-items: flex-end; padding: 0; }
  .detail-body {
    width: 100%;
    max-height: 82vh;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
    transform: translateY(24px);
  }
  .detail-sheet.open .detail-body { transform: translateY(0); }
  .detail-head { padding: 16px 17px 12px; }
  .detail-title { font-size: 19px; }
  .detail-scroll { padding: 14px 17px 2px; }
  .detail-hint { padding-left: 17px; padding-right: 17px; }
}


/* ===========================================================
   个人命盘
   =========================================================== */

body.no-scroll { overflow: hidden; }

.ghost-btn.ghost-accent {
  border-color: rgba(143, 168, 196, 0.45);
  color: var(--ice-2);
}

.ghost-btn.ghost-accent:hover {
  border-color: var(--ice);
  color: var(--moon);
  background: rgba(143, 168, 196, 0.12);
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.chart-modal.open { opacity: 1; visibility: visible; }

.chart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 7, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(780px, 100%);
  max-height: min(88vh, 900px);
  border: 1px solid var(--ice-line);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(17, 19, 25, 0.985), rgba(9, 9, 14, 0.99));
  box-shadow: 0 40px 100px -50px rgba(0, 0, 0, 0.95), 0 0 80px -40px rgba(143, 168, 196, 0.3);
  transform: translateY(14px) scale(0.99);
  transition: transform 0.38s cubic-bezier(0.22, 0.68, 0.35, 1);
  overflow: hidden;
}

.chart-modal.open .chart-panel { transform: translateY(0) scale(1); }

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 15px;
  border-bottom: 1px solid var(--line-3);
  flex: none;
}

.chart-title { display: flex; align-items: center; gap: 13px; }

.chart-seal {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  font-family: var(--kai);
  font-size: 21px;
  line-height: 1;
  color: var(--ice-2);
  background: rgba(143, 168, 196, 0.08);
}

.chart-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: var(--moon);
}

.chart-title p {
  margin: 4px 0 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--txt-4);
}

.chart-close {
  appearance: none;
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line-3);
  border-radius: 50%;
  background: transparent;
  color: var(--txt-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.24s ease;
}

.chart-close:hover { color: var(--red-2); border-color: rgba(210, 69, 60, 0.45); }

.chart-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 22px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 168, 196, 0.3) transparent;
}

.chart-scroll::-webkit-scrollbar { width: 4px; }
.chart-scroll::-webkit-scrollbar-thumb { background: rgba(143, 168, 196, 0.28); border-radius: 2px; }

/* ---------- 表单 ---------- */

.chart-form {
  display: grid;
  gap: 11px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-3);
}

.cf-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cf-label {
  flex: none;
  width: 36px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--txt-4);
}

.cf-hint { font-size: 10px; letter-spacing: 0.06em; color: var(--txt-4); opacity: 0.8; }

#cf-name {
  flex: 1;
  min-width: 130px;
  padding: 8px 12px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--moon);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.14em;
  outline: none;
  transition: border-color 0.24s ease, background 0.24s ease;
}

#cf-name::placeholder { color: var(--txt-4); letter-spacing: 0.06em; font-size: 12.5px; }
#cf-name:focus { border-color: var(--ice-line); background: rgba(143, 168, 196, 0.07); }

.cf-group { display: flex; gap: 0; flex: none; }

.gbtn, .cbtn {
  appearance: none;
  padding: 7px 15px;
  border: 1px solid var(--line-3);
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.24s ease;
}

.gbtn:first-child, .cbtn:first-child { border-radius: 2px 0 0 2px; }
.gbtn:last-child, .cbtn:last-child { border-radius: 0 2px 2px 0; border-left: none; }

.gbtn.on, .cbtn.on {
  color: var(--moon);
  border-color: rgba(143, 168, 196, 0.5);
  background: rgba(143, 168, 196, 0.13);
}

.cf-date { display: flex; gap: 7px; flex: 1; flex-wrap: wrap; }

.cf-date select {
  flex: 1;
  min-width: 82px;
  padding: 8px 8px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--txt);
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  outline: none;
  cursor: pointer;
  transition: border-color 0.24s ease;
}

.cf-date select:focus { border-color: var(--ice-line); }
.cf-date select option { background: #14161c; color: var(--txt); }

#cf-h { min-width: 148px; flex: 1.6; }

.chart-submit {
  appearance: none;
  justify-self: end;
  padding: 9px 34px;
  border: 1px solid rgba(143, 168, 196, 0.5);
  border-radius: 2px;
  background: rgba(143, 168, 196, 0.12);
  color: var(--moon);
  font-family: var(--kai);
  font-size: 15px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  cursor: pointer;
  transition: all 0.26s ease;
}

.chart-submit:hover {
  background: rgba(143, 168, 196, 0.22);
  border-color: var(--ice);
  box-shadow: 0 0 26px -12px rgba(143, 168, 196, 0.8);
}

.chart-submit:active { transform: translateY(1px); }

/* ---------- 结果 ---------- */

.ch-empty, .ch-err {
  margin: 26px 0;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--txt-4);
  line-height: 1.9;
}

.ch-err { color: var(--red-2); }

.ch-overview {
  padding: 16px 18px 14px;
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(143, 168, 196, 0.075), rgba(143, 168, 196, 0.02));
}

.ch-name {
  font-family: var(--kai);
  font-size: 24px;
  letter-spacing: 0.2em;
  color: var(--moon);
  line-height: 1.3;
}

.ch-name em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ice-2);
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  padding: 1px 7px 2px;
  margin-left: 10px;
  vertical-align: middle;
  opacity: 0.85;
}

.ch-ov-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px 16px;
  margin-top: 14px;
}

.ch-kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ch-kv .k {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--txt-4);
}

.ch-kv .v {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--txt);
  line-height: 1.5;
  word-break: break-word;
}

.ch-ov-note {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-3);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--txt-4);
  line-height: 1.7;
}

.ch-sec { margin-top: 24px; }
.ch-sec:first-child { margin-top: 0; }

.bz-col.bz-empty .bz-g.dim { color: var(--txt-4); opacity: 0.55; }

/* 强弱 */

.ch-more-hint { margin-top: 8px; font-size: 10.5px; color: var(--txt-4); letter-spacing: 0.04em; }

.ch-strength {
  padding: 15px 17px 16px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
}

.st-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.st-label {
  font-family: var(--kai);
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--moon);
}

.st-val { font-size: 12px; letter-spacing: 0.16em; }
.st-val.up { color: var(--red-2); }
.st-val.down { color: var(--ice-2); }

.st-bar {
  height: 5px;
  margin-top: 11px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.st-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ice), var(--moon));
  opacity: 0.8;
  transition: width 0.6s cubic-bezier(0.22, 0.68, 0.35, 1);
}

.st-meta {
  margin-top: 9px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--txt-4);
  line-height: 1.7;
}

.st-note {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--txt-2);
}

.wchips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.wc-k {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--txt-4);
  width: 30px;
  flex: none;
}

.wchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 2px 9px 3px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  color: var(--txt-2);
}

.wchip.xi { border-color: rgba(143, 168, 196, 0.4); background: rgba(143, 168, 196, 0.1); color: var(--moon); }
.wchip.ji { opacity: 0.72; }

.wc-none { font-size: 11.5px; color: var(--txt-4); }

.wx-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  opacity: 0.9;
}

/* 姓名 */

.name-chars {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.nc {
  flex: 1;
  min-width: 66px;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 12px 8px 10px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.016);
}

.nc.unknown { opacity: 0.55; }

.nc-char {
  font-family: var(--kai);
  font-size: 27px;
  line-height: 1.15;
  color: var(--moon);
}

.nc-wx {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ice-2);
}

.nc-st { font-size: 10px; letter-spacing: 0.06em; color: var(--txt-4); }

.name-sum {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 10px 14px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--txt-4);
}

.name-sum b {
  font-family: var(--kai);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--moon);
  margin-left: 5px;
}

.ch-fit {
  margin-top: 10px;
  padding: 9px 13px;
  border-left: 2px solid var(--line-2);
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.03em;
  color: var(--txt-2);
  background: rgba(255, 255, 255, 0.014);
}

.ch-fit.good { border-left-color: var(--red-2); }
.ch-fit.bad { border-left-color: var(--ice-2); }
.ch-fit.mid { border-left-color: var(--line-2); }

/* 五格 */

.wuge {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line-3);
  border-radius: 2px;
  overflow: hidden;
}

.wg-cell {
  padding: 11px 6px 10px;
  text-align: center;
  border-left: 1px solid var(--line-3);
  background: rgba(255, 255, 255, 0.014);
}

.wg-cell:first-child { border-left: none; }

.wg-k { font-size: 9.5px; letter-spacing: 0.16em; color: var(--txt-4); }

.wg-n {
  font-family: var(--kai);
  font-size: 21px;
  line-height: 1.25;
  color: var(--moon);
  margin-top: 3px;
}

.wg-w {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ice-2);
  margin-top: 2px;
}

.wg-cell.unknown { opacity: 0.45; }
.wg-cell.unknown .wg-n { color: var(--txt-4); }

.wg-d { font-size: 9px; letter-spacing: 0.02em; color: var(--txt-4); margin-top: 4px; opacity: 0.85; }

.sancai {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line-3);
  border-left-width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
}

.sancai.top { border-left-color: var(--red-2); }
.sancai.good { border-left-color: rgba(210, 69, 60, 0.6); }
.sancai.mid { border-left-color: var(--line-2); }
.sancai.bad { border-left-color: var(--ice-2); }

.sc-wx {
  font-family: var(--kai);
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--moon);
  white-space: nowrap;
}

.sc-txt { font-size: 12px; letter-spacing: 0.04em; color: var(--txt-2); line-height: 1.7; }

.ch-tip {
  padding: 14px 16px;
  border: 1px dashed var(--line-3);
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.85;
  color: var(--txt-3);
  letter-spacing: 0.04em;
}

.ch-tip p { margin: 0; }

.ch-foot {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-3);
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.05em;
  color: var(--txt-4);
  text-align: center;
}

/* 命盘内的标题走冷色，与主历的泥金区分 */
.chart-result .panel-head h2 { color: var(--ice-2); }
.chart-result .panel-head .rule { background: linear-gradient(90deg, var(--ice-line), transparent); }

/* ---------- 命盘响应式 ---------- */

@media (max-width: 760px) {
  .chart-modal { padding: 0; align-items: stretch; }
  .chart-panel {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: none;
    transform: translateY(20px);
  }
  .chart-head { padding: 14px 16px 12px; }
  .chart-scroll { padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .ch-ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wuge { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .wg-d { display: none; }
  .cf-label { width: 32px; }
  #cf-h { min-width: 132px; }
}

@media (max-width: 620px) {
  .head-actions { gap: 6px; }
  .ghost-btn { padding: 8px 10px; letter-spacing: 0.1em; text-indent: 0.1em; }
}

@media (max-width: 560px) {
  .chart-title h2 { font-size: 14px; letter-spacing: 0.2em; }
  .chart-title p { font-size: 9px; letter-spacing: 0.06em; }
  .chart-seal { width: 32px; height: 32px; font-size: 18px; }
  .cf-row { gap: 8px; }
  .cf-date { gap: 5px; }
  .cf-date select { min-width: 66px; font-size: 12.5px; padding: 8px 5px; }
  #cf-h { min-width: 118px; }
  .chart-submit { justify-self: stretch; letter-spacing: 0.4em; }
  .nc-char { font-size: 23px; }
  .wg-n { font-size: 18px; }
  .ch-name { font-size: 20px; }
  .sancai { flex-direction: column; align-items: flex-start; gap: 6px; }
  .st-label { font-size: 15px; }
}

@media (max-width: 380px) {
  .ch-ov-grid { grid-template-columns: 1fr; }
  .cf-date select { min-width: 58px; }
  #cf-h { min-width: 104px; }
  .nc { min-width: 54px; }
}

@media print {
  .chart-modal { display: none !important; }
}

/* ===========================================================
   十二生肖月
   =========================================================== */

.sx-card {
  margin-top: 26px;
  padding: 24px 26px 20px;
}

.sx-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-3);
}

.sx-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: var(--moon);
}

.sx-title p {
  margin: 5px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--txt-4);
}

.sx-sum { display: flex; gap: 8px; flex-wrap: wrap; }

.sx-tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 10px 4px;
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  color: var(--ice-2);
  background: var(--ice-dim);
  white-space: nowrap;
}

.sx-tag.dim {
  border-color: var(--line-3);
  background: transparent;
  color: var(--txt-3);
}

.sx-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.sx-cell {
  appearance: none;
  display: grid;
  gap: 7px;
  padding: 12px 13px 11px;
  text-align: left;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
  color: var(--txt);
  font-family: var(--serif);
  cursor: pointer;
  transition: border-color 0.26s ease, background 0.26s ease, transform 0.26s ease;
}

.sx-cell:hover {
  border-color: var(--ice-line);
  background: rgba(143, 168, 196, 0.06);
  transform: translateY(-1px);
}

.sx-cell.cur {
  border-color: var(--ice);
  background: rgba(143, 168, 196, 0.1);
  box-shadow: 0 0 22px -12px rgba(143, 168, 196, 0.9);
}

.sx-top {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.sx-m {
  font-family: var(--kai);
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--moon);
}

.sx-alias { font-size: 9.5px; letter-spacing: 0.14em; color: var(--txt-4); }

.sx-badge {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.04em;
  padding: 1px 6px 2px;
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 2px;
  color: var(--gold-2);
  background: var(--gold-dim);
  white-space: nowrap;
}

.sx-zhi { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 7px; }

.sx-z {
  font-family: var(--kai);
  font-size: 22px;
  line-height: 1;
  color: var(--ice-2);
}

.sx-sx {
  font-family: var(--kai);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--moon);
  opacity: 0.85;
}

.sx-gz {
  margin-left: auto;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--txt-3);
}

.sx-range {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 5px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--txt-3);
  font-variant-numeric: tabular-nums;
}

.sx-jq { white-space: nowrap; }

.sx-arrow { color: var(--txt-4); opacity: 0.7; }

.sx-wang {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--txt-4);
  padding-top: 6px;
  border-top: 1px dashed var(--line-3);
}

/* 犯太岁 */

.ts-block {
  margin-top: 22px;
  padding: 16px 18px 15px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.014);
}

.ts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 11px;
  border-bottom: 1px dashed var(--line-3);
}

.ts-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--ice-2);
}

.ts-note { font-size: 10px; letter-spacing: 0.06em; color: var(--txt-4); }

.ts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

/* 两行结构：首行「关系 + 生肖 + 地支」，次行独占整行放年份 */
.ts-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 9px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.012);
}

.ts-rel {
  flex: none;
  min-width: 42px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ice-2);
  text-align: center;
  padding: 2px 5px 3px;
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  background: var(--ice-dim);
  white-space: nowrap;
}

.ts-sx {
  flex: none;
  font-family: var(--kai);
  font-size: 17px;
  line-height: 1;
  color: var(--moon);
}

.ts-zhi {
  flex: none;
  font-size: 10.5px;
  color: var(--txt-4);
  letter-spacing: 0.06em;
}

.ts-years {
  flex: 1 0 100%;
  margin-left: 0;
  padding-top: 7px;
  border-top: 1px dashed var(--line-3);
  font-size: 10.5px;
  line-height: 1.75;
  letter-spacing: 0.03em;
  color: var(--txt-3);
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: break-word;
}

.sx-foot {
  margin: 16px 0 0;
  font-size: 10.5px;
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--txt-4);
}

/* ---------- 生肖月响应式 ---------- */

@media (max-width: 1180px) {
  .sx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sx-card { padding: 20px 18px 16px; }
  .sx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .sx-grid { grid-template-columns: 1fr; }
  .sx-cell { padding: 11px 12px 10px; }
  .sx-head { gap: 10px; }
  .sx-title h2 { font-size: 13.5px; }
  .sx-title p { font-size: 10px; line-height: 1.7; }
  .ts-list { grid-template-columns: 1fr; }
  .ts-years { font-size: 10px; }
}

@media (hover: none) {
  .sx-cell:hover { transform: none; }
}


/* ===========================================================
   个性化提醒条（依个人命盘生辰）
   =========================================================== */

.personal-bar {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--ice-line);
  border-radius: 3px;
  background: linear-gradient(100deg, rgba(143, 168, 196, 0.11), rgba(143, 168, 196, 0.025));
  box-shadow: 0 0 26px -20px rgba(143, 168, 196, 0.9);
}

/* 左侧生肖徽标 */
.pb-avatar {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 38px;
  padding: 5px 0 4px;
  border-right: 1px solid var(--ice-line);
  padding-right: 12px;
}

.pb-zi {
  font-family: var(--kai);
  font-size: 21px;
  line-height: 1;
  color: var(--moon);
  text-shadow: 0 0 16px rgba(220, 223, 228, 0.28);
}

.pb-sx {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ice-2);
  opacity: 0.85;
}

.pb-main { flex: 1; min-width: 0; }

.pb-who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pb-who-txt {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ice-2);
}

.pb-btn {
  appearance: none;
  margin-left: auto;
  padding: 2px 9px 3px;
  border: 1px solid var(--ice-line);
  border-radius: 2px;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  white-space: nowrap;
}

.pb-btn:hover {
  color: var(--moon);
  border-color: var(--ice);
  background: var(--ice-dim);
}

.pb-body { margin-top: 6px; display: grid; gap: 4px; }

.pb-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: var(--txt-2);
}

.pb-dot {
  flex: none;
  width: 4px;
  height: 4px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--txt-4);
}

/* 冲刑害破：朱砂 */
.pb-line.chong, .pb-line.xing, .pb-line.hai, .pb-line.po { color: var(--txt); }
.pb-line.chong .pb-dot, .pb-line.xing .pb-dot,
.pb-line.hai .pb-dot, .pb-line.po .pb-dot {
  background: var(--red-2);
  box-shadow: 0 0 7px rgba(232, 106, 94, 0.65);
}

/* 同支：月白 */
.pb-line.zhi .pb-dot {
  background: var(--moon);
  box-shadow: 0 0 7px rgba(220, 223, 228, 0.5);
}

/* 六合 / 三合 / 生日：银蓝 */
.pb-line.he .pb-dot, .pb-line.sanhe .pb-dot {
  background: var(--ice);
  box-shadow: 0 0 7px rgba(143, 168, 196, 0.6);
}

/* 空状态 */
.personal-bar.empty {
  border-style: dashed;
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.012);
  box-shadow: none;
  align-items: center;
  padding: 10px 14px;
}

.pb-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.pb-empty-txt {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--txt-3);
}

.personal-bar.empty .pb-btn { margin-left: auto; }

@media (max-width: 560px) {
  .personal-bar { padding: 11px 12px; gap: 10px; }
  .pb-avatar { min-width: 32px; padding-right: 10px; }
  .pb-zi { font-size: 18px; }
  .pb-line { font-size: 12px; line-height: 1.7; }
  .pb-empty-txt { font-size: 11.5px; }
}

@media (hover: none) {
  .pb-btn:hover { background: transparent; border-color: var(--ice-line); color: var(--txt-3); }
}

/* ---------------- 响应式 ---------------- */

/* 大屏：放大基准，避免 4K 上元素过小 */
@media (min-width: 1440px) {
  body { font-size: 15.5px; }
  .almanac { padding: 30px 34px 32px; }
}

@media (min-width: 1560px) {
  .page { max-width: 1400px; }
}

@media (min-width: 1900px) {
  body { font-size: 16px; }
  .page { max-width: 1480px; }
}

/* 小笔记本 / 平板横屏：侧栏收窄，历盘缩小 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .dial { width: 112px; height: 112px; }
}

/* 单列：侧栏转为两栏并排，避免页面过长 */
@media (max-width: 1020px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .dial { width: 104px; height: 104px; }
}

/* 平板竖屏：历盘让位给日期主体 */
@media (max-width: 900px) {
  .dial { display: none; }
  .day-head { grid-template-columns: auto minmax(0, 1fr) auto; }
}

/* 手机：主结构纵向化 */
@media (max-width: 760px) {
  /* 手机上顶栏改成两行：品牌 + 操作 / 日期 + 版块。
     不用一行硬挤——390px 下「品牌名 + 完整日期 + 三个按钮」的最小宽度约 590px，
     硬挤会把整个页面撑出横向滚动条。bar-top 用 display:contents 拆开，
     让它的子元素直接参与 bar-inner 的换行。 */
  .bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .bar-top { display: contents; }
  /* 一条零宽换行：把「日期胶囊 + 版块导航」推到第二行 */
  .bar-inner::after { content: ""; order: 5; flex: 0 0 100%; height: 0; }
  /* 第一行要同时放下「站名 + 三个按钮」。flex 换行是按未压缩宽度判断的，
     所以这里必须真的把两边都做窄，不能指望 h1 自动省略。 */
  .brand { order: 1; flex: 0 1 auto; min-width: 0; gap: 8px; }
  .brand-taiji { width: 22px; height: 22px; }
  .brand-txt { min-width: 0; overflow: hidden; }
  .brand-txt h1 {
    font-size: 13px;
    letter-spacing: 0.04em;
    text-indent: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .head-actions { order: 2; margin-left: auto; gap: 4px; }
  .site-head .ghost-btn { min-height: 30px; padding: 0 8px; font-size: 11px; letter-spacing: 0.06em; }
  .bar-quick button { min-width: 28px; min-height: 30px; padding: 0 5px; font-size: 11px; }
  .bar-quick #btn-today { min-width: 42px; }
  /* 手机上页脚与站名说明让位，第一行只留「站名 + 三键 + 命盘」 */
  .brand-txt p { display: none; }
  /* 胶囊只留「日期 · 农历」，星期和「今日」在手机上太占地方；
     「今日」是否选中已由今日按钮的金底表达。 */
  .bar-date { order: 6; flex: 0 1 auto; min-width: 0; font-size: 11px; padding: 5px 8px; gap: 5px; }
  .bar-date i:nth-of-type(n + 2),
  .bar-date em:nth-of-type(n + 2) { display: none; }
  .bar-nav { order: 7; flex: 1 1 0; min-width: 0; gap: 2px; padding: 0; max-height: 40px; }
  /* 手机上一行放不下十个版块，右缘渐隐提示「还能往右滑」 */
  .bar-nav {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  }
  .bar-nav button { padding: 5px 9px; letter-spacing: 0.1em; text-indent: 0.1em; }
  /* 滑到末尾时不再需要右缘渐隐 */
  .bar-nav.at-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
  /* 滚走以后两行都保留：版块导航常驻，随时可切；只把第一行压紧一点 */
  .site-head.compact .bar-top { min-height: 0; }
  /* 第一行压紧，好把高度还给内容，但站名与三键仍保持一行 */
  .site-head.compact .brand { gap: 6px; }
  .site-head.compact .brand-txt h1 { font-size: 12px; letter-spacing: 0.02em; text-indent: 0.02em; }
  .site-head.compact .head-actions { gap: 3px; }
  .site-head.compact .ghost-btn { padding: 0 7px; }
  .site-head.compact .bar-quick button { min-width: 26px; padding: 0 4px; }
  .site-head.compact .bar-quick #btn-today { min-width: 38px; }
  .site-head.compact .bar-date { font-size: 10.5px; padding: 4px 7px; }
  .almanac { padding: 16px 14px 18px; }  .day-main { flex-direction: column; align-items: flex-start; gap: 10px; }
  .dh-solar { align-items: center; }
  .dh-lunar { border-left: none; padding-left: 0; }
  .yiji { grid-template-columns: 1fr; }
  .yiji-col + .yiji-col { border-left: none; border-top: 1px solid var(--line-3); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact,
  .fact:nth-child(3n + 1) { border-left: none; padding-left: 12px; padding-right: 12px; }
  .fact:nth-child(even) { border-left: 1px solid var(--line-3); }
  .shensha { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr; }
  .hours { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .taiji-watermark { opacity: 0.04; }
  .jq-item { flex-wrap: wrap; white-space: normal; }
  .panel-head .sub { display: none; }
  .site-foot { flex-direction: column; gap: 4px; }
}

/* 窄屏手机：单列信息、三列时辰 */
@media (max-width: 560px) {
  .page { padding-bottom: 40px; }
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(even) { border-left: none; }
  .hours { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hour .hz { font-size: 17px; }
  .hour .hg { font-size: 9.5px; letter-spacing: 0.02em; }
  .dh-ganzhi,
  .tag { font-size: 10px; padding: 2px 7px 3px; }
  .hour-detail { padding: 12px 14px; font-size: 12px; }
  .hour-detail .sep { margin: 0 6px; }
  .dial-face {
    box-shadow:
      0 0 0 1px rgba(226, 236, 250, 0.40),
      0 0 10px rgba(200, 216, 240, 0.22),
      0 0 26px rgba(184, 203, 234, 0.12);
  }
  .dial-face::before { filter: blur(4px); inset: -20%; }
  .brand-taiji::before { filter: blur(3px); inset: -24%; }
}

/* 极窄屏（320—380） */
@media (max-width: 380px) {
  /* 极窄屏（iPhone SE / 大部分安卓）：顶部一行必须容下「站名 + 三键」。
     flex 换行是按「未经压缩的宽度」判断的，所以这里只能真的把两者做窄，
     不能指望 h1 自动省略。 */
  .bar-inner { gap: 5px; }
  .brand-txt h1 { font-size: 12.5px; letter-spacing: 0.04em; text-indent: 0.04em; }
  .brand-txt p { letter-spacing: 0.14em; }
  .brand-taiji { width: 21px; height: 21px; }
  .head-actions { gap: 4px; }
  .site-head .ghost-btn { padding: 0 6px; font-size: 10.5px; letter-spacing: 0.06em; }
  .bar-quick button { min-width: 24px; padding: 0 3px; font-size: 10.5px; }
  .bar-quick #btn-today { min-width: 36px; }
  .bar-date { font-size: 10.5px; padding: 4px 7px; gap: 4px; }
  .bar-nav button { padding: 4px 7px; }
  .ghost-btn { padding: 8px 10px; letter-spacing: 0.1em; }
  .hours { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dh-day { font-size: 40px; }
  .jieqi-strip { font-size: 11px; }
}

/* 横屏矮屏：压缩纵向留白 */
@media (max-height: 560px) and (orientation: landscape) {
  .site-head { padding-top: 14px; padding-bottom: 10px; }
  .almanac { padding-top: 14px; }
  .dial { display: none; }
  .day-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .taiji-watermark { opacity: 0.03; }
}

/* 触控设备：去掉悬停位移，放大点击区 */
@media (hover: none), (pointer: coarse) {
  .hour:hover,
  .dp-chip:hover,
  .dp-tab:hover,
  .dp-cell:hover,
  .chip:hover,
  .ghost-btn:hover,
  .bar-quick button:hover,
  .bar-nav button:hover,
  .nav-btn:hover { transform: none; }
  .hour:hover {
    background: rgba(255, 255, 255, 0.022);
    border-color: var(--line-3);
    box-shadow: none;
  }
  .dp-cell:hover { background: rgba(255, 255, 255, 0.022); border-color: transparent; }
  .nav-btn { min-width: 40px; min-height: 40px; }
  .nav-btn.sm { min-width: 34px; min-height: 34px; }
}


/* ---------------- 扩充模块响应式 ---------------- */

@media (max-width: 1180px) {
  .fw-wrap { grid-template-columns: clamp(140px, 22vw, 190px) minmax(0, 1fr); }
  .z-list { max-height: 226px; }
}

@media (max-width: 900px) {
  .bz-table { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dr-row { grid-template-columns: 13px 32px 26px minmax(0, 1fr) auto; gap: 8px; }
  .dr-note { font-size: 10.5px; }
}

@media (max-width: 760px) {
  .fw-wrap { grid-template-columns: 1fr; justify-items: center; }
  .compass { max-width: 178px; }
  .fw-side { width: 100%; }
  .fw-legend { justify-content: center; }
  .fw-taisui { text-align: center; }
  .gua-box { grid-template-columns: 66px minmax(0, 1fr); gap: 14px; }
  .bz-s { font-size: 10.5px; }
  .bz-ny { font-size: 10px; }
  .z-list { max-height: 240px; }
}

@media (max-width: 560px) {
  .bz-col { padding: 9px 4px 10px; }
  .bz-h { font-size: 9px; letter-spacing: 0.16em; text-indent: 0.16em; margin-bottom: 5px; }
  .bz-ny { display: none; }
  .bz-wxbox { padding: 10px 11px 11px; }
  .dr-row { grid-template-columns: 12px 30px 24px minmax(0, 1fr); gap: 7px; padding: 7px 10px; }
  .dr-note { display: none; }
  .dr-words { font-size: 11px; }
  .gua-box { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .gua-name { font-size: 18px; }
  .gua-desc { font-size: 12.5px; margin-top: 7px; }
  .z-main { grid-template-columns: 44px 26px minmax(0, 1fr) auto; gap: 7px; }
  .z-tags { gap: 3px; }
  .zt { font-size: 9px; padding: 1px 4px 2px; }
  .zeri-head h3 { letter-spacing: 0.2em; }
  .pz-box { padding: 10px 11px 11px; }
}

@media (max-width: 380px) {
  .bz-gz .bz-g, .bz-gz .bz-z { font-size: 19px; }
  .bz-s { font-size: 9.5px; }
  .wx-row { grid-template-columns: 18px minmax(0, 1fr) 16px; gap: 7px; }
  .zchip { font-size: 11.5px; padding: 3px 8px 4px; }
  .hchip { min-width: 30px; }
}

/* 超窄屏（≤340px，如 iPhone SE 一代 / 老安卓）：站名实在挤不下，
   只留太极图标，把整行让给操作按钮；站名不丢，页面标题里仍在。 */
@media (max-width: 340px) {
  .brand-txt { display: none; }
  .brand { gap: 0; }
  .brand-taiji { width: 24px; height: 24px; }
}

@media (hover: none), (pointer: coarse) {
  .tchip, .zchip, .zr-btn, .z-item, .hchip, .fold-head, .detail-close, .d-tag, .d-jump { touch-action: manipulation; }
  .tchip:active, .zchip:active, .zr-btn:active, .hchip:active { background: rgba(143, 168, 196, 0.14); }
  .z-item:active { background: rgba(143, 168, 196, 0.1); }
}

@media print {
  .zeri-card, #jieqi-year, .detail-sheet, .dress-note, .wx-note { display: none !important; }
  .bazi-wrap, .fw-wrap, .gua-box, .dress { break-inside: avoid; }
  .bz-col.bz-day { background: #f4f4f4; }
  .tchip { border-color: #ccc; }
}

/* ---------------- 打印 ---------------- */

@media print {
  .stars, .aura, .taiji-watermark, .head-actions, .nav-btn, .dial, .dp-panel, .share-thumb { display: none !important; }
  /* 常驻顶栏在纸上没有意义，还原成普通标题行 */
  .site-head {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-bottom: 1px solid #ccc !important;
  }
  .bar-inner { max-width: none; padding: 0; }
  .bar-top { min-height: 0; padding: 0 0 8px; }
  .bar-nav { display: none !important; }
  body { background: #fff; color: #1a1a1a; }
  .page { max-width: none; padding: 0; }
  .layout { grid-template-columns: 1fr; }
  .almanac, .card { background: #fff; box-shadow: none; border-color: #ccc; backdrop-filter: none; }
  .reveal { opacity: 1; transform: none; }
  .dh-lunar-big { color: #8a1f19; -webkit-text-fill-color: #8a1f19; filter: none; background: none; }
  .dh-day, .fact .v, .yiji-list, .hour .hz { color: #111; }
  .fact .k, .yiji-title, .panel-head h2 { color: #666; }
  .chip, .tag { color: #333; border-color: #ccc; background: #f6f6f6; }
  .hour, .note-card { break-inside: avoid; }
}


/* ===========================================================
   信息架构改版：章节分区 + 章节导航 + 信息网格分层
   （追加在文件末尾，不改动上方任何既有规则）
   =========================================================== */

/* 桌面：左竖排章节导航占据首列，正文整体右移一列 */
.page {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  column-gap: clamp(14px, 1.8vw, 26px);
}
.chapter-rail {
  grid-column: 1;
  grid-row: 1 / span 4;
  position: sticky;
  top: calc(var(--bar-h, 0px) + 22px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
  z-index: 25;
}
.chapter-rail button {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-left: 2px solid var(--line-2);
  border-radius: 0 2px 2px 0;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-align: left;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.chapter-rail button i {
  font-style: normal;
  font-size: 11px;
  color: var(--txt-4);
  transition: color .25s ease;
}
.chapter-rail button:hover { color: var(--txt); border-left-color: var(--line); }
.chapter-rail button.on {
  color: var(--gold-2);
  border-left-color: var(--gold);
  background: linear-gradient(90deg, var(--gold-dim), transparent);
}
.chapter-rail button.on i { color: var(--gold); }
.layout, .ch-year-wrap, .site-foot { grid-column: 2; min-width: 0; }

/* 章节标题条 */
.ch-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line-2);
  scroll-margin-top: calc(var(--bar-h, 0px) + 28px);
}
.ch-head:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.ch-no {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1;
  box-shadow: inset 0 0 12px -6px var(--gold);
}
.ch-text { flex: none; }
.ch-text h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--txt);
}
.ch-text p {
  margin: 4px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--txt-4);
}
.ch-line {
  flex: 1;
  height: 1px;
  min-width: 12px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.ch-year-wrap { margin-top: clamp(16px, 1.9vw, 26px); }

/* 信息网格「更多」 */
.fact-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line-3);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.012);
  color: var(--txt-3);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.fact-toggle:hover, .fact-toggle.on { color: var(--gold-2); border-color: var(--line); background: var(--gold-dim); }
.fact-toggle span { font-size: 12px; opacity: .7; }
.facts-more { margin-top: 0; }
.facts-more[hidden] { display: none; }

/* 手机 / 平板：左竖排收起为贴在顶栏下方的横排轨 */
@media (max-width: 1100px) {
  .page { display: block; }
  .chapter-rail {
    position: sticky;
    top: var(--bar-h, 0px);
    z-index: 30;
    flex-direction: row;
    gap: 2px;
    margin: 0 calc(-1 * clamp(16px, 2.6vw, 34px)) 14px;
    padding: 6px clamp(16px, 2.6vw, 34px);
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--bar-bg);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
    border-bottom: 1px solid var(--line);
  }
  .chapter-rail::-webkit-scrollbar { display: none; }
  .chapter-rail {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .chapter-rail button {
    flex: 0 0 auto;
    width: auto;
    padding: 6px 11px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-size: 11.5px;
    white-space: nowrap;
  }
  .chapter-rail button.on { border-color: var(--line); }
  .ch-head { scroll-margin-top: calc(var(--bar-h, 0px) + 64px); }
}
@media (max-width: 560px) {
  .ch-text p { display: none; }
  .ch-no { width: 28px; height: 28px; font-size: 13px; }
  .ch-text h2 { font-size: 12.5px; }
}


/* ===========================================================
   全面优化追加：今日摘要 / 冲煞 / 九宫飞星 / 月历工具箱 / 出处
   沿用原有玄夜·金篆配色；浮层统一挂 body 层，避开 .almanac overflow:hidden
   =========================================================== */

/* ---------- 今日一句话结论 + 冲煞生肖卡（壹章，摘要条） ---------- */
.day-summary {
  margin: clamp(14px, 1.8vw, 20px) 0 2px;
  padding: clamp(14px, 1.7vw, 18px) clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(201,169,97,0.055), rgba(255,255,255,0.012));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.ds-lead { margin-bottom: 10px; }
.ds-badge {
  display: inline-block;
  padding: 5px 13px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold-2);
  font-size: clamp(13px, 1.15vw, 15px);
  letter-spacing: 0.12em;
  background: var(--gold-dim);
}
.ds-badge.bane { border-color: var(--ice-line); color: var(--ice-2); background: var(--ice-dim); }
.ds-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  font-size: clamp(13px, 1.1vw, 14.5px);
  line-height: 1.65;
  border-top: 1px solid var(--line-3);
}
.ds-row b {
  flex: none;
  min-width: 42px;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.ds-yi b { color: var(--red-2); }
.ds-ji b { color: var(--ice-2); }
.ds-chong b { color: var(--gold-2); }
.ds-row span { color: var(--txt-2); overflow-wrap: anywhere; }
.ds-zx {
  flex: none;
  margin-left: auto;
  padding: 2px 9px;
  border: 1px solid var(--ice-line);
  border-radius: 999px;
  color: var(--ice-2);
  font-size: 11px !important;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .ds-row { flex-wrap: wrap; gap: 4px 10px; }
  .ds-zx { margin-left: 0; }
}

/* ---------- 九宫飞星（叁章） ---------- */
.fx-grids { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 1.8vw, 22px); margin-top: 16px; }
.fx-wrap { min-width: 0; }
.fx-title { font-size: 12.5px; letter-spacing: 0.1em; color: var(--ice-2); margin-bottom: 10px; text-align: center; }
.fx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.fx-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 62px;
  padding: 6px 2px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: rgba(255,255,255,0.014);
  text-align: center;
}
.fx-cell.fx-mid { border-color: var(--gold); background: var(--gold-dim); }
.fx-cell.fx-good .fx-star { color: var(--red-2); }
.fx-cell.fx-bad .fx-star { color: var(--ice-2); }
.fx-dir { font-size: 10px; color: var(--txt-4); letter-spacing: 0.08em; }
.fx-star { font-family: var(--serif); font-size: clamp(18px, 1.8vw, 22px); line-height: 1; }
.fx-name { font-size: 10px; color: var(--txt-3); white-space: nowrap; }
.fx-luck { font-size: 10px; letter-spacing: 0.1em; }
.fx-good .fx-luck { color: var(--red-2); }
.fx-bad .fx-luck { color: var(--ice-2); }
.fx-note { margin-top: 14px; font-size: 11.5px; line-height: 1.8; color: var(--txt-3); }
@media (max-width: 760px) {
  .fx-grids { grid-template-columns: 1fr; }
  .fx-cell { min-height: 56px; }
}

/* ---------- 日期胶囊月历按钮 ---------- */
.dp-chip.dp-cal { color: var(--ice-2); border-color: var(--ice-line); }
.dp-chip.dp-cal:hover { color: var(--gold-2); border-color: var(--gold); }

/* ---------- 工具箱模态（月历居中弹窗） ---------- */
.tool-modal {
  position: fixed;
  inset: 0;
  z-index: 97;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.tool-modal.open { opacity: 1; visibility: visible; }
.tool-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 6, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tool-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(20,20,28,0.97), rgba(10,10,16,0.98));
  box-shadow: 0 24px 80px -20px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
}
.tool-modal.open .tool-panel { transform: translateY(0) scale(1); }
.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-2);
}
.tool-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: 0.14em; }
.tool-seal {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--gold); border-radius: 5px;
  color: var(--gold-2); font-size: 14px; background: var(--gold-dim);
}
.tool-close {
  width: 32px; height: 32px; line-height: 1;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: transparent; color: var(--txt-2); font-size: 20px; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.tool-close:hover { color: var(--gold-2); border-color: var(--gold); }
.tool-tabs {
  display: flex; gap: 2px; padding: 10px 16px 0;
  border-bottom: 1px solid var(--line-2); overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.tool-tabs::-webkit-scrollbar { display: none; }
.tool-tabs button {
  flex: none; padding: 8px 14px;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--txt-3);
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.08em; cursor: pointer;
}
.tool-tabs button:hover { color: var(--txt); }
.tool-tabs button.on { color: var(--gold-2); border-bottom-color: var(--gold); }
.tool-scroll { padding: 18px 20px 24px; overflow-y: auto; }
.tool-view h3 { margin: 0 0 14px; font-size: 15px; letter-spacing: 0.1em; color: var(--gold-2); font-weight: 500; }

/* 月历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: clamp(17px, 2vw, 21px); letter-spacing: 0.16em; color: var(--gold-2); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 6px; }
.cal-week span { padding: 4px 0; text-align: center; font-size: 11px; letter-spacing: 0.1em; color: var(--txt-4); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50px; padding: 4px 2px;
  border: 1px solid var(--line-3); border-radius: 6px;
  background: rgba(255,255,255,0.012); color: var(--txt);
  font-family: var(--serif); cursor: pointer; transition: background .2s, border-color .2s;
}
.cal-cell:hover:not(:disabled) { background: var(--gold-dim); border-color: var(--gold); }
.cal-cell .cd { font-size: clamp(15px, 1.6vw, 18px); line-height: 1.2; }
.cal-cell .cl { margin-top: 3px; font-size: 10px; color: var(--txt-4); line-height: 1.2; text-align: center; overflow: hidden; white-space: nowrap; max-width: 100%; text-overflow: ellipsis; }
.cal-cell.today { border-color: var(--red); }
.cal-cell.today .cd { color: var(--red-2); }
.cal-cell.sel { background: var(--gold-dim); border-color: var(--gold); }
.cal-cell.sel .cd { color: var(--gold-2); }
.cal-cell.fest .cl { color: var(--red-2); }
.cal-cell.jq .cl { color: var(--ice-2); }
.cal-cell.out { opacity: 0.28; cursor: default; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 11px; color: var(--txt-4); }
.dp-now { padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--gold-2); font-family: var(--serif); font-size: 12px; cursor: pointer; }
.dp-now:hover { border-color: var(--gold); }
@media (max-width: 480px) {
  .cal-cell { min-height: 42px; }
  .cal-cell .cl { font-size: 9px; }
  .tool-scroll { padding: 14px 12px 20px; }
}

/* 换算 / 检索 / 对比 / 纪念日 表单 */
.tf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.tf-row > b { min-width: 92px; font-size: 12.5px; color: var(--txt-2); font-weight: 500; letter-spacing: 0.06em; }
.tf-row input[type="date"],
.tf-row input[type="text"],
.tf-row input[type="number"],
.tf-row select {
  padding: 7px 10px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: rgba(255,255,255,0.03); color: var(--txt);
  font-family: var(--sans); font-size: 13px;
}
.tf-row input[type="number"] { width: 78px; }
.tf-row input[type="date"] { color-scheme: dark; }
.tf-row button, .tf-share button {
  padding: 7px 15px;
  border: 1px solid var(--gold); border-radius: 6px;
  background: var(--gold-dim); color: var(--gold-2);
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.08em; cursor: pointer;
}
.tf-row button:hover, .tf-share button:hover { background: rgba(201,169,97,0.2); }
.tf-run { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--txt-2); }
.tf-out { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line-3); border-radius: 8px; background: rgba(255,255,255,0.012); font-size: 13px; line-height: 1.8; min-height: 42px; }
.tf-ok { color: var(--gold-2); }
.tf-err { color: var(--red-2); }
.tf-muted { color: var(--txt-4); margin: 0; }
.tf-hits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tf-hit { padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; color: var(--txt-2); font-family: var(--serif); font-size: 12px; cursor: pointer; }
.tf-hit:hover { border-color: var(--gold); color: var(--gold-2); }
.tf-hit i { font-style: normal; margin: 0 2px; }
.tf-hit i.yi { color: var(--red-2); }
.tf-hit i.ji { color: var(--ice-2); }
.tf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tf-table th, .tf-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-3); text-align: left; vertical-align: top; line-height: 1.6; }
.tf-table thead th { color: var(--gold-2); border-bottom-color: var(--line); }
.tf-table tbody th { color: var(--txt-3); font-weight: 500; width: 60px; }
.mine-item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-3); font-size: 13px; }
.mine-item b { color: var(--txt); }
.mine-item span { color: var(--txt-3); font-size: 12px; }
.mine-item em { margin-left: auto; color: var(--ice-2); font-style: normal; }
.mine-item button { padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 5px; background: transparent; color: var(--txt-4); font-family: var(--serif); font-size: 11px; cursor: pointer; }
.mine-item button:hover { color: var(--red-2); border-color: var(--red); }
.tf-share { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }

/* ---------- 出处与说明（伍章） ---------- */
#sources-card h3 { margin-top: 0; }
#sources-card p { font-size: 12.5px; line-height: 1.85; color: var(--txt-2); margin: 8px 0; }
#sources-card p b { color: var(--gold-2); font-weight: 500; }
#sources-card .src-disclaim { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); color: var(--txt-4); font-size: 11.5px; }

/* ---------- 飞星轻交互（可点宫格 + 盘面翻页） ---------- */
.fx-cell { cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.fx-cell:hover { border-color: var(--gold-2); background: rgba(255,255,255,0.055); transform: translateY(-1px); }
.fx-cell:active { transform: translateY(0); }
.fx-cell:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
.fx-title { display: flex; align-items: center; justify-content: center; gap: 5px; }
.fx-nav { display: inline-flex; align-items: center; gap: 4px; }
.fx-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--line-2);
  border-radius: 4px; background: transparent; color: var(--txt-3);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.fx-arrow:hover { color: var(--gold-2); border-color: var(--gold); }
.fx-arrow:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
.fx-view-bar { margin-top: 12px; text-align: center; font-size: 12px; color: var(--txt-3); }
.fx-view-bar b { color: var(--gold-2); font-weight: 500; }
.fx-now { color: var(--txt-4); }
.fx-reset {
  margin-left: 8px; padding: 3px 10px; border: 1px solid var(--line-2);
  border-radius: 5px; background: transparent; color: var(--ice-2);
  font-family: var(--serif); font-size: 11.5px; cursor: pointer;
}
.fx-reset:hover { border-color: var(--ice-2); }
.fx-reset:focus-visible { outline: 1px solid var(--ice-2); outline-offset: 1px; }
