:root {
  color-scheme: dark;
  --bg: #0b1011;
  --panel: rgba(24, 31, 31, .82);
  --panel-solid: #171f20;
  --line: rgba(227, 215, 190, .14);
  --line-strong: rgba(227, 215, 190, .27);
  --text: #f2eee5;
  --muted: #a9b0aa;
  --glow: #e4c58b;
  --serif: "Noto Serif KR", "AppleMyungjo", "Nanum Myeongjo", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body {
  background:
    radial-gradient(ellipse at 50% 12%, rgba(75, 100, 86, .22), transparent 38rem),
    radial-gradient(ellipse at 4% 88%, rgba(139, 105, 66, .1), transparent 30rem),
    linear-gradient(160deg, #101718 0%, #0b1011 58%, #111313 100%);
}
[hidden] { display: none !important; }

.home {
  position: relative;
  isolation: isolate;
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(34px, env(safe-area-inset-top)) 28px max(30px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
}
.home::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(76vw, 540px);
  aspect-ratio: 1;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(177, 148, 99, .055), transparent 68%);
  pointer-events: none;
}
.home-head { max-width: 610px; margin: 0 auto; text-align: center; }
.home-head h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 13px;
  font: 500 clamp(34px, 7vw, 48px)/1.18 var(--serif);
  letter-spacing: .025em;
}
.home-head h1::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
  background: #f0d49e;
  box-shadow: 0 0 12px 3px rgba(240, 212, 158, .34), 0 0 34px 8px rgba(240, 212, 158, .14);
}
.home-head p { max-width: 520px; margin: 0 auto; color: #bdc1b9; font-size: 15px; line-height: 1.8; }

.languages { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
#languages { position: absolute; top: max(22px, env(safe-area-inset-top)); inset-inline-end: 24px; }
.lang {
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: .015em;
  background: rgba(12, 17, 18, .34);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.lang:hover { color: var(--text); background: rgba(255,255,255,.04); }
.lang[aria-pressed="true"] { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.045); }
:lang(zh) { --serif: "Songti SC", "Noto Serif SC", serif; --sans: -apple-system, "PingFang SC", "Noto Sans SC", sans-serif; }
:lang(ar) { --serif: "Geeza Pro", "Noto Naskh Arabic", serif; --sans: -apple-system, "Geeza Pro", "Noto Sans Arabic", sans-serif; }

.room-list { list-style: none; width: min(100%, 620px); margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; direction: ltr; }
.room-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 104px;
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  color: inherit;
  font: inherit;
  background: linear-gradient(145deg, rgba(31, 39, 38, .94), rgba(20, 27, 28, .88));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .12), inset 0 1px rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
html[dir="rtl"] .room-card { direction: rtl; }
.room-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .62;
  background: radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--dot) 12%, transparent), transparent 62%);
  pointer-events: none;
}
.room-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--dot) 52%, var(--line)); box-shadow: 0 18px 38px rgba(0, 0, 0, .2), inset 0 1px rgba(255,255,255,.045); }
.room-card:active { transform: translateY(0); }
.room-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 16px 3px color-mix(in srgb, var(--dot) 50%, transparent); }
.room-text { flex: 1; min-width: 0; }
.room-name { display: block; font: 500 19px/1.35 var(--serif); letter-spacing: .01em; }
.room-place { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; letter-spacing: .015em; }
.room-count { flex: none; color: #c2c5bc; font-size: 12px; font-variant-numeric: tabular-nums; padding: 6px 9px; border: 1px solid rgba(255,255,255,.075); border-radius: 999px; background: rgba(0,0,0,.12); }

.home-foot { width: min(100%, 620px); margin: 0 auto; padding: 16px 4px 0; color: #929b95; font-size: 11px; line-height: 1.75; border-top: 1px solid rgba(230, 221, 201, .1); }
.home-foot p { margin: 0 0 5px; }
.home-foot a { color: var(--glow); text-underline-offset: 3px; }

.room { position: fixed; inset: 0; overflow: hidden; background: #101514; }
.world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pinch-zoom; cursor: pointer; }
.status {
  position: absolute; top: 34%; left: 50%; width: min(420px, calc(100% - 32px)); margin: 0; padding: 20px 22px;
  transform: translateX(-50%); text-align: center; line-height: 1.7;
  background: rgba(14, 19, 19, .88); border: 1px solid var(--line-strong); border-radius: 18px; backdrop-filter: blur(18px);
}
.count {
  position: absolute; top: max(18px, env(safe-area-inset-top)); left: 50%; margin: 0; padding: 9px 14px; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; color: #f1eee4;
  background: rgba(16, 21, 20, .64); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; backdrop-filter: blur(16px);
}
.audio-controls {
  position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 14px; display: flex; align-items: center; gap: 4px;
  padding: 3px 7px; background: rgba(16, 21, 20, .62); border: 1px solid rgba(255,255,255,.09); border-radius: 999px; backdrop-filter: blur(16px);
}
.volume { width: 76px; height: 40px; accent-color: var(--glow); }
.toast {
  position: absolute; top: calc(max(18px, env(safe-area-inset-top)) + 54px); left: 50%; max-width: calc(100% - 32px); margin: 0; padding: 10px 16px;
  transform: translateX(-50%); font-size: 13px; text-align: center; background: rgba(15, 20, 19, .8);
  border: 1px solid rgba(240, 235, 225, .18); border-radius: 999px; backdrop-filter: blur(14px);
}
.beads {
  position: absolute; bottom: 138px; right: 16px; width: 222px; height: 218px; margin: 0;
  color: var(--text); text-align: center; font-size: 11px; font-variant-numeric: tabular-nums;
  background: rgba(15, 20, 19, .72); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px rgba(0,0,0,.18); pointer-events: none;
}
.beads-label { position: absolute; top: 9px; left: 0; right: 0; opacity: .82; }
.beads-count { position: absolute; bottom: 8px; left: 0; right: 0; font-size: 12px; }
.beads-close { position: absolute; top: 7px; right: 7px; z-index: 1; min-width: 46px; height: 28px; padding: 0 7px; color: rgba(242,238,229,.92); font: 11px/1 var(--sans); white-space: nowrap; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; cursor: pointer; pointer-events: auto; }
.beads-close:hover { color: var(--text); background: rgba(255,255,255,.14); }
.bead-string { --turn: 0deg; position: absolute; left: 50%; top: 49%; width: 170px; height: 170px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 50%; cursor: pointer; pointer-events: auto; transform: translate(-50%,-50%) rotate(var(--turn)); transition: transform .34s cubic-bezier(.2,.75,.25,1); }
.bead-string::before { content: ""; position: absolute; inset: 15px; border: 2px solid rgba(221,194,151,.64); border-radius: 50%; box-shadow: inset 0 0 8px rgba(0,0,0,.22); }
.bead { --angle: 0deg; --radius: 70px; --pop: 1; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%;
  background: radial-gradient(circle at 28% 23%, #f5dfb9 0 10%, #c3945d 42%, #895d35 78%, #543a25 100%); border: 1px solid rgba(255,232,191,.72);
  transform: rotate(var(--angle)) translateY(calc(var(--radius) * -1)) scale(var(--pop)); box-shadow: inset -1px -1px 2px rgba(45,26,12,.5), 0 2px 4px rgba(0,0,0,.55); transition: background .16s, transform .16s;
}
.bead.is-current { background: radial-gradient(circle at 30% 25%, #fff7d3, #edc77e 70%, #af7834); --pop: 1.45; box-shadow: 0 0 10px rgba(248,211,139,.8); }
.bead.is-marker { width: 11px; height: 11px; margin: -5.5px; background: radial-gradient(circle at 30% 25%, #f7eee2, #85715d 72%, #4d4033); }
.beads[data-kind="buddhist"] .bead { width: 7px; height: 7px; margin: -3.5px; }
.beads[data-kind="buddhist"] .bead.is-marker { width: 13px; height: 13px; margin: -6.5px; background: radial-gradient(circle at 28% 23%, #f7e8cf, #ac7950 60%, #51331f); }
.beads[data-kind="buddhist"] .bead.is-current { --pop: 1.65; }
.mala-tassel { position: absolute; left: 50%; top: calc(50% + 76px); width: 10px; height: 25px; transform: translateX(-50%); pointer-events: none; }
.mala-tassel::before { content: ""; position: absolute; left: 3px; top: -9px; width: 4px; height: 11px; border-radius: 4px; background: linear-gradient(90deg,#70451f,#e0b574 50%,#71441f); }
.mala-tassel::after { content: ""; position: absolute; left: 1px; top: 0; width: 8px; height: 23px; background: repeating-linear-gradient(90deg,#a46e38 0 1px,#d4aa71 1px 2px,#835326 2px 3px); clip-path: polygon(18% 0,82% 0,100% 100%,0 100%); }
.beads[data-kind="islam"] .bead { background: radial-gradient(circle at 30% 25%, #e5f1df, #73947b 72%, #405a49); }
.beads[data-kind="islam"] .bead.is-current { background: radial-gradient(circle at 30% 25%, #f6f5da, #bdcc87 72%, #768b48); box-shadow: 0 0 10px rgba(204,221,149,.75); }
.beads[data-kind="islam"] .bead.is-marker { background: radial-gradient(circle at 30% 25%, #e9eee5, #819285 72%, #455449); }
.moktak-panel {
  position: absolute; right: 16px; bottom: 138px; width: min(248px, calc(100vw - 32px)); min-height: 220px;
  padding: 20px 16px 15px; display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center; gap: 2px;
  color: var(--text); text-align: center; background: rgba(15, 20, 19, .84);
  border: 1px solid rgba(255,255,255,.14); border-radius: 24px; backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0,0,0,.32); z-index: 4;
}
.moktak-title { margin: 0; padding-inline: 36px; font: 500 15px/1.4 var(--serif); }
.moktak-strike { width: 100%; min-height: 132px; display: grid; place-items: center; padding: 0; overflow: hidden; cursor: pointer; touch-action: manipulation;
  background: radial-gradient(ellipse, rgba(224,176,112,.16), transparent 70%); border: 0; border-radius: 18px; }
.moktak-strike:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.moktak-woodfish { width: min(220px, 100%); height: 130px; overflow: visible; }
.woodfish-body { transform-origin: 120px 78px; }
.moktak-mallet { transform-origin: 110px 54px; transition: transform .1s ease-out; }
.moktak-strike.is-struck .moktak-mallet { animation: moktak-hit .24s ease-in-out; }
.moktak-strike.is-struck .woodfish-body { animation: moktak-ring .25s ease-out; }
@keyframes moktak-hit { 0%,100% { transform: rotate(0); } 35% { transform: rotate(30deg) translate(13px, 10px); } 58% { transform: rotate(-5deg) translate(-2px, -1px); } }
@keyframes moktak-ring { 0%,100% { transform: scale(1); } 42% { transform: scale(.98, 1.025); } }
.moktak-hint, .moktak-count { margin: 3px 0 0; color: rgba(242,238,229,.78); font-size: 11px; line-height: 1.4; }
.moktak-count { color: var(--glow); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .moktak-panel { right: 10px; bottom: 128px; } }
@media (max-width: 380px) { .beads { right: 8px; bottom: 120px; width: 202px; height: 202px; } .bead-string { width: 158px; height: 158px; } .bead { --radius: 64px; } .mala-tassel { top: calc(50% + 68px); } .mala-tassel::after { height: 13px; } }
@media (prefers-reduced-motion: reduce) { .moktak-strike.is-struck .moktak-mallet, .moktak-strike.is-struck .woodfish-body { animation-duration: .01ms; } }
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 44px 16px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 11px; pointer-events: none;
  background: linear-gradient(to top, rgba(6, 10, 10, .78), rgba(6, 10, 10, .26) 52%, transparent);
}
.hint { margin: 0; color: rgba(248, 246, 236, .86); font-size: 11px; text-align: center; text-shadow: 0 1px 8px #000; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; pointer-events: auto; }
.actions:empty { display: none; }
.actions .btn { background: rgba(19, 25, 24, .84); }
.btn {
  min-height: 44px; padding: 0 16px; color: var(--text); font: inherit; font-size: 13px;
  background: rgba(24, 30, 29, .78); border: 1px solid rgba(240,235,225,.18); border-radius: 999px;
  cursor: pointer; backdrop-filter: blur(14px); transition: background .2s, border-color .2s, transform .2s;
}
.btn:hover { border-color: rgba(228,197,139,.65); background: rgba(43, 45, 37, .88); }
.btn:active { transform: scale(.98); }
.btn[aria-pressed="true"] { border-color: var(--glow); color: var(--glow); }
.leave { position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-start: 14px; z-index: 1; background: rgba(16, 21, 20, .76); }
.btn-primary { color: #211b11; font-weight: 600; background: var(--glow); border-color: var(--glow); }
.btn-primary:hover { color: #17130d; background: #f0d6a6; border-color: #f0d6a6; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

.notice {
  width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 30px 26px;
  color: var(--text); background: linear-gradient(145deg, #202927, #151c1d); border: 1px solid var(--line-strong); border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0,0,0,.45);
}
.notice::backdrop { background: rgba(5, 9, 9, .72); backdrop-filter: blur(8px); }
.notice h2 { margin: 0 0 15px; font: 500 23px/1.4 var(--serif); }
.notice p { margin: 0 0 14px; line-height: 1.75; }
.notice ul { margin: 0 0 14px; padding-inline-start: 21px; line-height: 1.8; color: #d4d5ce; }
.notice .languages { margin: -8px 0 16px; }
.candle-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 14px; padding: 12px 8px; background: rgba(7, 11, 11, .5); border: 1px solid rgba(255,255,255,.06); border-radius: 15px; }
.candle { min-height: 56px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; background: none; border: 1px solid transparent; border-radius: 9px; cursor: pointer; }
.candle:hover:not([aria-disabled="true"]) { border-color: var(--glow); background: rgba(255,255,255,.035); }
.candle[aria-disabled="true"] { cursor: default; }
.candle-flame { width: 8px; height: 14px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: transparent; }
/* Catholic votive glass */
[data-kind="catholic"] .candle-stick { width: 22px; height: 24px; margin-bottom: 4px; border-radius: 3px 3px 7px 7px; opacity: .78; }
[data-kind="catholic"] .c0 .candle-stick { background: #a3202c; }
[data-kind="catholic"] .c1 .candle-stick { background: #24448f; }
[data-kind="catholic"] .c2 .candle-stick { background: #c98a2e; }
[data-kind="catholic"] .lit .candle-stick { opacity: 1; box-shadow: 0 0 10px 2px rgba(255, 190, 110, .45); }
/* Christian taper candle */
[data-kind="christian"] .candle-stick { position: relative; width: 7px; height: 28px; margin-bottom: 8px; background: #efe8d6; border-radius: 2px 2px 0 0; }
[data-kind="christian"] .candle-stick::after { content: ""; position: absolute; left: -7px; right: -7px; bottom: -5px; height: 5px; background: #b8944f; border-radius: 2px; }
/* Buddhist lotus lantern */
.candle.lit .candle-flame { background: #ffc36a; box-shadow: 0 0 12px 4px rgba(255, 180, 90, .75); }
.candle.mine { border-color: var(--glow); }
[data-kind="buddhist"] .candle-stick { order: 1; width: 34px; height: 26px; background: #b46f84; clip-path: polygon(50% 0, 64% 30%, 82% 12%, 84% 44%, 100% 38%, 88% 72%, 68% 100%, 32% 100%, 12% 72%, 0 38%, 16% 44%, 18% 12%, 36% 30%); }
[data-kind="buddhist"] .candle-flame, [data-kind="buddhist"] .candle.lit .candle-flame { order: 2; width: 6px; height: 11px; margin-bottom: 4px; background: #f3ecd9; border-radius: 0; box-shadow: none; }
[data-kind="buddhist"] .lit .candle-stick { background: #ffc4d1; }
[data-kind="buddhist"] .candle.lit { filter: drop-shadow(0 0 7px rgba(255, 127, 159, .9)); }
.notice-room { color: var(--glow); }
.notice-fine { color: var(--muted); font-size: 12px; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 21px; }
.notice-actions .btn-primary { flex: 1 1 200px; }

@media (max-width: 620px) {
  .home { justify-content: center; gap: 24px; padding-inline: 20px; }
  #languages { top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
  .home-head { padding-top: 24px; }
  .home-head h1 { gap: 11px; }
  .home-head p { font-size: 14px; }
  .room-list { grid-template-columns: 1fr; gap: 9px; }
  .room-card { min-height: 82px; padding: 14px 16px; border-radius: 14px; }
  .room-name { font-size: 18px; }
  .count { top: calc(max(14px, env(safe-area-inset-top)) + 50px); }
  .toast { top: calc(max(14px, env(safe-area-inset-top)) + 94px); }
  .volume { width: 62px; }
  .dock { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .actions { max-width: 520px; }
  .actions .btn { min-height: 42px; padding-inline: 13px; }
}
@media (max-width: 380px) {
  .home { padding-inline: 16px; }
  .home-foot { font-size: 10px; }
  .audio-controls { inset-inline-end: 8px; gap: 0; }
  .leave { inset-inline-start: 8px; }
  .volume { width: 48px; }
}

/* Home screen: a quiet, more spacious room selector. */
body:has(.home:not([hidden])) {
  background:
    radial-gradient(ellipse at 50% 28%, rgba(158, 177, 148, .12), transparent 32rem),
    radial-gradient(ellipse at 8% 82%, rgba(186, 143, 94, .10), transparent 28rem),
    radial-gradient(ellipse at 94% 8%, rgba(97, 126, 113, .12), transparent 26rem),
    linear-gradient(145deg, #121a19 0%, #0b1111 48%, #111715 100%);
}
.home {
  width: min(100%, 900px);
  padding: max(52px, env(safe-area-inset-top)) 34px max(34px, env(safe-area-inset-bottom));
  gap: 38px;
}
.home::before {
  width: min(90vw, 780px);
  top: 43%;
  background: radial-gradient(ellipse, rgba(191, 192, 151, .075), rgba(110, 144, 120, .035) 36%, transparent 70%);
  filter: blur(8px);
}
.home-head {
  max-width: 680px;
  padding-top: 20px;
}
.home-head h1 {
  gap: 16px;
  margin-bottom: 16px;
  font-size: clamp(38px, 7vw, 58px);
  letter-spacing: .035em;
  text-shadow: 0 4px 30px rgba(220, 213, 184, .11);
}
.home-head h1::before {
  width: 8px;
  height: 8px;
  background: #e8d4a9;
  box-shadow: 0 0 14px 4px rgba(232, 212, 169, .34), 0 0 42px 12px rgba(232, 212, 169, .11);
}
.home-head p {
  max-width: 500px;
  color: #c2c9c0;
  font-size: 15px;
  line-height: 1.9;
  text-wrap: balance;
}
#languages {
  top: max(24px, env(safe-area-inset-top));
  inset-inline-end: 28px;
  padding: 4px;
  gap: 2px;
  background: rgba(9, 14, 14, .42);
  border: 1px solid rgba(231, 227, 207, .09);
  border-radius: 999px;
  backdrop-filter: blur(16px);
}
.lang { min-height: 34px; padding-inline: 11px; }
.lang[aria-pressed="true"] {
  color: #f5efdf;
  background: rgba(220, 209, 176, .12);
  border-color: rgba(225, 211, 173, .18);
}
.room-list {
  width: min(100%, 760px);
  gap: 14px;
}
.room-card {
  min-height: 126px;
  padding: 22px 22px;
  gap: 17px;
  background: linear-gradient(135deg, rgba(34, 44, 41, .88), rgba(19, 27, 27, .88));
  border-color: rgba(227, 222, 201, .13);
  border-radius: 20px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .17), inset 0 1px rgba(255, 255, 255, .045);
}
.room-card::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 2px;
  border-radius: 4px;
  background: var(--dot);
  opacity: .72;
  box-shadow: 0 0 15px color-mix(in srgb, var(--dot) 55%, transparent);
}
html[dir="rtl"] .room-card::before { inset: 12px 0 12px auto; }
.room-card::after {
  opacity: .85;
  background: radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--dot) 15%, transparent), transparent 65%);
}
.room-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--dot) 44%, rgba(235, 225, 199, .35));
  box-shadow: 0 22px 48px rgba(0, 0, 0, .24), inset 0 1px rgba(255,255,255,.07);
}
.room-dot {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 18px 4px color-mix(in srgb, var(--dot) 42%, transparent);
}
.room-name { font-size: 21px; letter-spacing: .025em; }
.room-place { margin-top: 7px; color: #b3bcb4; font-size: 12px; }
.room-count {
  padding: 7px 10px;
  color: #d2d3c9;
  background: rgba(3, 8, 8, .2);
  border-color: rgba(255,255,255,.1);
}
.home-foot {
  width: min(100%, 760px);
  padding: 17px 4px 0;
  color: #9da79f;
  border-color: rgba(230, 221, 201, .13);
}
@media (max-width: 620px) {
  .home { gap: 28px; padding-inline: 20px; }
  .home-head { padding-top: 38px; }
  .home-head h1 { font-size: clamp(36px, 10vw, 48px); }
  #languages { top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
  .room-list { gap: 10px; }
  .room-card { min-height: 88px; padding: 15px 17px; border-radius: 16px; }
  .room-name { font-size: 19px; }
  .room-place { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .room-card, .lang { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Illustrated sanctuary system: layered room art, warm controls, and fine-line symbols. */
.home {
  width: min(100%, 1040px);
  gap: clamp(24px, 4vh, 42px);
  background-image: radial-gradient(ellipse at 50% 42%, rgba(218, 190, 139, .045), transparent 62%);
}
.home-head h1::before { width: 9px; height: 9px; box-shadow: 0 0 0 7px rgba(232,212,169,.06), 0 0 28px 8px rgba(232,212,169,.38); }
.room-list { width: min(100%, 850px); gap: 16px; }
.room-card {
  height: 184px; min-height: 0; padding: 0; display: block; text-align: start;
  color: #f5eedc; background: #202b29; border: 1px solid rgba(226,210,171,.2); border-radius: 23px;
  box-shadow: 0 18px 44px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.16);
  transform: translateZ(0);
}
.room-card::before { display: block; inset: 7px; z-index: 2; width: auto; border: 1px solid rgba(246,226,186,.25); border-radius: 17px; background: none; opacity: .7; box-shadow: inset 0 0 24px rgba(255,230,183,.035); pointer-events: none; }
.room-card::after { inset: 0; z-index: 1; opacity: 0; background: none; }
.room-art { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit; }
.room-shade { position: absolute; inset: 0; z-index: 1; border-radius: inherit; background: linear-gradient(90deg,rgba(10,18,18,.82) 0%,rgba(10,18,18,.63) 34%,rgba(10,18,18,.1) 77%,transparent 100%),linear-gradient(0deg,rgba(8,13,13,.46),transparent 64%); pointer-events: none; }
.room-art svg { width: 100%; height: 100%; display: block; filter: saturate(1.12) contrast(1.06); transform: scale(1.015); transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .4s; }
.room-card:hover .room-art svg { transform: scale(1.07); filter: saturate(1.12) brightness(1.05); }
.room-card[data-faith="buddhist"] { --dot: #d8b379; }
.room-card[data-faith="catholic"] { --dot: #d2b87e; }
.room-card[data-faith="christian"] { --dot: #d8bd88; }
.room-card[data-faith="islam"] { --dot: #9dc4ad; }
.room-dot { position: absolute; z-index: 2; top: 24px; left: 24px; width: 7px; height: 7px; background: var(--dot); box-shadow: 0 0 15px 4px color-mix(in srgb,var(--dot) 55%,transparent); }
html[dir="rtl"] .room-dot { left: auto; right: 24px; }
.room-text { position: absolute; z-index: 2; left: 26px; right: 24px; bottom: 24px; width: min(70%, 250px); }
html[dir="rtl"] .room-text { left: 24px; right: 26px; }
.room-name { font-size: clamp(20px, 2vw, 24px); text-shadow: 0 2px 16px rgba(0,0,0,.42); }
.room-place { margin-top: 6px; color: rgba(245,238,220,.78); font-size: 12px; letter-spacing: .04em; }
.room-count { position: absolute; z-index: 2; top: 18px; right: 18px; padding: 6px 10px; color: #f7efdb; font-size: 11px; background: rgba(11,18,18,.5); border-color: rgba(255,255,255,.22); backdrop-filter: blur(12px); }
html[dir="rtl"] .room-count { right: auto; left: 18px; }
.room-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb,var(--dot) 68%,white); box-shadow: 0 24px 54px rgba(0,0,0,.3),inset 0 1px rgba(255,255,255,.22); }
.room-card:active { transform: translateY(-1px) scale(.995); }
.room-card:focus-visible { outline: 2px solid var(--dot); outline-offset: 4px; }

.room::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at center,transparent 45%,rgba(5,9,9,.3) 100%); }
.room > :not(.world):not(.dock) { z-index: 2; }
.room > .dock { z-index: 2; }
.room[data-faith="buddhist"] { --accent: #e4c58b; --accent-soft: rgba(228,197,139,.18); }
.room[data-faith="catholic"] { --accent: #e2c98f; --accent-soft: rgba(226,201,143,.18); }
.room[data-faith="christian"] { --accent: #e1c993; --accent-soft: rgba(225,201,147,.18); }
.room[data-faith="islam"] { --accent: #b7d3c1; --accent-soft: rgba(183,211,193,.17); }
.count, .audio-controls, .leave { background: linear-gradient(145deg,rgba(26,32,31,.86),rgba(10,15,15,.76)); border: 1px solid rgba(234,220,184,.23); box-shadow: 0 8px 26px rgba(0,0,0,.2),inset 0 1px rgba(255,255,255,.09); }
.count { padding: 10px 16px; font-family: var(--serif); letter-spacing: .035em; }
.leave { color: #f4ead4; }
.audio-controls { padding: 4px 9px; }
.actions { gap: 9px; max-width: 780px; }
.actions .btn {
  min-width: 84px; min-height: 66px; padding: 8px 12px 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #f5eedf; font-size: 11px; line-height: 1.25; letter-spacing: .015em;
  background: linear-gradient(155deg,rgba(40,45,40,.94),rgba(12,18,18,.92)); border: 1px solid rgba(235,219,180,.24); border-radius: 19px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28),inset 0 1px rgba(255,255,255,.12); backdrop-filter: blur(14px);
}
.action-icon { width: 26px; height: 26px; display: grid; place-items: center; color: var(--accent,var(--glow)); filter: drop-shadow(0 2px 5px rgba(0,0,0,.35)); }
.action-icon svg { width: 24px; height: 24px; overflow: visible; }
.actions .btn:hover { color: #fff7e7; border-color: color-mix(in srgb,var(--accent,var(--glow)) 72%,white); background: linear-gradient(145deg,rgba(57,59,48,.96),rgba(22,29,27,.96)); transform: translateY(-2px); }
.actions .btn:active { transform: scale(.96); }
.hint { color: rgba(250,245,231,.9); font-size: 12px; letter-spacing: .015em; }
.notice { position: relative; overflow: hidden auto; background: linear-gradient(145deg,rgba(35,43,39,.97),rgba(17,24,23,.98)); border-color: rgba(228,202,151,.32); box-shadow: 0 32px 100px rgba(0,0,0,.54),inset 0 1px rgba(255,255,255,.1); }
.notice::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(225,199,147,.12); border-radius: 16px; pointer-events: none; }
.notice h2 { text-shadow: 0 2px 18px rgba(229,198,134,.12); }
.notice .btn { min-height: 44px; border-radius: 15px; }
.btn-primary { background: linear-gradient(145deg,#f0d8a7,#cba96e); box-shadow: 0 5px 18px rgba(215,177,113,.18),inset 0 1px rgba(255,255,255,.38); }
.beads, .moktak-panel { border-color: rgba(230,208,166,.25); background: linear-gradient(145deg,rgba(33,39,34,.94),rgba(11,17,17,.94)); box-shadow: 0 18px 48px rgba(0,0,0,.38),inset 0 1px rgba(255,255,255,.12); }
.beads-label { font-family: var(--serif); letter-spacing: .04em; }
.toast { color: #fbf3de; background: linear-gradient(145deg,rgba(37,43,38,.95),rgba(12,17,17,.94)); border-color: rgba(228,202,151,.26); box-shadow: 0 10px 30px rgba(0,0,0,.3); }

@media (max-width: 620px) {
  .home { gap: 24px; padding: max(44px,env(safe-area-inset-top)) 18px max(24px,env(safe-area-inset-bottom)); }
  .room-list { grid-template-columns: 1fr; width: min(100%, 460px); gap: 11px; }
  .room-card { height: 144px; border-radius: 20px; }
  .room-text { left: 20px; bottom: 18px; }
  html[dir="rtl"] .room-text { right: 20px; }
  .room-dot { top: 18px; left: 20px; }
  html[dir="rtl"] .room-dot { right: 20px; }
  .actions { gap: 6px; max-width: 100%; }
  .actions .btn { min-width: 70px; min-height: 60px; padding-inline: 8px; border-radius: 17px; }
  .action-icon, .action-icon svg { width: 22px; height: 22px; }
}

/* 패널은 버튼 줄 수와 상관없이 그 위에 놓인다 */
.beads, .moktak-panel { bottom: calc(var(--dock-height, 130px) + 8px); }
@media (max-width: 420px) {
  .actions { gap: 5px; }
  .actions .btn { min-width: 62px; padding-inline: 4px; }
}

/* 이름표 */
.name-tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.name-tag { position: absolute; left: 0; top: 0; max-width: 220px; padding: 3px 10px; overflow: hidden; color: #f8f3ea; font: 500 13px/1.35 var(--sans); white-space: nowrap; text-overflow: ellipsis; background: rgba(14,13,18,.82); border-radius: 999px; }
.name-tag.is-mine { color: #21180b; background: rgba(246,232,196,.97); }

/* 염주를 빠르게 눌러도 화면이 확대되지 않게 한다. 메인 화면은 손가락으로 확대할 수 있게 둔다. */
html { touch-action: manipulation; }
.room { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.room button, .room input, .bead-string, .bead, .notice, .notice * { touch-action: manipulation; }
.notice { -webkit-user-select: none; user-select: none; }

/* 초·연등 창: 닫기를 위에 두고 문구 자리를 미리 잡아, 켜도 칸이 밀리거나 닫기가 잘리지 않는다 */
#candles { padding: 20px 18px; }
.candles-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.candles-head h2 { margin: 0; }
.candles-head .btn { flex: none; min-height: 40px; }
#candles p { margin-bottom: 10px; font-size: 14px; line-height: 1.55; }
#candles .candle-grid { margin-bottom: 10px; }
#candles-wish[hidden] { display: block !important; visibility: hidden; }

/* 휴대폰 윗줄: 나가기 아래에 방 정보를 두어 소리 조절과 겹치지 않게 한다 */
@media (max-width: 620px) {
  .leave { min-height: 38px; padding: 0 14px; font-size: 13px; }
  .audio-controls { padding: 2px 6px; }
  .audio-controls .btn { min-height: 32px; padding: 0 10px; font-size: 12px; }
  .volume { width: 56px; height: 32px; }
  .count { top: calc(max(14px, env(safe-area-inset-top)) + 46px); left: auto; inset-inline-start: 14px; padding: 5px 11px; transform: none; font-size: 11px; }
}
@media (max-width: 380px) {
  .count { inset-inline-start: 8px; }
  .volume { width: 46px; }
}

/* 메뉴는 언어와 버튼 수에 상관없이 한 줄. 긴 이름은 버튼 안에서 줄을 바꾼다 */
.actions { flex-wrap: nowrap; }
@media (max-width: 620px) {
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 0; min-width: 0; max-width: 84px; padding-inline: 3px; }
  .action-label { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
}

/* 설명 글도 한 줄. 아주 좁은 화면에서는 글자를 조금 줄인다 */
.hint { white-space: nowrap; }
@media (max-width: 380px) { .hint { font-size: 11px; letter-spacing: 0; } }
