/* Réinitialisation & mise en page */
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: #fff;
  font-family: system-ui, sans-serif;
}
body.admin-bar,
header,
footer,
.site-header,
.site-footer,
.main-navigation,
div#colophon,
.entry-footer {
  display: none !important;
}

/* Bouton PDF */
.pdf-controls {
  max-width: 960px;
  margin: 1rem auto 0.5rem auto;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
.pdf-controls button {
  font-size: 1rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid #1976D2;
  border-radius: 4px;
  background-color: #1976D2;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.pdf-controls button:hover {
  background-color: #0D47A1;
}

/* Contrôles grille */
.mental-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin: 1rem auto 0.5rem auto;
  padding: 0 1rem;
  gap: 1rem;
}
.mental-controls label,
.mental-controls select,
.mental-controls button {
  font-size: 1rem;
}
.mental-controls select {
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.mental-controls button {
  padding: 0.3rem 0.6rem;
  border: 1px solid #d32f2f;
  border-radius: 4px;
  background-color: #d32f2f;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.mental-controls button:hover {
  background-color: #b71c1c;
}

/* Titre “Trouve X” */
.mental-header {
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 0.5rem auto 1rem auto;
  color: #333;
}
.mental-header .target-number {
  color: #d32f2f;
  font-size: 2.2rem;
  margin-left: 0.25rem;
}

/* Grille et résultats */
.mental-wrap {
  display: flex;
  flex-direction: row;
  gap: 3rem;
  align-items: flex-start;
  max-width: 960px;
  margin: auto;
  padding: 0 1rem 0 1rem;
  page-break-inside: avoid;
}
.grid {
  display: grid;
  gap: 4px;
}
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f3f3;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 1.25rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.first {
  background: #ffc107;
}
.locked {
  pointer-events: none;
}
.board {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 1.75rem;
  font-weight: bold;
  color: #333;
  padding-top: 0.5rem;
  border-left: 1px solid #CC9922;
}

/* ✅ Pied de page (logo centré sous la grille) */
.mental-logo {
  width: 100%;
  text-align: center;
  margin: 1rem 0 0.5rem 0;
  padding-top: 0.25rem;
  border-top: 1px solid #ccc;
  font-size: 0.75rem;
  page-break-inside: avoid;
}
.mental-logo img {
  max-width: 40px;
  height: auto;
  opacity: 0.7;
}

/* Mobile */
@media screen and (max-width: 600px) {
  .mental-wrap {
    flex-direction: column;
    gap: 1.5rem;
  }
  .board {
    border-left: none;
    border-top: 1px solid #CC9922;
    padding-top: 1rem;
    margin-top: 1rem;
    font-size: 1.5rem;
  }
}

/* Impression */
@media print {
  body * {
    visibility: hidden;
  }
  #pdf-export-wrapper,
  #pdf-export-wrapper * {
    visibility: visible;
  }
  #pdf-export-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}

/* Mode compact pour PDF 2 grilles par page */
.pdf-export-wrapper.shrink .grid {
  width: 280px !important;
}
.pdf-export-wrapper.shrink .cell {
  font-size: 1rem !important;
}
