body.invite-locked{overflow:hidden;height:100svh}
body.invite-locked .topbar,
body.invite-locked .menu{opacity:0;visibility:hidden;pointer-events:none}

.intro{
  position:fixed;
  inset:0;
  z-index:25;
  min-height:100svh;
  height:100svh;
  padding:clamp(14px,4svh,35px) clamp(16px,4vw,22px);
  background:radial-gradient(ellipse at 50% 42%,#fffdf8 0%,#f7f3eb 63%,#e9e1d5 100%);
  color:var(--ink);
  display:grid;
  grid-template-columns:1fr;
  gap:0;
  place-items:center;
  text-align:center;
  transition:opacity var(--envelope-transition-duration,1s) ease,visibility var(--envelope-transition-duration,1s) ease
}

.envelope-backdrop{
  position:absolute;
  inset:0;
  z-index:0;
  background-size:cover;
  background-position:center;
  pointer-events:none
}

.envelope-scene{
  position:relative;
  z-index:2;
  width:min(510px,100%,calc(100svh - 28px));
  max-width:100%;
  margin-left:auto;
  margin-right:auto;
  display:flex;
  align-items:center;
  flex-direction:column
}

.envelope-atmosphere{
  position:absolute;
  inset:0;
  z-index:1;
  overflow:hidden;
  pointer-events:none;
  color:#bd917e
}

.envelope-atmosphere span{
  position:absolute;
  left:var(--x);
  top:110%;
  font:var(--envelope-particle-size,20px) var(--serif);
  opacity:0;
  animation:envelope-drift var(--float-time,16s) linear infinite;
  animation-delay:var(--float-delay,0s)
}

.envelope-atmosphere span:nth-child(1){--x:10%;--float-time:19s;--float-delay:-2s}
.envelope-atmosphere span:nth-child(2){--x:24%;--float-time:22s;--float-delay:-11s}
.envelope-atmosphere span:nth-child(3){--x:38%;--float-time:18s;--float-delay:-7s}
.envelope-atmosphere span:nth-child(4){--x:55%;--float-time:24s;--float-delay:-15s}
.envelope-atmosphere span:nth-child(5){--x:70%;--float-time:20s;--float-delay:-5s}
.envelope-atmosphere span:nth-child(6){--x:84%;--float-time:23s;--float-delay:-13s}
.envelope-atmosphere span:nth-child(7){--x:94%;--float-time:21s;--float-delay:-9s}
.envelope-atmosphere span:nth-child(8){--x:47%;--float-time:25s;--float-delay:-19s}

.envelope-atmosphere[data-animation="none"]{display:none}
.envelope-atmosphere[data-animation="hearts"] span{font-size:var(--envelope-particle-size,20px)}

.envelope-atmosphere[data-animation="glow"] span{
  width:calc(var(--envelope-particle-size,20px) * .28);
  height:calc(var(--envelope-particle-size,20px) * .28);
  border-radius:50%;
  background:#d5b56f;
  box-shadow:0 0 16px 5px #d5b56f66;
  font-size:0
}

@keyframes envelope-drift{
  0%{
    transform:translate3d(0,0,0) rotate(-12deg);
    opacity:0
  }
  12%{opacity:var(--envelope-particle-opacity,.28)}
  78%{opacity:calc(var(--envelope-particle-opacity,.28) * .7)}
  100%{
    transform:translate3d(24px,-125vh,0) rotate(24deg);
    opacity:0
  }
}

.envelope-scene>.eyebrow{
  margin:0 0 clamp(10px,3svh,25px);
  color:var(--clay)
}

.envelope{
  width:min(320px,78vw,42svh);
  max-width:100%;
  height:auto;
  aspect-ratio:320/205;
  flex:0 0 auto;
  position:relative;
  perspective:900px;
  margin:0 auto clamp(12px,3svh,27px);
  filter:drop-shadow(0 20px 23px #504a3b20)
}

.envelope-back{
  position:absolute;
  inset:0;
  background:#d4c3a8;
  border-radius:4px;
  z-index:1
}

.envelope-letter{
  position:absolute;
  z-index:2;
  left:9%;
  right:9%;
  top:10%;
  height:79%;
  background:#fffdf7;
  border:1px solid #e7dece;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  transition:transform var(--envelope-open-duration,2s) cubic-bezier(.2,.75,.25,1);
  transition-delay:.18s
}

.envelope-letter span{
  font-size:7px;
  letter-spacing:.2em;
  color:var(--muted)
}

.envelope-letter strong{
  font:500 clamp(20px,6vw,26px) var(--serif);
  color:var(--ink)
}

.envelope-letter i{
  font-style:normal;
  color:var(--gold);
  font-size:14px
}

.envelope-flap{
  position:absolute;
  z-index:4;
  inset:0 0 auto;
  height:58%;
  background:#b87962;
  clip-path:polygon(0 0,100% 0,50% 100%);
  transform-origin:50% 0;
  transition:transform var(--envelope-open-duration,2s) cubic-bezier(.35,.05,.2,1);
  backface-visibility:hidden
}

.envelope-front{
  position:absolute;
  z-index:3;
  inset:0;
  background:#e3d3bc;
  clip-path:polygon(0 0,50% 54%,100% 0,100% 100%,0 100%)
}

.envelope-seal{
  position:absolute;
  z-index:5;
  left:50%;
  top:51%;
  transform:translate(-50%,-50%);
  width:39px;
  height:39px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--clay);
  color:#fff8ed;
  border:2px solid #e4c9a9;
  font-size:18px;
  transition:opacity .2s,transform .3s
}

.intro-copy{
  width:100%;
  align-self:auto
}

.intro-message{
  font:italic 16px var(--serif);
  color:#777b70;
  margin:0 0 7px
}

.intro h1{
  font:500 clamp(40px,9vw,61px)/1.02 var(--serif);
  letter-spacing:-.04em;
  margin:0
}

.intro h1 em{
  color:var(--clay);
  font-style:italic
}

.intro-sub{
  font:13px var(--sans);
  color:var(--muted);
  margin:14px 0 24px
}

.intro-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap
}

.intro-actions .button{
  min-width:190px
}

.intro-sound{
  height:48px;
  padding:0 16px;
  display:inline-flex;
  align-items:center;
  gap:9px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.45);
  font-size:10px;
  cursor:pointer;
  transition:.2s
}

.intro-sound .sound-icon{
  font-size:16px;
  color:var(--clay)
}

.intro-sound[aria-pressed=true]{
  background:#e8e9df;
  border-color:#aeb9a8
}

.intro-foot{
  position:static;
  transform:none;
  margin:36px 0 0;
  color:#969387;
  font-size:8px;
  letter-spacing:.17em;
  display:flex;
  gap:7px
}

.intro-foot span{
  color:var(--clay);
  font-size:12px
}

.intro.is-opening .envelope-flap{
  transform:rotateX(180deg);
  z-index:1
}

.intro.is-opening .envelope-letter{
  transform:translateY(-62%)
}

.intro.is-opening .envelope-seal{
  opacity:0;
  transform:translate(-50%,-50%) scale(.5)
}

.intro.dismissed{
  opacity:0;
  visibility:hidden;
  pointer-events:none
}

body.invite-open .topbar{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .3s ease
}

@media(max-width:760px){
  .intro{
    padding:clamp(12px,3svh,28px) 20px clamp(12px,3svh,24px)
  }

  .envelope{
    width:min(320px,78vw,42svh);
    height:auto;
    aspect-ratio:320/205
  }

  .intro-message{
    font-size:15px
  }

  .intro h1{
    font-size:clamp(39px,10.5vw,54px)
  }

  .intro-sub{
    margin:11px 0 20px
  }

  .intro-actions{
    gap:9px
  }

  .intro-actions .button{
    min-width:0;
    width:min(100%,290px)
  }

  .intro-sound{
    height:43px
  }

  .intro-foot{
    margin-top:clamp(12px,3svh,28px);
    font-size:7px
  }
}

@media(max-height:560px) and (orientation:landscape){
  .intro{
    overflow-y:auto;
    padding:10px 18px
  }

  .envelope-scene{
    width:min(620px,100%)
  }

  .envelope-scene>.eyebrow{
    margin-bottom:8px
  }

  .envelope{
    width:min(250px,34vw,30svh);
    margin-bottom:10px
  }

  .intro-sub{
    margin:6px 0 10px
  }

  .intro-foot{
    margin-top:10px
  }
}

@media(prefers-reduced-motion:reduce){
  .intro,
  .envelope-flap,
  .envelope-letter{
    transition-duration:.01ms !important;
    scroll-behavior:auto!important
  }
}

@media(prefers-reduced-motion:reduce){
  .envelope-atmosphere{
    display:none!important
  }
}

/* Centrado del sobre */
#inicio.intro{
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:center !important;
  text-align:center !important
}

#inicio .envelope-scene{
  width:min(510px,100%,calc(100svh - 28px)) !important;
  max-width:100% !important;
  margin-left:auto !important;
  margin-right:auto !important;
  display:flex !important;
  align-items:center !important;
  flex-direction:column !important
}

#inicio .envelope{
  position:relative !important;
  width:min(320px,78vw,42svh) !important;
  max-width:100% !important;
  margin-left:auto !important;
  margin-right:auto !important
}

#inicio .intro-copy,
#inicio .intro-foot{
  width:100% !important;
  text-align:center !important
}

/* =====================================
   ENTRADA PREMIUM DEL SOBRE
   ===================================== */

.intro {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.85), transparent 32%),
    radial-gradient(circle at 80% 78%, rgba(212,195,168,.24), transparent 36%),
    linear-gradient(135deg, #fffdf8 0%, #f7f1e7 48%, #ebe1d2 100%) !important;
}

.envelope-back {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.25), transparent 28%),
    repeating-linear-gradient(
      0deg,
      rgba(96,75,49,.035) 0,
      rgba(96,75,49,.035) 1px,
      transparent 1px,
      transparent 4px
    ),
    #d4c3a8 !important;
}

.envelope-flap {
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.18),
      transparent 42%,
      rgba(92,52,35,.12)
    ),
    #b87962 !important;
}

.envelope-front {
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.22),
      transparent 40%,
      rgba(92,52,35,.12)
    ),
    #e3d3bc !important;
}

.envelope-letter {
  background:
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.9), transparent 30%),
    repeating-linear-gradient(
      0deg,
      rgba(120,100,75,.035) 0,
      rgba(120,100,75,.035) 1px,
      transparent 1px,
      transparent 5px
    ),
    #fffdf7 !important;
  box-shadow: inset 0 0 20px rgba(120,100,75,.08);
}

.envelope-seal {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.28), transparent 24%),
    radial-gradient(circle at 70% 75%, rgba(90,20,20,.3), transparent 42%),
    #8f2731 !important;
  border: 3px solid #c79a62 !important;
  box-shadow:
    0 5px 12px rgba(83,28,28,.28),
    inset 2px 2px 4px rgba(255,255,255,.18),
    inset -3px -4px 6px rgba(75,18,18,.24);
  animation: wax-seal-pulse 2.8s ease-in-out infinite;
}

.envelope-seal::after {
  content: "A · M";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f8e8d0;
  font: 600 9px Georgia, serif;
  letter-spacing: .04em;
  text-shadow: 0 1px 1px rgba(80,20,20,.35);
}

.intro.is-opening .envelope-seal {
  animation: none;
}

@keyframes wax-seal-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.06);
  }
}

/* Apertura lenta y elegante del sobre */
.envelope-flap {
  transition:
    transform 1.6s cubic-bezier(.35,.05,.2,1) !important;
}

.envelope-letter {
  transition:
    transform 3.4s cubic-bezier(.18,.72,.22,1),
    opacity 2.8s ease !important;
  transition-delay: .55s !important;
}





.intro.is-opening .envelope-flap {
  transform: rotateX(180deg) !important;
}

/* Secuencia correcta de apertura */
.envelope-front {
  z-index: 3 !important;
}

.envelope-flap {
  z-index: 4 !important;
}

.envelope-letter {
  z-index: 2 !important;
  transition:
    transform 3.2s cubic-bezier(.18,.72,.22,1),
    opacity 2.6s ease !important;
  transition-delay: .55s !important;
}

.envelope {
  overflow: visible !important;
}

.envelope-letter {
  z-index: 2 !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  animation: none !important;
}

.intro.is-opening .envelope-letter {
  animation: letter-emerge 4s cubic-bezier(.18,.72,.22,1) forwards !important;
}

.envelope-letter {
  z-index: 2 !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  transition: none !important;
  animation: none !important;
}

.envelope-flap {
  z-index: 4 !important;
  transition:
    transform 2.2s cubic-bezier(.35,.05,.2,1) !important;
}

.intro.is-opening .envelope-flap {
  transform: rotateX(180deg) !important;
}

.intro.is-opening .envelope-letter {
  animation:
    letter-emerge 2.8s cubic-bezier(.18,.72,.22,1) 2.2s both !important;
}

@keyframes letter-emerge {
  0% {
    z-index: 2;
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  25% {
    z-index: 2;
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  26% {
    z-index: 6;
  }

  100% {
    z-index: 6;
    transform: translateY(-82%) scale(1.025);
    opacity: 1;
  }
}




.intro.is-opening .envelope-flap {
  z-index: 4 !important;
  transform: rotateX(180deg) !important;
}

.intro.is-opening .envelope-flap {
  z-index: 4 !important;
  transform: rotateX(180deg) !important;
}

.intro.is-opening .envelope-seal {
  z-index: 1 !important;
  opacity: 0 !important;
}

/* Sello EN SOBRE con símbolo de corazón */
.envelope-seal::after {
  content: "♥" !important;
  font-size: 17px;
  color: #f8e8d0;
  font-family: Georgia, serif;
}

/* Paleta azul para el sobre */
.envelope-back {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.24), transparent 28%),
    repeating-linear-gradient(
      0deg,
      rgba(24, 52, 82, .035) 0,
      rgba(24, 52, 82, .035) 1px,
      transparent 1px,
      transparent 4px
    ),
    #b8cbe1 !important;
}

.envelope-flap {
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.18),
      transparent 42%,
      rgba(20,42,70,.18)
    ),
    #4d7098 !important;
}

.envelope-front {
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.2),
      transparent 40%,
      rgba(20,42,70,.18)
    ),
    #6e8fb6 !important;
}

.envelope-letter {
  background:
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.9), transparent 30%),
    repeating-linear-gradient(
      0deg,
      rgba(70,90,115,.035) 0,
      rgba(70,90,115,.035) 1px,
      transparent 1px,
      transparent 5px
    ),
    #fffdf7 !important;
}

.envelope-seal {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.28), transparent 24%),
    radial-gradient(circle at 70% 75%, rgba(83,55,20,.28), transparent 42%),
    #b08a45 !important;
  border-color: #e8cf8b !important;
}



/* Proporción correcta de los botones del sobre */
#openInvite {
  width: auto !important;
  min-width: 190px !important;
  height: auto !important;
  min-height: 44px !important;
  padding: 11px 22px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  letter-spacing: .04em !important;
  border-radius: var(--button-radius, 10px) !important;
}

#introSoundToggle {
  width: auto !important;
  min-width: 150px !important;
  height: auto !important;
  min-height: 38px !important;
  padding: 8px 14px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
  border-radius: var(--button-radius, 10px) !important;
}

#introSoundToggle #introSoundText {
  display: inline !important;
  font-size: 12px !important;
  white-space: nowrap;
}

#introSoundToggle .sound-icon {
  display: inline-block !important;
  font-size: 16px !important;
  line-height: 1 !important;
}

/* Evitar que restos del mini reproductor afecten el sobre */
#introSoundToggle .sound-wave,
#introSoundToggle .music-heart {
  display: none !important;
}

@media (max-width: 760px) {
  #openInvite {
    min-width: 175px !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
  }

  #introSoundToggle {
    min-width: 140px !important;
    min-height: 36px !important;
    padding: 7px 12px !important;
    font-size: 11px !important;
  }

  #introSoundToggle #introSoundText {
    font-size: 11px !important;
  }
}

#openInvite,
#introSoundToggle {
  font-family: var(--sans, Arial, sans-serif) !important;
  color: var(--paper, #fff) !important;
  background: var(--clay, #b66f58) !important;
  border-radius: var(--button-radius, 10px) !important;
}

#openInvite {
  font-size: var(--invitation-body-size, 16px) !important;
}

#introSoundToggle {
  font-size: var(--invitation-body-size, 16px) !important;
}