/* ===================== Variables & Reset ===================== */
:root {
  --bg-a: #3b0f8a;
  --bg-b: #9b1b6e;
  --bg-c: #ff6b2c;
  --bg-d: #1a0a3e;
  --card-bg: rgba(255, 255, 255, 0.97);
  --card-border: rgba(255, 255, 255, 0.55);
  --text-dark: #1a1230;
  --text-muted: #6a6480;
  --accent: #ff6b2c;
  --accent-2: #ffb703;
  --success: #1fbf5c;
  --danger: #e63946;
  --info: #457b9d;
  --radius: 22px;
  --shadow: 0 12px 36px rgba(20, 10, 50, 0.28), 0 2px 8px rgba(20, 10, 50, 0.12);
  --shadow-sm: 0 4px 14px rgba(20, 10, 50, 0.12);
  --font-size-base: 1.05rem;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
}

* { box-sizing: border-box; }

/* L'attribut HTML hidden doit toujours gagner sur les display: grid/inline-block des composants. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-size-base);
  color: var(--text-dark);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 10% 20%, rgba(255, 183, 3, 0.25), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(131, 56, 236, 0.35), transparent 50%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b), var(--bg-c), var(--bg-d));
  background-size: 100% 100%, 100% 100%, 300% 300%;
  min-height: 100vh;
}

/* Couche atmosphère (derrière le contenu, ne capture pas les clics) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("assets/bg-atmosphere.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Texture de motif discrète au-dessus de l'atmosphère */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("assets/pattern.jpg");
  background-repeat: repeat;
  opacity: 0.12;
}

body > .screen {
  position: relative;
  z-index: 0;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: gradientShift 20s ease infinite;
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%, 0% 50%, 0% 50%; }
  50% { background-position: 0% 50%, 0% 50%, 100% 50%; }
  100% { background-position: 0% 50%, 0% 50%, 0% 50%; }
}

/* Canvas confetti : plein écran, au-dessus de tout, ignore les clics de la souris */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}

/* ===================== Toasts ===================== */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 90vw;
}

.toast {
  padding: 0.9rem 1.2rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-weight: 600;
  max-width: 420px;
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toastIn 0.28s ease-out; }
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===================== Screens ===================== */
.screen {
  display: none;
  min-height: 100vh;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
}

.screen-active { display: block; }

/* ===================== Accueil (landing) ===================== */
.home-header { margin-bottom: 1.25rem; }

.home-logo {
  display: block;
  margin: 0 auto 0.75rem;
  width: 140px;
  height: 140px;
  border-radius: 28px;
  box-shadow: 0 6px 18px rgba(26, 10, 62, 0.28);
}

@media (max-width: 640px) {
  .home-logo { width: 104px; height: 104px; border-radius: 22px; }
}

.home-content {
  max-width: 960px;
  margin: 0 auto;
}

.home-intro {
  color: #fff;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.55;
  margin: 0 auto 1.5rem;
  max-width: 42rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.95;
}

.home-how-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.home-how-card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.home-how-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.home-cta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.home-cta-row .btn {
  min-width: 11rem;
}

.home-toggles {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.home-footer {
  text-align: center;
  padding-bottom: 1rem;
}

.home-footer a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.92;
}

.home-footer a:hover { opacity: 1; }

.setup-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto 0.75rem;
  gap: 0.75rem;
}

.btn-link-home {
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  opacity: 0.9;
}

.btn-link-home:hover { opacity: 1; text-decoration: underline; }

.btn-lang-toggle,
.btn-mute-toggle {
  min-width: 2.75rem;
}

@media (max-width: 640px) {
  .home-how-grid {
    grid-template-columns: 1fr;
  }
  .home-intro {
    font-size: 1rem;
    padding: 0 0.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .screen-active { animation: fadeSlideIn 0.4s ease-out; }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header {
  text-align: center;
  color: #fff;
  margin-bottom: 1.75rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.app-header h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  font-weight: 900;
}

.subtitle {
  margin: 0;
  opacity: 0.92;
  font-size: 1.08rem;
  font-weight: 500;
}

/* ===================== Cards & Layout ===================== */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  backdrop-filter: blur(8px);
}

.card h2 {
  margin-top: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ≥16px sur inputs/selects pour éviter le zoom iOS Safari au focus */
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="tel"],
select,
textarea {
  font-size: 1rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
  align-items: center;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form select {
  flex: 1 1 140px;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 2px solid #e0dcec;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Submit des formulaires joueur/équipe : largeur naturelle, pas full-width */
.inline-form > .btn {
  flex: 0 0 auto;
}

.save-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.save-toggle input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
}

.team-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 1rem;
}

.team-tools-create {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.team-tools #input-team-count {
  width: 4.5rem;
  padding: 0.65rem 0.5rem;
  border-radius: 12px;
  border: 2px solid #e0dcec;
  font-size: 1rem;
  background: #fff;
  text-align: center;
}

.team-tools #input-team-count:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.2);
}

.solo-mode-row {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.solo-mode-hint {
  margin: 0 0 1rem;
}

.btn-phase-back {
  display: block;
  margin: 0 0 0.85rem 0;
  padding: 0.5rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.9;
  box-shadow: none;
  align-self: flex-start;
}

.inline-form input:focus,
.inline-form select:focus,
#input-category-count:focus,
#input-questions-per-team:focus,
#input-lightning-duration:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.2);
}

.category-count-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

#input-category-count {
  width: 100%;
  max-width: 220px;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  border: 2px solid #e0dcec;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* Rangée nom d'équipe + 🎲 : le champ domine la largeur (y compris à 375 px) */
.team-name-row {
  display: flex;
  flex: 1 1 160px;
  gap: 0.45rem;
  align-items: center;
  min-width: 0;
}

.team-name-row #input-team-name {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

/* Cible tactile ~44×44 px pour le générateur de nom */
.btn-icon-like {
  flex: 0 0 auto;
  width: 2.75rem;   /* 44 px à base 16 px */
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

/* Formulaire joueur : le nom s'étend, l'âge reste compact */
#form-add-player #input-player-name {
  flex: 1 1 auto;
  min-width: 0;
}

.category-slots-hint {
  margin: 0 0 0.75rem;
}

.category-slots {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.category-slot-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.category-slot-num {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff9a5c);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.category-slot-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 2px solid #e0dcec;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-slot-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.2);
}

.category-slots-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.category-slots-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===================== Buttons ===================== */
.btn {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 0.72rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease, filter 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.97);
}

.btn:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-secondary {
  background: #eef0ff;
  color: var(--text-dark);
  border: 1px solid rgba(75, 31, 158, 0.08);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-correct { background: var(--success); color: #fff; }
.btn-incorrect { background: var(--danger); color: #fff; }

.btn-large { font-size: 1.25rem; padding: 1rem 2rem; }
.btn-small { font-size: 0.85rem; padding: 0.5rem 0.85rem; }

.btn-difficulty {
  color: #fff;
  font-size: 1.2rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
}

.btn-facile { background: linear-gradient(135deg, #1fbf5c, #6be08a); }
.btn-moyen { background: linear-gradient(135deg, #ffb703, #ffd166); color: #3a2800; }
.btn-difficile { background: linear-gradient(135deg, #e63946, #ff8fa3); }

.btn-method {
  background: linear-gradient(180deg, #f8f6ff, #efeaff);
  color: var(--text-dark);
  text-align: center;
  line-height: 1.4;
  padding: 1.1rem;
  border: 1px solid rgba(75, 31, 158, 0.1);
}

.method-points {
  font-weight: 900;
  color: var(--accent);
  font-size: 0.85rem;
  display: block;
  line-height: 1.3;
  margin-top: 0.25rem;
}

.method-heading {
  text-align: center;
  margin: 0.5rem 0 0;
  font-size: 1.15rem;
  color: var(--text-dark);
}

.method-buttons-zone { margin-top: 0.5rem; }

/* ===================== Item lists ===================== */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: #f5f3ff;
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(75, 31, 158, 0.06);
}

.item-row .item-label { flex: 1; font-weight: 600; }

.item-row-editing {
  flex-wrap: wrap;
  gap: 0.45rem;
}

.player-edit-name {
  flex: 1 1 8rem;
  min-width: 6rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-weight: 600;
  font-size: 0.95rem;
}

.player-edit-age {
  width: 4.5rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 0.95rem;
}

.player-edit-lang {
  flex: 0 0 auto;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
}

.item-row .btn-icon,
.team-card-header .btn-icon,
.team-player-row .btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.item-row .btn-icon:hover,
.team-card-header .btn-icon:hover,
.team-player-row .btn-icon:hover {
  background: #e8e4f8;
}

.item-row .btn-icon:focus-visible,
.team-card-header .btn-icon:focus-visible,
.team-player-row .btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ===================== Teams ===================== */
.team-list { display: flex; flex-direction: column; gap: 1rem; }

.team-card {
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: #f5f3ff;
  border-left: 8px solid #888;
  border: 1px solid rgba(75, 31, 158, 0.06);
  border-left-width: 8px;
  box-shadow: var(--shadow-sm);
}

.team-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.team-card-header input[type="text"] {
  flex: 1;
  min-width: 100px;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #ddd;
  font-weight: 700;
}

.team-card-header input[type="color"] {
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
}

.team-player-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: #fff;
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.team-player-row .btn-icon { font-size: 0.9rem; }

.team-assign-select {
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.team-reassign-select {
  max-width: 7.5rem;
  padding: 0.25rem 0.35rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 0.8rem;
  background: #fff;
  flex: 0 1 auto;
}

/* ===================== Settings ===================== */
.settings-group {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.settings-group legend {
  font-weight: 800;
  margin-bottom: 0.45rem;
  padding: 0;
  font-size: 1.02rem;
}

.radio-row {
  display: block;
  margin-bottom: 0.55rem;
  cursor: pointer;
  line-height: 1.4;
}

.radio-row input { margin-right: 0.5rem; }

.radio-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.radio-row-inline input[type="number"] {
  width: 5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  border: 2px solid #e0dcec;
  font-size: 1rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 0.4rem;
}

.lightning-hint {
  margin: 0.25rem 0 0 1.6rem;
  font-weight: 600;
}

.error-banner {
  max-width: 1200px;
  margin: 1rem auto;
  background: #ffe5e5;
  border: 2px solid var(--danger);
  color: #7a1010;
  padding: 1rem;
  border-radius: 14px;
  font-weight: 600;
  text-align: center;
}

.setup-actions {
  text-align: center;
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.podium-actions { gap: 1rem; }

/* ===================== Scoreboard ===================== */
.scoreboard {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(20, 10, 45, 0.88);
  backdrop-filter: blur(10px);
  border-radius: 0 0 20px 20px;
  padding: 0.85rem 1.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: -1.5rem -3rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.scoreboard-chips {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.score-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  color: #fff;
  font-weight: 700;
  border: 2px solid color-mix(in srgb, var(--chip-color, #fff) 55%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.score-chip .swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.score-chip .score-value {
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
  text-align: right;
}

.score-edit-btn {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  margin: 0;
  flex-shrink: 0;
}
.score-edit-btn:hover,
.score-edit-btn:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

.score-edit-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.score-edit-input {
  width: 5ch;
  min-width: 0;
  max-width: 6.5ch;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0.15rem 0.3rem;
  -moz-appearance: textfield;
}
.score-edit-input::-webkit-outer-spin-button,
.score-edit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-edit-confirm,
.score-edit-cancel {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  margin: 0;
}
.score-edit-confirm:hover,
.score-edit-cancel:hover {
  background: rgba(255, 255, 255, 0.32);
}

.score-chip .score-progress,
.score-chip .score-skips {
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 600;
  padding-left: 0.35rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  margin-left: 0.15rem;
}

.score-chip.leader {
  box-shadow: 0 0 0 3px var(--accent-2), 0 0 20px rgba(255, 183, 3, 0.65);
}

@media (prefers-reduced-motion: no-preference) {
  .score-chip.leader {
    animation: pulseLeader 1.6s ease-in-out infinite;
  }
}

@keyframes pulseLeader {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.scoreboard-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===================== Game main ===================== */
.game-main {
  max-width: 900px;
  margin: 0 auto;
}

.turn-banner {
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 18px;
  padding: 1.1rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.turn-label {
  display: block;
  font-size: 0.95rem;
  opacity: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.turn-player {
  display: inline-block;
  font-size: 1.9rem;
  font-weight: 900;
  margin-right: 0.6rem;
}

.turn-team {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.phase-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--card-border);
}

@media (prefers-reduced-motion: no-preference) {
  .phase-card:not([hidden]) {
    animation: phaseIn 0.35s ease-out;
  }
}

@keyframes phaseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* In-game scoring mode switch (category phase) */
.in-game-mode-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #f5f3ff;
  border-radius: 12px;
  border: 1px solid rgba(75, 31, 158, 0.08);
}

.in-game-mode-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.mode-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.25rem;
}

.btn-mode-option {
  font-size: 0.88rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dark);
  border: 1px solid transparent;
  box-shadow: none;
}

.btn-mode-option.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-mode-option:not(.is-active):hover {
  background: #eef0ff;
  border-color: rgba(75, 31, 158, 0.1);
}

/* Lightning choice (end of main game) */
.lightning-choice-duration {
  text-align: center;
  font-size: 1.05rem;
  margin: 0.5rem 0 1.25rem;
  color: var(--text-muted, #555);
}

.lightning-choice-buttons {
  max-width: 28rem;
  margin: 0 auto;
}

.phase-card h2 {
  margin-top: 0;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 800;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.random-category-display { text-align: center; }

.category-random-name {
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--accent);
  margin: 0.9rem 0;
  letter-spacing: -0.02em;
}

.stake-fixed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stake-wager {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.stake-wager label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.stake-wager input[type="range"] {
  width: 100%;
  margin-bottom: 0.6rem;
}

.stake-wager input[type="number"] {
  width: 140px;
  padding: 0.55rem;
  font-size: 1.2rem;
  text-align: center;
  border-radius: 12px;
  border: 2px solid #e0dcec;
  margin-bottom: 0.8rem;
}

.wager-band-label { font-size: 1.1rem; }
#wager-band-label {
  text-transform: uppercase;
  color: var(--accent);
}

/* ===================== Question card ===================== */
.question-card {
  text-align: center;
  transition: box-shadow 0.3s ease;
  border-radius: var(--radius);
}

.question-meta {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  background: #ece8ff;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid rgba(75, 31, 158, 0.1);
  text-transform: capitalize;
}

.badge-points {
  background: linear-gradient(135deg, var(--accent-2), #ffe08a);
  color: #4a2e00;
  border-color: transparent;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #4b1f9e, #6c3fcf);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(75, 31, 158, 0.25);
  box-shadow: 0 2px 8px rgba(75, 31, 158, 0.25);
}

.countdown-pill.countdown-warning {
  background: linear-gradient(135deg, #c1121f, #e63946);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(193, 18, 31, 0.4);
}

@media (prefers-reduced-motion: no-preference) {
  .countdown-pill.countdown-warning {
    animation: timerPulse 0.7s ease-in-out infinite;
  }
}

.question-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 0.75rem 0 1rem;
}

.btn-skip,
.btn-upgrade {
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
}

.btn-upgrade {
  background: linear-gradient(180deg, #fff8e6, #ffe8a8);
  color: #5a4200;
  border: 1px solid rgba(244, 162, 97, 0.45);
}

.btn-upgrade:hover {
  filter: brightness(1.03);
}

.host-adjust-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  background: #f4f1fb;
  border-radius: 14px;
  border: 1px solid rgba(75, 31, 158, 0.1);
}

.host-adjust-label {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.host-adjust-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.host-adjust-note {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.player-lang-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #ece8ff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid rgba(75, 31, 158, 0.15);
  flex: 0 0 auto;
}

.player-lang-select {
  flex: 0 0 auto !important;
  width: 4.5rem !important;
  min-width: 4.5rem !important;
}

.saved-chip-body .player-lang-tag {
  margin-left: 0.35rem;
}

.item-row .player-lang-tag {
  margin-right: 0.25rem;
}

.question-text {
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 1rem 0 0.75rem;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.base-stake-line {
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.consultation-badge {
  display: inline-block;
  background: #fff3cd;
  color: #7a5a00;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 183, 3, 0.4);
}

.revealed-answer {
  font-size: 1.45rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.glow-correct {
  box-shadow: 0 0 0 4px var(--success), 0 0 40px rgba(31, 191, 92, 0.7) !important;
}

.shake {
  box-shadow: 0 0 0 4px var(--danger) !important;
}

@media (prefers-reduced-motion: no-preference) {
  .shake { animation: shakeAnim 0.5s ease; }
}

@keyframes shakeAnim {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

.qcm-choice-btn {
  background: linear-gradient(180deg, #f8f6ff, #efeaff);
  color: var(--text-dark);
  font-size: 1.1rem;
  padding: 1.05rem;
  border-radius: 16px;
  border: 1px solid rgba(75, 31, 158, 0.1);
}

.qcm-choice-btn.choice-correct { background: var(--success); color: #fff; border-color: transparent; }
.qcm-choice-btn.choice-incorrect { background: var(--danger); color: #fff; border-color: transparent; }
.qcm-choice-btn:disabled { cursor: default; transform: none; }

/* ===================== Resolution ===================== */
.resolution-banner {
  text-align: center;
  font-size: 1.65rem;
  font-weight: 900;
  padding: 1.1rem;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.resolution-banner.win { background: #d9f7e2; color: #0a6b2f; }
.resolution-banner.lose { background: #fbdada; color: #8a1414; }

.explanation-panel {
  background: #fff8e6;
  border-left: 6px solid var(--accent-2);
  border-radius: 14px;
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.explanation-panel h3 { margin-top: 0; }

/* ===================== Feedback box ===================== */
.feedback-slot {
  margin: 0 0 1.25rem;
  max-width: 100%;
  min-width: 0;
}

.feedback-box {
  max-width: 100%;
}

.feedback-toggle {
  width: auto;
  max-width: 100%;
}

.feedback-form {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(26, 18, 48, 0.1);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.feedback-title {
  margin: 0 0 0.65rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.feedback-type-label,
.feedback-comment-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.45rem 0 0.25rem;
}

.feedback-type {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(26, 18, 48, 0.18);
  background: #fff;
  color: var(--text-dark);
}

.feedback-comment {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(26, 18, 48, 0.18);
  background: #fff;
  color: var(--text-dark);
  resize: vertical;
  min-height: 4.5rem;
}

.feedback-charcount {
  margin: 0.35rem 0 0.6rem;
  font-size: 0.8rem;
  text-align: right;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.feedback-actions .btn {
  flex: 0 1 auto;
}

/* ===================== Lightning ===================== */
.lightning-interstitial,
.lightning-recap {
  text-align: center;
}

.lightning-ready {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0.5rem 0 1.25rem;
}

.lightning-play { text-align: center; }

.lightning-timer {
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text-dark);
  line-height: 1;
  margin: 0.25rem 0 0.75rem;
  letter-spacing: -0.03em;
}

.lightning-timer.timer-urgent {
  color: var(--danger);
}

@media (prefers-reduced-motion: no-preference) {
  .lightning-timer.timer-urgent {
    animation: timerPulse 0.7s ease-in-out infinite;
  }
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.lightning-tally {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 1.25rem;
}

.lightning-qa {
  background: #f5f3ff;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(75, 31, 158, 0.08);
}

.lightning-question {
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  font-weight: 800;
  margin: 0 0 1rem;
  line-height: 1.35;
}

.lightning-answer-line {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-muted);
}

.lightning-answer-line strong {
  color: var(--text-dark);
  font-size: 1.35rem;
}

.lightning-controls { max-width: 520px; margin: 0 auto; }

.lightning-recap-text {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0.5rem 0 1.5rem;
}

/* ===================== Podium ===================== */
.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5rem;
  max-width: 900px;
  margin: 2rem auto;
  flex-wrap: wrap;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.podium-block {
  width: 160px;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1rem;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
}

.podium-place.first .podium-block {
  height: 230px;
  order: 2;
  box-shadow: 0 0 0 4px var(--gold), var(--shadow);
}

.podium-place.second .podium-block {
  height: 170px;
  box-shadow: 0 0 0 4px var(--silver), var(--shadow);
}

.podium-place.third .podium-block {
  height: 120px;
  box-shadow: 0 0 0 4px var(--bronze), var(--shadow);
}

@media (prefers-reduced-motion: no-preference) {
  .podium-place.first .podium-block { animation: podiumRise 0.7s ease-out 0.15s both; }
  .podium-place.second .podium-block { animation: podiumRise 0.7s ease-out both; }
  .podium-place.third .podium-block { animation: podiumRise 0.7s ease-out 0.3s both; }
}

@keyframes podiumRise {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.podium-place .podium-name {
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 0.65rem;
}

.podium-place .podium-score {
  font-size: 1.1rem;
  opacity: 0.92;
}

.podium-others {
  max-width: 700px;
  margin: 0 auto 1rem;
  color: #fff;
  text-align: center;
}

.podium-others-row {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 0.65rem 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}

/* ===================== Responsive ===================== */
@media (max-width: 1024px) {
  /* minmax(0, 1fr) et non 1fr : une piste « 1fr » garde min-width:auto, donc les
     cartes refusent de rétrécir sous la largeur de leur contenu et élargissent la
     page. Même motif qu'à la définition de base de .setup-grid. */
  .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .scoreboard { margin: -1.5rem -1rem 1.5rem; }
}

@media (max-width: 640px) {
  .screen { padding: 1rem 0.8rem 2.5rem; }
  #screen-game.screen { padding-top: 0.65rem; }
  .setup-grid { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  /* Sur écran très étroit (≈320px), la rangée joueur/équipe doit pouvoir
     replier ses boutons sur une 2e ligne plutôt que déborder la page. */
  .item-row {
    flex-wrap: wrap;
    min-width: 0;
    /* Une fois repliée, « space-between » écarterait ✏️ et ✕ aux deux bouts de
       la dernière ligne : on les garde groupés. */
    justify-content: flex-start;
  }
  /* Un <select> se dimensionne sur son option la plus longue : sans borne, un
     nom d'équipe à rallonge élargit la rangée puis la page entière. */
  .team-assign-select {
    min-width: 0;
    max-width: 100%;
  }
  .item-row-editing {
    gap: 0.35rem;
  }
  .player-edit-name {
    flex: 1 1 100%;
    min-width: 0;
  }
  .player-edit-age {
    width: 4rem;
  }
  .team-reassign-select {
    max-width: 6.5rem;
    font-size: 0.75rem;
  }
  .in-game-mode-switch {
    flex-direction: column;
    align-items: stretch;
    padding: 0.55rem 0.7rem;
  }
  .mode-segmented {
    width: 100%;
  }
  .btn-mode-option {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.82rem;
    padding: 0.5rem 0.55rem;
  }
  .lightning-choice-buttons {
    grid-template-columns: 1fr;
  }
  .scoreboard {
    flex-direction: column;
    align-items: stretch;
    margin: -0.65rem -0.8rem 0.65rem;
    padding: 0.5rem 0.8rem;
    gap: 0.45rem;
  }
  .scoreboard-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Indispensable : le bandeau passe en colonne sous 640px, donc l'axe
       transversal est horizontal. Avec une largeur auto, « align-items: stretch »
       étire cet élément à la taille de la LIGNE flex — laquelle prend la largeur
       max-content des pastilles (≈695px pour 4 équipes) et non les 375px du
       conteneur. Résultat : overflow-x ne sert à rien et c'est la page entière
       qui défile. Une largeur explicite ancre la taille sur le conteneur ;
       le défilement redevient interne aux pastilles. */
    width: 100%;
  }
  .score-chip {
    flex: 0 0 auto;
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
    gap: 0.35rem;
  }
  .score-chip .swatch {
    width: 0.8rem;
    height: 0.8rem;
  }
  .score-chip .score-progress,
  .score-chip .score-skips {
    font-size: 0.72rem;
    padding-left: 0.25rem;
  }
  .scoreboard-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
  }
  .scoreboard-actions .btn {
    flex: 0 0 auto;
    min-height: 40px;
    min-width: 40px;
    padding: 0.35rem 0.55rem;
    font-size: 0.9rem;
    width: auto;
  }
  /* Icon-only import / end-game on mobile; lang toggle keeps its EN/FR text */
  .scoreboard-actions .btn-label {
    display: none;
  }
  .button-grid { grid-template-columns: 1fr; }
  .stake-fixed { grid-template-columns: 1fr; }
  .btn-large {
    font-size: 1.05rem;
    padding: 0.85rem 1.4rem;
    width: 100%;
  }
  /* Sur petit écran : la rangée nom+🎲 occupe toute la largeur ; le submit passe en dessous.
     Le champ nom reste l'élément le plus large de sa rangée (pas width:100% sur le 🎲). */
  .inline-form > .btn { flex: 0 0 auto; }
  #form-add-team > .btn[type="submit"],
  #form-add-player > .btn[type="submit"] { width: 100%; }
  .team-name-row {
    flex: 1 1 100%;
    width: 100%;
  }
  .team-name-row #input-team-name {
    flex: 1 1 auto;
    min-width: 0;
  }
  .team-name-row .btn-icon-like {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
  }
  .category-slots-actions { flex-direction: column; }
  .category-slots-actions .btn { width: 100%; }
  .category-slot-row { align-items: stretch; }
  .turn-banner {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
  }
  .turn-label {
    font-size: 0.75rem;
    letter-spacing: 0.03em;
  }
  .turn-player {
    display: inline-block;
    font-size: 1.15rem;
    margin-bottom: 0;
    margin-right: 0.4rem;
  }
  .turn-team {
    font-size: 0.85rem;
  }
  .podium-block { width: 100px; font-size: 1.4rem; }
  .podium-place.first .podium-block { height: 170px; }
  .podium-place.second .podium-block { height: 125px; }
  .podium-place.third .podium-block { height: 95px; }
  .setup-actions .btn { width: 100%; max-width: 360px; }
  .lightning-controls { grid-template-columns: 1fr; }
}

/* ===================== Joueurs / équipes enregistrés (chips) ===================== */
.saved-roster-block {
  margin: 0.85rem 0 0.5rem;
}

.saved-roster-heading {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
}

.saved-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 0.5rem;
}

.saved-chip {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--saved-chip-color, var(--accent)) 12%, #fff);
  border: 2px solid color-mix(in srgb, var(--saved-chip-color, var(--accent)) 45%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  max-width: 100%;
}

.saved-chip-body {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  text-align: left;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-chip-body:hover {
  background: color-mix(in srgb, var(--saved-chip-color, var(--accent)) 18%, transparent);
}

.saved-chip-remove {
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--saved-chip-color, var(--accent)) 30%, transparent);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  line-height: 1;
}

.saved-chip-remove:hover {
  color: #c1121f;
  background: rgba(193, 18, 31, 0.08);
}

/* ===================== Historique & statistiques ===================== */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto 1.5rem;
}

.history-empty {
  margin: 0.5rem 0 0;
}

.history-games-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-game-row {
  background: color-mix(in srgb, var(--accent) 6%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}

.history-game-date {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.history-game-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-team-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}

.history-team-chip.winner {
  background: color-mix(in srgb, #ffd700 35%, #fff);
  border-color: color-mix(in srgb, #ffb703 70%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, #ffb703 40%, transparent);
  font-weight: 800;
}

.history-winner-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a5a00;
  background: rgba(255, 215, 0, 0.45);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.history-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-stats-header,
.history-stats-row {
  display: grid;
  grid-template-columns: minmax(5rem, 1.4fr) repeat(4, minmax(3.2rem, 1fr));
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
}

.history-stats-header {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  padding-bottom: 0.55rem;
  margin-bottom: 0.15rem;
}

.history-stats-row {
  background: color-mix(in srgb, var(--accent) 5%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.history-stats-cell {
  text-align: center;
}

.history-stats-cell.name {
  text-align: left;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-actions {
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  .history-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .home-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .home-cta-row .btn {
    width: 100%;
    min-width: 0;
  }
  .history-stats-header,
  .history-stats-row {
    grid-template-columns: minmax(4rem, 1.2fr) repeat(4, minmax(2.5rem, 1fr));
    font-size: 0.8rem;
    gap: 0.2rem;
    padding: 0.4rem 0.35rem;
  }
  .history-stats-header {
    font-size: 0.68rem;
  }
  .saved-chip-body {
    max-width: 12rem;
  }
}

/* ===================== Mode Jeopardy ===================== */
/* Palette scoped to Jeopardy — compatible with app :root tokens */
#phase-jeopardy-board,
#phase-jeopardy-clue,
#phase-jeopardy-daily-double,
#phase-jeopardy-round-break,
#phase-jeopardy-final-wager,
#phase-jeopardy-final-clue {
  --j-board-blue: #06164a;
  --j-cell-blue: #0b2a8c;
  --j-cell-blue-hi: #1540b8;
  --j-header-navy: #041038;
  --j-header-navy-hi: #0a1f5c;
  --j-gold: #ffd24a;
  --j-gold-hi: #ffe38a;
  --j-bevel-hi: rgba(255, 255, 255, 0.22);
  --j-bevel-lo: rgba(0, 0, 0, 0.45);
  --j-used: #050a1c;
  --j-used-edge: #0a1228;
  --j-text: #f4f0ff;
  --j-muted: rgba(244, 240, 255, 0.72);
  --j-focus: #ffb703;
}

.jeopardy-categories-hint {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.jeopardy-pick-hint {
  text-align: center;
  margin: 0.25rem 0 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.jeopardy-board-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0.35rem;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(6, 22, 74, 0.92), rgba(4, 16, 56, 0.96));
  box-shadow:
    inset 0 0 0 2px rgba(255, 210, 74, 0.18),
    0 8px 28px rgba(4, 10, 40, 0.35);
}

.jeopardy-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(3.4rem, 1fr));
  gap: 0.3rem;
  width: 100%;
  min-width: 21rem;
}

.jeopardy-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 8px;
  min-height: 3.1rem;
  padding: 0.4rem 0.2rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.15;
}

.jeopardy-header {
  background:
    linear-gradient(180deg, var(--j-header-navy-hi), var(--j-header-navy));
  color: #fff;
  font-size: clamp(0.62rem, 1.35vw, 0.82rem);
  font-weight: 800;
  min-height: 3.6rem;
  cursor: default;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
  border-bottom: 3px solid var(--j-gold);
  box-shadow:
    inset 0 1px 0 var(--j-bevel-hi),
    inset 0 -1px 0 var(--j-bevel-lo),
    0 2px 0 rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.jeopardy-value {
  background:
    linear-gradient(165deg, var(--j-cell-blue-hi) 0%, var(--j-cell-blue) 55%, #081f6a 100%);
  color: var(--j-gold);
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  word-break: keep-all;
  text-shadow:
    0 0 12px rgba(255, 210, 74, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.45);
  box-shadow:
    0 4px 0 #040e38,
    inset 0 1px 0 var(--j-bevel-hi),
    inset 0 -2px 0 var(--j-bevel-lo),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.jeopardy-value:hover:not(:disabled):not(.is-used) {
  filter: brightness(1.14);
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 #040e38,
    inset 0 1px 0 var(--j-bevel-hi),
    inset 0 -2px 0 var(--j-bevel-lo),
    0 0 16px rgba(255, 210, 74, 0.2);
}

.jeopardy-value:active:not(:disabled):not(.is-used) {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 #040e38,
    inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.jeopardy-value:focus-visible {
  outline: 3px solid var(--j-focus);
  outline-offset: 2px;
  z-index: 1;
}

.jeopardy-value.is-used,
.jeopardy-value:disabled {
  background:
    linear-gradient(180deg, var(--j-used-edge), var(--j-used));
  color: transparent;
  cursor: default;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 2px 8px rgba(0, 0, 0, 0.55);
  text-shadow: none;
  filter: none;
  transform: none;
}

/* ── Theme: clue / Daily Double / Final (blue–gold board continuity) ── */
.jeopardy-theme {
  background:
    linear-gradient(165deg, #0a1f6a 0%, var(--j-board-blue, #06164a) 55%, #040e30 100%) !important;
  color: var(--j-text, #f4f0ff);
  border: 1px solid rgba(255, 210, 74, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 36px rgba(4, 10, 40, 0.4);
}

.jeopardy-theme h2 {
  color: var(--j-gold, #ffd24a);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.jeopardy-theme .muted {
  color: var(--j-muted, rgba(244, 240, 255, 0.72));
}

#jeopardy-clue-card.jeopardy-theme {
  padding: 1.15rem 1.15rem 1.35rem;
}

#jeopardy-clue-card .question-meta {
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

#jeopardy-clue-card .badge,
#jeopardy-clue-card .badge-points {
  background: linear-gradient(180deg, var(--j-header-navy-hi, #0a1f5c), var(--j-header-navy, #041038));
  color: var(--j-gold, #ffd24a);
  border: 1px solid rgba(255, 210, 74, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

#jeopardy-clue-card .countdown-pill,
#phase-jeopardy-final-clue .countdown-pill {
  background: rgba(0, 0, 0, 0.35);
  color: var(--j-gold, #ffd24a);
  border: 1px solid rgba(255, 210, 74, 0.3);
}

#jeopardy-clue-text,
#jeopardy-final-clue-text {
  text-align: center;
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  margin: 0.5rem 0 1.15rem;
}

#jeopardy-answer-zone {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 210, 74, 0.25);
  animation: jeopardy-reveal 0.35s ease both;
}

#jeopardy-answer-zone .revealed-answer,
#jeopardy-final-answer-zone .revealed-answer {
  text-align: center;
  font-size: 1.15rem;
  color: var(--j-gold-hi, #ffe38a);
}

#jeopardy-final-answer-zone {
  animation: jeopardy-reveal 0.35s ease both;
}

@keyframes jeopardy-reveal {
  from {
    opacity: 0;
    transform: translateY(0.4rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.daily-double-banner {
  display: block;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: #1a1230;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow:
    0 0 24px rgba(255, 183, 3, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.25);
  animation: daily-double-enter 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes daily-double-enter {
  0% {
    opacity: 0;
    transform: scale(0.72);
    filter: brightness(1.6);
  }
  60% {
    opacity: 1;
    transform: scale(1.06);
    filter: brightness(1.15);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

.jeopardy-dd-category {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  color: var(--j-gold, #ffd24a);
}

.jeopardy-dd-label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--j-text, #f4f0ff);
}

.jeopardy-dd-range-hint {
  margin: 0 0 0.75rem;
}

#input-jeopardy-dd-range,
#input-jeopardy-dd-number {
  width: 100%;
  margin-bottom: 0.65rem;
}

#input-jeopardy-dd-number {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  padding: 0.65rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 210, 74, 0.35);
  background: rgba(0, 0, 0, 0.28);
  color: var(--j-gold, #ffd24a);
}

.jeopardy-theme #input-jeopardy-dd-range {
  accent-color: var(--accent-2);
}

.jeopardy-final-category {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0.35rem 0 0.75rem;
  color: var(--j-gold, #ffd24a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.jeopardy-final-secret {
  text-align: center;
  font-weight: 600;
  margin-bottom: 1rem;
}

.jeopardy-final-wager-rows,
.jeopardy-final-judge-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0 1.25rem;
}

.jeopardy-final-wager-row,
.jeopardy-final-judge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.7rem 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  border: 1px solid rgba(255, 210, 74, 0.18);
  color: var(--j-text, #f4f0ff);
}

.jeopardy-final-team-name {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--chip-color, var(--info));
  color: #fff;
  font-size: 0.9rem;
}

.jeopardy-final-wager-input {
  width: 6.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 2px solid rgba(255, 210, 74, 0.35);
  background: rgba(0, 0, 0, 0.3);
  color: var(--j-gold, #ffd24a);
  margin-left: auto;
}

.jeopardy-final-wager-amount {
  font-weight: 800;
  color: var(--j-gold, #ffd24a);
}

.jeopardy-final-judge-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.jeopardy-final-judge-row.is-correct {
  background: rgba(31, 191, 92, 0.22);
  border-color: rgba(31, 191, 92, 0.5);
}

.jeopardy-final-judge-row.is-incorrect {
  background: rgba(230, 57, 70, 0.2);
  border-color: rgba(230, 57, 70, 0.45);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .jeopardy-board-scroll {
    padding: 0.28rem;
    margin: 0;
  }
  .jeopardy-board {
    grid-template-columns: repeat(6, minmax(3rem, 1fr));
    gap: 0.22rem;
    min-width: 19rem;
  }
  .jeopardy-header {
    font-size: clamp(0.52rem, 2.4vw, 0.68rem);
    min-height: 3.1rem;
    padding: 0.28rem 0.1rem;
    border-bottom-width: 2px;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  .jeopardy-value {
    font-size: 0.95rem;
    min-height: 2.55rem;
    padding: 0.3rem 0.1rem;
    white-space: nowrap;
  }
  .jeopardy-cell {
    min-height: 2.55rem;
  }
  .daily-double-banner {
    font-size: 1.1rem;
  }
  #jeopardy-clue-text,
  #jeopardy-final-clue-text {
    font-size: 1.1rem;
  }
  .jeopardy-final-wager-row,
  .jeopardy-final-judge-row {
    flex-direction: column;
    align-items: stretch;
  }
  .jeopardy-final-wager-input,
  .jeopardy-final-judge-btns {
    margin-left: 0;
    width: 100%;
  }
  .jeopardy-final-judge-btns .btn {
    flex: 1;
  }
}

/* ===================== Reduced motion ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  body { animation: none; }
  .score-chip.leader { animation: none; }
  .lightning-timer.timer-urgent { animation: none; }
  .jeopardy-value { transition: none; }
  .daily-double-banner { animation: none; }
  #jeopardy-answer-zone,
  #jeopardy-final-answer-zone { animation: none; }
}

/* ---------- Version : bandeau, Nouveautés, registre ---------- */
.update-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  font-size: 0.95rem;
}
.update-banner-text { flex: 1 1 auto; }
.update-banner-reload {
  flex: 0 0 auto;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  background: #22c55e;
  color: #06240f;
  font-weight: 600;
}
.update-banner-close {
  flex: 0 0 auto;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
}

.whatsnew-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}
.whatsnew-modal {
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  color: #111827;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.whatsnew-title { margin: 0 0 2px; font-size: 1.4rem; }
.whatsnew-sub { margin: 0 0 12px; color: #6b7280; font-size: 0.9rem; }
.whatsnew-modal ul { margin: 0 0 10px; padding-left: 20px; }
.whatsnew-modal li { margin-bottom: 6px; }
.release-fixes-title { font-weight: 600; margin: 8px 0 4px; }
.whatsnew-close { margin-top: 8px; }

.release-register { margin-top: 4px; }
.release-entry { margin-bottom: 6px; }
.release-entry > summary { cursor: pointer; font-weight: 600; }
.release-body { padding: 6px 0 4px 4px; }
.release-body ul { margin: 4px 0 8px; padding-left: 20px; }
.build-stamp { margin-top: 8px; font-size: 0.8rem; word-break: break-all; }
.footer-version { margin-left: 10px; opacity: 0.75; font-size: 0.85rem; }
