:root {
    --rojo-intenso: #721c24; /* Burgundy */
    --burgundy-dark: #4a0e14;
    --champagne: #f4eae1; /* Soft cream/champagne background */
    --champagne-dark: #e8d7c8;
    --gold: #c5a059;
    --blanco: #FFFFFF;
    --texto-oscuro: #2c2523;
    --texto-suave: #5c5350;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--blanco); /* Seamless background */
    color: var(--texto-oscuro);
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

.script-font {
    font-family: 'Great Vibes', cursive;
    font-size: 2.2rem;
    color: var(--gold);
    margin: 0.5rem 0;
}

/* Red envelope login screen */
.envelope-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: var(--champagne-dark);
    background-image: radial-gradient(circle, var(--champagne) 0%, var(--champagne-dark) 100%);
}

.envelope-content {
    background-color: var(--rojo-intenso);
    background-image: linear-gradient(135deg, var(--rojo-intenso) 0%, var(--burgundy-dark) 100%);
    color: var(--champagne);
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 450px;
    width: 100%;
    border: 2px solid var(--gold);
    position: relative;
    overflow: hidden;
    animation: fadeIn 1s ease-out;
}

.envelope-seal {
    width: 110px; /* Larger to display the monogram details clearly */
    height: 110px;
    background-image: url('../images/monograma.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    margin: 0 auto 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid var(--champagne);
}

.envelope-seal::after {
    content: none;
}

.names-title {
    font-family: 'Great Vibes', cursive;
    font-size: 3.6rem; /* Cursive looks smaller, so we enlarge it to 3.6rem */
    color: var(--gold);
    margin: 0.8rem 0;
    font-weight: normal;
    letter-spacing: 0px;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.3rem; /* Enlarged for better presence */
    color: var(--champagne);
    font-style: italic;
    font-family: 'Playfair Display', serif;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.login-box {
    margin-top: 20px;
}

.login-instruction {
    font-size: 0.9rem;
    color: var(--champagne-dark);
    margin-bottom: 20px;
    font-weight: 300;
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid rgba(197, 160, 89, 0.4);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--blanco);
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

.form-group input::placeholder {
    color: rgba(244, 234, 225, 0.5);
}

.form-group input:focus {
    outline: none;
    border-color: var(--gold);
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(197, 160, 89, 0.3);
}

.btn-open {
    background-color: var(--gold);
    color: var(--burgundy-dark);
    border: none;
    padding: 14px 30px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-family: 'Playfair Display', serif;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn-open:hover {
    background-color: #dcb36d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Invitation Screen (Seamless, Full-width background) */
.invitation-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Start from top to allow scrolling */
    padding: 0;
    background-color: var(--blanco); /* Pure white background same as image */
}

.invitation-card {
    background-color: var(--blanco);
    padding: 460px 24px 480px 24px; /* Generous padding to clear the top and bottom floral borders */
    text-align: center;
    max-width: 520px;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 36px;
    z-index: 2;
    animation: fadeIn 0.8s ease-out;
}

/* Seamless Floral Borders - Tall height, cache-busted, z-index: 1 (behind text) */
.card-top-decor {
    background-image: url('../roses_top_border.png?v=3');
    background-position: top center;
    background-size: 100% auto;
    background-repeat: no-repeat;
    height: 380px; /* Tall enough to display the full image height and let it fade out naturally */
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1; /* Render behind text */
}

/* Gradient overlay to blend top border texture seamlessly into white card background */
.card-top-decor::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
}

.card-bottom-decor {
    background-image: url('../roses_bottom_border.png?v=3');
    background-position: bottom center;
    background-size: 100% auto;
    background-repeat: no-repeat;
    height: 380px; /* Tall enough to display the full image height and let it fade out naturally */
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    pointer-events: none;
    z-index: 1; /* Render behind text */
}

/* Gradient overlay to blend bottom border texture seamlessly into white card background */
.card-bottom-decor::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
    pointer-events: none;
}

/* Floating Side Decor (Leaves and small roses) */
.side-decor {
    position: absolute;
    width: 45px;
    height: 45px;
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
}

.leaf-decor {
    background-image: url('../single_leaf.png');
}

.rose-decor {
    background-image: url('../small_rose.png');
    width: 32px;
    height: 32px;
}

/* Placement and rotations of floating leaves/roses along the card */
.leaf-l1 { left: 4%; top: 380px; transform: rotate(-35deg) scale(1.1); }
.leaf-r1 { right: 6%; top: 560px; transform: rotate(45deg) scale(0.95); }
.rose-l1 { left: 8%; top: 820px; transform: rotate(15deg) scale(1); }
.leaf-r2 { right: 2%; top: 1100px; transform: rotate(-25deg) scale(1.2); }
.leaf-l2 { left: 5%; top: 1400px; transform: rotate(55deg) scale(0.9); }
.rose-r1 { right: 8%; top: 1650px; transform: rotate(-15deg) scale(1); }

/* Card elements: position: relative and z-index: 2 to render on top of the floral background */
.invitation-header {
    position: relative;
    z-index: 2;
}

.names-full-script {
    font-family: 'Great Vibes', cursive;
    font-size: 3.8rem;
    color: var(--gold);
    line-height: 1.2;
    margin: 0 0 10px 0;
    font-weight: normal;
}

.bold-script {
    font-weight: normal;
    text-shadow: 
      -1px -1px 0px rgba(255, 255, 255, 0.95), /* Luz de bisel superior izquierda */
      -1px 0px 0px rgba(255, 255, 255, 0.6),
      0px -1px 0px rgba(255, 255, 255, 0.6),
      1px 1px 0px rgba(139, 109, 55, 0.95),     /* Sombra de bisel inferior derecha */
      1px 2px 1px rgba(114, 28, 36, 0.3),      /* Extrusión cálida burgundy */
      2px 4px 6px rgba(0, 0, 0, 0.18);         /* Sombra paralela suave */
}

/* Slideshow Container */
.photo-slideshow {
    width: 100%;
    height: 500px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 24px;
    border: 1px solid rgba(197, 160, 89, 0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.love-note-section {
    position: relative;
    z-index: 2;
}

.guest-name-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--rojo-intenso);
    font-weight: 700;
    margin: 5px 0 0 0;
    letter-spacing: 0.5px;
}

.love-note {
    margin: 0 auto;
    max-width: 480px;
}

.love-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--texto-suave);
    line-height: 1.7;
    margin: 0;
}

.wedding-date-section {
    border-top: 1px solid rgba(197, 160, 89, 0.15);
    border-bottom: 1px solid rgba(197, 160, 89, 0.15);
    padding: 15px 0;
    margin: 5px 0;
    position: relative;
    z-index: 2;
}

.wedding-date {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--rojo-intenso);
    margin: 5px 0 0 0;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Cuenta Regresiva */
.countdown-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 30px auto 15px auto;
    max-width: 440px;
}

.countdown-item {
    flex: 1;
    background: linear-gradient(135deg, var(--rojo-intenso), var(--burgundy-dark));
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 12px 6px;
    text-align: center;
    min-width: 72px;
    box-shadow: 0 6px 15px rgba(114, 21, 37, 0.18);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.countdown-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 22px rgba(114, 21, 37, 0.28);
}

.countdown-value {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--champagne);
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.countdown-label {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--gold);
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.event-info-section {
    position: relative;
    z-index: 2;
}

.details {
    margin: 5px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.event-icon-large {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 10px;
}

.detail-label {
    font-size: 1.05rem; /* Enlarged for better section title visibility */
    letter-spacing: 4px; /* Slightly wider spacing for elegance */
    color: var(--gold);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.event-block {
    margin: 5px 0;
}

.event-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--texto-oscuro);
    margin: 5px 0;
    font-weight: 600;
}

.event-time {
    font-size: 0.95rem;
    color: var(--texto-suave);
    margin: 0;
}

.map-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--champagne);
    color: var(--rojo-intenso);
    border: 1px solid var(--gold);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 12px;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.5px;
}

.map-link:hover {
    background-color: var(--rojo-intenso);
    color: var(--blanco);
    border-color: var(--rojo-intenso);
    box-shadow: 0 4px 10px rgba(114, 28, 36, 0.2);
}

.map-icon {
    margin-right: 6px;
    font-size: 0.95rem;
}

.elegant-divider {
    color: var(--gold);
    font-size: 0.9rem;
    margin: 5px 0;
    opacity: 0.6;
}

/* Share Photos Section */
.share-photos-section {
    position: relative;
    z-index: 2;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--rojo-intenso);
    margin: 10px 0;
    font-weight: 700;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--texto-suave);
    line-height: 1.6;
    margin: 0 auto;
    max-width: 440px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--rojo-intenso);
    color: var(--blanco);
    border: 1px solid var(--rojo-intenso);
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: bold;
    text-decoration: none;
    margin-top: 15px;
    transition: all 0.3s ease;
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
}

.upload-btn:hover {
    background-color: var(--burgundy-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Guest & Confirm Section */
.guest-info {
    border-top: none; /* Handled by standard dividers */
    padding-top: 0;
    margin-top: 0;
    position: relative;
    z-index: 2;
}

.welcome-text {
    font-size: 1.05rem;
    margin: 0 0 5px;
    color: var(--texto-suave);
}

.guest-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--rojo-intenso);
    font-size: 1.25rem;
}

.pases-text {
    font-size: 0.9rem;
    color: var(--texto-suave);
    margin-bottom: 20px;
}

.pases-num {
    color: var(--texto-oscuro);
}

.confirm-section {
    background-color: rgba(244, 234, 225, 0.4);
    padding: 20px;
    border-radius: 12px;
    border: 1px dashed var(--gold);
}

.confirm-prompt {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 12px;
    font-weight: 600;
}

.select-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.styled-select {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background-color: var(--blanco);
    color: var(--texto-oscuro);
    font-family: 'Montserrat', sans-serif;
    appearance: none;
    -webkit-appearance: none;
    text-align-last: center;
    cursor: pointer;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    color: var(--gold);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.btn-confirm {
    background-color: var(--rojo-intenso);
    color: var(--blanco);
    border: none;
    padding: 12px 25px;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    font-weight: bold;
    letter-spacing: 1px;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-confirm:hover {
    background-color: var(--burgundy-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.confirmed-section {
    padding: 20px;
    border-radius: 12px;
    background-color: rgba(25, 135, 84, 0.08);
    border: 1px solid rgba(25, 135, 84, 0.25);
    margin-top: 10px;
    text-align: center;
}

.success-msg {
    color: #198754;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0;
}

/* Dress Code Section */
.dress-code-section {
    position: relative;
    z-index: 2;
}

/* Gifts Section */
.gifts-section {
    position: relative;
    z-index: 2;
}

.gift-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.gift-card {
    background-color: #fafaf9;
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.gift-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    border-color: var(--gold);
}

.gift-icon {
    font-size: 2.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 45px;
    margin-bottom: 8px;
}

.gift-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    color: var(--texto-oscuro);
    margin-bottom: 10px;
    font-weight: 600;
}

.gift-detail {
    font-size: 0.85rem;
    color: var(--texto-suave);
    line-height: 1.6;
    margin: 0;
}

.error-msg {
    color: #ffd89b;
    margin-top: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive styles */
@media (max-width: 576px) {
    .invitation-card {
        padding: 365px 16px 360px 16px;
        gap: 28px;
    }
    .names-title {
        font-size: 2.4rem;
    }
    .script-font {
        font-size: 1.8rem;
    }
    .names-full-script {
        font-size: 2.4rem;
        word-wrap: break-word;
        display: block;
        width: 100%;
    }
    .wedding-date {
        font-size: 1.3rem;
    }
    .event-title {
        font-size: 1.15rem;
    }
    .photo-slideshow {
        height: 350px; /* Shorter slideshow on mobile */
    }
    /* Reposition floating elements slightly for smaller displays */
    .leaf-l1 { left: 2%; top: 260px; }
    .leaf-r1 { right: 2%; top: 420px; }
    .rose-l1 { left: 4%; top: 620px; }
    .leaf-r2 { right: 1%; top: 800px; }
}

@media (min-width: 576px) {
    .gift-options {
        flex-direction: row;
    }
    .gift-card {
        flex: 1;
    }
}

/* ═══════════════════════════════════════════════════════════
   ANIMACIÓN DEL SOBRE
   ═══════════════════════════════════════════════════════════ */

/* Fade-out del formulario de login */
.fade-out-login {
    animation: loginFadeOut 0.5s ease-out forwards;
}
@keyframes loginFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.92); }
}

/* Slide-in de la invitación */
.invitation-slide-in {
    animation: invSlideIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes invSlideIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Escena principal del sobre — pantalla completa */
#envelope-animation-scene {
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.env-stage {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #f4eae1 0%, #e4cfc0 60%, #d4b8a8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Fade-out de la escena */
.scene-fade-out {
    animation: sceneFade 0.7s ease-out forwards;
}
@keyframes sceneFade {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Partículas flotantes */
.env-particle {
    position: absolute;
    color: var(--gold);
    opacity: 0;
    font-size: 1.2rem;
    animation: particleFloat 4s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
}
.env-particle.p1 { top: 15%; left: 10%;  animation-delay: 0.2s; }
.env-particle.p2 { top: 25%; right: 12%; animation-delay: 0.9s; font-size: 0.8rem; }
.env-particle.p3 { top: 60%; left: 8%;  animation-delay: 1.5s; font-size: 1.5rem; }
.env-particle.p4 { top: 70%; right: 9%; animation-delay: 0.5s; }
.env-particle.p5 { top: 40%; left: 5%;  animation-delay: 2s;   font-size: 0.9rem; }
.env-particle.p6 { top: 10%; right: 6%; animation-delay: 1.2s; font-size: 1.1rem; }
@keyframes particleFloat {
    0%   { opacity: 0; transform: translateY(20px) rotate(0deg); }
    30%  { opacity: 0.7; }
    70%  { opacity: 0.5; }
    100% { opacity: 0; transform: translateY(-60px) rotate(20deg); }
}

/* Wrapper centrado */
.env-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    animation: wrapperPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes wrapperPop {
    from { opacity: 0; transform: scale(0.75); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── El sobre ────────────────────────────────────────────── */
.env-envelope {
    position: relative;
    width: 340px;
    height: 230px;
    perspective: 900px;
    filter: drop-shadow(0 24px 48px rgba(114,28,36,0.28));
}

/* Flap TRASERO visible antes de que el flap de arriba se abra */
.env-flap-back {
    position: absolute;
    top: 0; left: 0;
    width: 0;
    height: 0;
    border-left: 170px solid transparent;
    border-right: 170px solid transparent;
    border-top: 120px solid #5a1520;
    z-index: 1;
}

/* Cuerpo del sobre */
.env-body {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 100%;
    background: linear-gradient(160deg, #8a2030 0%, #721c24 50%, #5a1520 100%);
    border-radius: 6px;
    overflow: hidden;
    z-index: 2;
    border: 2px solid var(--gold);
}

/* Triángulos interiores del cuerpo */
.env-triangle {
    position: absolute;
    width: 0;
    height: 0;
}
.env-tri-left {
    left: 0; bottom: 0;
    border-left: 170px solid rgba(90,21,32,0.6);
    border-top: 115px solid transparent;
}
.env-tri-right {
    right: 0; bottom: 0;
    border-right: 170px solid rgba(90,21,32,0.6);
    border-top: 115px solid transparent;
}
.env-tri-bottom {
    left: 0; bottom: 0; right: 0;
    border-left: 170px solid transparent;
    border-right: 170px solid transparent;
    border-bottom: 110px solid rgba(70,16,25,0.5);
}

/* Sello/Monograma central en el sobre */
.env-seal-spot {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 72px; height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold) 0%, #a07830 100%);
    display: flex; align-items: center; justify-content: center;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 0 0 4px rgba(197,160,89,0.3), 0 6px 20px rgba(0,0,0,0.3);
    z-index: 3;
}
.env-seal-img {
    width: 56px; height: 56px;
    object-fit: contain;
    border-radius: 50%;
}
.env-seal-fallback {
    color: var(--rojo-intenso);
    font-family: 'Great Vibes', cursive;
    font-size: 1.4rem;
    font-weight: bold;
    align-items: center;
    justify-content: center;
}

/* ── Flap superior (se abre) ────────────────────────────── */
.env-flap {
    position: absolute;
    top: 0; left: 0;
    width: 0;
    height: 0;
    border-left: 170px solid transparent;
    border-right: 170px solid transparent;
    border-top: 120px solid var(--rojo-intenso);
    z-index: 10;
    transform-origin: top center;
    transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}
/* Sombra/borde dorado del flap */
.env-flap::after {
    content: '';
    position: absolute;
    top: -120px; left: -170px;
    width: 0; height: 0;
    border-left: 170px solid transparent;
    border-right: 170px solid transparent;
    border-top: 120px solid rgba(197,160,89,0.35);
    pointer-events: none;
}
/* Estado ABIERTO del flap */
.env-flap.open {
    transform: rotateX(-175deg);
}

/* ── Carta que emerge ───────────────────────────────────── */
.env-letter {
    position: absolute;
    bottom: 10px;
    left: 20px; right: 20px;
    height: 85%;
    background: linear-gradient(160deg, #fffdf8 0%, #fdf6ec 100%);
    border-radius: 4px;
    z-index: 5;
    transform: translateY(0);
    transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 1.1s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(197,160,89,0.4);
}
/* Estado EMERGIDO de la carta */
.env-letter.emerge {
    transform: translateY(-135px);
    box-shadow: 0 20px 60px rgba(114,28,36,0.35), 0 4px 16px rgba(0,0,0,0.15);
}

.env-letter-inner {
    text-align: center;
    padding: 10px 16px;
}
.env-letter-script {
    font-family: 'Great Vibes', cursive;
    font-size: 1.9rem;
    color: var(--rojo-intenso);
    margin: 0; line-height: 1.15;
}
.env-letter-amp {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--gold);
    font-style: italic;
    margin: 2px 0;
}
.env-letter-sub {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--texto-suave);
    margin: 6px 0 0;
}
.env-letter-deco {
    font-size: 0.6rem;
    color: var(--gold);
    letter-spacing: 6px;
    margin-bottom: 4px;
}

/* Texto de ayuda debajo del sobre */
.env-hint {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--texto-suave);
    opacity: 0.75;
    animation: hintPulse 1.8s ease-in-out infinite;
    margin: 0;
}
@keyframes hintPulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 0.9; }
}

/* Responsive – sobre más pequeño en móviles */
@media (max-width: 400px) {
    .env-envelope { width: 280px; height: 190px; }
    .env-flap-back {
        border-left-width: 140px; border-right-width: 140px; border-top-width: 100px;
    }
    .env-flap {
        border-left-width: 140px; border-right-width: 140px; border-top-width: 100px;
    }
    .env-flap::after {
        top: -100px; left: -140px;
        border-left-width: 140px; border-right-width: 140px; border-top-width: 100px;
    }
    .env-tri-left { border-left-width: 140px; border-top-width: 95px; }
    .env-tri-right { border-right-width: 140px; border-top-width: 95px; }
    .env-tri-bottom { border-left-width: 140px; border-right-width: 140px; border-bottom-width: 90px; }
    .env-letter.emerge { transform: translateY(-105px); }
    .env-letter-script { font-size: 1.5rem; }
}
