* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f7;
  color: #172033;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header {
  background: #ffffff;
  border-bottom: 1px solid #d8dee8;
  padding: 18px;
  text-align: center;
}

h1 {
  margin: 0 0 5px;
  font-size: clamp(22px, 4vw, 34px);
}

header p {
  margin: 0;
  color: #5f6978;
}

main {
  max-width: 1500px;
  margin: auto;
  padding: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #173b70;
  color: white;
}

button.secondary {
  background: #e5eaf1;
  color: #172033;
}

#status {
  margin-left: auto;
  font-size: 14px;
  color: #596476;
}

/* =========================
   GRILLE
   ========================= */

.board {
  position: relative;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;

  background-image: url("grille.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;

  /*
    14 colonnes × 9 lignes
    Les dimensions restent identiques
    jusqu'à la dernière case.
  */
  aspect-ratio: 14 / 9;

  overflow: hidden;
}

/* =========================
   CASES SAISISSABLES
   ========================= */

.cell {
  position: absolute;

  width: calc(100% / 14);
  height: calc(100% / 9);

  margin: 0;
  padding: 0;

  border: 0;
  outline: none;

  background: transparent;

  z-index: 10;
  pointer-events: auto;
  cursor: text;

  /* Centrage horizontal */
  text-align: center;

  /* Centrage vertical */
  line-height: 1;

  /* Texte */
  text-transform: uppercase;
  font-size: clamp(16px, 2.6vw, 32px);
  font-weight: 800;
  font-family: Arial, Helvetica, sans-serif;
  color: #172033;

  /* Centrage parfait */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Case sélectionnée */

.cell:focus {
  background: rgba(255, 248, 168, 0.75);
  box-shadow: inset 0 0 0 3px #173b70;
}

/* Bonne réponse */

.cell.correct {
  background: rgba(191, 231, 197, 0.6);
}

/* Mauvaise réponse */

.cell.wrong {
  background: rgba(255, 197, 197, 0.6);
}

/* =========================
   PETITS ÉCRANS
   ========================= */

@media (max-width: 700px) {

  main {
    padding: 8px;
  }

  #status {
    width: 100%;
    margin-left: 0;
  }

  .board {
    width: 100%;
    aspect-ratio: 14 / 9;
  }

  .cell {
    font-size: clamp(12px, 5vw, 24px);
  }
}

/* =========================
   IMPRESSION
   ========================= */

@media print {

  header,
  .toolbar {
    display: none;
  }

  body {
    background: white;
  }

  main {
    padding: 0;
  }

  .cell {
    display: none;
  }

  .board {
    width: 100%;
    max-width: none;
  }
}
