#joinSlider,
#rebuySlider {
  display: block;
  width: calc(100% - 4px);
  height: 8px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: none;
  border: none;
  border-radius: 0;
  outline: none;
  margin: 8px auto 0;
  padding: 0;
  cursor: pointer;
}
#joinSlider::-webkit-slider-runnable-track,
#rebuySlider::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 4px;
}
#joinSlider::-moz-range-track,
#rebuySlider::-moz-range-track {
  height: 8px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 4px;
}
#joinSlider::-webkit-slider-thumb,
#rebuySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  border: none;
  margin-top: -4px;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}
.slider-label {
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}
#joinSlider::-moz-range-thumb,
#rebuySlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  border: none;
}
/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
/* La popup de recave ne floute pas l'arrière-plan et laisse voir les cartes
   de la table (la sienne et celles des autres joueurs). */
#rebuyModal {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(0,0,0,0.3);
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}
#rebuyModal .modal {
  width: 680px;
  max-width: 95vw;
  padding: 16px 20px;
}
#rebuyModal .modal p { margin-bottom: 12px; }
#rebuyModal .form-group { margin-bottom: 12px; }
#rebuyModal .form-hint { margin-top: 4px; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 440px;
  max-width: 95vw;
  position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 16px; font-size: 20px; }
.modal p { color: var(--text-secondary); margin-bottom: 16px; font-size: 14px; }
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-result { text-align: center; }
.modal-result h2 { font-size: 28px; }
.modal-result p { font-size: 16px; }
.modal-overlay.result-overlay {
  align-items: flex-start;
  padding-top: 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
.modal-overlay.result-overlay .modal {
  width: 400px;
  padding: 20px;
}
.hand-result-cards { margin: 12px 0; }
.hand-result-player { margin: 8px 0; padding: 8px; background: rgba(255,255,255,0.05); border-radius: 8px; }
.hand-result-player.folded { opacity: 0.5; }
.hand-result-name { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.hand-result-cards-row { display: flex; gap: 4px; }
.hand-result-cards-row img { width: 48px; height: auto; border-radius: 4px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
/* POKER TABLE */
.game-page { background: #0a0e17; padding-top: 56px; overflow: hidden; }
.poker-table-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  padding: 20px;
  position: relative;
}
/* Les dimensions (--table-w/--table-h) et l'échelle (--table-scale) sont
   calculées en JS (layoutGame) pour que la table s'adapte à l'écran en
   laissant autour de la place pour les sièges des joueurs. */
.poker-table {
  /* Hauteur pilotée par le viewport (largeur + hauteur): la table exploite la
     hauteur de l'écran, en se réduisant sur les écrans courts. */
  --th: min(620px, calc((100vh - 104px) / 1.56));
  position: relative;
  width: var(--table-w, 900px);
  height: var(--table-h, 500px);
  border-radius: calc(var(--table-w, 900px) * 0.277) / calc(var(--table-h, 500px) * 0.32);
  background: radial-gradient(ellipse at 50% 40%, #0f834d, #095230 60%, #063d1f);
  box-shadow: 0 0 80px rgba(6,107,62,0.3), inset 0 0 100px rgba(0,0,0,0.3), 0 20px 60px rgba(0,0,0,0.5);
  border: calc(12px * var(--table-scale, 1)) solid #4a3728;
  border-top-color: #5c4432;
  border-bottom-color: #3d2b1e;
}
.table-felt {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  background: repeating-conic-gradient(rgba(255,255,255,0.02) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
  pointer-events: none;
  z-index: 1;
}
.community-cards {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  display: flex;
  gap: clamp(6px, calc(var(--table-w, 900px) * 0.011), 10px);
  z-index: 2;
}
/* Taille minimale garantie pour que les cartes restent lisibles sur petits
   écrans (elles ne rétrécissent pas avec la table). Sur grands écrans la
   taille max (100px) correspond à l'ancienne valeur fixe. */
.community-cards .card-slot {
  width: clamp(72px, calc(var(--table-w, 900px) * 0.1111), 100px);
  height: clamp(100px, calc(var(--table-w, 900px) * 0.1111 * 1.4), 140px);
  background: rgba(0,0,0,0.25);
  border: none;
  border-radius: 6px;
}
.community-cards .card-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.pot-display {
  position: absolute;
  top: calc(50% + var(--table-h, 500px) * 0.2);
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 20px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  z-index: 5;
}
/* Quand le pot part vers le vainqueur (fin de main), on pose un fond sombre
   derrière le montant (sans bordure) jusqu'à la main suivante. */
.pot-display.claimed {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 6px 14px;
  text-shadow: none;
}
.pot-chip-icon {
  position: absolute;
  top: calc(50% + var(--table-h, 500px) * 0.14);
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  z-index: 5;
}
.seat-dealer {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-weight: 800;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid var(--accent-gold);
}
.result-banner {
  display: none;
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 60;
  pointer-events: none;
}
.result-banner-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(245,158,11,0.5), 0 2px 10px rgba(0,0,0,0.5);
}
.result-banner-hand {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.seat.winner .seat-avatar {
  border-color: var(--accent-gold);
  box-shadow: 0 0 30px rgba(245,158,11,0.6);
  animation: winner-glow 1s ease-in-out infinite;
}
@keyframes winner-glow {
  0%, 100% { box-shadow: 0 0 15px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 0 35px rgba(245,158,11,0.8); }
}
/* SEATS */
.seats-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all .3s;
  z-index: 4;
  max-width: min(240px, 55vw);
}
