/* =========================================================
   Lector de Greenroom (0.7)
   Páginas de papel, modo día / sepia / noche, panel lateral.
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.lec {
	--papel: #fbf8f1; --tinta: #1f1d1a; --suave: #6b665c; --fondo: #e9e5da; --linea: rgba(0,0,0,.08);
	--barra: var(--grm-verde-noche, #111c17); --acento: var(--grm-verde-logo, #7bcd18);
	--lec-fs: 19px; --lec-lh: 1.62; --lec-fuente: "Lora", Georgia, serif;
	background: var(--fondo); color: var(--tinta); font-family: "Montserrat", system-ui, sans-serif;
	overflow: hidden; height: 100dvh; display: flex; flex-direction: column;
	-webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.tema-sepia { --papel: #f4ead6; --tinta: #3a2e21; --suave: #7d6a52; --fondo: #e4d7bd; --linea: rgba(58,46,33,.1); }
body.tema-noche { --papel: #17221c; --tinta: #d7e2cf; --suave: #8fa287; --fondo: #0c140f; --linea: rgba(255,255,255,.07); }
body.fuente-sans { --lec-fuente: "Montserrat", system-ui, sans-serif; }
body.fuente-facil { --lec-fuente: "Lexend", "Montserrat", sans-serif; }
body.linea-amplio { --lec-lh: 1.95; }

/* Barra superior */
.lec-top { flex: 0 0 auto; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--barra); color: #fff; z-index: 20; }
.lec-tit { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.lec-tit strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lec-tit span { font-size: 12px; color: var(--grm-verde-claro, #bee68d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lec-herr { display: flex; gap: 2px; }
.lec-ico { width: 42px; height: 42px; border: 0; border-radius: 100px; background: transparent; color: inherit; display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; font: 700 15px "Montserrat", sans-serif; }
.lec-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lec-ico:hover, .lec-ico.is-on { background: rgba(255,255,255,.12); }
#lecSep.is-on svg { fill: var(--acento); stroke: var(--acento); }

/* Escena y libro */
.lec-escena { position: relative; flex: 1 1 auto; min-height: 0; perspective: 2200px; }
.lec-libro { position: absolute; background: var(--papel); border-radius: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.08); overflow: hidden; }
.lec-libro.is-doble::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 60px; margin-left: -30px; pointer-events: none;
	background: linear-gradient(90deg, transparent, rgba(0,0,0,.07) 42%, rgba(0,0,0,.14) 50%, rgba(0,0,0,.07) 58%, transparent); }
.lec-texto { position: absolute; column-fill: auto; font-family: var(--lec-fuente); font-size: var(--lec-fs); line-height: var(--lec-lh); color: var(--tinta);
	-webkit-hyphens: auto; hyphens: auto; text-align: justify; -webkit-user-select: text; user-select: text; will-change: transform; }
.lec-texto.anim-desliza { transition: transform .42s cubic-bezier(.3,.7,.2,1); }
.lec-texto p { margin: 0; text-indent: 1.6em; orphans: 2; widows: 2; }
.lec-texto h2 + p, .lec-texto blockquote + p { text-indent: 0; }
.lec-texto h2 { break-before: column; font-family: "Poppins", "Montserrat", sans-serif; font-weight: 700; font-size: 1.15em; letter-spacing: .04em; text-transform: uppercase; text-align: center; margin: 2.2em 0 1.4em; text-indent: 0; hyphens: none; }
.lec-texto h2:first-child { break-before: auto; margin-top: .6em; }
.lec-texto blockquote { margin: 0 0 1.6em; font-style: italic; text-align: center; color: var(--suave); hyphens: none; }
.lec-texto mark { background: none; color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lec-texto mark.c-amarillo { background: rgba(251, 211, 0, .42); }
.lec-texto mark.c-verde { background: rgba(123, 205, 24, .38); }
.lec-texto mark.c-rosa { background: rgba(240, 98, 146, .32); }
.lec-texto mark.c-azul { background: rgba(80, 160, 230, .32); }
body.tema-noche .lec-texto mark.c-amarillo { background: rgba(251, 211, 0, .3); }
.lec-texto .lec-leyendo { background: linear-gradient(transparent 0, rgba(123,205,24,.18) 0); border-radius: 4px; }
.lec-fin-muestra { break-before: column; text-align: center; font-family: "Montserrat", sans-serif; padding-top: 18%; }
.lec-fin-muestra h2 { break-before: auto; }
.lec-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--grm-verde-medio, #457433); }
body.tema-noche .lec-kicker { color: var(--acento); }

/* Hoja que se da vuelta */
.lec-hoja { position: absolute; display: block; visibility: hidden; transform-style: preserve-3d; z-index: 6; pointer-events: none; }
.lec-hoja.is-on { visibility: visible; }
.lec-hoja__cara, .lec-hoja__dorso { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--papel); }
.lec-hoja__cara::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,.0) 60%, rgba(0,0,0,.12)); opacity: var(--sombra, 0); }
.lec-hoja__dorso { transform: rotateY(180deg); background: linear-gradient(90deg, var(--papel), color-mix(in srgb, var(--papel) 88%, #000)); }
.lec-texto--copia { pointer-events: none; }
.lec-texto--copia h2.lec-salto:first-child { margin-top: 2.2em; }
.lec-texto--copia .lec-fin-muestra:first-child { padding-top: 18%; }

/* Cinta del separador */
.lec-cinta { position: absolute; width: 26px; height: 56px; z-index: 7; background: var(--cinta, var(--acento)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: 0 2px 4px rgba(0,0,0,.2); }

/* Zonas para pasar página */
.lec-zona { position: absolute; top: 0; bottom: 0; width: 56px; border: 0; background: transparent; color: var(--suave); cursor: pointer; z-index: 5; display: grid; place-items: center; opacity: .55; }
.lec-zona:hover { opacity: 1; }
.lec-zona svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lec-zona--izq { left: 0; }
.lec-zona--der { right: 0; }
.lec-zona[disabled] { opacity: .12; cursor: default; }
.lec-cargando { position: absolute; inset: 0; display: grid; place-items: center; background: var(--fondo); color: var(--suave); font-weight: 600; z-index: 9; }
.lec-cargando[hidden] { display: none; }

/* Pie */
.lec-pie { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--fondo); color: var(--suave); font-size: 12px; min-height: 52px; flex-wrap: wrap; }
.lec-rango { flex: 1 1 200px; accent-color: var(--grm-verde-medio, #457433); }
.lec-pag { font-weight: 700; color: var(--tinta); white-space: nowrap; }
.lec-lic { opacity: .75; white-space: nowrap; }
.lec-volver-pos { border: 0; border-radius: 100px; background: var(--barra); color: #fff; font: 700 12px "Montserrat", sans-serif; padding: 7px 14px; cursor: pointer; }

/* Panel */
.lec-panel { position: fixed; top: 56px; right: 0; bottom: 0; width: min(380px, 100vw); background: #fff; color: #1f1d1a; z-index: 40; box-shadow: -10px 0 40px rgba(0,0,0,.2); display: flex; flex-direction: column; -webkit-user-select: auto; user-select: auto; }
body.tema-noche .lec-panel { background: #142019; color: #dfe8d8; }
.lec-panel[hidden] { display: none; }
.lec-panel__top { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 14px; background: var(--barra); color: #fff; }
.lec-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.lec-tabs button { border: 0; background: transparent; color: #fff; font: 700 13px "Montserrat", sans-serif; padding: 8px 12px; border-radius: 100px; cursor: pointer; }
.lec-tabs button.is-on { background: var(--acento); color: #111; }
.lec-panel section { display: none; padding: 18px 20px 30px; overflow-y: auto; }
.lec-panel section.is-on { display: block; flex: 1; }
.lec-panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }
.lec-panel h3:first-child { margin-top: 0; }
.lec-ayuda { font-size: 13px; color: #6b665c; margin: 0 0 12px; line-height: 1.5; }
body.tema-noche .lec-ayuda { color: #9db095; }
.lec-indice { list-style: none; margin: 0; padding: 0; }
.lec-indice li { margin: 0; }
.lec-indice button { width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: none; padding: 11px 6px; border-bottom: 1px solid rgba(0,0,0,.06); font: 600 14px "Montserrat", sans-serif; color: inherit; cursor: pointer; }
.lec-indice button small { color: #8a857a; font-weight: 500; }
.lec-indice li.is-on button { color: var(--grm-verde-medio, #457433); }
body.tema-noche .lec-indice li.is-on button { color: var(--acento); }
.lec-lista { list-style: none; margin: 0 0 8px; padding: 0; }
.lec-lista li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.06); margin: 0; }
.lec-lista .lec-punto { flex: 0 0 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.lec-lista button.lec-ir { flex: 1; text-align: left; border: 0; background: none; padding: 0; font: 500 14px/1.45 "Montserrat", sans-serif; color: inherit; cursor: pointer; }
.lec-lista button.lec-ir small { display: block; color: #8a857a; font-size: 12px; }
.lec-lista input { width: 100%; border: 0; background: rgba(0,0,0,.05); border-radius: 8px; padding: 6px 8px; font: 600 14px "Montserrat", sans-serif; color: inherit; }
.lec-lista .lec-x { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: #999; padding: 2px 4px; }
.lec-vacio { color: #8a857a; font-size: 13px; padding: 6px 0 12px; }
.lec-opciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lec-opciones button { flex: 1 1 auto; border: 0; border-radius: 100px; background: rgba(0,0,0,.06); padding: 10px 14px; font: 700 14px "Montserrat", sans-serif; color: inherit; cursor: pointer; }
body.tema-noche .lec-opciones button { background: rgba(255,255,255,.08); }
.lec-opciones button.is-on { background: var(--grm-verde-noche, #111c17); color: var(--acento); }
.lec-tema--dia { background: #fbf8f1 !important; color: #1f1d1a !important; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.lec-tema--sepia { background: #f4ead6 !important; color: #3a2e21 !important; }
.lec-tema--noche { background: #17221c !important; color: #d7e2cf !important; }
.lec-opciones .lec-tema.is-on { box-shadow: 0 0 0 3px var(--acento); }
.lec-tam span { min-width: 60px; text-align: center; font-weight: 700; }
.lec-campo { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 0; }
.lec-campo select { display: block; width: 100%; margin-top: 6px; border: 0; border-radius: 12px; background: rgba(0,0,0,.06); padding: 10px 12px; font: 500 14px "Montserrat", sans-serif; color: inherit; }
body.tema-noche .lec-campo select { background: rgba(255,255,255,.08); }
.lec-voz-btns { display: flex; gap: 8px; }
.lec-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 100px; background: var(--acento); color: #111 !important; padding: 12px 20px; font: 800 13px "Montserrat", sans-serif; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; text-decoration: none; }
.lec-btn--linea { background: transparent; box-shadow: inset 0 0 0 2px currentColor; color: inherit !important; }

/* Ventanita para resaltar */
.lec-pop { position: fixed; z-index: 50; display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--barra); border-radius: 100px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.lec-pop[hidden] { display: none; }
.lec-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); cursor: pointer; }
.c-amarillo { background: #fbd300; } .c-verde { background: #7bcd18; } .c-rosa { background: #f06292; } .c-azul { background: #50a0e6; }
.lec-quitar { border: 0; background: transparent; color: #fff; font: 700 13px "Montserrat", sans-serif; cursor: pointer; padding: 4px 8px; }

/* Celular */
@media (max-width: 700px) {
	.lec-tit strong { font-size: 13px; }
	.lec-ico { width: 38px; height: 38px; }
	.lec-zona { width: 34px; }
	.lec-zona svg { display: none; }
	.lec-lic { display: none; }
	.lec-pie { gap: 10px; padding-left: 12px; padding-right: 12px; }
}

/* Nada se imprime */
@media print { body * { display: none !important; } body::after { content: "Este libro se lee en línea en Greenroom."; display: block !important; } }

/* =========================================================
   0.8 · Páginas originales, modo lectura y giro más suave
   ========================================================= */
.lec-pliego { position: absolute; }
.lec-pag { position: absolute; top: 0; height: 100%; background: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.18); overflow: hidden; }
.lec-pag img, .lec-hoja--img img { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.lec-pliego.is-doble .lec-pag--izq { border-radius: 4px 0 0 4px; }
.lec-pliego.is-doble .lec-pag--der { border-radius: 0 4px 4px 0; }
.lec-pliego.is-doble::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 70px; margin-left: -35px; pointer-events: none; z-index: 2;
	background: linear-gradient(90deg, transparent, rgba(0,0,0,.06) 40%, rgba(0,0,0,.16) 50%, rgba(0,0,0,.06) 60%, transparent); }
.lec-sombra { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(0,0,0,.05)); }
.lec-pag--izq .lec-sombra { background: linear-gradient(270deg, rgba(0,0,0,.35), rgba(0,0,0,.05)); }
.lec-brillo { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.25) 45%, rgba(0,0,0,.12)); }
.lec-hoja { will-change: transform; }
.lec-hoja.is-on { box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.lec-hoja--img .lec-hoja__cara, .lec-hoja--img .lec-hoja__dorso { background: #fff; }
body.tema-noche.lec--pag .lec-pag, body.tema-noche .lec-hoja--img .lec-hoja__cara, body.tema-noche .lec-hoja--img .lec-hoja__dorso { background: #fff; }
body.con-zoom .lec-escena { overflow: auto; }
body.con-zoom .lec-zona { display: none; }
.lec-fin-muestra--pag { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: color-mix(in srgb, var(--fondo) 92%, transparent); }
.lec-fin-muestra--pag[hidden] { display: none; }
.lec-fin-muestra--pag h2 { font-family: "Poppins", sans-serif; text-transform: uppercase; margin: 6px 0 10px; }
.lec-opcion-link { flex: 1 1 auto; border-radius: 100px; background: rgba(0,0,0,.06); padding: 10px 14px; font: 700 14px "Montserrat", sans-serif; color: inherit; text-decoration: none; text-align: center; }
body.tema-noche .lec-opcion-link { background: rgba(255,255,255,.08); }
.lec-ir-pag { display: flex; gap: 8px; }
.lec-ir-pag input { flex: 1; border: 0; border-radius: 100px; background: rgba(0,0,0,.06); padding: 10px 16px; font: 600 15px "Montserrat", sans-serif; color: inherit; }
.lec-pag-num { font-weight: 700; color: var(--tinta); white-space: nowrap; }

/* Modo lectura: sin barras (toca el centro para verlas) */
body.modo-lectura .lec-top, body.modo-lectura .lec-pie { position: fixed; left: 0; right: 0; z-index: 30; transform: translateY(-100%); transition: transform .25s; }
body.modo-lectura .lec-pie { bottom: 0; transform: translateY(100%); }
body.modo-lectura.barras .lec-top, body.modo-lectura.barras .lec-pie { transform: none; }
body.modo-lectura .lec-top { top: 0; }
body.modo-lectura #lecPantalla { background: rgba(255,255,255,.12); }
body.modo-lectura .lec-panel { top: 0; }

/* Ilustraciones dentro del texto adaptable */
.lec-texto figure { margin: 1em 0; text-align: center; break-inside: avoid; text-indent: 0; }
.lec-texto figure img { display: block; width: 100%; height: calc(var(--alto-col, 70vh) * .42); object-fit: contain; }
.lec-texto figure figcaption { font-size: .8em; color: var(--suave); margin-top: .4em; }
.lec-texto .lec-orn { text-align: center; margin: .6em 0; text-indent: 0; }
.lec-texto .lec-orn img { max-height: 4em; max-width: 60%; }

/* Letra muy grande: menos justificado para que no queden huecos */
body.letra-xl .lec-texto { text-align: left; hyphens: manual; }
.lec-fijo { position: absolute; z-index: 5; overflow: hidden; background: var(--papel); visibility: hidden; pointer-events: none; }
.lec-fijo.is-on { visibility: visible; }
/* 0.9 · ventana de capítulos y medidor */
.lec-texto h2.lec-salto:first-child { margin-top: 2.2em; }
.lec-relleno { break-after: column; }
.lec-medidor { position: absolute; left: -300vw; top: 0; width: 10px; height: 10px; overflow: hidden; visibility: hidden; pointer-events: none; }
.lec-medidor .lec-texto { left: 0; top: 0; }
/* Modo lectura: el libro usa toda la pantalla */
html { background: #e9e5da; }
body.modo-lectura .lec-escena { position: fixed; inset: 0; }
