html:is([data-scene="letter"], [data-scene="confession"]) .sky { background: #090e1d; }
html:is([data-scene="letter"], [data-scene="confession"]) .sky-cloud {
  background-image: url("../assets/images/midnight-dust.webp");
  opacity: .72;
}
html[data-scene="letter"] .sky::after {
  background: radial-gradient(ellipse at 1% 12%, #5a38765c, transparent 48%),
              radial-gradient(ellipse at 90% 92%, #7d477753, transparent 48%),
              radial-gradient(ellipse at 53% 39%, #14112404, #080b176f 81%);
}
html[data-scene="confession"] .sky::after {
  background: radial-gradient(ellipse at 44% 43%, #3925412b, #0b1123a0 78%);
}
.finale-forward {
  background: linear-gradient(112deg, #e6c19f, #fff0d6 53%, #e8bca1);
  border-color: #fce6cd6b;
  color: #251a24;
  box-shadow: 0 4px 19px #e3ab8542;
}
.finale-forward:hover { background: #fff0da; }
.finale-heading { text-align: center; }
.finale-heading .eyebrow, .confession-content .eyebrow {
  font: 400 clamp(12px, 3vw, 17px)/1.2 var(--serif);
  letter-spacing: .23em;
  color: var(--champagne);
}
.finale-heading h2, .confession-content h2 {
  color: var(--ivory);
  font: 400 clamp(32px, 10vw, 67px)/1.2 var(--display-song);
  letter-spacing: .05em;
  margin-top: 8px;
}
.letter-heading-star {
  display: flex;
  align-items: center;
  justify-content: center;
  column-gap: 9px;
  margin-bottom: 9px;
  color: var(--champagne);
  font-size: clamp(20px, 5vw, 29px);
  line-height: 1;
  text-shadow: 0 0 17px #ecaa6f84;
}
.letter-heading-star::before, .letter-heading-star::after {
  content: "";
  width: clamp(20px, 7vw, 51px);
  height: 1px;
  background: linear-gradient(90deg, transparent, #f3c49b9a);
}
.letter-heading-star::after { transform: scaleX(-1); }
.letter .finale-heading .eyebrow span { font-size: .63em; }
.letter .finale-heading h2 { color: #f7d7b5; transform: skewX(-6deg); }
.letter-flourish { width: min(76%, 420px); margin: 3px auto 0; color: #e4b995ac; }
.letter {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  gap: clamp(15px, 3.5svh, 31px);
  padding: clamp(22px, 5svh, 48px) 0 clamp(28px, 6svh, 54px);
}
.letter-stage { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: start; width: min(100%, 680px); }
.letter-sealed, .letter-paper, .letter-opening { grid-area: 1/1; }
.letter-sealed {
  min-width: 0;
  width: min(100%, 638px);
  display: grid;
  justify-items: center;
  gap: clamp(13px, 2.4svh, 24px);
  padding: 0 0 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.letter-stage[data-letter-phase="opening"] .letter-sealed {
  animation: release-envelope var(--opening-duration) linear both;
}
.letter-stage[data-letter-phase="opening"] .letter-open-label { visibility: hidden; }
.letter-opening {
  position: relative;
  display: grid;
  place-items: center;
  width: min(93%, 580px);
  aspect-ratio: 1.42;
  isolation: isolate;
  animation: opening-stage var(--opening-duration) linear both;
}
.opening-envelope {
  width: 84%;
  height: 50%;
  position: absolute;
  bottom: 10%;
  isolation: isolate;
  border-radius: 5%;
  border: 1px solid #dbad98;
  background: linear-gradient(145deg, #6f475e, #4c314a);
  box-shadow: 0 14px 30px #08061085, 0 0 20px #ebac9b25;
}
.opening-flap, .opening-pocket, .opening-note, .opening-seal { position: absolute; }
.opening-flap {
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 52% 76%, 48% 76%);
  transform: scaleY(-1);
  transform-origin: top;
  background: linear-gradient(#c18b93, #986878);
  animation: opening-flap var(--opening-duration) ease-out both;
}
.opening-note {
  top: 0;
  left: 9%;
  width: 82%;
  height: 87%;
  display: grid;
  place-items: center;
  z-index: 1;
  background: linear-gradient(142deg, #f7e7cc, #e6c9a9);
  border: 1px solid #e7bc94;
  border-radius: 3px;
  box-shadow: 0 2px 13px #1c0f1c70;
  color: #b9896f;
  font-size: clamp(13px, 4vw, 24px);
  animation: opening-note var(--opening-duration) cubic-bezier(.28,.74,.3,1) both;
}
.opening-pocket {
  inset: 0;
  border-radius: inherit;
  clip-path: polygon(0 18%, 50% 69%, 100% 18%, 100% 100%, 0 100%);
  z-index: 2;
  background: linear-gradient(145deg, #d8a3a443, #9e657ca8),
              url("../assets/images/letter-envelope.webp") center 93% / 116% auto no-repeat,
              #9c657a;
}
.opening-seal {
  top: 49%;
  left: 50%;
  z-index: 3;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: clamp(25px, 8vw, 47px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #e4ae9e;
  color: #fce0a5;
  background: radial-gradient(circle at 35% 24%, #c68b91, #813f59);
  animation: opening-seal var(--opening-duration) ease-out both;
}
.letter-opening .falling i {
  visibility: visible;
  animation: petal-fall .9s .14s ease-out both;
}
.letter-opening .falling i + i { left: 74%; animation-delay: .25s; }
.envelope-scene {
  position: relative;
  display: block;
  width: 100%;
  isolation: isolate;
}
.envelope-scene::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -6% 17% 21% 13%;
  background: url("../assets/images/crescent-ivory.webp") 48% 0 / contain no-repeat;
  opacity: .58;
  filter: drop-shadow(0 0 16px #f1b77775);
  transform: rotate(28deg);
}
.envelope-art {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 14px 24px #08050fc2);
}
.envelope-orbit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.letter-open-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 4vw, 22px);
  min-height: clamp(49px, 10vw, 63px);
  min-width: clamp(196px, 55vw, 305px);
  padding: 5px 15px 7px;
  border: 1px solid #f2c6a5;
  border-radius: 999px;
  color: #ffe1be;
  background: radial-gradient(ellipse at 54% 118%, #a563566e, transparent 65%),
              linear-gradient(155deg, #5a3e53, #2c233a 69%, #4a2e46);
  box-shadow: inset 0 1px 8px #ffcb9a69, 0 0 23px #d58c786c;
  font: 400 clamp(20px, 5.5vw, 29px) var(--display-song);
  letter-spacing: .085em;
  transition: box-shadow .22s, color .22s;
}
.letter-open-label span { font-size: .8em; color: #efc49f; }
.letter-open-label span:last-child { font: 1.27em/1 var(--serif); }
.letter-sealed:hover .letter-open-label { color: #fff1dc; box-shadow: inset 0 1px 10px #ffd0a4aa, 0 0 29px #d58c78a8; }
.letter-paper {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  padding: clamp(25px, 7vw, 54px) clamp(20px, 7vw, 59px);
  border-radius: 3px 6px 5px 3px;
  background:
    radial-gradient(ellipse at 100% 0%, #daba9278, transparent 51%),
    linear-gradient(114deg, #f3dfc2, #faead4 47%, #efddc5);
  color: #42323d;
  box-shadow: 0 17px 51px #030610a1, inset 0 0 0 1px #6a394d42;
  animation: unfold-paper .34s cubic-bezier(.18, .75, .25, 1) both;
}
.letter-paper::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 8px;
  border: 1px solid #a6795f4c;
  border-radius: 2px;
}
.letter-salutation, .letter-signature {
  font: 400 clamp(17px, 4.4vw, 24px)/1.4 var(--brush);
  color: #603c52;
}
.letter-body {
  margin: 15px 0 22px;
  font: 400 clamp(15px, 3.76vw, 18px)/1.92 "Starlight Letter", "Songti SC", SimSun, var(--body);
}
.letter-body p + p { margin-top: .83em; }
.letter-body strong { color: #784762; }
.letter-signature { text-align: right; }
.letter-actions .text-button, .confession-choices .text-button { border-color: #e5bda378; }

.confession {
  display: grid;
  align-content: center;
  justify-items: center;
  width: min(100%, 1080px);
  margin-inline: auto;
  padding-block: 18px clamp(25px, 6svh, 62px);
}
.confession-art {
  position: relative;
  width: min(100%, 495px);
  height: clamp(224px, 34svh, 405px);
  isolation: isolate;
  overflow: hidden;
}
.confession-art::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: radial-gradient(ellipse at 51% 42%, #c180aa36, transparent 63%);
  pointer-events: none;
}
.confession-moon {
  position: absolute;
  inset: -4% 1% 3% 28%;
  z-index: -2;
  opacity: .41;
  rotate: 22deg;
  background: url("../assets/images/crescent-ivory.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 26px #ebac8a57);
}
.confession-orbit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 91%;
  color: #f3bc94;
  z-index: -1;
}
.confession-art img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 75%;
  object-fit: contain;
  margin: auto;
  filter: saturate(1.02) drop-shadow(0 8px 22px #040615c5);
  mask-image: linear-gradient(#000 82%, transparent);
  transform-origin: 50% 95%;
  animation: confession-flower 8s ease-in-out infinite alternate;
}
html[data-paused] .confession-art img { animation-play-state: paused; }
.confession .falling i { visibility: visible; animation: petal-fall 11s 1.3s ease-in-out infinite both; }
.confession .falling i:nth-child(2) { left: 72%; animation-delay: 3.2s; width: 5px; height: 9px; }
.confession .falling i:nth-child(3) { left: 58%; animation-delay: 6s; width: 6px; height: 10px; }
.confession-content { width: min(100%, 530px); text-align: center; }
.confession.entered .confession-line,
.confession.entered .confession-question,
.confession.entered .confession-content h2 { animation: confession-type-in .55s .14s ease both; }
.confession.entered .confession-content h2 { animation-delay: .25s; }
.confession.entered .confession-question { animation-delay: .32s; }
.confession-line {
  margin: 8px auto 15px;
  max-width: 24em;
  color: #ecd5c8;
  font: 400 clamp(15px, 4vw, 20px)/1.6 var(--display-song);
  text-wrap: balance;
}
.confession-content h2 { margin-block: 13px 6px; color: #f8d9bd; }
.confession-question {
  color: #f8ded1;
  font: 400 clamp(17px, 4.5vw, 27px)/1.5 var(--display-song);
  margin-bottom: 18px;
}
.confession-choices button {
  width: min(145px, 43%);
  font-family: var(--display-song);
  font-size: clamp(14px, 3.8vw, 18px);
}
.confession-choices { gap: clamp(11px, 3.6vw, 19px); }
.confession-choices .text-button {
  color: #f6d8be;
  background: #211b2aac;
  border-color: #dfb29694;
}
.confession-choices .text-button:hover { background: #493044d9; }
.confession-choices .confession-primary {
  --choice-shadow: 0 5px 24px #e9a39672, inset 0 1px 2px #fff8e0c9;
  color: #382230;
  background: linear-gradient(112deg, #f8bfb8, #fff2d5 49%, #edaaae);
  border-color: #fbd6ba;
  box-shadow: var(--choice-shadow);
}
.confession-choices .confession-primary:hover {
  background: linear-gradient(112deg, #ffd1c7, #fff7e3 49%, #f6bfc2);
}
.confession-choices button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #f7ddbb, var(--choice-shadow, 0 0 18px #e1a99563);
}
.confession-reply {
  display: grid;
  align-content: center;
  min-height: 98px;
  margin: 14px auto 0;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background-color .3s, border-color .3s;
  color: #f3e1dc;
}
.confession[data-answer] .confession-reply { border-color: #e8c29d68; }
#confession-reply-title { font: 400 19px/1.35 var(--display-song); color: #ffdfc1; }
#confession-reply-body { font-size: 13px; margin-top: 6px; }
.confession[data-answer="yes"] .confession-reply { background: #4d2f4f91; }
.confession[data-answer="very"] .confession-reply { background: #603c548e; }
.confession-links {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 14px;
  visibility: hidden;
}
.confession[data-answer] .confession-links { visibility: visible; }
.confession-links a { display: inline-grid; place-items: center; min-height: 44px; color: var(--champagne); font-size: 13px; }

@keyframes unfold-paper {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
@keyframes release-envelope {
  0% { opacity: 1; }
  23%, 100% { opacity: 0; }
}
@keyframes opening-stage {
  0% { opacity: 0; }
  23%, 86% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes opening-flap {
  0%, 14% { transform: scaleY(1); }
  50%, 100% { transform: scaleY(-1); }
}
@keyframes opening-note {
  0%, 28% { transform: translateY(52%); }
  84%, 100% { transform: translateY(-83%); }
}
@keyframes opening-seal {
  0%, 16% { opacity: 1; transform: none; }
  43%, 100% { opacity: 0; transform: translateY(32%) rotate(16deg); }
}
@keyframes confession-flower { from { transform: rotate(-3deg); } to { transform: rotate(.3deg); } }
@keyframes confession-type-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 800px) {
  .confession { grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; }
}

@font-face {
  font-family: "Starlight Letter";
  src: url("../assets/fonts/song-letter.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

