:root {
  --forest: #173f32;
  --forest-deep: #103629;
  --sage: #668576;
  --sage-light: #a8b8a0;
  --cream: #f8f5ec;
  --paper: #fffdf6;
  --gold: #b59a5a;
  --ink: #24483b;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e8e5dc;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(14px, 3vw, 30px);
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 18% 14%, rgba(213, 205, 184, .22), transparent 36%),
    radial-gradient(ellipse at 84% 80%, rgba(206, 197, 174, .2), transparent 34%),
    #e8e5dc;
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

button {
  font: inherit;
}

.invitation {
  position: relative;
  width: min(100%, 480px);
  /* Altura ajustable para evitar espacios en blanco gigantes */
  min-height: min(820px, calc(100svh - 28px));
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 9px solid var(--forest);
  border-radius: 34px;
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  box-shadow: 0 24px 70px rgba(29, 43, 35, .2), inset 0 0 0 1px rgba(255,255,255,.55);
}

.invitation::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(181,154,90,.36);
  border-radius: 20px;
  pointer-events: none;
  z-index: 5;
}

.botanical {
  position: absolute;
  z-index: 1;
  opacity: .93;
  pointer-events: none;
}

.botanical.top-left {
  top: -10px;
  left: -15px;
  transform: rotate(20deg) scaleY(-1);
  width: 100px;
  height: 130px;
}

.botanical.top-right {
  top: -10px;
  right: -15px;
  transform: rotate(-20deg) scale(-1,-1);
  width: 100px;
  height: 130px;
}

.botanical.bottom-left {
  left: -12px;
  bottom: 92px;
  transform: scaleY(-1) rotate(-5deg);
  width: 110px;
  height: 140px;
}

.botanical.bottom-right {
  right: -12px;
  bottom: 92px;
  transform: scale(-1,-1) rotate(-5deg);
  width: 110px;
  height: 140px;
}

.top-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 100px 25px 0;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-family: 'Playfair Display', serif;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
}

h1 {
  margin: 15px 0 10px;
  color: var(--forest);
  font-family: 'Great Vibes', cursive;
  font-size: clamp(38px, 9vw, 48px);
  font-weight: 400;
  line-height: 1.2;
}

.intro {
  max-width: 280px;
  margin: 0 auto;
  color: #627668;
  font-size: 15px;
  font-style: normal; 
  line-height: 1.65;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin: 18px auto 0;
  color: var(--gold);
  font-size: 21px;
}

.divider::before,
.divider::after {
  content: "";
  width: 50px;
  height: 1px;
  background: rgba(181,154,90,.65);
}

/* --- CORRECCIÓN DEL ESPACIO --- */
.stage {
  position: relative;
  z-index: 3;
  width: 100%;
  /* Se elimina height fija y se usa flex para empujar suavemente */
  margin-top: 40px; 
  display: flex;
  justify-content: center;
  padding-bottom: 80px;
}

.envelope-wrap {
  position: relative;
  width: min(80%, 330px); /* Un poco más ancho en móviles */
  height: 205px;
  perspective: 900px;
}

.envelope {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: white;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 13px 12px rgba(22,45,34,.17));
}

.envelope-body {
  position: absolute;
  inset: 0;
  border-radius: 3px 3px 8px 8px;
  background: linear-gradient(145deg, #315c45, #1b4937 72%);
}

.envelope-body::before,
.envelope-body::after {
  content: "";
  position: absolute;
  inset: 0;
}

.envelope-body::before {
  background:
    linear-gradient(32deg, transparent 49.6%, rgba(9,43,31,.34) 50%, transparent 50.5%),
    linear-gradient(-32deg, transparent 49.6%, rgba(9,43,31,.28) 50%, transparent 50.5%);
}

.flap {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 100%;
  height: 67%;
  transform-origin: top center;
  clip-path: polygon(0 0,100% 0,50% 100%);
  background: linear-gradient(160deg,#3c694f,#244e3b);
  transition: transform .75s cubic-bezier(.2,.8,.2,1), z-index .1s .35s;
}

.seal {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 55%;
  transform: translate(-50%,-50%);
  width: 57px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f4e8bc;
  font-size: 21px;
  font-style: italic;
  font-family: 'Great Vibes', cursive;
  background: radial-gradient(circle at 35% 30%, #d8bd76, #997b3d 61%, #6f552b);
  border: 3px double #e7d39b;
  box-shadow: 0 2px 4px #17382c;
  transition: opacity .28s;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,241,190,.75);
  border-radius: 50%;
}

.envelope-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 76%;
  transform: translateX(-50%);
  width: 100%;
  margin: 0;
  color: #f8f5ec;
  font-family: 'Great Vibes', cursive;
  font-size: 24px;
  text-shadow: 0 1px 3px rgba(0,0,0,.22);
}

.tap-note {
  position: absolute;
  top: calc(100% + 20px);
  width: 100%;
  margin: 0;
  text-align: center;
  color: var(--forest);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.letter {
  position: absolute;
  z-index: 2;
  left: 5%;
  bottom: 13px;
  width: 90%;
  height: 330px;
  padding: 24px 19px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(181,154,90,.48);
  box-shadow: 0 8px 20px rgba(36,55,43,.16);
  opacity: 0;
  transform: translateY(115px) scale(.96);
  transition: transform .9s cubic-bezier(.16,.78,.24,1), opacity .38s ease;
}

.letter::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(181,154,90,.22);
  pointer-events: none;
}

.letter-ornament {
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 7px;
}

.letter-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .27em;
  text-transform: uppercase;
}

.letter h2 {
  margin: 0;
  color: var(--forest);
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  font-size: 32px;
}

.letter-copy {
  max-width: 260px;
  margin: 10px auto 14px;
  color: #637468;
  font-size: 12px;
  line-height: 1.5;
}

.letter-rule {
  width: 42px;
  height: 1px;
  background: var(--gold);
  margin: 0 auto 10px;
}

.question {
  margin: 0 0 12px;
  color: var(--forest);
  font-size: 16px;
  font-weight: 600;
  font-style: italic;
}

/* --- CORRECCIÓN DE LOS BOTONES --- */
.answers {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  margin-top: 5px;
  justify-content: center;
  width: 100%;
  padding: 0 10px; /* Evita que toquen los bordes */
}

.answer {
  min-width: 85px;
  padding: 8px 18px;
  border: 1px solid var(--sage);
  color: var(--forest);
  background: transparent;
  font-size: 12px;
  letter-spacing: .15em;
  cursor: pointer;
  /* Esquinas curveadas */
  border-radius: 20px; 
  transition: background .2s, color .2s, transform .2s, border-color .2s;
}

.answer:hover,
.answer:focus-visible {
  color: white;
  background: var(--forest);
  border-color: var(--forest);
  transform: translateY(-2px);
}

.answer.yes {
  border-color: var(--gold);
}

/* Mantiene el color cuando se selecciona el botón */
.answer.selected {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

.response {
  position: relative;
  z-index: 1;
  min-height: 16px;
  margin: 12px 0 0;
  color: #927b45;
  font-size: 11px;
  font-style: italic;
  padding: 0 10px;
}

.open .letter {
  opacity: 1;
  transform: translateY(-148px) scale(1);
}

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

.open .seal {
  opacity: 0;
}

.open .envelope-hint,
.open .tap-note {
  opacity: 0;
}

.open .envelope {
  z-index: 1;
  cursor: default;
  pointer-events: none;
}

.open .envelope-body {
  box-shadow: inset 0 5px 9px rgba(0,0,0,.13);
}

.footer {
  position: relative;
  z-index: 2;
  padding: 0 24px 27px;
  margin-top: auto; /* Empuja el footer hacia abajo */
  text-align: center;
  color: var(--forest);
  font-size: 10px;
  letter-spacing: .23em;
  line-height: 1.8;
  text-transform: uppercase;
}

.footer span {
  display: block;
}

/* --- AJUSTES PARA CELULARES --- */
@media (max-height: 760px) {
  .invitation { min-height: 740px; }
  .top-copy { padding-top: 85px; }
  .stage { margin-top: 20px; }
  .letter { height: 305px; }
  .open .letter { transform: translateY(-132px) scale(.97); }
}

@media (max-width: 390px) {
  .invitation { border-width: 7px; border-radius: 27px; }
  .top-copy { padding-top: 85px; padding-inline: 15px; }
  .stage { margin-top: 30px; padding-bottom: 60px; }
  .envelope-wrap { width: 85%; }
  .letter { width: 96%; left: 2%; padding-inline: 12px; }
  
  .botanical.top-left, .botanical.top-right { width: 80px; height: 105px; top: -5px; }
  .botanical.bottom-left, .botanical.bottom-right { width: 85px; height: 110px; bottom: 80px; }
  
  .intro { font-size: 13px; }
  .answer { min-width: 75px; font-size: 11px; } /* Botones un pelín más pequeños para que quepan bien */
}