/* ==========================================================================
   Biblia Adentro · App Web (PWA) · Fase 1
   --------------------------------------------------------------------------
   Capa de presentación móvil. TODAS las reglas cuelgan de html.app-mode,
   que el arranque (app-bootstrap) agrega sólo en teléfono, en la app
   instalada o cuando se fuerza con ?ba_app=1. El escritorio no cambia.

   Bloques:
     1. Tokens y base del shell
     2. Ocultamiento del chrome del sitio
     3. Barra superior y barra de pestañas
     4. Avisos (sin conexión, actualización, instalación)
     5. Hojas inferiores y ajustes
     6. Aviso flotante (toast)
     7. Ajustes puntuales de páginas existentes
     8. Accesibilidad, movimiento reducido e impresión
   ========================================================================== */

/* ------------------------------ 1. Tokens -------------------------------- */
html.app-mode {
    --ba-appbar: 56px;
    --ba-tabbar: 64px;
    --ba-bg: #f7f3ec;
    --ba-surface: #ffffff;
    --ba-surface-2: #f1ebe0;
    --ba-text: #2c2c2c;
    --ba-muted: #6b7280;
    --ba-line: #e6ddcf;
    --ba-accent: #c26a3d;
    --ba-accent-ink: #a8562e;
    --ba-accent-soft: #f6e6da;
    --ba-azul: #1f3a5f;
    --ba-ok: #1e6b2a;
    --ba-danger: #b23b32;
    --ba-radio: 0 0 0 1px rgba(44, 44, 44, .06), 0 8px 24px rgba(44, 44, 44, .10);
    --ba-safe-top: env(safe-area-inset-top, 0px);
    --ba-safe-bottom: env(safe-area-inset-bottom, 0px);
    --ba-appbar-total: calc(var(--ba-appbar) + var(--ba-safe-top));
    --ba-tabbar-total: calc(var(--ba-tabbar) + var(--ba-safe-bottom));
    -webkit-text-size-adjust: 100%;
}

html.app-mode[data-ba-theme="dark"] {
    --ba-bg: #101419;
    --ba-surface: #181e26;
    --ba-surface-2: #1e252e;
    --ba-text: #ece7de;
    --ba-muted: #9aa4b2;
    --ba-line: #2b3340;
    --ba-accent: #e0885a;
    --ba-accent-ink: #f0a274;
    --ba-accent-soft: #2c2119;
    --ba-azul: #9db6d6;
    --ba-ok: #7fc98b;
    --ba-danger: #f0a29a;
    --ba-radio: 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
    html.app-mode[data-ba-theme="system"] {
        --ba-bg: #101419;
        --ba-surface: #181e26;
        --ba-surface-2: #1e252e;
        --ba-text: #ece7de;
        --ba-muted: #9aa4b2;
        --ba-line: #2b3340;
        --ba-accent: #e0885a;
        --ba-accent-ink: #f0a274;
        --ba-accent-soft: #2c2119;
        --ba-azul: #9db6d6;
        --ba-ok: #7fc98b;
        --ba-danger: #f0a29a;
        --ba-radio: 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .45);
    }
}

html.app-mode body {
    padding-top: var(--ba-appbar-total) !important;
    padding-bottom: var(--ba-tabbar-total) !important;
    background-color: var(--ba-bg);
}

html.app-mode.ba-locked,
html.app-mode.ba-locked body {
    overflow: hidden !important;
}

/* ------------------------------ 2. Ocultar chrome del sitio -------------- */
/* Cuando la página NO está en modo app (escritorio, JS desactivado o el
   usuario eligió "ver el sitio completo"), el marcado del shell se oculta.
   Sin esta regla, el HTML inyectado se vería sin estilos. */
html:not(.app-mode) .ba-appbar,
html:not(.app-mode) .ba-tabbar,
html:not(.app-mode) .ba-install,
html:not(.app-mode) .ba-offline,
html:not(.app-mode) .ba-update,
html:not(.app-mode) .ba-sheet,
html:not(.app-mode) .ba-toast {
    display: none !important;
}

html.app-mode .navbar-top,
html.app-mode .header-static,
html.app-mode .offcanvas,
html.app-mode .offcanvas-backdrop,
html.app-mode .ac-nav,
html.app-mode .ac-sitenote,
html.app-mode footer,
html.app-mode .back-top,
html.app-mode .spinner-container {
    display: none !important;
}

/* El reproductor fijo de la radio sube por encima de la tab bar. */
html.app-mode .radio-bar {
    bottom: var(--ba-tabbar-total) !important;
    z-index: 840 !important;
}

html.app-mode .radio-page-con-barra {
    padding-bottom: calc(var(--ba-tabbar-total) + 90px) !important;
}

/* ------------------------------ 3. Barra superior ------------------------ */
html.app-mode .ba-appbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    height: var(--ba-appbar-total);
    padding: var(--ba-safe-top) 8px 0;
    background: var(--ba-surface);
    background: color-mix(in srgb, var(--ba-surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid transparent;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ba-text);
    transition: border-color .18s ease, box-shadow .18s ease;
}

html.app-mode .ba-appbar.is-scrolled {
    border-bottom-color: var(--ba-line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}

html.app-mode .ba-appbar__left {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

html.app-mode .ba-appbar__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    padding: 4px 6px 4px 2px;
    border-radius: 12px;
}

html.app-mode .ba-appbar__mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 10px;
    background: linear-gradient(150deg, #c26a3d, #a8562e);
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(194, 106, 61, .28);
}

html.app-mode .ba-appbar__name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.app-mode .ba-appbar__title {
    min-width: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 4px;
}

html.app-mode .ba-appbar__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

html.app-mode .ba-iconbtn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: var(--ba-text);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

html.app-mode .ba-iconbtn:active {
    background: var(--ba-surface-2);
}

html.app-mode .ba-ico {
    width: 22px;
    height: 22px;
    display: block;
}

/* ------------------------------ 3b. Barra de pestañas -------------------- */
html.app-mode .ba-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 860;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    box-sizing: border-box;
    height: var(--ba-tabbar-total);
    padding: 6px 4px calc(6px + var(--ba-safe-bottom));
    background: var(--ba-surface);
    background: color-mix(in srgb, var(--ba-surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--ba-line);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.app-mode .ba-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 3px 0 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ba-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 550;
    letter-spacing: .01em;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

html.app-mode .ba-tab .ba-ico {
    width: 24px;
    height: 24px;
}

html.app-mode .ba-tab:active {
    background: var(--ba-surface-2);
}

html.app-mode .ba-tab.is-active {
    color: var(--ba-accent);
}

html.app-mode .ba-tab.is-active .ba-tab__label {
    font-weight: 700;
}

html.app-mode .ba-tab__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------ 4. Avisos -------------------------------- */
html.app-mode .ba-offline,
html.app-mode .ba-update {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 895;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 14px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 550;
    border-bottom: 1px solid transparent;
}

html.app-mode .ba-offline {
    top: var(--ba-appbar-total);
    background: #fdf0d8;
    color: #8a5b12;
    border-bottom-color: #f0dcb2;
}

html.app-mode .ba-update {
    top: var(--ba-appbar-total);
    background: var(--ba-accent-soft);
    color: var(--ba-accent-ink);
    border-bottom-color: var(--ba-line);
}

html.app-mode .ba-offline[hidden],
html.app-mode .ba-update[hidden] {
    display: none !important;
}

html.app-mode .ba-offline .ba-ico,
html.app-mode .ba-update .ba-ico {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

html.app-mode .ba-update button {
    margin-left: auto;
    border: 0;
    border-radius: 999px;
    padding: 6px 12px;
    background: var(--ba-accent);
    color: #fff;
    font: inherit;
    font-size: 11.5px;
    font-weight: 650;
    cursor: pointer;
}

html.app-mode .ba-install {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--ba-tabbar-total) + 10px);
    z-index: 850;
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--ba-surface);
    color: var(--ba-text);
    box-shadow: var(--ba-radio);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.app-mode .ba-install[hidden] {
    display: none !important;
}

html.app-mode .ba-install__ico {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    background: var(--ba-accent-soft);
    color: var(--ba-accent-ink);
}

html.app-mode .ba-install__txt {
    flex: 1 1 auto;
    min-width: 0;
}

html.app-mode .ba-install__txt strong {
    display: block;
    font-size: 12.5px;
    font-weight: 650;
}

html.app-mode .ba-install__txt span {
    display: block;
    font-size: 11px;
    color: var(--ba-muted);
    margin-top: 1px;
}

html.app-mode .ba-install__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ba-muted);
    cursor: pointer;
}

html.app-mode .ba-install__close .ba-ico {
    width: 16px;
    height: 16px;
}

/* ------------------------------ 5. Hojas inferiores ---------------------- */
html.app-mode .ba-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.app-mode .ba-sheet[hidden] {
    display: none !important;
}

html.app-mode .ba-sheet__scrim {
    position: absolute;
    inset: 0;
    background: rgba(8, 11, 15, .55);
    opacity: 0;
    transition: opacity .24s ease;
}

html.app-mode .ba-sheet.is-open .ba-sheet__scrim {
    opacity: 1;
}

html.app-mode .ba-sheet__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 620px;
    max-height: 88vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 6px 18px calc(22px + var(--ba-safe-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--ba-surface);
    color: var(--ba-text);
    box-shadow: 0 -18px 48px rgba(0, 0, 0, .28);
    transform: translateY(102%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}

html.app-mode .ba-sheet.is-open .ba-sheet__panel {
    transform: translateY(0);
}

html.app-mode .ba-sheet__grip {
    display: block;
    width: 38px;
    height: 4px;
    margin: 6px auto 14px;
    border-radius: 99px;
    background: var(--ba-line);
}

html.app-mode .ba-sheet h2 {
    margin: 0 0 4px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ba-text);
}

html.app-mode .ba-sheet__sub {
    margin: 0 0 16px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ba-muted);
}

html.app-mode .ba-sheet__fine {
    margin: 16px 0 0;
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--ba-muted);
}

html.app-mode .ba-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--ba-line);
    margin-bottom: 4px;
}

html.app-mode .ba-field__label {
    font-size: 13px;
    font-weight: 600;
}

html.app-mode .ba-seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 11px;
    background: var(--ba-surface-2);
}

html.app-mode .ba-seg button {
    border: 0;
    border-radius: 8px;
    padding: 6px 10px;
    background: transparent;
    color: var(--ba-muted);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

html.app-mode .ba-seg button.is-on {
    background: var(--ba-surface);
    color: var(--ba-text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}

html.app-mode .ba-seg--wide {
    display: flex;
    width: 100%;
    margin-bottom: 14px;
}

html.app-mode .ba-seg--wide button {
    flex: 1 1 0;
    padding: 8px 10px;
}

html.app-mode .ba-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    min-height: 50px;
    padding: 11px 2px;
    border: 0;
    border-top: 1px solid var(--ba-line);
    background: transparent;
    color: var(--ba-text);
    text-decoration: none;
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

html.app-mode .ba-row:first-of-type {
    border-top: 0;
}

html.app-mode .ba-row:active {
    background: var(--ba-surface-2);
}

html.app-mode .ba-row .ba-ico {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    color: var(--ba-accent-ink);
}

html.app-mode .ba-row > span:first-of-type {
    flex: 1 1 auto;
}

html.app-mode .ba-row__meta {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ba-muted);
}

html.app-mode .ba-steps {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    counter-reset: ba-step;
    display: grid;
    gap: 11px;
}

html.app-mode .ba-steps li {
    counter-increment: ba-step;
    position: relative;
    padding-left: 34px;
    font-size: 12.5px;
    line-height: 1.5;
}

html.app-mode .ba-steps li::before {
    content: counter(ba-step);
    position: absolute;
    left: 0;
    top: -1px;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: var(--ba-accent-soft);
    color: var(--ba-accent-ink);
    font-size: 11px;
    font-weight: 700;
}

html.app-mode .ba-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    box-sizing: border-box;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--ba-surface-2);
    color: var(--ba-text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

html.app-mode .ba-btn--primary {
    background: var(--ba-accent);
    color: #fff;
    box-shadow: 0 10px 22px -12px rgba(194, 106, 61, .9);
}

html.app-mode .ba-btn--sm {
    min-height: 36px;
    padding: 0 13px;
    font-size: 12px;
    border-radius: 10px;
}

html.app-mode .ba-btn--block {
    width: 100%;
    margin-top: 6px;
}

/* ------------------------------ 6. Aviso flotante ------------------------ */
html.app-mode .ba-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--ba-tabbar-total) + 18px);
    z-index: 1200;
    max-width: 82vw;
    padding: 11px 16px;
    border-radius: 12px;
    background: #2c2c2c;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 550;
    line-height: 1.35;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .38);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    pointer-events: none;
    text-align: center;
}

html.app-mode .ba-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* ------------------------------ 7. Ajustes puntuales --------------------- */
/* El contenido mantiene su tema claro: la capa de app oscurece el chrome. */
html.app-mode .ba-appbar a:focus-visible,
html.app-mode .ba-iconbtn:focus-visible,
html.app-mode .ba-tab:focus-visible,
html.app-mode .ba-btn:focus-visible,
html.app-mode .ba-row:focus-visible,
html.app-mode .ba-seg button:focus-visible {
    outline: 2px solid var(--ba-accent);
    outline-offset: 2px;
}

/* En portadas de sección, deja respirar la primera sección. */
html.app-mode body > .container:first-of-type,
html.app-mode body > main:first-of-type {
    padding-top: 4px;
}

/* ------------------------------ 7b. Portada de la app -------------------- */
html.app-mode .ba-inicio {
    max-width: 720px;
    margin: 0 auto;
    padding: 4px 16px 26px;
}

html.app-mode .ba-inicio__fecha {
    margin: 8px 0 0;
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--ba-muted);
}

html.app-mode .ba-inicio__saludo {
    margin: 3px 0 18px;
    font-size: 27px;
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.15;
}

html.app-mode .ba-inicio__bloque { margin-top: 24px; }
html.app-mode .ba-inicio__bloque:first-of-type { margin-top: 8px; }

html.app-mode .ba-inicio__cabecera {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

html.app-mode .ba-inicio__cabecera h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.015em;
}

html.app-mode .ba-inicio__cabecera a {
    font-size: 12px;
    font-weight: 650;
    color: var(--ba-accent-ink);
    text-decoration: none;
}

html.app-mode .ba-inicio__nota {
    margin-top: 18px;
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed var(--ba-line);
    background: var(--ba-surface);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ba-muted);
}

html.app-mode .ba-inicio__nota strong { display: block; margin-bottom: 5px; color: var(--ba-text); }
html.app-mode .ba-inicio__nota p { margin: 0 0 12px; }

html.app-mode .ba-lista {
    border: 1px solid var(--ba-line);
    border-radius: 16px;
    background: var(--ba-surface);
    overflow: hidden;
}

html.app-mode .ba-entrada {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    text-decoration: none;
    color: inherit;
    border-top: 1px solid var(--ba-line);
}

html.app-mode .ba-entrada:first-child { border-top: 0; }
html.app-mode .ba-entrada:active { background: var(--ba-surface-2); }

html.app-mode .ba-entrada__thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, #1f3a5f, #3a5f8a);
    color: rgba(255, 255, 255, .92);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
}

html.app-mode .ba-entrada__thumb--vivo {
    background: #d9534f;
    font-size: 10px;
}

html.app-mode .ba-entrada__texto {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

html.app-mode .ba-entrada__titulo {
    font-size: 13.5px;
    font-weight: 640;
    line-height: 1.35;
}

html.app-mode .ba-entrada__meta {
    font-size: 11.5px;
    color: var(--ba-muted);
}

html.app-mode .ba-destacada {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 18px;
    border-radius: 18px;
    background:
        radial-gradient(120% 130% at 90% 0%, rgba(231, 216, 185, .3), transparent 55%),
        linear-gradient(150deg, var(--ba-card, #1f3a5f), #101a27);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 14px 30px -18px rgba(16, 26, 39, .9);
}

html.app-mode .ba-destacada__pildora {
    align-self: flex-start;
    padding: 4px 9px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .16);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

html.app-mode .ba-destacada__titulo {
    font-size: 21px;
    font-weight: 750;
    letter-spacing: -.02em;
    line-height: 1.2;
}

html.app-mode .ba-destacada__texto {
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .78);
}

html.app-mode .ba-carta {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px;
    border: 1px solid var(--ba-line);
    border-radius: 16px;
    background: var(--ba-surface);
    text-decoration: none;
    color: inherit;
}

html.app-mode .ba-pildora {
    align-self: flex-start;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--ba-accent-soft);
    color: var(--ba-accent-ink);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

html.app-mode .ba-carta__titulo {
    font-size: 14.5px;
    font-weight: 650;
    line-height: 1.35;
}

html.app-mode .ba-carta__meta {
    font-size: 11.5px;
    color: var(--ba-muted);
}

html.app-mode .ba-continuar { margin: 4px 0 6px; }

html.app-mode .ba-continuar__carta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: var(--ba-surface);
    border: 1px solid var(--ba-line);
    box-shadow: var(--ba-radio);
    text-decoration: none;
    color: inherit;
}

html.app-mode .ba-continuar__titulo {
    font-size: 14.5px;
    font-weight: 650;
    line-height: 1.3;
}

html.app-mode .ba-continuar__meta {
    font-size: 11.5px;
    color: var(--ba-muted);
}

html.app-mode .ba-continuar__barra {
    display: block;
    height: 4px;
    margin-top: 4px;
    border-radius: 99px;
    background: var(--ba-surface-2);
    overflow: hidden;
}

html.app-mode .ba-continuar__barra > span {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: var(--ba-accent);
}

html.app-mode .ba-inicio__pie {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--ba-line);
}

html.app-mode .ba-inicio__pie a {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--ba-line);
    background: var(--ba-surface);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ba-muted);
    text-decoration: none;
}

/* ------------------------------ 7c. Lector --------------------------------- */
html.app-mode .ba-readbar {
    position: fixed;
    top: var(--ba-appbar-total);
    left: 0;
    right: 0;
    z-index: 880;
    height: 3px;
    background: var(--ba-surface-2);
}

html.app-mode .ba-readbar > span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--ba-accent);
    transition: width .12s linear;
}

html.app-mode .ba-readerbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--ba-tabbar-total);
    z-index: 870;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    box-sizing: border-box;
    height: 54px;
    padding: 5px 8px;
    background: var(--ba-surface);
    border-top: 1px solid var(--ba-line);
    box-shadow: 0 -6px 20px rgba(31, 43, 58, .06);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html.app-mode .ba-readerbar__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--ba-text);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

html.app-mode .ba-readerbar__btn .ba-ico {
    width: 19px;
    height: 19px;
}

html.app-mode .ba-readerbar__btn:active { background: var(--ba-surface-2); }
html.app-mode .ba-readerbar__btn.is-on { color: var(--ba-accent); background: var(--ba-accent-soft); }

html.app-mode body[data-ba-page="article"] {
    padding-bottom: calc(var(--ba-tabbar-total) + 54px) !important;
}

html.app-mode .ba-lector-texto p,
html.app-mode .ba-lector-texto li,
html.app-mode .ba-lector-texto blockquote,
html.app-mode .ba-lector-texto dd {
    font-size: var(--ba-lector-size, 17.5px) !important;
    line-height: 1.68 !important;
}

html.app-mode .ba-lector-texto h2 { font-size: calc(var(--ba-lector-size, 17.5px) * 1.25) !important; }
html.app-mode .ba-lector-texto h3 { font-size: calc(var(--ba-lector-size, 17.5px) * 1.1) !important; }

/* La capa de lector no se muestra fuera del modo app ni en páginas sin artículo. */
html:not(.app-mode) .ba-readbar,
html:not(.app-mode) .ba-readerbar,
html:not(.app-mode) .ba-inicio {
    display: none !important;
}

/* Ajustes de las páginas nuevas dentro del shell de la app. */
html.app-mode .ia-page { padding-top: 10px; }
html.app-mode .ia-hero h1 { font-size: 27px; }
html.app-mode .ia-page .ia-seg button { min-height: 34px; }

/* ------------------------------ 7.5. Mini reproductor -------------------- */
html:not(.app-mode) .ba-mini { display: none !important; }

.ba-mini {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--ba-tabbar-total) + 8px);
    z-index: 850;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px -14px rgba(16, 26, 39, .55), 0 0 0 1px rgba(44, 44, 44, .05);
}
.ba-mini[hidden] { display: none !important; }
.ba-mini__cover {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 9px;
    object-fit: cover;
    background: #f1ebe0;
}
.ba-mini__txt {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ba-mini__txt strong {
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.25;
    color: #2c2c2c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ba-mini__txt span {
    font-size: 10.5px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ba-mini__btn {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f6e6da;
    color: #a8562e;
    cursor: pointer;
}
.ba-mini__btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ba-mini__btn--cerrar { background: transparent; color: #9aa4b2; }
.ba-mini__icon-pause { display: none; }
.ba-mini.is-playing .ba-mini__icon-play { display: none; }
.ba-mini.is-playing .ba-mini__icon-pause { display: block; }
.ba-mini.is-playing [data-ba-mini-toggle] { background: #c26a3d; color: #fff; }
.ba-mini.is-playing [data-ba-mini-toggle] svg { fill: currentColor; stroke: none; }

html.app-mode.ba-has-audio body {
    padding-bottom: calc(var(--ba-tabbar-total) + 62px) !important;
}
html.app-mode.ba-has-audio body[data-ba-page="article"] {
    padding-bottom: calc(var(--ba-tabbar-total) + 116px) !important;
}

/* ------------------------------ 8. Accesibilidad / impresión ------------- */
@media (prefers-reduced-motion: reduce) {
    html.app-mode .ba-sheet__panel,
    html.app-mode .ba-sheet__scrim,
    html.app-mode .ba-toast,
    html.app-mode .ba-appbar {
        transition-duration: .001ms !important;
    }
}

@media print {
    html.app-mode .ba-appbar,
    html.app-mode .ba-tabbar,
    html.app-mode .ba-offline,
    html.app-mode .ba-update,
    html.app-mode .ba-install,
    html.app-mode .ba-sheet,
    html.app-mode .ba-toast,
    html.app-mode .ba-mini {
        display: none !important;
    }

    html.app-mode body {
        padding: 0 !important;
    }
}
