:root {
  --crimson: #7a0b1e;
  --red: #c1121f;
  --rose: #ff6b81;
  --gold: #ffd700;
  --cream: #fff3e0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0002;
  font-family: 'Vazirmatn', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  opacity: 0;
  transition: opacity 1.6s ease;
}
body.ready { opacity: 1; }

/* ===== Background rose ===== */
#bg-rose {
  position: fixed;
  inset: -6%;
  z-index: 0;
  background: radial-gradient(circle at 50% 45%,
      #ff4d6d 0%, #c1121f 30%, #7a0b1e 60%, #2a0308 100%);
  background-size: cover;
  background-position: center;
  filter: saturate(1.1);
  animation: breathe 12s ease-in-out infinite;
}
#bg-rose.loaded {
  background-blend-mode: normal;
}
@keyframes breathe {
  0%, 100% { transform: scale(1) rotate(0deg); filter: saturate(1) hue-rotate(0deg); }
  50% { transform: scale(1.06) rotate(0.6deg); filter: saturate(1.15) hue-rotate(-6deg); }
}

#vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center,
      transparent 40%, rgba(20,0,4,0.55) 78%, rgba(10,0,2,0.92) 100%);
}

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

/* ===== Content ===== */
#content {
  position: relative; z-index: 3;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px 70px;
  text-align: center;
}

.hidden { display: none !important; }

/* Intro open button */
#intro { display: flex; align-items: center; justify-content: center; }
#intro.fade-out { animation: fadeOutUp 0.5s ease forwards; }
@keyframes fadeOutUp {
  to { opacity: 0; transform: translateY(-30px) scale(0.9); }
}

#open-btn {
  font-family: 'Lalezar', cursive;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  color: var(--cream);
  padding: 22px 44px;
  border: 2px solid rgba(255,215,0,0.5);
  border-radius: 60px;
  background: rgba(122,11,30,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 40px rgba(255,107,129,0.4), inset 0 0 25px rgba(255,215,0,0.15);
  cursor: pointer;
  animation: pulseGlow 2.4s ease-in-out infinite, floatY 4s ease-in-out infinite;
  transition: transform 0.25s ease;
}
#open-btn:hover { transform: scale(1.07); }
#open-btn:active { transform: scale(0.96); }

@keyframes pulseGlow {
  0%,100% { box-shadow: 0 0 40px rgba(255,107,129,0.4), inset 0 0 25px rgba(255,215,0,0.15); }
  50% { box-shadow: 0 0 70px rgba(255,107,129,0.7), inset 0 0 35px rgba(255,215,0,0.3); }
}
@keyframes floatY {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ===== Card ===== */
#card.reveal { animation: cardIn 1s ease forwards; }
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

#title {
  font-family: 'Lalezar', cursive;
  font-weight: 400;
  font-size: clamp(1.8rem, 7vw, 3.4rem);
  line-height: 1.4;
  background: linear-gradient(100deg, var(--gold), #fff, var(--rose), var(--gold));
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 0 30px rgba(255,215,0,0.25);
  animation: shimmer 5s linear infinite, titleIn 1.2s ease both;
  margin-bottom: 26px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
@keyframes shimmer { to { background-position: 250% center; } }
@keyframes titleIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.heart-icon {
  display: inline-block;
  -webkit-text-fill-color: initial;
  animation: beat 1.2s ease-in-out infinite;
}
@keyframes beat {
  0%,100% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.2); }
}

#message-card {
  max-width: 480px;
  padding: 26px 30px;
  border-radius: 22px;
  background: rgba(122,11,30,0.28);
  border: 1px solid rgba(255,215,0,0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 0 30px rgba(255,107,129,0.12);
  margin-bottom: 30px;
  animation: fadeUp 1.3s ease 0.3s both;
}
#poem {
  font-family: 'Amiri', serif;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  line-height: 2;
  color: var(--cream);
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Surprise buttons ===== */
#buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 560px;
  width: 100%;
}
@media (max-width: 560px) {
  #buttons { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.surprise-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px;
  border-radius: 18px;
  border: 1px solid rgba(255,215,0,0.35);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  animation: fadeUp 0.7s ease both;
}
.surprise-btn:hover {
  transform: translateY(-6px) scale(1.04);
  background: rgba(255,107,129,0.22);
  box-shadow: 0 8px 30px rgba(255,107,129,0.5);
}
.surprise-btn:active { transform: scale(0.95); }
.surprise-btn.pop { animation: pop 0.4s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.btn-icon { font-size: 1.9rem; filter: drop-shadow(0 0 8px rgba(255,215,0,0.5)); }
.btn-label { font-family: 'Vazirmatn', sans-serif; font-size: 0.95rem; font-weight: 700; }

/* ===== Toast ===== */
#toast {
  position: fixed; z-index: 20;
  bottom: 90px; left: 50%;
  transform: translate(-50%, 30px);
  max-width: 90vw;
  padding: 16px 24px;
  border-radius: 18px;
  background: rgba(30,0,8,0.75);
  border: 1px solid rgba(255,215,0,0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--cream);
  font-family: 'Amiri', serif;
  font-size: 1.25rem;
  text-align: center;
  box-shadow: 0 10px 40px rgba(255,107,129,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Modal ===== */
#modal-overlay {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(10,0,3,0.6);
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.35s ease;
}
#modal-overlay.open { opacity: 1; }
#modal {
  position: relative;
  max-width: 460px; width: 100%;
  max-height: 82vh; overflow-y: auto;
  padding: 34px 28px;
  border-radius: 26px;
  background: rgba(60,4,16,0.72);
  border: 1px solid rgba(255,215,0,0.4);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 0 40px rgba(255,107,129,0.15);
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(.2,1.3,.4,1);
}
#modal-overlay.open #modal { transform: scale(1); }
#modal-close {
  position: absolute; top: 12px; left: 16px;
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: var(--cream); font-size: 1.6rem; line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}
#modal-close:hover { background: rgba(255,107,129,0.4); }
.modal-title {
  font-family: 'Lalezar', cursive; font-weight: 400;
  font-size: 1.7rem; color: var(--gold);
  margin-bottom: 18px; text-shadow: 0 0 20px rgba(255,215,0,0.4);
}
.letter {
  font-family: 'Amiri', serif;
  font-size: 1.2rem; line-height: 2.1;
  color: var(--cream);
  white-space: pre-wrap; text-align: center;
  min-height: 260px;
}
.gift { font-size: 4.5rem; animation: giftShake 0.6s ease; text-align: center; }
@keyframes giftShake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(8deg); }
}
.gift-msg {
  font-family: 'Amiri', serif; font-size: 1.3rem; line-height: 2;
  color: var(--cream); margin-top: 16px; text-align: center;
}

/* ===== Mute button ===== */
#mute-btn {
  position: fixed; top: 14px; right: 14px; z-index: 25;
  width: 46px; height: 46px;
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 50%;
  background: rgba(30,0,8,0.5);
  backdrop-filter: blur(8px);
  color: var(--cream); font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
#mute-btn:hover { transform: scale(1.1); background: rgba(255,107,129,0.3); }

/* ===== Footer ===== */
footer {
  position: fixed; bottom: 10px; left: 0; right: 0;
  z-index: 15; text-align: center;
}
footer a {
  font-family: 'Vazirmatn', sans-serif;
  font-size: 0.85rem;
  color: rgba(255,215,0,0.55);
  text-decoration: none;
  transition: color 0.2s ease;
}
footer a:hover { color: var(--gold); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  #bg-rose, #open-btn, .heart-icon, #title { animation: none !important; }
}
</parameter>