:root {
  --ivory: #f6ecd9;
  --muted: #c9bca5;
  --accent: #e9c07a;
  --accent-soft: rgba(233, 192, 122, 0.18);
  --ink: #0a0f16;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #070b11;
  color: var(--ivory);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; overflow: hidden; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 42%, rgba(0, 0, 0, 0) 42%, rgba(3, 6, 11, 0.52) 100%),
    linear-gradient(to bottom, rgba(3, 6, 11, 0.35), rgba(3, 6, 11, 0) 22%, rgba(3, 6, 11, 0) 72%, rgba(3, 6, 11, 0.45));
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
}
.hud > * { pointer-events: auto; }

.glass {
  /* WebGL 캔버스 위에 20px 블러를 얹으면 아이폰 웹뷰가 매 프레임 캔버스를 다시 읽어
     흐리는 합성 패스를 하나 더 돌린다 — 화면이 주기적으로 끊기던 원인 중 하나였다.
     배경을 조금 더 진하게 하고 블러는 8px로 낮춰 같은 유리 느낌을 훨씬 싼 값에 낸다. */
  background: linear-gradient(180deg, rgba(44, 52, 66, 0.74), rgba(16, 22, 31, 0.78));
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

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

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.space-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 15px 0 13px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ivory);
  white-space: nowrap;
}
.space-btn:active { transform: scale(0.97); }
.space-btn .chev { font-size: 10px; opacity: 0.7; margin-left: 1px; }

.top-right { display: flex; gap: 8px; }

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  color: var(--ivory);
  transition: background 0.2s, box-shadow 0.2s;
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(233, 192, 122, 0.34), rgba(140, 98, 44, 0.34));
  box-shadow: 0 0 0 1px rgba(233, 192, 122, 0.55), 0 0 18px rgba(233, 192, 122, 0.3);
}

.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #241a0b;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.toast {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 100px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  max-width: 88vw;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(10, 14, 21, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  color: #f2e5cd;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 6;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------ 함께 머무는 이들 ------------------------------ */
.live-badge {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f3e7d2;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.45s ease, transform 0.45s ease, box-shadow 0.4s ease;
}
.live-badge.on { opacity: 1; transform: translateY(0); }
.live-badge:active { transform: scale(0.97); }
.live-badge .live-flame {
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(233, 192, 122, 0.5));
}
.live-badge.crowded {
  border-color: rgba(233, 192, 122, 0.5);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.34), 0 0 18px rgba(233, 192, 122, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.greet-btn {
  position: absolute;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #f6ead4;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.4s ease;
  pointer-events: none;
}
.greet-btn.on { opacity: 1; transform: scale(1); pointer-events: auto; }
.greet-btn:active { transform: scale(0.94); }
.greet-btn .greet-ico { font-size: 22px; line-height: 1; }
.greet-btn .greet-lbl { font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; color: #f0e2c8; }
.greet-btn.ring { animation: greetPulse 2.8s ease-in-out infinite; }
@keyframes greetPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(233, 192, 122, 0); }
  50% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 7px rgba(233, 192, 122, 0.1); }
}
#app.is-praying .greet-btn,
#app.is-rosary .greet-btn,
#app.is-sheet .greet-btn {
  opacity: 0;
  pointer-events: none;
}
.sheet-body .person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
}
.sheet-body .person:last-child { border-bottom: 0; }
.sheet-body .person small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sheet-body .person.me span:first-child { color: #ffdfa8; }
.sheet-body .sheet-lead {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.chip {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 154px);
  transform: translateX(-50%) translateY(10px) scale(0.96);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px 11px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff5e4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  white-space: nowrap;
}
.chip.on { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); pointer-events: auto; }
.chip:active { transform: translateX(-50%) scale(0.97); }
.chip-go {
  font-size: 10px;
  font-weight: 700;
  color: #241a0b;
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 7px;
  margin-left: 2px;
}

.prayer-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 158px);
  padding: 15px 17px 16px;
  border-radius: 22px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s, transform 0.5s;
}
.prayer-card.on { opacity: 1; transform: translateY(0); }
#app.is-praying .prayer-card { bottom: calc(env(safe-area-inset-bottom, 0px) + 172px); }
.prayer-card .prayer-cross { display: block; font-size: 13px; color: var(--accent); margin-bottom: 6px; opacity: 0.85; }
.prayer-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: #f4e8d4;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

/* ------------------------- 십자가의 길 묵상 카드 ------------------------- */
.medi-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 158px);
  padding: 16px 18px 13px;
  border-radius: 22px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s, transform 0.45s;
}
.medi-card.on { opacity: 1; transform: translateY(0); }
.medi-card .medi-cross { display: block; font-size: 12px; color: var(--accent); opacity: 0.85; margin-bottom: 5px; pointer-events: none; }
.medi-title { pointer-events: none; }
.medi-text { pointer-events: none; }
.medi-foot { pointer-events: none; }
.medi-title {
  margin: 0 0 7px;
  padding-right: 26px;
  font-family: ui-serif, Georgia, "Nanum Myeongjo", serif;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.36;
  color: #ffe9c2;
  letter-spacing: -0.01em;
  word-break: keep-all;
}
.medi-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.72;
  color: #f1e6d4;
  white-space: pre-line;
  letter-spacing: -0.01em;
  word-break: keep-all;
}
.medi-foot { display: block; margin-top: 9px; font-size: 10.5px; color: var(--muted); }
.medi-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  color: #e8dcc6;
  background: rgba(255, 255, 255, 0.12);
}
#app.is-medi .vignette {
  background:
    radial-gradient(120% 92% at 50% 40%, rgba(0, 0, 0, 0) 34%, rgba(3, 6, 11, 0.72) 100%),
    linear-gradient(to bottom, rgba(3, 6, 11, 0.5), rgba(3, 6, 11, 0) 24%, rgba(3, 6, 11, 0) 66%, rgba(3, 6, 11, 0.6));
}
#app.is-medi .joystick { opacity: 0; pointer-events: none; }
#app.is-blessing .joystick { opacity: 0.35; }

.candle-input {
  width: 100%;
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 13px;
  color: #f6ecd9;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.candle-input::placeholder { color: rgba(233, 224, 206, 0.55); }
.candle-input:focus { border-color: rgba(233, 192, 122, 0.6); }
.candle-past { margin-bottom: 2px; color: #ffdfa8; }

/* ------------------------------- rosary -------------------------------- */
.rosary-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  padding: 13px 16px 15px;
  border-radius: 22px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.32s ease, transform 0.32s ease;
}
.rosary-panel.on { opacity: 1; transform: translateY(0); }
.rosary-panel.done {
  border-color: rgba(233, 192, 122, 0.55);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4), 0 0 26px rgba(233, 192, 122, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.rosary-top { display: flex; align-items: center; gap: 8px; }
.rosary-title {
  font-family: ui-serif, Georgia, "Nanum Myeongjo", serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffe9c2;
  white-space: nowrap;
}
.rosary-count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rosary-close {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #e6d7bd;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.rosary-close:active { transform: scale(0.96); }
.rosary-guide {
  margin: 8px 0 11px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #ecdfc8;
  word-break: keep-all;
}
.rosary-beads { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 0 2px; }
.rosary-beads .bead {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.rosary-beads .bead.now { border-color: rgba(233, 192, 122, 0.8); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(233, 192, 122, 0.12); }
.rosary-beads .bead.lit {
  background: radial-gradient(circle at 34% 30%, #fff7e4, #f2c67f 55%, #c08a3e);
  border-color: rgba(255, 232, 190, 0.85);
  box-shadow: 0 0 10px rgba(255, 205, 126, 0.75), inset 0 -1px 2px rgba(120, 80, 30, 0.45);
  transform: scale(1.12);
  animation: beadPop 0.42s ease-out;
}
@keyframes beadPop {
  0% { transform: scale(0.72); box-shadow: 0 0 0 rgba(255, 205, 126, 0); }
  55% { transform: scale(1.3); box-shadow: 0 0 16px rgba(255, 215, 150, 0.9); }
  100% { transform: scale(1.12); }
}
.rosary-next {
  margin-top: 13px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #2a1d0c;
  background: linear-gradient(180deg, #f4d49a, #dcae66);
  box-shadow: 0 8px 20px rgba(196, 146, 72, 0.28);
  transition: transform 0.12s, filter 0.18s;
}
.rosary-next:active { transform: scale(0.985); filter: brightness(0.97); }
.rosary-hint { display: block; margin-top: 8px; font-size: 10.5px; color: #a89b86; text-align: center; letter-spacing: -0.01em; }
#app.is-rosary .joystick { opacity: 0; pointer-events: none; visibility: hidden; }

.joystick {
  position: absolute;
  left: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(30, 38, 52, 0.62), rgba(12, 17, 25, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.13);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.35);
  touch-action: none;
  transition: opacity 0.3s ease;
}
/* While praying or with a sheet open the joystick is out of the way,
   so the prayer text is never covered. */
#app.is-praying .joystick,
#app.is-sheet .joystick {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.stick {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgba(255, 250, 238, 0.95), rgba(233, 192, 122, 0.7) 55%, rgba(150, 110, 54, 0.65));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42), inset 0 -2px 6px rgba(120, 84, 34, 0.5);
  will-change: transform;
}
.joy-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(246, 236, 217, 0.35);
}
.joy-dot.up { top: 9px; }
.joy-dot.down { bottom: 9px; }
.joy-dot.left { left: 9px; }
.joy-dot.right { right: 9px; }

.action-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  height: 70px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 6px;
  border-radius: 24px;
}
.action-bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f2e6d2;
  transition: background 0.18s, color 0.18s, opacity 0.18s, transform 0.12s;
}
.action-bar button .ico { font-size: 20px; line-height: 1; filter: saturate(0.95); }
.action-bar button:active { transform: scale(0.96); }
.action-bar button.active {
  background: linear-gradient(180deg, rgba(233, 192, 122, 0.24), rgba(233, 192, 122, 0.1));
  box-shadow: inset 0 0 0 1px rgba(233, 192, 122, 0.55), 0 0 18px rgba(233, 192, 122, 0.2);
  color: #ffe7b9;
}
/* 자동으로 걸어가는 중 — 한 번 더 누르면 멈춘다는 표시 */
.action-bar button.going {
  background: linear-gradient(180deg, rgba(233, 192, 122, 0.34), rgba(233, 192, 122, 0.14));
  color: #fff0cd;
  animation: goingPulse 1.7s ease-in-out infinite;
}
@keyframes goingPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(233, 192, 122, 0.55), 0 0 12px rgba(233, 192, 122, 0.16); }
  50% { box-shadow: inset 0 0 0 1px rgba(233, 192, 122, 0.82), 0 0 24px rgba(233, 192, 122, 0.34); }
}
.action-bar button:disabled { opacity: 0.32; }

.fade {
  position: absolute;
  inset: 0;
  background: #05080d;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.42s ease;
  z-index: 20;
}
.fade.on { opacity: 1; pointer-events: auto; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  background: rgba(3, 6, 11, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.26s;
}
.sheet-backdrop.on { opacity: 1; }
.sheet {
  width: 100%;
  max-height: 80%;
  overflow-y: auto;
  padding: 8px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  border-radius: 26px 26px 0 0;
  transform: translateY(24px);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: linear-gradient(180deg, rgba(38, 46, 60, 0.92), rgba(14, 19, 27, 0.94));
}
.sheet-backdrop.on .sheet { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  margin: 4px auto 12px;
}
.sheet h2 {
  margin: 0 0 10px;
  font-family: ui-serif, Georgia, "Nanum Myeongjo", serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fbf1dd;
}
.sheet-body {
  font-size: 14px;
  line-height: 1.72;
  color: #e7dac4;
  white-space: pre-line;
  word-break: keep-all;
}
.sheet-body .record {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
}
.sheet-body .record span:first-child { color: var(--muted); font-size: 12.5px; }
.sheet-body .record .candle-left-time {
  font-style: normal;
  margin-left: 8px;
  font-size: 11.5px;
  color: rgba(255, 214, 160, 0.82);
}
.sheet-body .empty { color: var(--muted); text-align: center; padding: 22px 0; }
.sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.sheet-actions button {
  flex: 1;
  min-width: 110px;
  padding: 13px 14px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.12s, filter 0.15s;
}
.sheet-actions button:active { transform: scale(0.98); }
.sheet-actions .primary {
  background: linear-gradient(180deg, #f0c986, #d6a45c);
  color: #2a1d0c;
  box-shadow: 0 8px 20px rgba(196, 146, 72, 0.3);
}
.sheet-actions .ghost {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eadfc9;
}
.space-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.space-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.space-item .space-ico { font-size: 22px; }
.space-item .space-txt { display: flex; flex-direction: column; gap: 2px; }
.space-item strong { font-size: 14.5px; font-weight: 700; color: #f8eeda; }
.space-item small { font-size: 11.5px; color: var(--muted); }
.space-item.current {
  background: linear-gradient(180deg, rgba(233, 192, 122, 0.22), rgba(233, 192, 122, 0.06));
  border-color: rgba(233, 192, 122, 0.5);
}
.space-item .now { margin-left: auto; font-size: 11px; color: #ffdfa8; font-weight: 700; }
.sheet-foot { display: block; margin-top: 14px; text-align: center; font-size: 11px; letter-spacing: 0.04em; }
.sheet-foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid rgba(141, 134, 120, 0.4); padding-bottom: 1px; }
.sheet-foot a:hover { color: #ffdfa8; border-color: rgba(255, 223, 168, 0.5); }

.loading {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 100% at 50% 40%, #101827, #05080d 70%);
  transition: opacity 0.8s ease, visibility 0.8s;
}
.loading.off { opacity: 0; visibility: hidden; }
.loading-inner { text-align: center; }
.loading-cross {
  font-size: 40px;
  color: var(--accent);
  animation: breathe 2.6s ease-in-out infinite;
  margin-bottom: 14px;
}
.loading h1 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #f6ecd9;
  text-indent: 0.22em;
}
.loading p { margin: 0 0 10px; font-size: 15px; letter-spacing: 0.06em; color: #f2e6d0; }
.loading span { font-size: 11.5px; color: #8d8678; letter-spacing: 0.08em; }
@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.96); text-shadow: 0 0 18px rgba(233, 192, 122, 0.25); }
  50% { opacity: 1; transform: scale(1.03); text-shadow: 0 0 34px rgba(233, 192, 122, 0.55); }
}
@keyframes sheetUp { from { opacity: 0; } to { opacity: 1; } }

.error-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
  color: #e9dcc4;
  background: #0a0f16;
  z-index: 60;
}

@media (min-width: 760px) {
  .hud {
    left: 50%;
    right: auto;
    width: min(560px, 100vw);
    transform: translateX(-50%);
  }
  .prayer-card { left: 24px; right: 24px; }
  .medi-card { left: 24px; right: 24px; }
}

@media (max-height: 640px) {
  .joystick { width: 92px; height: 92px; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); }
  .greet-btn { width: 56px; height: 56px; bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); }
  .stick { width: 40px; height: 40px; }
  .action-bar { height: 62px; }
  .chip { bottom: calc(env(safe-area-inset-bottom, 0px) + 142px); }
  .prayer-card { bottom: calc(env(safe-area-inset-bottom, 0px) + 146px); }
  #app.is-praying .prayer-card { bottom: calc(env(safe-area-inset-bottom, 0px) + 150px); }
  .medi-card { bottom: calc(env(safe-area-inset-bottom, 0px) + 140px); padding: 12px 15px 11px; }
  .medi-text { font-size: 12.2px; line-height: 1.62; }
  .rosary-panel { bottom: calc(env(safe-area-inset-bottom, 0px) + 82px); padding: 11px 14px 12px; }
  .rosary-beads .bead { width: 13px; height: 13px; }
  .rosary-guide { margin: 6px 0 9px; font-size: 12px; }
  .rosary-next { margin-top: 10px; padding: 10px; }
}
