/* Botón Detener del bloque visible de audio: oculto hasta que se reproduce */
#btnDetenerHistoria[hidden] {
    display: none !important;
}

/* ============================================================
   Accesibilidad: tamaño de texto y lectura en voz alta
   ============================================================ */

html[data-letra="grande"] {
    font-size: 112.5%;
}

html[data-letra="muy-grande"] {
    font-size: 125%;
}

.a11y-widget {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 70;
    font-family: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #334155;
}

.a11y-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #cde6d9;
    border-radius: 9999px;
    background: #ffffff;
    color: #386252;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.35);
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.a11y-toggle:hover {
    background: #f4faf6;
}

.a11y-toggle-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    border-radius: 9999px;
    background: #fce3d0;
    color: #b2480c;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.a11y-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    width: min(300px, calc(100vw - 24px));
    padding: 14px;
    border: 1px solid #cde6d9;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 50px -20px rgba(15, 23, 42, 0.4);
}

.a11y-titulo {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.a11y-acciones {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.a11y-boton {
    flex: 1;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid #cde6d9;
    border-radius: 12px;
    background: #f4faf6;
    color: #386252;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.a11y-boton:hover {
    background: #e6f3ec;
}

.a11y-boton[aria-pressed="true"] {
    border-color: #e96a1b;
    background: #e96a1b;
    color: #ffffff;
}

.a11y-boton-secundario {
    background: #ffffff;
    color: #b2480c;
}

.a11y-boton-secundario:hover {
    background: #fef3eb;
}

.a11y-boton:disabled {
    border-color: #e2e8f0;
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.a11y-estado {
    margin: 8px 0 0;
    min-height: 18px;
    color: #437a62;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.a11y-nota {
    margin: 12px 0 0;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.45;
}

.a11y-toggle:focus-visible,
.a11y-boton:focus-visible {
    outline: 3px solid #e96a1b;
    outline-offset: 2px;
}

/* Modo oscuro del sitio */
body.dark-mode-active .a11y-toggle,
body.dark-mode-active .a11y-panel {
    border-color: #334155;
    background: #1e293b;
    color: #cbd5e1;
}

body.dark-mode-active .a11y-toggle:hover {
    background: #0f172a;
}

body.dark-mode-active .a11y-boton {
    border-color: #334155;
    background: #0f172a;
    color: #cbd5e1;
}

body.dark-mode-active .a11y-boton:hover {
    background: #1e293b;
}

body.dark-mode-active .a11y-boton[aria-pressed="true"] {
    border-color: #e96a1b;
    background: #e96a1b;
    color: #ffffff;
}

body.dark-mode-active .a11y-titulo,
body.dark-mode-active .a11y-nota {
    color: #94a3b8;
}

body.dark-mode-active .a11y-estado {
    color: #a6d0ba;
}

@media (max-width: 640px) {
    .a11y-toggle {
        padding: 0 12px;
    }

    .a11y-toggle-texto {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .a11y-toggle,
    .a11y-boton {
        transition: none;
    }
}
