/* Bindexp Learning
   Lenguaje: el de las apps de Apple. Fondo limpio, barras translúcidas, títulos
   grandes, un solo color de acento (el azul de Bindexp) y las portadas como
   protagonistas. En Apple usa la San Francisco del sistema; en lo demás, Inter. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --serif: 'New York', ui-serif, 'Iowan Old Style', 'Charter', Georgia, serif;

  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --elev: #ffffff;
  --elev-2: #f2f2f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --sep: rgba(60, 60, 67, .13);
  --sep-fuerte: rgba(60, 60, 67, .22);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --tint: #5271ff;
  --tint-text: #3a55e6;
  --tint-suave: rgba(82, 113, 255, .11);
  --lavanda: #9c1df5;
  --rosa: #f982c2;
  --rosa-text: #c01a76;
  --rojo: #e5372c;
  --verde: #28a745;
  --amarillo: #ffcc00;
  --barra: rgba(255, 255, 255, .78);
  --barra-borde: rgba(0, 0, 0, .1);
  --sombra-portada: 0 .5px 1px rgba(0, 0, 0, .12), 0 6px 16px -6px rgba(0, 0, 0, .28), 0 16px 32px -16px rgba(0, 0, 0, .22);
  --sombra-flotante: 0 0 0 .5px rgba(0, 0, 0, .06), 0 12px 40px -8px rgba(0, 0, 0, .22), 0 4px 12px -4px rgba(0, 0, 0, .1);
  --radio: 14px;
  --gutter: 20px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-salida: cubic-bezier(.2, .8, .2, 1);

  /* colores de colección */
  --c-azul: #5271ff;
  --c-lavanda: #9c1df5;
  --c-magenta: #e0479e;
  --c-verde: #2fae68;
  --c-naranja: #f08c1a;
  --c-grafito: #7c7c84;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #111113;
    --elev: #1c1c1e;
    --elev-2: #2c2c2e;
    --text: #f5f5f7;
    --text-2: #98989f;
    --text-3: #5f5f66;
    --sep: rgba(84, 84, 88, .42);
    --sep-fuerte: rgba(84, 84, 88, .7);
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .14);
    --tint: #6f89ff;
    --tint-text: #8ea2ff;
    --tint-suave: rgba(111, 137, 255, .16);
    --rosa-text: #ff8cc8;
    --rojo: #ff5147;
    --barra: rgba(18, 18, 20, .74);
    --barra-borde: rgba(255, 255, 255, .1);
    --sombra-portada: 0 0 0 .5px rgba(255, 255, 255, .08), 0 8px 20px -6px rgba(0, 0, 0, .7);
    --sombra-flotante: 0 0 0 .5px rgba(255, 255, 255, .1), 0 16px 48px -8px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .4; }
a { color: var(--tint-text); text-decoration: none; }
img { display: block; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--tint); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--tint-suave); }

.ico {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico.chico { width: 17px; height: 17px; stroke-width: 1.9; }
.ico.mini { width: 14px; height: 14px; stroke-width: 2.1; }
.ico.relleno { fill: currentColor; }

.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================================================================ estructura */
.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}
.contenido {
  min-width: 0;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
@media (min-width: 1024px) {
  .app { grid-template-columns: 272px minmax(0, 1fr); }
  .contenido { padding-bottom: 64px; }
  :root { --gutter: 40px; }
}
@media (min-width: 600px) and (max-width: 1023px) { :root { --gutter: 32px; } }

/* --------------------------------------------------------- barra lateral */
.lateral { display: none; }
@media (min-width: 1024px) {
  .lateral {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100dvh;
    background: var(--bg-2);
    border-right: .5px solid var(--sep);
    padding: 22px 12px 14px;
    overflow-y: auto;
  }
}
.marca {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 10px 18px;
}
.marca img { width: 30px; height: 30px; border-radius: 7.5px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.marca b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; display: block; line-height: 1.15; }
.marca span { font-size: 12px; color: var(--text-2); display: block; }

.lateral .campo-buscar { margin: 0 4px 14px; }
.lat-grupo { margin-bottom: 18px; }
.lat-titulo {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 0 10px 6px; letter-spacing: .01em;
}
.lat-titulo button { color: var(--text-2); border-radius: 6px; padding: 2px; display: grid; }
.lat-titulo button:hover { color: var(--tint-text); background: var(--fill-2); }
.lat-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 34px; padding: 6px 10px;
  border-radius: 9px; font-size: 14.5px; text-align: left;
  color: var(--text);
  transition: background .15s;
}
.lat-item .ico { color: var(--tint); width: 20px; height: 20px; }
.lat-item:hover { background: var(--fill-2); }
.lat-item.activo { background: var(--fill); font-weight: 600; }
.lat-item .cuenta { margin-left: auto; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 400; }
.lat-item .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 5px; background: var(--c, var(--tint)); }
.lat-pie { margin-top: auto; padding-top: 10px; }
.lat-pie .lat-item { color: var(--text-2); font-size: 13.5px; }
.lat-pie .lat-item .ico { color: var(--text-2); }

/* --------------------------------------------------------- barra de pestañas */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--barra);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--barra-borde);
}
@media (min-width: 1024px) { .pestanas { display: none; } }
.pestana {
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; font-weight: 500; color: var(--text-3);
  padding: 3px 0;
}
.pestana .ico { width: 25px; height: 25px; stroke-width: 1.6; }
.pestana.activa { color: var(--tint); }
@media (min-width: 600px) {
  .pestana { flex-direction: row; justify-content: center; gap: 7px; font-size: 13px; padding: 7px 0; }
  .pestana .ico { width: 22px; height: 22px; }
}

/* --------------------------------------------------------- barra superior */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  min-height: 52px;
  padding: env(safe-area-inset-top) calc(var(--gutter) - 8px) 0;
  padding-left: max(calc(var(--gutter) - 8px), env(safe-area-inset-left));
  padding-right: max(calc(var(--gutter) - 8px), env(safe-area-inset-right));
  background: transparent;
  transition: background .25s, border-color .25s;
  border-bottom: .5px solid transparent;
}
.nav.solida {
  background: var(--barra);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--barra-borde);
}
.nav-titulo {
  font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .25s var(--ease-salida);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
}
.nav.solida .nav-titulo { opacity: 1; transform: none; }
.nav-izq, .nav-der { display: flex; align-items: center; gap: 2px; }
.nav-der { justify-content: flex-end; }
.btn-nav {
  display: inline-flex; align-items: center; gap: 2px;
  min-width: 40px; height: 40px; justify-content: center;
  padding: 0 8px; border-radius: 20px;
  color: var(--tint-text); font-size: 16px;
  transition: background .15s, opacity .15s;
}
.btn-nav:hover { background: var(--fill-2); }
.btn-nav:active { opacity: .5; }
.btn-nav .ico { width: 24px; height: 24px; }
.btn-nav.atras { padding-left: 2px; }
.btn-nav.atras .ico { width: 26px; height: 26px; stroke-width: 2; }
.btn-nav.circulo { background: var(--fill); width: 34px; min-width: 34px; height: 34px; padding: 0; margin-left: 6px; }
.btn-nav.circulo .ico { width: 19px; height: 19px; stroke-width: 2.1; }
.btn-nav.circulo.tinta { background: var(--tint); color: #fff; }
.btn-nav.circulo.tinta:hover { filter: brightness(1.06); }

/* --------------------------------------------------------- encabezado grande */
.cabeza {
  padding: 4px var(--gutter) 18px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.ceja {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
}
.titulo-grande {
  font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
@media (max-width: 599px) { .titulo-grande { font-size: 32px; } }
@media (min-width: 1024px) { .titulo-grande { font-size: 38px; } .cabeza { padding-top: 18px; padding-bottom: 22px; } }
.subtitulo { color: var(--text-2); font-size: 15px; margin: 6px 0 0; }
.cabeza-fila { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.cabeza-fila > div:first-child { min-width: min(100%, 240px); flex: 1 1 auto; }
.cabeza-fila .barra-herr { margin-left: auto; margin-right: -10px; }

.seccion { margin: 6px 0 34px; }
.seccion-cab {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 var(--gutter); margin-bottom: 14px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.seccion-cab h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
@media (max-width: 599px) { .seccion-cab h2 { font-size: 20px; } }
.seccion-cab button, .seccion-cab a { color: var(--tint-text); font-size: 15px; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; flex: none; }
.seccion-cab .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.relleno-lados {
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* --------------------------------------------------------- campo de búsqueda */
.campo-buscar {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  background: var(--fill); border-radius: 10px;
  color: var(--text-2);
}
.campo-buscar .ico { width: 17px; height: 17px; stroke-width: 2; flex: none; }
.campo-buscar input {
  flex: 1; min-width: 0; border: 0; background: none; height: 100%;
  font-size: 16px; color: var(--text);
}
.campo-buscar input::placeholder { color: var(--text-2); }
.campo-buscar input::-webkit-search-cancel-button { display: none; }
.campo-buscar .limpiar { display: grid; color: var(--text-3); }
.campo-buscar.grande { height: 40px; border-radius: 12px; }
@media (min-width: 1024px) { .campo-buscar input { font-size: 14.5px; } }

/* --------------------------------------------------------- chips */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--gutter) 2px; margin: -6px 0 22px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 14px; border-radius: 16px;
  background: var(--fill-2); font-size: 14px; font-weight: 500; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s;
}
.chip:hover { background: var(--fill); }
.chip.activo { background: var(--text); color: var(--bg); }
.chip .ico { width: 16px; height: 16px; }

.barra-herr { display: flex; align-items: center; gap: 4px; }
.btn-texto {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 10px; border-radius: 8px;
  color: var(--tint-text); font-size: 14.5px; font-weight: 500;
}
.btn-texto:hover { background: var(--fill-2); }
.btn-texto .ico { width: 18px; height: 18px; }

/* ================================================================ portadas */
.portada {
  position: relative;
  aspect-ratio: 3 / 4;
  display: flex; align-items: flex-end; justify-content: center;
}
.portada > img, .portada > .gen {
  max-width: 100%; max-height: 100%;
  border-radius: 4px;
  box-shadow: var(--sombra-portada);
}
.portada > img { width: auto; height: auto; object-fit: contain; background: #fff; }
.portada > img.cargando { opacity: 0; }
.portada > img { transition: opacity .35s ease; }
/* lomo: un brillo sutil a la izquierda, como en Apple Books */
.portada > img + .lomo, .portada > .gen + .lomo {
  position: absolute; pointer-events: none;
}
.portada .esqueleto {
  width: 100%; height: 100%; border-radius: 4px;
  background: linear-gradient(110deg, var(--fill-2) 30%, var(--fill) 50%, var(--fill-2) 70%);
  background-size: 250% 100%;
  animation: brillo 1.6s linear infinite;
}
@keyframes brillo { to { background-position: -150% 0; } }

/* Portada generada: para artifacts, enlaces y PDFs sin miniatura aún */
.gen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 12% 11% 10%;
  overflow: hidden;
  position: relative;
  color: #1d1d1f;
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 60%),
    linear-gradient(170deg, color-mix(in srgb, var(--c) 9%, #fff), color-mix(in srgb, var(--c) 22%, #fff));
  container-type: inline-size;
}
.gen .gen-tipo {
  display: flex; align-items: center; gap: 5px;
  font-size: max(9px, 7.2cqi); font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 78%, #000);
}
.gen .gen-tipo .ico { width: max(11px, 9cqi); height: max(11px, 9cqi); stroke-width: 2; }
.gen .gen-titulo {
  font-family: var(--serif);
  font-size: max(12px, 11.5cqi); line-height: 1.12; font-weight: 600;
  letter-spacing: -.01em;
  margin-top: 9%;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
  text-wrap: balance;
}
.gen .gen-regla { width: 22%; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--c) 70%, #000); margin-top: auto; opacity: .8; }
.gen .gen-fuente { font-size: max(9px, 6.8cqi); color: rgba(0, 0, 0, .55); margin-top: 6%; font-weight: 500; }
@media (prefers-color-scheme: dark) {
  .gen {
    color: #f5f5f7;
    background:
      radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--c) 45%, transparent), transparent 62%),
      linear-gradient(170deg, color-mix(in srgb, var(--c) 22%, #1c1c1e), color-mix(in srgb, var(--c) 36%, #111));
  }
  .gen .gen-tipo { color: color-mix(in srgb, var(--c) 45%, #fff); }
  .gen .gen-regla { background: color-mix(in srgb, var(--c) 50%, #fff); }
  .gen .gen-fuente { color: rgba(255, 255, 255, .6); }
}

/* ================================================================ estante */
.estante {
  display: flex; gap: 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 6px var(--gutter) 10px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  scroll-padding-left: max(var(--gutter), env(safe-area-inset-left));
}
.estante::-webkit-scrollbar { display: none; }
.estante::after { content: ''; flex: 0 0 calc(var(--gutter) - 18px); }
.estante > * { scroll-snap-align: start; flex: none; }

/* Seguir leyendo: tarjeta grande */
.continuar {
  width: min(78vw, 330px);
  display: flex; gap: 16px; align-items: flex-end;
  padding: 16px; border-radius: 18px;
  background: var(--bg-2);
  text-align: left;
  transition: transform .3s var(--ease), background .2s;
}
.continuar:hover { background: var(--fill-2); }
.continuar:active { transform: scale(.98); }
.continuar .portada { width: 92px; flex: none; }
.continuar .info { flex: 1; min-width: 0; padding-bottom: 2px; }
.continuar .ceja-chica { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.continuar .t {
  font-size: 16px; font-weight: 650; line-height: 1.22; letter-spacing: -.01em; margin: 4px 0 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 1024px) { .continuar { width: 360px; } .continuar .portada { width: 104px; } }
.progreso { height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.progreso > i { display: block; height: 100%; background: var(--tint); border-radius: inherit; }
.progreso-txt { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* ================================================================ cuadrícula */
.cuadricula {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 30px 18px;
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
@media (max-width: 380px) { .cuadricula { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; } }
@media (min-width: 600px) { .cuadricula { grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 34px 24px; } }
@media (min-width: 1280px) { .cuadricula { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 40px 30px; } }

.libro { position: relative; min-width: 0; text-align: left; display: block; width: 100%; }
.libro, .fila, .continuar, .coleccion { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.estante .libro { width: 132px; }
@media (min-width: 600px) { .estante .libro { width: 150px; } }
.libro .portada { transition: transform .35s var(--ease); }
.libro:active .portada { transform: scale(.97); }
@media (hover: hover) { .libro:hover .portada { transform: translateY(-3px); } }
.libro-pie { display: flex; align-items: flex-start; gap: 4px; margin-top: 11px; }
.libro-textos { flex: 1; min-width: 0; }
.libro-t {
  font-size: 14px; font-weight: 600; line-height: 1.25; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.libro-m {
  font-size: 12.5px; color: var(--text-2); margin-top: 3px;
  display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden;
}
.libro-m .ico { width: 13px; height: 13px; stroke-width: 2; flex: none; }
.libro-m .nuevo { color: var(--tint-text); font-weight: 600; }
.libro-m .leido { color: var(--verde); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.libro .mas {
  width: 28px; height: 28px; margin: -4px -6px 0 0; border-radius: 14px;
  display: grid; place-items: center; color: var(--text-2); flex: none;
}
.libro .mas:hover { background: var(--fill-2); color: var(--text); }
.libro .barrita { position: absolute; left: 8%; right: 8%; bottom: 7px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.55); overflow: hidden; box-shadow: 0 0 0 .5px rgba(0,0,0,.12); }
.libro .barrita > i { display: block; height: 100%; background: var(--tint); }
.libro .estrella {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 11px;
  background: rgba(255, 255, 255, .9); color: #f5a623;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.libro .estrella .ico { width: 13px; height: 13px; }

/* ================================================================ lista */
.lista {
  margin: 0 var(--gutter);
  margin-left: max(var(--gutter), env(safe-area-inset-left));
  margin-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--bg-2); border-radius: var(--radio); overflow: hidden;
}
.fila {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 10px 14px; text-align: left;
  position: relative;
  transition: background .12s;
}
.fila:hover { background: var(--fill-2); }
.fila:active { background: var(--fill); }
.fila + .fila::before {
  content: ''; position: absolute; top: 0; right: 0; left: var(--sangria, 74px);
  border-top: .5px solid var(--sep);
}
.fila .portada { width: 44px; flex: none; }
.fila .portada > img, .fila .portada > .gen { border-radius: 3px; }
.fila .gen { padding: 10% 9%; }
.fila .gen .gen-titulo, .fila .gen .gen-regla, .fila .gen .gen-fuente { display: none; }
.fila .gen .gen-tipo { font-size: 0; justify-content: center; height: 100%; }
.fila .gen .gen-tipo .ico { width: 18px; height: 18px; }
.fila-textos { flex: 1; min-width: 0; }
.fila-t { font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-m { font-size: 13px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .fin { color: var(--text-3); display: flex; align-items: center; gap: 8px; font-size: 14px; flex: none; }
.fila .fin .ico { width: 18px; height: 18px; stroke-width: 2; }
.fila .icono-cuadro {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: #fff; background: var(--c, var(--tint));
}
.fila .icono-cuadro .ico { width: 18px; height: 18px; stroke-width: 1.9; }
.lista.compacta { --sangria: 58px; }

/* Organizar: arrastrar filas desde la agarradera */
.lista.organizar { overflow: visible; }
.organizar .fila { transition: transform .22s var(--ease); background: var(--bg-2); cursor: default; }
.organizar .fila:hover { background: var(--bg-2); }
.organizar:first-child .fila:first-child, .organizar .fila:first-child { border-radius: var(--radio) var(--radio) 0 0; }
.organizar .fila:last-child { border-radius: 0 0 var(--radio) var(--radio); }
.organizar.moviendo .fila::before { opacity: 0; }
.organizar .fila.arrastrando {
  transition: none; z-index: 5; border-radius: 12px;
  background: var(--elev); box-shadow: var(--sombra-flotante);
}
.asa-org {
  margin-left: auto; width: 44px; height: 44px; flex: none; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-3);
  touch-action: none; cursor: grab;
}
.asa-org:hover { color: var(--text-2); background: var(--fill-2); }
.asa-org:active, .arrastrando .asa-org { cursor: grabbing; color: var(--tint); }
.asa-org .ico { width: 22px; height: 22px; stroke-width: 2; }
.lista.compacta .fila { min-height: 50px; padding: 8px 14px; }

/* ================================================================ colecciones */
.colecciones-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px;
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
@media (min-width: 600px) { .colecciones-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 22px; } }
.coleccion { text-align: left; display: block; width: 100%; }
.pila {
  position: relative; aspect-ratio: 4 / 3; border-radius: 16px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, var(--bg-2)), color-mix(in srgb, var(--c) 24%, var(--bg-2)));
  overflow: hidden;
  transition: transform .35s var(--ease);
}
.coleccion:active .pila { transform: scale(.97); }
@media (hover: hover) { .coleccion:hover .pila { transform: translateY(-3px); } }
.pila .portada { position: absolute; width: 34%; bottom: 14%; aspect-ratio: 3 / 4; }
.pila .portada:nth-child(1) { left: 33%; z-index: 3; bottom: 11%; }
.pila .portada:nth-child(2) { left: 13%; z-index: 2; transform: rotate(-7deg); transform-origin: bottom center; }
.pila .portada:nth-child(3) { left: 53%; z-index: 1; transform: rotate(7deg); transform-origin: bottom center; }
.pila .portada:only-child { left: 33%; }
.pila .vacio-ico { position: absolute; inset: 0; display: grid; place-items: center; color: color-mix(in srgb, var(--c) 70%, var(--text-2)); }
.pila .vacio-ico .ico { width: 34px; height: 34px; stroke-width: 1.4; }
.coleccion .c-t { font-size: 15px; font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.005em; }
.coleccion .c-m { font-size: 13px; color: var(--text-2); }

/* ================================================================ vacío */
.vacio {
  text-align: center; padding: 56px 32px 40px; max-width: 420px; margin: 0 auto;
}
.vacio .vacio-icono {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 22px;
  display: grid; place-items: center;
  background: var(--tint-suave); color: var(--tint);
}
.vacio .vacio-icono .ico { width: 38px; height: 38px; stroke-width: 1.4; }
.vacio h3 { font-size: 21px; font-weight: 700; letter-spacing: -.015em; margin: 0 0 6px; }
.vacio p { color: var(--text-2); margin: 0 0 22px; font-size: 15px; text-wrap: pretty; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px; padding: 0 22px; border-radius: 22px;
  background: var(--tint); color: #fff; font-size: 15.5px; font-weight: 600;
  transition: transform .2s var(--ease), filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn .ico { width: 19px; height: 19px; stroke-width: 2.1; }
.btn.gris { background: var(--fill); color: var(--text); }
.btn.peligro { background: var(--rojo); }
.btn.ancho { width: 100%; }
.btn.chico { height: 36px; padding: 0 16px; font-size: 14.5px; }

/* ================================================================ aviso para instalar */
.aviso {
  margin: 0 var(--gutter) 30px; padding: 14px 16px; border-radius: 16px;
  margin-left: max(var(--gutter), env(safe-area-inset-left));
  margin-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--bg-2);
  display: flex; gap: 14px; align-items: center;
}
.aviso img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.aviso .a-t { font-weight: 600; font-size: 14.5px; }
.aviso .a-m { color: var(--text-2); font-size: 13.5px; line-height: 1.35; }
.aviso .a-m .ico { width: 15px; height: 15px; vertical-align: -2px; color: var(--tint); }
.aviso .cerrar { margin-left: auto; color: var(--text-3); align-self: flex-start; }

/* ================================================================ búsqueda */
.busqueda-cab { padding: 0 var(--gutter) 20px; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.resultado-doc { padding: 12px 14px; }
.resultado-doc .rd-cab { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.resultado-doc .portada { width: 34px; flex: none; }
.resultado-doc .rd-t { font-weight: 600; font-size: 15px; }
.resultado-doc .rd-m { font-size: 12.5px; color: var(--text-2); }
.fragmento {
  display: flex; gap: 12px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; color: var(--text-2);
}
.fragmento:hover { background: var(--fill-2); }
.fragmento .pag { flex: none; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--fill); border-radius: 6px; padding: 2px 7px; height: fit-content; font-variant-numeric: tabular-nums; }
.fragmento mark, .lt-res mark { background: none; color: var(--text); font-weight: 650; box-shadow: inset 0 -.45em 0 color-mix(in srgb, var(--amarillo) 55%, transparent); }
.sugerencia { color: var(--text-2); font-size: 14px; padding: 4px var(--gutter); }

/* ================================================================ hojas, menús, avisos */
.velo {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, .32);
  animation: aparece .25s ease both;
}
.velo.saliendo { animation: desaparece .22s ease both; }
@keyframes aparece { from { opacity: 0; } }
@keyframes desaparece { to { opacity: 0; } }

.hoja {
  position: fixed; z-index: 81; left: 0; right: 0; bottom: 0;
  max-height: 92dvh; overflow: auto;
  background: var(--elev); border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--sombra-flotante);
  animation: sube .42s var(--ease) both;
}
.hoja.saliendo { animation: baja .26s var(--ease-salida) both; }
@keyframes sube { from { transform: translateY(100%); } }
@keyframes baja { to { transform: translateY(100%); } }
.hoja::before { content: ''; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: 0 auto 10px; }
@media (min-width: 700px) {
  .hoja {
    left: 50%; top: 50%; bottom: auto; right: auto; width: 440px;
    border-radius: 20px; padding: 22px 24px 22px;
    transform: translate(-50%, -50%);
    animation: zoom .32s var(--ease) both;
  }
  .hoja.saliendo { animation: zoomfuera .2s ease both; }
  .hoja::before { display: none; }
  @keyframes zoom { from { opacity: 0; transform: translate(-50%, -48%) scale(.96); } }
  @keyframes zoomfuera { to { opacity: 0; transform: translate(-50%, -50%) scale(.97); } }
}
.hoja h3 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin: 6px 0 4px; text-align: center; }
.hoja .h-sub { color: var(--text-2); text-align: center; margin: 0 0 18px; font-size: 14.5px; text-wrap: pretty; }
.hoja .acciones { display: flex; gap: 10px; margin-top: 20px; }
.hoja .acciones .btn { flex: 1; }
.campo { display: block; margin-top: 14px; }
.campo > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 6px 4px; }
.campo input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 0; background: var(--fill-2); font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--sep);
  transition: box-shadow .15s;
}
.campo input:focus { box-shadow: inset 0 0 0 2px var(--tint); background: var(--elev); }
.colores { display: flex; gap: 12px; margin: 4px 4px 0; flex-wrap: wrap; }
.color {
  width: 32px; height: 32px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  display: grid; place-items: center; color: #fff;
  transition: transform .2s var(--ease);
}
.color .ico { width: 17px; height: 17px; stroke-width: 2.6; opacity: 0; }
.color.activo { box-shadow: 0 0 0 2px var(--elev), 0 0 0 4px var(--c); }
.color.activo .ico { opacity: 1; }
.color:active { transform: scale(.9); }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0; }

.lista-hoja { background: var(--fill-2); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.lista-hoja .fila { --sangria: 58px; }
.lista-hoja .fila .fin .ico { color: var(--tint); }

/* menú contextual: popover en pantallas grandes, hoja en el celular */
.menu {
  position: fixed; z-index: 81; min-width: 240px; max-width: 300px;
  background: color-mix(in srgb, var(--elev) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-radius: 14px; box-shadow: var(--sombra-flotante);
  padding: 5px; transform-origin: top right;
  animation: menuin .22s var(--ease) both;
}
.menu.saliendo { animation: desaparece .15s ease both; }
@keyframes menuin { from { opacity: 0; transform: scale(.92); } }
.menu .m-cab { padding: 8px 12px 8px; font-size: 12.5px; color: var(--text-2); border-bottom: .5px solid var(--sep); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border-radius: 9px; font-size: 15px; text-align: left;
}
.m-item:hover { background: var(--fill); }
.m-item:focus-visible { outline: none; background: var(--fill); }
.m-item .ico { margin-left: auto; width: 19px; height: 19px; color: var(--text); }
.m-item.peligro, .m-item.peligro .ico { color: var(--rojo); }
.m-sep { height: .5px; background: var(--sep); margin: 5px 8px; }
.menu.hoja-menu {
  left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: none; border-radius: 16px; padding: 6px;
  background: var(--elev);
  animation: sube .38s var(--ease) both; transform-origin: bottom;
}
.menu.hoja-menu.saliendo { animation: baja .22s var(--ease-salida) both; }
.menu.hoja-menu .m-item { padding: 13px 14px; font-size: 16.5px; }

.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px 12px 18px; border-radius: 16px;
  background: color-mix(in srgb, #1d1d1f 92%, transparent); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--sombra-flotante); font-size: 14.5px;
  animation: toastin .4s var(--ease) both;
}
@media (prefers-color-scheme: dark) { .toast { background: color-mix(in srgb, #3a3a3c 92%, transparent); } }
@media (min-width: 1024px) { .toast { bottom: 32px; left: calc(50% + 136px); } }
.toast.saliendo { animation: toastout .25s ease both; }
.toast .ico { width: 19px; height: 19px; color: #8ea2ff; }
.toast button { color: #a6b5ff; font-weight: 600; padding: 2px 4px; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@keyframes toastout { to { opacity: 0; transform: translate(-50%, 8px); } }

/* subidas en curso */
.subidas {
  position: fixed; z-index: 70; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(340px, calc(100vw - 32px));
  background: color-mix(in srgb, var(--elev) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border-radius: 16px; box-shadow: var(--sombra-flotante); padding: 6px;
  animation: toastin2 .4s var(--ease) both;
}
@keyframes toastin2 { from { opacity: 0; transform: translateY(16px); } }
@media (min-width: 1024px) { .subidas { bottom: 24px; right: 24px; } }
.subida { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.subida .s-t { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subida .s-m { font-size: 12px; color: var(--text-2); }
.subida .s-m.error { color: var(--rojo); }
.anillo { width: 26px; height: 26px; flex: none; transform: rotate(-90deg); }
.anillo circle { fill: none; stroke-width: 3; }
.anillo .fondo { stroke: var(--fill); }
.anillo .frente { stroke: var(--tint); stroke-linecap: round; transition: stroke-dashoffset .2s; }
.subida .ok { color: var(--verde); }
.subida .ok .ico, .subida .err .ico { width: 22px; height: 22px; stroke-width: 2.2; }
.subida .err { color: var(--rojo); }

/* soltar archivos */
.soltar {
  position: fixed; inset: 0; z-index: 95; pointer-events: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 10%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: aparece .2s ease both;
}
.soltar > div {
  padding: 34px 44px; border-radius: 24px; text-align: center;
  background: var(--elev); box-shadow: var(--sombra-flotante);
  border: 2px dashed color-mix(in srgb, var(--tint) 55%, transparent);
}
.soltar .ico { width: 40px; height: 40px; color: var(--tint); margin: 0 auto 10px; display: block; stroke-width: 1.5; }
.soltar b { font-size: 18px; display: block; }
.soltar span { color: var(--text-2); font-size: 14px; }

/* ================================================================ entrada (PIN) */
.entrada {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px calc(30px + env(safe-area-inset-bottom));
  background:
    radial-gradient(60% 50% at 20% 0%, color-mix(in srgb, var(--tint) 14%, transparent), transparent 70%),
    radial-gradient(50% 40% at 100% 20%, color-mix(in srgb, var(--lavanda) 10%, transparent), transparent 70%),
    var(--bg);
}
.entrada .icono-app { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 10px 30px -8px rgba(82, 113, 255, .55); }
.entrada h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 20px 0 4px; }
.entrada p { color: var(--text-2); margin: 0 0 30px; }
.puntos-pin { display: flex; gap: 18px; height: 16px; margin-bottom: 14px; }
.puntos-pin i { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--text-2); transition: background .15s, box-shadow .15s, transform .2s var(--ease); }
.puntos-pin i.lleno { background: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); transform: scale(1.05); }
.puntos-pin.error { animation: sacudir .45s; }
.puntos-pin.error i { box-shadow: inset 0 0 0 1.5px var(--rojo); }
@keyframes sacudir { 15%, 55% { transform: translateX(-10px); } 35%, 75% { transform: translateX(10px); } 90% { transform: translateX(-3px); } }
.pin-msg { height: 20px; font-size: 13.5px; color: var(--rojo); margin-bottom: 18px; }
.teclado { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 24px; }
.tecla {
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--fill-2); font-size: 32px; font-weight: 400;
  display: grid; place-items: center; line-height: 1;
  transition: background .1s;
}
.tecla:active { background: var(--fill); }
.tecla.sin { background: none; font-size: 16px; color: var(--text-2); }
.tecla.sin .ico { width: 28px; height: 28px; }
@media (max-height: 640px) { .teclado { grid-template-columns: repeat(3, 66px); gap: 12px 20px; } .tecla { width: 66px; height: 66px; font-size: 27px; } .entrada .icono-app { width: 64px; height: 64px; } }

/* ================================================================ animaciones de vista */
.vista { animation: vistain .38s var(--ease-salida) both; }
@keyframes vistain { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================ lector */
.lector {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--lt-fondo);
  --lt-fondo: #ececef;
  --lt-pagina: #ffffff;
  --lt-barra: rgba(250, 250, 252, .8);
  --lt-texto: #1d1d1f;
  --lt-texto-2: #6e6e73;
  --lt-tinta: var(--tint-text);
  --lt-borde: rgba(0, 0, 0, .1);
  --lt-fill: rgba(118, 118, 128, .12);
  color: var(--lt-texto);
  animation: lectorin .42s var(--ease) both;
}
@keyframes lectorin { from { opacity: 0; transform: scale(.985); } }
.lector.saliendo { animation: lectorout .22s ease both; }
@keyframes lectorout { to { opacity: 0; transform: scale(.99); } }
@media (prefers-color-scheme: dark) {
  .lector.t-original { --lt-fondo: #1a1a1c; --lt-barra: rgba(28, 28, 30, .8); --lt-texto: #f5f5f7; --lt-texto-2: #98989f; --lt-borde: rgba(255,255,255,.1); --lt-fill: rgba(118,118,128,.24); --lt-tinta: #8ea2ff; }
}
.lector.t-sepia { --lt-fondo: #e9dfca; --lt-pagina: #f8f1e3; --lt-barra: rgba(244, 236, 219, .86); --lt-texto: #3b2f20; --lt-texto-2: #7d6b52; --lt-tinta: #8a5a1f; --lt-borde: rgba(91, 62, 23, .16); --lt-fill: rgba(120, 90, 50, .12); }
.lector.t-noche { --lt-fondo: #0b0b0c; --lt-pagina: #1b1b1d; --lt-barra: rgba(20, 20, 22, .82); --lt-texto: #ececf0; --lt-texto-2: #8e8e95; --lt-tinta: #8ea2ff; --lt-borde: rgba(255,255,255,.09); --lt-fill: rgba(118,118,128,.24); }

.lt-barra {
  position: absolute; left: 0; right: 0; z-index: 5;
  background: var(--lt-barra);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  transition: transform .4s var(--ease), opacity .3s;
}
.lt-arriba {
  top: 0; border-bottom: .5px solid var(--lt-borde);
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; min-height: calc(52px + env(safe-area-inset-top));
}
/* En el celular el título ocupa lo que dejan los botones, sin montarse encima. */
@media (max-width: 699px) { .lt-arriba { grid-template-columns: auto minmax(0, 1fr) auto; } .lt-titulo b { max-width: none; } }
.lt-abajo {
  bottom: 0; border-top: .5px solid var(--lt-borde);
  padding: 10px max(18px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 14px;
}
.lector.sin-barras .lt-arriba { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.lector.sin-barras .lt-abajo { transform: translateY(100%); opacity: 0; pointer-events: none; }
.lt-titulo { text-align: center; min-width: 0; padding: 0 6px; }
.lt-titulo b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.lt-titulo span { display: block; font-size: 12px; color: var(--lt-texto-2); font-variant-numeric: tabular-nums; }
.lector .btn-nav { color: var(--lt-tinta); }
.lector .btn-nav:hover { background: var(--lt-fill); }
.lector .btn-nav.activo { background: var(--lt-fill); }
.lt-grupo { display: flex; align-items: center; gap: 0; }
.lt-grupo.der { justify-content: flex-end; }
.lt-grupo .btn-nav.atras span { font-size: 16px; }
@media (max-width: 480px) { .lt-grupo .btn-nav.atras span { display: none; } }

.lt-deslizador { flex: 1; display: flex; align-items: center; }
.lt-deslizador input { width: 100%; }
.lt-pag-txt { font-size: 13px; color: var(--lt-texto-2); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 92px; text-align: right; }
input[type=range].rango {
  -webkit-appearance: none; appearance: none; height: 28px; background: transparent; cursor: pointer;
  --pct: 0%;
}
input[type=range].rango::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--lt-tinta) var(--pct), var(--lt-fill) var(--pct));
}
input[type=range].rango::-moz-range-track { height: 4px; border-radius: 2px; background: var(--lt-fill); }
input[type=range].rango::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--lt-tinta); }
input[type=range].rango::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; margin-top: -9px;
  background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.25);
}
input[type=range].rango::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.25); }

.lt-scroll {
  flex: 1; overflow: auto; position: relative;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
.lt-paginas {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: calc(68px + env(safe-area-inset-top)) 12px calc(84px + env(safe-area-inset-bottom));
  min-width: fit-content;
  transform-origin: 0 0;
}
@media (min-width: 700px) { .lt-paginas { gap: 22px; padding-left: 28px; padding-right: 28px; } }
.pg {
  position: relative; flex: none;
  background: var(--lt-pagina);
  box-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 2px 10px -2px rgba(0,0,0,.16);
  border-radius: 2px;
  overflow: hidden;
}
.pg canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lector.t-sepia .pg canvas { mix-blend-mode: multiply; }
.lector.t-noche .pg canvas { filter: invert(.9) hue-rotate(180deg) contrast(.92); }
.lector.t-noche .pg { box-shadow: 0 0 0 .5px rgba(255,255,255,.06); }
.pg .num-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; color: var(--lt-texto-2); font-variant-numeric: tabular-nums;
}
.pg .enlaces { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.pg .enlaces a { position: absolute; pointer-events: auto; border-radius: 2px; }
.pg .enlaces a:hover { background: color-mix(in srgb, var(--tint) 12%, transparent); }

/* capa de texto de PDF.js: seleccionable, invisible */
.textLayer {
  position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none;
  transform-origin: 0 0; caret-color: CanvasText; z-index: 2;
}
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(82, 113, 255, .32); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
.textLayer mark { color: transparent; background: rgba(255, 204, 0, .42); border-radius: 2px; }
.textLayer mark.activo { background: rgba(255, 149, 0, .62); box-shadow: 0 0 0 2px rgba(255, 149, 0, .5); }

/* paneles del lector */
.lt-pop {
  position: absolute; z-index: 8; top: calc(58px + env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  width: min(320px, calc(100vw - 20px));
  background: color-mix(in srgb, var(--lt-pagina) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-radius: 18px; box-shadow: var(--sombra-flotante); padding: 16px;
  color: var(--lt-texto);
  animation: menuin .25s var(--ease) both; transform-origin: top right;
}
.lt-pop h4 { margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: var(--lt-texto-2); text-transform: uppercase; letter-spacing: .04em; }
.lt-pop h4:not(:first-child) { margin-top: 18px; }
.temas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tema {
  display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 13px; color: var(--lt-texto-2);
}
.tema i {
  width: 100%; height: 52px; border-radius: 12px; display: grid; place-items: center;
  font-style: normal; font-family: var(--serif); font-size: 21px; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  transition: box-shadow .15s;
}
.tema[data-tema=original] i { background: #fff; color: #1d1d1f; }
.tema[data-tema=sepia] i { background: #f8f1e3; color: #3b2f20; }
.tema[data-tema=noche] i { background: #1b1b1d; color: #ececf0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.tema.activo i { box-shadow: 0 0 0 2.5px var(--tint); }
.tema.activo { color: var(--lt-texto); font-weight: 600; }
.zoom-fila { display: flex; align-items: center; background: var(--lt-fill); border-radius: 12px; height: 44px; }
.zoom-fila button { flex: 1; height: 100%; display: grid; place-items: center; color: var(--lt-texto); border-radius: 12px; }
.zoom-fila button:active { background: var(--lt-fill); }
.zoom-fila output { min-width: 64px; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.zoom-fila .sep { width: .5px; height: 22px; background: var(--lt-borde); }
.lt-pop .btn-ajustar { width: 100%; margin-top: 10px; height: 40px; border-radius: 12px; background: var(--lt-fill); color: var(--lt-texto); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14.5px; font-weight: 500; }
.lt-pop .btn-ajustar .ico { width: 18px; height: 18px; }

.lt-lado {
  position: absolute; z-index: 9; top: 0; bottom: 0; left: 0;
  width: min(340px, 88vw);
  background: color-mix(in srgb, var(--lt-pagina) 94%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--sombra-flotante);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left);
  animation: ladoin .38s var(--ease) both;
}
@keyframes ladoin { from { transform: translateX(-100%); } }
.lt-lado.saliendo { animation: ladoout .25s var(--ease-salida) both; }
@keyframes ladoout { to { transform: translateX(-100%); } }
.lt-lado-cab { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; }
.segmentado { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--lt-fill); border-radius: 9px; padding: 2px; }
.segmentado button { height: 30px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--lt-texto); }
.segmentado button.activo { background: var(--lt-pagina); box-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.lt-lado-cuerpo { flex: 1; overflow: auto; padding: 4px 8px calc(16px + env(safe-area-inset-bottom)); }
.indice-item {
  display: flex; gap: 10px; width: 100%; text-align: left; align-items: baseline;
  padding: 9px 10px; border-radius: 9px; font-size: 14.5px; line-height: 1.3; color: var(--lt-texto);
}
.indice-item:hover { background: var(--lt-fill); }
.indice-item .n { margin-left: auto; color: var(--lt-texto-2); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.indice-item.nivel-1 { padding-left: 24px; font-size: 14px; color: var(--lt-texto-2); }
.indice-item.nivel-2, .indice-item.nivel-3 { padding-left: 38px; font-size: 13.5px; color: var(--lt-texto-2); }
.indice-item.actual { color: var(--lt-tinta); font-weight: 600; }
.miniaturas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 14px; padding: 8px 8px; }
.mini { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--lt-texto-2); font-variant-numeric: tabular-nums; }
.mini .mc { width: 100%; aspect-ratio: var(--ar, 3/4); background: var(--lt-pagina); border-radius: 3px; box-shadow: 0 0 0 .5px rgba(0,0,0,.1), 0 2px 8px -2px rgba(0,0,0,.2); overflow: hidden; }
.mini .mc canvas, .mini .mc img { width: 100%; height: 100%; display: block; }
.lector.t-noche .mini .mc canvas { filter: invert(.9) hue-rotate(180deg); }
.mini.actual .mc { box-shadow: 0 0 0 2.5px var(--tint); }
.mini.actual { color: var(--lt-tinta); font-weight: 600; }
.sin-indice { color: var(--lt-texto-2); font-size: 14px; text-align: center; padding: 40px 20px; }

.lt-busqueda {
  position: absolute; z-index: 6; left: 0; right: 0; top: calc(52px + env(safe-area-inset-top));
  background: var(--lt-barra);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--lt-borde);
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  animation: aparece .2s ease both;
}
.lt-busqueda .fila-b { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto; }
.lt-busqueda .campo-buscar { flex: 1; background: var(--lt-fill); color: var(--lt-texto-2); }
.lt-busqueda .campo-buscar input { color: var(--lt-texto); }
.lt-busqueda .cuenta-b { font-size: 13px; color: var(--lt-texto-2); font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }
.lt-busqueda .btn-nav { min-width: 34px; height: 34px; padding: 0; }
.lt-res-lista { max-width: 760px; margin: 6px auto 0; max-height: 40dvh; overflow: auto; }
.lt-res { display: flex; gap: 12px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; color: var(--lt-texto-2); line-height: 1.4; }
.lt-res:hover, .lt-res.activo { background: var(--lt-fill); }
.lt-res .pag { flex: none; font-size: 11.5px; font-weight: 600; background: var(--lt-fill); border-radius: 6px; padding: 2px 7px; height: fit-content; color: var(--lt-texto); }
.lt-res mark { color: var(--lt-texto); }

.lt-cargando {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; pointer-events: none;
}
.girador { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--lt-fill); border-top-color: var(--lt-texto-2); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.lt-error { text-align: center; max-width: 340px; padding: 24px; color: var(--lt-texto-2); pointer-events: auto; }
.lt-error b { display: block; color: var(--lt-texto); font-size: 17px; margin-bottom: 6px; }

/* visor de artifacts e imágenes */
.lt-marco { flex: 1; border: 0; width: 100%; background: #fff; margin-top: calc(52px + env(safe-area-inset-top)); }
.lt-imagen { flex: 1; overflow: auto; display: grid; place-items: center; padding: calc(64px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom)); }
.lt-imagen img { max-width: 100%; max-height: calc(100dvh - 100px); border-radius: 4px; box-shadow: 0 2px 16px -4px rgba(0,0,0,.3); cursor: zoom-in; }
.lt-imagen.real img { max-width: none; max-height: none; cursor: zoom-out; }

/* información */
.info-filas { background: var(--fill-2); border-radius: 14px; overflow: hidden; margin-top: 6px; }
.info-filas div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; font-size: 14.5px; }
.info-filas div + div { border-top: .5px solid var(--sep); }
.info-filas dt { color: var(--text-2); }
.info-filas dd { margin: 0; text-align: right; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
