@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&family=Gaegu:wght@400;700&display=swap');

/* 연등 소원지 (wish card) overlay */
.wc {
  position: fixed;
  inset: 0;
  z-index: 60;
  --wc-w: min(240px, 64vw, calc((100vh - 72px) / 2.6));
  --wc-red: #d8432c;
  --wc-red2: #e8763c;
  --wc-ink: #2c2a33;
  --wc-thread: #c98a5b;
  font-family: 'Nanum Pen Script', 'Gaegu', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}
.wc[hidden] {
  display: none;
}
.wc-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 16, 30, 0.45), rgba(8, 6, 14, 0.72));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: wc-fade 0.5s ease-out both;
}
.wc-hang {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 0;
  animation: wc-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both, wc-sway 7s ease-in-out 0.7s infinite alternate;
}
.wc-thread {
  flex: 1 1 0;
  min-height: 28px;
  width: 2px;
  background: var(--wc-thread);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
.wc-spacer {
  flex: 1 1 0;
  min-height: 24px;
}
.wc-card {
  position: relative;
  width: var(--wc-w);
  height: calc(var(--wc-w) * 2.6);
  box-sizing: border-box;
  background:
    repeating-linear-gradient(93deg, rgba(120, 90, 60, 0.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(176deg, rgba(255, 255, 255, 0.4) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at 50% 30%, #fffdf7, #fbf4e6);
  border: 2px solid var(--wc-red);
  border-radius: 3px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  color: var(--wc-ink);
  outline: none;
}
.wc-card::before {
  /* inner line of the double border */
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--wc-red2);
  border-radius: 2px;
  pointer-events: none;
}
.wc-hole {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: #241a16;
  border: 1px solid #d9c6a8;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
  z-index: 3;
}
.wc-deco {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.wc-no {
  position: absolute;
  top: calc(var(--wc-w) * 0.085);
  left: calc(var(--wc-w) * 0.17);
  font: 500 calc(var(--wc-w) * 0.052) / 1 'Courier New', ui-monospace, monospace;
  letter-spacing: 0.02em;
  color: #4a4650;
}
.wc-head {
  position: absolute;
  top: calc(var(--wc-w) * 0.15);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: calc(var(--wc-w) * 0.04);
}
.wc-buddha {
  /* assets/img/wish-buddha.png: square, transparent; the shadow keeps the gilt figure readable on the gold card */
  width: calc(var(--wc-w) * 0.44);
  height: calc(var(--wc-w) * 0.46);
  object-fit: contain;
  object-position: 50% 100%;
  filter: drop-shadow(0 1px 2px rgba(120, 70, 10, 0.35));
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.wc-sowon {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: 'Gaegu', 'Nanum Pen Script', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: calc(var(--wc-w) * 0.062);
  letter-spacing: 0.35em;
  color: var(--wc-red);
}
.wc-wish {
  /* the wish box (js/wishcard.js WISH): the column block is centred in it; font size + column height set per wish */
  position: absolute;
  top: calc(var(--wc-w) * 0.64);
  left: calc(var(--wc-w) * 0.2);
  width: calc(var(--wc-w) * 0.6);
  height: calc(var(--wc-w) * 1.56);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--wc-ink);
}
.wc-wish-txt {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: calc(var(--wc-w) * 0.11);
  line-height: 1.2;
  letter-spacing: 0.04em;
  word-spacing: var(--wc-ws, -0.5em); /* narrow spaces between words (upright spaces are a full em) */
  word-break: break-all;
  overflow-wrap: anywhere;
}
.wc-name {
  position: absolute;
  left: calc(var(--wc-w) * 0.1);
  bottom: calc(var(--wc-w) * 0.34);
  max-height: calc(var(--wc-w) * 0.9);
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: calc(var(--wc-w) * 0.08);
  line-height: 1.1;
  letter-spacing: 0.06em;
  overflow: hidden;
  color: #3a3542;
}
.wc-name small {
  font-size: 0.7em;
  color: #6c6672;
}
.wc-temple {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--wc-w) * 0.1);
  text-align: center;
  font-family: 'Gaegu', 'Nanum Pen Script', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-weight: 700;
  font-size: calc(var(--wc-w) * 0.135);
  line-height: 1;
  letter-spacing: 0.04em;
  text-indent: 0.04em;
  color: var(--wc-red);
}
.wc-date {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--wc-w) * 0.052);
  text-align: center;
  font: calc(var(--wc-w) * 0.04) / 1 'Courier New', ui-monospace, monospace;
  color: #8a8490;
}
.wc-sheen {
  /* plastic sleeve */
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.32) 42%, rgba(255, 255, 255, 0.06) 49%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 92%, rgba(255, 255, 255, 0.35));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), inset 0 0 12px rgba(255, 255, 255, 0.25);
}
.wc-close {
  position: absolute;
  top: calc(var(--wc-w) * -0.02);
  right: calc(var(--wc-w) * -0.02);
  transform: translate(50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(30, 24, 36, 0.8);
  color: #fff;
  font: 16px/1 system-ui, sans-serif;
  cursor: pointer;
  z-index: 4;
}
.wc-close:focus-visible {
  outline: 2px solid #ffd77a;
  outline-offset: 2px;
}
.wc-out .wc-backdrop {
  animation: wc-fade 0.3s ease-in reverse both;
}
.wc-out .wc-hang {
  animation: wc-in 0.3s ease-in reverse both;
}
@keyframes wc-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes wc-in {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes wc-sway {
  from {
    transform: rotate(-1.1deg);
  }
  to {
    transform: rotate(1.1deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .wc-hang,
  .wc-backdrop {
    animation-duration: 0.01s;
    animation-iteration-count: 1;
  }
}

/* note + action under the card (cooldown left, "이 자리에 연등 달기") */
.wc.wc-has-foot {
  --wc-w: min(240px, 64vw, calc((100vh - 190px) / 2.6));
}
.wc-hang:has(+ .wc-foot:not([hidden])) .wc-spacer {
  min-height: 120px;
}
.wc-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  font: 14px/1.45 'Pretendard', system-ui, sans-serif;
  text-align: center;
  animation: wc-fade 0.5s ease-out 0.3s both;
}
.wc-foot[hidden] {
  display: none;
}
.wc-note {
  margin: 0;
  max-width: 340px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(20, 16, 30, 0.72);
  color: #f6f1e7;
}
.wc-action {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: #e9c46a;
  color: #1a1408;
  font: 700 15px/1 'Pretendard', system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.wc-action[hidden] {
  display: none;
}
.wc-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.wc-acts[hidden] {
  display: none;
}
.wc-acts .wc-action {
  min-width: 96px;
}
.wc-action.wc-ghost {
  background: rgba(20, 16, 30, 0.78);
  color: #f6f1e7;
  box-shadow: inset 0 0 0 1px rgba(246, 241, 231, 0.35), 0 6px 20px rgba(0, 0, 0, 0.35);
}
/* your own lantern: gold paper */
.wc-card.wc-gold {
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 250, 220, 0.9) 0 1px, transparent 1.5px) 0 0 / 13px 17px,
    radial-gradient(circle at 70% 60%, rgba(255, 246, 200, 0.75) 0 1px, transparent 1.5px) 0 0 / 19px 11px,
    linear-gradient(160deg, #ffeeb0, #f4cd68 55%, #e2a944);
  border-color: #b5321f;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 34px rgba(255, 200, 90, 0.45);
}
