*{box-sizing:border-box;margin:0;padding:0}

:root{
  --azul:#1E3A8A;
  --turquesa:#06B6D4;
  --gris:#1F2937;
  --bg:#F9FAFB;
}

html,body{height:100%}
body.lector-body{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--bg);
  color:var(--gris);
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

/* ============ HEADER ============ */
.lector-header{
  display:flex;
  align-items:center;
  gap:.8rem;
  padding:.7rem 1rem;
  background:#fff;
  border-bottom:1px solid #E5E7EB;
  position:sticky;
  top:0;
  z-index:20;
}
.lector-btn{
  background:none;
  border:none;
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:var(--azul);
  cursor:pointer;
  transition:.15s;
  flex-shrink:0;
  font-family:inherit;
}
.lector-btn:hover{background:#F3F4F6}
.lector-titulo{flex:1;min-width:0;overflow:hidden}
.lector-titulo h1{
  font-size:.95rem;
  color:var(--gris);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:600;
}
.lector-titulo span{
  font-size:.75rem;
  color:#6B7280;
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* ============ PANEL AJUSTES ============ */
.lector-panel{
  position:fixed;
  top:60px;
  right:1rem;
  background:#fff;
  border-radius:12px;
  padding:1rem;
  box-shadow:0 10px 30px rgba(0,0,0,.15);
  display:none;
  z-index:30;
  min-width:260px;
}
.lector-panel.abierto{display:block}
.panel-grupo{margin-bottom:1rem}
.panel-grupo:last-child{margin-bottom:0}
.panel-grupo label{
  display:block;
  font-size:.75rem;
  color:#6B7280;
  margin-bottom:.4rem;
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
}
.panel-opciones{display:flex;gap:.4rem;flex-wrap:wrap}
.panel-btn{
  flex:1;
  min-width:60px;
  padding:.5rem .7rem;
  background:#F3F4F6;
  border:1px solid transparent;
  border-radius:8px;
  font-size:.85rem;
  cursor:pointer;
  color:var(--gris);
  transition:.15s;
  font-family:inherit;
}
.panel-btn:hover{background:#E5E7EB}
.panel-btn.activo{background:var(--azul);color:#fff}

/* ============ MAIN ============ */
.lector-main{
  flex:1;
  display:flex;
  justify-content:center;
  padding:1rem;
  overflow:hidden;
  position:relative;
}
.lector-visor{
  width:100%;
  max-width:900px;
  background:#fff;
  border-radius:12px;
  box-shadow:0 4px 20px rgba(0,0,0,.06);
  overflow:hidden;
  min-height:60vh;
}

/* Texto IA */
.lector-texto{
  max-width:720px;
  background:#fff;
  padding:2.5rem 1.5rem;
  border-radius:12px;
  box-shadow:0 4px 20px rgba(0,0,0,.06);
  line-height:1.9;
}
.lector-texto h1{color:var(--azul);font-size:1.5rem;margin-bottom:.3rem}
.lector-autor{color:#6B7280;font-size:.9rem;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #E5E7EB}
.lector-contenido{font-size:1.05rem}

/* Vacío */
.lector-vacio{text-align:center;padding:3rem 1rem;background:#fff;border-radius:12px;max-width:600px}
.lector-vacio p{margin-bottom:1.5rem;color:#6B7280}
.lector-cta{display:inline-block;padding:.7rem 1.3rem;background:var(--turquesa);color:#fff;border-radius:8px;text-decoration:none;font-weight:600}

/* ============ FOOTER ============ */
.lector-footer{
  display:flex;
  align-items:center;
  gap:1rem;
  padding:.8rem 1rem;
  background:#fff;
  border-top:1px solid #E5E7EB;
  position:sticky;
  bottom:0;
}
.lector-nav{
  width:44px;
  height:44px;
  border:none;
  background:#F3F4F6;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color:var(--azul);
  transition:.15s;
  flex-shrink:0;
}
.lector-nav:hover{background:var(--azul);color:#fff}
.lector-progreso{flex:1;display:flex;flex-direction:column;gap:.3rem;align-items:center}
.progreso-barra{
  width:100%;
  height:4px;
  background:#E5E7EB;
  border-radius:99px;
  overflow:hidden;
}
.progreso-fill{
  height:100%;
  background:var(--turquesa);
  width:0%;
  transition:width .3s;
}
#info-pagina{font-size:.75rem;color:#6B7280}

/* ============ TEMAS ============ */
body.tema-dark{background:#111827}
body.tema-dark .lector-header,
body.tema-dark .lector-footer{background:#1F2937;border-color:#374151}
body.tema-dark .lector-titulo h1{color:#F9FAFB}
body.tema-dark .lector-titulo span{color:#9CA3AF}
body.tema-dark .lector-btn{color:#E5E7EB}
body.tema-dark .lector-btn:hover{background:#374151}
body.tema-dark .lector-nav{background:#374151;color:#E5E7EB}
body.tema-dark .lector-nav:hover{background:#06B6D4;color:#fff}
body.tema-dark .lector-panel{background:#1F2937}
body.tema-dark .panel-grupo label{color:#9CA3AF}
body.tema-dark .panel-btn{background:#374151;color:#E5E7EB}
body.tema-dark .panel-btn.activo{background:#06B6D4}
body.tema-dark #info-pagina{color:#9CA3AF}
body.tema-dark .progreso-barra{background:#374151}

body.tema-sepia{background:#F4ECD8}
body.tema-sepia .lector-header,
body.tema-sepia .lector-footer{background:#EDE4CE;border-color:#D4C9B0}

/* ============ RESPONSIVE ============ */
@media(min-width:600px){
  .lector-main{padding:1.5rem}
  .lector-texto{padding:3rem 2.5rem}
  .lector-texto h1{font-size:1.8rem}
}

/* Aviso del TTS - versión bonita */
.tts-aviso{
  display:flex;
  align-items:center;
  gap:.6rem;
  margin-top:.8rem;
  padding:.7rem .8rem;
  background:linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border-radius:10px;
  border:1px solid #FCD34D;
  box-shadow:0 1px 3px rgba(245,158,11,.15);
}
.tts-aviso-icono{
  font-size:1.4rem;
  flex-shrink:0;
  line-height:1;
  filter:drop-shadow(0 1px 1px rgba(0,0,0,.1));
}
.tts-aviso-texto{
  display:flex;
  flex-direction:column;
  gap:.15rem;
  min-width:0;
}
.tts-aviso-texto strong{
  color:#92400E;
  font-size:.8rem;
  font-weight:700;
  display:block;
}
.tts-aviso-texto span{
  color:#B45309;
  font-size:.72rem;
  line-height:1.3;
  display:block;
}