/* ===== 抽選儀式 / 翻牌 / 凝神思考 ===== */
.result-panel { position: relative; }
.ceremony-stage { display: flex; align-items: center; justify-content: center; min-height: 190px; }
.ceremony { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
/* 凝神呼吸光球(抽牌前的靜心節拍) */
.focus-orb {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #fff 0%, var(--gold-soft) 16%, var(--purple) 62%, #241c52 100%);
  box-shadow: 0 0 46px 10px rgba(141,123,200,.4), 0 0 80px 20px rgba(212,175,106,.12);
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(.82); opacity: .7; filter: brightness(.9); }
  50% { transform: scale(1.12); opacity: 1; filter: brightness(1.15); }
}
.diviner-hand {
  position: absolute; top: 6px; font-size: 34px; pointer-events: none; z-index: 3;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); animation: handHover 2.3s ease-in-out infinite;
}
@keyframes handHover {
  0%, 100% { transform: translate(-32px, 8px) rotate(-9deg); }
  50% { transform: translate(30px, -10px) rotate(9deg); }
}
.cer-bubble {
  position: relative; background: rgba(20,16,40,.88); border: 1px solid var(--gold);
  color: var(--gold-soft); padding: 8px 16px; border-radius: 14px; font-size: 15px; letter-spacing: 1px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: bubblePop .3s ease;
}
.cer-bubble::after {
  content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: rgba(20,16,40,.88); border-left: 1px solid var(--gold); border-top: 1px solid var(--gold);
}
@keyframes bubblePop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.reveal-bubble {
  position: absolute; right: 18px; top: 8px; z-index: 6;
  background: linear-gradient(160deg, #2a2150, #15112a); border: 1px solid var(--gold-soft);
  color: var(--gold-soft); padding: 8px 16px; border-radius: 16px 16px 16px 4px; font-size: 17px; letter-spacing: 2px;
  box-shadow: 0 8px 22px rgba(0,0,0,.5); animation: revealBubble 2.6s ease forwards;
}
@keyframes revealBubble {
  0% { opacity: 0; transform: translateY(8px) scale(.9); }
  12% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.thinking-dots { display: flex; gap: 9px; align-items: center; justify-content: center; height: 42px; }
.thinking-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); opacity: .35; animation: thinkDot 1.2s ease-in-out infinite; }
.thinking-dots span:nth-child(2) { animation-delay: .2s; }
.thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes thinkDot { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } }

/* 多輪續聊對話 */
.followup { margin-top: 22px; border-top: 1px solid rgba(141,123,200,.2); padding-top: 18px; }
.chat-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.chat-bubble { max-width: 86%; padding: 11px 15px; border-radius: 14px; font-size: 15px; line-height: 1.75; white-space: pre-wrap; animation: bubblePop .25s ease; }
.chat-user { align-self: flex-end; background: linear-gradient(160deg, var(--gold), #c79a4f); color: #1a1430; border-bottom-right-radius: 4px; }
.chat-diviner { align-self: flex-start; background: rgba(255,255,255,.05); border: 1px solid rgba(141,123,200,.3); color: var(--text); border-bottom-left-radius: 4px; }
.chat-input-row { display: flex; gap: 8px; }
#chatInput { flex: 1; background: rgba(0,0,0,.25); border: 1px solid rgba(141,123,200,.3); border-radius: 12px; color: var(--text); padding: 12px 14px; font-size: 15px; font-family: inherit; }
#chatInput:focus { outline: none; border-color: var(--gold); }
.chat-send { width: 48px; border: none; border-radius: 12px; background: linear-gradient(120deg, var(--gold), #c79a4f); color: #1a1430; font-size: 20px; font-weight: 800; cursor: pointer; transition: filter .15s; }
.chat-send:hover { filter: brightness(1.08); }
.chat-hint { font-size: 12px; color: var(--text-dim); margin-top: 10px; text-align: center; }
.chat-dots { display: inline-flex; gap: 5px; padding: 3px 0; }
.chat-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: .4; animation: thinkDot 1.2s ease-in-out infinite; }
.chat-dots span:nth-child(2) { animation-delay: .2s; }
.chat-dots span:nth-child(3) { animation-delay: .4s; }

/* 八種占卜各自的等待動畫 (純 DOM+CSS, 零圖檔). 容器 .divining-stage 由 app.js 注入對應 HTML. */
.divining-stage { height: 124px; display: flex; align-items: center; justify-content: center; }
.dv { position: relative; width: 124px; height: 124px; }

/* 共用 keyframes */
@keyframes dvSpin { to { transform: rotate(360deg); } }
@keyframes dvPulse { 0%, 100% { opacity: .5; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.12); } }

/* 1. 塔羅: 三張蓋牌懸浮 */
.dv-tarot .dv-card {
  position: absolute; left: 45px; top: 30px; width: 34px; height: 54px; border-radius: 5px; overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  transform: translateX(var(--x)) rotate(var(--r));
  animation: dvCard 1.9s ease-in-out infinite; animation-delay: var(--d);
}
.dv-tarot .dv-card svg { width: 100%; height: 100%; display: block; }
.dv-tarot .dv-card:nth-child(1) { --x: -26px; --r: -16deg; --d: 0s; }
.dv-tarot .dv-card:nth-child(2) { --x: 0px; --r: 0deg; --d: .3s; }
.dv-tarot .dv-card:nth-child(3) { --x: 26px; --r: 16deg; --d: .6s; }
@keyframes dvCard {
  0%, 100% { transform: translateX(var(--x)) translateY(0) rotate(var(--r)); }
  50% { transform: translateX(var(--x)) translateY(-12px) rotate(var(--r)); box-shadow: 0 0 18px rgba(212,175,106,.7); }
}

/* 2. 易經: 三枚銅錢翻轉落下 */
.dv-iching { display: flex; gap: 9px; align-items: center; justify-content: center; }
.dv-iching .dv-coin {
  width: 30px; height: 30px; position: relative;
  animation: dvCoin 1s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
.dv-iching .dv-coin svg { width: 100%; height: 100%; display: block; }
.dv-iching .dv-coin:nth-child(2) { animation-delay: .15s; }
.dv-iching .dv-coin:nth-child(3) { animation-delay: .3s; }
@keyframes dvCoin {
  0% { transform: translateY(-10px) rotateY(0); }
  50% { transform: translateY(6px) rotateY(180deg); }
  100% { transform: translateY(-10px) rotateY(360deg); }
}

/* 3. 求籤: 籤筒搖晃 + 紅筊 */
.dv-oracle .dv-tube {
  position: absolute; left: 26px; top: 16px; width: 32px; height: 58px;
  background: linear-gradient(#6b4a2a, #3e2a16); border: 1px solid #8a6a3a; border-radius: 4px 4px 9px 9px;
  transform-origin: bottom center; animation: dvShake .34s ease-in-out infinite;
}
.dv-oracle .dv-tube i { position: absolute; top: -16px; width: 3px; height: 24px; background: linear-gradient(#ece0b8, #b89a5a); border-radius: 2px; }
.dv-oracle .dv-tube i:nth-child(1) { left: 5px; } .dv-oracle .dv-tube i:nth-child(2) { left: 12px; top: -19px; }
.dv-oracle .dv-tube i:nth-child(3) { left: 19px; } .dv-oracle .dv-tube i:nth-child(4) { left: 26px; top: -17px; }
@keyframes dvShake { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.dv-oracle .dv-jiao {
  position: absolute; bottom: 12px; width: 20px; height: 12px; background: #c0392b;
  border-radius: 0 0 14px 14px; box-shadow: inset 0 2px 3px rgba(0,0,0,.3);
}
.dv-oracle .dv-jiao { left: 74px; animation: dvJiao 1.1s ease-in-out infinite; }
.dv-oracle .dv-jiao.r { left: 96px; animation-delay: .25s; }
@keyframes dvJiao { 0%, 100% { transform: rotateX(0) translateY(0); } 50% { transform: rotateX(160deg) translateY(-8px); } }

/* 4. 八字: 太極旋轉 + 八方點 */
.dv-bazi .dv-taiji {
  position: absolute; left: 32px; top: 32px; width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(90deg, #ece8ff 50%, #241c52 50%); animation: dvSpin 3.2s linear infinite;
}
.dv-bazi .dv-taiji::before, .dv-bazi .dv-taiji::after { content: ""; position: absolute; left: 21px; width: 18px; height: 18px; border-radius: 50%; }
.dv-bazi .dv-taiji::before { top: 3px; background: #241c52; }
.dv-bazi .dv-taiji::after { bottom: 3px; background: #ece8ff; }
.dv-bazi .dv-bagua {
  position: absolute; left: 59px; top: 59px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold);
  transform: rotate(calc(var(--i) * 45deg)) translateY(-54px); animation: dvPulse 2s ease-in-out infinite;
  animation-delay: calc(var(--i) * .14s);
}

/* 5. 農民曆: 日曆翻頁 */
.dv-almanac .dv-cal {
  position: absolute; left: 30px; top: 20px; width: 64px; height: 76px; border-radius: 6px;
  background: #f4f1ff; box-shadow: 0 4px 14px rgba(0,0,0,.45); perspective: 320px;
}
.dv-almanac .dv-cal::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 18px; background: #c0392b; border-radius: 6px 6px 0 0; }
.dv-almanac .dv-page {
  position: absolute; top: 18px; left: 0; right: 0; bottom: 0; background: linear-gradient(#fff, #e6e1f5);
  transform-origin: top center; animation: dvFlip 1.6s ease-in-out infinite; backface-visibility: hidden;
}
.dv-almanac .dv-page.p2 { animation-delay: .5s; } .dv-almanac .dv-page.p3 { animation-delay: 1s; }
@keyframes dvFlip { 0% { transform: rotateX(0); } 35%, 100% { transform: rotateX(-158deg); } }

/* 6. 星盤: 三層軌道反向旋轉 */
.dv-astro .dv-ring { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(141,123,200,.4); border-radius: 50%; transform: translate(-50%, -50%); }
.dv-astro .dv-ring::after { content: ""; position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-soft); box-shadow: 0 0 8px var(--gold); }
.dv-astro .dv-ring.r1 { width: 112px; height: 112px; border-top-color: var(--gold); animation: dvSpin 4.5s linear infinite; }
.dv-astro .dv-ring.r2 { width: 78px; height: 78px; border-left-color: var(--purple); animation: dvSpin 3s linear infinite reverse; }
.dv-astro .dv-ring.r3 { width: 46px; height: 46px; border-bottom-color: var(--gold-soft); animation: dvSpin 2s linear infinite; }
.dv-astro .dv-sun { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(#fff, var(--gold)); box-shadow: 0 0 16px var(--gold); animation: dvPulse 2s ease-in-out infinite; }

/* 7. 紫微: 十二星點順序點亮 */
.dv-ziwei .dv-zstar {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-soft);
  box-shadow: 0 0 6px var(--gold);
  transform: rotate(calc(var(--i) * 30deg)) translateY(-50px) scale(1);
  opacity: .22; animation: dvTwinkle 2.6s linear infinite; animation-delay: calc(var(--i) * .18s);
}
@keyframes dvTwinkle {
  0%, 78%, 100% { opacity: .22; }
  9% { opacity: 1; }
}

/* 8. 姓名學: 毛筆筆劃 + 落墨擴散 */
.dv-name .dv-ink {
  position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: rgba(30,26,60,.85); transform: translate(-50%, -50%) scale(0); animation: dvInk 2.6s ease-out infinite;
}
@keyframes dvInk { 0% { transform: translate(-50%, -50%) scale(0); opacity: .6; } 60% { opacity: .12; } 100% { transform: translate(-50%, -50%) scale(6.5); opacity: 0; } }
.dv-name .dv-stroke { position: absolute; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transform-origin: left center; }
.dv-name .dv-stroke.s1 { left: 34px; top: 66px; transform: rotate(-8deg); animation: dvWrite 1.8s ease-in-out infinite; }
.dv-name .dv-stroke.s2 { left: 52px; top: 30px; transform: rotate(72deg); animation: dvWrite 1.8s ease-in-out .5s infinite; }
@keyframes dvWrite { 0% { width: 0; opacity: 0; } 18% { opacity: 1; } 60% { width: 52px; } 100% { width: 52px; opacity: 0; } }
.dv-name .dv-brush { position: absolute; left: 62px; top: 40px; width: 5px; height: 16px; border-radius: 3px 3px 5px 5px; background: linear-gradient(#3a2a18, #111); animation: dvBrush 1.8s ease-in-out infinite; }
@keyframes dvBrush { 0%, 100% { transform: translate(-14px, 22px) rotate(8deg); } 50% { transform: translate(10px, -14px) rotate(8deg); } }
