/* ===== Chùa Online ===== */
:root {
  --bg: #170d09;
  --bg-2: #22130c;
  --panel: #2a1810;
  --panel-2: #341e14;
  --line: #4b2d1d;
  --text: #f3e4c8;
  --muted: #bda483;
  --gold: #f2b94b;
  --gold-2: #ffe29a;
  --red: #b3261e;
  --red-2: #7c1712;
  --jade: #3f8f6b;
  --accent: var(--gold);
  --hall-a: #5a1510;
  --hall-b: #2a0a07;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Noto Serif', Georgia, 'Times New Roman', serif;
}
.theme-jade    { --hall-a: #174634; --hall-b: #0a1f17; --accent: #8fd6b1; }
.theme-crimson { --hall-a: #6a1712; --hall-b: #2b0907; --accent: #f2b94b; }
.theme-indigo  { --hall-a: #1f2552; --hall-b: #0c0f26; --accent: #c6b8ff; }
.theme-gold    { --hall-a: #6b4410; --hall-b: #2d1a05; --accent: #ffd67a; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); line-height: 1.6;
  background: radial-gradient(1200px 600px at 50% -10%, #3a1d10 0%, transparent 60%), var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); color: var(--gold-2); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .8em; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.big { font-size: 2.4rem; margin: 0; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.topbar { background: linear-gradient(#2c140b, #1d0e08); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold-2); font-weight: 700; font-size: 1.15rem; }
.brand svg { width: 30px; height: 30px; color: var(--gold); }
.brand:hover { text-decoration: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text); padding: 6px 12px; border-radius: 999px; }
.nav a:hover, .nav a.on { background: var(--panel-2); text-decoration: none; color: var(--gold-2); }
.nav .btn { color: #2a1406; }
.nav-user { color: var(--muted); padding: 0 8px; font-size: .92rem; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; font-size: 1.2rem; padding: 4px 10px; cursor: pointer; }
.lunar-bar { background: var(--red-2); font-size: .88rem; }
.lunar-bar .wrap { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.lunar-bar strong { color: var(--gold-2); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(#ffd67a, #e0a133); color: #2a1406; border: 0; border-radius: 999px;
  padding: 10px 20px; font: 600 1rem var(--font); cursor: pointer; box-shadow: 0 4px 14px rgba(242, 185, 75, .25);
  transition: transform .15s, filter .15s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn-ghost { background: transparent; color: var(--gold-2); border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { padding: 6px 14px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn.ping { animation: ping .5s; }
@keyframes ping { 50% { transform: scale(1.08); } }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.form input, .form select, .form textarea {
  width: 100%; font: 400 1rem var(--font); color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.form label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form label.check input { width: auto; margin-top: 5px; }
.hint { font-size: .82rem; color: var(--muted); margin: -6px 0 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.auth-card { max-width: 440px; margin: 20px auto; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.flash-success { background: #183a28; border-color: #2f6b4b; }
.flash-error { background: #4a1512; border-color: #8b2a23; }
.flash-info { background: #2f2413; border-color: #6d5227; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); transition: .35s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-color: #8b2a23; }
.toast-success { border-color: #2f6b4b; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: center; margin-bottom: 36px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--gold); margin-bottom: .4em; }
.lead { font-size: 1.1rem; color: #e6d2ae; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hero-stats { display: grid; gap: 12px; }
.hero-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: baseline; gap: 10px; }
.hero-stats strong { font-size: 1.8rem; color: var(--gold-2); }
.section-title { margin-top: 30px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.pagoda-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pagoda-card {
  display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); transition: transform .2s, box-shadow .2s;
}
.pagoda-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.pagoda-art { background: linear-gradient(160deg, var(--hall-a), var(--hall-b)); color: var(--accent); padding: 18px 0 6px; display: flex; justify-content: center; }
.pagoda-art svg { width: 150px; height: 100px; }
.pagoda-body { padding: 16px 18px 18px; }
.pagoda-body h3 { color: var(--gold-2); margin-bottom: 2px; }
.burning { font-size: .85rem; color: var(--gold); }

.wish-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.wish-card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; }
.wish-card p { font-style: italic; overflow-wrap: anywhere; }
.wish-card footer { font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rejoice { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; }
.rejoice.on { background: var(--gold); color: #2a1406; border-color: var(--gold); }
.rejoice:disabled { cursor: default; opacity: .7; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; }
.pager a.on { background: var(--gold); color: #2a1406; }

/* ---------- Temple ---------- */
.temple-head { margin-bottom: 18px; }
.temple-layout { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.scene { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.scene-hall {
  position: relative; height: 470px; border-radius: 10px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 214, 122, .22), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(0, 0, 0, .18) 58px 62px),
    linear-gradient(var(--hall-a), var(--hall-b));
}
.scene-hall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); pointer-events: none; }
.lantern { position: absolute; top: 0; width: 38px; height: 54px; border-radius: 45%; background: radial-gradient(#ffcf6a, #c9241b 70%); box-shadow: 0 0 30px rgba(255, 120, 60, .6); animation: sway 5s ease-in-out infinite; transform-origin: 50% -30px; margin-top: 30px; }
.lantern::before { content: ''; position: absolute; left: 50%; top: -30px; width: 2px; height: 30px; background: #a07a3a; }
.lantern.l { left: 7%; } .lantern.r { right: 7%; animation-delay: -2.5s; }
@keyframes sway { 50% { transform: rotate(4deg); } }
.banner { position: absolute; top: 110px; writing-mode: vertical-rl; background: linear-gradient(#b3261e, #7c1712); color: var(--gold-2); padding: 14px 8px; border: 2px solid #d9a23c; font-weight: 700; letter-spacing: .1em; font-size: .95rem; }
.banner.l { left: 4%; } .banner.r { right: 4%; }
.buddha { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); width: 250px; height: 275px; }
.buddha .halo { animation: glow 4s ease-in-out infinite; transform-origin: 100px 70px; }
@keyframes glow { 50% { opacity: .65; transform: scale(1.05); } }

.altar { position: absolute; left: 8%; right: 8%; bottom: 22px; height: 120px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 4%; z-index: 2;
  background: linear-gradient(transparent 55%, #6b2a14 55%, #4a1b0c); border-radius: 6px; }
.altar::after { content: ''; position: absolute; left: -2%; right: -2%; bottom: 52px; height: 8px; background: #d9a23c; border-radius: 4px; }
.candle { position: relative; width: 16px; height: 62px; margin-bottom: 60px; background: linear-gradient(90deg, #c7201a, #f04a3c, #c7201a); border-radius: 3px; }
.flame { position: absolute; left: 50%; top: -22px; width: 12px; height: 22px; margin-left: -6px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff7c2, #ffb22e 55%, rgba(255, 90, 0, .2)); box-shadow: 0 0 22px 8px rgba(255, 170, 60, .45); animation: flicker .18s infinite alternate; }
@keyframes flicker { to { transform: scale(.94, 1.06) translateX(.5px); opacity: .9; } }
.fruit, .flowers { white-space: nowrap; font-size: 1.7rem; margin-bottom: 60px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.burner { position: relative; width: 120px; height: 150px; margin-bottom: 58px; }
.burner-bowl { position: absolute; bottom: 0; left: 0; right: 0; height: 52px; border-radius: 12px 12px 50% 50% / 12px 12px 60% 60%; background: linear-gradient(#e3b155, #8d5a17); box-shadow: inset 0 6px 0 #ffe29a55, 0 6px 12px rgba(0, 0, 0, .5); }
.burner-bowl::before, .burner-bowl::after { content: ''; position: absolute; top: 10px; width: 14px; height: 22px; border: 4px solid #b98330; border-radius: 50%; }
.burner-bowl::before { left: -12px; } .burner-bowl::after { right: -12px; }
.burner-sticks { position: absolute; left: 50%; bottom: 40px; width: 0; height: 0; }
.stick {
  position: absolute; bottom: 0; left: var(--x); width: 3px; height: var(--h);
  background: linear-gradient(#5c2b12 0 70%, #c9432e 70%); border-radius: 2px;
  transform-origin: bottom center; transform: rotate(var(--tilt));
  animation: plant .7s ease-out both; animation-delay: var(--delay);
}
.stick.mine { box-shadow: 0 0 6px rgba(255, 214, 122, .5); }
@keyframes plant { from { transform: translateY(-60px) rotate(var(--tilt)); opacity: 0; } to { transform: rotate(var(--tilt)); opacity: 1; } }
.stick .tip { position: absolute; top: -3px; left: -1px; width: 5px; height: 6px; border-radius: 50%; background: #ff6a2a; box-shadow: 0 0 8px 3px rgba(255, 110, 40, .8); animation: ember 1.6s ease-in-out infinite alternate; }
@keyframes ember { to { box-shadow: 0 0 4px 1px rgba(255, 110, 40, .5); background: #ff8f4a; } }
.stick .smoke {
  position: absolute; top: -40px; left: -8px; width: 18px; height: 40px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(230, 225, 215, .35), transparent 70%);
  filter: blur(3px); animation: smoke 5s linear infinite; animation-delay: var(--smoke-delay); opacity: 0;
}
.stick .smoke.s2 { animation-delay: calc(var(--smoke-delay) + 2.5s); }
@keyframes smoke {
  0% { transform: translate(0, 0) scale(.6); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translate(12px, -150px) scale(2.4) rotate(20deg); opacity: 0; }
}
.scene-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0 6px; }

.offer-panel h2 { color: var(--gold-2); }
.sticks-pick { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; }
.sticks-pick legend { font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.sticks-pick label { display: block; position: relative; }
.sticks-pick input { position: absolute; opacity: 0; }
.sticks-pick span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-weight: 700; }
.sticks-pick input:checked + span { background: var(--gold); color: #2a1406; border-color: var(--gold); }
.sticks-pick input:focus-visible + span { outline: 2px solid var(--gold-2); }
.offer-done { text-align: center; padding: 10px 0; }

/* ---------- Fortune ---------- */
.fortune-layout { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
.small-title { font-size: 1rem; margin-top: 20px; color: var(--gold-2); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .92rem; }
.fortune-stage { min-height: 520px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 214, 122, .14), transparent 60%), var(--panel); }
.tube-wrap { position: relative; width: 260px; height: 280px; }
.tube { position: absolute; left: 50%; bottom: 20px; width: 110px; margin-left: -55px; transform-origin: 50% 100%; }
.tube-body { position: relative; height: 170px; border-radius: 10px 10px 16px 16px; background: linear-gradient(90deg, #7c1712, #c9362b 40%, #e25444 55%, #7c1712); border: 3px solid #d9a23c; display: grid; place-items: center; z-index: 2; }
.tube-body span { color: var(--gold-2); font-weight: 700; font-size: 1.05rem; letter-spacing: .1em; line-height: 1.3; }
.tube-sticks { position: absolute; left: 10px; right: 10px; bottom: 150px; height: 70px; }
.tube-sticks i { position: absolute; bottom: 0; left: calc(var(--i) * 6.5px); width: 6px; height: var(--h); background: linear-gradient(#e7c07a, #b98330); border-radius: 3px 3px 0 0; transform: rotate(calc((var(--i) - 6) * 1.6deg)); transform-origin: bottom; }
.tube.shaking { animation: shake .22s ease-in-out infinite; }
.tube.shaking .tube-sticks i { animation: jiggle .15s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -30ms); }
@keyframes shake { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(-2deg) translateY(-6px); } }
@keyframes jiggle { to { transform: translateY(-8px) rotate(calc((var(--i) - 6) * 2deg)); } }
.fallen-stick { position: absolute; right: 0; bottom: 8px; width: 150px; height: 20px; background: linear-gradient(#f1d08e, #c2913b); border-radius: 4px; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(0, 0, 0, .4); transform: rotate(-8deg); z-index: 3; }
.fallen-stick span { color: #7c1712; font-weight: 700; font-size: .95rem; }
.fallen-stick.drop { animation: drop .8s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes drop { from { transform: translate(-90px, -170px) rotate(-80deg); opacity: 0; } to { transform: rotate(-8deg); opacity: 1; } }

.keo-area { margin-top: 16px; max-width: 520px; }
.coins { display: flex; gap: 28px; justify-content: center; margin-bottom: 14px; perspective: 600px; }
.coin { position: relative; width: 84px; height: 52px; transform-style: preserve-3d; transition: transform .5s; }
.coin .face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; font-size: .8rem; font-weight: 700; border-radius: 84px 84px 12px 12px; }
.coin .up { background: linear-gradient(#e0493c, #8f1b14); color: var(--gold-2); border: 2px solid #d9a23c; }
.coin .down { background: linear-gradient(#5b3218, #2e170a); color: #e7c07a; border: 2px solid #7a4a22; transform: rotateX(180deg); }
.coin.is-up { transform: rotateX(0deg); }
.coin.is-down { transform: rotateX(180deg); }
.coin.tossing { animation: toss 1s ease-in-out; }
@keyframes toss { 0% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-90px) rotateX(900deg); } 100% { transform: translateY(0) rotateX(1800deg); } }
.keo-msg { min-height: 3em; }
.keo-thanh { color: #9fe0b9; font-weight: 700; }
.keo-am { color: #f0a39a; }
.keo-tieu { color: var(--gold-2); }
.stage-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* ---------- Fortune result ---------- */
.que-card { max-width: 760px; margin: 0 auto 24px; background: linear-gradient(#fbf1d9, #f1dfb5); color: #3a1d0c; border-radius: 12px; padding: 34px clamp(18px, 5vw, 48px); box-shadow: var(--shadow); border: 6px double #b3261e; }
.que-card .eyebrow { color: #8f1b14; }
.que-head { text-align: center; border-bottom: 1px solid #c9a86a; padding-bottom: 18px; margin-bottom: 20px; }
.que-number { font-size: 1rem; color: #8f1b14; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; }
.que-head h1 { color: #7c1712; margin: 6px 0 12px; }
.que-poem { text-align: center; font-size: 1.2rem; font-style: italic; line-height: 2; margin-bottom: 20px; color: #4a200b; }
.que-question { text-align: center; font-style: italic; }
.que-section { margin-top: 18px; }
.que-section h2 { font-size: 1.1rem; color: #8f1b14; border-left: 4px solid #b3261e; padding-left: 10px; }
.que-section.focus { background: #fff8e6; border: 1px solid #e0c388; border-radius: 10px; padding: 14px 16px; }
.aspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0; }
.aspects div { background: #fff8e6aa; border-radius: 8px; padding: 10px 12px; border: 1px solid #ead3a2; }
.aspects div.on { border-color: #b3261e; }
.aspects dt { font-weight: 700; color: #7c1712; }
.aspects dd { margin: 0; }
.que-section.advice p { font-weight: 600; }
.que-foot { margin-top: 24px; border-top: 1px solid #c9a86a; padding-top: 12px; text-align: center; color: #7a5a3a; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; vertical-align: middle; }
.badge.big { font-size: .95rem; padding: 4px 16px; }
.lv-best { background: #b3261e; color: #fff3c4; }
.lv-good { background: #d9a23c; color: #3a1d0c; }
.lv-mid { background: #6b7d5a; color: #f5f0e0; }
.lv-low { background: #5a4a44; color: #f0e2d0; }

/* ---------- History ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { text-align: center; padding: 16px; }
.stat strong { display: block; font-size: 1.8rem; color: var(--gold-2); }
.stat span { color: var(--muted); font-size: .9rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 16px 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.timeline p { margin: 4px 0; font-style: italic; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: #140a06; padding: 20px 0; font-size: .9rem; text-align: center; }
.footer p { margin: 4px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero, .temple-layout, .fortune-layout, .two-col { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .scene-hall { height: 420px; }
  .buddha { width: 210px; height: 230px; }
  .banner { display: none; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #1d0e08; flex-direction: column; align-items: stretch; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .nav-open .nav { display: flex; }
  .topbar-inner { position: relative; }
  .altar { left: 2%; right: 2%; }
  .fruit, .flowers { font-size: 1.2rem; }
  .pagoda-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media print {
  .topbar, .footer, .btn, .flash { display: none !important; }
  body { background: #fff; }
  .que-card { box-shadow: none; }
}

/* =====================  v2  ===================== */
.music-toggle { margin-left: auto; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; width: 38px; height: 38px; cursor: pointer; font-size: 1rem; flex: none; }
.music-toggle.on { color: #2a1406; background: var(--gold); border-color: var(--gold); animation: breathe 4s ease-in-out infinite; }
.music-toggle.waiting { border-color: var(--gold); color: var(--gold); }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(242, 185, 75, .15); } }
.nav { margin-left: 8px; }
.nav a { padding: 6px 10px; }
a.nav-user { color: var(--muted); }

/* Lễ vật */
.items-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.items-pick legend { font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.items-pick label { position: relative; display: block; font-weight: 400; }
.items-pick input { position: absolute; opacity: 0; }
.items-pick span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-size: .9rem; }
.items-pick input:checked + span { background: var(--gold); color: #2a1406; border-color: var(--gold); }
.items-pick input:focus-visible + span { outline: 2px solid var(--gold-2); }
.altar-offerings { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); display: flex; gap: 4px; z-index: 3; font-size: 1.25rem; pointer-events: none; max-width: 70%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); flex-wrap: wrap; justify-content: center; }
.altar-offerings span.new { animation: offer .8s ease-out both; }
@keyframes offer { from { transform: translateY(-40px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.altar-offerings.inline { position: static; transform: none; margin-bottom: 60px; max-width: 110px; font-size: 1.3rem; }

/* Lễ Phật 3 lạy */
.bow-overlay { position: absolute; inset: 0; z-index: 10; display: grid; place-content: center; text-align: center; gap: 10px; background: rgba(10, 4, 2, .72); backdrop-filter: blur(2px); cursor: pointer; padding: 16px; }
.bow-hands { font-size: 4rem; transform-origin: 50% 100%; }
.bow-overlay.bowing .bow-hands { animation: bow 3s ease-in-out; }
@keyframes bow { 0% { transform: none; } 35%, 55% { transform: translateY(30px) scale(.85) rotateX(40deg); opacity: .8; } 100% { transform: none; } }
.bow-overlay p { color: var(--gold-2); font-size: 1.15rem; max-width: 460px; margin: 0 auto; }
.bow-dots { display: flex; gap: 10px; justify-content: center; }
.bow-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gold); }
.bow-dots i.on { background: var(--gold); }

.report-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; }
.report-btn:hover { color: #f0a39a; border-color: #8b2a23; }

/* Tabs & Kinh khấn */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: var(--text); font: 600 1rem var(--font); padding: 10px 14px; cursor: pointer; }
.tabs button.on { border-bottom-color: var(--gold); color: var(--gold-2); }
.khan-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.khan-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 4px; }
.khan-list button { width: 100%; text-align: left; background: none; border: 1px solid transparent; color: var(--text); font: 1rem var(--font); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.khan-list button:hover { background: var(--panel-2); }
.khan-list button.on { background: var(--panel-2); border-color: var(--gold); color: var(--gold-2); }
.khan-paper { background: linear-gradient(#fbf1d9, #f1dfb5); color: #3a1d0c; border: 4px double #b3261e; }
.khan-paper h2 { color: #7c1712; }
.khan-paper .eyebrow { color: #8f1b14; }
.khan-text { font-size: 1.08rem; line-height: 1.9; }
.khan-text mark { background: #ffe9a8; color: #5a1a0c; padding: 0 3px; border-radius: 3px; }
.khan-text .blank { color: #a0522d; font-style: italic; }
.khan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.khan-actions .btn-ghost { color: #7c1712; border-color: #c9a86a; }
.chant-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.chant-bar select, #niemPick { font: 1rem var(--font); background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tempo { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.chant-text { font-size: 1.3rem; line-height: 2.1; max-height: 60vh; overflow-y: auto; padding: 10px 6px; }
.chant-text p { margin: 0 0 .9em; }
.chant-text span { cursor: pointer; border-radius: 4px; transition: color .2s; }
.chant-text span.done { color: var(--muted); }
.chant-text span.now { color: #2a1406; background: var(--gold); padding: 0 4px; }
.beads-card { text-align: center; }
.beads-wrap { position: relative; width: min(340px, 100%); margin: 0 auto; }
.beads { width: 100%; height: auto; display: block; }
.bead { fill: #6b4a2e; stroke: #3a2414; stroke-width: 1; transition: fill .3s; }
.bead.done { fill: var(--gold); }
.bead.mother { fill: #b3261e; }
.beads-center { position: absolute; inset: 0; display: grid; place-content: center; }
.beads-count { font-size: 2.4rem; font-weight: 700; color: var(--gold-2); }
.niem-text { font-size: 1.4rem; color: var(--gold-2); margin: 14px 0; }
.niem-text.pulse { animation: pulse .6s; }
@keyframes pulse { 40% { transform: scale(1.06); text-shadow: 0 0 18px rgba(242, 185, 75, .6); } }

/* Tưởng niệm */
.mem-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.mem-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.mem-card:hover { text-decoration: none; border-color: var(--gold); }
.mem-card h3 { margin: 0; color: var(--gold-2); font-size: 1.1rem; }
.mem-card p { margin: 2px 0; }
.mem-photo { flex: none; width: 76px; height: 96px; border-radius: 8px; overflow: hidden; background: #1a0e08; border: 3px solid #b98330; display: grid; place-items: center; font-size: 2rem; }
.mem-photo img { width: 100%; height: 100%; object-fit: cover; }
.soon { color: #ffcf6a; font-weight: 700; }
.gio-next { margin: 4px 0 0; }
.memorial-hall { --hall-a: #3a2016; --hall-b: #140906; }
.portrait { position: absolute; left: 50%; top: 34px; transform: translateX(-50%); width: 170px; height: 220px; padding: 10px; background: linear-gradient(135deg, #e7c07a, #8d5a17); border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.portrait img, .portrait-empty { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; display: block; background: #1a0e08; }
.portrait-empty { display: grid; place-content: center; text-align: center; color: var(--gold-2); gap: 8px; padding: 10px; }
.portrait-empty span { font-size: 3rem; }
.portrait-ribbon { position: absolute; right: -6px; top: -6px; width: 46px; height: 46px; background: linear-gradient(135deg, transparent 50%, #111 50%); opacity: .85; }
.owner-box, .share-box { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; font: .9rem var(--font); background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.bio-card { margin-top: 22px; }
.bio { white-space: normal; line-height: 1.8; }
.form-card { max-width: 760px; margin: 0 auto 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-list { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.radio-list legend { font-weight: 600; margin-bottom: 6px; }
.photo-current { display: flex; gap: 14px; align-items: center; }
.photo-current img { width: 80px; height: 100px; object-fit: cover; border-radius: 6px; border: 2px solid #b98330; }
.danger-zone { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); }
.btn.danger { color: #f0a39a; border-color: #8b2a23; }

/* Chia sẻ quẻ */
.share-panel { max-width: 760px; margin: 0 auto 20px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Quản trị */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.admin-nav a { padding: 6px 12px; border-radius: 8px; color: var(--text); }
.admin-nav a.on, .admin-nav a:hover { background: var(--panel-2); color: var(--gold-2); text-decoration: none; }
.admin-title { font-size: 1.6rem; }
.admin .card { margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.dim td { opacity: .55; }
.nowrap { white-space: nowrap; }
form.inline { display: inline; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-row input, .search-row select { flex: 1; min-width: 160px; font: 1rem var(--font); background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.search-row select { flex: 0 1 180px; }
.mod-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.mod-item p { margin: 0 0 6px; font-style: italic; overflow-wrap: anywhere; }
.mod-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat small { display: block; margin-top: 4px; }
.code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: .85rem; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 200px; padding: 20px 0 0; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; outline: none; }
.bar { width: 70%; max-width: 34px; background: var(--gold); border-radius: 4px 4px 0 0; min-height: 2px; transition: filter .15s; }
.bar-col:hover .bar, .bar-col:focus .bar { filter: brightness(1.2); }
.bar-label { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.bar-tip { position: absolute; bottom: calc(100% - 10px); background: var(--panel-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; font-size: .8rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 2; }
.bar-col:hover .bar-tip, .bar-col:focus .bar-tip { opacity: 1; }

@media (max-width: 900px) {
  .khan-layout, .form-row { grid-template-columns: 1fr; }
  .portrait { width: 140px; height: 180px; }
}
@media (max-width: 720px) {
  .nav-toggle { margin-left: 8px; }
  .nav { margin-left: 0; }
  .altar-offerings { bottom: 30px; font-size: 1rem; }
  .portrait { width: 116px; height: 150px; top: 24px; padding: 7px; }
}
@media print {
  .no-print, .share-panel, .tabs, .khan-list, .khan-fields, .khan-actions, .admin-nav { display: none !important; }
  .khan-layout { grid-template-columns: 1fr; }
}
