:root {
  --linen: oklch(95.8% .019 76.5);
  --blush: oklch(74.6% .089 344.6);
  --blush-soft: oklch(83% .075 350);
  --ink: #181818;
  --maroon: #800000;
  --glow-pink: #fdd5df;
  --glow-blush: radial-gradient(circle at center,
    rgba(253, 213, 223, 0.95) 0%,
    rgba(253, 213, 223, 0.6) 30%,
    rgba(253, 213, 223, 0.25) 58%,
    transparent 100%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; overflow-x: hidden; }
body { font-family: "Dancing Script", cursive; color: var(--ink); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; -webkit-user-drag: none; user-select: none; }

.script-text { font-family: "Great Vibes", cursive; }
.hand-text { font-family: "Dancing Script", cursive; }
.blush-text { color: var(--blush); }
.ink-text { color: var(--ink); }
.bg-linen { background-color: var(--linen); }

.screen { min-height: 100vh; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---------- Passcode (from site 2) ---------- */

.passcode-screen { position: relative; overflow: hidden; background: #0f1410; color: var(--linen); }
.passcode-label { font-size: 0.95rem; opacity: 0.7; margin: 0 0 1.4rem; letter-spacing: 0.04em; }

.glow-orb {
  position: fixed; top: 0; left: 0; width: 900px; height: 900px; border-radius: 50%;
  background-image: var(--glow-blush); transform: translate(-50%, -50%); pointer-events: none;
  z-index: 0; opacity: 0; transition: opacity 700ms; will-change: transform;
}
.glow-orb.visible { opacity: 0.5; }

.flash-overlay {
  position: fixed; inset: 0; z-index: 20; background-color: oklch(0.63 0.21 25);
  opacity: 0; pointer-events: none; transition: opacity 300ms;
}
.flash-overlay.visible { opacity: 0.3; }

.passcode-inner { position: relative; z-index: 10; text-align: center; }
.passcode-inner.shake { animation: shake-x 0.5s ease-in-out; }
@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px); }
  30% { transform: translateX(10px); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.dots { margin-bottom: 2rem; display: flex; justify-content: center; gap: 0.6rem; }
.dot {
  height: 0.7rem; width: 0.7rem; border-radius: 50%; border: 1px solid rgba(253, 213, 223, 0.6);
  background: transparent; transition: all 200ms;
}
.dot.filled { background-color: var(--glow-pink); transform: scale(1.15); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.keypad button {
  height: 3.25rem; width: 3.25rem; border-radius: 50%; border: 1px solid rgba(253, 213, 223, 0.4);
  background: transparent; color: var(--linen); font-size: 1.25rem; backdrop-filter: blur(2px);
  transition: all 200ms;
}
.keypad button:hover { border-color: var(--glow-pink); background-color: rgba(253, 213, 223, 0.1); }
.keypad button:active { background-color: rgba(253, 213, 223, 0.2); }
@media (min-width: 640px) { .keypad button { height: 3.75rem; width: 3.75rem; font-size: 1.5rem; } }

/* ---------- Flower transition (spiral bloom outward, then fly off-screen) ---------- */

.flower-transition { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.flower-piece { position: absolute; left: 50%; top: 50%; opacity: 0; will-change: transform, opacity; }
.flower-piece img {
  width: 100%; height: 100%; display: block; object-fit: contain; user-select: none;
  animation-name: flower-self-spin; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes flower-self-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ---------- Gift box (from site 4) ---------- */

.gift-screen { position: relative; background: radial-gradient(circle at 50% 30%, #fbe1e6, var(--linen) 70%); overflow: hidden; }
.gift-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.gift-box-btn { width: clamp(140px, 40vw, 220px); animation: gift-idle 3.2s ease-in-out infinite; transition: transform 0.25s ease; }
.gift-box-btn:active { transform: scale(0.94); }
@keyframes gift-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-2deg); }
}
.gift-svg { width: 100%; height: auto; filter: drop-shadow(0 12px 24px rgba(194, 59, 88, 0.25)); }
.gift-box-body { fill: var(--maroon); }
.gift-box-lid { fill: #5c0000; }
.gift-ribbon-v, .gift-ribbon-h, .gift-bow { fill: #eab750; stroke: rgba(110, 62, 8, 0.4); stroke-width: 1; }
.gift-caption { font-size: clamp(1.6rem, 5.5vw, 2.4rem); color: var(--maroon); margin: 0.5rem 0 0; }
.gift-hint { font-size: 1rem; color: var(--blush); opacity: 0.8; margin: 0; }

/* Opening animation — the lid/bow fly up, the box/ribbon drop down */
.gift-part-top, .gift-part-bottom {
  transition: transform 0.7s cubic-bezier(0.55, 0, 0.35, 1), opacity 0.7s ease;
  transform-origin: 60px 60px;
}
.gift-box-btn.opening .gift-part-top { transform: translateY(-46px) rotate(-10deg); opacity: 0; }
.gift-box-btn.opening .gift-part-bottom { transform: translateY(46px) rotate(6deg); opacity: 0; }
.gift-box-btn.opening { animation: none; }

/* ---------- Intro ---------- */

.intro-screen { text-align: center; padding: 0 1.5rem; }
.intro-inner { transition: opacity 1400ms ease-in-out; }
.intro-inner.fading-out { opacity: 0; }
.intro-title { font-size: 3rem; line-height: 1.15; margin: 0; color: var(--blush); }
.intro-sub { margin-top: 2rem; font-size: 1.25rem; }
@media (min-width: 640px) { .intro-title { font-size: 4.5rem; } .intro-sub { font-size: 1.5rem; } }
@media (min-width: 768px) { .intro-title { font-size: 6rem; } .intro-sub { font-size: 1.875rem; } }

.typewriter { display: inline-block; }
.caret { display: inline-block; margin-left: 0.04em; animation: caret-blink 0.9s step-end infinite; }
.caret.hidden { opacity: 0; animation: none; }
@keyframes caret-blink { 0%, 70%, 100% { opacity: 1; } 20%, 50% { opacity: 0; } }

/* ---------- Content sections ---------- */

.content-screen { position: relative; width: 100%; overflow: hidden; background-color: #550000; }
.snap-section { position: relative; z-index: 2; min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 4rem 1.25rem; }
.fade-wrap { width: 100%; will-change: transform, opacity; opacity: 0; transform: scale(0.72); transition: opacity 80ms linear, transform 80ms linear; }

/* Page-wide polaroid backdrop — spans the whole scrollable content (from the smile card
   to the final line), oversized and parallax-shifted so it never runs out as you scroll. */
.page-polaroids { position: absolute; left: 0; right: 0; top: 0; z-index: 0; pointer-events: none; }
.page-polaroid-frame {
  position: absolute; user-select: none; opacity: 0.4;
  background-color: #fffdf8; padding: 10px 10px 34px; border-radius: 3px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.45), 0 6px 10px -6px rgba(0, 0, 0, 0.4);
}
.page-polaroid-frame img {
  display: block; pointer-events: none; height: auto; object-fit: cover;
  aspect-ratio: 1 / 1; width: clamp(74px, 11vw, 190px);
}
.page-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-color: rgba(45, 0, 0, 0.55);
}

/* Smile card (from site 4) — soft blush wash instead of flat white */
.smile-card {
  position: relative; max-width: 520px; width: 100%; margin: 0 auto;
  background-color: #fdf1f3;
  background-image:
    repeating-linear-gradient(transparent, transparent 30px, rgba(180, 90, 110, 0.02) 31px),
    radial-gradient(circle at 10% 6%, rgba(255, 205, 220, 0.8), transparent 55%),
    radial-gradient(circle at 94% 96%, rgba(255, 222, 188, 0.55), transparent 55%),
    linear-gradient(150deg, #fff7f8 0%, #fdecf0 45%, #fbe0e6 100%);
  padding: clamp(1.6rem, 4vw, 2.6rem) clamp(1.6rem, 4vw, 3rem);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(120, 40, 20, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-family: "Caveat", cursive;
  font-size: clamp(1.5rem, 3.8vw, 2.2rem);
  font-weight: 600;
  line-height: 1.7;
  text-align: center;
}
.smile-card .deco { position: absolute; opacity: 0.55; }
.d1 { top: -14px; left: 24px; font-size: 1.2rem; color: #e8737a; transform: rotate(-15deg); }
.d2 { top: 8px; right: 20px; font-size: 0.85rem; color: #7cb87c; opacity: 0.5; transform: rotate(20deg); }
.d3 { bottom: -12px; right: 30px; font-size: 1rem; color: #d4626a; }
.d4 { bottom: 12px; left: 18px; font-size: 0.65rem; color: #8a6018; opacity: 0.4; }
.smile-card p { margin: 0; color: var(--ink); }
.hl-smile { background: linear-gradient(180deg, transparent 50%, rgba(248, 140, 165, 0.5) 50%); padding: 0 4px; color: #c43850; }
.hl-peace { background: linear-gradient(180deg, transparent 50%, rgba(120, 195, 135, 0.5) 50%); padding: 0 4px; color: #2a7540; }
.hl-love { background: linear-gradient(180deg, transparent 50%, rgba(235, 120, 110, 0.5) 50%); padding: 0 4px; color: #b02828; }
.hl-home { background: linear-gradient(180deg, transparent 50%, rgba(225, 185, 95, 0.5) 50%); padding: 0 4px; color: #8a6018; }

.scroll-hint {
  position: absolute; left: 50%; bottom: 1.75rem; z-index: 3;
  color: var(--glow-pink); opacity: 0.85; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  animation: scroll-hint-bounce 2s ease-in-out infinite;
}
@keyframes scroll-hint-bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 10px); }
}

/* Scratch card (from site 2) */
.scratch-card { margin: 0 auto; width: 100%; max-width: 420px; text-align: center; }
.scratch-card-inner { position: relative; aspect-ratio: 1 / 1; width: 100%; overflow: hidden; border-radius: 28px; box-shadow: 0 24px 60px -24px rgba(120, 60, 80, 0.45); }
.scratch-photo { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; }
.scratch-canvas { position: absolute; inset: 0; height: 100%; width: 100%; touch-action: none; cursor: pointer; }
.scratch-caption {
  margin-top: 1.25rem; font-size: 1.25rem; color: var(--glow-pink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

/* Paper card — the letter, styled like an aged, handwritten keepsake rather than a
   flat white box: warm sepia paper, a vignette of "age" at the edges, a wax-seal-red
   flourish above the greeting and a heart below the sign-off. */
.paper-card {
  position: relative; margin: 0 auto; width: 100%; max-width: 640px; border-radius: 4px;
  transform: rotate(-0.6deg);
  background-color: #f2e2bd;
  background-image:
    radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(110, 70, 20, 0.22) 100%),
    repeating-linear-gradient(transparent, transparent 34px, rgba(110, 70, 20, 0.04) 35px),
    linear-gradient(145deg, #f8ecd0 0%, #f0dfae 45%, #e6cd93 100%);
  border: 1px solid rgba(110, 70, 20, 0.4);
  padding: 3rem 1.75rem 2.5rem;
  box-shadow: 0 30px 70px -25px rgba(40, 15, 10, 0.55), inset 0 0 46px rgba(110, 65, 15, 0.18);
}
@media (min-width: 640px) { .paper-card { padding: 3.5rem 3rem 3rem; } }
.paper-card::before {
  content: "\2767"; display: block; text-align: center; margin-bottom: 1rem;
  font-family: "Great Vibes", cursive; font-size: 1.7rem; color: rgba(150, 40, 30, 0.6);
}
.paper-card::after {
  content: "\2665"; display: block; text-align: center; margin-top: 1.5rem;
  font-size: 1rem; color: rgba(150, 40, 30, 0.5);
}
.paper-card p { margin: 0; font-family: "Caveat", cursive; font-size: 1.25rem; font-weight: 600; line-height: 1.85; color: rgba(70, 42, 15, 0.9); }
.paper-card p:first-of-type { font-family: "Great Vibes", cursive; font-size: 1.75rem; font-weight: 400; color: #7a2f16; }
.paper-card p + p { margin-top: 1.5rem; }
@media (min-width: 640px) { .paper-card p { font-size: 1.5rem; } .paper-card p:first-of-type { font-size: 2.1rem; } }
.letter-word { opacity: 0; transition: opacity 500ms ease-out; }
.letter-placeholder-tag {
  display: inline-block; font-family: "Dancing Script", cursive; font-size: 0.85rem;
  color: #b02828; background: rgba(176, 40, 40, 0.08); border-radius: 8px; padding: 0.2rem 0.6rem; margin-bottom: 1rem;
}

/* Songs */
.songs { margin: 0 auto; width: 100%; max-width: 980px; }
.songs-title {
  text-align: center; font-size: 3rem; color: var(--glow-pink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}
@media (min-width: 640px) { .songs-title { font-size: 3.75rem; } }
.songs-grid { margin-top: 2.5rem; display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 640px) {
  .songs-grid { grid-template-columns: 1fr 1fr; }
  .song-card--wide { grid-column: span 2; width: 50%; margin: 0 auto; }
}
.song-card { border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.3); padding: 0.75rem; box-shadow: 0 20px 45px -25px rgba(120, 60, 80, 0.5); backdrop-filter: blur(20px); }
.song-card iframe { display: block; width: 100%; border: 0; border-radius: 16px; }

/* Moon card — a night-sky keepsake for the closing line, distinct from the paper letter */
.moon-card {
  position: relative; margin: 0 auto; width: 100%; max-width: 560px; border-radius: 22px;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255, 255, 255, 0.55) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 75% 20%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.4) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 85% 65%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 35% 80%, rgba(255, 255, 255, 0.35) 50%, transparent 100%),
    radial-gradient(circle at 30% 15%, rgba(255, 255, 255, 0.09), transparent 55%),
    linear-gradient(160deg, #2c0c1c 0%, #40100f 55%, #1c0507 100%);
  padding: 3rem 2rem; border: 1px solid rgba(255, 214, 160, 0.22);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), inset 0 0 60px rgba(255, 200, 140, 0.06);
}
.moon-card-icon {
  display: block; text-align: center; font-size: 2.25rem; margin-bottom: 1rem;
  filter: drop-shadow(0 0 12px rgba(255, 214, 140, 0.55));
}
.moon-card .final-line {
  padding: 0; text-align: center; font-size: 2.1rem;
  color: #ffe9c7; text-shadow: 0 0 18px rgba(255, 214, 140, 0.5), 0 2px 10px rgba(0, 0, 0, 0.5);
}
@media (min-width: 640px) { .moon-card .final-line { font-size: 3.25rem; } }

.restart-btn {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 40; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6); background-color: rgba(255, 255, 255, 0.5);
  padding: 0.75rem 1.5rem; font-size: 1.125rem; box-shadow: 0 16px 36px -16px rgba(120, 60, 80, 0.6);
  backdrop-filter: blur(20px); transition: all 300ms;
}
.restart-btn:hover { transform: translateY(-4px); background-color: rgba(255, 255, 255, 0.7); }
