/* ============================================================
   DUEL.CSS — Styles spécifiques au mode Duel
   ------------------------------------------------------------
   Ce fichier définit :
   - La sélection du mode de duel (5 boutons en grille)
   - Les onglets Créer / Rejoindre
   - Le code d'invitation
   - La liste des joueurs
   - Le classement de fin de manche
   - Le badge de vainqueur

   Note : les styles spécifiques à chaque mode de jeu
   (Écrire, Compléter, Référence, Vrai/Faux, Quiz) sont
   réutilisés depuis leurs CSS respectifs.

   Doit être chargé APRÈS base.css, composants.css, nav.css.
   ============================================================ */

/* ------------------------------------------------------------
   1. SÉLECTION DU MODE (5 boutons en grille)
   ------------------------------------------------------------ */
.duel-mode-choix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.duel-mode-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .75rem;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

.duel-mode-btn .mode-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.duel-mode-btn .mode-icon .material-symbols-outlined {
  font-size: 1.45rem;
  font-variation-settings: 'FILL' 1;
}

.duel-mode-btn .mode-icon.ecrire     { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); }
.duel-mode-btn .mode-icon.completer  { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.duel-mode-btn .mode-icon.reference  { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.duel-mode-btn .mode-icon.vraifaux   { background: linear-gradient(135deg, #16a34a, #15803d); }
.duel-mode-btn .mode-icon.quiz       { background: linear-gradient(135deg, var(--accent), #b45309); }

.duel-mode-btn .mode-nom {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
}

.duel-mode-btn .mode-desc {
  font-size: .68rem;
  color: var(--text-soft);
  font-weight: 500;
}

.duel-mode-btn.actif {
  border-color: var(--gold);
  background: var(--gold-soft);
  box-shadow: var(--shadow-gold);
}

.duel-mode-btn:hover:not(.actif) {
  transform: translateY(-2px);
  border-color: var(--gold);
}

/* ------------------------------------------------------------
   2. ONGLETS CRÉER / REJOINDRE
   ------------------------------------------------------------ */
.duel-tabs {
  display: flex;
  gap: .4rem;
  background: var(--surface-2);
  padding: .3rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

.duel-tab {
  flex: 1;
  padding: .75rem 1rem;
  border: none;
  background: transparent;
  border-radius: 999px;
  color: var(--text-soft);
  font-family: inherit;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
}

.duel-tab.actif {
  background: var(--surface);
  color: var(--gold-dark);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------
   3. CHAMPS DE FORMULAIRE
   ------------------------------------------------------------ */
.champ {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}

.champ label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-soft);
}

.champ input {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: .95rem 1.1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all .25s;
  outline: none;
}

.champ input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}

.champ input.code-saisie {
  text-transform: uppercase;
  letter-spacing: .35em;
  font-weight: 800;
  text-align: center;
  font-size: 1.4rem;
}

/* ------------------------------------------------------------
   4. AFFICHAGE DU CODE D'INVITATION
   ------------------------------------------------------------ */
.code-display {
  text-align: center;
  padding: 1.75rem 1.5rem;
  background: linear-gradient(135deg, var(--gold-soft), var(--bg-soft));
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-lg);
  margin: 1.25rem 0;
  box-shadow: var(--shadow-gold);
  position: relative;
  overflow: hidden;
}

.code-display::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, .4) 50%, transparent 70%);
  animation: shine 3s linear infinite;
}

@keyframes shine {
  0%   { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.code-display-valeur {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: .35em;
  color: var(--gold-dark);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
  user-select: all;
}

.code-display-hint {
  font-size: .85rem;
  color: var(--text-soft);
  margin-top: .5rem;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}

.code-display-hint .material-symbols-outlined {
  font-size: 1rem;
}

/* ------------------------------------------------------------
   5. IDENTITÉ DUEL
   ------------------------------------------------------------ */
.duel-identite {
  padding: .85rem 1.1rem;
  background: var(--gold-soft);
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  font-size: .92rem;
}

.duel-identite .material-symbols-outlined {
  font-size: 1.3rem;
  font-variation-settings: 'FILL' 1;
}

/* ------------------------------------------------------------
   6. LISTE DES JOUEURS
   ------------------------------------------------------------ */
.joueurs-liste {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin: 1.25rem 0;
}

.joueur-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  animation: fadeUp .35s ease both;
}

.joueur-item.est-moi {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.joueur-item .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.joueur-item .info {
  flex: 1;
  min-width: 0;
}

.joueur-item .pseudo {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.joueur-item .badge-moi {
  font-size: .65rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.joueur-item .statut {
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .65rem;
  border-radius: 999px;
}

.joueur-item .statut.hote    { background: var(--gold-soft); color: var(--gold-dark); }
.joueur-item .statut.pret    { background: var(--info-soft); color: var(--info); }
.joueur-item .statut.attente { background: var(--surface-2); color: var(--text-soft); }
.joueur-item .statut.termine { background: var(--gold-soft); color: var(--gold-dark); }

/* ------------------------------------------------------------
   7. ACTIONS DE LA SALLE D'ATTENTE
   ------------------------------------------------------------ */
.attente-actions {
  display: flex;
  gap: .75rem;
  flex-direction: column;
}

/* ------------------------------------------------------------
   8. CLASSEMENT DE MANCHE
   ------------------------------------------------------------ */
.duel-classement {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.duel-classement-titre {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.duel-classement-titre .material-symbols-outlined {
  font-size: 1.1rem;
  color: var(--gold);
  font-variation-settings: 'FILL' 1;
}

.classement-ligne {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .85rem;
  border-radius: var(--radius-sm);
  margin-bottom: .4rem;
  background: var(--bg-soft);
}

.classement-ligne.moi {
  background: var(--gold-soft);
  border: 1.5px solid var(--gold);
}

.classement-ligne .rang {
  width: 32px;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-faint);
  flex-shrink: 0;
}

.classement-ligne.moi .rang { color: var(--gold-dark); }
.classement-ligne .rang.or     { color: var(--gold); }
.classement-ligne .rang.argent { color: #94a3b8; }
.classement-ligne .rang.bronze { color: #a16207; }

.classement-ligne .class-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  flex-shrink: 0;
}

.classement-ligne .class-pseudo {
  flex: 1;
  font-weight: 700;
  font-size: .95rem;
}

.classement-ligne .class-score {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--gold-dark);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   9. BADGE VAINQUEUR
   ------------------------------------------------------------ */
.duel-gagnant {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: .85rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1.5px solid;
}

.duel-gagnant.gagne   { background: var(--gold-soft); color: var(--gold-dark); border-color: var(--gold); }
.duel-gagnant.perdu   { background: var(--danger-soft); color: var(--danger-dark); border-color: var(--danger); }
.duel-gagnant.egalite { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------
   10. ATTENTE DES RÉSULTATS
   ------------------------------------------------------------ */
.attente-resultats {
  text-align: center;
  padding: 1rem;
  font-size: .88rem;
  color: var(--text-soft);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.attente-resultats .material-symbols-outlined {
  font-size: 1.15rem;
  color: var(--gold);
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}