:root {
  --creme: #f6f1e4;
  --noir: #171512;
  --rouge: #d8332a;
  --bleu: #1c4fa1;
  --jaune: #f4c300;
  --vert: #3a7d44;
  --gris-rejete: #cfc7b0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--creme);
  color: var(--noir);
  font-family: "Bricolage Grotesque", "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 1.5rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 0.6rem;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sous-titre {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.7;
}

/* --- Page d'accueil --------------------------------------------------- */

.accueil {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.6rem;
  margin-top: 2rem;
  max-width: min(920px, 94vw);
}

.logo-accueil {
  /* Taille fluide plutot qu'un point de rupture fixe : "Lexicommandeur"
     (14 caracteres) en 4rem fixe debordait sur mobile (signale le
     2026-08-05). clamp() suit la largeur d'ecran (9vw) tout en gardant
     un minimum lisible (1.8rem) et le maximum d'origine (4rem) sur
     desktop. */
  font-size: clamp(1.8rem, 9vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
}

.description-accueil {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0.85;
  margin: 0;
  max-width: 560px;
}

.blobs-accueil {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.5rem 0;
}

.blobs-accueil.blobs-mini {
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.blob-deco {
  width: 2.6rem;
  height: 2.6rem;
  border: 3px solid var(--noir);
}

.blobs-mini .blob-deco {
  width: 1.1rem;
  height: 1.1rem;
  border-width: 2px;
}

.blob-deco:nth-child(1) {
  background: var(--rouge);
  border-radius: 40% 60% 55% 45% / 60% 45% 55% 40%;
}

.blob-deco:nth-child(2) {
  background: var(--bleu);
  border-radius: 55% 45% 40% 60% / 45% 55% 60% 40%;
}

.blob-deco:nth-child(3) {
  background: var(--jaune);
  border-radius: 45% 55% 60% 40% / 55% 40% 45% 60%;
}

.blob-deco:nth-child(4) {
  background: var(--vert);
  border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%;
}

.bouton-play {
  font-size: 1.4rem;
  font-weight: 800;
  padding: 0.9rem 3rem;
  letter-spacing: 0.05em;
  background: var(--rouge);
  color: var(--creme);
  border-radius: 60px 20px 60px 20px;
  text-decoration: none;
  display: inline-block;
}

.choix-mode {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.bouton-entrainement {
  background: var(--creme);
  color: var(--noir);
  border: 3px solid var(--noir);
}

.explication-mode {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
  margin: -0.4rem 0 0;
  max-width: 480px;
}

/* --- Indicateur de mode (page de jeu) ----------------------------------*/

.badge-mode {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.25rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 2px solid var(--noir);
  border-radius: 30px 10px 30px 10px;
  background: var(--jaune);
  color: var(--noir);
}

.badge-mode.masque {
  display: none;
}

.modal-mode {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--rouge);
  margin: -0.4rem 0 0.9rem;
}

.modal-mode.masque {
  display: none;
}

/* --- Tutoriel intégré à l'accueil -------------------------------------- */

.tutoriel {
  width: 100%;
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 3px dashed var(--noir);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.tutoriel h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.tutoriel-intro {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0.85;
  max-width: 620px;
  margin: 0;
}

.tutoriel-corps {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.6rem;
  align-items: flex-start;
}

.tutoriel-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  flex: 1 1 420px;
  max-width: 480px;
}

#toile-tuto {
  width: 100%;
  height: 260px;
  background: #fffdf7;
  border: 3px solid var(--noir);
  border-radius: 28px 60px 30px 70px / 60px 30px 70px 30px;
}

#formulaire-tuto {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  justify-content: center;
}

#champ-tuto {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.7rem 1.1rem;
  border: 3px solid var(--noir);
  border-radius: 30px 10px 30px 10px;
  background: #fffdf7;
  color: var(--noir);
  min-width: 160px;
  text-align: center;
}

#champ-tuto[readonly] {
  opacity: 0.85;
  cursor: default;
}

#message-tuto {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--vert);
  text-align: center;
  min-height: 1.3rem;
  max-width: 420px;
}

.legende-tuto {
  flex: 1 1 260px;
  max-width: 320px;
  background: #fffdf7;
  border: 3px solid var(--noir);
  border-radius: 20px 8px 20px 8px;
  padding: 1.1rem 1.2rem;
  text-align: left;
}

.legende-tuto h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 800;
}

.legende-tuto ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.legende-tuto li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.legende-tuto .pastille {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* --- Page de jeu -------------------------------------------------------*/

.lien-accueil {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--noir);
  opacity: 0.6;
  text-decoration: none;
  margin-bottom: 0.6rem;
}

.lien-accueil:hover {
  opacity: 1;
}

.info-partie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.cadres {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.3rem;
  font-weight: 700;
}

.cadre {
  padding: 0.5rem 1.2rem;
  border-radius: 40% 60% 55% 45% / 60% 45% 55% 40%;
  border: 3px solid var(--noir);
  background: var(--rouge);
  color: var(--creme);
  text-transform: capitalize;
}

.separateur {
  font-size: 1.4rem;
  opacity: 0.6;
}

.compteur {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.65;
}

#toile {
  width: min(900px, 92vw);
  height: min(360px, 40vh);
  background: #fffdf7;
  border: 3px solid var(--noir);
  border-radius: 28px 60px 30px 70px / 60px 30px 70px 30px;
  margin-bottom: 0.8rem;
}

.legende {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.1rem;
  max-width: min(900px, 92vw);
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.75;
}

.legende-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.pastille {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--noir);
  border-radius: 40% 60% 55% 45% / 60% 45% 55% 40%;
}

.pastille-cadre {
  background: var(--rouge);
}

.pastille-1 {
  background: var(--bleu);
}

.pastille-2 {
  background: var(--jaune);
}

.pastille-3 {
  background: var(--vert);
}

.pastille-rejete {
  background: var(--gris-rejete);
  border-style: dashed;
}

.zone-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.zone-action-ecart {
  margin-top: 0.2rem;
  margin-bottom: 0.9rem;
  opacity: 0.85;
}

#bouton-composer {
  background: var(--creme);
  border-style: dashed;
  font-size: 0.9rem;
}

#formulaire-mot {
  display: flex;
  gap: 0.6rem;
}

#champ-mot {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.7rem 1.1rem;
  border: 3px solid var(--noir);
  border-radius: 30px 10px 30px 10px;
  background: #fffdf7;
  color: var(--noir);
  min-width: 220px;
}

#champ-mot:focus {
  outline: 3px solid var(--bleu);
}

button {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  border: 3px solid var(--noir);
  border-radius: 10px 30px 10px 30px;
  background: var(--jaune);
  color: var(--noir);
  cursor: pointer;
  transition: transform 0.1s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

#bouton-nouvelle-partie {
  background: var(--creme);
}

#bouton-ranger {
  background: var(--creme);
}

#bouton-bilan {
  background: var(--vert);
  color: var(--creme);
}

.message {
  min-height: 1.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  max-width: 600px;
  padding: 0 0.5rem;
}

.message.erreur {
  color: var(--rouge);
}

.message.victoire {
  color: var(--vert);
  font-size: 1.3rem;
}

.message.info {
  opacity: 0.7;
}

.modal-fond {
  position: fixed;
  inset: 0;
  background: rgba(23, 21, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal-fond.masque {
  display: none;
}

.modal-carte {
  position: relative;
  background: var(--creme);
  border: 4px solid var(--noir);
  border-radius: 50px 100px 50px 100px / 100px 50px 100px 50px;
  padding: 2.6rem 3rem;
  max-width: min(440px, 100%);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.modal-carte-large {
  max-width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-carte h2 {
  margin: 0 0 0.8rem;
  font-size: 2rem;
  color: var(--vert);
}

.modal-carte p {
  margin: 0 0 1rem;
  font-weight: 600;
}

.modal-fermer {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  box-shadow: none;
}

.modal-fermer:hover {
  transform: none;
  opacity: 0.6;
}

.score-hero {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--bleu);
  margin: 0.2rem 0 1.2rem;
  line-height: 1;
}

.score-hero span {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--noir);
  opacity: 0.7;
}

.resume-partage {
  background: #fffdf7;
  border: 3px solid var(--noir);
  border-radius: 20px 8px 20px 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.4rem;
  text-align: center;
}

.resume-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0;
}

.resume-section + .resume-section {
  border-top: 2px dashed var(--noir);
  margin-top: 0.3rem;
}

.resume-titre-section {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.resume-emojis {
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  display: block;
  word-break: break-word;
}

.resume-legende {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.65;
}

.resume-rejetes {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.85;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

#bouton-copier {
  background: var(--vert);
  color: var(--creme);
}

#bouton-telecharger {
  background: var(--bleu);
  color: var(--creme);
}

/* --- Pied de page (liens legaux) ---------------------------------------*/

.pied-de-page {
  width: 100%;
  margin-top: 2rem;
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.pied-de-page a {
  color: var(--noir);
  opacity: 0.6;
  text-decoration: none;
}

.pied-de-page a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* --- Pages legales ------------------------------------------------------*/

.page-legale {
  width: 100%;
  max-width: min(680px, 92vw);
  margin: 1.2rem 0 0;
  background: #fffdf7;
  border: 3px solid var(--noir);
  border-radius: 30px 8px 30px 8px;
  padding: 1.8rem 2.2rem;
  text-align: left;
  line-height: 1.6;
}

.page-legale h1 {
  font-size: 1.7rem;
  margin: 0 0 1.2rem;
}

.page-legale h2 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.page-legale p {
  margin: 0 0 0.9rem;
  font-weight: 500;
}

.page-legale .placeholder {
  opacity: 0.6;
  font-style: italic;
}

.page-legale a {
  color: var(--bleu);
}
