/* ================================================================
   STAGE MODE, METRONOME, SCROLL CONTROLS, RESPONSIVE
   ================================================================ */

/* Metrónomo: barra dividida en los tiempos del compás; la parte del tiempo actual se ilumina,
   la primera del compás en naranja */
.metronome-bar {
    display: flex; gap: 3px; flex-shrink: 0; width: 120px; height: 18px; padding: 2px;
    border-radius: 6px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
}
.metronome-bar .mb-seg {
    flex: 1; border-radius: 3px; background: var(--border-color); opacity: 0.6;
    transition: background 0.04s, box-shadow 0.04s, opacity 0.04s;
}
.metronome-bar .mb-seg.on { background: var(--accent-cyan); opacity: 1; box-shadow: 0 0 10px var(--accent-cyan); }
.metronome-bar .mb-seg.mb-first { background: rgba(255,149,0,0.35); }
.metronome-bar .mb-seg.mb-first.on { background: var(--accent-orange); box-shadow: 0 0 14px var(--accent-orange); }

.scroll-params-live {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    flex-wrap: wrap;
}
.scroll-param-group { display: flex; align-items: center; gap: 0.25rem; }
.scroll-param-label { font-size: 0.72rem; color: var(--text-main); white-space: nowrap; margin-right: 2px; }
.scroll-param-btn {
    width: 24px; height: 24px;
    border-radius: 4px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.scroll-param-btn:hover { border-color: var(--accent-cyan); background: rgba(60,229,215,0.1); }
.scroll-param-val {
    min-width: 1.8rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-bright);
}

/* Stage Mode */
body.stage-mode .app-header { display: none !important; }
body.stage-mode .live-sidebar { display: none !important; }
body.stage-mode .live-main { height: 100vh; height: 100dvh; }

/* LRC Countdown overlay */
#lrc-countdown {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    font-size: clamp(5rem, 20vw, 12rem);
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    color: var(--accent-cyan);
    text-shadow: 0 0 40px rgba(60,229,215,0.6), 0 0 80px rgba(60,229,215,0.3);
    pointer-events: none;
    border-radius: inherit;
}
#lrc-countdown.beat {
    animation: lrcBeat 0.18s ease-out forwards;
}
@keyframes lrcBeat {
    0%   { transform: scale(1.3); opacity: 1; color: #fff; text-shadow: 0 0 60px rgba(255,255,255,0.8); }
    100% { transform: scale(1);   opacity: 0.75; color: var(--accent-cyan); text-shadow: 0 0 40px rgba(60,229,215,0.6); }
}

/* ================================================================
   RESPONSIVE - Mobile First
   ================================================================ */
@media screen and (max-width: 800px) {
    .live-wrapper { flex-direction: column; }
    .live-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 42vh;
        overflow-y: auto;
        gap: 0.6rem;
        padding: 0.8rem;
    }
    .live-sidebar h3 { width: 100%; margin-bottom: 0; }
    .live-controls { width: 100%; }
    .live-main { overflow-y: auto; }
    .live-header { flex-direction: column; }
    #live-title { font-size: 1.4rem; }
    .chords-lyrics-renderer { font-size: var(--live-text-size, 1rem); }
    .live-viewport { padding: 1rem; padding-bottom: 30vh; }

    .setshow-wrapper { flex-direction: column; height: auto; }
    .setshow-panel { border-right: none; border-bottom: 1px solid var(--border-color); }
    .setshow-panel:last-child { border-bottom: none; }

    .home-logo-big { font-size: 3rem; }
    .home-hero h1 { font-size: 2.2rem; }
    .home-cards { gap: 0.8rem; }
    .home-card { padding: 1.5rem 1rem; }
    .card-icon { font-size: 1.8rem; }
    .card-title { font-size: 1.2rem; }

    dialog#modal-editor { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 12px 12px 0 0; margin: auto auto 0 auto; }
    .form-row { flex-direction: column; }
}

@media screen and (min-width: 600px) {
    .home-cards { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .home-card { flex: 1; min-width: 150px; max-width: 200px; }
}

/* Panel de Sincronía (director): mismo estilo oscuro que el editor de canciones */
dialog.modal-sincronia {
    background: var(--bg-panel); color: var(--text-bright); border: 1px solid var(--accent-cyan);
    border-radius: 12px; padding: 0; width: min(560px, 94vw); max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
dialog.modal-sincronia::backdrop { background: rgba(0,0,0,0.7); }
.sync-body { padding: 1.1rem 1.5rem 1.3rem; }
.sync-help { font-size: 0.9rem; color: var(--text-bright); margin: 0 0 0.6rem; line-height: 1.45; }
.sync-tips { margin: 0 0 1rem; padding-left: 1.1rem; font-size: 0.82rem; color: var(--text-main); line-height: 1.5; }
.sync-tips li { margin-bottom: 0.25rem; }
.sync-tips strong { color: var(--text-bright); }
.sync-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.sync-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
    padding: 0.65rem 0.8rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); }
.sync-who { min-width: 0; }
.sync-who small { opacity: 0.6; }
.sync-dev { display: block; font-size: 0.75rem; color: var(--text-main); margin-top: 3px; }
.sync-dev.off { opacity: 0.55; }
.sync-adj { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sync-adj button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border-color);
    background: var(--bg-panel); color: var(--text-bright); cursor: pointer; font-weight: 700; font-size: 1rem; }
.sync-adj button:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.sync-adj span { min-width: 64px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sync-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* Destellos de la prueba de sincronía */
#sync-flash { position: fixed; inset: 0; z-index: 9999; pointer-events: none; display: none;
    align-items: center; justify-content: center; font-size: 30vmin; font-weight: 900; color: #000; background: #fff; }
#sync-flash.on { display: flex; }
#sync-flash.first { background: var(--accent-orange); }

/* Escenario: volver a pantalla completa (el navegador exige un toque) */
#stage-resume { position: fixed; inset: 0; z-index: 9000; display: none; flex-direction: column; align-items: center;
    justify-content: center; gap: 0.6rem; background: rgba(0,0,0,0.82); color: var(--text-bright); border: none;
    font-family: inherit; font-size: 1.3rem; font-weight: 800; cursor: pointer; }
#stage-resume span { font-size: 4rem; color: var(--accent-cyan); line-height: 1; }
#stage-resume.on { display: flex; }
/* Aviso de "No molestar" al entrar en escenario desde el celular */
#stage-tip { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 9001; display: none;
    width: min(92vw, 520px); padding: 0.75rem 1rem; border-radius: 10px; background: #1a1708; color: #ffd60a;
    border: 1px solid #ffd60a; font-weight: 700; font-size: 0.9rem; text-align: center; box-shadow: 0 8px 26px rgba(0,0,0,0.6); }
#stage-tip.on { display: block; }
