:root {
    --primary-red: #D42426;
    --dark-green: #165B33;
    --gold: #C5A059;
    --bg-white: #ffffff;
    --text-dark: #333333;
    --text-grey: #666666;
}

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

/* 1. LAYOUT PRINCIPAL (Split Screen) */
body {
    font-family: 'Lato', sans-serif;
    /* Imagen del árbol de fondo */
    background: url('../img/fondo.jpg') no-repeat center center fixed;
    background-size: cover;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.split-layout {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Columna Izquierda (Transparente) */
.left-pane {
    flex: 1;
    background: transparent;
}

/* --- CORRECCIÓN DE SCROLL Y CENTRADO --- */

.right-pane {
    flex: 1;
    position: relative;
    display: flex;
    
    /* Quitamos el centrado rígido que corta el contenido */
    /* justify-content: center; <--- ELIMINAR O COMENTAR */
    /* align-items: center;     <--- ELIMINAR O COMENTAR */

    
    /* CAMBIO CLAVE: Permitir scroll vertical */
    overflow-y: auto; 
    height: 100vh;
}

.content-wrapper {
    width: 90%;
    max-width: 450px;
    position: relative;
    z-index: 10;
    
    /* CAMBIO CLAVE: "margin: auto" centra vertical y horizontalmente 
       dentro de un flex container, pero permite scroll si no cabe. */
    margin: auto; 
    
    /* Añadimos aire arriba y abajo para que la tarjeta nunca toque los bordes */
    padding: 40px 0; 
}

/* --- ESTILOS DE NIEVE (JS) --- */
.snowflake {
    position: absolute;
    top: -10px;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 5px rgba(255,255,255,0.8);
    animation-name: fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes fall {
    0% { transform: translateY(-10vh) translateX(0); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(110vh) translateX(20px); opacity: 0.4; }
}

/* --- ESTILOS COMUNES DE LAS TARJETAS --- */
.card-box {
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    overflow: hidden; /* Esto es clave para el header rojo */
    transition: transform 0.5s ease;
    border: 1px solid rgba(255,255,255,0.4);
}

.hidden { display: none; }

/* --- FORMULARIO (CREADOR) --- */
.card-header {
    background: var(--primary-red);
    color: white;
    padding: 1.5rem;
    text-align: center;
    border-bottom: 5px solid var(--gold);
}

.card-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-top: 10px;
}

.gold-icon { color: var(--gold); font-size: 1.5rem; }

.card-body { padding: 2rem; }
.form-group { margin-bottom: 1.2rem; }

label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-dark);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input, textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    transition: 0.3s;
}

input:focus, textarea:focus { border-color: var(--primary-red); outline: none; }
textarea { height: 100px; resize: none; }

.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--dark-green);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 5px 15px rgba(22, 91, 51, 0.3);
}
.btn-primary:hover { background: #0f4626; transform: translateY(-2px); }


/* --- TARJETA FINAL (EL FIX ESTÁ AQUÍ) --- */
.result-card {
    text-align: center;
    padding: 3rem 2rem;
    background: white; /* Aseguramos fondo blanco puro */
    position: relative;
    border: 8px solid white; /* Borde visual */
}

/* Lazo decorativo */
.ribbon-corner {
    position: absolute;
    top: -10px; right: -10px;
    width: 100px; height: 100px;
    background: linear-gradient(135deg, transparent 50%, var(--primary-red) 50%);
    z-index: 5;
    border-radius: 0 0 0 20px;
}

/* FIX IMAGEN GIGANTE: Controlamos el tamaño de cualquier imagen en el header */
.visual-header img {
    width: 120px;       /* Tamaño fijo controlado */
    height: 120px;      /* Cuadrado */
    object-fit: contain; /* Que no se deforme */
    margin-bottom: 1rem;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.1));
}

.to-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}
.to-text span { color: var(--primary-red); }

/* Caja del mensaje bonita */
.message-box {
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-grey);
    font-size: 1.1rem;
    line-height: 1.6;
    background: #fdfdfd;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--gold);
    text-align: left; /* Para que se lea mejor */
    max-height: 200px;
    overflow-y: auto;
}

.separator {
    color: #ddd;
    margin: 20px 0;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
}
.separator::before, .separator::after {
    content: ''; width: 30px; height: 1px; background: #ddd;
}

.from-text { font-size: 0.9rem; color: var(--text-grey); }
.from-text strong {
    color: var(--dark-green); font-size: 1.3rem;
    font-family: 'Playfair Display', serif;
    display: block;
    margin-top: 5px;
}

/* --- FIX PANEL COMPARTIR --- */
#share-panel {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed #eee;
}

.copy-row {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    background: #f5f5f5;
    padding: 5px;
    border-radius: 8px;
}

#share-url {
    background: transparent;
    border: none;
    font-size: 0.9rem;
    color: #555;
    padding: 8px;
    width: 100%;
    outline: none;
}

#btn-copy {
    background: var(--gold);
    color: white;
    border: none;
    width: 45px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}
#btn-copy:hover { background: #b08d48; }

.text-link {
    background: none;
    border: none;
    color: var(--text-grey);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .split-layout { flex-direction: column; }
    .left-pane { display: none; } 
    .right-pane { background: rgba(0,0,0,0.5); }
}

/* ... (Todo tu CSS anterior sigue igual) ... */

/* --- PANTALLA DE APERTURA (Overlay) --- */
#intro-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(212, 36, 38, 0.98); /* Un poco más sólido para que no se trasluzca nada */
    z-index: 100; /* Aseguramos que esté MUY por encima */
    
    /* Configuración Flex para centrar */
    display: flex; 
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    backdrop-filter: blur(5px);
}

.intro-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 10px;
}

.intro-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.intro-icon {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#btn-open-card {
    background: var(--gold);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

#btn-open-card:hover {
    transform: scale(1.05);
    background: #b08d48;
}

/* --- BOTÓN DE MUTE EN LA TARJETA --- */
.music-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: transparent;
    border: none;
    color: var(--primary-red);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 6;
    opacity: 0.7;
    transition: 0.3s;
}
.music-btn:hover { opacity: 1; transform: scale(1.1); }