:root {
  --azul: #2563eb;
  --azul-oscuro: #1e40af;
  --amarillo: #fbbf24;
  --verde: #22c55e;
  --rojo: #ef4444;
  --fondo: #f4f7ff;
  --texto: #1f2937;
  --gris-claro: #e5e9f5;
  --radio: 18px;
  --sombra: 0 8px 20px rgba(30, 64, 175, 0.12);
  font-size: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Comic Sans MS", Verdana, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.6;
}

h1, h2, h3 { line-height: 1.3; }

.btn-icon {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: white;
  padding: 4px 10px;
  border-radius: 10px;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }

/* Barra superior */
.topbar {
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  color: white;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--sombra);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}
.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  flex: 1;
}

.selector-modo {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.btn-modo {
  background: none;
  border: none;
  color: white;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  white-space: nowrap;
}
.btn-modo.activo { background: var(--amarillo); color: var(--azul-oscuro); }

.progreso-mini { text-align: right; font-size: 0.85rem; min-width: 110px; }
.barra-mini { background: rgba(255,255,255,0.3); border-radius: 10px; height: 8px; margin-top: 4px; overflow: hidden; }
.barra-mini-relleno { background: var(--amarillo); height: 100%; width: 0%; transition: width .4s ease; }

/* Layout */
.layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
  position: relative;
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: white;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  margin: 16px;
  padding: 16px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--azul-oscuro); }
.solo-movil { display: none; }

#buscador {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--gris-claro);
  font-size: 1rem;
  margin-bottom: 10px;
}
#buscador:focus { outline: none; border-color: var(--azul); }

.lista-capitulos { list-style: none; margin: 0; padding: 0; }
.item-capitulo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .15s ease;
}
.item-capitulo:hover { background: var(--gris-claro); }
.item-capitulo.activo { background: var(--azul); color: white; }
.item-capitulo .num { font-weight: bold; opacity: 0.7; min-width: 22px; }
.item-capitulo .check { margin-left: auto; color: var(--verde); font-weight: bold; }
.item-capitulo.activo .check { color: var(--amarillo); }
.item-capitulo .titulo-item { font-size: 0.92rem; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}

/* Contenido principal */
.contenido {
  flex: 1;
  padding: 16px;
  min-width: 0;
}

.portada, .vista-capitulo {
  background: white;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 28px;
  margin-bottom: 16px;
}

.tarjetas-inicio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.tarjeta-inicio {
  background: var(--fondo);
  border-radius: var(--radio);
  padding: 18px;
  text-align: center;
  border: 2px solid var(--gris-claro);
}
.emoji-grande { font-size: 2.6rem; display: block; margin-bottom: 8px; }

.btn-primario {
  background: var(--verde);
  color: white;
  border: none;
  padding: 14px 26px;
  border-radius: 14px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--sombra);
  font-weight: bold;
}
.btn-primario:hover { filter: brightness(1.08); }

.btn-secundario {
  background: var(--azul);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 1rem;
  cursor: pointer;
}
.btn-secundario:disabled { background: #b3c2ea; cursor: not-allowed; }
.btn-secundario:hover:not(:disabled) { filter: brightness(1.1); }

.oculto { display: none !important; }

/* Vista de capítulo */
.cap-encabezado {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 3px dashed var(--gris-claro);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.cap-emoji { font-size: 3rem; }
.cap-numero { color: var(--azul); font-weight: bold; font-size: 0.9rem; }
.cap-titulo { margin: 2px 0 0; font-size: 1.5rem; }
.cap-subtitulo { color: #6b7280; margin: 2px 0 0; font-style: italic; }

.bloque {
  background: var(--fondo);
  border-left: 6px solid var(--azul);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.bloque.versiculo { border-left-color: var(--amarillo); background: #fff9e6; }
.bloque.dato { border-left-color: var(--verde); background: #eafff1; }
.bloque h4 { margin: 0 0 8px; }

.acciones-capitulo {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.nota-modos {
  background: #eef3ff;
  border: 2px dashed var(--azul);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 10px 0 20px;
}

/* Vista de adultos (texto original) */
.modo-adultos .bloque { border-left-color: var(--azul-oscuro); }
.seccion-original {
  background: var(--fondo);
  border: 2px solid var(--gris-claro);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.seccion-original h4 {
  margin: 0 0 10px;
  color: var(--azul-oscuro);
  font-size: 1rem;
  letter-spacing: 0.5px;
}
.seccion-original p.texto-original {
  text-align: justify;
  margin: 0 0 12px;
}
.referencias-biblicas {
  font-size: 0.85rem;
  color: #4b5563;
  background: #fff;
  border-left: 4px solid var(--amarillo);
  padding: 10px 14px;
  border-radius: 8px;
  white-space: pre-line;
}
.referencias-biblicas summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--azul);
}
.btn-quiz-seccion {
  display: inline-block;
  margin-top: 12px;
  background: var(--verde);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
}
.btn-quiz-seccion:hover { filter: brightness(1.08); }
.notas-referencias { margin-top: 10px; }
.nota-original {
  font-style: italic;
  color: #374151;
  margin: 10px 0 4px;
}
.verso-nvi {
  background: #fff;
  border-left: 3px solid var(--verde);
  padding: 6px 10px;
  border-radius: 6px;
  margin: 4px 0;
}
.verso-nvi sup { color: var(--azul); font-weight: bold; margin-right: 2px; }

.paginacion {
  display: flex;
  justify-content: space-between;
  padding: 0 16px 20px;
}

.pie {
  text-align: center;
  color: #6b7280;
  padding: 20px;
  font-size: 0.9rem;
}

/* Responsivo */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    height: 100vh;
    width: 280px;
    margin: 0;
    border-radius: 0;
    z-index: 45;
    transition: left .25s ease;
  }
  .sidebar.abierto { left: 0; }
  .solo-movil { display: inline-block; }
  .overlay.mostrar { display: block; }
  .topbar h1 { font-size: 0.95rem; }
  .topbar-inner { flex-wrap: wrap; }
  .progreso-mini { min-width: 80px; }
  .btn-modo { padding: 6px 8px; font-size: 0.75rem; }
}
