* {
  box-sizing: border-box;
}

body {
  background: #1a1a1a;
  color: #f5f1e8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  margin: 0;
  padding: 12px 12px 24px;
  /* Pas de sélection de texte ni de zoom double-tap pendant qu'on joue. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

h1 {
  font-size: 1.6em;
  margin: 8px 0 12px;
  letter-spacing: 0.08em;
}

p {
  margin: 8px 0;
}

canvas {
  display: block;
  margin: 10px auto;
  /* Le doigt sert à glisser les pièces, jamais à faire défiler la page. */
  touch-action: none;
}

canvas#grille {
  /* outline (et non border) : ne décale pas les coordonnées du pointeur. */
  outline: 2px solid #33322f;
  margin: 0 auto;
}

.cache {
  display: none !important;
}

button {
  background: #f5f1e8;
  color: #1a1a1a;
  border: none;
  padding: 12px 28px;
  min-height: 44px;
  font-size: 1em;
  font-weight: bold;
  border-radius: 6px;
  margin: 8px;
  cursor: pointer;
}

button:hover {
  background: #c9a227;
}

button.secondaire {
  background: transparent;
  color: #f5f1e8;
  border: 1px solid #5a5853;
}

.champ-pseudo {
  display: block;
  margin: 8px auto 16px;
  font-size: 0.9em;
  opacity: 0.9;
}

.champ-pseudo input {
  display: block;
  margin: 6px auto 0;
  width: 220px;
  max-width: 100%;
  padding: 10px 12px;
  font-size: 1.05em; /* 16 px minimum : évite le zoom automatique sur iPhone */
  text-align: center;
  border-radius: 6px;
  border: 1px solid #5a5853;
  background: #262522;
  color: #f5f1e8;
  -webkit-user-select: text;
  user-select: text;
}

.tableau-scores {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 440px;
  margin: 6px auto 10px;
  font-size: 0.95em;
}

.tableau-scores strong {
  font-size: 1.2em;
  margin-left: 4px;
}

#partie-chrono {
  font-variant-numeric: tabular-nums;
  font-size: 1.4em;
}

.zone-grille {
  position: relative;
  display: inline-block;
}

#partie-decompte {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5em;
  font-weight: bold;
  color: #1a1a1a;
  background: rgba(245, 241, 232, 0.6);
}

#ecran-partie.frenesie #partie-chrono {
  color: #e6572c;
  animation: pulse 0.6s ease-in-out infinite;
}

#ecran-partie.frenesie canvas#grille {
  outline-color: #e6572c;
  box-shadow: 0 0 24px 4px rgba(230, 87, 44, 0.5);
  transition: box-shadow 0.3s ease, outline-color 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Grille du jour (v0.2) ------------------------------------------------ */

section {
  max-width: 440px;
  margin: 0 auto;
}

h2 {
  font-size: 1.3em;
  margin: 8px 0;
}

.discret {
  opacity: 0.7;
  font-size: 0.9em;
}

.carte {
  background: #262522;
  border: 1px solid #3a3935;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
}

.carte-defi {
  border-color: #c9a227;
  background: rgba(201, 162, 39, 0.12);
}

button.principal {
  background: #c9a227;
  color: #1a1a1a;
  width: 100%;
  max-width: 320px;
  font-size: 1.1em;
}

button.principal:hover {
  background: #e0b838;
}

button.secondaire:hover {
  background: #33322f;
}

.statistiques {
  display: flex;
  justify-content: space-around;
  margin: 16px 0;
}

.statistiques div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.statistiques strong {
  font-size: 1.6em;
}

.statistiques span {
  font-size: 0.8em;
  opacity: 0.7;
}

.autres-modes {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.barre-partie {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barre-partie p {
  flex: 1;
  margin: 0;
  font-size: 0.95em;
  text-align: left;
}

button.retour {
  background: transparent;
  color: #f5f1e8;
  border: 1px solid #5a5853;
  padding: 6px 14px;
  min-height: 40px;
  margin: 0;
}

.tableau-scores > span {
  flex: 1;
}

.score-gauche {
  text-align: left;
}

.score-droite {
  text-align: right;
}

.gros-score {
  font-size: 1.3em;
  margin: 4px 0;
}

.gros-score strong {
  font-size: 2.4em;
}

.carte-partage {
  font-family: inherit;
  background: #262522;
  border-radius: 10px;
  padding: 12px;
  margin: 14px auto;
  line-height: 1.6;
  white-space: pre-wrap;
  -webkit-user-select: text;
  user-select: text;
}

/* --- KADRA (v0.3) ---------------------------------------------------------- */

.entete h1 {
  margin-bottom: 2px;
  letter-spacing: 0.18em;
}

.slogan {
  margin: 0 0 12px;
  font-size: 0.9em;
  opacity: 0.75;
}

button.lien {
  background: transparent;
  color: #f5f1e8;
  text-decoration: underline;
  font-weight: normal;
  opacity: 0.75;
  padding: 8px 12px;
}

button.lien:hover {
  background: transparent;
  opacity: 1;
}
