:root {
  --paper: #15110d;
  --paper-2: #1c1712;
  --paper-edge: #2a2218;
  --ink: #e8dcc4;
  --ink-soft: #b5a888;
  --ink-faint: #756a54;
  --cinnabar: #9e3b2e;
  --cinnabar-soft: #b9554a;
  --jade: #6a8a78;
  --gold: #ffd700;
  --gold-soft: #b8902f;
  --line: rgba(201,168,90,0.22);
  --serif-en: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --serif-zh: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "Noto Serif CJK SC", serif;
}

/* 白天浅色主题（JS 按时间切换：6:00-18:00 浅色，否则暗色） */
:root.theme-light {
  --paper: #efe6d3;
  --paper-2: #e6dac0;
  --paper-edge: #d8c9a8;
  --ink: #2a2521;
  --ink-soft: #5d544a;
  --ink-faint: #8a7e6e;
  --cinnabar: #9e3b2e;
  --cinnabar-soft: #b9554a;
  --jade: #4a6b5a;
  --gold: #7a5a16;
  --gold-soft: #4a3a12;
  --line: rgba(42,37,33,0.18);
}
:root.theme-light .ask label .zh {
  color: #7a5a16;
  text-shadow: none;
}
:root.theme-light body {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.4), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(168,133,47,0.08), transparent 50%),
    var(--paper);
}
:root.theme-light body::before {
  background-image:
    repeating-linear-gradient(0deg, rgba(120,100,70,0.03) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(120,100,70,0.025) 0 1px, transparent 1px 5px);
}
:root.theme-light #question { background: rgba(255,255,255,0.5); }
:root.theme-light .gua-card { background: rgba(255,255,255,0.55); box-shadow: 0 4px 22px rgba(120,100,70,0.12); }
:root.theme-light .title {
  background: linear-gradient(180deg, #4a3a12 0%, #5e4715 45%, #6b4f1c 75%, #7a5a16 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 1px 1px rgba(120,90,30,0.22));
}
:root.theme-light .title .dot {
  background: linear-gradient(180deg, #b9554a, #9e3b2e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 6px rgba(158,59,46,0.35));
}
:root.theme-light .title-en { color: #6b4f1c; }
:root.theme-light .brand-mark { color: #6b4f1c; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--serif-zh);
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 38%, rgba(232,220,196,0.05), transparent 55%),
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(0,0,0,0.42) 100%),
    var(--paper);
  background-attachment: fixed;
  min-height: 100%;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 微粒纹理 */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 18% 24%, rgba(232,220,196,0.22), transparent),
    radial-gradient(1px 1px at 68% 16%, rgba(201,168,90,0.20), transparent),
    radial-gradient(1px 1px at 84% 70%, rgba(232,220,196,0.16), transparent),
    radial-gradient(1px 1px at 28% 82%, rgba(201,168,90,0.18), transparent);
  z-index: 0;
}

.paper {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 56px 32px 72px;
}
/* 顶部金线装饰 */
.paper::before {
  content: "";
  position: absolute;
  top: 30px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

/* logo */
.logo { text-align: center; }
.logo-mark {
  width: 64px;
  height: 64px;
  display: inline-block;
  transition: transform 1.1s ease;
  filter: drop-shadow(0 0 8px rgba(201,168,90,0.28));
}
.logo:hover .logo-mark { transform: rotate(180deg); }

/* 头部 */
.site-header { text-align: center; margin-bottom: 40px; }
.title {
  font-family: 'Kaiti SC','STKaiti','Songti SC','Noto Serif SC','SimSun',serif;
  font-size: 60px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  font-weight: 700;
  margin-top: 14px;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff4b8 0%, #ffe066 22%, #ffd700 48%, #d9a522 76%, #b8902f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 1px 1px rgba(255,244,184,0.45)) drop-shadow(0 3px 10px rgba(201,168,90,0.38));
}
.title .dot {
  background: linear-gradient(180deg, #d66b5a, #9e3b2e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 8px rgba(158,59,46,0.55));
}
.title-en {
  margin-top: 12px;
  font-family: 'Georgia','Times New Roman',serif;
  font-size: 15px;
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  color: #c9a85a;
  text-transform: lowercase;
  opacity: 0.92;
}
.tagline {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.tagline .zh {
  font-size: 16px;
  letter-spacing: 0.42em;
  color: var(--gold);
  text-indent: 0.42em;
}
.tagline .en {
  font-family: var(--serif-en);
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-style: italic;
}
.rule {
  width: 90px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 22px auto 0;
  opacity: 0.7;
}

/* 提问区 */
.ask { margin-bottom: 34px; }
.ask label {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.22em;
  margin-bottom: 12px;
}
.ask label .zh {
  display: block;
  color: var(--gold);
  font-family: var(--serif-zh);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 14px rgba(255,215,0,0.5), 0 1px 1px rgba(0,0,0,0.25);
}
.ask label .en {
  display: block;
  font-family: var(--serif-en);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.16em;
  margin-top: 5px;
  font-style: italic;
}
#question {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(28,23,18,0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 14px 16px;
  font-family: var(--serif-zh);
  font-size: 17px;
  color: var(--ink);
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
#question:focus {
  border-color: var(--cinnabar-soft);
  box-shadow: 0 0 0 3px rgba(158,59,46,0.10);
}
#question::placeholder { color: var(--ink-faint); }

/* 占卜区 */
.divine {
  text-align: center;
  padding: 20px 0 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.turtle-wrap { position: relative; display: inline-block; margin: 6px 0 4px; }
#turtle { width: 168px; height: auto; cursor: pointer; transform-origin: 50% 52%; filter: drop-shadow(0 8px 22px rgba(0,0,0,0.5)); }
#turtle.shaking { animation: turtleShake 0.7s ease-in-out infinite; }
@keyframes turtleShake {
  0%,100% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-9deg) translateY(-6px); }
  40% { transform: rotate(8deg) translateY(-2px); }
  60% { transform: rotate(-6deg) translateY(-5px); }
  80% { transform: rotate(5deg) translateY(-1px); }
}

.hint {
  font-family: var(--serif-en);
  font-size: 12px; color: var(--ink-faint); letter-spacing: 0.16em; margin: 4px 0 16px;
  font-style: italic;
}

.shake-btn {
  font-family: var(--serif-zh);
  font-size: 18px;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: #f0e4cc;
  background: linear-gradient(180deg, var(--cinnabar), #722518);
  border: 1px solid rgba(185,85,74,0.5);
  border-radius: 2px;
  padding: 13px 40px 13px 46px;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(158,59,46,0.26), inset 0 1px 0 rgba(255,255,255,0.08);
  -webkit-tap-highlight-color: transparent;
}
.shake-btn:hover { box-shadow: 0 6px 20px rgba(158,59,46,0.36), inset 0 1px 0 rgba(255,255,255,0.1); }
.shake-btn:active { transform: translateY(1px); }
.shake-btn:disabled { background: var(--paper-2); color: var(--ink-faint); border-color: var(--line); cursor: not-allowed; box-shadow: none; }

/* 手机摇一摇：开启后的轻提示，仅触摸设备显示 */
.shake-status {
  display: none;
  font-family: var(--serif-en);
  font-size: 11px; color: #c9a44a; letter-spacing: 0.12em;
  margin-top: 8px; min-height: 14px;
}
@media (hover: none) and (pointer: coarse) {
  .shake-status { display: block; }
}

/* 爻位（由下往上） */
.casting {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  margin: 22px auto 4px;
  min-height: 20px;
  width: fit-content;
  max-width: 100%;
}
.yaoline {
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(8px);
  animation: lineIn .35s ease forwards;
}
@keyframes lineIn { to { opacity: 1; transform: translateY(0); } }
.yaoline .idx {
  width: 34px; text-align: right;
  font-family: var(--serif-en);
  font-size: 12px; color: var(--ink-faint);
  flex-shrink: 0;
  letter-spacing: 0.08em;
}
.yao-bars { display: flex; gap: 6px; flex-shrink: 0; }
.bar {
  width: 46px; height: 9px; border-radius: 1px;
  background: var(--gold);
  box-shadow: 0 0 5px rgba(201,168,90,0.22);
}
.bar.broken { background: transparent; position: relative; box-shadow: none; }
.bar.broken::before, .bar.broken::after {
  content: ""; position: absolute; top: 0; height: 9px; width: 20px;
  background: var(--gold); border-radius: 1px;
  box-shadow: 0 0 5px rgba(201,168,90,0.22);
}
.bar.broken::before { left: 0; }
.bar.broken::after { right: 0; }
.yaoline.changing .bar { background: var(--cinnabar); box-shadow: 0 0 6px rgba(158,59,46,0.38); }
.yaoline.changing .bar.broken::before, .yaoline.changing .bar.broken::after { background: var(--cinnabar); box-shadow: 0 0 6px rgba(158,59,46,0.38); }
.mark {
  width: 18px; text-align: center; font-size: 14px; color: var(--cinnabar-soft);
  flex-shrink: 0;
}
.coins { display: flex; gap: 5px; flex-shrink: 0; }
.coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d8b670, #a8853a);
  border: 1px solid #7a5e22;
  position: relative;
  box-shadow: 0 0 4px rgba(201,168,90,0.28);
}
.coin::after {
  content: ""; position: absolute; inset: 5px;
  background: var(--paper); border: 1px solid #7a5e22;
}
.coin.yin { background: radial-gradient(circle at 35% 30%, #4a4338, #2a2620); border-color: #5e574a; box-shadow: none; }
.coin.yin::after { border-color: #5e574a; background: var(--paper); }

/* 结果 */
.result { margin-top: 22px; }
.result[hidden] { display: none; }
.result .qecho {
  text-align: center; font-size: 16px; color: var(--ink-soft);
  margin-bottom: 14px; letter-spacing: 0.1em;
  word-break: break-word;
}
.result .qecho b { color: var(--cinnabar-soft); font-weight: 700; }

/* 模式徽标：让「随机摇卦」与「今日一卦」一眼可辨（修复"点今日一卦没反应"错觉） */
.mode-badge {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif-zh);
  font-size: 19px; font-weight: 700; letter-spacing: 0.12em;
  padding: 12px 16px; margin-bottom: 14px; border-radius: 2px;
  border: 1px solid var(--line);
}
.mode-badge::before {
  font-size: 20px; line-height: 1;
}
.mode-cast { color: var(--gold); background: rgba(255,215,0,0.08); border-color: rgba(255,215,0,0.35); }
.mode-cast::before { content: "🎲"; }
.mode-daily { color: var(--jade); background: rgba(106,138,120,0.12); border-color: rgba(106,138,120,0.4); }
.mode-daily::before { content: "📅"; }
:root.theme-light .mode-cast { background: rgba(122,90,22,0.08); border-color: rgba(122,90,22,0.35); }
:root.theme-light .mode-daily { background: rgba(74,107,90,0.1); border-color: rgba(74,107,90,0.4); }

.gua-card {
  background: rgba(28,23,18,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 18px 18px 20px;
  margin-bottom: 12px;
  box-shadow: 0 4px 22px rgba(0,0,0,0.3);
}
.gua-card .gc-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 6px 12px;
  border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px;
}
.gua-name {
  font-family: var(--serif-zh);
  font-size: 26px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink);
}
.gua-meta {
  font-family: var(--serif-en);
  font-size: 12px; color: var(--gold); letter-spacing: 0.18em; font-style: italic;
}

.gua-body { display: flex; gap: 16px; align-items: flex-start; }
.gua-fig { flex: 0 0 auto; display: flex; flex-direction: column-reverse; gap: 5px; padding-top: 2px; }
.gua-fig .fbars { display: flex; gap: 5px; }
.gua-fig .fbar { width: 30px; height: 7px; background: var(--gold); border-radius: 1px; box-shadow: 0 0 4px rgba(201,168,90,0.22); }
.gua-fig .fbar.brk { background: transparent; position: relative; box-shadow: none; }
.gua-fig .fbar.brk::before, .gua-fig .fbar.brk::after {
  content:""; position:absolute; top:0; height:7px; width:13px; background: var(--gold); border-radius:1px;
  box-shadow: 0 0 4px rgba(201,168,90,0.22);
}
.gua-fig .fbar.brk::before { left:0; } .gua-fig .fbar.brk::after { right:0; }
.gua-fig .fbar.chg { background: var(--cinnabar); box-shadow: 0 0 5px rgba(158,59,46,0.38); }
.gua-fig .fbar.brk.chg::before, .gua-fig .fbar.brk.chg::after { background: var(--cinnabar); box-shadow: 0 0 5px rgba(158,59,46,0.38); }

.gua-text { flex: 1; min-width: 0; }
.gua-text .label {
  font-family: var(--serif-en);
  font-size: 11px; color: var(--cinnabar-soft); letter-spacing: 0.3em; margin-bottom: 6px;
  text-transform: uppercase;
}
.gua-text .ci { font-size: 16px; line-height: 1.7; color: var(--ink); }
.gua-text .yaoci { margin-top: 8px; }
.gua-text .yaoci .yc {
  font-size: 15px; color: var(--ink-soft); line-height: 1.85;
  padding-left: 14px; border-left: 1px solid var(--cinnabar);
  margin: 4px 0;
}
.change-block { margin-top: 12px; }
.change-block .cb-title {
  font-family: var(--serif-en);
  font-size: 12px; color: var(--cinnabar-soft); letter-spacing: 0.28em; margin-bottom: 8px;
  text-transform: uppercase;
}

/* 断语 */
.verdict {
  text-align: center;
  padding: 18px 18px;
  border: 1px solid var(--cinnabar);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(158,59,46,0.10), rgba(158,59,46,0.03));
  box-shadow: 0 0 24px rgba(158,59,46,0.14);
}
.verdict .vword {
  font-family: var(--serif-zh);
  font-size: 46px; font-weight: 700; line-height: 1;
  color: var(--cinnabar);
  letter-spacing: 0.1em;
  text-shadow: 0 0 18px rgba(158,59,46,0.3);
}
.verdict .vword.bad { color: var(--ink-soft); text-shadow: none; }
.verdict .vdesc { margin-top: 10px; font-size: 15px; color: var(--ink-soft); letter-spacing: 0.05em; }
.verdict .vdesc-bai { margin-top: 10px; font-size: 15px; line-height: 1.65; color: var(--ink); letter-spacing: 0.02em; }
.verdict .vkey {
  font-family: var(--serif-en);
  margin-top: 8px; font-size: 11px; color: var(--ink-faint); letter-spacing: 0.2em; font-style: italic;
}
.verdict .vword-en {
  font-family: var(--serif-en);
  margin-top: 6px; font-size: 14px; letter-spacing: 0.32em; color: var(--cinnabar-soft); text-transform: uppercase;
}
.verdict .vword-en.bad { color: var(--ink-soft); }
.verdict .vdesc-en {
  font-family: var(--serif-en);
  margin-top: 4px; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.06em; font-style: italic;
}
.result .q-label { color: var(--ink-soft); }
.gua-text .yc-note { color: var(--ink-faint); font-size: 13px; }

/* 每日一卦 · 道家小故事 */
.story {
  margin-top: 12px; padding: 12px 14px;
  border-left: 2px solid var(--gold);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,215,0,0.06), rgba(185,85,74,0.05));
}
.story-label {
  font-size: 12px; letter-spacing: 0.22em; color: var(--gold);
  font-family: var(--serif-en); text-transform: uppercase; margin-bottom: 8px;
}
.story-text {
  font-size: 15px; line-height: 1.8; color: var(--ink); letter-spacing: 0.02em;
}
.story-bai { margin-top: 8px !important; }
.ai-story { margin-top: 10px; padding: 0 2px; }
.ai-hint { font-size: 13px; color: var(--ink-faint); letter-spacing: 0.03em; }
.ai-hint a { color: var(--gold); text-decoration: underline; cursor: pointer; }
.ai-story .story { margin-top: 0; }

/* 白话文翻译：与文言文上下对照 */
.gua-text .bai {
  font-size: 14.5px; line-height: 1.65; color: var(--ink-soft);
  margin: 4px 0 2px; padding-left: 12px;
  border-left: 2px solid var(--gold-soft);
  letter-spacing: 0.02em;
}
.change-block .bai.yc-bai {
  font-size: 14px; line-height: 1.8; color: var(--ink-soft);
  margin: -1px 0 8px; padding-left: 14px;
  border-left: 2px solid var(--gold-soft);
}

.again {
  display: block; margin: 28px auto 0;
  font-family: var(--serif-zh); font-size: 15px; letter-spacing: 0.4em; text-indent: 0.4em;
  color: var(--gold); background: transparent;
  border: 1px solid var(--gold-soft); border-radius: 2px;
  padding: 11px 32px; cursor: pointer; transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.again:hover { background: rgba(201,168,90,0.10); color: var(--ink); }

/* 今日一卦按钮 */
.daily-btn {
  display: block; margin: 14px auto 0;
  font-family: var(--serif-zh); font-size: 14px; letter-spacing: 0.3em; text-indent: 0.3em;
  color: var(--gold); background: transparent;
  border: 1px solid var(--gold-soft); border-radius: 2px;
  padding: 9px 26px; cursor: pointer; transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.daily-btn:hover { background: rgba(201,168,90,0.10); color: var(--ink); }

/* 结果操作区（分享 + 再卜） */
.result-actions {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: 14px; margin-top: 18px;
}
.result-actions .again { margin: 0; display: inline-block; }
.share-btn {
  font-family: var(--serif-zh); font-size: 15px; letter-spacing: 0.24em; text-indent: 0.24em;
  color: var(--gold); background: transparent;
  border: 1px solid var(--gold-soft); border-radius: 2px;
  padding: 11px 26px; cursor: pointer; transition: background .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.share-btn:hover { background: rgba(201,168,90,0.12); color: var(--ink); }
.daily-echo .q-label { color: var(--gold); letter-spacing: 0.2em; }

/* 分享弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(8,6,4,0.82); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-box {
  position: relative; z-index: 1; width: min(92vw, 420px);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 18px; box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  max-height: 92vh; overflow: auto;
}
.modal-head {
  text-align: center; font-family: var(--serif-zh); font-size: 17px; color: var(--gold);
  letter-spacing: 0.28em; text-indent: 0.28em; margin-bottom: 14px;
}
.modal-imgwrap { text-align: center; }
.modal-imgwrap img { max-width: 100%; max-height: 86vh; width: auto; height: auto; object-fit: contain; display: block; margin: 0 auto; border-radius: 2px; box-shadow: 0 4px 18px rgba(0,0,0,0.4); }
.modal-actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.btn-save, .btn-close {
  font-family: var(--serif-zh); font-size: 14px; letter-spacing: 0.16em; text-indent: 0.16em;
  padding: 10px 22px; border-radius: 2px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-save { color: #f0e4cc; background: linear-gradient(180deg, var(--cinnabar), #722518); border: 1px solid rgba(185,85,74,0.5); }
.btn-close { color: var(--ink-soft); background: transparent; border: 1px solid var(--line); }
.btn-save:hover { filter: brightness(1.08); }
.btn-close:hover { color: var(--ink); border-color: var(--gold-soft); }
.modal-tip {
  margin: 12px 2px 0; text-align: center; font-size: 12.5px; line-height: 1.7;
  color: var(--ink-faint); letter-spacing: 0.04em;
}
.modal-tip strong { color: var(--gold-soft); font-weight: 600; }

/* 复制链接 + 二维码 弹层 */
.link-qrwrap { text-align: center; margin: 4px 0 12px; }
.link-qrwrap img { width: 168px; height: 168px; border-radius: 4px; background: #fff; padding: 10px; box-shadow: 0 4px 18px rgba(0,0,0,0.4); }
.link-url {
  text-align: center; font-size: 13px; color: var(--ink-soft); word-break: break-all;
  padding: 7px 10px; border: 1px dashed var(--line); border-radius: 3px;
  margin: 0 auto 14px; max-width: 92%; letter-spacing: 0.02em;
}
/* 轻提示 toast */
.toast {
  position: fixed; left: 50%; bottom: 38px; transform: translateX(-50%);
  z-index: 120; background: rgba(20,15,10,0.92); color: #f0e4cc;
  font-family: var(--serif-zh); font-size: 14px; letter-spacing: 0.08em;
  padding: 11px 22px; border-radius: 24px; border: 1px solid var(--gold-soft);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); opacity: 0;
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* 移动端全屏看图层（长按保存 / 系统分享） */
.save-view {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(6,4,3,0.92);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.save-view[hidden] { display: none; }
.save-view-inner {
  width: min(94vw, 440px);
  text-align: center;
}
.save-view-inner img {
  max-width: 100%; max-height: 82vh; width: auto; height: auto; object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.5);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: default; /* 允许 iOS 长按弹出保存菜单 */
}
.save-view-tip {
  margin: 14px 4px 16px; text-align: center; font-size: 13px; line-height: 1.7;
  color: var(--gold); letter-spacing: 0.06em;
}
.save-view-close {
  display: inline-block; margin: 0 auto;
  font-family: var(--serif-zh); font-size: 14px; letter-spacing: 0.16em; text-indent: 0.16em;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line);
  border-radius: 2px; padding: 10px 26px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.save-view-close:hover { color: var(--ink); border-color: var(--gold-soft); }

footer {
  margin-top: 56px; text-align: center;
  font-family: var(--serif-en);
  font-size: 11px; color: var(--ink-faint); letter-spacing: 0.18em;
  line-height: 2;
  font-style: italic;
}
footer br + br { content: ""; }

.brand-mark {
  display: block;
  font-family: 'Georgia','Times New Roman',serif;
  font-size: 15px; font-weight: 400; font-style: normal;
  letter-spacing: 0.34em; text-indent: 0.34em;
  color: #c9a85a; margin-bottom: 12px;
  text-transform: lowercase;
}

/* ============ 八字测算板块 ============ */
.bazi {
  margin-top: 34px;
  padding: 28px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.mode-bazi { color: var(--gold); background: rgba(255,215,0,0.08); border-color: rgba(255,215,0,0.35); }
.mode-bazi::before { content: "☯"; }
:root.theme-light .mode-bazi { background: rgba(122,90,22,0.08); border-color: rgba(122,90,22,0.35); }
.bazi-intro { margin: 14px 0 18px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.bazi-intro .zh { font-size: 16px; letter-spacing: 0.34em; color: var(--gold); }
.bazi-intro .en { font-family: var(--serif-en); font-size: 11px; letter-spacing: 0.24em; color: var(--ink-faint); text-transform: uppercase; font-style: italic; }

.bazi-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px;
  max-width: 470px; margin: 0 auto; text-align: left;
}
.bazi-field { display: flex; flex-direction: column; gap: 7px; }
.bazi-field.bazi-date { grid-column: 1 / -1; }
.bazi-field label { display: flex; flex-direction: column; gap: 3px; }
.bazi-field label .zh { font-size: 15px; color: var(--ink-soft); letter-spacing: 0.1em; }
.bazi-field label .en { font-family: var(--serif-en); font-size: 10px; color: var(--ink-faint); letter-spacing: 0.14em; text-transform: uppercase; font-style: italic; }
.bazi-form input[type="date"], .bazi-form input[type="text"], .bazi-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(28,23,18,0.6);
  padding: 11px 12px;
  font-family: var(--serif-zh);
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.bazi-form select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.bazi-form input[type="date"]:focus, .bazi-form input[type="text"]:focus, .bazi-form select:focus { border-color: var(--cinnabar-soft); box-shadow: 0 0 0 3px rgba(158,59,46,0.10); }
.bazi-form input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }
.bazi-btn { grid-column: 1 / -1; margin-top: 6px; width: 100%; letter-spacing: 0.5em; padding: 13px 0 13px 0.5em; }
.bazi-btn:disabled { background: var(--paper-2); color: var(--ink-faint); border-color: var(--line); cursor: not-allowed; box-shadow: none; }

/* 八字结果 —— 高对比度可读配色（暗/亮主题均清晰） */
.bazi-result { margin-top: 22px; text-align: left; }
.bazi-result[hidden] { display: none; }
.bazi-result .bz-card {
  border: 1px solid rgba(201,168,90,0.42);
  border-radius: 6px;
  padding: 18px 16px 20px;
  margin-bottom: 12px;
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  box-shadow: 0 6px 26px rgba(0,0,0,0.35);
}
.bz-pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bz-pillar { text-align: center; border: 1px solid rgba(201,168,90,0.32); border-radius: 4px; padding: 12px 6px; background: rgba(0,0,0,0.32); }
.bz-pillar .pname { font-family: var(--serif-en); font-size: 11px; letter-spacing: 0.18em; color: #e0907e; text-transform: uppercase; margin-bottom: 6px; }
.bz-pillar .pganzhi { font-family: var(--serif-zh); font-size: 28px; font-weight: 700; letter-spacing: 0.08em; color: #ffdf33; }
.bz-pillar .pshishen { margin-top: 7px; font-size: 13px; color: #ddccab; line-height: 1.5; }
.bz-pillar .pshishen .t { color: #84cda8; font-weight: 600; }
.bz-pillar .pshishen .d { color: #bcab8a; }

.bz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 16px; }
.bz-block { border-top: 1px solid rgba(201,168,90,0.32); padding-top: 12px; }
.bz-block .bt { font-family: var(--serif-en); font-size: 11px; letter-spacing: 0.26em; color: #e0907e; text-transform: uppercase; margin-bottom: 8px; }
.bz-wuxing { display: flex; gap: 8px; flex-wrap: wrap; }
.bz-wuxing .wx { flex: 1; min-width: 40px; text-align: center; border: 1px solid rgba(201,168,90,0.32); border-radius: 4px; padding: 6px 2px; background: rgba(0,0,0,0.24); }
.bz-wuxing .wx .w { font-size: 14px; color: #ddccab; }
.bz-wuxing .wx .c { font-size: 18px; font-weight: 700; color: #ffdf33; }
.bz-daymaster { font-size: 15px; line-height: 1.85; color: #f0e6cf; }
.bz-daymaster b { color: #ffdf33; }
.bz-daymaster .str { color: #e89a8c; font-weight: 700; }

.bz-dayun .dy-line { font-size: 14px; color: #ddccab; margin-top: 4px; }
.bz-dayun .dy-line b { color: #ffdf33; }
.bz-dayun .dy-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bz-dayun .dy-item { border: 1px solid rgba(201,168,90,0.32); border-radius: 4px; padding: 5px 9px; font-size: 13px; color: #f0e6cf; background: rgba(0,0,0,0.24); }
.bz-dayun .dy-item .age { color: #bcab8a; font-size: 11px; margin-left: 4px; }

.bz-ai { margin-top: 16px; padding: 14px 16px; border-left: 3px solid #ffd700; border-radius: 4px 10px 10px 4px; background: linear-gradient(135deg, rgba(255,215,0,0.14), rgba(185,85,74,0.12)); box-shadow: inset 0 0 0 1px rgba(255,215,0,0.20); }
.bz-ai .ai-label { font-size: 12px; letter-spacing: 0.22em; color: #ffd700; font-family: var(--serif-en); text-transform: uppercase; margin-bottom: 9px; }
.bz-ai .ai-text { font-size: 15.5px; line-height: 1.95; color: #f4ecd6; letter-spacing: 0.02em; white-space: pre-line; }
.bz-ai .ai-hint { color: #ddccab; font-size: 14px; }

.bz-note { margin-top: 12px; font-size: 13px; color: #cbb893; line-height: 1.75; }

/* 八字结果 · 白天浅色主题适配 */
:root.theme-light .bazi-result .bz-card { background: rgba(255,255,255,0.62); border-color: rgba(42,37,33,0.3); box-shadow: 0 6px 22px rgba(120,100,70,0.16); }
:root.theme-light .bz-pillar { background: rgba(0,0,0,0.04); border-color: rgba(42,37,33,0.24); }
:root.theme-light .bz-pillar .pname { color: #b9554a; }
:root.theme-light .bz-pillar .pganzhi { color: #7a5a16; }
:root.theme-light .bz-pillar .pshishen { color: #5d544a; }
:root.theme-light .bz-pillar .pshishen .t { color: #4a6b5a; }
:root.theme-light .bz-pillar .pshishen .d { color: #8a7e6e; }
:root.theme-light .bz-block { border-color: rgba(42,37,33,0.24); }
:root.theme-light .bz-block .bt { color: #b9554a; }
:root.theme-light .bz-wuxing .wx { background: rgba(0,0,0,0.04); border-color: rgba(42,37,33,0.24); }
:root.theme-light .bz-wuxing .wx .w { color: #5d544a; }
:root.theme-light .bz-wuxing .wx .c { color: #7a5a16; }
:root.theme-light .bz-daymaster { color: #2a2521; }
:root.theme-light .bz-daymaster b { color: #7a5a16; }
:root.theme-light .bz-daymaster .str { color: #b9554a; }
:root.theme-light .bz-dayun .dy-line { color: #2a2521; }
:root.theme-light .bz-dayun .dy-line b { color: #7a5a16; }
:root.theme-light .bz-dayun .dy-item { color: #2a2521; background: rgba(0,0,0,0.04); border-color: rgba(42,37,33,0.24); }
:root.theme-light .bz-dayun .dy-item .age { color: #8a7e6e; }
:root.theme-light .bz-ai { background: linear-gradient(135deg, rgba(122,90,22,0.12), rgba(158,59,46,0.09)); box-shadow: inset 0 0 0 1px rgba(122,90,22,0.28); border-left-color: #7a5a16; }
:root.theme-light .bz-ai .ai-label { color: #7a5a16; }
:root.theme-light .bz-ai .ai-text { color: #2a2521; }
:root.theme-light .bz-ai .ai-hint { color: #5d544a; }
:root.theme-light .bz-note { color: #6d6456; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .paper { padding: 44px 24px 56px; }
  .logo-mark { width: 56px; height: 56px; }
  .title { font-size: 48px; }
  .tagline .zh { font-size: 15px; }
}

@media (max-width: 600px) {
  .paper { padding: 32px 18px 46px; }
  .paper::before { top: 20px; width: 90px; }
  .logo-mark { width: 50px; height: 50px; }
  .title { font-size: 38px; }
  .tagline .zh { font-size: 14px; letter-spacing: 0.32em; }
  .tagline .en { font-size: 10px; }

  .ask label { font-size: 13px; }
  #question { font-size: 16px; padding: 12px 14px; min-height: 68px; }

  #turtle { width: 138px; height: 138px; }
  .shake-btn { font-size: 16px; letter-spacing: 0.4em; padding: 12px 30px 12px 36px; }
  .hint { font-size: 11px; letter-spacing: 0.12em; }

  .yaoline { gap: 10px; }
  .yaoline .idx { width: 28px; font-size: 11px; }
  .bar { width: 38px; height: 8px; }
  .bar.broken::before, .bar.broken::after { width: 16px; height: 8px; }
  .coin { width: 14px; height: 14px; }
  .coin::after { inset: 4px; }

  .gua-card { padding: 14px 14px 16px; }
  .gua-body { flex-direction: column; gap: 12px; }
  .gua-fig .fbar { width: 28px; height: 6px; }
  .gua-fig .fbar.brk::before, .gua-fig .fbar.brk::after { width: 12px; height: 6px; }
  .gua-name { font-size: 20px; }
  .gua-meta { font-size: 11px; }
  .gua-text .ci { font-size: 14px; line-height: 1.55; }
  .gua-text .bai { font-size: 12.5px; line-height: 1.55; }
  .change-block .bai.yc-bai { font-size: 13px; }

  .verdict { padding: 11px 10px; }
  .verdict .vword { font-size: 28px; }
  .verdict .vdesc { font-size: 13px; line-height: 1.5; }
  .verdict .vdesc-bai { font-size: 13px; line-height: 1.5; }
  .verdict .vword-en { font-size: 12px; }

  .story { margin-top: 10px; padding: 10px 12px; }
  .story-text { font-size: 13px; line-height: 1.6; }
  .ai-story { margin-top: 8px; font-size: 13px; line-height: 1.6; }
  .result-actions { margin-top: 10px; gap: 10px; position: sticky; bottom: 8px; background: var(--paper); padding: 8px 0 4px; border-top: 1px solid var(--line); z-index: 6; }
  .share-btn, .again { padding: 9px 18px; font-size: 13px; letter-spacing: 0.16em; }
  .result-actions .again { margin: 0; }
  .qecho.daily-echo { margin-bottom: 10px; }

  footer { font-size: 10px; letter-spacing: 0.12em; }
}

@media (max-width: 380px) {
  .paper { padding: 26px 14px 38px; }
  .title { font-size: 32px; }
  .tagline .zh { font-size: 12px; letter-spacing: 0.24em; }
  .logo-mark { width: 44px; height: 44px; }

  #turtle { width: 120px; height: 120px; }
  .shake-btn { font-size: 15px; letter-spacing: 0.35em; padding: 11px 26px 11px 32px; }

  .gua-name { font-size: 23px; }
  .verdict .vword { font-size: 36px; }

  .yaoline { gap: 8px; }
  .yaoline .idx { width: 24px; font-size: 10px; }
  .bar { width: 32px; }
  .bar.broken::before, .bar.broken::after { width: 13px; }
  .coin { width: 12px; height: 12px; }
  .coin::after { inset: 3px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .paper { padding-top: 24px; padding-bottom: 30px; }
  .paper::before { top: 14px; }
  .site-header { margin-bottom: 24px; }
  .logo-mark { width: 44px; height: 44px; }
  .title { font-size: 34px; margin-top: 8px; }
  .rule { margin-top: 14px; }
  #turtle { width: 120px; height: 120px; }
  .divine { padding: 14px 0 4px; }
}

/* 八字板块 · 移动端 */
@media (max-width: 600px) {
  .bazi-form { grid-template-columns: 1fr; }
  .bazi-field.bazi-date { grid-column: auto; }
  .bz-pillars { grid-template-columns: repeat(2, 1fr); }
  .bz-pillar .pganzhi { font-size: 22px; }
  .bz-grid { grid-template-columns: 1fr; }
}
