* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: system-ui, sans-serif; }

.projector-body {
  background: #000;
  height: 100vh;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.stage-item {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  border: 0;
}

.hidden { display: none; }

#stage-youtube, #yt-player, #yt-player iframe {
  width: 100%;
  height: 100%;
}

.start-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999;
}

.start-overlay.hidden {
  display: none;
}

.stage-notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 80vw;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.85);
  color: #ddd;
  font: 14px system-ui, sans-serif;
  text-align: center;
}

.stage-notice.hidden { display: none; }

#stage-bible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bible-bg-color, #000);
  background-image: var(--bible-bg-image, none);
  background-size: cover;
  background-position: center;
  text-align: center;
  padding: 60px;
}

#stage-bible.hidden {
  display: none;
}

#bible-text {
  font-size: calc(var(--bible-font-size, 3vw) * var(--bible-fit-scale, 1));
  line-height: 1.5;
  max-width: 90%;
  font-family: var(--bible-font-family, Georgia, "Times New Roman", serif);
  color: var(--bible-text-color, #fff);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* varios versiculos: uno por linea, con su numero resaltado */
.bible-verse-line + .bible-verse-line { margin-top: 0.35em; }
.bible-verse-num {
  margin-right: 0.15em;
  font-weight: bold;
  font-size: 0.7em;
  vertical-align: 0.35em;
  color: var(--bible-ref-color, #ffd700);
}

#bible-reference {
  margin-top: 30px;
  font-size: calc(1.8vw * var(--bible-fit-scale, 1));
  color: var(--bible-ref-color, #ffd700);
  font-weight: bold;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.start-overlay button {
  padding: 20px 32px;
  font-size: 20px;
  border: none;
  border-radius: 10px;
  background: #2d6cdf;
  color: white;
  cursor: pointer;
}

.remote-body {
  background: #111;
  color: #eee;
  padding: 16px;
  min-height: 100vh;
}

.controls {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.controls button {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #2d6cdf;
  color: white;
}

#playlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.playlist-item {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #222;
}

.playlist-item.active {
  border-color: #2d6cdf;
}

.playlist-item img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  display: block;
}

.playlist-item .placeholder {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.playlist-item span {
  display: block;
  font-size: 12px;
  padding: 4px;
  text-align: center;
}

.admin-shortcuts {
  display: flex;
  gap: 14px;
  margin: 16px 0 20px;
  flex-wrap: wrap;
}

.admin-shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 92px;
  height: 92px;
  border-radius: 14px;
  border: 1px solid #333;
  background: #1b1b1b;
  color: #eee;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.admin-shortcut-btn:hover {
  background: #23324f;
  border-color: #2d6cdf;
}

.admin-shortcut-btn:active {
  transform: scale(0.96);
}

.admin-shortcut-btn .admin-shortcut-icon {
  font-size: 32px;
  line-height: 1;
}

.admin-shortcut-btn .admin-shortcut-label {
  font-size: 12px;
  color: #ccc;
  text-align: center;
}

/* Pagina Administrar contenido: botones mas grandes (los de Biblia/YouTube no cambian) */
.admin-shortcuts { gap: 18px; }
.admin-shortcuts .admin-shortcut-btn {
  width: 132px;
  height: 132px;
  gap: 10px;
  border-radius: 18px;
}
.admin-shortcuts .admin-shortcut-icon { font-size: 50px; }
.admin-shortcuts .admin-shortcut-label { font-size: 15px; }

.folder-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.folder-name { min-width: 150px; font-weight: 600; }
.folder-row button {
  padding: 8px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #262626;
  color: #eee;
  cursor: pointer;
}
.folder-row button:hover { background: #303a52; border-color: #2d6cdf; }
.folder-row button.hidden { display: none; }
.folder-status { font-size: 13px; color: #aaa; }
.folder-note { margin: 12px 0 0; font-size: 12px; color: #999; }

.admin-form {
  background: #1b1b1b;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.admin-form h2 {
  margin-top: 0;
  font-size: 16px;
}

.admin-form form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="file"],
.admin-form select {
  flex: 1;
  min-width: 160px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
}

.admin-form button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #2d6cdf;
  color: white;
  cursor: pointer;
}

#upload-status, #youtube-status, #bible-status, #local-file-status {
  font-size: 13px;
  color: #9dc1ff;
  min-height: 16px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1b1b1b;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.admin-row.active {
  border-color: #2d6cdf;
}

.admin-row-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.admin-row img {
  width: 80px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

.admin-row .placeholder {
  width: 80px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #333;
  border-radius: 4px;
  font-size: 20px;
}

.admin-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-row-info span {
  font-size: 12px;
  color: #999;
}

.admin-row-actions button {
  padding: 6px 10px;
  margin-left: 4px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
}

.admin-row-actions .btn-launch {
  background: #2d6cdf;
  color: white;
  font-weight: bold;
}

#now-playing {
  display: flex;
  flex-direction: column;
}

#now-playing-title {
  font-weight: bold;
}

.seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.seek-row #seek-label {
  font-size: 13px;
  color: #999;
  white-space: nowrap;
}

#seek-bar {
  flex: 1;
}

#seek-bar:disabled {
  opacity: 0.4;
}

.bible-breadcrumb {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 8px;
  min-height: 20px;
}

#bible-search-status {
  min-height: 21px;
  margin: 0 0 8px;
}

.bible-section h2 {
  font-size: 14px;
  color: #999;
  margin: 0 0 6px;
}

.bible-books h3,
#bible-books h3 {
  font-size: 12px;
  color: #777;
  margin: 8px 0 4px;
}

.bible-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.bible-books-grid {
  grid-template-columns: repeat(auto-fill, var(--book-btn-width, 62px));
  justify-content: start;
}

.bible-book-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--book-btn-width, 62px);
  height: var(--book-btn-height, 44px);
  padding: 4px 2px;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.bible-book-btn strong { font-size: 14px; }
.bible-book-btn span {
  font-size: 9px;
  opacity: 0.9;
  max-width: 100%;
  overflow-wrap: break-word;
  text-align: center;
}

.group-ley { background: #8b5e34; }
.group-historia { background: #c97a2b; }
.group-poesia { background: #a83246; }
.group-profetas_mayores { background: #7b3fa0; }
.group-profetas_menores { background: #3f51b5; }
.group-evangelios { background: #17a2b8; }
.group-historia_nt { background: #0f9b8e; }
.group-cartas_paulinas { background: #2e8b57; }
.group-cartas_generales { background: #8bc34a; color: #222; }
.group-apocalipsis { background: #c0ca33; color: #222; }

.bible-grid-numbers {
  grid-template-columns: repeat(auto-fill, minmax(var(--num-btn-width, 46px), 1fr));
}

.bible-num-btn {
  padding: 10px 0;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
  font-size: 15px;
}

.bible-num-btn.selected {
  background: #2d6cdf;
  font-weight: bold;
  color: white;
}

.bible-num-btn.current {
  outline: 2px solid #ffd700;
  outline-offset: -2px;
}

.bible-book-btn.current {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.bible-back-btn {
  padding: 8px 14px;
  margin-bottom: 10px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
}

.bible-selection-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b1b1b;
  border-top: 2px solid #2d6cdf;
  padding: 12px 16px;
}

.bible-selection-bar.hidden {
  display: none;
}

.bible-selection-bar button {
  padding: 10px 16px;
  margin-left: 8px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
}

.bible-selection-bar .btn-launch {
  background: #2d6cdf;
  color: white;
  font-weight: bold;
}

.bible-style-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
}

.bible-style-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #ccc;
}

.bible-style-form.hidden,
#style-bg-color-wrap.hidden,
#style-bg-image-wrap.hidden {
  display: none;
}

.bible-style-form select,
.bible-style-form input[type="color"] {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
}

.bible-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.bible-topbar-actions {
  display: flex;
  gap: 8px;
}

.bible-topbar button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
}

body.bible-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bible-page .bible-layout {
  flex: 1;
  min-height: 0;
  padding-bottom: 68px;
}

.bible-layout {
  display: grid;
  grid-template-columns:
    var(--col-verses-width, 300px)
    8px
    var(--col-books-width, 560px)
    8px
    1fr;
  gap: 8px;
}

.bible-resizer {
  cursor: col-resize;
  position: relative;
  height: 100%;
}

.bible-resizer::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 2px;
  height: 100%;
  background: #333;
  border-radius: 2px;
}

.bible-resizer:hover::after,
.bible-resizer.dragging::after {
  background: #2d6cdf;
}

.bible-preview-widget {
  display: grid;
  /* [minibotones de version] [preview] [boton Proyector] */
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px 10px;
  width: 100%;
  /* ancho del preview + minibotones (116px) + boton Proyector (92px) + 2 huecos */
  max-width: calc(var(--col-preview-width, 340px) + 228px);
  margin: 0 auto;
}

.bible-preview-widget > * { grid-column: 2; }

/* boton Proyector: a la derecha del preview, alineado con su parte superior */
.bible-preview-widget > .bible-projector-btn {
  grid-column: 3;
  grid-row: 2;
  align-self: start;
}

/* 13 minibotones para cambiar de version rapido: a la izquierda del preview */
.bible-preview-widget > .bible-quick-versions {
  grid-column: 1;
  grid-row: 2 / span 2;
  align-self: stretch;
  contain: size; /* no agranda el preview: se ajusta al alto disponible */
  display: grid;
  grid-template-columns: repeat(2, 56px);
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.qv-btn {
  min-height: 0;
  padding: 0 2px;
  overflow: hidden;
  border: 1px solid #333;
  border-radius: 6px;
  background: #262626;
  color: #ddd;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.qv-btn:hover { background: #303a52; border-color: #2d6cdf; }
.qv-btn.active { background: #2d6cdf; border-color: #6aa3ff; color: #fff; }
/* aun no descargadas: borde punteado (se descargan al elegirlas la primera vez) */
.qv-btn.pending { border-style: dashed; color: #999; }
.qv-btn.pending:hover { color: #fff; }

/* Columna Libros angosta (ventana chica): los minibotones pasan a una fila bajo el preview
   para que el preview no se aplaste */
.bible-col-books { container-type: inline-size; }

@container (max-width: 560px) {
  .bible-preview-widget { grid-template-columns: minmax(0, 1fr) auto; }
  .bible-preview-widget > * { grid-column: 1; }
  .bible-preview-widget > .bible-projector-btn { grid-column: 2; grid-row: 2; }
  .bible-preview-widget > .bible-quick-versions {
    grid-column: 1 / -1;
    grid-row: auto;
    contain: none;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: 28px;
  }
}

.bible-preview-widget.dragging-widget {
  opacity: 0.5;
}

.bible-preview-handle {
  cursor: move;
  background: #333;
  color: #999;
  font-size: 11px;
  text-align: center;
  padding: 4px;
  border-radius: 6px;
  user-select: none;
}

.bible-preview-handle:hover {
  background: #3a3a3a;
  color: #ccc;
}

.bible-col.drop-target-top {
  box-shadow: inset 0 4px 0 0 #2d6cdf;
}

.bible-col.drop-target-bottom {
  box-shadow: inset 0 -4px 0 0 #2d6cdf;
}

.bible-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.bible-col-left {
  background: #1b1b1b;
  border-radius: 8px;
  padding: 12px;
}

.bible-section-flex {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bible-section-flex .bible-scroll-box {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.bible-mini-preview {
  width: 100%;
  max-width: var(--col-preview-width, 340px);
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  overflow: hidden;
  background-color: var(--bible-bg-color, #000);
  background-image: var(--bible-bg-image, none);
  background-size: cover;
  background-position: center;
}

.bible-section {
  background: #1b1b1b;
  border-radius: 8px;
  padding: 10px;
}

.bible-scroll-box {
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}

#style-preview-text {
  font-family: var(--bible-font-family, Georgia, serif);
  font-size: 11px;
  line-height: 1.3;
  color: var(--bible-text-color, #fff);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  max-width: 95%;
}

#style-preview-text b { color: var(--bible-ref-color, #ffd700); }

#style-preview-ref {
  margin-top: 6px;
  font-size: 9px;
  font-weight: bold;
  color: var(--bible-ref-color, #ffd700);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.bible-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: var(--col-preview-width, 340px);
}

.bible-nav-row button {
  flex: 1;
  padding: 8px 4px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
  font-size: 13px;
}

.bible-count-toggle {
  display: flex;
  gap: 2px;
  background: #222;
  border-radius: 6px;
  padding: 2px;
}

.count-btn {
  width: 28px;
  padding: 6px 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 13px;
}

.count-btn.active {
  background: #2d6cdf;
  color: white;
  font-weight: bold;
}

.bible-verse-list {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bible-verse-row {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}

.bible-verse-row:hover {
  background: #2a2a2a;
}

.bible-verse-row.selected {
  background: #24406e;
}

.bible-verse-row.current {
  outline: 2px solid #ffd700;
  outline-offset: -2px;
}

.bible-verse-row .num {
  color: #ffd700;
  font-weight: bold;
  flex-shrink: 0;
}

@media (max-width: 1000px) {
  body.bible-page {
    height: auto;
    overflow: visible;
  }
  .bible-page .bible-layout {
    flex: none;
  }
  .bible-layout {
    grid-template-columns: 1fr;
  }
  .bible-col {
    height: 300px;
  }
  .bible-resizer {
    display: none;
  }
}

/* --- Dialogos y avisos compartidos (reemplazan confirm()/alert() nativos) --- */

.dlg-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.65);
}

.dlg-box {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  border-radius: 12px;
  background: #1b1b1b;
  border: 1px solid #333;
  color: #eee;
}

.dlg-msg {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.4;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dlg-cancel,
.dlg-ok {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.dlg-cancel { background: #444; }
.dlg-ok { background: #dc2626; }

.dlg-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 3000;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #262626;
  border: 1px solid #444;
  color: #eee;
  font-size: 13px;
  white-space: pre-line;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.dlg-toast.show { opacity: 1; }

/* --- Playlist de YouTube (/admin/youtube) --- */

.yt-hint {
  margin: 0 0 10px;
  color: #999;
  font-size: 13px;
}

#yt-links {
  width: 100%;
  min-height: 64px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #444;
  border-radius: 10px;
  background: #222;
  color: #eee;
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

#yt-links:focus {
  outline: none;
  border-color: #2d6cdf;
}

.yt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.yt-toolbar .yt-btn { width: 150px; }

.yt-btn {
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.yt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.yt-btn-add { background: linear-gradient(to right, #ef4444, #dc2626); }
.yt-btn-save { background: #d98a0b; }
.yt-btn-load { background: #7c4ddb; }
.yt-btn-clear { background: #4b5563; }

.yt-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #1b1b1b;
}

#yt-now-text {
  min-height: 20px;
  overflow: hidden;
  color: #ddd;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-seek-row { display: flex; align-items: center; gap: 10px; }

#yt-seek-label {
  color: #999;
  font-size: 13px;
  white-space: nowrap;
}

#yt-seek-bar { flex: 1; min-width: 0; }
#yt-seek-bar:disabled { opacity: 0.4; }

.yt-now-controls { display: flex; flex-wrap: wrap; gap: 6px; }

.yt-now-controls button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  font-size: 13px;
  cursor: pointer;
}

.yt-now-controls .yt-ctl-main { background: #2d6cdf; color: #fff; }
.yt-now-controls button:disabled { opacity: 0.35; cursor: default; }

.yt-listheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a2a2a;
  color: #bbb;
  font-size: 14px;
}

.yt-listheader-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

#yt-current-name {
  overflow: hidden;
  max-width: 200px;
  color: #888;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-view-btn {
  padding: 5px 9px;
  border: none;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  cursor: pointer;
}

.yt-view-btn.active { background: #2d6cdf; color: #fff; }

.yt-empty {
  margin: 20px 0;
  color: #777;
  font-style: italic;
  text-align: center;
}

.yt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #1b1b1b;
  cursor: grab;
}

.yt-item.playing { border-color: #2d6cdf; background: #1c2740; }
.yt-ghost { opacity: 0.4; }

.yt-item-content {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.yt-thumb {
  flex-shrink: 0;
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #111;
  object-fit: cover;
}

.yt-item-text { display: flex; flex-direction: column; min-width: 0; }
.yt-title { color: #eee; font-size: 14px; font-weight: 600; }

.yt-link {
  overflow: hidden;
  color: #777;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-item-actions { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }

.yt-play {
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  background: #1a73e8;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.yt-play:hover { background: #1557b0; }

.yt-del {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #8a8a8a;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.yt-del:hover {
  background: #b91c1c;
  color: #fff;
}

.yt-view-grid {
  display: grid;
  grid-template-columns: repeat(var(--yt-cols, 4), 1fr);
  gap: 12px;
}

.yt-view-grid .yt-item {
  flex-direction: column;
  margin-bottom: 0;
  padding: 8px;
  text-align: center;
}

.yt-view-grid .yt-item-content { flex-direction: column; width: 100%; gap: 6px; }
.yt-view-grid .yt-thumb { width: 100%; max-width: var(--yt-thumb, 128px); }
.yt-view-grid .yt-link { display: none; }

.yt-view-grid .yt-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.yt-view-grid .yt-item-actions { justify-content: center; width: 100%; }
.yt-view-grid .yt-play { padding: 4px 8px; font-size: 11px; }
.yt-view-grid .yt-empty { grid-column: 1 / -1; }

.yt-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.yt-page {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.yt-page.active { background: #2d6cdf; color: #fff; }
.yt-page:disabled { opacity: 0.4; cursor: not-allowed; }
.yt-page-info { color: #777; font-size: 12px; }

.yt-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.65);
}

.yt-modal.hidden { display: none; }

.yt-modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #333;
  border-radius: 12px;
  background: #1b1b1b;
}

.yt-modal-box h3 { margin: 0 0 12px; }

.yt-modal-box input[type="text"] {
  width: 100%;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #222;
  color: #eee;
}

.yt-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.yt-modal-actions .dlg-ok { background: #d98a0b; }

.yt-saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #262626;
  cursor: pointer;
}

.yt-saved-item:hover { background: #303030; }

.yt-saved-item button {
  margin-left: 10px;
  border: none;
  background: none;
  color: #ef4444;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  .yt-thumb { width: 96px; }
}

@media (max-width: 560px) {
  .yt-view-grid { grid-template-columns: repeat(2, 1fr); }
}

.yt-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.yt-topbar h1 {
  margin: 0;
  font-size: 26px;
  text-align: center;
}

.yt-back { justify-self: start; color: #7db3ff; }

@media (max-width: 700px) {
  .yt-topbar { grid-template-columns: 1fr; }
  .yt-topbar h1 { grid-row: 2; }
}

/* Cuadricula en pantallas anchas: tira de botones pegada al borde derecho de la tarjeta,
   con Lanzar (arriba) y quitar (abajo) ocupando cada uno la mitad del alto */
@media (min-width: 960px) {
  .yt-view-grid .yt-item {
    display: grid;
    grid-template-columns: 1fr 68px;
    grid-template-rows: auto 1fr;
    grid-template-areas: "thumb actions" "text actions";
    align-items: start;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
  }

  .yt-view-grid .yt-item.playing { box-shadow: 0 0 0 2px #2d6cdf; }

  .yt-view-grid .yt-item-content { display: contents; }

  .yt-view-grid .yt-thumb {
    grid-area: thumb;
    justify-self: start;
    width: var(--yt-thumb, 128px);
    max-width: calc(100% - 20px);
    margin: 10px 0 0 10px;
  }

  .yt-view-grid .yt-item-text {
    grid-area: text;
    align-self: center;
    width: 100%;
    padding: 8px 10px 10px;
  }

  .yt-view-grid .yt-item-actions {
    grid-area: actions;
    align-self: stretch;
    flex-direction: column;
    gap: 0;
    width: auto;
  }

  .yt-view-grid .yt-play,
  .yt-view-grid .yt-del {
    flex: 1;
    width: 100%;
    height: auto;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
  }

  .yt-view-grid .yt-del { font-size: 20px; }
}

/* Fila superior: campo de links + botones | reproductor | Proyector + Modo Presentacion */
.yt-top-row { margin-bottom: 10px; }

.yt-side-btns { display: flex; gap: 10px; margin-top: 12px; }
.yt-side-btns .admin-shortcut-btn { font-family: inherit; flex-shrink: 0; }
.yt-side-btns button.admin-shortcut-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.yt-side-btns button.admin-shortcut-btn:disabled:hover { background: #1b1b1b; border-color: #333; }
.yt-side-btns .admin-shortcut-label { line-height: 1.2; }

@media (min-width: 1100px) {
  .yt-top-row {
    display: grid;
    grid-template-columns: 630px minmax(0, 1fr); /* 630 = 4 botones de 150 + 3 huecos */
    gap: 16px;
    align-items: stretch;
  }

  .yt-input-col { display: flex; flex-direction: column; min-width: 0; }
  .yt-input-col #yt-links { flex: 1; resize: none; margin-bottom: 12px; }
  .yt-input-col .yt-toolbar { margin-bottom: 0; }
  .yt-top-row .yt-player { margin-bottom: 0; justify-content: space-between; }

  /* hasta 1299px los dos botones cuadrados van en una fila debajo */
  .yt-side-btns { grid-column: 1 / -1; margin-top: 0; }
}

/* desde 1300px: a la derecha del reproductor, uno tras otro */
@media (min-width: 1300px) {
  .yt-top-row { grid-template-columns: 630px minmax(0, 1fr) auto; }
  .yt-side-btns { grid-column: auto; align-self: center; }
}

/* Panel desplegable: tamaño de miniaturas y tarjetas */
.yt-size-toggle { white-space: nowrap; }

.yt-size-panel {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #1b1b1b;
}

.yt-size-panel.hidden { display: none; }
.yt-size-panel .yt-hint { margin-bottom: 8px; }

.yt-size-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 22px;
}

.yt-size-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  color: #ccc;
  font-size: 13px;
}

.yt-size-reset {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  font-size: 13px;
  cursor: pointer;
}

.yt-size-reset:hover { background: #444; }

/* Modo Presentacion: iluminado en verde cuando esta encendido */
.yt-side-btns button.admin-shortcut-btn.on {
  border-color: #10b981;
  background: #0d6b4d;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.55);
}

.yt-side-btns button.admin-shortcut-btn.on:hover { background: #0f7d5a; border-color: #34d399; }
.yt-side-btns button.admin-shortcut-btn.on .admin-shortcut-label { color: #fff; }

/* Menu desplegable de version de la Biblia */
.version-picker { position: relative; }

.version-picker > button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #333;
  color: #eee;
  cursor: pointer;
}

.version-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 300;
  width: 360px;
  max-width: 90vw;
  max-height: 70vh;
  margin-top: 6px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #333;
  border-radius: 10px;
  background: #1b1b1b;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}

.version-menu.hidden { display: none; }

.version-item {
  display: grid;
  grid-template-columns: 74px 1fr 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #ddd;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.version-item:hover { background: #262626; }
.version-item.active { background: #23324f; color: #fff; }
.version-item strong { color: #ffd700; }
.version-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-item em { color: #8a8a8a; font-style: normal; text-align: center; }
.version-item.active em { color: #6aa3ff; }

/* Abreviatura de la version junto a la referencia (proyeccion y vista previa) */
#bible-version::before { content: "· "; }
#bible-version {
  margin-left: 0.5em;
  font-size: 0.8em;
  font-weight: normal;
  opacity: 0.85;
}

.ref-version { margin-left: 0.5em; font-weight: normal; opacity: 0.85; }
.ref-version::before { content: "· "; }

/* --- Himnario --- */
.himnario-page { max-width: 1200px; margin: 0 auto; }
.hymn-folder-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#hymn-folder-info { font-size: 13px; color: #aaa; }
.hymn-note { font-size: 12px; color: #999; margin: 8px 0 0; }
.hymn-note:empty { display: none; }
.hymn-folder-box button.hidden,
.hymn-panel.hidden { display: none; }

.hymn-search-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.hymn-search-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 17px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1b1b1b;
  color: #eee;
}
.hymn-search-row input:focus { outline: none; border-color: #2d6cdf; }
#hymn-count { font-size: 13px; color: #999; white-space: nowrap; }

.hymn-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .hymn-layout { grid-template-columns: 380px minmax(0, 1fr); }
}

.hymn-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
@media (min-width: 900px) { .hymn-results { max-height: calc(100vh - 260px); } }

.hymn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #1b1b1b;
  color: #eee;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.hymn-row:hover { background: #23324f; border-color: #2d6cdf; }
.hymn-row.selected { background: #2d6cdf; border-color: #6aa3ff; }
.hymn-row .hn { font-weight: 700; color: #ffd700; min-width: 2.4em; font-variant-numeric: tabular-nums; }
.hymn-row.selected .hn { color: #fff; }
.hymn-row .ht { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hymn-row .hc { font-size: 12px; color: #999; white-space: nowrap; }
.hymn-row.selected .hc { color: #dbe7ff; }

.hymn-panel { background: #1b1b1b; border-radius: 10px; padding: 14px; }
.hymn-panel h2 { margin: 0 0 10px; font-size: 20px; }
.hymn-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.hymn-controls button { padding: 9px 14px; font-size: 14px; }
.hymn-controls button:not(.btn-launch) { border: 1px solid #333; border-radius: 6px; background: #262626; color: #eee; cursor: pointer; }
.hymn-controls button:not(.btn-launch):hover:not(:disabled) { background: #303a52; border-color: #2d6cdf; }
.hymn-controls button:disabled { opacity: 0.4; cursor: not-allowed; }

.hymn-slides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.hymn-slide {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 2px solid #333;
  border-radius: 8px;
  background: #262626;
  color: #eee;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}
.hymn-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hymn-slide:hover { border-color: #2d6cdf; }
.hymn-slide.on { border-color: #10b981; box-shadow: 0 0 12px rgba(16, 185, 129, 0.6); }
.hymn-slide-num {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 13px;
  text-align: center;
}
.hymn-slide:not(:has(img)) .hymn-slide-num { position: static; background: none; font-size: 24px; }

.hymn-warn { margin: 8px 0 0; padding: 8px 12px; border-radius: 6px; background: #4a3512; color: #ffd28a; font-size: 13px; }
.hymn-warn:empty { display: none; }

.hymn-slide.bad { border-style: dashed; border-color: #b45309; }

/* Historial de fotos y videos (Administrar contenido) */
.history-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #151515;
}
.history-thumb {
  flex: 0 0 96px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: #262626;
  font-size: 24px;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #999; }
.history-info strong { color: #eee; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-info a { color: #7db3ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-keep { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #ccc; white-space: nowrap; cursor: pointer; }
.history-row .history-del { padding: 6px 10px; border: 1px solid #333; border-radius: 6px; background: #262626; cursor: pointer; }
.history-row .history-del:hover { background: #5a2323; border-color: #a33; }
#history-clear:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 600px) {
  .history-row { flex-wrap: wrap; }
  .history-thumb { flex-basis: 80px; }
}

/* Anuncios: crear carpetas y copiar archivos */
.ann-new-row { margin-top: 12px; }
.ann-new-row input {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #151515;
  color: #eee;
  font-size: 14px;
}
.ann-new-row input:focus { outline: none; border-color: #2d6cdf; }
.ann-new-row button:disabled, .hymn-controls button:disabled { opacity: 0.45; cursor: not-allowed; }
.ann-drop { transition: outline-color 0.1s; outline: 2px dashed transparent; outline-offset: 4px; }
.ann-drop.over { outline-color: #2d6cdf; background: #1d2740; }
.hymn-slide-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  line-height: 20px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.75);
  color: #ddd;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
}
.hymn-slide:hover .hymn-slide-del, .hymn-slide:focus-within .hymn-slide-del { opacity: 1; }
.hymn-slide-del:hover { background: #a33; color: #fff; }
@media (hover: none) { .hymn-slide-del { opacity: 1; } }

/* Anuncios: renombrar/borrar carpeta, reordenar arrastrando */
.dlg-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #151515;
  color: #eee;
  font-size: 15px;
}
.dlg-input:focus { outline: none; border-color: #2d6cdf; }
.dlg-ok.dlg-ok-primary { background: #2d6cdf; }
.hymn-controls button.ann-danger { color: #f0a0a0; }
.hymn-controls button.ann-danger:hover:not(:disabled) { background: #5a2323; border-color: #a33; }
.hymn-slide[draggable="true"] { cursor: grab; }
.hymn-slide.dragging { opacity: 0.35; }
.hymn-slide.drop-before { box-shadow: -6px 0 0 0 #2d6cdf; }
.hymn-slide.drop-after { box-shadow: 6px 0 0 0 #2d6cdf; }
.hymn-slide-mv {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.1s;
}
.hymn-slide-mv span {
  width: 22px;
  height: 22px;
  line-height: 20px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.75);
  color: #ddd;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
}
.hymn-slide-mv span:hover { background: #2d6cdf; color: #fff; }
.hymn-slide:hover .hymn-slide-mv, .hymn-slide:focus-within .hymn-slide-mv { opacity: 1; }
@media (hover: none) { .hymn-slide-mv { opacity: 1; } }

/* Cabecera de Himnario y Anuncios: titulo a la izquierda, boton Proyector a la derecha */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.page-head h1 { margin-top: 8px; }
