/* ===================== Sân chùa 2.5D ===================== */
#yard { position: relative; height: 100vh; height: 100svh; min-height: 520px; overflow: hidden; background: #000; }
.yard-stage { position: absolute; inset: 0; overflow: hidden; }
.ylayer {
  position: absolute; inset: -4% -7%;
  transform: translate(var(--px, 0), var(--py, 0));
  transform-origin: 50% 64%;
  transition: transform .6s ease-out, opacity 1.9s;
  will-change: transform;
}
.ylayer svg { width: 100%; height: 100%; display: block; }
.yard-stage.walking .ylayer {
  transform: scale(calc(1 + var(--d) * 4.2));
  opacity: calc(1.45 - var(--d));
  transition: transform 1.9s cubic-bezier(.55, 0, .75, .45), opacity 1.9s;
}
.yard-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.walk-fade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .9s;
  background: radial-gradient(circle at 50% 62%, #fff3c4, #ffb84a 40%, #2a1206);
}
.walk-fade.on { opacity: 1; }
.topbar.floating { position: absolute; left: 0; right: 0; top: 0; background: linear-gradient(rgba(0, 0, 0, .55), transparent); backdrop-filter: none; }
.yard-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 16px 22px; text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}
.yard-desc { max-width: 520px; margin: 0 auto 4px; color: #fff3e0; text-shadow: 0 1px 4px #000; line-height: 1.45; font-size: .9rem; }
.yard-occ { color: var(--gold); font-size: .85rem; margin-bottom: 12px; text-shadow: 0 1px 3px #000; }
.primary.big { padding: 14px 34px; font-size: 1.1rem; }

.tree-sway { animation: tsway 6s ease-in-out infinite; }
@keyframes tsway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
.door-glow { animation: doorglow 3s ease-in-out infinite; }
@keyframes doorglow { 50% { opacity: .65; } }
.smoke-line { animation: doorglow 4s ease-in-out infinite; }

/* ===================== Chánh điện 3D ===================== */
.altar-scene {
  perspective: 700px; perspective-origin: 50% 42%;
  background: radial-gradient(ellipse at 50% 70%, var(--wall, #3a1208), #070302 75%);
}
#cam {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d;
  transform: scale3d(var(--k, 1), var(--k, 1), var(--k, 1)) translate3d(var(--cx, 0), var(--cy, 0), var(--cz, 0));
  transition: transform 2.6s cubic-bezier(.45, 0, .2, 1);
}
#cam.instant { transition: none; }
#room {
  position: absolute; left: 0; top: 0; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .8s ease-out;
}
#room > div { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
#room > div > div { position: absolute; left: 0; top: 0; }

.h-back {
  width: 1400px; height: 900px; transform-origin: 0 0;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 3px, transparent 3px 140px),
    linear-gradient(#0d0604, var(--wall) 45%, var(--wall));
  box-shadow: inset 0 -40px 80px rgba(0, 0, 0, .5);
}
#room .h-back > .h-back-inner {
  left: 50%; top: auto; bottom: 0; width: 560px; height: 420px;
  transform: translateX(-50%) scale(1.6); transform-origin: 50% 100%;
}
.plaque {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: linear-gradient(#6b1a0e, #4a0f08); border: 3px solid var(--gold-deep); border-radius: 4px;
  color: var(--gold); font-family: "Noto Serif", serif; font-weight: 700; font-size: 17px; letter-spacing: .06em; padding: 4px 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.h-floor {
  width: 1400px; height: 1700px; transform-origin: 0 0;
  background:
    linear-gradient(90deg, transparent 610px, rgba(140, 20, 20, .55) 610px 790px, transparent 790px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .25) 0 2px, transparent 2px 140px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 70px),
    linear-gradient(#1a0c08, var(--floor) 30%, var(--floor));
}
.h-side {
  height: 760px; transform-origin: 0 0; filter: brightness(.75);
  background:
    repeating-linear-gradient(90deg, var(--wall) 0 130px, transparent 130px 240px),
    linear-gradient(var(--wall) 0 24%, var(--window) 24% 56%, var(--wall) 56%);
}
.h-pillar {
  width: 48px; height: 760px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .5), var(--pillar) 30%, rgba(255, 160, 120, .35) 48%, var(--pillar) 66%, rgba(0, 0, 0, .55));
}
.h-pillar::before, .h-pillar::after { content: ""; position: absolute; left: -4px; right: -4px; height: 14px; background: var(--gold-deep); border-radius: 3px; }
.h-pillar::before { top: 90px; }
.h-pillar::after { bottom: 0; height: 30px; background: #5a4a3a; }
.h-lantern { width: 32px; height: 44px; }
.h-lantern i {
  display: block; width: 32px; height: 40px; border-radius: 45%; margin-top: 4px;
  background: radial-gradient(#ffe6a8, #d8382a 72%); box-shadow: 0 0 34px 12px rgba(255, 140, 60, .35);
  animation: sway 5s ease-in-out infinite; transform-origin: 50% -200px;
}
.h-lantern::before { content: ""; position: absolute; left: 15px; bottom: 100%; width: 2px; height: 300px; background: #2a160c; }

.cushion {
  width: 68px; height: 68px; border-radius: 50%; transform-origin: 0 0;
  background: radial-gradient(circle at 50% 42%, #b4482c, #6a1a10 72%);
  box-shadow: inset 0 0 0 4px rgba(201, 138, 36, .55), 0 0 0 3px rgba(0, 0, 0, .3);
  display: grid; place-items: center;
}
.cushion span { font-size: 18px; font-weight: 700; color: rgba(243, 198, 107, .55); }
.cushion.mine { background: radial-gradient(circle at 50% 42%, #ffe08a, #c98a24 72%); box-shadow: 0 0 40px 14px rgba(255, 200, 100, .55); }
.cushion.mine span { color: #5a2a0c; }
.sitter { width: 60px; height: 70px; }
.sitter svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.sitter small {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 12px; color: var(--text); background: rgba(0, 0, 0, .55); padding: 1px 6px; border-radius: 6px; opacity: 0; transition: opacity .2s;
}
.sitter:hover small { opacity: 1; }
.seat-marker {
  color: var(--gold); font-size: 34px; text-align: center; white-space: nowrap;
  text-shadow: 0 0 14px rgba(255, 200, 100, .9); animation: markerpulse 1.6s ease-in-out infinite;
}
.seat-marker small { display: block; font-size: 15px; font-weight: 600; }
@keyframes markerpulse { 50% { opacity: .45; } }
.seated .seat-marker { display: none; }

.kinh-banner {
  position: absolute; left: 12px; top: 10px; z-index: 6; max-width: calc(100% - 110px);
  background: rgba(0, 0, 0, .5); border: 1px solid var(--panel-border); border-radius: 999px;
  padding: 4px 12px; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.kinh-banner:empty { display: none; }
.kinh-banner b { color: var(--gold); font-weight: 600; }
.sit-bar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 7;
  display: flex; flex-direction: column; align-items: center; gap: 8px; transition: opacity .5s;
}
.seat-label { background: rgba(0, 0, 0, .6); border: 1px solid var(--gold-deep); border-radius: 999px; padding: 3px 12px; font-size: .8rem; color: var(--gold); white-space: nowrap; }
.seated .sit-bar { opacity: 0; pointer-events: none; }
.stand-btn { position: absolute; right: 12px; bottom: 12px; z-index: 7; }

.kinh-text {
  margin-top: 14px; max-height: 260px; overflow: auto;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px 16px;
  font-family: "Noto Serif", serif; line-height: 1.9;
}
.kinh-text:empty { display: none; }
.panel .kinh-text p { margin: 0; color: var(--muted); transition: color .4s, transform .4s; }
.panel .kinh-text p.on { color: var(--gold); transform: translateX(4px); }
.panel .kinh-text p.big { font-size: 1.6rem; text-align: center; color: var(--gold); padding: 18px 0 6px; }
.kinh-schedule { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.kinh-schedule li { display: flex; gap: 12px; padding: 6px 10px; border-radius: 8px; font-size: .9rem; color: var(--muted); border: 1px solid transparent; }
.kinh-schedule li time { color: var(--gold-deep); font-variant-numeric: tabular-nums; min-width: 92px; }
.kinh-schedule li.now { background: rgba(243, 198, 107, .1); color: var(--text); border-color: var(--gold-deep); }
.kinh-schedule li.now::after { content: "đang tụng"; margin-left: auto; font-size: .75rem; color: var(--gold); }
.small { font-size: .8rem; }

/* ===================== Góc nhìn & nhân vật ===================== */
#cam.dragging { transition: transform .08s linear; }
.altar-scene { touch-action: pan-y; cursor: grab; }
.altar-scene:active { cursor: grabbing; }
.h-back, #room .h-back > .h-back-inner, .h-side { backface-visibility: hidden; }

#room .sitter { width: 76px; height: 84px; transform-style: preserve-3d; }
.sitter .face { position: absolute; inset: 0; backface-visibility: hidden; }
.sitter .face.front { transform: rotateY(180deg); }
.sitter .chibi { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.sitter .breathe { transform-origin: 50% 100%; animation: breathe 4s ease-in-out infinite; animation-delay: var(--delay, 0s); }
@keyframes breathe { 50% { transform: scale(1.015, 1.035); } }
.sitter.me::before {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 110px; height: 30px; margin-left: -55px; border-radius: 50%;
  background: radial-gradient(rgba(255, 220, 140, .7), transparent 70%); animation: doorglow 3s ease-in-out infinite;
}
.sitter.me { animation: appear .8s ease-out; }
@keyframes appear { from { opacity: 0; } }

.view-bar { position: absolute; right: 10px; top: 46px; z-index: 7; display: flex; flex-direction: column; gap: 6px; }
.view-bar button {
  width: 40px; height: 40px; border-radius: 50%; padding: 0; font-size: 17px; line-height: 1;
  background: rgba(0, 0, 0, .5); border: 1px solid var(--panel-border); color: var(--text);
}
.view-bar button.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(243, 198, 107, .5); }
.view-bar button[hidden] { display: none; }
.view-name {
  position: absolute; right: 58px; top: 52px; z-index: 7; font-size: .75rem; color: var(--gold);
  background: rgba(0, 0, 0, .5); padding: 2px 8px; border-radius: 999px; pointer-events: none; transition: opacity .6s;
}
.drag-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 6; font-size: .72rem; color: var(--muted); pointer-events: none; opacity: .8; }
.seated .drag-hint { bottom: 54px; }

/* ===================== Đăng ký & phí duy trì ===================== */
.gender-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.gender-pick label {
  border: 2px solid var(--panel-border); border-radius: 14px; padding: 8px; text-align: center; cursor: pointer;
  background: var(--panel); transition: border-color .2s, transform .2s;
}
.gender-pick label:has(input:checked) { border-color: var(--gold); transform: translateY(-2px); background: rgba(243, 198, 107, .08); }
.gender-pick input { position: absolute; opacity: 0; pointer-events: none; }
.gender-pick svg { width: 96px; height: 106px; display: block; margin: 0 auto; }
.gender-pick span { font-weight: 600; }
.fee-pick { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.fee-pick label { flex: 1; min-width: 120px; border: 2px solid var(--panel-border); border-radius: 12px; padding: 10px; text-align: center; cursor: pointer; }
.fee-pick label:has(input:checked) { border-color: var(--gold); background: rgba(243, 198, 107, .08); }
.fee-pick input { position: absolute; opacity: 0; pointer-events: none; }
.fee-pick b { display: block; font-size: 1.2rem; color: var(--gold); }
.pay-box { display: grid; gap: 10px; justify-items: center; text-align: center; margin-top: 10px; }
.pay-box img { width: min(340px, 100%); border-radius: 12px; background: #fff; }
.pay-info { width: 100%; display: grid; gap: 4px; font-size: .9rem; text-align: left; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 12px; }
.pay-info b { color: var(--gold); }
.pay-code { font-size: 1.3rem; letter-spacing: .08em; color: var(--gold); user-select: all; }
.pay-wait { color: var(--muted); font-size: .85rem; }
.pay-wait::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); margin-right: 6px; animation: markerpulse 1.2s infinite; }
.pay-ok { color: #9be39b; font-weight: 600; }
.note-box { font-size: .82rem; color: var(--muted); background: rgba(0, 0, 0, .2); border-radius: 10px; padding: 8px 12px; line-height: 1.5; }
#room .sitter { transition: opacity .6s; }
#room .sitter.behind { opacity: .12; }
dialog { overflow-x: hidden; }

/* ===================== Sân chùa 3D ===================== */
.yard-stage { background: linear-gradient(var(--sky, #6a8ab0), #20140c); touch-action: pan-y; cursor: grab; }
.yard-stage:active { cursor: grabbing; }
.y3cam {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d;
  transition: transform 3s cubic-bezier(.42, 0, .25, 1);
}
.y3cam.instant { transition: none; }
.y3cam.dragging { transition: transform .08s linear; }
.y3world, .g3 { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.p3 { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.p3 > svg { display: block; }
.p3.face { background-color: #7a2a14; }
.p3.face > div { width: 100%; height: 100%; }
.p3.stone { background-color: #8e887c; }
.p3.stone.side { background-color: #6e695f; }
.p3.stone.top, .p3.stone-top { background-color: #9c968a; background-image: repeating-linear-gradient(0deg, #0002 0 2px, transparent 2px 60px), repeating-linear-gradient(90deg, #0002 0 2px, transparent 2px 60px); }
.p3.roof { background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, .28) 0 4px, transparent 4px 18px), linear-gradient(rgba(255, 255, 255, .08), rgba(0, 0, 0, .25)); }
.p3.gable { clip-path: polygon(50% 0, 100% 100%, 0 100%); background-image: linear-gradient(rgba(0, 0, 0, .25), rgba(0, 0, 0, .4)); }
.p3.shadow { background: radial-gradient(closest-side, rgba(0, 0, 0, .45), transparent); }
.p3.ground {
  background-image:
    radial-gradient(ellipse at 50% 70%, transparent 30%, rgba(0, 0, 0, .35) 75%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px calc(90px / var(--s, 1))),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px calc(90px / var(--s, 1)));
}
.p3.water { opacity: .95; box-shadow: inset 0 0 60px rgba(255, 255, 255, .15); }
.p3.water::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, .12) 22px 24px);
  animation: ripple 6s linear infinite;
}
@keyframes ripple { to { background-position: 0 48px; } }
.cloud3, .bird3 { display: block; width: 100%; height: 100%; }
.cloud3 { animation: cdrift var(--dur) linear infinite; animation-delay: var(--del); }
@keyframes cdrift { from { transform: translateX(-900px); } to { transform: translateX(900px); } }
.bird3 { animation: bfly 34s linear infinite; animation-delay: var(--del); }
@keyframes bfly { 0% { transform: translate(0, 0) scaleY(1); } 25% { transform: translate(700px, -60px) scaleY(.5); } 50% { transform: translate(1400px, -20px) scaleY(1); } 75% { transform: translate(2100px, -80px) scaleY(.5); } 100% { transform: translate(2800px, 0) scaleY(1); } }
.gate3 { transition: opacity .8s .5s, visibility 0s 1.3s; }
.yard-stage.walking .gate3 { opacity: 0; visibility: hidden; }
.yard-stage.night { background: linear-gradient(#03050f, #0c1024); }
@media (prefers-reduced-motion: reduce) { .cloud3, .bird3, .p3.water::after { animation: none; } }

/* Tên trên đầu: luôn hiện, hai mặt để nhìn từ phía nào chữ cũng xuôi */
#room .sitter small.name {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  opacity: 1; font-size: 28px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  color: #fff3e0; background: rgba(0, 0, 0, .5); padding: 3px 12px 3px 3px; border-radius: 999px;
  display: flex; align-items: center; gap: 6px; max-width: 170px;
  text-shadow: 0 1px 2px #000; backface-visibility: hidden; pointer-events: none;
}
#room .sitter small.name.flip { transform: translateX(-50%) rotateY(180deg); }
#room .sitter.me small.name { color: var(--gold); border: 1px solid var(--gold-deep); }
#room .sitter.me::before { display: none; }

/* ===================== Sơ đồ toàn điện ===================== */
.hall-map {
  position: absolute; inset: 44px 58px 12px 12px; z-index: 8; overflow: auto;
  background: rgba(12, 6, 4, .88); border: 1px solid var(--gold-deep); border-radius: 14px; padding: 12px;
  backdrop-filter: blur(4px); cursor: default; touch-action: pan-y;
}
.map-close { position: sticky; top: 0; float: right; z-index: 2; padding: 2px 10px; }
.map-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: .85rem; }
.map-head b { color: var(--gold); }
.map-head span { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.map-head span i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.map-floor { perspective: 900px; }
.map-altar {
  margin: 0 auto 10px; width: 60%; text-align: center; font-size: .75rem; color: var(--gold);
  border: 1px solid var(--gold-deep); border-radius: 6px; padding: 3px; background: rgba(201, 138, 36, .12);
}
.map-blocks { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; transform: rotateX(18deg); transform-origin: 50% 0; }
.map-block { background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-border); border-radius: 8px; padding: 4px 6px 6px; }
.map-block.here { border-color: var(--gold); box-shadow: 0 0 10px rgba(243, 198, 107, .35); }
.map-block > b { display: block; font-size: .68rem; color: var(--muted); text-align: center; margin-bottom: 3px; font-weight: 600; }
.map-block.here > b { color: var(--gold); }
.map-grid { display: grid; grid-template-columns: repeat(9, 9px); gap: 3px; }
.map-grid i { width: 9px; height: 9px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px rgba(201, 138, 36, .45); }
.map-grid i.none { box-shadow: none; }
.map-grid i.nam, .map-head i.nam { background: #8fb0dc; box-shadow: none; }
.map-grid i.nu, .map-head i.nu { background: #f0a6bd; box-shadow: none; }
.map-grid i.me, .map-head i.me { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* Đăng nhập Google */
.google-btn { display: flex; justify-content: center; min-height: 44px; margin: 18px 0 8px; }
#loginDlg p.small { font-size: 12px; text-align: center; }
.btn-ico { width: 1.35em; height: 1.35em; vertical-align: -0.3em; margin-right: 2px; }

#room .sitter small.name span { overflow: hidden; text-overflow: ellipsis; }

/* Ảnh đại diện tròn (ảnh Google hoặc chữ cái đầu) */
.av { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center;
  font-size: 18px; font-weight: 700; font-style: normal; color: #fff; background: #8a5a2a; border: 2px solid rgba(255, 220, 160, .7); }
.av.nu { background: #b8436e; }
.av.nam { background: #3f6aa8; }
.av.big { width: 52px; height: 52px; font-size: 24px; }
.av.huge { width: 84px; height: 84px; font-size: 38px; border-width: 3px; }
.av.mini { width: 24px; height: 24px; font-size: 13px; border-width: 1px; vertical-align: middle; }

/* Thẻ thông tin khi trỏ vào người ngồi */
.sitter-card {
  position: absolute; z-index: 9; display: flex; gap: 10px; align-items: center; min-width: 190px; max-width: 240px;
  background: rgba(20, 10, 6, .94); border: 1px solid var(--gold-deep); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); pointer-events: none; font-size: 13px;
}
.sitter-card div > b { display: block; color: var(--gold); font-size: 15px; }
.sitter-card em { color: var(--muted); font-style: normal; font-weight: 400; font-size: 12px; }
.sitter-card small { display: block; color: #e8d8c0; line-height: 1.5; }
.sitter-card small.mail { color: #9fc4ff; word-break: break-all; }
#room .sitter { cursor: pointer; }

/* Nút tài khoản và hộp hồ sơ */
#profileBtn { display: inline-flex; align-items: center; gap: 6px; }
.profile-head { display: flex; gap: 16px; align-items: center; margin: 8px 0 14px; }
.profile-head h2 { margin: 0 0 4px; }
.profile-head p { margin: 2px 0; font-size: 13px; color: var(--muted); }
.profile-head p b { color: #e8d8c0; font-weight: 600; }
.profile-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 6px 0 4px; }
.profile-dl dt { color: var(--muted); }
.profile-dl dd { margin: 0; color: #f3e6d0; word-break: break-word; }

/* Thời khóa tụng kinh */
.kinh-special { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.kinh-special b { color: var(--gold); }
.kinh-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: .85rem; }
.kinh-chain:empty { display: none; }
.kinh-chain span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--panel-border); color: var(--muted); }
.kinh-chain span.on { color: var(--gold); border-color: var(--gold-deep); background: rgba(232, 180, 80, .1); }
.kinh-chain i { color: var(--muted); font-style: normal; }
.kinh-schedule li span { display: flex; flex-direction: column; gap: 1px; }
.kinh-schedule li span b { font-weight: 600; color: inherit; }
.kinh-schedule li span small { font-size: .78rem; opacity: .85; }
.now-kinh { font-size: .8rem; color: var(--muted); margin: 6px 0 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.now-kinh b { color: var(--gold); font-weight: 600; }
.now-kinh small { opacity: .8; }

/* Dùng thử & ủng hộ */
.me-trial { font-size: .72rem; color: var(--gold); background: rgba(232, 180, 80, .12); border: 1px solid var(--gold-deep); border-radius: 999px; padding: 1px 7px; margin-left: 2px; }
.access-box { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px 14px; font-size: .92rem; line-height: 1.6; }
.access-box .clock { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.access-box .ok { color: #8fe0a6; }
.access-box .warn { color: #f0b060; }
.access-box small { color: var(--muted); }
.access-box button { margin-top: 8px; }
.admin-link { display: inline-block; margin-top: 10px; padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: .9rem; }

/* Thanh dùng thử trong chánh điện */
.trial-bar {
  position: absolute; left: 12px; top: 42px; z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(0, 0, 0, .55); border: 1px solid var(--gold-deep); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .78rem;
  max-width: calc(100% - 110px);
}
.trial-bar b { color: var(--gold); font-variant-numeric: tabular-nums; }
.trial-bar button {
  border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-weight: 600; cursor: pointer;
  background: linear-gradient(var(--gold), var(--gold-deep)); color: #3a2208;
}
.trial-bar.soon { border-color: #e07a50; animation: trialPulse 2s ease-in-out infinite; }
@keyframes trialPulse { 50% { box-shadow: 0 0 0 4px rgba(224, 122, 80, .25); } }

/* Ví Lộc & mâm lễ */
.loc { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; background: url(loc.svg) center / contain no-repeat; font-style: normal; }
.loc.big { width: 1.1em; height: 1.1em; }
.hall-stats { display: flex; gap: 6px; align-items: center; }
.loc-chip { cursor: pointer; font: inherit; font-weight: 600; color: var(--gold); background: rgba(243, 198, 107, .1); border: 1px solid var(--gold-deep); border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 5px; }
.loc-chip:hover { background: rgba(243, 198, 107, .2); }
.wallet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; font-size: .9rem; }
.wallet b { color: var(--gold); }
.wallet .free-note { color: #8fe0a6; font-size: .82rem; }
.wallet button { margin-left: auto; padding: 5px 12px; border-radius: 999px; font-size: .85rem; }
[data-incense] small { font-weight: 400; opacity: .85; }
.offer-grid button { position: relative; cursor: pointer; transition: transform .15s, border-color .15s; }
.offer-grid button em { font-style: normal; font-size: .75rem; color: var(--gold); display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.offer-grid button.on { border-color: var(--gold); background: rgba(243, 198, 107, .14); transform: translateY(-2px); }
.offer-grid button.on::after { content: "✓"; position: absolute; top: 4px; right: 8px; font-size: .9rem; color: var(--gold); }
.offer-grid button:disabled { opacity: .4; cursor: not-allowed; }
.tray-build { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.tray-plate {
  flex: 1 1 220px; min-height: 64px; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 2px;
  font-size: 1.9rem; padding: 6px 12px 14px; border-radius: 50% / 0 0 100% 100%;
  background: linear-gradient(#c9963a, #8a5a1c); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .25);
}
.tray-plate small { font-size: .85rem; color: #3a2208; align-self: center; }
.tray-sum { flex: 1 1 200px; display: grid; gap: 8px; font-size: .9rem; }
.tray-sum b { color: var(--gold); }
.tray-sum .ok { color: #8fe0a6; }
.tray-sum .warn { color: #f0b060; }
/* mâm lễ trên bàn thờ */
.offerings { align-items: flex-end; gap: 14px; }
.mam { display: flex; flex-direction: column; align-items: center; animation: drop .5s ease-out; }
.mam-fruit { display: flex; flex-wrap: wrap; justify-content: center; max-width: 92px; font-size: 18px; line-height: 1; margin-bottom: -4px; position: relative; z-index: 1; }
.mam-plate { width: 84px; height: 10px; border-radius: 50%; background: linear-gradient(#e8b450, #8a5a1c); box-shadow: 0 3px 0 #5a3a10; }
#locPick b { display: flex; align-items: center; justify-content: center; gap: 6px; }
.tray-sum button:disabled { opacity: .45; cursor: not-allowed; }
.le-img { width: 1em; height: 1em; vertical-align: -.12em; display: inline-block; object-fit: contain; }

/* Lịch hôm nay */
.lich { margin: 6px 0 12px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 8px 12px; font-size: .88rem; }
.lich summary { cursor: pointer; color: var(--muted); list-style: none; }
.lich summary::-webkit-details-marker { display: none; }
.lich summary::after { content: " ▾ chi tiết"; color: var(--gold); font-size: .8rem; }
.lich[open] summary::after { content: " ▴ thu gọn"; }
.lich summary b { color: var(--gold); }
.lich h4 { margin: 12px 0 6px; font-size: .85rem; color: var(--gold); }
.lich-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; }
.lich-dl dt { color: var(--muted); }
.lich-dl dd { margin: 0; }
.lich .ok { color: #8fe0a6; }
.lich .warn { color: #f0b060; }
.gio-list { display: flex; flex-wrap: wrap; gap: 6px; }
.gio { border-radius: 999px; padding: 3px 10px; border: 1px solid var(--panel-border); }
.gio small { color: var(--muted); }
.gio.good { border-color: rgba(143, 224, 166, .5); color: #b6f0c6; }
.gio.bad { opacity: .7; }
.gio.now { outline: 2px solid var(--gold); }
/* Xin xăm trong ngày */
.f-today { font-size: .8rem; color: var(--gold); margin-bottom: 6px; }
/* Bói Kiều */
.kieu-khan { margin: 8px 0 12px; padding: 8px 12px; border-left: 3px solid var(--gold-deep); color: var(--muted); font-style: italic; font-size: .88rem; }
.kieu-area { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.kieu-book {
  width: 70px; height: 92px; border-radius: 4px 8px 8px 4px; display: grid; place-items: center; text-align: center;
  background: linear-gradient(90deg, #5a1a12 0 8px, #8a2a1c 8px); box-shadow: 3px 3px 0 #e8d8b0, 5px 5px 0 #3a1208;
  color: var(--gold); font-family: 'Noto Serif', serif; font-weight: 700; font-size: .85rem; line-height: 1.2; transition: transform .4s;
}
.kieu-book.open { animation: kieuFlip .35s ease-in-out infinite alternate; }
@keyframes kieuFlip { to { transform: perspective(300px) rotateY(-28deg); } }
.kieu-card { margin-top: 14px; border: 3px double #a3271a; background: linear-gradient(#f7e6c4, #e9cf9b); color: #3a2208; border-radius: 12px; padding: 16px 18px; text-align: center; }
.kieu-card .f-today { color: #8a5a1c; }
.kieu-card .f-level { font-weight: 700; color: #fff3d6; background: #a3271a; }
.kieu-card .f-level[data-level="Thượng"] { background: #2e7a3a; }
.kieu-card .f-level[data-level="Trung"] { background: #a8701c; }
.panel .kieu-verse { color: #3a1a0e; font-family: 'Noto Serif', serif; font-size: 1.15rem; line-height: 1.7; margin: 10px 0; }
.kieu-card .f-meaning { color: #3a2208; }
.kieu-card .f-disclaimer { color: #7a5a40; font-size: .75rem; }
.fortune-card .f-today { color: #8a5a1c; }

/* Số may mắn */
.lucky-area { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.lucky-ball {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font: 700 2rem 'Noto Serif', serif; color: #3a2208; font-variant-numeric: tabular-nums;
  background: radial-gradient(circle at 35% 30%, #fff4c8, #f3c66b 55%, #a8701c); box-shadow: 0 0 0 4px rgba(243, 198, 107, .25), 0 6px 16px rgba(0, 0, 0, .4);
}
.lucky-ball.spin { animation: luckySpin .5s linear infinite; }
@keyframes luckySpin { 50% { transform: scale(1.08) rotate(8deg); } }
.lucky-card { margin-top: 14px; border: 3px double #a3271a; background: linear-gradient(#f7e6c4, #e9cf9b); color: #3a1a0e; border-radius: 12px; padding: 16px 18px; text-align: center; animation: fade .5s; }
.lucky-card .f-today { color: #8a5a1c; }
.lucky-num { font: 700 3.4rem/1.1 'Noto Serif', serif; color: #a3271a; letter-spacing: .05em; }
.lucky-card .f-level { color: #fff3d6; background: #a8701c; }
.lucky-card .f-level[data-level="Đại cát"] { background: #a3271a; }
.lucky-card .f-level[data-level="Cát"] { background: #2e7a3a; }
.lucky-title { font-weight: 700; color: #5a3420; }
.panel .lucky-pair { margin: 8px 0; color: #a3271a; font-weight: 600; }
.lucky-digits { text-align: left; margin: 10px auto; padding-left: 20px; max-width: 520px; color: #3a1a0e; line-height: 1.6; }
.panel .lucky-advice { color: #2e5a2a; font-weight: 600; }
.lucky-card .f-disclaimer { color: #7a5a40; font-size: .75rem; }

/* Hộp thoại trên điện thoại: vừa khít phần màn hình thấy được, nút đóng luôn hiện */
dialog { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overscroll-behavior: contain; }
.dlg-close { position: sticky; top: 0; float: right; z-index: 3; margin: -6px -6px 0 8px; right: auto; }
.dlg-close button { background: #22120a; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
@media (max-width: 560px) {
  dialog { width: calc(100% - 20px); padding: 16px 14px 20px; }
  .profile-head { gap: 12px; }
  .profile-head #pAvatar .av { width: 72px; height: 72px; }
  .profile-head h2 { font-size: 1.35rem; }
  .profile-head p { overflow-wrap: anywhere; }
  .profile-dl dd { overflow-wrap: anywhere; }
}

/* Trang chủ: khối Hôm nay */
.today { margin: 4px 0 22px; display: grid; gap: 10px; text-align: left; }
.today-date { background: rgba(0, 0, 0, .25); border: 1px solid var(--panel-border); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; font-size: .92rem; }
.today-date b { color: var(--gold); }
.today .ok { color: #8fe0a6; }
.today .warn { color: #f0b060; }
.le-banner { border-radius: 14px; padding: 10px 14px; border: 1px dashed var(--gold-deep); color: var(--text); font-size: .92rem; }
.le-banner b { color: var(--gold); }
.le-banner.on { border-style: solid; background: linear-gradient(90deg, rgba(163, 39, 26, .55), rgba(243, 198, 107, .18)); animation: leGlow 3s ease-in-out infinite; }
@keyframes leGlow { 50% { box-shadow: 0 0 18px rgba(243, 198, 107, .35); } }
.today-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.today-card { background: linear-gradient(#f7e6c4, #e9cf9b); color: #3a1a0e; border-radius: 14px; padding: 12px 14px; border: 2px solid #a3271a; }
.today-card.empty { background: rgba(0, 0, 0, .2); color: var(--muted); border: 1px dashed var(--panel-border); }
.tc-head { font-weight: 700; font-size: .85rem; color: #8a2a1c; margin-bottom: 6px; }
.today-card.empty .tc-head { color: var(--gold); }
.tc-empty { font-size: .85rem; }
.tc-big { font-weight: 700; color: #a3271a; }
.tc-verse { font-family: 'Noto Serif', serif; font-size: 1rem; line-height: 1.55; color: #3a1a0e; }
.tc-num { font: 700 2.2rem/1 'Noto Serif', serif; color: #a3271a; }
.tc-text { font-size: .85rem; margin-top: 4px; color: #5a3420; line-height: 1.45; }

/* Sơ đồ: phóng to từng khu, tìm bạn theo tên */
.map-search { display: block; width: calc(100% - 52px); margin: 0 0 10px; padding: 7px 12px; border-radius: 999px; font-size: .85rem; }
.map-head small { color: var(--muted); font-size: .75rem; }
button.map-block { font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
button.map-block:hover, button.map-block:focus-visible { border-color: var(--gold); transform: translateY(-2px); }
.zone-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.zone-head b { color: var(--gold); font-size: .9rem; }
.zone-head button { padding: 4px 12px; border-radius: 999px; font-size: .82rem; }
.zone-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; max-width: 560px; margin: 0 auto; }
.zs { aspect-ratio: 1 / 1.25; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; min-width: 0; padding-top: 3px; border-radius: 8px; }
.zs.empty { justify-content: center; }
.zs.empty i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(201, 138, 36, .45); }
.zs.nam, .zs.nu, .zs.me { background: rgba(255, 255, 255, .06); }
.zs.me { outline: 1.5px solid var(--gold); }
.zs.mark { outline: 2px solid #8fe0a6; animation: zoneMark 1.2s ease-in-out infinite; }
@keyframes zoneMark { 50% { box-shadow: 0 0 12px #8fe0a6; } }
.zs small { font-size: .6rem; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e8d8c0; padding: 0 2px; }
.zs .av.mini { width: 22px; height: 22px; font-size: 11px; }
.zs.nu .av { border-color: #f0a6bd; }
.zs.nam .av { border-color: #8fb0dc; }
.zone-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.zone-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .04); font-size: .85rem; }
.zone-list li[data-find] { cursor: pointer; }
.zone-list li[data-find]:hover { background: rgba(243, 198, 107, .12); }
.zone-list li span { flex: 1; min-width: 0; display: grid; }
.zone-list li span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-list li span em { color: var(--gold); font-style: normal; font-weight: 400; }
.zone-list li small { color: var(--muted); font-size: .75rem; }
.zone-list li .zm { color: var(--gold); flex: none; }
.zone-list li.me { outline: 1px solid var(--gold-deep); }
.zone-list li.mark { outline: 1.5px solid #8fe0a6; }
.zone-list li.empty { color: var(--muted); justify-content: center; }

/* Sân chùa: trời phẳng phía sau cảnh 3D; chữ và nút luôn nằm trên mọi lớp 3D (Chrome Android hay vẽ lớp 3D đè lên) */
.yard-stage { z-index: 0; isolation: isolate; }
.y3sky { position: absolute; inset: 0; pointer-events: none; }
.y3sky svg { display: block; }
.yard-particles { z-index: 2; }
.walk-fade { z-index: 3; }
#yard .topbar.floating, #yard .yard-bottom { z-index: 5; transform: translateZ(0); }

/* Nút nhạc nền ở cổng */
.gate-music { width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 1.05rem; line-height: 1; flex: none; }
.gate-music.off { opacity: .55; }
.me-bar .merit { margin-left: auto; margin-right: 10px; }

/* Hôm nay: trực, ngũ hành, xuất hành, tuổi */
.td-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 16px; margin-top: 6px; font-size: .86rem; }
.td-grid span { color: var(--muted); margin-right: 6px; }
.td-grid span::after { content: ':'; }
.td-nen { font-size: .84rem; color: #e8d8c0; line-height: 1.5; }
.lv-ok, .lv-mid, .lv-bad { font-style: normal; font-size: .72rem; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.lv-ok { background: rgba(143, 224, 166, .18); color: #8fe0a6; }
.lv-mid { background: rgba(243, 198, 107, .15); color: var(--gold); }
.lv-bad { background: rgba(240, 120, 90, .18); color: #f39a80; }
.loi-ngay { text-align: center; font-family: 'Noto Serif', serif; color: #f3dcb0; padding: 4px 12px; font-size: .98rem; line-height: 1.5; }
.tuoi-cta { width: 100%; text-align: left; font: inherit; font-size: .9rem; color: var(--text); background: linear-gradient(90deg, rgba(122, 31, 18, .55), rgba(243, 198, 107, .12)); border: 1px dashed var(--gold-deep); border-radius: 14px; padding: 11px 14px; cursor: pointer; }
.tuoi-cta b { color: var(--gold); }
.tuoi-today { border: 1px solid var(--gold-deep); background: rgba(0, 0, 0, .28); border-radius: 14px; padding: 12px 14px; display: grid; gap: 5px; }
.tt-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.tt-head b { color: var(--gold); }
.tt-text { font-size: .85rem; line-height: 1.5; }
.tt-text b { color: var(--gold); }
.tuoi-today button { justify-self: start; margin-top: 4px; padding: 5px 14px; border-radius: 999px; font-size: .84rem; }

/* Hồ sơ: ngày sinh */
#birthInput { color-scheme: dark; }
.tuoi-btn { width: 100%; margin: 4px 0 6px; }

/* Lá số tuổi */
.tuoi-dlg { width: min(760px, calc(100% - 20px)); }
.tuoi-head { display: flex; gap: 16px; align-items: center; margin: 4px 40px 14px 0; }
.tuoi-head h2 { margin: 0 0 4px; color: var(--gold); }
.tuoi-head p { margin: 2px 0; font-size: .88rem; }
.tuoi-badge { flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font: 700 1.5rem 'Noto Serif', serif; color: #2a1408;
  background: radial-gradient(circle at 35% 30%, #fff8, transparent 55%), var(--h); box-shadow: 0 0 0 3px rgba(243, 198, 107, .5), 0 0 22px var(--h); }
.hanh { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; color: #2a1408; background: var(--h); }
.tuoi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.tuoi-sec { background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-border); border-radius: 14px; padding: 12px 14px; font-size: .87rem; }
.tuoi-sec h3 { margin: 0 0 8px; font-size: .98rem; color: var(--gold); }
.tuoi-sec h4 { margin: 10px 0 4px; font-size: .82rem; color: var(--muted); }
.tuoi-sec p { margin: 4px 0; line-height: 1.55; }
.tuoi-sec .ok, .tuoi-dlg .ok { color: #8fe0a6; }
.tuoi-sec .warn, .tuoi-dlg .warn { color: #f0b060; }
.mau { display: inline-flex; align-items: center; gap: 4px; margin: 2px 8px 2px 0; }
.mau i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); }
.so { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(243, 198, 107, .15); color: var(--gold); }
.huong { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.huong li { display: flex; gap: 8px; align-items: baseline; }
.huong li b { min-width: 76px; }
.huong li.ok b { color: #8fe0a6; }
.huong li.bad b { color: #f39a80; }
.huong li span { color: var(--muted); font-size: .8rem; }
.phat { font: 600 1.05rem 'Noto Serif', serif; color: #f3dcb0; }
.gio { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 8px; border-radius: 999px; background: rgba(143, 224, 166, .12); color: #cfeed8; font-size: .8rem; }
.ngay-dep { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ngay-dep li { display: grid; padding: 6px 8px; border-radius: 10px; background: rgba(243, 198, 107, .07); }
.ngay-dep li b { color: var(--gold); }
.ngay-dep li small { color: var(--muted); }
.ngay-dep li span { font-size: .8rem; }
.tuoi-note { margin: 12px 0 0; font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.5; }
@media (max-width: 560px) {
  .tuoi-grid { grid-template-columns: 1fr; }
  .tuoi-head { gap: 12px; }
  .tuoi-badge { width: 58px; height: 58px; font-size: 1.2rem; }
}

/* Hôm nay: bố cục thẻ như lịch vạn niên */
.today-date { gap: 10px; }
.td-title { display: grid; gap: 2px; }
.td-title > b { font-size: 1.15rem; }
.td-title span { font-size: .9rem; }
.td-title span b { color: var(--text); }
.td-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.td-card { display: grid; gap: 3px; align-content: start; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(243, 198, 107, .18); font-size: .85rem; }
.td-card small { color: var(--muted); font-size: .76rem; }
.td-card > b { font: 600 1.05rem 'Noto Serif', serif; color: var(--gold); }
.td-card > b.ok { color: #8fe0a6; }
.td-card > b.warn { color: #f0b060; }
.td-hours-title { font-size: .85rem; color: var(--gold); margin-top: 2px; }
.td-hours-title small { color: var(--muted); font-size: .75rem; }
.td-hours { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.td-hours div { display: grid; justify-items: center; padding: 5px 2px; border-radius: 9px; border: 1px solid rgba(232, 216, 192, .22); background: rgba(255, 255, 255, .035); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); color: #cbb9a0; font-size: .78rem; text-align: center; }
.td-hours div b { font-weight: 600; }
.td-hours div span { font-size: .7rem; }
.td-hours div small { font-size: .68rem; opacity: .8; }
.td-hours div.good { background: rgba(243, 198, 107, .12); border-color: rgba(243, 198, 107, .45); color: var(--text); }
.td-hours div.good b, .td-hours div.good small { color: var(--gold); opacity: 1; }
@media (max-width: 560px) {
  .td-hours { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .td-cards { grid-template-columns: 1fr 1fr; }
}

/* ===== Sự kiện ngày lễ Phật giáo ===== */
.fest-banner { --p1: #f6b3c8; --p2: #ffe08a; --p3: #fff; --bg1: rgba(163, 39, 26, .7); --bg2: rgba(243, 198, 107, .25);
  position: relative; overflow: hidden; display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 18px;
  background: linear-gradient(120deg, var(--bg1), var(--bg2)); border: 1.5px solid var(--gold); box-shadow: 0 0 26px rgba(243, 198, 107, .25); animation: leGlow 4s ease-in-out infinite; }
.fest-tet { --p1: #f7a1b5; --p2: #ffd54a; --p3: #ff7a59; --bg1: rgba(178, 28, 18, .85); --bg2: rgba(255, 196, 64, .3); }
.fest-phatdan { --p1: #f6a9c4; --p2: #ffe08a; --p3: #fff6e8; --bg1: rgba(150, 60, 110, .7); --bg2: rgba(255, 214, 120, .3); }
.fest-vulan { --p1: #e8506a; --p2: #f6a3b5; --p3: #ffe9a8; --bg1: rgba(140, 20, 40, .75); --bg2: rgba(246, 163, 181, .22); }
.fest-lantern { --p1: #ffcf6b; --p2: #ff9a3c; --p3: #fff1c4; --bg1: rgba(120, 50, 10, .8); --bg2: rgba(255, 170, 60, .3); }
.fest-lotus { --p1: #f3c66b; --p2: #f6b3c8; --p3: #fff3d6; --bg1: rgba(90, 40, 20, .8); --bg2: rgba(243, 198, 107, .28); }
.fest-quanam { --p1: #ffffff; --p2: #cfe3ff; --p3: #f6d3e3; --bg1: rgba(40, 70, 110, .75); --bg2: rgba(220, 235, 255, .22); }
.fest-icon { position: relative; z-index: 1; flex: none; font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 0 10px rgba(255, 220, 140, .8)); animation: festBob 3s ease-in-out infinite; }
@keyframes festBob { 50% { transform: translateY(-4px) scale(1.05); } }
.fest-body { position: relative; z-index: 1; display: grid; gap: 4px; min-width: 0; }
.fest-body small { color: #ffe9b8; font-size: .78rem; letter-spacing: .02em; text-transform: uppercase; }
.fest-body > b { font: 700 1.25rem/1.3 'Noto Serif', serif; color: #fff3d0; text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
.fest-body p { margin: 0; font-size: .9rem; line-height: 1.55; color: #fbe9d0; }
.fest-events { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fest-events span { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 233, 184, .3); }
.fest-events b { color: #ffe08a; }
.fest-body button { justify-self: start; margin-top: 6px; }
.fest-petals { position: absolute; inset: 0; pointer-events: none; }
.fest-petals i { position: absolute; top: -12px; width: 10px; height: 10px; border-radius: 0 100% 0 100%; background: var(--p1); opacity: .85; animation: festFall 7s linear infinite; }
.fest-petals i:nth-child(3n) { background: var(--p2); }
.fest-petals i:nth-child(3n+1) { background: var(--p3); width: 7px; height: 7px; }
.fest-petals i:nth-child(1) { left: 3%; animation-delay: -0.0s; animation-duration: 6s; }
.fest-petals i:nth-child(2) { left: 11%; animation-delay: -0.6s; animation-duration: 7s; }
.fest-petals i:nth-child(3) { left: 20%; animation-delay: -1.2s; animation-duration: 8s; }
.fest-petals i:nth-child(4) { left: 28%; animation-delay: -1.8s; animation-duration: 9s; }
.fest-petals i:nth-child(5) { left: 36%; animation-delay: -2.4s; animation-duration: 6s; }
.fest-petals i:nth-child(6) { left: 44%; animation-delay: -3.0s; animation-duration: 7s; }
.fest-petals i:nth-child(7) { left: 53%; animation-delay: -3.7s; animation-duration: 8s; }
.fest-petals i:nth-child(8) { left: 61%; animation-delay: -4.3s; animation-duration: 9s; }
.fest-petals i:nth-child(9) { left: 69%; animation-delay: -4.9s; animation-duration: 6s; }
.fest-petals i:nth-child(10) { left: 78%; animation-delay: -5.5s; animation-duration: 7s; }
.fest-petals i:nth-child(11) { left: 86%; animation-delay: -6.1s; animation-duration: 8s; }
.fest-petals i:nth-child(12) { left: 94%; animation-delay: -6.7s; animation-duration: 9s; }
@keyframes festFall { to { transform: translate(30px, 260px) rotate(540deg); opacity: 0; } }
.fest-flags { position: absolute; top: 0; left: 0; right: 0; height: 9px; z-index: 1;
  background: repeating-linear-gradient(90deg, #2f6fd1 0 28px, #f2c230 28px 56px, #d93a2b 56px 84px, #f7f3ea 84px 112px, #f08a2c 112px 140px); opacity: .9; }
.fest-chip { display: inline-block; padding: 0 8px; border-radius: 999px; background: rgba(243, 198, 107, .2); color: var(--gold); font-size: .8rem; }
.fest-next { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--panel-border); background: rgba(0, 0, 0, .2); font-size: .86rem; }
.fn-title { color: var(--gold); font-weight: 600; }
.fn-item { display: inline-grid; }
.fn-item b { color: var(--text); }
.fn-item.dai b { color: #ffd58a; }
.fn-item small { color: var(--muted); font-size: .76rem; }

/* Hiệu ứng toàn trang */
.fest-fx { --p1: #f6b3c8; --p2: #ffe08a; --p3: #fff; position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fest-fx.fest-tet { --p1: #f7a1b5; --p2: #ffd54a; --p3: #ff7a59; }
.fest-fx.fest-phatdan { --p1: #f6a9c4; --p2: #ffe08a; --p3: #fff6e8; }
.fest-fx.fest-vulan { --p1: #e8506a; --p2: #f6a3b5; --p3: #ffe9a8; }
.fest-fx.fest-lantern { --p1: #ffcf6b; --p2: #ff9a3c; --p3: #fff1c4; }
.fest-fx.fest-lotus { --p1: #f3c66b; --p2: #f6b3c8; --p3: #fff3d6; }
.fest-fx.fest-quanam { --p1: #ffffff; --p2: #cfe3ff; --p3: #f6d3e3; }
.fest-fx i { position: absolute; left: var(--x); opacity: 0; animation-duration: var(--d); animation-delay: var(--w); animation-iteration-count: infinite; animation-timing-function: linear; }
.fest-fx i.petal { top: -20px; width: calc(13px * var(--s)); height: calc(13px * var(--s)); border-radius: 0 100% 0 100%; background: var(--p1); animation-name: fxFall; box-shadow: 0 0 6px rgba(255, 255, 255, .25); }
.fest-fx i.petal:nth-child(3n) { background: var(--p2); }
.fest-fx i.petal:nth-child(3n+1) { background: var(--p3); }
.fest-fx i.glow { bottom: -30px; width: calc(14px * var(--s)); height: calc(18px * var(--s)); border-radius: 45% 45% 40% 40%;
  background: radial-gradient(circle at 50% 40%, #fff6d0, var(--p1) 45%, var(--p2) 75%); box-shadow: 0 0 14px 4px rgba(255, 190, 90, .55); animation-name: fxRise; }
@keyframes fxFall { 0% { transform: translate(0, 0) rotate(0); opacity: 0; } 8% { opacity: .75; } 90% { opacity: .6; } 100% { transform: translate(var(--dx), 105vh) rotate(720deg); opacity: 0; } }
@keyframes fxRise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .8; } 85% { opacity: .55; } 100% { transform: translate(var(--dx), -105vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fest-fx { display: none; } .fest-petals i, .fest-icon, .fest-banner { animation: none; } }
@media (max-width: 560px) { .fest-banner { padding: 14px; gap: 10px; } .fest-icon { font-size: 2rem; } .fest-body > b { font-size: 1.08rem; } }

/* Đèn lồng treo hai bên trong ngày lễ */
.fest-fx .fx-lantern { position: absolute; top: 0; width: 2px; height: var(--h); background: linear-gradient(#d9a441, #8a5a1c); transform-origin: top center; animation: fxSwing var(--t) ease-in-out infinite alternate; }
.fest-fx .fx-lantern.l { left: calc(6px + var(--o)); }
.fest-fx .fx-lantern.r { right: calc(6px + var(--o)); animation-direction: alternate-reverse; }
.fest-fx .fx-lantern b { position: absolute; top: 100%; left: 50%; width: 22px; height: 28px; margin-left: -11px; border-radius: 45% 45% 42% 42%;
  background: radial-gradient(circle at 50% 38%, #fff3c4 0, var(--lc, #e2402c) 55%, #7a1408 100%); box-shadow: 0 0 14px 3px rgba(255, 120, 60, .45); }
.fest-fx .fx-lantern b::before, .fest-fx .fx-lantern b::after { content: ''; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: #d9a441; }
.fest-fx .fx-lantern b::before { top: -2px; }
.fest-fx .fx-lantern b::after { bottom: -2px; }
.fest-fx.fest-phatdan .fx-lantern b { --lc: #f2c230; box-shadow: 0 0 14px 3px rgba(255, 210, 90, .5); }
.fest-fx.fest-lotus .fx-lantern b { --lc: #e9a93a; }
.fest-fx.fest-quanam .fx-lantern b { --lc: #9fc3f0; box-shadow: 0 0 14px 3px rgba(190, 220, 255, .5); }
.fest-fx.fest-vulan .fx-lantern b { --lc: #e8506a; }
@keyframes fxSwing { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@media (max-width: 560px) { .fest-fx .fx-lantern:nth-of-type(n+3) { display: none; } .fest-fx .fx-lantern { opacity: .85; } .fest-fx .fx-lantern.l { left: 3px; } .fest-fx .fx-lantern.r { right: 3px; } .fest-fx .fx-lantern b { width: 14px; height: 19px; margin-left: -7px; } }
body:has(#hall.active) .fest-fx .fx-lantern { display: none; }

/* Ngày nhớ cá nhân */
.my-events { border: 1px solid var(--gold-deep); background: rgba(0, 0, 0, .28); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.me-head { display: flex; justify-content: space-between; align-items: center; color: var(--gold); font-weight: 600; font-size: .95rem; }
.me-head button { padding: 3px 12px; border-radius: 999px; font-size: .8rem; }
.me-due, .me-soon { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.me-due span, .me-soon span { display: grid; }
.me-due { padding: 8px 10px; border-radius: 10px; background: linear-gradient(90deg, rgba(163, 39, 26, .55), rgba(243, 198, 107, .14)); border: 1px solid rgba(243, 198, 107, .45); }
.me-due b { color: #ffe3a6; }
.me-due small, .me-soon small { color: var(--muted); font-size: .78rem; }
.me-due small b { color: #ffe3a6; }
.events-dlg { width: min(620px, calc(100% - 20px)); }
.events-dlg h2 { margin: 0 40px 4px 0; color: var(--gold); }
.event-form { display: grid; gap: 8px; margin: 10px 0 14px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-border); }
.event-form input, .event-form select { width: 100%; padding: 8px 10px; border-radius: 10px; font: inherit; font-size: .9rem; color-scheme: dark; }
.ev-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.ev-row label { display: grid; gap: 3px; font-size: .78rem; color: var(--muted); }
.ev-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.event-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(232, 216, 192, .15); }
.event-list li.due { border-color: var(--gold); background: rgba(243, 198, 107, .1); }
.event-list li.past { opacity: .6; }
.event-list li.empty { color: var(--muted); justify-content: center; font-size: .88rem; }
.ev-ico { font-size: 1.3rem; line-height: 1.2; }
.ev-main { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: .9rem; }
.ev-main em { font-style: normal; color: var(--gold); font-size: .8rem; }
.ev-main small { color: var(--muted); font-size: .78rem; }
.ev-main .ev-next { color: #e8d8c0; }
.ev-next b { color: #ffe3a6; }
.ev-btns { display: flex; gap: 4px; }
.ev-btns button { padding: 4px 8px; border-radius: 8px; }

/* Nút "Vào chùa" dưới tên trang: cuộn xuống danh sách chùa */
.go-temples { display: inline-flex; align-items: center; gap: 6px; margin: 4px auto 18px; padding: 11px 30px; border-radius: 999px; font-size: 1.05rem; font-weight: 700; text-decoration: none; }
#templeList { scroll-margin-top: 12px; }
