:root {
  --ink: #f7f2e8;
  --ink-dim: rgba(247, 242, 232, 0.72);
  --ink-faint: rgba(247, 242, 232, 0.5);
  --gold: #ffc871;
  --gold-deep: #ff9d3c;
  --glass: rgba(16, 18, 48, 0.5);
  --glass-strong: rgba(13, 14, 38, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --serif: 'Gowun Batang', 'Nanum Myeongjo', 'AppleMyungjo', serif;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #05071a;
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

/* ---------- 머리 ---------- */
.top {
  position: fixed;
  top: calc(var(--safe-t) + 22px);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  animation: rise 1.4s cubic-bezier(.2, .8, .2, 1) both;
}
.top::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  top: -40px;
  width: min(620px, 140vw);
  height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(4, 6, 24, 0.62), rgba(4, 6, 24, 0.3) 55%, rgba(4, 6, 24, 0));
}
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.22em; color: var(--ink-dim); }
.title {
  margin: 6px 0 2px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(44px, 12vw, 72px);
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-indent: 0.08em;
  background: linear-gradient(180deg, #fff8e8 20%, #ffd99a 75%, #ffb866);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 186, 104, 0.35));
}
.sub { margin: 0; font-family: var(--serif); font-size: 15px; color: var(--ink-dim); letter-spacing: 0.02em; }
.dday {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 14px;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.dday b { color: var(--gold); font-weight: 800; font-size: 15px; letter-spacing: 0.04em; }
.dday span { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-dim); min-width: 8.5em; text-align: left; }
.stats {
  margin: 12px 0 0;
  display: flex;
  justify-content: center;
  gap: 6px 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #cfff94;
  box-shadow: 0 0 9px #cfff94;
  vertical-align: 1px;
  animation: blink 2.6s ease-in-out infinite;
}

.empty-sky {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 47%;
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 19px;
  color: rgba(255, 236, 205, 0.9);
  text-shadow: 0 0 18px rgba(255, 180, 100, 0.45);
  pointer-events: none;
  animation: rise 1.6s .4s cubic-bezier(.2, .8, .2, 1) both, breathe-text 5s 2s ease-in-out infinite;
}
.empty-sky span { display: block; margin-top: 8px; font-family: var(--sans); font-size: 13.5px; color: var(--ink-dim); text-shadow: none; }
@keyframes breathe-text { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

/* ---------- 함께 기도하는 시간 ---------- */
.moment {
  position: fixed;
  left: 16px;
  right: 16px;
  margin: 0 auto;
  width: fit-content;
  top: calc(var(--safe-t) + 236px);
  transform: translateY(8px);
  opacity: 0;
  transition: opacity .6s, transform .6s;
  padding: 12px 20px;
  border-radius: 18px;
  text-align: center;
  background: rgba(40, 26, 64, 0.55);
  border: 1px solid rgba(255, 210, 150, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 40px rgba(255, 170, 90, 0.25);
  pointer-events: none;
  max-width: 520px;
}
.moment.on { opacity: 1; transform: none; animation: breathe 4s ease-in-out infinite; }
.moment strong { display: block; font-family: var(--serif); font-size: 17px; color: #ffe2b0; }
.moment span { display: block; margin-top: 3px; font-size: 13px; color: var(--ink-dim); }

/* ---------- 아래 메뉴 ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 30px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  pointer-events: none;
  animation: rise 1.4s .25s cubic-bezier(.2, .8, .2, 1) both;
}
.dock > * { pointer-events: auto; }
.side { display: flex; gap: 8px; }
.side.right { justify-content: flex-end; }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-on { display: none; }
.icon-btn.on .i-on { display: block; }
.icon-btn.on .i-off { display: none; }
.icon-btn.on { background: rgba(255, 200, 113, 0.16); border-color: rgba(255, 200, 113, 0.45); }

.btn-float {
  position: relative;
  padding: 17px 30px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #2b1605;
  background: radial-gradient(130% 150% at 50% 0%, #ffe7b3 0%, #ffc164 45%, #ff8f3a 100%);
  box-shadow: 0 10px 40px rgba(255, 150, 60, 0.5), 0 0 0 1px rgba(255, 236, 200, 0.5) inset, 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  white-space: nowrap;
  transition: transform .15s, box-shadow .3s;
  animation: glow 3.2s ease-in-out infinite;
}
.btn-float:active { transform: scale(.96); }

.pray {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, rgba(255, 214, 150, 0.32), rgba(26, 22, 58, 0.72) 70%);
  border: 1px solid rgba(255, 220, 160, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .2s, box-shadow .3s;
}
.pray::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--p, 0) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}
.pray.holding { transform: scale(.94); box-shadow: 0 0 36px rgba(255, 190, 110, 0.55); }
.pray-in { font-family: var(--serif); font-size: 16px; font-weight: 700; color: #ffe6bd; }
.pray-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 7px;
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.my-prayers {
  position: fixed;
  right: 16px;
  bottom: calc(var(--safe-b) + 112px);
  margin: 0;
  font-size: 12px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 180, 90, 0.5);
}
.donate-link {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 6px);
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-faint);
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}

/* ---------- 시트 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 14, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 20px calc(var(--safe-b) + 22px);
  border-radius: 26px 26px 0 0;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-bottom: 0;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, 105%);
  transition: transform .5s cubic-bezier(.2, .9, .2, 1);
  outline: none;
}
.sheet.on { transform: translate(-50%, 0); }
.grab { width: 40px; height: 4px; margin: -8px auto 16px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); }
.sheet h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 23px; font-weight: 700; }
.sheet h3 { margin: 22px 0 8px; font-size: 14px; color: var(--gold); font-weight: 700; }
.lead { margin: 0; color: var(--ink-dim); font-size: 14.5px; line-height: 1.6; }
.notice { margin: 16px 0 0; font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }
.list { margin: 0; padding-left: 18px; color: var(--ink-dim); font-size: 14px; line-height: 1.7; }
.list b { color: var(--ink); }
.maker { margin-top: 18px; font-size: 12px; color: var(--ink-faint); }

.preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: radial-gradient(120% 140% at 0% 50%, rgba(255, 170, 80, 0.13), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 220, 170, 0.14);
}
.preview canvas { width: 54px; height: 69px; flex: none; }
.pv-text p { margin: 0; }
.pv-target { font-size: 12.5px; color: var(--gold); font-weight: 600; }
.pv-message { margin-top: 3px !important; font-family: var(--serif); font-size: 17px; line-height: 1.4; word-break: keep-all; }
.pv-sender { margin-top: 4px !important; font-size: 12px; color: var(--ink-faint); }
.preview .empty { opacity: 0.45; }

.field { margin-top: 18px; }
.field label, .field .label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--ink-dim); }
.field em { font-style: normal; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.input::placeholder { color: rgba(247, 242, 232, 0.36); }
.input:focus { border-color: rgba(255, 200, 113, 0.65); background: rgba(255, 255, 255, 0.09); }
textarea.input { resize: none; line-height: 1.45; }
#f-sender-custom { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips.suggest { margin-top: 10px; }
.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-left: -20px;
  margin-right: -20px;
  padding: 2px 20px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 30px), transparent);
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
#sheet-float { padding-bottom: 0; }
.sheet-foot {
  position: sticky;
  bottom: 0;
  margin: 6px -20px 0;
  padding: 4px 20px calc(var(--safe-b) + 16px);
  background: linear-gradient(180deg, rgba(13, 14, 38, 0), rgba(13, 14, 38, 0.97) 26%);
}
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
  font-size: 13px;
  transition: background .2s, border-color .2s, color .2s;
}
.chips.suggest .chip { font-size: 12.5px; padding: 7px 11px; }
.chip[aria-checked='true'] { background: rgba(255, 200, 113, 0.2); border-color: rgba(255, 200, 113, 0.65); color: var(--ink); }

.swatches { display: flex; gap: 16px; }
.swatch { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--ink-faint); }
.swatch i {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 18px rgba(var(--g), 0.45);
  background: radial-gradient(circle at 50% 70%, var(--l), var(--m) 55%, var(--d));
  transition: border-color .2s, transform .2s;
}
.swatch[aria-checked='true'] i { border-color: #fff; transform: scale(1.08); }
.swatch[aria-checked='true'] span { color: var(--ink); }
.swatch[data-color='0'] { --l: #fff4d2; --m: #ffb347; --d: #a8471a; --g: 255, 168, 72; }
.swatch[data-color='1'] { --l: #ffe8ef; --m: #ff8fb0; --d: #9c2f58; --g: 255, 128, 170; }
.swatch[data-color='2'] { --l: #e4fff5; --m: #74d9b9; --d: #1d6f5c; --g: 104, 226, 186; }
.swatch[data-color='3'] { --l: #f6f7ff; --m: #b5c2ff; --d: #44509e; --g: 168, 184, 255; }

.error { min-height: 1.2em; margin: 12px 0 0; font-size: 13.5px; color: #ffb3a1; }
.error.shake { animation: shake .4s; }

.light {
  position: relative;
  width: 100%;
  margin-top: 8px;
  padding: 18px;
  border-radius: 16px;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  color: #2b1605;
  background: linear-gradient(180deg, #ffdc96, #ffa94a);
  box-shadow: 0 10px 34px rgba(255, 150, 60, 0.4);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: box-shadow .3s, transform .15s;
}
.light::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.75), rgba(255, 246, 220, 0.4));
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
}
.light .light-text { position: relative; }
.light.holding { box-shadow: 0 0 50px rgba(255, 170, 80, 0.85); transform: scale(.99); }
.light.busy { opacity: .7; pointer-events: none; }

.row { display: flex; gap: 10px; margin-top: 20px; }
.row > * { flex: 1; }
.btn-primary, .btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.btn-primary { color: #2b1605; background: linear-gradient(180deg, #ffdc96, #ffaa4c); box-shadow: 0 8px 28px rgba(255, 150, 60, 0.35); }
.btn-ghost { color: var(--ink); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); }
#card-pray { width: 100%; margin-top: 22px; }
#card-prayers:not(:empty) { margin-left: 6px; }
.btn-text { display: block; margin: 16px auto 0; padding: 8px 12px; color: var(--ink-faint); font-size: 14px; }
.btn-text.small { display: inline; margin: 0; padding: 4px 6px; font-size: 12.5px; }
.btn-text.danger { color: #ffb3a1; text-decoration: underline; text-underline-offset: 3px; }

.kicker { margin: 0 0 8px; font-size: 12.5px; color: var(--gold); letter-spacing: 0.04em; }
.card-target { font-size: 15px !important; font-family: var(--sans) !important; color: var(--ink-dim); font-weight: 600 !important; }
.card-message { margin: 8px 0 0; font-family: var(--serif); font-size: 25px; line-height: 1.45; word-break: keep-all; }
.card-meta { margin: 12px 0 0; font-size: 13px; color: var(--ink-faint); }
.report { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--ink-faint); }

/* ---------- 알림 ---------- */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  margin: 0 auto;
  width: fit-content;
  bottom: calc(var(--safe-b) + 128px);
  transform: translateY(16px);
  opacity: 0;
  max-width: 520px;
  padding: 11px 17px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.on { opacity: 1; transform: none; }
body.sheet-open .toast { bottom: auto; top: calc(var(--safe-t) + 14px); z-index: 3; }
.plus {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 0 12px rgba(255, 190, 100, 0.85);
  animation: plus 1.2s ease-out forwards;
}
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; }

/* ---------- 움직임 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes glow { 0%, 100% { box-shadow: 0 10px 40px rgba(255, 150, 60, 0.45), 0 0 0 1px rgba(255, 236, 200, 0.5) inset, 0 1px 0 rgba(255, 255, 255, 0.7) inset; } 50% { box-shadow: 0 10px 56px rgba(255, 150, 60, 0.75), 0 0 0 1px rgba(255, 236, 200, 0.6) inset, 0 1px 0 rgba(255, 255, 255, 0.7) inset; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 30px rgba(255, 170, 90, 0.2); } 50% { box-shadow: 0 0 60px rgba(255, 170, 90, 0.45); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes plus { 0% { opacity: 0; transform: translate(-50%, 0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54px); } }

@media (min-width: 720px) {
  .top { top: calc(var(--safe-t) + 34px); }
  .moment { top: calc(var(--safe-t) + 270px); }
  .dock { max-width: 640px; margin: 0 auto; bottom: 40px; }
  .my-prayers { right: calc(50% - 300px); bottom: 124px; }
}
@media (max-height: 640px) {
  .sub { display: none; }
  .moment { top: calc(var(--safe-t) + 190px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 미리보기 이미지(og) ---------- */
body.og .dock, body.og .stats, body.og .dday, body.og .donate-link, body.og .my-prayers { display: none !important; }
body.og .top { top: 22%; animation: none; }
body.og .eyebrow { font-size: 22px; }
body.og .title { font-size: 120px; }
body.og .sub { display: block !important; font-size: 30px; margin-top: 8px; }
body.og .top::before { width: 900px; height: 520px; top: -110px; background: radial-gradient(closest-side, rgba(4, 6, 24, 0.75), rgba(4, 6, 24, 0.4) 55%, rgba(4, 6, 24, 0)); }
