/* multijoueur.php — règles propres à cette page.
   L'habillage commun (body, #app, top-bar, h1, info-bar, boutons, overlay,
   footer) vient de fichiers-partages-des-jeux/css/jeu.css.
   Ne garder ici que ce qui est propre au quizz. */

/* Le contexte d'empilement de #app (position + z-index) est pose dans
   quizz-banner.css, au meme endroit que le body::before qui le rend
   necessaire. Ne pas le dupliquer ici : deux copies finissent par diverger. */

/* --- Code de partie -------------------------------------------------------- */
.code-display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-light);
  letter-spacing: 8px;
  margin: 12px 0;
  cursor: pointer;
}

.code-display:hover {
  color: var(--texte);
}

.code-hint {
  font-size: 0.78rem;
  color: var(--texte-faible);
  margin-bottom: 16px;
}

/* Le gabarit du bouton vient de .btn-copier dans le socle : ici, juste sa place
   dans la ligne et l'accusé de copie. */
.btn-copier {
  margin-left: 8px;
  vertical-align: middle;
}

.btn-copier.copie {
  background: #14432a;
  border-color: #2f7f52;
  color: #7ee29b;
}

/* --- Joueurs --------------------------------------------------------------- */
.joueurs-zone {
  margin-bottom: 20px;
}

.joueurs-zone h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--texte);
  font-weight: 700;
  margin-bottom: 10px;
}

.joueurs-liste {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.joueur-tag {
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mon propre badge, a reperer d'un coup d'oeil dans la liste. */
.joueur-tag.moi {
  border-color: var(--color-light);
  background: color-mix(in srgb, var(--color-light) 14%, var(--surface-2));
}

.joueur-score {
  color: #64ab7c;
  font-weight: 700;
}

.joueur-repondu {
  color: var(--color-light);
  font-size: 0.75rem;
}

/* --- Compteurs de la barre d'info -----------------------------------------
   Memes couleurs qu'en solo : ces reperes ne doivent pas changer d'un mode a
   l'autre. */
.question-count {
  color: var(--color-light);
}

.timer-display {
  color: #d07070;
}

/* --- Jauge de temps -------------------------------------------------------- */
.timer-bar-container {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: var(--color-mid);
  border-radius: 3px;
  transition: width 0.3s linear;
}

.timer-bar.warning {
  background: #d07070;
}

/* --- Question -------------------------------------------------------------- */
.question-categorie {
  font-size: 0.8rem;
  color: var(--color-light);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-texte {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--texte);
  line-height: 1.5;
  margin-bottom: 20px;
  min-height: 50px;
}

/* --- Réponses --------------------------------------------------------------
   Memes valeurs qu'en solo : un etat de jeu ne doit pas changer d'aspect d'un
   mode a l'autre. Fonds opaques, cf. css/solo.css. */
.reponses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.reponse-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 12px;
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--texte);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  text-align: center;
  line-height: 1.4;
}

.reponse-btn:hover:not(.disabled) {
  background: color-mix(in srgb, var(--color-light) 12%, var(--surface-2));
  border-color: var(--color-light);
}

.reponse-btn.correct {
  background: #14432a;
  border-color: #2f7f52;
  color: #7ee29b;
}

.reponse-btn.incorrect {
  background: #4d1f24;
  border-color: #a33a48;
  color: #ff9a9a;
}

/* La bonne reponse revelee apres une erreur : creuse, pas pleine. */
.reponse-btn.show-correct {
  background: var(--surface-2);
  border-color: #2f7f52;
  color: #7ee29b;
}

.reponse-btn.disabled {
  cursor: default;
  opacity: 0.6;
}

/* --- Retour après réponse -------------------------------------------------- */
.feedback-zone {
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 600;
  display: none;
}

.feedback-zone.visible {
  display: block;
}

.feedback-zone.correct {
  background: #14432a;
  border: 1px solid #2f7f52;
  color: #7ee29b;
}

.feedback-zone.incorrect {
  background: #4d1f24;
  border: 1px solid #a33a48;
  color: #ff9a9a;
}

.btn-full {
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
}

.status-msg {
  font-size: 0.85rem;
  color: var(--texte-doux);
  font-style: italic;
  margin-bottom: 12px;
}

/* --- Classement de fin ----------------------------------------------------- */
.classement-final {
  text-align: left;
  margin-bottom: 20px;
}

.classement-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

/* Le vainqueur : la seule ligne qui porte une couleur. */
.classement-row:first-child {
  background: #3a2f12;
  border-color: #7a6524;
}

.classement-row .rang {
  width: 30px;
  font-weight: 800;
  color: var(--texte-doux);
}

.classement-row:first-child .rang {
  color: #e0b23c;
}

.classement-row .pseudo-cl {
  flex: 1;
  font-weight: 600;
  color: var(--texte);
}

.classement-row .score-cl {
  font-weight: 700;
  color: #64ab7c;
}

/* --- Confettis ------------------------------------------------------------- */
.confetti {
  position: fixed;
  top: -10px;
  z-index: 200;
  pointer-events: none;
  font-size: 1.2rem;
  animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {

  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 480px) {

  .reponses {
    grid-template-columns: 1fr;
  }

  .code-display {
    font-size: 1.6rem;
  }
}

/* --- Formulaire « rejoindre via un lien » ----------------------------------
   Remplace une pile d'utilitaires issus d'anciens attributs style= : c'est un
   composant, il merite sa propre classe. */
.form-rejoindre {
  text-align: center;
  padding: 20px;
}

.form-rejoindre-intro {
  color: var(--texte-doux);
  margin-bottom: 16px;
}

.form-rejoindre-ligne {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.champ-pseudo {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--line-forte);
  background: var(--surface-2);
  color: var(--texte);
  outline: none;
  width: 200px;
  transition: border-color 0.15s;
}

.champ-pseudo:focus {
  border-color: var(--color-light);
}

.champ-pseudo::placeholder {
  color: var(--texte-faible);
}

/* Joueur connecte : son pseudo est impose, le champ est verrouille. */
.champ-verrouille {
  opacity: 0.7;
}

.erreur-rejoindre {
  color: #d07070;
  font-size: 0.82rem;
  min-height: 1.2rem;
}
