/* ===============================
   Skyjo – styles spécifiques
   =============================== */

.sj-jeu {
  --sj-bleu: #2f6be0;
  --sj-bleu-fonce: #1d3f8f;
  --sj-encre: #1b2f5e;
  --cm: 64px; /* cartes du joueur */
  --ca: 40px; /* cartes des adversaires */
  --ct: 58px; /* pioche, main, défausse */
  --vit: 1;
  color: var(--sj-encre);
  /* Barre commune (css/games.css), au-dessus du ciel */
  --mg-jeu-largeur: 1600px;
  --mgb-fond: radial-gradient(120% 160% at 0% 0%, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(120deg, var(--sj-bleu-fonce), var(--sj-bleu));
  --mgb-accent: #ffd54f;
  --mgb-titre: linear-gradient(100deg, #ffffff, #cfe6ff);
  --mg-bulle-fond: var(--sj-encre);
  user-select: none;
  -webkit-user-select: none;
}

/* Le ciel : cadre du plateau, sous la barre et de même largeur qu'elle */
.sj-ciel {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  min-height: 560px;
  padding: 8px 12px 12px;
  border-radius: 20px;
  /* même fond bleu nuit que le plein écran */
  background: var(--mg-fs-fond);
  box-shadow: 0 10px 30px rgba(30, 70, 140, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Barre du haut ---------- */

/* Titre de la page, dans la barre du jeu */

/* ---------- Plateaux des joueurs ---------- */

.sj-adversaires {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 20px;
}

.sj-plateau {
  --w: var(--ca);
  position: relative;
  padding: 6px 10px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.9);
  transition:
    box-shadow 0.25s,
    border-color 0.25s,
    background 0.25s;
}

.sj-plateau.moi {
  --w: var(--cm);
  margin: 0 auto;
  padding: 8px 14px 14px;
}

.sj-plateau.actif {
  border-color: #ffc93c;
  background: rgba(255, 250, 225, 0.85);
  box-shadow:
    0 0 0 3px rgba(255, 201, 60, 0.35),
    0 8px 20px rgba(30, 70, 140, 0.15);
}

.sj-plateau.moi.a-vous {
  border-color: #ffc93c;
}

.sj-tete {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.moi .sj-tete {
  font-size: 0.95rem;
  justify-content: center;
}

.sj-av {
  font-size: 1.25em;
  line-height: 1;
}

.sj-nom {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9em;
}

.sj-niv {
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  color: #fff;
  background: #3fae4f;
}

.sj-niv-moyen {
  background: #f0a500;
}

.sj-niv-expert {
  background: #d9412f;
}

.sj-drap {
  display: none;
}

.finisseur .sj-drap {
  display: inline;
}

.sj-pts,
.sj-total {
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  cursor: default;
}

.sj-pts {
  margin-left: auto;
  background: var(--sj-encre);
  color: #fff;
}

.sj-total {
  background: rgba(47, 107, 224, 0.15);
  color: var(--sj-bleu-fonce);
}

.moi .sj-pts {
  margin-left: 8px;
}

.sj-grille {
  display: flex;
  justify-content: center;
  gap: calc(var(--w) * 0.1);
  min-height: calc(var(--w) * 4.4);
}

.sj-col {
  display: flex;
  flex-direction: column;
  gap: calc(var(--w) * 0.1);
  max-width: var(--w);
}

/* Colonne éliminée : elle se replie (transition seulement à ce moment-là,
   sinon un changement de taille des cartes ferait se chevaucher les colonnes) */
.sj-col.sj-part {
  transition:
    max-width calc(0.35s * var(--vit)),
    opacity calc(0.35s * var(--vit)),
    margin calc(0.35s * var(--vit));
  max-width: 0;
  opacity: 0;
  margin-right: calc(var(--w) * -0.1);
}

/* Réplique d'un adversaire */
.sj-quip {
  position: absolute;
  left: 50%;
  top: 30px;
  z-index: 5;
  max-width: 220px;
  padding: 5px 11px;
  border-radius: 12px;
  background: #fff;
  color: var(--sj-encre);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(20, 50, 110, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.85);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.sj-quip.on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Cartes ---------- */

.sj-carte {
  position: relative;
  flex: none;
  width: var(--w);
  height: calc(var(--w) * 1.4);
  perspective: calc(var(--w) * 8);
  transition: translate 0.15s;
}

.sj-in {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform calc(0.45s * var(--vit)) cubic-bezier(0.4, 0.2, 0.2, 1);
}

.sj-carte.vis .sj-in {
  transform: rotateY(180deg);
}

.sj-net .sj-in {
  transition: none !important;
}

.sj-dos,
.sj-recto {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--w) * 0.13);
  border: calc(var(--w) * 0.05) solid #fff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 calc(var(--w) * 0.04) calc(var(--w) * 0.1) rgba(20, 45, 100, 0.3);
}

/* Dos : bleu nuit, quadrillage fin, liseré et losange doré */
.sj-dos {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px calc(var(--w) * 0.09)),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px calc(var(--w) * 0.09)),
    radial-gradient(ellipse at 50% 35%, #34509f 0%, #1c2f68 60%, #121f47 100%);
}

.sj-dos::before {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid rgba(240, 200, 110, 0.6);
  border-radius: calc(var(--w) * 0.07);
}

/* Médaillon doré « MG » au centre */
.sj-dos::after {
  content: "MG";
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #e2ab35 55%, #b07b14);
  box-shadow:
    0 0 0 calc(var(--w) * 0.03) #1c2f68,
    0 0 0 calc(var(--w) * 0.05) rgba(240, 200, 110, 0.7);
  color: #1c2f68;
  font-family: "Madimi One", sans-serif;
  font-size: calc(var(--w) * 0.24);
  line-height: 1;
  letter-spacing: -0.02em;
  transform: translate(-50%, -50%);
}

.sj-recto {
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fond, #ccc);
}

.sj-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78%;
  aspect-ratio: 1 / 1.2;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--encre, #333);
  font-family: "Madimi One", sans-serif;
  font-size: calc(var(--w) * 0.44);
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.sj-coin {
  position: absolute;
  top: 3%;
  left: 7%;
  font-family: "Madimi One", sans-serif;
  font-size: calc(var(--w) * 0.19);
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.sj-coin.bas {
  top: auto;
  left: auto;
  bottom: 3%;
  right: 7%;
  transform: rotate(180deg);
}

.sj-mini .adv .sj-coin {
  display: none;
}

/* Petites grilles : l'en-tête passe sur deux lignes pour ne pas les élargir */
.sj-mini .adv .sj-tete {
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 4px;
  max-width: calc(var(--w) * 4.3);
  margin: 0 auto 5px;
}

.sj-mini .adv .sj-nom {
  max-width: calc(var(--w) * 3);
}

.sj-mini .adv .sj-pts {
  margin-left: 0;
}

.sj-mini .adv .sj-niv {
  display: none;
}

.sj-mini .adv .sj-quip {
  max-width: none;
  font-size: 0.72rem;
}

.sj-carte[data-coul="neg"] {
  --fond: linear-gradient(155deg, #7a6af2, #3a2db0);
  --encre: #3a2db0;
}
.sj-carte[data-coul="zero"] {
  --fond: linear-gradient(155deg, #7fd6f7, #2a9fd6);
  --encre: #1b7fb3;
}
.sj-carte[data-coul="vert"] {
  --fond: linear-gradient(155deg, #7fd486, #2f9a45);
  --encre: #237a37;
}
.sj-carte[data-coul="jaune"] {
  --fond: linear-gradient(155deg, #ffe169, #f2b705);
  --encre: #9a6f00;
}
.sj-carte[data-coul="rouge"] {
  --fond: linear-gradient(155deg, #ff7b66, #d9372a);
  --encre: #b02a1d;
}

/* Distribution : les cartes tombent sur la table */
.sj-donne {
  animation: sjDonne calc(0.35s * var(--vit)) cubic-bezier(0.2, 0.8, 0.3, 1.2) backwards;
}

@keyframes sjDonne {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.6) rotate(-8deg);
  }
}

/* Carte qui vole d'une place à l'autre */
.sj-vol {
  position: fixed;
  z-index: 3000;
  margin: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

.sj-vol .sj-dos,
.sj-vol .sj-recto {
  box-shadow: 0 10px 22px rgba(20, 45, 100, 0.35);
}

.sj-vide,
.sj-absente {
  visibility: hidden;
}

/* Cartes jouables : halo doré */
.sj-carte.cliquable {
  cursor: pointer;
}

.sj-carte.cliquable::after,
.sj-conseil .sj-tas::after,
.sj-carte.sj-conseil::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--w) * 0.16);
  pointer-events: none;
}

.sj-carte.cliquable::after {
  box-shadow: 0 0 0 2px rgba(255, 190, 30, 0.9);
  animation: sjHalo 1.3s ease-in-out infinite;
}

.sj-carte.cliquable:hover {
  translate: 0 -5px;
}

@keyframes sjHalo {
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 190, 30, 0.9),
      0 0 12px 3px rgba(255, 200, 40, 0.55);
  }
}

/* Conseil : la carte ou la pile recommandée brille */
.sj-carte.sj-conseil::after,
.sj-conseil .sj-tas::after {
  box-shadow:
    0 0 0 3px #ffd000,
    0 0 18px 6px rgba(255, 208, 0, 0.85);
  animation: sjConseil 0.8s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes sjConseil {
  to {
    box-shadow:
      0 0 0 3px #fff3a0,
      0 0 26px 10px rgba(255, 208, 0, 0.6);
  }
}

/* Colonne éliminée */
.sj-col.sj-brille .sj-carte::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--w) * 0.16);
  box-shadow:
    0 0 0 3px #fff,
    0 0 20px 8px rgba(255, 230, 120, 0.95);
  animation: sjConseil 0.3s ease-in-out infinite alternate;
}

/* ---------- Table : pioche, carte en main, défausse ---------- */

.sj-table {
  --w: var(--ct);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(14px, 5vw, 46px);
  padding: 6px 0 2px;
}

.sj-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  outline: none;
}

.sj-tas {
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * 0.13);
  transition: translate 0.15s;
}

.sj-tas > .sj-carte {
  position: absolute;
  left: 0;
  top: 0;
}

.sj-main .sj-tas {
  border: 2px dashed rgba(29, 63, 143, 0.25);
}

#sj-def-tas {
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 2px rgba(29, 63, 143, 0.15);
}

.sj-deco.d0 {
  transform: translate(4px, 4px) rotate(3deg);
}
.sj-deco.d1 {
  transform: translate(2px, 2px) rotate(-2deg);
}
.sj-deco.sous {
  transform: rotate(-6deg);
  filter: brightness(0.92);
}

.sj-tas.peu .sj-deco,
.sj-pile.vide .sj-carte {
  visibility: hidden;
}

.sj-compte {
  position: absolute;
  top: -8px;
  right: -10px;
  z-index: 3;
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--sj-encre);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

/* Largeur fixe : « Carte de … » ne doit pas élargir la pile et décaler le jeu */
.sj-lib {
  width: 9em;
  font-size: 0.8rem;
  font-weight: 700;
  color: #cfe0ff; /* libellés sur le fond bleu nuit */
  min-height: 1.2em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sj-pile.cliquable {
  cursor: pointer;
}

.sj-pile.cliquable .sj-tas::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--w) * 0.17);
  box-shadow: 0 0 0 2px rgba(255, 190, 30, 0.9);
  animation: sjHalo 1.3s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

.sj-pile.cliquable:hover .sj-tas,
.sj-pile.cliquable:focus-visible .sj-tas {
  translate: 0 -5px;
}

.sj-pile.cliquable .sj-lib {
  color: #b86e00;
}

.sj-melange .sj-tas {
  animation: sjSecoue 0.3s ease-in-out 3;
}

@keyframes sjSecoue {
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}

/* Bannière « Dernier tour ! » */
.sj-banniere {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  padding: 8px 26px;
  border-radius: 40px;
  background: linear-gradient(135deg, #ff9a2f, #e2412f);
  color: #fff;
  font-family: "Madimi One", sans-serif;
  font-size: 1.9rem;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(170, 50, 20, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
}

.sj-banniere.petite {
  font-size: 1.2rem;
  background: linear-gradient(135deg, #4a82f0, #1d3f8f);
}

.sj-banniere.on {
  animation: sjBanniere calc(1.7s * var(--vit)) ease-out forwards;
}

@keyframes sjBanniere {
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1) rotate(-3deg);
  }
  25%,
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-3deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -80%) scale(0.9) rotate(-3deg);
  }
}

.sj-retour-bilan {
  position: absolute;
  right: 0;
  top: 8px;
  z-index: 6;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--sj-bleu);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--sj-bleu-fonce);
}

.sj-statut {
  /* Hauteur fixe (2 lignes) : un long message ne doit pas agrandir le jeu */
  height: calc(2.6em + 8px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 14px;
  margin: 0 auto;
  max-width: 640px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.sj-moi {
  display: flex;
  justify-content: center;
}

/* ---------- Fenêtres ---------- */

/* La barre commune reste au-dessus du voile des fenêtres (configuration, confirmation) */
.sj-jeu > .mg-barre {
  position: relative;
  z-index: 51;
}

.sj-modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: inherit;
  background: rgba(20, 45, 100, 0.45);
}

.sj-modal[hidden] {
  display: none;
}

.sj-boite {
  width: 100%;
  max-width: 520px;
  max-height: 100%;
  overflow: auto;
  padding: 20px 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(10, 30, 80, 0.4);
  text-align: center;
  animation: sjBoite 0.25s ease-out;
}

@keyframes sjBoite {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.sj-titre {
  font-family: "Madimi One", sans-serif;
  font-size: 1.6rem;
  color: var(--sj-bleu);
}

.sj-sous {
  margin-top: 6px;
  color: #4a5a80;
  font-size: 0.95rem;
}

.sj-trophee {
  font-size: 3rem;
  line-height: 1.1;
  animation: sjTrophee 1.2s ease-in-out infinite alternate;
}

@keyframes sjTrophee {
  to {
    transform: translateY(-4px) rotate(4deg);
  }
}

.sj-champ {
  display: block;
  margin-top: 14px;
  text-align: left;
}

.sj-champ > span {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.sj-champ input[type="text"] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 2px solid #cfe0ff;
  border-radius: 10px;
  font-size: 1rem;
  color: var(--sj-encre);
  outline: none;
}

.sj-champ input[type="text"]:focus {
  border-color: var(--sj-bleu);
}

.sj-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sj-seg button {
  flex: 1 1 auto;
  min-width: 38px;
  padding: 8px 10px;
  border: 2px solid #cfe0ff;
  border-radius: 10px;
  background: #f3f8ff;
  color: var(--sj-bleu-fonce);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.sj-seg button:hover {
  border-color: var(--sj-bleu);
}

.sj-seg button.on {
  background: var(--sj-bleu);
  border-color: var(--sj-bleu);
  color: #fff;
}

.sj-seg-niv button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-basis: 40%;
}

.sj-seg-niv b {
  color: inherit;
  font-family: "Madimi One", sans-serif;
  font-weight: 400;
  font-size: 1.05rem;
}

.sj-seg-niv small {
  font-size: 0.75rem;
  opacity: 0.8;
}

.sj-variante {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
}

.sj-alerte {
  margin-top: 12px;
  color: #c0392b;
  font-weight: 600;
  font-size: 0.9rem;
}

.sj-boutons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.sj-jouer {
  font-family: "Madimi One", sans-serif;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, #4a82f0, var(--sj-bleu));
  border-radius: 30px;
  padding: 11px 56px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--sj-bleu-fonce);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}

.sj-jouer:hover {
  transform: translateY(-1px);
}

.sj-jouer:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--sj-bleu-fonce);
}

.sj-btn {
  color: var(--sj-bleu);
  background: #fff;
  border: 2px solid #cfe0ff;
  border-radius: 22px;
  padding: 7px 18px;
  font-size: 0.95rem;
  cursor: pointer;
}

.sj-btn:hover {
  border-color: var(--sj-bleu);
}

.sj-btn[hidden] {
  display: none;
}

/* Classement */
.sj-classe {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 14px;
}

.sj-ligne {
  display: grid;
  grid-template-columns: 2em 1fr auto 3.2em;
  align-items: center;
  gap: 4px 10px;
  padding: 7px 12px;
  border-radius: 12px;
  background: #f1f6ff;
  text-align: left;
}

.sj-ligne.moi {
  background: #fff6d6;
  box-shadow: inset 0 0 0 2px #ffd56a;
}

.sj-rang {
  font-family: "Madimi One", sans-serif;
  font-size: 1.1rem;
  color: var(--sj-bleu);
  text-align: center;
}

.sj-qui {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sj-qui .sj-drap {
  display: inline;
}

.sj-manche-pts {
  font-weight: 600;
  color: #4a5a80;
}

.sj-badge-x2 {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: #e2412f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.sj-tot {
  font-family: "Madimi One", sans-serif;
  font-size: 1.15rem;
  text-align: right;
}

.sj-jauge {
  grid-column: 2 / -1;
  height: 5px;
  border-radius: 3px;
  background: #dde7fa;
  overflow: hidden;
}

.sj-jauge i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s;
}

.sj-jauge.vert i {
  background: #3fae4f;
}
.sj-jauge.orange i {
  background: #f0a500;
}
.sj-jauge.rouge i {
  background: #e2412f;
}

.sj-details {
  margin-top: 12px;
  text-align: left;
  font-size: 0.85rem;
}

.sj-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--sj-bleu);
}

.sj-histo {
  overflow-x: auto;
  margin-top: 6px;
}

.sj-tab {
  width: 100%;
  margin: 0;
  font-size: 0.85rem;
}

.sj-tab th,
.sj-tab td {
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid #e3ebfa;
  white-space: nowrap;
}

.sj-tab th {
  color: #6a7aa0;
  font-weight: 600;
}

.sj-tab .sj-tab-nom {
  text-align: left;
}

.sj-tab .sj-x2 {
  color: #e2412f;
  font-weight: 800;
}

.sj-tab .sj-fini {
  text-decoration: underline dotted;
}

/* Confettis de victoire */
.sj-confetti {
  position: fixed;
  top: -16px;
  z-index: 3500;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  animation: sjTombe linear forwards;
}

@keyframes sjTombe {
  to {
    transform: translate(var(--derive, 0), 105vh) rotate(900deg);
  }
}

/* ---------- Infobulles ---------- */

/* ---------- Plein écran ---------- */

/* Plein écran : le ciel occupe toute la place sous la barre */
.sj-jeu.mg-fs .sj-ciel {
  align-self: stretch;
  width: auto;
  flex: 1 1 auto;
  border-radius: 14px;
}

/* ---------- Petits écrans ---------- */

@media (max-width: 560px) {
  .sj-ciel {
    padding: 8px 6px 12px;
    border-radius: 12px;
  }
  .sj-plateau {
    padding: 5px 6px 8px;
  }
  .sj-tete {
    font-size: 0.72rem;
  }
  .sj-niv {
    display: none;
  }
  
  .sj-statut {
    font-size: 0.85rem;
  }
  .sj-boite {
    padding: 16px 14px;
  }
  .sj-jouer {
    padding: 10px 40px;
  }
}

/* Avant la première partie : place pour la fenêtre des réglages */
.sj-jeu:not(.sj-en-jeu) .sj-ciel {
  min-height: 664px; /* place de la fenêtre de réglages (la barre est au-dessus) */
}

.sj-jeu:not(.sj-en-jeu) .sj-infos,
.sj-jeu:not(.sj-en-jeu) .sj-table,
.sj-jeu:not(.sj-en-jeu) .sj-statut {
  visibility: hidden;
}

/* La feuille du site donne une marge aux label */
.sj-jeu label {
  margin-left: 0;
  margin-right: 0;
}

.sj-jouer:focus-visible,
.sj-btn:focus-visible,
.sj-seg button:focus-visible {
  outline: 3px solid #ffd000;
  outline-offset: 2px;
}

/* ---------- Bas du jeu : pioche, défausse et grille du joueur ---------- */

.sj-bas {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Grand écran : la pioche et la défausse en colonne, à gauche de la grille */
.sj-large .sj-bas {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: clamp(24px, 4vw, 60px);
}

.sj-large .sj-table {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.sj-sans-moi .sj-moi {
  display: none;
}

/* ---------- Réglages : deux colonnes, un siège par joueur ---------- */

.sj-boite.sj-boite-large {
  max-width: 880px;
}

.sj-cfg-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0 28px;
  text-align: left;
}

.sj-siege {
  display: grid;
  grid-template-columns: 22px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin-bottom: 4px;
}

.sj-siege-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sj-bleu);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.sj-siege[data-type="off"] .sj-siege-num {
  background: #b9c6de;
}

.sj-seg.sj-seg-type {
  flex-wrap: nowrap;
  gap: 3px;
}

.sj-seg-type button {
  flex: none;
  min-width: 0;
  padding: 5px 9px;
  font-size: 0.82rem;
}

.sj-siege[data-type="off"] .sj-seg-type button.on {
  background: #8a99b8;
  border-color: #8a99b8;
}

.sj-siege:not([data-type="humain"]) .sj-siege-nom,
.sj-siege:not([data-type="bot"]) .sj-siege-niv {
  display: none;
}

.sj-champ input.sj-siege-nom {
  padding: 5px 10px;
  font-size: 0.9rem;
}

.sj-siege-niv {
  display: block;
  width: 100%;
  margin: 0;
  padding: 5px 8px;
  border: 2px solid #cfe0ff;
  border-radius: 10px;
  background: #f3f8ff;
  color: var(--sj-bleu-fonce);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.sj-siege-niv:focus {
  border-color: var(--sj-bleu);
}

.sj-cfg-aide {
  margin-top: 14px;
  font-size: 0.8rem;
  color: #5a6a90;
  line-height: 1.35;
}

.sj-jouer:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

@media (max-width: 760px) {
  .sj-cfg-cols {
    grid-template-columns: 1fr;
  }
}

/* En partie, la hauteur suit la taille calculée des cartes */
.sj-jeu.sj-en-jeu {
  min-height: 420px;
}

/* Petits écrans : titre sur sa propre ligne */

/* Piles en colonne (grand écran) : un peu plus de place pour « Carte de … » */
.sj-large .sj-lib {
  width: 10.5em;
}

@media (max-width: 560px) {
  .sj-lib {
    font-size: 0.72rem;
  }
}
