:root {
  --emerald-dark: #07221b;
  --emerald-mid: #0f382e;
  --burgundy-deep: #4a0e17;
  --burgundy-accent: #681421;
  --cream-bg: #fdfaf3;
  --cream-soft: #f5eedc;
  --gold-primary: #d4af37;
  --gold-light: #f3e5ab;
  --gold-dark: #997a15;
  --text-dark: #1f1b18;
  --font-body: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-poetic: 'Gulzar', serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at center, var(--emerald-mid) 0%, var(--emerald-dark) 100%);
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 20px 14px;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hidden {
  display: none !important;
}

/* ==========================================
   FLOATING AUDIO BUTTON
   ========================================== */
.music-btn {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  left: max(20px, env(safe-area-inset-left, 20px));
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  border: 2px solid var(--cream-bg);
  color: var(--emerald-dark);
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.music-btn:hover,
.music-btn:active {
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.6);
}

/* ==========================================
   PRIVATE / LOCKED STATE SCREEN
   ========================================== */
.private-screen {
  width: 100%;
  max-width: 520px;
  padding: 12px;
}

.private-card {
  background: var(--cream-bg);
  border: 3px double var(--gold-primary);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.private-message {
  font-size: 1.1rem;
  line-height: 2;
  color: var(--burgundy-deep);
  font-weight: 600;
  margin: 18px 0;
}

.ornament-top,
.ornament-bottom {
  color: var(--gold-primary);
  font-size: 1.8rem;
}

/* ==========================================
   3D ANIMATED ENVELOPE (MOBILE SAFE)
   ========================================== */
.envelope-wrapper {
  perspective: 1200px;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.envelope-wrapper.fade-out {
  opacity: 0;
  transform: scale(0.95);
}

.envelope {
  position: relative;
  width: 100%;
  min-height: 350px;
  background: linear-gradient(145deg, var(--burgundy-accent), var(--burgundy-deep));
  border-radius: 12px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.65), 0 0 0 2px var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  transform-style: preserve-3d;
}

/* Top 3D Envelope Flap */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54%;
  max-height: 195px;
  background: linear-gradient(180deg, #5c111d 0%, var(--burgundy-deep) 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  border-top: 2px solid var(--gold-primary);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4));
  backface-visibility: visible;
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope-body {
  width: 100%;
  height: 100%;
  background: var(--cream-bg);
  border-radius: 8px;
  padding: 10px;
  z-index: 2;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.15);
  transition: transform 0.8s ease 0.35s;
}

.envelope.open .envelope-body {
  transform: translateY(-28px);
}

.envelope-border {
  border: 2px solid var(--gold-primary);
  border-radius: 6px;
  padding: 34px 16px 76px;
  text-align: center;
  background: radial-gradient(circle, #ffffff 0%, var(--cream-soft) 100%);
}

.bismillah {
  font-family: var(--font-poetic);
  font-size: clamp(1.35rem, 4.5vw, 1.6rem);
  color: var(--emerald-dark);
  margin-bottom: 14px;
  line-height: 1.8;
}

.envelope-subtitle {
  font-size: 0.95rem;
  color: #5a524c;
  margin-bottom: 8px;
}

.guest-name {
  font-size: clamp(1.2rem, 4.2vw, 1.45rem);
  color: var(--burgundy-deep);
  font-weight: 700;
  padding: 6px 12px;
  border-bottom: 1px dashed var(--gold-primary);
  display: inline-block;
  max-width: 100%;
  word-wrap: break-word;
  line-height: 1.6;
}

/* Gold Wax Seal Button */
.wax-seal {
  position: absolute;
  bottom: 20px;
  z-index: 4;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold-primary) 55%, var(--gold-dark) 95%);
  border: 3px dashed #7a5f0b;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(255, 255, 255, 0.6);
  color: var(--emerald-dark);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.4s ease;
  animation: pulseSeal 2.4s infinite ease-in-out;
}

.wax-seal:hover,
.wax-seal:active {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(212, 175, 55, 0.75);
}

.envelope.open .wax-seal {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}

@keyframes pulseSeal {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ==========================================
   REVEALED WEDDING INVITATION CARD
   ========================================== */
.invitation-container {
  width: 100%;
  max-width: 660px;
  margin: 16px auto;
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.invitation-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.card-outer-frame {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark), var(--gold-primary));
  padding: 5px;
  border-radius: 16px;
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.65);
}

.card-inner-frame {
  position: relative;
  background-color: var(--cream-bg);
  background-image: radial-gradient(var(--gold-light) 0.75px, transparent 0.75px);
  background-size: 24px 24px;
  border: 2px solid var(--emerald-dark);
  border-radius: 12px;
  padding: 46px 32px;
  text-align: center;
  overflow: hidden;
}

/* Traditional Floral Corner Ornaments */
.corner {
  position: absolute;
  width: 48px;
  height: 48px;
  border-color: var(--gold-primary);
  border-style: double;
  pointer-events: none;
}

.corner-tr { top: 12px; right: 12px; border-width: 4px 4px 0 0; border-top-right-radius: 8px; }
.corner-tl { top: 12px; left: 12px; border-width: 4px 0 0 4px; border-top-left-radius: 8px; }
.corner-br { bottom: 12px; right: 12px; border-width: 0 4px 4px 0; border-bottom-right-radius: 8px; }
.corner-bl { bottom: 12px; left: 12px; border-width: 0 0 4px 4px; border-bottom-left-radius: 8px; }

.card-bismillah {
  font-family: var(--font-poetic);
  font-size: clamp(1.45rem, 4.5vw, 1.75rem);
  color: var(--emerald-dark);
  margin-bottom: 4px;
  line-height: 1.8;
}

.floral-divider {
  color: var(--gold-dark);
  font-size: 1.15rem;
  margin: 16px 0;
  letter-spacing: 2px;
}

/* Classic Dari/Farsi Poem */
.poem-section {
  background: rgba(245, 238, 220, 0.8);
  border-right: 3px solid var(--gold-primary);
  border-left: 3px solid var(--gold-primary);
  padding: 20px 14px;
  margin: 20px auto;
  border-radius: 8px;
  max-width: 520px;
}

.poem-verse {
  font-family: var(--font-poetic);
  font-size: clamp(1.1rem, 3.8vw, 1.35rem);
  line-height: 2.25;
  color: var(--burgundy-deep);
}

/* Couple Names */
.couple-section {
  margin: 28px 0;
}

.couple-intro,
.couple-outro {
  font-size: 1.02rem;
  color: #4a443f;
  line-height: 1.8;
}

.couple-names {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.bride-name,
.groom-name {
  font-family: var(--font-poetic);
  font-size: clamp(2.5rem, 8vw, 3.4rem);
  color: var(--emerald-dark);
  font-weight: 400;
  line-height: 1.5;
  text-shadow: 0 2px 4px rgba(212, 175, 55, 0.3);
}

.and-symbol {
  font-family: var(--font-poetic);
  font-size: clamp(1.8rem, 5.5vw, 2.2rem);
  color: var(--gold-dark);
}

/* Personal Note for Guest */
.guest-note-section {
  margin: 24px auto;
  max-width: 540px;
}

.note-box {
  background: linear-gradient(135deg, #fffdf8, var(--cream-soft));
  border: 1px solid var(--gold-primary);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.guest-note-text {
  font-size: 1rem;
  line-height: 1.95;
  color: var(--emerald-dark);
  font-weight: 600;
}

.guest-seats {
  margin-top: 0.75rem;
  font-weight: 700;
  color: var(--gold-dark);
  font-size: 0.95rem;
}

/* Event Details & Countdown */
.section-title {
  font-family: var(--font-poetic);
  font-size: clamp(1.45rem, 4.5vw, 1.65rem);
  color: var(--burgundy-deep);
  margin-bottom: 10px;
  font-weight: 400;
  line-height: 1.7;
}

.event-date {
  font-size: clamp(1.2rem, 4vw, 1.35rem);
  font-weight: 700;
  color: var(--emerald-dark);
  margin-bottom: 6px;
}

.event-time {
  font-size: 1rem;
  color: #4f4842;
  margin-bottom: 22px;
}

.countdown-section {
  margin: 28px 0;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 420px;
  margin: 12px auto 0;
}

.time-box {
  background: var(--emerald-dark);
  color: var(--cream-bg);
  border: 1px solid var(--gold-primary);
  border-radius: 8px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-num {
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  font-weight: 700;
  color: var(--gold-light);
}

.time-label {
  font-size: 0.82rem;
  margin-top: 4px;
  opacity: 0.9;
}

/* Venue Section */
.venue-section {
  margin: 30px 0 18px;
}

.venue-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--emerald-dark);
  margin-bottom: 6px;
}

.venue-address {
  font-size: 0.95rem;
  color: #3f3a36;
  margin-bottom: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  word-break: break-word;
}

.map-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--burgundy-accent), var(--burgundy-deep));
  color: var(--gold-light);
  text-decoration: none;
  padding: 12px 26px;
  border-radius: 30px;
  border: 1px solid var(--gold-primary);
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 6px 16px rgba(74, 14, 23, 0.35);
}

.map-btn:hover,
.map-btn:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(74, 14, 23, 0.5);
}

.card-footer {
  margin-top: 22px;
  font-size: 0.95rem;
  color: #5c5346;
}

/* ==========================================
   MOBILE & SMALL SMARTPHONE OPTIMIZATIONS
   ========================================== */
@media (max-width: 480px) {
  body {
    padding: 12px 10px;
  }

  .envelope {
    padding: 16px 12px;
    min-height: 320px;
  }

  .envelope-border {
    padding: 26px 12px 68px;
  }

  .wax-seal {
    width: 108px;
    height: 108px;
    font-size: 0.8rem;
    bottom: 14px;
  }

  .card-inner-frame {
    padding: 36px 16px 30px;
  }

  .corner {
    width: 34px;
    height: 34px;
  }

  .poem-section {
    padding: 16px 10px;
  }

  .couple-names {
    gap: 12px;
  }

  .note-box {
    padding: 16px 14px;
  }

  .countdown-grid {
    gap: 6px;
  }

  .time-box {
    padding: 10px 4px;
  }

  .map-btn {
    width: 100%;
    max-width: 280px;
    padding: 12px 18px;
  }
}