/* ============================================================
 * 来一卦 · 视觉系统
 * 玄墨为底 · 宣纸为文 · 朱砂为令 · 鎏金为饰
 * ============================================================ */

:root {
  --ink: #0b0d12;          /* 玄墨 */
  --ink-2: #11141c;        /* 墨二 */
  --ink-3: #171b26;        /* 墨三 */
  --paper: #ece3cf;        /* 宣纸 */
  --paper-dim: #9a917d;    /* 旧纸 */
  --paper-faint: #6f6959;  /* 淡墨纸 */
  --cinnabar: #c8412f;     /* 朱砂 */
  --cinnabar-bright: #e05a46;
  --gold: #c9a227;         /* 鎏金 */
  --gold-bright: #e5c76b;
  --line: rgba(201, 162, 39, 0.16);

  --font-display: "Ma Shan Zheng", "STKaiti", "KaiTi", "楷体", serif;
  --font-body: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;

  --radius: 14px;
  --ease-out: cubic-bezier(0.22, 0.7, 0.25, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(201, 162, 39, 0.07), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(200, 65, 47, 0.05), transparent 55%),
    var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100vh;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

/* 宣纸颗粒 */
#grain {
  position: fixed; inset: 0; z-index: 999; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible { outline: 2px solid rgba(201, 162, 39, 0.75); outline-offset: 2px; border-radius: 4px; }

/* R62 iOS 适配：输入 16px 防 Safari 聚焦缩放 */
input, select, textarea, button { font-size: max(16px, 1em); }
#castQuestion, #hexSearch, .q-preset, .tool-form select, .set-fields input { font-size: 16px; }
html { -webkit-tap-highlight-color: transparent; }

::selection { background: rgba(200, 65, 47, 0.55); color: var(--paper); }
.chip { transition: color 0.2s, border-color 0.2s, transform 0.2s; }
.chip:hover { transform: translateY(-1px); }
.btn-ghost:active { transform: scale(0.97); }
.entry .glyph { transition: transform 0.3s var(--ease-out); }
.entry:hover .glyph { transform: rotate(8deg) scale(1.1); }
.najia-row { transition: background 0.2s; }
.najia-row:hover { background: rgba(201, 162, 39, 0.03); }
.yong-line { transition: background 0.2s; }
.yong-line:hover { background: rgba(201, 162, 39, 0.02); }
.history-item:focus-visible { outline: 2px solid rgba(201, 162, 39, 0.7); outline-offset: 2px; }
.mode-pill { transition: all 0.25s; }
.mode-pill:hover:not(.active) { border-color: rgba(201, 162, 39, 0.3); color: var(--paper); }
.tcard:hover .inner { filter: brightness(1.05); }
.hexlib-item:active { transform: scale(0.97); }
.w-row { transition: border-color 0.2s; }
.w-row:hover { border-color: rgba(201, 162, 39, 0.3); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 162, 39, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201, 162, 39, 0.5); }

/* ---------- 导航 ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  font-family: var(--font-display); font-size: 22px; letter-spacing: 0.12em;
}
.brand .seal {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--cinnabar); color: var(--paper);
  border-radius: 7px; font-size: 19px;
  box-shadow: 0 0 0 1px rgba(229, 90, 70, 0.35), 0 4px 14px rgba(200, 65, 47, 0.35);
}
nav { display: flex; gap: clamp(10px, 2.5vw, 28px); align-items: center; }
nav a {
  color: var(--paper-dim); text-decoration: none; font-size: 15px;
  padding: 6px 2px; position: relative; transition: color 0.25s; cursor: pointer;
}
nav a::after {
  content: ""; position: absolute; left: 50%; bottom: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  transform: translateX(-50%); transition: width 0.3s var(--ease-out);
}
nav a:hover, nav a.active { color: var(--paper); }
nav a.active::after, nav a:hover::after { width: 100%; }
#soundToggle {
  background: none; border: 1px solid var(--line); color: var(--paper-dim);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 15px;
  transition: color 0.25s, border-color 0.25s; flex: 0 0 auto;
}
#soundToggle:hover { color: var(--gold-bright); border-color: var(--gold); }
#soundToggle.off { opacity: 0.45; }

/* ---------- 视图容器 ---------- */
main { max-width: 860px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px) calc(60px + env(safe-area-inset-bottom)); }
.view { display: none; animation: viewIn 0.5s var(--ease-out); }
.view.show { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 Hero ---------- */
#view-home { text-align: center; padding-top: clamp(30px, 7vh, 72px); position: relative; }
.hero-plate { position: relative; width: min(78vw, 400px); height: min(78vw, 400px); margin: 0 auto; }
.hero-plate svg { width: 100%; height: 100%; overflow: visible; }
.rot-slow { animation: spin 100s linear infinite; transform-origin: 150px 150px; }
.rot-rev { animation: spinRev 70s linear infinite; transform-origin: 150px 150px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinRev { to { transform: rotate(-360deg); } }
.plate-glow { animation: breathe 5s ease-in-out infinite; transform-origin: 150px 150px; }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.hero-title {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
  z-index: 1;
}
/* 墨晕底衬：托住标题，避免与罗盘地支层叠冲突 */
.hero-title::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 118%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(11, 13, 18, 0.82) 0%,
    rgba(11, 13, 18, 0.5) 40%,
    rgba(11, 13, 18, 0.12) 58%,
    transparent 66%);
  z-index: -1;
}
.hero-eyebrow { font-size: clamp(14px, 2.5vw, 17px); letter-spacing: 0.6em; text-indent: 0.6em; color: var(--paper-dim); }
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(58px, 13vw, 96px);
  letter-spacing: 0.1em; text-indent: 0.1em;
  color: var(--paper);
  text-shadow: 0 0 30px rgba(201, 162, 39, 0.25), 0 2px 0 rgba(0, 0, 0, 0.4);
  margin: 6px 0 2px;
}
.hero-sub { font-size: clamp(13px, 2vw, 15px); color: var(--paper-faint); letter-spacing: 0.2em; }

/* 朱砂主按钮：笔触横扫 */
.btn-primary {
  display: inline-block; margin-top: clamp(26px, 4vh, 40px);
  background: linear-gradient(160deg, var(--cinnabar-bright), var(--cinnabar));
  color: #fbeee6; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 19px; font-weight: 600; letter-spacing: 0.35em; text-indent: 0.35em;
  padding: 16px 46px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(200, 65, 47, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg); transition: left 0.55s var(--ease-out);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 10px 34px rgba(200, 65, 47, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn-primary:hover::after { left: 130%; }
.btn-primary:active { transform: translateY(0) scale(0.99); }

/* 入口三径 */
.entries { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: clamp(36px, 6vh, 56px); }
.entry {
  background: linear-gradient(175deg, rgba(236, 227, 207, 0.045), rgba(236, 227, 207, 0.015));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 14px; cursor: pointer; text-align: center;
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background 0.3s;
}
.entry:hover { transform: translateY(-4px); border-color: rgba(201, 162, 39, 0.45); background: rgba(236, 227, 207, 0.06); }
.entry .glyph { font-size: 30px; display: block; margin-bottom: 10px; color: var(--gold-bright); }
.entry .t { font-size: 16px; letter-spacing: 0.15em; }
.entry .d { font-size: 12px; color: var(--paper-faint); margin-top: 6px; letter-spacing: 0.05em; }
.home-note { margin-top: 34px; font-size: 12px; color: var(--paper-faint); letter-spacing: 0.15em; }

/* ---------- 通用块 ---------- */
.backlink {
  display: inline-flex; align-items: center; gap: 6px; margin: 26px 0 8px;
  color: var(--paper-faint); font-size: 14px; cursor: pointer; transition: color 0.2s;
}
.backlink:hover { color: var(--paper); }
.section-title { font-family: var(--font-display); font-size: clamp(26px, 5vw, 34px); letter-spacing: 0.18em; }
.section-sub { color: var(--paper-faint); font-size: 14px; margin-top: 6px; letter-spacing: 0.08em; }
.step-label {
  display: inline-block; margin: 30px 0 12px;
  font-size: 13px; letter-spacing: 0.3em; color: var(--gold);
  border: 1px solid rgba(201, 162, 39, 0.35); border-radius: 999px; padding: 5px 14px;
}
.card {
  background: linear-gradient(175deg, rgba(236, 227, 207, 0.05), rgba(236, 227, 207, 0.015));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
}
.faint { color: var(--paper-faint); font-size: 12px; }

/* ---------- 起卦 ---------- */
#castQuestion {
  width: 100%; background: rgba(236, 227, 207, 0.04);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--paper); font-family: var(--font-body); font-size: 16px;
  padding: 15px 18px; outline: none; transition: border-color 0.25s; letter-spacing: 0.03em;
}
#castQuestion:focus { border-color: rgba(201, 162, 39, 0.55); }
#castQuestion::placeholder { color: var(--paper-faint); }

.cast-stage {
  margin-top: 26px; display: flex; flex-direction: column; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(20px, 4vw, 36px);
  background:
    radial-gradient(500px 200px at 50% 0%, rgba(201, 162, 39, 0.05), transparent 70%),
    linear-gradient(175deg, rgba(236, 227, 207, 0.03), transparent);
  position: relative; overflow: hidden;
}
/* 案几 */
.cast-stage::after {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 30px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.4), transparent);
}

.coins { display: flex; gap: clamp(16px, 4vw, 30px); perspective: 700px; margin-top: 6px; }
.coin3d { width: clamp(58px, 15vw, 76px); height: clamp(58px, 15vw, 76px); }
.coin-inner {
  width: 100%; height: 100%; position: relative;
  transform-style: preserve-3d;
  transition: transform 0.95s var(--ease-out);
}
.coin3d.fast .coin-inner { transition-duration: 0.18s; }
.coin-face {
  position: absolute; inset: 0; border-radius: 50%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}
.coin-face.back { transform: rotateY(180deg); }
.coin3d.hop { animation: hop 0.95s var(--ease-out); }
.coin3d.fast.hop { animation-duration: 0.2s; }
@keyframes hop {
  0% { transform: translateY(0); }
  28% { transform: translateY(calc(clamp(58px, 15vw, 76px) * -0.75)); }
  60% { transform: translateY(0); }
  75% { transform: translateY(-7px); }
  100% { transform: translateY(0); }
}
/* 摇卦震颤 */
.coins.shaking .coin3d { animation: tremble 0.11s infinite; }
@keyframes tremble {
  0% { transform: translate(calc(var(--amp, 2px) * -1), 0) rotate(-3deg); }
  50% { transform: translate(var(--amp, 2px), calc(var(--amp, 2px) * -0.6)) rotate(3deg); }
  100% { transform: translate(calc(var(--amp, 2px) * -1), 0) rotate(-3deg); }
}
.coins.shaking .coin3d.hop { animation: tremble 0.11s infinite; }

.cast-progress { margin-top: 18px; font-size: 14px; letter-spacing: 0.25em; color: var(--paper-dim); min-height: 20px; }
.cast-progress b { color: var(--gold-bright); font-weight: 600; }

#holdBtn {
  margin-top: 20px;
  width: min(100%, 300px);
  background: linear-gradient(160deg, var(--cinnabar-bright), var(--cinnabar));
  color: #fbeee6; border: none; cursor: pointer; border-radius: 999px;
  font-family: var(--font-body); font-size: 17px; font-weight: 600; letter-spacing: 0.3em; text-indent: 0.3em;
  padding: 15px 20px;
  box-shadow: 0 5px 20px rgba(200, 65, 47, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#holdBtn:disabled { filter: saturate(0.4) brightness(0.7); cursor: wait; }
#holdBtn.pressing { transform: scale(0.96); box-shadow: 0 2px 10px rgba(200, 65, 47, 0.5); }
.skip-anim { display: inline-block; margin-top: 12px; padding: 8px 16px; font-size: 13px; color: var(--paper-faint); cursor: pointer; letter-spacing: 0.1em; }
.skip-anim:hover { color: var(--paper-dim); }

/* 成卦爻堆（右侧浮层，窄屏在下） */
.cast-layout { display: grid; grid-template-columns: 1fr 220px; gap: 22px; align-items: start; }
@media (max-width: 700px) { .cast-layout { grid-template-columns: 1fr; } }
.yao-stack { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 14px; background: rgba(236, 227, 207, 0.02); }
.yao-stack h4 { font-size: 13px; letter-spacing: 0.25em; color: var(--paper-faint); font-weight: 400; margin-bottom: 12px; text-align: center; }
.yao-row { display: grid; grid-template-columns: 30px 1fr 34px; align-items: center; gap: 8px; min-height: 26px; margin-bottom: 7px; }
.yao-row .pos { font-size: 12px; color: var(--paper-faint); text-align: right; }
.yao-row .mark { font-size: 11px; color: var(--gold); letter-spacing: 0.05em; }
.yao-lane { position: relative; height: 13px; }
.yao-bar, .yao-bar::before, .yao-bar::after { border-radius: 6px; }
.yao-bar { position: absolute; inset: 0; }
.yao-bar.yang { background: var(--paper); animation: yaoIn 0.5s var(--ease-out) both; }
.yao-bar.yin { background: transparent; }
.yao-bar.yin::before, .yao-bar.yin::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 44%;
  animation: yaoIn 0.5s var(--ease-out) both;
}
.yao-bar.yin::before { left: 0; } .yao-bar.yin::after { right: 0; }
.yao-bar.yang.dong { background: var(--gold-bright); box-shadow: 0 0 12px rgba(229, 199, 107, 0.55); }
.yao-bar.yin.dong::before, .yao-bar.yin.dong::after { background: var(--gold-bright); box-shadow: 0 0 12px rgba(229, 199, 107, 0.55); }
.yao-bar.dong { animation: yaoIn 0.5s var(--ease-out) both, dongPulse 2.2s ease-in-out 0.6s infinite; }
.yao-bar.yin.dong { animation: yaoIn 0.5s var(--ease-out) both; }
.yao-bar.yin.dong::before { animation-name: yaoInDong; }
.yao-bar.yin.dong::after { animation-name: yaoInDong; }
@keyframes yaoIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes yaoInDong { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dongPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

/* ---------- 卦成墨幕 ---------- */
#inkVeil {
  position: fixed; inset: 0; z-index: 200; background: var(--ink);
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  transition: opacity 0.45s ease;
}
#inkVeil.on { opacity: 1; }
#inkVeil .veil-char {
  font-family: var(--font-display); font-size: clamp(64px, 14vw, 110px);
  letter-spacing: 0.4em; text-indent: 0.4em; color: var(--paper);
  opacity: 0; transform: scale(1.25);
}
#inkVeil.on .veil-char { animation: veilChar 1s var(--ease-out) both; }
@keyframes veilChar { 0% { opacity: 0; transform: scale(1.3); } 35% { opacity: 1; transform: scale(1); } 100% { opacity: 0.9; transform: scale(1); } }

/* ---------- 结果页 ---------- */
#view-result { padding-top: 10px; }
.result-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 30px 0 6px; }
.result-head .rule { height: 1px; width: min(120px, 20vw); background: linear-gradient(90deg, transparent, var(--line)); }
.result-head .rule:last-child { background: linear-gradient(90deg, var(--line), transparent); }
.result-head span { font-size: 14px; letter-spacing: 0.5em; text-indent: 0.5em; color: var(--gold); }

.result-hero {
  display: flex; justify-content: center; align-items: stretch; gap: clamp(20px, 6vw, 56px);
  margin: 26px 0 10px; flex-wrap: wrap;
}
.hex-figure { text-align: center; }
.hex-figure .hex-fig { display: flex; flex-direction: column; gap: 9px; width: clamp(120px, 22vw, 168px); padding: 22px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(236, 227, 207, 0.02); }
.hex-fig .yao-line { position: relative; height: clamp(12px, 2vw, 15px); animation-delay: var(--d, 0s); }
.hex-fig .yao-line.yang { background: var(--paper); border-radius: 7px; animation: yaoIn 0.55s var(--ease-out) both; animation-delay: var(--d, 0s); }
.hex-fig .yao-line.yin { background: transparent; }
.hex-fig .yao-line.yin::before, .hex-fig .yao-line.yin::after { content: ""; position: absolute; top: 0; bottom: 0; width: 44%; background: var(--paper); border-radius: 7px; animation: yaoIn 0.55s var(--ease-out) both; animation-delay: var(--d, 0s); }
.hex-fig .yao-line.yin::before { left: 0; } .hex-fig .yao-line.yin::after { right: 0; }
.hex-fig .yao-line.yang.dong { background: var(--gold-bright); box-shadow: 0 0 10px rgba(229, 199, 107, 0.5); }
.hex-fig .yao-line.yin.dong::before, .hex-fig .yao-line.yin.dong::after { background: var(--gold-bright); box-shadow: 0 0 10px rgba(229, 199, 107, 0.5); }
.hex-fig.no-anim .yao-line, .hex-fig.no-anim .yao-line.yin::before, .hex-fig.no-anim .yao-line.yin::after { animation: none; }
.hex-figure .cap { margin-top: 12px; font-size: 13px; letter-spacing: 0.2em; color: var(--paper-dim); }
.hex-figure .cap b { color: var(--gold-bright); font-weight: 600; font-size: 15px; }
.result-arrow { align-self: center; font-size: 22px; color: var(--gold); font-family: var(--font-display); }

.result-name {
  text-align: center; margin: 8px 0 4px;
}
.result-name .ord { font-size: 13px; color: var(--paper-faint); letter-spacing: 0.35em; }
.result-name .nm {
  font-family: var(--font-display);
  font-size: clamp(56px, 13vw, 88px); line-height: 1.15; letter-spacing: 0.12em;
  text-shadow: 0 0 26px rgba(200, 65, 47, 0.28);
}
.result-name .full { font-size: 15px; color: var(--paper-dim); letter-spacing: 0.4em; text-indent: 0.4em; margin-top: 2px; }
.result-trigrams { display: flex; justify-content: center; gap: 26px; margin-top: 14px; color: var(--paper-dim); font-size: 14px; letter-spacing: 0.1em; }
.result-trigrams b { font-size: 20px; color: var(--gold-bright); font-weight: 400; margin-right: 6px; }
.hex-struct { text-align: center; font-size: 13px; color: var(--paper-faint); margin-top: 10px; letter-spacing: 0.06em; }

/* ---------- 本周择日 & 十二时辰 ---------- */
.week-days { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-top: 10px; }
.week-day {
  flex: 0 0 118px; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 10px; text-align: center; background: rgba(236, 227, 207, 0.02);
}
.week-day.today { border-color: rgba(201, 162, 39, 0.6); background: rgba(201, 162, 39, 0.07); }
.week-day b { font-size: 13px; color: var(--gold-bright); font-weight: 400; letter-spacing: 0.15em; }
.week-day .wd-lunar { display: block; font-size: 12px; color: var(--paper); margin: 6px 0 8px; }
.week-day .wd-yi { display: block; font-size: 11px; color: #8fbf6a; line-height: 1.7; }
.week-day .wd-ji { display: block; font-size: 11px; color: var(--cinnabar-bright); margin-top: 3px; }
.hour-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 10px; }
@media (max-width: 640px) { .hour-grid { grid-template-columns: repeat(4, 1fr); } }
.hour-cell { text-align: center; border-radius: 8px; padding: 8px 4px; border: 1px solid var(--line); }
.hour-cell b { font-family: var(--font-display); font-size: 17px; font-weight: 400; display: block; }
.hour-cell span { font-size: 11px; }
.hour-cell.ji { border-color: rgba(122, 157, 84, 0.5); background: rgba(122, 157, 84, 0.08); }
.hour-cell.ji span { color: #8fbf6a; }
.hour-cell.xiong { border-color: rgba(200, 65, 47, 0.4); }
.hour-cell.xiong span { color: var(--paper-faint); }
.hour-cell.xiong b { color: var(--paper-dim); }

/* ---------- 会诊 ---------- */
.consult-card { margin-top: 26px; border: 1px solid rgba(201, 162, 39, 0.4); }
.consult-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 640px) { .consult-grid { grid-template-columns: 1fr; } }
.consult-col { border: 1px dashed rgba(201, 162, 39, 0.3); border-radius: 10px; padding: 14px; }
.consult-col h5 { font-size: 12px; letter-spacing: 0.3em; color: var(--gold); font-weight: 400; margin-bottom: 8px; }
.consult-col .c-main { font-family: var(--font-display); font-size: 22px; color: var(--paper); }
.consult-col .c-sub { font-size: 12.5px; color: var(--paper-dim); line-height: 1.8; margin-top: 6px; }
.consult-verdict { margin-top: 16px; }
.consult-verdict .v-tag { display: inline-block; font-size: 13px; padding: 4px 14px; border-radius: 999px; margin-right: 8px; margin-bottom: 8px; }
.v-tag.agree { color: #8fbf6a; border: 1px solid rgba(122, 157, 84, 0.55); }
.v-tag.warn { color: var(--cinnabar-bright); border: 1px solid rgba(200, 65, 47, 0.55); }
.consult-verdict p { font-size: 14px; line-height: 2; color: var(--paper-dim); margin-top: 8px; }

.dong-chips { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 20px 0 0; }
.chip {
  font-size: 12px; letter-spacing: 0.12em; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--paper-dim); background: rgba(236, 227, 207, 0.03);
}
.chip.gold { color: var(--gold-bright); border-color: rgba(201, 162, 39, 0.5); }
.chip.red { color: var(--cinnabar-bright); border-color: rgba(200, 65, 47, 0.5); }

.quote-block { margin: 28px 0 0; border-left: 3px solid var(--cinnabar); padding: 4px 0 4px 18px; }
.quote-block .qt { font-family: var(--font-display); font-size: clamp(18px, 3vw, 22px); line-height: 1.8; letter-spacing: 0.08em; }
.quote-block .src { display: block; margin-top: 8px; font-size: 12px; color: var(--paper-faint); letter-spacing: 0.2em; }
.quote-block.xiang { border-left-color: var(--gold); margin-top: 16px; }
.basis-block .quote-block { margin-top: 14px; }
.basis-block .quote-block .bai { margin-top: 8px; font-size: 14px; line-height: 1.9; color: var(--paper-dim); font-family: var(--font-body); }

/* ---------- 装卦表 ---------- */
.najia-wrap { margin-top: 26px; }
.najia-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.najia-table { border: 1px solid rgba(201, 162, 39, 0.25); border-radius: 10px; overflow: hidden; }
.najia-row {
  display: grid; grid-template-columns: 46px 118px 1fr 62px 36px;
  align-items: center; gap: 10px; padding: 9px 16px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.08);
}
.najia-row:last-child { border-bottom: none; }
.najia-row.dong { background: rgba(201, 162, 39, 0.06); }
.najia-row .r-shen { font-size: 12px; color: var(--paper-faint); letter-spacing: 0.1em; }
.najia-row .r-qin { font-size: 13px; color: var(--paper-dim); }
.najia-row .r-qin b { font-weight: 400; color: var(--gold-bright); margin-left: 7px; }
.najia-row .r-line { display: flex; justify-content: center; }
.najia-row .r-line i { display: inline-block; height: 7px; border-radius: 4px; background: var(--paper); width: 72px; position: relative; }
.najia-row .r-line i.yin { background: transparent; }
.najia-row .r-line i.yin::before, .najia-row .r-line i.yin::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 44%; background: var(--paper); border-radius: 4px;
}
.najia-row .r-line i.yin::before { left: 0; } .najia-row .r-line i.yin::after { right: 0; }
.najia-row.dong .r-line i, .najia-row.dong .r-line i.yin::before, .najia-row.dong .r-line i.yin::after { background: var(--gold-bright); }
.najia-row .r-gz { font-size: 13px; color: var(--paper); letter-spacing: 0.08em; }
.najia-row .r-sy { font-size: 11px; color: var(--cinnabar-bright); text-align: center; letter-spacing: 0.1em; }
.najia-note { margin-top: 12px; font-size: 12px; color: var(--paper-faint); text-align: center; letter-spacing: 0.05em; }
.najia-row.yong { box-shadow: inset 3px 0 0 var(--cinnabar); }
.yong-card .yong-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed rgba(201, 162, 39, 0.12); }
.yong-card .yong-line:last-of-type { border-bottom: none; }
.yong-card .yong-line b { font-family: var(--font-display); font-size: 17px; color: var(--gold-bright); font-weight: 400; }
.yong-pos { font-size: 12px; color: var(--paper-dim); }
.yong-str { font-size: 12px; padding: 2px 11px; border-radius: 999px; letter-spacing: 0.1em; }
.yong-str.s-wang { color: #8fbf6a; border: 1px solid rgba(122, 157, 84, 0.55); }
.yong-str.s-ping { color: var(--paper-dim); border: 1px solid var(--line); }
.yong-str.s-shuai { color: var(--cinnabar-bright); border: 1px solid rgba(200, 65, 47, 0.55); }
.yong-why { font-size: 12px; color: var(--paper-faint); }
.yong-hint { margin-top: 12px; font-size: 14px; line-height: 1.9; color: var(--paper-dim); }
.yong-cats { margin-top: 14px; }

/* ---------- 卦库 ---------- */
#hexSearch {
  width: 100%; background: rgba(236, 227, 207, 0.04);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--paper); font-family: var(--font-body); font-size: 15px;
  padding: 13px 16px; outline: none; transition: border-color 0.25s; margin-top: 18px;
}
#hexSearch:focus { border-color: rgba(201, 162, 39, 0.55); }
#hexSearch::placeholder { color: var(--paper-faint); }
.hexlib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.hexlib-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px;
  text-align: center; cursor: pointer; background: rgba(236, 227, 207, 0.02);
  transition: transform 0.25s var(--ease-out), border-color 0.25s;
}
.hexlib-item:hover { transform: translateY(-3px); border-color: rgba(201, 162, 39, 0.45); }
.hexlib-item .hex-fig { width: 78px; padding: 8px 6px; gap: 4px; border: none; background: none; margin: 0 auto; }
.hexlib-item .hex-fig .yao-line { height: 7px; }
.hexlib-item .hex-fig .yao-line.yin::before, .hexlib-item .hex-fig .yao-line.yin::after { height: 7px; }
.hexlib-item .nm { font-family: var(--font-display); font-size: 22px; margin-top: 8px; }
.hexlib-item .fl { font-size: 11px; color: var(--paper-faint); margin-top: 3px; letter-spacing: 0.15em; }

/* ---------- 紫微盘 ---------- */
.ziwei-result { margin-top: 22px; display: none; }
.ziwei-result.show { display: block; animation: viewIn 0.5s var(--ease-out); }
.ziwei-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
@media (max-width: 640px) { .ziwei-grid { grid-template-columns: repeat(2, 1fr); } }
.zpal { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 104px; background: rgba(236, 227, 207, 0.02); }
.zpal.empty { border: none; background: none; min-height: 0; }
.zpal.body { box-shadow: inset 0 0 0 1.5px rgba(200, 65, 47, 0.55); }
.zpal.soul { border-color: rgba(201, 162, 39, 0.55); }
.zpal .zp-name { font-size: 12px; color: var(--gold-bright); letter-spacing: 0.15em; display: flex; justify-content: space-between; }
.zpal .zp-name b { color: var(--cinnabar-bright); font-weight: 400; }
.zpal .zp-gz { font-size: 11px; color: var(--paper-faint); margin: 3px 0 5px; letter-spacing: 0.05em; }
.zp-star { font-size: 12.5px; line-height: 1.65; }
.zp-star.major { color: var(--paper); }
.zp-star.major i { font-style: normal; color: var(--cinnabar-bright); font-size: 11px; }
.zp-star.minor { color: var(--paper-dim); font-size: 11.5px; }
.zp-star.adj { color: var(--paper-faint); font-size: 11px; }
.star-panel {
  margin-top: 12px; border: 1px solid rgba(201, 162, 39, 0.35); border-radius: 10px;
  padding: 12px 16px; font-size: 14px; line-height: 1.9; color: var(--paper-dim);
  animation: viewIn 0.3s var(--ease-out);
}
.star-panel b { font-family: var(--font-display); color: var(--gold-bright); font-weight: 400; margin-right: 8px; font-size: 16px; }

/* ---------- 西式三家 ---------- */
.western-result { margin-top: 22px; display: none; }
.western-result.show { display: block; animation: viewIn 0.5s var(--ease-out); }
.w-row {
  display: grid; grid-template-columns: 44px 52px 1fr auto; grid-template-areas: "g k s d" "g t t x";
  align-items: center; column-gap: 12px; row-gap: 4px;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px;
  background: rgba(236, 227, 207, 0.02);
}
.w-row .w-glyph { grid-area: g; font-size: 30px; color: var(--gold-bright); text-align: center; }
.w-row .w-key { grid-area: k; font-size: 13px; color: var(--paper-dim); letter-spacing: 0.2em; }
.w-row .w-sign { grid-area: s; font-family: var(--font-display); font-size: 22px; font-weight: 400; }
.w-row .w-deg { grid-area: d; font-size: 13px; color: var(--paper-dim); }
.w-row .w-trait { grid-area: t; font-size: 12px; color: var(--gold); letter-spacing: 0.1em; }
.w-row .w-desc { grid-area: x; font-size: 12px; color: var(--paper-faint); justify-self: end; }

/* ---------- 今日之卦条 & 滚动显现 ---------- */
.today-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 18px auto 0; width: fit-content; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 22px;
  background: rgba(236, 227, 207, 0.03); transition: border-color 0.25s;
}
.today-strip:hover { border-color: rgba(201, 162, 39, 0.5); }
.today-strip .ts-label { font-size: 12px; color: var(--paper-faint); letter-spacing: 0.25em; }
.today-strip .ts-hex { font-family: var(--font-display); font-size: 24px; color: var(--gold-bright); }
.today-strip .ts-full { font-size: 13px; color: var(--paper-dim); letter-spacing: 0.1em; }
.today-strip .ts-go { color: var(--paper-faint); }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- 设置弹层 ---------- */
#settingsModal {
  position: fixed; inset: 0; z-index: 260; display: none; place-items: center;
  background: rgba(5, 6, 9, 0.88); backdrop-filter: blur(6px); padding: 20px;
  overflow-y: auto;
}
#settingsModal.on { display: grid; animation: viewIn 0.3s var(--ease-out); }
.settings-panel {
  width: min(92vw, 460px); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--ink-2); padding: 26px;
}
.settings-panel h3 { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.4em; text-align: center; margin-bottom: 20px; }
.set-section { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 18px; }
.set-section h4 { font-size: 13px; letter-spacing: 0.25em; color: var(--gold-bright); font-weight: 400; margin-bottom: 12px; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.set-actions .btn-ghost { padding: 9px 18px; font-size: 13px; }
.set-fields { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.set-fields input {
  background: rgba(236, 227, 207, 0.04); border: 1px solid var(--line); border-radius: 10px;
  color: var(--paper); font-family: var(--font-body); font-size: 13px; padding: 10px 13px; outline: none;
}
.set-fields input:focus { border-color: rgba(201, 162, 39, 0.55); }

/* ---------- AI 解读 ---------- */
.ai-card { margin-top: 24px; border: 1px dashed rgba(201, 162, 39, 0.45); }
.ai-card h3 { color: var(--gold-bright); }
.ai-card p { font-size: 15px; line-height: 2; white-space: pre-wrap; }
.ai-card .ai-note { font-size: 12px; color: var(--paper-faint); margin-top: 10px; }

/* ---------- 大运时间线 ---------- */
.dayun-wrap { margin-top: 30px; }
.dayun-wrap h3 { font-size: 14px; letter-spacing: 0.25em; color: var(--gold); font-weight: 400; margin-bottom: 12px; }
.dayun-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.dayun-chips .chip { text-align: center; line-height: 1.7; flex: 0 0 auto; font-size: 11px; }
.dayun-chips .chip b { font-size: 15px; font-weight: 400; color: var(--paper); font-family: var(--font-display); }
.dayun-chips .chip.gold b { color: var(--gold-bright); }
.dayun-chips .chip.gold { border-color: rgba(201, 162, 39, 0.6); background: rgba(201, 162, 39, 0.08); }

/* ---------- 星盘圈 & 相位 ---------- */
.wheel-wrap { display: flex; justify-content: center; margin: 20px 0 6px; }
.chart-wheel { width: min(70vw, 320px); height: auto; overflow: visible; }
.asp-box { margin-top: 16px; }
.asp-box h4 { font-size: 13px; letter-spacing: 0.3em; color: var(--gold); font-weight: 400; margin-bottom: 10px; }

/* ---------- 小工具 ---------- */
.entries { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
@media (max-width: 700px) { .tools-grid { grid-template-columns: 1fr; } }
.tool-card h3 { font-size: 17px; letter-spacing: 0.15em; color: var(--gold-bright); font-weight: 400; margin-bottom: 6px; }
.tool-card .faint { margin-bottom: 14px; }
.tool-form { display: flex; gap: 8px; }
.tool-form select {
  flex: 1; background: rgba(236, 227, 207, 0.04); border: 1px solid var(--line);
  border-radius: 10px; color: var(--paper); font-family: var(--font-body);
  font-size: 14px; padding: 10px 6px; outline: none; color-scheme: dark;
}
.ln-input {
  width: 100%; background: rgba(236, 227, 207, 0.04); border: 1px solid var(--line);
  border-radius: 10px; color: var(--paper); font-family: var(--font-body);
  font-size: 15px; padding: 11px 14px; outline: none; color-scheme: dark;
}
.tool-result { margin-top: 16px; min-height: 20px; }
.tool-result .big-name {
  font-family: var(--font-display); font-size: 42px; color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(201, 162, 39, 0.3); letter-spacing: 0.1em;
}
.tool-result .path { font-size: 12px; color: var(--paper-faint); margin-top: 8px; letter-spacing: 0.1em; }
.tool-result .desc { font-size: 14px; line-height: 1.9; color: var(--paper-dim); margin-top: 10px; }
.tool-result .badge { display: inline-block; font-size: 12px; padding: 3px 12px; border-radius: 999px; margin-right: 8px; }
.tool-result .badge.ji { color: #8fbf6a; border: 1px solid rgba(122, 157, 84, 0.55); }
.tool-result .badge.xiong { color: var(--cinnabar-bright); border: 1px solid rgba(200, 65, 47, 0.55); }
.tool-result.calc { animation: viewIn 0.4s var(--ease-out); }

/* ---------- 问句模板 ---------- */
.q-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.q-preset {
  font-size: 12px; color: var(--paper-dim); cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px;
  transition: color 0.2s, border-color 0.2s; background: rgba(236, 227, 207, 0.02);
}
.q-preset:hover { color: var(--gold-bright); border-color: rgba(201, 162, 39, 0.5); }
@media (max-width: 560px) {
  .najia-row { grid-template-columns: 40px 104px 1fr 54px 30px; gap: 6px; padding: 8px 10px; }
  .najia-row .r-line i { width: 52px; }
}

.reading-block { margin-top: 26px; }
.reading-block h3, .aspect-cards h3, .daily-grid h3, .tarot-section h3, .bazi-result h3 {
  font-size: 14px; letter-spacing: 0.3em; color: var(--gold); font-weight: 400; margin-bottom: 12px;
}
.reading-block p { font-size: 16px; line-height: 2; color: var(--paper); text-align: justify; }

.aspect-cards { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .aspect-cards { grid-template-columns: 1fr; } }
.aspect-cards .card .h { display: flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: 0.2em; color: var(--gold-bright); margin-bottom: 10px; }
.aspect-cards .card p { font-size: 14px; line-height: 1.9; color: var(--paper-dim); }

.result-actions { display: flex; justify-content: center; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--paper-dim);
  border-radius: 999px; padding: 12px 26px; font-family: var(--font-body);
  font-size: 14px; letter-spacing: 0.2em; cursor: pointer; transition: all 0.25s;
}
.btn-ghost:hover { color: var(--paper); border-color: var(--gold); }

/* ---------- 每日一卦 ---------- */
.daily-head { text-align: center; margin: 34px 0 8px; }
.daily-head .date { font-size: clamp(22px, 5vw, 30px); letter-spacing: 0.15em; }
.daily-head .lunar { margin-top: 8px; color: var(--paper-dim); font-size: 14px; letter-spacing: 0.2em; }
.daily-grid { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 26px; }
.daily-grid > div { min-width: 0; }
@media (min-width: 720px) { .daily-grid { grid-template-columns: 260px 1fr; align-items: start; } }
.daily-hex { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 18px; }
.daily-hex .hex-figure .hex-fig { width: 150px; }
.daily-hex .nm { font-family: var(--font-display); font-size: 40px; letter-spacing: 0.1em; }
.daily-hex .fl { color: var(--paper-dim); font-size: 13px; letter-spacing: 0.3em; }
.daily-reading p { font-size: 15px; line-height: 2; text-align: justify; }
.almanac { margin-top: 22px; }
.almanac-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; flex-wrap: wrap; }
.almanac-row .k { font-family: var(--font-display); font-size: 20px; color: var(--gold-bright); flex: 0 0 auto; }
.almanac-row.ji .k { color: var(--cinnabar-bright); }
.almanac-row .v { font-size: 14px; color: var(--paper-dim); line-height: 1.9; }

/* ---------- 塔罗 ---------- */
.mode-pills { display: flex; gap: 10px; margin: 24px 0; }
.mode-pill {
  border: 1px solid var(--line); background: none; color: var(--paper-dim);
  border-radius: 999px; padding: 9px 22px; font-family: var(--font-body);
  font-size: 14px; letter-spacing: 0.15em; cursor: pointer; transition: all 0.25s;
}
.mode-pill.active { color: var(--paper); border-color: var(--cinnabar); background: rgba(200, 65, 47, 0.14); }
.tarot-table { display: flex; justify-content: center; padding: 26px 0 10px; }
.deck {
  width: 128px; height: 188px; cursor: pointer; position: relative;
  transition: transform 0.3s var(--ease-out);
}
.deck::before, .deck::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px;
  background:
    radial-gradient(circle at 50% 34%, rgba(229, 199, 107, 0.16), transparent 55%),
    linear-gradient(165deg, #1b1f2b, #10131b);
  border: 1px solid rgba(201, 162, 39, 0.4);
}
.deck::after { transform: translate(6px, 6px) rotate(3deg); opacity: 0.6; }
.deck .face-mark {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
  font-family: var(--font-display); color: var(--gold-bright); font-size: 42px;
  text-shadow: 0 0 18px rgba(201, 162, 39, 0.5);
}
.deck .face-sub { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; font-size: 10px; letter-spacing: 0.3em; color: var(--paper-faint); z-index: 1; }
.deck:hover { transform: translateY(-8px) rotate(-1.5deg); }
.deck-hint { text-align: center; color: var(--paper-faint); font-size: 13px; letter-spacing: 0.2em; margin-bottom: 10px; }

.tarot-cards { display: flex; justify-content: center; gap: clamp(12px, 3vw, 26px); margin-top: 26px; flex-wrap: wrap; }
.tcard-slot { width: 138px; }
.tcard {
  width: 138px; height: 208px; perspective: 800px; cursor: default;
}
.tcard .inner {
  width: 100%; height: 100%; position: relative; transform-style: preserve-3d;
  transition: transform 0.8s var(--ease-out);
}
.tcard.flipped .inner { transform: rotateY(180deg); }
.tcard .backf, .tcard .frontf {
  position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.tcard .backf {
  background:
    radial-gradient(circle at 50% 34%, rgba(229, 199, 107, 0.16), transparent 55%),
    linear-gradient(165deg, #1b1f2b, #10131b);
  border: 1px solid rgba(201, 162, 39, 0.4);
  display: grid; place-items: center;
  font-family: var(--font-display); color: var(--gold-bright); font-size: 40px;
}
.tcard .frontf {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #f4ecd9, #e2d6ba);
  color: #23201a; border: 1px solid #c9b98e;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 14px 8px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
.tcard[data-suit="wands"] .frontf { border: 1.5px solid #b0543c; }
.tcard[data-suit="cups"] .frontf { border: 1.5px solid #4c7ba0; }
.tcard[data-suit="swords"] .frontf { border: 1.5px solid #7d8593; }
.tcard[data-suit="pents"] .frontf { border: 1.5px solid #5f7a44; }
.tcard .frontf .num { font-size: 13px; letter-spacing: 0.2em; color: #8a6d1f; }
.tcard .frontf .nm { font-family: var(--font-display); font-size: 30px; letter-spacing: 0.08em; }
.tcard .frontf .en { font-size: 9px; letter-spacing: 0.12em; color: #7d7259; text-transform: uppercase; }
.tcard .frontf .orn { font-size: 18px; color: #b58a4e; }
.tcard.reversed .frontf .nm, .tcard.reversed .frontf .num, .tcard.reversed .frontf .orn { transform: rotate(180deg); }
.tcard-slot .pos-label { text-align: center; margin-top: 10px; font-size: 12px; letter-spacing: 0.25em; color: var(--gold); }
.tcard-slot .ori { text-align: center; margin-top: 5px; font-size: 11px; letter-spacing: 0.15em; }
.tcard-slot .ori.zheng { color: #7a9d54; } .tcard-slot .ori.ni { color: var(--cinnabar-bright); }
.tarot-read { margin-top: 26px; }
.tarot-read .kw { font-size: 14px; letter-spacing: 0.12em; color: var(--gold-bright); margin-bottom: 8px; }
.tarot-read p { font-size: 15px; line-height: 2; color: var(--paper); }

/* ---------- 命盘 ---------- */
.bazi-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12px; letter-spacing: 0.25em; color: var(--paper-faint); }
.field input, .field select {
  background: rgba(236, 227, 207, 0.04); border: 1px solid var(--line); border-radius: 10px;
  color: var(--paper); font-family: var(--font-body); font-size: 15px; padding: 11px 14px;
  outline: none; color-scheme: dark; min-width: 150px;
}
.field input:focus, .field select:focus { border-color: rgba(201, 162, 39, 0.55); }
.bazi-submit {
  background: linear-gradient(160deg, var(--cinnabar-bright), var(--cinnabar));
  border: none; color: #fbeee6; border-radius: 10px; padding: 13px 30px;
  font-family: var(--font-body); font-size: 15px; letter-spacing: 0.25em; cursor: pointer;
  box-shadow: 0 4px 16px rgba(200, 65, 47, 0.35); transition: transform 0.2s;
}
.bazi-submit:hover { transform: translateY(-1px); }

.bazi-result { margin-top: 34px; display: none; }
.bazi-result.show { display: block; animation: viewIn 0.5s var(--ease-out); }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 6px; }
@media (max-width: 620px) { .pillars { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } }
.pillar { text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 16px 6px 12px; background: rgba(236, 227, 207, 0.025); }
.pillar .pl { font-size: 11px; letter-spacing: 0.3em; color: var(--paper-faint); margin-bottom: 10px; }
.pillar .gz { font-family: var(--font-display); font-size: clamp(26px, 6vw, 34px); line-height: 1.35; }
.pillar .ss-tag { margin-top: 5px; font-size: 10px; line-height: 1.5; color: var(--paper-faint); letter-spacing: 0.08em; }
.pillar .wx { margin-top: 8px; display: flex; gap: 5px; justify-content: center; }
.wx-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bazi-info { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.bazi-info .chip b { color: var(--paper); font-weight: 400; margin-left: 6px; }

.wuxing-bars { margin-top: 30px; }
.wxbar { display: grid; grid-template-columns: 34px 1fr 26px; gap: 12px; align-items: center; margin-bottom: 11px; }
.wxbar .n { font-size: 15px; text-align: center; }
.wxbar .track { height: 10px; background: rgba(236, 227, 207, 0.06); border-radius: 5px; overflow: hidden; }
.wxbar .fill { height: 100%; border-radius: 5px; width: 0; transition: width 0.9s var(--ease-out); }
.wxbar .c { font-size: 13px; color: var(--paper-dim); text-align: right; }
.wuxing-note { margin-top: 14px; font-size: 13px; line-height: 1.9; color: var(--paper-dim); }


/* ---------- 卦例历史 ---------- */
.history { margin-top: 40px; }
.history h4 { font-size: 13px; letter-spacing: 0.4em; color: var(--paper-faint); font-weight: 400; margin-bottom: 14px; text-align: center; }
.history-item {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; margin-bottom: 9px; cursor: pointer;
  background: rgba(236, 227, 207, 0.02);
  transition: border-color 0.25s, transform 0.25s var(--ease-out);
  text-align: left;
}
.history-item:hover { border-color: rgba(201, 162, 39, 0.45); transform: translateX(3px); }
.history-item .h-date { font-size: 12px; color: var(--paper-faint); flex: 0 0 auto; letter-spacing: 0.05em; }
.history-item .h-hex { font-family: var(--font-display); font-size: 19px; color: var(--gold-bright); flex: 0 0 auto; }
.history-item .h-q { font-size: 13px; color: var(--paper-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-clear { margin-left: auto; font-size: 12px; color: var(--paper-faint); flex: 0 0 auto; }
.history-item .h-clear:hover { color: var(--cinnabar-bright); }
.history-item .h-share { margin-left: auto; font-size: 12px; color: var(--paper-faint); flex: 0 0 auto; padding: 4px 6px; }
.history-item .h-share:hover { color: var(--gold-bright); }
.history-item .h-share ~ .h-clear { margin-left: 0; }

/* ---------- 分享图弹层 ---------- */
#shareModal {
  position: fixed; inset: 0; z-index: 250; display: none;
  place-items: center; background: rgba(5, 6, 9, 0.88); backdrop-filter: blur(6px);
  padding: 20px;
}
#shareModal.on { display: grid; animation: viewIn 0.3s var(--ease-out); }
.share-panel { text-align: center; max-width: 92vw; }
#shareCanvas {
  width: min(62vw, 380px); height: auto; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 162, 39, 0.25);
}
.share-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: rgba(17, 20, 28, 0.95); border: 1px solid var(--line); color: var(--paper);
  padding: 12px 26px; border-radius: 999px; font-size: 14px; letter-spacing: 0.1em;
  opacity: 0; pointer-events: none; transition: all 0.35s var(--ease-out); z-index: 300;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 页脚 ---------- */
footer {
  border-top: 1px solid var(--line); margin-top: 30px;
  padding: 30px clamp(16px, 4vw, 40px) 40px; text-align: center;
}
footer .f1 { font-size: 13px; color: var(--paper-dim); letter-spacing: 0.15em; line-height: 2; }
footer .f2 { margin-top: 12px; font-size: 11px; color: var(--paper-faint); letter-spacing: 0.1em; line-height: 1.9; }

/* ---------- 动效尊重 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
  .rot-slow, .rot-rev { animation: none; }
}

.q-preset.active { color: var(--gold-bright); border-color: rgba(201,162,39,0.6); background: rgba(201,162,39,0.08); }

.asp-matrix { border-collapse: collapse; margin-top: 12px; }
.asp-matrix th, .asp-matrix td { border: 1px solid rgba(201,162,39,0.15); width: 26px; height: 24px; text-align: center; font-size: 12px; }
.asp-matrix th { color: var(--gold-bright); font-weight: 400; }
.asp-matrix td.soft { color: #8fbf6a; }
.asp-matrix td.hard { color: #d05a4e; }

.qm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.qm-cell { border: 1px solid rgba(201,162,39,0.3); border-radius: 8px; min-height: 96px; padding: 7px 8px; position: relative; background: rgba(236,227,207,0.025); display: flex; flex-direction: column; justify-content: space-between; }
.qm-cell.center { background: rgba(201,162,39,0.06); }
.qm-shen { font-size: 10px; color: var(--cinnabar-bright); }
.qm-star { font-size: 11px; color: var(--gold-bright); }
.qm-men { font-size: 15px; font-family: var(--font-display); color: var(--paper); }
.qm-gz { font-size: 12px; color: var(--paper-dim); }
.qm-gz b { color: var(--paper); font-weight: 500; margin-right: 6px; }
.qm-name { position: absolute; bottom: 6px; right: 8px; font-size: 10px; color: var(--paper-faint); }

.qm-men.ji { color: #8fbf6a; }
.qm-men.xiong { color: #d05a4e; }
.qm-shen.ji { color: #7fae5e; }
.qm-shen.xiong { color: #c9705e; }

.quick-nav { margin-top: 14px; }
.quick-nav .chip { cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.quick-nav .chip:hover { color: var(--gold-bright); border-color: rgba(201,162,39,0.5); }

/* ---------- 信任承诺条 ---------- */
.trust-strip { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.trust-badge {
  border: 1px solid rgba(201,162,39,0.35); border-radius: 999px; padding: 8px 18px;
  font-size: 12px; letter-spacing: 0.08em; color: var(--paper-dim);
  background: rgba(201,162,39,0.05); display: inline-flex; gap: 8px; align-items: center;
}
.trust-badge b { color: var(--gold-bright); font-weight: 400; letter-spacing: 0.15em; }
.trust-badge b::after { content: " ·"; color: rgba(201,162,39,0.5); }

/* ---------- 塔罗问心仪式 ---------- */
#tarotRitual {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(7, 9, 13, 0.96); backdrop-filter: blur(6px);
}
#tarotRitual.on { display: grid; place-items: center; animation: viewIn 0.4s var(--ease-out); }
.ritual-stage { width: min(680px, 92vw); text-align: center; padding: 20px 8px 40px; }
.ritual-step h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 6vw, 34px); letter-spacing: 0.3em; color: var(--gold-bright); margin-bottom: 10px; }
.ritual-tip { font-size: 13px; color: var(--paper-dim); letter-spacing: 0.12em; margin-bottom: 24px; }
#ritualQuestion {
  width: min(420px, 90%); background: rgba(236,227,207,0.05); border: 1px solid var(--line);
  border-radius: 12px; color: var(--paper); font-family: var(--font-body); font-size: 15px;
  padding: 13px 16px; outline: none; text-align: center; letter-spacing: 0.05em;
}
#ritualQuestion:focus { border-color: rgba(201,162,39,0.55); }
.ritual-btns { display: flex; gap: 14px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.shuffle-zone { height: 260px; display: grid; place-items: center; touch-action: none; }
.shuffle-deck { position: relative; width: 130px; height: 192px; cursor: grab; }
.shuffle-deck:active { cursor: grabbing; }
.shuffle-card {
  position: absolute; inset: 0; border-radius: 12px;
  background: radial-gradient(circle at 50% 34%, rgba(229,199,107,0.16), transparent 55%), linear-gradient(165deg, #1b1f2b, #10131b);
  border: 1px solid rgba(201,162,39,0.4);
  display: grid; place-items: center; font-family: var(--font-display);
  color: var(--gold-bright); font-size: 34px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5);
  transition: transform 0.12s ease-out;
}
.shuffle-deck.moving .shuffle-card { transition: none; }
.shuffle-bar { width: min(300px, 70%); height: 6px; border-radius: 3px; margin: 6px auto 0; background: rgba(236,227,207,0.08); overflow: hidden; }
.shuffle-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--cinnabar), var(--gold)); transition: width 0.15s linear; }
.fan-deck { display: flex; justify-content: center; align-items: flex-end; min-height: 240px; padding: 10px 0 26px; flex-wrap: wrap; gap: 2px; }
.fan-card {
  width: clamp(52px, 11vw, 74px); height: clamp(88px, 17vw, 124px); border-radius: 9px;
  background: radial-gradient(circle at 50% 34%, rgba(229,199,107,0.15), transparent 55%), linear-gradient(165deg, #1b1f2b, #10131b);
  border: 1px solid rgba(201,162,39,0.38);
  display: grid; place-items: center; color: var(--gold-bright); font-family: var(--font-display); font-size: 20px;
  cursor: pointer; transition: transform 0.22s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
}
.fan-card:hover { transform: translateY(-14px) rotate(0deg) !important; border-color: rgba(201,162,39,0.75); }
.fan-card.picked { transform: translateY(-22px) scale(1.06) !important; border-color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(201,162,39,0.35), 0 14px 30px rgba(0,0,0,0.55); }
.fan-card.dimmed { opacity: 0.28; }

/* ---------- 塔罗解读 · 被看见结构 ---------- */
.tarot-read .tk-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tarot-read .tk-chips .chip { font-size: 12px; }
.tarot-read .advice-line { margin-top: 12px; padding: 10px 14px; border-left: 2px solid var(--gold); background: rgba(201,162,39,0.06); font-size: 14px; color: var(--paper); }
.tarot-read .empathy-line { text-align: center; margin-top: 22px; font-size: 13px; letter-spacing: 0.2em; color: var(--paper-faint); }

/* ---------- 牌义图鉴 ---------- */
.cardlib-search { margin: 6px 0 20px; }
.cardlib-search input {
  width: 100%; background: rgba(236,227,207,0.04); border: 1px solid var(--line); border-radius: 10px;
  color: var(--paper); font-family: var(--font-body); font-size: 15px; padding: 12px 14px; outline: none;
}
.cardlib-group { margin-bottom: 26px; }
.cardlib-group h4 { font-size: 13px; letter-spacing: 0.3em; color: var(--gold); font-weight: 400; margin-bottom: 12px; }
.cardlib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.cardlib-item {
  display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 8px 10px; text-align: center; background: rgba(236,227,207,0.025);
  transition: transform 0.22s var(--ease-out), border-color 0.2s;
}
.cardlib-item:hover { transform: translateY(-4px); border-color: rgba(201,162,39,0.55); }
.cardlib-item .cl-num { font-size: 11px; letter-spacing: 0.15em; color: var(--paper-faint); }
.cardlib-item .cl-nm { font-family: var(--font-display); font-size: 20px; color: var(--paper); margin: 5px 0 3px; }
.cardlib-item .cl-kw { font-size: 10.5px; color: var(--paper-faint); line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 大众占卜三选一 ---------- */
.mass-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.mass-head h3 { margin-bottom: 0; }
.mass-head .faint { font-size: 12px; }
.mass-stacks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0 6px; }
.mass-stack {
  border: 1px solid rgba(201,162,39,0.35); border-radius: 14px; padding: 18px 10px 14px; text-align: center;
  cursor: pointer; background: rgba(236,227,207,0.025);
  transition: transform 0.25s var(--ease-out), border-color 0.2s, background 0.2s; position: relative;
}
.mass-stack:hover { transform: translateY(-5px); border-color: rgba(201,162,39,0.7); }
.mass-stack .ms-letter { font-family: var(--font-display); font-size: 30px; color: var(--gold-bright); }
.mass-stack .ms-cards { display: flex; justify-content: center; gap: 3px; margin: 10px 0 8px; }
.mass-stack .ms-cards i {
  width: 26px; height: 40px; border-radius: 4px; display: block;
  background: radial-gradient(circle at 50% 34%, rgba(229,199,107,0.18), transparent 60%), linear-gradient(165deg, #1b1f2b, #10131b);
  border: 1px solid rgba(201,162,39,0.45);
}
.mass-stack .ms-hint { font-size: 11px; color: var(--paper-faint); letter-spacing: 0.2em; }
.mass-stack.chosen { border-color: var(--gold-bright); background: rgba(201,162,39,0.08); }
.mass-reveal { margin-top: 16px; animation: viewIn 0.5s var(--ease-out); }
.mass-reveal .mr-card { text-align: center; margin-bottom: 14px; }
.mass-reveal .mr-card .nm { font-family: var(--font-display); font-size: 34px; color: var(--gold-bright); }
.mass-reveal .mr-card .ori { font-size: 13px; letter-spacing: 0.2em; margin-top: 6px; }
.mass-reveal .mr-card .ori.zheng { color: #7a9d54; }
.mass-reveal .mr-card .ori.ni { color: var(--cinnabar-bright); }
.mass-reveal .mr-kw { text-align: center; font-size: 13px; color: var(--paper-dim); letter-spacing: 0.1em; margin-bottom: 10px; }
.mass-reveal .mr-text { font-size: 15px; line-height: 2.1; color: var(--paper); }
.mass-reveal .advice-line { margin-top: 12px; padding: 10px 14px; border-left: 2px solid var(--gold); background: rgba(201,162,39,0.06); font-size: 14px; }
.mass-reveal .empathy-line { text-align: center; margin-top: 18px; font-size: 12px; letter-spacing: 0.2em; color: var(--paper-faint); }

/* ---------- 实时天象 ---------- */
.sky-now-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.sky-cell { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: rgba(236,227,207,0.025); display: flex; align-items: center; gap: 10px; }
.sky-cell .sc-glyph { font-size: 20px; color: var(--gold-bright); width: 26px; text-align: center; }
.sky-cell .sc-body { flex: 1; }
.sky-cell .sc-name { font-size: 13px; color: var(--paper); }
.sky-cell .sc-sign { font-size: 12px; color: var(--paper-dim); }
.sky-cell.rx .sc-name::after { content: " ℞"; color: var(--cinnabar-bright); }
.sky-moon { display: flex; gap: 18px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.sky-moon .moon-glyph { font-size: 34px; color: var(--gold-bright); }
.sky-moon .moon-info b { font-weight: 400; color: var(--paper); font-size: 15px; letter-spacing: 0.1em; }
.sky-moon .moon-info p { font-size: 12.5px; color: var(--paper-dim); margin-top: 4px; }
.transit-hit { display: flex; align-items: baseline; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed rgba(236,227,207,0.1); flex-wrap: wrap; }
.transit-hit:last-child { border-bottom: none; }
.transit-hit .th-asp { font-size: 14px; }
.transit-hit .th-asp.hard { color: #d05a4e; }
.transit-hit .th-asp.soft { color: #9ec27a; }
.transit-hit .th-note { font-size: 13px; color: var(--paper-dim); flex: 1; min-width: 200px; line-height: 1.8; }
.transit-hit .th-orb { font-size: 11px; color: var(--paper-faint); letter-spacing: 0.05em; }
.biwheel-wrap { display: grid; place-items: center; margin: 10px 0 6px; }

/* ---------- 西式合盘 ---------- */
.syn-pts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-top: 14px; }
.syn-pt { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.syn-pt .sp-who { width: 52px; color: var(--paper-faint); font-size: 12px; letter-spacing: 0.1em; }
.syn-pt b { font-weight: 400; color: var(--paper); }
.syn-verdict { margin-top: 18px; padding: 14px 16px; border-left: 2px solid var(--gold); background: rgba(201,162,39,0.06); font-size: 14px; line-height: 2; }

@media (max-width: 560px) {
  header { padding: 12px 12px; }
  .brand { font-size: 17px; white-space: nowrap; }
  nav { gap: 9px; flex-wrap: nowrap; }
  nav a { font-size: 12.5px; letter-spacing: 0.02em; white-space: nowrap; padding: 6px 1px; }
  #soundToggle { flex: none; }
  .mass-stacks { gap: 8px; }
  .syn-pts { grid-template-columns: 1fr; }
}

/* ---------- 占星骰子 ---------- */
.dice-stage { display: flex; justify-content: center; gap: clamp(14px, 4vw, 26px); margin: 22px 0 16px; }
.die {
  width: clamp(84px, 22vw, 108px); height: clamp(84px, 22vw, 108px); border-radius: 16px;
  border: 1px solid rgba(201,162,39,0.45); background: radial-gradient(circle at 50% 30%, rgba(229,199,107,0.12), transparent 60%), linear-gradient(165deg, #1b1f2b, #10131b);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45); transition: transform 0.25s var(--ease-out), border-color 0.25s;
  user-select: none;
}
.die .die-glyph { font-size: clamp(30px, 8vw, 40px); color: var(--gold-bright); line-height: 1; }
.die .die-label { font-size: 11px; letter-spacing: 0.2em; color: var(--paper-faint); }
.die.landed { border-color: var(--gold-bright); transform: translateY(-6px); box-shadow: 0 0 0 2px rgba(201,162,39,0.25), 0 12px 28px rgba(0,0,0,0.55); }
.die.rolling { animation: diceShake 0.32s linear infinite; border-color: rgba(201,162,39,0.6); }
@keyframes diceShake {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-3px, -5px) rotate(-6deg); }
  50% { transform: translate(3px, 2px) rotate(5deg); }
  75% { transform: translate(-2px, 4px) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.dice-read .dr-head { text-align: center; font-family: var(--font-display); font-size: 26px; color: var(--gold-bright); margin-bottom: 4px; }
.dice-read .dr-sub { text-align: center; font-size: 12.5px; color: var(--paper-dim); letter-spacing: 0.12em; margin-bottom: 12px; }
