*,*::before,*::after{box-sizing:border-box}h1,h2,h3,p{margin:0}img,svg{display:block;vertical-align:middle}img{max-width:100%;height:auto}button,input,textarea{font:inherit}


:root {
  --color-cream: #f6f1e8;
  --color-ink: #243044;
  --color-blush: #e7a0b0;
  --color-sky: #a9cde4;
  --color-wax: #c4844a;
  --color-paper: #fffaf3;
  --font-sans: "Be Vietnam Pro", system-ui, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --radius: 1.25rem;
}

@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }

  html,
  body {
    height: 100%;
    max-height: 100%;
    background: #140e22;
    color: #f6efe2;
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    margin: 0;
  }

  #root {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }
}

.stage {
  --px: 0;
  --py: 0;
  position: relative;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--color-sky);
  color: var(--color-ink);
}

.sky {
  position: absolute;
  inset: -4%;
  transform: translate3d(calc(var(--px) * -22px), calc(var(--py) * -14px), 0);
}

.sky img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 1s ease;
}

.sky-day {
  animation: sky-drift 32s ease-in-out infinite alternate;
}

.sky-dusk {
  opacity: 0;
}

.stage[data-dusk="true"] .sky-dusk {
  opacity: 1;
}

.cloud-belt {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  z-index: 1;
}

.cloud-shift {
  width: 100%;
  height: 100%;
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cloud-track {
  display: flex;
  width: 200%;
  height: 100%;
  animation: drift 90s linear infinite;
}

.cloud-track img {
  width: 50%;
  height: 100%;
  object-fit: cover;
}

.cloud-far {
  opacity: 0.38;
}

.cloud-far .cloud-shift {
  transform: translate3d(calc(var(--px) * -40px), calc(var(--py) * -22px - 4vh), 0) scale(1.08);
}

.cloud-far .cloud-track {
  animation-duration: 150s;
}

.cloud-mid {
  opacity: 0.5;
}

.cloud-mid .cloud-shift {
  transform: translate3d(calc(var(--px) * 86px), calc(var(--py) * 40px + 2vh), 0) scale(1.28);
}

.cloud-mid .cloud-track {
  animation-duration: 96s;
}

.cloud-near {
  opacity: 0.62;
}

.cloud-near .cloud-shift {
  transform: translate3d(calc(var(--px) * 160px), calc(var(--py) * 78px + 12vh), 0) scale(1.62);
}

.cloud-near .cloud-track {
  animation-duration: 58s;
  animation-direction: reverse;
}

.bird {
  position: absolute;
  z-index: 2;
  width: min(28vw, 220px);
  left: 4vw;
  top: 12vh;
  pointer-events: none;
  animation: fly 18s ease-in-out infinite;
  filter: drop-shadow(0 12px 16px color-mix(in srgb, var(--color-ink) 18%, transparent));
}

.florals {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  pointer-events: none;
  transform: translateY(72%);
  transition: transform 1.5s cubic-bezier(0.16, 0.84, 0.24, 1);
}

.stage[data-open="true"] .florals {
  transform: translateY(18%);
}

.stage[data-scene="letter"] .florals {
  transform: translateY(46%);
}

.stage[data-scene="isles"] .florals {
  transform: translateY(46%);
}

.stage[data-scene="stay"] .florals {
  transform: translateY(8%);
}

.mascot {
  position: absolute;
  z-index: 3;
  width: min(34vw, 210px);
  right: 6vw;
  bottom: 16vh;
  pointer-events: none;
  animation: sway 6.5s ease-in-out infinite;
  transition: right 800ms ease, bottom 800ms ease, left 800ms ease, width 800ms ease, opacity 600ms ease;
}

.stage[data-scene="letter"] .mascot {
  width: min(26vw, 160px);
  right: auto;
  left: 4vw;
  bottom: 8vh;
}

.stage[data-scene="isles"] .mascot {
  width: min(22vw, 140px);
  right: 4vw;
  bottom: auto;
  top: 18vh;
}

.stage[data-scene="lanterns"] .mascot,
.stage[data-scene="stay"] .mascot {
  width: min(30vw, 190px);
  right: 8vw;
  bottom: 18vh;
}

.petals {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  transform: translate3d(calc(var(--px) * 18px), calc(var(--py) * 12px), 0);
}

.petal {
  position: absolute;
  top: -8%;
  width: 14px;
  height: 18px;
  border-radius: 80% 10% 80% 10%;
  opacity: 0.8;
  animation: fall linear infinite;
}

.petal-0 { background: var(--color-blush); }
.petal-1 { background: var(--color-sky); }
.petal-2 { background: color-mix(in srgb, var(--color-blush) 55%, var(--color-cream)); }
.petal-3 { background: var(--color-paper); }

.stage[data-scene="bloom"] .petal {
  animation-name: burst;
}

.chrome {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  pointer-events: none;
}

.chrome .tools,
.chrome .tools * {
  pointer-events: auto;
}

.brand {
  display: none;
}

.fireflies {
  display: none;
}

.stage[data-theme="dem"] .fireflies {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform: translate3d(calc(var(--px) * -36px), calc(var(--py) * -20px), 0);
}

.stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 8% 18%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 18% 42%, #ffe7a8 60%, transparent 62%),
    radial-gradient(1.6px 1.6px at 28% 12%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 42% 28%, #fff 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 56% 16%, #ffe7a8 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 68% 34%, #fff 60%, transparent 62%),
    radial-gradient(1.4px 1.4px at 78% 14%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 88% 26%, #ffe7a8 60%, transparent 62%),
    radial-gradient(1.3px 1.3px at 34% 58%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 62% 52%, #fff 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 14% 72%, #ffe7a8 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 92% 64%, #fff 60%, transparent 62%);
  animation: twinkle 3.2s ease-in-out infinite alternate;
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -8px), 0);
}

.fireflies span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffe7a8;
  animation: firefly 9s ease-in-out infinite;
}

.stage[data-theme="dem"] {
  color: #f6efe2;
}

.stage[data-theme="dem"] .display,
.stage[data-theme="dem"] .kicker,
.stage[data-theme="dem"] .name-line,
.stage[data-theme="dem"] .soft,
.stage[data-theme="dem"] .brand,
.stage[data-theme="dem"] .hint {
  color: #f7f1e4;
  text-shadow: 0 2px 16px rgba(8, 6, 18, 0.55);
}

.stage[data-theme="dem"] .letter-sheet,
.stage[data-theme="dem"] .paper,
.stage[data-theme="dem"] .isle-back,
.stage[data-theme="dem"] .editor form {
  color: #2a2118;
  text-shadow: none;
}

.stage[data-theme="dem"] .florals {
  transform: translate3d(calc(var(--px) * 28px), 64%, 0);
}

.stage[data-theme="dem"][data-scene="letter"] .florals,
.stage[data-theme="dem"][data-scene="isles"] .florals,
.stage[data-theme="dem"][data-scene="stay"] .florals {
  transform: translate3d(calc(var(--px) * 16px), 74%, 0);
}

.stage[data-theme="dem"][data-scene="seal"] .mascot,
.stage[data-theme="dem"][data-scene="bloom"] .mascot {
  width: min(20vw, 140px);
  right: 1vw;
  bottom: 1vh;
}

.stage[data-theme="dem"] .mascot {
  transform: translate3d(calc(var(--px) * 34px), calc(var(--py) * 18px), 0);
}

.stage[data-theme="dem"] .petal-0 { background: #e07a8a; }
.stage[data-theme="dem"] .petal-1 { background: #f3cfc6; }
.stage[data-theme="dem"] .petal-2 { background: #c45c6a; }
.stage[data-theme="dem"] .petal-3 { background: #f7efe4; }

@keyframes firefly {
  0% { translate: 0 0; opacity: 0.15; }
  40% { translate: 36px -48px; opacity: 1; }
  100% { translate: -18px -12px; opacity: 0.3; }
}

@keyframes sky-drift {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to { transform: scale(1.14) translate3d(-2.2%, -1.4%, 0); }
}

@keyframes sway {
  0%, 100% { translate: 0 0; rotate: -7deg; }
  50% { translate: 12px -18px; rotate: 8deg; }
}

@keyframes twinkle {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-ink) 12%, transparent);
  background: color-mix(in srgb, var(--color-paper) 92%, #1a1028);
  color: var(--color-ink);
  transition: scale 150ms ease-out, background 180ms ease;
}

.icon-btn:active {
  scale: 0.96;
}

.icon-swap {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
}

.icon-swap span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 300ms cubic-bezier(0.2, 0, 0, 1), filter 300ms cubic-bezier(0.2, 0, 0, 1), scale 300ms cubic-bezier(0.2, 0, 0, 1);
}

.icon-swap span[data-off="true"] {
  opacity: 0;
  filter: blur(4px);
  scale: 0.25;
}

.tools {
  display: flex;
  gap: 0.4rem;
}

.scene {
  position: absolute;
  z-index: 4;
  inset: 4.5rem 0 6.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 0 1.25rem 0.5rem;
  text-align: center;
  overflow: hidden;
  container-type: size;
  min-height: 0;
}

.stage[data-scene="letter"] .scene,
.stage[data-scene="isles"] .scene {
  overflow: auto;
  scrollbar-width: thin;
}

.stage[data-scene="isles"] .scene {
  bottom: 8.25rem;
}

.envelope-btn {
  background: none;
  border: 0;
  padding: 0;
  max-height: 100%;
  min-height: 0;
  animation: bob 4.8s ease-in-out infinite;
  transition: scale 150ms ease-out;
}

.envelope-btn:active {
  scale: 0.96;
}

.envelope-btn img {
  width: min(78vw, 440px);
  height: auto;
  max-height: max(100px, calc(100cqh - 14.5rem));
  object-fit: contain;
}

.stage[data-scene="bloom"] .envelope-btn {
  animation: lift 1.7s ease forwards;
  pointer-events: none;
}

.kicker {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-ink) 68%, transparent);
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0;
}

.soft {
  max-width: 36rem;
  margin: 0.75rem auto 0;
  color: color-mix(in srgb, var(--color-ink) 78%, transparent);
  font-size: 1.05rem;
}

.name-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.7rem;
  margin: 0.2rem 0 0;
}

.paper {
  width: min(40rem, 100%);
  max-height: 100%;
  overflow: auto;
  text-align: left;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-paper) 94%, transparent);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--color-ink) 12%, transparent);
  animation: rise-in 700ms ease both;
}

.paper h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
  margin: 0.2rem 0 0.6rem;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--color-ink) 62%, transparent);
}

.eyebrow em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.35rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-ink);
}

.note {
  white-space: pre-wrap;
  margin: 0.8rem 0 0;
  font-size: 1rem;
}

.sign {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.45rem;
}

.stage[data-scene="letter"] .scene {
  overflow: visible;
}

.letter-flat {
  position: relative;
  width: min(34rem, 100%);
  margin: 1.6rem auto 0.4rem;
}

.letter-sheet {
  position: relative;
  max-height: min(74dvh, 640px);
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  text-align: center;
  padding: 1.45rem 2.8rem 4.2rem;
  color: #2a2118;
  background:
    radial-gradient(42% 28% at 16% 82%, rgba(176, 132, 78, 0.22), transparent 70%),
    radial-gradient(36% 24% at 86% 16%, rgba(150, 108, 64, 0.16), transparent 72%),
    radial-gradient(80% 60% at 50% 120%, rgba(120, 78, 40, 0.2), transparent 55%),
    radial-gradient(90% 70% at 50% -10%, rgba(255, 248, 230, 0.7), transparent 46%),
    linear-gradient(168deg, #f8efd8 0%, #f1e0be 42%, #e8d0a4 78%, #e2c696 100%);
  box-shadow:
    inset 0 0 48px rgba(120, 82, 40, 0.16),
    inset 0 0 0 1px rgba(120, 84, 42, 0.18),
    0 22px 42px rgba(48, 32, 16, 0.18);
  clip-path: polygon(
    1% 0.8%, 12% 0%, 28% 0.7%, 46% 0%, 67% 0.6%, 84% 0%, 98.4% 1%,
    100% 8%, 99.3% 24%, 100% 46%, 99.2% 68%, 100% 88%, 98.6% 99%,
    82% 100%, 61% 99.3%, 39% 100%, 18% 99.2%, 1.2% 98.4%,
    0% 86%, 0.7% 64%, 0% 38%, 0.6% 14%
  );
  animation: rise-in 700ms ease both;
}

.letter-sheet::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.letter-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(rgba(90, 60, 30, 0.35) 0.6px, transparent 0.7px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

.salute,
.script,
.closing,
.mono-sign {
  position: relative;
  font-family: "Dancing Script", cursive;
  font-weight: 500;
}

.salute {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
}

.script {
  margin: 0;
  white-space: pre-wrap;
  font-size: clamp(1.02rem, 1.75vw, 1.24rem);
  line-height: 1.42;
}

.closing {
  margin: 0.55rem 0 0;
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
}

.mono-sign {
  margin: 0.05rem 0 0.2rem;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  font-weight: 700;
}

.ink-caret {
  width: 1px;
  background: #2a2118;
}

.prop {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(40, 28, 16, 0.2));
}

.flower-tl {
  width: 78px;
  left: -18px;
  top: -22px;
  rotate: -12deg;
  z-index: 3;
}

.pen-prop {
  width: min(168px, 46%);
  left: -1%;
  bottom: 0;
  rotate: -8deg;
  z-index: 3;
}

.flower-br {
  width: 62px;
  right: -10px;
  bottom: -14px;
  rotate: 16deg;
  z-index: 3;
}

.caret {
  display: inline-block;
  width: 0.55rem;
  height: 1em;
  margin-left: 1px;
  background: var(--color-wax);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

.isles {
  width: min(58rem, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem 0.8rem;
  padding: 0.4rem 0.2rem 0.6rem;
}

.isle {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--color-ink);
  cursor: pointer;
  perspective: 1000px;
  animation: bob 6s ease-in-out infinite;
  transition: scale 150ms ease-out;
}

.isle:nth-child(odd) { rotate: -1.6deg; }
.isle:nth-child(even) { rotate: 1.5deg; }
.isle:nth-child(3n) { rotate: -0.4deg; }

.isle:active {
  scale: 0.97;
}

.isle-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 680ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.isle.is-open .isle-inner {
  transform: rotateY(180deg);
}

.isle-front,
.isle-back {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  border-radius: 2px;
  box-shadow: 0 12px 22px rgba(48, 34, 22, 0.16);
}

.isle-front {
  background: #fbf8f3;
  padding: 0.42rem 0.42rem 1.55rem;
}

.isle-front img,
.isle-plain {
  display: block;
  width: 100%;
  height: 7.2rem;
  object-fit: cover;
  border-radius: 1px;
  background: #2a1830;
}

.isle-front img.contain {
  object-fit: contain;
  padding: 0.45rem;
}

.isle-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem 0.8rem;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(255, 228, 228, 0.85), transparent 62%),
    linear-gradient(180deg, #fbf3ee, #f0d5d0);
}

.isle-back h2 {
  font-family: "Dancing Script", cursive;
  font-size: 1.65rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.1;
}

.isle-back h2::after {
  content: "";
  display: block;
  width: 2rem;
  height: 1px;
  margin: 0.35rem auto 0;
  background: #c45c6a;
}

.isle-back p {
  margin: 0.4rem 0 0;
  font-family: "Dancing Script", cursive;
  font-size: 1.15rem;
  line-height: 1.35;
}

.envelope-btn:disabled {
  opacity: 1;
  cursor: default;
}

.center {
  text-align: center;
}

.isle-front img.contain {
  object-fit: contain;
  padding: 0.45rem;
}

.lantern {
  position: absolute;
  z-index: 3;
  bottom: 22%;
  width: 92px;
  height: auto;
  pointer-events: none;
  animation: rise linear forwards;
}

.dock {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 1rem 1rem;
}

.dock-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.btn {
  min-height: 2.75rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: scale 150ms ease-out, background 180ms ease;
}

.btn:active {
  scale: 0.96;
}

.btn-ink {
  background: #8d3a52;
  color: #fff8f4;
}

.btn-ghost {
  background: color-mix(in srgb, var(--color-paper) 82%, transparent);
  color: var(--color-ink);
  border-color: color-mix(in srgb, var(--color-ink) 12%, transparent);
}

.hint {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--color-ink) 70%, transparent);
}

.editor {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--color-ink) 28%, transparent);
  padding: 1rem;
}

.editor form {
  width: min(32rem, 100%);
  background: var(--color-paper);
  color: var(--color-ink);
  border-radius: 1.25rem 1.25rem 1rem 1rem;
  padding: 1.1rem 1.1rem 1.2rem;
  box-shadow: 0 20px 50px color-mix(in srgb, var(--color-ink) 25%, transparent);
}

.editor h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
  font-weight: 600;
}

.editor header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.field input,
.field textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--color-ink);
  background: var(--color-cream);
  border: 1px solid color-mix(in srgb, var(--color-ink) 16%, transparent);
  border-radius: 0.8rem;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

@keyframes fly {
  0%, 100% { translate: 0 0; rotate: -4deg; }
  50% { translate: 8vw -3vh; rotate: 5deg; }
}

@keyframes fall {
  0% { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.9; }
  100% { transform: translate3d(var(--dx, 36px), 115vh, 0) rotate(240deg); opacity: 0.15; }
}

@keyframes burst {
  0% { transform: translate(0, 40vh) scale(0.4) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--dx, 20px), -30vh) scale(1) rotate(180deg); opacity: 0; }
}

@keyframes lift {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-6vh) scale(1.12); opacity: 0; }
}

@keyframes rise {
  0% { transform: translateY(8vh); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-95vh); opacity: 0.15; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (min-width: 800px) {
  .isles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .isle img {
    height: 8.4rem;
  }
}

@media (max-width: 420px) {
  .scene { inset: 4.2rem 0 6.6rem; }
  .flower-tl { width: 58px; left: -8px; top: -14px; }
  .pen-prop { width: 140px; bottom: 0; }
  .flower-br { width: 50px; right: 4%; bottom: 4px; }
  .letter-sheet { padding: 1.6rem 1rem 3.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud-track,
  .bird,
  .mascot,
  .petal,
  .envelope-btn,
  .isle,
  .lantern,
  .caret,
  .stars,
  .sky-day,
  .fireflies span {
    animation: none !important;
  }

  .isle-inner,
  .cloud-shift,
  .florals,
  .sky img,
  .mascot {
    transition: none;
  }

  .cloud-shift {
    transform: none !important;
  }

  .stage[data-open="true"] .florals {
    transform: translateY(18%);
  }

  .stage[data-scene="letter"] .florals,
  .stage[data-scene="isles"] .florals {
    transform: translateY(46%);
  }
}

[hidden]{display:none!important}button{font-family:inherit;touch-action:manipulation}.display,.soft,.name-line,.salute,.script,.closing,.mono-sign,.sign,.eyebrow,.isle-back,.brand,.hint,.btn{overflow-wrap:anywhere}
.stage[data-theme="dem"] .paper .soft{color:#2a2118;text-shadow:none}.brand{display:none!important}
.scene{overflow-x:hidden}.scene>div{flex-shrink:1;max-width:100%;min-width:0;min-height:0}.scene>div:not(.letter-flat){width:min(100%,70rem)}.letter-flat{width:min(720px,100%);padding-top:1.5rem;flex-shrink:0}
.stage[data-scene="seal"] .scene>div,.stage[data-scene="bloom"] .scene>div{display:flex;flex-direction:column;align-items:center;justify-content:center;max-height:100%}
.letter-sheet{max-height:min(60dvh,640px);overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.letter-sheet::-webkit-scrollbar,.scene::-webkit-scrollbar,.paper::-webkit-scrollbar,.isle-back::-webkit-scrollbar{display:none;width:0;height:0}.letter-sheet .script{white-space:pre-wrap;font-size:clamp(1rem,3.4vw,1.2rem)}
.stage[data-scene="letter"] .scene,.paper,.isle-back{scrollbar-width:none;-ms-overflow-style:none}
.reveal-letter{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;position:sticky;top:.35rem;z-index:2;margin:0 auto .85rem;border:0;border-radius:999px;padding:.55rem 1.15rem .55rem 1rem;font:600 .92rem/1 var(--font-display);letter-spacing:.02em;color:#fff8f4;background:linear-gradient(160deg,#d98a9c 0%,#b85a72 48%,#9a3f58 100%);box-shadow:0 8px 18px rgba(122,40,62,.28),inset 0 1px 0 rgba(255,255,255,.35);transition:transform 160ms ease,box-shadow 160ms ease}
.reveal-letter:hover{transform:translateY(-1px);box-shadow:0 10px 22px rgba(122,40,62,.34),inset 0 1px 0 rgba(255,255,255,.4)}
.reveal-letter:active{transform:translateY(1px) scale(.98)}
.reveal-heart{display:inline-block;font-size:.95rem;line-height:1;color:#ffe3ea;filter:drop-shadow(0 1px 0 rgba(90,20,40,.25));animation:reveal-pulse 1.6s ease-in-out infinite}
@keyframes reveal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.14)}}
.isles{margin-inline:auto}.isle{min-width:0}.isle-inner{min-height:11rem}.isle-back{max-height:100%;overflow:auto}.soft,.isle-back p{white-space:pre-wrap}
button:focus-visible,.letter-sheet:focus-visible{outline:3px solid #d19b82;outline-offset:3px}.btn{max-width:100%;white-space:normal}.dock-row{max-width:100%}.dock-row .btn-ghost{flex-shrink:0}.dock-row .btn-ink{flex:0 1 auto;min-width:0}
.envelope-btn img{max-height:max(100px,calc(100cqh - 14.5rem));width:auto;max-width:min(78vw,440px);object-fit:contain}
.stage[data-scene="seal"] .display{font-size:clamp(1.55rem,5.2vw,4.4rem);margin-top:.2rem}.stage[data-scene="seal"] .soft{margin-top:.4rem;font-size:.92rem}.stage[data-scene="seal"] .kicker{margin-top:.25rem}.stage[data-scene="seal"] .name-line{font-size:clamp(1.35rem,4vw,1.7rem)}
.stage[data-scene="seal"] .scene,.stage[data-scene="bloom"] .scene,.stage[data-scene="lanterns"] .scene,.stage[data-scene="stay"] .scene{overflow:hidden}
.stage .scene,.stage[data-scene="isles"] .scene{bottom:calc(var(--dock-height,6.4rem) + .75rem)}html[data-confession-editor="true"] .dock{bottom:64px}html[data-confession-editor="true"] .stage .scene{bottom:calc(var(--dock-height,6.4rem) + .75rem + 64px)}
@media(max-width:420px){.letter-sheet{max-height:56dvh}.hint{max-width:95%;font-size:.78rem}.letter-sheet .script{font-size:1rem}.reveal-letter{font-size:.88rem;padding:.5rem 1rem}}
@media(prefers-reduced-motion:reduce){.paper,.letter-sheet{animation:none}.lantern{display:none}.petal{opacity:.4}}

/* Keep touch targets still while the photographs retain their gentle float. */
.isle{animation:none}
.isle-inner{animation:bob 6s ease-in-out infinite;animation-delay:inherit}
.isle:focus-visible .isle-inner,.isle:hover .isle-inner{animation-play-state:paused}
.envelope-btn:hover,.envelope-btn:focus-visible{animation-play-state:paused}
.stage[data-paused="true"] *{animation-play-state:paused!important}
.stage[data-scene="seal"] .scene,.stage[data-scene="bloom"] .scene,.stage[data-scene="lanterns"] .scene,.stage[data-scene="stay"] .scene{overflow-y:auto}
.stage[data-scene="seal"] .scene>div,.stage[data-scene="bloom"] .scene>div{max-height:none;min-height:100%;flex-shrink:0}
.stage[data-scene="lanterns"] .scene>div,.stage[data-scene="stay"] .scene>div{flex-shrink:0}
.isle-back p{user-select:text}
.lantern-status{margin:.75rem 0 0;font-size:.85rem;color:#f7f1e4}
.reveal-letter{min-height:44px}
@media(prefers-reduced-motion:reduce){.isle-inner,.reveal-heart{animation:none!important}}

/* Reserve the dock's measured space even on short landscape screens. Long
   letters scroll inside their paper instead of painting beneath the buttons. */
.stage[data-scene="letter"] .scene{overflow:hidden}
.letter-flat{margin-block:0}
.letter-sheet{max-height:min(60dvh,640px,calc(100cqh - 3rem))}
@media(max-width:420px){.letter-sheet{max-height:min(56dvh,calc(100cqh - 3rem))}}
