* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  color: #1f2a24;
  background-color: #f4f1ea;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  width: min(100%, 46rem);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

h1 {
  font-size: 3.4rem;
  letter-spacing: 0.04em;
}

h2 {
  font-size: 1.6rem;
  font-weight: normal;
}

.presentation,
.consigne,
.coups,
.message,
.erreur,
.compte,
.classement,
.choix,
.bouton,
.lien,
input {
  font-family: "Segoe UI", Arial, sans-serif;
}

.presentation {
  max-width: 36rem;
  font-size: 1.2rem;
  line-height: 1.6;
}

.coin-compte {
  position: relative;
  display: flex;
  justify-content: flex-end;
  min-height: 2.4rem;
}

.liens-compte {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.35rem 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.85rem;
  color: #1f2a24;
}

.texte-bouton {
  font: inherit;
  color: #4d5c54;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.texte-bouton:hover {
  color: #1f2a24;
}

.panneau-compte {
  position: absolute;
  top: 2.3rem;
  right: 1.35rem;
  z-index: 2;
  width: 15rem;
  gap: 0.55rem;
  padding: 0.8rem;
  text-align: left;
  box-shadow: 0 10px 28px rgba(31, 42, 36, 0.08);
}

.bouton-compact {
  padding: 0.45rem 0.8rem;
  font-size: 0.9rem;
}

.entete,
.jeu,
.classement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.consigne {
  max-width: 32rem;
  line-height: 1.5;
}

.coups,
.erreur {
  color: #4d5c54;
}

.erreur {
  color: #8a3b32;
}

.ligne-boutons,
.choix-jeux {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.panneau {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 22rem);
  padding: 1rem;
  background-color: #fffdf8;
  border: 1px solid #d9d1c3;
  border-radius: 0.6rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
  font-size: 0.95rem;
}

input {
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d9d1c3;
  border-radius: 0.4rem;
  background-color: #fff;
  color: #1f2a24;
}

.bouton,
.choix,
.lien {
  font-size: 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.bouton {
  color: #f4f1ea;
  background-color: #2f4a3c;
  border: none;
  padding: 0.6rem 1.2rem;
}

.bouton:hover,
.choix:hover {
  background-color: #3d5e4d;
}

.bouton-secondaire,
.choix {
  color: #2f4a3c;
  background-color: transparent;
  border: 2px solid #2f4a3c;
  padding: 0.5rem 0.9rem;
}

.choix[aria-pressed="true"] {
  color: #f4f1ea;
  background-color: #2f4a3c;
}

.lien {
  color: #2f4a3c;
  background: none;
  border: none;
  text-decoration: underline;
}

.grille {
  display: grid;
  grid-template-columns: repeat(4, 5.5rem);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.carte {
  height: 5.5rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  perspective: 600px;
}

.carte-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.carte.retournee .carte-inner,
.carte.trouvee .carte-inner {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  backface-visibility: hidden;
  font-size: 2rem;
}

.dos {
  background-color: #2f4a3c;
  color: #f4f1ea;
  font-family: Georgia, "Times New Roman", serif;
}

.devant {
  background-color: #fffdf8;
  border: 2px solid #d9d1c3;
  transform: rotateY(180deg);
}

.carte.trouvee .devant {
  border-color: #2f4a3c;
}

.ciel {
  position: relative;
  width: min(100%, 22rem);
  height: 14rem;
  background-color: #24352c;
  border-radius: 0.6rem;
  overflow: hidden;
}

.etoile {
  position: absolute;
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 50%;
  background-color: #f4e7b3;
  cursor: pointer;
  font-size: 1.2rem;
}

.reflexe {
  width: min(100%, 16rem);
  height: 8rem;
  border: none;
  border-radius: 0.6rem;
  background-color: #2f4a3c;
  color: #f4f1ea;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 1.15rem;
  cursor: pointer;
}

.reflexe.attente {
  background-color: #8d6a4a;
}

.reflexe.pars {
  background-color: #d7c07a;
  color: #1f2a24;
}

.classement {
  width: min(100%, 28rem);
}

.classement ol {
  width: 100%;
  list-style: none;
  text-align: left;
  font-family: "Segoe UI", Arial, sans-serif;
}

.classement li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #e7e1d6;
}

footer {
  text-align: center;
  padding: 1.25rem;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.9rem;
  color: #4d5c54;
  background-color: #e7e1d6;
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.6rem;
  }

  .grille {
    grid-template-columns: repeat(4, 4.2rem);
    gap: 0.5rem;
  }

  .carte {
    height: 4.2rem;
  }

  .face {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carte-inner {
    transition: none;
  }
}
