body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background-color: #121212;
  color: #f0f0f0;
  text-align: center;
}

header {
  background-color: #1f1f1f;
  padding: 1rem;
  border-bottom: 2px solid #2ecc71;
}

h1 {
  margin: 0;
  font-size: 2rem;
}

.logo {
  height: 50px;
  align-items: center;
}

.arena {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: auto;
  height: 45vh;
  min-height: 280px; /* jamais trop petit */
  max-height: 500px; /* jamais trop grand*/
  margin: 2rem auto;
  background-image: url("assets/img/tapisVert.jpg");
  background-size: cover;
  background-position: center;
  border: 8px solid #8b5e3c;
  border-radius: 20px;
  box-shadow:
    inset 0 0 30px #000,
    0 0 15px #2ecc71;
  padding: 2rem;
}

.arena.yam {
  animation: flashYam 1s ease;
}

@keyframes flashYam {
  0% {
    box-shadow: 0 0 10px #fff;
  }
  50% {
    box-shadow: 0 0 40px #2ecc71;
  }
  100% {
    box-shadow: 0 0 10px #fff;
  }
}

.dice-zone {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.kept-container {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;

  right: 10px; /* bord droit */
  top: 50%;
  transform: translateY(-50%); /* centré verticalement */
}

.dice-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  max-width: 100%;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}

.die {
  width: clamp(48px, 10vw, 64px);
  height: clamp(48px, 10vw, 64px);
  background: radial-gradient(circle at 30% 30%, #fff 60%, #ccc);
  border-radius: 12px;
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.3),
    0 12px 18px rgba(0, 0, 0, 0.35),
    0 0 6px rgba(255, 255, 255, 0.4) inset;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: bold;
  color: #222;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}
.die > .face-grid {
  width: 100%;
  height: 100%;
}

.die.roll {
  animation: rollDice 0.5s ease-out;
  box-shadow:
    0 20px 30px rgba(0, 0, 0, 0.4),
    0 0 6px rgba(255, 255, 255, 0.4) inset;
}

@keyframes rollDice {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  20% {
    transform: translateY(-10px) rotate(120deg) scale(1.1);
  }
  50% {
    transform: translateY(0) rotate(240deg) scale(0.95);
  }
  80% {
    transform: translateY(-5px) rotate(320deg) scale(1.05);
  }
  100% {
    transform: translateY(0) rotate(360deg) scale(1);
  }
}

.die.mini {
  transform: scale(0.7);
  opacity: 0.8;
  box-shadow: 0 0 8px #2ecc71;
  border: 2px solid #2ecc71;
}

.face-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
  box-sizing: border-box;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: transparent;
  margin: auto;
}

.dot.active {
  background-color: #222;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #2ecc71;
  object-fit: cover;
}

.player-info {
  display: none; /*Masquer par default*/
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.player-info.active {
  display: flex; /*afficher uniquement si actif*/
}

#roll-counter {
  font-size: 1rem;
  color: #f0f0f0;
  margin-top: 0.5rem;
}

button {
  background-color: #2ecc71;
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  margin: 1rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background-color: #27ae60;
}

.combo-grid {
  display: none;
  margin: 2rem auto;
  max-width: 600px;
}

.combo-grid.active {
  display: block;
}

.combo-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
  max-width: 600px;
  margin: 0 auto;
  transition: opacity 0.3s ease;
}

.combo-list li.locked {
  pointer-events: none;
  cursor: default;
  opacity: 0.5;
  background-color: #eee;
}

.combo-list li {
  background-color: #2c3e50;
  padding: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

.combo-list li:hover {
  background-color: #27ae60;
}

.combo-list li.selected {
  background-color: #2ecc71;
  font-weight: bold;
}
.combo-list.visible {
  display: grid;
}

.combo-list.hidden {
  display: none;
}

.points {
  display: block;
  font-size: 0.9rem;
  color: #aaa;
  margin-top: 0.3rem;
}

.score-grid {
  margin: 2rem auto;
  max-width: 600px;
}
.score-cell.active-player {
  font-weight: bold;
  background-color: #1e1e1e;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.6rem;
  border-bottom: 1px solid #444;
  text-align: left;
}

/* stylisation fil de discussion retractable + bulle message + animation façon portable */

/* Bouton d’ouverture du chat */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  padding: 10px 15px;
  background: #06f17c;
  color: white;
  border: none;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chat-toggle.ping {
  animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    background-color: #2ecc71;
  }
  50% {
    transform: scale(1.1);
    background-color: #27ae60;
  }
  100% {
    transform: scale(1);
    background-color: #2ecc71;
  }
}

/* Mini téléphone */
.chat-panel {
  position: fixed;
  bottom: 70px;
  right: 20px;
  width: 280px;
  height: 420px;
  border-radius: 20px;
  border: 2px solid #ccc;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.chat-panel.hidden {
  display: none;
}

.chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}
/* Zone des messages */
.chat-log {
  flex: 1;
  overflow-y: auto;
  background: #121212;
  border: 6px solid #8b5e3c;
  padding: 10px;
}

/* Zone input + boutons */
.chat-controls {
  position: relative; /* IMPORTANT pour le picker */
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 1px solid #ddd;
  background: #1f1f1f;
}
/* Input */
.chat-input {
  flex: 1;
  min-width: 0;
  max-height: 80px; /* limite comme Messenger */
  padding: 8px 10px;
  font-size: 14px;
  line-height: 18px;
  border-radius: 12px;
  border: 1px solid #ccc;
  resize: none; /* empêche le resize manuel */
  overflow-y: auto; /* scroll si trop de texte */
}

/* Bouton envoyer */
.chat-send {
  flex-shrink: 0;
  padding: 5px 10px;
  background: #06f17c;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: white;
}

/* Bouton emoji */
.emoji-toggle {
  background: #eee;
  border: none;
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;

  flex-shrink: 0;
}

.emoji-picker {
  position: absolute;
  bottom: 45px;
  left: 10px;
  width: 260px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 30px 10px 10px; /* espace pour la croix */
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  max-height: 200px;
  overflow-y: auto;
  opacity: 1;
  z-index: 2000;
}

.emoji-picker.hidden {
  opacity: 0;
  pointer-events: none;
}

.emoji-close {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #ff4d4d;
  border: none;
  color: white;

  border-radius: 50%;
  cursor: pointer;
}

/* Boutons emoji */

.emoji {
  font-size: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.emoji:hover {
  transform: scale(1.3);
}

/* Bulles */

.chat-bubble {
  background: #e0e0e0;
  border-radius: 15px;
  padding: 8px 12px;
  margin-bottom: 8px;
  position: relative;
  max-width: 80%;
  font-size: 14px;
  animation: ping 0.3s ease-in-out;
}

.chat-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 10px;
  border-width: 6px;
  border-style: solid;
  border-color: #e0e0e0 transparent transparent transparent;
}

.hidden {
  display: none !important;
}

#login-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.login-box {
  background: #fff;
  color: #1f1f1f;
  padding: 20px;
  border-radius: 8px;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes ping {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#debug-panel {
  background: #222;
  color: #0f0;
  font-family: monospace;
  padding: 1em;
  margin-top: 1em;
  border: 2px dashed lime;
}

@media (max-width: 700px) {
  .arena {
    height: 55vh;
    min-height: 320px;
  }
}
