/* ==========================================================================
   Roboptik — feuille de style du tableau de bord
   --------------------------------------------------------------------------
   Ambiance « seventies » : couleurs chaudes de coucher de soleil, bandes
   arc-en-ciel, coins très arrondis, titres en police "ronde" (Cooper Black
   si elle est installée, sinon une police serif grasse du système).

   Pensée "mobile d'abord" : le streamer gère souvent son bot depuis son
   téléphone pendant le live. Aucune police à télécharger, un seul fichier
   CSS, pas de framework.

   Sommaire :
     1. Thèmes (variables de couleurs) — choisis par l'utilisateur, attribut
        data-theme sur <html> : soleil, disco, avocat, nuit
     2. Bases
     3. Structure : barre du haut, menu, contenu
     4. Barre d'état (bot + live)
     5. Composants : boutons, formulaires, listes, badges, messages
     6. Pages particulières (tirage, citations, bingo, ALLO ALBA…)
     7. Animations (désactivées si l'utilisateur préfère réduire les mouvements)
   ========================================================================== */

/* 1. Thèmes ------------------------------------------------------------------ */
/* Chaque thème définit les mêmes variables. Les 4 couleurs --band-1..4 forment
   les bandes rétro (sous la barre du haut, sur les panneaux importants). */
:root,
[data-theme="soleil"] {
  --ink: #3b1a0c;          /* texte principal : brun chocolat */
  --ink-soft: #7d5a43;     /* texte secondaire */
  --paper: #fdf1dc;        /* fond de page : crème */
  --surface: #fffaf0;      /* fond des panneaux */
  --line: #ecd3ac;         /* bordures */
  --accent: #d94722;       /* couleur d'action : orange brûlé */
  --accent-ink: #fffaf0;
  --accent-soft: #fbe0c8;
  --accent-2: #f9be42;     /* moutarde */
  --band-1: #f9be42; --band-2: #f07522; --band-3: #d94722; --band-4: #751011;
  --bar-bg: #751011;       /* barre d'état */
  --bar-ink: #fdf1dc;
  --live: #d93f3f;
  --warn: #9a5b00; --warn-soft: #fbeac2;
  --danger: #a8231f; --danger-soft: #f9dcd6;
  --ok: #3f6b1e; --ok-soft: #e4efcf;
  --shadow: 0 2px 0 rgb(117 16 17 / .12), 0 10px 24px -14px rgb(117 16 17 / .35);
  color-scheme: light;
}

[data-theme="disco"] {
  --ink: #2a1240;
  --ink-soft: #6c5585;
  --paper: #f6ecfb;
  --surface: #fffaff;
  --line: #e2cdee;
  --accent: #c2307a;
  --accent-ink: #fff;
  --accent-soft: #f9d9ea;
  --accent-2: #2bb3a3;
  --band-1: #ffb347; --band-2: #e2468f; --band-3: #8a3fc0; --band-4: #2bb3a3;
  --bar-bg: #3d1a5c;
  --bar-ink: #fdf0ff;
  --warn: #8c5a00; --warn-soft: #fff0cc;
  --danger: #b0174f; --danger-soft: #fbd9e6;
  --ok: #1d7a6e; --ok-soft: #d4f2ec;
  --shadow: 0 2px 0 rgb(61 26 92 / .12), 0 10px 24px -14px rgb(61 26 92 / .4);
  color-scheme: light;
}

[data-theme="avocat"] {
  --ink: #2f2a14;
  --ink-soft: #6b6440;
  --paper: #f3e6c4;
  --surface: #fbf4e0;
  --line: #ddcc9c;
  --accent: #6b7a2a;
  --accent-ink: #fbf4e0;
  --accent-soft: #e3e5bd;
  --accent-2: #c9a227;
  --band-1: #c9a227; --band-2: #a8752a; --band-3: #8a4b2a; --band-4: #6b7a2a;
  --bar-bg: #4a4f1c;
  --bar-ink: #f3e6c4;
  --warn: #8a5a10; --warn-soft: #f4e2b4;
  --danger: #9c3420; --danger-soft: #f2d4c5;
  --ok: #4d6a12; --ok-soft: #e1ebc4;
  --shadow: 0 2px 0 rgb(74 79 28 / .14), 0 10px 24px -14px rgb(74 79 28 / .4);
  color-scheme: light;
}

[data-theme="nuit"] {
  --ink: #f6e7d6;
  --ink-soft: #b9a3a0;
  --paper: #1c1424;
  --surface: #261b30;
  --line: #3d2d48;
  --accent: #feac13;
  --accent-ink: #1c1424;
  --accent-soft: #3d2d1c;
  --accent-2: #f0623a;
  --band-1: #feac13; --band-2: #f0623a; --band-3: #c24bd6; --band-4: #5b2a86;
  --bar-bg: #120c18;
  --bar-ink: #f6e7d6;
  --live: #ff5a5a;
  --warn: #f5c35a; --warn-soft: #3a2c12;
  --danger: #ff8a7a; --danger-soft: #42201f;
  --ok: #9be07a; --ok-soft: #1f3420;
  --shadow: 0 0 0 1px rgb(254 172 19 / .06), 0 12px 28px -16px rgb(0 0 0 / .8);
  color-scheme: dark;
}

:root {
  --radius: 18px;
  --radius-small: 12px;
  --space: 16px;
  --sidebar: 252px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Cooper Black", "Cooper Std", "Recoleta", "Georgia", "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
  --bands: linear-gradient(90deg, var(--band-1) 0 25%, var(--band-2) 25% 50%, var(--band-3) 50% 75%, var(--band-4) 75%);
  --bands-v: linear-gradient(180deg, var(--band-1) 0 25%, var(--band-2) 25% 50%, var(--band-3) 50% 75%, var(--band-4) 75%);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

/* 2. Bases ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--paper);
  transition: background-color .4s ease, color .4s ease;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-family: var(--display); font-size: 1.9rem; font-weight: 700; letter-spacing: .005em; }
h2 { font-family: var(--display); font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 72ch; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); padding: .05em .4em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* 3. Structure ------------------------------------------------------------------ */
.shell { min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 var(--space);
  background: var(--surface);
}
/* Les fameuses bandes seventies sous la barre du haut */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px;
  background: linear-gradient(180deg, var(--band-1) 0 2px, var(--band-2) 2px 4px, var(--band-3) 4px 6px, var(--band-4) 6px 8px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.35rem; font-weight: 700; }
.brand img { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 3px var(--band-1), 0 0 0 6px var(--band-2); transition: transform .5s var(--ease-bounce); }
.brand:hover img { transform: rotate(-12deg) scale(1.05); }
.topbar .spacer { flex: 1; }
.menu-toggle, .icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 2px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

/* Sélecteurs du haut (chaîne gérée, thème) */
.top-menu { position: relative; }
.top-menu > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem;
}
.top-menu > summary::-webkit-details-marker { display: none; }
.top-menu > summary .label { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .top-menu > summary .label { display: none; } }
.top-menu .dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  width: min(300px, calc(100vw - 24px)); padding: 10px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: drop-in .25s var(--ease-bounce);
}
.top-menu .dropdown h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 4px 6px 8px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-small);
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item[aria-current="true"] { background: var(--accent-soft); }
.swatch { display: inline-flex; flex: none; width: 44px; height: 22px; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1); }
.swatch span { flex: 1; }

/* Menu latéral : tiroir sur mobile, colonne fixe sur grand écran */
.sidebar {
  position: fixed; inset: 68px auto 0 0; z-index: 30;
  width: min(86vw, var(--sidebar));
  padding: 14px 10px 24px;
  overflow-y: auto;
  background: var(--surface); border-right: 2px solid var(--line);
  transform: translateX(-105%);
  transition: transform .35s var(--ease-bounce);
}
.shell.menu-open .sidebar { transform: none; }
.backdrop { position: fixed; inset: 68px 0 0; z-index: 25; background: rgb(30 10 0 / .4); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.shell.menu-open .backdrop { opacity: 1; pointer-events: auto; }

.nav-section { margin: 4px 0 10px; }
.nav-section > summary {
  list-style: none; cursor: pointer;
  padding: 6px 10px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary::after { content: "–"; }
.nav-section:not([open]) > summary::after { content: "+"; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: .95rem;
  transition: background-color .2s ease, transform .2s var(--ease-bounce), color .2s;
}
.nav-link:hover { background: var(--accent-soft); transform: translateX(3px); }
.nav-link[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 650; box-shadow: var(--shadow); }

.content { padding: 24px var(--space) 48px; max-width: 1080px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; }

@media (min-width: 960px) {
  .menu-toggle { display: none; }
  .sidebar { transform: none; width: var(--sidebar); }
  .backdrop { display: none; }
  .content { margin-left: var(--sidebar); padding: 28px 36px 56px; }
}

/* 4. Barre d'état : bot et live, visible sur toutes les pages ----------------- */
.statusbar {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  margin-top: 8px; padding: 9px var(--space); font-size: .85rem;
  background: var(--bar-bg); color: var(--bar-ink);
}
.statusbar .signal { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.statusbar .dot { width: 10px; height: 10px; border-radius: 50%; background: #9c8c84; }
.statusbar .dot.on { background: #8fd16a; box-shadow: 0 0 0 3px rgb(143 209 106 / .3); }
.statusbar .dot.live { background: var(--live); box-shadow: 0 0 0 3px rgb(217 63 63 / .3); animation: pulse 2s ease-in-out infinite; }
.statusbar a { color: inherit; }
.statusbar .button { border-color: rgb(255 255 255 / .3); background: transparent; color: inherit; }
@media (min-width: 960px) { .statusbar { margin-left: var(--sidebar); padding: 9px 36px; } }

/* 5. Composants ------------------------------------------------------------------- */
.panel {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel > h2:first-child { margin-top: 0; }
.panel.banded { position: relative; overflow: hidden; padding-top: 28px; }
.panel.banded::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; background: var(--bands); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease-bounce), box-shadow .2s ease, background-color .2s, border-color .2s, filter .2s;
}
.button:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.97); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--band-4); }
.button.primary:hover { filter: brightness(1.07); box-shadow: 0 5px 0 var(--band-4); }
.button.primary:active { box-shadow: 0 1px 0 var(--band-4); }
.button.danger { color: var(--danger); }
.button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.button.ghost { border-color: transparent; background: transparent; }
.button.small { min-height: 34px; padding: 0 13px; font-size: .875rem; }
.button.big { min-height: 56px; font-size: 1.1rem; padding: 0 28px; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.is-done { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
form.inline { display: inline; }
/* Bouton « Enregistrer » en bas d'un formulaire de page : même espace qu'après un panneau. */
.content > form > .button:last-child, .content > form > .actions:last-child { margin-bottom: 20px; }

/* Formulaires */
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 6px; }
.reset-default { margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line, currentColor); border-radius: 999px; background: none; color: var(--ink-soft); font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer; }
.reset-default:hover { color: inherit; }
.reset-default[hidden] { display: none; }
.field .hint { display: block; color: var(--ink-soft); font-size: .85rem; margin-top: 4px; }
input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 14px;
  border: 2px solid var(--line); border-radius: var(--radius-small);
  background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { min-height: 88px; resize: vertical; }
input[type="color"] { width: 64px; height: 44px; padding: 2px; border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }
.row { display: grid; gap: 12px; }
@media (min-width: 640px) { .row.two { grid-template-columns: 1fr 1fr; } .row.three { grid-template-columns: 1fr 1fr 1fr; } .row.four { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .row.four { grid-template-columns: repeat(4, 1fr); } }
fieldset { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 18px; }
legend { font-weight: 700; padding: 0 6px; }

/* Case à cocher façon interrupteur */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; margin-bottom: 14px; }
.switch input { appearance: none; flex: none; width: 48px; height: 28px; margin: 0; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; transition: background .25s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .35s var(--ease-bounce); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.switch .text { display: block; font-weight: 650; }
.switch .text small { display: block; font-weight: 400; color: var(--ink-soft); }

/* Messages */
.notice { padding: 12px 16px; border-radius: var(--radius-small); margin-bottom: 14px; border: 2px solid transparent; animation: slide-down .4s var(--ease-bounce); }
.notice.success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.notice.info { background: var(--accent-soft); color: var(--ink); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.badge.live { background: var(--live); border-color: transparent; color: #fff; }
.badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.keyword { font-family: var(--mono); font-size: .85rem; background: var(--accent-soft); color: var(--ink); padding: 1px 8px; border-radius: 999px; }

/* Listes (commandes, bots, chaînes…) : lignes, pas de cartes */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > li { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 16px; border-top: 2px solid var(--line); transition: background-color .2s; }
.list > li:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.list > li:first-child { border-top: 0; }
.list .main { flex: 1; min-width: 12rem; }
.list .title { font-weight: 700; color: var(--ink); text-decoration: none; }
.list .title:hover { text-decoration: underline; }
.whisper-link { text-decoration: none; }
.list .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.list .preview { color: var(--ink-soft); font-size: .9rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; }
.list li.disabled .main { opacity: .55; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--band-1); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); border: 2px solid var(--line); background: var(--surface); font-size: .9rem; font-weight: 600; transition: transform .2s var(--ease-bounce), background-color .2s; }
.tabs a:hover { transform: translateY(-2px); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tabs .count { display: inline-block; min-width: 1.6em; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; text-align: center; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-soft); }
.empty p { margin: 0 auto 14px; }

table.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--line); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* Champ de copie (liens OBS) */
.copy { display: flex; flex-wrap: wrap; gap: 8px; }
.copy input { flex: 1 1 14rem; font-family: var(--mono); font-size: .8rem; }
.copy select { flex: 1 1 14rem; width: auto; }

/* Réponses multiples dans le formulaire de commande */
.response { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--paper); }
.response-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 650; font-size: .9rem; }
.response details summary { cursor: pointer; color: var(--ink-soft); font-size: .875rem; margin-top: 8px; }

.stat-line { display: flex; flex-wrap: wrap; gap: 24px; }
.stat-line div { min-width: 120px; }
.stat-line strong { display: block; font-family: var(--display); font-size: 1.8rem; line-height: 1.1; color: var(--accent); }

/* État des abonnements EventSub */
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.status-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: var(--radius-small); background: var(--paper); }
.status-dot { flex: none; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: var(--ink-soft); }
.status-list .ok .status-dot { background: #5fa83a; }
.status-list .pending .status-dot { background: var(--accent-2); animation: pulse-soft 1.4s ease-in-out infinite; }
.status-list .skipped { opacity: .7; }
.status-list .bad { background: var(--danger-soft); color: var(--danger); }
.status-list .bad .status-dot { background: var(--danger); }

/* Lignes de commandes de modération */
.mod-row { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--paper); }
.mod-row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.mod-row.removing { animation: pop-out .3s ease forwards; }

/* Choix des droits de l'équipe */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 2px solid var(--line); cursor: pointer; font-size: .875rem; font-weight: 600; transition: all .2s var(--ease-bounce); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* 6. Pages particulières ------------------------------------------------------------ */

/* Connexion */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 50% 120%, var(--band-1) 0 22%, var(--band-2) 22% 30%, var(--band-3) 30% 38%, var(--band-4) 38% 46%, transparent 46%),
    var(--paper);
}
.login-box { width: min(440px, 100%); text-align: left; background: var(--surface); padding: 28px; border-radius: 28px; border: 2px solid var(--line); box-shadow: var(--shadow); animation: rise .6s var(--ease-bounce); }
.login-box img { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 4px var(--band-1), 0 0 0 8px var(--band-2); }
.login-box h1 { font-size: 2.2rem; margin: 18px 0 8px; }
.button.twitch { background: #6441a5; border-color: #6441a5; color: #fff; width: 100%; min-height: 52px; font-size: 1.05rem; }

/* Tirage au sort : panneau de contrôle */
.giveaway-live { display: grid; gap: 20px; }
@media (min-width: 720px) { .giveaway-live { grid-template-columns: 1.2fr 1fr; } }
.counter { font-family: var(--display); font-size: 3.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.recent .badge { animation: pop-in .35s var(--ease-bounce); }
.winner-reveal { font-family: var(--display); font-size: 1.7rem; font-weight: 800; color: var(--accent); min-height: 2.2rem; }
/* Roue de la fortune : cases avec leur couleur sur la roue */
.wheel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wheel-chip { padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-weight: 700; font-size: .9rem; }
.wheel-chip small { opacity: .8; font-weight: 600; }

/* Classement */
.leaderboard .rank { width: 2.2em; font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.leaderboard li:nth-child(-n+3) .rank { color: var(--accent); }

/* Liens OBS */
.overlay-card { display: grid; gap: 10px; }
.overlay-card .actions { justify-content: flex-start; }

/* Citations */
.quote-text { font-family: var(--display); font-size: 1.05rem; line-height: 1.4; }
.quote-text::before { content: "« "; color: var(--accent); }
.quote-text::after { content: " »"; color: var(--accent); }
.quote-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; width: 100%; }
.quote-edit input { flex: 1 1 16rem; }

/* Bingo */
/* Page publique du bingo : mots en étiquettes */
.bingo-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.bingo-words li { padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); }
.bingo-words li[hidden] { display: none; }
.bingo-grid { display: grid; gap: 6px; max-width: 420px; }
.bingo-grid .cell {
  aspect-ratio: 1; display: grid; place-items: center; padding: 4px; border-radius: 12px;
  background: var(--paper); border: 2px dashed var(--line); color: var(--ink-soft);
  font-size: .8rem; font-weight: 650; text-align: center; overflow-wrap: anywhere;
}
.bingo-grid .cell.found { background: var(--accent); border: 2px solid var(--accent); color: var(--accent-ink); animation: pop-in .4s var(--ease-bounce); }
.bingo-grid .cell.secret .secret-label { filter: blur(7px); transition: filter .3s; user-select: none; }
.bingo-grid.revealed .cell.secret .secret-label { filter: none; user-select: auto; }
/* Grille du tableau de bord : un bouton apparaît au survol, les mots ne se dévoilent qu'au clic. */
.bingo-peek-wrap { position: relative; max-width: 420px; }
.bingo-peek { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: var(--shadow, 0 4px 14px rgb(0 0 0 / .2)); }
.bingo-peek-wrap:hover .bingo-peek, .bingo-peek:focus-visible { opacity: 1; pointer-events: auto; }
.weight { display: inline-block; height: 8px; border-radius: 999px; background: var(--bands); vertical-align: middle; min-width: 4px; }

/* ALLO ALBA */
.alloalba-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.alloalba-mark { position: relative; flex: none; width: 110px; height: 110px; }
.alloalba-mark img { position: absolute; inset: 0; width: 100%; height: 100%; }
.alloalba-mark { animation: rise .6s var(--ease-bounce) both; }
.guest { animation: pop-in .35s var(--ease-bounce); }

/* Choix du thème (page compte / menu) */
.theme-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* 7. Animations --------------------------------------------------------------------- */
/* Entrée douce du contenu de chaque page, panneaux en cascade */
.content > * { animation: rise .5s var(--ease-bounce) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(5) { animation-delay: .16s; }
.content > *:nth-child(n+6) { animation-delay: .2s; }
.reveal { animation: rise .45s var(--ease-bounce) both; }
.list > li { animation: rise .4s ease both; }
.list > li:nth-child(2) { animation-delay: .03s; } .list > li:nth-child(3) { animation-delay: .06s; }
.list > li:nth-child(4) { animation-delay: .09s; } .list > li:nth-child(n+5) { animation-delay: .12s; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: scale(.95); height: 0; margin: 0; padding: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(217 63 63 / .05); } }
@keyframes pulse-soft { 50% { opacity: .4; } }
@keyframes spin-slow { to { transform: rotate(360deg); } }

/* Changement de thème : fondu des couleurs */
html.theme-changing * { transition: background-color .4s ease, color .4s ease, border-color .4s ease !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Messages éphémères (boutons « Tester », erreurs JavaScript) */
.toast { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); box-shadow: var(--shadow); animation: toast-in .4s var(--ease-bounce); }
.toast.leaving { animation: toast-out .4s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 20px); } }

/* Étapes numérotées (ajout d'un bot) */
.steps { margin: 0; padding-left: 1.4em; display: grid; gap: 14px; }
.steps li::marker { font-family: var(--display); color: var(--accent); font-weight: 700; }

/* Chaîne gérée, rappelée en haut du menu */
.sidebar-channel { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; margin-bottom: 8px; border-bottom: 2px solid var(--line); line-height: 1.25; }
.nav-link.is-off { opacity: .6; }
/* Pastille « en attente de validation » (bingo, citations) ; sur le titre de section, visible seulement replié */
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; letter-spacing: 0; text-transform: none; line-height: 1.5; }
.nav-section > summary .nav-count { margin-left: 6px; }
.nav-section[open] > summary .nav-count { display: none; }
.menu-toggle { position: relative; }
.menu-count { position: absolute; top: -4px; right: -6px; margin: 0; min-width: 18px; padding: 0 5px; font-size: .68rem; }
.build { padding: 16px 10px 0; margin: 0; font-size: .75rem; }

/* Gestion de la chaîne de quelqu'un d'autre : impossible à confondre avec la sienne.
   Rayures diagonales sur la barre d'état, bandeau dédié, bord coloré du menu. */
.acting-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px var(--space);
  background: var(--acting-soft); color: var(--ink);
  border-bottom: 3px solid var(--acting);
  animation: slide-down .4s var(--ease-bounce);
}
.acting-banner .acting-text { flex: 1; min-width: 14rem; display: grid; }
.acting-banner .avatar { box-shadow: 0 0 0 3px var(--acting); }
@media (min-width: 960px) { .acting-banner { margin-left: var(--sidebar); padding: 12px 36px; } }
:root { --acting: #2a7f8f; --acting-soft: #d6eef1; }
[data-theme="nuit"] { --acting: #3fc1d3; --acting-soft: #15343a; }
[data-acting] .statusbar {
  background: repeating-linear-gradient(135deg, var(--acting) 0 14px, color-mix(in srgb, var(--acting) 82%, #000) 14px 28px);
  color: #fff;
}
[data-acting] .sidebar { border-right-color: var(--acting); box-shadow: inset -4px 0 0 var(--acting); }
[data-acting] .sidebar-channel strong { color: var(--acting); }
[data-acting] .nav-link[aria-current="page"] { background: var(--acting); color: #fff; }

/* Changement de chaîne depuis le menu */
.channel-switch { display: grid; gap: 6px; margin: -4px 0 12px; }
.channel-pill {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 12px;
  border: 2px dashed var(--line); border-radius: 999px; background: none; color: var(--ink);
  font: inherit; font-size: .9rem; font-weight: 600; text-align: left; cursor: pointer;
}
.channel-pill:hover { border-style: solid; border-color: var(--acting); color: var(--acting); }
/* Sélecteur du haut : zone de clic plus généreuse */
.top-menu > summary { min-height: 44px; padding: 0 14px; user-select: none; }
.top-menu > summary * { pointer-events: none; }
.dropdown-item { min-height: 48px; }
.dropdown-item * { pointer-events: none; }

/* Suggestion d'expiration quand un message contient une date */
.date-suggest { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; padding: 10px 12px;
  border-radius: var(--radius-small); background: var(--warn-soft); color: var(--ink); font-size: .9rem; animation: slide-down .3s var(--ease-bounce); }
.date-suggest.applied { background: var(--ok-soft); color: var(--ok); }
.date-suggest .date-warn { flex-basis: 100%; color: var(--danger); font-weight: 650; }

/* Journal « Dernières commandes reçues » (accueil) */
.list.activity > li { padding: 10px 14px; }
.list.activity > li.is-bad { background: var(--danger-soft); }
.list.activity > li.is-bad .small { color: var(--danger); font-weight: 600; }

/* Page « Overlay Spotify » : aperçu collant à côté du formulaire */
.sp-editor { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .sp-editor { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } .sp-preview-panel { position: sticky; top: 80px; } }
.sp-preview { display: block; padding: 28px 20px; min-height: 180px; border-radius: var(--radius-small); overflow: hidden; }
.sp-preview.checker { background: repeating-conic-gradient(#d9d2c4 0 25%, #f3ede1 0 50%) 0 0 / 22px 22px; }
.sp-preview.dark { background: linear-gradient(135deg, #20283a, #0f1622 60%, #3a2440); }
.sp-preview.light { background: #f4f4f4; }
.sp-form fieldset { background: var(--surface); }
.sp-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.sp-save { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 35%); }

/* Sélecteur d'emojis / emotes Twitch des champs de messages */
.emoji-wrap { position: relative; display: block; }
.emoji-wrap > input, .emoji-wrap > textarea { padding-right: 46px; }
.emoji-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; font-size: 1.2rem; cursor: pointer;
  filter: grayscale(.6); transition: filter .2s, transform .2s var(--ease-bounce), background-color .2s;
}
.emoji-wrap.is-area .emoji-toggle { top: 8px; transform: none; }
.emoji-toggle:hover, .emoji-toggle:focus-visible { filter: none; background: var(--accent-soft); transform: translateY(-50%) scale(1.12); }
.emoji-wrap.is-area .emoji-toggle:hover { transform: scale(1.12); }
.emoji-panel {
  position: absolute; z-index: 70; max-height: 380px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  animation: drop-in .2s var(--ease-bounce);
}
/* Barre des catégories : jamais écrasée ni recouverte (flex: none), passe à la ligne au lieu de défiler. */
.emoji-tabs { flex: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 2px solid var(--line); }
.emoji-tab { flex: 1 0 auto; min-width: 34px; padding: 0 6px; height: 34px; border: 0; border-radius: 10px; background: none; font-size: 1.1rem; cursor: pointer; color: var(--ink); font-weight: 600; }
.emoji-tab[aria-selected="true"] { background: var(--accent-soft); }
.emoji-search { flex: none; margin: 8px 8px 0; width: calc(100% - 16px) !important; min-height: 36px !important; }
.emoji-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 8px 10px; }
.emoji-group { margin: 8px 2px 4px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); cursor: help; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; }
.emoji-item { height: 36px; border: 0; border-radius: 8px; background: none; font-size: 1.35rem; cursor: pointer; display: grid; place-items: center; }
.emoji-item:hover { background: var(--accent-soft); }
.emoji-item:hover img { transform: scale(1.15); }
.emoji-item.emote img { width: 28px; height: 28px; object-fit: contain; }

/* --- Choix de police des overlays : aperçu --- */
.font-field select { max-width: 360px; }
.font-preview { display: block; margin-top: 8px; font-size: 22px; line-height: 1.3; }
.font-preview.muted { opacity: .55; }

/* Formulaire en cours d'enregistrement (cases de l'équipe…) : un clic à la fois. */
form.is-saving { pointer-events: none; opacity: .6; }

/* Listes longues (citations, mots du bingo) : hauteur limitée, défilement à l'intérieur */
.scroll-area { max-height: max(420px, 70vh); overflow: auto; overscroll-behavior: contain; }
.table-wrap.scroll-area thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }

/* Validation groupée : barre au-dessus de la liste, case en tête de chaque ligne */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 8px 12px; border: 2px dashed var(--line); border-radius: var(--radius); transition: border-color .2s, background-color .2s; }
.bulk-bar.has-selection { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.bulk-all { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; cursor: pointer; }
.bulk-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.bulk-check, .bulk-all input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; flex: none; }
.bulk-cell { width: 1%; }

/* Bouton « Enregistrer » flottant : apparaît dès qu'un formulaire est modifié */
.save-float { position: fixed; z-index: 55; right: 24px; bottom: 24px; display: flex; gap: 12px; align-items: center; padding: 8px 8px 8px 18px; background: var(--surface); border: 2px solid var(--accent); border-radius: 999px; box-shadow: var(--shadow); animation: save-in .45s var(--ease-bounce); }
.save-float .text { font-weight: 700; font-size: .9rem; color: var(--ink); }
.save-float .button { animation: save-nudge 2.4s ease-in-out 1s infinite; }
.save-float.leaving { animation: save-out .25s ease forwards; }
@keyframes save-in { from { opacity: 0; transform: translateY(40px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes save-out { to { opacity: 0; transform: translateY(24px) scale(.95); } }
@keyframes save-nudge { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-3px); } }
@media (max-width: 640px) {
  .save-float { left: 16px; right: 16px; bottom: 16px; justify-content: space-between; }
}

/* Page « Overlay OBS » d'un module : aperçu(s) en direct + sons */
.overlay-tools-title { font-size: 1rem; margin: 18px 0 10px; }
.overlay-previews.several { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: start; }
.overlay-preview-card { min-width: 0; }
.overlay-form-section { margin-top: 26px; }
.overlay-preview {
  position: relative; overflow: hidden; max-width: 100%; border: 2px solid var(--line); border-radius: var(--radius);
  /* damier : montre la transparence, comme dans OBS */
  background-color: #2b2b33;
  background-image: linear-gradient(45deg, #34343d 25%, transparent 25%, transparent 75%, #34343d 75%), linear-gradient(45deg, #34343d 25%, transparent 25%, transparent 75%, #34343d 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px;
}
.overlay-preview iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: transparent; pointer-events: none; }
.overlay-preview-actions { margin-top: 10px; align-items: center; }
.overlay-preview-actions form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; }
/* Export vidéo (public/js/app.js) : seul l'aperçu agrandi reste visible, la capture est recadrée dessus. */
html.is-filming body { background: #15151a; overflow: hidden; }
html.is-filming body * { visibility: hidden; }
html.is-filming .overlay-preview.recording, html.is-filming .overlay-preview.recording *,
html.is-filming .recording-bar, html.is-filming .recording-bar * { visibility: visible; }
.overlay-preview.recording { position: fixed; z-index: 100; max-width: none; border-color: transparent; border-radius: 0; }
.recording-bar { position: fixed; z-index: 101; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.recording-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--live); animation: pulse-soft 1.2s ease-in-out infinite; }
.sound-moment { background: var(--paper); }
.sound-grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .sound-grid { grid-template-columns: 2fr 1.4fr 1fr 1fr; align-items: start; } }
.sound-grid input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 10px; }
.sound-grid output { font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.sound-moment-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.sound-moment-foot .switch { margin-bottom: 10px; }

/* Bibliothèque de sons */
.sound-drop { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 26px 16px; border: 2px dashed var(--line); border-radius: var(--radius); transition: border-color .2s, background-color .2s; }
.sound-drop > .icon { width: 34px; height: 34px; color: var(--accent); }
.sound-drop p { margin: 0; }
.sound-drop.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.sound-upload-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: .9rem; }
.sound-upload-list .success { color: var(--ok, #2f7d32); }
.sound-upload-list .error { color: var(--danger, #c0392b); }
.sound-upload-list li { display: grid; gap: 4px; justify-items: center; margin-top: 6px; }
.sound-upload-list progress { width: min(320px, 100%); height: 8px; appearance: none; border: 0; border-radius: 4px; overflow: hidden; background: var(--line); accent-color: var(--accent); }
.sound-upload-list progress::-webkit-progress-bar { background: var(--line); }
.sound-upload-list progress::-webkit-progress-value { background: var(--accent); transition: width .2s; }
.sound-upload-list progress::-moz-progress-bar { background: var(--accent); }
.sound-share { margin: 0; align-items: center; gap: 8px; }
.sound-rename { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sound-rename input { flex: 1 1 14rem; font-weight: 700; }
.list audio { height: 36px; max-width: 260px; }

/* Classement du preums : podium et avatars */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; margin: 10px 0 22px; text-align: center; }
.podium-place { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.podium-name { font-weight: 800; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 5px solid var(--podium-color, var(--line)); background: var(--surface); }
.place-1 .podium-avatar { width: 110px; height: 110px; }
.place-1 { --podium-color: #f9be42; --step: 120px; --step-bg: #f07522; }
.place-2 { --podium-color: #cfc8bd; --step: 84px; --step-bg: #d94722; }
.place-3 { --podium-color: #d98a4e; --step: 62px; --step-bg: #f9be42; }
.podium-step { width: 100%; height: var(--step); margin-top: 6px; display: grid; place-items: center; border-radius: 14px 14px 0 0; background: var(--step-bg); color: #fff; font: 800 2.2rem/1 var(--display); box-shadow: var(--shadow); }
.place-3 .podium-step { color: #3b1a0c; }
.avatar-initial { display: inline-grid; place-items: center; font: 800 1.6rem/1 var(--display); color: var(--ink-soft); background: var(--line); }
.place-1 .avatar-initial { font-size: 2.2rem; }
.lb-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.lb-avatar.avatar-initial { font-size: 1rem; }
@media (max-width: 480px) {
  .podium-avatar { width: 64px; height: 64px; } .place-1 .podium-avatar { width: 80px; height: 80px; }
}
.podium + .leaderboard li .rank { color: var(--ink-soft); } /* les 3 premiers sont déjà sur le podium */

/* Course de rongeurs : coureurs et paris en direct */
.race-runners { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.race-runner { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.race-runner.winner { border-color: var(--runner-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--runner-color) 30%, transparent); }
.race-runner .main { flex: 1; min-width: 0; }
.race-number { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--runner-color); color: #fff; font-weight: 900; font-size: 1.2rem; text-shadow: 0 1px 2px rgb(0 0 0 / .4); }
.race-bar { height: 8px; margin-top: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.race-bar span { display: block; height: 100%; background: var(--runner-color); border-radius: inherit; transition: width .4s ease; }
.race-count { font-size: 1.4rem; font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: right; }

/* ---- Complot de Pèv ---- */
.pev-gauge { position: relative; height: 34px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 10px; }
.pev-gauge span { position: absolute; inset: 0 auto 0 0; width: var(--level); background: repeating-linear-gradient(-45deg, #1c1c1c 0 14px, #3a3a3a 14px 28px); transition: width .6s ease; }
.pev-gauge strong { position: relative; display: block; text-align: center; line-height: 34px; color: #fff; mix-blend-mode: difference; font-variant-numeric: tabular-nums; }
.actions .race-open { flex: 1 1 100%; }

/* Bingo : variantes d'un mot (termes fusionnés) */
.bingo-variants { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--ink-soft); }
.bingo-variant { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.bingo-variant button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; opacity: .6; }
.bingo-variant button:hover { opacity: 1; }
.bingo-merge { margin-top: 4px; }
.bingo-merge summary { cursor: pointer; color: var(--ink-soft); }
.bingo-merge form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bingo-merge input[type="text"], .bingo-merge input[type="search"] { min-width: 10rem; flex: 1; }

/* Fusion d'un mot : résultats de la recherche du mot final */
.merge-results { list-style: none; margin: 0; padding: 4px; flex: 1 1 100%; max-height: 240px; overflow: auto; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.merge-results[hidden] { display: none; }
.bingo-merge .merge-results { order: 1; } /* sous le champ et le bouton */
.merge-results button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.merge-results button:hover, .merge-results button.is-active { background: var(--accent-soft); }
.merge-results .empty-result { padding: 8px 10px; }

/* Petits écrans : mots du bingo et citations en liste simple, actions flottantes en bas (mobilePick.ejs) */
.pick-only { display: none; }
.pick-bar[hidden], .pick-bar [hidden] { display: none !important; }
.pick-bar { position: fixed; z-index: 60; left: 8px; right: 8px; bottom: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border: 2px solid var(--accent); border-radius: 18px; box-shadow: var(--shadow); animation: save-in .35s var(--ease-bounce); }
.pick-bar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pick-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pick-close { flex: none; border: 0; background: none; color: var(--ink-soft); font-size: 1.7rem; line-height: 1; padding: 0 6px; cursor: pointer; }
.pick-bar-actions { display: flex; gap: 6px; }
.pick-bar-actions .button { flex: 1 1 0; min-width: 0; min-height: 58px; padding: 4px 6px; flex-direction: column; gap: 3px; border-radius: 14px; font-size: .8rem; }
.pick-bar-actions .button[data-pick="delete"] { flex: 0 0 48px; }
.pick-bar-body form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.pick-bar-body input[type="text"], .pick-bar-body input[type="search"] { flex: 1 1 100%; min-width: 0; font-size: 16px; /* pas de zoom automatique sur iPhone */ }
.pick-bar-body button[type="submit"] { flex: 1 1 100%; min-height: 46px; order: 2; }
.pick-bar-body .merge-results { order: 1; }
.pick-bar-body .merge-results { max-height: 34vh; }
@media (max-width: 719px) {
  .pick-ready .pick-hide { display: none !important; }
  .pick-ready .pick-only { display: inline; }
  .pick-ready [data-pick-item] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .pick-ready [data-pick-item].is-picked { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); box-shadow: inset 4px 0 0 var(--accent); }
  .pick-ready .scroll-area { max-height: none; overflow: visible; }
  .pick-ready .list .main { min-width: 0; overflow-wrap: anywhere; }
  .pick-ready .pick-table thead { display: none; }
  .pick-ready .pick-table, .pick-ready .pick-table tbody { display: block; }
  .pick-ready .pick-table tr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 8px; border-bottom: 2px solid var(--line); }
  .pick-ready .pick-table td { display: block; padding: 0; border: 0; }
  .pick-ready .pick-table td:not(.bulk-cell) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .pick-ready .pick-table .bulk-cell { width: auto; padding-top: 2px; }
  body.pick-open { padding-bottom: 150px; }
}

/* Administration : journal des mises à jour automatiques */
.deploy-log { max-height: 320px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius); background: rgb(0 0 0 / .06); font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* Aide au réglage du subathon : fenêtres « objectif » et « estimation » */
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:hover { filter: brightness(1.15); }
.calc-links { margin: -4px 0 14px; }
.calc-links[hidden], [data-calc-mix-choices][hidden] { display: none; }
.calc-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.calc-dialog::backdrop { background: rgb(0 0 0 / .45); }
.calc-dialog .panel-head h2 { font-size: 1.3rem; }
.calc-advanced { margin: 4px 0 16px; }
.calc-advanced summary { cursor: pointer; }
.calc-results h3 { margin: 8px 0 4px; }
.calc-results .table td { padding: 8px; }
@media (max-width: 639px) { .calc-dialog { padding: 16px; } }
/* Champs côte à côte : libellé, champ et aide sur trois lignes communes (subgrid), pour que les
   champs restent alignés même quand un libellé passe sur deux lignes ou qu'une aide est longue. */
@media (min-width: 640px) {
  .calc-dialog .row { row-gap: 0; column-gap: 12px; }
  .calc-dialog .row > .field { display: grid; grid-row: span 3; grid-template-rows: subgrid; align-content: start; }
  .calc-dialog .row > .field > label { align-self: end; }
  .calc-dialog .row > .field > .hint { align-self: start; }
}
