/* =========================================================
   Chùa Trực Tuyến — giao diện
   Bảng màu, font và hiệu ứng theo bản demo của khách.
   ========================================================= */

:root {
  --radius: 0.5rem;

  /* Màu thương hiệu */
  --gold: oklch(0.8 0.13 80);
  --gold-soft: oklch(0.9 0.08 85);
  --lacquer: oklch(0.36 0.12 25);
  --wood: oklch(0.24 0.04 45);
  --cream: oklch(0.96 0.025 85);

  /* Màu ngữ nghĩa */
  --background: oklch(0.15 0.025 40);
  --foreground: oklch(0.94 0.03 85);
  --card: oklch(0.2 0.035 40);
  --primary: oklch(0.8 0.13 80);
  --primary-foreground: oklch(0.18 0.03 40);
  --muted: oklch(0.25 0.03 40);
  --muted-foreground: oklch(0.75 0.04 80);
  --accent: oklch(0.3 0.06 35);
  --border: oklch(0.8 0.13 80 / 22%);

  --gradient-gold: linear-gradient(135deg, oklch(0.88 0.11 88), oklch(0.72 0.14 70));
  --shadow-glow: 0 0 40px -6px oklch(0.8 0.13 80 / 55%);

  --font-display: "Cormorant Garamond", serif;
  --font-sans: "Be Vietnam Pro", system-ui, sans-serif;

  --container: 80rem;
  --gutter: 1.25rem;
  --header-h: 3.5rem;

  color-scheme: dark;
}

/* ---------- Reset & nền ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; }
p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
section[id] { scroll-margin-top: var(--header-h); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tiện ích dùng chung ---------- */
.text-gold-gradient {
  background: var(--gradient-gold);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.glass-panel {
  background: color-mix(in oklab, var(--card) 70%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: .75rem;
  border: 0; border-radius: 999px;
  padding: .75rem 2rem;
  font-weight: 600;
  background: var(--gradient-gold);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow);
  transition: transform .2s ease;
}
.btn-gold:hover { transform: translateY(-2px); }
.btn-gold:active { transform: translateY(0) scale(.98); }
.btn-gold:focus-visible, .nav a:focus-visible, .rite:focus-visible, .menu-toggle:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}

.eyebrow { font-size: .875rem; letter-spacing: .4em; color: var(--gold-soft); }
.label { font-size: .75rem; letter-spacing: .3em; color: var(--gold-soft); }
.section-title { font-size: 2.25rem; font-weight: 600; }
.lead { color: var(--muted-foreground); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  border-width: 0 0 1px 0;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.brand { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; white-space: nowrap; }
.nav { display: none; gap: 1.5rem; font-size: .875rem; color: var(--muted-foreground); }
.nav a { transition: color .15s; }
.nav a:hover, .nav a.is-active { color: var(--primary); }

.menu-toggle {
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; margin-right: -.5rem;
  background: none; border: 0; border-radius: .5rem; color: var(--gold-soft);
}
.menu-toggle svg { width: 1.5rem; height: 1.5rem; }
.mobile-nav {
  display: grid; gap: .25rem;
  padding: .5rem var(--gutter) 1rem;
  border-top: 1px solid var(--border);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a { padding: .75rem 0; color: var(--muted-foreground); border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: 0; }
.mobile-nav a:hover { color: var(--primary); }

@media (min-width: 768px) {
  .nav { display: flex; }
  .menu-toggle, .mobile-nav { display: none !important; }
}

/* ---------- Đại Hùng Bảo Điện (hero) ---------- */
/* Ảnh bắt đầu ngay dưới thanh menu, không bị menu che */
.hero { position: relative; overflow: hidden; padding-top: calc(var(--header-h) + 1px); }
.hero-stage { position: relative; height: calc(100vh - var(--header-h) - 1px); height: calc(100svh - var(--header-h) - 1px); overflow: hidden;
  /* Màn hình rộng mà thấp: giữ khung đủ cao để thấy cả tượng Phật lẫn bát nhang */
  min-height: 42.5vw; }
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 35%;
  filter: brightness(1.25) saturate(1.1);
  animation: hero-zoom 8s ease-out both;
}
.hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--background), transparent 50%, color-mix(in oklab, var(--background) 20%, transparent));
}
.hero-glow {
  position: absolute; inset: 0; opacity: .3; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 35%, var(--gold) 0%, transparent 45%);
  animation: flicker 2.4s ease-in-out infinite;
}
.smoke-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.offerings {
  position: absolute; bottom: 30%; left: 50%; transform: translateX(-50%);
  display: flex; gap: .25rem; font-size: 1.5rem; pointer-events: none;
}
.offerings span { animation: offering-drop .5s cubic-bezier(.2,.8,.2,1) both; }

.hero-content {
  position: relative; z-index: 10;
  margin-top: -2.5rem;
  text-align: center;
}
.hero-content .eyebrow { animation: fade-in 1s .5s both; }
.hero-title {
  margin-top: .75rem;
  font-size: 3rem; font-weight: 700;
  animation: rise-in 1.2s .8s both;
}
.hero-sub { max-width: 36rem; margin: 1rem auto 0; color: color-mix(in oklab, var(--cream) 90%, transparent); }
.hero-content .btn-gold { margin-top: 2rem; }

/* Playlist YouTube */
.playlist {
  width: 100%; max-width: 16rem;
  margin: 2.5rem auto 0;
  padding: .75rem;
  border-radius: 1rem;
  text-align: left;
}
.playlist .label { margin-bottom: .75rem; }
.video-frame { aspect-ratio: 16 / 9; width: 100%; overflow: hidden; border-radius: .75rem; background: var(--muted); }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-empty {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  border: 1px dashed var(--border); border-radius: .75rem;
  font-size: .875rem; color: var(--muted-foreground); text-align: center; padding: 1rem;
}

/* ---------- Sơ đồ ghế ---------- */
.seat-section { padding: 1.5rem var(--gutter) 0; }
.seat-hall {
  width: 100%; max-width: 64rem;
  margin: 2.5rem auto 0;
  padding: .75rem;
  border-radius: 1rem;
}
.seat-hall-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.seat-count { font-size: .75rem; color: var(--muted-foreground); white-space: nowrap; }
.seat-rows { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: .125rem .125rem; }

/* Mỗi ghế là một chiếc đệm thiền tròn (bồ đoàn) */
.seat {
  position: relative;
  display: flex; flex-direction: column; align-items: center; min-width: 0;
  padding: .125rem 0;
  background: none; border: 0; border-radius: .5rem;
  color: inherit;
  transition: transform .2s ease;
}
.seat:hover { transform: translateY(-2px); }
.seat:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Ghế: bồ đoàn thêu sen nhìn nghiêng (lớp .bare = không có vòng tròn bao ngoài) */
.seat-pad {
  position: relative; width: 100%; max-width: 3.25rem; aspect-ratio: 1; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid oklch(0.8 0.13 80 / 26%);
  background: radial-gradient(circle at 50% 40%, oklch(0.26 0.03 45 / .55), oklch(0.17 0.025 40 / .35) 70%);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.zafu {
  position: absolute; left: 7%; width: 86%; bottom: 12%;
  aspect-ratio: 100 / 64; height: auto;
  opacity: .55;
  transition: opacity .25s ease;
}
.seat:hover .zafu { opacity: .85; }
.seat:hover .seat-pad { border-color: oklch(0.8 0.13 80 / 50%); }
.seat-no {
  position: absolute; left: 0; right: 0; top: 69%;
  text-align: center; line-height: 1;
  font-size: 8px; font-weight: 600; color: #e7c77a; opacity: .9;
}
/* Người ngồi trên đệm */
.seat-person { position: absolute; left: 28%; width: 44%; bottom: 38%; aspect-ratio: 1; display: block; }
.seat-avatar, .seat-icon {
  display: block; width: 100%; height: 100%; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 1.5px oklch(0.8 0.13 80 / 70%), 0 2px 6px rgba(0,0,0,.5);
}
.seat.is-taken .zafu { opacity: 1; }
.seat.is-taken .seat-pad { border-color: oklch(0.8 0.13 80 / 55%); }
.seat.is-mine .seat-pad { border-color: var(--gold); box-shadow: 0 0 12px 1px oklch(0.8 0.13 80 / 45%); }
/* Điện thoại: 5 cột để đệm đủ lớn, nhìn rõ hoa sen */
@media (max-width: 559px) {
  .seat-hall .seat-rows { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem .25rem; }
  .seat-hall .seat-pad.bare { max-width: none; }
  .seat-hall .seat-no { font-size: 10px; }
  .seat-hall .seat-name { font-size: 10px; }
}
.seat-avatar { object-fit: cover; background: var(--muted); }
.seat-icon { display: grid; place-items: center; background: var(--muted); color: var(--gold-soft); }
.seat-icon svg { width: 72%; height: 72%; }
.seat-icon.nu { color: oklch(0.85 0.08 10); }
.seat.is-mine .seat-avatar, .seat.is-mine .seat-icon {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px 2px oklch(0.8 0.13 80 / 60%);
}
.seat.is-new .seat-person { animation: seat-in .6s cubic-bezier(.2,.8,.2,1) both; }
.seat-name {
  margin-top: .125rem; width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: center; font-size: 8px; line-height: 1.3; color: var(--muted-foreground);
}
.seat.is-taken .seat-name { color: var(--cream); }
/* Màn hình hẹp: tên 2 chữ xuống 2 dòng thay vì bị cắt */
@media (max-width: 639px) {
  .seat.is-taken .seat-name {
    white-space: normal; overflow-wrap: anywhere; line-height: 1.15;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
}

@media (min-width: 640px) {
  .seat-hall { padding: 1.25rem; }
  .seat-rows { gap: .25rem .25rem; }
  .seat-no { font-size: 9.5px; }
  .seat-name { font-size: 10.5px; }
  .playlist { padding: 1rem; }
}

/* ---------- Bồ đoàn không viền (dùng cho cả giảng đường và thiền đường) ---------- */
.seat-pad.bare { border: 0; background: none; box-shadow: none; max-width: 5.25rem; aspect-ratio: 100 / 76; }
.seat-pad.bare .zafu { left: 0; width: 100%; bottom: 4%; opacity: .82; filter: drop-shadow(0 2px 3px rgba(20, 6, 0, .45)); }
.seat-pad.bare .seat-person { bottom: 47%; z-index: 1; } /* avatar có thể nhô lên trên mép ô */
.seat-pad.bare .seat-no { top: 75%; }
.seat:hover .seat-pad.bare .zafu, .seat.is-taken .seat-pad.bare .zafu { opacity: 1; }
.seat.is-mine .seat-pad.bare { box-shadow: none; }
.seat.is-mine .seat-pad.bare .zafu { filter: drop-shadow(0 0 5px oklch(0.8 0.13 80 / 85%)); }

/* ---------- Nghi thức lễ Phật ---------- */
.rites { padding-block: 5rem; }
.rites .section-title, .rites .lead { text-align: center; }
.rites .lead { margin-top: .75rem; }
.rite-grid { margin-top: 3rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.rite {
  padding: 1.5rem;
  border-radius: .75rem;
  text-align: left;
  transition: transform .2s ease, box-shadow .2s ease;
}
.rite:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.rite:active { transform: scale(.96); }
.rite-icon { font-size: 2.25rem; line-height: 1; }
.rite h3 { margin-top: .75rem; font-size: 1.5rem; font-weight: 600; color: var(--gold-soft); }
.rite p { margin-top: .25rem; font-size: .875rem; color: var(--muted-foreground); }

/* ---------- Thiền đường ---------- */
.meditation { position: relative; overflow: hidden; }
.meditation-stage { position: relative; overflow: hidden; }
.meditation-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: brightness(1.1);
}
.meditation-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--background), color-mix(in oklab, var(--background) 30%, transparent) 50%, transparent);
}
.meditation-inner {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 80vh; padding-bottom: 2.5rem;
  text-align: center;
}
.meditation-inner .eyebrow { letter-spacing: .3em; font-weight: 500; color: var(--cream); }
.meditation-title {
  margin-top: .75rem;
  font-size: 1.5rem; font-weight: 600; white-space: nowrap;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.6));
}
.music-btn { margin-top: 2rem; padding: .75rem 1.5rem; }
.music-btn .icon { font-size: 1.25rem; line-height: 1; }
.meditation .seat-wrap { padding-bottom: 3rem; }

/* ---------- Công quả ---------- */
.merit { max-width: 48rem; margin-inline: auto; padding: 5rem var(--gutter); text-align: center; }
.merit .lead-cream { margin-top: 1rem; color: color-mix(in oklab, var(--cream) 85%, transparent); }
.merit-box { margin-top: 1.5rem; padding: 1rem; border-radius: var(--radius); font-size: .875rem; color: var(--muted-foreground); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  text-align: center; font-size: .875rem; color: var(--muted-foreground);
}
.site-footer .footer-line2 { margin-top: .375rem; }

/* ---------- Hộp thoại nghi lễ ---------- */
.rite-overlay {
  /* Nằm trong khung ảnh Phật: ảnh vẫn hiện rõ, chỉ tối dần ở dưới để đọc chữ */
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: flex-end; justify-content: center;
  padding: var(--gutter) var(--gutter) clamp(4.5rem, 12vh, 7rem);
  background:
    radial-gradient(ellipse 55% 45% at 50% 32%, oklch(0.85 0.14 80 / 28%), transparent 70%),
    linear-gradient(to top, color-mix(in oklab, var(--background) 88%, transparent) 0%, transparent 55%);
  opacity: 0; visibility: hidden; cursor: pointer;
  transition: opacity .5s ease, visibility 0s .5s;
}
.rite-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .5s ease; }
/* Vầng hào quang lan toả sau tượng Phật */
.rite-halo {
  position: absolute; left: 50%; top: 30%;
  width: min(70vw, 34rem); aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, oklch(0.95 0.1 85 / 70%) 0%, oklch(0.85 0.14 80 / 35%) 30%, transparent 65%);
  opacity: 0;
}
.rite-overlay.is-open .rite-halo { animation: halo-burst 2.6s cubic-bezier(.2,.7,.3,1) both; }
.rite-overlay-body { position: relative; text-align: center; max-width: 40rem; opacity: 0; }
.rite-overlay.is-open .rite-overlay-body { animation: rite-rise .9s .35s cubic-bezier(.2,.8,.2,1) both; }
.rite-overlay-icon {
  font-size: clamp(3.5rem, 9vw, 5.5rem); line-height: 1;
  filter: drop-shadow(0 0 30px var(--gold));
  animation: pulse 2s ease-in-out infinite;
}
.rite-overlay h3 { margin-top: 1rem; font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 600; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.rite-overlay p { margin-top: .375rem; color: var(--cream); text-shadow: 0 1px 8px rgba(0,0,0,.8); }

/* ---------- Trình phát ---------- */
.playlist { max-width: 19rem; }
.video-frame #yt-player, .video-frame iframe { width: 100%; height: 100%; display: block; border: 0; }

/* Băng chuyền 3 ô phát nhạc: ô giữa to và đang phát, hai ô bên nhỏ, mờ */
.carousel {
  position: relative;
  width: 100%; max-width: 60rem;
  margin: 2.5rem auto 0;
  overflow-x: clip;
  padding: .5rem 0 0;
}
.car-track { display: grid; justify-items: center; align-items: start; padding: 0 3rem; }
.pcard {
  grid-area: 1 / 1;
  width: min(20rem, 76vw); max-width: none; margin: 0;
  position: relative;
  transition: transform .55s cubic-bezier(.2,.8,.2,1), opacity .45s ease, filter .45s ease, box-shadow .45s ease;
  will-change: transform;
}
.pcard.pos-center { z-index: 3; transform: none; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8), var(--shadow-glow); border-color: oklch(0.8 0.13 80 / 45%); }
.pcard.pos-right  { z-index: 2; transform: translateX(86%) scale(.8); opacity: .5; filter: saturate(.55) brightness(.8); }
.pcard.pos-left   { z-index: 2; transform: translateX(-86%) scale(.8); opacity: .5; filter: saturate(.55) brightness(.8); }
.pcard:not(.pos-center):hover { opacity: .75; }
.pcard .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.is-playing .label::after { content: " ♪"; color: var(--gold); }
/* Ô bên cạnh: phủ một lớp trong suốt để bấm là đưa vào giữa */
.pcard-cover { display: none; position: absolute; inset: 0; z-index: 4; background: none; border: 0; border-radius: inherit; cursor: pointer; }
.pcard:not(.pos-center) .pcard-cover { display: block; }
.car-nav {
  position: absolute; top: 42%; z-index: 6;
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: color-mix(in oklab, var(--card) 80%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid oklch(0.8 0.13 80 / 45%);
  color: var(--gold-soft);
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  transition: background .2s, transform .2s;
}
.car-nav:hover { background: var(--accent); transform: scale(1.06); }
.car-nav:active { transform: scale(.95); }
.car-nav:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.car-nav svg { width: 1.35rem; height: 1.35rem; }
.car-prev { left: .25rem; }
.car-next { right: .25rem; }
.car-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: .375rem; margin-top: 1rem; }
.car-dots button {
  padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--card) 50%, transparent);
  color: var(--muted-foreground); font-size: .75rem;
  transition: all .2s;
}
.car-dots button[aria-current="true"] { background: var(--gradient-gold); color: var(--primary-foreground); border-color: transparent; font-weight: 600; }
@media (max-width: 639px) {
  .car-track { padding: 0; }
  .pcard.pos-right { transform: translateX(78%) scale(.78); }
  .pcard.pos-left  { transform: translateX(-78%) scale(.78); }
  .car-nav { width: 2.4rem; height: 2.4rem; top: 38%; }
  .car-dots span { font-size: .6875rem; }
}
@media (prefers-reduced-motion: reduce) { .pcard { transition: none; } }

/* Nhạc thiền nguồn YouTube: khung video giữa thiền đường */
.med-player { max-width: 26rem; margin: 1.5rem auto 0; text-align: left; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8), var(--shadow-glow); }
.med-player .now-playing { margin-top: .5rem; }
.player-bar { margin-top: .625rem; }
.now-playing {
  font-size: .75rem; color: var(--cream); opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-controls { display: flex; align-items: center; gap: .375rem; margin-top: .5rem; }
.pc-btn {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 999px;
  background: color-mix(in oklab, var(--muted) 70%, transparent);
  border: 1px solid var(--border); color: var(--gold-soft);
  transition: background .15s, transform .15s;
}
.pc-btn:hover { background: var(--accent); }
.pc-btn:active { transform: scale(.94); }
.pc-btn svg { width: 1rem; height: 1rem; }
.pc-main { width: 2.5rem; height: 2.5rem; background: var(--gradient-gold); color: var(--primary-foreground); border: 0; box-shadow: var(--shadow-glow); }
.pc-main:hover { background: var(--gradient-gold); }
.pc-main .i-pause { display: none; }
.pc-main.is-playing .i-play { display: none; }
.pc-main.is-playing .i-pause { display: block; }
.pc-mode { margin-left: auto; font-size: .6875rem; letter-spacing: .05em; color: var(--muted-foreground); }

/* ---------- Nút phụ ---------- */
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.5rem; border-radius: 999px;
  background: color-mix(in oklab, var(--card) 55%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid oklch(0.8 0.13 80 / 45%);
  color: var(--gold-soft); font-weight: 500;
  transition: background .2s, transform .2s;
}
.btn-ghost:hover { background: color-mix(in oklab, var(--accent) 80%, transparent); transform: translateY(-1px); }
.btn-ghost.small { padding: .45rem 1rem; font-size: .875rem; cursor: pointer; }
.link-btn { background: none; border: 0; padding: .25rem; color: var(--muted-foreground); font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--gold-soft); }
.meditation-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .75rem; margin-top: 2rem; }
.meditation-actions .music-btn { margin-top: 0; }

/* ---------- Hộp thoại ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter) max(1rem, env(safe-area-inset-bottom));
  background: color-mix(in oklab, var(--background) 55%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1);
  overflow-y: auto;
  animation: fade-in .35s ease both;
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 26rem; margin: auto;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 1.25rem;
  background: color-mix(in oklab, var(--card) 78%, transparent);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7), var(--shadow-glow);
  text-align: center;
  animation: rise-in .45s cubic-bezier(.2,.8,.2,1) both;
}
.modal-card.small { max-width: 22rem; }
.modal-title { margin-top: .5rem; font-size: 2rem; font-weight: 600; }
.modal-sub { margin-top: .5rem; font-size: .875rem; color: var(--muted-foreground); }
.modal-actions { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-top: 1.25rem; }
.modal-actions .btn-gold { width: 100%; }
.modal-actions.column .btn-ghost { width: 100%; }

.field { display: grid; gap: .375rem; margin-top: 1rem; text-align: left; border: 0; padding: 0; }
.field > span, .field legend { font-size: .8125rem; color: var(--gold-soft); }
.field em { font-style: normal; color: var(--muted-foreground); }
.field input[type="text"], .field input[type="email"], .field textarea {
  width: 100%; padding: .7rem .875rem;
  border-radius: .625rem;
  border: 1px solid oklch(0.8 0.13 80 / 30%);
  background: color-mix(in oklab, var(--background) 70%, transparent);
  color: var(--foreground);
  font: inherit; font-size: 1rem; /* 16px: tránh iOS tự phóng to */
  resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px oklch(0.8 0.13 80 / 20%); }
.field input::placeholder { color: oklch(0.75 0.04 80 / 55%); }

.gender { display: flex; flex-wrap: wrap; gap: .5rem; }
.gender legend { width: 100%; margin-bottom: .375rem; }
.gender label { flex: 1; cursor: pointer; }
.gender input { position: absolute; opacity: 0; pointer-events: none; }
.gender span {
  display: block; text-align: center; padding: .6rem;
  border-radius: .625rem; border: 1px solid oklch(0.8 0.13 80 / 30%);
  color: var(--muted-foreground);
  transition: all .15s;
}
.gender input:checked + span { border-color: var(--gold); color: var(--primary-foreground); background: var(--gradient-gold); font-weight: 600; }
.gender input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.avatar-pick { display: flex; align-items: center; gap: 1rem; }
.avatar-preview {
  width: 4rem; height: 4rem; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--muted); color: var(--gold-soft);
  box-shadow: 0 0 0 1.5px oklch(0.8 0.13 80 / 60%);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview svg { width: 70%; height: 70%; }
.avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.hint { width: 100%; font-size: .75rem; color: var(--muted-foreground); }
.form-error { min-height: 1.25rem; margin-top: .75rem; font-size: .8125rem; color: oklch(0.75 0.15 30); }

.join-returning { display: flex; flex-direction: column; align-items: center; gap: .25rem; margin-top: 1.25rem; }
.join-me { display: flex; flex-direction: column; align-items: center; gap: .5rem; font-weight: 600; color: var(--cream); }
.join-me .avatar-preview { width: 4.5rem; height: 4.5rem; }

.rite-overlay-vow {
  max-width: 32rem; margin: 1rem auto 0; padding: 1rem 1.25rem;
  border-left: 2px solid var(--gold);
  font-family: var(--font-display); font-size: 1.25rem; font-style: italic;
  color: var(--cream); white-space: pre-line; text-align: left;
  max-height: 30vh; overflow: auto;
  background: color-mix(in oklab, var(--background) 55%, transparent); border-radius: 0 .5rem .5rem 0;
}

/* ---------- Công quả: QR ---------- */
.merit-qr { margin-top: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1.75rem; }
.qr-frame {
  position: relative; display: block;
  padding: .875rem; border: 0; border-radius: 1rem; background: #fff;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-glow);
  cursor: zoom-in; transition: transform .2s ease;
}
.qr-frame:hover { transform: scale(1.02); }
.qr-frame:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.qr-zoom-hint {
  position: absolute; left: 50%; bottom: -.875rem; translate: -50% 0;
  display: inline-flex; align-items: center; gap: .375rem; white-space: nowrap;
  padding: .3rem .75rem; border-radius: 999px; font-size: .75rem;
  background: var(--background); color: var(--gold-soft); border: 1px solid var(--border);
}
/* Ảnh QR phóng to */
.qr-lightbox {
  max-width: none; max-height: none; width: 100%; height: 100%;
  margin: 0; padding: var(--gutter); border: 0; background: transparent;
  display: none; place-items: center; cursor: zoom-out;
}
.qr-lightbox[open] { display: grid; animation: fade-in .2s ease both; }
.qr-lightbox::backdrop { background: rgba(10, 6, 3, .88); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.qr-lightbox img {
  max-width: min(100%, 40rem); max-height: calc(100svh - 2 * var(--gutter) - 2rem);
  width: auto; height: auto; object-fit: contain;
  border-radius: 1rem; background: #fff; padding: .75rem;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.9);
  animation: qr-pop .25s cubic-bezier(.2,.8,.2,1) both;
}
.qr-close {
  position: fixed; top: max(1rem, env(safe-area-inset-top)); right: 1rem;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 80%, transparent);
  color: var(--cream); font-size: 1.125rem; cursor: pointer;
}
@keyframes qr-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.qr-frame img { width: min(15rem, 70vw); height: auto; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; }
.qr-note { max-width: 32rem; font-size: .9375rem; color: var(--cream); white-space: pre-line; }

/* ---------- Kênh cuối trang ---------- */
.channels { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-bottom: 1.25rem; padding-inline: var(--gutter); }
.channel {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem .5rem .625rem; border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 70%, transparent);
  color: var(--cream); font-size: .875rem;
  transition: border-color .15s, transform .15s;
}
.channel:hover { border-color: var(--gold); transform: translateY(-2px); }
.channel svg { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }

/* ---------- Thông báo nhỏ ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 1rem);
  max-width: calc(100vw - 2rem);
  padding: .7rem 1.25rem; border-radius: 999px;
  background: color-mix(in oklab, var(--card) 90%, transparent);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--cream); font-size: .875rem; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Breakpoints ---------- */
@media (min-width: 640px) {
  .meditation-title { font-size: 2.25rem; }
}
@media (min-width: 768px) {
  .hero-title { font-size: 4.5rem; }
  .section-title { font-size: 3rem; }
  .rite-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .meditation-title { font-size: 3rem; }
}
@media (max-width: 380px) {
  .meditation-title { white-space: normal; }
}

/* ---------- Keyframes ---------- */
@keyframes hero-zoom { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes offering-drop { from { opacity: 0; transform: translateY(-80px); } to { opacity: 1; transform: none; } }
@keyframes smoke-rise {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  20% { opacity: .8; }
  100% { transform: translateY(-260px) translateX(30px) scale(1.8); opacity: 0; }
}
@keyframes flicker { 0%, 100% { opacity: .85; } 45% { opacity: 1; } 60% { opacity: .7; } }
@keyframes halo-burst { 0% { opacity: 0; scale: .3; } 35% { opacity: 1; } 100% { opacity: .55; scale: 1.25; } }
@keyframes rite-rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes seat-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .smoke-canvas, .hero-glow { display: none; }
}
