/* =====================================================================
   Pétanque & Mistral — styles propres au jeu (préfixe pq-)
   Direction artistique : affiche de voyage ancienne, papier crème,
   encre sarcelle, tomate et ocre.
   La barre, le plein écran et les infobulles sont dans css/games.css.
   ===================================================================== */

.pq-jeu {
  --mg-jeu-largeur: 1204px;
  --pq-papier: #f7ecd2;
  --pq-papier2: #efdcb4;
  --pq-encre: #17393f;
  --pq-sarcelle: #1f6670;
  --pq-tomate: #d4502b;
  --pq-ocre: #e9a93a;
  --pq-jaune: #f2c230;
  --pq-bleu: #2f6fc0;
  --pq-titre: "Abril Fatface", Georgia, serif;
  --pq-texte: "Josefin Sans", "Outfit", sans-serif;
  --pq-main: "Caveat", cursive;

  --mgb-fond: linear-gradient(100deg, #12343b 0%, #1f6670 58%, #c8683a 118%);
  --mgb-accent: #f6c653;
  --mgb-titre: linear-gradient(100deg, #fff6df, #f6c653);
  --mgb-police-titre: "Abril Fatface", Georgia, serif;
  --mgb-doux: #bcd5cf;
  --mgc-fond: var(--pq-papier);
  --mgc-texte: var(--pq-encre);
  --mgc-bord: #d9bf8c;
  --mg-stat-largeur: 4.4em;
  --mg-fs-fond: #12343b;
  --mg-bulle-fond: #12343b;
}

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

.pq-pastille {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-right: 0.34em;
  border-radius: 50%;
  vertical-align: -0.04em;
  box-shadow: inset -1px -1px 2px rgba(0, 0, 0, 0.4), inset 1px 1px 2px rgba(255, 255, 255, 0.6);
}
.pq-c0 {
  background: var(--pq-jaune);
}
.pq-c1 {
  background: var(--pq-bleu);
}

/* ---------- Rangée des gestes ---------- */
.pq-commandes {
  --mgb-accent: #1f6670;
  min-height: 52px;
  font-family: var(--pq-texte);
  transition: opacity 0.25s;
}
.pq-gestes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pq-geste {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--pq-texte);
  font-weight: 700;
}
.pq-geste svg {
  width: 30px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
  overflow: visible;
}
.pq-geste svg path {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 3 2.4;
}
.pq-geste svg circle {
  stroke: none;
}
.pq-geste-tir[aria-pressed="true"] {
  background: var(--pq-tomate) !important;
}
.pq-consigne {
  font-family: var(--pq-texte);
  font-weight: 600;
  font-size: 0.95em;
  color: var(--pq-encre);
  text-align: right;
  line-height: 1.2;
}
.pq-consigne b {
  font-family: inherit;
  color: var(--pq-tomate);
}

/* ---------- Zone de jeu ---------- */
.pq-zone {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  margin-top: 8px;
  border-radius: 16px;
  overflow: hidden;
  background: #e8b873;
  font-family: var(--pq-texte);
  color: var(--pq-encre);
  box-shadow: 0 8px 26px rgba(20, 40, 45, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  user-select: none;
  -webkit-user-select: none;
}
.pq-jeu.mg-fs .pq-zone {
  align-self: stretch;
  width: auto;
  flex: 1;
  min-height: 0;
  margin-top: 6px;
  border-radius: 0;
}
.pq-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- Plaques des joueurs ---------- */
.pq-plaques {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100% - 24px);
}
.pq-plaque {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 13px 4px 4px;
  border-radius: 40px;
  background: var(--pq-papier);
  box-shadow: 0 3px 10px rgba(30, 30, 30, 0.28), inset 0 0 0 1px rgba(120, 90, 40, 0.28);
  opacity: 0.8;
  transform: scale(0.94);
  transform-origin: left center;
  transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
}
.pq-plaque.pq-actif {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 0 3px var(--pq-tomate), 0 5px 16px rgba(30, 30, 30, 0.35);
}
.pq-portrait {
  display: block;
  width: 42px;
  height: 42px;
  flex: none;
}
.pq-portrait svg {
  display: block;
  width: 100%;
  height: 100%;
}
.pq-plaque-txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}
.pq-plaque-txt b {
  color: var(--pq-encre);
  font-family: var(--pq-titre);
  font-weight: 400;
  font-size: 0.98em;
  white-space: nowrap;
}
.pq-restes {
  display: flex;
  gap: 4px;
  min-height: 12px;
}
.pq-restes i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0, var(--c) 34%, #1b2a33 120%);
  transition: transform 0.25s, opacity 0.25s;
}
.pq-restes i.pq-jouee {
  opacity: 0.22;
  transform: scale(0.72);
  background: #6b6253;
}

/* ---------- Bulle de parole ---------- */
.pq-parole {
  position: absolute;
  top: 70px;
  left: 16px;
  max-width: min(330px, calc(100% - 32px));
  padding: 8px 15px 9px;
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: 0 5px 16px rgba(20, 20, 20, 0.3);
  pointer-events: none;
  transform-origin: 26px -8px;
  animation: pq-parole-in 0.32s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.pq-parole::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 24px;
  border: 5px solid transparent;
  border-bottom: 9px solid #fffaf0;
  border-top: 0;
}
.pq-parole small {
  display: block;
  font-family: var(--pq-texte);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pq-tomate);
}
.pq-parole span {
  font-family: var(--pq-main);
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.05;
  color: var(--pq-encre);
}
@keyframes pq-parole-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* ---------- Retour sur le geste ---------- */
.pq-retour {
  position: absolute;
  left: 50%;
  bottom: 26px;
  padding: 5px 16px 3px;
  border-radius: 30px;
  background: rgba(23, 57, 63, 0.9);
  color: #fff6df;
  font-family: var(--pq-titre);
  font-size: 1.15em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  animation: pq-retour 1.5s ease forwards;
}
.pq-retour.pq-top {
  background: var(--pq-tomate);
}
@keyframes pq-retour {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  14%,
  70% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

/* ---------- Tampons : CARREAU !, BIBERON !… ---------- */
.pq-tampon {
  position: absolute;
  top: 38%;
  left: 50%;
  padding: 0.1em 0.45em 0;
  border: 0.09em solid currentColor;
  border-radius: 0.14em;
  color: var(--pq-tomate);
  background: rgba(255, 248, 228, 0.92);
  font-family: var(--pq-titre);
  font-size: clamp(2.6rem, 9vw, 5.6rem);
  line-height: 1.04;
  white-space: nowrap;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 0 0 0.05em rgba(255, 248, 228, 0.92), 0 18px 34px rgba(20, 20, 20, 0.34);
  animation: pq-tampon 1.8s cubic-bezier(0.2, 1.1, 0.3, 1) forwards;
}
.pq-tampon.pq-sobre {
  color: var(--pq-sarcelle);
  font-size: clamp(1.9rem, 6vw, 3.6rem);
}
.pq-tampon.pq-triste {
  color: #5c6168;
  font-size: clamp(1.9rem, 6vw, 3.6rem);
}
@keyframes pq-tampon {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.6) rotate(-16deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.96) rotate(-6deg);
  }
  22%,
  78% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-6deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.05) rotate(-6deg);
  }
}

/* ---------- Bilan de mène ---------- */
.pq-bilan {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: min(440px, calc(100% - 24px));
  box-sizing: border-box;
  padding: 12px 20px 14px;
  border-radius: 14px;
  background: var(--pq-papier);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 40%);
  box-shadow: 0 14px 34px rgba(20, 20, 20, 0.42), inset 0 0 0 2px var(--pq-papier), inset 0 0 0 3px #caa76b;
  text-align: center;
  transform: translateX(-50%);
  animation: pq-monte 0.42s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes pq-monte {
  from {
    opacity: 0;
    transform: translate(-50%, 40px);
  }
}
.pq-bilan p {
  margin: 0;
}
.pq-bilan-sur {
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pq-tomate);
}
.pq-bilan-titre {
  margin-top: 3px !important;
  font-family: var(--pq-titre);
  font-size: 1.62em;
  line-height: 1.1;
}
.pq-bilan-texte {
  margin: 4px 0 9px !important;
  font-family: var(--pq-main);
  font-size: 1.28em;
  font-weight: 700;
  line-height: 1.05;
  color: var(--pq-sarcelle);
}
.pq-bilan .mg-btn,
.pq-fin .mg-btn,
.pq-go {
  --mgb-accent: #d4502b;
  font-family: var(--pq-texte);
  font-weight: 700;
}

/* ---------- Accueil ---------- */
.pq-menu,
.pq-fin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  overflow: auto;
  background: linear-gradient(180deg, rgba(18, 52, 59, 0.34), rgba(18, 52, 59, 0.62));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.pq-affiche {
  width: min(1060px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1.2vh, 12px);
}
.pq-entete {
  text-align: center;
  color: #fff8e6;
  text-shadow: 0 2px 0 rgba(120, 55, 25, 0.75), 0 6px 22px rgba(30, 20, 10, 0.5);
}
.pq-surtitre {
  margin: 0;
  font-size: clamp(0.72rem, 1.5vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.pq-grand-titre {
  margin: 0;
  font-family: var(--pq-titre);
  font-size: clamp(2.2rem, min(7vw, 10vh), 4.9rem);
  line-height: 1.02;
}
.pq-grand-titre em {
  font-style: italic;
  color: var(--pq-ocre);
}
.pq-onglets {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 30px;
  background: rgba(18, 52, 59, 0.72);
}
.pq-onglet {
  padding: 8px 20px 5px;
  border: 0;
  border-radius: 30px;
  background: none;
  color: #e9ddc2;
  font-family: var(--pq-texte);
  font-weight: 700;
  font-size: 0.96em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.pq-onglet:hover {
  color: #fff;
}
.pq-onglet[aria-selected="true"] {
  background: var(--pq-papier);
  color: var(--pq-encre);
}
.pq-cartes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 12px);
  width: 100%;
}
.pq-carte {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 5px 5px 8px;
  border: 0;
  border-radius: 7px;
  background: var(--pq-papier);
  color: var(--pq-encre);
  font-family: var(--pq-texte);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(20, 20, 20, 0.38);
  transition: transform 0.2s cubic-bezier(0.2, 1.4, 0.4, 1), box-shadow 0.2s;
}
.pq-carte:nth-child(odd) {
  transform: rotate(-0.8deg);
}
.pq-carte:nth-child(even) {
  transform: rotate(0.7deg);
}
.pq-carte:hover:not(:disabled),
.pq-carte:focus-visible {
  transform: translateY(-6px) rotate(0deg) scale(1.03);
  box-shadow: 0 16px 30px rgba(20, 20, 20, 0.48);
  z-index: 1;
}
.pq-carte:focus-visible {
  outline: 3px solid var(--pq-tomate);
}
.pq-carte:disabled {
  cursor: default;
}
.pq-carte-img {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
}
.pq-carte-img > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.pq-carte:disabled .pq-carte-img > svg {
  filter: grayscale(0.5) brightness(0.92);
}
.pq-carte-por {
  position: absolute;
  right: 7px;
  top: calc((100% - 16px) * 0.1);
  width: 38%;
  max-width: 62px;
}
.pq-carte-por svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(20, 20, 20, 0.45));
}
.pq-carte-num {
  position: absolute;
  top: 9px;
  left: 9px;
  min-width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--pq-tomate);
  color: #fff8e6;
  font-family: var(--pq-titre);
  font-size: 0.92em;
  line-height: 27px;
}
.pq-carte-etat {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #2d7f5e;
  color: #fff;
  font-weight: 700;
  line-height: 27px;
}
.pq-carte:disabled .pq-carte-num {
  background: #6d6a62;
}
.pq-carte-nom {
  margin-top: 6px;
  font-family: var(--pq-titre);
  font-size: clamp(0.82rem, 1.45vw, 1.06rem);
  line-height: 1.06;
}
.pq-carte-adv {
  margin-top: 3px;
  font-size: clamp(0.68rem, 1.05vw, 0.82rem);
  font-weight: 600;
  line-height: 1.12;
  color: var(--pq-sarcelle);
}
.pq-carte-trait {
  margin-top: 2px;
  font-family: var(--pq-main);
  font-size: clamp(0.84rem, 1.35vw, 1.05rem);
  font-weight: 700;
  line-height: 1;
  color: var(--pq-tomate);
}
.pq-libre {
  box-sizing: border-box;
  width: min(760px, 100%);
  padding: 13px 18px 15px;
  border-radius: 12px;
  background: var(--pq-papier);
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.4);
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: stretch;
}
.pq-ligne {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pq-ligne-lib {
  flex: 0 0 58px;
  padding-top: 7px;
  font-family: var(--pq-titre);
}
.pq-puces {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pq-puce {
  padding: 6px 11px 3px;
  border: 1px solid #cfb27a;
  border-radius: 20px;
  background: #fffaf0;
  color: var(--pq-encre);
  font-family: var(--pq-texte);
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pq-puce:hover {
  background: var(--pq-papier2);
}
.pq-puce[aria-pressed="true"] {
  background: var(--pq-sarcelle);
  border-color: var(--pq-sarcelle);
  color: #fff;
}
.pq-go {
  align-self: center;
  margin-top: 2px;
  padding-left: 30px;
  padding-right: 30px;
}

/* ---------- Fin de match ---------- */
.pq-fin {
  background: rgba(18, 52, 59, 0.42);
}
.pq-fin-carte {
  box-sizing: border-box;
  width: min(490px, 100%);
  padding: 14px 24px 18px;
  border-radius: 12px;
  background: var(--pq-papier);
  box-shadow: 0 22px 50px rgba(10, 20, 25, 0.5), inset 0 0 0 3px var(--pq-papier), inset 0 0 0 4px #caa76b;
  text-align: center;
  animation: pq-carte-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes pq-carte-in {
  from {
    opacity: 0;
    transform: translateY(26px) rotate(-3deg) scale(0.9);
  }
}
.pq-fin-carte p {
  margin: 0;
}
.pq-fin-tableau {
  margin: 0 auto 6px;
}
.pq-fin-tableau .pq-portrait {
  width: 84px;
  height: 84px;
  margin: 0 auto;
}
.pq-fin-sur {
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--pq-tomate);
}
.pq-fin-titre {
  font-family: var(--pq-titre);
  font-size: clamp(1.7rem, 4.6vw, 2.5rem);
  line-height: 1.05;
}
.pq-fin-score {
  margin-top: 3px !important;
  font-family: var(--pq-titre);
  font-size: 1.28em;
  color: var(--pq-sarcelle);
}
.pq-fin-texte {
  margin: 4px 0 11px !important;
  font-family: var(--pq-main);
  font-size: 1.36em;
  font-weight: 700;
  line-height: 1.05;
}
.pq-fin-boutons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* La Fanny : un tableau, et un rideau tiré par pudeur */
.pq-fanny {
  position: relative;
  width: 118px;
  height: 92px;
  margin: 0 auto;
  border: 7px solid #8c5a2a;
  border-radius: 3px;
  background: #f0d7b0;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(20, 20, 20, 0.35), inset 0 0 0 1px #5a3715;
}
.pq-fanny::before,
.pq-fanny::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 51%;
  background: repeating-linear-gradient(90deg, #a92a22 0 8px, #d0453a 8px 12px, #8c1f1a 12px 15px);
}
.pq-fanny::before {
  left: 0;
}
.pq-fanny::after {
  right: 0;
}
.pq-fanny b {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  padding: 1px 6px 0;
  border-radius: 3px;
  background: #e9c867;
  color: #4b2b0d;
  font-family: var(--pq-titre);
  font-weight: 400;
  font-size: 0.8em;
  transform: translate(-50%, -50%) rotate(-5deg);
}

/* ---------- Petits écrans ---------- */
@media (max-width: 760px) {
  .pq-commandes {
    justify-content: center;
  }
  .pq-consigne {
    flex-basis: 100%;
    text-align: center;
    font-size: 0.86em;
  }
  .pq-geste {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 0.82em;
  }
  .pq-geste svg {
    display: none;
  }
  .pq-menu {
    align-items: flex-start;
  }
  .pq-cartes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pq-carte:last-child {
    grid-column: 1 / -1;
  }
  .pq-carte:last-child .pq-carte-img {
    aspect-ratio: 8 / 3;
  }
  .pq-portrait {
    width: 32px;
    height: 32px;
  }
  .pq-plaque-txt b {
    font-size: 0.82em;
  }
  .pq-parole {
    top: 58px;
  }
}
