/* Extras : boutons d'en-tête, chrono, panneaux règles / historique, clavier, animations réduites */

/* ----- Boutons d'en-tête ----- */
.haut__outils {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.bouton--icone {
  min-width: 2.4rem;
  padding-inline: 0.55rem;
  font-size: 1.05rem;
}

.bouton--eteint {
  opacity: 0.55;
}

.bouton--outils {
  display: none;
}

/* ----- Chrono du joueur ----- */
.chrono {
  --reste: 1;
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8em;
  font-weight: 800;
  color: #17301f;
  background: linear-gradient(90deg, #f1dc8a calc(var(--reste) * 100%), rgba(255, 255, 255, 0.25) calc(var(--reste) * 100%));
  white-space: nowrap;
}

.chrono[hidden] {
  display: none !important;
}

.chrono--urgent {
  color: #fff;
  background: linear-gradient(90deg, #c0392b calc(var(--reste) * 100%), rgba(255, 255, 255, 0.25) calc(var(--reste) * 100%));
  animation: chrono-pouls 0.5s ease-in-out infinite alternate;
}

@keyframes chrono-pouls {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ----- Panneaux (règles en bas à gauche, historique en bas à droite) ----- */
.panneau {
  position: fixed;
  bottom: 0.8rem;
  z-index: 30;
  width: clamp(210px, 20vw, 290px);
  display: flex;
  flex-direction: column;
  color: #eaf3e4;
  background: rgba(14, 32, 22, 0.94);
  border: 1px solid rgba(241, 220, 138, 0.45);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  font-size: 0.76rem;
  line-height: 1.3;
}

.panneau--regles { left: 0.8rem; }
.panneau--histo { right: 0.8rem; width: clamp(230px, 22vw, 320px); }

.panneau--ferme {
  display: none;
}

.panneau__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid rgba(241, 220, 138, 0.25);
}

.panneau__entete h2 {
  margin: 0;
  font-size: 0.95rem;
  color: #f1dc8a;
}

.panneau__fermer {
  border: 0;
  border-radius: 50%;
  width: 1.7rem;
  height: 1.7rem;
  cursor: pointer;
  color: inherit;
  background: rgba(255, 255, 255, 0.12);
}

.panneau__corps {
  padding: 0.4rem 0.7rem 0.6rem;
}

.panneau__sous-titre {
  margin: 0.4rem 0 0.1rem;
  font-size: 0.85rem;
  color: #f1dc8a;
}

.panneau__texte p {
  margin: 0.25rem 0;
}

.panneau__vide {
  margin: 0.3rem 0;
  opacity: 0.75;
}

.onglets {
  display: flex;
  gap: 0.3rem;
}

.onglet {
  flex: 1;
  padding: 0.3rem 0.4rem;
  border: 1px solid rgba(241, 220, 138, 0.4);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.onglet--actif {
  color: #17301f;
  background: #f1dc8a;
}

.histo {
  margin: 0;
  padding: 0;
  list-style: none;
}

.histo__pli {
  display: block;
  padding: 0.12rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  font-size: 0.72rem;
  line-height: 1.2;
}

.histo__pli strong {
  margin-right: 0.35rem;
}

.histo__carte {
  display: inline;
}

.histo__carte:not(:last-child)::after {
  content: " · ";
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
}

.histo__carte--gagnant {
  font-weight: 800;
  color: #f1dc8a;
}

/* ----- Focus clavier bien visible ----- */
.carte:focus-visible,
.dos:focus-visible,
.carte--clavier,
.bouton:focus-visible,
.onglet:focus-visible,
.panneau__fermer:focus-visible,
.de-scene:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 3px;
}

.carte--clavier {
  z-index: 5;
}

/* ----- Respect de « réduire les animations » ----- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----- Téléphone : les panneaux deviennent des feuilles en bas de l'écran ----- */
@media (max-width: 760px) {
  .panneau {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 0.9rem;
  }

  .bouton--outils {
    display: inline-flex;
  }
}

/* Carte choisie au toucher (téléphone) */
.carte--choisie {
  translate: 0 -14px;
  z-index: 6;
  box-shadow: 0 0 0 3px #ffd166, 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* ----- Pause ----- */
.voile-pause {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(8, 20, 13, 0.62);
  color: #f1dc8a;
  font-size: 1.6rem;
  font-weight: 800;
}

.voile-pause[hidden] {
  display: none;
}

.voile-pause p {
  margin: 0;
}

/* L'en-tête reste utilisable pendant la pause */
.jeu .haut {
  position: relative;
  z-index: 26;
}

.haut__mobile {
  display: none;
  gap: 0.4rem;
  align-items: center;
}

@media (max-width: 760px) {
  .haut__mobile {
    display: inline-flex;
  }

  #btn-pause {
    display: none;
  }
}
