/* ================================================================
   LE PENDU — styles
   Palette : prune foncé + or, typographie Baloo 2 / Nunito
   ================================================================ */

:root {
  --prune-fonce: #2b1128;
  --prune-plus-fonce: #190a17;
  --prune-clair: #4a2246;
  --prune-eclat: #6b3164;
  --or: #d8a657;
  --or-clair: #f0d29a;
  --creme: #f4ead9;
  --rouge: #d9564c;
  --vert: #8bc077;
  --ombre: rgba(10, 3, 9, 0.55);

  --police-titre: "Baloo 2", "Comic Sans MS", sans-serif;
  --police-texte: "Nunito", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background-color: var(--prune-fonce);
  color: var(--creme);
  font-family: var(--police-texte);
  overflow-x: hidden;
}

body {
  background-image:
    linear-gradient(rgba(25, 10, 23, 0.72), rgba(25, 10, 23, 0.72)),
    url("../images/image-fond.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}

button {
  font-family: var(--police-titre);
  cursor: pointer;
  border: none;
}

img { max-width: 100%; display: block; }

.ecran {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ecran[hidden] {
  display: none;
}

/* ============ ÉCRAN DE CHARGEMENT ============ */
.ecran-chargement {
  justify-content: center;
  gap: 24px;
  background-color: var(--prune-fonce);
}

.chargement-potence { width: 110px; }

.chargement-svg {
  width: 100%;
  fill: none;
  stroke: var(--or);
  stroke-width: 5;
  stroke-linecap: round;
}
.chargement-tete {
  fill: var(--prune-fonce);
  stroke: var(--or-clair);
  animation: balancer 1.6s ease-in-out infinite;
  transform-origin: 80px 32px;
}
@keyframes balancer {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

.chargement-texte {
  font-family: var(--police-titre);
  font-size: 1.3rem;
  color: var(--or-clair);
  letter-spacing: 0.03em;
}
.points span { animation: clignoter 1.4s infinite; opacity: 0; }
.points span:nth-child(1) { animation-delay: 0s; }
.points span:nth-child(2) { animation-delay: 0.2s; }
.points span:nth-child(3) { animation-delay: 0.4s; }
@keyframes clignoter { 0%, 20% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

.chargement-barre {
  width: min(280px, 70vw);
  height: 10px;
  border-radius: 6px;
  background: var(--prune-plus-fonce);
  overflow: hidden;
  border: 2px solid var(--prune-eclat);
}
.chargement-progression {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--or), var(--or-clair));
  transition: width 0.25s ease;
}

/* ============ ÉCRAN D'ACCUEIL ============ */
.ecran-accueil {
  justify-content: flex-start;
  padding: 32px 24px;
  gap: 0;
}

.accueil-titre {
  max-width: min(520px, 90vw);
  margin: 12px auto 40px;
}
.titre-repli {
  font-family: var(--police-titre);
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: var(--or-clair);
  text-shadow: 3px 3px 0 var(--prune-plus-fonce);
  margin: 24px 0 40px;
  text-align: center;
}

.accueil-lien-jouer {
  display: block;
  margin: 0 auto 56px;
  max-width: 260px;
  transition: transform 0.15s ease;
  text-decoration: none;
}
.accueil-lien-jouer:hover { transform: scale(1.05); }
.accueil-lien-jouer:active { transform: scale(0.97); }

.bouton-repli {
  display: inline-block;
  font-family: var(--police-titre);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--prune-plus-fonce);
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  padding: 16px 48px;
  border-radius: 50px;
  box-shadow: 0 6px 0 #a87a34, 0 10px 18px var(--ombre);
}

.accueil-bas {
  margin-top: auto;
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .accueil-bas {
    justify-content: center;
    align-items: center;
    text-align: center;
  }
}

.accueil-image {
  width:114px;
  height: 100px;
  object-fit: cover;
  /**border-radius: 14px;
  border: 3px solid var(--or);
  background: var(--prune-clair);**/
}

.accueil-texte {
  width: 300px;
  height: 100px;
  max-width: 80vw;
  background: rgba(25, 10, 23, 0.55);
  /**border: 3px solid var(--or);
  border-radius: 16px;
  padding: 18px;
  color: var(--creme);**/
  font-size: 1rem;
  line-height: 1.5;
  overflow-y: auto;
}

/* ============ EN-TÊTE DU JEU ============ */
.ecran-jeu {
  padding: 14px 18px 24px;
  max-width: 1100px;
  margin: 0 auto;
  gap: 10px;
}

.jeu-entete {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.entete-droite {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icone {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--prune-clair);
  border: 2px solid var(--or);
  color: var(--or-clair);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-icone:hover { transform: translateY(-2px); background: var(--prune-eclat); }
.btn-icone.muet { color: var(--rouge); opacity: 0.75; }

.compteur {
  font-family: var(--police-titre);
  background: var(--prune-clair);
  border: 2px solid var(--or);
  color: var(--or-clair);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 1rem;
  min-width: 70px;
  text-align: center;
}

.indice {
  font-family: var(--police-titre);
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  text-align: center;
  color: var(--or-clair);
  background: var(--prune-plus-fonce);
  border: 2px dashed var(--or);
  border-radius: 14px;
  padding: 12px 20px;
  margin: 6px 0 4px;
  max-width: 640px;
}

/* ============ ZONE SUPÉRIEURE (minuteur / pendu) ============ */
.zone-superieure {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.colonne-gauche {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.minuteur {
  --progression: 1;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(closest-side, var(--prune-fonce) 72%, transparent 73% 100%),
    conic-gradient(var(--or) calc(var(--progression) * 360deg), var(--prune-plus-fonce) 0deg);
  transition: background 0.3s linear;
}
.minuteur.minuteur-urgent { animation: alerte 0.6s infinite; }
@keyframes alerte {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
#minuteur-texte {
  font-family: var(--police-titre);
  font-size: 1.5rem;
  color: var(--or-clair);
}
.minuteur.minuteur-urgent #minuteur-texte { color: var(--rouge); }

.image-question-cadre {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  border: 3px solid var(--or);
  background: var(--prune-clair);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-question { width: 100%; height: 100%; object-fit: cover; }

.colonne-droite {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 200px;
}

.pendu-svg {
  width: min(220px, 60vw);
  fill: none;
  stroke: var(--creme);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pendu-socle, .pendu-poteau, .pendu-barre, .pendu-corde { stroke: var(--or); opacity: 0.9; }
.partie-pendu {
  opacity: 0;
  stroke: var(--creme);
  transition: opacity 0.35s ease;
}
.partie-pendu.visible { opacity: 1; }
#partie-1 { fill: var(--prune-fonce); }

/* ============ MOT À DEVINER ============ */
.mot-a-deviner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 6px;
  width: 100%;
}
.case-lettre {
  min-width: 34px;
  height: 44px;
  border-bottom: 4px solid var(--or);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--police-titre);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--creme);
}
.case-lettre.trouvee { color: var(--or-clair); }
.case-lettre.echec { color: var(--rouge); border-color: var(--rouge); }

/* ============ CLAVIER ============ */
.clavier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}
.rangee-clavier {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.rangee-accents { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--prune-eclat); }

.touche {
  width: 40px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  color: var(--prune-plus-fonce);
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 3px 0 #a87a34;
  transition: transform 0.1s ease, opacity 0.3s ease;
}
.touche:active { transform: translateY(2px); box-shadow: 0 1px 0 #a87a34; }
.touche.utilisee {
  opacity: 0.28;
  background: var(--prune-clair);
  color: var(--creme);
  box-shadow: none;
  cursor: default;
}
.touche.correcte { outline: 2px solid var(--vert); }
.touche.incorrecte { outline: 2px solid var(--rouge); }

/* ============ BOUTON SUIVANT ============ */
.bouton-suivant {
  margin-top: 18px;
  background: none;
  border: none;
  padding: 0;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease;
}
.bouton-suivant:hover { transform: scale(1.05); }

.suivant-label {
  font-family: var(--police-titre);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--prune-plus-fonce);
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  padding: 12px 34px;
  border-radius: 40px;
  box-shadow: 0 5px 0 #a87a34;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ============ ÉCRAN DE FIN ============ */
.ecran-fin {
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 24px;
}
.fin-titre {
  font-family: var(--police-titre);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--or-clair);
}
.fin-score {
  font-family: var(--police-titre);
  font-size: clamp(1.4rem, 4vw, 2rem);
  background: var(--prune-plus-fonce);
  border: 2px solid var(--or);
  border-radius: 16px;
  padding: 14px 30px;
}
.fin-boutons { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

/* ============ CLASSEMENT ============ */
.bouton-classement-accueil {
  margin-top: 18px;
  font-family: var(--police-titre);
  font-size: 1rem;
  color: var(--or-clair);
  background: var(--prune-clair);
  border: 2px solid var(--or);
  padding: 10px 24px;
  border-radius: 30px;
}

.ecran-classement { justify-content: center; gap: 18px; padding: 24px; }

.classement-enregistrement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--prune-plus-fonce);
  border: 2px solid var(--or);
  border-radius: 16px;
  padding: 16px 24px;
  max-width: 360px;
  width: 100%;
}
.classement-enregistrement label {
  font-family: var(--police-titre);
  color: var(--or-clair);
  font-size: 0.95rem;
}
#pseudo-joueur {
  width: 100%;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 30px;
  border: 2px solid var(--or);
  background: var(--prune-fonce);
  color: var(--creme);
  font-family: var(--police-texte);
  font-size: 1rem;
  text-align: center;
}
#pseudo-joueur:focus { outline: 2px solid var(--or-clair); }

.message-enregistrement {
  font-size: 0.9rem;
  color: var(--vert);
  margin: 0;
}
.message-enregistrement.message-erreur { color: var(--rouge); }

.classement-conteneur {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.classement-conteneur h3 {
  font-family: var(--police-titre);
  color: var(--or-clair);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.liste-classement {
  list-style: none;
  counter-reset: rang;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.liste-classement li {
  background: var(--prune-clair);
  border: 1px solid var(--prune-eclat);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--creme);
  font-size: 0.95rem;
  text-align: left;
}

.bouton-principal, .bouton-secondaire {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 40px;
}
.bouton-principal {
  color: var(--prune-plus-fonce);
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  box-shadow: 0 5px 0 #a87a34;
}
.bouton-secondaire {
  color: var(--or-clair);
  background: var(--prune-clair);
  border: 2px solid var(--or);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
  .touche { width: 32px; height: 40px; font-size: 0.9rem; }
  .case-lettre { min-width: 26px; height: 36px; font-size: 1.15rem; }
  .accueil-texte { width: 260px; height: 220px; }
}
