/* Fond général et ambiance */
body {
  margin: 0;
  font-family: 'Georgia', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url('solitarius2.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #e0e0f0;
  text-shadow: 1px 1px 2px #000;
}

/* Zone d'information */
#counter {
  margin-top: 20px;
  margin-bottom: 15px;
  font-size: 1.4em;
  font-weight: bold;
  color: #ffdca8;
  text-shadow: 1px 1px 2px #000;
}

/* Plateau */
.board {
  display: grid;
  grid-template-columns: repeat(7, 60px);
  grid-template-rows: repeat(7, 60px);
  gap: 5px;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 15px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  margin-top: 10px;
  backdrop-filter: blur(4px);
}

/* Case générique */
.cell {
  width: 60px;
  height: 60px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Cellules vides */
.cell[data-type="empty"] {
  background-color: transparent;
}

/* Cellules fissurées */
.cell[data-type="block"] {
  background-color: transparent;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.1);
}

.cell[data-type="block"]::before {
  content: '⛔'; /* ou '💥', '⛔', etc.🪨 */
  font-size: 28px;
  color: #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}


.bonus-cell {
  border: 2px dashed #7fffd4 !important; /* lueur alchimique */
}
.cell.selected {
  outline: 3px solid #c084fc; /* violet mystique */
}

/* Animation de pulsation */
@keyframes pulse {
  0%, 100% { outline-color: #ff6688; }
  50% { outline-color: #ffc0cb; }
}

/* Bille générique */
.ball {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 26px;
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
  text-shadow: 1px 1px 2px #000;
}

.ball:hover {
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

/* Mouvement */
.ball.move {
  transition: transform 0.4s ease-in-out;
  z-index: 10;
  position: absolute;
}

/* Animation disparition */
@keyframes pop {
  0%   { transform: scale(1) rotate(0); opacity: 1; }
  50%  { transform: scale(1.5) rotate(20deg); opacity: 0.7; }
  100% { transform: scale(0) rotate(45deg); opacity: 0; }
}
.ball.pop {
  animation: pop 0.5s forwards;
}

/* Couleurs pastel douces */
.cell[data-type^="pastel"] {
  background-color: transparent;
}
.ball.pastel0,
.ball.pastel1,
.ball.pastel2,
.ball.pastel3,
.ball.pastel4,
.ball.pastel5 {
  background-color: rgba(255, 255, 255, 0.08); /* tous identiques, subtilement lumineux */
}

/* Icône portée par le CSS */
.ball::before {
  content: '';
  font-size: 26px;
  line-height: 1;
}


.ball.pastel0::before { content: '🎼'; }  /* Boîte à musique */


/* Composants alchimiques */
.ball.pastel1::before { content: '🔴'; } /* Pierre rouge (Soufre) */
.ball.pastel2::before { content: '🔵'; } /* Perle bleue (Mercure) */
.ball.pastel3::before { content: '⚪'; } /* Orbe blanche (Sel) */
.ball.pastel4::before { content: '⚫'; } /* Obsidienne noire (Ténèbres) */
.ball.pastel5::before { content: '🟢'; } /* Orbe verte (Éther) */


.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: 10px;
  font-size: 20px;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 500px;
  background-color: rgba(30, 30, 30, 0.95);
  color: #f0f0ff;
  text-align: left;
  border-radius: 8px;
  padding: 10px;
  position: absolute;
  z-index: 10;
  top: 120%; /* ✅ affiche la bulle en dessous de l'icône */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  font-size: 0.85em;
  line-height: 1.4;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}



/* ----------- Responsive design ----------- */

/* Adapter le plateau (board) à la taille de l'écran */
@media (max-width: 600px) {
  .board {
    grid-template-columns: repeat(7, 40px);
    grid-template-rows: repeat(7, 40px);
    padding: 10px;
    gap: 4px;
  }

  .cell {
    width: 40px;
    height: 40px;
  }

  .ball {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .ball::before {
    font-size: 20px;
  }

  #counter {
    font-size: 1.1em;
  }

  #controls button {
    font-size: 0.85em;
    padding: 6px 10px;
    margin: 4px;
  }

  .tooltip .tooltiptext {
    width: 90vw;
    font-size: 0.8em;
    top: 110%;
  }
}

/* Centrage horizontal des boutons */
#controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
}

/* Rendre les boutons plus tactiles */
#controls button {
  padding: 8px 14px;
  font-size: 1em;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid #888;
  color: #f0f0ff;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background-color 0.3s ease;
}

#controls button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Accessibilité tactile pour tooltip */
@media (hover: none) {
  .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
  }
}

/* Ajout de sécurité : empêcher la bulle de sortir de l'écran */
.tooltip .tooltiptext {
  max-width: 90vw;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#celebration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,215,0,0.5) 0%, transparent 70%);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

#celebration.active {
  opacity: 1;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0% { opacity: 0.8; }
  50% { opacity: 0.3; }
  100% { opacity: 0.8; }
}
#celebration #victory-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 5px black;
  animation: zoomIn 1s ease;
}

@keyframes zoomIn {
  0% { transform: scale(0.5) translate(-50%, -50%); opacity: 0; }
  50% { transform: scale(1.1) translate(-50%, -50%); opacity: 1; }
  100% { transform: scale(1) translate(-50%, -50%); }
}
#autoPlay {
display: none;
}