:root {
  --navy: #0d47a1;
  --navy2: #1565c0;
  --rail: #0d3a75;
  --card: #fff;
  --page: #eceff1;
  --pie: #f0f0f0;
  --line: #cfd8dc;
  --text: #37474f;
  --muted: #78909c;
  --live: #eceff1;
  --link: #1565c0;
  --font: "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html:has(body.consola),
html:has(body.visor) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.consola {
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 146px;
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  width: 100%;
  overflow: hidden;
  min-width: 1100px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--navy);
  color: #fff;
  padding: 0 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  z-index: 3;
  height: 100%;
  min-height: 0;
}
.logo-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 6px;
  font-size: 1.25rem;
}
.logo-btn:hover { background: rgba(255,255,255,.22); }
.buscar-biblia {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.buscar-biblia > .bi-search { opacity: .9; }
.buscar-biblia input[type="search"] {
  width: min(320px, 36vw);
  border: 0;
}
.buscar-biblia .form-check-label {
  font-size: .92rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.buscar-biblia .form-check-input {
  margin: 0;
  width: 1em;
  height: 1em;
}
.marca {
  font-size: 1.25rem;
  font-weight: 300;
  white-space: nowrap;
}
.marca strong { font-weight: 700; }

.cuerpo {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  gap: 4px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.rail-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.35rem;
  border-radius: 6px;
  line-height: 1;
  cursor: pointer;
}
.rail-btn:hover, .rail-btn.on { background: rgba(255,255,255,.18); }

#centro { min-height: 0; height: 100%; overflow: hidden; padding: 10px; }
.vista { display: none; height: 100%; min-height: 0; overflow: hidden; }
.vista.on { display: flex; flex-direction: column; }
.vista-row {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  margin: 0 !important;
}
.vista-row > [class*="col"] { min-height: 0; max-height: 100%; }

.bienvenida {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  background: #fff;
  border-radius: 4px;
  padding: 24px;
}
.bienvenida-card h1 { margin: 0 0 12px; font-weight: 300; font-size: 2rem; color: #455a64; }
.bienvenida-card ul { margin: 0; padding-left: 1.1rem; line-height: 1.8; color: #455a64; }
.btn-iniciar {
  border: 0;
  background: #e3f2fd;
  color: var(--navy);
  padding: 28px 22px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.btn-iniciar .bi { font-size: 2rem; }
.btn-iniciar:hover { background: #bbdefb; }

.caja {
  background: var(--card);
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  overflow: auto;
  height: 100%;
}
.hint { color: var(--muted); font-weight: 300; font-size: 1.15rem; padding: 2rem 1rem; }
.muted { color: var(--muted); }

.filtro-libros {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.filtro-libros .form-control { flex: 1; }
.col-head {
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-size: .85rem;
  padding: 4px 6px;
}
.libro, .album, .fav-item, .himnario {
  display: block;
  padding: 6px 8px;
  color: var(--link);
  border-bottom: 1px solid #eee;
  cursor: pointer;
  text-decoration: none;
}
.libro:hover, .album:hover, .fav-item:hover, .himnario:hover,
.libro.on, .album.on, .himnario.on { background: var(--live); color: var(--navy); }

.caps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}
.cap-btn {
  min-width: 40px;
  background: #546e7a;
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 6px 8px;
}
.cap-btn.on, .cap-btn:hover { background: var(--navy); }

.verso {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.verso:hover, .verso.en-vivo { background: var(--live); }
.verso strong { color: #263238; }
.cita-cap { font-weight: 300; text-align: center; margin: 0 0 8px; color: #455a64; }

.tabla-head {
  display: grid;
  grid-template-columns: 1fr 52px 70px 52px;
  background: var(--navy);
  color: #fff;
  font-size: .85rem;
  text-align: center;
  padding: 4px 6px;
}
.tabla-head .c-ti { text-align: left; }
.cancion-row {
  display: grid;
  grid-template-columns: 1fr 52px 88px;
  padding: 6px;
  cursor: pointer;
  color: var(--link);
  border-bottom: 1px solid #eee;
  font-size: .92rem;
}
.cancion-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cancion-row .c-to, .cancion-row .c-es { text-align: center; color: var(--text); }
.cancion-row:hover, .cancion-row.on { background: var(--live); }

.acciones-cancion { display: flex; gap: 6px; margin-bottom: 8px; }
.acciones-cancion .btn.on { background: var(--navy2); outline: 2px solid #fff; }
.cap-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.salto-biblia {
  margin: 6px 0 10px;
}
.salto-libro-ti {
  text-align: center;
  font-size: 1.25rem;
  color: #455a64;
  margin-bottom: 4px;
}
.salto-campos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.salto-campos input {
  font-size: 1.15rem !important;
  border: 0;
  border-bottom: 1px solid #cfd8dc;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
}
.tabla-head .c-nav { display: flex; gap: 2px; justify-content: flex-end; }
body.visor-fondo #capa-texto,
body.visor-fondo #velo,
body.visor-fondo #marquee-wrap { display: none !important; }
.titulo-cancion {
  text-align: center;
  text-transform: capitalize;
  font-size: 1.15rem;
  color: #455a64;
  margin-bottom: 8px;
}
.bloque-estrofa {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 8px 4px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.bloque-estrofa:hover, .bloque-estrofa.en-vivo { background: var(--live); }
.numestro { font-weight: 700; color: #455a64; }
.estrofa { white-space: pre-wrap; line-height: 1.35; }
.nro-estrofa {
  position: sticky;
  bottom: 8px;
  width: 64px;
  margin: 12px auto 0;
  text-align: center;
}
.versiculator {
  position: sticky;
  bottom: 8px;
  float: right;
  clear: both;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #455a64;
  color: #fff;
  border-radius: 8px;
  padding: 2px 8px;
  border: 2px solid #8f8f8f;
}
.versiculator span { font-size: .75rem; }
.versiculator .nro-estrofa {
  position: static;
  width: 56px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.lado-lista { flex: 1 1 auto; min-height: 0; overflow: auto; }
.panel-lado { display: flex; flex-direction: column; overflow: hidden; }
#vista-canciones .col-5 .caja {
  display: flex;
  flex-direction: column;
}
#lista-canciones { flex: 1 1 auto; min-height: 0; overflow: auto; }
.drawer-himnarios {
  flex: 0 0 auto;
  width: 100%;
  margin: 8px -12px -10px;
  border-top: 1px solid var(--line);
}
.btn-drawer-him {
  width: 100%;
  border: 0;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: .85rem;
  cursor: pointer;
}
.btn-drawer-him:hover { background: var(--navy2); }
.drawer-himnarios.collapsed .himnarios-lista { display: none; }
.drawer-himnarios.collapsed .bi-chevron-up { transform: rotate(180deg); }
.himnarios-lista {
  max-height: 28vh;
  overflow: auto;
  background: #fff;
}
.himnarios-lista .himnario {
  padding: 6px 8px;
}
.btn-navy {
  background: #455a64;
  color: #fff;
  border: 0;
}
.btn-navy:hover { background: #37474f; color: #fff; }

.mosaico {
  --mbz-tile: 130px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--mbz-tile), 1fr));
  gap: 10px;
}
.mosaico .tile {
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: #f8f8f8;
  position: relative;
}
.mosaico .tile.on { border-color: var(--navy2); }
.mosaico .thumb { position: relative; background: #000; }
.mosaico img, .mosaico video {
  width: 100%;
  height: var(--mbz-tile);
  object-fit: contain;
  background: #111;
  display: block;
}
.tipo-fondo {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  pointer-events: none;
}
.mosaico .nom {
  display: none;
  font-size: 12px;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mosaico.con-nombres .nom { display: block; }
.fav-fondo {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: rgba(0,0,0,.45);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
}

.pie {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px 18px;
  align-items: center;
  padding: 4px 18px 6px 12px;
  background: var(--pie);
  border-top: 1px solid #ddd;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.pie-sliders {
  min-width: 0;
  width: 100%;
}
.pie-sliders label {
  display: block;
  font-size: 12px;
  color: #607d8b;
  margin: 0 0 4px;
  line-height: 1.2;
  white-space: nowrap;
}
.pie-sliders .form-range {
  width: 100%;
  height: 18px;
  padding: 0;
}
.pie-sliders .form-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}
.pie-sliders .form-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
}
.pie-sliders .form-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
}
.pie-sliders .form-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
}
.pie-botones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  align-items: center;
}
.pie-botones .btn {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 6px 4px;
  font-size: 1.2rem;
}

.minivisor {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
#mini-media { position: absolute; inset: 0; }
#mini-media video, #mini-media img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
#mini-velo {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  z-index: 1;
}
.minivisor .t {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6px 20px;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 4px #000;
  z-index: 2;
}

body.visor {
  margin: 0;
  background: #000;
  overflow: hidden;
  font-family: var(--font);
  color: #fff;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  width: 100dvw;
}
#capa-fondo { position: fixed; inset: 0; }
#capa-fondo img, #capa-fondo video { width: 100%; height: 100%; object-fit: cover; }
#velo { position: fixed; inset: 0; background: #000; pointer-events: none; }
#capa-texto {
  position: fixed;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.25;
}
#capa-texto .cita { margin-top: .6em; opacity: .85; font-size: .45em; font-weight: 500; }
#capa-texto.anim-fade { animation: mbz-fade .35s ease; }
@keyframes mbz-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
#marquee-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.5vh;
  height: 6vh;
  overflow: hidden;
  z-index: 5;
  pointer-events: none;
}
#marquee {
  display: inline-block;
  white-space: nowrap;
  color: #fff;
  font-size: 3.4vh;
  font-weight: 700;
  text-shadow: 0 1px 8px #000;
  padding-left: 100%;
  animation: mbz-mq linear infinite;
}
@keyframes mbz-mq {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.video-ctrls { display: flex; gap: 6px; }
.panel-config {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 96px;
  width: 280px;
  background: #fff;
  z-index: 20;
  overflow: auto;
  padding: 12px;
  border-left: 1px solid var(--line);
}
.panel-config[hidden], .modal-mbz[hidden] { display: none !important; }
.panel-config-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.modal-mbz {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-mbz-card {
  background: #fff;
  width: min(640px, 92vw);
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
  border-radius: 6px;
}
.placeholder-afuera {
  text-align: center;
  color: #90a4ae;
  padding-top: 8vh;
}
.placeholder-afuera i {
  font-size: 50px;
  display: block;
  margin-bottom: 8px;
}
.panel-afuera {
  position: fixed;
  width: 800px;
  height: 500px;
  left: 32vw;
  top: 76px;
  z-index: 30;
  background: #111;
  color: #fff;
  border: 1px solid #555;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 360px;
  min-height: 240px;
}
.panel-afuera[hidden] { display: none !important; }
.panel-afuera-bar {
  background: #000;
  padding: 6px 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  cursor: move;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.panel-afuera-bar > span { margin-right: auto; }
.afuera-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: default;
  text-transform: none;
  letter-spacing: 0;
}
.afuera-zoom input { width: 90px; }
.panel-afuera-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
  background: #1a1a1a;
  min-height: 0;
}
.resize-handle {
  position: absolute;
  z-index: 2;
  background: transparent;
}
.resize-handle.n, .resize-handle.s { left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.resize-handle.e, .resize-handle.w { top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.resize-handle.n { top: 0; }
.resize-handle.s { bottom: 0; }
.resize-handle.e { right: 0; }
.resize-handle.w { left: 0; }
.resize-handle.ne, .resize-handle.nw, .resize-handle.se, .resize-handle.sw {
  width: 16px;
  height: 16px;
}
.resize-handle.ne { top: 0; right: 0; cursor: nesw-resize; }
.resize-handle.nw { top: 0; left: 0; cursor: nwse-resize; }
.resize-handle.se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, #9e9e9e 55%);
  width: 18px;
  height: 18px;
}
.resize-handle.sw { bottom: 0; left: 0; cursor: nesw-resize; }
