/* ---------- F6 : salle de match ---------- */
.tete-salle { display: grid; gap: 6px; margin-bottom: 20px; }
.tete-salle h1 { font: 700 clamp(30px, 7vw, 48px)/1.05 var(--f-titre); text-transform: uppercase; overflow-wrap: anywhere; }

/* Phase « Prêt » */
.versus-salle { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 12px; }
.joueur-salle { display: grid; justify-items: center; gap: 8px; min-width: 0; padding: 20px 10px; text-align: center; background: var(--plaque); border: 1px solid var(--trait); }
.joueur-salle img, .avatar-salle { width: 72px; height: 72px; border-radius: 50%; }
.avatar-salle { display: grid; place-items: center; background: var(--sol); font: 700 30px var(--f-titre); text-transform: uppercase; }
.nom-salle { max-width: 100%; font: 700 20px var(--f-titre); overflow-wrap: anywhere; }
.joueur-salle small { color: var(--gris); }
.rang-placement { color: var(--or); font: 700 14px var(--f-titre); letter-spacing: .03em; }
.etat-pret { color: var(--gris); font-weight: 600; }
.etat-pret.pret { color: var(--ok); }
.versus-salle .vs { align-self: center; font: 700 26px var(--f-titre); color: var(--rouge-vif); }
.compte-salle { margin: 20px 0 12px; text-align: center; color: var(--gris); }
.compte-salle b { font-size: 34px; color: var(--texte); }
#v-salle .btn-pret-salle { display: block; width: min(360px, 100%); margin: 0 auto; padding: 16px; font-size: 20px; }
.attente-salle { min-height: 1.5em; margin-top: 12px; text-align: center; color: var(--gris); }

/* Phase « En partie » */
.grille-salle { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.colonne-salle { display: grid; gap: 16px; min-width: 0; }
.bloc-salle { display: grid; gap: 10px; min-width: 0; padding: 16px; background: var(--plaque); border: 1px solid var(--trait); }
.code-salle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 4px 2px; }
.code-salle output { font-size: clamp(20px, 4vw, 26px); font-weight: 700; color: var(--texte); overflow-wrap: anywhere; }
#v-salle .code-salle .btn { padding: 8px 14px; }
.regles-salle { display: grid; gap: 4px; margin: 0; padding: 0 2px; color: var(--gris); }
.etapes-salle { display: grid; gap: 8px; margin: 0; padding: 0 0 0 20px; overflow-wrap: anywhere; }
.lien-copier { padding: 2px 8px; background: none; color: var(--rouge-vif); border: 1px solid var(--trait); cursor: pointer; font: inherit; }
.lien-copier:hover, .lien-copier:focus-visible { border-color: var(--rouge-vif); }

/* Déclaration du score */
#v-salle .declaration-salle .btn { width: 100%; padding: 14px; }
.choix-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.choix-score[hidden] { display: none; }
.score-possible { display: grid; gap: 2px; justify-items: center; padding: 10px 6px; background: var(--sol); color: var(--texte); border: 1px solid var(--trait); cursor: pointer; font: inherit; }
.score-possible b { font-size: 22px; }
.score-possible small { color: var(--gris); }
.score-possible.gagne:hover, .score-possible.gagne:focus-visible { border-color: var(--ok); }
.score-possible.perd:hover, .score-possible.perd:focus-visible { border-color: var(--ko); }
.etat-score { min-height: 1.4em; color: var(--gris); }
.etat-score:empty { display: none; }

/* Chat privé */
.chat-salle { position: sticky; top: 90px; }
.fil-salle { display: grid; align-content: start; gap: 6px; height: min(46vh, 420px); overflow-y: auto; padding: 8px; background: var(--sol); border: 1px solid var(--trait); }
.msg-salle { padding: 6px 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-salle b { color: var(--gris); }
.msg-salle.moi b { color: var(--rouge-vif); }
.saisie-salle { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.saisie-salle textarea, .signaler-salle textarea, .signaler-salle select { width: 100%; padding: 8px; background: var(--sol); color: var(--texte); border: 1px solid var(--trait); font: inherit; resize: vertical; }

/* Signalement */
.signaler-salle summary { color: var(--gris); cursor: pointer; }
.signaler-salle form { display: grid; gap: 10px; margin-top: 10px; }
.signaler-salle label { display: grid; gap: 4px; }
#v-salle .fin-salle { display: grid; gap: 12px; justify-items: start; }

@media (max-width: 800px) {
  .grille-salle { grid-template-columns: minmax(0, 1fr); }
  .chat-salle { position: static; }
  /* « Déclarer le score » reste à portée de main, au-dessus de la barre de navigation mobile. */
  .declaration-salle { position: sticky; bottom: 92px; z-index: 5; }
  .fil-salle { height: 260px; }
}
@media (max-width: 420px) {
  .versus-salle { gap: 6px; }
  .joueur-salle { padding: 14px 6px; }
  .versus-salle .vs { font-size: 18px; }
}

/* ---------- Partie en cours : l'arène (niveau 1) ----------
   Les deux joueurs face à face et le score au milieu, en très grand. « VS » tant que la partie n'est pas détectée. */
.arene-salle { position: relative; display: grid; justify-items: center; gap: 14px; margin-bottom: 16px; padding: 22px 16px 18px; overflow: hidden;
  background: radial-gradient(90% 130% at 50% -10%, rgb(232 32 46 / .26), transparent 62%), var(--plaque);
  border: 1px solid var(--trait); border-radius: var(--arrondi, 0); }
.arene-salle::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: linear-gradient(90deg, transparent, var(--rouge-vif), transparent); opacity: .7; }
.duel-arene { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(8px, 3vw, 36px); width: min(880px, 100%); }
.cote-arene { display: grid; justify-items: center; gap: 6px; min-width: 0; text-align: center; }
.cote-arene img, .cote-arene .avatar-salle { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 2px var(--trait); transition: box-shadow .3s; }
.cote-arene.mene img, .cote-arene.mene .avatar-salle { box-shadow: 0 0 0 3px var(--rouge-vif), 0 0 30px rgb(232 32 46 / .6); }
.cote-arene .nom-salle { font-size: clamp(15px, 2.6vw, 20px); }
.jauge-arene { width: min(170px, 100%); height: 6px; margin-top: 4px; overflow: hidden; background: rgb(255 255 255 / .09); border-radius: 99px; }
.jauge-arene i { display: block; width: 0; height: 100%; background: var(--rouge-vif); border-radius: inherit; transition: width .4s ease-out; }
.score-arene { display: flex; align-items: center; gap: clamp(6px, 2vw, 20px); font: 800 clamp(58px, 14vw, 124px)/.9 var(--f-titre); letter-spacing: -.03em; }
.score-arene b { min-width: .62em; text-align: center; font-variant-numeric: tabular-nums; }
.score-arene i { font-style: normal; font-size: .45em; color: var(--gris); }
.score-arene .vs-arene { font-size: clamp(30px, 7vw, 54px); letter-spacing: .04em; color: var(--rouge-vif); }
.score-arene b.bat { animation: bat-score .4s ease-out; }
@keyframes bat-score { 0% { transform: scale(1.4); color: var(--rouge-vif); } }
.regle-arene { margin: 0; color: var(--gris); text-align: center; }
.regle-arene b { color: var(--texte); }

/* « À faire maintenant » (niveau 2) : une seule consigne, et le rail des étapes. */
.action-salle { display: grid; gap: 12px; min-width: 0; padding: 18px; background: var(--plaque); border: 1px solid var(--trait); border-left: 4px solid var(--rouge-vif); border-radius: var(--arrondi, 0); }
.action-salle.echec { border-left-color: var(--or); }
.action-titre { margin: 0; font: 700 clamp(18px, 2.8vw, 24px)/1.25 var(--f-titre); overflow-wrap: anywhere; }
.action-salle .muet { margin: 0; }
.rail-etapes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.rail-etapes li { display: grid; gap: 6px; overflow: hidden; color: var(--gris); font-size: 12px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.rail-etapes li::before { content: ""; height: 4px; background: rgb(255 255 255 / .1); border-radius: 99px; }
.rail-etapes li.fait { color: var(--texte); }
.rail-etapes li.fait::before { background: var(--ok); }
.rail-etapes li.actuelle { color: var(--texte); font-weight: 700; }
.rail-etapes li.actuelle::before { background: var(--rouge-vif); animation: pouls-etape 1.4s ease-in-out infinite; }
@keyframes pouls-etape { 50% { opacity: .35; } }

/* Secours (niveau 3) : déclarer soi-même si le robot n'a pas validé. */
.secours-salle summary { color: var(--gris); cursor: pointer; }
.secours-corps { display: grid; gap: 10px; margin-top: 10px; }
#v-salle .secours-corps .btn { width: 100%; padding: 12px; }

@media (max-width: 520px) {
  .arene-salle { padding: 16px 10px 14px; }
  .cote-arene img, .cote-arene .avatar-salle { width: 48px; height: 48px; }
  .cote-arene .avatar-salle { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .score-arene b.bat, .rail-etapes li.actuelle::before { animation: none; }
  .jauge-arene i, .cote-arene img, .cote-arene .avatar-salle { transition: none; }
}

/* F30 : tutoriel du robot (une seule fois) */
.tuto-robot { width: min(92vw, 440px); padding: 26px 24px 22px; color: var(--texte); text-align: center; background: var(--plaque); border: 1px solid var(--trait-fort, var(--trait)); border-radius: 18px; }
.tuto-robot::backdrop { background: rgb(5 9 16 / .72); }
.tuto-robot .icone-tuto { margin: 6px 0 4px; font-size: 46px; line-height: 1; }
.tuto-robot h2 { margin: 6px 0 8px; font: 800 22px/1.2 var(--f-titre); }
.tuto-robot p { margin: 0; color: var(--gris); }
.tuto-robot p b { color: var(--texte); }
.points-tuto { display: flex; justify-content: center; gap: 6px; margin: 18px 0 16px; }
.points-tuto i { width: 8px; height: 8px; background: var(--trait); border-radius: 50%; transition: width .2s, background .2s; }
.points-tuto i.actif { width: 22px; background: var(--rouge-vif); border-radius: 99px; }
.boutons-tuto { display: flex; justify-content: center; gap: 10px; }
