/* =====================================================================
   Pochette mystère — styles propres au jeu (préfixe pm-)
   La barre, le plein écran et les infobulles sont dans css/games.css.
   ===================================================================== */

/* Barre commune aux couleurs du jeu : bac de disquaire, noir et bordeaux, étiquette dorée */
.pm-jeu {
  --mg-jeu-largeur: 1204px; /* barre de 1180 px + marges de 12 px : ne pas changer */
  --mgb-fond: linear-gradient(120deg, #17141a, #6b1d2c);
  --mgb-accent: #e8a33c;
  --mgb-titre: linear-gradient(100deg, #ffffff, #f3c46b);
  --mg-stat-largeur: 4.2em;
  --mg-fs-fond: #1c181d;
  --mg-bulle-fond: #2a1a20;

  --pm-fond: #1f1b21;
  --pm-carte: #2b252c;
  --pm-bord: #40373f;
  --pm-texte: #f3ece6;
  --pm-doux: #b5a9ad;
  --pm-or: #e8a33c;
  --pm-vert: #4fbf7a;
  --pm-rouge: #e0565b;
}

.pm-jeu [hidden] {
  display: none !important;
}

.pm-source {
  font-size: 0.88em;
  color: var(--mgc-texte);
  opacity: 0.8;
}

.pm-source a {
  color: inherit;
  font-weight: 600;
}

/* Zone de jeu : même largeur que la barre (css/games.css), hauteur posée par game.js (ajuster) */
.pm-zone {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 22px 26px;
  background:
    radial-gradient(circle at 30% 50%, rgba(232, 163, 60, 0.1), transparent 55%),
    var(--pm-fond);
  color: var(--pm-texte);
}

/* Plein écran : la zone prend toute la place sous la barre */
.pm-jeu.mg-fs .pm-zone {
  align-self: stretch;
  width: auto;
  flex: 1;
  min-height: 0;
}

/* ---------- Pochette (canvas carré) et vinyle qui en sort ---------- */
.pm-scene {
  flex: 1.25;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-pochette {
  position: relative;
  /* taille posée par game.js */
}

.pm-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: #111;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.pm-vinyle {
  position: absolute;
  top: 3%;
  left: 3%;
  width: 94%;
  height: 94%;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--pm-or) 0 15%, #2a2a2a 15.5% 16.5%, transparent 17%),
    repeating-radial-gradient(circle, #121212 0 2px, #1d1d1d 2px 3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  /* Sortie du disque selon le palier de netteté (game.js) */
  transform: translateX(var(--pm-sortie, 3%)) rotate(var(--pm-rotation, 0deg));
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pm-vinyle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3%;
  height: 3%;
  border-radius: 50%;
  background: var(--pm-fond);
  transform: translate(-50%, -50%);
}

/* Le disque sort de la pochette une fois la réponse donnée */
.pm-pochette.revele .pm-vinyle {
  transform: translateX(32%) rotate(200deg);
}

.pm-attente {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-attente span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--pm-or);
  animation: pm-tourne 0.8s linear infinite;
}

/* Décompte avant l'apparition de la pochette */
.pm-decompte {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pm-or);
  font-size: 7em;
  font-weight: 800;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.pm-decompte.pulse {
  animation: pm-pulse 1s ease-out;
}

@keyframes pm-pulse {
  from {
    transform: scale(1.5);
    opacity: 0;
  }
  25% {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.85);
    opacity: 0.6;
  }
}

@keyframes pm-tourne {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Panneau : netteté, réponses, verdict ---------- */
.pm-panneau {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.pm-nettete-tete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  color: var(--pm-doux);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pm-nettete-tete b {
  color: var(--pm-or);
  font-size: 1.35em;
  letter-spacing: 0;
  text-transform: none;
}

.pm-crans {
  display: flex;
  gap: 6px;
}

.pm-crans i {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--pm-or);
  transition: background 0.3s;
}

.pm-crans i.passe {
  background: var(--pm-bord);
}

.pm-chrono {
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--pm-bord);
  overflow: hidden;
}

.pm-chrono div {
  height: 100%;
  width: 0;
  background: var(--pm-doux);
}

.pm-reponses {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pm-rep {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 2px solid var(--pm-bord);
  border-radius: 12px;
  background: var(--pm-carte);
  color: var(--pm-texte);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    transform 0.1s;
}

.pm-rep:hover:not(:disabled) {
  border-color: var(--pm-or);
}

.pm-rep:active:not(:disabled) {
  transform: scale(0.98);
}

.pm-rep:disabled {
  cursor: default;
}

.pm-rep-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pm-bord);
  font-weight: 700;
}

.pm-rep-texte {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pm-rep-texte b,
.pm-rep-texte span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-rep-texte b {
  color: var(--pm-texte);
}

.pm-rep-texte span {
  color: var(--pm-doux);
  font-size: 0.9em;
}

.pm-rep.bonne {
  border-color: var(--pm-vert);
  background: color-mix(in srgb, var(--pm-vert) 18%, var(--pm-carte));
}

.pm-rep.bonne .pm-rep-num {
  background: var(--pm-vert);
}

.pm-rep.fausse {
  border-color: var(--pm-rouge);
  background: color-mix(in srgb, var(--pm-rouge) 18%, var(--pm-carte));
}

.pm-rep.fausse .pm-rep-num {
  background: var(--pm-rouge);
}

.pm-rep.attente {
  opacity: 0.6;
}

.pm-rep.eteinte {
  opacity: 0.45;
}

.pm-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 116px;
}

.pm-verdict p {
  margin: 0 0 4px;
}

.pm-verdict-titre {
  font-size: 1.2em;
  font-weight: 700;
}

.pm-verdict-titre.gagne {
  color: var(--pm-vert);
}

.pm-verdict-titre.perdu {
  color: var(--pm-rouge);
}

.pm-verdict-infos {
  color: var(--pm-doux);
}

.pm-consigne {
  margin: 0;
  color: var(--pm-rouge);
  font-weight: 600;
}

.pm-boutons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pm-boutons a.mg-btn {
  text-decoration: none;
}

/* ---------- Règles : pochette d'exemple à chaque palier ---------- */
.pm-exemple {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 4px 0 8px;
}

.pm-exemple[hidden] {
  display: none;
}

.pm-exemple figure {
  margin: 0;
  text-align: center;
}

.pm-exemple canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  background: #111;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.pm-exemple figcaption {
  margin-top: 6px;
  font-size: 0.85em;
  font-weight: 600;
}

.pm-exemple figure:last-child figcaption {
  color: #2f9e5f;
}

@media (max-width: 600px) {
  .pm-exemple {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Fin de partie / erreur : voile dans la zone (sous la barre) ---------- */
.pm-fin {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 13, 17, 0.82);
  backdrop-filter: blur(3px);
}

.pm-fin-boite {
  box-sizing: border-box;
  width: min(760px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px 26px;
  border-radius: 16px;
  background: var(--pm-carte);
  border: 1px solid var(--pm-bord);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.pm-fin-boite h2 {
  margin: 0 0 6px;
  color: var(--pm-texte);
}

.pm-fin-score {
  margin: 0 0 14px;
  color: var(--pm-doux);
}

.pm-fin-score b {
  color: var(--pm-or);
  font-size: 1.6em;
}

.pm-fin-liste {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.pm-fin-liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pm-fin-liste a {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 3px;
  background: #111 center / cover no-repeat;
}

.pm-fin-liste .pm-fin-texte {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.88em;
}

.pm-fin-texte b,
.pm-fin-texte span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-fin-texte b {
  color: var(--pm-texte);
}

.pm-fin-texte span {
  color: var(--pm-doux);
}

.pm-fin-pts {
  flex: none;
  min-width: 2.2em;
  padding: 2px 6px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85em;
  background: color-mix(in srgb, var(--pm-vert) 25%, transparent);
  color: var(--pm-vert);
}

.pm-fin-pts.zero {
  background: color-mix(in srgb, var(--pm-rouge) 25%, transparent);
  color: var(--pm-rouge);
}

/* ---------- Écrans étroits : pochette au-dessus, réponses dessous ---------- */
@media (max-width: 760px) {
  .pm-zone {
    flex-direction: column;
    gap: 16px;
    padding: 14px;
  }

  .pm-panneau {
    justify-content: flex-start;
  }

  .pm-fin-liste {
    grid-template-columns: 1fr;
  }

  .pm-source {
    display: none;
  }
}
