/* ==========================================================================
   THEP DEVATA - ALTAR GAME & SHRINE SYSTEM (praying.html)
   หิ้งพระทิพย์จำลอง & มินิเกมจัดหิ้งพระตามลำดับชั้นศักดิ์สิทธิ์
   สอดคล้องกับ Cosmic Galaxy & Obsidian Gold Theme ของ thepdevata.com
   ========================================================================== */

/* --- Container & Stage --- */
.altar-main-container {
  position: relative;
  z-index: 2;
  padding-top: 100px;
  padding-bottom: 60px;
  min-height: 100vh;
}

.altar-hero-header {
  text-align: center;
  margin-bottom: 2rem;
}

.altar-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  padding: 0.4rem 1.2rem;
  border-radius: 50px;
  font-size: 0.88rem;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.altar-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.altar-hero-subtitle {
  color: var(--text-readable);
  font-size: 1.05rem;
  max-width: 780px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.6;
}

/* --- Mode Switcher Tabs --- */
.altar-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.altar-mode-btn {
  background: rgba(19, 5, 38, 0.75);
  border: 1px solid rgba(147, 51, 234, 0.4);
  color: var(--text-readable);
  padding: 0.65rem 1.4rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(8px);
}

.altar-mode-btn:hover {
  border-color: rgba(245, 158, 11, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.3);
}

.altar-mode-btn.active {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.5), rgba(217, 119, 6, 0.4));
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35);
}

/* --- Altar Controls Bar --- */
.altar-toolbar {
  background: rgba(18, 7, 36, 0.85);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 16px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.85rem;
  color: var(--text-muted-cosmic);
}

.theme-pill-btn, .pavilion-pill-btn, .size-pill-btn, .flower-pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.theme-pill-btn:hover, .theme-pill-btn.active,
.pavilion-pill-btn:hover, .pavilion-pill-btn.active,
.size-pill-btn:hover, .size-pill-btn.active,
.flower-pill-btn:hover, .flower-pill-btn.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.btn-cart-trigger {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(147, 51, 234, 0.35));
  border-color: #f59e0b !important;
  color: #fef08a !important;
  font-weight: 600;
}
.btn-cart-trigger:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.45), rgba(147, 51, 234, 0.55));
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.5);
}

/* ==========================================================================
   THE 3D SACRED ALTAR VIEWPORT & ARCHITECTURAL DOME PAVILIONS
   ========================================================================== */
.altar-3d-viewport {
  position: relative;
  user-select: none;
  cursor: grab;
  min-height: 660px;
  height: 670px;
  border-radius: 26px;
  padding: 0;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 50px rgba(245, 158, 11, 0.25);
  overflow: hidden;
  border: 2px solid rgba(245, 158, 11, 0.45);
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

.altar-3d-viewport.is-dragging {
  cursor: grabbing !important;
}

/* --- 1. Pavilion: ศาลาไทยพุทธมงคล (Thai Traditional Teak Pavilion) --- */
.altar-3d-viewport.pavilion-thai {
  background: radial-gradient(circle at 50% 15%, rgba(217, 119, 6, 0.28) 0%, rgba(30, 14, 5, 0.96) 75%),
              linear-gradient(180deg, #1c0f05 0%, #0c0502 100%);
  border-color: #b45309;
}
.altar-3d-viewport.pavilion-thai .pavilion-arch {
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 55px;
  background: radial-gradient(ellipse at 50% 0%, rgba(254, 240, 138, 0.35) 0%, rgba(245, 158, 11, 0.15) 50%, transparent 80%),
              linear-gradient(180deg, rgba(217, 119, 6, 0.4) 0%, transparent 100%);
  border-bottom: 2px solid rgba(254, 240, 138, 0.5);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 50% 80%, 8% 100%);
  pointer-events: none;
}
.altar-3d-viewport.pavilion-thai .pavilion-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(90deg, #451a03 0%, #92400e 30%, #fef08a 50%, #92400e 70%, #451a03 100%);
  border-left: 1px solid rgba(254, 240, 138, 0.4);
  border-right: 1px solid rgba(254, 240, 138, 0.4);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 1;
}
.altar-3d-viewport.pavilion-thai .pavilion-left { left: 16px; }
.altar-3d-viewport.pavilion-thai .pavilion-right { right: 16px; }

/* --- 2. Pavilion: วิหารแก้วคริสตัล (Crystal Glass Sanctuary Dome) --- */
.altar-3d-viewport.pavilion-crystal {
  background: radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.28) 0%, rgba(15, 23, 42, 0.98) 75%),
              linear-gradient(180deg, #082f49 0%, #030712 100%);
  border-color: #38bdf8;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 60px rgba(56, 189, 248, 0.35);
}
.altar-3d-viewport.pavilion-crystal .pavilion-arch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: radial-gradient(ellipse at 50% 0%, rgba(224, 242, 254, 0.6) 0%, rgba(56, 189, 248, 0.2) 60%, transparent 100%);
  border-bottom: 2px solid #7dd3fc;
  pointer-events: none;
}
.altar-3d-viewport.pavilion-crystal .pavilion-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, rgba(8, 47, 73, 0.8) 0%, rgba(56, 189, 248, 0.6) 30%, #ffffff 50%, rgba(56, 189, 248, 0.6) 70%, rgba(8, 47, 73, 0.8) 100%);
  border-left: 1px solid #bae6fd;
  border-right: 1px solid #bae6fd;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
  pointer-events: none;
  z-index: 1;
}
.altar-3d-viewport.pavilion-crystal .pavilion-left { left: 16px; }
.altar-3d-viewport.pavilion-crystal .pavilion-right { right: 16px; }

/* --- 3. Pavilion: มณฑปทองคำสุวรรณภูมิ (Golden Mondop Palace) --- */
.altar-3d-viewport.pavilion-gold {
  background: radial-gradient(circle at 50% 15%, rgba(251, 191, 36, 0.38) 0%, rgba(24, 12, 2, 0.96) 75%),
              linear-gradient(180deg, #2a1503 0%, #0d0601 100%);
  border-color: #fbbf24;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 65px rgba(245, 158, 11, 0.45);
}
.altar-3d-viewport.pavilion-gold .pavilion-arch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: radial-gradient(ellipse at 50% 0%, rgba(254, 240, 138, 0.6) 0%, rgba(217, 119, 6, 0.3) 65%, transparent 100%);
  border-bottom: 3px double #fef08a;
  pointer-events: none;
}
.altar-3d-viewport.pavilion-gold .pavilion-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  background: linear-gradient(90deg, #78350f 0%, #d97706 25%, #fef08a 50%, #d97706 75%, #78350f 100%);
  border-left: 2px solid #fef08a;
  border-right: 2px solid #fef08a;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
  pointer-events: none;
  z-index: 1;
}
.altar-3d-viewport.pavilion-gold .pavilion-left { left: 16px; }
.altar-3d-viewport.pavilion-gold .pavilion-right { right: 16px; }

/* --- 4. Pavilion: โดมแก้วจักรวาล (Cosmic Celestial Observatory) --- */
.altar-3d-viewport.pavilion-cosmic {
  background: radial-gradient(circle at 50% 25%, rgba(147, 51, 234, 0.4) 0%, rgba(10, 4, 20, 0.98) 75%),
              linear-gradient(180deg, #1e053a 0%, #030108 100%);
  border-color: #a855f7;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 60px rgba(168, 85, 247, 0.4);
}
.altar-3d-viewport.pavilion-cosmic .pavilion-arch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: radial-gradient(ellipse at 50% 0%, rgba(232, 121, 249, 0.5) 0%, rgba(147, 51, 234, 0.25) 50%, transparent 100%);
  border-bottom: 2px solid #e879f9;
  pointer-events: none;
}
.altar-3d-viewport.pavilion-cosmic .pavilion-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 26px;
  background: linear-gradient(90deg, #3b0764 0%, #9333ea 35%, #f5d0fe 50%, #9333ea 65%, #3b0764 100%);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.45);
  pointer-events: none;
  z-index: 1;
}
.altar-3d-viewport.pavilion-cosmic .pavilion-left { left: 16px; }
.altar-3d-viewport.pavilion-cosmic .pavilion-right { right: 16px; }

/* --- 5. Pavilion: วิหารหินอ่อนลักชูรี (White Carrara Marble Dome) --- */
.altar-3d-viewport.pavilion-marble {
  background: radial-gradient(circle at 50% 20%, rgba(226, 232, 240, 0.22) 0%, rgba(15, 23, 42, 0.96) 80%),
              linear-gradient(180deg, #1e293b 0%, #090d16 100%);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 50px rgba(245, 158, 11, 0.25);
}
.altar-3d-viewport.pavilion-marble .pavilion-arch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.4) 0%, rgba(203, 213, 225, 0.15) 60%, transparent 100%);
  border-bottom: 2px solid #fef08a;
  pointer-events: none;
}
.altar-3d-viewport.pavilion-marble .pavilion-column {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, #475569 0%, #cbd5e1 35%, #ffffff 50%, #cbd5e1 65%, #475569 100%);
  border-left: 1px solid #fef08a;
  border-right: 1px solid #fef08a;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 1;
}
.altar-3d-viewport.pavilion-marble .pavilion-left { left: 16px; }
.altar-3d-viewport.pavilion-marble .pavilion-right { right: 16px; }

/* Celestial Light Ray Beam */
.pavilion-celestial-beam {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 100%;
  background: radial-gradient(ellipse at 50% 10%, rgba(254, 240, 138, 0.16) 0%, rgba(245, 158, 11, 0.06) 45%, transparent 75%);
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   3D CAMERA FLOATING HUD (Camera Presets, Bowing, 360 Auto-Rotate)
   ========================================================================== */
.altar-3d-hud {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 30;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  pointer-events: none;
}

.hud-chip {
  background: rgba(14, 5, 28, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef08a;
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  white-space: nowrap;
}

.hud-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: rgba(14, 5, 28, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.42);
  padding: 0.32rem 0.45rem;
  border-radius: 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
  margin-left: auto;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #fef08a;
  width: auto;
  height: auto;
  min-height: 32px;
  padding: 0.3rem 0.68rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-btn:hover {
  background: rgba(245, 158, 11, 0.35);
  border-color: #f59e0b;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.hud-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000000;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
}

/* ==========================================================================
   3D SCENE & STEPPED DEPTH TIERS
   ========================================================================== */
.altar-3d-scene {
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
  transform-origin: 50% 50% -60px;
  transition: transform 0.08s ease-out;
  will-change: transform;
  width: 100%;
}

/* The Sacred Altar Stage Wrapper */
.altar-stage {
  position: relative;
  background: transparent;
  padding: 1.5rem 0.5rem;
  transform-style: preserve-3d;
}

/* Celestial Aura Behind Shrine */
.altar-stage::before {
  content: '';
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22) 0%, rgba(168, 85, 247, 0.15) 50%, transparent 75%);
  pointer-events: none;
  filter: blur(25px);
  z-index: 1;
}

/* Theme variations for Altar Stage */
.altar-stage.theme-marble {
  background: radial-gradient(circle at 50% 20%, rgba(217, 119, 6, 0.18) 0%, rgba(15, 23, 42, 0.95) 80%),
              linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(245, 158, 11, 0.4);
}

.altar-stage.theme-wood {
  background: radial-gradient(circle at 50% 15%, rgba(217, 119, 6, 0.25) 0%, rgba(20, 10, 5, 0.95) 85%),
              linear-gradient(180deg, #1c0f05 0%, #0c0602 100%);
  border-color: #b45309;
}

.altar-stage.theme-cosmic {
  background: radial-gradient(circle at 50% 25%, rgba(147, 51, 234, 0.35) 0%, rgba(5, 2, 10, 0.98) 85%);
  border-color: #a855f7;
}

/* --- The Tier Structure --- */
.altar-tiers-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.altar-tier {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tier Table Widths (Hierarchy from top to bottom) with 3D Depth Stepping */
.altar-tier {
  transform-style: preserve-3d;
  will-change: transform;
}
.altar-tier[data-tier="1"] { max-width: 400px; z-index: 7; transform: translateZ(-90px); }
.altar-tier[data-tier="2"] { max-width: 600px; z-index: 6; transform: translateZ(-65px); }
.altar-tier[data-tier="3"] { max-width: 720px; z-index: 5; transform: translateZ(-40px); }
.altar-tier[data-tier="4"] { max-width: 820px; z-index: 4; transform: translateZ(-15px); }
.altar-tier[data-tier="5"] { max-width: 890px; z-index: 3; transform: translateZ(10px); }
.altar-tier[data-tier="6"] { max-width: 950px; z-index: 2; transform: translateZ(35px); }
.altar-tier[data-tier="7"] { max-width: 1000px; z-index: 1; transform: translateZ(65px); }

/* --- Table Size Variations (เพื่อรองรับของไหว้ที่หลากหลาย) --- */
.table-size-wide .altar-tier[data-tier="1"] { max-width: 460px; }
.table-size-wide .altar-tier[data-tier="2"] { max-width: 720px; }
.table-size-wide .altar-tier[data-tier="3"] { max-width: 860px; }
.table-size-wide .altar-tier[data-tier="4"] { max-width: 980px; }
.table-size-wide .altar-tier[data-tier="5"] { max-width: 1060px; }
.table-size-wide .altar-tier[data-tier="6"] { max-width: 1140px; }
.table-size-wide .altar-tier[data-tier="7"] { max-width: 1180px; }

.table-size-grand .altar-tier[data-tier="1"] { max-width: 520px; }
.table-size-grand .altar-tier[data-tier="2"] { max-width: 820px; }
.table-size-grand .altar-tier[data-tier="3"] { max-width: 980px; }
.table-size-grand .altar-tier[data-tier="4"] { max-width: 1120px; }
.table-size-grand .altar-tier[data-tier="5"] { max-width: 1220px; }
.table-size-grand .altar-tier[data-tier="6"] { max-width: 1300px; }
.table-size-grand .altar-tier[data-tier="7"] { max-width: 1340px; }

/* Tier Badge / Hierarchy Label */
.tier-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(10, 4, 20, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef08a;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 0.35rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
}

.tier-header-badge:hover {
  background: rgba(245, 158, 11, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.tier-num {
  background: #f59e0b;
  color: #000000;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Statue Slots Row */
.tier-slots-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  min-height: 105px;
  position: relative;
  z-index: 3;
}

/* Individual Slot */
.altar-slot {
  position: relative;
  width: 86px;
  height: 100px;
  border: 1.5px dashed rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  background: rgba(20, 8, 40, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: visible;
}

.altar-slot:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.25);
}

.altar-slot.drag-over {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
  transform: scale(1.06);
}

.slot-empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(254, 240, 138, 0.6);
  font-size: 0.7rem;
  gap: 0.25rem;
  text-align: center;
  padding: 0.2rem;
  pointer-events: none;
}

.slot-empty-hint i {
  font-size: 1.25rem;
  color: rgba(245, 158, 11, 0.7);
}

/* Occupied Slot */
.altar-slot.has-item {
  border: 1.5px solid rgba(245, 158, 11, 0.75);
  background: radial-gradient(circle at 50% 60%, rgba(245, 158, 11, 0.2) 0%, rgba(20, 8, 40, 0.6) 80%);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.altar-slot.has-item:hover {
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.45);
}

.slot-statue-img {
  max-width: 90%;
  max-height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.45));
  transition: transform 0.2s;
  pointer-events: none;
}

.altar-slot:hover .slot-statue-img {
  transform: scale(1.05);
}

/* Special sizing for Top Buddha & Center Guardians */
.altar-tier[data-tier="1"] .altar-slot {
  width: 120px;
  height: 125px;
}
.altar-tier[data-tier="1"] .slot-statue-img {
  max-height: 105px;
  filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.85));
}

.slot-statue-name {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(10, 4, 20, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Remove button on slot */
.slot-remove-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  font-size: 0.65rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  z-index: 5;
  transition: transform 0.15s;
}

.altar-slot.has-item:hover .slot-remove-btn {
  display: flex;
}

.slot-remove-btn:hover {
  transform: scale(1.2);
  background: #dc2626;
}

/* --- The 3D Wooden Tier Shelf Table with Genuine Depth --- */
.tier-table-shelf {
  position: relative;
  width: 100%;
  height: 26px;
  background: linear-gradient(180deg, #b45309 0%, #78350f 45%, #451a03 100%);
  border-top: 2.5px solid #fef08a;
  border-bottom: 3px solid #1a0802;
  border-radius: 4px 4px 8px 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.9), inset 0 2px 3px rgba(254, 240, 138, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}

/* 3D Top Table Platform Surface */
.tier-table-shelf .tier-shelf-top {
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, rgba(254, 240, 138, 0.45) 0%, rgba(217, 119, 6, 0.9) 60%, #92400e 100%);
  transform-origin: bottom center;
  transform: rotateX(55deg);
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

/* Carved Filigree Gold Pattern Line */
.tier-table-shelf::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 12px;
  right: 12px;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #fef08a 25%, #f59e0b 50%, #fef08a 75%, transparent 100%);
  opacity: 0.85;
}

/* Table Legs / Relief Molding */
.tier-table-shelf::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 3%;
  right: 3%;
  height: 8px;
  background: linear-gradient(180deg, #451a03 0%, #150501 100%);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.85);
}

/* --- Theme 2: White Carrara Marble Table --- */
.theme-marble .tier-table-shelf {
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 45%, #64748b 100%);
  border-top-color: #fef08a;
  border-bottom-color: #334155;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.85), inset 0 2px 3px rgba(255, 255, 255, 0.9);
}
.theme-marble .tier-table-shelf .tier-shelf-top {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, #e2e8f0 70%, #94a3b8 100%);
}
.theme-marble .tier-table-shelf::after {
  background: #1e293b;
}

/* --- Theme 3: Luminous Crystal Glass Table --- */
.theme-crystal .tier-table-shelf {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.75) 0%, rgba(14, 116, 144, 0.85) 50%, rgba(8, 47, 73, 0.95) 100%);
  border-top-color: #bae6fd;
  border-bottom-color: #0369a1;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.4), inset 0 2px 5px rgba(255, 255, 255, 0.8);
}
.theme-crystal .tier-table-shelf .tier-shelf-top {
  background: linear-gradient(180deg, rgba(224, 242, 254, 0.9) 0%, rgba(56, 189, 248, 0.7) 70%, #0284c7 100%);
}
.theme-crystal .tier-table-shelf::after {
  background: #082f49;
  box-shadow: 0 6px 14px rgba(56, 189, 248, 0.35);
}

/* --- Theme 4: Imperial Gold Leaf Table (ปิดทองคำแท้) --- */
.theme-gold .tier-table-shelf {
  background: linear-gradient(180deg, #fef08a 0%, #f59e0b 40%, #b45309 80%, #78350f 100%);
  border-top-color: #ffffff;
  border-bottom-color: #451a03;
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.9);
}
.theme-gold .tier-table-shelf .tier-shelf-top {
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 50%, #d97706 100%);
}
.theme-gold .tier-table-shelf::after {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%);
  border-bottom: 2px solid #fef08a;
}

/* Cosmic Theme Shelf */
.theme-cosmic .tier-table-shelf {
  background: linear-gradient(180deg, #6b21a8 0%, #3b0764 50%, #1e0338 100%);
  border-top-color: #d8b4fe;
  border-bottom-color: #0f021c;
  box-shadow: 0 8px 20px rgba(107, 33, 168, 0.4);
}
.theme-cosmic .tier-table-shelf::after {
  background: #0f021c;
}

/* --- Tier 7: Sacred Offering Base Station --- */
.altar-offerings-base {
  width: 100%;
  background: rgba(15, 6, 30, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 18px;
  padding: 1.25rem 1rem;
  margin-top: 1rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(254, 240, 138, 0.2);
}

.offering-item-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.offering-item-unit:hover {
  transform: translateY(-3px);
}

.offering-img-wrap {
  position: relative;
  height: 75px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.offering-svg-icon {
  height: 65px;
  max-width: 85px;
  filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.35));
}

.offering-label-tag {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-readable);
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(147, 51, 234, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

/* Incense Smoke Animation */
.incense-smoke-particle {
  position: absolute;
  top: 0px;
  width: 6px;
  height: 6px;
  background: rgba(254, 240, 138, 0.5);
  border-radius: 50%;
  filter: blur(3px);
  animation: smokeAscend 3s infinite linear;
  pointer-events: none;
}

@keyframes smokeAscend {
  0% {
    transform: translateY(0) scale(1) translateX(0);
    opacity: 0.8;
  }
  30% {
    transform: translateY(-25px) scale(2.5) translateX(-8px);
    opacity: 0.6;
  }
  60% {
    transform: translateY(-55px) scale(4) translateX(12px);
    opacity: 0.3;
  }
  100% {
    transform: translateY(-90px) scale(6) translateX(-15px);
    opacity: 0;
  }
}

/* Candle Flame Flicker Animation */
.flame-active {
  animation: flameFlicker 1.8s infinite ease-in-out alternate;
}

@keyframes flameFlicker {
  0% { transform: scale(1) rotate(-1deg); filter: drop-shadow(0 0 10px #f59e0b); }
  50% { transform: scale(1.08, 0.95) rotate(1.5deg); filter: drop-shadow(0 0 16px #fbbf24); }
  100% { transform: scale(0.96, 1.04) rotate(-0.5deg); filter: drop-shadow(0 0 12px #f59e0b); }
}

/* --- Action Bottom Dock (Chant, Light, Reset, Save) --- */
.altar-actions-dock {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.dock-btn-pray {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #000000;
  border: 1px solid #fef08a;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}
.dock-btn-pray:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
}

.dock-btn-incense {
  background: rgba(147, 51, 234, 0.3);
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.5);
}
.dock-btn-incense:hover {
  background: rgba(147, 51, 234, 0.5);
  border-color: #f59e0b;
  transform: translateY(-2px);
}

.dock-btn-save {
  background: rgba(16, 185, 129, 0.25);
  color: #a7f3d0;
  border: 1px solid #10b981;
}
.dock-btn-save:hover {
  background: rgba(16, 185, 129, 0.45);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
}

.dock-btn-reset {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.dock-btn-reset:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* --- Section: Catalog Drawer & Filter Tabs --- */
.altar-catalog-section {
  background: rgba(18, 7, 36, 0.9);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  margin-top: 2.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.catalog-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: #fef08a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.catalog-search-wrap {
  position: relative;
  min-width: 240px;
}

.catalog-search-input {
  background: rgba(10, 4, 20, 0.85);
  border: 1px solid rgba(147, 51, 234, 0.4);
  color: #ffffff;
  border-radius: 10px;
  padding: 0.45rem 0.9rem 0.45rem 2.2rem;
  font-size: 0.88rem;
  width: 100%;
}
.catalog-search-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
  outline: none;
}
.catalog-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted-cosmic);
}

/* Category Filter Pills */
.catalog-filter-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.cat-pill {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: var(--text-readable);
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-pill:hover, .cat-pill.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* Catalog Items Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.5) rgba(10, 4, 20, 0.5);
}

.catalog-card {
  background: rgba(10, 4, 20, 0.8);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 14px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.25s;
  cursor: pointer;
  position: relative;
}

.catalog-card:hover {
  border-color: #f59e0b;
  background: rgba(25, 10, 50, 0.9);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 158, 11, 0.25);
}

.catalog-card-tier-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #f59e0b;
  color: #000000;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}

.catalog-card-img-wrap {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.catalog-card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.catalog-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card-blessing {
  font-size: 0.72rem;
  color: #fef08a;
  opacity: 0.85;
  margin-bottom: 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card-btn {
  margin-top: auto;
  width: 100%;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.catalog-card:hover .catalog-card-btn {
  background: #f59e0b;
  color: #000000;
}

/* --- Mode 2: PUZZLE CHALLENGE GAME UI --- */
.challenge-game-panel {
  display: none; /* activated when mode is challenge */
  background: rgba(18, 7, 36, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.2);
}

.challenge-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(10, 4, 20, 0.85);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-item i {
  font-size: 1.25rem;
  color: #f59e0b;
}
.stat-val {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fef08a;
}
.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted-cosmic);
}

/* Golden Tray of figures to arrange */
.challenge-tray-section {
  background: radial-gradient(circle at 50% 30%, rgba(217, 119, 6, 0.25) 0%, rgba(20, 8, 40, 0.9) 80%);
  border: 2px dashed rgba(245, 158, 11, 0.6);
  border-radius: 18px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.tray-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: #fef08a;
  margin-bottom: 0.25rem;
}

.tray-desc {
  font-size: 0.82rem;
  color: var(--text-readable);
  margin-bottom: 1rem;
}

.tray-items-flex {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  min-height: 110px;
}

.tray-item-card {
  width: 95px;
  background: rgba(10, 4, 20, 0.9);
  border: 2px solid rgba(245, 158, 11, 0.5);
  border-radius: 12px;
  padding: 0.6rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  transition: all 0.2s;
  user-select: none;
}

.tray-item-card:hover, .tray-item-card.selected {
  border-color: #fbbf24;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
  background: rgba(40, 15, 75, 0.95);
}

.tray-item-card.selected {
  outline: 2px solid #38bdf8;
}

.tray-item-img {
  width: 55px;
  height: 55px;
  object-fit: contain;
  margin-bottom: 0.35rem;
}

.tray-item-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Feedback & Toast Alert */
.feedback-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  background: rgba(18, 7, 36, 0.95);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 25px rgba(245, 158, 11, 0.4);
  display: none;
  max-width: 360px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Mode 3: ASTROLOGY & PURPOSE PRESETS --- */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.preset-card {
  background: rgba(10, 4, 20, 0.85);
  border: 1px solid rgba(147, 51, 234, 0.4);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.preset-card:hover {
  border-color: #f59e0b;
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(245, 158, 11, 0.3);
}

.preset-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.2);
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  margin-bottom: 0.65rem;
  align-self: flex-start;
}

.preset-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.preset-desc {
  font-size: 0.85rem;
  color: var(--text-readable);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.preset-composition {
  font-size: 0.78rem;
  color: var(--text-muted-cosmic);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.preset-apply-btn {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.6), rgba(217, 119, 6, 0.6));
  border: 1px solid #f59e0b;
  color: #fef08a;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.preset-card:hover .preset-apply-btn {
  background: #f59e0b;
  color: #000000;
}

/* --- Knowledge & Feng Shui Guide Section --- */
.altar-guide-section {
  background: rgba(18, 7, 36, 0.8);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
}

.guide-step-card {
  background: rgba(10, 4, 20, 0.7);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 14px;
  padding: 1.25rem;
  height: 100%;
  transition: all 0.2s;
}

.guide-step-card:hover {
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-2px);
}

.guide-step-num {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: #f59e0b;
  opacity: 0.85;
}

/* --- Modals Custom Styling --- */
.modal-content-galaxy {
  background: radial-gradient(circle at 50% 10%, rgba(68, 20, 110, 0.5) 0%, rgba(10, 4, 20, 0.98) 85%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(147, 51, 234, 0.4);
  color: #f8fafc;
}

.modal-header-galaxy {
  border-bottom: 1px solid rgba(147, 51, 234, 0.35);
  padding: 1.25rem 1.5rem;
}

.modal-body-galaxy {
  padding: 1.5rem;
}

.katha-pali-box {
  background: rgba(15, 6, 32, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
  color: #fef08a;
  font-size: 1.05rem;
  line-height: 1.8;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
  text-align: center;
}

/* Prayer Meditation Progress Bar */
.prayer-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
}
.prayer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9333ea, #f59e0b);
  width: 0%;
  transition: width 1s linear;
}

/* ==========================================================================
   OFFERINGS STORE & MULTI-SLOT OFFERINGS SYSTEM ("จะขายเครื่องไหว้ได้")
   ========================================================================== */
.offerings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.offering-card {
  background: rgba(18, 7, 36, 0.85);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.offering-card:hover {
  border-color: #f59e0b;
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(245, 158, 11, 0.25);
}

.offering-card-img-wrap {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  background: radial-gradient(circle at 50% 60%, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
  border-radius: 12px;
}

.offering-card-img {
  max-height: 80px;
  max-width: 90px;
  filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.4));
  transition: transform 0.25s;
}

.offering-card:hover .offering-card-img {
  transform: scale(1.08);
}

.offering-card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #fef08a;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.offering-card-category {
  font-size: 0.72rem;
  color: var(--text-muted-cosmic);
  margin-bottom: 0.5rem;
}

.offering-card-meaning {
  font-size: 0.8rem;
  color: var(--text-readable);
  line-height: 1.5;
  margin-bottom: 0.85rem;
  flex-grow: 1;
}

.offering-card-price-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.offering-price-tag {
  font-size: 1.05rem;
  font-weight: 700;
  color: #38bdf8;
}

.offering-price-tag.free {
  color: #4ade80;
}

.offering-card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-buy-and-offer {
  width: 100%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(147, 51, 234, 0.35) 100%);
  border: 1.5px solid #fbbf24;
  color: #fef08a;
  padding: 0.52rem 0.75rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.btn-buy-and-offer:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #000000;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.65);
  transform: translateY(-2px);
}

.btn-buy-and-offer:active {
  transform: translateY(0);
}

.btn-offer-3d {
  flex: 1;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef08a;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-offer-3d:hover {
  background: #f59e0b;
  color: #000000;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.btn-buy-offering {
  flex: 1;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.4), rgba(217, 119, 6, 0.4));
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #ffffff;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-buy-offering:hover:not(:disabled) {
  background: linear-gradient(135deg, #9333ea, #d97706);
  color: #fef08a;
  box-shadow: 0 0 16px rgba(147, 51, 234, 0.5);
}

.btn-buy-offering:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(51, 65, 85, 0.4);
  color: rgba(226, 232, 240, 0.65);
  box-shadow: none;
}

/* Category Filter Pills for Offerings */
.offering-cat-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.offering-cat-pill:hover, .offering-cat-pill.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

/* Multi-Slot 3D Offerings Base on Table */
.altar-offerings-base {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.85rem;
  padding: 1.25rem 0.75rem 0.85rem 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  border-radius: 16px;
  background: rgba(20, 8, 40, 0.7);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 2px 4px rgba(254, 240, 138, 0.25);
  position: relative;
  transform-style: preserve-3d;
}

.table-size-wide .altar-offerings-base {
  gap: 0.65rem;
  padding: 1.25rem 0.5rem;
}

.table-size-grand .altar-offerings-base {
  gap: 0.5rem;
  padding: 1.25rem 0.35rem;
}

.offering-slot-unit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 0.25rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.offering-slot-unit:hover {
  transform: translateY(-4px) scale(1.05);
}

.offering-unit-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 0.6rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
}

.offering-slot-unit:hover .offering-unit-remove {
  display: flex;
}

/* --- Responsive Adaptations --- */
@media (max-width: 768px) {
  .altar-main-container {
    padding-top: 85px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .altar-3d-viewport {
    min-height: 520px;
    padding: 1.5rem 0.5rem 1rem 0.5rem;
    border-radius: 18px;
  }
  .hud-chip span {
    display: none;
  }
  .altar-stage {
    padding: 1rem 0.25rem;
  }
  .tier-slots-row {
    gap: 0.35rem;
    min-height: 80px;
  }
  .altar-slot {
    width: 58px;
    height: 74px;
    border-radius: 8px;
  }
  .slot-statue-img {
    max-height: 56px;
  }
  .altar-tier[data-tier="1"] .altar-slot {
    width: 85px;
    height: 92px;
  }
  .altar-tier[data-tier="1"] .slot-statue-img {
    max-height: 70px;
  }
  .slot-statue-name {
    font-size: 0.55rem;
    max-width: 60px;
    bottom: -15px;
  }
  .tier-table-shelf {
    height: 18px;
  }
  .offering-svg-icon {
    height: 44px;
    max-width: 58px;
  }
  .catalog-grid, .offerings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .altar-mode-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.82rem;
  }
}

/* ===================================================
   REAL-TIME THREE.JS WEBGL 3D SHRINE ROOM & HUD STYLES
   =================================================== */
.altar-3d-viewport.view-mode-3d {
  padding: 0 !important;
  min-height: 650px;
  height: 670px;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  overflow: hidden;
}

.altar-3d-viewport.view-mode-3d .pavilion-overlay,
.altar-3d-viewport.view-mode-3d .altar-3d-scene {
  display: none !important;
}

.altar-3d-viewport.view-mode-2d .altar-3d-canvas-wrap,
.altar-3d-viewport.view-mode-2d .hud-selected-slot-bar {
  display: none !important;
}

.altar-3d-canvas-wrap {
  width: 100%;
  height: 100%;
  min-height: 650px;
  position: relative;
  flex: 1;
  cursor: grab;
}

.altar-3d-canvas-wrap:active {
  cursor: grabbing;
}

.altar-3d-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.hud-btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%) !important;
  color: #fff !important;
  border-color: #fef08a !important;
  font-weight: 600;
}

.hud-btn-toggle-mode {
  background: rgba(147, 51, 234, 0.45) !important;
  border-color: rgba(216, 180, 254, 0.7) !important;
  color: #f3e8ff !important;
}

.hud-selected-slot-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 820px;
  background: rgba(14, 5, 28, 0.92);
  backdrop-filter: blur(14px);
  border: 1.5px solid #fbbf24;
  border-radius: 16px;
  padding: 0.7rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 40;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85), 0 0 20px rgba(245, 158, 11, 0.3);
  animation: fadeInUpBar 0.25s ease-out;
}

@keyframes fadeInUpBar {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.selected-slot-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.selected-slot-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 3px;
}

.selected-slot-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .altar-3d-viewport.view-mode-3d,
  .altar-3d-canvas-wrap {
    min-height: 480px;
    height: 500px;
  }
  .hud-selected-slot-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.65rem 0.85rem;
    gap: 0.55rem;
  }
  .selected-slot-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
