:root {
  --glass: rgba(34, 30, 26, 0.55);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text: #f5f1ea;
  --muted: rgba(245, 241, 234, 0.7);
  --accent: #e9c96a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1c1814;
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.icon {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.hud { position: fixed; top: 16px; z-index: 10; }

.hud-left {
  left: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 999px; font-size: 17px;
}
.divider { width: 1px; height: 14px; background: var(--glass-border); }
.muted { color: var(--muted); font-size: 14px; }

.hud-right { right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; border-radius: 999px; }
.count { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-right: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover, .action:hover, .pill:hover { background: rgba(255, 255, 255, 0.1); }
#btn-mute .off { display: none; }
#btn-mute.muted .on { display: none; }
#btn-mute.muted .off { display: block; }

.pill { padding: 9px 16px; border-radius: 999px; font-size: 14px; }
.pill.active { color: #2a2218; background: var(--accent); border-color: var(--accent); }

.toast {
  position: fixed; top: 84px; left: 50%; z-index: 40;
  transform: translate(-50%, -8px);
  padding: 11px 22px; border-radius: 22px; font-size: 15px; text-align: center; word-break: keep-all;
  width: max-content; max-width: calc(100vw - 24px); /* 긴 글은 화면 안에서 줄을 바꾼다 */
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.actions {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; z-index: 10;
  transform: translateX(-50%);
  display: flex; gap: 8px; padding: 8px 16px; border-radius: 28px;
}
.action {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 104px; padding: 10px 0; border-radius: 18px; font-size: 14px;
  transition: background 0.2s, color 0.2s;
}
.action.active { color: var(--accent); }
.action[hidden] { display: none; }
.action:disabled { opacity: 0.5; cursor: default; }

.nametag-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.prayer-days {
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: rgba(93, 107, 79, 0.88); color: #fdf6e6; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.nametag {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: #3a3228;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.nametag .me {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: #5d6b4f; color: #fff; font-size: 11px;
}

.loading {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: linear-gradient(rgba(20, 16, 12, 0.55), rgba(20, 16, 12, 0.55)), url('assets/hall-view.webp') center / cover, #1c1814;
  color: var(--text); font-size: 16px; letter-spacing: 0.02em;
  transition: opacity 0.8s ease;
}
.loading.done { opacity: 0; pointer-events: none; }

/* 고요한 순간 담기 */
.capture {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: flex-start; padding: 16px 0 16px 56px;
  background: rgba(10, 8, 6, 0.3);
  opacity: 0; transition: opacity 0.25s ease;
}
.capture[hidden] { display: none; }
.capture.show { opacity: 1; }
.capture-card {
  position: relative; width: min(400px, 100%); max-height: 100%; overflow: auto;
  padding: 22px 20px 16px; border-radius: 32px; text-align: center;
  color: #3f3128;
  background-color: #f6f0e4;
  background-image: 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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.3 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(12px) scale(0.98); transition: transform 0.3s ease;
}
.capture.show .capture-card { transform: none; }
.capture-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #5a544b; }
.capture-x:hover { background: rgba(0, 0, 0, 0.06); }
.capture-lotus { width: 58px; height: 40px; filter: drop-shadow(0 3px 3px rgba(120, 70, 50, 0.25)); }
.capture-card h2 { margin: 2px 0 4px; font-family: "Jua", "Apple SD Gothic Neo", sans-serif; font-weight: 400; font-size: 30px; color: #3f3128; letter-spacing: 0.01em; }
.capture-sub { margin: 0 0 16px; font-size: 14px; color: #7d7265; }
.capture-formats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 6px 14px; border-radius: 999px; background: #ebe4d6; }
.capture-format { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 999px; font-size: 14px; color: #6b655b; transition: background 0.2s, color 0.2s; }
.capture-format .icon { width: 18px; height: 18px; }
.capture-format[aria-checked="true"] { background: #4f6a5a; color: #f7f2e8; box-shadow: 0 2px 6px rgba(40, 60, 50, 0.25); }
.capture-img { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: 26px; }
.capture-tools { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.capture-days { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #4f6a5a; cursor: pointer; }
.capture-days input { width: 17px; height: 17px; accent-color: #4f6a5a; }
.capture-phrase { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 14px; border-radius: 999px; font-size: 14px; color: #4f6a5a; background: rgba(79, 106, 90, 0.1); }
.capture-phrase:hover { background: rgba(79, 106, 90, 0.18); }
.capture-phrase .icon { width: 16px; height: 16px; }
.capture-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.capture-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; border-radius: 999px; font-size: 15px; font-weight: 600;
  background: transparent; border: 1.5px solid #cfc6b6; color: #3a4a40;
}
.capture-btn .icon { width: 20px; height: 20px; }
.capture-btn:hover { background: rgba(255, 255, 255, 0.6); }
.capture-btn { height: 54px; font-size: 16px; color: #4f6a5a; border-color: #b9b1a2; }
.capture-btn.primary { background: #4f6a5a; color: #f7f2e8; border-color: #4f6a5a; box-shadow: 0 4px 10px rgba(40, 60, 50, 0.2); }
.capture-btn.primary:hover { background: #435b4d; }
.capture-links { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #e3dccf; }
.capture-links button { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #5a544b; padding: 4px 8px; border-radius: 8px; }
.capture-links button:hover { background: rgba(0, 0, 0, 0.05); }
.capture-links .icon { width: 18px; height: 18px; }
.capture-links-divider { width: 1px; height: 18px; background: #ddd5c6; }
.capture-note { margin: 8px 0 0; font-size: 11px; color: #8a8478; }

@media (max-width: 640px) {
  .capture { justify-content: center; padding: 16px; }
  .hud-left { padding: 8px 14px; font-size: 15px; }
  .actions { gap: 2px; padding: 6px 8px; width: calc(100vw - 12px); justify-content: center; }
  .action { flex: 1 1 0; min-width: 0; width: auto; max-width: 66px; font-size: 11px; white-space: nowrap; letter-spacing: -0.03em; }
  .toast { font-size: 13px; top: 76px; }
}

/* 모습 고르기 */
.select {
  position: fixed; inset: 0; z-index: 25;
  display: grid; place-items: center; padding: 16px;
  background: rgba(14, 11, 8, 0.45);
  opacity: 0; transition: opacity 0.4s ease;
}
.select[hidden] { display: none; }
.select.show { opacity: 1; }
.select-card {
  width: min(460px, 100%); padding: 26px 22px 22px; border-radius: 28px; text-align: center;
  color: #2c2a26;
  background: linear-gradient(160deg, rgba(246, 242, 234, 0.94), rgba(222, 216, 204, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.select-eyebrow { margin: 0; font-size: 13px; color: #7a7468; }
.select-card h1 { margin: 6px 0 18px; font-size: 21px; font-weight: 600; }
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.look {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 10px 12px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.55); border: 2px solid transparent;
  font-size: 15px; font-weight: 500; transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.look:hover { background: rgba(255, 255, 255, 0.8); }
.look[aria-checked="true"] { border-color: #3f4a43; background: #fffdf8; transform: translateY(-2px); }
.look img, .look .placeholder {
  width: 100%; aspect-ratio: 2 / 3; object-fit: contain; border-radius: 14px; background: #f8f3e9;
}
.look .placeholder { display: grid; place-items: center; }
.look .placeholder svg { width: 60%; height: auto; }
.select-name {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 18px 0 14px; font-size: 15px;
}
.select-name .muted { color: #7a7468; font-size: 13px; }
.reroll { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #55534c; }
.reroll:hover { background: rgba(0, 0, 0, 0.06); }
.reroll .icon { width: 18px; height: 18px; }
.enter {
  width: 100%; height: 50px; border-radius: 999px; font-size: 16px; font-weight: 600;
  background: #3f4a43; color: #f4f2ec;
}
.enter:hover { background: #333d37; }

/* 염불 듣기 / 목탁 소리 */
.sound-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: calc(100vw - 32px); }
.sound { display: flex; align-items: center; border-radius: 999px; transition: background 0.2s, border-color 0.2s; }
.sound-toggle { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px; font-size: 14px; }
.sound-toggle::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.35); transition: background 0.2s, box-shadow 0.2s;
}
.sound-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.sound.active { border-color: rgba(233, 201, 106, 0.6); }
.sound.active .sound-toggle { color: var(--accent); }
.sound.active .sound-toggle::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.sound-volume {
  width: 0; margin: 0; opacity: 0; pointer-events: none;
  accent-color: var(--accent); cursor: pointer;
  transition: width 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
}
.sound.active .sound-volume { width: 86px; margin-right: 16px; opacity: 1; pointer-events: auto; }

/* 염주 창 */
.mala-panel {
  position: fixed; left: 16px; top: 50%; z-index: 12;
  width: 300px; padding: 10px 10px 14px; border-radius: 26px; text-align: center;
  transform: translate(-12px, -50%); opacity: 0; cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.mala-panel[hidden] { display: none; }
.mala-panel.show { opacity: 1; transform: translate(0, -50%); }
.mala-panel canvas {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 18px;
  background: radial-gradient(circle at 50% 45%, #f7ead6, #e6d3b6 70%, #d8c3a3);
}
.mala-count { display: flex; flex-direction: column; align-items: center; gap: 0; margin-top: 10px; }
.mala-num { display: flex; align-items: baseline; gap: 6px; }
.mala-count strong { font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.mala-count span { color: var(--muted); font-size: 14px; }
.mala-count em { font-style: normal; font-size: 13px; color: var(--muted); }
.mala-hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .mala-panel { width: 190px; top: auto; bottom: 120px; transform: translate(-12px, 0); }
  .mala-panel.show { transform: none; }
  .mala-hint { display: none; }
}

/* 계절 고르기 */
.seasons { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.seasons-label { font-size: 13px; color: #7a7468; margin-right: 4px; }
.season {
  padding: 7px 13px; border-radius: 999px; font-size: 14px;
  background: rgba(255, 255, 255, 0.55); border: 1.5px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.season:hover { background: rgba(255, 255, 255, 0.85); }
.season[aria-checked="true"] { border-color: #3f4a43; background: #fffdf8; font-weight: 600; }

/* 인사 받았을 때 */
.greet-prompt {
  position: fixed; top: 136px; left: 50%; z-index: 40; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 20px; border-radius: 999px; font-size: 15px; white-space: nowrap;
  animation: rise 0.3s ease;
}
.greet-prompt[hidden] { display: none; }
.greet-prompt button { padding: 8px 16px; border-radius: 999px; background: var(--accent); color: #2a2218; font-weight: 600; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* 이름표: 다른 사람 */
.nametag.other { background: rgba(255, 255, 255, 0.75); padding: 3px 10px; font-size: 12px; }

/* 염주 창 옮기기 / 크기 바꾸기 */
.mala-panel.placed, .mala-panel.placed.show { transform: none; }
.mala-drag { height: 20px; margin: -4px 0 4px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.mala-drag:active { cursor: grabbing; }
.grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); }
.mala-resize {
  position: absolute; right: 6px; bottom: 6px; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 45%, rgba(255,255,255,0.45) 45% 55%, transparent 55% 70%, rgba(255,255,255,0.45) 70% 80%, transparent 80%);
}

/* 이름 입력 */
.select-name { flex-direction: column; gap: 6px; }
.name-field {
  display: flex; align-items: center; gap: 4px; width: min(280px, 100%);
  padding: 4px 4px 4px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75); border: 1.5px solid rgba(63, 74, 67, 0.2);
}
.name-field:focus-within { border-color: #3f4a43; background: #fffdf8; }
.name-field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; font-weight: 600; color: #2c2a26; text-align: center;
}
.name-hint { font-size: 12px; color: #8a8478; }
.icon-lg { width: 26px; height: 26px; stroke-width: 1.5; }

/* 배경음악 듣기 */
.nature-bar { display: flex; align-items: center; border-radius: 999px; }
.nature-toggle { display: flex; align-items: center; gap: 7px; padding: 9px 10px 9px 16px; border-radius: 999px 0 0 999px; font-size: 14px; }
.nature-toggle:hover, .nature-list-btn:hover { background: rgba(255, 255, 255, 0.08); }
.nature-list-btn { display: grid; place-items: center; width: 36px; height: 36px; border-left: 1px solid var(--glass-border); border-radius: 0 999px 999px 0; }
.nature-list-btn .icon { width: 18px; height: 18px; transition: transform 0.2s; }
.nature-list-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.nature-toggle.paused { color: var(--muted); }
.nature-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.nature-toggle.playing { color: var(--accent); border-color: rgba(233, 201, 106, 0.6); }
.nature-toggle.playing .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nature-count { font-size: 12px; opacity: 0.8; }
.nature-panel {
  width: min(360px, calc(100vw - 32px)); max-height: min(60vh, 520px); overflow: auto;
  padding: 14px; border-radius: 22px;
}
.nature-panel[hidden] { display: none; }
.nature-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.nature-head strong { font-size: 15px; }
.nature-head .muted { font-size: 12px; flex: 1; }
.nature-off { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.nature-off:hover { background: rgba(255, 255, 255, 0.18); }
.nature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nature-item {
  display: flex; flex-direction: column; gap: 6px; padding: 9px 11px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.nature-item:hover { background: rgba(255, 255, 255, 0.12); }
.nature-item .name { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.nature-item.on { border-color: rgba(233, 201, 106, 0.6); background: rgba(233, 201, 106, 0.12); }
.nature-item.on .name { color: var(--accent); }
.nature-item input { display: none; width: 100%; accent-color: var(--accent); }
.nature-item.on input { display: block; }

/* 시계, 시간대 */
.clock { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.time-of-day {
  position: fixed; top: 70px; left: 16px; z-index: 10;
  display: flex; gap: 2px; padding: 4px; border-radius: 999px;
}
.time-chip { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); transition: background 0.2s, color 0.2s; }
.time-chip:hover { background: rgba(255, 255, 255, 0.08); }
.time-chip[aria-checked="true"] { background: rgba(255, 255, 255, 0.16); color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .time-of-day { top: 62px; } .time-chip { padding: 5px 9px; } }

/* 대웅전 고르기 */
.room-btn { display: flex; align-items: center; gap: 10px; padding: 0; border-radius: 999px; font-size: inherit; }
.room-btn:hover #room-name { color: var(--text); }
.room-btn .caret { width: 16px; height: 16px; opacity: 0.7; margin-left: -4px; }
.room-menu {
  position: fixed; top: 64px; left: 16px; z-index: 30;
  display: flex; flex-direction: column; gap: 2px; min-width: 230px; padding: 6px; border-radius: 18px;
}
.room-menu[hidden] { display: none; }
.room-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 15px; text-align: left; }
.room-item:hover { background: rgba(255, 255, 255, 0.1); }
.room-item[aria-selected="true"] { background: rgba(233, 201, 106, 0.14); color: var(--accent); }
.room-item .flag { font-size: 18px; }
.room-item .here { margin-left: auto; font-size: 11px; color: var(--muted); }
.nature-panel { max-height: calc(100vh - 270px); }
.nature-group { grid-column: 1 / -1; margin: 8px 2px 0; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.nature-group:first-child { margin-top: 0; }

/* 법당 고르기 */
.select-card { max-height: calc(100vh - 24px); overflow: auto; }
.hall-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.hall-pick {
  display: flex; flex-direction: column; gap: 6px; padding: 5px 5px 8px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.55); border: 2px solid transparent; font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
}
.hall-pick:hover { background: rgba(255, 255, 255, 0.85); }
.hall-pick[aria-checked="true"] { border-color: #3f4a43; background: #fffdf8; }
.hall-pick img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 11px; }
.hall-pick span { display: flex; flex-direction: column; line-height: 1.25; }
.hall-pick strong { font-size: 14px; }
.hall-pick em { font-style: normal; font-size: 12px; color: #7a7468; min-height: 15px; }
.looks .look img, .looks .look .placeholder { aspect-ratio: 4 / 5; }
.room-menu-title { margin: 4px 10px 4px; font-size: 12px; color: var(--muted); }

/* 염주 방향 화살표 */
.mala-stage { position: relative; }
.mala-arrow {
  position: absolute; left: 50%; bottom: 7%; width: 26%; transform: translateX(-50%);
  fill: none; stroke: rgba(90, 52, 30, 0.6); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.mala-arrow.pulse { animation: mala-nudge 0.45s ease; }
@keyframes mala-nudge {
  0% { transform: translateX(-50%); }
  40% { transform: translateX(calc(-50% + 6px)); stroke: rgba(180, 110, 40, 0.95); }
  100% { transform: translateX(-50%); }
}

/* 사찰 아이콘, 법당 메뉴, 새벽 아이콘 */
.temple-icon { width: 30px; height: 30px; object-fit: contain; margin: -4px 0; }
.hall-item img { width: 54px; height: 36px; object-fit: cover; border-radius: 8px; }
.hall-name { display: flex; flex-direction: column; line-height: 1.25; }
.hall-name em { font-style: normal; font-size: 12px; color: var(--muted); }
.time-chip { display: inline-flex; align-items: center; gap: 4px; }
.time-icon { width: 18px; height: 18px; object-fit: contain; }

/* 아래 메뉴: 그림 아이콘 */
.act-icon { height: 44px; width: auto; max-width: 84px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25)); transition: transform 0.2s; }
.act-icon:not([src]) { visibility: hidden; }
.action:hover .act-icon { transform: translateY(-2px); }
.action.active { background: rgba(255, 255, 255, 0.12); }
/* 절하기 그림은 옆으로 길어서 다른 아이콘과 크기가 비슷해 보이게 조금 작게 */
.act-icon.act-bow { height: 34px; margin-top: 10px; }
@media (max-width: 640px) { .act-icon { height: 34px; max-width: 54px; } .act-icon.act-bow { height: 26px; margin-top: 8px; } }

/* 사찰 바로가기 (링크 · QR) */
.link-panel {
  position: fixed; top: 76px; right: 16px; z-index: 32; width: min(340px, calc(100vw - 32px));
  padding: 18px 16px 14px; border-radius: 26px; text-align: center; color: #3f3128;
  background: #f6f0e4; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.link-panel[hidden] { display: none; }
.link-panel h2 { margin: 0; font-family: "Jua", "Apple SD Gothic Neo", sans-serif; font-weight: 400; font-size: 24px; }
.link-sub { margin: 4px 0 12px; font-size: 12px; color: #7d7265; }
.link-halls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: #ebe4d6; }
.link-hall { display: flex; flex-direction: column; padding: 6px 4px; border-radius: 12px; font-size: 13px; color: #6b655b; line-height: 1.2; }
.link-hall em { font-style: normal; font-size: 11px; opacity: 0.8; }
.link-hall[aria-checked="true"] { background: #4f6a5a; color: #f7f2e8; }
.link-qr { margin: 14px auto 10px; width: 200px; padding: 12px 12px 8px; border-radius: 18px; background: #fff; box-shadow: 0 4px 12px rgba(60, 45, 30, 0.12); }
.link-qr svg { display: block; width: 100%; height: auto; }
.link-qr span { display: block; margin-top: 4px; font-size: 12px; color: #5a544b; }
.link-url { display: flex; gap: 6px; }
.link-url input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 999px; border: 1px solid #d6cdbd; background: #fffdf8; font: inherit; font-size: 12px; color: #5a544b; }
.link-url button { padding: 0 14px; border-radius: 999px; background: #4f6a5a; color: #f7f2e8; font-size: 13px; }
.link-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.link-actions button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border-radius: 999px; border: 1.5px solid #c9c0b0; color: #4f6a5a; font-size: 14px; }
.link-actions button:hover, .link-url button:hover { filter: brightness(1.05); }
.link-actions .icon { width: 18px; height: 18px; }
.link-note { margin: 8px 0 0; font-size: 11px; color: #9a8f80; }

/* 언어 */
.lang-chips { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.06); }
.lang-chip { padding: 5px 14px; border-radius: 999px; font-size: 13px; color: #6b655b; }
.lang-chip[aria-checked="true"] { background: #3f4a43; color: #f4f2ec; font-weight: 600; }
.lang-btn { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }

/* 함께 있는 사람 */
button.count { color: inherit; padding: 6px 8px; border-radius: 999px; }
button.count:hover { background: rgba(255, 255, 255, 0.08); }
.people-panel {
  position: fixed; top: 76px; right: 16px; z-index: 32; width: min(300px, calc(100vw - 32px));
  max-height: min(60vh, 460px); overflow: auto; padding: 14px; border-radius: 22px;
}
.people-panel[hidden] { display: none; }
.people-panel h2 { margin: 0 4px 10px; font-size: 15px; font-weight: 600; }
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.person .face { width: 36px; height: 36px; flex: none; border-radius: 50%; object-fit: cover; background: #f6efe2; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }
.person .who { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.person .who-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.person .who strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .flag { flex: none; font-size: 16px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.person .who em { font-style: normal; font-size: 12px; color: var(--muted); }
.person .me { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #5d6b4f; color: #fff; }

/* 지장전 추모하기 */
.memorial { justify-content: center; padding: 16px; }
.memorial-card { width: min(380px, 100%); }
.memorial-photo { display: grid; place-items: center; width: 150px; aspect-ratio: 3 / 4; margin: 0 auto 12px; border-radius: 14px; border: 2px dashed #c8bda9; background: #efe7d8; overflow: hidden; cursor: pointer; }
.memorial-photo[hidden] { display: none; }
.memorial-tablet-opt { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; font-size: 14px; color: #5a4e40; cursor: pointer; }
.memorial-tablet-opt input { width: 18px; height: 18px; accent-color: #4f6a5a; }
.memorial-photo img { width: 100%; height: 100%; object-fit: cover; }
.memorial-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; color: #6b5f50; }
.memorial-pick[hidden] { display: none; }
.memorial-pick .icon { width: 30px; height: 30px; }
.memorial-input { display: block; width: 100%; margin: 0 0 8px; padding: 11px 14px; border: 1px solid #d6ccba; border-radius: 14px; background: #fffdf8; color: #3f3128; font: inherit; font-size: 15px; resize: none; user-select: text; }
.memorial-input:focus { outline: 2px solid #4f6a5a; outline-offset: 1px; }
.memorial-add { width: 100%; margin-top: 4px; }
.memorial-add:disabled { opacity: 0.45; cursor: default; }
.memorial-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.memorial-list:empty { display: none; }
.memorial-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.55); }
.memorial-item img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; border: 2px solid #3a2416; }
.memorial-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.memorial-who strong { font-size: 14px; color: #3f3128; }
.memorial-who em { font-style: normal; font-size: 12px; color: #7d7265; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memorial-go { padding: 6px 10px; border-radius: 999px; font-size: 13px; color: #f7f2e8; background: #4f6a5a; }
.memorial-del { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #8a7f70; }
.memorial-del:hover { background: rgba(0, 0, 0, 0.06); }
.memorial-del .icon { width: 16px; height: 16px; }

/* 나가기: 배웅 화면 (사홍서원) */
.exit {
  position: fixed; inset: 0; z-index: 60; overflow: hidden;
  display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(#fbe9da, #fceee1 55%, #f7e5d5);
  color: #4a3424; text-align: center;
  opacity: 0; transition: opacity 0.8s ease;
}
.exit[hidden] { display: none; }
.exit.show { opacity: 1; }
.exit-hills { position: absolute; bottom: 0; width: min(36vw, 400px); pointer-events: none; }
.exit-hills.left { left: 0; }
.exit-hills.right { right: 0; }
/* 산 그림의 위쪽과 안쪽 가장자리가 바탕에 스며들게 */
.exit-hills.left {
  -webkit-mask-image: linear-gradient(to top, #000 45%, transparent), linear-gradient(to left, transparent, #000 40%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to top, #000 45%, transparent), linear-gradient(to left, transparent, #000 40%);
  mask-composite: intersect;
}
.exit-hills.right {
  -webkit-mask-image: linear-gradient(to top, #000 45%, transparent), linear-gradient(to right, transparent, #000 40%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to top, #000 45%, transparent), linear-gradient(to right, transparent, #000 40%);
  mask-composite: intersect;
}
.exit-body { position: relative; display: flex; flex-direction: column; align-items: center; max-width: 560px; }
.exit-monk {
  width: min(480px, 86vw);
  /* 그림 가장자리가 바탕에 스며들게 */
  -webkit-mask-image: radial-gradient(ellipse 70% 72% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 72% at 50% 50%, #000 62%, transparent 100%);
}
.exit-kicker { margin: 18px 0 8px; font-size: 15px; letter-spacing: 0.6em; text-indent: 0.6em; color: #7a5d47; }
.exit-title { margin: 0 0 14px; font-family: "Jua", "Apple SD Gothic Neo", sans-serif; font-weight: 400; font-size: clamp(30px, 6vw, 44px); color: #4a2f1e; }
.exit-text { margin: 0 0 30px; font-size: clamp(16px, 3.6vw, 21px); line-height: 1.75; color: #7a5d47; }
.exit-back {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 34px 14px 22px;
  border-radius: 999px; font-size: 20px; color: #fdf3e6;
  background: linear-gradient(#7d5631, #6a4626); border: 2px solid #b48a5c;
  box-shadow: 0 8px 22px rgba(90, 55, 25, 0.28);
}
.exit-back:hover { filter: brightness(1.08); }
.exit-back img { width: 46px; height: auto; border-radius: 8px; }

/* ── 처음 여는 화면: 산사 입구 그림 ── */
.loading { background: #f6e6cf; }
.loading img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }

/* ── 입장 화면 (시안: 오늘, 마음이 머물 곳을 골라요) ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.select {
  /* 뒤의 법당 대신 산사 입구 그림을 흐릿하게 */
  background: linear-gradient(rgba(255, 244, 228, 0.25), rgba(255, 244, 228, 0.25)), url('assets/loading.webp') center 60% / cover, #f6e6cf;
}
.select::before { content: ''; position: absolute; inset: 0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.select-card {
  position: relative; width: min(1080px, 100%); padding: 26px 36px 30px; border-radius: 34px;
  color: #3b2a1e;
  background: linear-gradient(180deg, rgba(255, 251, 243, 0.94), rgba(250, 241, 226, 0.94));
  border: 1.5px solid rgba(201, 165, 118, 0.55);
  box-shadow: 0 30px 80px rgba(90, 60, 30, 0.25), inset 0 0 0 6px rgba(255, 255, 255, 0.35);
}
.lang-chips { position: absolute; top: 22px; right: 26px; margin: 0; background: rgba(120, 90, 60, 0.08); }
.lang-chip[aria-checked="true"] { background: #3f5446; }
.lotus { width: 30px; height: 20px; fill: #c99a55; }
.select-kicker { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 16px; color: #8a6a4a; letter-spacing: 0.05em; }
.select-kicker .rule { width: 70px; height: 1px; background: linear-gradient(90deg, transparent, #c9a576); }
.select-kicker .rule:last-child { background: linear-gradient(90deg, #c9a576, transparent); }
.select-card h1 { margin: 10px 0 2px; font-family: "Gowun Batang", serif; font-weight: 700; font-size: clamp(26px, 3.4vw, 40px); color: #3b2618; }
.select-ornament { margin: 0 0 18px; }
.select-ornament .lotus { width: 22px; height: 14px; }
.select-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; text-align: left; }
.select-panel { padding: 22px 22px 20px; border-radius: 26px; background: rgba(255, 252, 246, 0.75); box-shadow: inset 0 0 0 1px rgba(201, 165, 118, 0.25); }
.select-panel h2 { margin: 0 0 16px; text-align: center; font-family: "Gowun Batang", serif; font-weight: 700; font-size: clamp(19px, 2vw, 25px); color: #3b2618; }
.hall-picks { gap: 12px; margin-bottom: 20px; }
.hall-pick { position: relative; padding: 8px 8px 12px; border-radius: 18px; background: #fffdf8; border: 2px solid transparent; box-shadow: 0 4px 14px rgba(110, 80, 50, 0.08); }
.hall-pick img { aspect-ratio: 1 / 0.95; border-radius: 13px; }
.hall-pick strong { font-size: 17px; font-weight: 600; text-align: center; margin-top: 6px; }
.hall-pick em { display: none; }
.hall-pick[aria-checked="true"], .look[aria-checked="true"] { border-color: #a8763f; background: #fffaf0; }
/* 고른 것에 동그란 체크 */
.hall-pick[aria-checked="true"]::after, .look[aria-checked="true"]::after {
  content: ''; position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: #a8763f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
}
.seasons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 18px; }
.seasons-label, .select-label { grid-column: 1 / -1; display: block; margin: 0 0 2px; font-size: 16px; color: #6e5440; }
.season { height: 48px; border-radius: 999px; font-size: 16px; background: #fffdf8; border: 2px solid rgba(201, 165, 118, 0.25); }
.season[aria-checked="true"] { border-color: #a8763f; background: #fffaf0; font-weight: 600; }
.select-name { margin: 0; align-items: stretch; }
.select-name .select-label { margin-bottom: 8px; }
.name-field { width: 100%; height: 52px; padding: 4px 8px 4px 18px; background: #fffdf8; border: 1.5px solid rgba(201, 165, 118, 0.35); }
.name-field input { font-size: 17px; }
.name-hint { display: none; }
.looks { gap: 16px; }
.look { position: relative; padding: 10px 10px 16px; background: #fffdf8; border-radius: 22px; font-size: 18px; box-shadow: 0 4px 14px rgba(110, 80, 50, 0.08); }
.looks .look img { aspect-ratio: 3 / 4.6; object-fit: contain; object-position: 50% 50%; background: #fdf8ec; }
.enter {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  width: min(760px, 100%); height: 64px; margin: 22px auto 0; border-radius: 999px;
  font-size: 22px; font-weight: 600; color: #fdf3e6;
  background: linear-gradient(#7a5332, #5e3e22); border: 2px solid #b48a5c;
  box-shadow: 0 10px 24px rgba(90, 55, 25, 0.3);
}
.enter img { width: 46px; border-radius: 8px; }
.enter:hover { filter: brightness(1.08); }

/* 고른 법당 설명 카드: 법당을 바꾸면 한 바퀴 돌며 바뀐다 */
.hall-about {
  margin: -6px 0 18px; padding: 14px 18px; border-radius: 18px; text-align: left;
  background: #fffaf0; border: 1.5px solid rgba(168, 118, 63, 0.35); box-shadow: 0 4px 14px rgba(110, 80, 50, 0.08);
  transform-origin: 50% 50%; perspective: 600px;
}
.hall-about-head { margin: 0 0 6px; font-family: "Gowun Batang", serif; font-size: 17px; color: #3b2618; }
.hall-about-name { font-weight: 700; }
.hall-about-dot { margin: 0 6px; color: #b48a5c; }
.hall-about-deity { font-weight: 700; color: #8a5a2e; }
.hall-about-text { margin: 0; font-size: 15px; line-height: 1.6; color: #5c4634; word-break: keep-all; }
.hall-about.flip-out { animation: about-out 0.22s ease-in forwards; }
.hall-about.flip-in { animation: about-in 0.32s ease-out; }
@keyframes about-out { to { transform: perspective(600px) rotateY(90deg); opacity: 0.3; } }
@keyframes about-in { from { transform: perspective(600px) rotateY(-90deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hall-about.flip-out, .hall-about.flip-in { animation: none; } }

/* 휴대폰: 한 줄로 쌓는다 */
@media (max-width: 760px) {
  .select { padding: 10px; }
  .select-card { padding: 18px 14px 18px; border-radius: 26px; }
  .lang-chips { position: static; margin-bottom: 8px; }
  .select-kicker .rule { width: 34px; }
  .select-grid { grid-template-columns: 1fr; gap: 12px; }
  .select-panel { padding: 16px 14px; }
  .hall-picks { gap: 8px; margin-bottom: 14px; }
  .hall-pick strong { font-size: 14px; }
  .hall-about { margin: -4px 0 14px; padding: 12px 14px; }
  .hall-about-head { font-size: 15px; }
  .hall-about-text { font-size: 13.5px; }
  .seasons { gap: 6px; }
  .season { height: 40px; font-size: 14px; }
  .looks .look img { aspect-ratio: 3 / 4.2; }
  .enter { height: 56px; font-size: 19px; margin-top: 14px; }
}
/* 오른쪽 모습 칸: 그림이 칸 높이를 채우게 */
@media (min-width: 761px) {
  .select-grid > .select-panel:last-child { display: flex; flex-direction: column; }
  .select-grid > .select-panel:last-child .looks { flex: 1; min-height: 0; }
  .look { height: 100%; }
  .looks .look img { flex: 1; min-height: 0; aspect-ratio: auto; object-fit: contain; object-position: 50% 50%; }
}
.name-field input { text-align: left; }
/* 세로 화면(휴대폰): 그림 속 글이 잘리지 않게 그림 전체를 보이고, 남는 위아래는 같은 그림을 흐리게 깐다 */
@media (max-aspect-ratio: 1/1) {
  .loading::before { content: ''; position: absolute; inset: -20px; background: url('assets/loading.webp') center / cover; filter: blur(14px) brightness(1.05); }
  .loading img { object-fit: contain; object-position: center; }
}
@media (max-width: 760px) {
  .select-card h1 { font-size: 23px; word-break: keep-all; }
  .season { white-space: nowrap; font-size: 13px; padding: 0 4px; letter-spacing: -0.02em; }
  .looks .look img { aspect-ratio: 3 / 4.2; }
}

/* 노래(삼귀의·사홍서원) 끄기·크기: 입장 화면 왼쪽 위, 나가기 화면 오른쪽 위 */
.song-ctl {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(120, 90, 60, 0.08); color: #6e5440;
}
.select-card .song-ctl { position: absolute; top: 20px; left: 24px; }
.exit .song-ctl { position: absolute; top: 18px; right: 18px; z-index: 1; background: rgba(255, 255, 255, 0.55); }
.song-toggle { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fffdf8; color: #6e5440; box-shadow: 0 1px 3px rgba(90, 60, 30, 0.15); }
.song-toggle .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.song-toggle .off, .song-ctl.off .song-toggle .on { display: none; }
.song-ctl.off .song-toggle .off { display: block; }
.song-ctl.off .song-volume { opacity: 0.4; }
.song-volume { width: 90px; accent-color: #8a6440; }
@media (max-width: 760px) {
  .select-card .song-ctl { position: static; margin: 0 6px 8px 0; }
  .select-card .lang-chips { display: inline-flex; vertical-align: top; }
  .song-volume { width: 70px; }
}

.memorial-list-hint { margin: 16px 4px 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: #4f6a5a; background: rgba(79, 106, 90, 0.1); text-align: left; }
.memorial-list-hint[hidden] { display: none; }
.memorial-list-hint b { color: #3f5446; }
.memorial-list-hint + .memorial-list { margin-top: 8px; }

.memorial-check { flex: none; width: 20px; height: 20px; accent-color: #4f6a5a; cursor: pointer; }
.memorial-together { width: 100%; margin-top: 10px; height: 48px; font-size: 15px; }
.memorial-together[hidden] { display: none; }
.memorial-together:disabled { opacity: 0.5; cursor: default; background: #8a978e; border-color: #8a978e; }

/* 브라우저가 노래를 막았을 때: 스피커가 숨 쉬듯 반짝이고 '눌러서 삼귀의 듣기' */
.song-hint { display: none; font-size: 12px; color: #8a6440; white-space: nowrap; }
.song-ctl.blocked .song-hint { display: inline; }
.song-ctl.blocked .song-volume { display: none; }
.song-ctl.blocked .song-toggle { animation: song-pulse 1.6s ease-in-out infinite; }
@keyframes song-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 118, 63, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(168, 118, 63, 0); }
}
/* 휴대폰: 입장 카드가 길어 스크롤되어도 '마음, 잠시 쉬어가기'는 늘 아래에 보이게 */
@media (max-width: 760px) {
  .enter { position: sticky; bottom: 0; z-index: 2; }
  .select-card { padding-bottom: 12px; }
}

/* ── 휴대폰 위쪽 줄 정리 ──
   1줄: 왼쪽 법당 이름(길면 …) / 오른쪽 작은 아이콘들
   2줄: 왼쪽 새벽·낮·저녁 / 오른쪽 염불·목탁
   3줄: 오른쪽 배경음악 */
@media (max-width: 640px) {
  .hud { top: 10px; }
  .hud-left { left: 8px; gap: 6px; padding: 6px 10px; font-size: 14px; max-width: calc(100vw - 236px); }
  .hud-left #hall-btn strong, .hud-left .divider, .hud-left .clock { display: none; }
  .hud-left #hall-btn { gap: 2px; flex: none; }
  .hud-left .temple-icon { width: 22px; height: 22px; }
  .hud-left #room-btn { min-width: 0; gap: 2px; }
  .hud-left #room-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 13px; }
  .hud-right { right: 8px; gap: 8px; }
  .toolbar { gap: 0; padding: 3px 4px 3px 10px; }
  .toolbar .icon-btn { width: 32px; height: 32px; }
  .toolbar .icon { width: 18px; height: 18px; }
  .count { margin-right: 2px; font-size: 13px; gap: 3px; }
  .time-of-day { top: 56px; left: 8px; }
  .time-chip { padding: 5px 7px; font-size: 12px; }
  .time-icon { width: 15px; height: 15px; }
  .sound-row { gap: 4px; }
  .sound-toggle { padding: 7px 10px; font-size: 12px; gap: 5px; }
  .sound.active .sound-volume { width: 60px; margin-right: 10px; }
  .nature-bar { font-size: 12px; }
}

/* 개인기도 · 추모 중: 켜진 버튼 위에 '다시 누르면 나가요' 말풍선 */
.action { position: relative; }
.action[data-action="pray"].active::before,
.action[data-action="memorial"].active::before {
  content: attr(data-exit);
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: #fdf6e6;
  background: rgba(93, 107, 79, 0.92); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  animation: exit-hint 2.4s ease-in-out infinite; pointer-events: none;
}
.action[data-action="pray"].active::after,
.action[data-action="memorial"].active::after {
  content: ''; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: rgba(93, 107, 79, 0.92); border-bottom: 0;
  animation: exit-hint 2.4s ease-in-out infinite; pointer-events: none;
}
@keyframes exit-hint { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@media (max-width: 640px) {
  .action[data-action="pray"].active::before,
  .action[data-action="memorial"].active::before { font-size: 11px; padding: 4px 9px; }
}

/* 개인 기도: 기원 적기 창 */
.wish-input { font-family: "Gowun Dodum", "Apple SD Gothic Neo", sans-serif; font-size: 16px; line-height: 1.5; }
.wish-count { margin: -2px 4px 12px; text-align: right; font-size: 12px; color: #9a8f80; }
.wish-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wish-actions .capture-btn { padding: 0 8px; }
.wish-actions .capture-btn:disabled { opacity: 0.45; cursor: default; }

/* 기도하는 동안 걸어 두는 기원지: 끈에 매단 한지 (사진처럼 연꽃 · 세로 글 · 아래 잎) */
.wish-tag {
  position: fixed; z-index: 9; top: 190px; right: max(4vw, 24px);
  display: flex; flex-direction: column; align-items: center;
  width: 132px; height: 440px; padding: 22px 12px 14px; border-radius: 3px;
  color: #3a2f27; cursor: pointer; transform-origin: 50% -40px;
  background-color: #f5eedd;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.47 0 0 0 0 0.36 0 0 0 0.13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 50% 40%, rgba(255, 252, 242, 0.9), rgba(230, 218, 192, 0.6));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 0 18px rgba(170, 145, 105, 0.18);
}
.wish-tag[hidden] { display: none; }
.wish-tag { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.wish-tag.dragging { cursor: grabbing; animation: none; box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35); }
/* 기원지 내리기 (X) */
.wish-tag-close {
  position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(63, 49, 40, 0.85); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0.85; transition: opacity 0.2s, background 0.2s;
}
.wish-tag-close:hover { background: #8a3b2e; }
.wish-tag-close svg { width: 12px; height: 12px; fill: none; stroke: #f7f2e8; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .wish-tag-close { opacity: 0; } .wish-tag:hover .wish-tag-close { opacity: 0.9; } }
/* 크기 바꾸는 모서리 손잡이 */
.wish-tag-resize {
  position: absolute; right: -10px; bottom: -10px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; cursor: nwse-resize;
  background: rgba(79, 106, 90, 0.92); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0.85; transition: opacity 0.2s;
}
.wish-tag-resize svg { width: 14px; height: 14px; fill: none; stroke: #f7f2e8; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .wish-tag-resize { opacity: 0; } .wish-tag:hover .wish-tag-resize, .wish-tag.dragging .wish-tag-resize { opacity: 0.9; } }
/* 매단 끈 */
.wish-tag::before {
  content: ''; position: absolute; left: 50%; bottom: 100%; width: 2px; height: 40px; transform: translateX(-50%);
  background: repeating-linear-gradient(#a98b66 0 3px, #8a6d4c 3px 6px);
}
.wish-tag-hole { position: absolute; top: 9px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: #c9b98f; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35); }
.wish-tag-lotus { width: 62px; height: 42px; flex: none; margin: 6px 0 10px; }
.wish-tag-leaves { position: absolute; left: 8px; bottom: 8px; width: 56px; height: 38px; opacity: 0.9; }
.wish-tag-text {
  flex: 1; min-height: 0; margin-bottom: 30px;
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: "Gowun Dodum", "Apple SD Gothic Neo", sans-serif; font-size: 23px; line-height: 1.75; letter-spacing: 0.08em;
  overflow: hidden; word-break: keep-all;
}
.wish-tag.horizontal .wish-tag-text { writing-mode: horizontal-tb; font-size: 17px; line-height: 1.5; letter-spacing: 0; text-align: center; padding-top: 10px; }
.wish-tag.hung { animation: wish-hang 0.9s cubic-bezier(0.2, 0.8, 0.3, 1), wish-sway 6s ease-in-out 0.9s infinite; }
@keyframes wish-hang { from { opacity: 0; transform: translateY(-30px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes wish-sway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.6deg); } }
@media (prefers-reduced-motion: reduce) { .wish-tag.hung { animation: none; } }
@media (max-width: 640px) {
  .wish-tag { top: 214px; right: 14px; width: 84px; height: 290px; padding: 16px 7px 10px; }
  .wish-tag::before { height: 26px; }
  .wish-tag-hole { top: 6px; width: 8px; height: 8px; margin-left: -4px; }
  .wish-tag-lotus { width: 42px; height: 28px; margin: 4px 0 6px; }
  .wish-tag-leaves { width: 38px; height: 26px; left: 5px; bottom: 5px; }
  .wish-tag-text { font-size: 16px; margin-bottom: 20px; }
  .wish-tag.horizontal .wish-tag-text { font-size: 12.5px; }
}

/* 선택 가입 (입장 화면 이름 칸 아래) */
.account { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.account-text { margin: 0; font-size: 12px; color: #8a8478; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.account-btn {
  padding: 7px 14px; border-radius: 999px; border: 1.5px solid rgba(201, 165, 118, 0.45);
  background: #fffdf8; color: #3f3128; font: inherit; font-size: 13px; cursor: pointer;
}
.account-btn:hover { border-color: #3f4a43; }
.account-btn:disabled { opacity: 0.6; cursor: default; }
.account-link { padding: 0; border: 0; background: none; color: #7a7468; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
.account-link.danger { color: #9a4a3a; }

/* 시점 바꾸기 (3인칭 ↔ 1인칭): 아래 메뉴 바로 위 오른쪽 */
.view-btn {
  position: fixed; right: 16px; bottom: calc(24px + 104px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px;
  font-size: 13px; cursor: pointer;
}
.view-btn .icon { width: 18px; height: 18px; }
.view-btn[hidden] { display: none; }

/* 휴대폰 이동용 엄지 조이스틱: 아래 메뉴 바로 위 왼쪽 */
.joystick {
  position: fixed; left: 18px; bottom: calc(24px + 96px + env(safe-area-inset-bottom)); z-index: 10;
  width: 134px; height: 134px; border-radius: 50%;
  background: rgba(255, 250, 240, 0.16); border: 1.5px solid rgba(255, 250, 240, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.joystick[hidden] { display: none; }
.joystick.active { background: rgba(255, 250, 240, 0.26); }
/* 끝까지 밀어 빨리 걷는 중: 테두리가 밝아진다 */
.joystick.run { border-color: rgba(255, 244, 214, 0.95); box-shadow: 0 0 14px rgba(255, 236, 190, 0.45); }
.joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%;
  background: rgba(255, 250, 240, 0.85); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.joystick:not(.active) .joystick-knob { transition: transform 0.15s ease-out; }

/* 휴대폰: 소리 버튼들은 '🎵 소리' 하나로 접어 둔다 */
.sounds-btn { display: none; }
@media (max-width: 640px) {
  .sounds-btn { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; }
  .hud-right:not(.sounds-open) .sound-row,
  .hud-right:not(.sounds-open) .nature-bar { display: none; }
  .sounds-open .sounds-btn { background: rgba(255, 250, 240, 0.9); color: #3f3128; }
  .view-btn { right: 10px; bottom: calc(24px + 84px + env(safe-area-inset-bottom)); padding: 8px 12px; }
  .joystick { left: 14px; bottom: calc(24px + 84px + env(safe-area-inset-bottom)); }
}

/* 가로로 눕힌 휴대폰 (화면 높이가 낮을 때): 아래 메뉴를 작게, 조이스틱·시점 버튼은 양쪽 아래 구석으로 */
@media (max-height: 500px) {
  .actions { bottom: calc(8px + env(safe-area-inset-bottom)); gap: 2px; padding: 4px 8px; width: auto; }
  .action { width: 62px; padding: 5px 0; gap: 2px; font-size: 11px; white-space: nowrap; }
  .act-icon { height: 28px; max-width: 46px; }
  .act-icon.act-bow { height: 22px; margin-top: 6px; }
  .sounds-btn { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; }
  .hud-right:not(.sounds-open) .sound-row,
  .hud-right:not(.sounds-open) .nature-bar { display: none; }
  .sounds-open .sounds-btn { background: rgba(255, 250, 240, 0.9); color: #3f3128; }
  .view-btn { right: calc(12px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); padding: 8px 12px; }
  .joystick { left: calc(14px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom)); width: 116px; height: 116px; }
}

/* 내 모습 버튼: 시점 버튼 바로 위 */
.avatar-btn { bottom: calc(24px + 150px + env(safe-area-inset-bottom)); }
.avatar-btn:disabled { opacity: 0.5; }
@media (max-width: 640px) {
  .avatar-btn { right: 10px; bottom: calc(24px + 128px + env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) {
  .avatar-btn { right: calc(12px + env(safe-area-inset-right)); bottom: calc(54px + env(safe-area-inset-bottom)); }
}

/* 내 모습 창: 모습(남/여)과 이름 바꾸기 */
.avatar-panel {
  position: fixed; left: 50%; top: 50%; z-index: 32; transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 16px; border-radius: 22px; color: var(--text);
}
.avatar-panel[hidden] { display: none; }
.avatar-panel h2 { margin: 0 4px 12px; font-size: 16px; font-weight: 600; text-align: center; }
.avatar-looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.avatar-look {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 16px;
  color: inherit; font-size: 14px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; cursor: pointer;
}
.avatar-look img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #f6efe2; }
.avatar-look[aria-checked="true"] { border-color: var(--accent); background: rgba(233, 201, 106, 0.14); font-weight: 600; }
.avatar-name { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.avatar-name-field { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 12px; border-radius: 14px; background: #fffdf8; }
/* 16px 이상이어야 아이폰이 글을 쓸 때 화면을 확대하지 않는다 */
.avatar-name-field input { flex: 1; min-width: 0; height: 38px; border: 0; background: none; color: #3f3128; font: inherit; font-size: 16px; outline: none; user-select: text; }
.avatar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.avatar-actions button { height: 44px; border-radius: 999px; font-size: 15px; color: var(--text); background: rgba(255, 255, 255, 0.1); cursor: pointer; }
.avatar-actions .primary { background: var(--accent); color: #2a2218; font-weight: 600; }

/* 염주 소리 끄기 (염주 창 오른쪽 위) */
.mala-sound {
  position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); background: rgba(255, 255, 255, 0.12); cursor: pointer;
}
.mala-sound .icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mala-sound .off, .mala-sound.off .on { display: none; }
.mala-sound.off .off { display: block; }
.mala-sound.off { background: rgba(255, 255, 255, 0.28); }
/* 작게 줄인 염주 창 (휴대폰에서 120px까지) */
.mala-panel.small { padding: 6px 6px 10px; border-radius: 18px; }
.mala-panel.small canvas { border-radius: 12px; }
.mala-panel.small .mala-drag { margin: -2px 0 2px; }
.mala-panel.small .mala-count { margin-top: 4px; }
.mala-panel.small .mala-count strong { font-size: 17px; }
.mala-panel.small .mala-count span, .mala-panel.small .mala-count em { font-size: 10px; }
.mala-panel.small .mala-sound { top: 3px; right: 4px; width: 24px; height: 24px; }
.mala-panel.small .mala-sound .icon { width: 14px; height: 14px; }
/* 손가락으로 잡기 쉽게 크기 조절 손잡이를 크게 */
@media (pointer: coarse) {
  .mala-resize { right: 2px; bottom: 2px; width: 30px; height: 30px; background-size: 18px 18px; background-position: right 4px bottom 4px; background-repeat: no-repeat; }
}

/* 입장 화면: 어떤 폭의 휴대폰에서도 옆으로 넘치지 않게 칸들이 화면에 맞춰 줄어든다 */
.select-card { overflow-x: hidden; overflow-y: auto; }
.select-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.select-grid > * { min-width: 0; }
.hall-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seasons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hall-pick, .season, .look { min-width: 0; }
.hall-pick strong { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .select-grid { grid-template-columns: minmax(0, 1fr); }
}
/* 아주 좁은 휴대폰 (360px 이하) */
@media (max-width: 360px) {
  .select { padding: 6px; }
  .select-card { padding: 14px 10px; border-radius: 22px; }
  .select-panel { padding: 12px 10px; border-radius: 20px; }
  .select-card h1 { font-size: 21px; }
  .select-kicker .rule { display: none; }
  .hall-picks { gap: 6px; }
  .hall-pick { padding: 6px 6px 8px; border-radius: 14px; }
  .hall-pick strong { font-size: 12.5px; }
  .hall-pick[aria-checked="true"]::after, .look[aria-checked="true"]::after { top: 8px; right: 8px; width: 24px; height: 24px; }
  .seasons { gap: 4px; }
  .season { font-size: 12px; padding: 0 2px; }
  .song-volume { width: 56px; }
  .enter { font-size: 17px; gap: 10px; }
  .enter img { width: 38px; }
}
