/* ==========================================================================
   晋阳阁 JINYANG · 设计系统 v2（卡片居中版）
   纯黑白 · 无彩色 · 无阴影 · 圆角为 0
   每个模块一张白卡，横向居中，内容居中排列
   ========================================================================== */

:root {
  /* 色板：只有黑白灰 */
  --bg:       #F0EFEA;   /* 页面底 */
  --card:     #FFFFFF;   /* 卡片底 */
  --ink:      #111111;
  --text:     #1F1F1F;
  --muted:    #5C5C5C;
  --faint:    #6F6F6F;
  --line:     #E4E2DC;
  --reverse:  #F5F4F0;

  /* 字体 */
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;

  /* 8pt 节奏 */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s6: 48px;
  --s8: 64px;
  --s12: 96px;

  /* 栅格 */
  --header-h: 72px;
  --card-w: 760px;
  --card-pad-y: 64px;
  --card-pad-x: 48px;
  --radius: 10px;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- 重置 ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, dl, dd, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }

/* hidden 属性优先于任何 display 设定 */
[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

::selection { background: var(--ink); color: var(--bg); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ---------- 页头 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding-inline: var(--s3);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease);
}

.site-header.is-scrolled { border-bottom-color: var(--line); }

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}

.brand-cn {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: .26em;
  color: var(--ink);
}

.brand-en {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .34em;
  color: var(--faint);
}

.site-nav { display: flex; gap: var(--s4); }

.site-nav a {
  position: relative;
  padding: 4px 0;
  font-size: 13.5px;
  letter-spacing: .14em;
  color: var(--muted);
  transition: color .2s var(--ease);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}

.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--ink); }

/* 移动端菜单按钮 */

.nav-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -10px;
}

.nav-toggle span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 1px;
  background: var(--ink);
  transition: transform .3s var(--ease), top .3s var(--ease);
}

.nav-toggle span:nth-child(1) { top: 18px; }
.nav-toggle span:nth-child(2) { top: 26px; }

.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 22px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { top: 22px; transform: rotate(-45deg); }

/* 抽屉 */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: calc(var(--header-h) + var(--s3)) var(--s3) var(--s6);
  background: var(--bg);
  overflow: auto;
}

.drawer[hidden] { display: none; }

.drawer a {
  display: block;
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: .12em;
}

.drawer a:last-child { border-bottom: 1px solid var(--line); }

/* ---------- 视图 ---------- */

.view[hidden] { display: none; }

/* 卡片栈：横向居中 */

.stack {
  width: min(var(--card-w), calc(100% - var(--s3) * 2));
  margin-inline: auto;
  padding-block: var(--s3) var(--s12);
  display: grid;
  gap: var(--s3);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad-y) var(--card-pad-x);
  text-align: center;
  scroll-margin-top: calc(var(--header-h) + var(--s2));
}

/* ---------- 首屏字标 ---------- */

/* ---------- 卡片小标题 ---------- */

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--s4);
}

.sec-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3em;
  padding-left: .3em;
  color: #4A4A4A;
}

/* ---------- 自述 ---------- */

/* ---------- 所问 ---------- */

/* ---------- 三器 ---------- */

/* ---------- 占位卡 ---------- */

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

.site-footer {
  padding: var(--s6) var(--s3) var(--s12);
  text-align: center;
}

/* ---------- 进场 ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}

.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 万年历 ---------- */

.card-cal { padding: 40px 32px 32px; }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.cal-nav {
  flex: none;
  width: 40px;
  height: 40px;
  font-size: 16px;
  color: var(--muted);
  transition: color .2s var(--ease);
}

.cal-nav:hover { color: var(--ink); }

.cal-title { min-width: 0; text-align: center; }

.cal-title-cn {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: .08em;
  color: var(--ink);
  white-space: nowrap;
}

.cal-title-en {
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: .3em;
  color: var(--faint);
}

.cal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 20px;
}

.cal-link {
  padding: 4px 0;
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

.cal-link:hover { color: var(--ink); border-bottom-color: var(--line); }

.cal-modes {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.cal-mode {
  padding: 2px 0;
  letter-spacing: .08em;
  color: var(--faint);
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease);
}

.cal-mode:hover { color: var(--ink); }

.cal-mode[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.cal-mode-sep { color: var(--line); }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.cal-week span {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .2em;
  color: var(--faint);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 66px;
  padding: 8px 2px;
  color: var(--text);
  transition: background .18s var(--ease);
}

.day:hover { background: var(--reverse); }

.day.is-blank { visibility: hidden; }

.day-num {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.15;
}

.day-sub {
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--muted);
}

.day.is-mark .day-sub { color: var(--ink); }

.day.is-active { box-shadow: inset 0 0 0 1px var(--ink); }

.day.is-today { background: var(--ink); }
.day.is-today .day-num { color: var(--card); }
.day.is-today .day-sub { color: #C9C9C9; }
.day.is-today:hover { background: var(--ink); }

/* 日详情 */

.card-day { padding: 48px 40px; }

.day-body { max-width: 560px; margin-inline: auto; }

.day-solar {
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: .04em;
  color: var(--ink);
}

.day-lunar {
  margin-top: 10px;
  font-size: 13.5px;
  letter-spacing: .08em;
  color: var(--muted);
}

.day-note {
  display: inline-block;
  margin-top: 14px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--ink);
}

.day-meta {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.meta-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s2);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.7;
}

.meta-row dt { color: var(--faint); letter-spacing: .1em; }
.meta-row dd { margin: 0; color: var(--ink); }

.fortune {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}

.fortune-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  line-height: 1.9;
}

.fortune-mark { font-size: 9px; color: var(--ink); }

.fortune-key {
  flex: none;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--ink);
}

.fortune-val { color: var(--text); }

/* ---------- 八字 ---------- */

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.field-label {
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--faint);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
}

.seg button {
  padding: 8px 18px;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--muted);
  border-right: 1px solid var(--line);
  transition: background .2s var(--ease), color .2s var(--ease);
}

.seg button:last-child { border-right: 0; }

.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s3);
  align-items: end;
}

.field-gender .seg { height: 44px; }

.field-gender .seg button {
  height: 100%;
  padding: 0 18px;
  display: flex;
  align-items: center;
}

.field { display: grid; gap: var(--s1); }

.field select,
.field input[type="date"],
.field input[type="text"],
.field input[type="datetime-local"],
.field-inline select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background-color: var(--card);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
}

.field select,
.field-inline select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 1l5 4 5-4' fill='none' stroke='%235C5C5C' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field select:focus,
.field input:focus,
.field-inline select:focus {
  outline: none;
  border-color: var(--ink);
}

.field select:disabled,
.field-inline select:disabled {
  color: var(--faint);
  background-color: var(--reverse);
}

.lunar-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr;
  gap: var(--s1);
}

.field-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
  margin: 0;
}

.field-inline select { width: auto; flex: 1; height: 40px; }

.field-hint {
  margin-top: -8px;
  font-size: 11.5px;
  line-height: 1.8;
  letter-spacing: .03em;
  color: var(--faint);
  text-align: left;
}

.btn-primary {
  height: 48px;
  margin-top: var(--s1);
  background: var(--ink);
  color: var(--card);
  font-size: 14px;
  letter-spacing: .3em;
  padding-left: .3em;
  transition: opacity .2s var(--ease);
}

.btn-primary:hover { opacity: .86; }

/* 四柱 */

.bazi-meta, .yun-start, .liunian-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 10px;
  font-size: 12.5px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: var(--muted);
}

.bazi-meta { margin-bottom: var(--s4); }
.yun-start { margin-bottom: var(--s3); }
.liunian-head { margin-bottom: var(--s2); }

.bazi-meta span,
.yun-start span,
.liunian-head span { white-space: nowrap; }

.dot { color: var(--line); }

.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 640px;
  margin-inline: auto;
}

.pillar {
  padding: 0 var(--s2);
  border-left: 1px solid var(--line);
}

.pillar:first-child { border-left: 0; }

.p-name {
  font-size: 11px;
  letter-spacing: .24em;
  padding-left: .24em;
  color: var(--faint);
}

.p-ss {
  margin-top: var(--s2);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
}

.p-gz {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.3;
  color: var(--ink);
}

.pillar.is-unknown .p-gz { color: var(--faint); }

.p-hide {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 62px;
  margin-top: var(--s2);
  text-align: left;
}

.hp {
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: .02em;
  color: var(--muted);
}

.hp i {
  font-style: normal;
  color: var(--faint);
  margin-right: 7px;
}

.p-foot {
  display: grid;
  gap: 3px;
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  text-align: left;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 36px;
  margin-top: var(--s4);
}

/* 大运 */

.yun-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.yun {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: var(--s2) 2px;
  border-left: 1px solid var(--line);
  transition: background .2s var(--ease);
}

.yun:first-child { border-left: 0; }
.yun:hover { background: var(--reverse); }

.yun-ss { font-size: 10.5px; line-height: 1.4; color: var(--muted); }
.yun-yr { margin-top: 6px; font-size: 10px; color: var(--faint); }

.yun[aria-pressed="true"] { background: var(--ink); }
.yun[aria-pressed="true"] .yun-ss,
.yun[aria-pressed="true"] .yun-g,
.yun[aria-pressed="true"] .yun-z,
.yun[aria-pressed="true"] .yun-ssz,
.yun[aria-pressed="true"] .yun-yr { color: var(--card); }

.liunian { margin-top: var(--s4); }

.ln-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.ln {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 10px 2px;
  background: var(--card);
}

.ln-yr { font-size: 10px; color: var(--faint); }
.ln-ss { margin-top: 4px; font-size: 10.5px; line-height: 1.4; color: var(--muted); }
.yun-g, .yun-z, .ln-g, .ln-z { font-family: var(--serif); font-size: 17px; line-height: 1.25; color: var(--ink); }
.yun-ssz, .ln-ssz { font-size: 10.5px; line-height: 1.4; color: var(--faint); }

/* 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s6);
  z-index: 80;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 20px;
  background: var(--ink);
  color: var(--card);
  font-size: 13px;
  letter-spacing: .1em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 六爻 ---------- */

.bazi-form,
.liuyao-form {
  max-width: 520px;
  margin-inline: auto;
  display: grid;
  gap: var(--s3);
  text-align: left;
}

.toss-list {
  display: grid;
  margin-top: var(--s1);
  border-top: 1px solid var(--line);
}

.toss {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: var(--s2);
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.toss-pos { color: var(--faint); letter-spacing: .1em; }
.toss-coins { font-family: var(--serif); letter-spacing: .22em; color: var(--ink); }
.toss-name { color: var(--muted); letter-spacing: .06em; }
.toss.is-empty .toss-coins,
.toss.is-empty .toss-name { color: var(--faint); }
.toss.is-moving .toss-name { color: var(--ink); }

/* 卦盘 */

.gua-sheet {
  max-width: 640px;
  margin-inline: auto;
  text-align: left;
}

.sheet-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: var(--ink);
}

.sheet-line + .sheet-line { margin-top: 2px; }

.sheet-line > i {
  flex: none;
  width: 2.6em;
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--faint);
}

.sheet-line b { font-weight: 400; }

.sheet-kong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 56px;
  margin: 16px 0 8px;
  font-size: 13.5px;
  letter-spacing: .1em;
  color: var(--ink);
}

.gua-table {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: fixed;
}

.gua-table th {
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--ink);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.gua-table td {
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
  text-align: center;
  vertical-align: middle;
}

.col-shen { width: 12%; }
.col-fu { width: 18%; }
.col-ben { width: 31%; }
.col-shi { width: 9%; }
.col-dong { width: 4%; }
.col-bian { width: 26%; }

/* 静卦：无变卦与动爻两列，本卦列加宽 */
.gua-table.is-static {
  width: auto;
  max-width: 100%;
  table-layout: auto;
  margin-inline: auto;
}

.gua-table.is-static th,
.gua-table.is-static td {
  padding-left: 20px;
  padding-right: 20px;
}

.c-shen { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.c-fu { color: var(--faint); font-size: 11.5px; letter-spacing: .04em; }
.c-shi { font-size: 12px; letter-spacing: .1em; }
.c-dong { font-size: 11px; letter-spacing: 0; }

.c-fu .fu-qin, .c-fu .fu-gz { margin: 0 2px; }

.gua-cell {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gua-cell .qin { font-size: 12.5px; letter-spacing: .06em; white-space: nowrap; }
.gua-cell .gz { font-size: 12.5px; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }

.yao-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 38px;
  flex: none;
}

.yao-line i {
  display: block;
  flex: 1;
  height: 3px;
  background: var(--ink);
}

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

@media (max-width: 760px) {
  :root {
    --header-h: 60px;
    --card-pad-y: 44px;
    --card-pad-x: 22px;
  }

  .site-nav { display: none; }
  .nav-toggle { display: block; }

  .stack {
    width: calc(100% - var(--s3) * 2);
    padding-block: var(--s2) var(--s8);
    gap: var(--s2);
  }

  .card-cal { padding: 28px 12px 16px; }
  .card-day { padding: 36px 20px; }

  .cal-title-cn { font-size: 16px; letter-spacing: .04em; }
  .cal-nav { width: 30px; height: 36px; }
  .cal-actions { margin: 12px 0 14px; }

  .day { min-height: 52px; padding: 6px 0; gap: 2px; }
  .day-num { font-size: 15px; }
  .day-sub { font-size: 9.5px; }

  .day-solar { font-size: 20px; }

  .meta-row {
    grid-template-columns: 60px 1fr;
    gap: 12px;
    font-size: 13px;
  }

  .fortune-line { font-size: 13.5px; }

  /* 八字 */
  .bazi-form { gap: 18px; }
  .seg button { padding: 7px 12px; font-size: 12.5px; }
  .field-hint { margin-top: -6px; }

  .pillars { grid-template-columns: repeat(4, 1fr); }
  .pillar { padding: 0 6px; }
  .p-gz { font-size: 26px; }
  .p-hide { min-height: 52px; gap: 2px; }
  .hp { font-size: 10px; }
  .hp i { margin-right: 5px; }
  .p-foot { font-size: 10px; gap: 2px; padding-top: 10px; }

  .yun-strip { grid-template-columns: repeat(5, 1fr); }
  .yun { padding: 10px 2px; }
  .yun-g, .yun-z { font-size: 15px; }
  .yun:nth-child(5n+1) { border-left: 0; }
  .yun:nth-child(n+6) { border-top: 1px solid var(--line); }

  .ln { padding: 8px 2px; }
  .ln-g, .ln-z { font-size: 15px; }

  .card-gua { padding-inline: 14px; }

  .sheet-line { font-size: 12.5px; gap: 8px; }
  .sheet-line > i { width: 2.4em; }
  .sheet-kong { gap: 32px; margin: 14px 0 6px; font-size: 12.5px; letter-spacing: .06em; }

  .gua-table th { padding: 6px 2px 8px; font-size: 10px; letter-spacing: 0; }
  .gua-table td { padding: 9px 2px; font-size: 11px; }

  .col-shen { width: 11%; }
  .col-fu { width: 13%; }
  .col-ben { width: 32%; }
  .col-shi { width: 8%; }
  .col-dong { width: 6%; }
  .col-bian { width: 30%; }

  .gua-table.is-static th,
  .gua-table.is-static td {
    padding-left: 12px;
    padding-right: 12px;
  }

  .c-shen { font-size: 10.5px; letter-spacing: 0; }
  .c-fu { font-size: 10px; letter-spacing: 0; line-height: 1.35; }
  .c-fu .fu-qin, .c-fu .fu-gz { display: block; margin: 0; }
  .c-dong { font-size: 10px; }

  .gua-cell { gap: 4px; }
  .gua-cell .qin, .gua-cell .gz { font-size: 10.5px; letter-spacing: 0; }

  .yao-line { width: 18px; gap: 3px; }
  .yao-line i { height: 2px; }
  .bazi-meta,
  .yun-start,
  .liunian-head { flex-direction: column; align-items: center; gap: 2px; }

  .bazi-meta .dot,
  .yun-start .dot,
  .liunian-head .dot { display: none; }

  .footer-note { font-size: 12.5px; }
}

/* ---------- 打印：纯黑白 ---------- */

@media print {
  .site-header, .drawer, .nav-toggle, .skip-link { display: none !important; }

  body { background: #fff; color: #000; }

  .stack { width: 100%; padding: 0; gap: 0; }

  .card { border: 1px solid #000; break-inside: avoid; }

  .js .reveal { opacity: 1 !important; transform: none !important; }

  .view[hidden] { display: none; }
}

/* ---------- 降低动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }

  .js .reveal { opacity: 1; transform: none; }
}


/* ---------- 神煞浮层 ---------- */

.sha-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s3);
  background: rgba(17, 17, 17, .38);
}

.sha-card {
  width: min(420px, 100%);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: var(--s4) var(--s3) var(--s3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sha-card:focus { outline: none; }

.sha-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.sha-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3em;
  color: var(--ink);
}

.sha-sub {
  margin-top: 6px;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--faint);
}

.sha-close {
  flex: none;
  padding-bottom: 2px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.sha-close:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.sha-note {
  margin-bottom: var(--s3);
  font-size: 11.5px;
  line-height: 1.8;
  letter-spacing: .03em;
  color: var(--faint);
}

.sha-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 10px;
}

.sha-list li {
  font-size: 13.5px;
  letter-spacing: .06em;
  color: var(--ink);
  white-space: nowrap;
}

.sha-list .dash {
  margin: 0 2px;
  color: var(--faint);
}
.sha-list .value { color: var(--muted); letter-spacing: .02em; }

/* ---------- 六爻手选 ---------- */

.manual-list {
  display: grid;
  gap: 6px;
  margin-top: var(--s1);
}

.manual-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
}

.manual-pos {
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--faint);
}

.manual-opts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
}

.manual-opts button {
  padding: 8px 0;
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
  border-left: 1px solid var(--line);
  transition: background .18s var(--ease), color .18s var(--ease);
}

.manual-opts button:first-child { border-left: 0; }
.manual-opts button:hover { color: var(--ink); }

.manual-opts button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
}

/* 起卦区的两个面板：包住按钮与列表后要恢复整宽与间距 */
#toss-panel,
#manual-panel {
  display: grid;
  gap: var(--s2);
}

#toss-panel .field-hint,
#manual-panel .field-hint {
  margin-top: 0;
}

/* ==========================================================================
   首页 · 按 Excel 框架（首屏 / 主理人 / 咨询业务）
   ========================================================================== */

.home {
  width: min(1120px, 100% - 96px);
  margin-inline: auto;
}

.home > section + section { border-top: 1px solid var(--line); }

/* ---------- 首屏 ---------- */

.home-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5.4vw, 64px);
  line-height: 1.2;
  letter-spacing: .14em;
  padding-left: .14em;
}

.home-tagline {
  margin-top: clamp(16px, 2vw, 26px);
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 500;
  letter-spacing: .22em;
  color: var(--text);
}

.diagram {
  display: block;
  width: clamp(180px, 22vw, 260px);
  height: auto;
}

/* ---------- 主理人 ---------- */

.home-about {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  padding-block: clamp(48px, 7vw, 88px);
}

.avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: #F7F6F2;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: .3em;
  padding-left: .3em;
}

.about-name {
  font-size: 15px;
  letter-spacing: .16em;
  padding-left: .16em;
  color: var(--ink);
}

.about-text {
  margin-top: 20px;
  max-width: 46em;
  font-size: 15.5px;
  line-height: 2.15;
  letter-spacing: .02em;
  color: var(--muted);
  text-align: justify;
}

/* ---------- 咨询业务 ---------- */

.home-services {
  padding-block: clamp(56px, 8vw, 96px);
}

.services-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 2.2vw, 26px);
  letter-spacing: .34em;
  padding-left: .34em;
  text-align: center;
}

.services {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 3vw, 40px);
  margin-top: clamp(36px, 5vw, 64px);
}

.service {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: clamp(28px, 3.4vw, 44px) clamp(24px, 3vw, 40px) clamp(28px, 3vw, 36px);
  text-align: center;
}

.service-figure { color: var(--ink); }

.service-figure .diagram {
  width: clamp(150px, 15vw, 190px);
  margin-inline: auto;
}

.service-name {
  margin-top: clamp(24px, 3vw, 36px);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(22px, 2vw, 26px);
  letter-spacing: .2em;
  padding-left: .2em;
}

.service-kind {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: .34em;
  padding-left: .34em;
  color: var(--muted);
}

.service-text {
  margin: 20px auto 0;
  max-width: 24em;
  font-size: 14.5px;
  line-height: 2.05;
  color: var(--muted);
  text-align: justify;
}

.service-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color .2s var(--ease);
}

.service-link:hover { border-color: var(--ink); }

/* ---------- 页脚（覆盖旧版） ---------- */

.site-footer {
  padding: clamp(48px, 6vw, 72px) var(--s3);
  text-align: center;
  border-top: 1px solid var(--line);
}

.footer-brand {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .34em;
  padding-left: .34em;
  color: var(--ink);
}

.footer-motto {
  margin-top: 16px;
  font-size: 13.5px;
  letter-spacing: .1em;
  color: var(--text);
}

.footer-note {
  max-width: 32em;
  margin: 14px auto 0;
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: .02em;
  color: var(--faint);
}

.footer-meta {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--faint);
}

/* ---------- 导航里的「联系」 ---------- */

.nav-contact {
  position: relative;
  padding: 4px 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: .14em;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s var(--ease);
}

.nav-contact:hover { color: var(--ink); }

/* ---------- 二维码浮层 ---------- */

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 17, 17, .3);
  backdrop-filter: blur(2px);
}

.qr-modal[hidden] { display: none; }

.qr-panel:focus { outline: none; }

.qr-panel {
  position: relative;
  width: min(330px, 100%);
  padding: 34px 28px 30px;
  background: var(--card);
  border-radius: var(--radius);
  text-align: center;
}

.qr-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: .34em;
  padding-left: .34em;
}

.qr-note {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--muted);
}

.qr-img {
  display: block;
  width: 200px;
  height: auto;
  margin: 20px auto 0;
}

.qr-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.qr-close:hover { color: var(--ink); }

/* ---------- 首页窄屏 ---------- */

@media (max-width: 760px) {
  .home { width: calc(100% - 40px); }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-block: 48px 44px;
    text-align: center;
  }

  .diagram { width: 190px; margin-inline: auto; }

  .home-about {
    grid-template-columns: 1fr;
    gap: 28px;
    justify-items: center;
    text-align: center;
    padding-block: 44px;
  }

  .avatar { width: 120px; height: 120px; }

  .about-name { font-size: 14px; }

  .about-text { font-size: 15px; line-height: 2.1; text-align: justify; }

  .services { grid-template-columns: 1fr; }

  .service { padding: 32px 22px 28px; }

  .service-figure .diagram { width: 160px; }
}

/* 抽屉里的「联系」按钮：与链接同款 */
.drawer .drawer-contact {
  display: block;
  width: 100%;
  padding: var(--s3) 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: none;
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: .12em;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.drawer .drawer-contact:hover,
.drawer a:hover { color: var(--ink); }

/* 去掉按钮/链接的默认聚焦方框，改细线 */
.drawer a:focus-visible,
.drawer .drawer-contact:focus-visible,
.qr-close:focus-visible,
.nav-contact:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

/* 首屏文字上下居中对齐 */
/* ==========================================================================
   首屏（左文右图）与头像
   ========================================================================== */

.home-hero {
  position: relative;
  display: grid;
  place-content: center;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: clamp(24px, 4vw, 72px);
  min-height: clamp(420px, 64vh, 660px);
  padding-block: clamp(40px, 5vw, 64px);
  text-align: left;
  overflow: visible;
}

.home-hero-text {
  text-align: center;
  justify-self: start;
}

.home-title { font-size: clamp(34px, 4.4vw, 56px); }

.title-wrap {
  position: relative;
  display: inline-block;
}

/* 朱红「晋阳」印章 */
.seal {
  position: absolute;
  top: -8px;
  right: -60px;
  display: inline-grid;
  gap: 5px;
  padding: 8px 7px;
  background: #A9342A;
  box-shadow: inset 0 0 0 2px #F7F1E8;
  color: #FBF6EE;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1;
  border-radius: 2px;
  letter-spacing: .02em;
  user-select: none;
}

.seal i {
  font-style: normal;
  display: block;
  text-align: center;
}

/* 右侧：后天八卦 + 十二地支，反向旋转 */
.hero-figure {
  position: relative;
  justify-self: end;
  margin: 0;
}

.fig {
  position: relative;
  width: min(460px, 40vw, 56vh);
  aspect-ratio: 1;
}

.fig svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .62;
  will-change: transform;
}

.fig-bagua { animation: fig-spin 180s linear infinite; }
.fig-zhi { animation: fig-spin-rev 180s linear infinite; }

@keyframes fig-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fig-spin-rev {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

/* 主理人头像：抠底插画，无边、底边渐隐 */
.avatar {
  width: 148px;
  height: 148px;
  border: 0;
  background: transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}

.avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
}

@media (prefers-reduced-motion: reduce) {
  .fig-bagua, .fig-zhi { animation: none; }
}

@media (max-width: 760px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: clamp(400px, 62vh, 480px);
    padding-block: 36px;
    text-align: center;
  }

  .home-hero-text { justify-self: center; }
  .hero-figure { justify-self: center; }
  .home-title { font-size: clamp(30px, 8.4vw, 40px); }
  .fig { width: min(300px, 76vw); }

  .seal {
    top: -6px;
    right: -42px;
    gap: 3px;
    padding: 6px 5px;
    font-size: 13px;
    box-shadow: inset 0 0 0 1.5px #F7F1E8;
  }
}
