/* 籤詩天堂 ── 東方古典 × 天文台 × 無限圖書館 */
:root {
  --ink: #14110f;
  --ink-2: #221d19;
  --paper: #f4ecdc;
  --paper-2: #e8dcc4;
  --gold: #c9a961;
  --gold-2: #e6cf8f;
  --mute: #a99f8f;
  --line: rgba(201, 169, 97, .35);
  --accent: var(--gold);
  --accent-soft: rgba(201, 169, 97, .16);
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Helvetica Neue", sans-serif;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
/* 每個世界固定色與材質，共用骨架 */
[data-world="guandi"]  { --accent: #c8412f; --accent-soft: rgba(200,65,47,.18);  --accent-2: #e0b45c; }
[data-world="guanyin"] { --accent: #9fd0c4; --accent-soft: rgba(159,208,196,.16); --accent-2: #f0f4f1; }
[data-world="jiazi"]   { --accent: #d9a648; --accent-soft: rgba(217,166,72,.18);  --accent-2: #f3e3b3; }
[data-world="yijing"]  { --accent: #cfcfcf; --accent-soft: rgba(207,207,207,.14); --accent-2: #8a8a8a; }
[data-world="tarot"]   { --accent: #b48be6; --accent-soft: rgba(180,139,230,.18); --accent-2: #f0c96a; }
[data-world="yuelao"]  { --accent: #e0607a; --accent-soft: rgba(224,96,122,.18);  --accent-2: #f3c0cc; }
[data-world="guren"]   { --accent: #c9a961; --accent-soft: rgba(201,169,97,.18);  --accent-2: #7f9c6d; }
[data-world="wish"]    { --accent: #e0a85a; --accent-soft: rgba(224,168,90,.2); --accent-2: #f3d98a; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--ink); color: var(--paper);
  font-family: var(--sans); line-height: 1.7; letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1.3; }
p { margin: 0 0 .8em; }
.serif { font-family: var(--serif); }
.mute { color: var(--mute); }
.small { font-size: .85rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ───────── 版面 ───────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.hero {
  position: relative; min-height: 62vh; display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center top; padding: 0 0 24px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,17,15,.35) 0%, rgba(20,17,15,.05) 35%, rgba(20,17,15,.75) 80%, var(--ink) 100%);
}
.hero > * { position: relative; }
.hero.tall { min-height: 78vh; }
.topbar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 16px 0; z-index: 2;
}
.iconbtn {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(20,17,15,.55); border: 1px solid var(--line);
  color: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: .85rem; backdrop-filter: blur(8px);
}
.iconbtn:hover { border-color: var(--accent); }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-bottom: 80px; flex: 1; }

.kicker { font-family: var(--serif); color: var(--accent); letter-spacing: .3em; font-size: .8rem; text-transform: uppercase; }
.title-xl { font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 900; letter-spacing: .12em; text-shadow: 0 2px 20px rgba(0,0,0,.6); }
.title-l { font-size: clamp(1.5rem, 5vw, 2.2rem); letter-spacing: .08em; }
.tagline { font-family: var(--serif); font-size: clamp(1.05rem, 3.4vw, 1.35rem); color: var(--gold-2); letter-spacing: .12em; }
.subline { color: var(--mute); font-size: .95rem; }

/* ───────── 入口大殿：八扇門（道具圖＋名稱，人物圖留到進入之後） ───────── */
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }
@media (max-width: 640px) { .doors { grid-template-columns: repeat(2, 1fr); } }
.door {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 0; padding: 14px 10px 16px; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(90% 70% at 50% 34%, var(--accent-glow) 0%, var(--accent-soft) 32%, rgba(20,17,15,0) 72%), var(--ink-2);
  color: var(--paper);
  box-shadow: var(--shadow), inset 0 0 60px rgba(0,0,0,.35);
  transition: transform .25s ease, border-color .25s ease, box-shadow .4s ease;
}
.door:hover { transform: translateY(-4px); border-color: var(--accent); }
.door-prop { flex: none; width: 100%; aspect-ratio: 8 / 9; display: flex; align-items: center; justify-content: center; }
.door-prop img { width: 100%; height: 100%; max-height: none; object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)) drop-shadow(0 0 14px var(--accent-glow)) drop-shadow(0 0 34px var(--accent-soft));
  animation: prop-breathe 5.5s ease-in-out infinite; transition: transform .3s ease, filter .4s ease; }
.door:nth-child(2n) .door-prop img { animation-delay: -2.7s; }
.door:nth-child(3n) .door-prop img { animation-delay: -1.3s; }
/* 使用者模式：四扇占卜門＋願境橫幅（許願角落） */
.door.wide { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 16px; padding: 12px 20px; min-height: 0;
  background: radial-gradient(60% 120% at 12% 50%, var(--accent-glow) 0%, var(--accent-soft) 40%, rgba(20,17,15,0) 75%), var(--ink-2); }
.door.wide .door-prop { width: 96px; aspect-ratio: 1; }
.door.wide .name { text-align: left; display: grid; gap: 2px; }
.door.wide .name::after { content: "許一個願，也記得回來。"; font-size: .85rem; color: var(--mute); letter-spacing: .06em; }
.doors-more { margin: 14px 0 0; opacity: .55; letter-spacing: .04em; }
.door:hover .door-prop img { transform: translateY(-3px) scale(1.03); filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)) drop-shadow(0 0 18px var(--accent-glow)) drop-shadow(0 0 44px var(--accent-glow)); }
.door .name { text-align: center; }
.door .name h3 { font-size: 1.15rem; letter-spacing: .14em; color: var(--paper); text-shadow: 0 0 18px var(--accent-soft); }
.door .enter { display: none; margin-top: 8px; font-size: .78rem; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; color: var(--gold-2); }
.door.pending { opacity: .7; }
.door.pending .enter { display: inline-block; margin-top: 6px; font-size: .74rem; color: var(--gold-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.door.pending .door-prop img { filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)) saturate(.5); animation: none; }
/* 八世界各自的門卡光暈 */
.door[href="#/w/guandi"]  { --accent-soft: rgba(200,65,47,.22); --accent-glow: rgba(230,90,60,.55); }
.door[href="#/w/guanyin"] { --accent-soft: rgba(159,208,196,.18); --accent-glow: rgba(190,235,220,.5); }
.door[href="#/w/jiazi"]   { --accent-soft: rgba(217,166,72,.22); --accent-glow: rgba(240,190,90,.55); }
.door[href="#/w/yijing"]  { --accent-soft: rgba(207,207,207,.16); --accent-glow: rgba(235,235,235,.45); }
.door[href="#/w/tarot"]   { --accent-soft: rgba(180,139,230,.22); --accent-glow: rgba(200,160,255,.55); }
.door[href="#/w/yuelao"]  { --accent-soft: rgba(224,96,122,.22); --accent-glow: rgba(255,120,150,.55); }
.door[href="#/w/guren"]   { --accent-soft: rgba(201,169,97,.22); --accent-glow: rgba(230,200,120,.5); }
.door[href="#/w/wish"]    { --accent-soft: rgba(224,168,90,.22); --accent-glow: rgba(255,200,120,.55); }

.motto { margin: 26px auto 0; text-align: center; font-family: var(--serif); color: var(--gold-2); letter-spacing: .25em; font-size: 1.05rem; }
.motto small { display: block; color: var(--mute); letter-spacing: .1em; font-size: .78rem; margin-top: 6px; font-family: var(--sans); }

/* ───────── 世界頁 ───────── */
.world-hero { min-height: 86vh; background-position: center top; }  /* 入口圖已在上方接墨，貼頂對齊，人像頭頂不被頂欄壓到 */
.world-hero::before { background: linear-gradient(180deg, rgba(20,17,15,.25) 0%, rgba(20,17,15,0) 30%, rgba(20,17,15,.85) 70%, var(--ink) 100%); }
.world-hero .tagline { margin-top: 6px; }
.gatekeeper {
  display: inline-flex; gap: 10px; align-items: baseline; margin-top: 14px; padding: 10px 14px; border-left: 3px solid var(--accent);
  background: rgba(20,17,15,.55); backdrop-filter: blur(6px); border-radius: 0 10px 10px 0; font-family: var(--serif);
}
.gatekeeper b { color: var(--accent); font-weight: 600; letter-spacing: .1em; white-space: nowrap; }
.actions { display: grid; gap: 10px; margin-top: 18px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px 20px; border-radius: 12px;
  border: 1px solid var(--accent); background: linear-gradient(180deg, var(--accent-soft), rgba(20,17,15,.6));
  font-family: var(--serif); font-size: 1.25rem; letter-spacing: .2em; color: var(--paper);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, var(--shadow); transition: transform .15s, background .2s;
}
.btn:hover { transform: translateY(-2px); background: linear-gradient(180deg, var(--accent-soft), var(--accent-soft)); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.secondary { font-size: .95rem; letter-spacing: .12em; border-color: var(--line); background: rgba(20,17,15,.5); padding: 12px 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }

.notice {
  margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--mute); font-size: .9rem; background: rgba(255,255,255,.02);
}
.notice b { color: var(--gold-2); }

.pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .75rem; color: var(--mute); letter-spacing: .08em; }
.pill.warn { border-color: rgba(224,150,60,.6); color: #e8b46a; }
.pill.ok { border-color: rgba(120,190,120,.6); color: #9fd39f; }
.pill.accent { border-color: var(--accent); color: var(--accent); }

/* 求籤與結果頁：環境圖當場景，道具去背後渲染在前景 */
.hero.prop.scene { background-size: cover; background-position: center 30%; }
.hero.prop.scene::before { background: linear-gradient(180deg, rgba(20,17,15,.35) 0%, rgba(20,17,15,.25) 35%, rgba(20,17,15,.82) 75%, var(--ink) 100%); }
.hero.prop.scene.small { min-height: 34vh; background-position: center 40%; }
.prop-stage.shaking .prop-img { animation: prop-shake .5s ease-in-out infinite; }
@keyframes prop-shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-2.5deg) translateX(-3px); } 75% { transform: rotate(2.5deg) translateX(3px); } }
.stick-drop {
  position: absolute; left: 50%; top: 20%; width: 14px; height: 92px; margin-left: -7px; border-radius: 3px;
  background: linear-gradient(#f3e3b3, #c9a961); box-shadow: 0 6px 14px rgba(0,0,0,.5); color: #4a3410; font-family: var(--serif); font-size: .7rem; font-weight: 700;
  writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; letter-spacing: .1em;
  animation: stick-fall 1s cubic-bezier(.3,.7,.3,1) both;
}
.stick-drop.tarot { width: 44px; height: 68px; margin-left: -22px; border-radius: 4px; background: linear-gradient(160deg, #3a2a5a, #1a1430); border: 1px solid #f0c96a; box-shadow: 0 0 18px rgba(240,201,106,.35); }
.stick-drop.guren { width: 12px; background: linear-gradient(#e9dcc0, #b9a67a); }
@keyframes stick-fall { 0% { transform: translateY(-40px) rotate(-6deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: translateY(150px) rotate(78deg); opacity: 1; } }
/* 舊版畫出來的籤筒（已不用，留給沒有道具圖的世界） */
.hero.prop { min-height: 58vh; background: radial-gradient(120% 80% at 50% 35%, var(--accent-soft) 0%, rgba(20,17,15,0) 60%), var(--ink); }
.hero.prop::before { background: linear-gradient(180deg, rgba(20,17,15,.2) 0%, rgba(20,17,15,0) 40%, rgba(20,17,15,.7) 80%, var(--ink) 100%); }
.hero.prop.small { min-height: 36vh; }
.prop-stage { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 48px 0 20vh; pointer-events: none; }
.hero.prop.small .prop-stage { padding: 40px 0 14vh; }
.prop-img {
  width: min(44vw, 230px); max-height: 30vh; object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.55)) drop-shadow(0 0 28px var(--accent-soft));
  animation: prop-rise 1.1s cubic-bezier(.2,.7,.2,1) both;
}
.hero.prop.small .prop-img { width: min(40vw, 200px); max-height: 26vh; }
.hero.prop.scene.small .prop-stage { display: none; }
@keyframes prop-rise { from { opacity: 0; transform: translateY(18px) scale(.96); filter: drop-shadow(0 18px 30px rgba(0,0,0,0)) blur(6px); } to { opacity: 1; transform: none; } }
.prop-stage::after { display: none; content: ""; position: absolute; left: 50%; top: calc(64px + min(30vh, 230px) - 10px); width: min(40vw, 200px); height: 22px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent); opacity: .9; }
/* ───────── 求籤 ───────── */
.ask { margin-top: 20px; }
.ask label { display: block; font-family: var(--serif); letter-spacing: .15em; color: var(--gold-2); margin-bottom: 8px; }
.ask textarea, .ask input {
  width: 100%; background: rgba(244,236,220,.06); border: 1px solid var(--line); border-radius: 10px; color: var(--paper);
  padding: 12px 14px; font: inherit; font-size: 1rem; resize: vertical; min-height: 64px;
}
.ask textarea:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  border: 1px solid var(--line); background: rgba(20,17,15,.4); border-radius: 999px; padding: 6px 12px; font-size: .85rem; color: var(--paper);
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--gold-2); }

.ritual { text-align: center; padding: 30px 0 10px; }
.ritual .stage { position: relative; height: 240px; display: flex; align-items: flex-end; justify-content: center; }
.cylinder {
  width: 120px; height: 150px; border-radius: 12px 12px 18px 18px; position: relative;
  background: linear-gradient(90deg, #5a3a22, #8b5a34 40%, #5a3a22); border: 2px solid var(--gold); box-shadow: var(--shadow);
}
.cylinder::before { content: attr(data-label); position: absolute; left: 50%; top: 22px; transform: translateX(-50%); writing-mode: vertical-rl; font-family: var(--serif); color: var(--gold-2); letter-spacing: .2em; font-size: .9rem; }
.sticks { position: absolute; left: 50%; bottom: 140px; transform: translateX(-50%); display: flex; gap: 5px; }
.stick { width: 8px; height: 80px; background: linear-gradient(#f3e3b3, #c9a961); border-radius: 3px; box-shadow: 0 2px 4px rgba(0,0,0,.4); transform-origin: bottom center; }
.shaking .cylinder, .shaking .sticks { animation: shake .55s ease-in-out infinite; }
@keyframes shake { 0%,100% { transform: translateX(-50%) rotate(0); } 25% { transform: translateX(-52%) rotate(-3deg); } 75% { transform: translateX(-48%) rotate(3deg); } }
.shaking .cylinder { animation-name: shake2; }
@keyframes shake2 { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-3deg) translateX(-3px); } 75% { transform: rotate(3deg) translateX(3px); } }
.falling .stick.chosen { animation: fall .5s cubic-bezier(.3,.7,.3,1) forwards; }
@keyframes fall { 0% { transform: translateY(0) rotate(0); } 55% { transform: translateY(-120px) rotate(20deg); } 100% { transform: translateY(70px) rotate(88deg); opacity: 1; } }
.ritual .status { margin-top: 14px; font-family: var(--serif); letter-spacing: .2em; color: var(--gold-2); min-height: 1.6em; }

/* 三枚銅錢 */
.coins { display: flex; gap: 18px; justify-content: center; height: 100px; align-items: center; }
.coin {
  width: 62px; height: 62px; border-radius: 50%; border: 3px solid #a67c2e; position: relative;
  background: radial-gradient(circle at 35% 35%, #f3d78a, #b98a2e 70%, #7a5a1e); box-shadow: 0 6px 16px rgba(0,0,0,.5);
  display: grid; place-items: center; font-family: var(--serif); color: #4a3410; font-weight: 700; font-size: 1.1rem;
}
.coin::after { content: ""; position: absolute; width: 16px; height: 16px; background: var(--ink); border-radius: 2px; }
.coin.back::after { display: none; }
.coin.back { color: #3a2a0c; }
.tossing .coin { animation: toss .7s ease-in-out; }
@keyframes toss { 0% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-70px) rotateX(540deg); } 100% { transform: translateY(0) rotateX(1080deg); } }
.hexbuild { display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; margin: 14px auto 0; min-height: 140px; }
.hline { width: 160px; height: 14px; display: flex; gap: 0; justify-content: center; position: relative; }
.hline i { display: block; height: 100%; background: var(--paper); border-radius: 2px; flex: 1; }
.hline.yin i:nth-child(2) { }
.hline.yang i { }
.hline.yin i.gap { background: transparent; flex: 0 0 12px; }
.hline.moving::after { content: attr(data-mark); position: absolute; right: -28px; top: -6px; color: var(--accent-2, var(--gold)); font-weight: 700; }
.hline.pending { opacity: .18; }

/* ───────── 結果頁 ───────── */
.result-head { padding-top: 24px; }
.result-head .kicker { display: block; margin-bottom: 6px; }
.rank { display: inline-block; margin-left: 10px; font-size: 1rem; color: var(--accent); font-weight: 600; letter-spacing: .15em; }
.paper {
  margin-top: 18px; padding: 28px 22px; border-radius: 6px; position: relative;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%); color: #2a2018;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(120,90,40,.25), inset 0 0 0 6px var(--paper), inset 0 0 0 7px rgba(120,90,40,.35);
}
.paper .poem { font-family: var(--serif); font-size: clamp(1.35rem, 5vw, 1.9rem); line-height: 1.9; letter-spacing: .12em; text-align: center; margin: 6px 0; }
.paper .poem p { margin: 0; }
.paper .seal { position: absolute; right: 18px; bottom: 14px; width: 40px; height: 40px; border: 2px solid #b8452f; color: #b8452f; border-radius: 4px; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; transform: rotate(-6deg); font-size: .85rem; line-height: 1; }
.paper .meta { text-align: center; color: #6b5a44; font-size: .85rem; letter-spacing: .12em; margin-bottom: 8px; }
.paper .meta b { color: #2a2018; }

.layer { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.layer-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.layer-h .num { font-family: var(--serif); font-size: 1.6rem; color: var(--accent); font-weight: 900; line-height: 1; }
.layer-h h3 { font-size: 1.05rem; letter-spacing: .15em; }
.layer-h .nature { margin-left: auto; }
.layer .body { color: var(--paper); }
.layer .body q, .layer .body blockquote { font-family: var(--serif); color: var(--gold-2); }
.layer blockquote { margin: 8px 0; padding: 10px 14px; border-left: 2px solid var(--accent); background: rgba(255,255,255,.03); border-radius: 0 8px 8px 0; }
.why { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.why b { display: block; font-family: var(--serif); letter-spacing: .1em; color: var(--gold-2); margin-bottom: 4px; }
.why p { margin: 0; }
.layer .placeholder { color: var(--mute); font-style: italic; border: 1px dashed var(--line); padding: 10px 14px; border-radius: 8px; }
.kv { display: grid; grid-template-columns: 4.5em 1fr; gap: 6px 12px; }
.kv-grid { grid-template-columns: 3.2em 1fr 3.2em 1fr; font-size: .92rem; }
@media (max-width: 520px) { .kv-grid { grid-template-columns: 3.2em 1fr; } }
blockquote.serif { letter-spacing: .06em; line-height: 1.9; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }
.verdict {
  margin-top: 24px; padding: 22px; border-radius: var(--radius); border: 1px solid var(--accent);
  background: radial-gradient(120% 100% at 50% 0%, var(--accent-soft), rgba(20,17,15,.3)); text-align: center;
}
.verdict .word { font-family: var(--serif); font-size: 3.6rem; font-weight: 900; color: var(--accent); line-height: 1; letter-spacing: .1em; }
.verdict .core { font-family: var(--serif); font-size: 1.15rem; margin-top: 8px; letter-spacing: .12em; }
.verdict .yj { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; text-align: left; }
.verdict .yj div { background: rgba(20,17,15,.45); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.verdict .yj b { display: block; color: var(--gold-2); font-family: var(--serif); letter-spacing: .2em; margin-bottom: 4px; }
.verdict .yj ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.verdict .yj li { position: relative; padding-left: 14px; line-height: 1.55; }
.verdict .yj li::before { content: ""; position: absolute; left: 1px; top: .68em; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-2); opacity: .75; }
@media (max-width: 360px) { .verdict .yj { grid-template-columns: 1fr; } }
/* 逐句解籤：原句一行、解釋一段，條與條之間用細虛線隔開 */
.lxi { padding: 10px 0 12px; border-bottom: 1px dashed var(--line); }
.lxi:first-child { padding-top: 2px; } .lxi:last-child { border-bottom: 0; padding-bottom: 0; }
.lxi .ln { display: block; font-family: var(--serif); color: var(--gold-2); letter-spacing: .1em; font-size: 1.05rem; margin-bottom: 4px; }
.lxi p { margin: 0; line-height: 1.8; }
.result-actions { margin-top: 26px; }

/* 易經 */
.hexgram { display: flex; flex-direction: column-reverse; gap: 7px; align-items: center; margin: 10px auto; }
.hexgram .hline { width: 140px; height: 12px; }
.hexgram .hline i { background: #2a2018; }
.hexgram .hline.moving i { background: #b8452f; }
.hexgram .hline.moving i.gap, .hline.moving i.gap { background: transparent; }
.tri { display: flex; justify-content: center; gap: 30px; margin-top: 10px; font-size: .9rem; color: #6b5a44; }
.tri b { color: #2a2018; font-family: var(--serif); font-size: 1.1rem; }
.primary { margin-bottom: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent-soft); }
.primary > b { display: block; font-family: var(--serif); letter-spacing: .2em; color: var(--gold-2); margin-bottom: 4px; }
.primary blockquote { margin: 6px 0; background: rgba(20,17,15,.45); }
.lines-list { display: grid; gap: 10px; }
.line-item { padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid transparent; }
.line-item.moving { border-color: var(--accent); background: var(--accent-soft); }
.line-item .ln { font-family: var(--serif); color: var(--gold-2); letter-spacing: .12em; }
.line-item .lx { color: var(--mute); font-size: .88rem; margin-top: 4px; }
.change { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.change .arrow { font-size: 1.6rem; color: var(--accent); }
.change .sym { font-size: 2.6rem; font-family: var(--serif); }
.depth { display: flex; gap: 8px; margin: 14px 0 0; }
.depth button { flex: 1; border: 1px solid var(--line); background: rgba(20,17,15,.5); border-radius: 999px; padding: 8px; font-size: .85rem; letter-spacing: .1em; }
.depth button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--gold-2); }

/* ───────── 列表 ───────── */
.list { display: grid; gap: 10px; margin-top: 16px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.item:hover { border-color: var(--accent); }
.item .n { font-family: var(--serif); color: var(--accent); min-width: 3.2em; font-weight: 700; }
.item .t { flex: 1; }
.item .t small { display: block; color: var(--mute); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: .85rem; }
.tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--gold-2); background: var(--accent-soft); }

/* 頁尾 */
footer.site { margin-top: auto; padding: 24px 18px 40px; text-align: center; color: var(--mute); font-size: .8rem; letter-spacing: .1em; border-top: 1px solid rgba(255,255,255,.06); }
footer.site nav { display: flex; gap: 18px; justify-content: center; margin-bottom: 10px; }
footer.site nav a:hover { color: var(--gold-2); }
.safety { margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--line); color: var(--mute); font-size: .82rem; }
.safety b { color: var(--paper); }

.fade { animation: fade .5s ease; }
@keyframes fade { from { opacity: .2; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───────── 儀式層：星塵、變暗、短語 ───────── */
.ritual-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
body::after { content: ""; position: fixed; inset: 0; background: #0a0806; opacity: 0; pointer-events: none; transition: opacity .35s ease; z-index: 30; }
body.ritual-dim::after { opacity: .42; }
.ritual-ack {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) translateY(6px); z-index: 50; pointer-events: none;
  font-family: var(--serif); font-size: clamp(1.3rem, 4.5vw, 1.8rem); letter-spacing: .35em; color: var(--gold-2);
  text-shadow: 0 0 18px rgba(230,207,143,.45); opacity: 0; transition: opacity .35s ease, transform .35s ease;
}
.ritual-ack.in { opacity: 1; transform: translate(-50%, -50%); }
.ritual-ack.out { opacity: 0; transform: translate(-50%, -50%) translateY(-6px); }
.ask textarea { min-height: 44px; }

/* ───────── 籤詩出現時的停頓：籤紙先浮現，詩句逐句出來，解讀最後淡入 ───────── */
.result-body .paper { animation: paper-in .8s ease both; }
@keyframes paper-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.result-body .paper .poem p, .result-body .paper .meta, .result-body .paper .seal { opacity: 0; animation: line-in .9s ease forwards; }
.result-body .paper .meta { animation-delay: .5s; }
.result-body .paper .poem p { animation-delay: calc(.9s + var(--i, 0) * .65s); }
.result-body .paper .seal { animation-delay: 3.2s; }
.result-body .paper .hexgram, .result-body .paper .tri { opacity: 0; animation: line-in .9s ease forwards; animation-delay: .6s; }
@keyframes line-in { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
.result-body > .layer, .result-body > .verdict, .result-body > section { opacity: 0; animation: fade-late .8s ease forwards; animation-delay: 3.4s; }
@keyframes fade-late { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-actions { opacity: 0; animation: fade-late .8s ease forwards; animation-delay: 3.8s; }

/* 門卡點擊：光暈一閃、道具微升，再進入世界 */
.door.pressed { animation: door-press .55s cubic-bezier(.2,.7,.2,1) both; border-color: var(--accent); }
.door.pressed .door-prop img { transform: translateY(-10px) scale(1.08); filter: drop-shadow(0 18px 26px rgba(0,0,0,.6)) drop-shadow(0 0 26px var(--accent-glow)) drop-shadow(0 0 60px var(--accent-glow)) brightness(1.12); animation: none; transition: transform .45s cubic-bezier(.2,.7,.2,1), filter .45s ease; }
.door.pressed::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(60% 50% at 50% 42%, var(--accent-soft), transparent 70%); animation: door-flash .55s ease-out both; }
@keyframes door-press { 0% { transform: scale(.985); } 55% { transform: translateY(-6px) scale(1.02); } 100% { transform: translateY(-4px) scale(1.01); } }
@keyframes door-flash { 0% { opacity: 0; } 35% { opacity: 1; } 100% { opacity: .35; } }

@keyframes prop-breathe { 0%, 100% { filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)) drop-shadow(0 0 12px var(--accent-glow)) drop-shadow(0 0 28px var(--accent-soft)); } 50% { filter: drop-shadow(0 14px 18px rgba(0,0,0,.6)) drop-shadow(0 0 20px var(--accent-glow)) drop-shadow(0 0 46px var(--accent-glow)); } }

/* ───────── 願境：許願／還願 ───────── */
.wish-hero { min-height: 62vh; background-size: cover; background-position: center 38%; transition: filter .7s ease; }
.wish-hero.make { min-height: 56vh; } .wish-hero.ret { min-height: 52vh; }
.wish-hero::before { background: linear-gradient(180deg, rgba(20,17,15,.12) 0%, rgba(20,17,15,0) 35%, rgba(20,17,15,.72) 78%, var(--ink) 100%); }
.wish-hero.lit { filter: brightness(1.12) saturate(1.05); }
.lamps { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.lamp { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #f7e3a6; transform: translate(-50%,-50%);
  box-shadow: 0 0 6px 2px rgba(243,217,138,.75), 0 0 16px 4px rgba(232,138,106,.25); animation: lamp-breathe 4.2s ease-in-out infinite; }
.wish-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
@media (max-width: 480px) { .wish-paths { grid-template-columns: 1fr; } }
.wish-path { display: flex; flex-direction: column; gap: 6px; padding: 22px 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); color: var(--paper); text-decoration: none; box-shadow: var(--shadow); transition: transform .25s ease, border-color .25s ease; }
.wish-path:hover { transform: translateY(-3px); border-color: var(--accent); }
.wish-path .glyph { font-size: 1.5rem; color: var(--gold-2); text-shadow: 0 0 14px rgba(243,217,138,.6); }
.wish-path b { font-family: var(--serif); font-size: 1.25rem; letter-spacing: .12em; }
.wish-path small { color: var(--mute); }
.wish-path.make .glyph { color: #f3d98a; }
.wish-path.return .glyph { color: #e88a6a; text-shadow: 0 0 14px rgba(232,138,106,.5); }
.wish-path.dim { opacity: .7; }
.wish-form { display: flex; flex-direction: column; gap: 16px; }
.wish-input { width: 100%; box-sizing: border-box; font-size: 1.25rem; line-height: 1.7; padding: 16px 18px; color: var(--paper); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; resize: none; outline: none; transition: border-color .25s, color .3s; }
.wish-input:focus { border-color: var(--accent); }
.wish-input.shake { animation: shake .45s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.wish-opt { display: flex; flex-direction: column; gap: 8px; }
.wish-fly { position: fixed; z-index: 60; pointer-events: none; font-size: 1.25rem; line-height: 1.7; padding: 16px 18px; color: #f7e3a6; text-shadow: 0 0 14px rgba(243,217,138,.8); transform-origin: 50% 50%; will-change: transform, opacity; }
.wish-dot { position: fixed; z-index: 60; width: 10px; height: 10px; border-radius: 50%; background: #f7e3a6; box-shadow: 0 0 10px 4px rgba(243,217,138,.85), 0 0 30px 10px rgba(243,217,138,.3); pointer-events: none; will-change: transform; }
.wish-done { text-align: center; padding: 24px 0 8px; }
.wish-ack { font-size: 1.8rem; letter-spacing: .3em; margin: 6px 0 14px; color: var(--paper); text-shadow: 0 0 18px rgba(243,217,138,.5); }
.wish-echo { font-size: 1.15rem; line-height: 1.8; color: var(--gold-2); }
.wish-card { padding: 22px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.wish-card.unfold { animation: unfold .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes unfold { from { opacity: 0; transform: scaleY(.6) translateY(-8px); } to { opacity: 1; transform: none; } }
.outcomes .chip { font-size: .95rem; }
/* 水面：不用硬邊框，改用羽化的橢圓光暈加淡淡的同心圈，邊緣像漣漪一樣散開 */
.water { position: relative; height: 130px; margin-top: -6px; overflow: visible;
  background: radial-gradient(58% 52% at 50% 60%, rgba(120,150,200,.30) 0%, rgba(90,120,170,.14) 42%, rgba(20,17,15,0) 72%);
  -webkit-mask-image: radial-gradient(72% 64% at 50% 60%, #000 28%, rgba(0,0,0,.55) 55%, transparent 82%);
          mask-image: radial-gradient(72% 64% at 50% 60%, #000 28%, rgba(0,0,0,.55) 55%, transparent 82%); }
.water::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background: repeating-radial-gradient(ellipse 46% 20% at 50% 60%, transparent 0 15px, rgba(243,217,138,.10) 15px 16px, transparent 16px 34px);
  animation: water-breathe 6s ease-in-out infinite; }
@keyframes water-breathe { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: .6; transform: scale(1.03); } }
.ripple { position: absolute; left: 50%; top: 60%; width: 12px; height: 6px; border: 1px solid rgba(243,217,138,.75); border-radius: 50%; transform: translate(-50%,-50%); opacity: 0; animation: ripple 2.2s ease-out forwards; }
@keyframes ripple { 0% { width: 12px; height: 6px; opacity: .9; border-width: 1.5px; } 100% { width: 340px; height: 96px; opacity: 0; border-width: .5px; } }
.leaf { position: fixed; z-index: 60; width: 18px; height: 26px; background: linear-gradient(160deg, #f7e3a6, #d9a648); border-radius: 100% 0 100% 0; box-shadow: 0 0 14px rgba(243,217,138,.7); pointer-events: none; will-change: transform, opacity; }
.wish-item .note { display: block; margin-top: 6px; font-style: normal; color: var(--paper); opacity: .85; }
.wish-item.static { cursor: default; }
.wish-item .ops { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; font-size: .82rem; }
.wish-item .ops a { color: var(--gold-2); }
button.link { background: none; border: 0; padding: 0; color: var(--mute); font: inherit; font-size: .82rem; cursor: pointer; }
button.link.danger:hover { color: #e88a6a; }
h3.sec { margin: 22px 0 8px; font-size: .95rem; letter-spacing: .12em; color: var(--mute); font-weight: 500; }

/* 還願之後：水面升起幾點星光，「謝謝」從光裡聚出來 */
.spark { position: absolute; bottom: 36%; width: 4px; height: 4px; border-radius: 50%; background: #f7e3a6; box-shadow: 0 0 8px 2px rgba(243,217,138,.8); opacity: 0; animation: spark-rise 2.2s ease-out forwards; }
@keyframes spark-rise { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(var(--dx, 0), -120px) scale(1.1); opacity: 0; } }
.wish-done .wish-ack { animation: ack-gather 1.6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes ack-gather { 0% { opacity: 0; letter-spacing: 1.1em; filter: blur(4px); } 60% { opacity: 1; filter: blur(0); } 100% { letter-spacing: .3em; } }
.wish-quiet { margin: 4px 0 14px; animation: fade-in 1.2s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* 還願堂的題辭 */
.epigraph { margin-top: 34px; padding: 16px 18px; border-top: 1px solid var(--line); }
.epigraph summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.epigraph summary::-webkit-details-marker { display: none; }
.epigraph summary .serif { font-size: 1.05rem; line-height: 1.8; color: var(--gold-2); }
.epigraph summary small { color: var(--mute); font-size: .8rem; letter-spacing: .08em; }
.epigraph[open] summary small { opacity: .5; }
.epigraph-full { margin-top: 14px; color: var(--paper); line-height: 1.95; font-size: 1rem; }
.epigraph-full p { margin: 0 0 12px; }
.epigraph-full .by { text-align: right; color: var(--mute); }
.wish-bless { margin: 8px auto 20px; max-width: 32em; font-size: 1.05rem; line-height: 1.9; color: var(--gold-2); animation: fade-in 1.6s .4s ease both; }
.wish-bless small { display: block; margin-top: 6px; color: var(--mute); font-size: .8rem; }

/* 斷句：短語不在中間換行 */
.ph { display: inline-block; }

/* 月老處境解 */
.sit { margin: 0 0 12px; padding: 10px 14px; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.sit b { display: block; font-size: .8rem; letter-spacing: .1em; color: var(--gold-2); margin-bottom: 4px; font-weight: 600; }

/* 月老第二個籤筒 */
.deck2 { margin-top: 18px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 14px; }
.deck2 .btn { margin-bottom: 8px; }
.deck2 p { margin: 0; }

/* 月老：兩個籤筒卡片 */
.decks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 4px; }
.decks .door.deck { --accent-soft: rgba(224,96,122,.22); --accent-glow: rgba(255,120,150,.55); }
.decks .door .name p { margin: 4px 0 0; font-size: .82rem; color: var(--mute); letter-spacing: .04em; }
@media (max-width: 420px) { .decks { gap: 10px; } .decks .door .name h3 { font-size: 1rem; } }

/* 願境：手機直式畫面改成顯示整棵許願樹（contain），圖的上下邊已在產生時淡入墨色 */
@media (max-width: 640px) {
  .wish-hero { background-size: contain; background-position: center 0; background-color: var(--ink); background-repeat: no-repeat; min-height: 54vh; }
  .wish-hero.make { min-height: 46vh; } .wish-hero.ret { min-height: 44vh; }
  .wish-hero::before { background: linear-gradient(180deg, rgba(20,17,15,0) 0%, rgba(20,17,15,0) 45%, rgba(20,17,15,.6) 70%, var(--ink) 100%); }
}

/* 按住籤筒搖、放手落籤 */
.prop-img { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.prop-stage.held .prop-img { animation-duration: .3s; cursor: grabbing; filter: drop-shadow(0 18px 30px rgba(0,0,0,.55)) drop-shadow(0 0 34px var(--accent-soft)) drop-shadow(0 0 60px var(--accent-soft)); }
.hint { text-align: center; margin: 4px 0 -4px; }
.result-actions + .once { text-align: center; margin: 10px 0 0; opacity: .8; }
/* 凶籤留在樹上：安靜的一行入口，在「再求一籤」下面 */
.leave { text-align: center; margin: 22px 0 0; opacity: 0; animation: fade-late .8s ease forwards; animation-delay: 4.2s; }
.leave-btn { background: none; border: 0; color: var(--mute); text-decoration: underline dotted; text-underline-offset: 5px; cursor: pointer; font: inherit; font-size: .92rem; letter-spacing: .06em; padding: 6px 10px; }
.leave-btn:hover { color: var(--gold-2); }
.leave-btn:disabled { opacity: .5; cursor: default; }
.leave p { margin: 8px 0 0; }
.leave.done { animation: none; opacity: 1; }
.leave.done .wish-quiet { margin: 0; font-family: var(--serif); letter-spacing: .08em; color: var(--gold-2); }
.leave a { color: var(--mute); }
.item.left { opacity: .55; }
.recfold { margin-top: 20px; }
.recfold > summary { color: var(--mute); letter-spacing: .06em; }
.recfold .list { margin: 4px 0 12px; }

/* 求籤頁：按住籤筒時不讓 iOS 選字、跳拷貝、預覽圖片 */
.hero.prop, .hero.prop * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.prop-stage { pointer-events: none; } .prop-stage .prop-img { pointer-events: auto; }

/* 全站按鈕類連結：長按不跳 iOS 的連結選單（開新分頁／複製連結…），也不選字 */
a.btn, a.door, a.iconbtn, .chip, .tabs a, .item, .wish-paths a { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* 所有按鈕（含 <button>）與求籤頁整頁：長按不選字、不跳拷貝 */
.btn, button, .hero.prop ~ main, .hero.prop ~ main * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.hero.prop ~ main textarea, .hero.prop ~ main input { -webkit-user-select: text; user-select: text; }

footer .ver { margin-top: 6px; font-size: .7rem; letter-spacing: .12em; color: var(--mute); opacity: .55; }

/* 世界頁：說明收進「關於這個世界」 */
.more { margin-top: 10px; }
.more summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '›'; display: inline-block; transition: transform .25s; color: var(--gold-2); }
.more[open] summary::before { transform: rotate(90deg); }
.more p { margin: 8px 0 0; }

/* 大殿：頂欄拿掉，兩個連結移到標題下方，不擋神像 */
.hero.hall { cursor: pointer; }
.hall-links { margin: 10px 0 0; display: flex; gap: 18px; font-size: .86rem; letter-spacing: .06em; }
.hall-links a { color: var(--gold-2); opacity: .85; text-decoration: none; border-bottom: 1px solid rgba(243,217,138,.35); padding-bottom: 1px; }
.hall-links a:hover { opacity: 1; }

/* 入口海報 */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); cursor: pointer; animation: fade-in .9s ease both; }
.gate.leave { animation: gate-leave .45s ease forwards; }
@keyframes gate-leave { to { opacity: 0; transform: scale(1.02); } }
.gate .poster { position: relative; width: min(100vw, calc(100vh / 1.5)); }
.gate img { display: block; width: 100%; height: auto; }
.gate-enter { position: absolute; left: 50%; top: 79%; width: 27%; aspect-ratio: 1.12; transform: translate(-50%, -50%); border-radius: 50%; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: gate-pulse 2.8s ease-in-out infinite; }
@keyframes gate-pulse { 0%, 100% { box-shadow: 0 0 16px 2px rgba(243,217,138,.12); } 50% { box-shadow: 0 0 36px 10px rgba(243,217,138,.42); } }
.gate ~ footer, .gate + footer { display: none; }

/* 大殿背景：從畫中「讓神明為你指引」以下逐漸收成墨色，圓牌與底字藏進黑裡，標題後面是乾淨的底 */
.hero.hall::before { background: linear-gradient(180deg, rgba(20,17,15,.10) 0%, rgba(20,17,15,0) 22%, rgba(20,17,15,0) 50%, rgba(20,17,15,.75) 62%, rgba(20,17,15,.97) 70%, var(--ink) 100%); }
.hero.hall .wrap { padding-bottom: 6px; }

/* ───────── 易經牌陣：本卦／動爻／之卦（tools/build_yijing_cards.py 產生牌面與六爻座標） ───────── */
.spread { display: grid; gap: 14px; align-items: start; margin-top: 18px; }
.spread.one { grid-template-columns: minmax(0, 360px); justify-content: center; }
.spread.three { grid-template-columns: minmax(0, 1fr) minmax(150px, .9fr) minmax(0, 1fr); }
.ycard { position: relative; margin: 0; border-radius: 12px; overflow: hidden; background: #1a1535; line-height: 0;
  box-shadow: var(--shadow), 0 0 0 1px rgba(201,169,97,.35); }
.ycard { aspect-ratio: 2 / 3; }   /* 只作為 JS 跑之前的暫時高度；fitCard() 會把高度寫成寬×1.5 的像素值，iOS Safari 才不會把圖壓扁 */
.ycard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.ycard.empty { aspect-ratio: 2 / 3; line-height: 1.5; }
.ycard figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; text-align: center; font-family: var(--serif); letter-spacing: .2em; font-size: .85rem; color: var(--gold-2);
  background: linear-gradient(180deg, rgba(20,17,15,0), rgba(20,17,15,.86)); text-shadow: 0 1px 4px #000; pointer-events: none; }
.yhot { position: absolute; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 4px; -webkit-tap-highlight-color: transparent; transition: box-shadow .2s, background .2s; }
.yhot:hover, .yhot:focus-visible { background: rgba(255,255,255,.12); outline: none; }
/* 動爻標記：不畫框，改在那條槓的左前方放一顆鎏金星（使用者偏好星星；星只需對到槓的高度，比框耐偏移） */
.yhot.on::before { content: "✦"; position: absolute; right: calc(100% - 3px); top: 50%; transform: translateY(-50%); font-size: 20px; line-height: 1; color: #ffe9a8;
  text-shadow: 0 0 6px rgba(255,214,110,.95), 0 0 16px rgba(255,214,110,.7), 0 0 30px rgba(255,200,80,.45); animation: ystar 2.2s ease-in-out infinite; pointer-events: none; }
.yhot.sel { box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 22px 6px rgba(255,255,255,.45); }
.yhot.sel.on::before { color: #fff; }
@keyframes ystar { 0%, 100% { transform: translateY(-50%) scale(1); text-shadow: 0 0 6px rgba(255,214,110,.9), 0 0 14px rgba(255,214,110,.6); } 50% { transform: translateY(-50%) scale(1.25); text-shadow: 0 0 8px #fff, 0 0 22px rgba(255,236,170,1), 0 0 40px rgba(255,200,80,.8); } }
.ycard.empty { display: grid; place-items: center; background: radial-gradient(80% 60% at 50% 40%, rgba(216,183,110,.18), rgba(26,21,53,0)), #1a1535; border: 1px dashed var(--line); }
.yempty { text-align: center; color: var(--gold-2); font-family: var(--serif); }
.yempty .sym { display: block; font-size: 2.8rem; line-height: 1.1; }
.yempty b { display: block; letter-spacing: .15em; margin-top: 6px; }
.yempty small { display: block; color: var(--mute); letter-spacing: .1em; margin-top: 4px; font-family: var(--sans); }
.ypanel { align-self: center; display: grid; gap: 8px; }
.ypanel-h { text-align: center; font-family: var(--serif); letter-spacing: .3em; color: var(--accent); font-size: .85rem; }
.yline { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
  background: rgba(255,255,255,.03); color: var(--paper); cursor: pointer; transition: border-color .2s, background .2s; }
.yline:hover, .yline.sel { border-color: var(--gold-2); background: var(--accent-soft); }
.ybadge { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #2c244f, #14112a); box-shadow: 0 0 0 1.5px rgba(216,183,110,.7), 0 0 14px rgba(216,183,110,.35); }
.ybadge img { width: 100%; height: 100%; object-fit: cover; }
.ybar { display: flex; gap: 0; width: 32px; height: 7px; }
.ybar i { flex: 1; background: #e6cf8f; border-radius: 2px; box-shadow: 0 0 6px rgba(255,214,110,.6); }
.ybar i.gap { flex: 0 0 6px; background: transparent; box-shadow: none; }
.yline .yt { display: grid; gap: 2px; min-width: 0; }
.yline .yt b { font-family: var(--serif); color: var(--gold-2); letter-spacing: .1em; font-weight: 600; }
.yline .yt .mark { margin-left: 6px; color: var(--accent-2, var(--gold)); }
.yline .yt .serif { font-size: .9rem; color: var(--paper); }
.ypop { margin-top: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--gold-2); background: linear-gradient(180deg, rgba(42,35,80,.55), rgba(20,17,15,.6)); animation: fade-late .4s ease both; }
.ypop-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.ypop-h b { font-size: 1.15rem; color: var(--gold-2); }
.ypop .ytext { font-size: 1.15rem; line-height: 1.8; }
.ypop .lx { color: var(--mute); font-size: .88rem; margin-top: 4px; }
.ypop blockquote { margin: 10px 0 0; padding: 10px 14px; border-left: 2px solid var(--accent); background: rgba(255,255,255,.03); border-radius: 0 8px 8px 0; font-family: var(--serif); color: var(--gold-2); }
.yhint { text-align: center; margin: 8px 0 0; }
.line-item.sel { border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-2) inset; }
[data-world="yijing"] { --accent: #d8b76e; --accent-soft: rgba(216,183,110,.16); --accent-2: #f0dca0; }
@media (max-width: 640px) {
  .spread.three { grid-template-columns: 1fr; }
  .spread.three .ycard { max-width: 300px; margin: 0 auto; width: 100%; }
  .spread.one .ycard { max-width: 300px; }
  .spread.three > .ycard[data-role="changed"] { order: 3; }
  .spread.three > .ypanel { order: 2; }
}
/* 六十四卦圖鑑 */
.ygrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 640px) { .ygrid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
@media (max-width: 400px) { .ygrid { grid-template-columns: repeat(2, 1fr); } }
.ytile { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: #1a1535; box-shadow: 0 10px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(201,169,97,.3); transition: transform .18s, box-shadow .18s; }
.ytile:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(0,0,0,.55), 0 0 0 1px var(--gold-2); }
.ytile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ytile .yname { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 6px; text-align: center; font-family: var(--serif); font-size: .82rem; letter-spacing: .12em; color: var(--paper);
  background: linear-gradient(180deg, rgba(20,17,15,0), rgba(20,17,15,.8)); }
.ytile .yname small { display: block; color: var(--gold-2); font-size: .7rem; letter-spacing: .1em; }
.ytile.empty { display: grid; place-items: center; border: 1px dashed var(--line); }
.ytile.empty .yempty .sym { font-size: 2rem; }
.ytile.empty .yempty b { font-size: .85rem; }
.ytile.empty .yempty small { font-size: .7rem; }

/* ───────── 易經結果頁四段式（2026-10-08）：牌陣 → 本次應讀紙卡 → 今 → 原典與研讀（摺疊） ───────── */
.paper.read .meta .guide { color: #8a7355; letter-spacing: .04em; }
.paper .pr { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(120,90,40,.3); }
.paper .pr:first-of-type { border-top: 0; padding-top: 0; }
.paper .pr-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: #6b5a44; font-size: .9rem; }
.paper .pr-h b { color: #2a2018; font-size: 1rem; letter-spacing: .1em; }
.paper .pr-h a { color: #2a2018; text-decoration: underline dotted; text-underline-offset: 3px; }
.paper .pr .mk { color: #b8452f; font-family: var(--serif); font-weight: 700; letter-spacing: .1em; }
.paper .pr.mv { background: rgba(184,69,47,.05); margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.paper .pr .poem { text-align: left; font-size: clamp(1.2rem, 4.2vw, 1.5rem); line-height: 1.8; letter-spacing: .08em; margin: 4px 0; }
.paper .tag { display: inline-block; font-size: .7rem; letter-spacing: .12em; color: #8a7355; border: 1px solid rgba(120,90,40,.35); border-radius: 999px; padding: 0 7px; margin-right: 6px; font-family: var(--sans); vertical-align: 2px; }
.paper .pl { margin: 4px 0 0; color: #4a3c2c; font-size: .92rem; line-height: 1.7; }
.paper .pl.serif { font-size: 1.05rem; color: #2a2018; }
.paper .story { margin-top: 10px; padding: 10px 12px; border-left: 3px solid #b8452f; background: rgba(255,255,255,.45); border-radius: 0 8px 8px 0; font-family: var(--serif); color: #2a2018; line-height: 1.75; }
.paper .story b { display: inline-block; margin-right: 6px; color: #7a2e1e; }
.paper .story .sl { display: block; margin-top: 4px; color: #6b5a44; font-size: .9rem; }
.paper .note { margin: 10px 0 0; color: #8a7355; font-size: .85rem; letter-spacing: .04em; }
.paper .pr.zh { border-top-style: solid; }
.result-body .paper.read .poem p { animation-delay: .7s; }
.result-body .paper.read .pr, .result-body .paper.read .note { opacity: 0; animation: line-in .9s ease forwards; animation-delay: .9s; }
.result-body .paper.read .pr:nth-of-type(2) { animation-delay: 1.5s; } .result-body .paper.read .pr:nth-of-type(3) { animation-delay: 2.1s; }
.layer .lead { font-family: var(--serif); color: var(--gold-2); font-size: 1.05rem; }
.facets { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.facets summary { cursor: pointer; font-family: var(--serif); letter-spacing: .12em; color: var(--gold-2); list-style: none; }
.facets summary::-webkit-details-marker { display: none; }
.facets summary::after { content: "＋"; float: right; color: var(--accent); }
.facets[open] summary::after { content: "－"; }
.facets .kv { margin-top: 10px; }
@media (max-width: 520px) { .facets .kv { display: block; } .facets .kv dt { margin-top: 10px; color: var(--gold-2); } .facets .kv dd { margin: 2px 0 0; } }
details.source { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
details.source > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
details.source > summary::-webkit-details-marker { display: none; }
details.source > summary .num { font-family: var(--serif); font-size: 1.6rem; color: var(--accent); font-weight: 900; line-height: 1; }
details.source > summary h3 { font-size: 1.05rem; letter-spacing: .15em; }
details.source > summary::after { content: "展開 ＋"; margin-left: auto; font-size: .8rem; color: var(--accent); letter-spacing: .1em; white-space: nowrap; }
details.source[open] > summary::after { content: "收起 －"; }
details.source .layer { border-top: 1px dashed var(--line); }
details.source .layer:first-of-type { border-top: 0; }
.paper.read { padding-bottom: 60px; }
.facets summary { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.facets summary::after { float: none; margin-left: auto; }
details.source > summary { flex-wrap: wrap; }
details.source > summary h3 { white-space: nowrap; }
details.source > summary .small { flex: 1 1 100%; padding-left: 2.4rem; margin-top: -4px; }
.facets summary .small { letter-spacing: .1em; }
/* 易經兩套牌面切換：星夜版／淡彩版 */
.ystyle { display: inline-flex; gap: 6px; }
.ystyle .chip small { margin-left: 5px; font-size: .7rem; color: var(--mute); letter-spacing: 0; }
.ystyle .chip[aria-pressed="true"] small { color: var(--gold-2); }
.ystyle .chip:disabled { opacity: .4; cursor: default; }
.yhint-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.yhint-row .yhint { margin: 0; }
.tabs .ystyle { margin-left: auto; }
/* 易經・夜霧揭曉：只在剛起完卦的結果頁播一次（.spread.fog → .lift）。霧是一層深靛漸層＋輕微模糊，不對大圖做重濾鏡 */
.ycard .yfog { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.6s ease;
  background: radial-gradient(60% 45% at 50% 48%, rgba(26,21,53,.55) 0%, rgba(26,21,53,.92) 60%, rgba(20,17,15,.98) 100%); }
.spread.fog .ycard img { filter: blur(10px) saturate(.35) brightness(.75); transform: scale(1.04); transition: filter 1.6s ease, transform 1.6s ease; }
.spread.fog .ycard .yfog { opacity: 1; }
.spread.fog .yhot.on::before { text-shadow: 0 0 10px #fff, 0 0 30px rgba(255,236,170,1), 0 0 60px rgba(255,200,80,.9); font-size: 26px; }
.spread.fog .ypanel, .spread.fog figcaption { opacity: 0; transition: opacity .8s ease .9s; }
.spread.fog.lift .ycard img { filter: blur(0) saturate(1) brightness(1); transform: none; }
.spread.fog.lift .ycard .yfog { opacity: 0; }
.spread.fog.lift .ypanel, .spread.fog.lift figcaption { opacity: 1; }
.yhot.flash::before { animation: yhot-flash 1.1s ease 1.3s 1; }
@keyframes yhot-flash { 0%, 100% { transform: translateY(-50%) scale(1); } 45% { transform: translateY(-50%) scale(1.9); text-shadow: 0 0 12px #fff, 0 0 40px rgba(255,236,170,1); } }
@media (prefers-reduced-motion: reduce) { .spread.fog .ycard img, .ycard .yfog, .spread.fog .ypanel, .spread.fog figcaption { transition-duration: .2s; } }
/* 梅花易數：報數輸入與體用表 */
.mhnum { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; }
/* 梅花報數：數字盤 1–99 */
.mhnum .picked { display: flex; gap: 8px; align-items: stretch; margin: 8px 0 10px; }
.mhnum .picked span { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(244,236,220,.04); }
.mhnum .picked span small { color: var(--mute); font-size: .72rem; letter-spacing: .1em; }
.mhnum .picked span b { font-family: var(--serif); font-size: 1.5rem; color: var(--mute); line-height: 1.2; }
.mhnum .picked span.on { border-color: var(--gold-2); } .mhnum .picked span.on b { color: var(--gold-2); }
.mhnum .picked .pill { align-self: center; cursor: pointer; background: transparent; }
.mhnum .numpad { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.mhnum .numpad button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: rgba(244,236,220,.04); color: var(--paper); font-family: var(--serif); font-size: .9rem; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s; }
.mhnum .numpad button:hover { border-color: var(--accent); }
.mhnum .numpad button.on { background: var(--accent-soft); border-color: var(--gold-2); color: var(--gold-2); font-weight: 700; box-shadow: 0 0 10px rgba(216,183,110,.4); }
@media (max-width: 640px) { .mhnum .numpad { grid-template-columns: repeat(9, 1fr); gap: 5px; } .mhnum .numpad button { font-size: 1rem; } }
@media (max-width: 400px) { .mhnum .numpad { grid-template-columns: repeat(8, 1fr); } }
.tiyong { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .95rem; }
.tiyong th, .tiyong td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tiyong thead th { color: var(--mute); font-weight: 500; font-size: .8rem; letter-spacing: .1em; }
.tiyong tbody th { font-family: var(--serif); color: var(--gold-2); white-space: nowrap; }
.tiyong td small { margin-left: 4px; color: var(--mute); }
.tiyong td.v { font-family: var(--serif); white-space: nowrap; }
.tiyong td.v.sheng_in, .tiyong td.v.he { color: #a9d5a0; } .tiyong td.v.ke_out { color: var(--gold-2); } .tiyong td.v.sheng_out { color: var(--mute); } .tiyong td.v.ke_in { color: #e08a7a; }
/* 六爻納甲排盤 */
.najia { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .95rem; }
.najia th, .najia td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.najia thead th { color: var(--mute); font-weight: 500; font-size: .76rem; letter-spacing: .08em; padding-top: 0; }
.najia tbody th { font-family: var(--serif); white-space: nowrap; width: 4.6em; }
.najia tbody th b { color: var(--gold-2); font-size: 1.05rem; }
.najia tbody th .mk { font-style: normal; color: var(--accent-2, var(--gold)); margin-left: 2px; }
.najia tbody th em { font-style: normal; display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--gold-2); border-radius: 999px; color: var(--gold-2); font-size: .72rem; line-height: 1.5; vertical-align: 2px; }
.najia td.rel b { font-family: var(--serif); margin-right: 8px; }
.najia td.rel .gz, .najia td.chg .gz { font-family: var(--serif); letter-spacing: .05em; }
.najia td.rel .gz small, .najia td.chg .gz small { margin-left: 2px; color: var(--mute); font-size: .76rem; }
.najia td.rel .shou { display: inline-block; margin-left: 8px; color: var(--mute); font-size: .74rem; }
.najia td.chg { white-space: nowrap; }
.najia td.chg b { font-family: var(--serif); margin-right: 6px; }
.najia td.chg small { display: block; color: var(--mute); font-size: .74rem; }
.najia td.tg > span { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.najia td.tg .pill { padding: 0 6px; font-size: .68rem; }
.najia tr.mv td, .najia tr.mv th { background: var(--accent-soft); }
.najia tr.ys td, .najia tr.ys th { box-shadow: inset 0 0 0 1px var(--gold-2); }
.yongshen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.yongshen .chip { font-size: .8rem; padding: 4px 10px; }
.ys-note { margin-top: 8px; }
@media (max-width: 480px) { .najia { font-size: .86rem; } .najia th, .najia td { padding: 8px 4px; } .najia tbody th { width: 4em; } .najia td.rel .shou { display: block; margin: 2px 0 0; } .najia td.chg { white-space: normal; } }
.yhot.off { pointer-events: none; cursor: default; }
.ys-note .reading { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--gold-2); border-radius: 12px; background: linear-gradient(180deg, rgba(42,35,80,.35), rgba(20,17,15,.5)); }
.ys-note .reading p { margin: 0 0 10px; line-height: 1.8; font-size: .95rem; }
.ys-note .reading p:last-child { margin-bottom: 0; color: var(--gold-2); font-family: var(--serif); }
.ys-note .reading b { font-family: var(--serif); color: var(--gold-2); margin-right: 6px; letter-spacing: .08em; }
/* 術語標籤與展開定義 */
button.gl { background: none; border: 0; padding: 0 1px; margin: 0; font: inherit; color: var(--gold-2); cursor: pointer; border-bottom: 1px dotted var(--gold-2); line-height: inherit; -webkit-tap-highlight-color: transparent; }
button.gl[aria-expanded="true"] { color: #fff; border-bottom-style: solid; }
button.gl.pill { border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; color: var(--mute); }
button.gl.pill.ok { border-color: #7fb37a; color: #a9d5a0; } button.gl.pill.warn { border-color: #c9a961; color: var(--gold-2); }
.glpop { display: block; margin: 6px 0 8px; padding: 8px 12px; border-left: 2px solid var(--gold-2); background: rgba(255,255,255,.04); border-radius: 0 8px 8px 0; font-size: .88rem; color: var(--paper); line-height: 1.7; }
.glpop b { font-family: var(--serif); color: var(--gold-2); margin-right: 8px; }
td .glpop, th .glpop { font-size: .8rem; }
.najia td.rel button.gl { font-family: var(--serif); font-weight: 700; margin-right: 8px; }
.najia td.chg button.gl { font-family: var(--serif); font-weight: 700; margin-right: 6px; }
.mhplain { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--gold-2); border-radius: 10px; background: rgba(42,35,80,.35); font-size: .95rem; line-height: 1.8; }
.mhplain b { color: var(--gold-2); font-family: var(--serif); margin-right: 2px; }
.ys-note .reading button.gl { font-weight: 500; }
.tiyong td.v small { display: block; color: var(--mute); font-family: var(--sans); white-space: normal; }
.layer .reading { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--gold-2); border-radius: 12px; background: linear-gradient(180deg, rgba(42,35,80,.35), rgba(20,17,15,.5)); }
.layer .reading p { margin: 0 0 10px; line-height: 1.8; font-size: .95rem; } .layer .reading p:last-child { margin-bottom: 0; }
.layer .reading b { font-family: var(--serif); color: var(--gold-2); margin-right: 6px; letter-spacing: .08em; }
details.src { margin-top: 10px; } details.src summary { cursor: pointer; }
/* 原文摺疊：白話直接顯示，原文點開 */
details.orig { margin-top: 8px; }
details.orig summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.orig summary::-webkit-details-marker { display: none; }
details.orig summary::after { content: "＋"; margin-left: auto; color: #8a7355; }
details.orig[open] summary::after { content: "－"; }
details.orig p { margin: 8px 0 0; line-height: 1.8; font-size: 1.05rem; color: #2a2018; letter-spacing: .06em; }
.ypop details.orig p { color: var(--gold-2); font-size: 1rem; }
.ypop details.orig p.small { font-size: .88rem; color: var(--mute); }
.ypop details.orig summary::after { color: var(--accent); }
.paper .poem p { letter-spacing: .04em; }
.copyrow { margin: 18px 0 4px; text-align: center; }
.copyrow .btn { width: 100%; }
.copyrow p { margin: 8px 0 0; }
.copyrow .export { margin-top: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; white-space: pre-wrap; font-size: .8rem; color: var(--paper); text-align: left; -webkit-user-select: text; user-select: text; max-height: 40vh; overflow: auto; }
.copyrow label { display: block; text-align: left; margin-bottom: 6px; }
.copyrow textarea { width: 100%; background: rgba(244,236,220,.06); border: 1px solid var(--line); border-radius: 10px; color: var(--paper); padding: 10px 12px; font-size: 1rem; font-family: var(--sans); resize: vertical; margin-bottom: 10px; -webkit-user-select: text; user-select: text; }
.copyrow textarea:focus { outline: none; border-color: var(--accent); }
/* 複製給 AI：四個單色線條圖示（星芒、對話、機器人、迴路腦），SVG 內嵌、隨主題色 */
.aibtn { display: flex; align-items: center; justify-content: center; gap: 14px; }
.ai-icons { display: inline-flex; gap: 8px; align-items: center; }
.ai-icons svg { width: 22px; height: 22px; stroke: var(--gold-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: var(--gold-2); opacity: .9; transition: transform .2s, opacity .2s; }
.ai-icons svg [fill="none"] { fill: none; } .ai-icons svg .f { fill: var(--gold-2); }
.ai-icons svg:nth-child(1) { fill: var(--gold-2); stroke: none; }
.aibtn:hover .ai-icons svg { opacity: 1; }
.aibtn:hover .ai-icons svg:nth-child(1) { transform: rotate(20deg) scale(1.15); }
.aibtn:hover .ai-icons svg:nth-child(2) { transform: translateY(-2px); }
.aibtn:hover .ai-icons svg:nth-child(3) { transform: rotate(-8deg); }
.aibtn:hover .ai-icons svg:nth-child(4) { transform: scale(1.1); }
.aibtn.done .ai-icons svg { animation: ai-pop .5s ease; }
@keyframes ai-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (max-width: 400px) { .ai-icons svg { width: 18px; height: 18px; } .aibtn { gap: 10px; } }
/* 按鈕字樣：淚體外框向量圖（img/ui/copyai-label.svg，用 mask 上色，不嵌字型檔） */
.aibtn.done .lbl { display: none; }
.aibtn .lbl-txt { font-size: .95rem; letter-spacing: .1em; }

/* ───────── 易經「本次應讀」紙卡：改成與牌面同調的墨色鎏金（其他世界的米白籤紙不變） ───────── */
.paper.read { background: radial-gradient(120% 90% at 50% 0%, #2a2350 0%, #1a1535 55%, #14112a 100%); color: var(--paper);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(216,183,110,.55), inset 0 0 0 5px rgba(20,17,15,.0), inset 0 0 0 6px rgba(216,183,110,.28), inset 0 0 60px rgba(0,0,0,.35); border-radius: 12px; }
.paper.read::before, .paper.read::after { content: "✦"; position: absolute; color: rgba(240,220,160,.75); font-size: 14px; line-height: 1; }
.paper.read::before { left: 12px; top: 10px; } .paper.read::after { right: 12px; top: 10px; }
.paper.read .meta { color: var(--mute); } .paper.read .meta b { color: var(--gold-2); } .paper.read .meta .guide { color: var(--mute); }
.paper.read .pr { border-top-color: rgba(216,183,110,.25); }
.paper.read .pr-h { color: var(--mute); } .paper.read .pr-h b { color: var(--gold-2); } .paper.read .pr-h a { color: var(--gold-2); }
.paper.read .pr .mk { color: #f0a08a; }
.paper.read .pr.mv { background: rgba(216,183,110,.08); box-shadow: inset 2px 0 0 var(--gold-2); }
.paper.read .poem { color: var(--paper); }
.paper.read .tag { color: var(--gold-2); border-color: rgba(216,183,110,.5); }
.paper.read .pl { color: #cfc7e0; } .paper.read .pl.serif { color: var(--paper); }
.paper.read .story { background: rgba(255,255,255,.04); border-left-color: #e08a7a; color: var(--paper); }
.paper.read .story b { color: #f0c9b0; } .paper.read .story .sl { color: var(--mute); }
.paper.read .note { color: var(--mute); }
.paper.read .seal { border-color: #e08a7a; color: #e08a7a; }
.paper.read details.orig summary::after { color: var(--gold-2); }
.paper.read details.orig p { color: var(--gold-2); }
.paper.read .hexgram .hline i { background: var(--gold-2); } .paper.read .hexgram .hline.moving i { background: #f0a08a; }
.paper.read .tri { color: var(--mute); } .paper.read .tri b { color: var(--gold-2); }
/* 易經世界頁問題欄、結果頁問題大字 */
.world-hero ~ main .ask label, main .ask label { display: block; font-family: var(--serif); letter-spacing: .15em; color: var(--gold-2); margin-bottom: 8px; }
main .ask textarea { width: 100%; background: rgba(244,236,220,.06); border: 1px solid var(--line); border-radius: 10px; color: var(--paper); padding: 10px 12px; font-size: 1rem; font-family: var(--sans); resize: vertical; -webkit-user-select: text; user-select: text; }
main .ask textarea:focus { outline: none; border-color: var(--accent); }
.result-head .asked { margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: rgba(20,17,15,.55); border-radius: 0 10px 10px 0; font-family: var(--serif); font-size: 1.15rem; color: var(--paper); line-height: 1.6; }
.result-head .asked .small { display: block; letter-spacing: .15em; margin-bottom: 2px; }
/* 淚體字樣（外框 SVG，mask 上 currentColor；高度跟字級走） */
.tz { display: inline-block; height: 1.15em; width: calc(1.15em * var(--r)); vertical-align: -0.18em; background: currentColor; -webkit-mask: var(--tz) center / contain no-repeat; mask: var(--tz) center / contain no-repeat; }
.btn .tz { height: 1.2em; }
.chip .tz { height: 1.1em; vertical-align: -0.15em; }
.title-l .tz { height: 1.05em; }
.aibtn .tz.lbl { height: 1.35em; }
.result-head .asked .small .tz { height: 1.3em; color: var(--mute); }
figcaption .tz { height: 1.2em; }
.ypanel-h .tz { height: 1.3em; }
/* 問題欄：標題放在框框裡（左上角） */
.qbox { position: relative; }
.qbox label { position: absolute; left: 12px; top: 10px; margin: 0; pointer-events: none; z-index: 1; }
.qbox label .small { margin-left: 6px; letter-spacing: 0; }
main .ask .qbox textarea { padding-top: 42px; min-height: 100px; }

/* ───────── 塔羅：牌面圖、洗牌攤弧形、牌陣 ───────── */
.tbig { position: relative; width: min(62vw, 260px); margin: 6px auto 0; border-radius: 10px; overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(240,201,106,.35); transition: transform .6s; }
.tbig img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.tbig.rev img { transform: rotate(180deg); }
.tbig .seal { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 2px solid #b3382a; color: #b3382a; background: rgba(250,244,230,.92); border-radius: 4px; font-family: var(--serif); font-weight: 700; font-size: .95rem; }
.tquote { color: var(--gold-2); font-family: var(--serif); letter-spacing: .08em; margin: 12px 0 6px; }
.item .th { width: 44px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; border: 1px solid rgba(240,201,106,.3); flex: none; }
.fan { position: relative; height: 260px; margin: 10px auto 0; width: 100%; max-width: 480px; --org: clamp(210px, 58vw, 380px); touch-action: none; perspective: 900px; }
.fan::before { content: ""; position: absolute; left: 50%; top: 40px; width: 70%; height: 150px; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(180,139,230,.22), transparent 70%); filter: blur(18px); opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.fan.shuffling::before, .fan.fanned::before { opacity: 1; }
.tcard {
  position: absolute; left: 50%; top: 24px; width: 56px; height: 88px; margin-left: -28px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid #e6c37a; background: radial-gradient(ellipse at 50% 40%, #3a2a5a 0%, #1a1430 70%);
  background-image: radial-gradient(circle at 50% 50%, rgba(240,201,106,.55) 0 2px, transparent 2.5px), radial-gradient(circle at 0 0, rgba(240,201,106,.35) 0 1.5px, transparent 2px), radial-gradient(ellipse at 50% 40%, #3a2a5a 0%, #1a1430 70%);
  background-size: 14px 14px, 14px 14px, 100% 100%; box-shadow: inset 0 0 0 3px #1a1430, inset 0 0 0 4px rgba(240,201,106,.45), 0 4px 12px rgba(0,0,0,.5);
  transform-origin: 50% var(--org); transform: translate(0, 0) rotate(0deg); transition: transform 1.1s cubic-bezier(.2,.8,.2,1), box-shadow .4s, opacity .6s, filter .6s; -webkit-tap-highlight-color: transparent; will-change: transform;
}
.fan.shuffling .tcard { animation: tshuf 3s cubic-bezier(.45,0,.2,1) both; animation-delay: calc(var(--i) * 9ms); }
@keyframes tshuf {
  0%   { transform: translate(0, 0) rotate(0) rotateY(0); filter: blur(0); }
  22%  { transform: translate(var(--sx), var(--sy)) rotate(var(--sr)) rotateY(var(--ry)); filter: blur(.6px); opacity: .85; }
  48%  { transform: translate(calc(var(--sx) * -.5), calc(var(--sy2) * .6)) rotate(calc(var(--sr) * -.6)) rotateY(calc(var(--ry) * -1)); filter: blur(.3px); opacity: 1; }
  72%  { transform: translate(var(--sx2), var(--sy2)) rotate(var(--sr2)) rotateY(calc(var(--ry) * .5)); filter: blur(.6px); opacity: .9; }
  100% { transform: translate(0, 0) rotate(0) rotateY(0); filter: blur(0); opacity: 1; }
}
.fan.fanned .tcard { transform: rotate(var(--a)); transition-delay: calc(var(--i) * 9ms); }
.fan.fanned .tcard.hov { transform: rotate(var(--a)) translateY(-22px) scale(1.06); transition: transform .18s ease-out; z-index: 3; box-shadow: inset 0 0 0 3px #1a1430, inset 0 0 0 4px rgba(240,201,106,.8), 0 0 18px rgba(180,139,230,.6); }
.fan.fanned .tcard.picked { transform: rotate(var(--a)) translateY(-34px); transition: transform .35s; z-index: 4; box-shadow: inset 0 0 0 3px #1a1430, inset 0 0 0 4px rgba(240,201,106,.9), 0 0 22px rgba(240,201,106,.6); }
.fan.done .tcard:not(.picked) { opacity: .3; pointer-events: none; }
.slots { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.slot { width: 66px; text-align: center; }
.slot .face { width: 66px; height: 99px; border-radius: 6px; border: 1px dashed var(--line); position: relative; transform-style: preserve-3d; transition: transform .85s cubic-bezier(.3,.7,.3,1); }
.slot.filled .face { border: none; }
.slot.flip .face { transform: rotateY(180deg); }
.slot .face .b, .slot .face .f { position: absolute; inset: 0; border-radius: 6px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.slot.filled .face .b { border: 1px solid #e6c37a; background: radial-gradient(circle at 50% 50%, rgba(240,201,106,.55) 0 2px, transparent 2.5px), radial-gradient(ellipse at 50% 40%, #3a2a5a 0%, #1a1430 70%); background-size: 14px 14px, 100% 100%; box-shadow: inset 0 0 0 3px #1a1430, inset 0 0 0 4px rgba(240,201,106,.45); }
.slot .face .f { transform: rotateY(180deg); background: #1a1430; box-shadow: 0 0 0 1px rgba(240,201,106,.5); }
.slot .face .f img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slot .face .f img.rev { transform: rotate(180deg); }
.slot small { display: block; margin-top: 5px; color: var(--gold-2); font-family: var(--serif); font-size: .74rem; letter-spacing: .06em; }
.spreadrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 6px 0 14px; }
.spreadrow .mini { width: 78px; text-align: center; text-decoration: none; color: var(--paper); }
.spreadrow .mini .face { border-radius: 6px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(240,201,106,.4); }
.spreadrow .mini .face img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.spreadrow .mini .face.rev img { transform: rotate(180deg); }
.spreadrow .mini small { display: block; margin-top: 6px; color: var(--gold-2); font-family: var(--serif); font-size: .74rem; letter-spacing: .06em; }
.spreadrow .mini b { display: block; font-family: var(--serif); font-size: .86rem; font-weight: 600; line-height: 1.3; }
.spreadrow .mini b i { font-style: normal; color: #d9735f; font-size: .72rem; margin-left: 2px; }
.spsum { margin: 0; padding-left: 0; list-style: none; }
.spsum li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.spsum li b { font-family: var(--serif); color: var(--accent); margin-right: 8px; }
@media (prefers-reduced-motion: reduce) { .tcard, .slot .face { transition: none; } }
/* 塔羅：看大圖 */
.tbig { width: min(74vw, 320px); cursor: zoom-in; }
@media (hover: hover) {
  .tbig:hover { transform: scale(1.04); }
  .spreadrow .mini .face { transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
  .spreadrow .mini:hover .face { transform: scale(2.1); z-index: 5; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.7), 0 0 0 1px rgba(240,201,106,.7); }
  .spreadrow .mini:hover .face.rev img { transform: rotate(180deg); }
}
.spreadrow .mini { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(8,6,14,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; opacity: 0; transition: opacity .25s; cursor: zoom-out; }
.lb.in { opacity: 1; }
.lbcard { width: min(88vw, calc(78vh * 2 / 3)); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.8), 0 0 0 1px rgba(240,201,106,.5); transform: scale(.92); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.lb.in .lbcard { transform: scale(1); }
.lbcard img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.lbcard.rev img { transform: rotate(180deg); }
.lbcap { margin: 0; font-family: var(--serif); color: var(--gold-2); letter-spacing: .08em; }
.lbcap a { color: var(--accent); }
/* 願境題辭：淚體短語 */
.tzblock .tz.ph { display: inline-block; height: 1.15em; vertical-align: -0.2em; margin: .22em 0; }
.epigraph summary .serif .tz.ph { height: 1.2em; }
.tzblock .ph { display: inline; }
.tzblock .tz.ph { max-width: 100%; }

/* 塔羅：牌陣入口與選擇頁 */
.spbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.spbtn small { font-size: .72rem; color: var(--mute); letter-spacing: .04em; font-weight: 400; }
.spnow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 10px; font-size: .95rem; }
.spnow b { font-family: var(--serif); color: var(--gold-2); }
.spnow a { margin-left: auto; color: var(--accent); text-decoration: none; font-size: .9rem; }
.spguide { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 16px; }
.spguide .pill { text-decoration: none; color: var(--paper); border-color: var(--line); }
.spguide .pill:hover { border-color: var(--accent); color: var(--gold-2); }
.splist { display: grid; gap: 12px; }
.spitem { display: block; text-decoration: none; color: var(--paper); padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); transition: border-color .2s, transform .2s; }
.spitem:hover { border-color: var(--accent); transform: translateY(-2px); }
.spitem.on { border-color: var(--accent); background: var(--accent-soft); }
.spitem .sphead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spitem h3 { margin: 0; font-family: var(--serif); font-size: 1.15rem; color: var(--gold-2); }
.spitem p { margin: 6px 0 0; }
.spitem .form { color: var(--paper); }
.spitem .pos { color: var(--accent); letter-spacing: .04em; }
.slots { max-width: 420px; margin-left: auto; margin-right: auto; }
/* 有牌背圖時（public/img/tarot/back.webp）：牌背、翻牌前的面都用它 */
.tback .tcard, .tback .slot.filled .face .b { background: #1a1430 url(img/tarot/back.webp) center / cover no-repeat; box-shadow: 0 4px 12px rgba(0,0,0,.5); border-color: rgba(240,201,106,.6); }
.tback .fan.fanned .tcard.hov { box-shadow: 0 0 18px rgba(180,139,230,.6), 0 0 0 1px rgba(240,201,106,.9); }
.tback .fan.fanned .tcard.picked { box-shadow: 0 0 22px rgba(240,201,106,.6), 0 0 0 1px rgba(240,201,106,.9); }
/* 牌背中央的「賦」（淚體外框圖，金色） */
.tcard, .slot.filled .face .b { display: flex; align-items: center; justify-content: center; }
.tz.fu { height: 1.6em; width: 1.6em; color: #e6c37a; opacity: .92; filter: drop-shadow(0 0 4px rgba(240,201,106,.5)); pointer-events: none; }
.slot .face .b .tz.fu { height: 1.9em; width: 1.9em; }
.fan.shuffling .tz.fu { opacity: .6; }
.slot:not(.filled) .face .b .tz.fu { display: none; }
/* 牌背圖的中央圓章：賦字依牌寬縮放、對準圓章 */
.tback .tz.fu { width: 30%; height: auto; aspect-ratio: 1; transform: translateY(-5%); opacity: 1; filter: drop-shadow(0 0 3px rgba(240,201,106,.45)); }
.tback .slot .face .b .tz.fu { width: 30%; height: auto; }
/* 塔羅：自己洗牌（牌攤在桌上，手指繞圈推動） */
.fan.mix { cursor: grab; }
.fan.mix .tcard { transition: none; z-index: auto; transform-origin: 50% 50%; }
.fan.mix::before { opacity: 1; }
.mixbtns { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 6px 0 10px; }
.mixbtns .btn { width: auto; padding: 10px 22px; }
/* 洗牌引導弧 */
.fan .guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; overflow: visible; }
.fan .g-arc { fill: none; stroke: rgba(240,201,106,.55); stroke-width: 1.5; stroke-dasharray: 4 7; stroke-linecap: round; }
.fan .g-dot { fill: #f0c96a; filter: drop-shadow(0 0 6px rgba(240,201,106,.9)); }
.fan .g-txt { fill: rgba(240,201,106,.75); font-family: var(--serif); font-size: 13px; letter-spacing: .1em; }
.fan.tracing .g-dot { display: none; }
.fan.tracing .g-arc { stroke: rgba(180,139,230,.75); }
/* 爻圖＋程式畫的陰陽短槓 */
.ybwrap { flex: 0 0 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ybar.mini { width: 30px; height: 5px; }
.ybar.mini i.gap { flex: 0 0 5px; }
/* 分享結果 */
.sharebtn { margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.sharebtn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sharebtn .tz { height: 1.15em; }
/* 兩層結果頁、主題面向、其他起卦方式、更多牌陣、精簡問題行 */
.facets { margin-top: 8px; } .facets > summary { cursor: pointer; list-style: none; } .facets > summary::-webkit-details-marker { display: none; }
.facets > summary::after { content: "　＋"; color: var(--accent); } .facets[open] > summary::after { content: "　－"; }
.morechips { display: inline-flex; align-items: center; } .morechips > summary { list-style: none; cursor: pointer; }
.morechips > summary::-webkit-details-marker { display: none; }
.chip-more { display: inline-block; padding: 7px 12px; border: 1px dashed var(--line); border-radius: 999px; font-size: .85rem; color: var(--mute); }
.morechips[open] > summary { display: none; } .morechips .chips { margin-top: 0; }
details.source.deep { margin-top: 22px; }
details.source.spmore .splist { margin-top: 12px; }
.qbox.compact textarea, .qbox.compact label { display: none; }
.qbox .qline { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--serif); color: var(--gold-2); }
.qbox .qline .pill { margin-left: auto; cursor: pointer; }
main .ask .qbox.compact { padding: 12px 14px; min-height: 0; }
/* 大殿：先問，再選門 */
.hallask { margin-top: 18px; } .hallask .cats { margin-top: 10px; }
.doors-hint { margin: 18px 0 -8px; letter-spacing: .2em; }
main .ask.hallask .qbox textarea { padding-top: 42px; min-height: 100px; }
/* 分享圖預覽 */
.lb.share .lbcard.img { width: min(86vw, calc(70vh * 4 / 5)); } .lb.share .lbcard.img img { aspect-ratio: 4 / 5; }
.lb.share .lbcap .btn { display: inline-block; padding: 10px 22px; }
/* 分享圖預覽：長籤（9:16）也放得下 */
.lb.share .lbcard.img { width: auto; max-width: 86vw; } .lb.share .lbcard.img img { width: auto; height: auto; max-width: 86vw; max-height: 70vh; aspect-ratio: auto; }
/* 選牌陣頁：「你的問題像是……」與第一個牌陣之間多一行空白 */
.spguide { margin-bottom: 34px; }
/* 點爻彈窗：這一爻的圖（圓形遮罩＋金環） */
.ypop-img { float: right; width: 112px; height: 112px; margin: 0 0 8px 12px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px rgba(230,195,122,.85), 0 0 18px rgba(216,183,110,.35); background: #14112a; }
.ypop-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ypop::after { content: ""; display: block; clear: both; }
@media (max-width: 380px) { .ypop-img { width: 92px; height: 92px; } }
/* 易經・爻圖鑑 */
.tilemode { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; }
.tilemode button { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--paper); font-size: .85rem; cursor: pointer; }
.tilemode button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--gold-2); }
.ysym { font-size: 1.15em; margin-right: 4px; }
.yaohero { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; }
.yaocard { flex: 0 0 112px; display: block; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.5), 0 0 0 1px rgba(201,169,97,.4); }
.yaocard img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.yaohero .lead { margin: 0 0 12px; font-size: 1rem; line-height: 1.8; color: var(--gold-2); }
.yaofull { display: inline-block; width: auto; padding: 9px 16px; }
.yaotitle { margin: 26px 0 6px; font-family: var(--serif); font-size: 1.1rem; letter-spacing: .15em; color: var(--gold-2); }
.yaotitle small { font-size: .78rem; letter-spacing: .04em; font-family: var(--sans); }
.yaolist { margin-top: 10px; }
.yaorow { position: relative; display: grid; grid-template-columns: 104px 1fr; gap: 14px; padding: 6px 0 22px; }
.yaorow::before { content: ""; position: absolute; left: 51px; top: 112px; bottom: -6px; width: 2px; background: linear-gradient(rgba(216,183,110,.55), rgba(216,183,110,.08)); }
.yaorow:last-child::before { display: none; }
.yaorail { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.yaobadge { width: 100px; height: 100px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #2c244f, #14112a); box-shadow: 0 0 0 2px rgba(230,195,122,.85), 0 0 22px rgba(216,183,110,.3); }
.yaobadge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yaobadge.noimg i { font-style: normal; color: var(--gold-2); font-size: 1.8rem; }
.yaorail .ybar.mini { width: 34px; height: 5px; }
.yaotext { min-width: 0; padding-top: 4px; }
.yaohead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.yaohead b { font-size: 1.15rem; color: var(--gold-2); letter-spacing: .1em; }
.yaohead small { color: var(--mute); font-size: .78rem; letter-spacing: .04em; }
.yaoplain { margin: 6px 0 4px; font-size: 1.02rem; line-height: 1.75; }
.yaoadv { margin: 0 0 6px; }
.yaomore { margin-top: 4px; }
.yaomore summary { cursor: pointer; list-style: none; } .yaomore summary::-webkit-details-marker { display: none; }
.yaomore summary::after { content: "　＋"; color: var(--accent); } .yaomore[open] summary::after { content: "　－"; }
.yaomore blockquote { margin: 8px 0; }
.yaorow.extra .yaobadge { box-shadow: 0 0 0 2px rgba(230,195,122,.5); }
.yaonav { display: flex; gap: 10px; margin: 8px 0 18px; } .yaonav .btn { flex: 1; text-align: center; padding: 10px 8px; }
@media (max-width: 400px) { .yaorow { grid-template-columns: 84px 1fr; gap: 10px; } .yaobadge { width: 80px; height: 80px; } .yaorow::before { left: 41px; top: 92px; } .yaocard { flex-basis: 92px; } }
/* 爻圖鑑標題區：背景圖上的字加底影，避免被主圖蓋住 */
.hero.prop.scene.small .kicker, .hero.prop.scene.small .title-l, .hero.prop.scene.small .small.mute { text-shadow: 0 2px 10px rgba(0,0,0,.85), 0 0 3px rgba(0,0,0,.8); }
.hero.prop.scene.small .kicker { color: var(--gold-2); }
/* 爻圖鑑：沒有爻圖時，圓框裡畫大大的陰陽爻符號（學習用） */
.yaobadge.noimg { flex-direction: column; gap: 6px; align-content: center; background: radial-gradient(circle at 50% 38%, #2c244f, #14112a); }
.yaobadge.noimg { display: flex; align-items: center; justify-content: center; }
.ybar.big { width: 58px; height: 11px; }
.ybar.big i { flex: 1; background: #e6cf8f; border-radius: 3px; box-shadow: 0 0 10px rgba(255,214,110,.55); }
.ybar.big i.gap { flex: 0 0 12px; background: transparent; box-shadow: none; }
.yaobadge.noimg small { color: var(--gold-2); font-family: var(--serif); font-size: .95rem; letter-spacing: .2em; }
@media (max-width: 400px) { .ybar.big { width: 48px; height: 9px; } .ybar.big i.gap { flex-basis: 10px; } }
/* 爻圖鑑頁首：卦象圖（六條爻由上到下，標爻名，可點） */
.yaohero { flex-wrap: wrap; }
.yaofig { flex: 0 0 168px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, rgba(42,35,80,.5), rgba(20,17,15,.6)); }
.yaofig-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; color: var(--gold-2); }
.yaofig-h b { font-size: 1.05rem; letter-spacing: .1em; }
.yf { display: grid; grid-template-columns: 44px 1fr 22px; align-items: center; gap: 8px; width: 100%; padding: 5px 4px; border: 0; background: transparent; color: var(--paper); cursor: pointer; border-radius: 8px; font-family: var(--serif); }
.yf:hover, .yf:focus-visible { background: var(--accent-soft); outline: none; }
.yfn { font-size: .92rem; letter-spacing: .08em; color: var(--gold-2); text-align: left; }
.yfk { font-size: .72rem; color: var(--mute); }
.ybar.big2 { width: 100%; max-width: 70px; height: 11px; }
.ybar.big2 i { flex: 1; background: #e6cf8f; border-radius: 3px; box-shadow: 0 0 8px rgba(255,214,110,.5); }
.ybar.big2 i.gap { flex: 0 0 12px; background: transparent; box-shadow: none; }
.yaofig-n { margin: 8px 0 0; line-height: 1.5; }
.yaohero-t { flex: 1 1 220px; min-width: 0; }
.yaorow.pulse .yaobadge { animation: yaopulse 1.3s ease-out; }
.yaorow.pulse .yaohead b { text-shadow: 0 0 14px rgba(240,201,106,.9); }
@keyframes yaopulse { 0% { box-shadow: 0 0 0 2px rgba(230,195,122,.85), 0 0 0 0 rgba(230,195,122,.7); } 100% { box-shadow: 0 0 0 2px rgba(230,195,122,.85), 0 0 0 26px rgba(230,195,122,0); } }
@media (max-width: 400px) { .yaofig { flex-basis: 100%; } }
/* 爻之間的連結 */
.yaolink { display: inline-block; margin: 8px 0 2px; color: var(--accent); font-size: .92rem; text-decoration: none; }
.yaolink:hover { text-decoration: underline; }
.yaoentry { text-decoration: none; color: var(--gold-2); border-color: var(--gold-2); margin-right: 8px; white-space: nowrap; }
.yhint-row { flex-wrap: wrap; }
/* 爻圖鑑：排列方向（預設初爻在最下、往上讀），箭頭與層數標示 */
.yaoorder { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.yaoorder button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--paper); font-size: .84rem; cursor: pointer; }
.yaoorder button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--gold-2); }
.yaolayer { margin-left: auto; font-style: normal; color: var(--accent); font-size: .74rem; letter-spacing: .08em; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.yaolist.up .yaorow::before { background: linear-gradient(rgba(216,183,110,.12), rgba(216,183,110,.6)); }
.yaolist.up .yaorow:not(:last-child)::after, .yaolist.down .yaorow:not(:last-child)::after { position: absolute; left: 43px; bottom: -4px; width: 18px; text-align: center; color: var(--gold-2); font-size: .72rem; line-height: 1; }
.yaolist.up .yaorow:not(:last-child)::after { content: "▲"; }
.yaolist.down .yaorow:not(:last-child)::after { content: "▼"; }
@media (max-width: 400px) { .yaolist .yaorow:not(:last-child)::after { left: 33px; } }
/* ── 爻圖鑑「蓋房子」：初爻是地基在最下面，一層一層往上蓋，上爻是屋頂 ── */
.yaolist.up { --taper: 16px; position: relative; }
.yaolist.up .ytower { display: flex; flex-direction: column; align-items: center; }
.yaolist.up .yaorow { width: calc(100% - var(--n) * var(--taper)); margin: 0; padding: 18px 16px 16px 14px; position: relative; box-sizing: border-box;
  border: 2px solid rgba(201,169,97,.7); border-top: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 26px, rgba(0,0,0,.2) 26px 28px), linear-gradient(180deg, rgba(48,40,86,.6), rgba(20,17,42,.9)); }
/* 屋簷：每層樓上緣一條向兩側伸出的金色橫簷 */
.yaolist.up .yaorow::before { content: ""; display: block; position: absolute; left: -12px; right: -12px; top: -9px; bottom: auto; width: auto; height: 9px; border-radius: 5px 5px 2px 2px; background: linear-gradient(#f0d78f, #a8843d); box-shadow: 0 4px 10px rgba(0,0,0,.55); }
.yaolist.up .yaorow:last-child::before { display: block; }
.yaolist.up .yaorow::after { display: none !important; }
.yaolist.up .yaorow[data-pos="1"] { border-bottom-width: 4px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 46px, rgba(0,0,0,.28) 46px 48px), linear-gradient(180deg, rgba(58,50,38,.9), rgba(30,26,20,.95)); }
.yaolist.up .yaorow[data-pos="5"] .yaobadge { box-shadow: 0 0 0 2px rgba(240,215,143,.95), 0 0 30px rgba(240,215,143,.55); }
.yaolist.up .yaorow.fade { animation: yrise .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--n) * .14s); }
@keyframes yrise { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }
/* 屋頂：飛簷屋頂加金色塔尖，最後才出現 */
.yaolist.up .yroof { position: relative; height: 84px; margin: 22px auto -9px; width: calc(100% - 6 * var(--taper) + 56px); clip-path: polygon(50% 0, 60% 30%, 80% 62%, 100% 84%, 100% 100%, 0 100%, 0 84%, 20% 62%, 40% 30%); background: linear-gradient(180deg, #f6dc94, #a8843d 70%, #6f5526); animation: yfade .6s ease both; animation-delay: .95s; }
.yaolist.up .yroof i { position: absolute; left: 50%; top: 0; width: 3px; height: 14px; margin-left: -1.5px; background: #f6dc94; }
@keyframes yfade { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
/* 地基 */
.yaolist.up .yground { height: 30px; margin: 0 -14px; border-top: 4px solid #a8843d; border-radius: 0 0 6px 6px; background: repeating-linear-gradient(90deg, #3a3226 0 44px, #2a241b 44px 46px); display: grid; place-items: center; }
.yaolist.up .yground span { font-family: var(--serif); letter-spacing: .5em; font-size: .78rem; color: var(--gold-2); }
.yaolist.up .yaolayer { background: rgba(0,0,0,.28); border-color: rgba(201,169,97,.5); color: var(--gold-2); }
.yaolist.up .yaorow .yaorail .ybar { margin-top: 2px; }
@media (max-width: 460px) { .yaolist.up { --taper: 9px; } .yaolist.up .yaorow { padding: 16px 10px 14px 8px; grid-template-columns: 74px 1fr; gap: 10px; } .yaolist.up .yaobadge { width: 72px; height: 72px; } .yaolist.up .yaobadge.noimg small { font-size: .8rem; } .ybar.big { width: 42px; height: 8px; } .ybar.big i.gap { flex-basis: 8px; } .yaolist.up .yroof { width: calc(100% - 6 * var(--taper) + 40px); height: 64px; } }
@media (prefers-reduced-motion: reduce) { .yaolist.up .yaorow.fade, .yaolist.up .yroof { animation: none; } }
/* ── 爻圖鑑：左邊固定一棟小房子導覽，右邊乾淨的說明卡（初爻在最下，往上蓋）── */
.yaostage.up { margin: 10px 0 24px; padding: 0; border: 0; background: none; box-shadow: none; }
.yaogrid.up { display: grid; grid-template-columns: minmax(210px, 36%) 1fr; gap: 24px; align-items: start; }
.tnav { position: sticky; top: 76px; align-self: start; }
.tnav-in { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid rgba(201,169,97,.5); box-shadow: 0 14px 40px rgba(0,0,0,.5); background: #1a1430; }
.tnav-in img { display: block; width: 100%; height: auto; }
.tband { position: absolute; left: 0; right: 0; height: 7.8%; border: 0; padding: 4px 0 0 8px; background: transparent; cursor: pointer; text-align: left; transition: background .25s, box-shadow .25s; }
.tband span { font-family: var(--serif); font-size: .76rem; letter-spacing: .06em; color: #f6e7bd; opacity: 0; transition: opacity .2s; text-shadow: 0 1px 6px #000; }
.tband:hover span, .tband:focus-visible span, .tband.on span { opacity: 1; }
.tband:hover { background: rgba(255,190,90,.14); }
.tband.on { background: linear-gradient(90deg, rgba(255,200,110,.42), rgba(255,200,110,.2) 60%, rgba(255,200,110,.08)); box-shadow: inset 0 0 0 1.5px rgba(255,214,140,.9), 0 0 18px rgba(255,190,90,.55); }
.tband:focus-visible { outline: 2px solid #f0d78f; outline-offset: -2px; }
.yaogrid.up .yaolist.up { display: grid; gap: 14px; min-width: 0; }
.yaogrid.up .ytower { display: grid; gap: 14px; }
.yaogrid.up .yaorow, .yaogrid.up .yaorow[data-pos="1"] { width: 100%; margin: 0; padding: 16px 16px 14px 14px; border: 1px solid rgba(201,169,97,.28); border-left: 3px solid rgba(201,169,97,.55); border-radius: 14px; background: rgba(24,19,48,.82); transition: border-color .25s, box-shadow .25s, background .25s; }
.yaogrid.up .yaorow::before, .yaogrid.up .yaorow::after { display: none; }
.yaogrid.up .yaorow.now { border-color: rgba(240,215,143,.85); border-left-color: #f0d78f; background: rgba(40,31,76,.9); box-shadow: 0 0 0 1px rgba(240,215,143,.25), 0 10px 30px rgba(0,0,0,.4); }
@media (max-width: 640px) { .yaogrid.up { grid-template-columns: 30% 1fr; gap: 10px; } .tnav { top: 64px; } .tnav-in { border-radius: 10px; } .tband { padding-left: 3px; } .tband span { font-size: .56rem; } .yaogrid.up .yaorow { padding: 12px 10px 10px 10px; grid-template-columns: 1fr; } .yaogrid.up .yaorail { display: none; } }
.yaogrid.up .yaorow:last-child::before { display: none !important; }

/* 精簡：一張卡＝爻名＋陰陽＋一句白話，原文與建議收起來 */
.yaogrid.up .yaorow { grid-template-columns: 1fr; gap: 6px; padding: 14px 16px 12px; }
.yaogrid.up .yaohead { display: flex; align-items: center; gap: 12px; }
.yaogrid.up .yaohead b { font-size: 1.15rem; color: var(--gold-2); }
.yaogrid.up .yaoplain { margin: 0; font-size: 1.02rem; line-height: 1.7; }
.yaogrid.up .yaomore { margin-top: 2px; }
.yaogrid.up .yaoadv { margin: 6px 0 0; color: var(--gold-2); }
.yaogrid.up .yaoadv::before { content: "建議："; opacity: .7; }

/* 爻圖鑑用粉圓體（OFL）；原文＝金色，白話＝白，參考建議收起 */
@font-face { font-family: 'Huninn'; src: url(fonts/openhuninn.woff2?v=2) format('woff2'); font-display: swap; }
.yaostage { font-family: 'Huninn', var(--sans, "Noto Sans TC", sans-serif); }
.yaostage .yaohead b, .yaostage .yaotext1, .yaostage .yaoplain, .yaostage .yaoadv, .yaostage summary, .yaostage .yaotitle { font-family: 'Huninn', "Noto Sans TC", sans-serif; }
.yaogrid.up .yaotext1 { margin: 2px 0 0; font-size: .98rem; line-height: 1.7; color: var(--gold-2); letter-spacing: .04em; }
.yaogrid.up .yaoplain { color: #f1ecff; }
.yaogrid.up .yaoplain::before { content: "白話　"; font-size: .74rem; opacity: .55; letter-spacing: .08em; }
.yaogrid.up .yaoadv::before { content: ""; }

.yaocopy { justify-self: start; margin-top: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(201,169,97,.5); background: transparent; color: var(--gold-2); font-family: 'Huninn', sans-serif; cursor: pointer; }
.yaocopy:hover, .yaocopy:focus-visible { background: rgba(201,169,97,.16); }

/* ── 擲筊（卜杯）：GPT 畫的朱紅漆木筊杯；圓面朝上＝紅色凸面，平面朝上＝淺木色平面 ── */
.jb-wrap { display: grid; justify-items: center; gap: 12px; }
.jb-ask { margin: 0; font-family: var(--serif); letter-spacing: .12em; color: var(--gold-2); }
.jb-stage { display: flex; gap: 22px; height: 210px; align-items: flex-end; padding-bottom: 6px; }
.jb { display: block; width: 130px; height: 120px; }
.jb b { display: block; width: 100%; height: 100%; background: url(img/block/convex.webp?v=1) center / contain no-repeat; filter: drop-shadow(0 8px 10px rgba(0,0,0,.55)); }
.jb.flat b { background-image: url(img/block/flat.webp?v=1); }
.jb.m b { transform: scaleX(-1); }
.jb-dots { display: flex; gap: 10px; }
.jb-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(240,215,143,.7); transition: background .3s, box-shadow .3s; }
.jb-dots span.on { background: #f0d78f; box-shadow: 0 0 10px rgba(240,215,143,.8); }
.jb-msg { margin: 0; min-height: 1.6em; color: #efe7ff; letter-spacing: .06em; }
.jb-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.jb-skip { background: none; border: 0; color: var(--mute, #a89fc4); text-decoration: underline; cursor: pointer; font: inherit; font-size: .88rem; }
.jb-skip:disabled, #jbtoss:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: reduce) { .jb { transition: none; } }

/* 擲筊＝走進神明廳：全螢幕蓋住頁面，廟的圖在上、卜杯落在下方空白的石板地 */
.jb-hall { position: fixed; inset: 0; z-index: 70; background: #0b0a10; display: flex; justify-content: center; opacity: 0; transition: opacity .45s; }
.jb-hall.in { opacity: 1; }
.jb-room { position: relative; height: 100%; aspect-ratio: 2 / 3; max-width: 100vw; background: #0b0a10 center top / cover no-repeat; display: flex; align-items: flex-end; justify-content: center; }
.jb-room::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 45% at 50% 38%, rgba(255,186,110,.22), rgba(255,186,110,0) 70%), linear-gradient(180deg, rgba(10,8,14,0) 55%, rgba(10,8,14,.48) 100%); pointer-events: none; }
.jb-room { filter: brightness(1.14) saturate(1.06); }
.jb-room .jb-wrap { filter: brightness(.88); }   /* 文字與按鈕不要跟著被提亮 */
.jb-room .jb-wrap { position: relative; padding: 0 16px max(22px, env(safe-area-inset-bottom)); width: 100%; }
.jb-room .jb-stage { height: 190px; }
.jb-room .jb-ask, .jb-room .jb-msg { text-shadow: 0 1px 8px rgba(0,0,0,.9); }
@media (max-height: 700px) { .jb-room .jb-stage { height: 150px; } .jb { width: 104px; height: 96px; } }
@media (prefers-reduced-motion: reduce) { .jb-hall { transition: none; } }
.jb-room .jb-ask { background: rgba(10,8,14,.62); padding: 6px 14px; border-radius: 999px; font-size: .95rem; }

/* 香火繚繞：廟裡蒙一層薄薄的煙。三縷煙從供桌前慢慢往上飄、左右輕晃，只動 transform 與 opacity（省電）；整層再罩一層暖白薄霧 */
.jb-haze { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,236,214,.06) 0%, rgba(255,232,205,.13) 40%, rgba(255,228,200,.09) 64%, rgba(255,228,200,0) 92%);
  -webkit-backdrop-filter: blur(.7px) saturate(.96); backdrop-filter: blur(.7px) saturate(.96); }
.jb-haze i { position: absolute; left: 50%; bottom: 22%; width: 78%; height: 46%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,242,226,.62), rgba(255,236,214,.26) 45%, rgba(255,236,214,0) 72%);
  filter: blur(22px); opacity: 0; transform: translate(-50%, 0) scale(.7); will-change: transform, opacity;
  animation: jb-smoke 26s ease-in-out infinite; }
.jb-haze i:nth-child(2) { width: 62%; height: 40%; left: 38%; animation-duration: 31s; animation-delay: -12s; }
.jb-haze i:nth-child(3) { width: 70%; height: 36%; left: 62%; animation-duration: 36s; animation-delay: -24s; }
@keyframes jb-smoke {
  0%   { opacity: 0;   transform: translate(-50%, 6%)   scale(.7)  rotate(0deg); }
  18%  { opacity: .9;  transform: translate(-46%, -14%) scale(.92) rotate(3deg); }
  55%  { opacity: .55; transform: translate(-56%, -48%) scale(1.15) rotate(-4deg); }
  85%  { opacity: .15; transform: translate(-48%, -82%) scale(1.35) rotate(2deg); }
  100% { opacity: 0;   transform: translate(-50%, -100%) scale(1.45) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) { .jb-haze i { animation: none; opacity: .5; transform: translate(-50%, -40%) scale(1.1); } }
.jb-room .jb-stage { height: 175px; }

/* 學習者密碼門 */
.pwgate { position: fixed; inset: 0; z-index: 80; background: rgba(6,5,10,.72); display: grid; place-items: center; padding: 20px; }
.pwbox { width: min(100%, 360px); background: #16122a; border: 1px solid rgba(201,169,97,.5); border-radius: 16px; padding: 22px 20px 18px; display: grid; gap: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.pwbox b { font-size: 1.15rem; color: var(--gold-2); letter-spacing: .1em; }
.pwbox input { font: inherit; font-size: 1.2rem; letter-spacing: .3em; text-align: center; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(201,169,97,.45); background: rgba(0,0,0,.35); color: #fff; }
.pwbox .pwerr { min-height: 1.2em; color: #f0a0a0; margin: 0; }
.pwbox .row { display: flex; gap: 8px; } .pwbox .row .btn { flex: 1; }
.pwbox.shake { animation: pwshake .35s; }
@keyframes pwshake { 0%,100% { transform: none; } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.modebox .ystyle { margin-top: 8px; }
.spmore { margin: 14px 0 0; text-align: center; }

/* 使用者模式的摺疊層 */
details.fold { margin: 6px 0 10px; border: 1px dashed rgba(201,169,97,.35); border-radius: 12px; padding: 0 14px; }
details.fold > summary { cursor: pointer; padding: 10px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "＋"; margin-left: auto; color: var(--gold-2); }
details.fold[open] > summary::after { content: "－"; }
details.fold > .layer, details.fold > .story { margin-top: 0; }
details.fold > .layer .layer-h { display: none; }

/* 大殿：閱讀模式開關 */
.hero.hall, .gate { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }   /* 長按暗門：不要跳出選取／儲存圖片 */
.pwbox .ystyle { justify-content: center; } .pwbox .ystyle .chip { padding: 9px 18px; font-size: 1rem; }

/* 學習者的門：星空密碼（沿用班表的芝麻開門） */
.sesame { position: fixed; inset: 0; z-index: 90; background: radial-gradient(120% 90% at 50% 30%, #2E2A46, #1A1628 80%); display: flex; flex-direction: column; align-items: center; opacity: 0; transition: opacity .4s; }
.sesame.in { opacity: 1; }
.sesame-x { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); right: 18px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05); color: #9C8FA8; font: inherit; cursor: pointer; }
.sesame-title { font-family: var(--serif); color: #E6DBC2; font-size: 1rem; letter-spacing: .14em; margin-top: calc(env(safe-area-inset-top, 0px) + 70px); text-align: center; text-shadow: 0 0 20px rgba(240,220,168,.3); }
.sesame-dots { display: flex; gap: 14px; margin-top: 18px; height: 16px; }
.sesame-dots span { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #6B6388; transition: all .25s; }
.sesame-dots span.on { background: radial-gradient(circle, #FFF6D8, #E0A95C); border-color: #F4E3B2; box-shadow: 0 0 12px rgba(244,227,178,.8); transform: scale(1.15); }
.sesame-err { min-height: 1.4em; margin: 10px 0 0; color: #CFC8E0; font-size: .9rem; letter-spacing: .08em; }
.sesame-sky { position: relative; flex: 1; width: 100%; max-width: 420px; margin: 0 auto; }
.nstar { position: absolute; width: 52px; height: 52px; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.nstar svg { width: 100%; height: 100%; overflow: visible; }
.nstar .sp { fill: rgba(244,238,219,.2); stroke: rgba(201,168,106,.55); stroke-width: .7; stroke-linejoin: round; transition: all .3s; }
.nstar .nn { fill: #CFC8E0; font-family: var(--mono, ui-monospace, monospace); font-size: 7.5px; font-weight: 700; transition: fill .3s; }
.nstar.lit .sp { fill: #F4E3B2; stroke: #F4E3B2; filter: drop-shadow(0 0 8px rgba(244,227,178,.9)); }
.nstar.lit .nn { fill: #3A2E14; }
.nstar.glow { animation: nsTwinkle 2.6s ease-in-out infinite; }
.nstar.deco { opacity: .5; pointer-events: none; width: 36px; height: 36px; }
@keyframes nsTwinkle { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
.nstar:active { transform: translate(-50%, -50%) scale(.88); }
.sesame.fail .sesame-sky { animation: sesShake .4s; }
@keyframes sesShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .nstar.glow, .sesame.fail .sesame-sky { animation: none; } }

.jb-note { margin: 4px 0 0; font-size: .74rem; letter-spacing: .06em; color: rgba(239,231,255,.55); text-align: center; }
.jb-room .jb-note { text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.jb-msg .small { opacity: .8; }

.copyrow .gptlink { display: inline-block; margin-top: 10px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(201,169,97,.45); color: var(--gold-2); font-size: .9rem; text-decoration: none; letter-spacing: .04em; }
.copyrow .gptlink:hover, .copyrow .gptlink:focus-visible { background: rgba(201,169,97,.14); }

.result-actions.row { display: block; } .result-actions .btn { width: 100%; display: block; text-align: center; }   /* 只剩「再求一籤」一顆，撐滿一行 */

.actions .row > .btn:only-child { flex: 1; width: 100%; }   /* 使用者模式只剩「我的紀錄」時撐滿 */

/* 白天 JoJo 版神明廳：拿掉夜晚版的提亮濾鏡，下方改成柔和的深色底讓白字讀得清楚 */
.jb-room { filter: none; }
.jb-room .jb-wrap { filter: none; }
.jb-room::before { background: linear-gradient(180deg, rgba(24,16,10,0) 52%, rgba(24,16,10,.42) 68%, rgba(24,16,10,.72) 100%); }
.jb-room .jb-ask { background: rgba(24,16,10,.66); color: #f6e7bd; }

/* 結果頁上方：改用明亮圖，遮罩只在下緣接黑底，上半保持亮 */
.hero.result-hero::before { background: linear-gradient(180deg, rgba(20,17,15,.12) 0%, rgba(20,17,15,0) 30%, rgba(20,17,15,.35) 62%, rgba(20,17,15,.85) 88%, var(--ink) 100%); }
/* 擲筊內容整組往下：卜杯落在石板地上，不壓到供桌 */
.jb-room .jb-wrap { gap: 6px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.jb-room .jb-stage { height: 128px; padding-bottom: 0; }
.jb-room .jb { width: 112px; height: 104px; }
.jb-room .jb-dots { margin-top: 2px; }
.jb-room .jb-msg { font-size: .92rem; line-height: 1.45; }
.jb-room .jb-actions { gap: 6px; }
.jb-room #jbtoss { padding: 10px 34px; }
.jb-room .jb-ask { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; }
.jb-room .jb-wrap { position: static; }
.jb-room .jb-wrap > * { position: relative; z-index: 1; }
.jb-room .jb-wrap > .jb-ask { position: absolute; z-index: 2; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); transform: translateX(-50%); }
.jb-room .jb-stage { height: 104px; }
.jb-room .jb { width: 100px; height: 92px; }
.jb-room .jb-msg { line-height: 1.35; }
.jb-room .jb-note { margin-top: 0; }
.jb-room .jb-skip { padding: 2px 0; }
/* 籤落下的終點再往下一點（150px → 200px） */
@keyframes stick-fall { 0% { transform: translateY(-40px) rotate(-6deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: translateY(200px) rotate(78deg); opacity: 1; } }
/* 「再問神明……」放到卜杯上方 */
.jb-room .jb-msg { order: -1; margin-bottom: 2px; }
.jb-room .jb-msg { background: rgba(24,16,10,.58); padding: 5px 14px; border-radius: 14px; }   /* 壓在供桌下緣也讀得清楚 */

/* 精緻的籤：竹片打磨的金黃本體、朱漆籤頭、金線、竹節，籤號用國字直書紅字 */
.stick-drop:not(.tarot) { width: 20px; height: 136px; margin-left: -10px; border-radius: 3px 3px 10px 10px; overflow: hidden;
  background: linear-gradient(90deg, #a87a33 0%, #e7c983 22%, #fff3cf 48%, #f0d797 62%, #b98a3e 100%);
  box-shadow: inset 0 0 0 1px rgba(92,60,18,.55), 0 8px 16px rgba(0,0,0,.55), 0 0 14px rgba(255,214,140,.35);
  color: #9a1f12; font-size: .64rem; font-weight: 700; letter-spacing: .05em; justify-content: flex-start; padding-top: 26px; box-sizing: border-box; }
.stick-drop:not(.tarot)::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 20px; background: linear-gradient(90deg, #6e0f0a, #c9301e 48%, #e04a2c 55%, #6e0f0a); border-bottom: 2px solid #e8c56a; }
.stick-drop:not(.tarot)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 3px; background: linear-gradient(90deg, rgba(92,60,18,.65), rgba(92,60,18,.25) 50%, rgba(92,60,18,.65)); }
.stick-drop .sk-no { position: relative; z-index: 1; text-shadow: 0 0 1px rgba(255,240,200,.8); }
.stick-drop.guren { background: linear-gradient(90deg, #b9a67a 0%, #efe3c6 45%, #e2d3ae 62%, #a8946a 100%); }

/* 籤筒搖動：幅度加大、節奏明顯 */
.prop-stage.shaking .prop-img { animation: prop-shake2 .38s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes prop-shake2 { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-5deg) translateX(-6px); } 50% { transform: rotate(4deg) translateX(5px) translateY(-3px); } 80% { transform: rotate(-3deg) translateX(-3px); } }
@media (prefers-reduced-motion: reduce) { .prop-stage.shaking .prop-img { animation: none; } }
/* 擲筊排版：提問往上（可壓在供桌上）、卜杯稍上、圓點緊貼卜杯、和按鈕之間留空 */
.jb-room .jb-msg { margin-bottom: 26px; }
.jb-room .jb-dots { margin-top: -4px; margin-bottom: 16px; }
/* 搖動放慢；手機上籤的落點略高一點 */
.prop-stage.shaking .prop-img { animation-duration: .72s; }
@keyframes stick-fall-m { 0% { transform: translateY(-40px) rotate(-6deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: translateY(165px) rotate(78deg); opacity: 1; } }
@media (max-width: 480px) { .stick-drop { animation-name: stick-fall-m; } }
/* 擲筊排版對齊：每一塊都置中、文字置中、上下間距一致 */
.jb-room .jb-wrap { justify-items: center; text-align: center; }
.jb-room .jb-msg { text-align: center; width: max-content; max-width: calc(100% - 32px); margin: 0 auto 22px; padding: 6px 16px; }
.jb-room .jb-msg .small { display: block; margin-top: 2px; }
.jb-room .jb-stage { width: 100%; justify-content: center; gap: 18px; }
.jb-room .jb-dots { justify-content: center; margin: 0 auto 18px; }
.jb-room .jb-actions { width: 100%; align-items: center; }
.jb-room .jb-note { width: 100%; text-align: center; }
.jb-room #jbtoss { width: auto; min-width: 150px; padding: 10px 36px; }
.jb-room .jb-msg { white-space: nowrap; font-size: .88rem; background: rgba(24,16,10,.62); }   /* 第一行不要斷成「的？」單獨一行 */

.ritual-ack { transition: opacity .6s ease, transform .6s ease; }   /* 「此問已達。」淡入淡出放慢 */
/* 卜杯往上、靠近提問文字 */
.jb-room .jb-msg { margin-bottom: 8px; }
.jb-room .jb-dots { margin-bottom: 30px; }
.jb-room .jb-stage { height: 94px; }

/* 易經：小象與文言的白話 */
.lx.tr, .tr { color: var(--mute); }
.wenyan p { margin: 6px 0; }
.wenyan p + p.small { margin: 2px 0 12px; }

/* ───────── 願望符印（願境第三條路，sigil.js） ───────── */
.wish-path.sigil .glyph { color: #cfd8ff; text-shadow: 0 0 14px rgba(180,200,255,.55); }
@media (min-width: 720px) { .wish-paths { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 481px) and (max-width: 719px) { .wish-path.sigil { grid-column: 1 / -1; } }
.sg-hero { min-height: 34vh; }
.sg-stage { margin-top: 18px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #f4eddf; transition: background .25s; }
.sg-stage svg { display: block; width: 100%; height: auto; }
.sg-stage svg .seg { transition: stroke-width .15s, opacity .15s; }
.sg-stage svg .seg.hl { stroke-width: 6 !important; }
.sg-stage svg.dim .seg:not(.hl) { opacity: .22; }
.sg-stage svg.dim .node:not(.hl) { opacity: .35; }
.sg-stage svg .node { cursor: pointer; }
.sg-bgs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.sg-bgs button { width: 46px; height: 46px; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid var(--line); background: var(--ink-2); color: var(--mute); font-size: .8rem; display: grid; place-items: center; }
.sg-bgs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-bgs button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--accent); }
.sg-grp { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.sg-lbl { font-size: .8rem; letter-spacing: .1em; color: var(--mute); }
.sg-opts { padding: 14px 16px 16px; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 14px; }
.sg-opts .sg-grp:first-child { margin-top: 0; }
.sg-opts input[type=range] { accent-color: var(--accent); width: 100%; }
.sg-readings { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; max-height: 280px; overflow: auto; }
@media (max-width: 380px) { .sg-readings { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sg-read { display: flex; flex-direction: column; gap: 3px; align-items: center; padding: 7px 4px 5px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); min-width: 0; }
.sg-read:hover, .sg-read.hl { border-color: var(--accent); }
.sg-read strong { font-size: 1.3rem; font-weight: 500; line-height: 1.2; }
.sg-read input { width: 100%; min-width: 0; text-align: center; font: inherit; font-size: .85rem; padding: 4px 2px; color: var(--paper); background: rgba(20,17,15,.5); border: 1px solid var(--line); border-radius: 7px; outline: none; }
.sg-read input:focus { border-color: var(--accent); }
.sg-read .src { font-size: .65rem; color: var(--mute); letter-spacing: .05em; }
.sg-read.unknown { border-color: #e88a6a; } .sg-read.unknown input { color: #e88a6a; }
.sg-read.tw .src { color: #9fd0a4; } .sg-read.manual .src { color: var(--gold-2); }
.sg-seq { margin: 4px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); font-size: .95rem; letter-spacing: .14em; line-height: 1.9; word-break: break-all; }
.sg-seq s { color: var(--mute); }
.sg-brief { margin-top: 18px; padding: 14px 16px; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.sg-zy { margin: 0 0 4px; font-size: 1.05rem; letter-spacing: .12em; line-height: 1.9; color: var(--gold-2); word-break: break-all; }
.sg-coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.sg-coll .it { display: flex; flex-direction: column; gap: 3px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); min-width: 0; }
.sg-coll .it svg { width: 100%; height: auto; display: block; border-radius: 6px; cursor: pointer; }
.sg-coll .it .t { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-coll .it .d { font-size: .7rem; color: var(--mute); }
.sg-coll .it .b { display: flex; gap: 6px; }
.sg-coll .it .b button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: .75rem; color: var(--mute); }
.sg-coll .it .b button:hover { border-color: var(--accent); color: var(--gold-2); }
.sg-toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; padding: 8px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); font-size: .9rem; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: calc(100% - 32px); }
.sg-toast.show { opacity: 1; }
.sg-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sg-modal { width: min(95vw, 460px); max-height: 96vh; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.sg-modal img { width: min(100%, 340px); border-radius: 8px; background: #fff; -webkit-touch-callout: default; }
@media (prefers-reduced-motion: reduce) { .sg-stage svg .seg { transition: none; } }

.sg-presets { justify-content: center; margin-top: 8px; }
.sg-presets .chip { font-size: .8rem; }
