

.gift-view,
.reward-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 460px);
}

.gift-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gift-card {
  padding: clamp(16px, 4.6vw, 24px);
  border: var(--pixel-line) solid var(--plum);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--pixel-shadow-sm);
  text-align: center;
}

.gift-title {
  color: var(--plum);
  font-size: clamp(20px, 5.6vw, 24px);
  font-weight: 800;
}

.gift-sub {
  margin-top: 4px;
  color: var(--plum-soft);
  font-size: 14px;
  line-height: 1.6;
}

.gift-done {
  margin-top: 6px;
  color: var(--plum);
  font-weight: 700;
}

.gift-card .btn {
  margin-top: 12px;
  width: 100%;
}



.cake-scene {
  position: relative;
  display: grid;
  place-items: center;
  height: 218px;
  margin-top: 10px;
}

.cake-shadow {
  position: absolute;
  bottom: 16px;
  width: 190px;
  height: 16px;
  border-radius: 50%;
  background: rgb(73 59 81 / 16%);
  filter: blur(3px);
}

.cake {
  position: relative;
  width: 176px;
  height: 168px;
  image-rendering: pixelated;
}

.cake-plate {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 196px;
  height: 16px;
  border: 3px solid var(--plum);
  border-radius: 3px;
  background: var(--sky);
  transform: translateX(-50%);
}

.cake-body {
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 150px;
  height: 88px;
  border: 3px solid var(--plum);
  border-radius: 4px;
  background: var(--sun);
  transform: translateX(-50%);
  overflow: hidden;
}

.cake-layer {
  position: absolute;
  left: 0;
  right: 0;
  height: 18px;
  border-top: 3px solid var(--plum);
  background: #ffe9a8;
}

.cake-layer--one {
  top: 34px;
}

.cake-layer--two {
  top: 62px;
  background: var(--mint);
}

.cake-top {
  position: absolute;
  bottom: 100px;
  left: 50%;
  width: 150px;
  height: 26px;
  border: 3px solid var(--plum);
  border-radius: 4px;
  background: var(--cream-light);
  transform: translateX(-50%);
}

.cake-icing {
  position: absolute;
  top: 6px;
  left: 10px;
  width: 10px;
  height: 10px;
  background: var(--strawberry);
  box-shadow: 18px 4px 0 var(--strawberry), 36px -2px 0 var(--strawberry), 54px 5px 0 var(--strawberry),
    72px 0 0 var(--strawberry), 90px 4px 0 var(--strawberry), 108px -2px 0 var(--strawberry);
}

.cake-number {
  position: absolute;
  bottom: 52px;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 3px solid var(--plum);
  border-radius: 6px;
  background: var(--cream-light);
  color: var(--strawberry);
  font-family: var(--font-pixel);
  font-size: 24px;
  font-weight: 700;
  transform: translateX(-50%);
}

.cake-candle {
  position: absolute;
  bottom: 156px;
  left: 50%;
  width: 10px;
  height: 30px;
  transform: translateX(-50%);
}

.cake-wick {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 22px;
  background: repeating-linear-gradient(
    0deg,
    var(--strawberry) 0 6px,
    var(--cream-light) 6px 12px
  );
  transform: translateX(-50%);
}

.cake-flame {
  position: absolute;
  bottom: 20px;
  left: 50%;
  width: 14px;
  height: 18px;
  border: 2px solid var(--plum);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--sun);
  transform: translateX(-50%);
  animation: candle-flicker 1.6s ease-in-out infinite;
}

@keyframes candle-flicker {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) scale(1.08, 0.94);
    opacity: 0.86;
  }
}

.cake-scene.is-wished .cake-flame {
  animation: none;
  opacity: 0;
  transform: translateX(-50%) translateY(-8px) scale(0.4);
  transition: opacity 320ms var(--ease-soft), transform 320ms var(--ease-soft);
}



.anniversary-card {
  aspect-ratio: 3 / 4;
  max-height: 46dvh;
  margin: 10px auto 0;
  width: auto;
  max-width: 100%;
}

.anniversary-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}



.envelope {
  position: relative;
  width: 100%;
}

.envelope-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 150px;
  padding: 18px;
  border: 3px solid var(--plum);
  border-radius: 8px;
  background: repeating-linear-gradient(
    135deg,
    var(--cream) 0 14px,
    var(--cream-deep) 14px 28px
  );
  box-shadow: var(--pixel-shadow-sm);
  color: var(--plum);
  text-align: left;
  cursor: pointer;
}

.envelope-to {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.envelope-from {
  color: var(--plum-soft);
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.envelope-hint {
  margin-top: auto;
  align-self: flex-end;
  padding: 4px 9px;
  border: 2px solid var(--plum);
  border-radius: 4px;
  background: var(--strawberry);
  color: var(--cream-light);
  font-family: var(--font-pixel);
  font-size: 11px;
}

.letter-body {
  padding: 18px;
  border: 3px solid var(--plum);
  border-radius: 8px;
  background: var(--paper);
  color: var(--plum);
  text-align: left;
}

.letter-head {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.letter-body p {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 10px;
  user-select: text;
}

.letter-pending {
  color: var(--plum);
  font-size: 17px;
  font-weight: 700;
}

.letter-pending-hint {
  color: var(--plum-soft);
  font-size: 14px;
}

.letter-sign {
  margin-top: 12px;
  text-align: right;
  font-family: var(--font-display);
  font-size: 18px;
}

.gift-actions {
  display: grid;
  gap: 9px;
}

.gift-ending {
  padding: 8px 4px 26px;
  color: var(--plum);
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1.7;
}



.reward-card {
  padding: clamp(20px, 5.2vw, 28px);
  border: var(--pixel-line) solid var(--plum);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--pixel-shadow-lg);
  text-align: center;
}

.reward-title {
  margin-top: 10px;
  color: var(--plum);
  font-size: clamp(20px, 5.6vw, 24px);
  font-weight: 800;
  line-height: 1.4;
}

.reward-body {
  margin-top: 6px;
  color: var(--plum-soft);
  font-size: 15px;
}

.reward-envelope {
  margin: 16px auto 6px;
  width: min(100%, 260px);
}

.reward-box {
  position: relative;
  height: 132px;
  border: 3px solid var(--plum);
  border-radius: 10px;
  background: var(--lavender);
  box-shadow: var(--pixel-shadow-sm);
  overflow: hidden;
}

.reward-box::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  border-bottom: 3px solid var(--plum);
  background: var(--sky);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  content: "";
}

.reward-star {
  position: absolute;
  bottom: 20px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: var(--sun);
  box-shadow: 28px -10px 0 var(--strawberry), 56px 4px 0 var(--mint);
}

.reward-heart {
  position: absolute;
  right: 26px;
  bottom: 18px;
  width: 18px;
  height: 18px;
  background: var(--strawberry);
  transform: rotate(45deg);
}

.reward-envelope.is-drawing .reward-box {
  animation: reward-shake 700ms var(--ease-soft);
}

@keyframes reward-shake {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-4px) rotate(-1.2deg);
  }
  60% {
    transform: translateY(2px) rotate(1deg);
  }
}

.reward-result {
  margin-top: 12px;
  padding: 14px;
  border: 2px dashed var(--plum);
  border-radius: 8px;
  background: var(--paper);
}

.reward-prize-label {
  color: var(--plum-soft);
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.reward-prize {
  margin-top: 2px;
  color: var(--plum);
  font-size: 19px;
  font-weight: 800;
}

.reward-prize-desc {
  margin-top: 4px;
  color: var(--plum-soft);
  font-size: 14px;
}

.reward-demo-tag {
  margin-top: 8px;
  color: var(--strawberry);
  font-family: var(--font-pixel);
  font-size: 10.5px;
}

.reward-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.reward-actions .btn {
  width: 100%;
}

.reward-pending,
.reward-saved {
  color: var(--plum-soft);
  font-size: 14px;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  .cake-flame {
    animation: none;
  }

  .reward-envelope.is-drawing .reward-box {
    animation: none;
  }
}


.draft-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 460px);
}

.draft-badge {
  padding: 5px 12px;
  border: 2px solid var(--strawberry);
  border-radius: 6px;
  background: #fde7ec;
  color: var(--plum);
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.draft-letter {
  width: 100%;
  padding: clamp(18px, 5vw, 26px);
  border: var(--pixel-line) solid var(--plum);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--pixel-shadow-sm);
  color: var(--plum);
}

.draft-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.draft-to {
  margin: 14px 0 12px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}

.draft-letter p {
  font-size: 17px;
  line-height: 1.85;
  margin-bottom: 12px;
  user-select: text;
}

.draft-sign {
  margin-top: 16px;
  text-align: right;
  font-family: var(--font-display);
  font-size: 18px;
}

.draft-note {
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}


.reward-hint {
  margin-top: 10px;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.6;
}

.reward-card.is-opened .reward-box {
  background: var(--mint);
  animation: reward-open-pop 420ms var(--ease-soft);
}

@keyframes reward-open-pop {
  0% {
    transform: scale(0.94);
  }
  60% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reward-card.is-opened .reward-box {
    animation: none;
  }
}



.letter-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.envelope-cover {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  padding: 22px;
  border: 3px solid var(--plum);
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, #f7ead2 0 16px, #f1e1c4 16px 32px);
  box-shadow: var(--pixel-shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.envelope-cover:focus-visible {
  outline: 4px solid var(--strawberry);
  outline-offset: 3px;
}

.envelope-flap {
  position: absolute;
  inset: 0 0 auto;
  height: 92px;
  border-bottom: 3px solid var(--plum);
  background: linear-gradient(180deg, #efdcc0, #e7d2ae);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

.envelope-stamp {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 44px;
  border: 3px solid var(--plum);
  border-radius: 3px;
  background: var(--sky);
  box-shadow: 2px 2px 0 var(--plum);
}

.envelope-stamp::before {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--strawberry);
  content: "";
}

.envelope-to {
  position: relative;
  display: block;
  margin-top: 58px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.3;
}

.envelope-from {
  position: relative;
  display: block;
  margin-top: 4px;
  color: var(--plum-soft);
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.envelope-hint {
  margin-top: 26px;
}

.letter-paper {
  position: relative;
  width: 100%;
  scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 14px);
  padding: clamp(22px, 6vw, 42px) clamp(18px, 5.4vw, 44px) clamp(28px, 7vw, 48px);
  border-radius: 5px;
  background-color: #f0e4d0;
  background-image:
    radial-gradient(120% 85% at 50% 0%, rgb(255 251 241 / 70%), transparent 62%),
    repeating-linear-gradient(92deg, rgb(120 92 62 / 5%) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(2deg, rgb(255 255 255 / 16%) 0 1px, transparent 1px 7px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
  box-shadow:
    0 16px 30px rgb(73 59 81 / 18%),
    inset 0 0 46px rgb(120 86 54 / 14%);
  color: #3a2a20;
  font-family: "VA-Pen-CJK", "KaiTi", "STKaiti", "PingFang SC", "Songti SC", serif;
  font-size: clamp(17px, 4.6vw, 19px);
  line-height: 1.95;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}

.letter-paper:focus {
  outline: none;
}

.letter-paper:focus-visible {
  outline: 3px solid var(--strawberry);
  outline-offset: 3px;
}

.letter-paper-inner {
  position: relative;
  z-index: 1;
}

.letter-para {
  margin: 0 0 1.05em;
  text-indent: 2em;
}

.letter-salutation {
  margin: 0 0 1.15em;
  color: #2f2119;
  font-family: "VA-Pen-Latin", "VA-Pen-CJK", "KaiTi", "STKaiti", serif;
  font-size: clamp(25px, 7.4vw, 31px);
  line-height: 1.45;
  text-indent: 0;
  letter-spacing: 0.02em;
}

.letter-closing {
  margin-top: 1.25em;
  text-indent: 0;
}

.letter-love {
  text-indent: 0;
  font-family: "VA-Pen-Latin", "VA-Pen-CJK", "KaiTi", "STKaiti", serif;
  font-size: clamp(21px, 6vw, 24px);
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.letter-signature {
  margin: 0.9em 0 0;
  padding-right: 6%;
  color: #2f2119;
  font-family: "VA-Pen-Latin", "VA-Pen-CJK", "KaiTi", "STKaiti", serif;
  font-size: clamp(30px, 8.6vw, 38px);
  line-height: 1.25;
  text-align: right;
  letter-spacing: 0.03em;
}

.letter-paper.is-revealing {
  animation: letter-rise 720ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes letter-rise {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .letter-paper.is-revealing {
    animation: none;
  }
}



.letter-standalone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.letter-page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: center;
}

.letter-step {
  color: var(--strawberry);
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.letter-title {
  color: var(--plum);
  font-size: clamp(20px, 5.4vw, 24px);
  line-height: 1.4;
}

.letter-sub {
  color: var(--plum-soft);
  font-size: 14px;
  line-height: 1.7;
}

.letter-envelope {
  position: relative;
  width: min(100%, 420px);
  min-height: 270px;
  margin: 2px auto;
  border: 3px solid var(--plum);
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, #f6e8d0 0 16px, #efdec1 16px 32px);
  box-shadow: var(--pixel-shadow);
  perspective: 900px;
  overflow: hidden;
}

.letter-envelope-body {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, #f6e8d0 0 16px, #efdec1 16px 32px);
}

.letter-envelope-paper {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4%;
  z-index: 1;
  height: 58%;
  border: 2.5px solid var(--plum);
  border-radius: 4px;
  background:
    radial-gradient(120% 85% at 50% 0%, rgb(255 251 241 / 70%), transparent 62%),
    repeating-linear-gradient(2deg, rgb(255 255 255 / 16%) 0 1px, transparent 1px 7px),
    #f0e4d0;
  box-shadow: 0 -4px 12px rgb(73 59 81 / 12%);
  opacity: 0;
  transform: translateY(46%) scale(0.94);
  transition: transform 700ms var(--ease-soft) 120ms, opacity 500ms var(--ease-soft) 120ms;
}

.letter-envelope-flap {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 46%;
  border-bottom: 3px solid var(--plum);
  background: linear-gradient(180deg, #efdcc0, #e5cfa9);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 620ms var(--ease-soft), opacity 220ms ease 520ms;
}

.letter-envelope-cover {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 24px;
  border: 0;
  background: transparent;
  color: var(--plum);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.letter-envelope-cover:focus-visible {
  outline: 4px solid var(--strawberry);
  outline-offset: 4px;
}

.letter-envelope-to {
  margin-top: 72px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.letter-envelope-from {
  color: var(--plum-soft);
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.letter-envelope-hint {
  margin-top: auto;
  align-self: flex-end;
  padding: 6px 11px;
  border: 2px solid var(--plum);
  border-radius: 4px;
  background: var(--strawberry);
  color: var(--cream-light);
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.letter-envelope-stamp {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 44px;
  border: 3px solid var(--plum);
  border-radius: 3px;
  background: var(--sky);
  box-shadow: 2px 2px 0 var(--plum);
}

.letter-envelope-stamp::before {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--strawberry);
  content: "";
}

.letter-envelope.is-opening .letter-envelope-flap {
  opacity: 0.85;
  transform: translateY(-12%) scaleY(0.38);
  transition: transform 620ms var(--ease-soft), opacity 260ms ease 420ms;
}

.letter-envelope.is-opening .letter-envelope-paper {
  opacity: 1;
  transform: translateY(-34%) scale(1);
  transition-delay: 240ms;
}

.letter-envelope.is-opening .letter-envelope-hint {
  display: none;
}

.letter-close-hint {
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

.letter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
}

.letter-actions .btn {
  min-height: 48px;
  padding: 0 20px;
}

.letter-after-note {
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

.letter-locked-note {
  color: var(--plum-soft);
  font-size: 14px;
  line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
  .letter-envelope-paper,
  .letter-envelope-flap {
    transition: none;
  }
}



.final-view .final-kicker {
  color: var(--strawberry);
  font-family: var(--font-pixel);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.final-gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.final-gift-title {
  color: var(--plum);
  font-size: clamp(20px, 5.4vw, 23px);
  line-height: 1.4;
}

.final-gift-body {
  color: var(--plum-soft);
  font-size: 14px;
  line-height: 1.7;
}

.final-envelope {
  width: min(100%, 220px);
  margin-top: 6px;
}

.final-gift-actions {
  display: grid;
  width: 100%;
  margin-top: 12px;
}

.final-gift-actions .btn {
  width: 100%;
  min-height: 50px;
}

.final-gift-hint {
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.6;
}

.final-gift-done {
  color: var(--plum);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.final-gift-back {
  margin-top: 4px;
}

.gift-locked-note {
  color: var(--plum-soft);
  font-size: 13.5px;
  line-height: 1.7;
}

.final-gift-card.is-opened .reward-box {
  background: var(--mint);
}


.final-view .gift-card.cake-card {
  padding: 14px 14px 10px;
}

.final-view .cake-scene {
  height: 150px;
  margin-top: 0;
}

.final-view .cake-scene .cake {
  transform: scale(0.72);
  transform-origin: center bottom;
}

.final-view .cake-scene .cake-shadow {
  bottom: 4px;
}

.final-view .gift-title {
  font-size: clamp(19px, 5.2vw, 22px);
}

.final-view .gift-sub {
  font-size: 13.5px;
}

.final-view .gift-card .btn {
  margin-top: 8px;
}

.final-view .final-gift-card {
  padding-top: 14px;
}
