	* {
	  user-select: none;
	  -webkit-user-select: none; /* Pour Safari */
	  -ms-user-select: none;     /* Pour IE/Edge */
	}


body {
      font-family: 'Poppins', sans-serif;
      background: linear-gradient(to bottom, #ffe6ff, #e6f2ff);
      flex-direction: column;
      align-items: center;
      margin: 0;
      padding: 20px 0;
      color: #333;
    }
	
	.container {
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  justify-content: center;
	  width: 100%;
	  max-width: 100%;
	  margin: 0 auto;
	  text-align: center;
	}	

    h1 {
      color: #ff3399;
      text-shadow: 1px 1px 2px white;
    }
	
    #board {
      display: grid;
      gap: 5px;
      background: transparent;
	  margin: 20px auto 0 auto; /* haut auto bas auto */
      padding: 10px;
    }	

    .cell {
      background: white;
      border-radius: 0;
	  width: 100%;
      aspect-ratio: 1 / 1; /* carré automatique */
      box-shadow: 0 2px 6px rgba(0,0,0,0.2);
      display: flex;
      justify-content: center;
      align-items: center;
      font-weight: bold;
      cursor: pointer;
      user-select: none;
      transition: transform 0.15s ease, box-shadow 0.2s ease;
	  user-drag: none;
	  -webkit-user-drag: none;
    }

    .cell:hover {
      transform: scale(1.05);
      box-shadow: 0 0 10px rgba(255, 0, 200, 0.2);
    }

    .place-effect {
      animation: popQueen 0.2s ease-out;
    }
	
	#fireworks {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10001; /* bien au-dessus de #victoryOverlay */
}


    .remove-effect {
      animation: fadeOut 0.2s ease-in;
    }

    .conflict {
      background-color: #ff4d4d !important;
      color: white;
    }

    .solution {
      background-color: #ccccff !important;
      color: #333;
    }

    .victory {
      animation: celebrate 0.5s ease-in-out 3;
    }

    @keyframes popQueen {
      0% { transform: scale(0.4); opacity: 0; }
      80% { transform: scale(1.1); opacity: 1; }
      100% { transform: scale(1); }
    }

    @keyframes fadeOut {
      0% { transform: scale(1); opacity: 1; }
      100% { transform: scale(0.5); opacity: 0; }
    }
		
	@keyframes fadeSweep {
	  0% {
		opacity: 1;
		transform: scale(1);
		filter: brightness(1);
	  }
	  100% {
		opacity: 0;
		transform: scale(0.7);
		filter: brightness(2);
	  }
	}

	.sweep-clear {
	  animation: fadeSweep 0.3s ease-out forwards;
	}




    @keyframes celebrate {
      0% { transform: scale(1); background-color: #ffcc00; }
      50% { transform: scale(1.2); background-color: #66ff66; }
      100% { transform: scale(1); background-color: #ffcc00; }
    }
	
	.small-x {
    font-size: 20px;
    color: #666;
    }


    #victoryOverlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.4s ease;
    }

    #victoryOverlay.show {
      opacity: 1;
      pointer-events: auto;
    }

    #victoryMessage {
      position: relative;
      background: linear-gradient(to bottom right, #ff66cc, #ff99cc);
      color: white;
      padding: 30px 40px;
      border-radius: 16px;
      font-size: 24px;
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
      text-align: center;
      max-width: 300px;
    }

    #victoryMessage .close-btn {
      position: absolute;
      top: 10px;
      right: 14px;
      font-size: 22px;
      cursor: pointer;
      color: white;
    }

    #victoryMessage button {
      margin-top: 20px;
      font-size: 18px;
      padding: 10px 18px;
      border: none;
      border-radius: 8px;
      background: white;
      color: #ff3399;
      font-weight: bold;
      cursor: pointer;
      transition: background 0.2s ease;
    }

    #victoryMessage button:hover {
      background: #ffeeff;
    }

    #timerDisplay {
      margin-top: 15px;
      font-size: 18px;
      color: #444;
    }

    /* Régions colorées */
    .region-0 { background-color: #33A8C7; }
    .region-1 { background-color: #52E3E1; }
    .region-2 { background-color: #A0E426; }
    .region-3 { background-color: #FDF148; }
    .region-4 { background-color: #FFAB00; }
    .region-5 { background-color: #F77976; }
    .region-6 { background-color: #F050AE; }
    .region-7 { background-color: #D883FF; }
    .region-8 { background-color: #9336FD; }
    .region-9 { background-color: #09F04A; }

    select, button {
      font-size: 16px;
      padding: 6px 12px;
      margin: 5px;
      border-radius: 6px;
      border: none;
      background-color: #fff0f5;
      cursor: pointer;
    }

    select:focus, button:focus {
      outline: none;
      box-shadow: 0 0 3px #ff66cc;
    }
	
	.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.control-bar label,
.control-bar select,
.control-bar button {
  margin: 0;
}

.auto-cross-label {
  display: flex;
  align-items: center;
  gap: 5px;
}




/* Responsive */

/* Smartphone (max-width: 767px) */
@media screen and (max-width: 767px) {
  body {
    align-items: stretch; /* le contenu prendra toute la largeur possible */    
	padding: 10px;
    font-size: 14px;
  }
  h1 {
    font-size: 1.5rem;
  }
  #board {
    max-width: 100%; /* ou max-width: 100%; */
    gap: 3px;
    padding: 5px;
  }
    /* Adapter .board dynamiquement  */

  #board.size-6 { grid-template-columns: repeat(6, 50px); }
  #board.size-7 { grid-template-columns: repeat(7, 45px); }
  #board.size-8 { grid-template-columns: repeat(8, 40px); }
  #board.size-9 { grid-template-columns: repeat(9, 35px); }
  
  /* Adapter .cell dynamiquement selon .board.size */
  #board.size-6 .cell { width: 50px; height: 50px; font-size: 20px; }
  #board.size-7 .cell { width: 45px; height: 45px; font-size: 18px; }
  #board.size-8 .cell { width: 40px; height: 40px; font-size: 17px; }
  #board.size-9 .cell { width: 35px; height: 35px; font-size: 16px; }
  
  select, button {
    font-size: 14px;
    padding: 5px 10px;
  }
  #timerDisplay {
    font-size: 14px;
  }
  #victoryMessage {
    font-size: 18px;
    padding: 20px 25px;
    max-width: 90vw;
  }
}

/* Tablet (min-width: 767px and max-width: 1023px) */
@media screen and (min-width: 767px) and (max-width: 1023px) {
  body {
    align-items: stretch; /* le contenu prendra toute la largeur possible */    	  
    font-size: 15px;
  }
  h1 {
    font-size: 1.75rem;
  }
  #board {
    max-width: 100%; /* ou max-width: 100%; */	  
    gap: 5px;
    padding: 8px;
  }
  #board.size-6 { grid-template-columns: repeat(6, 70px); }
  #board.size-7 { grid-template-columns: repeat(7, 70px); }
  #board.size-8 { grid-template-columns: repeat(8, 70px); }
  #board.size-9 { grid-template-columns: repeat(9, 70px); }
  /* Adapter .cell dynamiquement selon .board.size */
  #board.size-6 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-7 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-8 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-9 .cell { width: 70px; height: 70px; font-size: 28px; }
  
  select, button {
    font-size: 15px;
    padding: 6px 11px;
  }
  #timerDisplay {
    font-size: 16px;
  }
  #victoryMessage {
    font-size: 20px;
    padding: 25px 30px;
    max-width: 80vw;
  }
}

/* Desktop (min-width: 1024px) */
@media screen and (min-width: 1024px) {
  body {
    display: flex;	  
    font-size: 16px;
  }
  h1 {
    font-size: 2rem;
  }
  #board {
    gap: 5px;
    padding: 10px;
	max-width:100%
  }
  #board.size-6 { grid-template-columns: repeat(6, 70px); }
  #board.size-7 { grid-template-columns: repeat(7, 70px); }
  #board.size-8 { grid-template-columns: repeat(8, 70px); }
  #board.size-9 { grid-template-columns: repeat(9, 70px); }
  /* Adapter .cell dynamiquement selon .board.size */
  #board.size-6 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-7 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-8 .cell { width: 70px; height: 70px; font-size: 28px; }
  #board.size-9 .cell { width: 70px; height: 70px; font-size: 28px; }
  
  select, button {
    font-size: 16px;
    padding: 6px 12px;
  }
  #timerDisplay {
    font-size: 18px;
  }
  #victoryMessage {
    font-size: 24px;
    padding: 30px 40px;
    max-width: 300px;
  }
}