/* Simplified Speedoku Game Styles */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* Main container */
.speedoku-container {
  font-family: 'Roboto', sans-serif;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Grid section */
.speedoku-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  background-color: #333;
  padding: 3px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: min(90vw, 90vw, 350px);
  height: min(90vw, 90vw, 350px);
  aspect-ratio: 1;
}

.speedoku-cell {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  font-weight: bold;
  background-color: #f8f8f8;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

/* Cell states */
.speedoku-fixed {
  background-color: #e0e0e0;
  color: #333;
  cursor: not-allowed;
}

.speedoku-filled {
  background-color: #f0f9ff;
  color: #0284c7;
}

.speedoku-empty {
  background-color: #f8f8f8;
  color: #666;
}

.speedoku-selected {
  background-color: #bae6fd;
  box-shadow: 0 0 0 2px var(--main-color, #0284c7);
  transform: scale(1.05);
  z-index: 2;
}

/* Cell animations - enhanced */
.speedoku-cell.speedoku-correct-answer {
    animation: correctAnimation 0.5s ease forwards !important;
}
    
@keyframes correctAnimation {
  0% { transform: scale(1); background-color: #f8f8f8; }
  50% { transform: scale(1.1); background-color: #86efac; box-shadow: 0 0 12px rgba(16, 185, 129, 0.7); }
  100% { transform: scale(1); background-color: #f0f9ff; }
}

.speedoku-cell.speedoku-error {
    animation: errorAnimation 1s ease forwards !important;
}

@keyframes errorAnimation {
  0% { transform: scale(1); background-color: #f8f8f8; }
  20% { transform: scale(1.05) rotate(-2deg); background-color: #fecaca; }
  40% { transform: scale(1.05) rotate(2deg); background-color: #f87171; }
  60% { transform: scale(1.05) rotate(-2deg); background-color: #fecaca; }
  80% { transform: scale(1.05) rotate(2deg); background-color: #f87171; }
  100% { transform: scale(1); background-color: #f8f8f8; }
}

/* Error shake animation for the grid */
.speedoku-error-shake {
  animation: errorShake 0.5s ease;
}

@keyframes errorShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* Block styling */
.block-0-0,
.block-1-1 {
  background-color: #f0f9ff;
}

/* Grid animations */
.speedoku-grid-complete {
  animation: gridComplete 1s ease;
}

@keyframes gridComplete {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.2); box-shadow: 0 0 20px rgba(16, 185, 129, 0.7); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* Number pad */
.speedoku-number-pad {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(90vw, 350px);
}

.speedoku-number-button {
  width: 60px;
  height: 60px;
  font-size: 28px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background-color: var(--main-color, #0284c7);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.speedoku-number-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
}

.speedoku-number-button:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Responsive styling */
@media (max-height: 600px) {
  .speedoku-cell {
    font-size: 24px;
  }
  
  .speedoku-number-button {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
}

@media (max-height: 500px) {
  .speedoku-cell {
    font-size: 20px;
  }
  
  .speedoku-number-button {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
  
  .speedoku-container {
    gap: 15px;
  }
}