.jeu-devinette,
.regles-devinette {
  margin: 0 0 1.4rem;
}

.dev-numero {
  margin: 0 0 0.8rem;
  font-weight: 800;
  color: var(--accent);
}

.dev-saisie {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.dev-label {
  font-weight: 700;
}

.jeu-devinette input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--ligne);
  background: var(--carte);
  color: var(--texte);
  font: inherit;
  font-size: 16px;
}

.dev-suggestions {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  max-height: 18rem;
  overflow: auto;
}

.dev-suggestions button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.35rem 0.45rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--texte);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dev-suggestions button[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.dev-suggestions img {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: cover;
  border-radius: 8px;
  background: #0d120c;
  flex: 0 0 auto;
}

.dev-message {
  min-height: 1.2rem;
  margin: 0;
  color: var(--muet);
}

.dev-tableau {
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.dev-entetes,
.dev-ligne {
  display: grid;
  grid-template-columns: minmax(8.5rem, 1.4fr) repeat(5, minmax(4.2rem, 1fr));
  gap: 0.35rem;
  align-items: stretch;
  min-width: 36rem;
}

.dev-entetes {
  margin: 0 0 0.35rem;
  color: var(--muet);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.dev-grille {
  display: grid;
  gap: 0.4rem;
}

.dev-nom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.3rem;
  border: 1px solid var(--ligne);
  border-radius: 10px;
  background: var(--carte);
  color: var(--texte);
}

.dev-nom img {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: 8px;
  background: #0d120c;
  flex: 0 0 auto;
}

.dev-nom span {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.2;
}

.dev-case {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3.3rem;
  padding: 0.25rem 0.15rem;
  border-radius: 10px;
  border: 1px solid var(--ligne);
  background: var(--carte);
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.15;
  animation: dev-pop 0.28s ease both;
}

.dev-ligne .dev-case:nth-child(2) { animation-delay: 0.04s; }
.dev-ligne .dev-case:nth-child(3) { animation-delay: 0.08s; }
.dev-ligne .dev-case:nth-child(4) { animation-delay: 0.12s; }
.dev-ligne .dev-case:nth-child(5) { animation-delay: 0.16s; }
.dev-ligne .dev-case:nth-child(6) { animation-delay: 0.2s; }

.dev-case.ok {
  background: #1e4d32;
  border-color: var(--feuille);
  color: #e7ffe9;
}

.dev-case.proche {
  background: #5c3814;
  border-color: var(--renard);
  color: #fff0dc;
}

.dev-case.ko {
  background: #5c2424;
  border-color: #e05a5a;
  color: #ffe4e4;
}

.dev-symbole {
  font-size: 0.95rem;
  font-weight: 800;
}

.dev-mesure {
  color: inherit;
  opacity: 0.85;
  font-size: 0.65rem;
}

.dev-fin {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--ligne);
  border-radius: 12px;
  background: var(--carte);
}

.dev-fin h2 {
  margin: 0.6rem 0 0.2rem;
}

.dev-fin .latin {
  margin-bottom: 0.6rem;
}

.dev-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dev-actions .cta {
  margin-top: 0.4rem;
}

.dev-partage-statut {
  min-height: 1.3rem;
  margin: 0.35rem 0 0;
  font-weight: 800;
  color: var(--accent);
}

.dev-partage-texte {
  width: 100%;
  min-height: 8rem;
  margin-top: 0.5rem;
  padding: 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--ligne);
  background: var(--fond);
  color: var(--texte);
  font: inherit;
}

.dev-compte {
  margin: 0.9rem 0 0.4rem;
  color: var(--muet);
}

.dev-stats {
  margin-top: 0.6rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--ligne);
  border-radius: 12px;
  background: var(--carte);
}

.dev-stats h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.dev-stats p {
  margin: 0.2rem 0;
}

.dev-barres {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.dev-barre {
  display: grid;
  grid-template-columns: 1.2rem 1fr auto;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.85rem;
}

.dev-barre i {
  display: block;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--accent);
}

.regles-devinette h2 {
  margin: 0 0 0.4rem;
}

.regles-devinette p {
  color: var(--muet);
  margin: 0.35rem 0;
}

@media (max-width: 720px) {
  .jeu-devinette .cta {
    width: 100%;
  }
  .regles-devinette {
    padding-bottom: calc(4.6rem + env(safe-area-inset-bottom));
  }
}

/* Mobile : nom sur une ligne, puis 5 indices sur toute la largeur */
@media (max-width: 640px) {
  .dev-tableau {
    overflow-x: visible;
  }
  .dev-entetes,
  .dev-ligne {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.25rem;
    min-width: 0;
  }
  .dev-entetes span:first-child {
    display: none;
  }
  .dev-entetes {
    font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  }
  .dev-entetes span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dev-grille {
    gap: 0.6rem;
  }
  .dev-nom {
    grid-column: 1 / -1;
    padding: 0.2rem 0.3rem;
  }
  .dev-nom img {
    width: 1.8rem;
    height: 1.8rem;
  }
  .dev-case {
    min-width: 0;
    min-height: 3rem;
    padding: 0.2rem 0.1rem;
    font-size: clamp(0.58rem, 2.7vw, 0.72rem);
    overflow-wrap: anywhere;
    hyphens: auto;
  }
  .dev-case > span {
    max-width: 100%;
  }
  .dev-symbole {
    font-size: 0.85rem;
  }
  .dev-mesure {
    font-size: 0.52rem;
  }
}

@keyframes dev-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
