/* 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 {
  position: relative;
  z-index: 1;
  padding: 28px 24px 24px;
  max-width: 95vw;
  min-width: 380px;
}

.code-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-light);
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  padding: 4px 10px;
  letter-spacing: 2px;
}

/* Salle d'attente */
.attente-panel {
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.attente-panel h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--texte);
  font-weight: 700;
  margin-bottom: 12px;
}

.config-info {
  font-size: 0.82rem;
  color: var(--texte-doux);
  margin-bottom: 16px;
}

.liste-joueurs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.joueur-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  font-size: 0.85rem;
}

.joueur-pseudo {
  font-weight: 600;
  color: var(--texte);
}

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

.joueur-statut {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.joueur-statut.en_cours {
  background: var(--surface-2);
  color: var(--texte);
}

.joueur-statut.gagne {
  background: rgba(74, 222, 128, 0.2);
  color: #64ab7c;
}

.joueur-statut.perdu {
  background: rgba(248, 113, 113, 0.2);
  color: #d07070;
}

.progression-bar {
  width: 60px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

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

.btn-full {
  width: 100%;
  padding: 12px 20px;
}

/* Info bar */
.mine-count {
  color: #d07070;
}

.timer {
  color: var(--color-light);
}

.manche-info {
  color: var(--texte-doux);
  font-size: 0.8rem;
}

/* Grille */
.grid-container {
  overflow: auto;
  max-width: 90vw;
  max-height: 65vh;
  margin: 0 auto 12px;
  border-radius: 8px;
}

/* Fond du quadrillage : c'est lui qu'on voit dans le gap de 1 px. Le laisser a
   --surface-2 le rendrait invisible entre deux cases fermees. */
.grid {
  display: inline-grid;
  gap: 1px;
  background: var(--line);
  border: 2px solid var(--line-forte);
  border-radius: 6px;
  padding: 1px;
  user-select: none;
  -webkit-user-select: none;
}

.cell {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 3px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  line-height: 1;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), inset -1px -1px 0 rgba(0, 0, 0, 0.25);
}

.cell:hover:not(.revealed):not(.exploded) {
  background: color-mix(in srgb, var(--color-light) 14%, var(--surface-2));
  border-color: var(--color-light);
}

.cell:active:not(.revealed):not(.exploded) {
  box-shadow: inset -1px -1px 0 rgba(255, 255, 255, 0.06), inset 1px 1px 0 rgba(0, 0, 0, 0.25);
}

/* Case revelee : a plat, plus sombre que la case fermee. Sans cet ecart de fond,
   ouvert et ferme deviennent impossibles a distinguer. */
.cell.revealed {
  background: #000;
  cursor: default;
  border-color: var(--line);
  box-shadow: none;
}

.cell.exploded {
  background: #7a2732;
  cursor: default;
  border-color: #a33a48;
  box-shadow: none;
}

.cell.mine-shown {
  background: color-mix(in srgb, #d07070 20%, var(--surface-0));
  cursor: default;
  border-color: #6b3238;
  box-shadow: none;
  animation: mine-pop 0.3s ease-out;
}

@keyframes mine-pop {

  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Le marqueur du drapeau, c'est l'emoji : on assombrit a peine. */
.cell.flagged {
  background: color-mix(in srgb, var(--color-light) 6%, var(--surface-2));
}

.cell.wrong-flag {
  background: color-mix(in srgb, #d07070 18%, var(--surface-0));
  text-decoration: line-through;
}

/* Memes chiffres qu'en solo : c'est une information de jeu, elle ne doit pas
   changer d'un mode a l'autre. */
.cell.n1 {
  color: #6f9fd8;
}

.cell.n2 {
  color: #64ab7c;
}

.cell.n3 {
  color: #d07070;
}

.cell.n4 {
  color: #9b8ac9;
}

.cell.n5 {
  color: #b08641;
}

.cell.n6 {
  color: #59a8b5;
}

.cell.n7 {
  color: var(--texte);
}

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

/* Adversaires panel */
.adversaires-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.adversaire-card {
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.adversaire-pseudo {
  font-weight: 600;
  color: var(--texte);
}

/* Résultats manche */
.resultats-panel {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.resultats-panel.visible {
  display: block;
}

.resultats-panel h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--texte);
  font-weight: 700;
  margin-bottom: 12px;
}

.resultat-ligne {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.resultat-gagnant {
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.08);
}

.overlay-box .win {
  color: #64ab7c;
}

.overlay-box .lose {
  color: #d07070;
}

.overlay-box p {
  color: var(--texte-doux);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.classement-final {
  text-align: left;
  margin-bottom: 16px;
}

.classement-ligne {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.classement-ligne:first-child {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.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;
  }
}

@keyframes shake {

  0%, 100% {
    transform: translateX(0);
  }

  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-4px);
  }

  20%, 40%, 60%, 80% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.5s;
}

.flag-toggle {
  background: var(--surface-2);
  border: 2px solid var(--line-forte);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
}

.flag-toggle.active {
  background: rgba(99,102,241,0.3);
  border-color: var(--line-forte);
  box-shadow: 0 0 8px rgba(99,102,241,0.3);
}

.settings-toggle {
  background: var(--surface-2);
  border: 2px solid var(--line-forte);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
}

.settings-toggle:hover {
  background: var(--surface-2);
}

.settings-panel {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  text-align: left;
}

.settings-panel.visible {
  display: block;
}

.settings-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--texte-doux);
  cursor: pointer;
  padding: 4px 0;
}

.settings-panel input[type="checkbox"] {
  accent-color: var(--color-mid);
  width: 16px;
  height: 16px;
}

.settings-info {
  font-size: 0.75rem;
  color: var(--texte-faible);
  margin-top: 6px;
  line-height: 1.4;
}

.settings-info a {
  color: var(--texte-doux);
  text-decoration: none;
}

.settings-info a:hover {
  color: var(--color-light);
}

.input-rejoindre {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  border: 1px solid var(--line-forte);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--texte);
  outline: none;
  transition: border-color 0.2s;
}

.input-rejoindre:focus {
  border-color: var(--line-forte);
}

.input-rejoindre::placeholder {
  color: var(--texte-faible);
}

.btn-copier {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--texte);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-copier:hover {
  background: rgba(167, 139, 250, 0.3);
  border-color: var(--line-forte);
}

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

.badge-difficulte {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--texte);
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 8px;
  padding: 3px 10px;
  margin-bottom: 8px;
}

.info-visibilite {
  font-size: 0.82rem;
  color: var(--texte-doux);
  margin-bottom: 8px;
}

#rejouer-statut {
  font-size: 0.85rem;
  color: var(--texte-doux);
  margin-bottom: 10px;
  min-height: 1.2rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {

  #app {
    padding: 18px 12px 16px;
    min-width: auto;
  }

  .cell {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
}

/* --- Utilitaires (remplacent d'anciens attributs style=) ---------------- */
.u-erreur {
  color: #d07070;
}

.u-flex {
  display: flex;
}

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

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

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

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

.u-gras {
  font-weight: 700;
}

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

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

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

.u-succes {
  color: #64ab7c;
}

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

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

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

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

.multij-s4 {

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