:root {
  --pink-1: #fff4f8;
  --pink-2: #ffe3ef;
  --pink-3: #ffc9de;
  --pink-4: #ff9ec4;
  --pink-5: #ff78ad;
  --pink-6: #ff5d9e;
  --lavender: #e9d7ff;
  --peach: #ffe4d6;
  --white: #ffffff;
  --text: #6b3a52;
  --text-soft: #8b5a72;
  --shadow: 0 12px 30px rgba(255, 120, 173, 0.18);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Vazirmatn', 'Baloo 2', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fff7fb 0%, #ffeaf4 40%, #ffe0ee 100%);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.8;
  direction: rtl;
  text-align: right;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

.bg-decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb1 { width: 320px; height: 320px; background: #ffd1e6; top: -60px; left: -60px; }
.orb2 { width: 260px; height: 260px; background: #e9d7ff; bottom: 10%; right: -40px; animation-duration: 22s; }
.orb3 { width: 220px; height: 220px; background: #ffe4d6; top: 40%; left: 50%; animation-duration: 20s; }
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(30px, -20px) scale(1.08); }
}

#floating-layer {
  position: absolute;
  inset: 0;
}
.float-item {
  position: absolute;
  bottom: -10vh;
  opacity: 0.75;
  animation: floatUp linear infinite;
  user-select: none;
  will-change: transform;
}
@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { transform: translateY(-120vh) translateX(var(--drift)) rotate(20deg); opacity: 0; }
}

.character {
  position: absolute;
  font-size: 3rem;
  filter: drop-shadow(0 8px 12px rgba(255,120,173,0.2));
  animation: bob 4s ease-in-out infinite;
  opacity: 0.9;
}
.teddy { top: 12%; right: 6%; }
.bunny { bottom: 14%; left: 5%; animation-delay: 1s; }
.teddy2 { bottom: 28%; right: 12%; font-size: 2.2rem; animation-delay: .5s; opacity: .7; }
.bunny2 { top: 30%; left: 8%; font-size: 2.2rem; animation-delay: 1.5s; opacity: .7; }
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

.screen, .main-content, .section { position: relative; z-index: 1; }
.screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.screen.active { display: flex; }
.main-content { padding: 80px 16px 40px; max-width: 1100px; margin: 0 auto; }
.section { margin: 0 auto 56px; }
.section-title { text-align: center; margin-bottom: 20px; }
.section-title h3 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin: 0 0 6px;
  color: #d94f86;
}
.section-title p { margin: 0; color: var(--text-soft); font-size: 1.05rem; }

.card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 182, 213, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.welcome-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  padding: 36px 24px;
  animation: popIn .8s ease;
}
@keyframes popIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.welcome-characters { font-size: 3rem; display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.bounce { display: inline-block; animation: bob 2.8s ease-in-out infinite; }
.bounce.delay { animation-delay: .7s; }
.sparkle-big { display: inline-block; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.welcome-card h1 { font-size: clamp(2rem, 7vw, 3rem); margin: 0; color: #e2558f; line-height: 1.4; }
.subtitle { font-size: 1.2rem; margin: 10px 0 22px; color: var(--text-soft); }
.hint { margin: 14px 0 0; font-size: .95rem; color: #b07a93; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.primary-btn {
  background: linear-gradient(135deg, var(--pink-5), var(--pink-6));
  color: white;
  box-shadow: 0 10px 20px rgba(255,93,158,.35);
}
.primary-btn:hover { box-shadow: 0 12px 24px rgba(255,93,158,.45); transform: translateY(-1px); }
.secondary-btn {
  background: #fff;
  color: #d94f86;
  border: 2px solid var(--pink-3);
}

.music-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,182,213,.9);
  background: rgba(255,255,255,.9);
  box-shadow: 0 6px 16px rgba(255,120,173,.18);
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
}
.music-toggle[aria-pressed="true"] { background: #ffeaf4; color: #d94f86; }
.music-icon { font-size: 1.1rem; }

.hero-card { text-align: center; padding: 32px 22px; }
.eyebrow { margin: 0; color: #c86a93; font-weight: 700; }
.hero-card h2 { font-size: clamp(1.9rem, 6vw, 3rem); margin: 4px 0 10px; color: #e2558f; line-height: 1.4; }
.hero-card p { margin: 0 auto; max-width: 700px; font-size: 1.1rem; color: var(--text-soft); }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.hero-badges span {
  background: linear-gradient(135deg, #fff, #fff1f7);
  border: 1.5px solid #ffd0e4;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  color: #c65786;
}

/* Envelope / Letter */
.envelope-area { display: grid; gap: 18px; justify-items: center; }
.envelope {
  position: relative;
  width: min(320px, 90vw);
  height: 210px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  perspective: 800px;
}
.envelope-back, .envelope-front, .envelope-flap, .envelope-paper-preview {
  position: absolute; left: 0; right: 0; margin: auto;
}
.envelope-back {
  bottom: 0; height: 150px; width: 100%;
  background: linear-gradient(180deg, #ffd5e7, #ffc1dc);
  border-radius: 0 0 18px 18px;
  border: 2px solid #ffb6d5;
}
.envelope-front {
  bottom: 0; height: 150px; width: 100%;
  background: linear-gradient(180deg, #ffcbe2, #ffb2d4);
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 18px 18px;
  border: 2px solid #ffb6d5;
  border-top: none;
  z-index: 3;
}
.envelope-flap {
  top: 20px; height: 120px; width: 100%;
  background: linear-gradient(180deg, #ffe3ef, #ffcfe4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform .7s ease;
  z-index: 4;
  border: 2px solid #ffb6d5;
  border-bottom: none;
  border-radius: 18px 18px 0 0;
}
.envelope-paper-preview {
  bottom: 20px; width: 86%; height: 120px;
  background: #fffdf8;
  border-radius: 10px;
  border: 1.5px solid #ffe3ef;
  z-index: 2;
  transition: transform .7s ease .1s;
}
.envelope-heart {
  position: absolute; top: 78px; left: 0; right: 0;
  text-align: center; font-size: 1.8rem; z-index: 5;
  transition: opacity .3s ease;
}
.envelope .tap-label {
  position: absolute; bottom: -30px; left: 0; right: 0; text-align: center;
  font-weight: 700; color: #d0608e; font-size: .95rem;
}
.envelope.open .envelope-flap { transform: rotateX(170deg); }
.envelope.open .envelope-paper-preview { transform: translateY(-30px); }
.envelope.open .envelope-heart { opacity: 0; }

.letter-paper {
  max-width: 720px;
  width: 100%;
  background: linear-gradient(180deg, #fffdfb, #fff7fb);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 1.08rem;
  line-height: 2.1;
  transform-origin: top;
  transform: scaleY(.96) translateY(-8px);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0 24px;
  transition: opacity .5s ease, transform .5s ease, max-height .6s ease, padding .5s ease;
  text-align: right;
}
.letter-paper.show {
  opacity: 1;
  transform: scaleY(1) translateY(0);
  max-height: 1400px;
  padding: 24px;
  margin-top: 10px;
}
.letter-paper h4 { margin: 0 0 8px; color: #d94f86; font-size: 1.4rem; }
.letter-paper p { margin: 0 0 12px; }
.signature { margin-top: 8px; color: #c65786; }

/* Gift */
.gift-area { text-align: center; padding: 28px 20px; }
.gift-box {
  position: relative;
  width: 180px; height: 170px;
  margin: 10px auto 10px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.gift-body {
  position: absolute; bottom: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(180deg, #ff8fbb, #ff6aa6);
  border-radius: 16px;
  border: 2px solid #ff5a9d;
}
.gift-ribbon-v { position: absolute; top: 0; bottom: 0; left: 50%; width: 26px; transform: translateX(-50%); background: #ffe3a6; }
.gift-ribbon-h { position: absolute; left: 0; right: 0; top: 50%; height: 22px; transform: translateY(-50%); background: #ffe3a6; }
.gift-lid {
  position: absolute; top: 18px; left: -6px; right: -6px; height: 44px;
  background: linear-gradient(180deg, #ffa3c8, #ff78ad);
  border-radius: 14px;
  border: 2px solid #ff5a9d;
  transform-origin: left bottom;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), top .6s ease;
  z-index: 2;
}
.gift-bow {
  position: absolute; top: -18px; left: 50%; width: 34px; height: 22px; transform: translateX(-50%);
  background: #ffe3a6; border-radius: 50%;
  box-shadow: -26px 6px 0 0 #ffe3a6, 26px 6px 0 0 #ffe3a6;
}
.gift-box .tap-label { position: absolute; bottom: -32px; left: 0; right: 0; font-weight: 700; color: #d0608e; }
.gift-box.open .gift-lid { transform: rotate(-28deg) translate(-10px, -30px); top: 0; }
.gift-box.open { animation: wiggle .4s ease; }
@keyframes wiggle { 0%,100%{transform:rotate(0)}25%{transform:rotate(-3deg)}75%{transform:rotate(3deg)} }

.gift-reveal {
  max-height: 0; opacity: 0; overflow: hidden; transform: translateY(8px);
  transition: all .5s ease;
}
.gift-reveal.show { max-height: 600px; opacity: 1; transform: translateY(0); margin-top: 40px; }
.reveal-inner {
  background: linear-gradient(180deg, #fff, #fff3f9);
  border: 2px dashed #ffb9d7;
  border-radius: 20px;
  padding: 18px;
}
.big-surprise { font-size: 2.5rem; animation: pulse 1.8s infinite; }
.reveal-inner h4 { margin: 4px 0 6px; font-size: 1.6rem; color: #e2558f; }
.reveal-inner p { margin: 0 0 8px; color: var(--text-soft); }
.coupon { font-weight: 700; color: #c65786; }
.tiny-icons { font-size: 1.3rem; margin-top: 4px; }

/* Quiz */
.quiz-card { max-width: 760px; margin: 0 auto; }
.quiz-progress {
  height: 10px; background: #ffe3ef; border-radius: 999px; overflow: hidden; margin-bottom: 18px;
}
.quiz-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ff8fbb, #ff5d9e); border-radius: 999px; transition: width .35s ease; }
.quiz-question { font-size: 1.3rem; margin: 0 0 14px; color: #d94f86; text-align: center; line-height: 1.7; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option {
  width: 100%; text-align: right; padding: 14px 16px; border-radius: 16px;
  border: 2px solid #ffd0e4; background: #fff; cursor: pointer; font-weight: 600;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
  line-height: 1.7;
}
.quiz-option:hover { background: #fff6fb; border-color: #ffb2d4; }
.quiz-option:active { transform: scale(.98); }
.quiz-feedback { text-align: center; margin-top: 14px; min-height: 28px; color: #c65786; font-weight: 700; line-height: 1.8; }
.quiz-result { text-align: center; }
.quiz-result h4 { font-size: 1.7rem; margin: 0 0 8px; color: #e2558f; line-height: 1.5; }
.quiz-result p { margin: 0 0 16px; font-size: 1.1rem; color: var(--text-soft); }

/* Memories */
.memories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.memory-card { padding: 16px; text-align: center; }
.memory-photo {
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 2px dashed #ffbdd9;
  background: linear-gradient(135deg, #fff1f7, #ffe6f2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #c65786;
  text-align: center;
  padding: 10px;
}
.memory-photo span { font-size: 2rem; }
.memory-photo small { font-weight: 600; line-height: 1.6; }
.memory-photo img { width: 100%; height: 100%; object-fit: cover; }
.memory-card h4 { margin: 0 0 4px; color: #d94f86; font-size: 1.15rem; }
.memory-card p { margin: 0; color: var(--text-soft); }
.customize-note { text-align: center; margin: 14px 0 0; color: #9b6b82; font-size: .95rem; line-height: 1.8; }
.customize-note code { background: #fff; border: 1px solid #ffd9e8; padding: 2px 6px; border-radius: 8px; direction: ltr; unicode-bidi: embed; display: inline-block; }

/* Final */
.final-card { text-align: center; padding: 34px 22px; background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,240,248,.95)); }
.final-sparkles { font-size: 1.6rem; margin-bottom: 8px; }
.final-card h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 12px; color: #e2558f; line-height: 1.6; }
.final-love { font-size: 1.35rem; font-weight: 800; color: #c65786; margin: 0; }
.final-hearts { margin-top: 14px; font-size: 1.6rem; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.final-hearts span { animation: bob 3s ease-in-out infinite; }
.final-hearts span:nth-child(2){animation-delay:.3s}.final-hearts span:nth-child(3){animation-delay:.6s}
.final-hearts span:nth-child(4){animation-delay:.9s}.final-hearts span:nth-child(5){animation-delay:1.2s}

/* Responsive */
@media (max-width: 900px) {
  .memories-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .main-content { padding-top: 76px; }
  .card { padding: 20px 16px; border-radius: 20px; }
  .memories-grid { grid-template-columns: 1fr; }
  .character { font-size: 2.2rem; opacity: .55; }
  .teddy2, .bunny2 { display: none; }
  .music-toggle .music-text { display: none; }
  .music-toggle { padding: 10px 12px; }
  .envelope { height: 200px; }
  .quiz-option { text-align: right; }
  .welcome-card { padding: 30px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}