:root {
  color-scheme: dark;
  --night: #11102a;
  --violet: #30214f;
  --lavender: #d7c5ff;
  --gold: #f5d992;
  --text: #f8f3ff;
  --muted: #d5cde6;
  --glass: rgba(31, 24, 57, .58);
  --line: rgba(238, 222, 255, .18);
  font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 55%, rgba(111, 77, 139, .53), transparent 44%),
    linear-gradient(180deg, #090d22 0%, #17132f 45%, #38264c 78%, #684565 100%);
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, audio:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
button:disabled { cursor: not-allowed; opacity: .58; }
::selection { color: #1b1530; background: var(--gold); }

#sky, .sky-glow, .moon { position: fixed; pointer-events: none; }
#sky { z-index: 0; inset: 0; width: 100%; height: 100%; }
.sky-glow {
  z-index: 0; left: 50%; top: 24%; width: min(80vw, 680px); height: min(80vw, 680px);
  border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(210, 192, 255, .1), rgba(171, 135, 223, .035) 44%, transparent 70%);
}
.moon {
  z-index: 0; top: clamp(70px, 12vh, 130px); left: 50%; width: clamp(86px, 18vw, 156px);
  aspect-ratio: 1; border-radius: 50%; transform: translateX(-50%);
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,.95), transparent 34%),
    radial-gradient(circle at 69% 65%, rgba(190, 179, 219, .62) 0 5%, transparent 6%),
    radial-gradient(circle at 37% 67%, rgba(180, 168, 210, .54) 0 8%, transparent 9%),
    radial-gradient(circle at 61% 32%, rgba(179, 166, 207, .4) 0 4%, transparent 5%),
    #f6eddb;
  box-shadow: 0 0 28px 8px rgba(245, 232, 255, .24), 0 0 100px 40px rgba(184, 159, 231, .14);
  animation: moon-rise 1.8s ease-out both;
}
.moon span {
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at 68% 71%, transparent 0 25%, rgba(255,255,255,.14) 60%, transparent 72%);
}
@keyframes moon-rise { from { opacity: 0; translate: 0 42px; } to { opacity: 1; translate: 0 0; } }

main { position: relative; z-index: 1; width: min(100% - 32px, 980px); margin: 0 auto; padding: 1px 0 50px; }
.screen { min-height: 100svh; display: grid; place-items: center; padding: 215px 0 125px; }
.hidden { display: none !important; }
.glass {
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px); box-shadow: 0 18px 70px rgba(5, 5, 20, .25), inset 0 1px rgba(255,255,255,.08);
}
.gate-card, .letter, .section-block.glass, .daily-card, .reasons-card, .game-card, .closing-card {
  width: 100%; border-radius: 26px; padding: 28px 22px; text-align: center;
}
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: .67rem; font-weight: 700; letter-spacing: .19em; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-weight: 500; }
.gate-card h1, .welcome h1, .letter-title, .section-heading h2, .section-block h2, .closing-card h2 {
  font-family: "Dancing Script", cursive; font-weight: 600;
}
.gate-card h1 { margin-bottom: 12px; font-size: clamp(2.4rem, 11vw, 3.8rem); line-height: 1.06; }
.gate-copy { color: var(--muted); line-height: 1.7; font-size: .94rem; }
.gate-card form { margin-top: 27px; text-align: left; }
.gate-card label { display: block; margin-bottom: 9px; font-size: .83rem; color: #f0e9fb; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  min-width: 0; flex: 1; border: 1px solid rgba(255,255,255,.2); border-radius: 13px;
  padding: 13px 12px; color: white; background: rgba(255,255,255,.08);
}
.input-row input::placeholder { color: #c1b6d1; font-size: .78rem; }
.hint, .form-message { margin: 12px 0 0; min-height: 1em; color: var(--muted); font-size: .77rem; }
.form-message { color: #ffe5b2; }
.button {
  min-height: 46px; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; padding: 11px 20px;
  background: rgba(255,255,255,.09); cursor: pointer; font-size: .88rem; font-weight: 600;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.button:hover { transform: translateY(-2px); background: rgba(255,255,255,.16); }
.button-gold { color: #302344; border-color: rgba(255,235,185,.6); background: linear-gradient(135deg, #f8e6b8, #e6c982); box-shadow: 0 5px 25px rgba(238, 208, 144, .17); }
.button-gold:hover { background: linear-gradient(135deg, #fff1ca, #efd99d); }
.button-quiet { color: var(--muted); }

.envelope-screen { align-content: center; gap: 20px; }
.envelope-screen > .eyebrow { margin: 0; }
.envelope { position: relative; width: min(76vw, 310px); height: 190px; border: 0; padding: 0; background: transparent; cursor: pointer; perspective: 700px; filter: drop-shadow(0 18px 30px rgba(6,5,21,.35)); }
.envelope::before { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(140deg, #bba8da, #75538e 75%); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); border-radius: 12px; }
.envelope-letter { position: absolute; z-index: 1; left: 9%; right: 9%; bottom: 8px; height: 78%; background: #fff8e9; border-radius: 7px; transition: transform .8s ease; }
.envelope-letter::before { content: "Para ti"; display: block; padding-top: 34px; color: #795a8b; font: 600 1.5rem "Dancing Script", cursive; }
.envelope-flap { position: absolute; inset: 0 0 1px; z-index: 3; background: linear-gradient(145deg, #ddc9ec, #9672aa); clip-path: polygon(0 0, 100% 0, 50% 59%); transform-origin: top; transition: transform .7s ease, z-index .01s .35s; }
.wax-seal { position: absolute; z-index: 4; left: 50%; top: 43%; display: grid; place-items: center; width: 49px; height: 49px; border: 2px solid rgba(255,255,255,.2); border-radius: 50%; transform: translate(-50%, -50%); color: #f6dce9; background: radial-gradient(circle at 35% 30%, #a879b7, #562c6f); box-shadow: 0 4px 12px #291530; font-size: 1.3rem; transition: opacity .3s ease; }
.envelope.open .envelope-flap { z-index: 0; transform: rotateX(180deg); }
.envelope.open .envelope-letter { transform: translateY(-82px); }
.envelope.open .wax-seal { opacity: 0; }
.envelope-caption { color: var(--muted); }

.letter-screen { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 15px; }
.letter { padding: 30px 22px; }
.letter-title { margin: 0 0 22px; font-size: clamp(2.5rem, 10vw, 4rem); }
.chapter-progress { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 23px; }
.progress-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.28); }
.progress-dot.active { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.progress-line { width: 28px; height: 1px; background: rgba(255,255,255,.2); }
.letter h2 { margin-bottom: 12px; font-size: 1.1rem; color: var(--gold); }
.typed-copy { min-height: 125px; margin: 0 auto; max-width: 620px; color: #f6efff; font: 500 1.55rem/1.48 "Dancing Script", cursive; white-space: pre-line; }
.letter-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.signature { margin: 22px 0 0; color: var(--gold); font: 600 1.7rem "Dancing Script", cursive; }
.music-dock { position: fixed; z-index: 5; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); width: min(calc(100% - 24px), 390px); padding: 10px 12px; border-radius: 20px; transform: translateX(-50%); }
.music-player { display: flex; align-items: center; gap: 13px; padding: 0 2px 8px; }
.vinyl { position: relative; display: grid; flex: 0 0 42px; place-items: center; width: 42px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: repeating-radial-gradient(circle, #181526 0 3px, #393149 4px 5px, #191625 6px 8px); box-shadow: 0 0 15px rgba(245,217,146,.22); }
.vinyl::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: linear-gradient(135deg, #f8e6b8, #a872aa 75%); }
.vinyl span { z-index: 1; width: 5px; aspect-ratio: 1; border-radius: 50%; background: #281d32; }
.music-dock.playing .vinyl { animation: vinyl-spin 2.2s linear infinite; }
@keyframes vinyl-spin { to { transform: rotate(360deg); } }
.music-track { flex: 1; text-align: left; }
.music-track strong, .music-track small { display: block; }
.music-track strong { font-size: .88rem; letter-spacing: .06em; }
.music-track small { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.music-toggle { min-height: 40px; padding: 8px 13px; border-radius: 12px; color: var(--text); cursor: pointer; }
.music-dock audio { display: block; width: 100%; height: 40px; }

.content { padding-top: 170px; padding-bottom: 140px; }
.welcome { padding: 28px 4px 50px; text-align: center; }
.welcome h1 { margin-bottom: 7px; font-size: clamp(2.9rem, 12vw, 5.2rem); }
.welcome > p:last-child { color: var(--muted); line-height: 1.6; }
.section-block { margin: 0 auto 55px; scroll-margin-top: 25px; }
.section-heading { margin-bottom: 22px; text-align: center; }
.section-heading h2, .section-block h2 { margin-bottom: 10px; font-size: clamp(2.2rem, 9vw, 3.3rem); }
.section-heading > p:last-child, .section-block > p:not(.eyebrow):not(.daily-quote):not(.prayer):not(.game-message):not(.growing-note) { color: var(--muted); line-height: 1.6; }
.message-sky { position: relative; min-height: 250px; overflow: hidden; border-radius: 24px; }
.message-star { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; color: #fff1b8; background: transparent; cursor: pointer; font-size: 1.5rem; text-shadow: 0 0 16px #f7d58b; animation: twinkle 2.5s ease-in-out infinite alternate; }
.message-star:nth-child(2n) { animation-delay: .8s; }
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
.when-grid, .promise-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.when-button { min-height: 72px; border-radius: 18px; text-align: left; }
.when-button span { display: block; color: var(--gold); font-size: 1.3rem; margin-bottom: 4px; }
.promise-card { min-height: 180px; padding: 0; border: 0; background: transparent; perspective: 800px; cursor: pointer; }
.promise-inner { position: relative; display: block; width: 100%; height: 100%; min-height: 180px; transform-style: preserve-3d; transition: transform .65s ease; }
.promise-card.flipped .promise-inner { transform: rotateY(180deg); }
.promise-face { position: absolute; inset: 0; display: grid; align-content: center; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); backface-visibility: hidden; }
.promise-face strong { color: var(--gold); font-size: .9rem; }
.promise-face span { margin-top: 9px; color: var(--muted); font-size: .75rem; }
.promise-back { transform: rotateY(180deg); font: 500 1.35rem/1.35 "Dancing Script", cursive; }
.daily-card, .reasons-card, .game-card, .closing-card { margin-bottom: 55px; }
.daily-quote { min-height: 60px; display: grid; place-items: center; color: #fff3d4; font: 500 1.55rem/1.4 "Dancing Script", cursive; }
.reasons-list { display: grid; gap: 10px; padding: 0; margin: 22px 0; list-style: none; text-align: left; }
.reasons-list li { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; color: #f3ebfb; background: rgba(255,255,255,.045); animation: appear .35s ease both; }
.reasons-list li strong { margin-right: 8px; color: var(--gold); font-size: .78rem; }
@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.game-hud { display: flex; justify-content: center; gap: 26px; margin: 14px 0; color: var(--muted); font-size: .85rem; }
.game-hud strong { color: var(--gold); }
.game-arena { position: relative; height: 250px; overflow: hidden; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, rgba(14,18,44,.4), rgba(95,58,112,.25)); touch-action: manipulation; }
.falling-item { position: absolute; top: -40px; display: grid; place-items: center; width: 48px; height: 48px; border: 0; background: transparent; cursor: pointer; font-size: 1.8rem; animation: fall linear forwards; filter: drop-shadow(0 0 8px rgba(248,215,154,.55)); }
@keyframes fall { to { transform: translateY(300px) rotate(35deg); } }
.game-message { min-height: 1.4em; margin: 10px 0 0; color: var(--gold); font: 500 1.3rem "Dancing Script", cursive; }
.prayer { margin: 16px auto 24px; max-width: 620px; color: #f7efff; font: 500 1.6rem/1.5 "Dancing Script", cursive; white-space: pre-line; }
.growing-note { margin: 23px 0 0; color: var(--muted); font-size: .8rem; }
footer { padding: 5px 0 25px; color: var(--muted); text-align: center; font-size: .75rem; }
footer span { color: var(--gold); }

.modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8,7,23,.68); }
.modal-card { position: relative; width: min(100%, 480px); padding: 35px 25px 28px; border-radius: 24px; text-align: center; animation: appear .25s ease both; }
.modal-card h2 { margin-bottom: 13px; font: 600 2.5rem "Dancing Script", cursive; }
.modal-card > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 1rem; line-height: 1.65; white-space: pre-line; }
.modal-close { position: absolute; top: 8px; right: 13px; border: 0; background: transparent; color: white; cursor: pointer; font-size: 1.8rem; }
.celebration { position: fixed; z-index: 11; inset: 0; overflow: hidden; pointer-events: none; }
.celebration-piece { position: absolute; top: -30px; color: var(--gold); text-shadow: 0 0 10px currentColor; animation: celebrate var(--duration) ease-in forwards; }
.celebration-piece.petal { color: #d9b8ef; }
@keyframes celebrate { to { transform: translate(var(--drift), 110vh) rotate(720deg); opacity: 0; } }
.loader { position: fixed; z-index: 20; inset: 0; display: grid; align-content: center; justify-items: center; gap: 20px; background: #11102a; transition: opacity .6s ease, visibility .6s ease; }
.loader.done { opacity: 0; visibility: hidden; }
.loader p { color: var(--muted); font: 500 1.3rem "Dancing Script", cursive; }
.loader-moon { width: 70px; aspect-ratio: 1; border-radius: 50%; background: #f6eddb; box-shadow: 0 0 30px #dacbf2; animation: moon-rise 1.2s ease-out both; }

@media (min-width: 620px) {
  main { width: min(100% - 48px, 920px); }
  .gate-card { padding: 42px; }
  .letter { padding: 40px; }
  .when-grid { grid-template-columns: repeat(2, 1fr); }
  .promise-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 850px) {
  .screen { padding-top: 190px; }
  .gate-card { width: min(100%, 620px); }
  .when-grid { grid-template-columns: repeat(3, 1fr); }
  .promise-grid { grid-template-columns: repeat(3, 1fr); }
  .message-sky { min-height: 310px; }
  .content { padding-top: 185px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
