/* =====================================================================
   ทายใจจากคำถาม (ask.html) — ลูกแก้วเรืองแสง + หมอก
   ===================================================================== */
.ak-stage { overflow: hidden; background: radial-gradient(420px 260px at 50% 18%, rgba(185, 150, 236, .22), transparent 70%), linear-gradient(160deg, rgba(58, 29, 99, .65), rgba(20, 9, 38, .85)); }

/* ---------- ลูกแก้ว ---------- */
.ak-orb-wrap { position: relative; width: 210px; height: 262px; margin: 0 auto 6px; }
.ak-aura { position: absolute; left: 50%; top: 100px; width: 300px; height: 300px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(185, 150, 236, .35), rgba(227, 194, 122, .08) 45%, transparent 68%); animation: akAura 4s ease-in-out infinite; pointer-events: none; }
@keyframes akAura { 0%, 100% { opacity: .65; transform: translate(-50%, -50%) scale(.94); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } }
.ak-orb {
  position: absolute; left: 50%; top: 4px; width: 196px; height: 196px; transform: translateX(-50%); border-radius: 50%; overflow: hidden; isolation: isolate;
  background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .5), transparent 22%), radial-gradient(circle at 50% 60%, #6c47b8 0%, #3a1d70 45%, #160a2e 80%);
  box-shadow: inset 0 0 40px rgba(217, 200, 245, .45), inset -12px -18px 40px rgba(10, 4, 22, .8), 0 0 0 2px rgba(255, 241, 201, .25), 0 0 50px rgba(185, 150, 236, .45);
  transition: box-shadow .6s;
}
.ak-mist { position: absolute; inset: -30%; border-radius: 50%; mix-blend-mode: screen; filter: blur(14px); opacity: .7; }
.ak-mist.m1 { background: radial-gradient(ellipse 40% 26% at 40% 55%, rgba(217, 200, 245, .7), transparent 70%); animation: akSwirl 9s linear infinite; }
.ak-mist.m2 { background: radial-gradient(ellipse 34% 22% at 60% 45%, rgba(143, 208, 255, .45), transparent 70%); animation: akSwirl 13s linear infinite reverse; }
.ak-mist.m3 { background: radial-gradient(ellipse 30% 20% at 50% 62%, rgba(245, 223, 166, .4), transparent 70%); animation: akSwirl 17s linear infinite; }
@keyframes akSwirl { to { transform: rotate(360deg); } }
.ak-shine { position: absolute; left: 22%; top: 14%; width: 30%; height: 18%; border-radius: 50%; background: radial-gradient(ellipse, rgba(255, 255, 255, .7), transparent 70%); transform: rotate(-30deg); }
.ak-orb-text { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; font-family: var(--font-head); font-weight: 700; color: #fff6d8; text-shadow: 0 0 18px rgba(245, 223, 166, .9), 0 0 4px rgba(0, 0, 0, .5); font-size: 1.05rem; line-height: 1.35; opacity: 0; transform: scale(.8); transition: opacity .6s, transform .6s var(--ease); z-index: 2; }
.ak-orb-text.show { opacity: 1; transform: none; }
.ak-orb-text.big { font-size: 2rem; }
.ak-base { position: absolute; left: 50%; bottom: 0; width: 170px; transform: translateX(-50%); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .6)); }
.ak-sp { position: absolute; width: 10px; height: 10px; background: #f5dfa6; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 2.4s ease-in-out infinite; }
.ak-sp.s1 { left: 4px; top: 30px; } .ak-sp.s2 { right: 0; top: 70px; animation-delay: .6s; width: 7px; height: 7px; }
.ak-sp.s3 { left: 18px; top: 160px; animation-delay: 1.2s; width: 6px; height: 6px; } .ak-sp.s4 { right: 16px; top: 8px; animation-delay: 1.8s; }

/* สถานะกำลังตั้งจิต */
.ak-orb-wrap.thinking .ak-orb { box-shadow: inset 0 0 60px rgba(245, 223, 166, .7), inset -12px -18px 40px rgba(10, 4, 22, .6), 0 0 0 2px rgba(255, 241, 201, .5), 0 0 90px 10px rgba(227, 194, 122, .6); }
.ak-orb-wrap.thinking .ak-mist { opacity: 1; animation-duration: 2.2s; }
.ak-orb-wrap.thinking .ak-aura { animation-duration: 1s; }
.ak-orb-wrap.thinking { animation: akHover 1.2s ease-in-out infinite; }
@keyframes akHover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.ak-orb-wrap.answered .ak-orb { box-shadow: inset 0 0 50px rgba(245, 223, 166, .55), inset -12px -18px 40px rgba(10, 4, 22, .7), 0 0 0 2px rgba(255, 241, 201, .4), 0 0 70px rgba(227, 194, 122, .45); }

/* ---------- ฟอร์ม ---------- */
.ak-form { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.ak-input { min-height: 54px; font-size: 1.05rem; text-align: center; border-radius: 999px; }
.ak-count { font-size: .78rem; text-align: center; }
.ak-pop-h { font-size: .84rem; text-align: center; margin: 4px 0 0; }
.ak-pop { gap: 6px; }
.ak-pop .chip { font-size: .84rem; padding: 7px 13px; min-height: 40px; white-space: normal; text-align: left; }
.ak-form.is-busy { opacity: .55; pointer-events: none; }

/* ---------- คำตอบ ---------- */
.ak-answer { margin-top: 20px; }
.ak-ans { text-align: center; }
.ak-q { margin: 6px auto 14px; max-width: 520px; font-size: 1.08rem; }
.ak-q::before, .ak-q::after { content: '“'; color: var(--gold); font-size: 1.4em; line-height: 0; vertical-align: -.2em; margin-right: 4px; }
.ak-q::after { content: '”'; margin: 0 0 0 4px; }
.ak-verdict { display: inline-flex; flex-direction: column; align-items: center; padding: 14px 34px 12px; border-radius: 26px; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 0, rgba(227, 194, 122, .2), transparent 70%); margin-bottom: 12px; }
.ak-verdict b { font-family: var(--font-head); font-size: 2.6rem; line-height: 1.25; }
.ak-verdict small { color: var(--text-3); font-size: .82rem; letter-spacing: .1em; }
.ak-verdict.yes b { background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ak-verdict.cond b { background: linear-gradient(180deg, #ffe7c2, #f2b46b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ak-verdict.wait b { background: linear-gradient(180deg, #e8deff, #b996ec); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ak-verdict.no b { background: linear-gradient(180deg, #d9ecff, #8fb8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ak-head { font-family: var(--font-head); font-size: 1.25rem; margin: 4px 0 6px; color: var(--text); }
.ak-body { text-align: left; }
.ak-body p { color: var(--text-2); }
.ak-body h3 { font-size: 1rem; color: var(--gold-2); display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; }
.ak-body h3 svg { width: 18px; height: 18px; }

/* ---------- ประวัติ ---------- */
.ak-hist { display: grid; gap: 8px; }
.ak-hi { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-soft); }
.ak-hi-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }
.ak-hi-main b { display: block; font-weight: 400; overflow-wrap: anywhere; line-height: 1.45; }
.ak-hi-main small { color: var(--text-3); font-size: .78rem; }
.ak-hi .badge { flex: none; }
.ak-hi .icon-btn { width: 40px; height: 40px; flex: none; }
.ak-hi .icon-btn svg { width: 16px; height: 16px; }
#ak-clear svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .ak-aura, .ak-mist, .ak-sp, .ak-orb-wrap.thinking { animation: none !important; }
}
@media (max-width: 639px) {
  .ak-pop.chip-row.wrap { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 8px; margin: 0 -4px; }
  .ak-pop .chip { white-space: nowrap; }
}
