:root {
  --fond: #14161c;
  --texte: #f2f2f2;
  --discret: #9aa0ab;
  --carte: #1f232c;
  --correct: #c0392b;
  --present: #d4a017;
  --absent: #3a3f4b;
  --indice: #2c3140;
  --accent: #5b8def;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--carte);
}

h1 {
  margin: 0;
  letter-spacing: 0.15em;
  font-size: 1.6rem;
}

h2 {
  margin-top: 0;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

#compte {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--discret);
}

#compte form {
  margin: 0;
}

#zone-jour {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--discret);
  font-size: 0.9rem;
}

select {
  padding: 0.3rem;
  border-radius: 6px;
  background: var(--carte);
  color: var(--texte);
  border: 1px solid var(--absent);
}



#grille {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin: 1rem 0;
  width: 100%;
}

.ligne {
  display: flex;
  gap: 0.25rem;
  width: 100%;
}

.case {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--carte);
  font-weight: 700;
  font-size: clamp(0.9rem, 4.5vw, 1.6rem);
  border: 2px solid transparent;
}

.case.correct {
  background: var(--correct);
}

.case.present {
  background: var(--present);
  color: #111;
}

.case.absent {
  background: var(--absent);
}

.case.indice {
  background: var(--indice);
  color: var(--discret);
}

.case.saisie {
  border-color: var(--accent);
}

#message {
  min-height: 1.5em;
  text-align: center;
  color: var(--discret);
}

#message.succes {
  color: #6fd38a;
}

#message.echec {
  color: #ff8a80;
}

#message.erreur {
  color: #ffb74d;
}

#clavier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  width: var(--largeur-clavier);
  margin-left: auto;
  margin-right: auto;
}

.rangee {
  display: flex;
  gap: 0.3rem;
  width: 100%;
}

.touche {
  flex: 1 1 0;
  min-width: 0;
  max-width: 2.6rem;
  height: 2.8rem;
  border: 0;
  border-radius: 6px;
  background: var(--carte);
  color: var(--texte);
  font-weight: 700;
  cursor: pointer;
}

.touche.large {
  flex: 1.6 1 0;
  max-width: 3.6rem;
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  main {
    padding: 0.75rem;
  }

  header {
    padding: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .touche {
    height: 2.4rem;
    font-size: 0.85rem;
  }

  .touche.large {
    font-size: 0.7rem;
  }

  .ligne {
    gap: 0.2rem;
  }

  #grille {
    gap: 0.25rem;
  }

  .aides button {
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
  }

  dialog {
    padding: 1rem;
  }
}

.touche.correct {
  background: var(--correct);
}

.touche.present {
  background: var(--present);
  color: #111;
}

.touche.absent {
  background: var(--absent);
  color: var(--discret);
}

.bouton,
button.secondaire {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button.secondaire {
  background: var(--carte);
  color: var(--texte);
}

:root {
  --largeur-clavier: min(100%, 25rem);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: var(--largeur-clavier);
  margin: 0.75rem auto 0;
}

.actions .bouton,
.actions button.secondaire {
  width: 100%;
  text-align: center;
}

.aides {
  display: flex;
  gap: 0.5rem;
}

.aides button {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.5rem 0.4rem;
}

.titre {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.titre button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
}

dialog {
  background: var(--carte);
  color: var(--texte);
  border: 1px solid var(--absent);
  border-radius: 10px;
  max-width: min(90vw, 32rem);
  padding: 1.25rem 1.5rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

dialog ul {
  padding-left: 1.1rem;
  line-height: 1.5;
}

dialog form {
  text-align: right;
}

.exemple {
  display: inline-block;
  min-width: 4.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
}

.exemple.correct {
  background: var(--correct);
}

.exemple.present {
  background: var(--present);
  color: #111;
}

.exemple.absent {
  background: var(--absent);
}

#message.indice-texte {
  color: #9fd3ff;
}

#connexion {
  text-align: center;
  margin-top: 3rem;
}

#classement {
  margin-top: 2.5rem;
}

.tableau {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--carte);
}

th {
  color: var(--discret);
  font-weight: 600;
  font-size: 0.85rem;
}

td:not(:first-child),
th:not(:first-child) {
  text-align: right;
}
