/* 구름마루 — 실사 산사 위의 한지 패널. 낮·노을은 밝은 한지, 새벽·밤은 먹빛 한지. */
:root {
  --ink: #2a241d;
  --ink-soft: #6a5f52;
  --paper: rgba(250, 246, 237, 0.86);
  --paper-solid: #f8f3e9;
  --paper-tint: rgba(255, 255, 255, 0.4);
  --paper-line: rgba(70, 52, 34, 0.14);
  --dan-red: #b8432f;
  --dan-green: #23706b;
  --dan-gold: #d6a23f;
  --shadow: 0 18px 48px rgba(18, 14, 10, 0.3);
  --radius: 18px;
  --font-title: 'Gowun Batang', 'Nanum Myeongjo', serif;
  --font-body: 'Gowun Dodum', 'Apple SD Gothic Neo', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --hanji: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body[data-phase='night'],
body[data-phase='dawn'] {
  --ink: #f1e9dc;
  --ink-soft: #b8ae9f;
  --paper: rgba(24, 27, 38, 0.8);
  --paper-solid: #222634;
  --paper-tint: rgba(255, 255, 255, 0.06);
  --paper-line: rgba(255, 255, 255, 0.12);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1c2230;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--dan-gold); outline-offset: 2px; }

/* ── 장면 ─────────────────────────────────── */
.scene { position: fixed; inset: 0; overflow: hidden; }
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 10, 16, 0.42), transparent 20%, transparent 72%, rgba(8, 10, 16, 0.32));
}
.parallax { position: absolute; inset: 0; transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.stage { position: absolute; }
.stage.panning { animation: pan 80s ease-in-out infinite alternate; }
.zoom {
  position: absolute;
  inset: 0;
  transform-origin: 40% 72%;
  animation: kenburns 70s ease-in-out infinite alternate;
}
.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.bg.show { opacity: 1; }
.sky,
.yard { position: absolute; inset: 0; pointer-events: none; }
.fx {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes pan { from { transform: translateX(0); } to { transform: translateX(var(--pan)); } }
@keyframes kenburns { from { transform: scale(1.03); } to { transform: scale(1.09); } }

/* ── 하늘 연등 ─────────────────────────────── */
.lantern {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 2.1%;
  aspect-ratio: 3 / 4.4;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, 0);
  animation: bob var(--dur, 6s) ease-in-out var(--delay, 0s) infinite;
  filter: drop-shadow(0 0 0.5vw color-mix(in srgb, var(--c) 65%, transparent));
  transition: filter 0.4s;
}
.lantern:hover { filter: drop-shadow(0 0 1.1vw var(--c)) brightness(1.12); }
body[data-phase='night'] .lantern,
body[data-phase='dawn'] .lantern { filter: drop-shadow(0 0 1vw var(--c)) brightness(1.1); }
.l-cap {
  position: absolute;
  left: 24%;
  right: 24%;
  top: 0;
  height: 9%;
  border-radius: 2px;
  background: #3b2a1e;
}
.l-body {
  position: absolute;
  left: 0;
  right: 0;
  top: 8%;
  bottom: 17%;
  border-radius: 46% 46% 42% 42% / 52% 52% 40% 40%;
  background:
    repeating-linear-gradient(90deg, transparent 0 17%, rgba(0, 0, 0, 0.09) 17% 19%),
    radial-gradient(ellipse at 50% 45%, #fff6d8 0%, var(--c) 48%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.l-tassel {
  position: absolute;
  left: 46%;
  width: 8%;
  top: 83%;
  bottom: 0;
  border-radius: 2px;
  background: var(--dan-gold);
}
.lantern.mine::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -24%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px #fff;
  transform: translateX(-50%);
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0) rotate(-2deg); }
  50% { transform: translate(-50%, -14%) rotate(2deg); }
}

/* ── 마당의 도반 ───────────────────────────── */
.pilgrim {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: var(--z);
  width: 5.2%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -100%) scale(var(--scale));
  transform-origin: 50% 100%;
  pointer-events: auto;
}
.pilgrim:hover .name { background: rgba(10, 12, 18, 0.72); }
.yard-menu { width: auto; min-width: 160px; text-align: center; }
.yard-menu .wish { margin-bottom: 10px; }
.pilgrim .dongja { width: 100%; height: auto; overflow: visible; animation: breathe 4.2s ease-in-out var(--delay) infinite; }
.pilgrim .name {
  margin-top: -2px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(10, 12, 18, 0.5);
  color: #fff;
  font-size: clamp(10px, 0.72vw, 13px);
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.pilgrim.me .name { background: var(--dan-red); }
.pilgrim .bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  padding: 4px 9px;
  border-radius: 10px;
  background: #f8f3e9;
  color: #2a241d;
  font-size: clamp(10px, 0.78vw, 13px);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.3s, transform 0.3s;
}
.pilgrim .bubble.show { opacity: 1; transform: translate(-50%, 0); }

.dongja .upper { transform-box: view-box; transform-origin: 50px 100px; }
.dongja .body { transform-box: view-box; transform-origin: 50px 124px; }
.dongja.bow .upper { animation: bowUpper 1.3s ease-in-out; }
.dongja.bow .body { animation: bowBody 1.3s ease-in-out; }
.dongja .glow { animation: flicker 2.4s ease-in-out infinite; }

@keyframes breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6%); } }
@keyframes bowUpper { 0%, 100% { transform: none; } 45%, 62% { transform: translateY(26px) scale(0.9, 0.7); } }
@keyframes bowBody { 0%, 100% { transform: none; } 45%, 62% { transform: scaleY(0.62); } }
@keyframes flicker { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.5; } }

/* ── 상단 ─────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: calc(14px + var(--safe-t)) 18px 0;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font-family: var(--font-title); font-size: 24px; font-weight: 700; letter-spacing: 0.05em; }
.brand p { margin: 2px 0 0; font-size: 12.5px; opacity: 0.88; }
.seal {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--dan-red);
  color: #f7efe0;
  font-family: var(--font-title);
  font-size: 22px;
  text-shadow: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(255, 240, 220, 0.25);
  transform: rotate(-4deg);
}
.seal.big { width: 58px; height: 58px; margin: 0 auto; font-size: 31px; }
.status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(14, 16, 24, 0.38);
  color: #fff;
  font-size: 13px;
  text-shadow: none;
  white-space: nowrap;
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
button.chip { cursor: pointer; }
button.chip:hover { background: rgba(14, 16, 24, 0.55); }
.chip.merit span { font-size: 12px; opacity: 0.8; }
.chip strong { font-weight: 400; font-variant-numeric: tabular-nums; }
.chip.merit strong { color: #ffd98a; font-size: 14px; }
.chip.icon { justify-content: center; width: 34px; padding: 0; }
.chip.icon svg { width: 18px; height: 18px; fill: #fff; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }
.chip.icon .wave { fill: none; opacity: 0.25; transition: opacity 0.3s; }
.chip.icon.on .wave { opacity: 1; }

/* ── 정시 예불 배너 · 합장 알림 ─────────────── */
.service-banner {
  position: fixed;
  top: calc(66px + var(--safe-t));
  left: 50%;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  max-width: calc(100vw - 24px);
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(214, 162, 63, 0.55);
  border-radius: 999px;
  background: var(--hanji), var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.service-banner.live { border-color: var(--dan-gold); box-shadow: 0 0 0 3px rgba(214, 162, 63, 0.25), var(--shadow); }
.service-mark { color: var(--dan-gold); font-family: var(--font-title); }
.service-banner.live .service-mark { animation: flicker 2.4s ease-in-out infinite; }
.service-text { font-variant-numeric: tabular-nums; }

/* 알림은 예불 배너 아래 가운데에 쌓는다(오른쪽 위에 두면 배너와 겹친다) */
.notices {
  position: fixed;
  left: 50%;
  top: calc(122px + var(--safe-t));
  z-index: 45;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  transform: translateX(-50%);
}
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  background: var(--hanji), var(--paper);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  animation: noticeIn 0.3s ease-out;
}
.notice-actions { display: flex; flex: none; gap: 6px; }
@keyframes noticeIn { from { opacity: 0; transform: translateY(-8px); } }

/* ── 하단 메뉴 ─────────────────────────────── */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-b));
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--paper-line);
  border-radius: 22px;
  background: var(--hanji), var(--paper);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}
.dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 74px;
  height: 58px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.dock button:hover { background: var(--paper-tint); color: var(--ink); }
.dock button.on { background: var(--dan-red); color: #fff8ee; }
.dock svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── 패널 ─────────────────────────────────── */
.panel {
  position: fixed;
  right: 20px;
  bottom: calc(96px + var(--safe-b));
  z-index: 15;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 200px);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: var(--hanji), var(--paper);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.28s ease, transform 0.28s ease;
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}
.panel.open { opacity: 1; pointer-events: auto; transform: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 6px; }
.panel-head h2 { margin: 0; font-family: var(--font-title); font-size: 19px; font-weight: 700; }
.close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--paper-tint);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.panel-body { overflow: auto; overscroll-behavior: contain; padding: 4px 18px 18px; }

.seg { display: flex; gap: 3px; margin: 4px 0 12px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.06); }
body[data-phase='night'] .seg,
body[data-phase='dawn'] .seg { background: rgba(255, 255, 255, 0.07); }
.seg button {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
}
.seg button.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }

.btn {
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: var(--paper-solid);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary { border-color: transparent; background: var(--dan-red); color: #fff8ee; box-shadow: 0 6px 16px rgba(184, 67, 47, 0.32); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

.hint { margin: 2px 0 0; color: var(--ink-soft); font-size: 12.5px; text-align: center; line-height: 1.5; }
.section { margin: 18px 0 8px; color: var(--ink-soft); font-family: var(--font-title); font-size: 15px; font-weight: 400; }
.empty { color: var(--ink-soft); font-size: 13.5px; text-align: center; }

/* ── 수행 ─────────────────────────────────── */
.tally { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 2px 0 4px; }
.tally .label,
.tally .sub { color: var(--ink-soft); font-size: 12.5px; }
.tally .count { font-family: var(--font-title); font-size: 36px; font-weight: 400; font-variant-numeric: tabular-nums; }
.practice-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 0; }

.moktak, .ring {
  width: 230px;
  max-width: 72%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.moktak svg, .ring-svg { display: block; width: 100%; height: auto; }
.moktak-body { fill: #8a5326; }
.moktak .mallet { transform-box: view-box; transform-origin: 150px 6px; }
.moktak.hit svg { animation: knock 0.18s ease-out; }
.moktak.hit .mallet { animation: mallet 0.18s ease-out; }
@keyframes knock { 35% { transform: scale(0.96) translateY(3px); } }
@keyframes mallet { 40% { transform: rotate(-16deg); } }

.ring-string { stroke: rgba(150, 100, 50, 0.4); stroke-width: 1.2; }
.bead { fill: #7b4a2a; transition: fill 0.25s; }
.bead.passed { fill: var(--dan-gold); }
.bead.current { fill: #fff3cf; stroke: var(--dan-gold); stroke-width: 1; }
.bead.guru { fill: var(--dan-red); }
.tassel { stroke: var(--dan-red); stroke-width: 2; stroke-linecap: round; }
.round { margin: 0; color: var(--ink-soft); font-size: 14px; font-variant-numeric: tabular-nums; }

.bow-stage { display: grid; place-items: end center; width: 150px; height: 170px; }
.dongja.big { width: 140px; height: auto; overflow: visible; }
.bar { width: 100%; height: 8px; overflow: hidden; border-radius: 99px; background: rgba(0, 0, 0, 0.08); }
body[data-phase='night'] .bar,
body[data-phase='dawn'] .bar { background: rgba(255, 255, 255, 0.12); }
.bar span { display: block; width: var(--p, 0%); height: 100%; background: linear-gradient(90deg, var(--dan-gold), var(--dan-red)); transition: width 0.4s; }

.float-merit {
  position: fixed;
  z-index: 50;
  color: #ffd98a;
  font-family: var(--font-title);
  font-size: 20px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: floatUp 0.9s ease-out forwards;
}
@keyframes floatUp {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -48px); }
}

/* ── 연등 패널 ─────────────────────────────── */
.wish-form { display: grid; gap: 10px; }
.field { position: relative; }
textarea,
input {
  width: 100%;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: var(--paper-solid);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
}
textarea { display: block; padding: 12px 14px 24px; resize: none; }
.counter { position: absolute; right: 12px; bottom: 7px; color: var(--ink-soft); font-size: 11.5px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.swatch.on { outline: 3px solid var(--dan-gold); outline-offset: 2px; }
.lantern-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lantern-list li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: var(--paper-tint);
}
.lantern-list li.empty { display: block; }
.dot { width: 12px; height: 16px; border-radius: 40%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.wish { margin: 0; font-size: 14.5px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.meta { margin: 2px 0 0; color: var(--ink-soft); font-size: 12px; }

.popover {
  position: fixed;
  z-index: 40;
  width: min(280px, calc(100vw - 24px));
  padding: 14px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  background: var(--hanji), var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.popover .wish { margin: 0 0 6px; font-family: var(--font-title); font-size: 16px; }
.popover .meta { margin: 0 0 10px; }

/* ── 동자승 꾸미기 ─────────────────────────── */
.closet-head { display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 14px; margin-bottom: 12px; }
.closet-head .dongja.big { width: 104px; }
.nick-row { display: flex; gap: 6px; }
.nick-row input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 10px; font-size: 14px; }
.merit-line { margin: 8px 0 2px; font-size: 13.5px; }
.closet-head .hint { text-align: left; }
.items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: var(--paper-tint);
}
.item.worn { border-color: var(--dan-gold); box-shadow: inset 0 0 0 1px var(--dan-gold); }
.thumb { width: 62px; height: auto; overflow: visible; }
.iname { font-size: 13px; text-align: center; }
.item .btn { width: 100%; padding: 0 6px; }

/* ── 대웅전(스님) ──────────────────────────── */
.hall {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #120e0a url('/img/hall.jpg') center / cover no-repeat;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.hall::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(10, 8, 6, 0.15), rgba(10, 8, 6, 0.78));
}
.hall.open { opacity: 1; visibility: visible; }
.hall-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  height: min(760px, calc(100vh - 32px));
  padding: 16px 18px 14px;
  border: 1px solid rgba(255, 220, 170, 0.18);
  border-radius: 20px;
  background: rgba(24, 19, 14, 0.6);
  color: #f3e9da;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hall-head { display: flex; align-items: center; gap: 10px; }
.hall-head h2 { margin: 0; font-family: var(--font-title); font-size: 18px; font-weight: 400; }
.hall .back { height: 34px; border-color: rgba(255, 255, 255, 0.22); color: #f3e9da; font-size: 13.5px; }
.disclaimer { margin: 10px 0 8px; color: rgba(243, 233, 218, 0.7); font-size: 12px; line-height: 1.5; }
.crisis { margin-bottom: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(184, 67, 47, 0.92); color: #fff; font-size: 13.5px; line-height: 1.55; }
.crisis a { color: #fff; font-weight: 700; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 6px 2px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.65; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.msg p { margin: 0; }
.msg.monk { align-self: flex-start; border-bottom-left-radius: 4px; background: rgba(255, 244, 225, 0.94); color: #2a241d; }
.msg.monk .who { display: block; margin-bottom: 2px; color: #8a6a45; font-family: var(--font-title); font-size: 11.5px; }
.msg.me { align-self: flex-end; border-bottom-right-radius: 4px; background: rgba(184, 67, 47, 0.94); color: #fff8ee; }
.msg.note { align-self: center; background: rgba(0, 0, 0, 0.5); color: #f3e9da; font-size: 13px; }
.msg.waiting p { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.chat-form { display: grid; gap: 8px; margin-top: 8px; }
.chat-form textarea { padding: 12px 14px; border: 0; background: rgba(255, 250, 240, 0.95); color: #2a241d; }
.chat-form .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.remaining { color: rgba(243, 233, 218, 0.72); font-size: 12px; }

/* ── 첫 방문·알림 ──────────────────────────── */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 12, 18, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.welcome-card {
  width: min(420px, 100%);
  padding: 28px 26px 22px;
  border-radius: 22px;
  background: var(--hanji), var(--paper-solid);
  color: var(--ink);
  text-align: center;
  box-shadow: var(--shadow);
}
.welcome-card h2 { margin: 14px 0 8px; font-family: var(--font-title); font-size: 22px; }
.welcome-card p { margin: 6px 0; line-height: 1.6; }
.welcome-card ul { max-width: 300px; margin: 12px auto; padding-left: 20px; line-height: 1.85; text-align: left; }
.welcome-card .small { color: var(--ink-soft); font-size: 12.5px; }
.welcome-card .actions { display: grid; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + var(--safe-b));
  z-index: 70;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 18, 15, 0.9);
  color: #fff8ee;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 80; padding: 12px; border-radius: 12px; background: #f8f3e9; color: #2a241d; }

/* ── 좁은 화면 ─────────────────────────────── */
@media (max-width: 720px) {
  .topbar { padding: calc(10px + var(--safe-t)) 12px 0; }
  .brand h1 { font-size: 20px; }
  .brand p { font-size: 11.5px; }
  .seal { width: 34px; height: 34px; font-size: 19px; }
  .chip { height: 30px; padding: 0 10px; font-size: 12px; }
  .chip.icon { width: 30px; }
  .dock { bottom: calc(10px + var(--safe-b)); }
  .dock button { width: 66px; height: 54px; }
  .panel { left: 8px; right: 8px; bottom: calc(80px + var(--safe-b)); width: auto; max-height: 62vh; }
  .pilgrim { width: 6.4%; }
  .lantern { width: 2.6%; }
  /* left:50% 기준이면 오른쪽 절반 폭에 갇혀 세로로 길어지므로 좌우 여백 기준으로 */
  .service-banner { top: calc(52px + var(--safe-t)); left: 12px; right: 12px; max-width: none; padding: 8px 10px; border-radius: 16px; font-size: 12.5px; transform: none; }
  .notices { right: 12px; left: 12px; top: auto; bottom: calc(80px + var(--safe-b)); width: auto; transform: none; }
  .toast { bottom: calc(88px + var(--safe-b)); }
}
@media (max-width: 420px) {
  .brand h1 { white-space: nowrap; }
  .brand p { display: none; }
  .status { gap: 5px; }
  .chip { padding: 0 9px; }
  .chip .auto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { animation: none !important; transition: none !important; }
}
