* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  min-height: 100vh;
  background: linear-gradient(160deg, #14532d 0%, #16a34a 60%, #4ade80 100%);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}

/* --- Écrans --- */
.ecran { display: none; width: 100%; max-width: 440px; flex-direction: column; align-items: center; }
.ecran.actif { display: flex; }

/* --- Accueil --- */
.logo { font-size: 5rem; margin-top: 20px; filter: drop-shadow(0 4px 3px rgba(0,0,0,0.3)); }
h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0,0,0,0.25);
  margin-bottom: 6px;
  text-align: center;
}
.sous-titre { font-size: 1.05rem; text-align: center; opacity: 0.95; margin-bottom: 26px; }

.btns-accueil { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 300px; }

/* --- Boutons --- */
button { font-family: inherit; cursor: pointer; border: none; touch-action: manipulation; }

.btn-vert, .btn-bleu {
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
  padding: 16px;
  border-radius: 999px;
}
.btn-vert { background: #22c55e; box-shadow: 0 5px 0 #15803d; }
.btn-bleu { background: #3b82f6; box-shadow: 0 5px 0 #1d4ed8; }
.btn-vert:active, .btn-bleu:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }

.record-accueil { margin-top: 22px; font-size: 1.1rem; background: rgba(0,0,0,0.2); padding: 10px 20px; border-radius: 14px; }

.credit { margin-top: 30px; text-align: center; font-size: 0.9rem; opacity: 0.9; line-height: 1.5; }
.credit-petit { font-size: 0.8rem; opacity: 0.8; }

/* --- Écran de jeu --- */
.haut { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 12px; }
.btn-retour {
  background: rgba(0,0,0,0.25); color: #fff; font-weight: 700;
  padding: 8px 16px; border-radius: 999px; font-size: 1rem;
}
.btn-retour:active { transform: translateY(2px); }
.scores { display: flex; gap: 16px; font-size: 1.3rem; }

canvas {
  width: 100%;
  max-width: 500px;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #bbf7d0;
  border: 5px solid #14532d;
  border-radius: 12px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.25);
  touch-action: none;
}

/* --- Croix de flèches (D-pad) --- */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  grid-template-rows: repeat(3, 68px);
  gap: 8px;
  margin-top: 22px;
}
.fleche {
  background: #22c55e;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 900;
  border-radius: 16px;
  box-shadow: 0 4px 0 #15803d;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fleche:active { transform: translateY(3px); box-shadow: 0 1px 0 #15803d; }
.fleche.haut   { grid-column: 2; grid-row: 1; }
.fleche.gauche { grid-column: 1; grid-row: 2; }
.fleche.droite { grid-column: 3; grid-row: 2; }
.fleche.bas    { grid-column: 2; grid-row: 3; }

.astuce { margin-top: 16px; font-size: 0.85rem; opacity: 0.85; text-align: center; }

/* --- Écran résultat --- */
.resultat-contenu {
  background: rgba(0,0,0,0.25);
  border-radius: 24px;
  padding: 34px 26px;
  text-align: center;
  margin-top: 40px;
  width: 100%;
  max-width: 360px;
}
.resultat-emoji { font-size: 4.5rem; margin-bottom: 8px; }
.resultat-contenu h2 { font-size: 1.8rem; margin-bottom: 20px; }
.resultat-stats { margin-bottom: 24px; }
.stat { font-size: 1.15rem; margin: 10px 0; }
.btns-resultat { display: flex; flex-direction: column; gap: 12px; }

/* Le clavier ne fait pas défiler la page sur mobile */
@media (min-width: 500px) {
  .astuce { font-size: 0.95rem; }
}
