/* ===== RESET TOTAL ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== ESTILOS BASE ===== */
body {
    font-family: 'Poppins', Arial, sans-serif;
    background: #f9d5e5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ===== TARJETA PRINCIPAL ===== */
.tarjeta {
    max-width: 950px;
    width: 100%;
    background: white;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(255, 77, 109, 0.2);
    padding: 40px;
    position: relative;
    z-index: 10;
    margin: 0 auto;
}

/* ===== CABECERA ===== */
.cabecera {
    text-align: center;
    margin-bottom: 40px;
}

.titulo {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5rem;
    color: #590d22;
    margin-bottom: 10px;
}

.resaltado {
    color: #ff4d6d;
    font-weight: bold;
}

.subtitulo {
    font-size: 1.5rem;
    color: #ff4d6d;
    font-weight: 300;
}

.corazon {
    display: inline-block;
    animation: latido 1.5s infinite;
}

/* ===== CONTADOR ===== */
.contador-principal {
    background: #fff0f3;
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 40px;
    border: 2px dashed #ff8fa3;
}

.contador-titulo {
    color: #590d22;
    font-size: 1.8rem;
    margin-bottom: 30px;
}

.contador-cajas {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.caja {
    background: white;
    border-radius: 12px;
    padding: 15px 10px;
    width: 110px;
    margin: 0 5px 10px 5px;
    border: 2px solid #ff8fa3;
    text-align: center;
}

.caja-especial {
    background: #ff4d6d;
    border: none;
}

.caja-especial .numero,
.caja-especial .etiqueta {
    color: white;
}

.numero {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff4d6d;
    display: block;
    line-height: 1;
}

.etiqueta {
    display: block;
    margin-top: 8px;
    color: #590d22;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.fecha-inicio {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #590d22;
    font-family: 'Dancing Script', cursive;
}

.mensaje-estado {
    margin-top: 15px;
    padding: 10px 25px;
    background: rgba(255, 77, 109, 0.1);
    color: #ff4d6d;
    border-radius: 50px;
    display: inline-block;
    font-weight: 500;
}

/* ===== MENSAJE DE AMOR ===== */
.mensaje-amor {
    background: #fff5f7;
    border-radius: 20px;
    padding: 40px;
    position: relative;
    border: 3px solid #ff4d6d;
    margin-bottom: 40px;
    display: none;
}

.mensaje-amor.mostrar {
    display: block;
}

.fondo-corazon {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 6rem;
    color: rgba(255, 77, 109, 0.08);
    z-index: 1;
}

.amor-titulo {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    color: #590d22;
    text-align: center;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.fecha-especial {
    color: #ff4d6d;
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 30px;
    font-family: 'Dancing Script', cursive;
    border-bottom: 2px solid #ff4d6d;
    padding-bottom: 10px;
    display: inline-block;
    position: relative;
    z-index: 2;
}

.texto-amor {
    position: relative;
    z-index: 2;
}

.texto-amor p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    color: #444;
    text-align: justify;
}

/* ===== FIRMA ===== */
.firma {
    text-align: right;
    margin-top: 30px;
    position: relative;
    z-index: 2;
}

.firma p {
    font-size: 1.2rem;
    color: #590d22;
    font-style: italic;
}

.firma-nombre {
    color: #ff4d6d;
    font-size: 1.6rem;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

.firma-fecha {
    font-size: 1rem;
    color: #666;
    display: block;
    margin-top: 5px;
}

/* ===== CÓDIGO CSS ===== */
.codigo-caja {
    background: #1e1e1e;
    border-radius: 12px;
    margin-top: 40px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.codigo-cabecera {
    background: #2d2d2d;
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

.punto {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.rojo { background: #ff5f56; }
.amarillo { background: #ffbd2e; }
.verde { background: #27ca3f; }

.codigo-titulo {
    color: #aaa;
    margin-left: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.codigo-caja pre {
    padding: 20px;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.codigo-caja code {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #f8f8f2;
    line-height: 1.6;
    display: block;
}

.codigo-comentario {
    color: #7c7c7c;
    font-style: italic;
    padding: 12px 20px;
    background: #252525;
    margin: 0;
    border-top: 1px solid #333;
}

/* ===== HISTORIA ===== */
.historia-caja {
    margin-top: 40px;
    padding: 25px;
    background: rgba(255, 77, 109, 0.05);
    border-radius: 15px;
    border-left: 5px solid #ff4d6d;
    position: relative;
    z-index: 2;
}

.historia-caja h4 {
    color: #590d22;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.historia-item {
    display: flex;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 77, 109, 0.2);
}

.historia-item:last-child {
    border-bottom: none;
}

.historia-fecha {
    font-weight: bold;
    color: #ff4d6d;
    min-width: 130px;
}

.historia-texto {
    color: #555;
    margin-left: 20px;
}

/* ===== PIE DE PÁGINA ===== */
.pie {
    text-align: center;
    padding-top: 25px;
    border-top: 2px solid #ffe6eb;
    color: #666;
}

.pie-fecha {
    color: #ff4d6d;
    margin-top: 5px;
}

.fa-heart {
    color: #ff4d6d;
    animation: latido 1.5s infinite;
}

/* ===== REPRODUCTOR DE MÚSICA ===== */
.reproductor {
    margin-top: 25px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 60px;
    display: inline-block;
    border: 1px solid #ffccd5;
}

.boton-musica {
    background: #ff4d6d;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.boton-musica:hover {
    background: #590d22;
}

.info-cancion {
    color: #590d22;
    margin-left: 15px;
    font-size: 0.95rem;
}

.credito {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

/* ===== CONTROLES DE VISTA PREVIA ===== */
.controles-preview {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(255,77,109,0.3);
    border: 2px solid #ff4d6d;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-preview {
    background: #ff4d6d;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ocultar {
    background: #590d22;
}

.badge-preview {
    color: #590d22;
    font-weight: 500;
    padding-left: 10px;
    border-left: 2px solid #ffccd5;
}

/* ===== CORAZONES FLOTANTES ===== */
.corazones {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.corazon-float {
    position: absolute;
    bottom: 0;
    color: #ff4d6d;
    font-size: 1.2rem;
    opacity: 0.6;
    animation: flotar 12s linear infinite;
}

/* ===== ANIMACIONES ===== */
@keyframes latido {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes flotar {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    .tarjeta { padding: 25px; }
    .titulo { font-size: 2.8rem; }
    .subtitulo { font-size: 1.3rem; }
    .caja { width: 90px; }
    .numero { font-size: 2rem; }
    .mensaje-amor { padding: 25px; }
    .amor-titulo { font-size: 2rem; }
    .texto-amor p { font-size: 1rem; }
    .historia-item { flex-direction: column; }
    .historia-texto { margin-left: 0; margin-top: 5px; }
    .controles-preview { 
        flex-direction: column; 
        width: 90%;
        left: 5%;
    }
}

@media screen and (max-width: 480px) {
    .titulo { font-size: 2.2rem; }
    .contador-titulo { font-size: 1.5rem; }
    .caja { width: calc(50% - 20px); }
    .reproductor { display: block; }
    .boton-musica { width: 100%; justify-content: center; }
    .info-cancion { display: block; margin-left: 0; margin-top: 10px; }
}

/* ===== FIX ESPECÍFICO PARA EDGE ===== */
@supports (-ms-ime-align: auto) {
    .caja {
        width: 100px;
        margin: 0 3px 10px 3px;
    }
    
    .reproductor {
        display: block;
        text-align: center;
    }
    
    .boton-musica {
        margin-bottom: 10px;
    }
    
    .info-cancion {
        display: block;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .controles-preview {
        display: block;
        text-align: center;
    }
    
    .btn-preview {
        display: inline-block;
        margin: 5px;
    }
    
    .badge-preview {
        display: block;
        margin-top: 10px;
        padding-left: 0;
        border-left: none;
        border-top: 2px solid #ffccd5;
        padding-top: 10px;
    }
}