:root {
  --bg-deep: #0b0302;
  --gold-bright: #ffe89e;
  --gold-main: #f4c150;
  --gold-deep: #b87e14;
  --ivory: #fff8eb;
  --muted-gold: #d8be92;
}

.co-temple, .co-temple *, .temple-gate, .temple-gate * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

.co-temple {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ivory);
  line-height: normal;
}

body.obs-mode, body.obs-mode html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body.obs-mode .co-head, body.obs-mode .co-foot, body.obs-mode #wpadminbar { display: none !important; }
html:has(body.obs-mode) { margin-top: 0 !important; }

.app-workspace {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 24px;
  padding: 12px;
}

body.obs-mode {
  background: transparent;
}
body.obs-mode .app-workspace {
  padding: 0;
  gap: 0;
}
body.obs-mode .quick-dock {
  display: none !important;
}

/* ==========================================================================
   KHUNG 9:16 CHUẨN TIKTOK LIVE (1080 x 1920 LOGICAL) — TỐI ƯU HÓA GPU COMPOSITOR
   ========================================================================== */
.stage-wrapper {
  position: relative;
  height: 96vh;
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid rgba(244, 193, 80, 0.55);
  background: #120403;
  contain: layout paint style;
}

body.obs-mode .stage-wrapper {
  height: 100vh;
  border-radius: 0;
  border: none;
}

.stage-9x16 {
  position: absolute;
  perspective: 2200px;
  perspective-origin: 50% 50%;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  transform-origin: top left;
  overflow: hidden;
  background: #120403;
  contain: strict;
}

/* 1. HÌNH NỀN CHÁNH ĐIỆN ĐỨC PHẬT A DI ĐÀ SẮC NÉT TUYỆT ĐỐI */
.sanctuary-bg-img {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  object-fit: cover;
  object-position: center top;
  z-index: 1;
  pointer-events: none;
}

/* 1B. HỆ THỐNG HÀO QUANG ĐỨC PHẬT A DI ĐÀ — TỐI ƯU HÓA CPU (KHÔNG DÙNG FILTER:BLUR) */
.buddha-halo-system {
  position: absolute;
  left: 540px;
  top: 260px;
  width: 720px;
  height: 720px;
  transform: translate3d(-50%, -50%, 0);
  z-index: 4;
  pointer-events: none;
  /* Khoét tâm trong suốt tại vị trí khuôn mặt Đức Phật để mặt Ngài sắc nét 100% */
  mask-image: radial-gradient(
    circle at 50% 50%,
    transparent 0%,
    transparent 16%,
    rgba(0, 0, 0, 0.75) 25%,
    #000000 45%,
    rgba(0, 0, 0, 0.4) 62%,
    transparent 72%
  );
  -webkit-mask-image: radial-gradient(
    circle at 50% 50%,
    transparent 0%,
    transparent 16%,
    rgba(0, 0, 0, 0.75) 25%,
    #000000 45%,
    rgba(0, 0, 0, 0.4) 62%,
    transparent 72%
  );
  opacity: 0.78;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.buddha-halo-system.flare {
  opacity: 1;
  transform: translate3d(-50%, -50%, 0) scale(1.06);
}

.halo-sunburst {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 236, 150, 0.38) 0deg 5deg,
    rgba(255, 195, 70, 0.04) 5deg 12deg,
    rgba(255, 245, 190, 0.28) 12deg 16deg,
    rgba(255, 180, 50, 0.02) 16deg 24deg
  );
  will-change: transform;
  /* steps(180) giảm số lần cập nhật GPU xuống chỉ ~3 lần/giây mà vẫn mượt */
  animation: haloSpinCw 60s steps(180) infinite;
}

.halo-counter-rays {
  display: none;
}

.halo-pulse-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 2px solid rgba(255, 238, 160, 0.55);
  transform: translate3d(-50%, -50%, 0);
  pointer-events: none;
}
.halo-pulse-ring.ring-2 {
  width: 540px;
  height: 540px;
  border-color: rgba(255, 220, 120, 0.35);
}

.halo-dharma-svg {
  position: absolute;
  inset: 20px;
  width: 680px;
  height: 680px;
}
.dharma-wheel-outer {
  transform-origin: 340px 340px;
  will-change: transform;
  animation: haloSpinCw 72s steps(180) infinite;
}
.dharma-wheel-inner {
  transform-origin: 340px 340px;
  will-change: transform;
  animation: haloSpinCcw 48s steps(140) infinite;
}

@keyframes haloSpinCw {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes haloSpinCcw {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* Hào quang Đài Sen Vàng trên tay Đức Phật A Di Đà (x=540, y=502) */
.lotus-hand-halo {
  position: absolute;
  left: 540px;
  top: 502px;
  width: 190px;
  height: 150px;
  transform: translate3d(-50%, -50%, 0);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 250, 210, 0.72) 0%,
    rgba(255, 210, 85, 0.32) 45%,
    rgba(255, 165, 30, 0) 75%
  );
  z-index: 5;
  pointer-events: none;
  opacity: 0.8;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.lotus-hand-halo.flare {
  transform: translate3d(-50%, -50%, 0) scale(1.4);
  opacity: 1;
}

/* 2. THANH TRẠNG THÁI MỎNG TRÊN ĐỈNH (KHÔNG DÙNG BACKDROP-FILTER) */
.minimal-top-bar {
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.top-Right-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill, .mini-stat-pill, .tts-voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(16, 4, 3, 0.92);
  border: 1.5px solid rgba(244, 193, 80, 0.6);
  font-size: 17px;
  font-weight: 600;
  color: var(--ivory);
}

.live-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff3b30;
}
.live-dot.connected {
  background: #2ecc71;
}

.tts-voice-pill {
  color: var(--gold-bright);
}
.tts-voice-pill.speaking {
  border-color: #fff3b0;
  background: rgba(58, 14, 9, 0.95);
}

.voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}
.voice-wave i {
  display: block;
  width: 3px;
  height: 6px;
  background: var(--gold-bright);
  border-radius: 2px;
}
.tts-voice-pill.speaking .voice-wave i {
  height: 14px;
}

/* ==========================================================================
   3. CỘT SÁNG TÂM HƯƠNG & LƯ HƯƠNG ĐỒNG TRUNG TÂM (KHÔNG DÙNG FILTER:BLUR)
   ========================================================================== */
.sacred-light-beam {
  position: absolute;
  left: 540px;
  top: 485px;
  width: 110px;
  height: 435px;
  transform: translate3d(-50%, 0, 0);
  background: radial-gradient(
    ellipse 50% 50% at 50% 55%,
    rgba(255, 246, 200, 0.55) 0%,
    rgba(255, 220, 120, 0.22) 55%,
    rgba(255, 210, 100, 0) 100%
  );
  z-index: 6;
  pointer-events: none;
  opacity: 0.65;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.sacred-light-beam.intense {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scaleX(1.35);
}

.incense-burner-zone {
  position: absolute;
  top: 790px;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 220px;
  z-index: 9;
  cursor: pointer;
}

.incense-sticks-holder {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 105px;
  pointer-events: none;
}

.incense-stick {
  position: absolute;
  bottom: 0;
  width: 3.5px;
  height: 82px;
  background: linear-gradient(180deg, #e0d6cc 0%, #d4a359 35%, #8c1d18 80%);
  border-radius: 2px;
  transform-origin: bottom center;
}

.incense-ember {
  position: absolute;
  top: -4px;
  left: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff6d00;
  border: 1.5px solid #ffe082;
}

/* Nút Pháp Khí Tương Tác Nhanh Trên Bàn Thờ */
.ritual-hotspot {
  position: absolute;
  z-index: 15;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(20, 5, 3, 0.88);
  border: 1.5px solid rgba(244, 193, 80, 0.65);
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
}
.bell-hotspot {
  top: 955px;
  left: 34px;
}
.woodfish-hotspot {
  top: 955px;
  right: 34px;
}
.fortune-hotspot {
  top: 895px;
  right: 34px;
}

/* ==========================================================================
   4. NHÂN VẬT PHẬT TỬ ÁO LAM QUỲ LỄ (SHADOW ĐÃ BAKE SẴN VÀO PNG, 0% CPU FILTER)
   ========================================================================== */
.devotee-sprite {
  display: block;
  object-fit: contain;
  transform-origin: bottom center;
}

/* Chủ lễ đang hành lễ ngay chính giữa trước lư hương đồng */
.central-worshipper {
  position: absolute;
  left: 540px;
  top: 970px;
  transform: translate3d(-50%, 0, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 14;
  pointer-events: none;
  will-change: transform;
}

.central-worshipper.walking-up {
  animation: centralWalkUpCarpet 2.1s linear forwards;
}

@keyframes centralWalkUpCarpet {
  0% {
    transform: translate3d(-50%, 490px, 0) scale(1.06);
  }
  100% {
    transform: translate3d(-50%, 0px, 0) scale(1);
  }
}

.central-sprite-stack {
  position: relative;
  width: 132px;
  height: 176px;
}

.pose-frame {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 162px;
  opacity: 0;
  pointer-events: none;
}

.pose-frame[data-pose="walk1"],
.pose-frame[data-pose="walk2"] {
  width: 102px;
  height: 176px;
}

.pose-frame.active {
  opacity: 1;
}

.worshipper-wish-bubble {
  max-width: 340px;
  padding: 6px 14px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: rgba(18, 4, 3, 0.92);
  border: 1.5px solid var(--gold-main);
  color: var(--gold-bright);
  font-size: 14.5px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thẻ tên thí chủ chuẩn phong cách Game Live */
.name-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  background: rgba(16, 6, 4, 0.94);
  border: 1.5px solid var(--gold-main);
  margin-top: -12px;
  position: relative;
  z-index: 2;
}

.central-name-tag {
  padding: 5px 15px 5px 6px;
  border-width: 2px;
  border-color: var(--gold-bright);
}

.tag-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-bright);
  background: #4f100a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-bright);
  overflow: hidden;
  flex-shrink: 0;
}
.tag-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag-texts {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.tag-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  max-width: 135px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold-bright);
}

/* 5. HÀNG 6 ĐỆM QUỲ VIP TRÊN BỤC GỖ (STATIC LAYER, 0% CPU KHI ĐỨNG YÊN) */
.vip-cushions-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  contain: layout style;
}

.vip-devotee-slot {
  position: absolute;
  transform: translate3d(-50%, -100%, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vip-devotee-slot .devotee-sprite {
  width: 102px;
  height: 132px;
}

.vip-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: rgba(14, 5, 4, 0.94);
  border: 1.5px solid var(--gold-main);
  margin-top: -10px;
  white-space: nowrap;
}

.vip-rank-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e6ac35;
  color: #1b0503;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vip-rank-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 6. ĐẠO TRÀNG NGƯỜI XEM QUỲ LỄ HAI BÊN THẢM ĐỎ (40 CHỖ NGỒI TĨNH SIÊU NHẸ CPU) */
.congregation-hall {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  contain: layout style;
}

.hall-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hall-seat .devotee-sprite {
  width: 92px;
  height: 120px;
}

.seat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  background: rgba(12, 4, 3, 0.92);
  border: 1px solid rgba(244, 193, 80, 0.68);
  margin-top: -12px;
  white-space: nowrap;
}

.seat-avatar {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #6b150e;
  border: 1px solid var(--gold-bright);
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.seat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seat-username {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff6e5;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 7. NGƯỜI XEM ĐI BỘ DỌC THẢM ĐỎ LÊN DÂNG HƯƠNG (GPU TRANSFORM3D) */
.carpet-walker-layer {
  position: absolute;
  inset: 0;
  z-index: 14;
  pointer-events: none;
}

.carpet-walker {
  position: absolute;
  left: 540px;
  top: 1665px;
  will-change: transform, opacity;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: walkUpRedCarpet 2.2s linear forwards;
}

.carpet-walker .devotee-sprite {
  width: 102px;
  height: 192px;
  transform-origin: bottom center;
}

@keyframes walkUpRedCarpet {
  0% {
    transform: translate3d(-50%, -100%, 0) scale(1.06);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  92% {
    transform: translate3d(-50%, calc(-100% - 495px), 0) scale(0.84);
    opacity: 1;
  }
  100% {
    transform: translate3d(-50%, calc(-100% - 510px), 0) scale(0.82);
    opacity: 0;
  }
}

/* ==========================================================================
   8. ĐÈN HOA ĐĂNG / SỚ CẦU NGUYỆN BAY LÊN & CANVAS
   ========================================================================== */
.sky-lanterns-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 16;
  overflow: hidden;
}

.sky-lantern {
  position: absolute;
  bottom: 360px;
  width: 260px;
  padding: 12px 15px;
  border-radius: 16px;
  background: rgba(98, 18, 12, 0.94);
  border: 2px solid var(--gold-bright);
  color: var(--ivory);
  will-change: transform, opacity;
  animation: floatLanternUp 9.5s linear forwards;
}
.sky-lantern::before {
  content: '🏮 SỚ CẦU AN';
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-bright);
  letter-spacing: 1.2px;
  margin-bottom: 3px;
}
.sky-lantern-user {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.sky-lantern-wish {
  font-size: 15px;
  line-height: 1.3;
  color: #ffe8a3;
  margin-top: 2px;
}

@keyframes floatLanternUp {
  0% { transform: translate3d(0, 60px, 0) scale(0.85); opacity: 0; }
  12% { transform: translate3d(0, 0px, 0) scale(1); opacity: 1; }
  86% { opacity: 0.95; }
  100% { transform: translate3d(0, -1180px, 0) scale(0.92); opacity: 0; }
}

#temple3dCanvas {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  pointer-events: none;
  z-index: 16;
}

#temple3dCanvas[hidden] {
  display: none !important;
}

#templeCanvas {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  pointer-events: none;
  z-index: 15;
}

/* ==========================================================================
   10. THANH HUD GỌN GÀNG DƯỚI ĐÁY
   ========================================================================== */
.bottom-hud-bar {
  position: absolute;
  bottom: 20px;
  left: 24px;
  right: 24px;
  height: 192px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
}

.hud-left-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.hud-active-notice {
  height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  background: rgba(34, 10, 6, 0.94);
  border: 1.5px solid rgba(244, 193, 80, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 19px;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-gift-cards {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hud-gift-card {
  cursor: pointer;
  background: rgba(24, 8, 5, 0.94);
  border: 1.5px solid rgba(244, 193, 80, 0.55);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hud-gift-card:hover {
  border-color: var(--gold-bright);
}
.gift-coin-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted-gold);
  letter-spacing: 0.5px;
}
.gift-card-body {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gift-emoji {
  font-size: 34px;
}
.gift-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-bright);
}

/* Bảng TẤM LÒNG THÀNH bên phải đáy */
.hud-right-leaderboard {
  background: rgba(22, 7, 4, 0.94);
  border: 1.5px solid rgba(244, 193, 80, 0.65);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
}

.hud-lb-header {
  text-align: center;
  font-family: 'Noto Serif', serif;
  font-size: 19px;
  font-weight: 900;
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(244, 193, 80, 0.3);
}

.hud-lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.leader-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
}
.leader-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(244, 193, 80, 0.25);
  border: 1px solid var(--gold-main);
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}
.leader-name {
  flex: 1;
  font-weight: 700;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leader-merit {
  font-weight: 800;
  color: var(--gold-bright);
  margin-left: 8px;
}

/* ==========================================================================
   MODAL TỜ GIẢI QUẺ LINH XĂM & ĐẠI LỄ HÀO QUANG
   ========================================================================== */
.fortune-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 2, 1, 0.82);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.fortune-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.fortune-scroll-card {
  width: 780px;
  background: linear-gradient(180deg, #fff5dc 0%, #f5deb3 100%);
  color: #3b0d09;
  border: 6px solid #8c1812;
  outline: 3px solid var(--gold-main);
  border-radius: 24px;
  padding: 34px 42px;
  text-align: center;
}
.fortune-badge {
  display: inline-block;
  background: #8c1812;
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 22px;
  padding: 6px 24px;
  border-radius: 999px;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.fortune-heading {
  font-family: 'Noto Serif', serif;
  font-size: 35px;
  font-weight: 900;
  color: #6b0f0a;
  margin-bottom: 8px;
}
.fortune-devotee {
  font-size: 22px;
  font-weight: 700;
  color: #8c2d19;
  margin-bottom: 18px;
}
.fortune-poem {
  font-family: 'Noto Serif', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.55;
  color: #2b0705;
  background: rgba(140, 24, 18, 0.08);
  border-top: 2px dashed rgba(140, 24, 18, 0.35);
  border-bottom: 2px dashed rgba(140, 24, 18, 0.35);
  padding: 18px 20px;
  white-space: pre-line;
  margin-bottom: 18px;
}
.fortune-meaning {
  font-size: 21px;
  line-height: 1.45;
  color: #3d120d;
  font-weight: 600;
}

.volume-control-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.volume-label-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ivory);
}
.volume-label-line strong {
  color: var(--gold-bright);
}
.volume-slider {
  width: 100%;
  accent-color: var(--gold-main);
  cursor: pointer;
  height: 6px;
}

.grand-ceremony-banner {
  position: absolute;
  top: 790px;
  left: 50%;
  transform: translate3d(-50%, 0, 0) scale(0.9);
  width: 860px;
  padding: 22px 30px;
  border-radius: 24px;
  background: linear-gradient(135deg, #6e0f0a 0%, #a31c14 50%, #520906 100%);
  border: 4px solid #fff099;
  text-align: center;
  z-index: 48;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.grand-ceremony-banner.visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
}
.grand-title {
  font-family: 'Noto Serif', serif;
  font-size: 36px;
  font-weight: 900;
  color: #fff3b0;
}
.grand-sub {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 6px;
}

/* ==========================================================================
   BẢNG ĐIỀU KHIỂN NHANH BÊN CẠNH MÀN HÌNH LIVE (QUICK RPC DOCK)
   ========================================================================== */
.quick-dock {
  width: 390px;
  max-height: 96vh;
  overflow-y: auto;
  background: #1a0705;
  border: 1.5px solid rgba(244, 193, 80, 0.45);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(244, 193, 80, 0.25);
  padding-bottom: 12px;
}
.dock-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--gold-bright);
}
.dock-link {
  font-size: 13px;
  color: var(--gold-main);
  text-decoration: none;
  border: 1px solid rgba(244, 193, 80, 0.4);
  padding: 5px 10px;
  border-radius: 8px;
}
.dock-section {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(244, 193, 80, 0.2);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-gold);
}
.dock-input-row {
  display: flex;
  gap: 8px;
}
.dock-input {
  flex: 1;
  background: #0f0403;
  border: 1px solid rgba(244, 193, 80, 0.38);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--ivory);
  font-size: 14px;
  outline: none;
}
.dock-btn {
  cursor: pointer;
  border: 1px solid rgba(244, 193, 80, 0.5);
  border-radius: 10px;
  padding: 9px 13px;
  background: linear-gradient(180deg, #6e140e 0%, #420a07 100%);
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dock-btn.gold {
  background: linear-gradient(180deg, #f4c150 0%, #c48312 100%);
  color: #1f0604;
  border-color: #fff3b0;
}
.dock-btn.active-toggle {
  background: linear-gradient(180deg, #1b7a46 0%, #104f2d 100%);
  border-color: #58e698;
  color: #eafff3;
}
.dock-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.event-feed {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}
.event-feed-item {
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--gold-main);
  color: #f3e5cf;
}


/* One shared virtual camera rig: preserves the fixed 1080x1920 stage. */
.temple-camera-rig {
  position: absolute;
  inset: 0;
  width: 1080px;
  height: 1920px;
  transform-origin: 50% 50%;
  z-index: 1;
  transform: translate3d(0, 0, 0) scale(1);
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .temple-camera-rig { will-change: auto; }
}

/* Gift gameplay props stay inside the same fixed 9:16 scene. */
.gift-action-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  overflow: hidden;
  pointer-events: none;
}
.gift-action-fx {
  position: absolute;
  display: block;
  font-size: 112px;
  line-height: 1;
  transform: translate3d(-50%, -50%, 0);
  user-select: none;
  white-space: nowrap;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  will-change: transform, opacity;
}
.gift-rocket {
  width: 112px;
  height: 42px;
  font-size: 0;
  filter: drop-shadow(0 7px 12px rgba(255, 110, 28, .55));
}
.gift-rocket::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 4px;
  width: 78px;
  height: 34px;
  border-radius: 55% 42% 42% 55%;
  background: linear-gradient(180deg, #fff5c8 0%, #f8b84e 38%, #c94a24 100%);
  border: 3px solid #7d2d20;
  box-shadow: inset 0 3px 5px rgba(255,255,255,.8);
}
.gift-rocket::after {
  content: "";
  position: absolute;
  left: 47px;
  top: 12px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, #8fe4ff 30%, #2877a6 75%);
  border: 2px solid #713322;
  box-shadow: -35px 18px 0 -4px #9a3923, -35px -5px 0 -4px #9a3923;
}
.gift-blast { font-size: 170px; }
.gift-donut {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  font-size: 0;
  background:
    radial-gradient(circle, transparent 0 22%, #8c3d22 23% 29%, transparent 30%),
    radial-gradient(circle at 38% 28%, #fff1c2 0 4%, transparent 5%),
    radial-gradient(circle at 66% 32%, #ffefbd 0 3%, transparent 4%),
    radial-gradient(circle at 73% 62%, #fff1c2 0 4%, transparent 5%),
    radial-gradient(circle at 32% 68%, #fff1c2 0 3%, transparent 4%),
    radial-gradient(circle at 50% 50%, #f9c2cf 0 44%, #a84c36 46% 53%, #6d2c21 56% 61%, transparent 63%);
  filter: drop-shadow(0 8px 12px rgba(75, 27, 12, .5));
}
.gift-donut::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: conic-gradient(from 15deg, transparent 0 8%, #ffe27d 8% 11%, transparent 11% 24%, #fff 24% 27%, transparent 27% 45%, #ff8b45 45% 48%, transparent 48% 66%, #fff 66% 69%, transparent 69% 85%, #8ce0b0 85% 88%, transparent 88%);
  mask: radial-gradient(circle, transparent 0 28%, #000 30% 62%, transparent 64%);
}

/* Procedural eastern dragon: curved scaled body, crest, horns and whiskers. */
.gift-dragon {
  width: 270px;
  height: 150px;
  font-size: 0;
  filter: drop-shadow(0 9px 14px rgba(12, 48, 28, .72));
}
.gift-dragon::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 48px;
  width: 226px;
  height: 66px;
  border: 17px solid transparent;
  border-top-color: #4fc47b;
  border-bottom-color: #16764c;
  border-radius: 48% 58% 42% 54%;
  transform: rotate(-13deg);
  background:
    repeating-radial-gradient(ellipse at 50% 50%, rgba(210,255,170,.75) 0 3px, transparent 4px 13px),
    linear-gradient(180deg, #79e39a, #17834f 58%, #075638);
  box-shadow: inset 0 5px 8px rgba(224,255,183,.55), 0 0 18px rgba(82,220,128,.5);
  clip-path: polygon(0 18%, 18% 0, 38% 18%, 58% 0, 78% 18%, 100% 5%, 91% 82%, 70% 100%, 48% 80%, 27% 100%, 8% 78%);
}
.gift-dragon::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 19px;
  width: 86px;
  height: 76px;
  border: 4px solid #075638;
  border-radius: 48% 58% 44% 52%;
  background:
    radial-gradient(ellipse at 67% 47%, #fff3a0 0 5%, transparent 6%),
    radial-gradient(ellipse at 68% 47%, #182b1b 0 2%, transparent 3%),
    radial-gradient(ellipse at 30% 65%, #e9a64c 0 8%, transparent 9%),
    linear-gradient(145deg, #b4f28b 0%, #42bd70 42%, #08734a 100%);
  box-shadow:
    -18px -34px 0 -27px #f5d36e,
    -2px -43px 0 -28px #f5d36e,
    30px 12px 0 -36px #f5d36e,
    0 0 0 5px rgba(255,207,99,.28),
    inset -8px -8px 0 rgba(0,52,36,.25);
  transform: rotate(-9deg);
}
.gift-dragon-wind { font-size: 150px; }


/* Procedural Rocket exhaust and impact layers. */
.gift-rocket-trail {
  width: 44px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,250,190,.98) 0%, rgba(255,143,35,.88) 38%, rgba(214,45,12,.35) 72%, transparent 100%);
  filter: blur(2px);
  box-shadow: 0 0 18px rgba(255,115,24,.75);
}
.gift-impact-flash {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,240,1) 0%, rgba(255,216,110,.92) 24%, rgba(255,105,22,.55) 48%, transparent 74%);
  mix-blend-mode: screen;
}
.gift-blast-smoke {
  width: 76px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(76,65,57,.56) 0%, rgba(111,82,58,.34) 48%, transparent 76%);
  filter: blur(5px);
}
.gift-blast-debris {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, #fff0a1, #f28a27 60%, #8b2c12);
  box-shadow: 0 0 9px rgba(255,169,54,.8);
}


/* Rose gift and combo feedback remain light and non-blocking. */
.gift-rose-main { font-size: 112px; filter: drop-shadow(0 8px 18px rgba(255,90,125,.5)); }
.gift-rose-petal { font-size: 42px; filter: drop-shadow(0 3px 8px rgba(255,180,190,.45)); }
.gift-combo-pulse {
  color: #fff1a8;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 3px 0 #7a250d, 0 0 18px rgba(255,190,70,.95);
}


.gift-dragon-impact {
  width: 120px;
  height: 120px;
  border: 7px solid rgba(255,210,120,.9);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(255,150,55,.85), inset 0 0 18px rgba(255,230,160,.65);
}

/* Full-world 3D mode: remove the 2D illustration/sprite stack so it cannot
   double-render over the real perspective scene. Keep only live HUD overlays. */
.stage-9x16.temple-3d-mode {
  background: #160904;
  isolation: isolate;
}
.stage-9x16.temple-3d-mode .sanctuary-bg-img,
.stage-9x16.temple-3d-mode .buddha-halo-system,
.stage-9x16.temple-3d-mode .lotus-hand-halo,
.stage-9x16.temple-3d-mode .sacred-light-beam,
.stage-9x16.temple-3d-mode .incense-burner-zone,
.stage-9x16.temple-3d-mode .ritual-hotspot,
.stage-9x16.temple-3d-mode .central-worshipper,
.stage-9x16.temple-3d-mode .vip-cushions-layer,
.stage-9x16.temple-3d-mode .congregation-hall,
.stage-9x16.temple-3d-mode .carpet-walker-layer,
.stage-9x16.temple-3d-mode .sky-lanterns-layer,
.stage-9x16.temple-3d-mode #templeCanvas {
  display: none !important;
}
.stage-9x16.temple-3d-mode #temple3dCanvas {
  display: block !important;
  pointer-events: auto;
  touch-action: manipulation;
  z-index: 0;
}
.stage-9x16.temple-3d-mode .temple-camera-rig {
  z-index: 0;
}
.stage-9x16.temple-3d-mode .minimal-top-bar,
.stage-9x16.temple-3d-mode .bottom-hud-bar,
.stage-9x16.temple-3d-mode #grandCeremonyBanner,
.stage-9x16.temple-3d-mode #fortuneModal {
  z-index: 30;
}


/* ==========================================================================
   IMMERSIVE SANCTUARY HUD — 3D MODE ONLY
   The 2D broadcast layout is intentionally left unchanged.
   ========================================================================== */
.stage-9x16.temple-3d-mode {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(194, 126, 45, 0.16), transparent 42%),
    #100805;
}
.stage-9x16.temple-3d-mode .minimal-top-bar {
  top: 30px;
  left: 30px;
  right: 30px;
  align-items: flex-start;
  gap: 18px;
}
.stage-9x16.temple-3d-mode .live-pill {
  min-height: 58px;
  padding: 9px 20px 9px 15px;
  gap: 12px;
  border: 1px solid rgba(255, 218, 145, 0.42);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(34, 17, 11, 0.88), rgba(12, 8, 7, 0.72));
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 245, 218, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 16px;
  letter-spacing: 0.8px;
}
.stage-9x16.temple-3d-mode .live-pill::after {
  content: '3D SANCTUARY';
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  margin-left: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255, 211, 119, 0.38);
  border-radius: 999px;
  background: rgba(181, 111, 28, 0.2);
  color: #ffe1a0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
}
.stage-9x16.temple-3d-mode .mini-stat-pill {
  min-height: 54px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 218, 145, 0.34);
  border-radius: 17px;
  background: rgba(20, 12, 8, 0.72);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25), inset 0 1px rgba(255, 245, 218, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f7e6c5;
  font-size: 15px;
}
.stage-9x16.temple-3d-mode .live-dot {
  box-shadow: 0 0 0 5px rgba(255, 74, 55, 0.13), 0 0 16px rgba(255, 74, 55, 0.55);
}
.stage-9x16.temple-3d-mode .live-dot.connected {
  box-shadow: 0 0 0 5px rgba(46, 204, 113, 0.13), 0 0 16px rgba(46, 204, 113, 0.55);
}
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  left: 28px;
  right: 28px;
  bottom: 28px;
  height: 208px;
  grid-template-columns: 1.55fr 0.92fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 218, 145, 0.3);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(26, 15, 10, 0.82), rgba(10, 8, 7, 0.76));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 244, 219, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  height: 48px;
  flex: 0 0 48px;
  justify-content: flex-start;
  padding: 0 16px;
  border: 1px solid rgba(255, 215, 137, 0.22);
  border-radius: 13px;
  background: rgba(255, 231, 184, 0.07);
  color: #ffe7b2;
  font-size: 15px;
  letter-spacing: 0.15px;
}
.stage-9x16.temple-3d-mode .hud-gift-cards {
  gap: 9px;
}
.stage-9x16.temple-3d-mode .hud-gift-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 211, 130, 0.28);
  border-radius: 15px;
  background: linear-gradient(155deg, rgba(113, 63, 28, 0.32), rgba(22, 13, 9, 0.68));
  box-shadow: inset 0 1px rgba(255, 247, 222, 0.1);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.stage-9x16.temple-3d-mode .hud-gift-card::after {
  content: '';
  position: absolute;
  right: -28px;
  top: -34px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 224, 161, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 12px rgba(255, 224, 161, 0.025), 0 0 0 24px rgba(255, 224, 161, 0.02);
  pointer-events: none;
}
.stage-9x16.temple-3d-mode .hud-gift-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 225, 161, 0.72);
  background: linear-gradient(155deg, rgba(151, 94, 40, 0.4), rgba(28, 16, 10, 0.78));
}
.stage-9x16.temple-3d-mode .gift-coin-tag {
  color: #d9c39c;
  font-size: 11px;
  letter-spacing: 1px;
}
.stage-9x16.temple-3d-mode .gift-card-body {
  position: relative;
  z-index: 1;
  gap: 8px;
}
.stage-9x16.temple-3d-mode .gift-emoji {
  font-size: 30px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}
.stage-9x16.temple-3d-mode .gift-title {
  color: #ffe5ae;
  font-size: 17px;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 211, 130, 0.24);
  border-radius: 16px;
  background: rgba(255, 231, 184, 0.055);
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  color: #ffe2a7;
  font-size: 16px;
  letter-spacing: 1.8px;
}
.stage-9x16.temple-3d-mode .leader-item {
  font-size: 13px;
}
.stage-9x16.temple-3d-mode .leader-rank {
  width: 19px;
  height: 19px;
  font-size: 11px;
}
.stage-9x16.temple-3d-mode .leader-name {
  color: #f5e7d0;
}
.stage-9x16.temple-3d-mode .leader-merit {
  color: #ffd77d;
}
.stage-9x16.temple-3d-mode #grandCeremonyBanner {
  border-radius: 22px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.48), 0 0 35px rgba(255, 190, 75, 0.22);
  backdrop-filter: blur(12px);
}
.stage-9x16.temple-3d-mode #fortuneModal {
  backdrop-filter: blur(12px);
}
@media (prefers-reduced-motion: reduce) {
  .stage-9x16.temple-3d-mode .hud-gift-card {
    transition: none;
  }
}

/* Clean livestream HUD refresh — 3D sanctuary only.
   Preserve the legacy 2D broadcast UI and make more of the portrait scene visible. */
.stage-9x16.temple-3d-mode .minimal-top-bar {
  top: 14px;
  left: 14px;
  right: 14px;
  gap: 8px;
}
.stage-9x16.temple-3d-mode .live-pill {
  min-height: 38px;
  padding: 6px 11px;
  gap: 8px;
  border-color: rgba(226, 190, 126, .24);
  border-radius: 12px;
  background: rgba(18, 13, 11, .72);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  font-size: 11px;
  letter-spacing: .15px;
}
.stage-9x16.temple-3d-mode .live-pill::after {
  min-height: 19px;
  margin-left: 3px;
  padding: 0 7px;
  font-size: 8px;
  letter-spacing: .7px;
}
.stage-9x16.temple-3d-mode .mini-stat-pill {
  min-height: 36px;
  padding: 5px 10px;
  border-color: rgba(226, 190, 126, .2);
  border-radius: 12px;
  background: rgba(18, 13, 11, .68);
  box-shadow: none;
  font-size: 10px;
}
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  left: 14px;
  right: 14px;
  bottom: 14px;
  height: 142px;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, .82fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(224, 190, 133, .22);
  border-radius: 17px;
  background: linear-gradient(155deg, rgba(25, 19, 16, .9), rgba(13, 11, 10, .88));
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.stage-9x16.temple-3d-mode .hud-left-col {
  min-width: 0;
  gap: 7px;
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  min-width: 0;
  height: 29px;
  min-height: 29px;
  flex: 0 0 29px;
  padding: 0 9px;
  gap: 5px;
  overflow: hidden;
  border: 1px solid rgba(226, 190, 126, .15);
  border-radius: 9px;
  background: rgba(255, 245, 224, .045);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.stage-9x16.temple-3d-mode .hud-gift-cards {
  min-height: 0;
  flex: 1 1 auto;
  gap: 6px;
}
.stage-9x16.temple-3d-mode .hud-gift-card {
  min-height: 0;
  padding: 8px 7px;
  border: 1px solid rgba(226, 190, 126, .18);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(91, 57, 34, .34), rgba(22, 17, 14, .62));
  box-shadow: none;
}
.stage-9x16.temple-3d-mode .hud-gift-card::after {
  display: none;
}
.stage-9x16.temple-3d-mode .gift-coin-tag {
  font-size: 8px;
  letter-spacing: .45px;
}
.stage-9x16.temple-3d-mode .gift-card-body {
  gap: 5px;
}
.stage-9x16.temple-3d-mode .gift-emoji {
  font-size: 21px;
  filter: none;
}
.stage-9x16.temple-3d-mode .gift-title {
  font-size: 10px;
  line-height: 1.15;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(226, 190, 126, .16);
  border-radius: 11px;
  background: rgba(255, 245, 224, .035);
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  margin-bottom: 5px;
  font-size: 10px;
  letter-spacing: 1px;
}
.stage-9x16.temple-3d-mode .leader-item {
  min-height: 17px;
  gap: 5px;
  font-size: 9px;
  line-height: 1.15;
}
.stage-9x16.temple-3d-mode .leader-rank {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  font-size: 8px;
}
.stage-9x16.temple-3d-mode .leader-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-9x16.temple-3d-mode .leader-merit {
  flex: 0 0 auto;
  font-size: 9px;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .bottom-hud-bar {
    left: 9px;
    right: 9px;
    bottom: 9px;
    height: 128px;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .78fr);
    gap: 6px;
    padding: 6px;
  }
  .stage-9x16.temple-3d-mode .hud-active-notice {
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .gift-title {
    font-size: 9px;
  }
}


/* Final visual pass — 3D livestream HUD. Keep all legacy 2D styles untouched. */
.stage-9x16.temple-3d-mode .minimal-top-bar {
  top: 20px;
  left: 22px;
  right: 22px;
  align-items: center;
  gap: 12px;
}
.stage-9x16.temple-3d-mode .live-pill {
  min-height: 48px;
  padding: 8px 14px;
  gap: 10px;
  border: 1px solid rgba(255, 220, 157, .42);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(32, 19, 13, .88), rgba(13, 10, 8, .78));
  box-shadow: 0 8px 26px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 244, 218, .13);
  color: #fff0d1;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .55px;
}
.stage-9x16.temple-3d-mode .live-pill::after {
  min-height: 23px;
  padding: 0 9px;
  border-color: rgba(255, 213, 132, .36);
  background: rgba(174, 112, 35, .2);
  color: #ffe2a6;
  font-size: 9px;
  letter-spacing: 1px;
}
.stage-9x16.temple-3d-mode .mini-stat-pill {
  min-height: 46px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 220, 157, .32);
  border-radius: 14px;
  background: rgba(20, 13, 9, .82);
  color: #f8e8ce;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 7px 22px rgba(0, 0, 0, .24);
}
.stage-9x16.temple-3d-mode .mini-stat-pill strong {
  color: #ffdc8b;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  left: 20px;
  right: 20px;
  bottom: 20px;
  height: 166px;
  grid-template-columns: minmax(0, 1.48fr) minmax(0, .86fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 218, 155, .3);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(28, 18, 12, .91), rgba(10, 9, 8, .88));
  box-shadow: 0 14px 42px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 244, 218, .12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  min-height: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 218, 155, .18);
  border-radius: 10px;
  background: rgba(255, 239, 211, .065);
  color: #ffe8bd;
  font-size: 11px;
  font-weight: 700;
}
.stage-9x16.temple-3d-mode .hud-gift-cards {
  gap: 8px;
}
.stage-9x16.temple-3d-mode .hud-gift-card {
  justify-content: center;
  gap: 9px;
  padding: 9px 8px;
  border: 1px solid rgba(255, 215, 143, .25);
  border-radius: 13px;
  background: linear-gradient(155deg, rgba(113, 70, 35, .42), rgba(22, 15, 11, .88));
  box-shadow: inset 0 1px rgba(255, 247, 225, .1), 0 5px 15px rgba(0, 0, 0, .18);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.stage-9x16.temple-3d-mode .hud-gift-card:active {
  transform: translateY(1px) scale(.985);
  border-color: rgba(255, 224, 157, .65);
}
.stage-9x16.temple-3d-mode .gift-coin-tag {
  color: #d9bd8b;
  font-size: 8px;
  font-weight: 800;
}
.stage-9x16.temple-3d-mode .gift-card-body {
  align-items: center;
  gap: 7px;
}
.stage-9x16.temple-3d-mode .gift-emoji {
  font-size: 25px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35));
}
.stage-9x16.temple-3d-mode .gift-title {
  color: #ffe5ae;
  font-size: 11px;
  font-weight: 800;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  padding: 9px 10px;
  border: 1px solid rgba(255, 218, 155, .2);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(255, 239, 211, .07), rgba(255, 239, 211, .025));
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom-color: rgba(255, 218, 155, .2);
  color: #ffe1a2;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.1px;
}
.stage-9x16.temple-3d-mode .leader-item {
  min-height: 19px;
  font-size: 10px;
}
.stage-9x16.temple-3d-mode .leader-rank {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
  border-color: rgba(255, 213, 132, .48);
  background: rgba(206, 151, 65, .16);
  color: #ffe2a5;
  font-size: 8px;
}
.stage-9x16.temple-3d-mode .leader-name {
  color: #f4e8d5;
}
.stage-9x16.temple-3d-mode .leader-merit {
  color: #ffdc8b;
  font-size: 9px;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .minimal-top-bar {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 6px;
  }
  .stage-9x16.temple-3d-mode .live-pill {
    min-height: 35px;
    padding: 5px 8px;
    gap: 6px;
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .live-pill::after {
    min-height: 18px;
    padding: 0 6px;
    font-size: 7px;
  }
  .stage-9x16.temple-3d-mode .mini-stat-pill {
    min-height: 34px;
    padding: 4px 7px;
    font-size: 8px;
  }
  .stage-9x16.temple-3d-mode .mini-stat-pill strong {
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .bottom-hud-bar {
    left: 9px;
    right: 9px;
    bottom: 9px;
    height: 132px;
    gap: 6px;
    padding: 6px;
  }
  .stage-9x16.temple-3d-mode .hud-active-notice {
    min-height: 27px;
    height: 27px;
    flex-basis: 27px;
    padding: 0 7px;
    font-size: 8px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-cards {
    gap: 5px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-card {
    gap: 5px;
    padding: 6px 5px;
  }
  .stage-9x16.temple-3d-mode .gift-emoji {
    font-size: 19px;
  }
  .stage-9x16.temple-3d-mode .gift-title {
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .hud-right-leaderboard {
    padding: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-9x16.temple-3d-mode .hud-gift-card {
    transition: none;
  }
}


/* 3D HUD refinement: split the legacy footer into two floating console modules. */
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  height: 276px;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, .82fr);
  gap: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.stage-9x16.temple-3d-mode .hud-left-col,
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  position: relative;
  min-width: 0;
  padding: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 220, 157, .62);
  border-radius: 18px 6px 18px 6px;
  background:
    linear-gradient(135deg, rgba(119, 75, 34, .26), transparent 48%),
    linear-gradient(155deg, rgba(22, 17, 14, .97), rgba(7, 8, 9, .96));
  box-shadow:
    0 16px 42px rgba(0, 0, 0, .5),
    inset 0 1px rgba(255, 244, 218, .18),
    inset 0 -2px rgba(183, 125, 55, .18);
}
.stage-9x16.temple-3d-mode .hud-left-col::before,
.stage-9x16.temple-3d-mode .hud-right-leaderboard::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 220, 157, .13);
  border-radius: 12px 3px 12px 3px;
  pointer-events: none;
}
.stage-9x16.temple-3d-mode .hud-left-col {
  gap: 13px;
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  min-height: 48px;
  height: 48px;
  flex-basis: 48px;
  padding: 0 16px;
  border-radius: 7px;
  font-size: 16px;
}
.stage-9x16.temple-3d-mode .hud-gift-cards {
  gap: 12px;
}
.stage-9x16.temple-3d-mode .hud-gift-card {
  border-radius: 13px 5px 13px 5px;
  background:
    linear-gradient(145deg, rgba(157, 102, 43, .25), transparent 60%),
    linear-gradient(180deg, rgba(46, 31, 20, .98), rgba(12, 11, 10, .98));
}
.stage-9x16.temple-3d-mode .gift-emoji {
  font-size: 44px;
}
.stage-9x16.temple-3d-mode .gift-title {
  font-size: 17px;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  padding: 17px 18px;
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  font-size: 15px;
  letter-spacing: 2px;
}
.stage-9x16.temple-3d-mode .leader-item {
  min-height: 29px;
  font-size: 14px;
}
.stage-9x16.temple-3d-mode .leader-name {
  font-size: 14px;
}
.stage-9x16.temple-3d-mode .leader-merit {
  font-size: 13px;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .bottom-hud-bar {
    height: 198px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 6px;
  }
  .stage-9x16.temple-3d-mode .hud-left-col,
  .stage-9x16.temple-3d-mode .hud-right-leaderboard {
    padding: 7px;
  }
  .stage-9x16.temple-3d-mode .hud-left-col { gap: 6px; }
  .stage-9x16.temple-3d-mode .hud-active-notice {
    min-height: 34px;
    height: 34px;
    flex-basis: 34px;
    padding: 0 7px;
    font-size: 10px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-cards { gap: 5px; }
  .stage-9x16.temple-3d-mode .gift-emoji { font-size: 25px; }
  .stage-9x16.temple-3d-mode .gift-title { font-size: 10px; }
  .stage-9x16.temple-3d-mode .hud-lb-header { font-size: 10px; }
  .stage-9x16.temple-3d-mode .leader-item,
  .stage-9x16.temple-3d-mode .leader-name { font-size: 9px; }
  .stage-9x16.temple-3d-mode .leader-merit { font-size: 8px; }
}

/* Cinematic scene finish — 3D mode only. The soft edge falloff adds depth,
   protects HUD contrast, and leaves the central Buddha/altar unobscured. */
.stage-9x16.temple-3d-mode::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 43%, transparent 42%, rgba(8, 4, 3, .16) 76%, rgba(5, 3, 3, .42) 100%),
    linear-gradient(180deg, rgba(8, 4, 3, .22) 0%, transparent 17%, transparent 72%, rgba(7, 4, 3, .38) 100%);
}


/* ==========================================================================
   3D BROADCAST INTERFACE — sculpted sanctuary console (3D only)
   Replaces the legacy compact 2D-like cards with a readable live control deck.
   ========================================================================== */
.stage-9x16.temple-3d-mode .minimal-top-bar {
  top: 26px;
  left: 28px;
  right: 28px;
  align-items: center;
  gap: 18px;
}
.stage-9x16.temple-3d-mode .live-pill {
  min-height: 64px;
  padding: 10px 22px 10px 17px;
  gap: 13px;
  border: 1px solid rgba(255, 222, 164, .62);
  border-radius: 18px 8px 18px 8px;
  background: linear-gradient(115deg, rgba(45, 24, 15, .94), rgba(12, 10, 9, .82));
  box-shadow: 0 12px 30px rgba(0,0,0,.34), inset 0 1px rgba(255,245,218,.18), inset 0 -1px rgba(198,137,58,.16);
  color: #fff1d4;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
}
.stage-9x16.temple-3d-mode .live-pill::after {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(255,218,145,.48);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(164,111,48,.3), rgba(67,39,20,.38));
  color: #ffe5ae;
  font-size: 10px;
  letter-spacing: 1.2px;
}
.stage-9x16.temple-3d-mode .live-dot {
  width: 13px;
  height: 13px;
  box-shadow: 0 0 0 5px rgba(46,204,113,.12), 0 0 16px rgba(46,204,113,.7);
}
.stage-9x16.temple-3d-mode .mini-stat-pill {
  min-height: 60px;
  padding: 9px 18px;
  gap: 9px;
  border: 1px solid rgba(255,220,157,.46);
  border-radius: 8px 18px 8px 18px;
  background: linear-gradient(135deg, rgba(42,25,15,.94), rgba(12,10,9,.86));
  box-shadow: 0 12px 30px rgba(0,0,0,.3), inset 0 1px rgba(255,245,218,.13);
  color: #f7e7c9;
  font-size: 14px;
  letter-spacing: .35px;
}
.stage-9x16.temple-3d-mode .mini-stat-pill strong {
  color: #ffdc8b;
  font-size: 18px;
  text-shadow: 0 0 12px rgba(255,190,86,.22);
}
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  left: 24px;
  right: 24px;
  bottom: 24px;
  height: 218px;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, .88fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,220,157,.52);
  border-radius: 22px 8px 22px 8px;
  background:
    linear-gradient(115deg, rgba(67,39,23,.42), transparent 38%),
    linear-gradient(155deg, rgba(25,18,14,.96), rgba(8,8,8,.94));
  box-shadow: 0 18px 48px rgba(0,0,0,.48), inset 0 1px rgba(255,245,218,.16), inset 0 -2px rgba(157,100,42,.22);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}
.stage-9x16.temple-3d-mode .hud-left-col {
  min-width: 0;
  gap: 10px;
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  min-height: 44px;
  height: 44px;
  flex: 0 0 44px;
  justify-content: flex-start;
  padding: 0 15px;
  gap: 9px;
  border: 1px solid rgba(255,220,157,.3);
  border-left: 3px solid #d9a84e;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(131,81,34,.24), rgba(255,240,210,.035));
  color: #ffe8bd;
  font-size: 15px;
  font-weight: 700;
}
.stage-9x16.temple-3d-mode .hud-gift-cards {
  min-height: 0;
  flex: 1 1 auto;
  gap: 10px;
}
.stage-9x16.temple-3d-mode .hud-gift-card {
  min-width: 0;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 9px;
  border: 1px solid rgba(226,190,126,.3);
  border-radius: 12px 5px 12px 5px;
  background:
    linear-gradient(145deg, rgba(125,77,37,.28), transparent 55%),
    linear-gradient(180deg, rgba(39,27,19,.94), rgba(14,12,11,.96));
  box-shadow: inset 0 1px rgba(255,244,218,.1), 0 7px 18px rgba(0,0,0,.22);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stage-9x16.temple-3d-mode .hud-gift-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,222,157,.8);
  box-shadow: inset 0 1px rgba(255,244,218,.16), 0 10px 24px rgba(0,0,0,.32), 0 0 18px rgba(210,157,75,.12);
}
.stage-9x16.temple-3d-mode .gift-coin-tag {
  color: #cdb58d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.stage-9x16.temple-3d-mode .gift-card-body {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.stage-9x16.temple-3d-mode .gift-emoji {
  font-size: 38px;
  line-height: 1;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.38));
}
.stage-9x16.temple-3d-mode .gift-title {
  color: #ffe4ae;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .35px;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,220,157,.28);
  border-radius: 8px 15px 8px 15px;
  background: linear-gradient(155deg, rgba(255,231,188,.075), rgba(255,231,188,.018));
  box-shadow: inset 0 1px rgba(255,244,218,.08);
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  margin: 0 0 9px;
  padding: 0 0 9px;
  border-bottom: 1px solid rgba(226,190,126,.26);
  color: #ffdfa0;
  font-size: 14px;
  letter-spacing: 1.8px;
}
.stage-9x16.temple-3d-mode .hud-lb-list {
  gap: 7px;
}
.stage-9x16.temple-3d-mode .leader-item {
  min-height: 25px;
  gap: 7px;
  font-size: 13px;
}
.stage-9x16.temple-3d-mode .leader-rank {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin: 0;
  border: 1px solid rgba(255,215,132,.4);
  background: rgba(199,145,65,.16);
  color: #ffe2a5;
  font-size: 11px;
}
.stage-9x16.temple-3d-mode .leader-name {
  color: #f4e8d5;
  font-size: 13px;
}
.stage-9x16.temple-3d-mode .leader-merit {
  color: #ffdc8b;
  font-size: 12px;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .minimal-top-bar {
    top: 18px;
    left: 16px;
    right: 16px;
    gap: 8px;
  }
  .stage-9x16.temple-3d-mode .live-pill {
    min-height: 48px;
    padding: 7px 10px;
    gap: 7px;
    font-size: 11px;
  }
  .stage-9x16.temple-3d-mode .live-pill::after {
    min-height: 21px;
    padding: 0 7px;
    font-size: 8px;
  }
  .stage-9x16.temple-3d-mode .mini-stat-pill {
    min-height: 46px;
    padding: 5px 8px;
    gap: 4px;
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .mini-stat-pill strong {
    font-size: 11px;
  }
  .stage-9x16.temple-3d-mode .bottom-hud-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 188px;
    gap: 7px;
    padding: 7px;
  }
  .stage-9x16.temple-3d-mode .hud-active-notice {
    min-height: 34px;
    height: 34px;
    flex-basis: 34px;
    padding: 0 8px;
    font-size: 10px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-cards {
    gap: 5px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-card {
    gap: 5px;
    padding: 7px 4px;
  }
  .stage-9x16.temple-3d-mode .gift-coin-tag {
    font-size: 8px;
  }
  .stage-9x16.temple-3d-mode .gift-emoji {
    font-size: 25px;
  }
  .stage-9x16.temple-3d-mode .gift-title {
    font-size: 10px;
  }
  .stage-9x16.temple-3d-mode .hud-right-leaderboard {
    padding: 7px;
  }
  .stage-9x16.temple-3d-mode .hud-lb-header {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .stage-9x16.temple-3d-mode .leader-item,
  .stage-9x16.temple-3d-mode .leader-name {
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .leader-rank {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
    font-size: 8px;
  }
  .stage-9x16.temple-3d-mode .leader-merit {
    font-size: 8px;
  }
}


/* 3D RITUAL CONSOLE — distinct ceremonial modules, 3D mode only. */
.stage-9x16.temple-3d-mode .bottom-hud-bar {
  height: 232px;
  left: 22px;
  right: 22px;
  bottom: 22px;
  gap: 13px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.stage-9x16.temple-3d-mode .hud-left-col,
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(239, 196, 119, .58);
  border-radius: 17px 5px 17px 5px;
  background:
    linear-gradient(130deg, rgba(184, 126, 55, .16), transparent 42%),
    linear-gradient(160deg, rgba(25, 19, 15, .97), rgba(7, 8, 9, .97));
  box-shadow: 0 18px 42px rgba(0,0,0,.48), inset 0 1px rgba(255,245,218,.16), inset 0 -2px rgba(177,119,48,.16);
}
.stage-9x16.temple-3d-mode .hud-left-col::before,
.stage-9x16.temple-3d-mode .hud-right-leaderboard::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 5px;
  border: 1px solid rgba(255, 224, 166, .13);
  border-radius: 11px 3px 11px 3px;
  pointer-events: none;
}
.stage-9x16.temple-3d-mode .hud-left-col {
  padding: 12px;
  gap: 10px;
}
.stage-9x16.temple-3d-mode .hud-panel-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 0 4px 7px;
  border-bottom: 1px solid rgba(231, 190, 119, .24);
  color: #eacb91;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.stage-9x16.temple-3d-mode .hud-panel-kicker span:last-child {
  color: rgba(244, 222, 184, .55);
  font-size: 8px;
  letter-spacing: 1.2px;
}
.stage-9x16.temple-3d-mode .hud-active-notice {
  min-height: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 6px;
  border-left: 3px solid #d9a84e;
  background: linear-gradient(90deg, rgba(144, 91, 39, .25), rgba(255,240,210,.025));
  font-size: 13px;
}
.stage-9x16.temple-3d-mode .hud-gift-cards { gap: 9px; }
.stage-9x16.temple-3d-mode .hud-gift-card {
  position: relative;
  justify-content: center;
  border: 1px solid rgba(226, 190, 126, .34);
  border-radius: 11px 4px 11px 4px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255,211,132,.12), transparent 58%),
    linear-gradient(180deg, rgba(55,37,24,.96), rgba(12,11,10,.98));
  box-shadow: inset 0 1px rgba(255,244,218,.13), inset 0 -3px rgba(0,0,0,.3), 0 8px 18px rgba(0,0,0,.25);
  cursor: pointer;
}
.stage-9x16.temple-3d-mode .hud-gift-card::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 9px;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(239, 202, 137, .42);
  border-radius: 50%;
  color: #f3d49a;
  font-size: 9px;
  line-height: 17px;
  text-align: center;
}
.stage-9x16.temple-3d-mode .hud-gift-card:nth-child(1)::before { content: '01'; }
.stage-9x16.temple-3d-mode .hud-gift-card:nth-child(2)::before { content: '02'; }
.stage-9x16.temple-3d-mode .hud-gift-card:nth-child(3)::before { content: '03'; }
.stage-9x16.temple-3d-mode .hud-gift-card:hover,
.stage-9x16.temple-3d-mode .hud-gift-card:focus-visible {
  transform: translateY(-4px);
  outline: none;
  border-color: rgba(255, 226, 166, .9);
  box-shadow: inset 0 1px rgba(255,244,218,.2), 0 12px 25px rgba(0,0,0,.35), 0 0 20px rgba(218,166,83,.16);
}
.stage-9x16.temple-3d-mode .gift-emoji {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(241, 203, 139, .22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(237,184,96,.16), rgba(20,14,10,.12) 70%);
  font-size: 35px;
}
.stage-9x16.temple-3d-mode .gift-title {
  font-size: 14px;
  letter-spacing: .5px;
}
.stage-9x16.temple-3d-mode .hud-right-leaderboard {
  padding: 15px 16px;
}
.stage-9x16.temple-3d-mode .hud-lb-header {
  display: flex;
  align-items: center;
  min-height: 27px;
  margin-bottom: 10px;
  padding: 0 0 9px 28px;
  border-bottom: 1px solid rgba(231,190,119,.3);
  color: #ffdfa0;
  font-size: 13px;
  letter-spacing: 1.8px;
}
.stage-9x16.temple-3d-mode .hud-lb-header::before {
  content: '✦';
  position: absolute;
  left: 16px;
  color: #e7b85f;
  font-size: 17px;
}
.stage-9x16.temple-3d-mode .hud-lb-list { gap: 7px; }
.stage-9x16.temple-3d-mode .leader-item {
  min-height: 28px;
  padding: 2px 3px;
  border-bottom: 1px solid rgba(255,226,177,.07);
}
.stage-9x16.temple-3d-mode .leader-item:first-child .leader-rank {
  border-color: rgba(255,220,132,.8);
  background: linear-gradient(145deg, rgba(236,185,83,.34), rgba(128,78,25,.2));
  color: #ffe7a7;
  box-shadow: 0 0 12px rgba(229,174,75,.14);
}
.stage-9x16.temple-3d-mode .leader-rank {
  border-radius: 6px 2px 6px 2px;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .bottom-hud-bar {
    height: 196px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 6px;
  }
  .stage-9x16.temple-3d-mode .hud-left-col { padding: 7px; gap: 6px; }
  .stage-9x16.temple-3d-mode .hud-panel-kicker {
    min-height: 18px;
    padding-bottom: 4px;
    font-size: 8px;
    letter-spacing: 1px;
  }
  .stage-9x16.temple-3d-mode .hud-panel-kicker span:last-child { font-size: 6px; }
  .stage-9x16.temple-3d-mode .hud-active-notice {
    min-height: 31px;
    height: 31px;
    flex-basis: 31px;
    font-size: 9px;
  }
  .stage-9x16.temple-3d-mode .hud-gift-card::before {
    top: 4px; left: 5px; width: 15px; height: 15px;
    font-size: 7px; line-height: 13px;
  }
  .stage-9x16.temple-3d-mode .gift-emoji { width: 38px; height: 38px; font-size: 23px; }
  .stage-9x16.temple-3d-mode .gift-title { font-size: 9px; }
  .stage-9x16.temple-3d-mode .hud-right-leaderboard { padding: 8px; }
  .stage-9x16.temple-3d-mode .hud-lb-header { font-size: 9px; }
  .stage-9x16.temple-3d-mode .leader-item { min-height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage-9x16.temple-3d-mode .hud-gift-card { transition: none; }
}

/* Reference finish — a quiet antique-brass frame around the 3D sanctuary only.
   It sits above the scene/HUD but never intercepts pointer or touch input. */
.stage-9x16.temple-3d-mode {
  border-radius: 42px;
  isolation: isolate;
}
.stage-9x16.temple-3d-mode::before {
  content: '';
  position: absolute;
  inset: 16px;
  z-index: 50;
  border: 3px solid rgba(186, 137, 51, .82);
  border-radius: 34px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 226, 157, .2),
    inset 0 0 18px rgba(205, 151, 61, .055),
    0 0 0 1px rgba(14, 7, 3, .92);
  pointer-events: none;
}

/* 3D leaderboard empty state — keep the panel intentional before the first live contribution. */
.stage-9x16.temple-3d-mode .hud-lb-list:empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 0;
}
.stage-9x16.temple-3d-mode .hud-lb-list:empty::before {
  content: '✧';
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(230, 190, 119, .34);
  border-radius: 50%;
  color: #edc879;
  background: radial-gradient(circle, rgba(226, 176, 87, .15), rgba(26, 18, 13, .1) 72%);
  box-shadow: 0 0 18px rgba(218, 169, 83, .08), inset 0 0 9px rgba(255, 230, 180, .06);
  font-size: 18px;
  line-height: 1;
}
.stage-9x16.temple-3d-mode .hud-lb-list:empty::after {
  content: 'Chưa có lượt cúng dường\A Mỗi tấm lòng đều được trân trọng';
  color: rgba(239, 221, 190, .62);
  font-size: 9px;
  letter-spacing: .15px;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
}
@media (max-width: 480px) {
  .stage-9x16.temple-3d-mode .hud-lb-list:empty::before {
    width: 21px;
    height: 21px;
    font-size: 14px;
  }
  .stage-9x16.temple-3d-mode .hud-lb-list:empty::after {
    font-size: 7px;
  }
}
