* { 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%;
    background: var(--color-cream);
    color: var(--color-ink);
    font-family: var(--font-sans);
    line-height: 1.5;
  }

  body {
    margin: 0;
    overflow: hidden;
  }
}

.stage {
  --px: 0;
  --py: 0;
  position: relative;
  height: 100dvh;
  /* Clip the sky without creating a programmatically scrollable ancestor.
     Letter and memory content keep their own .scene scroll region. */
  overflow: clip;
  background: var(--color-sky);
  color: var(--color-ink);
}

.sky,
.sky img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sky img {
  transform: scale(1.08) translate(calc(var(--px) * -14px), calc(var(--py) * -10px));
  transition: transform 700ms ease-out, opacity 1.1s ease;
}

.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: bob 5.5s ease-in-out infinite;
  filter: drop-shadow(0 16px 18px color-mix(in srgb, var(--color-ink) 16%, transparent));
  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;
}

.petal {
  position: absolute;
  top: -8%;
  width: 12px;
  height: 16px;
  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;
}

.brand {
  display: none;
}

.dots {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-paper) 72%, transparent);
  backdrop-filter: blur(10px);
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--color-ink) 35%, transparent);
  background: transparent;
  padding: 0;
}

.dot[data-on="true"] {
  background: var(--color-ink);
  border-color: var(--color-ink);
}

.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) 78%, transparent);
  color: var(--color-ink);
  backdrop-filter: blur(10px);
  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: auto;
}

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

.envelope-btn {
  --env-w: min(78vw, 400px);
  background: none;
  border: 0;
  padding: 0;
  animation: bob 4.8s ease-in-out infinite;
  transition: scale 150ms ease-out;
}

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

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

.env {
  position: relative;
  display: block;
  width: var(--env-w);
  margin-inline: auto;
}

.env-art {
  position: relative;
  z-index: 3;
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 22px 24px color-mix(in srgb, var(--color-ink) 18%, transparent));
}

.env-letter {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 0;
  height: 58%;
  z-index: 1;
  border-radius: 0.3rem 0.3rem 0.12rem 0.12rem;
  background: linear-gradient(180deg, #fffefb 0%, #f6ebe0 100%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--color-ink) 6%, transparent),
    0 8px 14px color-mix(in srgb, var(--color-ink) 10%, transparent);
  transform: translate3d(0, 55%, 0);
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.env-letter-rule {
  position: absolute;
  inset: 24% 16% auto;
  height: 40%;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 0.7rem,
    color-mix(in srgb, var(--color-blush) 32%, transparent) 0.7rem 0.76rem
  );
  opacity: 0.7;
}

.env-letter-heart {
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
  color: color-mix(in srgb, var(--color-wax) 78%, var(--color-blush));
  opacity: 0.85;
}

.env-seal {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 4;
  width: 3.05rem;
  height: 3.05rem;
  margin: 0 0 0 -1.525rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 32% 28%, #f0d08a 0%, #d4a04e 38%, #b8732e 72%, #8d5419 100%);
  box-shadow:
    inset 0 2px 3px color-mix(in srgb, #fff 55%, transparent),
    inset 0 -3px 5px color-mix(in srgb, #5c3010 35%, transparent),
    0 8px 14px color-mix(in srgb, var(--color-ink) 22%, transparent);
  opacity: 0;
  pointer-events: none;
}

.env-seal-heart {
  color: color-mix(in srgb, #6b3414 80%, #fff);
  font-size: 1rem;
  line-height: 1;
}

.stage[data-scene="bloom"] .env {
  animation: env-stage-exit 1s cubic-bezier(0.22, 0.82, 0.18, 1) 1.45s forwards;
}

.stage[data-scene="bloom"] .env-art {
  animation: env-art-open 1.55s cubic-bezier(0.18, 0.8, 0.2, 1) forwards;
}

.stage[data-scene="bloom"] .env-letter {
  opacity: 1;
  animation: env-letter-rise 1.5s cubic-bezier(0.18, 0.84, 0.2, 1) 0.2s forwards;
}

.stage[data-scene="bloom"] .env-seal {
  opacity: 1;
  animation: env-seal-break 1.15s cubic-bezier(0.18, 0.84, 0.22, 1) 0.08s forwards;
}


.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) 82%, transparent);
  backdrop-filter: blur(8px);
  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;
  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::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: #d5e4f0;
}

.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, 252, 245, 0.9), transparent 60%),
    linear-gradient(180deg, #f7f0e2, #efe2cc);
}

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

.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;
  filter: drop-shadow(0 10px 12px color-mix(in srgb, var(--color-ink) 20%, transparent));
}

.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: var(--color-ink);
  color: var(--color-cream);
}

.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);
  backdrop-filter: blur(8px);
}

.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: translateY(0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.85; }
  100% { transform: translateY(110vh) rotate(220deg); opacity: 0.2; }
}

@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 env-art-open {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(3px) scale(1.015); }
  100% { transform: translateY(-6px) scale(1.03); }
}

@keyframes env-letter-rise {
  0% { transform: translate3d(0, 55%, 0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate3d(0, -18%, 0); opacity: 1; }
}

@keyframes env-seal-break {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  16% { transform: scale(1.16) rotate(-10deg); }
  40% { transform: translate3d(10px, -16px, 0) rotate(12deg); opacity: 1; }
  100% { transform: translate3d(56px, 120px, 0) rotate(52deg) scale(0.88); opacity: 0; }
}

@keyframes env-stage-exit {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-6vh) scale(1.08); opacity: 0; }
}

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

@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); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: 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) {
  .brand { display: none; }
  .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 {
    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; }
.display, .soft, .name-line, .salute, .script, .closing, .mono-sign, .sign, .eyebrow, .isle-back { overflow-wrap: anywhere; }
.isle-inner { min-height: 11rem; }
.isle-back { max-height: 100%; overflow: auto; }
.scene > div { flex-shrink: 0; }
.scene > div:not(.letter-flat) { width: min(100%, 70rem); }
.stage[data-scene="letter"] .scene { overflow: auto; }
.letter-flat { padding-top: 1.5rem; }
.letter-sheet { max-height: min(60dvh, 640px); }
button:focus-visible, .letter-sheet:focus-visible { outline: 3px solid var(--color-ink); outline-offset: 3px; }
.dots { gap: 0; }
.dot { position: relative; width: 1.65rem; height: 2rem; border: 0; background: none; }
.dot[data-on="true"] { background: none; }
.dot::before { content: ""; position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; width: .7rem; height: .7rem; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--color-ink) 35%, transparent); }
.dot[data-on="true"]::before { background: var(--color-ink); border-color: var(--color-ink); }
@media (max-width: 420px) { .letter-sheet { max-height: 56dvh; } }

.envelope-btn { --env-w: min(78vw, 360px); }
.env-art { max-height: max(140px, calc(100dvh - 23rem)); width: auto; max-width: 100%; margin-inline: auto; object-fit: contain; }

.soft, .isle-back p { white-space: pre-wrap; }

/* Keep the watercolor scene lightweight and responsive to the page lifecycle. */
.stage[data-visible="false"] *,
.stage[data-visible="false"] *::before,
.stage[data-visible="false"] *::after { animation-play-state: paused !important; }
.scene { overscroll-behavior: contain; scrollbar-width: thin; }
.scene:focus { outline: none; }
.letter-sheet { overscroll-behavior: contain; scrollbar-width: thin; scroll-behavior: auto; }
.letter-skip {
  display: block;
  min-height: 44px;
  margin: .6rem auto 0;
  padding: .45rem .85rem;
  border: 1px solid rgb(120 84 42 / 30%);
  border-radius: 999px;
  background: rgb(255 250 243 / 78%);
  color: #49351e;
  font: 500 .8rem var(--font-sans);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.lantern-status { min-height: 1.5em; margin-top: .65rem; font-size: .85rem; }
.isle-front { min-width: 0; }
.isle-front img[hidden] { display: none; }
.isle-back { -webkit-backface-visibility: hidden; }
.dock { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.scene { bottom: calc(6.4rem + env(safe-area-inset-bottom)); }
.stage[data-scene="isles"] .scene { bottom: calc(8.25rem + env(safe-area-inset-bottom)); }
@media (max-width: 420px) { .scene { bottom: calc(6.6rem + env(safe-area-inset-bottom)); } }
@media (max-width: 380px) {
  .dock { padding-inline: .6rem; }
  .dock-row { gap: .4rem; width: 100%; }
  .dock-row .btn { padding-inline: .8rem; font-size: .86rem; }
}
@media (max-height: 500px) {
  .chrome { padding-top: .45rem; }
  .scene { top: 3.2rem; }
  .letter-flat { margin-top: .5rem; padding-top: .75rem; }
  .letter-sheet { max-height: 48dvh; }
  .hint { font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .paper, .letter-sheet { animation: none; }
  .stage[data-scene="bloom"] .envelope-btn,
  .stage[data-scene="bloom"] .env,
  .stage[data-scene="bloom"] .env-art,
  .stage[data-scene="bloom"] .env-letter,
  .stage[data-scene="bloom"] .env-seal {
    animation: none !important;
  }
  .stage[data-scene="bloom"] .env-letter {
    opacity: 1;
    transform: translate3d(0, -18%, 0);
  }
}

.isles { margin-inline: auto; }
@media (max-width: 420px) {  }

.ink-bottle { display: none; }

.dots, .dot { display: none !important; }
.stage[data-dusk="true"] .sky-dusk[data-ready="false"] { opacity: 0; }
