/* =====================================================================
   APPLAUDIMÈTRE · thème « plain » (base générique)
   ----------------------------------------------------------------------
   - Dashboard sobre, palette slate, polices système (aucune dépendance CDN)
   - Accent bleu neutre + vert/rouge fonctionnels (VU-mètre)
   - Les variables --yellow* portent l'accent principal (bleu ici) pour
     préserver les références var(--yellow) existantes (admin/présentateur)
   - Tous les IDs et hooks JS d'origine sont conservés
   ===================================================================== */

:root {
  --black:    #0f172a;   /* fond de page (slate-900) */
  --ink:      #0b1220;   /* sections sombres */
  --panel:    #1e293b;   /* cartes (slate-800) */
  --panel-2:  #273449;
  --line:     #334155;   /* bordures (slate-700) */
  --line-2:   #475569;   /* bordures claires (slate-600) */
  --text:     #e2e8f0;   /* texte (slate-200) */
  --muted:    #94a3b8;   /* texte secondaire (slate-400) */
  --dim:      #64748b;   /* texte tertiaire (slate-500) */
  --ink-2:    #64748b;

  --yellow:   #3B82F6;   /* accent principal (bleu neutre) */
  --yellow-2: #2563EB;
  --yellow-d: #1D4ED8;
  --magenta:  #f43f5e;   /* accent secondaire */
  --green:    #22c55e;
  --red:      #ef4444;
  --blue:     #3B82F6;

  --display: system-ui, 'Segoe UI', Roboto, sans-serif;
  --ui:      system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono:    ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --shadow:    0 4px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.45);
  --radius:    12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--ui);
  background: var(--black);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================================
   COMPOSANTS PARTAGÉS (admin + présentateur)
   ===================================================================== */

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.card h2 .ico { width: 18px; height: 18px; flex-shrink: 0; fill: var(--yellow); }

/* Buttons */
.btn {
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--ui);
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s, box-shadow .15s, transform .1s, border-color .15s;
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: var(--yellow-2); }
.btn-success { background: var(--green); color: #05230f; }
.btn-danger  { background: var(--red); }
.btn-warning { background: var(--blue); }        /* pas de jaune : accent bleu */
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.select-sm { padding: 5px 8px; font-size: .8rem; border-radius: 6px; min-width: 90px; width: auto; }

/* Forms */
input, select, textarea {
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .92rem;
  font-family: var(--ui);
  width: 100%;
}
input[type="checkbox"] { width: auto; accent-color: var(--blue); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
input[type="range"] { accent-color: var(--blue); padding: 0; }
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block; font-size: .78rem; color: var(--muted);
  margin-bottom: 6px; font-weight: 500;
}
.form-row { display: flex; gap: 12px; align-items: end; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted); font-size: .72rem; letter-spacing: .8px;
  text-transform: uppercase; font-weight: 600; background: var(--ink);
}
tbody tr:hover td { background: rgba(59,130,246,.05); }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

/* Badges */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; font-family: var(--ui);
}
.badge-finalist { background: rgba(59,130,246,.18); color: var(--blue); }
.badge-winner   { background: var(--blue); color: #fff; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line);
  margin-bottom: 22px; flex-wrap: wrap;
}
.tab {
  padding: 10px 20px; background: transparent; border: none;
  color: var(--muted); cursor: pointer;
  font-family: var(--ui); font-size: .92rem; font-weight: 600;
  position: relative; transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--blue);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =====================================================================
   EN-TÊTE RÉGIE (admin.html)
   ===================================================================== */

.admin-header {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 8px 0 24px;
}
.admin-header .brand { display: flex; align-items: center; gap: 14px; }
.admin-header .brand img { width: 48px; height: 48px; object-fit: contain; }
.admin-header .brand .titles { line-height: 1.2; }
.admin-header .brand h1 {
  font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  letter-spacing: .3px;
}
.admin-header .brand .subtitle { color: var(--muted); font-size: .8rem; margin-top: 2px; }

.status-strip { display: flex; gap: 22px; margin-left: 8px; }
.status-strip .item { display: flex; flex-direction: column; gap: 2px; }
.status-strip .item-label {
  font-size: .68rem; letter-spacing: 1px; text-transform: uppercase; color: var(--dim);
}
.status-strip .item-value strong { font-size: .95rem; color: var(--text); }

.regie-link, .external-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: .82rem; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.regie-link:hover, .external-link:hover { border-color: var(--blue); background: var(--panel-2); }
.regie-link svg, .external-link svg { width: 14px; height: 14px; }

/* Calibration */
.calib-grid {
  display: grid; grid-template-columns: 200px 1fr 1fr; gap: 20px;
  align-items: start;
}
.calib-meter {
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; text-align: center;
}
.calib-meter .label { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }
.calib-meter #calDb { font-family: var(--mono); font-size: 1.6rem; color: var(--blue); margin: 6px 0; }
.calib-meter #calLevel { font-family: var(--mono); font-size: .9rem; color: var(--muted); }
.calib-actions { display: flex; flex-direction: column; gap: 8px; }
.calib-thresholds { display: flex; flex-direction: column; gap: 10px; }
#calStatus { color: var(--muted); font-size: .85rem; margin-top: 12px; }

/* Tableaux de poule (admin) */
.pool-table { margin-bottom: 24px; }
.pool-table h3 { font-size: 1rem; color: var(--blue); margin-bottom: 10px; }
.pool-table .rank-1 { background: rgba(59,130,246,.12); }
.pool-table .rank-1 td:first-child::before { content: "🥇 "; }

/* =====================================================================
   INDICATEUR SIGNAL (partagé index + présentateur)
   ===================================================================== */

.signal-pill {
  position: fixed; top: 14px; right: 14px; z-index: 1000;
  padding: 6px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; letter-spacing: .3px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.signal-pill.signal-ok    { color: var(--green); border-color: rgba(34,197,94,.5); }
.signal-pill.signal-quiet { color: var(--blue);  border-color: rgba(59,130,246,.5); }
.signal-pill.signal-error { color: var(--red);   border-color: rgba(239,68,68,.5); }

/* =====================================================================
   ÉCRAN PUBLIC (index.html) — layout sobre centré
   ===================================================================== */

body.public {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}

.public-wrap { width: 100%; max-width: 760px; text-align: center; }

.public-head { margin-bottom: 28px; }
.public-logo { width: 72px; height: 72px; object-fit: contain; opacity: .95; }
.public-title {
  font-family: var(--display); font-size: 1.8rem; font-weight: 700;
  letter-spacing: .5px; margin-top: 10px;
}
.public-phase { color: var(--muted); font-size: 1rem; margin-top: 4px; }

/* Panneau d'état */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}
.panel .lead { font-size: 1.6rem; color: var(--text); }
.panel .sub  { color: var(--muted); font-size: 1rem; margin: 4px 0; }
.panel-title { font-family: var(--display); font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }

.team-name {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800; line-height: 1.05;
  color: var(--text); margin: 8px 0;
  word-break: break-word;
}
.team-photo {
  display: block; max-width: 320px; max-height: 220px;
  margin: 18px auto; border-radius: 12px; object-fit: contain;
  box-shadow: var(--shadow);
}

/* VU-mètre horizontal */
.meter { margin-top: 26px; }
.meter-caption {
  font-size: 1rem; color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 12px;
}
.meter-track {
  position: relative; width: 100%; max-width: 620px; height: 46px;
  margin: 0 auto; background: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.meter-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--green) 0%, #eab308 62%, var(--red) 100%);
  border-radius: 999px; transition: width .06s linear;
}
.meter-peak {
  position: absolute; top: 0; bottom: 0; left: 0%; width: 3px;
  background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.8);
  transform: translateX(-1px); transition: left .08s linear;
}
.big-score, .meter-num {
  font-family: var(--mono); font-weight: 700;
  color: var(--blue); line-height: 1;
}
.meter-num { font-size: 3.4rem; margin-top: 14px; }
.big-score { font-size: clamp(3rem, 10vw, 5.5rem); margin: 18px 0; }

/* Slider manuel (fallback) */
.manual-slider { max-width: 420px; margin: 22px auto 0; }
.manual-slider input[type="range"] { width: 100%; }

/* Classement (poule + finale) */
.rank-table { margin-top: 8px; }
.rank-table td { padding: 12px 14px; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.rank-table .pr-num { width: 48px; color: var(--muted); font-family: var(--mono); text-align: center; }
.rank-table .pr-name { text-align: left; font-weight: 600; }
.rank-table .pr-score { text-align: right; font-family: var(--mono); font-weight: 700; color: var(--text); }
.rank-table .pool-winner-row td { background: rgba(59,130,246,.14); color: var(--text); }
.rank-table .pool-winner-row .pr-name::before { content: "🏆 "; }
.rank-table .pool-winner-row .pr-score { color: var(--blue); }

/* Bloc vainqueur (index) */
.winner-badge {
  display: inline-block; font-family: var(--display); font-weight: 800;
  font-size: 1.2rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--blue); margin-bottom: 12px;
}
.winner-name { color: var(--blue); }

/* Décompte 3-2-1 (overlay plein écran) */
.countdown-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,23,42,.85);
  font-family: var(--display); font-weight: 900;
  font-size: clamp(6rem, 22vw, 16rem); color: var(--blue);
}
.countdown-pulse { animation: countdown-pop .8s ease-out infinite; }
@keyframes countdown-pop {
  0%   { transform: scale(.7); opacity: 0; }
  30%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Overlay média (vidéo / image / diaporama) */
.media-overlay {
  position: fixed; inset: 0; z-index: 950;
  display: none; align-items: center; justify-content: center;
  background: #000;
}
.media-overlay video, .media-overlay img {
  width: 100%; height: 100%; object-fit: contain;
}

/* =====================================================================
   ÉTAT VAINQUEUR PLEIN ÉCRAN (.winner-stage — utilisé par le présentateur)
   ===================================================================== */

.winner-stage {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: var(--black); text-align: center; padding: 24px;
}
.winner-stage .winner-crown {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--display); font-weight: 800; font-size: 1.4rem;
  letter-spacing: 2px; text-transform: uppercase; color: var(--blue);
}
.winner-stage .winner-crown svg { width: 34px; height: 34px; fill: var(--blue); }
.winner-stage .winner-team {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(3rem, 9vw, 6rem); line-height: 1; color: var(--text);
}
.winner-stage .winner-score {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 5rem); color: var(--blue);
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .calib-grid { grid-template-columns: 1fr; }
  .form-row { flex-wrap: wrap; }
  .panel { padding: 28px 18px; }
  .public-title { font-size: 1.4rem; }
  .status-strip { gap: 16px; }
}
