/* =========================
   ESTILOS GENERALES
========================= */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 10px;
  background-color: #121212;
  color: white;
}

/* =========================
   CONTENEDOR PRINCIPAL
========================= */
.game-container {
  text-align: center;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================
   BOTONES SUPERIORES
========================= */
.buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  width: 100%;
}

#reset,
#fullscreen-button,
#difficulty {
  padding: 10px 16px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
}

#reset {
  background-color: #00eaff;
  color: white;
}

#reset:hover {
  background-color: #00b3d4;
}

#fullscreen-button {
  background-color: #FFD700;
  color: black;
}

#fullscreen-button:hover {
  background-color: #FFC700;
}

#difficulty {
  background: #2a2a2a;
  color: white;
}

/* =========================
   TABLERO
========================= */
.checkers-board {
  display: grid;
  grid-template-columns: repeat(8, 60px);
  grid-template-rows: repeat(8, 60px);
  gap: 0;
  margin: 20px auto;
  border: 4px solid #444;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.cell {
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.cell.dark {
  background-color: #769656;
}

.cell.light {
  background-color: #eeeed2;
}

/* =========================
   PIEZAS
========================= */
.piece {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  position: relative;
  z-index: 1;
}

.piece.white {
  background-color: #ffffff;
  border: 2px solid #000;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.4);
}

.piece.black {
  background-color: #000000;
  border: 2px solid #555;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.piece.king::after {
  content: '♔';
  color: gold;
  font-size: 22px;
  font-weight: bold;
  line-height: 50px;
  text-align: center;
  display: block;
}

/* =========================
   MOVIMIENTOS POSIBLES
========================= */
.possible-move {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: rgba(0, 255, 0, 0.55);
  border-radius: 50%;
  z-index: 0;
}

/* =========================
   ESTADO DEL JUEGO
========================= */
.status {
  font-size: 24px;
  margin: 20px 0;
  font-weight: bold;
  text-align: center;
}

/* =========================
   CONTROLES MÓVILES
========================= */
.mobile-controls {
  display: none;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
}

.mobile-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mobile-controls button {
  width: 70px;
  height: 70px;
  border: none;
  border-radius: 15px;
  font-size: 30px;
  font-weight: bold;
  background: linear-gradient(145deg, #00eaff, #0088cc);
  color: white;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.mobile-controls button:active {
  transform: scale(0.95);
}

/* =========================
   PANTALLA COMPLETA
========================= */
#game-container:-webkit-full-screen,
#game-container:-moz-full-screen,
#game-container:-ms-fullscreen,
#game-container:fullscreen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
}

/* =========================
   RESPONSIVE PARA MÓVILES
========================= */
@media (max-width: 768px) {
  body {
    padding: 5px;
    align-items: flex-start;
  }

  .game-container {
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 10px;
  }

  .buttons-container {
    flex-direction: column;
    align-items: center;
  }

  #reset,
  #fullscreen-button,
  #difficulty {
    width: 90%;
    max-width: 300px;
    font-size: 16px;
  }

  /* Tablero adaptado */
  .checkers-board {
    width: min(96vw, 480px);
    height: min(96vw, 480px);
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
  }

  .cell {
    width: 100%;
    height: 100%;
  }

  .piece {
    width: 80%;
    height: 80%;
  }

  .piece.king::after {
    font-size: 5vw;
    line-height: calc(min(96vw, 480px) / 8 * 0.8);
  }

  .possible-move {
    width: 28%;
    height: 28%;
  }

  .status {
    font-size: 20px;
    margin: 15px 0;
  }

  /* Mostrar controles táctiles */
  .mobile-controls {
    display: block;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  .status {
    font-size: 18px;
  }

  .mobile-controls button {
    width: 60px;
    height: 60px;
    font-size: 26px;
  }
}