/* multijoueur.php — règles propres à cette page.
   L'habillage commun vient de fichiers-partages-des-jeux/css/jeu.css. */

/* Habillage commun (body, #app, top-bar, boutons, info-bar, overlay,
   classement) : fichiers-partages-des-jeux/css/jeu.css.
   Ici, uniquement ce qui est propre a ce jeu. */
#app {
  padding: 32px;
  max-width: 1100px;
}

h1 {
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  text-align: center;
  color: var(--texte-doux);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* Attente */
.attente-panel {
  text-align: center;
  padding: 20px 0;
}

.code-affiche {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--texte);
  margin: 16px 0;
}

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

.joueur-badge {
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte);
}

.joueur-badge.createur {
  border-color: #d2973a;
  color: #d2973a;
}

/* Game layout */
.game-layout {
  display: flex;
  gap: 20px;
  margin-top: 16px;
}

.game-main {
  flex: 1;
}

.game-sidebar {
  width: 280px;
  flex-shrink: 0;
}

/* Grille (même style que solo) */
.grille-container {
  overflow-x: auto;
  margin-bottom: 12px;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 12px;
}

.grille-table {
  border-collapse: collapse;
  user-select: none;
  margin: 0 auto;
}

.grille-table td {
  width: 32px;
  height: 32px;
  position: relative;
  border: 1px solid var(--line-forte);
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s;
}

/* Etats de case : fonds opaques, memes valeurs qu'en solo. */
.grille-table td.noire {
  background: #0a0f11;
  cursor: default;
  border-color: #0a0f11;
}

.grille-table td.lettre {
  background: var(--surface-2);
}

.grille-table td.mot-actif {
  background: #1f3b40 !important;
}

/* Declaree apres .mot-actif : les deux classes sont posees sur la meme case. */
.grille-table td.active {
  background: #2a5a58 !important;
  border-color: var(--color-light);
  box-shadow: inset 0 0 0 2px var(--color-light);
}

.grille-table td.correct {
  background: #14432a !important;
}

.grille-table td.correct .lettre-case {
  color: #7ee29b;
}

.numero-case {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--color-light);
  pointer-events: none;
}

.lettre-case {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--texte);
  text-transform: uppercase;
  pointer-events: none;
}

/* Barre de définition active (mobile uniquement) : toujours visible
   juste au-dessus du clavier, évite d'aller chercher la définition
   dans le panneau situé sous le clavier. */
.clue-bar {
  display: none;
}

@media (max-width: 768px) {

  .clue-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 9px 10px;
    background: var(--surface-2);
    border: 1px solid rgba(129, 140, 248, 0.45);
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--texte);
  }

  .clue-bar-txt {
    flex: 1;
    min-width: 0;
  }

  .clue-bar-len {
    font-size: 0.7rem;
    color: var(--texte-doux);
  }

  .clue-bar-nav {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--texte);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .clue-bar-nav:active {
    background: rgba(99, 102, 241, 0.4);
  }
}

/* Définitions */
.definitions-panel {
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 12px;
}

.definitions-panel h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--texte);
  margin: 8px 0 4px;
}

.definitions-panel h3:first-child {
  margin-top: 0;
}

.def-item {
  font-size: 0.78rem;
  color: var(--texte-doux);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.3;
}

.def-item:hover {
  background: var(--surface-1);
  color: var(--texte);
}

/* Definition en cours de saisie : le panneau est deja en --surface-2, un fond
   --surface-2 ne s'y verrait pas. Teinte d'accent + repere a gauche. */
.def-item.active {
  background: color-mix(in srgb, var(--color-light) 16%, var(--surface-2));
  color: var(--texte);
  box-shadow: inset 3px 0 0 var(--color-light);
}

.def-item.found {
  color: #34d399;
  text-decoration: line-through;
  opacity: 0.7;
}

.def-numero {
  font-weight: 700;
  color: var(--color-light);
  margin-right: 3px;
}

/* Adversaires */
.adversaires-panel {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 12px;
  margin-top: 12px;
}

.adversaires-panel h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--texte);
  margin-bottom: 8px;
}

.adversaire-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.adversaire-pseudo {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texte);
  min-width: 80px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-mid), var(--texte-doux));
  border-radius: 4px;
  transition: width 0.3s;
}

.adversaire-pct {
  font-size: 0.78rem;
  color: var(--texte-doux);
  min-width: 35px;
  text-align: right;
}

/* Actions */
.actions-bar {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-warning {
  background: #a3742c;
}

.btn-success {
  background: #3f7a55;
}

.btn-full {
  width: 100%;
}

/* Info bar */
.info-bar {
  margin: 12px 0;
}

.info-item {
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  padding: 6px 12px;
}

.info-item span {
  color: var(--texte);
  font-weight: 700;
}

/* Résultats manche */
.resultats-panel {
  text-align: center;
  padding: 20px;
  background: var(--surface-2);
  border-radius: 6px;
  margin-top: 16px;
}

.resultats-panel h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--texte);
  margin-bottom: 12px;
}

.resultat-joueur {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-forte);
}

.resultat-joueur:last-child {
  border-bottom: none;
}

.resultat-pseudo {
  font-weight: 700;
  color: var(--texte);
}

.resultat-score {
  color: var(--color-light);
  font-weight: 600;
}

.resultat-gagnant {
  color: #d2973a;
}

.btn-copier {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: #d2973a;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  margin-left: 8px;
  vertical-align: middle;
}

.btn-copier:hover {
  background: rgba(251, 191, 36, 0.3);
  border-color: rgba(251, 191, 36, 0.5);
}

.btn-copier.copie {
  background: var(--surface-2);
  border-color: rgba(34, 197, 94, 0.4);
  color: #64ab7c;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {

  .game-layout {
    flex-direction: column;
  }

  .game-sidebar {
    width: 100%;
  }

  .grille-table td {
    width: 26px;
    height: 26px;
  }

  .lettre-case {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {

  #app {
    padding: 20px 14px;
  }

  .info-bar {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .info-bar::-webkit-scrollbar {
    display: none;
  }

  .info-item {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Clavier AZERTY */
#clavier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0 8px;
}

.clavier-ligne {
  display: flex;
  gap: 4px;
}

.touche {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 0;
  min-width: 34px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--texte);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.touche:hover {
  background: rgba(255,255,255,0.22);
}

.touche:active {
  transform: translateY(0);
  background: rgba(99,102,241,0.3);
}

.touche.large {
  min-width: 60px;
  font-size: 0.75rem;
  padding: 12px 8px;
}

@media (max-width: 480px) {

  .touche {
    min-width: 28px;
    font-size: 0.8rem;
    padding: 10px 0;
    border-radius: 6px;
  }

  .touche.large {
    min-width: 48px;
    font-size: 0.7rem;
  }
}

@media (max-width: 360px) {

  .touche {
    min-width: 24px;
    font-size: 0.72rem;
    padding: 9px 0;
  }

  .touche.large {
    min-width: 42px;
  }
}

/* --- Utilitaires (remplacent d'anciens attributs style=) ---------------- */
.u-centre {
  text-align: center;
}

.u-erreur {
  color: #d07070;
}

.u-flex {
  display: flex;
}

.u-flex-centre {
  align-items: center;
}

.u-flex-retour {
  flex-wrap: wrap;
}

.u-gap-8 {
  gap: 8px;
}

.u-marge-bas-12 {
  margin-bottom: 12px;
}

.u-marge-bas-16 {
  margin-bottom: 16px;
}

.u-marge-bas-8 {
  margin-bottom: 8px;
}

.u-marge-haut-16 {
  margin-top: 16px;
}

.u-marge-haut-8 {
  margin-top: 8px;
}

.u-normal {
  font-size: 0.95rem;
}

.u-petit {
  font-size: 0.82rem;
}

.u-texte-doux {
  color: var(--texte-doux);
}

.u-texte-faible {
  color: var(--texte-faible);
}

/* --- Regles ponctuelles issues d'anciens attributs style= --------------- */
.multij-s1 {
  margin: 16px auto;
}

.multij-s2 {
  padding: 20px;
}

.multij-s3 {
  justify-content: center;
}

.multij-s4 {
  font-family: 'inter',sans-serif;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #f1f5f9;
  outline: none;
  width: 200px;
}

.multij-s5 {
  min-height: 1.2rem;
}

.multij-s6 {
  color: #a5b4fc;
}

.multij-s7 {

  $ {
    style;
  }
}

.multij-s8 {
  font-size: 0.65rem;
}

.multij-s9 {

  width: $ {
    adv.progression;
  }
  %;
}
