:root {
  --primary-color: #6C63FF;
  --secondary-color: #FF6584;
  --accent-color: #43D9AD;
  --background-color: #2F2E41;
  --surface-color: #3F3D56;
  --text-color: #FFFFFF;
  --text-secondary: #B0B0B0;
  --success-color: #4CAF50;
  --error-color: #F44336;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #2F2E41 0%, #1F1D36 100%);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.main-container {
  width: 95%;
  max-width: 1100px;
  background-color: rgba(63, 61, 86, 0.9);
  backdrop-filter: blur(15px);
  border-radius: 25px;
  padding: 40px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
  width: 100%;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 30px;
}

h1 {
  font-size: 3.5rem;
  color: var(--primary-color);
  text-shadow: 0 4px 10px rgba(108, 99, 255, 0.5);
  margin-bottom: 25px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

.game-info {
  display: flex;
  gap: 40px;
  justify-content: center;
  width: 100%;
}

.stat-box {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  padding: 15px 40px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 180px;
  transition: transform 0.3s ease;
}

.stat-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4);
}

.stat-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 5px;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-color);
  text-shadow: 0 0 15px rgba(67, 217, 173, 0.4);
}

.game-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  width: 100%;
  flex-wrap: wrap;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
  min-width: 250px;
  max-width: 300px;
}

.guide-container {
  background: linear-gradient(145deg, rgba(63, 61, 86, 0.8), rgba(31, 29, 54, 0.8));
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
}

.guide-container h3 {
  margin-bottom: 15px;
  color: var(--text-color);
  font-size: 1.2rem;
  letter-spacing: 1px;
}

#image-guide {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 15px;
  border: 3px solid var(--accent-color);
  box-shadow: 0 5px 15px rgba(67, 217, 173, 0.3);
}

.controls-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

.difficulty-controls {
  width: 100%;
  text-align: center;
}

.difficulty-controls h3 {
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.difficulty-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.action-button {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  border: none;
  padding: 15px 30px;
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  box-shadow: 0 5px 15px rgba(108, 99, 255, 0.4);
}

.action-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(108, 99, 255, 0.6);
}

.action-button:active {
  transform: translateY(-1px);
}

.action-button.secondary {
  background: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  box-shadow: none;
}

.action-button.secondary:hover {
  background-color: rgba(67, 217, 173, 0.1);
  box-shadow: 0 0 15px rgba(67, 217, 173, 0.3);
}

.action-button.small {
  padding: 10px 15px;
  font-size: 0.9rem;
  min-width: auto;
}

.board-container {
  background-color: #1F1D36;
  padding: 15px;
  border-radius: 20px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6),
    0 10px 30px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

#tabla {
  border-collapse: separate;
  border-spacing: 5px;
}

.pieza {
  width: 110px;
  height: 110px;
  border: none;
  background-size: 440px 440px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.pieza:hover:not(.vacio) {
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(108, 99, 255, 0.6);
  z-index: 10;
  border: 2px solid var(--primary-color);
}

.vacio {
  background-image: none !important;
  background-color: rgba(255, 255, 255, 0.03);
  cursor: default;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 14, 23, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.modal-content {
  background: linear-gradient(135deg, var(--surface-color), #2F2E41);
  padding: 50px;
  border-radius: 30px;
  text-align: center;
  max-width: 550px;
  width: 90%;
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 50px rgba(108, 99, 255, 0.5);
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal h2 {
  color: var(--accent-color);
  margin-bottom: 15px;
  font-size: 2.5rem;
  text-shadow: 0 2px 10px rgba(67, 217, 173, 0.3);
}

.modal p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 15px;
}

.modal-stats p {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
}

.modal-stats span {
  color: var(--white);
  font-weight: 800;
  font-size: 2rem;
  color: var(--primary-color);
  margin-top: 5px;
}

.modal-image-container {
  margin: 25px 0;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 15px;
  border: 3px solid var(--secondary-color);
  box-shadow: 0 5px 20px rgba(255, 101, 132, 0.4);
}

.modal-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 30px;
}

@media (max-width: 768px) {
  .game-area {
    flex-direction: column-reverse;
    align-items: center;
    gap: 30px;
  }

  .pieza {
    width: 70px;
    height: 70px;
    background-size: 280px 280px;
  }

  h1 {
    font-size: 2rem;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .stat-box {
    padding: 10px 20px;
    min-width: 120px;
  }
}