/* 🙏 หน้าขอพร (B4) · สีจาก themes.css · โต๊ะบูชา = ฉากกลางคืนสีคงที่ทั้ง 2 ธีม (เปลวเทียนต้องเห็นชัด) */
/* ① รายชื่อองค์ */
.gods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.god {
  font: inherit; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px 12px;
  border: 2px solid var(--card-line); border-radius: calc(var(--card-radius) - 4px);
  background: var(--field); color: var(--card-ink);
}
.god[data-id="birthday"] { grid-column: span 2; } /* 7 องค์ = เด่น 1 + คู่ 3 แถว ไม่มีช่องค้าง */
.god .emblem { width: 64px; height: 64px; }
.god b { font-size: 16px; line-height: 1.3; }
.god small { font-size: 12.5px; color: var(--card-mute); line-height: 1.35; }
.god[aria-pressed="true"] { border-color: var(--gold); outline: 3px solid var(--gold); outline-offset: 1px; }
.god:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ② เขียนคำอธิษฐาน */
.bday { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 12px; font-size: 14px; color: var(--accent); }
.wlabel { display: block; font-weight: 600; font-size: 17px; margin-top: 10px; }
.wish { width: 100%; resize: vertical; line-height: 1.5; min-height: 104px; }
.count { margin: 2px 0 0; text-align: right; font-size: 12px; color: var(--card-mute); }
.care { background: #fdecea; color: #7b241c; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 10px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.wmsg { margin: 8px 0 0; font-size: 14px; color: var(--bad); min-height: 1em; }

/* ③ โต๊ะบูชา */
.altar-wrap { position: relative; max-width: 340px; margin: 4px auto 0; }
.altar { display: block; width: 100%; height: auto; border-radius: 14px; }
.ritual-hint { text-align: center; font-size: 14px; color: var(--card-mute); margin: 10px 0; min-height: 1.6em; }
.ritual-ctl { display: flex; gap: 8px; max-width: 340px; margin: 0 auto; }
.ritual-ctl .step-btn { flex: 1; }
.snd-btn {
  flex: none; width: 48px; font-size: 20px; cursor: pointer;
  border: 2px solid var(--card-line); border-radius: var(--chip-radius); background: var(--field);
}

.altar .flame { opacity: 0; transition: opacity .6s; }
.altar.lit .flame { opacity: 1; animation: flicker 1.1s ease-in-out infinite alternate; }
@keyframes flicker {
  0% { transform: scale(1, 1) rotate(-2deg); }
  50% { transform: scale(.94, 1.06) rotate(1.5deg); }
  100% { transform: scale(1.04, .96) rotate(-1deg); }
}

.altar .ember, .altar .smoke { opacity: 0; }
.altar.incensed .ember { opacity: 1; animation: ember 1.6s ease-in-out infinite alternate; }
@keyframes ember { from { fill: #ff5a1f; } to { fill: #ffb238; } }
.altar.incensed .smoke { animation: smoke 3.6s linear infinite; }
.altar.incensed .s1 { animation-delay: 1.2s; }
.altar.incensed .s2 { animation-delay: 2.4s; }
@keyframes smoke {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: .6; }
  100% { opacity: 0; transform: translateY(-46px); }
}

.altar .flower { transform: scale(0); transition: transform .7s cubic-bezier(.3, 1.6, .5, 1); }
.altar.offered .flower { transform: scale(1); }

.altar .emb-glow { opacity: 0; transition: opacity 1.2s; }
.altar.prayed .emb-glow { animation: glow 2.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .35; } to { opacity: 1; } }
.altar .rays { transform-box: fill-box; transform-origin: center; }
.altar.prayed .rays { animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.altar .spark { opacity: 0; }
.altar.prayed .spark { animation: spark 2.2s ease-out infinite; }
@keyframes spark {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), -150px); }
}

.wish-float {
  position: absolute; left: 8%; right: 8%; top: 58%;
  text-align: center; font-size: 15px; line-height: 1.45; color: #fff3c4;
  text-shadow: 0 0 8px rgba(255, 200, 90, .9), 0 1px 2px #000;
  opacity: 0; pointer-events: none;
}
.altar-wrap.prayed .wish-float { animation: rise 3.4s ease-in forwards; }
@keyframes rise {
  0% { opacity: 0; transform: translateY(0) scale(1); }
  20% { opacity: 1; }
  80% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-150px) scale(.8); }
}

/* ④ การ์ด */
.wcard { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 12px; border-radius: 10px; box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
.card-ctl { display: grid; gap: 8px; max-width: 360px; margin: 0 auto; }

@media (min-width: 640px) {
  .gods { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .altar *, .wish-float { animation: none !important; transition: none !important; }
  .altar.prayed .emb-glow, .altar-wrap.prayed .wish-float { opacity: .9; }
}
