/* --- 1. VARIABLES Y CONFIGURACIÓN BASE --- */
:root {
    --primary: #2c3e50;
    --secondary: #e74cc;
    --bg-app: #f0f2f5;
    --page-bg: #ffffff;
    --text: #333333;
    --shadow: rgba(0,0,0,0.2);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-app);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* --- 2. ESCENARIO 3D (EL LIBRO) --- */
.scene {
    width: 90vw;
    max-width: 400px;
    height: 80vh;
    max-height: 600px; 
    perspective: 1500px;
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.page {
    position: absolute; /* Vital para apilar páginas */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--page-bg);
    border-radius: 10px 2px 2px 10px;
    box-shadow: -2px 2px 15px var(--shadow);
    transform-origin: left center; 
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    cursor: pointer; /* Manita al pasar el mouse */
    backface-visibility: hidden; 
}

.page.flipped {
    transform: rotateY(-120deg);
}

/* --- 3. CONTENIDO INTERNO --- */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* ESTO ES CLAVE: permite que el clic "atraviese" el texto y active la página */
    pointer-events: none; 
}

.logo-img {
    max-width: 300px;
    max-height: 150px;
    width: auto;
    height: auto;
    margin-bottom: 20px;
}

h1, h2 { color: var(--primary); margin: 0 0 10px 0; }
p { color: var(--text); line-height: 1.5; font-size: 1rem; padding: 0 5px; }
.subtitle { color: var(--secondary); font-weight: bold; }

/* --- 4. ANIMACIÓN SVG --- */
.draw-svg {
    margin: 20px 0;
    display: block;
}

.draw-svg path,
.draw-svg circle,
.draw-svg rect,
.draw-svg line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 10s ease-in-out;
}

.draw-svg.start-drawing path,
.draw-svg.start-drawing circle,
.draw-svg.start-drawing rect,
.draw-svg.start-drawing line {
    stroke-dashoffset: 0;
}

/* --- 5. TEXTO FLOTANTE "SIGUIENTE" --- */
.tap-hint {
    margin-top: auto; /* Empuja al fondo */
    font-size: 0.9rem;
    color: #999;
    padding-top: 20px;
    animation: bounce 2s infinite;
}

.reset-btn {
    pointer-events: auto; /* El botón de reinicio SÍ debe recibir clics */
    margin-top: 20px;
    padding: 10px 20px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

/* --- 6. BOTÓN WHATSAPP --- */
.whatsapp-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: transform 0.2s;
}

.whatsapp-btn:active { transform: scale(0.95); }

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}