/* ============================================================
   SUPER SERPENTS — css/style.css
   Grande interface pour enfants : gros boutons, peu de texte.
   ============================================================ */
:root {
  --texte: #1f2430;
  --fond: #8d98a3;
  --blanc: #ffffff;
  --vert: #2ecc71;
  --vert-fonce: #27ae60;
  --bleu: #3d8bff;
  --bleu-fonce: #2f6fe0;
  --rouge: #ff4d4d;
  --jaune: #ffd11a;
  --gris-bouton: #e9edf2;
  --ombre: 0 10px 30px rgba(20, 26, 40, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%; overflow: hidden; touch-action: none;
  background: var(--fond);
  font-family: "Arial Rounded MT Bold", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--texte);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#jeu { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

/* ---------- les écrans (menu, mort, salon…) ---------- */
.ecran {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px; z-index: 40; background: rgba(31, 36, 48, .45);
  overflow-y: auto;
}
.ecran.cache { display: none; }
.boite {
  background: var(--blanc); border-radius: 28px; padding: 26px 24px;
  width: min(520px, 94vw); box-shadow: var(--ombre); text-align: center;
  max-height: 94vh; overflow-y: auto;
}
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: 1px; }
h1 .serp { text-decoration: underline wavy var(--vert); }
.sous { color: #5a6474; font-size: 1.05rem; margin: 8px 0 18px; }

/* gros boutons */
.btn {
  display: block; width: 100%; margin: 12px 0; padding: 20px 18px;
  font-size: clamp(1.15rem, 4.5vw, 1.45rem); font-weight: bold; font-family: inherit;
  color: #fff; background: var(--vert); border: none; border-radius: 22px;
  cursor: pointer; box-shadow: 0 6px 0 var(--vert-fonce);
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--vert-fonce); }
.btn.bleu { background: var(--bleu); box-shadow: 0 6px 0 var(--bleu-fonce); }
.btn.bleu:active { box-shadow: 0 2px 0 var(--bleu-fonce); }
.btn.gris { background: var(--gris-bouton); color: var(--texte); box-shadow: 0 6px 0 #c6cdd6; }
.btn.gris:active { box-shadow: 0 2px 0 #c6cdd6; }
.btn:disabled { filter: grayscale(.6); opacity: .6; }

/* champ pseudo */
input[type="text"] {
  width: 100%; padding: 16px; font-size: 1.25rem; font-family: inherit;
  border: 3px solid #d5dbe3; border-radius: 16px; text-align: center;
  margin: 6px 0 4px; background: #f7f9fc; color: var(--texte);
}
input[type="text"]:focus { outline: none; border-color: var(--bleu); }

/* ---------- le choix de difficulté ---------- */
.grille-dif { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.dif {
  padding: 16px 6px; border: none; border-radius: 18px; cursor: pointer;
  font-family: inherit; font-size: 1.02rem; font-weight: bold; color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .22); display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; min-height: 92px;
}
.dif:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .22); }
.dif .emo { font-size: 2rem; }
.dif.facile { background: #2ecc71; } .dif.moyen { background: #f39c12; }
.dif.difficile { background: #e67e22; } .dif.tresdifficile { background: #e74c3c; }

/* ---------- le salon (partie avec les copains) ---------- */
.code-salle {
  font-size: clamp(2.6rem, 12vw, 3.6rem); letter-spacing: 6px; margin: 6px 0;
  background: #f2f5f9; border-radius: 18px; padding: 12px;
}
.lien-partage {
  font-size: .85rem; background: #f2f5f9; border-radius: 12px; padding: 8px 10px;
  word-break: break-all; color: #5a6474; margin: 8px 0;
}
.joueurs-salon { list-style: none; margin: 10px 0; font-size: 1.1rem; }
.joueurs-salon li {
  padding: 8px 12px; border-radius: 12px; background: #f2f5f9; margin: 6px 0;
  display: flex; align-items: center; gap: 10px; justify-content: center;
}
.pastille { width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- le clavier à animaux (entrer un code) ---------- */
.code-slots { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.code-slots span {
  width: 72px; height: 72px; font-size: 2.6rem; display: flex; align-items: center;
  justify-content: center; background: #f2f5f9; border-radius: 16px; border: 3px dashed #c9d2dd;
}
.grille-animaux { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.animal {
  font-size: 2rem; padding: 10px 0; border: none; border-radius: 14px; cursor: pointer;
  background: #f2f5f9; font-family: inherit; min-height: 60px;
}
.animal:active { background: #dfe7ef; transform: scale(.94); }

/* ---------- les boutons en pleine partie ---------- */
#btnBombe {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left));
  width: 92px; height: 92px; border-radius: 50%; border: none; cursor: pointer;
  background: conic-gradient(var(--rouge) var(--pourcent, 100%), #565f6c 0);
  z-index: 30; box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
  font-size: 2.4rem; line-height: 1; color: #fff; font-family: inherit;
  display: none; align-items: center; justify-content: center;
  -webkit-user-select: none; user-select: none;
}
#btnBombe .cd {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: bold; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
#btnBombe.pret { animation: pulse .4s ease; }
@keyframes pulse { 50% { transform: scale(1.12); } }

#btnSprint {
  position: fixed; bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  min-width: 200px; padding: 20px 34px; border-radius: 60px; border: none; cursor: pointer;
  background: var(--jaune); color: #5b4600; font-size: 1.5rem; font-weight: bold; font-family: inherit;
  box-shadow: 0 6px 0 #d9ad00; z-index: 30; display: none;
}
#btnSprint.actif { background: #ffb400; transform: translateX(-50%) scale(.96); box-shadow: 0 2px 0 #d9ad00; }

/* ---------- le classement en direct ---------- */
#classement {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  background: rgba(255, 255, 255, .92); border-radius: 16px; padding: 8px 12px;
  min-width: 148px; z-index: 20; font-size: .92rem; display: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
#classement h2 { font-size: .8rem; color: #5a6474; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
#classement .ligne { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
#classement .ligne .pastille { width: 12px; height: 12px; }
#classement .ligne .qui { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
#classement .ligne.moi { font-weight: bold; background: #fff3c4; border-radius: 8px; padding: 1px 6px; margin: 0 -6px; }

/* ---------- petits messages ---------- */
#toast {
  position: fixed; top: calc(120px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: rgba(31, 36, 48, .92); color: #fff; padding: 12px 22px; border-radius: 40px;
  z-index: 60; font-size: 1.05rem; display: none; text-align: center; max-width: 88vw;
}
#deco {
  position: fixed; top: calc(120px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: rgba(229, 57, 53, .94); color: #fff; padding: 10px 20px; border-radius: 40px;
  z-index: 55; font-size: 1rem; display: none;
}

/* ---------- l'écran des records ---------- */
.clq-liste { margin: 10px 0; }
.clq-ligne {
  display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px;
  background: #f2f5f9; margin: 5px 0; font-size: 1.02rem;
}
.clq-ligne b { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.clq-ligne .pts { color: #5a6474; }
.clq-vide { color: #8a93a2; padding: 10px; }

.trois { display: flex; gap: 10px; }
.trois .btn { margin: 12px 0 0; }

@media (max-width: 480px) {
  #classement { font-size: .82rem; min-width: 128px; }
  #btnBombe { width: 82px; height: 82px; font-size: 2.1rem; }
  #btnSprint { min-width: 170px; font-size: 1.3rem; }
}

/* respect des personnes sensibles au mouvement */
@media (prefers-reduced-motion: reduce) {
  .btn, .dif, .animal { transition: none; }
  #btnBombe.pret { animation: none; }
}
