/* ---------- Ambiance générale ---------- */
body.jeu {
  min-height: 100vh;
  color: #f4f1e8;
  background:
    radial-gradient(ellipse at 50% -10%, #3f7a52 0%, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.05) 0 3px, transparent 4px) 0 0 / 46px 46px,
    radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.04) 0 2px, transparent 3px) 0 0 / 61px 61px,
    linear-gradient(180deg, #16301f 0%, #0d1f15 100%);
  background-attachment: fixed;
}

[hidden] {
  display: none !important;
}

/* ---------- Haut de page ---------- */
.haut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem 0.4rem;
}

.haut__titre {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.haut__reglages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.haut select {
  margin-left: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: inherit;
  font-size: 0.95rem;
}

.lien {
  color: #f1dc8a;
  font-size: 0.9rem;
}

/* ---------- Boutons ---------- */
.bouton {
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: #f1dc8a;
  color: #2b2a14;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #b79b3a, 0 6px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
}

.bouton:hover:not(:disabled) {
  transform: translateY(-2px);
}

.bouton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bouton--discret {
  background: rgba(255, 255, 255, 0.12);
  color: #f4f1e8;
  box-shadow: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.bouton--principal {
  background: #8fd18a;
  box-shadow: 0 3px 0 #4d8f49, 0 6px 14px rgba(0, 0, 0, 0.35);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ---------- Bandeau : atout, score, piles ---------- */
.bandeau {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.4rem 1.25rem;
}

.atout {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 1.2rem 0.5rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--couleur, #fff);
  box-shadow: 0 0 22px color-mix(in srgb, var(--couleur, #fff) 55%, transparent);
}

.atout__icone {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--couleur, #fff);
  font-size: 1.7rem;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.atout__textes {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.atout__textes small {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  opacity: 0.75;
}

.atout__textes strong {
  font-size: 1.2rem;
}

.atout__textes em {
  font-size: 0.75rem;
  opacity: 0.8;
}

.score {
  text-align: center;
}

.score__ligne {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.score__pli {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.pips {
  display: inline-flex;
  gap: 0.25rem;
}

.pip {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  transition: background 0.3s, transform 0.3s;
}

.pip--plein {
  background: #f1dc8a;
  border-color: #f1dc8a;
  transform: scale(1.15);
  box-shadow: 0 0 8px #f1dc8a;
}

.piles {
  display: flex;
  gap: 1.2rem;
}

.pile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.pile i {
  display: block;
  width: 1.9rem;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, #2f5d43, #2f5d43 4px, #3f7355 4px, #3f7355 8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 2px 2px 0 #1c3b2a, 4px 4px 0 #2f5d43, 6px 6px 0 #1c3b2a;
}

.pile--defausse i {
  opacity: 0.55;
  filter: grayscale(0.5);
}

/* ---------- Plateau ---------- */
.plateau {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.camp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.camp--ordi {
  flex-direction: column;
}

.etiquette {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-weight: 700;
  transition: background 0.3s, box-shadow 0.3s;
}

.etiquette.actif {
  background: #f1dc8a;
  color: #2b2a14;
  box-shadow: 0 0 18px rgba(241, 220, 138, 0.8);
}

.etiquette.actif .pip {
  border-color: #2b2a14;
}

.etiquette.actif .pip--plein {
  background: #2b2a14;
  box-shadow: none;
}

.message {
  min-height: 2.6rem;
  margin: 0;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.message--maj {
  animation: apparition 0.35s ease-out;
}

/* ---------- Main de l'ordinateur ---------- */
.rangee {
  display: flex;
  justify-content: center;
  min-height: 5rem;
}

.dos {
  position: relative;
  width: clamp(54px, 6vw, 72px);
  aspect-ratio: 2 / 3;
  margin-left: -1.1rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18) 0 28%, transparent 30%),
    repeating-linear-gradient(45deg, #2f5d43, #2f5d43 6px, #3f7355 6px, #3f7355 12px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 120%;
}

.dos::after {
  content: "🦋";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}

.dos:first-child {
  margin-left: 0;
}

.dos:nth-child(1) { transform: rotate(8deg); }
.dos:nth-child(2) { transform: rotate(4deg); }
.dos:nth-child(3) { transform: rotate(0deg); }
.dos:nth-child(4) { transform: rotate(-4deg); }
.dos:nth-child(5) { transform: rotate(-8deg); }

.dos--cible {
  cursor: pointer;
  border-color: #f1dc8a;
  animation: pulse 1s ease-in-out infinite;
}

.dos--cible:hover {
  transform: translateY(14px) scale(1.12);
  z-index: 5;
}

/* ---------- Tapis de jeu ---------- */
.tapis {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.4rem 2.6rem;
  border-radius: 90px;
  border: 10px solid #6b4a2b;
  background:
    radial-gradient(ellipse at 50% 40%, #3c8057 0%, #25573a 70%);
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.55),
    0 0 0 3px #3b2814,
    0 18px 40px rgba(0, 0, 0, 0.55);
}

.tapis__plis {
  display: flex;
  gap: clamp(1rem, 4vw, 3rem);
}

.tapis__duel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.6rem;
  border-top: 2px dashed rgba(241, 220, 138, 0.6);
}

.tapis__duel-titre {
  font-weight: 700;
  color: #f1dc8a;
  letter-spacing: 0.05em;
}

.emplacement {
  width: clamp(104px, 12vw, 160px);
  aspect-ratio: 2 / 3;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.12);
}

.emplacement .carte {
  width: 100%;
  transition: transform 0.4s, opacity 0.4s, filter 0.4s, box-shadow 0.4s;
}

#table-ordi .carte--arrive,
#duel-ordi .carte--arrive {
  animation: poser-haut 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

#table-joueur .carte--arrive,
#duel-joueur .carte--arrive {
  animation: poser-bas 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.carte--gagnante {
  transform: scale(1.07);
  filter: drop-shadow(0 0 16px #f1dc8a);
}

.carte--perdante {
  opacity: 0.5;
  filter: grayscale(0.7);
  transform: scale(0.94);
}

.carte--egalite {
  animation: egalite 0.9s ease-in-out infinite;
}

/* ---------- Main du joueur : éventail ---------- */
.rangee--joueur {
  padding: 1.4rem 0 0.4rem;
}

.rangee--joueur .carte {
  width: clamp(96px, 11.5vw, 150px);
  margin-left: -1.4rem;
  transform-origin: 50% 130%;
  transition: transform 0.18s, filter 0.18s;
}

.rangee--joueur .carte:first-child {
  margin-left: 0;
}

.rangee--joueur .carte:nth-child(1) { transform: rotate(-8deg) translateY(7px); }
.rangee--joueur .carte:nth-child(2) { transform: rotate(-4deg) translateY(2px); }
.rangee--joueur .carte:nth-child(3) { transform: rotate(0deg); }
.rangee--joueur .carte:nth-child(4) { transform: rotate(4deg) translateY(2px); }
.rangee--joueur .carte:nth-child(5) { transform: rotate(8deg) translateY(7px); }

.rangee--joueur .carte--jouable,
.rangee--joueur .carte--echange {
  cursor: pointer;
}

.rangee--joueur .carte--jouable:hover,
.rangee--joueur .carte--echange:hover {
  transform: translateY(-26px) rotate(0deg) scale(1.1);
  z-index: 10;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.5));
}

.rangee--joueur .carte:not(.carte--jouable):not(.carte--echange) {
  filter: brightness(0.8);
}

.carte--echange .carte__face {
  outline: 3px dashed #ff8a7a;
  outline-offset: -3px;
}

/* Les cartes d'atout brillent et portent une étoile */
.carte--atout .carte__face {
  box-shadow: 0 0 0 0.9cqw #f1dc8a, 0 0 7cqw 1cqw rgba(241, 220, 138, 0.75);
}

.carte--atout::after {
  content: "★";
  position: absolute;
  left: 50%;
  top: 3.2%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 12cqw;
  height: 12cqw;
  margin-left: -6cqw;
  border-radius: 50%;
  background: #f1dc8a;
  color: #7a5a00;
  font-size: 8cqw;
  box-shadow: 0 0 2cqw rgba(0, 0, 0, 0.35);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.4rem;
}

/* ---------- Animations ---------- */
@keyframes poser-haut {
  from { transform: translateY(-140px) rotate(-12deg) scale(0.8); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes poser-bas {
  from { transform: translateY(190px) rotate(10deg) scale(0.8); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes apparition {
  from { transform: scale(0.92); opacity: 0.2; }
  to   { transform: none; opacity: 1; }
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(241, 220, 138, 0)); }
  50%      { filter: drop-shadow(0 0 12px rgba(241, 220, 138, 0.95)); }
}

@keyframes egalite {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 138, 100, 0)); }
  50%      { filter: drop-shadow(0 0 16px rgba(255, 138, 100, 1)); }
}

@media (max-width: 700px) {
  .tapis {
    padding: 1rem 1.2rem;
    border-radius: 50px;
    border-width: 7px;
  }
  .rangee--joueur .carte {
    margin-left: -2.4rem;
  }
}

/* Le texte des cartes reste foncé même sur le fond sombre de la page de jeu */
.carte {
  color: #2b3a2f;
}

/* ---------- Zoom au survol ---------- */
.emplacement .carte:hover {
  transform: scale(1.3);
  z-index: 30;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.55));
}

.rangee--joueur .carte:hover,
.rangee--joueur .carte--jouable:hover,
.rangee--joueur .carte--echange:hover,
.rangee--joueur .carte:not(.carte--jouable):not(.carte--echange):hover {
  transform: translateY(-34px) rotate(0deg) scale(1.22);
  z-index: 10;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.55));
}
