/* Nhà Thờ Online — giao diện sân khấu 9:16 + bảng điều khiển */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  overflow: hidden;
  background: #0d0a08;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #fff8e1;
}
.app-workspace {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  gap: 24px;
  padding: 12px;
}
.stage-wrapper {
  position: relative;
  height: 96vh;
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid rgba(212, 175, 55, 0.55);
  background: #0d0a08;
  contain: layout paint style;
}
.stage-9x16 {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  transform-origin: top left;
  overflow: hidden;
  background: #0d0a08;
  contain: strict;
}
.altar-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.altar-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 18%, rgba(0,0,0,0) 72%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
#churchCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
.top-bar {
  position: absolute;
  top: 24px;
  left: var(--safe-inset, 24px);
  right: var(--safe-inset, 24px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.fake-online-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(20, 12, 6, 0.85);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  font-size: 17px;
  font-weight: 700;
  color: #ffe082;
}
.fake-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 10px #ff3b30;
  animation: fakePulse 1.6s ease-in-out infinite;
}
@keyframes fakePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.fake-online-line {
  font-size: 15px;
  font-weight: 700;
  color: #ffe082;
  text-align: center;
}
.live-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(20, 12, 6, 0.88);
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffe082;
}
.live-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd54f;
  box-shadow: 0 0 12px #ffd54f;
}
.stat-pills {
  position: absolute;
  top: 100px;
  left: var(--safe-inset, 24px);
  right: var(--safe-inset, 24px);
  z-index: 20;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.stat-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 12, 6, 0.85);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  font-size: 19px;
  color: #ffecb3;
}
.stat-pill strong { color: #fff; }

/* Dãy nến */
.candle-stand {
  position: absolute;
  bottom: 250px;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  justify-content: center;
  gap: 16px;
}
.candle {
  width: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.candle-flame {
  width: 20px;
  height: 30px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 70%, #fff8e1 0%, #ffca28 35%, #ff6f00 70%, rgba(255, 111, 0, 0) 100%);
  opacity: 0;
  transform-origin: 50% 100%;
}
.candle.lit .candle-flame {
  opacity: 1;
  animation: flick 0.9s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 14px rgba(255, 202, 40, 0.9));
}
@keyframes flick {
  from { transform: scale(1) rotate(-2deg); }
  to { transform: scale(1.12, 1.2) rotate(2deg); }
}
.candle-body {
  width: 22px;
  height: 84px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #cfd8dc, #90a4ae);
}
.candle.lit .candle-body {
  background: linear-gradient(180deg, #fffde7, #ffe082);
  box-shadow: 0 0 18px rgba(255, 224, 130, 0.55);
}

/* Hoa dâng bay lên */
.flower-layer {
  position: absolute;
  inset: 0;
  z-index: 16;
  pointer-events: none;
  overflow: hidden;
}
.flower-float {
  position: absolute;
  bottom: 420px;
  font-size: 44px;
  animation: flowerUp 4s ease-out forwards;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}
@keyframes flowerUp {
  from { transform: translateY(0) scale(0.8); opacity: 0; }
  15% { opacity: 1; }
  to { transform: translateY(-420px) scale(1.15); opacity: 0; }
}

/* Hạt chuỗi Mân Côi */
.rosary-row {
  position: absolute;
  bottom: 380px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(20, 12, 6, 0.8);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
}
.rosary-bead {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}
.rosary-bead.on {
  background: #ffd54f;
  border-color: #ffe082;
  box-shadow: 0 0 12px rgba(255, 213, 79, 0.9);
}

/* Thanh nút nhanh dưới đáy sân khấu */
.bottom-hud-bar {
  position: absolute;
  bottom: 20px;
  left: var(--safe-inset, 24px);
  right: var(--safe-inset, 24px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hud-gift-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.hud-gift-card {
  cursor: pointer;
  background: rgba(20, 12, 6, 0.92);
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  border-radius: 14px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 30px;
}
.hud-gift-card span { font-size: 17px; font-weight: 700; color: #ffecb3; }
.hud-gift-card:hover { border-color: #ffe082; }
.hud-feed {
  min-height: 30px;
  font-size: 18px;
  color: #ffe082;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* Bảng điều khiển */
.quick-dock {
  width: 390px;
  max-height: 96vh;
  overflow-y: auto;
  background: #17100a;
  border: 1.5px solid rgba(212, 175, 55, 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(212, 175, 55, 0.25);
  padding-bottom: 12px;
}
.dock-title { font-size: 19px; font-weight: 800; color: #ffe082; }
.dock-section {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-section-title { font-size: 13px; font-weight: 700; color: #ffe082; }
.dock-btn {
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(255, 255, 255, 0.06);
  color: #ffecb3;
  cursor: pointer;
}
.dock-btn.gold {
  background: linear-gradient(180deg, #ffd54f, #d4af37);
  color: #3a2200;
  border: none;
}
.dock-btn.active-toggle { border-color: #ffd54f; }
.dock-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dock-input {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  border-radius: 10px;
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #fff8e1;
  outline: none;
}
.dock-input[readonly] { opacity: 0.75; }
.volume-control-row { display: flex; flex-direction: column; gap: 6px; }
.volume-label-line { display: flex; justify-content: space-between; font-size: 13px; }
.volume-slider { width: 100%; }
.event-feed { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #d7ccc8; }
.event-feed-item { line-height: 1.4; }
.dock-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: #bcaaa4;
  text-align: center;
}

/* Cổng tên thánh + nút điện thoại + banner dự phòng */
#btnToggleControls { display: none; }
.name-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 4, 2, 0.88);
  backdrop-filter: blur(3px);
}
.name-gate.hidden { display: none; }
.name-gate-card {
  width: 100%;
  max-width: 420px;
  background: #17100a;
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  border-radius: 20px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.name-gate-title { font-size: 22px; font-weight: 800; color: #ffe082; text-align: center; }
.name-gate-desc { font-size: 15px; line-height: 1.5; color: #f5e9c8; text-align: center; }
#inputTenThanhGate {
  width: 100%;
  padding: 13px 14px;
  font-size: 18px;
  border-radius: 12px;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  background: rgba(0, 0, 0, 0.35);
  color: #fff8e1;
  outline: none;
}
#inputTenThanhGate:focus { border-color: #ffd54f; }
.name-gate-error { min-height: 20px; font-size: 14px; color: #ffab91; text-align: center; }
#btnClaimTenThanh {
  padding: 13px;
  font-size: 17px;
  font-weight: 800;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, #ffd54f, #d4af37);
  color: #3a2200;
  cursor: pointer;
}
#btnClaimTenThanh:disabled { opacity: 0.55; }
.name-gate-active { border-top: 1px solid rgba(212, 175, 55, 0.25); padding-top: 10px; font-size: 13px; color: #d7ccc8; }
.name-gate-active-title { font-weight: 700; color: #ffe082; margin-bottom: 4px; }
#nameGateActiveList { line-height: 1.5; word-break: break-word; }
#nameLocalNote {
  display: none;
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(23, 16, 10, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.6);
  color: #ffe082;
  font-size: 13px;
  white-space: nowrap;
  max-width: 94vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nameLocalNote.visible { display: block; }

/* Cửa sổ Lời nguyện */
.prayer-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
}
.prayer-modal-overlay.visible { display: flex; }
.prayer-modal-card {
  width: 100%;
  max-width: 480px;
  background: #17100a;
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.prayer-modal-badge { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: #ffd54f; }
.prayer-modal-text {
  font-family: 'Noto Serif', serif;
  font-size: 20px;
  line-height: 1.65;
  color: #fff8e1;
}
.prayer-modal-devotee { font-size: 14px; color: #d7ccc8; }
.prayer-modal-actions { display: flex; gap: 10px; justify-content: center; }

/* Điện thoại: sân khấu full, dock thành tấm trượt ẩn mặc định */
@media (max-width: 768px) {
  .app-workspace { display: block; padding: 0; gap: 0; height: 100dvh; }
  .stage-wrapper { width: 100vw; height: 100dvh; aspect-ratio: auto; border: none; border-radius: 0; }
  .quick-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 66dvh;
    border-radius: 20px 20px 0 0;
    z-index: 50;
    transform: translateY(105%);
    transition: transform 0.3s ease;
    padding-bottom: 84px;
  }
  body.controls-open .quick-dock { transform: translateY(0); }
  #btnToggleControls {
    display: flex;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 61;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(23, 16, 10, 0.92);
    border: 1.5px solid rgba(212, 175, 55, 0.7);
    color: #ffd54f;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Khung viền vàng trang trí (chỉ điện thoại) ------------------ */
.fake-frame { display: none; }
@media (max-width: 768px) {
  .fake-frame {
    display: block;
    position: fixed;
    inset: 10px;
    z-index: 45;
    pointer-events: none;
    border: 2px solid rgba(212, 175, 55, 0.75);
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35), inset 0 0 24px rgba(0, 0, 0, 0.35);
  }
}
