/* ==========================================================================
   CHÙA VITECCONS ONLINE — 3D EDITION
   Hệ thống giao diện "Glass" kiểu iOS: blur dày, trong suốt nhiều lớp,
   viền sáng mảnh + highlight trên, bo góc lớn, đổ bóng mềm.
   ========================================================================== */
:root {
  --glass-bg: rgba(28, 14, 10, 0.52);
  --glass-bg-strong: rgba(24, 12, 8, 0.68);
  --glass-border: rgba(255, 210, 140, 0.28);
  --glass-highlight: rgba(255, 255, 255, 0.14);
  --gold-bright: #ffe89e;
  --gold-main: #f4c150;
  --ivory: #fff8eb;
  --muted-gold: #e0c298;
  --radius-lg: 20px;
  --radius-md: 14px;
  --blur: saturate(150%) blur(22px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #100503;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ivory);
}

.app-workspace {
  display: flex;
  width: 100vw;
  height: 100vh;
  gap: 14px;
  padding: 12px;
}

/* ==========================================================================
   KHUNG CẢNH 3D
   ========================================================================== */
.stage-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  height: calc(100vh - 24px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 var(--glass-highlight);
  background: radial-gradient(ellipse 70% 60% at 50% 35%, #4a1c0e 0%, #1c0a05 80%);
}

#templeCanvas3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.labels-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
   GLASS CHUNG
   ========================================================================== */
.glass,
.live-pill,
.mini-stat-pill,
.scene-hint,
.hud-active-notice,
.hud-gift-card,
.hud-right-leaderboard,
.name-label,
.lantern-tag,
.fortune-scroll-card,
.grand-ceremony-banner,
.quick-dock,
.dock-section {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 var(--glass-highlight);
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */
.minimal-top-bar {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  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 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ivory);
}

.brand-mark {
  height: 20px;
  width: auto;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.35));
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 8px #34c759;
}

.mini-stat-pill strong {
  color: var(--gold-bright);
}

.scene-hint {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted-gold);
  pointer-events: none;
  white-space: nowrap;
}

.scene-hint b {
  color: var(--gold-bright);
}

/* ==========================================================================
   NHÃN TÊN TRÊN ĐẦU NHÂN VẬT (glass pill chiếu từ 3D)
   ========================================================================== */
.name-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #ffe9bd;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  will-change: transform;
}

.name-label.vip-label {
  color: #fff3c8;
  border-color: rgba(255, 220, 120, 0.6);
  font-weight: 800;
}

.name-label.me-label {
  color: #d8f5e3;
  border-color: rgba(120, 230, 160, 0.55);
}

.name-label.walker-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 16px;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}

.name-label.walker-label span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-gold);
}

.lantern-tag {
  position: absolute;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 260px;
  will-change: transform;
}

.lantern-tag b {
  color: var(--gold-bright);
}

.lantern-tag span {
  color: #f7e6cc;
  font-style: italic;
  font-weight: 500;
}

.merit-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 800;
  font-family: 'Noto Serif', serif;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 22px currentColor;
  animation: meritFloat 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes meritFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.7);
  }

  15% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(1);
  }
}

/* ==========================================================================
   HUD DƯỚI ĐÁY
   ========================================================================== */
.bottom-hud-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.hud-left-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.hud-active-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ivory);
}

.hud-active-notice strong {
  color: var(--gold-bright);
}

.flower-bullet {
  font-size: 13px;
}

.hud-gift-cards {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.hud-gift-card {
  position: relative;
  min-width: 128px;
  padding: 22px 16px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hud-gift-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), inset 0 1px 0 var(--glass-highlight);
}

.hud-gift-card:active {
  transform: translateY(-1px) scale(0.98);
}

.gift-coin-tag {
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #3a1c04;
  background: linear-gradient(180deg, #ffd766, #e8a52c);
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

/* Thẻ Cầu Duyên — tông hồng nổi bật giữa hàng thẻ lễ */
.gift-coin-tag.pink {
  color: #3d0a1e;
  background: linear-gradient(180deg, #ffb1c9, #e86a92);
}

.hud-gift-card.duyen-card {
  border-color: rgba(255, 150, 180, 0.4);
  background: rgba(70, 22, 34, 0.5);
}

.hud-gift-card.duyen-card .gift-title {
  color: #ffb9cd;
}

/* có lời trao duyên đến → thẻ 💞 nhấp nháy cho dễ thấy */
.hud-gift-card.duyen-card.has-req {
  animation: duyenPulse 1.2s ease-in-out infinite;
}

.gift-card-body {
  display: flex;
  align-items: center;
  gap: 9px;
}

.gift-emoji {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.gift-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--gold-bright);
}

.hud-right-leaderboard {
  width: 240px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  pointer-events: auto;
}

/* nút 🏆 chỉ hiện trên điện thoại — bật/tắt bảng công đức dạng overlay */
.lb-toggle {
  display: none;
}

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

.hud-lb-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.leader-item {
  display: flex;
  align-items: center;
  font-size: 13.5px;
}

.leader-rank {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(244, 193, 80, 0.2);
  border: 1px solid rgba(244, 193, 80, 0.7);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.leader-name {
  flex: 1;
  font-weight: 600;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-merit {
  font-weight: 800;
  color: var(--gold-bright);
  margin-left: 8px;
}

/* ==========================================================================
   BANNER ĐẠI LỄ + MODAL QUẺ XĂM
   ========================================================================== */
.grand-ceremony-banner {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  z-index: 30;
  padding: 22px 44px;
  border-radius: var(--radius-lg);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.grand-ceremony-banner.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.grand-title {
  font-family: 'Noto Serif', serif;
  font-size: 30px;
  font-weight: 900;
  color: var(--gold-bright);
  text-shadow: 0 0 26px rgba(255, 210, 100, 0.55);
}

.grand-sub {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ivory);
}

.fortune-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 4, 2, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.fortune-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.fortune-scroll-card {
  max-width: 480px;
  padding: 28px 34px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg-strong);
  text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.fortune-modal-overlay.visible .fortune-scroll-card {
  transform: translateY(0) scale(1);
}

.fortune-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #3a1c04;
  background: linear-gradient(180deg, #ffd766, #e8a52c);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.fortune-heading {
  font-family: 'Noto Serif', serif;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold-bright);
  margin-bottom: 6px;
}

.fortune-devotee {
  font-size: 13px;
  color: var(--muted-gold);
  margin-bottom: 14px;
}

.fortune-poem {
  font-size: 15.5px;
  font-style: italic;
  line-height: 1.7;
  color: var(--ivory);
  white-space: pre-line;
  margin-bottom: 12px;
}

.fortune-meaning {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted-gold);
}

/* ── Gieo quẻ: lật thẻ + số quẻ lớn + theme theo hạng ── */
.fortune-number {
  font-family: 'Noto Serif', serif;
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  background: linear-gradient(180deg, #fff6d8, #e8a52c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(232, 165, 44, 0.35);
}

.fortune-scroll-card.flip-in {
  animation: fortuneFlip 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes fortuneFlip {
  0% {
    transform: perspective(900px) rotateY(88deg) scale(0.85);
    opacity: 0;
  }

  60% {
    transform: perspective(900px) rotateY(-12deg) scale(1.03);
    opacity: 1;
  }

  100% {
    transform: perspective(900px) rotateY(0) scale(1);
    opacity: 1;
  }
}

.fortune-modal-overlay[data-rank="top"] .fortune-scroll-card {
  box-shadow: 0 0 60px rgba(255, 200, 80, 0.35), inset 0 0 40px rgba(255, 215, 120, 0.06);
}

.fortune-modal-overlay[data-rank="top"] .fortune-badge {
  background: linear-gradient(180deg, #ffe9a8, #f0b429);
  box-shadow: 0 0 18px rgba(255, 200, 80, 0.6);
}

.fortune-modal-overlay[data-rank="mid"] .fortune-badge {
  background: linear-gradient(180deg, #cfe8ff, #7fa8d8);
  color: #16324f;
}

.fortune-modal-overlay[data-rank="low"] .fortune-badge {
  background: linear-gradient(180deg, #d8cfc4, #9a8a76);
  color: #2a1c10;
}

.poem-line {
  display: block;
  opacity: 0;
  transform: translateY(8px);
  animation: poemLineIn 0.55s ease forwards;
}

@keyframes poemLineIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fortune-close {
  margin-top: 16px;
  padding: 9px 22px;
  border: 1px solid rgba(216, 160, 60, 0.5);
  border-radius: 999px;
  background: rgba(216, 160, 60, 0.14);
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.fortune-close:hover {
  background: rgba(216, 160, 60, 0.3);
}

/* ── Màn chúc mừng kết duyên ── */
.bond-celebration {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.bond-celebration.visible {
  opacity: 1;
  pointer-events: auto;
}

.bond-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 214, 120, 0.32), rgba(120, 40, 10, 0.55) 75%);
}

.bond-card {
  position: relative;
  text-align: center;
  padding: 38px 54px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(60, 22, 8, 0.92), rgba(30, 10, 4, 0.95));
  border: 1px solid rgba(255, 205, 110, 0.55);
  box-shadow: 0 0 80px rgba(255, 190, 80, 0.35), inset 0 0 50px rgba(255, 200, 100, 0.08);
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.bond-celebration.visible .bond-card {
  transform: scale(1);
}

.bond-emoji {
  font-size: 46px;
  animation: bondPulse 1.1s ease-in-out infinite;
}

@keyframes bondPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18) rotate(-6deg);
  }
}

.bond-title {
  font-family: 'Noto Serif', serif;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #ffe9a8, #e8a52c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 6px 0 14px;
}

.bond-names {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.bond-names i {
  font-style: normal;
  color: #ff7a9a;
  animation: heartBeat 0.9s ease-in-out infinite;
}

@keyframes heartBeat {

  0%,
  100% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.35);
  }
}

.bond-sub {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted-gold);
  letter-spacing: 0.5px;
}

.bond-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bond-confetti i {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }

  85% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(105vh) rotate(720deg);
  }
}

/* ── Modal Tử vi & Hoàng đạo ── */
.zen-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 4, 2, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.zen-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.zen-card {
  width: min(560px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg-strong);
}

.zen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.zen-title {
  font-family: 'Noto Serif', serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--gold-bright);
  letter-spacing: 1px;
}

.zen-close {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ivory);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.zen-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.zen-birth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted-gold);
}

.zen-birth input[type="date"] {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(216, 160, 60, 0.4);
  border-radius: 8px;
  color: var(--ivory);
  padding: 7px 10px;
  font-size: 13px;
}

.zen-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #e8a52c, #b97f14);
  color: #2a1503;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.zen-btn:hover {
  filter: brightness(1.1);
}

.zen-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.zen-tab {
  flex: 1;
  min-width: 80px;
  padding: 8px 6px;
  border: 1px solid rgba(216, 160, 60, 0.3);
  border-radius: 9px;
  background: transparent;
  color: var(--muted-gold);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.zen-tab.active {
  background: rgba(216, 160, 60, 0.22);
  color: var(--gold-bright);
  border-color: rgba(216, 160, 60, 0.7);
}

.zen-body {
  font-size: 14px;
  color: var(--ivory);
  line-height: 1.65;
}

.zen-body h4 {
  font-family: 'Noto Serif', serif;
  color: var(--gold-bright);
  margin: 12px 0 6px;
  font-size: 15px;
}

.zen-score {
  display: inline-block;
  font-size: 30px;
  font-weight: 900;
  font-family: 'Noto Serif', serif;
  margin-right: 8px;
}

.zen-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin: 2px 4px 2px 0;
}

.zen-pill.good {
  background: rgba(95, 191, 106, 0.2);
  color: #8fe0a0;
  border: 1px solid rgba(95, 191, 106, 0.4);
}

.zen-pill.mid {
  background: rgba(216, 160, 60, 0.18);
  color: #ffd98a;
  border: 1px solid rgba(216, 160, 60, 0.4);
}

.zen-pill.bad {
  background: rgba(255, 90, 90, 0.15);
  color: #ff9a9a;
  border: 1px solid rgba(255, 90, 90, 0.35);
}

.zen-day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
}

.zen-day-row .d-date {
  font-weight: 800;
  min-width: 110px;
}

.zen-day-row .d-can {
  color: var(--gold-bright);
  font-weight: 700;
  min-width: 90px;
}

.zen-day-row .d-why {
  color: var(--muted-gold);
  font-size: 12.5px;
  flex: 1;
}

.zen-note {
  font-size: 11.5px;
  color: rgba(255, 217, 138, 0.55);
  margin-top: 12px;
  font-style: italic;
}

.zen-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.zen-chart-cell {
  text-align: center;
  padding: 10px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(216, 160, 60, 0.2);
}

.zen-chart-cell .cz-label {
  font-size: 11px;
  color: var(--muted-gold);
}

.zen-chart-cell .cz-val {
  font-size: 17px;
  font-weight: 900;
  color: var(--gold-bright);
  font-family: 'Noto Serif', serif;
}

.zen-lucky {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 13px;
}

.zen-lucky span b {
  color: var(--gold-bright);
}

/* ==========================================================================
   QUICK DOCK (GLASS SIDEBAR)
   ========================================================================== */
.quick-dock {
  width: 372px;
  flex-shrink: 0;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--glass-bg-strong);
}

.quick-dock::-webkit-scrollbar {
  width: 6px;
}

.quick-dock::-webkit-scrollbar-thumb {
  background: rgba(244, 193, 80, 0.35);
  border-radius: 3px;
}

.dock-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dock-brand-logo {
  height: 40px;
  width: auto;
  background: #fff;
  border-radius: 10px;
  padding: 5px 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.dock-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--gold-bright);
}

.dock-section {
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 235, 200, 0.05);
  border-color: rgba(255, 210, 140, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.dock-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-gold);
}

.dock-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 210, 140, 0.22);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--ivory);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dock-input::placeholder {
  color: rgba(243, 229, 207, 0.45);
}

.dock-input:focus {
  border-color: rgba(244, 193, 80, 0.65);
  background: rgba(255, 255, 255, 0.1);
}

.dock-btn {
  cursor: pointer;
  border: 1px solid rgba(255, 210, 140, 0.3);
  border-radius: 11px;
  padding: 9px 12px;
  background: rgba(255, 235, 200, 0.07);
  color: var(--ivory);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.dock-btn:hover {
  background: rgba(255, 235, 200, 0.14);
  border-color: rgba(244, 193, 80, 0.55);
}

.dock-btn:active {
  transform: scale(0.97);
}

.dock-btn.gold {
  background: linear-gradient(180deg, rgba(255, 205, 90, 0.92), rgba(224, 150, 30, 0.92));
  color: #3a1c04;
  border-color: rgba(255, 230, 160, 0.8);
  font-weight: 800;
}

.dock-btn.gold:hover {
  background: linear-gradient(180deg, rgba(255, 216, 110, 0.98), rgba(232, 158, 36, 0.98));
}

.dock-btn.active-toggle {
  background: rgba(52, 199, 89, 0.16);
  border-color: rgba(52, 199, 89, 0.55);
  color: #b8f5cd;
}

.dock-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dock-btn.track-btn {
  padding: 7px 8px;
  font-size: 0.78rem;
}

.dock-btn.track-btn.active-toggle {
  background: rgba(255, 199, 0, 0.16);
  border-color: rgba(255, 199, 0, 0.55);
  color: #ffe9a8;
}

.volume-control-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.volume-label-line {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted-gold);
}

.volume-label-line strong {
  color: var(--ivory);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 235, 200, 0.18);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid #fff6dd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.event-feed {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.event-feed::-webkit-scrollbar {
  width: 5px;
}

.event-feed::-webkit-scrollbar-thumb {
  background: rgba(244, 193, 80, 0.3);
  border-radius: 3px;
}

.event-feed-item {
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 235, 200, 0.06);
  border: 1px solid rgba(255, 210, 140, 0.1);
  color: #f3e5cf;
  line-height: 1.45;
}

.event-feed-item strong {
  color: var(--gold-bright);
}

.event-feed-empty {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px dashed rgba(255, 210, 140, 0.18);
  color: rgba(243, 229, 207, 0.55);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.dock-footer {
  text-align: center;
  font-size: 11.5px;
  color: rgba(243, 229, 207, 0.5);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .app-workspace {
    flex-direction: column;
    gap: 10px;
  }

  .stage-wrapper {
    height: 62vh;
    flex: none;
  }

  .quick-dock {
    width: 100%;
    max-height: none;
  }

  .scene-hint {
    display: none;
  }
}

/* ==========================================================================
   ĐIỆN THOẠI (≤820px) — cảnh trên, điều khiển dưới, touch targets lớn
   ========================================================================== */
@media (max-width: 820px) {
  .app-workspace {
    gap: 8px;
    padding: 8px;
  }

  /* Cảnh 3D chiếm phần trên — đủ cao để nhìn rõ đạo tràng */
  .stage-wrapper {
    height: 57vh;
    border-radius: 16px;
  }

  /* Dock dưới: cuộn riêng trong phần còn lại — không bị cắt khuất */
  .quick-dock {
    width: 100%;
    max-height: calc(100vh - 57vh - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    padding: 12px;
    gap: 10px;
  }

  .dock-section {
    padding: 10px;
    gap: 8px;
  }

  /* Touch targets ≥ 44px + input 16px (chặn iOS auto-zoom khi focus) */
  .dock-btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13.5px;
  }

  .dock-btn.track-btn {
    min-height: 40px;
    font-size: 0.8rem;
  }

  .dock-input,
  .gate-input,
  .chat-input {
    font-size: 16px;
  }

  .volume-slider {
    height: 8px;
  }

  .volume-slider::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
  }

  /* Top bar gọn lại — giữ số liệu quan trọng, chữ nhỏ hơn */
  .minimal-top-bar {
    top: 8px;
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .live-pill {
    font-size: 10px;
    padding: 5px 10px;
    gap: 6px;
  }

  .live-pill .brand-mark {
    height: 18px;
  }

  .top-Right-badges {
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .mini-stat-pill {
    font-size: 10px;
    padding: 4px 9px;
  }

  /* HUD dưới: thẻ nghi lễ nhỏ vừa, dễ chạm; bảng công đức ẩn trên màn nhỏ
     (mở bằng nút trong dock — thông tin trùng phần Số Liệu) */
  .bottom-hud-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 8px;
  }

  .hud-left-col {
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .hud-active-notice {
    padding: 6px 12px;
    font-size: 11.5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-gift-cards {
    gap: 6px;
    width: 100%;
  }

  .hud-gift-card {
    min-width: 0;
    flex: 1;
    padding: 18px 6px 10px;
    border-radius: 12px;
  }

  .gift-coin-tag {
    font-size: 8px;
    padding: 2px 6px;
    left: 8px;
  }

  .gift-card-body {
    flex-direction: column;
    gap: 3px;
  }

  .gift-emoji {
    font-size: 20px;
  }

  .gift-title {
    font-size: 11px;
  }

  /* Bảng công đức: overlay nổi, bật/tắt bằng nút 🏆 — không chiếm chỗ thẻ lễ */
  .lb-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 8px;
    bottom: 96px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    background: var(--glass-bg-strong);
    font-size: 19px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 26;
  }

  .hud-right-leaderboard {
    display: none;
    position: absolute;
    right: 8px;
    bottom: 146px;
    width: min(230px, 60vw);
    max-height: 46%;
    overflow-y: auto;
    z-index: 26;
    font-size: 12px;
  }

  .hud-right-leaderboard.lb-open {
    display: block;
  }

  .hud-lb-header {
    font-size: 12px;
    padding-bottom: 5px;
    margin-bottom: 6px;
  }

  .leader-item {
    font-size: 11.5px;
  }

  /* Chat panel full-width sát đáy — không đè thẻ nghi lễ */
  .chat-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 86px;
    z-index: 45;
  }

  .chat-panel.collapsed {
    width: auto;
  }

  .chat-head {
    padding: 8px 10px;
  }

  .chat-msgs {
    height: 150px;
  }

  /* Toast + banner gọn trên màn hẹp */
  .temple-toast {
    max-width: 88%;
    font-size: 12px;
    bottom: 140px;
  }

  .grand-ceremony-banner {
    width: 92%;
    padding: 16px 18px;
  }

  .grand-title {
    font-size: 19px;
  }

  .grand-sub {
    font-size: 12px;
  }

  /* Modal quẻ + chọn chiếu + cầu duyên fit màn hẹp */
  .fortune-scroll-card {
    width: 92%;
    max-width: 92%;
    padding: 20px 18px;
  }

  .fortune-heading {
    font-size: 17px;
  }

  .fortune-poem {
    font-size: 13.5px;
  }

  .seat-panel {
    width: 94%;
    padding: 14px 12px 12px;
    max-height: 88vh;
    overflow-y: auto;
  }

  .seat-grid {
    gap: 5px;
  }

  .seat-cell .cell-num {
    font-size: 9px;
  }

  .seat-cell .cell-name {
    font-size: 7px;
  }

  .seat-legend {
    gap: 10px;
    font-size: 10px;
  }

  .duyen-panel {
    width: 94vw;
    padding: 16px 14px 12px;
    max-height: 84vh;
  }

  .duyen-row {
    padding: 8px 4px;
  }

  .duyen-btn {
    min-height: 36px;
    padding: 6px 12px;
  }

  /* Nhãn tên + đèn lồng nhỏ lại cho vừa màn hẹp */
  .name-label {
    font-size: 11px;
    padding: 3px 9px;
  }

  .name-label.walker-label {
    font-size: 11px;
    padding: 5px 12px;
  }

  .lantern-tag {
    max-width: 190px;
    font-size: 11px;
    padding: 6px 10px;
  }

  .merit-pop {
    font-size: 20px;
  }

  /* Cổng pháp danh: nút vào lớn vừa tay */
  .name-gate-panel {
    width: min(400px, 94vw);
    padding: 24px 20px 20px;
  }

  .gate-btn {
    min-height: 48px;
    font-size: 15px;
  }
}

/* Màn rất hẹp (≤480px) — chữ nhỏ hơn nữa cho vừa */
@media (max-width: 480px) {
  .stage-wrapper {
    height: 55vh;
  }

  .quick-dock {
    max-height: calc(100vh - 55vh - 24px);
  }

  .live-pill {
    font-size: 9px;
  }

  .mini-stat-pill {
    font-size: 9px;
    padding: 3px 7px;
  }

  .hud-active-notice {
    font-size: 10.5px;
  }

  .gift-emoji {
    font-size: 18px;
  }

  .gift-title {
    font-size: 10px;
  }

  .chat-msgs {
    height: 130px;
  }
}

/* Màn landscape thấp (điện thoại xoay ngang) — dock cuộn được trong phần cao hạn chế */
@media (max-height: 620px) and (max-width: 1100px) {
  .stage-wrapper {
    height: 54vh;
  }

  .quick-dock {
    max-height: calc(100vh - 54vh - 24px);
  }
}

/* ==========================================================================
   CHỌN CHIẾU — kiểu ghế rạp phim (glass iOS)
   ========================================================================== */
.seat-modal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 6, 3, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 40;
}

.seat-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.seat-panel {
  width: min(560px, 88%);
  padding: 20px 22px 16px;
  border-radius: 24px;
  background: rgba(52, 20, 8, 0.62);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid rgba(255, 214, 140, 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 235, 190, 0.22);
  color: #f7e8cd;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.seat-modal-overlay.visible .seat-panel {
  transform: translateY(0) scale(1);
}

.seat-panel-title {
  font-family: 'Noto Serif', serif;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  color: #ffd98a;
  text-shadow: 0 0 18px rgba(255, 180, 80, 0.5);
}

.seat-panel-sub {
  text-align: center;
  font-size: 11.5px;
  color: rgba(243, 229, 207, 0.72);
  margin-top: 4px;
}

.seat-altar-line {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #ffbf66;
  margin: 12px 0 10px;
  opacity: 0.9;
}

.seat-map {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: stretch;
}

.seat-wing {
  flex: 1;
}

.seat-wing-name {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255, 214, 140, 0.6);
  margin-bottom: 6px;
}

.seat-aisle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 9px;
  color: rgba(255, 200, 100, 0.35);
  text-align: center;
  padding: 0 2px;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.seat-cell {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1px solid rgba(255, 220, 150, 0.18);
  background: rgba(255, 240, 210, 0.06);
  color: #f3e5cf;
  font-family: 'Be Vietnam Pro', sans-serif;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  transition: transform 0.12s ease, background 0.15s, box-shadow 0.15s;
}

.seat-cell .cell-num {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.9;
}

.seat-cell .cell-name {
  font-size: 7.5px;
  line-height: 1;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-cell.free {
  background: rgba(120, 200, 120, 0.14);
  border-color: rgba(150, 230, 160, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.seat-cell.free:hover {
  transform: translateY(-2px) scale(1.08);
  background: rgba(140, 220, 140, 0.28);
  box-shadow: 0 0 14px rgba(140, 230, 150, 0.45);
}

.seat-cell.taken {
  background: rgba(30, 12, 6, 0.55);
  border-color: rgba(255, 210, 140, 0.12);
  color: rgba(230, 200, 160, 0.55);
  cursor: not-allowed;
}

.seat-cell.mine {
  background: linear-gradient(160deg, rgba(255, 190, 80, 0.4), rgba(230, 130, 40, 0.35));
  border-color: rgba(255, 220, 140, 0.85);
  box-shadow: 0 0 16px rgba(255, 190, 80, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff5dc;
  cursor: default;
}

.seat-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
  font-size: 11px;
  color: rgba(243, 229, 207, 0.75);
}

.seat-legend .lg {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: -1px;
}

.seat-legend .free {
  background: rgba(120, 200, 120, 0.4);
  border: 1px solid rgba(150, 230, 160, 0.6);
}

.seat-legend .taken {
  background: rgba(30, 12, 6, 0.7);
  border: 1px solid rgba(255, 210, 140, 0.25);
}

.seat-legend .mine {
  background: rgba(255, 190, 80, 0.55);
  border: 1px solid rgba(255, 220, 140, 0.9);
}

.seat-close {
  margin-top: 14px;
  width: 100%;
}

/* trạng thái ghế của bạn trong dock */
.seat-status {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(243, 229, 207, 0.8);
  background: rgba(255, 226, 160, 0.07);
  border: 1px solid rgba(255, 214, 140, 0.16);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}

.seat-status b {
  color: #ffd98a;
}

/* toast thông báo giữa scene */
.temple-toast {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%) translateY(12px);
  max-width: 70%;
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(60, 24, 8, 0.72);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 214, 140, 0.4);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  color: #ffe9c0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 45;
}

.temple-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* nhãn hàng chờ cổng */
.queue-label {
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(70, 30, 12, 0.6);
  border-color: rgba(255, 214, 140, 0.35);
}

/* ═══ KHUNG CHAT REALTIME ═══ */
.chat-panel {
  position: absolute;
  left: 16px;
  bottom: 92px;
  width: 320px;
  max-width: calc(100vw - 32px);
  border-radius: 16px;
  background: rgba(28, 16, 8, 0.62);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid rgba(255, 214, 140, 0.28);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  z-index: 40;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 199, 0, 0.08);
  border-bottom: 1px solid rgba(255, 214, 140, 0.18);
}

.chat-title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #ffd98a;
}

.chat-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff5a5a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.chat-toggle {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffe9c0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.chat-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-panel.collapsed .chat-body {
  display: none;
}

.chat-panel.collapsed {
  width: 200px;
}

.chat-body {
  display: flex;
  flex-direction: column;
}

.chat-msgs {
  height: 210px;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 214, 140, 0.3) transparent;
}

.chat-msgs::-webkit-scrollbar {
  width: 5px;
}

.chat-msgs::-webkit-scrollbar-thumb {
  background: rgba(255, 214, 140, 0.3);
  border-radius: 3px;
}

.chat-empty {
  margin: auto;
  color: rgba(255, 233, 192, 0.45);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.chat-msg {
  font-size: 12.5px;
  line-height: 1.45;
  color: #fff3dd;
  word-break: break-word;
  animation: chatIn 0.18s ease-out;
}

@keyframes chatIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg .chat-name {
  font-weight: 700;
  margin-right: 5px;
}

.chat-msg .chat-time {
  color: rgba(255, 233, 192, 0.35);
  font-size: 10px;
  margin-left: 5px;
}

.chat-msg.mine {
  opacity: 0.92;
}

.chat-msg.mine .chat-name {
  color: #ffd98a !important;
}

.chat-quick-row {
  display: flex;
  gap: 4px;
  padding: 6px 8px 0;
}

.chat-quick {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 15px;
  padding: 4px 0;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-quick:hover {
  background: rgba(216, 160, 60, 0.25);
  transform: translateY(-1px);
}

.chat-quick:active {
  transform: scale(0.92);
}

.wish-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wish-input-wrap .dock-input {
  flex: 1;
}

.chat-mic {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(216, 160, 60, 0.45);
  border-radius: 9px;
  background: rgba(216, 160, 60, 0.12);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-mic:hover {
  background: rgba(216, 160, 60, 0.3);
}

.chat-mic.listening {
  background: rgba(255, 90, 90, 0.3);
  border-color: #ff5a5a;
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 90, 90, 0.5);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(255, 90, 90, 0);
  }
}

.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 214, 140, 0.14);
}

.chat-input {
  flex: 1;
  border: 1px solid rgba(255, 214, 140, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff3dd;
  font-size: 12.5px;
  padding: 8px 10px;
  outline: none;
}

.chat-input:focus {
  border-color: rgba(255, 199, 0, 0.55);
}

.chat-input::placeholder {
  color: rgba(255, 233, 192, 0.35);
}

.chat-send {
  width: 34px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 216, 110, 0.9), rgba(232, 158, 36, 0.9));
  color: #3a2200;
  font-size: 14px;
  cursor: pointer;
}

.chat-send:hover {
  filter: brightness(1.08);
}

/* ── Tab Chung / Riêng + nút Cầu Duyên trong chat head ── */
.chat-tabs {
  display: flex;
  gap: 3px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 2px;
}

.chat-tab {
  position: relative;
  border: none;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 233, 192, 0.55);
  background: transparent;
  cursor: pointer;
}

.chat-tab.active {
  background: rgba(255, 199, 0, 0.22);
  color: #ffd98a;
}

.chat-tab .chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 15px;
  height: 15px;
  font-size: 9.5px;
  line-height: 15px;
}

.chat-duyen-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 7px;
  background: rgba(255, 122, 162, 0.18);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

.chat-duyen-btn:hover {
  background: rgba(255, 122, 162, 0.34);
}

.chat-duyen-btn.has-req {
  animation: duyenPulse 1.2s ease-in-out infinite;
}

@keyframes duyenPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 122, 162, 0.55);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(255, 122, 162, 0);
  }
}

/* ── Chat riêng (DM) ── */
.dm-msgs {
  display: flex;
}

.dm-msgs[hidden] {
  display: none;
}

.chat-msgs[hidden] {
  display: none;
}

.dm-partner-line {
  padding: 5px 12px;
  font-size: 11px;
  color: #ffb9cd;
  border-top: 1px solid rgba(255, 122, 162, 0.25);
  background: rgba(255, 122, 162, 0.07);
}

.dm-partner-line b {
  color: #ffd0de;
}

.dm-note {
  font-size: 9.5px;
  color: rgba(255, 185, 205, 0.55);
  font-style: italic;
  margin-top: 1px;
}

.dm-end-btn {
  float: right;
  border: none;
  background: rgba(255, 122, 162, 0.2);
  color: #ffb9cd;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 10px;
  cursor: pointer;
}

.dm-end-btn:hover {
  background: rgba(255, 122, 162, 0.4);
}

/* ── MODAL CẦU DUYÊN ── */
.duyen-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 6, 3, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 60;
}

.duyen-modal-overlay[hidden] {
  display: none;
}

.duyen-panel {
  width: min(400px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 22px 16px;
  border-radius: 24px;
  background: rgba(52, 20, 8, 0.68);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid rgba(255, 150, 180, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 235, 190, 0.22);
  color: #f7e8cd;
  scrollbar-width: thin;
}

.duyen-title {
  font-family: 'Noto Serif', serif;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  color: #ff9ebb;
  text-shadow: 0 0 18px rgba(255, 120, 160, 0.5);
}

.duyen-sub {
  text-align: center;
  font-size: 11.5px;
  color: rgba(243, 229, 207, 0.72);
  margin: 6px 0 12px;
  line-height: 1.5;
}

.duyen-sec-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 214, 140, 0.85);
  margin: 12px 0 6px;
}

.duyen-bond-box {
  text-align: center;
  font-size: 12.5px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 122, 162, 0.14);
  border: 1px solid rgba(255, 122, 162, 0.4);
  color: #ffd0de;
}

.duyen-bond-box b {
  color: #ff9ebb;
}

.duyen-req-box {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 199, 0, 0.08);
  border: 1px solid rgba(255, 214, 140, 0.3);
}

.duyen-req-box .duyen-sec-title {
  margin-top: 0;
}

.duyen-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 214, 140, 0.08);
}

.duyen-row:last-child {
  border-bottom: none;
}

.duyen-row .duyen-name {
  flex: 1;
  color: #fff3dd;
}

.duyen-row .duyen-seat {
  font-size: 10px;
  color: rgba(255, 233, 192, 0.4);
}

.duyen-btn {
  border: none;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 158, 187, 0.95), rgba(224, 96, 138, 0.95));
  color: #3d0a1e;
}

.duyen-btn:hover {
  filter: brightness(1.08);
}

.duyen-btn.accept {
  background: linear-gradient(180deg, rgba(255, 216, 110, 0.95), rgba(232, 158, 36, 0.95));
  color: #3a2200;
}

.duyen-btn.decline,
.duyen-btn.end {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 233, 192, 0.75);
}

.duyen-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.duyen-empty {
  text-align: center;
  font-size: 11.5px;
  font-style: italic;
  color: rgba(255, 233, 192, 0.4);
  padding: 10px 0;
}

@media (max-width: 720px) {
  .chat-panel {
    width: 250px;
    bottom: 80px;
  }

  .chat-msgs {
    height: 160px;
  }
}

/* ── CỔNG PHÁP DANH — bắt buộc ghi danh, chỉ hiện khi html.need-name ── */
.name-gate-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(22, 7, 3, 0.6);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  z-index: 200;
}

html.need-name .name-gate-overlay {
  display: flex;
}

.name-gate-panel {
  width: min(400px, 90%);
  padding: 30px 28px 26px;
  border-radius: 26px;
  background: rgba(52, 20, 8, 0.68);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(255, 214, 140, 0.32);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 235, 190, 0.22);
  color: #f7e8cd;
  text-align: center;
  animation: gateIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes gateIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gate-logo {
  width: 96px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 14px rgba(255, 190, 90, 0.35));
}

.gate-title {
  font-family: 'Noto Serif', serif;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ffd98a;
  text-shadow: 0 0 20px rgba(255, 180, 80, 0.5);
}

.gate-sub {
  font-size: 12px;
  line-height: 1.55;
  color: rgba(243, 229, 207, 0.75);
  margin: 8px 0 16px;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-size: 15px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.gate-btn {
  width: 100%;
  padding: 13px 14px;
  font-size: 14.5px;
}

/* ===== Lá số Tử Vi 4×4 ===== */
.zen-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(216, 160, 60, 0.4);
  border-radius: 8px;
  color: var(--ivory);
  padding: 7px 8px;
  font-size: 13px;
}

.zw-head-info {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted-gold);
  line-height: 1.7;
  margin-bottom: 12px;
}

.zw-head-info b {
  color: var(--gold-bright);
}

.zw-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(86px, auto);
  gap: 3px;
  border: 1px solid rgba(216, 160, 60, 0.4);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(216, 160, 60, 0.12);
}

.zw-cell {
  background: linear-gradient(160deg, rgba(30, 18, 8, 0.92), rgba(18, 10, 5, 0.95));
  padding: 6px 5px;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 0;
}

.zw-cell:hover {
  background: linear-gradient(160deg, rgba(60, 36, 14, 0.95), rgba(28, 16, 7, 0.95));
}

.zw-cell.empty {
  cursor: default;
  background: rgba(10, 6, 3, 0.6);
}

.zw-cell.center {
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zw-center-txt {
  font-size: 11px;
  color: var(--muted-gold);
  text-align: center;
  line-height: 1.5;
  padding: 4px;
}

.zw-cell.is-ming {
  box-shadow: inset 0 0 0 1.5px rgba(255, 215, 120, 0.55);
}

.zw-cell.is-shen {
  box-shadow: inset 0 0 0 1.5px rgba(120, 200, 255, 0.4);
}

.zw-cell.is-empty .zw-stars::after {
  content: '· không chính tinh';
  color: #888;
  font-size: 10px;
}

.zw-cname {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold-bright);
  letter-spacing: 0.3px;
}

.zw-cgz {
  font-size: 10px;
  color: #c9a86a;
  margin-bottom: 3px;
}

.zw-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.zw-star {
  font-size: 10.5px;
  line-height: 1.3;
  color: #e8d9b8;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 1px 4px;
  white-space: nowrap;
}

.zw-star i {
  font-style: normal;
  font-size: 9px;
  color: #9a8a68;
  margin-left: 2px;
}

.zw-star.maj {
  color: #ffe9b0;
  background: rgba(216, 160, 60, 0.18);
  font-weight: 700;
}

.zw-star .zw-sihua,
.zw-sihua {
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  margin-left: 3px;
  color: #ffb347;
}

.zw-star.has-sihua {
  border: 1px solid rgba(255, 179, 71, 0.45);
}

.zw-dx {
  font-size: 9px;
  color: #8a7a5c;
  margin-top: 3px;
}

/* ===== Form lập lá số (kiểu tuvi.vn) ===== */
.zb-row {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.zb-lb {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted-gold);
  min-width: 66px;
}

.zb-lb small {
  font-weight: 500;
  opacity: 0.8;
}

.zb-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted-gold);
  cursor: pointer;
}

.zb-radio input {
  accent-color: #d8a03c;
}

.zen-input {
  flex: 1;
  min-width: 140px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(216, 160, 60, 0.4);
  border-radius: 8px;
  color: var(--ivory);
  padding: 7px 10px;
  font-size: 13px;
}

/* ===== Chế độ toàn màn hình tab Tử Vi ===== */
.zen-card.zw-mode {
  width: min(1560px, 97vw);
  max-height: 95vh;
  display: flex;
  flex-direction: column;
}

.zen-card.zw-mode .zen-body {
  overflow-y: auto;
  flex: 1;
}

.zen-card.zw-mode .zw-head-top {
  flex-wrap: wrap;
  gap: 4px 18px;
}

.zw-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.zw-chart-col {
  flex: 0 0 600px;
  min-width: 0;
}

.zw-detail {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  max-height: 72vh;
  position: sticky;
  top: 0;
}

@media (max-width: 980px) {
  .zw-layout {
    flex-direction: column;
  }

  .zw-chart-col {
    flex: none;
    width: 100%;
  }

  .zw-detail {
    max-height: 50vh;
    position: static;
  }

  .zen-card.zw-mode {
    width: 96vw;
    max-height: 92vh;
  }
}

/* ===== Lá số phong cách giấy truyền thống (tab Tử Vi) ===== */
.zen-card.zw-mode .zw-grid {
  background: rgba(140, 95, 30, 0.35);
  border: 1.5px solid #a87c3f;
  border-radius: 6px;
}

.zen-card.zw-mode .zw-cell {
  background: linear-gradient(165deg, #f7eed9, #eee1c4);
  border: 1px solid #c9ab76;
  border-radius: 3px;
}

.zen-card.zw-mode .zw-cell:hover {
  background: linear-gradient(165deg, #fdf6e4, #f3e6c8);
}

.zen-card.zw-mode .zw-cell.center {
  background: linear-gradient(165deg, #f2e4c5, #e9d7ae);
  border: 1.5px solid #b08d4f;
}

.zen-card.zw-mode .zw-cell.empty {
  background: rgba(120, 90, 45, 0.18);
}

.zen-card.zw-mode .zw-cell.is-ming {
  box-shadow: inset 0 0 0 1.8px #a3231c, 0 0 8px rgba(163, 35, 28, 0.3);
}

.zen-card.zw-mode .zw-cell.is-shen {
  box-shadow: inset 0 0 0 1.8px #2a5f9e;
}

.zen-card.zw-mode .zw-cname {
  color: #8b1a1a;
}

.zen-card.zw-mode .zw-cgz {
  color: #8a6a3a;
}

.zen-card.zw-mode .zw-dx {
  color: #8a6a3a;
}

.zen-card.zw-mode .zw-star {
  background: rgba(120, 80, 30, 0.1);
  color: #4a3820;
}

.zen-card.zw-mode .zw-star.maj {
  font-weight: 800;
}

.zen-card.zw-mode .zw-star.el-moc {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.1);
}

.zen-card.zw-mode .zw-star.el-hoa {
  color: #c62828;
  background: rgba(198, 40, 40, 0.09);
}

.zen-card.zw-mode .zw-star.el-tho {
  color: #9c6b10;
  background: rgba(156, 107, 16, 0.1);
}

.zen-card.zw-mode .zw-star.el-kim {
  color: #546e7a;
  background: rgba(84, 110, 122, 0.11);
}

.zen-card.zw-mode .zw-star.el-thuy {
  color: #1565c0;
  background: rgba(21, 101, 192, 0.1);
}

.zen-card.zw-mode .zw-star.maj.el-kim {
  color: #455a64;
}

.zen-card.zw-mode .zw-star.br-tot {
  box-shadow: 0 0 4px rgba(200, 150, 40, 0.45);
}

.zen-card.zw-mode .zw-star.br-xau {
  opacity: 0.62;
}

.zen-card.zw-mode .zw-star.br-xau i {
  color: #a3231c;
}

.zen-card.zw-mode .zw-star i {
  color: #8a6a3a;
}

.zen-card.zw-mode .zw-star.has-sihua {
  border-color: rgba(163, 35, 28, 0.5);
}

.zen-card.zw-mode .zw-cell.is-empty .zw-stars::after {
  color: #9a8258;
}

.zen-card.zw-mode .zw-center-txt {
  color: #4a3820;
  font-size: 12.5px;
  text-align: left;
}

.zen-card.zw-mode .zw-head-info {
  color: #8a6a3a;
}

.zen-card.zw-mode .zw-head-info b {
  color: #8b1a1a;
}

/* trung cung — ô thông tin lá số */
.zc-h {
  font-weight: 800;
  color: #8b1a1a;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

.zc-sm {
  font-size: 10.5px;
  color: #8a6a3a;
}

/* luận giải trên nền giấy */
.zen-card.zw-mode .zw-detail {
  background: linear-gradient(165deg, #fbf4e2, #f2e4c5);
  border: 1.5px solid #b08d4f;
  color: #4a3820;
}

.zen-card.zw-mode .zw-detail-title {
  color: #8b1a1a;
  font-size: 15px;
}

.zen-card.zw-mode .zw-sec-h {
  color: #8b1a1a;
}

.zen-card.zw-mode .zw-sec-b {
  color: #4a3820;
}

.zen-card.zw-mode .zw-sub {
  border-color: rgba(163, 35, 28, 0.25);
  background: rgba(163, 35, 28, 0.05);
}

.zen-card.zw-mode .zw-sub summary {
  color: #9c6b10;
}

.zen-card.zw-mode .zw-sub summary:hover {
  color: #8b1a1a;
}

.zen-card.zw-mode .zw-sub summary::before {
  color: rgba(163, 35, 28, 0.5);
}

/* ===== Lưới lá số cỡ lớn (fullscreen) ===== */
.zw-grid-lg {
  grid-auto-rows: minmax(112px, auto);
}

.zw-grid-lg .zw-star {
  font-size: 12.5px;
  padding: 2px 7px;
  border-radius: 5px;
}

.zw-grid-lg .zw-star i {
  font-size: 10px;
}

.zw-grid-lg .zw-sihua,
.zw-grid-lg .zw-star .zw-sihua {
  font-size: 10.5px;
}

.zw-grid-lg .zw-cname {
  font-size: 13.5px;
}

.zw-grid-lg .zw-cgz {
  font-size: 11px;
  margin-bottom: 5px;
}

.zw-grid-lg .zw-dx {
  font-size: 10px;
}

.zw-grid-lg .zw-center-txt {
  font-size: 12.5px;
}

.zw-grid-lg .zw-stars {
  gap: 3px;
}

@media (max-width: 560px) {
  .zw-grid-lg {
    grid-auto-rows: minmax(78px, auto);
  }

  .zw-grid-lg .zw-star {
    font-size: 10px;
    padding: 1px 4px;
  }

  .zw-grid-lg .zw-cname {
    font-size: 11px;
  }
}

/* ===== Màu tứ hóa chuẩn: Lộc đỏ, Quyền lam, Khoa lục, Kỵ đỏ đậm ===== */
.zw-sihua.sh-loc {
  color: #ff5a5a;
}

.zw-sihua.sh-quyen {
  color: #5aa8ff;
}

.zw-sihua.sh-khoa {
  color: #5ad07a;
}

.zw-sihua.sh-ky {
  color: #ff4040;
  font-weight: 900;
  text-shadow: 0 0 4px rgba(255, 64, 64, 0.4);
}

/* ===== Tô màu sao theo ngũ hành + độ sáng ===== */
.zw-star.el-moc {
  color: #b8f09a;
  background: rgba(90, 180, 80, 0.16);
}

.zw-star.el-hoa {
  color: #ffb3a7;
  background: rgba(220, 90, 70, 0.16);
}

.zw-star.el-tho {
  color: #f0cd8a;
  background: rgba(200, 150, 60, 0.16);
}

.zw-star.el-kim {
  color: #e2e8f0;
  background: rgba(180, 200, 220, 0.14);
}

.zw-star.el-thuy {
  color: #a8d8ff;
  background: rgba(70, 150, 220, 0.16);
}

.zw-star.maj.el-moc,
.zw-star.maj.el-hoa,
.zw-star.maj.el-tho,
.zw-star.maj.el-kim,
.zw-star.maj.el-thuy {
  font-weight: 700;
}

.zw-star.br-tot {
  box-shadow: 0 0 6px rgba(255, 215, 120, 0.25);
}

.zw-star.br-xau {
  opacity: 0.72;
  border-style: dashed;
}

.zw-star.br-xau i {
  color: #e08a8a;
}

/* ===== Màu nhấn theo loại cung ===== */
.zw-cell[class*="pc-"] {
  border-top: 2px solid rgba(216, 160, 60, 0.25);
}

.zw-cell.pc-ming {
  border-top-color: #ffd777;
}

.zw-cell.pc-phu-the {
  border-top-color: #ff9ec7;
}

.zw-cell.pc-tu-tuc {
  border-top-color: #a8e063;
}

.zw-cell.pc-tai-bach {
  border-top-color: #57c785;
}

.zw-cell.pc-tat-ach {
  border-top-color: #ff6b6b;
}

.zw-cell.pc-thien-di {
  border-top-color: #5eb8ff;
}

.zw-cell.pc-no-boc {
  border-top-color: #b0b0b0;
}

.zw-cell.pc-quan-loc {
  border-top-color: #b48cff;
}

.zw-cell.pc-dien-trach {
  border-top-color: #c68e5a;
}

.zw-cell.pc-phuc-duc {
  border-top-color: #4fd1c5;
}

.zw-cell.pc-phu-mau {
  border-top-color: #7f8cff;
}

.zw-cell.pc-huynh-de {
  border-top-color: #ffab5e;
}

.zw-cell.is-ming {
  box-shadow: inset 0 0 0 1.5px rgba(255, 215, 120, 0.55), 0 0 10px rgba(255, 215, 120, 0.12);
}

.zw-cell.is-shen {
  box-shadow: inset 0 0 0 1.5px rgba(120, 200, 255, 0.4);
}

/* ===== Mục luận giải thu gọn ===== */
.zw-sub {
  margin: 10px 0 4px;
  border: 1px solid rgba(216, 160, 60, 0.18);
  border-radius: 8px;
  background: rgba(216, 160, 60, 0.05);
  overflow: hidden;
}

.zw-sub summary {
  cursor: pointer;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 700;
  color: #c9a86a;
  list-style: none;
  user-select: none;
}

.zw-sub summary::before {
  content: '▸ ';
  color: rgba(216, 160, 60, 0.6);
}

.zw-sub[open] summary::before {
  content: '▾ ';
}

.zw-sub summary:hover {
  color: var(--gold-bright);
}

.zw-sub .zw-sec-b {
  padding: 0 12px 10px;
}

.zw-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(216, 160, 60, 0.25);
  font-size: 12.5px;
  line-height: 1.6;
  color: #e8d9b8;
  min-height: 40px;
}

.zw-detail-title {
  color: var(--gold-bright);
  font-weight: 800;
  margin-bottom: 4px;
}

.zw-detail-body {
  color: #d8c9a8;
}

/* ===== Hạn vận ===== */
.zw-horo {
  margin-bottom: 8px;
}

.zw-horo-row {
  font-size: 13px;
  color: #e8d9b8;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(216, 160, 60, 0.15);
}

.zw-horo-mut {
  font-size: 12px;
  color: #ffcf8a;
  padding: 3px 0 3px 14px;
}

.zw-horo-stars {
  font-size: 11px;
  color: #9a8a68;
  padding: 2px 0 5px 14px;
}

@media (max-width: 560px) {
  .zw-grid {
    grid-auto-rows: minmax(64px, auto);
  }

  .zw-star {
    font-size: 9.5px;
    padding: 1px 3px;
  }

  .zw-cname {
    font-size: 10px;
  }

  .zw-cell {
    padding: 4px 3px;
  }
}

/* ===== Luận giải cung — scroll ~1 trang A4 ===== */
.zw-detail {
  max-height: 72vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(216, 160, 60, 0.5) transparent;
}

.zw-detail::-webkit-scrollbar {
  width: 6px;
}

.zw-detail::-webkit-scrollbar-thumb {
  background: rgba(216, 160, 60, 0.4);
  border-radius: 3px;
}

.zw-sec-h {
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 13px;
  margin: 12px 0 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(216, 160, 60, 0.2);
}

.zw-sec-h:first-of-type {
  margin-top: 4px;
}

.zw-sec-b {
  font-size: 12.5px;
  line-height: 1.75;
  color: #ddd0b4;
  text-align: justify;
}

/* ===== Chọn ngày lưu nhật ===== */
.zw-datepick {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted-gold);
  margin-bottom: 10px;
}

.zw-datepick input[type="date"] {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(216, 160, 60, 0.4);
  border-radius: 8px;
  color: var(--ivory);
  padding: 6px 9px;
  font-size: 13px;
}

.zw-reset {
  background: linear-gradient(180deg, #999, #666) !important;
}