.pt-root.zg-root {
  --zg-paper: #F3EEE4;
  --zg-ink: #1E1B18;
  --zg-line: #1E1B1833;
  --zg-mute: #1E1B1899;
  --zg-zhu: #B8322A;
  --zg-lucky: #5A6B7D;
  --zg-sha: #9A3B2E;
  --zg-kai: 'LXGW WenKai TC', 'Kaiti TC', serif;
  --zg-song: 'Noto Serif TC', 'Songti TC', serif;
  background: var(--zg-paper);
  color: var(--zg-ink);
  font-family: var(--zg-song);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  position: fixed;
  inset: 0;
  z-index: 30;
  height: auto;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* 網頁字型還沒換上時先不畫字，避免進頁先閃系統字再換成宋楷 */
.pt-root.zg-root:not(.zg-fonts) :is(.zg-stars, .zg-nav b, .zg-nav small, .zg-tabs button, .zg-keys, .zg-natal, .zg-log) {
  visibility: hidden;
}
.pt-root.zg-root.zg-wide {
  position: relative;
  inset: auto;
  z-index: 1;
  height: 100%;
  padding-bottom: 0;
}
.pt-root.zg-root.zg-cover {
  position: fixed;
  inset: 0;
  z-index: 80;
  height: auto;
}
.pt-root.zg-root::before {
  content: '';
  position: absolute;
  right: -60px; top: 120px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 27, 24, .07), rgba(30, 27, 24, 0) 70%);
  pointer-events: none;
}
.zg-nav {
  position: relative;
  flex: none;
  box-sizing: border-box;
  height: calc(58px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: env(safe-area-inset-top) 10px 0;
}
.zg-nav b {
  display: block;
  text-align: center;
  font-family: var(--zg-kai);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .3em;
  padding-left: .3em;
}
.zg-nav small {
  display: block;
  text-align: center;
  font-size: 11px;
  color: #1E1B1888;
  letter-spacing: .15em;
}
.pt-root.zg-root .zg-nav button {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: var(--zg-ink);
}
.pt-root.zg-root .zg-nav button.zg-who {
  width: auto;
  height: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
}
.zg-wide .zg-nav button.zg-who { align-items: flex-start; }
.zg-tabs {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 22px;
  padding: 2px 0 8px;
}
.zg-tabs.has-send { gap: 12px; }
.pt-root.zg-root .zg-tabs button {
  width: auto;
  height: auto;
  font-family: var(--zg-kai);
  font-size: 16px;
  letter-spacing: .2em;
  padding-bottom: 5px;
  white-space: nowrap;
  color: #1E1B1888;
}
.pt-root.zg-root .zg-tabs button.on {
  font-weight: 700;
  color: var(--zg-ink);
  border-bottom: 2px solid var(--zg-zhu);
}
.pt-root.zg-root .zg-tabs button.zg-act {
  color: var(--zg-zhu);
  font-weight: 700;
  letter-spacing: .08em;
  border-bottom: 0;
}
.pt-root.zg-root .zg-tabs button.zg-act:disabled {
  color: #1E1B1844;
  font-weight: 500;
}
.pt-root.zg-root .zg-tabs button.zg-act.is-kept:disabled {
  color: #1E1B1888;
}
.pt-root.zg-root .zg-save-note {
  margin: 0;
  padding: 2px 16px 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: var(--zg-zhu);
}
.zg-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* 盤下面只留四化／起卦說明這一條，高度固定，十二宮不跟頁面換。宮數干數在中宮。 */
.zg-lower { flex: none; display: flex; flex-direction: column; min-height: 0; }
.zg-lower-foot {
  flex: none;
  height: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.zg-lower .zg-hand-note { margin: 0 16px 4px; }
.zg-lower .zg-hua-row { margin: 0 14px 4px; }
.zg-board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px 14px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--zg-line);
  border-left: 1px solid var(--zg-line);
}
.pt-root.zg-root:not(.zg-wide) .zg-cell { container: zgcell / size; }
/* 16 Pro 占卦格比較窄的那邊約 93.5 時星名 16px。 */
@container zgcell (min-width: 0px) {
  .pt-root.zg-root:not(.zg-wide) .zg-name { font-size: calc(16px * min(100cqw, 100cqh) / 93.5px * var(--zg-fit, 1)); }
  .pt-root.zg-root:not(.zg-wide) .zg-star.lucky .zg-name,
  .pt-root.zg-root:not(.zg-wide) .zg-star.sha .zg-name { font-size: calc(14px * min(100cqw, 100cqh) / 93.5px * var(--zg-fit, 1)); }
  .pt-root.zg-root:not(.zg-wide) .zg-hua { width: calc(15px * min(100cqw, 100cqh) / 93.5px * var(--zg-fit, 1)); height: calc(15px * min(100cqw, 100cqh) / 93.5px * var(--zg-fit, 1)); font-size: calc(10px * min(100cqw, 100cqh) / 93.5px * var(--zg-fit, 1)); }
  .pt-root.zg-root:not(.zg-wide) .zg-pname { font-size: calc(12px * min(100cqw, 100cqh) / 93.5px); }
  .pt-root.zg-root:not(.zg-wide) .zg-natal { font-size: calc(11px * min(100cqw, 100cqh) / 93.5px); }
  .pt-root.zg-root:not(.zg-wide) .zg-gz { font-size: calc(14px * min(100cqw, 100cqh) / 93.5px); }
}
.zg-sf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.zg-sf line {
  stroke: #8e8e93;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 5 4;
  opacity: 0.8;
}
.zg-cell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--zg-line);
  border-bottom: 1px solid var(--zg-line);
}
.zg-cell.is-life { background: rgba(184, 50, 42, .06); }
.zg-cell.is-preview { box-shadow: inset 0 0 0 1.5px var(--zg-zhu); }
.zg-hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.zg-hit:focus { outline: none; }
.zg-hit:focus-visible { outline: 1px solid var(--zg-zhu); outline-offset: -3px; }
.zg-hit:disabled { cursor: default; }
.zg-stars {
  position: absolute;
  left: 7px; top: 7px;
  display: flex;
  align-items: flex-start;
  gap: 3px;
}
.zg-star {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.zg-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--zg-song);
  font-size: calc(16px * var(--zg-fit, 1));
  font-weight: 700;
  line-height: 1.08;
  color: var(--zg-ink);
}
.zg-name i { font-style: normal; display: block; }
.zg-star.lucky .zg-name { color: var(--zg-lucky); font-size: calc(14px * var(--zg-fit, 1)); font-weight: 500; }
.zg-star.sha .zg-name { color: var(--zg-sha); font-size: calc(14px * var(--zg-fit, 1)); font-weight: 500; }
.zg-hua {
  width: calc(15px * var(--zg-fit, 1)); height: calc(15px * var(--zg-fit, 1));
  border-radius: 50%;
  border: 1px solid var(--zg-zhu);
  color: var(--zg-zhu);
  font-size: calc(10px * var(--zg-fit, 1));
  font-style: normal;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--zg-song);
  font-weight: 700;
}
.zg-hua.pop { animation: zg-pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.zg-hua.is-hold, .zg-slip.is-hold { visibility: hidden; }
.zg-cell:not(.is-fit) .zg-stars { visibility: hidden; }
.zg-slip {
  flex: none;
  align-self: flex-start;
  box-sizing: border-box;
  width: 16px;
  height: 32px;
  padding: 2px 0;
  background: var(--zg-zhu);
  border-radius: 2px;
  justify-content: center;
  transform: none;
}
.zg-slip .zg-name { color: #fff; font-size: 12px; width: 12px; line-height: 1.05; }
.zg-slip.drop { animation: zg-drop .3s ease-out; }
.zg-foot { position: absolute; inset: 0; pointer-events: none; }
.zg-natal {
  position: absolute;
  left: 7px;
  bottom: 6px;
  font-size: 11px;
  color: var(--zg-mute);
}
.zg-pname, .zg-will { position: absolute; left: 7px; bottom: 22px; }
.zg-pname { font-size: 12px; color: var(--zg-zhu); opacity: 0; }
.zg-pname.on { opacity: 1; transition: opacity .2s ease-out; }
.zg-gz, .zg-stamp { position: absolute; right: 7px; bottom: 6px; }
.zg-gz { font-size: 14px; font-weight: 700; }
.zg-stamp {
  width: 34px; height: 34px;
  background: var(--zg-zhu);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--zg-kai);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.05;
  text-align: center;
  animation: zg-seal .3s cubic-bezier(.2, 1.4, .4, 1);
}
.zg-dot {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--zg-zhu);
  opacity: .85;
}
.zg-will {
  font-family: var(--zg-kai);
  font-size: 12px;
  font-weight: 700;
  color: var(--zg-zhu);
}
.zg-center {
  grid-row: 2 / 4;
  grid-column: 2 / 4;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 8px 6px;
  overflow: hidden;
  border-right: 1px solid var(--zg-line);
  border-bottom: 1px solid var(--zg-line);
  text-align: center;
}
.zg-center .zg-keys {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.zg-center .zg-keys-head { flex: none; margin-bottom: 2px; gap: 6px; }
.zg-center .zg-keys-head b { font-size: 12px; letter-spacing: .12em; flex: none; }
.zg-center .zg-keys-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}
.zg-center .zg-palace-keys {
  flex: 3 1 auto;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 0;
}
.zg-center .zg-digit-keys {
  flex: 2 1 auto;
  min-height: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 3px;
}
.zg-wheels {
  display: flex;
  align-items: center;
  gap: 28px;
}
.zg-wheel { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.zg-wheel em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: .3em;
  color: #1E1B1888;
  margin-bottom: 10px;
}
.zg-wheel b {
  font-family: var(--zg-kai);
  font-weight: 700;
}
.zg-wheel .side {
  font-size: 20px;
  color: var(--zg-ink);
  opacity: .18;
  filter: blur(1.2px);
}
.zg-wheel .mid {
  font-size: 54px;
  margin: 8px 0;
  filter: blur(.7px);
}
.zg-wheels.settled .mid { filter: none; }
.zg-rule { width: 1px; height: 90px; background: var(--zg-line); }
.zg-rolling {
  margin-top: 16px;
  font-family: var(--zg-kai);
  font-size: 13px;
  letter-spacing: .5em;
  color: #1E1B1888;
}
.zg-mid-meta {
  display: flex;
  gap: 16px;
  max-width: 100%;
  font-family: var(--zg-kai);
  font-size: calc(12.5px * var(--zg-mid, 1));
  letter-spacing: calc(.08em * var(--zg-mid, 1));
  color: var(--zg-mute);
}
.zg-mid-branch {
  font-family: var(--zg-kai);
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  margin: 2px 0;
  clip-path: inset(0 0 100% 0);
}
.zg-mid-branch.on { clip-path: none; animation: zg-reveal .65s ease-out; }
.zg-mid-line {
  max-width: 100%;
  font-size: calc(14px * var(--zg-mid, 1));
  letter-spacing: calc(.12em * var(--zg-mid, 1));
}
.zg-mid-bar { margin-top: 8px; width: 40px; height: 1px; background: #1E1B1855; }
.zg-mid-note {
  max-width: 100%;
  margin-top: 6px;
  font-size: calc(12px * var(--zg-mid, 1));
  color: var(--zg-mute);
  letter-spacing: calc(.02em * var(--zg-mid, 1));
}
.pt-root.zg-root .zg-nav button.zg-who.is-still { cursor: default; }
.zg-log {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 4px 16px calc(24px + env(safe-area-inset-bottom));
}
.zg-log-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zg-mute);
  letter-spacing: .12em;
}
.zg-log section { margin-top: 8px; }
.zg-log h3 {
  margin: 12px 0 6px;
  font-family: var(--zg-kai);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2em;
  color: var(--zg-mute);
}
.zg-log article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--zg-line);
}
.pt-root.zg-root .zg-log-open {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 10px;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--zg-song);
  color: var(--zg-ink);
}
.zg-log-open b {
  font-family: var(--zg-kai);
  font-size: 22px;
  font-weight: 700;
}
.zg-log-open span { font-size: 14px; letter-spacing: .04em; }
.zg-log-open small { font-size: 12px; color: var(--zg-mute); }
.zg-log label { grid-column: 1; }
.zg-log input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--zg-line);
  background: none;
  padding: 4px 0;
  font-family: var(--zg-song);
  font-size: 14px;
  color: var(--zg-ink);
}
.zg-log input::placeholder { color: #1E1B1866; }
.pt-root.zg-root .zg-log-del {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  width: auto;
  height: auto;
  padding: 0 0 4px;
  border: 0;
  background: none;
  color: var(--zg-mute);
  font-size: 13px;
  letter-spacing: .08em;
}
.zg-wide .zg-log { padding: 0 8px 24px; }
.zg-hand-note {
  flex: none;
  margin: 8px 16px 0;
  text-align: center;
  font-size: 13px;
  color: var(--zg-mute);
  letter-spacing: .04em;
}
.zg-hand-mid { display: flex; gap: 18px; }
.zg-hand-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.zg-hand-col em { font-style: normal; font-size: 11.5px; letter-spacing: .3em; color: var(--zg-mute); }
.zg-hand-col b {
  width: 70px; height: 62px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 2px solid var(--zg-ink);
  font-family: var(--zg-kai);
  font-size: 34px;
  font-weight: 700;
}
.zg-hand-col.zhu b { border-bottom-color: var(--zg-zhu); color: var(--zg-zhu); font-size: 42px; }
.zg-hand-col small { font-size: 12.5px; color: var(--zg-mute); }
.zg-hand-col small b { width: auto; height: auto; border: 0; font-family: var(--zg-song); font-size: 16px; color: var(--zg-ink); }
.zg-hua-row {
  flex: none;
  margin: 10px 14px 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  font-style: normal;
  opacity: 0;
}
.zg-hua-row.on { opacity: 1; transition: opacity .2s ease-out; }
.zg-hua-row span { display: inline-flex; align-items: center; gap: 4px; }
.zg-actions {
  flex: none;
  padding: 12px 16px 8px;
  display: flex;
  justify-content: center;
}
.pt-root.zg-root .zg-stick {
  width: 100%;
  height: 52px;
  font-size: 18px;
  font-weight: 700;
}
.pt-root.zg-root .zg-stick {
  border: 0;
  border-radius: 0;
  background: var(--zg-ink);
  color: var(--zg-paper);
  font-family: var(--zg-song);
  letter-spacing: .14em;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
}
.pt-root.zg-root .zg-stick.is-cast { letter-spacing: .5em; padding-left: .5em; }
.pt-root.zg-root .zg-stick:disabled { opacity: .28; }
.zg-keys { flex: 0 1 auto; min-height: 0; overflow: auto; margin: 14px 14px 0; }
.zg-keys-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.zg-keys-head b { font-family: var(--zg-kai); font-size: 14px; letter-spacing: .2em; }
.zg-keys-head span { font-size: 11.5px; color: #1E1B1888; }
.zg-palace-keys {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 10px;
}
.zg-digit-keys {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 3px;
}
.pt-root.zg-root .zg-key {
  height: 38px;
  border: 1px solid var(--zg-line);
  background: none;
  color: var(--zg-ink);
  font-family: var(--zg-kai);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.pt-root.zg-root .zg-digit-keys .zg-key { height: 44px; }
.pt-root.zg-root .zg-key small {
  font-family: var(--zg-song);
  font-size: 11px;
  font-weight: 400;
  color: #1E1B1888;
}
.pt-root.zg-root .zg-key.on {
  border-color: var(--zg-zhu);
  background: var(--zg-zhu);
  color: #fff;
}
.pt-root.zg-root .zg-key.on small { color: #FFFFFFCC; }
.pt-root.zg-root .zg-center .zg-key { height: 100%; min-height: 0; font-size: 14px; padding: 0; }
.pt-root.zg-root .zg-center .zg-digit-keys .zg-key { height: 100%; }
.pt-root.zg-root .zg-center .zg-key small { font-size: 9px; line-height: 1; }
.zg-tune { flex: 1; min-height: 0; overflow: auto; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
.zg-tune-h { margin: 0 2px 12px; }
.zg-tune-h b { font-family: var(--zg-kai); font-size: 18px; letter-spacing: .2em; }
.zg-tune-h p { margin: 4px 0 0; font-size: 12.5px; color: var(--zg-mute); line-height: 1.6; }
.zg-start {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--zg-line);
  border-left: 1px solid var(--zg-line);
  margin-bottom: 26px;
}
.pt-root.zg-root .zg-start button {
  height: 44px;
  border-right: 1px solid var(--zg-line);
  border-bottom: 1px solid var(--zg-line);
  font-family: var(--zg-song);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}
.pt-root.zg-root .zg-start button.on { background: var(--zg-zhu); color: #fff; }
.zg-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--zg-ink);
}
.zg-map-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding-right: 8px;
  border-bottom: 1px solid #1E1B1822;
}
.zg-map-row > b { width: 28px; font-family: var(--zg-kai); font-size: 20px; font-weight: 700; }
.zg-map-row > span { flex: 1; min-width: 0; font-size: 12.5px; color: #1E1B1888; white-space: nowrap; }
.pt-root.zg-root .zg-stem {
  flex: none;
  width: auto;
  min-width: 44px;
  height: 30px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid #1E1B1855;
  font-family: var(--zg-song);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}
.zg-stem i { font-style: normal; font-size: 9px; color: var(--zg-mute); }
.zg-stem-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 12px; }
.pt-root.zg-root .zg-stem-pick button {
  min-width: 32px; height: 32px;
  border: 1px solid var(--zg-line);
  font-family: var(--zg-song);
  font-size: 16px;
  font-weight: 700;
}
.pt-root.zg-root .zg-stem-pick button.on { background: var(--zg-zhu); color: #fff; border-color: var(--zg-zhu); }
.zg-done {
  justify-self: end;
  padding-right: 6px;
  color: var(--zg-zhu);
  font-family: var(--zg-kai);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .1em;
}

.zg-wide.zg-root::before {
  right: -80px; top: 60px;
  width: 520px; height: 520px;
}
.zg-wide .zg-nav {
  height: 84px;
  grid-template-columns: 1fr auto 1fr;
  padding: 0 40px;
  border-bottom: 1px solid var(--zg-line);
}
.zg-wide .zg-nav-who { display: flex; align-items: center; gap: 14px; }
.zg-wide .zg-nav b { text-align: left; font-size: 28px; padding-left: 0; }
.zg-wide .zg-nav small { text-align: left; font-size: 13px; color: var(--zg-mute); letter-spacing: .1em; }
.zg-wide .zg-tabs { padding: 0; gap: 40px; flex-wrap: nowrap; }
.zg-wide .zg-tabs.has-send { gap: 22px; }
.pt-root.zg-wide .zg-tabs button {
  width: auto; height: auto;
  font-size: 18px; letter-spacing: .25em; padding-bottom: 6px; white-space: nowrap;
}
.pt-root.zg-wide .zg-set {
  justify-self: end;
  width: auto; height: 40px;
  min-width: max-content;
  padding: 0 16px;
  border: 1px solid var(--zg-line);
  gap: 8px;
  font-family: var(--zg-kai);
  font-size: 16px;
  white-space: nowrap;
}
.zg-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 56px;
  padding: 28px 40px;
}
.zg-wide .zg-board {
  width: min(calc(100vh - 160px), calc(100% - 380px));
  height: auto;
  aspect-ratio: 1;
  flex: none;
  margin: 0;
}
.zg-wide .zg-name { font-size: calc(22px * var(--zg-fit, 1)); }
.zg-wide .zg-star.lucky .zg-name,
.zg-wide .zg-star.sha .zg-name { font-size: calc(19px * var(--zg-fit, 1)); }
.zg-wide .zg-slip { width: 22px; height: 44px; }
.zg-wide .zg-slip .zg-name { font-size: 16px; width: 16px; }
.zg-wide .zg-hua { width: calc(19px * var(--zg-fit, 1)); height: calc(19px * var(--zg-fit, 1)); font-size: calc(12px * var(--zg-fit, 1)); }
.zg-wide .zg-pname { font-size: 15px; bottom: 28px; }
.zg-wide .zg-will { bottom: 28px; }
.zg-wide .zg-natal { font-size: 13px; }
.zg-wide .zg-gz { font-size: 18px; }
.zg-wide .zg-stamp { width: 48px; height: 48px; font-size: 18px; }
.zg-wide .zg-mid-branch { font-size: 128px; }
.zg-wide .zg-mid-meta { font-size: calc(16px * var(--zg-mid, 1)); gap: 30px; }
.zg-wide .zg-mid-line { font-size: calc(18px * var(--zg-mid, 1)); }
.zg-wide .zg-mid-note { font-size: calc(14px * var(--zg-mid, 1)); }
.zg-wide .zg-cell { container: zgwcell / size; }
/* 15 吋占卦格比較窄的那邊 185 時星名 22px。 */
@container zgwcell (min-width: 0px) {
  .zg-wide .zg-name { font-size: calc(22px * min(100cqw, 100cqh) / 185px * var(--zg-fit, 1)); }
  .zg-wide .zg-star.lucky .zg-name,
  .zg-wide .zg-star.sha .zg-name { font-size: calc(19px * min(100cqw, 100cqh) / 185px * var(--zg-fit, 1)); }
  .zg-wide .zg-hua { width: calc(19px * min(100cqw, 100cqh) / 185px * var(--zg-fit, 1)); height: calc(19px * min(100cqw, 100cqh) / 185px * var(--zg-fit, 1)); font-size: calc(12px * min(100cqw, 100cqh) / 185px * var(--zg-fit, 1)); }
  .zg-wide .zg-pname { font-size: calc(15px * min(100cqw, 100cqh) / 185px); }
  .zg-wide .zg-natal { font-size: calc(13px * min(100cqw, 100cqh) / 185px); }
  .zg-wide .zg-gz { font-size: calc(18px * min(100cqw, 100cqh) / 185px); }
  .zg-wide .zg-stamp { width: calc(48px * min(100cqw, 100cqh) / 185px); height: calc(48px * min(100cqw, 100cqh) / 185px); font-size: calc(18px * min(100cqw, 100cqh) / 185px); }
  .zg-wide .zg-slip { width: calc(22px * min(100cqw, 100cqh) / 185px); height: calc(44px * min(100cqw, 100cqh) / 185px); }
  .zg-wide .zg-slip .zg-name { font-size: calc(16px * min(100cqw, 100cqh) / 185px); width: calc(16px * min(100cqw, 100cqh) / 185px); }
}
.zg-side .zg-hand-note { margin: 12px 0 0; }
.zg-side {
  flex: 1 1 320px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}
.zg-side-head {
  border-top: 2px solid var(--zg-ink);
  padding-top: 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.zg-side-head b { font-family: var(--zg-kai); font-size: 20px; letter-spacing: .25em; }
.zg-side-head span { font-size: 13px; color: var(--zg-mute); }
.zg-side-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 24px;
}
.zg-side-seal {
  width: 72px; height: 72px;
  background: var(--zg-zhu);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--zg-kai);
  font-weight: 700;
  font-size: 44px;
}
.zg-side-hero b { font-family: var(--zg-kai); font-size: 24px; letter-spacing: .2em; }
.zg-side-hero small { display: block; margin-top: 4px; font-size: 14px; color: var(--zg-mute); }
.zg-row {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  border-bottom: 1px solid #1E1B1822;
  font-size: 17px;
}
.zg-row em {
  font-style: normal;
  padding: 2px 6px;
  background: var(--zg-zhu);
  color: #fff;
  font-family: var(--zg-song);
  font-weight: 700;
  font-size: 15px;
}
.zg-row .zg-hua { width: 26px; height: 26px; font-size: 16px; flex: none; }
.zg-row span { flex: 1; }
.zg-row small { font-size: 14px; color: var(--zg-mute); }
.zg-side .zg-actions { margin-top: auto; padding: 16px 0 0; }
.pt-root.zg-wide .zg-stick { height: 56px; font-size: 20px; }
.dw-shell-main > .pt-root.zg-root.zg-wide {
  flex: 1; min-height: 0; height: auto; padding: 0; overflow: hidden;
}
.zg-side .zg-keys { margin: 0; }
.zg-wide .zg-palace-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.zg-wide .zg-digit-keys { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.zg-tune-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.pt-root.zg-root .zg-reset {
  flex: none;
  width: auto;
  height: auto;
  border: 0;
  background: none;
  padding: 0;
  color: #1E1B1888;
  font-family: var(--zg-song);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .08em;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
}
.pt-root.zg-root .zg-tune-bar .zg-stick { flex: 1; width: auto; min-width: 0; }
.zg-tune-nav { grid-template-columns: auto 1fr auto; }
.pt-root.zg-root .zg-tune-nav button,
.pt-root.zg-root.zg-tune-cover .zg-nav button {
  width: auto;
  height: 44px;
  gap: 2px;
  padding: 0 4px;
  white-space: nowrap;
  font-family: var(--zg-kai);
  font-size: 16px;
}
.zg-tune-nav em, .zg-tune-cover em { font-style: normal; letter-spacing: .15em; }
.zg-tune-cover .zg-nav { grid-template-columns: auto 1fr auto; }
.zg-tune-cover .zg-nav b { text-align: center; }
.zg-tune-cover .zg-tune,
.zg-tune-cover .zg-tune-bar { padding-left: 64px; padding-right: 64px; }

.dw-shell-pane > .pt-root.zg-root {
  padding: 0;
  overflow: hidden;
}

.zg-pick-shade {
  position: absolute;
  inset: 0;
  z-index: 40;
  border: 0;
  background: rgba(0, 0, 0, 0.28);
}
.zg-pick {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  max-height: 78%;
  overflow: auto;
  box-sizing: border-box;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 14px 14px 0 0;
  background: #f2f2f7;
  color: #0a0a0a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}
.pt-root.zg-root .zg-pick button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.zg-pick-group { border-radius: 12px; overflow: hidden; background: #fff; }
.pt-root.zg-root .zg-pick-group button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.16);
}
.pt-root.zg-root .zg-pick-group button:last-child { border-bottom: 0; }
.zg-pick-group b { display: block; font-size: 16px; font-weight: 600; }
.zg-pick-group small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: rgba(60, 60, 67, 0.6); }
.zg-pick-group svg { flex: none; color: #007aff; }
.pt-root.zg-root .zg-pick-cancel {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: #007aff;
}

@keyframes zg-pop {
  from { transform: scale(.3); }
  to { transform: scale(1); }
}
@keyframes zg-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes zg-seal {
  from { transform: scale(1.9) rotate(-8deg); }
  to { transform: none; }
}
@keyframes zg-reveal {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  .zg-hua.pop, .zg-slip.drop, .zg-stamp, .zg-mid-branch.on { animation: none; }
}
/* 還沒有自己的本命盤：不代用別人的盤，先選 */
.zg-need-pick { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 72px 32px; text-align: center; }
.zg-need-pick b { font-size: 18px; }
.zg-need-pick p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; color: #6e6e73; }
.pt-root.zg-root .zg-need-pick button { width: 100%; max-width: 280px; height: 44px; border-radius: 10px; font-size: 16px; color: #1c1c1e; background: rgba(120, 120, 128, 0.12); }
.pt-root.zg-root .zg-need-pick button.zg-need-go { color: #fff; background: #1c1c1e; }
.zg-pick-mine { margin-left: 6px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-style: normal; font-weight: 500; color: #fff; background: #94211b; }

