/* ============ TEMAS (claro y oscuro) ============
   Todos los colores de la app salen de estas variables. El tema oscuro se
   activa poniendo data-theme="dark" en la etiqueta <html> (lo hace el botón
   de la cabecera). Si añades algo nuevo, usa siempre una variable de aquí
   en vez de escribir un color a mano: así sigue funcionando en los dos temas. */
:root {
    color-scheme: light;

    --primary-color: #0f2939;
    --primary-hover: #0a1d29;
    --on-primary: #ffffff;
    --accent-color: #c8952f;
    /* Dorado de la marca: el mismo del punto de la "i" y de la estrella del
       logo. No cambia entre temas a propósito — es color de identidad, no de
       interfaz, y solo aparece en detalles pequeños. */
    --brand-gold: #e5bd72;

    --secondary-color: #6b7280;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #d97706;

    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-card: #ffffff;
    --splash-bg: #f8f4ea;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --border-color: #e5e7eb;
    --border-hover: #d1d5db;

    --chord-color: #0f2939;
    --chord-input-bg: rgba(17, 24, 39, 0.03);
    --overlay-bg: rgba(0, 0, 0, 0.3);
    --tag-danger-hover: #fecaca;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --mono-font: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    /* Letra de toda la app. Los acordes y la letra de las canciones siguen en
       monoespaciada para que cada acorde quede encima de su sílaba. */
    --ui-font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
    color-scheme: dark;

    /* En oscuro el azul noche del logo no se ve sobre el fondo, así que los
       botones usan el mismo turquesa del logo pero aclarado (mismo tono, 198°).
       El dorado NO se usa para botones: queda reservado a los detalles de
       identidad y a los acordes, que es donde de verdad significa algo. */
    --primary-color: #6eb2cf;
    --primary-hover: #8cc3db;
    --on-primary: #0e1922;
    --accent-color: #e5bd72;
    --brand-gold: #e5bd72;

    --secondary-color: #94a3b8;
    --success-color: #4ade80;
    --danger-color: #f87171;
    --warning-color: #fbbf24;

    --bg-primary: #0e1922;
    --bg-secondary: #16242f;
    --bg-tertiary: #1e3242;
    --bg-card: #16242f;
    --splash-bg: #0e1922;

    --text-primary: #e8eef3;
    --text-secondary: #a9bac6;
    --text-muted: #7b8c99;

    --border-color: #27394a;
    --border-hover: #3a5165;

    --chord-color: #e5bd72;
    --chord-input-bg: rgba(229, 189, 114, 0.06);
    --overlay-bg: rgba(0, 0, 0, 0.45);
    --tag-danger-hover: #7f1d1d;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 1px 2px -1px rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { max-width: 100%; }
body { max-width: 100%; overflow-x: hidden; }

body {
    font-family: var(--ui-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

.header {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section { display: flex; align-items: center; gap: 0.75rem; transition: opacity 0.2s; }
.logo-section:hover { opacity: 0.7; }
.logo-img { width: 52px; height: 52px; object-fit: contain; display: block; }
/* El nombre de la marca usa la misma letra geométrica que el logo. La "i" va sin
   punto (carácter ı) y el punto se dibuja aparte en dorado, como en el logo. Si
   Poppins no llegara a cargar, cae en la letra del sistema y se sigue leyendo. */
.logo-text {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
/* La "i" lleva caja propia (inline-block) para que el punto se coloque siempre
   igual: si no, cada navegador calcula la altura de la línea a su manera y el
   punto acaba en un sitio distinto, o fuera de la vista. */
.logo-i { position: relative; display: inline-block; line-height: 1; }
.logo-i::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -0.22em;
    transform: translateX(-50%);
    width: 0.14em;
    height: 0.14em;
    border-radius: 50%;
    background: var(--brand-gold);
}

/* Botón de cambio de tema (luna / sol) */
.btn-theme { padding: 0.375rem 0.6rem; }
.btn-theme svg { display: block; }

.nav-tabs { display: flex; gap: 0.5rem; }

.nav-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}
.nav-tab:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-tab.active { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }

.app-container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; overflow-x: hidden; overflow-x: clip; }
.view { display: none; }
.view.active { display: block; }

.songs-container { max-width: 800px; margin: 0 auto; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title { font-size: 2rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }

.btn-add-song {
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.875rem;
}
.btn-add-song:hover { background: var(--primary-hover); }

.search-container { margin-bottom: 2rem; }

.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.search-box:focus { outline: none; border-color: var(--primary-color); }

/* El buscador lleva la cruz DENTRO, así que necesita caja propia y hueco a la
   derecha para que el texto no pase por debajo del botón. */
.search-field { position: relative; flex: 1; min-width: 200px; }
.search-field .search-box { width: 100%; padding-right: 2.6rem; }
.search-clear {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.35rem 0.45rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
}
.search-clear:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.search-clear[hidden] { display: none; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}
.empty-state h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); }

.songs-grid {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: none;
}

.song-item {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    border: none;
    box-shadow: none;
}
.song-item:hover { background: var(--bg-tertiary); }

.song-info { flex: 1; min-width: 0; }
.song-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-vocal-select {
    margin-top: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    max-width: 220px;
}

.lead-vocal-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.lv-hidden { display: none !important; }

.lead-vocal-reader-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

.reader-lead-vocal {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    background: #7c3aed;
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
    margin-right: 0.5rem;
}

#convocados-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}
.convocado-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
}
.convocado-chip .instrumento { font-weight: 700; }
.convocado-chip .persona { color: var(--text-secondary); }

.convocatoria-role {
    border-bottom: 1px solid var(--border-color);
    padding: 0.4rem 0;
}
.convocatoria-role:last-child { border-bottom: none; }
.convocatoria-role summary {
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.4rem 0.2rem;
    list-style: none;
    user-select: none;
}
.convocatoria-role summary::-webkit-details-marker { display: none; }
.convocatoria-role summary::before { content: '▸ '; display: inline-block; width: 1rem; }
.convocatoria-role[open] summary::before { content: '▾ '; }
.convocatoria-role-body { padding: 0.5rem 0.2rem 0.3rem 1.2rem; }
.convocatoria-name-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.convocatoria-name-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s;
}
.convocatoria-name-btn:hover { background: var(--bg-tertiary); }
.convocatoria-name-btn.added { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }
.convocatoria-selected { display: flex; flex-wrap: wrap; gap: 0.35rem; min-height: 1.6rem; }
.convocatoria-selected-tag {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.12s;
}
.convocatoria-selected-tag:hover { background: var(--tag-danger-hover); }
.convocatoria-empty { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

.song-block-note {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.35rem;
    white-space: normal;
    line-height: 1.35;
}

.song-actions { display: flex; gap: 0.5rem; margin-left: 1rem; flex-shrink: 0; }

.action-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.action-btn:hover { background: var(--bg-tertiary); border-color: var(--border-color); }
.edit-btn:hover { color: var(--primary-color); background: var(--bg-tertiary); border-color: var(--border-hover); }
.delete-btn:hover { color: var(--danger-color); background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.3); }
.note-btn:hover { color: #a78bfa; background: rgba(124, 58, 237, 0.12); border-color: rgba(124, 58, 237, 0.3); }
.note-btn.has-note { color: #a78bfa; }

.song-reader { max-width: 1100px; margin: 0 auto; }

.reader-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.reader-block-note {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
    line-height: 1.4;
}

.reader-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.reader-title-row .reader-title { margin-bottom: 0; }
.reader-title { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
#setlist-nav-controls {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.btn-icon-nav {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    color: var(--text-primary);
    transition: background 0.15s;
}
.btn-icon-nav:hover:not(:disabled) { background: var(--bg-tertiary); }
.btn-icon-nav:disabled { opacity: 0.3; cursor: not-allowed; }
#setlist-position-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.reader-meta { color: var(--text-secondary); font-size: 1rem; margin-bottom: 0.5rem; }
.reader-extra-info { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
.reader-controls { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.control-group { display: flex; align-items: center; gap: 0.4rem; }

.control-divider {
    width: 1px;
    align-self: stretch;
    min-height: 1.75rem;
    background: var(--border-color);
    margin: 0 0.15rem;
}

.control-icon { font-size: 0.95rem; opacity: 0.75; }

.transpose-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.font-size-controls { display: flex; align-items: center; gap: 0.35rem; }

.transpose-btn {
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.transpose-btn:hover { background: var(--primary-hover); }

.current-key {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    min-width: 3rem;
    text-align: center;
    font-family: var(--mono-font);
}

.song-body-layout { display: flex; gap: 0.85rem; align-items: flex-start; }

.song-content {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
    font-family: var(--mono-font);
    line-height: 1.3;
    max-width: 100%;
    overflow-x: hidden;
}

.song-structure-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.85rem;
    overflow: hidden;
}

.song-structure-bar.pinned {
    position: fixed;
    top: var(--structure-bar-top, 0.5rem);
    left: 0.5rem;
    right: 0.5rem;
    max-width: 1080px;
    margin: 0 auto;
    z-index: 80;
    box-shadow: var(--shadow-md);
}

.structure-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    overflow: visible;
}

body.fullscreen-active .structure-bar-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
body.fullscreen-active .structure-bar-inner::-webkit-scrollbar { display: none; }

.structure-chip {
    flex-shrink: 0;
    color: white;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
    line-height: 1.3;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
}
.structure-chip:active { filter: brightness(0.9); }

.section { margin-bottom: 1.25rem; }
.section:last-child { margin-bottom: 0; }
.section-label {
    background: var(--primary-color);
    color: var(--on-primary);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 0.6rem;
    display: inline-block;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}
.section-label.inline-label { margin: 0.35rem 0 0.35rem; }

.pair { margin-bottom: 0.5rem; max-width: 100%; }
.chord-line { color: var(--chord-color); font-weight: 700; white-space: pre; margin-bottom: 0.1rem; font-size: 0.95em; transition: all 0.2s; }
.lyric-line { color: var(--text-primary); white-space: pre; font-size: 1em; transition: all 0.2s; }

.song-content.voice-mode .chord-line { display: none; }
.song-content.voice-mode .lyric-line { font-size: 1.25em; font-weight: 500; line-height: 1.7; }
.song-content.voice-mode .pair { margin-bottom: 0.65rem; }

.editor-container { display: flex; gap: 2rem; height: calc(100vh - 200px); min-height: 600px; }

.editor-sidebar {
    width: 250px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
}
.sidebar-section { margin-bottom: 2rem; }
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }

/* Aviso en la barra lateral cuando hay partes escritas dentro de otra sección. */
.outline-hint {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.outline-hint-text { font-size: 0.78rem; line-height: 1.4; color: var(--text-secondary); }
.outline-hint strong { color: var(--text-primary); }
.outline-hint .btn-xs { align-self: flex-start; }
.btn-split { border-color: var(--border-hover); }

.outline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}
.outline-item:hover { background: var(--bg-tertiary); }
.outline-name {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.outline-count { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.outline-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }
.outline-actions .btn-xs { padding: 0.1rem 0.35rem; line-height: 1.2; }
.outline-actions .btn-xs:disabled { opacity: 0.25; cursor: default; }
.outline-actions .btn-xs:disabled:hover { background: var(--bg-card); border-color: var(--border-color); }

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.toolbar-left { display: flex; align-items: center; gap: 1rem; }
.toolbar-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chips-container { display: flex; gap: 0.5rem; }

.chip {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.save-indicator { font-size: 0.75rem; color: var(--success-color); font-weight: 500; }
.save-indicator.unsaved { color: var(--warning-color); }

.editor-content { flex: 1; padding: 1.5rem; overflow-y: auto; }

.section-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.section-header-editor { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.5rem; }

.section-label-input {
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}
.section-label-input:focus { outline: none; box-shadow: 0 0 0 2px var(--border-hover); }
.section-actions { display: flex; gap: 0.5rem; }

.pair-editor { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.pair-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.pair-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }
.pair-actions { display: flex; gap: 0.25rem; }

.chord-input, .lyric-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: var(--mono-font);
    background: var(--bg-card);
    color: var(--text-primary);
    resize: vertical;
    min-height: 2.5rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}
.chord-input:focus, .lyric-input:focus { outline: none; border-color: var(--primary-color); }
.chord-input { background: var(--chord-input-bg); color: var(--chord-color); }

.btn, .btn-sm, .btn-xs {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.btn:hover, .btn-sm:hover, .btn-xs:hover { background: var(--bg-tertiary); border-color: var(--border-hover); }

.btn.active-mode { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }

.btn-primary { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-danger { background: var(--danger-color); color: #ffffff; border-color: var(--danger-color); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; border-radius: 4px; }

.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-primary); font-size: 0.875rem; }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary-color); }
.form-textarea { min-height: 200px; resize: vertical; font-family: var(--mono-font); line-height: 1.6; }

/* Botones con las partes de la canción, dentro de la ventana del orden. */
.structure-picker-hint { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.structure-picker { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.structure-pick {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.12s;
}
.structure-pick:hover { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    /* La barra de título es el asa para mover la ventana. */
    cursor: move;
    user-select: none;
    touch-action: none;
}

/* Mientras se arrastra, el fondo se aclara del todo para ver lo que hay detrás. */
.modal-overlay.dragging { background: transparent; }
.modal-overlay.dragging .modal { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); }
.modal-title { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.modal-content { padding: 1.5rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1.5rem; border-top: 1px solid var(--border-color); flex-shrink: 0; }

.youtube-inline-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}
.youtube-inline-btn:hover { text-decoration: underline; }

.youtube-embed-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* proporción 16:9 */
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.youtube-embed-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.youtube-mini-player {
    position: fixed;
    top: max(0.6rem, env(safe-area-inset-top));
    left: 0.6rem;
    width: 46vw;
    max-width: 220px;
    min-width: 150px;
    z-index: 950;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    overflow: visible;
}
.youtube-mini-iframe-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.youtube-mini-iframe-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.yt-mini-close {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    z-index: 951;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--on-primary);
    border: 2px solid var(--bg-card);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: var(--shadow-md);
}

.metronome-popup {
    position: fixed;
    top: max(4.5rem, calc(env(safe-area-inset-top) + 4rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 950;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 1.1rem 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    min-width: 160px;
}
.metronome-bpm { font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.metronome-dots { display: flex; gap: 0.4rem; }
.metronome-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--border-color);
    transition: background 0.05s, transform 0.05s;
}
.metronome-dot.active { background: var(--primary-color); transform: scale(1.3); }
.metronome-toggle-btn {
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.metronome-toggle-btn:hover { background: var(--primary-hover); }
.reader-bpm-clickable {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

.import-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.import-preview-item input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.import-preview-info { flex: 1; min-width: 0; }
.import-preview-title { font-weight: 600; font-size: 0.9rem; }
.import-preview-meta { font-size: 0.75rem; color: var(--text-muted); }

#btn-fullscreen-exit {
    display: none;
    position: fixed;
    top: max(0.5rem, env(safe-area-inset-top));
    right: 0.5rem;
    z-index: 900;
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s;
    padding: 0;
}

.teleprompter-controls {
    display: none;
    position: fixed;
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    align-items: center;
    gap: 0.6rem;
    background: rgba(14, 25, 34, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0.5rem;
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
}
.tp-icon-btn {
    background: transparent;
    border: none;
    color: white;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}
.tp-icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.tp-icon-btn-main {
    background: var(--primary-color);
    color: var(--on-primary);
    width: 2.6rem;
    height: 2.6rem;
}
.tp-icon-btn-main:hover { background: var(--primary-hover); }

body.fullscreen-active .header,
body.fullscreen-active #btn-back-to-list,
body.fullscreen-active .transpose-controls,
body.fullscreen-active .lead-vocal-controls,
body.fullscreen-active .font-size-controls,
body.fullscreen-active #btn-toggle-notation,
body.fullscreen-active #btn-voice-mode,
body.fullscreen-active #btn-song-structure-setlist,
body.fullscreen-active #btn-setlist-version,
body.fullscreen-active .version-revert-btn,
body.fullscreen-active #btn-fullscreen-toggle,
body.fullscreen-active #btn-edit-song,
body.fullscreen-active .reader-more-wrap,
body.fullscreen-active .reader-extra-info {
    display: none !important;
}

body.fullscreen-active .reader-lead-vocal { font-size: 0.72rem; padding: 0.2rem 0.6rem; }

body.fullscreen-active #btn-fullscreen-exit { display: inline-flex; align-items: center; justify-content: center; }
body.fullscreen-active .app-container { padding: 0.5rem; max-width: 100%; }
body.fullscreen-active .song-reader { max-width: 100%; }
body.fullscreen-active .reader-header {
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.4rem;
    box-shadow: none;
    border-radius: 10px;
    padding-right: 3.2rem;
}
body.fullscreen-active .reader-title { font-size: 1.3rem; margin-bottom: 0.1rem; }
body.fullscreen-active .reader-meta { margin-bottom: 0; font-size: 0.85rem; }
body.fullscreen-active .reader-block-note { font-size: 0.72rem; padding: 0.2rem 0.5rem; margin-bottom: 0.5rem; }
body.fullscreen-active .song-structure-bar {
    padding: 0.3rem 0.5rem;
    margin-bottom: 0.5rem;
}

body.fullscreen-active .song-content { padding: 0.85rem 1.1rem calc(5.5rem + env(safe-area-inset-bottom)) 1.1rem; }

@media (max-width: 768px) {
    .app-container { padding: 0.75rem 0.5rem; }
    /* Tres filas (logo / pestañas / tema y sesión) eran demasiado alto en un
       móvil. Con "display: contents" el bloque derecho desaparece como caja y
       sus hijos pasan a colocarse solos: las pestañas suben junto al logo, y
       tema y sesión se quedan con una fila propia debajo. */
    .header-content { padding: 0 0.5rem; flex-wrap: wrap; column-gap: 0.5rem; row-gap: 0.5rem; }
    .header-right { display: contents; }
    .header-right > nav { margin-left: auto; }
    .auth-section { flex-basis: 100%; justify-content: flex-end; }
    .logo-img { width: 36px; height: 36px; }
    .logo-text { font-size: 1rem; }
    .logo-section { gap: 0.5rem; }
    .nav-tabs { gap: 0.35rem; }
    .nav-tab { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
    .auth-section { font-size: 0.75rem; }
    #user-email-label { display: none !important; }
    .control-divider { display: none; }
    .reader-controls > .control-group:not(.font-size-controls) { display: contents; }

    .song-item { padding: 0.7rem 1rem; min-height: auto; }
    .song-title { font-size: 1rem; }
    .song-meta { font-size: 0.78rem; }
    .section-title { font-size: 1.4rem; }
    .btn-add-song { padding: 0.6rem 1rem; font-size: 0.8rem; }

    .reader-header { padding: 0.85rem 1rem; margin-bottom: 0.6rem; border-radius: 10px; }
    .reader-title { font-size: 1.25rem; margin-bottom: 0.15rem; }
    .reader-meta { font-size: 0.8rem; margin-bottom: 0.3rem; }
    .reader-block-note { font-size: 0.75rem; padding: 0.25rem 0.6rem; margin-bottom: 0.6rem; }
    .reader-extra-info { font-size: 0.8rem; margin-bottom: 0.6rem; }
    #btn-back-to-list { padding: 0.35rem 0.7rem; font-size: 0.78rem; margin-bottom: 0.5rem; }

    #setlist-nav-controls { padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
    #setlist-nav-controls .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

    .reader-controls { gap: 0.5rem; }
    .transpose-controls { padding: 0.4rem 0.6rem; gap: 0.35rem; }
    .lead-vocal-controls { padding: 0.4rem 0.6rem; gap: 0.35rem; }
    .lead-vocal-reader-select { padding: 0.3rem 0.4rem; font-size: 0.78rem; }
    .lead-vocal-select { font-size: 0.75rem; padding: 0.25rem 0.4rem; }
    .transpose-btn { width: 1.6rem; height: 1.6rem; font-size: 0.85rem; }
    .current-key { padding: 0.3rem 0.6rem; min-width: 2.2rem; font-size: 0.85rem; }
    .reader-controls .btn-sm, .reader-controls .btn-primary { padding: 0.4rem 0.7rem; font-size: 0.78rem; }

    .song-structure-bar { padding: 0.35rem 0.5rem; margin-bottom: 0.6rem; }

    .song-content { padding: 0.85rem 1rem; border-radius: 10px; line-height: 1.25; }
    .section { margin-bottom: 0.9rem; }
    .section-label { padding: 0.25rem 0.6rem; font-size: 0.75rem; margin-bottom: 0.45rem; }

    .chord-line, .lyric-line { white-space: pre-wrap; word-break: break-word; font-size: 0.85em; }
    .chord-line { margin-bottom: 0.05rem; }
    .song-content.voice-mode .lyric-line { font-size: 1.15em; }

    .pair { margin-bottom: 0.4rem; }

    .song-item { padding: 1rem; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .song-actions { margin-left: 0; align-self: flex-end; }
    .editor-container { flex-direction: column; height: auto; }
    .editor-sidebar { width: 100%; order: 1; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; }
    .chips-container { display: none; }
    .section-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
    .section-header-inline { flex-direction: row; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }

    /* Detalle del repertorio: lo de preparar ocupa menos, y las canciones más. */
    #view-repertorio-detail .section-header { gap: 0.6rem; margin-bottom: 1rem; }
    #btn-back-to-repertorios { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
    #view-repertorio-detail .section-header .btn { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
    #setlist-name-input { font-size: 1.3rem !important; }
    #setlist-songs-list .song-item { padding: 0.75rem 1rem; gap: 0.3rem; }
    #setlist-songs-list .song-title { font-size: 0.98rem; }
    .convocado-chip { font-size: 0.72rem; padding: 0.1rem 0.5rem; }
}
/* Bloque derecho de la cabecera (pestañas + tema + sesión). En escritorio va
   todo en línea; en móvil se reparte (ver la media query del final). */
.header-right { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

/* Cabecera de sección que NO se parte en dos filas en móvil: el título a la
   izquierda y un único botón a la derecha. La de "Canciones" no la usa porque
   allí hay varios botones y sí necesitan su propia fila. */
.section-header-inline { flex-wrap: nowrap; align-items: center; }
.btn-add-compact { flex-shrink: 0; }

/* En la lista de un repertorio la línea de datos lleva tonalidad, BPM y vídeo:
   se deja partir en dos líneas en vez de cortarse con puntos suspensivos, y los
   dos elementos pulsables se separan un poco para no fallar el dedo. */
#setlist-songs-list .song-meta {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.8;
}
#setlist-songs-list .reader-bpm-clickable,
#setlist-songs-list .youtube-inline-btn { padding: 0.15rem 0.2rem; }

/* ============ DETALLE DEL REPERTORIO ============
   Los botones de reordenar y borrar solo se ven en "Editar lista": el resto del
   tiempo la pantalla es la lista de canciones, que es para lo que se abre. */
#setlist-songs-list:not(.edit-mode) .song-actions { display: none; }

/* Título a la izquierda, opciones detrás de un icono a la derecha. */
/* Fila superior del repertorio: "Volver" a la izquierda, menú a la derecha. */
.setlist-topbar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.btn-icon-menu { padding: 0.4rem 0.55rem; line-height: 0; }
.btn-icon-menu svg { display: block; }
.setlist-menu-wrap { position: relative; flex-shrink: 0; }

.setlist-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 120;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 15rem;
}
.setlist-menu[hidden] { display: none; }
.setlist-menu .btn-sm { justify-content: flex-start; border-color: transparent; background: transparent; }
.setlist-menu .btn-sm:hover { background: var(--bg-tertiary); border-color: var(--border-color); }
/* Sin esto, el estado activo dejaba el texto blanco sobre el fondo blanco del
   menú: el botón seguía ahí pero no se veía. */
.setlist-menu .btn-sm.active-mode {
    background: var(--primary-color);
    color: var(--on-primary);
    border-color: var(--primary-color);
}

/* Barra de "estás editando la lista", con la salida siempre a la vista. */
.setlist-edit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.setlist-edit-bar[hidden] { display: none; }

/* La convocatoria se consulta una vez: va plegada en una línea. */

/* El desplegable de voz se ve como una etiqueta tranquila; sigue siendo un
   desplegable normal al tocarlo. */
#setlist-songs-list .lead-vocal-select {
    margin-top: 0.3rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
    background: var(--bg-tertiary);
    border-color: transparent;
    border-radius: 999px;
}
#setlist-songs-list .lead-vocal-select:focus { border-color: var(--primary-color); }

/* La convocatoria pasa a una línea densa de etiquetas pequeñas: se sigue viendo
   entera, pero ocupa la mitad. */
#convocados-display { gap: 0.3rem; }
.convocado-chip { font-size: 0.75rem; padding: 0.15rem 0.55rem; }

/* ============ TARJETA DE REPERTORIO ============
   A diferencia de las canciones, aquí la papelera se queda pegada al título
   (misma fila, tamaño reducido) en vez de bajar a una fila propia: era lo único
   pulsable de la tarjeta y quedaba justo donde cae el pulgar. */
.setlist-item .btn-delete-compact { padding: 0.3rem; }

/* Las primeras canciones, en una línea que se corta con puntos suspensivos. */
.setlist-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.15rem;
}
.setlist-item .song-meta { font-size: 0.76rem; color: var(--text-muted); }

@media (max-width: 768px) {
    .setlist-item { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.85rem 1rem; }
    .setlist-item .song-actions { margin-left: 0.5rem; align-self: center; }
}

/* ============ BOTÓN FLOTANTE DE GUARDAR (solo en edición) ============ */
.btn-save-floating {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 880;
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.btn-save-floating:hover { background: var(--primary-hover); }
.btn-save-floating .save-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--warning-color);
    display: none;
}
.btn-save-floating.unsaved .save-dot { display: block; }

/* Hueco al final para que el botón no tape el último campo del editor. */
#view-edicion { padding-bottom: 5rem; }

/* Franja de "sin conexión". Va arriba del todo y por encima de casi todo,
   menos de los modales, para que no se pierda de vista. */
#offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 960;
    padding: calc(0.4rem + env(safe-area-inset-top, 0px)) 0.75rem 0.4rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--warning-color);
}
#offline-banner[hidden] { display: none; }

/* ============ PANTALLA DE CARGA (SPLASH) ============ */
#app-splash {
    position: fixed;
    inset: 0;
    background: var(--splash-bg);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

#app-splash { flex-direction: column; gap: 18px; }
.splash-status { text-align: center; padding: 0 24px; max-width: 340px; color: var(--text-secondary, #6b7a86); font-size: 0.95rem; }
.splash-status p { margin: 0 0 12px; }

#app-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    width: 200px;
    height: auto;
    object-fit: contain;
    animation: splash-pulse 1.4s ease-in-out infinite;
}

/* En claro se ve la versión con fondo crema; en oscuro, la transparente. */
.splash-logo-dark { display: none; }
[data-theme="dark"] .splash-logo-light { display: none; }
[data-theme="dark"] .splash-logo-dark { display: block; }

@keyframes splash-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.95); }
}
/* ============ PANTALLAS DE ENTRADA (Google + equipo) ============
   Mientras no se ha entrado, la app está "bloqueada" (body.gated): se
   esconden las pestañas y el cierre de sesión de la cabecera, y solo se ve
   la tarjeta de entrada. */
body.gated .header-right nav,
body.gated #btn-logout,
body.gated #user-email-label { display: none !important; }

.auth-card {
    max-width: 420px;
    margin: 2.5rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 2rem 1.5rem;
    text-align: center;
}
.auth-card-wide { max-width: 520px; text-align: left; }
.auth-logo { width: 88px; height: 88px; object-fit: contain; display: block; margin: 0 auto 0.75rem; }
.auth-title {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.auth-title-sm { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.35rem; }
.auth-tagline { color: var(--text-secondary); margin: 0.35rem 0 1.5rem; line-height: 1.45; }
.btn-google { width: 100%; padding: 0.8rem 1rem; font-size: 1rem; gap: 0.6rem; }
.btn-google svg { background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }
.auth-note { min-height: 1.2rem; margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; }
.auth-note.error { color: var(--danger-color); font-weight: 600; }

.onb-field { margin-bottom: 1.25rem; }
.onb-block { margin-bottom: 0.25rem; }
.onb-block-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; }
.onb-help { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.onb-row { display: flex; gap: 0.5rem; }
.onb-row .form-input { flex: 1; min-width: 0; }
.onb-row .btn { flex-shrink: 0; }
.onb-code { text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono-font); font-weight: 700; }
.onb-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.onb-divider::before, .onb-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.onb-logout { margin-top: 0.5rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ============ PANTALLA DE EQUIPO ============ */
.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.team-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.team-code {
    font-family: var(--mono-font);
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    user-select: all;
}
.team-hint { font-size: 0.85rem; color: var(--text-secondary); margin: 0.4rem 0 0.75rem; line-height: 1.4; }
.team-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.team-me { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-size: 1.05rem; }

.team-members { display: flex; flex-direction: column; }
.team-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--border-color);
}
.team-member:first-child { border-top: none; }
.team-member-info { min-width: 0; }
.team-member-name { font-weight: 600; color: var(--text-primary); }
.team-member-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.2rem; }
.team-member-email { font-size: 0.78rem; color: var(--text-muted); word-break: break-all; }
.team-member-actions { display: flex; gap: 0.4rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.role-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.role-badge.role-lider { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); }
.role-badge.role-director { background: rgba(124, 58, 237, 0.12); color: #7c3aed; border-color: rgba(124, 58, 237, 0.35); }
[data-theme="dark"] .role-badge.role-director { color: #c4b5fd; }

.btn-danger-outline { color: var(--danger-color); border-color: rgba(220, 38, 38, 0.35); }
.btn-danger-outline:hover { background: rgba(220, 38, 38, 0.1); border-color: var(--danger-color); color: var(--danger-color); }

/* Voz líder en la lista, para quien no gestiona el repertorio (solo lectura). */
.lead-vocal-tag {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
/* Nombre del repertorio bloqueado para quien no lo gestiona. */
#setlist-name-input[readonly] { cursor: default; }

@media (max-width: 768px) {
    .auth-card { margin: 1rem auto; padding: 1.5rem 1.1rem; }
    .onb-row { flex-direction: column; }
    .team-member { flex-direction: column; align-items: flex-start; }
    .team-member-actions { justify-content: flex-start; }
    .team-code { font-size: 1.6rem; }
}

/* Aclaración debajo del campo del nombre en la pantalla de entrada. */
.onb-help-below { margin: 0.45rem 0 0; line-height: 1.4; }

/* ============ APROBACIÓN DE EQUIPOS ============ */
#pending-banner {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
}
#pending-banner[hidden] { display: none; }
.team-card-pending { border-color: var(--warning-color); }
.role-badge.role-pending { background: rgba(217, 119, 6, 0.12); color: var(--warning-color); border-color: rgba(217, 119, 6, 0.4); }
.role-badge.role-approved { background: rgba(22, 163, 74, 0.12); color: var(--success-color); border-color: rgba(22, 163, 74, 0.4); }
.btn-attention { border-color: var(--warning-color); color: var(--warning-color); font-weight: 700; }

/* Línea de créditos al final de cada canción (solo si tiene datos). */
.song-credits {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-family: var(--ui-font);
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-muted);
    white-space: normal;
}

/* ============ VERSIÓN PROPIA EN UN REPERTORIO ============ */
.reader-version-note {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #b45309;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.35);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    margin-right: 0.5rem;
}
[data-theme="dark"] .reader-version-note { color: #fbbf24; }
.version-revert-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.version-tag { color: #b45309; font-weight: 600; }
[data-theme="dark"] .version-tag { color: #fbbf24; }

/* ============ EDITOR A PANTALLA COMPLETA ============ */
body.ve-open { overflow: hidden; }
.version-editor {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1100;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
}
.ve-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}
.ve-bar .btn { padding: 0.5rem 0.9rem; font-size: 0.9rem; flex-shrink: 0; }
.ve-title { flex: 1; min-width: 0; text-align: center; }
.ve-title-main { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ve-title-sub { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ve-tools {
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ve-tools::-webkit-scrollbar { display: none; }
.ve-chip {
    flex-shrink: 0;
    min-width: 2.6rem;
    height: 2.4rem;
    padding: 0 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--chord-color);
    font-family: var(--mono-font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    touch-action: manipulation;
}
.ve-chip:active { background: var(--bg-tertiary); }
.ve-chip-section { font-family: inherit; color: var(--text-primary); font-weight: 600; font-size: 0.85rem; }
.ve-sep { flex-shrink: 0; width: 1px; background: var(--border-color); margin: 0.2rem 0.15rem; }
.ve-text {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 0.9rem 0.9rem 2rem;
    font-family: var(--mono-font);
    font-size: 16px;
    line-height: 1.5;
    white-space: pre;
    overflow: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-overflow-scrolling: touch;
    tab-size: 4;
}
.ve-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.75rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.ve-link {
    background: none;
    border: none;
    color: var(--danger-color);
    font-weight: 600;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0.2rem 0;
}
/* En pantallas grandes, el texto no se estira de lado a lado. */
@media (min-width: 900px) {
    .ve-bar, .ve-tools, .ve-foot { padding-left: calc((100vw - 860px) / 2); padding-right: calc((100vw - 860px) / 2); }
    .ve-text { padding-left: calc((100vw - 860px) / 2); padding-right: calc((100vw - 860px) / 2); }
}

/* iPhone con la app instalada: la barra de estado (hora, batería) va encima
   de la app, así que la cabecera deja ese hueco para no quedar tapada. */
.header { padding-top: calc(1rem + env(safe-area-inset-top, 0px)); }

/* ============ PANTALLA EQUIPO (compacta) ============ */
#view-equipo .section-header { margin-bottom: 0.25rem; }
.team-count { color: var(--text-secondary); font-size: 0.9rem; margin: 0 0 1rem; }
.team-notice {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.35);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 1rem;
}
.team-invite {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow-sm);
}
.team-invite-main { min-width: 0; }
.team-invite-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.team-invite .team-code { font-size: 1.35rem; letter-spacing: 0.1em; line-height: 1.3; }
.team-invite .btn { flex-shrink: 0; }
.team-invite-hint { margin: 0.45rem 0.2rem 1.25rem; font-size: 0.78rem; }
.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary-color);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.member-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.6rem 0.65rem 0.85rem;
    border-top: 1px solid var(--border-color);
}
.member-row:first-child { border-top: none; }
.member-avatar {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-you { font-weight: 400; color: var(--text-muted); font-size: 0.85em; }
.member-email { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row .role-badge { flex-shrink: 0; }
.member-menu-btn {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.member-menu-btn:hover, .member-menu-btn:active { background: var(--bg-tertiary); }
.member-menu-spacer { flex-shrink: 0; width: 2.2rem; }
.member-list + .team-hint { margin: 0.6rem 0.2rem 0; }

/* Menú de opciones de una persona (se abre al pulsar ⋯). */
.member-menu-role { margin-bottom: 0.75rem; }
.menu-list { display: flex; flex-direction: column; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.menu-item {
    text-align: left;
    background: var(--bg-card);
    color: var(--text-primary);
    border: none;
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}
.menu-item:first-child { border-top: none; }
.menu-item:active, .menu-item:hover { background: var(--bg-tertiary); }
.menu-item-danger { color: var(--danger-color); }

/* ============ BIENVENIDA: dos opciones claras ============ */
.onb-question { font-weight: 700; color: var(--text-primary); margin: 0.25rem 0 0.6rem; }
.onb-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1rem; }
.onb-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    text-align: left;
    padding: 0.85rem 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.onb-choice:hover { border-color: var(--border-hover); }
.onb-choice.selected { border-color: var(--primary-color); background: var(--bg-secondary); }
.onb-choice-icon { font-size: 1.35rem; line-height: 1.2; }
.onb-choice-text { display: flex; flex-direction: column; gap: 0.15rem; }
.onb-choice-title { font-weight: 700; font-size: 0.98rem; }
.onb-choice-sub { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.35; }
.onb-block[hidden] { display: none; }
#onb-join-block, #onb-create-block { margin-bottom: 0.5rem; }
@media (max-width: 480px) { .onb-choices { grid-template-columns: 1fr; } }

/* ============ CEJILLA ============ */
.transpose-controls { flex-wrap: wrap; }
.capo-btn { white-space: nowrap; }
.capo-note {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--ui-font);
    font-size: 0.9rem;
    line-height: 1.35;
}
.capo-note strong { color: var(--text-primary); }
.modal-footer:empty { display: none; }
.song-content.voice-mode .capo-note { display: none; }
.capo-hint { margin: 0 0 1rem; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.45; }
.capo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}
.capo-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 64px;
    padding: 0.5rem 0.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
}
.capo-option:hover { border-color: var(--border-hover); }
.capo-option-fret { font-size: 0.75rem; color: var(--text-secondary); }
.capo-option-shape { font-size: 1.25rem; font-weight: 700; }
.capo-option.easy .capo-option-shape { color: var(--accent-color); }
.capo-option.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
}
.capo-option.selected .capo-option-fret,
.capo-option.selected .capo-option-shape { color: var(--on-primary); }
@media (max-width: 380px) {
    .capo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============ LECTOR: MENÚ ⋯ Y TONO INICIAL ============ */
.btn-reset-key { min-width: 2.2rem; justify-content: center; font-size: 1rem; }
.reader-more-menu { min-width: 14rem; max-width: calc(100vw - 1.5rem); left: 0; right: auto; }
#btn-reader-more { min-width: 2.6rem; min-height: 2rem; justify-content: center; font-size: 1.1rem; line-height: 1; }
.reader-more-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem 0.4rem 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.2rem;
}
.reader-more-label { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }
.reader-more-menu .font-size-controls .btn-sm {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    min-width: 2.6rem;
    justify-content: center;
}
.reader-more-menu > .btn-sm { padding: 0.6rem 0.75rem; font-size: 0.9rem; }
/* En pantalla completa, ◀ 1/4 ▶ sigue a mano para pasar de canción. */
body.fullscreen-active #setlist-nav-controls { margin-bottom: 0; }

/* ============ CERRAR SESIÓN (en la pestaña Equipo) ============ */
.session-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.session-email { font-size: 0.82rem; color: var(--text-secondary); word-break: break-all; }

/* ============ CABECERA EN MÓVIL: UNA SOLA FILA ============
   Logo, pestañas y tema en la misma línea, para dejar más sitio a la canción. */
@media (max-width: 768px) {
    .header { padding: 0.5rem 0; padding-top: calc(0.5rem + env(safe-area-inset-top, 0px)); }
    .header-content { flex-wrap: nowrap; }
    .auth-section { flex-basis: auto; }
    .header-right > nav { margin-left: auto; min-width: 0; }
    .nav-tabs { gap: 0.3rem; }
    .nav-tab { padding: 0.4rem 0.6rem; }
    .btn-theme { padding: 0.35rem 0.45rem; }
}
@media (max-width: 480px) {
    .logo-text { display: none; }
    .logo-img { width: 32px; height: 32px; }
}
/* Si hay una pestaña más (administrador), se deja bajar a otra fila. */
@media (max-width: 420px) {
    .header-content:has(#nav-tab-edicion[style*="inline-block"]) { flex-wrap: wrap; }
}

/* Búsqueda por letra: la línea que coincide, debajo del título. */
.song-lyric-hit {
    margin-top: 0.2rem;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ============ AJUSTE A LA PANTALLA (tablet y ordenador) ============ */
/* Para medir la línea más larga sin que se parta. */
.song-content.measuring .lyric-line,
.song-content.measuring:not(.voice-mode) .chord-line {
    display: inline-block !important;
    white-space: pre !important;
    max-width: none !important;
}
.song-content.measuring .pair { display: block; }
/* Dos columnas, repartidas por secciones enteras. */
.song-content.song-two-cols { column-count: 2; column-gap: 40px; column-fill: balance; }
.song-content.song-two-cols .section { break-inside: avoid; page-break-inside: avoid; }
.song-content.song-two-cols .capo-note,
.song-content.song-two-cols .song-credits { column-span: all; }
/* Si aun así una línea no cabe, se desplaza de lado en vez de cortarse. */
@media (min-width: 769px) { .song-content { overflow-x: auto; } }

/* ============ BUSCADOR SIEMPRE A MANO ============
   Al bajar por la lista de canciones, el buscador se queda pegado bajo la
   cabecera: no hace falta subir hasta arriba para buscar otra. */
#view-canciones .search-container {
    position: sticky;
    top: var(--header-h, 0px);
    z-index: 90;
    background: var(--bg-primary);
    padding: 0.6rem 0;
    margin-top: -0.6rem;
    margin-bottom: 1.4rem;
    flex-wrap: nowrap !important;
    align-items: stretch;
}
#view-canciones .search-field { min-width: 0; }
#sort-select { flex: 0 0 auto; }
@media (max-width: 768px) {
    #view-canciones .search-container { gap: 0.5rem !important; margin-bottom: 0.8rem; }
    #sort-select { padding: 0.6rem 0.5rem !important; font-size: 0.85rem !important; }
    #view-canciones .search-box { padding-top: 0.6rem; padding-bottom: 0.6rem; }
}

/* Importar créditos: vista previa */
.credits-replace { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 0.75rem; }
.credits-list { max-height: 50vh; overflow-y: auto; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.45; }
.credits-list li { margin-bottom: 0.3rem; }

/* ============ ACORDES PEGADOS A LA LETRA ============ */
/* Cada trozo de letra lleva su acorde encima; así la letra puede ir en Nunito
   (no monoespaciada) y, si una línea no cabe, se parte entre trozos sin que
   ningún acorde se mueva de su sílaba. */
.song-content { font-family: var(--ui-font); }
.song-content .chord-line { font-family: var(--ui-font); word-spacing: 0.35em; }
.lyric-line.inline-chords { white-space: normal; word-break: normal; }
.inline-chords .seg { display: inline-block; vertical-align: bottom; max-width: 100%; }
.inline-chords .ch { display: block; color: var(--chord-color); font-weight: 700; font-size: 0.95em; line-height: 1.25; white-space: pre; padding-right: 0.35em; }
.inline-chords .tx { display: block; white-space: pre-wrap; }
.inline-chords .seg.no-chord .ch { visibility: hidden; }
.song-content.voice-mode .inline-chords .ch { display: none; }
.song-content.measuring .lyric-line.inline-chords { white-space: nowrap !important; }

/* Partes del orden sin letra escrita (Instrumental, Espontáneo…) */
.section.free-section { min-height: 0; padding-bottom: 4px; }

/* Parte abierta: espontáneo (se repite la rueda el tiempo que haga falta) */
#tp-hold-btn {
    display: none; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 1200;
    background: var(--warning-color); color: #fff; border: 0; border-radius: 999px;
    padding: 12px 22px; font: 600 1rem var(--ui-font); box-shadow: var(--shadow-lg); cursor: pointer;
}

/* ============ EN VIVO: SEGUIR A QUIEN GUÍA ============ */
.live-pill {
    position: fixed;
    left: max(0.75rem, env(safe-area-inset-left));
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    z-index: 901;
    max-width: calc(50vw - 5rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: white;
    background: rgba(14, 25, 34, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
}
.live-pill[hidden] { display: none; }
.live-pill.live-on { background: #2563eb; max-width: calc(100vw - 5rem); }
.live-pill.live-guiding { background: #dc2626; }
.live-pill.live-guiding::before {
    content: '';
    display: inline-block;
    width: 0.5rem; height: 0.5rem;
    border-radius: 50%;
    background: white;
    margin-right: 0.4rem;
    vertical-align: middle;
    animation: live-blink 1.2s infinite;
}
@keyframes live-blink { 50% { opacity: 0.25; } }
/* La parte por donde va quien guía, marcada en la pantalla de quien sigue. */
.song-content .section.live-current { position: relative; }
.song-content .section.live-current::before {
    content: '';
    position: absolute;
    left: -0.6rem; top: 0; bottom: 0;
    width: 3px;
    border-radius: 2px;
    background: #2563eb;
}
.live-menu .menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; }
.live-menu .live-opt-title { font-weight: 600; }
.live-menu .live-opt-sub { font-size: 0.8rem; color: var(--text-secondary); font-weight: 400; }
.live-menu .menu-item.live-selected { border-color: var(--primary-color); background: var(--bg-tertiary); }

/* Mayúsculas para Dios: vista previa */
.caps-list { max-height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.caps-song { border: 1px solid var(--border-color); border-radius: 10px; padding: 0.6rem 0.75rem; }
.caps-title { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.caps-count { margin-left: auto; font-size: 0.75rem; color: var(--text-secondary); }
.caps-lines { margin: 0.4rem 0 0; padding-left: 1.6rem; font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary); }
.caps-lines mark { background: #fde68a; color: #111827; border-radius: 3px; padding: 0 2px; }
.caps-more { list-style: none; font-style: italic; }

/* ============ REGISTRO VOCAL ============ */
.voice-sex { display: flex; gap: 1.25rem; }
.voice-sex label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; }
.voice-type { margin-top: 0.5rem; font-weight: 600; color: var(--primary-color); min-height: 1.2em; }
.member-voice { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }
button.member-voice { padding: 0; }
.reader-voice-hint {
    margin: 0 0 0.6rem;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.reader-voice-hint strong { color: var(--text-primary); }
.voice-hint-btn { margin-left: 0.4rem; border: 1px solid var(--primary-color); background: transparent; color: var(--primary-color); border-radius: 999px; padding: 0.15rem 0.6rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.voice-hint-ok { margin-left: 0.3rem; color: #16a34a; font-weight: 600; }
body.fullscreen-active .reader-voice-hint { display: none !important; }
.caps-auto { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; margin-top: 0.4rem; }

/* Enlaces legales (privacidad, eliminar cuenta) */
.legal-links { margin: 0.75rem 0 0; font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.legal-links a { color: var(--text-secondary); }

/* ============ FAVORITOS DEL EQUIPO ============ */
.rep-tabs, .pick-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; }
.rep-tab {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.rep-tab.active { background: var(--primary-color); border-color: var(--primary-color); color: var(--on-primary); }
.fav-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.25rem 0 0.9rem; }
.fav-btn { font-size: 1.15rem; line-height: 1; color: var(--text-muted); background: transparent; border: none; cursor: pointer; padding: 0.35rem 0.5rem; }
.fav-btn.is-fav { color: var(--accent-color); }
#songs-grid .song-item { position: relative; }
.pick-list { max-height: 52vh; overflow-y: auto; }
.pick-list .import-preview-item { cursor: pointer; }
#songs-grid .song-item > .fav-btn, #repertorio-grid .song-item > .fav-btn { position: absolute; top: 0.45rem; right: 0.45rem; }
#songs-grid .song-item > .song-info, #repertorio-grid .song-item > .song-info { padding-right: 2rem; }
#repertorio-grid .song-item { position: relative; }

/* ===== Varios equipos: selector ===== */
.team-switch-btn {
    display: inline-flex; align-items: center; gap: 6px;
    margin: -4px 0 12px; padding: 7px 14px; min-height: 36px;
    border: 1px solid var(--border-color, #d8d2c4); border-radius: 999px;
    background: var(--bg-secondary, #fff); color: var(--text-primary, #0f2939);
    font-size: 0.92rem; font-weight: 600; cursor: pointer; max-width: 100%;
}
.team-switch-btn[hidden] { display: none; }
.team-switch-label { font-weight: 400; color: var(--text-secondary, #6b7a86); }
.team-switch-caret { font-size: 0.75em; opacity: 0.7; }
.team-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.team-chip {
    padding: 7px 14px; min-height: 36px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border-color, #d8d2c4); background: transparent;
    color: var(--text-primary, #0f2939); font-size: 0.9rem;
}
.team-chip.active { background: var(--primary-color, #0f2939); border-color: var(--primary-color, #0f2939); color: #fff; font-weight: 600; }
.team-another { margin: 18px 0 4px; text-align: center; }
.menu-item-sub { display: block; font-size: 0.8rem; font-weight: 400; color: var(--text-secondary, #6b7a86); margin-top: 2px; }
.menu-item-current { font-weight: 700; }
