/* =====================================================================
   Suites & Séries — styles propres au jeu (préfixe sx-)
   La barre, le plein écran et les infobulles sont dans css/games.css.
   ===================================================================== */

/* Barre commune aux couleurs du jeu : velours bordeaux et or */
.sx-jeu {
  --mg-jeu-largeur: 1204px; /* barre de 1180 px + marges de 12 px : ne pas changer */
  --mgb-fond:
    radial-gradient(
      120% 180% at 0% 0%,
      rgba(232, 190, 110, 0.22),
      transparent 55%
    ),
    linear-gradient(120deg, #3a0d1c, #6b1a33);
  --mgb-accent: #f0c977;
  --mgb-titre: linear-gradient(100deg, #fff1d6, #f0c977 55%, #d39a3e);
  --mgb-police-titre: "Playfair Display", serif;
  --mgb-doux: #dcb2bf;
  --mg-fs-fond: #22060f;
  --mg-bulle-fond: #3a0d1c;
  --sx-l: 54px; /* largeur d'une carte, posée par game.js */
  --sx-h: calc(var(--sx-l) * 1.4);
  --sx-or: #f0c977;
  --sx-pique: #1d1d2b;
  --sx-coeur: #c8102e;
  --sx-carreau: #1f6fd1;
  --sx-trefle: #1c8a4c;
}

.sx-jeu .mg-barre-titre {
  font-weight: 900;
}

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

/* ---------- Le salon ---------- */
.sx-zone {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(
      80% 60% at 50% 35%,
      rgba(255, 255, 255, 0.07),
      transparent 70%
    ),
    radial-gradient(120% 100% at 50% 40%, #7a1f3b 0%, #5a1329 55%, #380a19 100%);
  box-shadow:
    inset 0 0 0 2px rgba(240, 201, 119, 0.35),
    inset 0 20px 60px rgba(0, 0, 0, 0.35),
    0 18px 40px -18px rgba(34, 6, 15, 0.8);
  color: #f6e9ec;
  font-family: "Outfit", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Velours : un léger motif damassé */
.sx-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(
      circle at 25% 25%,
      rgba(240, 201, 119, 0.05) 0 6px,
      transparent 7px
    ),
    radial-gradient(
      circle at 75% 75%,
      rgba(240, 201, 119, 0.05) 0 6px,
      transparent 7px
    );
  background-size: 46px 46px;
}

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

/* ---------- Adversaires et pioche ---------- */
.sx-haut {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sx-adversaires {
  flex: 1;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.sx-adv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(240, 201, 119, 0.2);
  transition:
    box-shadow 0.2s,
    background 0.2s;
}

.sx-adv.actif {
  background: rgba(240, 201, 119, 0.14);
  box-shadow:
    inset 0 0 0 2px var(--sx-or),
    0 0 18px rgba(240, 201, 119, 0.35);
}

.sx-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c, #a33);
  color: #fff;
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 1.15em;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.sx-adv-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.sx-adv-nom {
  font-weight: 700;
}

.sx-adv-detail {
  font-size: 0.82em;
  color: #dcb2bf;
  white-space: nowrap;
}

/* Éventail de dos de cartes : combien il lui en reste */
.sx-eventail {
  position: relative;
  width: 46px;
  height: 30px;
}

.sx-eventail i {
  position: absolute;
  bottom: 0;
  left: 14px;
  width: 18px;
  height: 26px;
  border-radius: 3px;
  background: var(--sx-dos);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transform-origin: 50% 100%;
}

.sx-pioche {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
}

.sx-pioche-dos {
  width: 40px;
  height: 56px;
  border-radius: 5px;
  background: var(--sx-dos);
  box-shadow:
    2px 2px 0 #f6efe0,
    4px 4px 0 #d8cdb4,
    6px 6px 10px rgba(0, 0, 0, 0.45);
}

.sx-pioche b {
  color: var(--sx-or);
  font-size: 1.2em;
}

/* À votre tour, la pioche se touche pour piocher */
.sx-pioche.active {
  cursor: pointer;
}

.sx-pioche-dos {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sx-pioche.active:hover .sx-pioche-dos {
  transform: translateY(-3px);
}

.sx-pioche.active:active .sx-pioche-dos {
  transform: translateY(1px);
}

/* ---------- La table ---------- */
/* La table, avec « Tout reprendre » posé dans son coin bas droit */
.sx-plateau {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#sx-reprendre {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  height: 34px;
  background: rgba(40, 8, 20, 0.85);
}

#sx-reprendre[hidden] {
  display: none;
}

.sx-table {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 56px; /* place pour « Tout reprendre », en bas à droite */
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 0 0 1.5px rgba(240, 201, 119, 0.18);
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 201, 119, 0.35) transparent;
}

.sx-table.cible {
  box-shadow:
    inset 0 0 0 2px var(--sx-or),
    inset 0 0 40px rgba(240, 201, 119, 0.15);
}

.sx-groupes {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 14px 18px;
}

.sx-groupe {
  position: relative;
  display: flex;
  padding: 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 2px rgba(120, 220, 150, 0.55);
  transition:
    box-shadow 0.15s,
    background 0.15s,
    transform 0.15s;
}

.sx-groupe.faux {
  box-shadow: inset 0 0 0 2px #ff6b6b;
  background: rgba(200, 16, 46, 0.18);
}

/* Combinaisons posées avant ce tour, quand on n'a pas encore ouvert : intouchables */
.sx-groupe.bloque {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.15);
  opacity: 0.75;
}

.sx-groupe.cible {
  background: rgba(240, 201, 119, 0.2);
  box-shadow:
    inset 0 0 0 2px var(--sx-or),
    0 0 18px rgba(240, 201, 119, 0.4);
  transform: scale(1.02);
}

/* Ce que l'adversaire vient de jouer */
.sx-groupe.nouveau {
  animation: sx-nouveau 1.6s ease-out;
}

@keyframes sx-nouveau {
  0%,
  40% {
    box-shadow:
      inset 0 0 0 2px var(--sx-or),
      0 0 26px rgba(240, 201, 119, 0.7);
  }
}

.sx-groupe .sx-carte + .sx-carte {
  margin-left: calc(var(--sx-l) * -0.3);
}

.sx-points {
  position: absolute;
  top: -10px;
  right: 8px;
  padding: 0 7px;
  border-radius: 999px;
  background: #2b0912;
  color: var(--sx-or);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.6;
}

.sx-vide {
  margin-top: 14px;
  padding: 14px;
  border: 2px dashed rgba(240, 201, 119, 0.3);
  border-radius: 14px;
  color: rgba(240, 201, 119, 0.6);
  text-align: center;
  font-size: 0.92em;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.sx-vide.cible {
  border-color: var(--sx-or);
  background: rgba(240, 201, 119, 0.12);
  color: var(--sx-or);
}

/* ---------- Cartes ---------- */
.sx-jeu {
  --sx-dos:
    repeating-linear-gradient(
      45deg,
      rgba(240, 201, 119, 0.4) 0 2px,
      transparent 2px 7px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(240, 201, 119, 0.4) 0 2px,
      transparent 2px 7px
    ),
    radial-gradient(circle, #6b1a33, #3a0d1c);
}

.sx-carte {
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  width: var(--sx-l);
  height: var(--sx-h);
  border-radius: calc(var(--sx-l) * 0.1);
  background: linear-gradient(160deg, #ffffff, #f4eee0);
  border: 1px solid #dacdb0;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 4px 10px -3px rgba(0, 0, 0, 0.55);
  color: var(--coul);
  cursor: grab;
  touch-action: none;
  transition:
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.15s,
    opacity 0.15s;
}

.sx-carte.e0 {
  --coul: var(--sx-pique);
}

.sx-carte.e1 {
  --coul: var(--sx-coeur);
}

.sx-carte.e2 {
  --coul: var(--sx-carreau);
}

.sx-carte.e3 {
  --coul: var(--sx-trefle);
}

.sx-carte b {
  position: absolute;
  top: calc(var(--sx-l) * 0.05);
  left: calc(var(--sx-l) * 0.09);
  color: inherit;
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: calc(var(--sx-l) * 0.36);
  line-height: 1;
  letter-spacing: -0.04em;
}

.sx-carte small {
  position: absolute;
  top: calc(var(--sx-l) * 0.42);
  left: calc(var(--sx-l) * 0.1);
  font-size: calc(var(--sx-l) * 0.24);
  line-height: 1;
}

.sx-carte span {
  position: absolute;
  right: calc(var(--sx-l) * 0.07);
  bottom: calc(var(--sx-l) * 0.04);
  font-size: calc(var(--sx-l) * 0.52);
  line-height: 1;
  opacity: 0.9;
}

/* Joker */
.sx-carte.joker {
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(255, 255, 255, 0.5),
      transparent 50%
    ),
    linear-gradient(150deg, #ffd36b, #ff6b9a 50%, #8f5bff);
  border-color: #c99a3c;
  color: #fff;
}

.sx-carte.joker b {
  font-size: calc(var(--sx-l) * 0.42);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sx-carte.joker span {
  right: 0;
  left: 0;
  bottom: calc(var(--sx-l) * 0.08);
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: calc(var(--sx-l) * 0.17);
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sx-carte:hover {
  transform: translateY(-4px);
  z-index: 3;
}

/* Carte posée pendant ce tour : liseré vert et fond teinté */
.sx-carte.posee:not(.joker) {
  background: linear-gradient(180deg, #eafbe9, #cdeecd);
}

.sx-carte.posee {
  box-shadow:
    0 0 0 2.5px #5fd38a,
    0 0 14px rgba(95, 211, 138, 0.85),
    0 4px 10px -3px rgba(0, 0, 0, 0.55);
}

.sx-carte.choisie {
  transform: translateY(-10px);
  box-shadow:
    0 0 0 3px var(--sx-or),
    0 12px 20px -6px rgba(0, 0, 0, 0.6);
  z-index: 4;
}

.sx-carte.fixe {
  cursor: default;
}

.sx-carte.fixe:hover {
  transform: none;
}

.sx-carte.fantome {
  opacity: 0.25;
}

/* Carte qui suit le pointeur pendant un glisser */
.sx-glisse {
  position: fixed;
  z-index: 3000;
  display: flex;
  pointer-events: none;
  transform: rotate(-4deg) scale(1.08);
  transform-origin: 0 0;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.5));
  cursor: grabbing;
}

.sx-glisse .sx-carte + .sx-carte {
  margin-left: calc(var(--sx-l) * -0.28);
}

/* Posée par un adversaire depuis votre dernier tour : entourée de sa couleur */
.sx-carte.adverse {
  box-shadow:
    0 0 0 2.5px var(--cadv),
    0 0 14px var(--cadv),
    0 4px 10px -3px rgba(0, 0, 0, 0.55);
}

/* La carte que vous venez de piocher */
.sx-carte.neuve {
  animation: sx-neuve 1.4s ease-in-out 3;
}

@keyframes sx-neuve {
  50% {
    box-shadow:
      0 0 0 3px #fff4d0,
      0 0 20px rgba(240, 201, 119, 0.9);
    transform: translateY(-6px);
  }
}

/* ---------- Bas : chevalet et actions ---------- */
.sx-bas {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 14px;
  align-items: end;
}

.sx-etat {
  grid-column: 1 / -1;
  min-height: 1.3em;
  color: var(--sx-or);
  font-weight: 600;
  font-size: 0.95em;
}

.sx-etat .erreur {
  color: #ffb3b3;
}

/* Le chevalet de bois */
.sx-chevalet {
  position: relative;
  min-width: 0;
  padding: 10px 12px 14px 12px;
  border-radius: 14px 14px 10px 10px;
  background:
    repeating-linear-gradient(
      92deg,
      rgba(0, 0, 0, 0.06) 0 2px,
      transparent 2px 11px
    ),
    linear-gradient(180deg, #a86b3c, #7a4622 70%, #5e3418);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -6px 0 rgba(0, 0, 0, 0.25),
    0 10px 24px -10px rgba(0, 0, 0, 0.7);
}

.sx-chevalet.cible {
  box-shadow:
    inset 0 0 0 2px var(--sx-or),
    0 0 20px rgba(240, 201, 119, 0.5);
}

.sx-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px; /* écart entre paquets : ECART_PAQUETS dans game.js */
  min-height: calc(var(--sx-h) + 8px);
}

/* Emplacement libre au bout du chevalet : y lâcher une carte l'isole dans un nouveau paquet */
/* (visible seulement pendant un glisser ; sa place reste réservée) */
.sx-main::after {
  content: "Isoler";
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: calc(var(--sx-l) * 0.8);
  height: calc(var(--sx-h) + 8px);
  border: 2px dashed rgba(240, 201, 119, 0.6);
  border-radius: 10px;
  color: var(--sx-or);
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  visibility: hidden;
}

.sx-jeu.en-glisse .sx-main::after {
  visibility: visible;
}

/* Un paquet de la main (rangé par vous, ou une combinaison trouvée par le tri) */
.sx-paquet {
  position: relative;
  display: flex;
  padding: 4px; /* BORD_PAQUET (2 × 4) dans game.js */
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.sx-paquet .sx-carte + .sx-carte {
  margin-left: var(--sx-chevauche, 4px);
}

/* Combinaison prête à poser */
.sx-paquet.combo {
  background: rgba(240, 201, 119, 0.22);
  box-shadow:
    inset 0 0 0 2px var(--sx-or),
    0 0 14px rgba(240, 201, 119, 0.35);
}

.sx-paquet .sx-points {
  top: -11px;
  right: 6px;
  z-index: 5;
}

/* Où la carte va se glisser */
.sx-repere {
  position: absolute;
  z-index: 6;
  width: 4px;
  height: calc(var(--sx-h) + 8px);
  border-radius: 2px;
  background: var(--sx-or);
  box-shadow: 0 0 10px var(--sx-or);
  pointer-events: none;
}

.sx-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 190px;
}

.sx-tri {
  display: flex;
  gap: 6px;
}

.sx-tri .sx-btn {
  flex: 1;
  padding: 0 4px;
  font-size: 0.9em;
  white-space: nowrap;
}


.sx-btn {
  height: 42px;
  margin: 0;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 0 0 1.5px rgba(240, 201, 119, 0.6);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.98em;
  cursor: pointer;
  transition:
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.15s,
    opacity 0.15s;
}

.sx-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

.sx-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.sx-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.sx-btn:focus-visible {
  outline: 3px solid var(--sx-or);
  outline-offset: 2px;
}

.sx-btn.petit {
  height: 32px;
  padding: 0 8px;
  font-size: 0.78em;
  font-weight: 600;
}

/* Tri en cours */
.sx-btn.petit[aria-pressed="true"] {
  background: var(--sx-or);
  box-shadow: none;
  color: #3a1a06;
}

.sx-btn.clair {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.sx-btn.or {
  background: linear-gradient(135deg, #ffe29e, #d39a3e);
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.7);
  color: #3a1a06;
}

.sx-btn.or:hover:not(:disabled) {
  background: linear-gradient(135deg, #fff0c4, #e0a948);
}

/* ---------- Fenêtres : dans le salon, la barre reste visible ---------- */
.sx-voile {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(20, 3, 9, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sx-fen {
  box-sizing: border-box;
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 24px 18px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, #6b1a33, #3a0d1c);
  box-shadow:
    0 0 0 2px var(--sx-or),
    0 30px 60px -20px rgba(0, 0, 0, 0.8);
  color: #f6e9ec;
  text-align: center;
  animation: sx-fen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sx-fen {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

.sx-fen-titre {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 1.9em;
  color: var(--sx-or);
}

.sx-fen-sous {
  margin: 6px 0 12px 0;
  color: #e7c6cf;
}

.sx-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid rgba(240, 201, 119, 0.15);
  font-weight: 600;
}

.sx-choix {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

.sx-choix button {
  min-width: 40px;
  height: 32px;
  margin: 0;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #e7c6cf;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.sx-choix button[aria-pressed="true"] {
  background: var(--sx-or);
  color: #3a1a06;
}

.sx-choix button:focus-visible {
  outline: 2px solid var(--sx-or);
  outline-offset: 1px;
}

.sx-fen-boutons {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.sx-fen .btn-vert {
  min-width: 130px;
  background: linear-gradient(135deg, #ffe29e, #d39a3e);
  color: #3a1a06;
}

.sx-classement {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.sx-classement div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.sx-classement div:first-child {
  background: rgba(240, 201, 119, 0.18);
  box-shadow: inset 0 0 0 1.5px var(--sx-or);
}

.sx-classement em {
  margin-left: auto;
  font-style: normal;
  color: #e7c6cf;
}

/* ---------- Écran étroit ---------- */
@media (max-width: 760px) {
  .sx-zone {
    padding: 8px;
    gap: 6px;
  }

  .sx-plateau {
    flex: none;
  }

  .sx-table {
    flex: none;
    min-height: 280px;
  }

  #sx-ouverture {
    display: none;
  }

  .sx-adversaires {
    flex-wrap: wrap;
    gap: 4px;
  }

  .sx-adv {
    padding: 3px 8px 3px 3px;
  }

  .sx-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.9em;
  }

  .sx-eventail {
    display: none;
  }

  .sx-bas {
    grid-template-columns: 1fr;
  }

  .sx-actions {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sx-actions .sx-btn {
    flex: 1;
    padding: 0 8px;
  }

  .sx-tri {
    flex-basis: 100%;
  }
}

/* Classement de fin : le site colore les <b>, on garde des noms bien lisibles */
.sx-classement b {
  color: #fff;
  font-weight: 700;
}

.sx-classement div:first-child b {
  color: var(--sx-or);
}

.sx-classement em {
  color: #f1dbe1;
}

/* Bouton secondaire aux couleurs du salon */
.sx-fen .btn-bleu {
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 1.5px var(--sx-or);
  color: #fff;
}

.sx-fen .btn-bleu:hover {
  background: rgba(0, 0, 0, 0.45);
}
