/* ==========================================================================
   Styles propres à la page « Le paradoxe de Monty Hall »
   Chargée après style.css, dont elle reprend les variables.
   ========================================================================== */

/* Les encres de données (bleue pour « changer », verte pour « garder »)
   sont définies dans style.css. */

/* ---------- Règles et tableau ---------- */

.regles li {
  margin-bottom: 0.4rem;
}

.tableau-defile {
  overflow-x: auto;
  margin: 1.25rem 0;
}

.tableau {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--police-ui);
  font-size: 0.95rem;
}

.tableau caption {
  text-align: left;
  margin-bottom: 0.5rem;
  color: var(--texte-doux);
}

.tableau th,
.tableau td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--filet);
}

.tableau thead th {
  border-bottom: 2px solid var(--texte-doux);
}

.gagne {
  color: var(--observe);
  font-weight: 600;
}

.perdu {
  color: var(--texte-doux);
}

/* ---------- Jeu : les portes ---------- */

.jeu__consigne {
  min-height: 3.4em;
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.portes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.6rem, 3vw, 1.5rem);
  max-width: 30rem;
  margin: 0 auto 1.5rem;
}

.porte {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  aspect-ratio: 3 / 4.4;
  padding: 0.5rem;
  font-family: var(--police-texte);
  color: var(--texte);
  background: var(--fond);
  border: 2px solid var(--texte);
  border-bottom-width: 4px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Poignée de la porte, tant qu’elle est fermée. */
.porte::after {
  content: "";
  position: absolute;
  right: 12%;
  top: 54%;
  width: 0.55rem;
  height: 0.55rem;
  border: 2px solid var(--texte);
  border-radius: 50%;
}

.porte[data-etat="ouverte"]::after,
.porte[data-etat="revelee"]::after {
  display: none;
}

.porte:hover:not(:disabled) {
  background: var(--surface);
}

.porte:disabled {
  cursor: default;
}

.porte__numero {
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
}

.porte__contenu {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  line-height: 1;
}

.porte__legende {
  font-family: var(--police-ui);
  font-size: 0.85rem;
  color: var(--texte-doux);
}

/* Mention portée par la porte que l’animateur a ouverte. */
.porte__mention {
  font-family: var(--police-ui);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  color: var(--texte-doux);
}

/* Porte choisie par le joueur : cadre à l’encre bleue. */
.porte[data-choisie="oui"] {
  border-color: var(--observe);
  box-shadow: inset 0 0 0 2px var(--observe);
}

/* Porte ouverte par l’animateur, ou révélée en fin de partie. */
.porte[data-etat="ouverte"],
.porte[data-etat="revelee"] {
  background: var(--surface);
  border-style: dashed;
}

.jeu__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.jeu__actions .bouton {
  margin-left: 0;
}

.jeu__actions .bouton[hidden] {
  display: none;
}

.bouton--discret {
  color: var(--texte);
  background: transparent;
  border: 1px solid var(--filet);
}

.resultat-gagne {
  color: var(--observe);
  font-weight: 700;
}

.resultat-perdu {
  font-weight: 700;
}

/* ---------- Simulation : barre de répartition des victoires ---------- */

.repartition__compteur {
  margin: 0 0 0.5rem;
  font-family: var(--police-ui);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--texte-doux);
}

/* La piste réserve au-dessus de la barre la place du crochet de l’intervalle. */
.repartition__piste {
  position: relative;
  padding-top: 1.4rem;
}

.repartition__barre {
  display: flex;
  height: 3.25rem;
  background: var(--fond);
  border: 1px solid var(--texte-doux);
  overflow: hidden;
}

.repartition__segment {
  height: 100%;
}

.repartition__segment--changer {
  background: var(--observe);
}

.repartition__segment--garder {
  background: var(--observe-2);
}

/* Crochet de l’intervalle à 95 %, ouvert vers la barre. */
.repartition__intervalle {
  position: absolute;
  top: 0.45rem;
  height: 0.75rem;
  min-width: 2px;
  border: 2px solid var(--theorie);
  border-bottom: 0;
}

.repartition__intervalle[hidden] {
  display: none;
}

/* Trait de la valeur théorique, détouré pour rester visible sur les deux couleurs. */
.repartition__theorie {
  position: absolute;
  top: 0;
  bottom: -0.45rem;
  width: 0;
  margin-left: -1px;
  border-left: 2px solid var(--theorie);
  box-shadow: 1px 0 0 var(--fond), -1px 0 0 var(--fond);
}

/* Courbe d’évolution placée sous la barre. */
.figure--evolution {
  margin-top: 1.75rem;
}

.repartition__legendes {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  margin: 0.75rem 0 0;
  font-family: var(--police-ui);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 34rem) {
  .jeu__actions .bouton {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .porte {
    transition: none;
  }
}
