/* ==========================================================================
   VIVIR ADELANTADO — móvil-first · claro/oscuro · jerarquía editorial real
   ========================================================================== */
:root {
    --accent-old-gold: #BD9667;
    --font-body: 'Merriweather', serif;
    --font-controls: 'Inter', sans-serif;
    --bg: #050a12;
    --text: #FFFFFF;
    --text-soft: rgba(255,255,255,0.78);
    --card-a: rgba(189,150,103,0.20);
    --card-b: rgba(189,150,103,0.06);
    --input-bg: rgba(255,255,255,0.02);
    --input-border: rgba(255,255,255,0.3);
    --shadow: rgba(0,0,0,0.4);
    --divisor: rgba(189,150,103,0.25);
}
html.tema-claro {
    --bg: #F5F1E8;
    --text: #1a1a1a;
    --text-soft: rgba(0,0,0,0.65);
    --card-a: rgba(189,150,103,0.28);
    --card-b: rgba(189,150,103,0.10);
    --input-bg: rgba(0,0,0,0.02);
    --input-border: rgba(0,0,0,0.25);
    --shadow: rgba(0,0,0,0.15);
    --divisor: rgba(138,109,66,0.35);
}
html.tema-claro h1, html.tema-claro h2, html.tema-claro h3,
html.tema-claro .libro-titulo,
html.tema-claro .anclaje-titulo { color: #8a6d42; }
/* El subtítulo del libro mantiene #0C8283 en ambos temas */

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.85;
    margin: 0;
    padding: 1.5rem 1.2rem 7rem;
    font-size: 1.06rem;
    -webkit-text-size-adjust: 100%;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ---- TÍTULO DEL LIBRO (estilo "Título" de Word) ---- */
.libro-titulo {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--accent-old-gold);
    text-align: center;
    line-height: 1.15;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 1rem 0 1rem;
}

/* ---- SUBTÍTULO / AUTOR / SECCIÓN (estilo "Subtítulo") ---- */
.libro-subtitulo {
    font-size: 1.3rem;
    color: #0C8283 !important;
    text-align: center;
    font-style: italic;
    font-weight: 300;
    margin: 0 0 2rem;
}

/* ---- CAPÍTULOS (h1 y h2) ---- */
#visor-lectura h1 {
    font-size: 2.1rem;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--divisor);
    color: var(--accent-old-gold);
    line-height: 1.3;
}
#visor-lectura h2 {
    font-size: 1.7rem;
    margin-top: 3rem;
    margin-bottom: 1.3rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--divisor);
    color: var(--accent-old-gold);
    line-height: 1.3;
}
#visor-lectura h3 {
    font-size: 1.3rem;
    margin-top: 2rem;
    color: var(--accent-old-gold);
}

.anclaje-titulo { color: var(--accent-old-gold); font-family: var(--font-body); font-weight: 700; }

.contenedor-lectura { max-width: 720px; margin: 0 auto; }

/* Cuerpo */
.parrafo-bloque, #visor-lectura p, #visor-lectura li {
    color: var(--text);
    opacity: 1;
    margin-bottom: 1.4rem;
    transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.3s ease, color 0.4s ease;
}
/* El título y subtítulo del libro no llevan margen de párrafo normal */
.libro-titulo.parrafo-bloque, .libro-subtitulo.parrafo-bloque { margin-bottom: 0.8rem; }

/* Párrafo narrado — tarjeta de foco premium */
#visor-lectura p.activo:not(.libro-titulo):not(.libro-subtitulo),
#visor-lectura li.activo,
#visor-lectura h1.activo,
#visor-lectura h2.activo,
#visor-lectura h3.activo,
.parrafo-bloque.activo:not(.libro-titulo):not(.libro-subtitulo) {
    color: var(--text);
    background: linear-gradient(90deg, var(--card-a), var(--card-b));
    border-left: 3px solid var(--accent-old-gold);
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: 0 4px 18px var(--shadow);
}

/* ---- BOTÓN DE TEMA ---- */
#btn-tema {
    position: fixed; top: 14px; right: 14px; z-index: 9999;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--accent-old-gold);
    background: var(--bg); color: var(--text);
    font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px var(--shadow); transition: transform 0.2s ease;
}
#btn-tema:active { transform: scale(0.92); }

/* ---- BOTÓN FLOTANTE ESCUCHAR ---- */
#btn-escoltar {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 9998;
    background-color: var(--accent-old-gold); color: #050a12; border: none;
    padding: 16px 34px; border-radius: 50px;
    font-family: var(--font-controls); font-size: 1.02rem; font-weight: 700; letter-spacing: 0.5px;
    cursor: pointer; box-shadow: 0 6px 22px var(--shadow); transition: transform 0.2s ease;
    white-space: nowrap; text-transform: none;
}
#btn-escoltar:hover { transform: translateX(-50%) translateY(-2px); }
#btn-escoltar:active { transform: translateX(-50%) translateY(1px); }
#btn-escoltar:disabled { opacity: 0.6; cursor: wait; }

header { padding: 1.5rem 0 !important; text-align: center; }

.btn-accion {
    font-family: var(--font-controls); background-color: transparent;
    border: 1px solid var(--accent-old-gold); color: var(--accent-old-gold);
    padding: 15px 24px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    font-weight: 600; border-radius: 8px; transition: all 0.3s ease;
}
.btn-accion:hover { background-color: var(--accent-old-gold); color: #050a12; }
.btn-accion:disabled { cursor: not-allowed; border-color: var(--text-soft); color: var(--text-soft); }

textarea {
    width: 100%; background: var(--input-bg); border: 1px solid var(--input-border);
    color: var(--text); font-family: var(--font-controls); padding: 1.5rem; resize: vertical;
    border-radius: 6px; transition: background 0.4s ease, color 0.4s ease, border-color 0.2s ease;
}
textarea:focus { outline: none; border-color: var(--accent-old-gold) !important; box-shadow: 0 0 8px rgba(189,150,103,0.3); }

.neo-modal-overlay {
    position: fixed; inset: 0; background: rgba(5,10,18,0.85); backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center; z-index: 1000; padding: 1rem;
}

/* ================= RESPONSIVE MÓVIL ================= */
@media (max-width: 600px) {
    body { padding: 1rem 1rem 7rem; font-size: 1.12rem; line-height: 1.82; }
    .contenedor-lectura { padding: 0; max-width: 100%; }
    .libro-titulo { font-size: 1.9rem; margin: 0.5rem 0 0.8rem; }
    .libro-subtitulo { font-size: 1.1rem; margin-bottom: 1.8rem; }
    #visor-lectura h1 { font-size: 1.6rem; margin-top: 2.8rem; }
    #visor-lectura h2 { font-size: 1.4rem; margin-top: 2.6rem; }
    #visor-lectura h3 { font-size: 1.15rem; }
    #visor-lectura p, #visor-lectura li, .parrafo-bloque { margin-bottom: 1.3rem; }
    #visor-lectura p.activo:not(.libro-titulo):not(.libro-subtitulo), .parrafo-bloque.activo:not(.libro-titulo):not(.libro-subtitulo) {
        padding: 12px 14px; border-left-width: 4px;
    }
    #btn-escoltar { bottom: 18px; padding: 15px 30px; font-size: 1rem; max-width: 90%; }
    #btn-tema { top: 12px; right: 12px; width: 42px; height: 42px; }
    #dashboard-compromiso { padding-top: 2rem !important; }
    textarea { font-size: 1rem !important; }
}