/* ══════════════════════════════════════
   KARAOKÉ — thème clair / sombre
   ══════════════════════════════════════ */

:root, [data-theme="light"] {
    --bg: #f6f3fb;
    --card: #ffffff;
    --text: #1d1630;
    --text-2: #6a6185;
    --accent: #c2187a;
    --accent-2: #7b3fe4;
    --accent-soft: #fbe4f1;
    --border: #e4ddf0;
    --danger: #d32f2f;
    --ok: #2e7d32;
    --warn: #b26a00;
    --shadow: 0 2px 10px rgba(40, 20, 80, .08);
}

[data-theme="dark"] {
    --bg: #14101f;
    --card: #1f1930;
    --text: #f1ecfb;
    --text-2: #a79dc2;
    --accent: #ff4fb0;
    --accent-2: #9d6bff;
    --accent-soft: #3a1d3a;
    --border: #332a4a;
    --danger: #ff6b6b;
    --ok: #6fdc8c;
    --warn: #ffc56b;
    --shadow: 0 2px 14px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    font-size: 16px; line-height: 1.4;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.hidden { display: none !important; }
.flex1 { flex: 1; }
h1, h2 { margin: 0 0 10px; }
h2 { font-size: 1.05rem; }
.aide { color: var(--text-2); font-size: .9rem; margin: 4px 0 10px; }
.petit { font-size: .8rem; }
.ok { color: var(--ok); }
.ko { color: var(--danger); }
.erreur { color: var(--danger); min-height: 1.2em; margin-top: 8px; }

/* ── En-tête ── */
.header {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--card); border-bottom: 1px solid var(--border);
}
.logo { font-size: 1.15rem; }
.badge-soiree {
    background: var(--accent-soft); color: var(--accent);
    padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
}
.header-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
    width: 44px; height: 44px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text); font-size: 1.2rem; cursor: pointer;
}

/* ── Navigation bas d'écran ── */
.nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; background: var(--card); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    flex: 1; min-height: 60px; border: 0; background: none; color: var(--text-2);
    font-size: .75rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    cursor: pointer;
}
.nav-item span { font-size: 1.3rem; }
.nav-item.active { color: var(--accent); font-weight: 600; }
body.invite .admin-only { display: none !important; }

/* ── Pages ── */
main { max-width: 760px; margin: 0 auto; padding: 12px; }
.page { display: none; }
.page.active { display: block; }

.card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}

/* ── Formulaires ── */
label { display: block; font-size: .85rem; color: var(--text-2); margin: 10px 0; }
input, select {
    width: 100%; margin-top: 4px; padding: 12px; font-size: 16px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { margin-top: 0; }
.row.wrap { flex-wrap: wrap; margin-top: 8px; }

.btn {
    min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
    font-size: .95rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.secondaire { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.petit { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.plein { width: 100%; }
.btn.rond { width: 56px; height: 56px; border-radius: 50%; padding: 0; font-size: 1.2rem; }

/* ── Recherche + filtres ── */
.search-bar input { margin: 0 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; }
.chip {
    flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: .85rem;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-select { width: auto; flex: none; margin: 0; padding: 6px 10px; border-radius: 999px; font-size: .85rem; }

/* ── Listes ── */
.liste { display: flex; flex-direction: column; gap: 8px; }
.item {
    display: flex; align-items: center; gap: 12px; padding: 10px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.liste.compacte .item { background: var(--bg); }
.item-txt { flex: 1; min-width: 0; }
.item-titre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sous { color: var(--text-2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.en-cours { border: 2px solid var(--accent); }
.item.passe { opacity: .6; }
.pochette { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; }
.pochette.vide { display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; }
.pochette.grande { width: 72px; height: 72px; }
.vide-liste { color: var(--text-2); text-align: center; padding: 24px 8px; }
.tag { font-size: .75rem; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tag-warn { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.chanteur { font-weight: 600; color: var(--accent); flex: none; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rang { width: 24px; text-align: center; color: var(--text-2); font-weight: 600; flex: none; }
.compteur { color: var(--text-2); font-weight: 400; }
.mini-actions { display: flex; gap: 2px; flex: none; }
.mini-actions button {
    width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer;
}
.mini-actions button:disabled { opacity: .3; }
.apercu { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }

/* ── Soirée ── */
.controles { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.code { font-family: ui-monospace, monospace; color: var(--accent); letter-spacing: 2px; }
.qr-ligne { display: flex; gap: 14px; align-items: center; }
.qr-petit { width: 120px; flex: none; background: #fff; border-radius: 10px; padding: 4px; }
.qr-petit svg, .qr-grand svg, .qr-coin svg { display: block; width: 100%; height: auto; }

/* ── Modales ── */
#modal-overlay {
    position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .55);
    display: flex; align-items: flex-end; justify-content: center;
}
.modal {
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    background: var(--card); border-radius: 18px 18px 0 0; padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: monte .18s ease-out;
}
@media (min-width: 700px) {
    #modal-overlay { align-items: center; }
    .modal { border-radius: 18px; }
}
@keyframes monte { from { transform: translateY(40px); opacity: 0; } }
.modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ── Toasts ── */
.toast {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 200;
    background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px;
    box-shadow: var(--shadow); font-size: .9rem; max-width: 90vw;
}
.toast-erreur { background: var(--danger); color: #fff; }

/* ── Connexion / invité ── */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 380px; text-align: center; }
.login label { text-align: left; }
.login-logo { font-size: 3rem; }
.login .btn { margin-top: 8px; }
.code-input { text-align: center; font-size: 2rem; letter-spacing: 10px; text-transform: uppercase; margin: 10px 0; }

/* ══════════════════════════════════════
   ÉCRAN SCÈNE (TV)
   ══════════════════════════════════════ */
body.mode-scene { padding: 0; overflow: hidden; background: #000; }
body.mode-scene .header, body.mode-scene .nav { display: none; }
body.mode-scene main { max-width: none; padding: 0; }

#scene { position: fixed; inset: 0; background: radial-gradient(ellipse at top, #2a1450, #07040d 70%); color: #fff; }
#scene-player-wrap { position: absolute; inset: 0; }
#scene-player-wrap.cache { visibility: hidden; }
#scene-player-wrap iframe { width: 100%; height: 100%; border: 0; }

.scene-ecran {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center; padding: 4vh 4vw; gap: 2vh;
}
.scene-ecran.demarrer { background: rgba(7, 4, 13, .92); cursor: pointer; z-index: 10; }
.scene-titre { font-size: 7vh; font-weight: 800; }
.scene-sous { font-size: 3.2vh; color: #cbbfe6; }
.scene-code { font-size: 3vh; color: #cbbfe6; }
.scene-code b { color: #ff4fb0; letter-spacing: .3em; font-size: 4.5vh; }
.qr-grand { width: 34vh; background: #fff; border-radius: 2vh; padding: 1vh; }
.qr-grand:empty { display: none; }
.annonce-nom {
    font-size: 14vh; font-weight: 900; line-height: 1;
    background: linear-gradient(135deg, #ff4fb0, #9d6bff); -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: pop .5s ease-out;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.annonce-pochette { width: 22vh; height: 22vh; border-radius: 2vh; object-fit: cover; box-shadow: 0 2vh 6vh rgba(0, 0, 0, .5); }
.annonce-titre { font-size: 4.5vh; font-weight: 700; }
.annonce-titre small { font-size: 3vh; font-weight: 400; color: #cbbfe6; }

.scene-bandeau {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
    display: flex; gap: 3vw; align-items: center; padding: 1.2vh 2vw;
    background: linear-gradient(transparent, rgba(0, 0, 0, .85)); font-size: 2.6vh; pointer-events: none;
}
.bandeau-suivant { margin-left: auto; color: #cbbfe6; }
.qr-coin {
    position: absolute; top: 2vh; right: 2vh; z-index: 5; width: 13vh;
    background: #fff; border-radius: 1vh; padding: .6vh; color: #14101f; text-align: center;
    font-weight: 800; font-size: 2vh; letter-spacing: .2em; opacity: .9;
}
.scene-outils { position: absolute; top: 1.5vh; left: 1.5vh; z-index: 20; display: flex; gap: 8px; opacity: .25; transition: opacity .2s; }
.scene-outils:hover { opacity: 1; }
.scene-outils button {
    width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 1.1rem; cursor: pointer;
}
