@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Inter:wght@400;600;800&display=swap');

:root {
  --bg: #10030a;
  --ink: #fff9fb;
  --muted: #ffd7e8;
  --rose: #ff4f93;
  --berry: #c90054;
  --gold: #ffd166;
  --teal: #55d6c2;
  --glass: rgba(255, 255, 255, .12);
  --line: rgba(255, 255, 255, .28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

button { font: inherit; }

canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}

.app {
  min-height: 100vh;
  width: 100%;
  position: relative;
  isolation: isolate;
}

.app::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(circle at var(--x, 48%) var(--y, 34%), rgba(85, 214, 194, .16), transparent 22%),
    radial-gradient(circle at 72% 18%, rgba(255, 209, 102, .14), transparent 24%),
    radial-gradient(circle at 30% 72%, rgba(255, 79, 147, .28), transparent 26%),
    #10030a;
  transition: background .6s ease;
}

.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 82px 24px 40px;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  overflow: hidden;
}

.scene.active {
  opacity: 1;
}

.hud {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 20;
  width: min(560px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 12px;
  align-items: center;
}

.progress-track {
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--rose));
  transition: width .5s ease;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .35);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.scene-dots {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 19;
  display: grid;
  gap: 10px;
}

.scene-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.scene-dots button.active { background: var(--gold); border-color: var(--gold); }

.scene-intro { text-align: center; }

.stars {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#fff 1px, transparent 1px), radial-gradient(#ffd166 1px, transparent 1px);
  background-size: 80px 80px, 120px 120px;
  animation: drift 18s linear infinite;
  opacity: .28;
}

.intro-copy, .scene-copy, .memory-text, .final-copy, .gallery-header {
  position: relative;
  z-index: 1;
}

.memory-text {
  min-width: 0;
}

.eyebrow, .subtitle, .date {
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.angel-name {
  text-transform: capitalize;
}

.glow-title {
  font-family: "Great Vibes", cursive;
  font-size: clamp(58px, 12vw, 150px);
  line-height: .95;
  margin: 10px 0;
  text-shadow: 0 0 18px rgba(255, 79, 147, .95), 0 0 60px rgba(85, 214, 194, .45);
}

.primary-btn, .ghost-btn {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--berry));
  box-shadow: 0 16px 45px rgba(255, 42, 123, .38);
  cursor: pointer;
}

.ghost-btn {
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--line);
  box-shadow: none;
}

.gift-stage, .letter-layout {
  width: min(980px, 92vw);
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 44px;
  align-items: center;
}

.gift-wrap {
  position: relative;
  width: 230px;
  height: 196px;
  justify-self: center;
  cursor: pointer;
  filter: drop-shadow(0 30px 45px rgba(0, 0, 0, .55));
  animation: float 2.5s ease-in-out infinite;
}

.gift-glow {
  position: absolute;
  inset: -36px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, .35), transparent 60%);
  transform: scale(.9);
  transition: transform .8s ease;
}

.gift-wrap:hover .gift-glow, .gift-wrap.open .gift-glow { transform: scale(1.15); }

.gift-body {
  position: absolute;
  bottom: 0;
  width: 230px;
  height: 140px;
  background: linear-gradient(135deg, #ffe2ec, #ff78a8 55%, #c90054);
  border-radius: 16px;
}

.gift-lid {
  position: absolute;
  top: 0;
  left: -14px;
  width: 258px;
  height: 64px;
  background: linear-gradient(135deg, #fff1d5, #ff5f99);
  border-radius: 16px;
  transform-origin: bottom left;
  transition: transform .9s ease;
}

.gift-wrap.open .gift-lid { transform: rotate(-28deg) translate(-20px, -45px); }

.ribbon-v, .ribbon-h {
  position: absolute;
  background: linear-gradient(180deg, var(--gold), #f28b2e);
}

.ribbon-v { width: 36px; height: 196px; left: 97px; }
.ribbon-h { height: 34px; width: 230px; bottom: 76px; }

.scene-copy h2, .gallery-header h2 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(52px, 8vw, 92px);
  line-height: .95;
  margin: 0 0 12px;
}

.scene-copy p {
  max-width: 440px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.memory-card {
  width: min(1040px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: minmax(220px, min(34vw, 390px)) minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.photo-frame {
  position: relative;
  width: min(34vw, 390px, calc((100vh - 150px) * .8));
  max-width: 100%;
  max-height: calc(100vh - 150px);
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  background: rgba(0, 0, 0, .24);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: softZoom 10s ease infinite alternate;
}

.photo-frame span {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .48);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.memory-text h2 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(42px, 6vw, 84px);
  line-height: .95;
  margin: 0;
  color: #ffe1ec;
  text-shadow: 0 0 22px rgba(255, 43, 124, .75);
  overflow-wrap: anywhere;
}

.memory-text p {
  max-width: 100%;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.memory-card.fade-in .memory-text > * {
  animation: textReveal .65s cubic-bezier(.22, 1, .36, 1) both;
}

.memory-card.fade-in .memory-text h2 { animation-delay: .08s; }
.memory-card.fade-in .memory-text #memoryLine { animation-delay: .16s; }
.memory-card.fade-in .memory-actions { animation-delay: .24s; }

.memory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.envelope {
  width: min(640px, 92vw);
  height: 420px;
  position: relative;
  cursor: pointer;
  perspective: 1200px;
}

.flap, .letter-pocket {
  position: absolute;
  inset: 0;
  border-radius: 22px;
}

.flap {
  z-index: 3;
  display: grid;
  place-items: start center;
  padding-top: 58px;
  background: linear-gradient(135deg, #ffb4cb, #ff3b83);
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: top;
  transition: transform 1s ease;
}

.letter-pocket {
  z-index: 1;
  background: linear-gradient(145deg, rgba(255, 255, 255, .2), rgba(255, 79, 147, .35));
  border: 1px solid var(--line);
}

.flap span {
  color: #fff9fb;
  font-weight: 800;
  font-size: clamp(18px, 2.6vw, 30px);
  text-shadow: 0 3px 18px rgba(125, 0, 52, .55);
  pointer-events: none;
}

.envelope.open .flap { transform: rotateX(165deg); }

.letter-paper {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0;
  z-index: 2;
  height: 88%;
  padding: 32px;
  background: #fff8f7;
  color: #330016;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .5);
  transform: translateY(112px);
  transition: transform 1s ease;
  overflow: auto;
}

.envelope.open .letter-paper { transform: translateY(-25px); }

.letter-paper h2 {
  font-family: "Great Vibes", cursive;
  font-size: 52px;
  color: var(--berry);
  margin: 0 0 12px;
}

.letter-paper p {
  font-size: 18px;
  line-height: 1.7;
  white-space: pre-line;
}

.scene-gallery {
  display: flex;
  flex-direction: column;
  gap: 22px;
  text-align: center;
}

.polaroids {
  display: grid;
  grid-template-columns: repeat(5, minmax(104px, 150px));
  gap: 14px;
  justify-content: center;
  align-items: center;
  width: min(100%, calc(100vw - 48px));
}

.polaroids figure {
  margin: 0;
  background: white;
  color: #61122e;
  padding: 10px 10px 36px;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .5);
  transform: rotate(var(--r));
  transition: transform .32s ease, box-shadow .32s ease;
  cursor: pointer;
}

.polaroids figure:nth-child(1) { --r: -5deg; }
.polaroids figure:nth-child(2) { --r: 3deg; }
.polaroids figure:nth-child(3) { --r: -2deg; }
.polaroids figure:nth-child(4) { --r: 4deg; }
.polaroids figure:nth-child(5) { --r: -4deg; }

.polaroids figure:hover {
  transform: scale(1.08) rotate(0deg);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .7);
  z-index: 2;
}

.polaroids img {
  width: 100%;
  max-height: min(34vh, 260px);
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: #fff3f7;
}

.polaroids figcaption {
  height: 28px;
  margin-top: 10px;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 24px;
}

.scene-final {
  grid-template-columns: minmax(260px, 430px) minmax(300px, 560px);
  gap: 36px;
}

.final-photo img {
  width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  background: rgba(0, 0, 0, .24);
  border-radius: 28px;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .75);
}

.final-copy h1 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(60px, 9vw, 118px);
  line-height: .9;
  margin: 8px 0 18px;
  text-shadow: 0 0 25px rgba(255, 45, 128, .7);
}

.final-copy h2 {
  font-size: 28px;
  font-weight: 400;
}

.wish-card {
  min-height: 74px;
  display: grid;
  place-items: center;
  margin: 0 0 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .1);
  color: #fff6d5;
  line-height: 1.5;
  backdrop-filter: blur(14px);
}

.lightbox {
  width: min(720px, 92vw);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  color: var(--ink);
  background: rgba(18, 3, 12, .92);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .75);
}

.lightbox::backdrop { background: rgba(0, 0, 0, .72); }

.lightbox img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 16px;
}

.lightbox p {
  margin: 12px 0 0;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 34px;
}

.close-btn {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

.shake { animation: shake .45s; }
.fade-in { animation: softIn .7s; }

@keyframes float { 50% { transform: translateY(-16px); } }
@keyframes drift { to { background-position: 200px 400px, -300px 200px; } }
@keyframes kenburns { to { transform: scale(1.045); } }
@keyframes softZoom { to { transform: scale(1.015); } }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }
@keyframes softIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes textReveal { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }

@media (max-width: 860px) {
  .scene { padding: 82px 18px 28px; overflow: hidden; }
  .scene-dots { display: none; }
  .gift-stage, .letter-layout, .memory-card, .scene-final {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .scene-copy p { margin-inline: auto; }
  .memory-actions { justify-content: center; }
  .photo-frame { width: min(360px, 82vw, calc((100vh - 220px) * .8)); max-height: calc(100vh - 220px); justify-self: center; }
  .polaroids { grid-template-columns: repeat(2, minmax(112px, 148px)); gap: 12px; }
  .polaroids figure:last-child { grid-column: 1 / -1; justify-self: center; width: 148px; }
  .envelope { height: 470px; justify-self: center; }
  .final-photo img { width: min(360px, 84vw); max-height: 42vh; }
}

@media (max-width: 430px) {
  .hud { grid-template-columns: 40px 1fr 40px; gap: 8px; }
  .icon-btn { width: 40px; height: 40px; }
  .glow-title { font-size: 58px; }
  .letter-paper { padding: 24px; }
  .letter-paper h2 { font-size: 42px; }
  .letter-paper p { font-size: 16px; }
  .polaroids { grid-template-columns: repeat(2, minmax(104px, 136px)); }
}
