/* La cible : le plateau du jeu. Chaque état se lit par la forme autant que par la couleur. */

.cible-jeu {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e-4);
  width: 100%;
}

.cible-tete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e-3);
}

/* La plaque : un petit écran encastré, comme le tableau de points, où s'affiche la cible. */
.cible-plaque {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 152px;
  padding: var(--e-2) var(--e-5) var(--e-3);
  border-radius: var(--r-moyen);
  background: var(--studio-950);
  box-shadow: inset 0 0 0 1px var(--studio-800), inset 0 8px 16px -10px rgb(0 0 0 / 0.8);
  transition: box-shadow var(--d-court) ease;
}

.cible-legende {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texte-3);
}

.cible-nombre {
  display: block;
  font-size: clamp(2.75rem, 2.2rem + 3vw, 3.5rem);
  line-height: 1;
  color: var(--points);
}

/* Cible atteinte : la plaque s'allume d'un anneau de famille, le temps du retour. */
.cible-plaque.cible-atteinte {
  box-shadow: inset 0 0 0 3px var(--fam), inset 0 8px 16px -10px rgb(0 0 0 / 0.8);
}

/* L'étiquette de la règle : le signe dans un anneau, puis son nom. */
.cible-regle {
  display: inline-flex;
  align-items: center;
  gap: var(--e-2);
  min-height: 36px;
  padding: 0 var(--e-4) 0 5px;
  border-radius: var(--r-pilule);
  background: var(--surface);
  font-weight: 700;
  transition: background-color var(--d-court) ease;
}

/* La règle vient de changer (niveau du mélange) : l'étiquette se teinte pour cette cible. */
.cible-regle.cible-nouvelle {
  background: color-mix(in oklab, var(--fam) 26%, var(--surface));
}

.cible-signe {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--fam);
  color: var(--fam);
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1;
}

/* Les tuiles, sous le pouce. La grille garde des tuiles assez grandes, sans faire défiler l'écran du téléphone. */
.cible-grille {
  display: grid;
  grid-template-columns: repeat(var(--c), minmax(0, 1fr));
  gap: var(--e-2);
  width: min(100%, calc(var(--c) * 96px), max(calc(var(--c) * 60px), calc((100dvh - 430px) * var(--c) / var(--r, 3))));
  margin-top: auto;
  padding-top: 6px; /* la place des tuiles soulevées */
}

.cible-tuile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 12px;
  background: var(--fiche);
  box-shadow: var(--ombre-tuile);
  color: var(--encre);
  font-size: clamp(1.375rem, 6.4vw, 1.875rem);
  line-height: 1;
  transition: transform var(--d-appui) var(--ease-out), box-shadow var(--d-court) ease, background-color var(--d-court) ease;
}

.cible-tuile:active {
  transform: scale(0.95);
}

/* Choisie : soulevée et cerclée. */
.cible-tuile.cible-choisie {
  transform: translateY(-6px);
  box-shadow: inset 0 0 0 3px var(--fam-encre), inset 0 1px 0 rgb(255 255 255 / 0.5), 0 14px 18px -10px rgb(0 0 0 / 0.75);
}

.cible-tuile.cible-choisie:active {
  transform: translateY(-6px) scale(0.95);
}

/* Juste : la tuile reste soulevée, cerclée à l'encre de la famille, avec une coche (la plaque, elle, s'allume). */
.cible-tuile.cible-juste {
  transform: translateY(-6px);
  box-shadow: inset 0 0 0 3px var(--fam-encre), 0 14px 18px -10px rgb(0 0 0 / 0.75);
}

/* Faux : un anneau rouge, une croix et une courte secousse. */
.cible-tuile.cible-faux {
  box-shadow: inset 0 0 0 3px var(--erreur), var(--ombre-tuile);
  animation: secousse 220ms var(--ease-out);
}

/* Après deux essais : une solution encadrée d'un pointillé. */
.cible-tuile.cible-montree::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2.5px dashed var(--fam-encre);
  border-radius: 8px;
  pointer-events: none;
}

.cible-marque {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fam-encre);
  color: var(--fiche);
}

.cible-faux .cible-marque {
  background: var(--erreur);
  color: var(--studio-50);
}

.cible-marque svg {
  width: 12px;
  height: 12px;
}

/* L'aperçu de la fiche : la même scène, en petit. */
.cible-apercu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e-2);
}

.cible-apercu .cible-plaque {
  min-width: 104px;
  padding: var(--e-1) var(--e-4) 6px;
}

.cible-apercu .cible-nombre {
  font-size: 2rem;
}

.cible-apercu .cible-regle {
  min-height: 28px;
  padding-right: var(--e-3);
  font-size: var(--t-petit);
}

.cible-apercu .cible-signe {
  width: 20px;
  height: 20px;
  font-size: 0.9375rem;
}

.cible-apercu .cible-grille {
  width: 150px;
  margin-top: var(--e-1);
  padding-top: 4px;
  gap: 6px;
}

.cible-apercu .cible-tuile {
  border-radius: 9px;
  font-size: 1.125rem;
}

.cible-apercu .cible-tuile.cible-choisie {
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .cible-tuile,
  .cible-plaque,
  .cible-regle {
    transition: none;
  }

  .cible-tuile.cible-faux {
    animation: none;
  }
}
