/*
 * mobile.css — SOLO móvil (se carga con media="(max-width: 768px)" desde index.html).
 * Mantiene el tema de style.css (monospace, fondo #212121, acento #91ff00)
 * y sobrescribe únicamente lo necesario para que sea cómodo con el pulgar.
 * Escritorio no se ve afectado.
 */

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
    padding: 0 14px calc(90px + env(safe-area-inset-bottom, 0px)) 14px;
    font-size: 16px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-tap-highlight-color: rgba(145, 255, 0, 0.15);
}

h1 { font-size: 1.4rem; margin: 14px 0 8px; }

/* ---------- Buscador fijo arriba ---------- */
#toc {
    position: sticky;
    top: 0;
    z-index: 100;
    margin: 0 -14px 6px;
    padding: 10px 14px;
    background: #212121;
    border-bottom: 1px solid #333;
}
#toc h2 { display: none; }              /* "Índice" ya no aporta nada */

.controls {
    gap: 8px;
    align-items: stretch;
}

/* 16px evita el zoom automático de iOS al enfocar el input */
input[type="search"], select {
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
}
input[type="search"] {
    width: 100%;
    flex: 1 1 100%;
}

/* Categoría + favoritos en una misma fila */
.category-filter {
    flex: 1 1 0;
    flex-direction: row;
    width: auto;
    min-width: 0;
}
.category-filter > span { display: none; }  /* el select ya dice "Todas las categorías" */
.category-filter select { width: 100%; }

.favorites-filter {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 4px;
    font-size: 15px;
}
.favorites-filter input {
    width: 22px;
    height: 22px;
}

/* ---------- Secciones ---------- */
.block { margin-bottom: 6px; }

#sections h2 {
    font-size: 1.1rem;
    margin: 22px 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #91ff00;
}

ul { padding: 0; margin: 0; }

/* Cada fila es un objetivo táctil de ≥48px */
li {
    position: relative;
    margin: 0;
    padding: 13px 4px;
    min-height: 48px;
    box-sizing: border-box;
    border-bottom: 1px solid #2e2e2e;
}
li:last-child { border-bottom: 0; }

/* Toda la fila del enlace es pulsable (no sólo el "[>]") */
li > a::after {
    content: "";
    position: absolute;
    inset: 0;
}
li:has(> a:active) { background: #2a2a2a; }

/* Elementos copiables y resultados: bloque completo bajo la descripción */
li > .fn-result[style*="cursor"],
li > .fn-result {
    display: inline-block;
    padding: 4px 0;
}
li:has(> .fn-result[style*="pointer"]) { padding-top: 10px; padding-bottom: 10px; }
li > .fn-result[style*="pointer"] {
    display: block;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px dashed #91ff00;
    border-radius: 4px;
    text-align: center;
}

/* Tags: que envuelvan sin pegarse */
.tag {
    display: inline-block;
    margin: 4px 6px 0 0;
    line-height: 1.3;
}
li > .desc ~ .tag:first-of-type { margin-left: 8px; }

.star { font-size: 1.3rem; margin-right: .4rem; }

/* Citas */
.quote { display: block; margin-bottom: 4px; }
.quote-author { display: block; padding-left: 13px; }

/* ---------- Botón subir ---------- */
#scrollTopBtn {
    left: auto;
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: none;
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 16px;
    border: 1px solid #91ff00;
    z-index: 200;
}
/* En táctil, :hover se queda "pegado": usar sólo :active */
@media (hover: none) {
    #scrollTopBtn:hover { color: yellowgreen; background: #333; }
    #scrollTopBtn:active { color: #333; background: yellowgreen; }
}

/* ---------- Toasts (logros / copiado) ---------- */
.nx-toast-container {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    align-items: stretch;
}
.nx-toast {
    max-width: none;
    padding: 12px 14px;
}
.nx-toast-title,
.nx-toast-message { font-size: 14px; }

/* ---------- Modal (logros) ---------- */
.nx-modal-box {
    width: calc(100% - 24px);
    max-width: none;
    max-height: 85vh;
    box-sizing: border-box;
    padding: 14px;
}
.nx-modal-close {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 15px;
}