/* ==========================================================================
   Briques communes des jeux (08/11/2026) : chargée par chaque page de jeu, après site.css et avant la feuille du jeu.
   Seulement les jetons de site.css (fond, surface, filet, encre, accent) : elle suit les quatre thèmes du pupitre, en
   clair comme en sombre. Cibles de 2,75 rem (44 px) au moins, focus de 3 px, aucune animation si le mouvement est réduit.
   ========================================================================== */
.jx {
  --jx-cible: 2.75rem;
  --jx-rayon: 10px;
}

.jx-jeu {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.jx :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.jx h2,
.jx h3 {
  scroll-margin-top: 1rem;
}

.jx h2 {
  margin-top: 0;
}

.jx-sans-script {
  max-width: var(--mesure);
  padding: 1rem 1.25rem;
  border: 2px dashed var(--encre-3);
  border-radius: var(--jx-rayon);
}

/* ---------- Boutons ---------- */
.jx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.jx .jx-bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--jx-cible);
  padding: 0.5rem 1.2rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--fond);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.jx .jx-bouton:hover {
  border-color: var(--accent-fort);
  background: var(--accent-fort);
}

.jx .jx-bouton--second {
  background: transparent;
  color: var(--accent-fort);
}

.jx .jx-bouton--second:hover {
  background: var(--surface);
  color: var(--encre);
}

/* inactif, mais lisible et annoncé comme tel (attribut aria-disabled) : pointillé, sans fond */
.jx .jx-bouton[aria-disabled="true"],
.jx .jx-bouton[aria-disabled="true"]:hover {
  border: 2px dashed var(--encre-3);
  background: transparent;
  color: var(--encre-2);
  cursor: not-allowed;
}

/* ---------- Messages, aide, avertissement ---------- */
.jx-message {
  max-width: var(--mesure);
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  color: var(--encre);
}

.jx-discret {
  color: var(--encre-2);
  font-size: 0.9375rem;
}

.jx-aide {
  max-width: var(--mesure);
  justify-self: end;
}

.jx-aide summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--jx-cible);
  padding: 0.4rem 1rem;
  border: 2px solid var(--filet);
  border-radius: 999px;
  color: var(--accent-fort);
  font-weight: 600;
  cursor: pointer;
}

.jx-aide[open] summary {
  border-color: var(--accent);
}

.jx-aide p {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--jx-rayon);
  background: var(--surface);
  color: var(--encre);
}

.jx-avertissement {
  max-width: var(--mesure);
}

.jx-trois li {
  margin-bottom: 0.4rem;
}

.jx-confirmation {
  margin: 1rem 0 0;
  font-weight: 600;
}

/* ---------- Jauges : le nom, la barre, le nombre et le mot ---------- */
.jx-jauge {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(4rem, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.jx-jauge-nom {
  font-weight: 600;
}

.jx-jauge-val {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

.jx-jauge-mot {
  color: var(--encre-2);
  font-size: 0.9375rem;
}

.jx-jauge-barre {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.75rem;
  border: 1px solid var(--encre-3);
  border-radius: 999px;
  background: var(--surface);
}

.jx-jauge-barre::-webkit-meter-bar {
  height: 100%;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.jx-jauge-barre::-webkit-meter-optimum-value,
.jx-jauge-barre::-webkit-meter-suboptimum-value,
.jx-jauge-barre::-webkit-meter-even-less-good-value {
  border-radius: 999px;
  background: var(--accent);
}

.jx-jauge-barre::-moz-meter-bar {
  border-radius: 999px;
  background: var(--accent);
}

/* ---------- Paliers, bilan, partage ---------- */
.jx-paliers,
.jx-bilan-choix {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.jx-palier,
.jx-bilan-choix > li,
.jx-partage {
  max-width: var(--mesure);
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--filet);
  border-radius: var(--jx-rayon);
  background: var(--surface);
}

.jx-palier p,
.jx-bilan-choix p {
  margin: 0.35rem 0 0;
}

.jx-palier-tete {
  color: var(--encre-2);
}

.jx-palier--ouvert {
  border-left: 4px solid var(--accent);
}

.jx-palier--ouvert .jx-palier-tete {
  color: var(--encre);
}

.jx-bilan-choix h4 {
  margin: 0;
}

.jx-bilan-votre {
  font-weight: 600;
}

.jx-partage {
  margin: 1rem 0;
}

.jx-partage h3 {
  margin-top: 0;
}

.jx-resume code {
  display: block;
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--encre-3);
  border-radius: 6px;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--f-mono);
  overflow-wrap: anywhere;
  user-select: all;
}

.jx-accord {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 600;
}

.jx-accord input {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.1rem 0 0;
  accent-color: var(--accent);
}

.jx-effacer {
  margin-top: 1.5rem;
}

/* ---------- Ce que le joueur emporte, la ligne de confiance, le lien discret (08/11/2026) ---------- */
.jx-emporter {
  margin: 1.25rem 0;
}

.jx-emporter .jx-actions {
  margin: 0 0 0.5rem;
}

.jx-confiance {
  max-width: var(--mesure);
}

/* un bouton qui ouvre un panneau, discret comme un lien : souligné, à la couleur de l'accent, cible de 44 px */
.jx .jx-lien {
  display: inline-flex;
  align-items: center;
  min-height: var(--jx-cible);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-fort);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.jx .jx-lien:hover {
  color: var(--encre);
}

/* La copie de la cible posée par emporter() pendant l'impression : cachée à l'écran ; à l'impression, elle seule
   reste (le reste de la page n'est pas imprimé). Couleurs du système (Canvas, CanvasText) : du noir sur du blanc. */
.jx-feuille {
  display: none;
}

@media print {
  html.jx-impression body > :not(.jx-feuille) {
    display: none;
  }

  html.jx-impression .jx-feuille {
    display: block;
    max-width: none;
    padding: 0;
    background: Canvas;
    color: CanvasText;
    font-size: 11pt;
    line-height: 1.45;
  }

  html.jx-impression .jx-feuille * {
    background: transparent;
    color: CanvasText;
  }
}

/* ---------- L'apparition d'un élément : 200 ms, seulement si le mouvement n'est pas réduit ---------- */
@media (prefers-reduced-motion: no-preference) {
  .jx-apparait {
    animation: jx-apparition 200ms ease-out both;
  }

  @keyframes jx-apparition {
    from {
      opacity: 0;
      transform: translateY(0.5rem);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .jx-apparait {
    animation: none;
  }
}

/* ---------- Téléphone : ce qui ne passe pas, on ne le met pas ---------- */
@media (max-width: 48em) {
  .jx-jauge {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
  }

  .jx-jauge-barre {
    display: none;
  }

  .jx-aide {
    justify-self: stretch;
  }

  .jx-actions .jx-bouton {
    flex: 1 1 100%;
  }
}
