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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header { text-align: center; padding: 20px 0; }
.header h1 { font-size: 2.5rem; color: #fbbf24; text-transform: uppercase; letter-spacing: 3px; }

/* Cards */
.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.card h2 {
  font-size: 1.2rem;
  color: #94a3b8;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); }
.btn-primary { background: #3b82f6; color: white; }
.btn-success { background: #22c55e; color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-warning { background: #f59e0b; color: #0f172a; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Forms */
input, select {
  background: #334155;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: #3b82f6; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
.form-row { display: flex; gap: 10px; align-items: end; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #334155; }
th { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
tr:hover { background: rgba(59, 130, 246, 0.05); }

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

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-waiting { background: #475569; color: #94a3b8; }
.badge-voting { background: #22c55e; color: #0f172a; animation: pulse 1s infinite; }
.badge-results { background: #3b82f6; color: white; }
.badge-finalist { background: #fbbf24; color: #0f172a; }
.badge-winner { background: #f59e0b; color: #0f172a; font-size: 1rem; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab {
  padding: 10px 20px;
  background: #1e293b;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.tab.active { background: #3b82f6; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Applause meter */
.meter-container {
  text-align: center;
  padding: 40px 20px;
}
.meter-label {
  font-size: 1.5rem;
  color: #94a3b8;
  margin-bottom: 20px;
}
.meter-bar-outer {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 20px;
  height: 60px;
  background: #334155;
  border-radius: 30px;
  overflow: hidden;
  position: relative;
}
.meter-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #fbbf24 60%, #ef4444 100%);
  background-size: 200% 100%;
  border-radius: 30px;
  width: 0%;
  animation: shimmer 1.6s linear infinite;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
.peak-hold {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
  transform: translateX(-2px);
  pointer-events: none;
  transition: left 0.08s linear;
}
.meter-value {
  font-size: 6rem;
  font-weight: 900;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 24px rgba(251, 191, 36, 0.4);
}
.meter-max {
  font-size: 1rem;
  color: #64748b;
  margin-top: 5px;
}

/* Décompte 3-2-1 */
.countdown {
  font-size: 8rem;
  font-weight: 900;
  color: #fbbf24;
  text-align: center;
  margin: 20px 0;
  line-height: 1;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.6);
}
.countdown-pulse { animation: countdown-pop 0.8s ease-out infinite; }
@keyframes countdown-pop {
  0% { transform: scale(0.7); opacity: 0; }
  30% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Indicateur signal audio (coin haut droit) */
.signal-pill {
  position: fixed;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 1000;
  background: #1e293b;
  border: 1px solid #334155;
  letter-spacing: 0.5px;
}
.signal-pill.signal-ok { color: #22c55e; border-color: #22c55e; }
.signal-pill.signal-quiet { color: #f59e0b; border-color: #f59e0b; }
.signal-pill.signal-error { color: #ef4444; border-color: #ef4444; }

/* Current team display */
.current-team {
  text-align: center;
  padding: 30px;
}
.current-team .team-name {
  font-size: 3rem;
  font-weight: bold;
  color: #fbbf24;
  margin: 10px 0;
}
.current-team .pool-name {
  font-size: 1.2rem;
  color: #94a3b8;
}

/* Score display */
.score-value {
  font-size: 4rem;
  font-weight: bold;
  text-align: center;
}
.score-value.winner { color: #fbbf24; }

/* Pool table in admin */
.pool-table { margin-bottom: 30px; }
.pool-table h3 {
  font-size: 1.1rem;
  color: #fbbf24;
  margin-bottom: 10px;
}
.pool-table .rank-1 { background: rgba(251, 191, 36, 0.15); }
.pool-table .rank-1 td:first-child::before { content: "🥇 "; }

/* Tournament view */
.tournament-bracket {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: start;
  padding: 30px 0;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.bracket-round h3 {
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.bracket-group {
  background: #1e293b;
  border-radius: 8px;
  padding: 15px;
  min-width: 250px;
}
.bracket-group h4 { color: #fbbf24; margin-bottom: 10px; }
.bracket-team {
  padding: 8px 12px;
  margin: 4px 0;
  background: #334155;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
}
.bracket-team.qualified { border-left: 3px solid #fbbf24; font-weight: bold; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}
.toast-success { background: #22c55e; }
.toast-error { background: #ef4444; }
.toast-info { background: #3b82f6; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Manual test slider (fallback si pas de micro) */
.manual-slider {
  margin: 20px auto;
  max-width: 400px;
}
.manual-slider input[type="range"] {
  width: 100%;
  accent-color: #fbbf24;
}

/* Workflow progress bar */
#workflowProgressBar { transition: width 0.5s ease; }

/* Team image in voting screen */
#votingImage { display: block; margin: 15px auto; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* Responsive */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tournament-bracket { flex-direction: column; align-items: center; }
  .header h1 { font-size: 1.8rem; }
}
