/* ─────────────────────────────────────────────
   자필 카드 + 모션 텍스트 공통 스타일
   고객 화면(widget)과 QR 랜딩페이지(gift)에서 같이 씁니다.
   ───────────────────────────────────────────── */

/* 손글씨체 — 나눔손글씨 펜 (SIL Open Font License 1.1)
   서버가 처음 켜질 때 내려받아 /assets/ 에서 서빙합니다.
   못 받았을 경우를 대비해 시스템 손글씨체로 폴백합니다. */
@font-face {
  font-family: "TB Handwriting";
  src: url("/assets/NanumPenScript-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink-warm_gratitude: #3f2a1c;   /* 감사 — 진한 세피아 */
  --ink-romantic:       #6b2230;   /* 로맨틱 — 와인 */
  --ink-calm_comfort:   #3b4a52;   /* 위로 — 차분한 먹색 */
  --ink-celebration:    #7a4a12;   /* 축하 — 따뜻한 갈색 */
}

/* ── 자필 카드 ────────────────────────────── */
.tb-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: #f3ebdd center/cover no-repeat;
  box-shadow: 0 14px 34px rgba(59, 36, 23, .22);
  display: flex;
  flex-direction: column;
  container-type: inline-size;   /* 카드 너비 기준으로 글자 크기 조절 */
}

/* 이미지 자산 위에 감정별 색감과 빛을 얹는다. DEMO에서도 mood 변화가 보인다. */
.tb-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 16%, var(--tb-mood-glow, rgba(201,162,39,.18)), transparent 38%),
    linear-gradient(145deg, transparent 12%, var(--tb-mood-glow, rgba(201,162,39,.08)) 52%, transparent 86%);
  mix-blend-mode: multiply;
  opacity: .9;
}
.tb-card.tb-postcard::before {
  opacity: 0;
  mix-blend-mode: normal;
}

/* 종이 위에 얹는 아주 옅은 결 — 인쇄물 느낌 */
.tb-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.012) 0 1px, transparent 1px 3px);
  pointer-events: none;
}

.tb-card-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 9cqw 8cqw 7cqw;
}

.tb-card.tb-postcard .tb-card-inner {
  position: absolute;
  inset: 13.8% 16.5% 13.8% 16.5%;
  padding: 7.2cqw 6.2cqw 6.4cqw;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  transform: rotate(-3.6deg);
  transform-origin: 50% 46%;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.tb-card.tb-postcard .tb-card-inner::before,
.tb-card.tb-postcard .tb-card-inner::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.tb-card.tb-postcard .tb-card-inner::before {
  display: none;
}

.tb-card.tb-postcard .tb-card-inner::after {
  display: none;
}

.tb-card .tb-kicker {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--tb-ink, #3f2a1c);
  font-size: 2.55cqw;
  letter-spacing: .18em;
  font-weight: 700;
  opacity: .68;
  text-align: center;
  text-transform: uppercase;
}
.tb-card.tb-postcard .tb-kicker {
  position: relative;
  z-index: 2;
  color: rgba(83, 82, 72, .58);
  font-size: 1.95cqw;
  letter-spacing: .12em;
  opacity: 1;
  text-align: left;
  text-transform: none;
  margin: 0 0 1.6cqw;
}

.tb-card .tb-title {
  margin-top: 4.5cqw;
  color: var(--tb-ink, #3f2a1c);
  font-family: "Cormorant Garamond", "Nanum Myeongjo", serif;
  font-size: 7.2cqw;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  text-align: center;
  text-wrap: balance;
}

.tb-card.tb-postcard .tb-title {
  position: relative;
  z-index: 2;
  margin-top: 0;
  margin-bottom: 4.6cqw;
  max-width: 56%;
  color: rgba(46, 45, 40, .78);
  font-family: "Nanum Myeongjo", Georgia, serif;
  font-size: 8.2cqw;
  font-weight: 400;
  line-height: .94;
  letter-spacing: -.06em;
  text-align: left;
  text-transform: uppercase;
  mix-blend-mode: multiply;
  opacity: .78;
  transform: none;
}

.tb-postcard-meta {
  display: none;
}

.tb-card.tb-postcard .tb-postcard-meta {
  position: relative;
  z-index: 2;
  display: block;
  width: 58%;
  margin: 0 0 5.4cqw;
  color: rgba(56, 55, 48, .66);
  mix-blend-mode: multiply;
}

.tb-card.tb-postcard .tb-postcard-row {
  display: grid;
  grid-template-columns: 12cqw minmax(0, 1fr);
  align-items: end;
  gap: 2cqw;
  min-height: 6.4cqw;
  border-bottom: 1px solid rgba(80, 76, 64, .22);
}

.tb-card.tb-postcard .tb-postcard-row + .tb-postcard-row {
  margin-top: 1.7cqw;
}

.tb-card.tb-postcard .tb-postcard-row b {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 2.1cqw;
  font-weight: 600;
  letter-spacing: .16em;
  color: rgba(80, 76, 64, .46);
}

.tb-card.tb-postcard .tb-postcard-row span {
  min-width: 0;
  color: rgba(50, 49, 43, .76);
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: 4.4cqw;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: rotate(-.2deg);
}

.tb-card .tb-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4cqw 0 5cqw;
  opacity: .62;
}
.tb-card.tb-postcard .tb-divider {
  display: none;
}

.tb-card .tb-divider::before,
.tb-card .tb-divider::after {
  content: "";
  width: 16cqw;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tb-ink, #3f2a1c));
}

.tb-card .tb-divider::after { transform: scaleX(-1); }
.tb-card .tb-divider span {
  width: 1.5cqw;
  height: 1.5cqw;
  margin: 0 2.2cqw;
  border: .35cqw solid var(--tb-ink, #3f2a1c);
  transform: rotate(45deg);
}

.tb-card .tb-card-ornament {
  position: absolute;
  top: 5.5cqw;
  right: 7cqw;
  color: var(--tb-ink, #3f2a1c);
  font-size: 4cqw;
  letter-spacing: .08em;
  opacity: .48;
}

.tb-card.tb-postcard .tb-card-ornament {
  display: none;
}

.tb-card[data-align="left"] .tb-kicker,
.tb-card[data-align="left"] .tb-title,
.tb-card[data-align="left"] .tb-body { text-align: left; }
.tb-card[data-align="left"] .tb-divider { justify-content: flex-start; }
.tb-card[data-align="right"] .tb-kicker,
.tb-card[data-align="right"] .tb-title,
.tb-card[data-align="right"] .tb-body { text-align: right; }
.tb-card[data-align="right"] .tb-divider { justify-content: flex-end; }

.tb-card .tb-body {
  position: relative;
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: 7.4cqw;
  line-height: 1.62;
  color: var(--tb-ink, #3f2a1c);
  white-space: pre-line;
  word-break: keep-all;
  flex: 1;
  /* 손으로 쓴 듯한 다정한 호흡 */
  transform: rotate(-.25deg);
  text-shadow: 0 0 .4px currentColor;
  overflow: hidden;
}

.tb-card .tb-body span,
.tb-card .tb-sign span {
  position: relative;
  z-index: 1;
}

.tb-card.tb-postcard .tb-body {
  position: relative;
  z-index: 2;
  flex: 0 1 auto;
  width: 58%;
  max-height: 26cqw;
  margin-top: 6.2cqw;
  margin-left: 2.4cqw;
  margin-bottom: 0;
  color: rgba(48, 48, 42, .74);
  font-family: "Nanum Myeongjo", Georgia, "Apple SD Gothic Neo", serif;
  font-size: 3.35cqw;
  line-height: 1.52;
  letter-spacing: -.015em;
  text-align: left;
  text-shadow:
    .12px .08px 0 rgba(255, 255, 255, .34),
    -.1px -.08px 0 rgba(42, 28, 20, .08);
  transform: none;
  opacity: .9;
  mix-blend-mode: multiply;
  filter: saturate(.86) contrast(.9);
}

/* ── 엽서 레이어 템플릿 6종 ─────────────────── */
.tb-card.tb-postcard[data-template="stamp"] .tb-card-inner {
  inset: 13.2% 14.8% 13.5% 17.8%;
  transform: rotate(-4deg);
  padding: 7.4cqw 6.5cqw 6.2cqw;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 100% 0, transparent 0 1.55cqw, #fbf6ea 1.62cqw) top right / 3.05cqw 3.05cqw repeat-y,
    radial-gradient(circle at 0 0, transparent 0 1.55cqw, #fbf6ea 1.62cqw) top left / 3.05cqw 3.05cqw repeat-y,
    radial-gradient(circle at 0 100%, transparent 0 1.55cqw, #fbf6ea 1.62cqw) bottom left / 3.05cqw 3.05cqw repeat-x,
    radial-gradient(circle at 100% 100%, transparent 0 1.55cqw, #fbf6ea 1.62cqw) bottom right / 3.05cqw 3.05cqw repeat-x,
    repeating-linear-gradient(0deg, rgba(94,82,62,.07) 0 1px, transparent 1px 7.1cqw),
    #fbf6ea;
}

.tb-card.tb-postcard[data-template="deckle"] .tb-card-inner {
  inset: 16% 14.5% 15% 15.5%;
  transform: rotate(1.8deg);
  border-radius: 2.1cqw 1.2cqw 2.5cqw 1.5cqw;
  padding: 8cqw 7cqw 6.8cqw;
  background:
    radial-gradient(circle at 14% 8%, rgba(255,255,255,.8), transparent 30%),
    repeating-linear-gradient(88deg, rgba(80,65,45,.04) 0 1px, transparent 1px 5px),
    #fbf7ed;
  box-shadow: 0 2.8cqw 6cqw rgba(43, 28, 18, .22);
}
.tb-card.tb-postcard[data-template="deckle"] .tb-card-inner::before {
  inset: -.5cqw;
  border: 1px solid rgba(120, 105, 82, .16);
  border-radius: 2.9cqw 1.4cqw 3.2cqw 1.7cqw;
  filter: blur(.25px);
}
.tb-card.tb-postcard[data-template="deckle"] .tb-card-inner::after { display: none; }

.tb-card.tb-postcard[data-template="letter"] .tb-card-inner {
  inset: 15% 12% 16.2% 12%;
  transform: rotate(.4deg);
  padding: 8.4cqw 8.6cqw 7cqw;
  border-radius: .6cqw;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(98, 85, 62, .18) 49.8% 50.2%, transparent 50.3%),
    linear-gradient(110deg, rgba(255,255,255,.56), transparent 45%),
    #fcf8ef;
}
.tb-card.tb-postcard[data-template="letter"] .tb-title,
.tb-card.tb-postcard[data-template="letter"] .tb-postcard-meta { max-width: 46%; width: 46%; }
.tb-card.tb-postcard[data-template="letter"] .tb-body { width: 84%; max-height: 30cqw; margin-left: 0; margin-top: 4.4cqw; }
.tb-card.tb-postcard[data-template="letter"] .tb-card-inner::after { display: none; }

.tb-card.tb-postcard[data-template="envelope"] .tb-card-inner {
  inset: 20% 12% 16% 18%;
  transform: rotate(-2.2deg);
  padding: 7.2cqw 6.8cqw 6.3cqw;
  border-radius: .8cqw;
  background:
    linear-gradient(142deg, transparent 0 58%, rgba(188, 162, 127, .24) 58.2% 59%, transparent 59.2%),
    linear-gradient(38deg, transparent 0 58%, rgba(188, 162, 127, .2) 58.2% 59%, transparent 59.2%),
    #fbf5e8;
}
.tb-card.tb-postcard[data-template="envelope"] .tb-card-inner::before {
  inset: auto -3.8cqw -7.8cqw -3.8cqw;
  height: 20cqw;
  border: 1px solid rgba(139, 114, 82, .18);
  border-radius: .9cqw;
  background:
    linear-gradient(145deg, rgba(170, 135, 92, .2), transparent 50%),
    #e8d7bc;
  z-index: -1;
  transform: rotate(1.8deg);
}
.tb-card.tb-postcard[data-template="envelope"] .tb-card-inner::after { display: none; }

.tb-card.tb-postcard[data-template="polaroid"] .tb-card-inner {
  inset: 13.5% 12.5% 11.8% 13.5%;
  transform: rotate(-2.8deg);
  padding: 9cqw 6.2cqw 13.5cqw;
  border-radius: .8cqw;
  background:
    linear-gradient(#fdf9f0, #f9f2e4);
}
.tb-card.tb-postcard[data-template="polaroid"] .tb-card-inner::before {
  inset: 5.3cqw 5.3cqw 22cqw;
  border: 1px solid rgba(110, 95, 73, .14);
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.72), transparent 32%),
    rgba(224, 209, 184, .26);
}
.tb-card.tb-postcard[data-template="polaroid"] .tb-title { margin-top: 28cqw; }
.tb-card.tb-postcard[data-template="polaroid"] .tb-postcard-meta { display: none; }
.tb-card.tb-postcard[data-template="polaroid"] .tb-body { width: 82%; max-height: 30cqw; margin-top: 4cqw; margin-left: 0; }
.tb-card.tb-postcard[data-template="polaroid"] .tb-card-inner::after { display: none; }

.tb-card.tb-postcard[data-template="classic"] .tb-card-inner {
  inset: 18% 11.5% 18% 11.5%;
  transform: rotate(0deg);
  padding: 7.3cqw 7.5cqw 6.3cqw;
  border-radius: .3cqw;
  background:
    linear-gradient(90deg, transparent 52%, rgba(92, 78, 58, .22) 52.2% 52.5%, transparent 52.7%),
    repeating-linear-gradient(0deg, transparent 0 6.5cqw, rgba(95,82,61,.16) 6.55cqw 6.65cqw),
    #fbf6e9;
}
.tb-card.tb-postcard[data-template="classic"] .tb-title { max-width: 46%; }
.tb-card.tb-postcard[data-template="classic"] .tb-postcard-meta {
  margin-left: 57%;
  margin-top: -20cqw;
  width: 38%;
}
.tb-card.tb-postcard[data-template="classic"] .tb-body { width: 47%; max-height: 30cqw; margin-left: 0; margin-top: 7cqw; }

/* 이미지 안의 실제 빈 엽서를 살린다.
   종이 레이어를 다시 그리지 않고, 인쇄/손글씨만 얹어 카드뉴스 참고 이미지처럼 보이게 한다. */
.tb-card.tb-postcard .tb-card-inner,
.tb-card.tb-postcard[data-template="stamp"] .tb-card-inner,
.tb-card.tb-postcard[data-template="deckle"] .tb-card-inner,
.tb-card.tb-postcard[data-template="letter"] .tb-card-inner,
.tb-card.tb-postcard[data-template="envelope"] .tb-card-inner,
.tb-card.tb-postcard[data-template="polaroid"] .tb-card-inner,
.tb-card.tb-postcard[data-template="classic"] .tb-card-inner {
  inset: 12.2% 17.5% 13.6% 17.6%;
  padding: 5.8cqw 5.6cqw 5.8cqw;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: rotate(-3.6deg);
}

.tb-card.tb-postcard .tb-card-inner::before,
.tb-card.tb-postcard .tb-card-inner::after,
.tb-card.tb-postcard[data-template] .tb-card-inner::before,
.tb-card.tb-postcard[data-template] .tb-card-inner::after {
  display: none;
}

.tb-card.tb-postcard .tb-kicker {
  margin-bottom: 1cqw;
  color: rgba(73, 70, 61, .42);
  font-size: 1.65cqw;
  letter-spacing: .1em;
}

.tb-card.tb-postcard .tb-title {
  max-width: 48%;
  margin-bottom: 4.2cqw;
  color: rgba(45, 43, 37, .72);
  font-size: 7.7cqw;
  opacity: .78;
}

.tb-card.tb-postcard .tb-postcard-meta,
.tb-card.tb-postcard[data-template="classic"] .tb-postcard-meta {
  width: 45%;
  margin: 0 0 8.4cqw;
  color: rgba(57, 54, 47, .58);
}

.tb-card.tb-postcard .tb-body,
.tb-card.tb-postcard[data-template="letter"] .tb-body,
.tb-card.tb-postcard[data-template="polaroid"] .tb-body,
.tb-card.tb-postcard[data-template="classic"] .tb-body {
  width: 54%;
  max-height: 34cqw;
  margin-top: 0;
  margin-left: .9cqw;
  color: rgba(55, 51, 43, .66);
  font-family: "Nanum Myeongjo", Georgia, "Apple SD Gothic Neo", serif;
  font-size: 2.9cqw;
  line-height: 1.58;
  opacity: .88;
}

.tb-card.tb-postcard.tb-long .tb-body { font-size: 2.55cqw; line-height: 1.46; }
.tb-card.tb-postcard.tb-vlong .tb-body { font-size: 2.25cqw; line-height: 1.38; }

.tb-card.tb-postcard[data-mode="original"] .tb-title,
.tb-card.tb-postcard[data-mode="light"] .tb-title,
.tb-card.tb-postcard[data-mode="warm"] .tb-title,
.tb-card.tb-postcard[data-mood="romantic"] .tb-title,
.tb-card.tb-postcard[data-mood="calm_comfort"] .tb-title,
.tb-card.tb-postcard[data-mood="celebration"] .tb-title {
  font-family: "Nanum Myeongjo", Georgia, serif;
  font-size: 8.2cqw;
  font-style: normal;
  font-weight: 400;
  line-height: .94;
  letter-spacing: -.06em;
  transform: none;
  text-align: left;
}

.tb-card.tb-postcard[data-mode="original"] .tb-body,
.tb-card.tb-postcard[data-mode="light"] .tb-body {
  font-family: "Nanum Myeongjo", Georgia, "Apple SD Gothic Neo", serif;
  font-size: 3.35cqw;
  line-height: 1.52;
  letter-spacing: -.015em;
  transform: none;
}

.tb-card.tb-postcard .tb-body::after,
.tb-card.tb-postcard .tb-sign::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: 0;
  color: currentColor;
  white-space: pre-line;
  word-break: keep-all;
  opacity: .1;
  filter: blur(.28px);
  transform: translate(.22px, .16px);
  pointer-events: none;
}

/* C안: 문장 선택 모드에 따라 손글씨의 힘과 호흡만 달리한다. */
.tb-card[data-mode="original"] .tb-body {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-weight: 400;
  letter-spacing: .015em;
  transform: rotate(-.45deg);
}
.tb-card[data-mode="light"] .tb-body {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-weight: 500;
  letter-spacing: -.015em;
  transform: rotate(-.15deg);
}
.tb-card[data-mode="warm"] .tb-body {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: 7.8cqw;
  line-height: 1.55;
  letter-spacing: .02em;
  transform: rotate(-.25deg);
}

.tb-card.tb-postcard[data-mode="warm"] .tb-body {
  font-family: "Nanum Myeongjo", Georgia, "Apple SD Gothic Neo", serif;
  font-size: 3.45cqw;
  line-height: 1.5;
  opacity: .9;
  letter-spacing: -.015em;
  transform: none;
}
.tb-card[data-mode="original"] .tb-title {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: 7.8cqw;
  transform: rotate(-1deg);
}
.tb-card[data-mode="warm"] .tb-title {
  font-size: 8.1cqw;
  letter-spacing: -.04em;
}

.tb-card[data-mood="romantic"] .tb-title {
  font-family: "Nanum Myeongjo", Georgia, serif;
  font-style: italic;
  letter-spacing: -.04em;
}
.tb-card[data-mood="calm_comfort"] .tb-title {
  font-family: "Nanum Myeongjo", Georgia, serif;
  font-weight: 500;
}
.tb-card[data-mood="celebration"] .tb-title {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  transform: rotate(-1deg);
}
.tb-card[data-mood="celebration"] .tb-card-ornament {
  animation: tbSparkle 2.8s ease-in-out infinite;
}
@keyframes tbSparkle {
  0%, 100% { opacity: .25; transform: scale(.9) rotate(0deg); }
  50% { opacity: .72; transform: scale(1.18) rotate(18deg); }
}

.tb-card .tb-sign {
  position: relative;
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: 6.4cqw;
  color: var(--tb-ink, #3f2a1c);
  text-align: right;
  opacity: .92;
  margin-top: 4cqw;
  transform: rotate(-.7deg);
}

.tb-card.tb-postcard .tb-sign {
  display: none;
}
.tb-card[data-mode="original"] .tb-sign { transform: rotate(-1.3deg); }
.tb-card[data-mode="warm"] .tb-sign { font-size: 6.8cqw; }
.tb-card[data-align="left"] .tb-sign { text-align: left; }
.tb-card[data-align="center"] .tb-sign { text-align: center; }

/* 브랜드 각인 — 종이 아래쪽에 눌러 찍은 느낌 */
.tb-card .tb-emboss {
  position: absolute;
  left: 8cqw;
  bottom: 5cqw;
  z-index: 1;
  font-size: 3cqw;
  letter-spacing: .22em;
  font-weight: 700;
  color: rgba(90, 62, 40, .30);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}
.tb-card.tb-postcard .tb-emboss {
  left: 50%;
  bottom: 9.8%;
  transform: translateX(-50%);
  color: rgba(78, 76, 68, .24);
  font-size: 1.9cqw;
  letter-spacing: .28em;
  opacity: 1;
}

/* 글자가 많으면 자동으로 작게 */
.tb-card.tb-long  .tb-body { font-size: 6.2cqw; line-height: 1.55; }
.tb-card.tb-vlong .tb-body { font-size: 5.2cqw; line-height: 1.5; }
.tb-card.tb-postcard.tb-long  .tb-body { font-size: 2.95cqw; line-height: 1.42; }
.tb-card.tb-postcard.tb-vlong .tb-body { font-size: 2.55cqw; line-height: 1.34; }

/* ── 모션 텍스트 ──────────────────────────── */
.tb-motion {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3.4%;
  padding: 18% 12% 24%;
  z-index: 2;
  pointer-events: none;
  text-align: center;
}

.tb-motion[data-variant="motion"] {
  justify-content: stretch;
  align-items: stretch;
  padding: 0;
  text-align: left;
}

.tb-motion[data-variant="video"] {
  justify-content: stretch;
  align-items: stretch;
  padding: 0;
  text-align: left;
}

.tb-motion[data-variant="motion"] .tb-scene {
  animation-fill-mode: forwards;
}

.tb-video-letter {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: #11100d;
  font-family: "BatangChe", "Batang", "Gungsuh", serif;
}

.video-letter-brand {
  position: absolute;
  left: 0;
  right: 0;
  top: 19%;
  color: rgba(255, 253, 244, .78);
  font: 500 clamp(10px, 2.8cqw, 14px)/1 "Batang", serif;
  letter-spacing: .12em;
  text-align: center;
  opacity: 0;
  animation: tbVideoBrand 4.6s ease-in-out .7s forwards;
  text-shadow: 0 1px 12px rgba(0,0,0,.34);
}

.video-type-paper {
  position: absolute;
  left: 11%;
  right: 33%;
  top: 26%;
  height: 20%;
  overflow: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  animation: tbVideoPaperIn .8s ease-out 5.1s forwards;
}

.video-type-line {
  position: relative;
  display: none;
  width: max-content;
  max-width: 100%;
  min-height: clamp(20px, 5.8cqw, 28px);
  height: clamp(20px, 5.8cqw, 28px);
  margin-bottom: clamp(2px, 1.2cqw, 6px);
  white-space: nowrap;
  text-align: right;
  overflow: visible;
  color: rgba(18, 15, 11, .96);
  font-size: clamp(14px, 4.85cqw, 23px);
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: .22px .16px 0 rgba(10,9,7,.5);
  transform-origin: right center;
  animation: none;
}

.video-type-line.active {
  display: block;
  text-shadow:
    .35px .2px 0 rgba(10,9,7,.58),
    0 0 .9px rgba(10,9,7,.2);
}

.video-type-line.done {
  display: block;
}

.video-type-line.active::after {
  content: "";
  display: inline-block;
  width: .12em;
  height: .82em;
  margin-left: .04em;
  vertical-align: -.08em;
  background: rgba(18, 14, 9, .28);
  animation: tbTypeCursor .16s steps(1, end) infinite;
}

.video-type-sign {
  position: absolute;
  right: 34%;
  top: 48%;
  color: rgba(10, 9, 7, .75);
  font-size: clamp(10px, 3.5cqw, 17px);
  opacity: 0;
}

.video-type-sign.show {
  animation: tbSignIn .55s ease-out forwards;
}

.tb-motion.tb-video-long .video-type-paper {
  top: 22%;
  height: 24%;
}

.tb-motion.tb-video-vlong .video-type-paper {
  top: 19%;
  height: 27%;
}

.tb-motion.tb-video-long .video-type-char {
  font-size: clamp(14px, 4.7cqw, 23px);
}

.tb-motion.tb-video-vlong .video-type-char {
  font-size: clamp(12px, 4.05cqw, 20px);
}

.tb-motion.tb-video-long .video-type-line,
.tb-motion.tb-video-vlong .video-type-line {
  height: clamp(16px, 4.5cqw, 22px);
}

@keyframes tbVideoBrand {
  0% { opacity: 0; transform: translateY(8px); }
  18%, 72% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes tbVideoPaperIn {
  to { opacity: 1; }
}

@keyframes tbTypeCursor {
  0%, 49% { opacity: .7; }
  50%, 100% { opacity: .18; }
}

.tb-write-card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 11% 9% 12%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,250,241,.1) 34%, rgba(43,28,17,.38) 100%);
}

.write-label {
  position: absolute;
  top: 7.2%;
  left: 9%;
  right: 9%;
  color: rgba(255,255,255,.82);
  font: 900 clamp(8px, 2.3cqw, 12px)/1 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: .2em;
  text-shadow: 0 1px 10px rgba(68,42,20,.35);
}

.write-lines {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 13%;
  z-index: 3;
  color: #fffaf2;
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: clamp(18px, 7.1cqw, 34px);
  line-height: 1.2;
  letter-spacing: 0;
  word-break: keep-all;
  text-shadow:
    0 2px 15px rgba(30, 18, 10, .44),
    0 1px 2px rgba(30, 18, 10, .24);
}

.write-char {
  opacity: 0;
  animation: tbWriteChar .22s ease-out forwards;
}

.write-break {
  display: contents;
}

.write-sign {
  position: absolute;
  right: 10%;
  bottom: 7.5%;
  z-index: 3;
  color: rgba(255,255,255,.88);
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: clamp(12px, 4.7cqw, 21px);
  opacity: 0;
  transform: translateY(6px) rotate(-1deg);
  animation: tbSignIn .7s ease-out forwards;
  text-shadow: 0 2px 12px rgba(30,18,10,.34);
}

.motion-photo-stamp,
.motion-sketch,
.motion-envelope {
  display: none;
}

.tb-motion[data-template="photo"] .motion-photo-stamp {
  display: block;
  position: absolute;
  left: 50%;
  top: 31%;
  width: 34%;
  aspect-ratio: 1;
  transform: translateX(-50%) rotate(-1.5deg);
  border: .8cqw solid rgba(255,255,255,.85);
  box-shadow: 0 1.6cqw 5cqw rgba(41, 27, 18, .24);
  background:
    radial-gradient(circle at 50% 38%, rgba(255,218,138,.9), transparent 18%),
    linear-gradient(155deg, rgba(39,82,104,.84), rgba(15,32,48,.86));
  opacity: 0;
  animation: tbStampIn .9s .35s ease-out forwards;
}

.tb-motion[data-template="photo"] .tb-write-card {
  background:
    radial-gradient(circle at 50% 37%, rgba(34,58,74,.18) 0 15%, transparent 15.5%),
    linear-gradient(90deg, transparent 0 44%, rgba(255,255,255,.72) 44% 56%, transparent 56%),
    radial-gradient(circle at 34% 24%, rgba(255,255,255,.46), transparent 28%),
    repeating-linear-gradient(0deg, rgba(38,31,24,.035) 0 1px, transparent 1px 4px),
    #e4e2dc;
}

.tb-motion[data-template="photo"] .write-lines {
  top: 10%;
  bottom: auto;
  color: #d51f22;
  font-size: clamp(18px, 7.2cqw, 34px);
  line-height: 1.42;
  text-shadow: 0 1px 0 rgba(255,255,255,.34);
}

.tb-motion[data-template="photo"] .write-label {
  display: none;
}

.tb-motion[data-template="photo"] .write-sign {
  color: #d51f22;
  bottom: 9%;
  text-shadow: 0 1px 0 rgba(255,255,255,.34);
}

.tb-motion[data-template="sketch"] .tb-write-card {
  background:
    radial-gradient(circle at 72% 18%, rgba(23,63,191,.045), transparent 31%),
    repeating-linear-gradient(0deg, rgba(62,49,31,.025) 0 1px, transparent 1px 5px),
    #fbf6e8;
}

.tb-motion[data-template="sketch"] .motion-sketch {
  display: block;
  position: absolute;
  right: 7%;
  top: 18%;
  width: 48%;
  height: auto;
  z-index: 1;
  fill: none;
  stroke: #173fbf;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tb-motion[data-template="sketch"] .motion-sketch path {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: tbDrawLine 2.4s ease-out forwards;
}

.tb-motion[data-template="sketch"] .motion-sketch path:nth-child(2) { animation-delay: .28s; }
.tb-motion[data-template="sketch"] .motion-sketch path:nth-child(3) { animation-delay: .58s; }
.tb-motion[data-template="sketch"] .motion-sketch path:nth-child(4) { animation-delay: .82s; }
.tb-motion[data-template="sketch"] .motion-sketch path:nth-child(5) { animation-delay: 1.08s; }

.tb-motion[data-template="sketch"] .write-label {
  color: #173fbf;
  text-shadow: none;
}

.tb-motion[data-template="sketch"] .write-lines {
  left: 8%;
  right: 47%;
  top: 20%;
  bottom: auto;
  color: #173fbf;
  font-size: clamp(19px, 7.8cqw, 37px);
  line-height: 1.08;
  text-shadow: none;
}

.tb-motion[data-template="sketch"] .write-sign {
  color: #173fbf;
  text-shadow: none;
}

.tb-motion[data-template="envelope"] .tb-write-card {
  background:
    url("/assets/motion/handmade-envelope-open.png") center/cover no-repeat,
    #f7f0e4;
}

.tb-motion[data-template="envelope"].tb-motion-long .tb-write-card,
.tb-motion[data-template="envelope"].tb-motion-vlong .tb-write-card {
  animation: tbEnvelopePhotoBreathe 18s 2.2s ease-in-out forwards;
}

.tb-motion[data-template="envelope"] .tb-write-card::before {
  content: "";
  position: absolute;
  left: 17.5%;
  right: 17.5%;
  top: 18.5%;
  height: 39%;
  z-index: 1;
  border-radius: 1.2cqw .9cqw .5cqw .5cqw;
  background:
    radial-gradient(circle at 42% 16%, rgba(255,255,255,.44), transparent 34%),
    repeating-linear-gradient(0deg, rgba(90,70,45,.045) 0 1px, transparent 1px 6.6cqw),
    rgba(252,247,235,.58);
  box-shadow: 0 1.2cqw 3.4cqw rgba(68,43,22,.08);
  opacity: 0;
  pointer-events: none;
}

.tb-motion[data-template="envelope"].tb-motion-long .tb-write-card::before,
.tb-motion[data-template="envelope"].tb-motion-vlong .tb-write-card::before {
  opacity: .84;
  animation: tbLetterSheetRise 16s 2.15s ease-in-out forwards;
}

.tb-motion[data-template="envelope"] .motion-envelope {
  display: none;
  position: absolute;
  left: 2.5%;
  right: 2.5%;
  bottom: 2.5%;
  height: 91%;
  z-index: 1;
}

.env-back,
.env-front,
.env-flap,
.env-card {
  position: absolute;
  left: 0;
  right: 0;
}

.env-back {
  bottom: 0;
  height: 58%;
  border-radius: 2.2cqw;
  background:
    linear-gradient(180deg, rgba(255,255,255,.25), transparent 38%),
    #e8dac2;
  box-shadow: 0 2cqw 5cqw rgba(64,42,24,.14);
}

.env-front {
  bottom: 0;
  height: 44%;
  border-radius: 0 0 2.2cqw 2.2cqw;
  background:
    linear-gradient(145deg, transparent 49.5%, rgba(137,107,73,.18) 50%, transparent 51%),
    linear-gradient(35deg, transparent 49.5%, rgba(137,107,73,.16) 50%, transparent 51%),
    #efe2cb;
  z-index: 4;
}

.env-flap {
  top: 28%;
  height: 32%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, rgba(255,255,255,.24), transparent 42%),
    #e5d5bb;
  transform-origin: 50% 100%;
  animation: tbEnvelopeOpen 1.4s .35s cubic-bezier(.2,.8,.2,1) forwards;
  z-index: 5;
}

.env-card {
  bottom: 18%;
  left: 8.5%;
  right: 8.5%;
  height: 68%;
  border-radius: .8cqw;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(126,107,78,.22) 49.8% 50.2%, transparent 50.4%),
    repeating-linear-gradient(0deg, transparent 0 13.7%, rgba(126,107,78,.13) 13.9% 14.2%),
    radial-gradient(circle at 35% 20%, rgba(255,255,255,.78), transparent 34%),
    #fbf5e8;
  box-shadow: 0 1.4cqw 4cqw rgba(58,37,22,.13);
  opacity: 0;
  transform: translateY(24%);
  animation: tbCardRise 1.35s 1.15s cubic-bezier(.2,.8,.2,1) forwards;
  z-index: 3;
}

.tb-motion[data-template="envelope"] .write-label {
  display: none;
  top: 9%;
  color: rgba(68,52,37,.52);
  text-shadow: none;
  text-align: center;
}

.tb-motion[data-template="envelope"] .write-lines {
  left: 17.5%;
  right: 17.5%;
  top: 24%;
  bottom: auto;
  color: #173fbf;
  max-height: 37%;
  overflow: hidden;
  font-size: clamp(13px, 5.05cqw, 23px);
  line-height: 1.12;
  text-align: center;
  text-shadow:
    .2px .2px 0 rgba(255,255,255,.32),
    -.15px -.1px 0 rgba(10,32,130,.14);
}

.tb-motion[data-template="envelope"].tb-motion-long .write-lines {
  left: 16.5%;
  right: 16.5%;
  top: 20%;
  max-height: 53%;
  font-size: clamp(12px, 4.25cqw, 19px);
  line-height: 1.1;
  animation: tbWrittenTextRise 16s 2.15s ease-in-out forwards;
}

.tb-motion[data-template="envelope"].tb-motion-vlong .write-lines {
  left: 15.5%;
  right: 15.5%;
  top: 17.5%;
  max-height: 61%;
  font-size: clamp(10.5px, 3.72cqw, 16.5px);
  line-height: 1.08;
  animation: tbWrittenTextRiseMore 17s 2.15s ease-in-out forwards;
}

.tb-motion[data-template="envelope"] .write-sign {
  color: #173fbf;
  right: 24%;
  bottom: 42%;
  text-shadow: none;
  font-size: clamp(10px, 3.25cqw, 15px);
}

.tb-motion[data-template="envelope"].tb-motion-long .write-sign,
.tb-motion[data-template="envelope"].tb-motion-vlong .write-sign {
  right: 22%;
  bottom: 48%;
}

.tb-kinetic-board {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12% 10% 13%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.02) 34%, rgba(255,250,241,.62) 100%);
}

.kinetic-topline {
  position: absolute;
  top: 8.5%;
  left: 10%;
  right: 10%;
  color: rgba(255,255,255,.82);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: clamp(8px, 2.5cqw, 12px);
  font-weight: 900;
  letter-spacing: .22em;
  text-shadow: 0 1px 10px rgba(68, 42, 20, .35);
}

.kinetic-phrases {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2.5cqw 2.2cqw;
}

.kinetic-word {
  display: inline-block;
  max-width: 100%;
  color: #fffaf2;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: clamp(16px, 6.4cqw, 31px);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: 0;
  word-break: keep-all;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(18px) scale(.98);
  filter: blur(4px);
  text-shadow:
    0 2px 18px rgba(31, 20, 12, .48),
    0 1px 2px rgba(31, 20, 12, .34);
  animation: tbKineticSettle 1.25s cubic-bezier(.16, .9, .22, 1) forwards;
}

.kinetic-word.hero {
  flex-basis: 100%;
  color: #fff;
  font-size: clamp(22px, 9.3cqw, 42px);
  line-height: 1.06;
}

.kinetic-word.wide {
  color: #ffe19a;
  font-size: clamp(18px, 7.4cqw, 34px);
}

.kinetic-word.sign {
  flex-basis: 100%;
  margin-top: 3%;
  color: rgba(255,255,255,.88);
  font-size: clamp(12px, 4.4cqw, 19px);
  font-weight: 800;
  text-align: right;
}

.tb-motion[data-mood="romantic"] .kinetic-word.wide { color: #ffd4c7; }
.tb-motion[data-mood="calm_comfort"] .kinetic-word.wide { color: #d9e8e4; }
.tb-motion[data-mood="celebration"] .kinetic-word.wide { color: #fff08a; }

.tb-motion .tb-scene {
  position: absolute;
  inset: 18% 10% 24%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.8%;
  opacity: 0;
  transform: translateY(18px) scale(.98);
  filter: blur(3px);
  animation: tbSceneIn 2.4s cubic-bezier(.2,.8,.2,1) forwards;
  text-align: center;
}

.tb-motion .scene-kicker {
  color: #e6c866;
  font-family: -apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  font-size: clamp(8px, 2.4cqw, 12px);
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .92;
}

.tb-motion .scene-title {
  max-width: 92%;
  color: #fff8ee;
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: clamp(22px, 8.2cqw, 36px);
  line-height: 1.35;
  word-break: keep-all;
  text-shadow: 0 2px 16px rgba(0,0,0,.82), 0 0 34px rgba(52,22,9,.55);
}

.tb-motion .scene-body {
  max-width: 82%;
  color: rgba(255,248,238,.9);
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  font-size: clamp(14px, 5.2cqw, 23px);
  line-height: 1.55;
  white-space: pre-line;
  word-break: keep-all;
  text-shadow: 0 2px 12px rgba(0,0,0,.72);
}

.tb-motion .tb-scene.message .scene-title {
  color: #fffaf0;
}

.tb-motion .tb-scene.closing .scene-title {
  font-size: clamp(19px, 7cqw, 31px);
}

.tb-motion .tb-scene.closing .scene-body {
  color: #e6c866;
  text-align: right;
}

.tb-motion[data-align="left"] { text-align: left; }
.tb-motion[data-align="left"] .tb-scene { align-items: flex-start; text-align: left; }
.tb-motion[data-align="left"] .tb-scene .scene-title,
.tb-motion[data-align="left"] .tb-scene .scene-body { margin-left: 0; }
.tb-motion[data-align="right"] { text-align: right; }
.tb-motion[data-align="right"] .tb-scene { align-items: flex-end; text-align: right; }

.tb-motion .line {
  font-family: "TB Handwriting", "Nanum Pen Script", cursive;
  color: #fff8ee;
  font-size: clamp(16px, 6.8cqw, 29px);
  line-height: 1.48;
  letter-spacing: .015em;
  word-break: keep-all;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .82), 0 0 34px rgba(52, 22, 9, .55);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  filter: blur(3px);
  animation: tbLineIn .95s cubic-bezier(.2, .8, .2, 1) forwards;
}

.tb-motion .line.opening {
  align-self: center;
  margin-bottom: 3%;
  color: #e6c866;
  font-size: clamp(13px, 4.6cqw, 20px);
  letter-spacing: .08em;
  opacity: .9;
}

.tb-motion .line.main {
  max-width: 86%;
}

.tb-motion .line.closing {
  margin-top: 3%;
  opacity: .9;
}

/* 마지막 줄(서명)은 조금 작고 금색으로 */
.tb-motion .line.sign {
  align-self: flex-end;
  max-width: 80%;
  font-size: clamp(12px, 4.8cqw, 20px);
  color: #e6c866;
  text-align: right;
  margin-top: 7%;
}

@keyframes tbSceneIn {
  0% { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(3px); }
  16% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  72% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-10px) scale(1.015); filter: blur(2px); }
}

.tb-motion[data-variant="motion"] .tb-scene,
.tb-motion[data-variant="motion"] .line {
  opacity: 1;
  filter: none;
}

@keyframes tbLineIn {
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes tbKineticSettle {
  0% { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(4px); }
  72% { opacity: 1; transform: translateY(0) scale(1.01); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes tbWriteChar {
  from { opacity: 0; filter: blur(.8px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes tbSignIn {
  to { opacity: 1; transform: translateY(0) rotate(-1deg); }
}

@keyframes tbStampIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px) rotate(-1.5deg) scale(.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) rotate(-1.5deg) scale(1); }
}

@keyframes tbDrawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes tbEnvelopeOpen {
  to { transform: rotateX(178deg); opacity: .72; }
}

@keyframes tbCardRise {
  to { opacity: 1; transform: translateY(-18%); }
}

@keyframes tbEnvelopePhotoBreathe {
  0%, 28% { background-position: center 50%; }
  100% { background-position: center 47%; }
}

@keyframes tbLetterSheetRise {
  0%, 18% { transform: translateY(5%); opacity: .48; }
  100% { transform: translateY(-15%); opacity: .88; }
}

@keyframes tbWrittenTextRise {
  0%, 22% { transform: translateY(0); }
  100% { transform: translateY(-12%); }
}

@keyframes tbWrittenTextRiseMore {
  0%, 22% { transform: translateY(0); }
  100% { transform: translateY(-18%); }
}
