/* Sudoku Game specific styles */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
  background: linear-gradient(135deg, #2d3748, #4a5568);
  padding: 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 8px 32px rgba(45, 55, 72, 0.3);
}

.score-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.score-box {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  min-width: 70px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

.score-box:nth-child(1) { animation-delay: 0s; }
.score-box:nth-child(2) { animation-delay: 0.5s; }
.score-box:nth-child(3) { animation-delay: 1s; }
.score-box:nth-child(4) { animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.score-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.score-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.game-controls .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:active {
  transform: translateY(0);
}

.difficulty-select {
  padding: 8px 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 14px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.difficulty-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.difficulty-select option {
  background: #4a5568;
  color: white;
}

.game-container {
  position: relative;
  margin: 0 auto;
  max-width: 500px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 3px solid rgba(45, 55, 72, 0.2);
}

.game-container::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, transparent, rgba(45, 55, 72, 0.2), transparent);
  border-radius: 15px;
  animation: borderGlow 3s linear infinite;
  z-index: -1;
}

@keyframes borderGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  background: #2d3748;
  border: 3px solid #2d3748;
  border-radius: 8px;
  padding: 3px;
  margin: 0 auto;
  max-width: 450px;
  aspect-ratio: 1;
}

.sudoku-cell {
  background: #fff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sudoku-cell:hover {
  background: #f7fafc;
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sudoku-cell.given {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
  color: #2d3748;
  cursor: default;
  font-weight: 700;
}

.sudoku-cell.given:hover {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
  transform: none;
  box-shadow: none;
}

.sudoku-cell.selected {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
}

.sudoku-cell.highlighted {
  background: linear-gradient(135deg, #fed7d7, #feb2b2);
}

.sudoku-cell.error {
  background: linear-gradient(135deg, #fc8181, #f56565);
  color: white;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.sudoku-cell.hint {
  background: linear-gradient(135deg, #faf089, #f6e05e);
  animation: hintPulse 1s ease-in-out 3;
}

@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 15px rgba(246, 224, 94, 0.6); }
}

/* 3x3宫格边框 */
.sudoku-cell:nth-child(3n) {
  border-right: 2px solid #2d3748;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid #2d3748;
}

.game-status {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin: 20px 0;
  padding: 15px;
  background: rgba(45, 55, 72, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(45, 55, 72, 0.2);
}

.number-pad {
  margin-top: 20px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 16px;
}

.number-pad-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  font-size: 16px;
  text-align: center;
}

.number-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 300px;
  margin: 0 auto;
}

.number-btn {
  aspect-ratio: 1;
  border: 2px solid #2d3748;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #f8f9fa);
  color: #2d3748;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-btn:hover {
  background: linear-gradient(135deg, #2d3748, #4a5568);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 55, 72, 0.3);
}

.number-btn:active {
  transform: translateY(0);
}

.number-btn.selected {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
  border-color: #3182ce;
}

.erase-btn {
  background: linear-gradient(135deg, #fc8181, #f56565);
  color: white;
  border-color: #f56565;
}

.erase-btn:hover {
  background: linear-gradient(135deg, #f56565, #e53e3e);
  border-color: #e53e3e;
}

.game-instructions {
  margin-top: 20px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 16px;
}

.instruction-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  font-size: 16px;
}

.instruction-content p {
  margin: 8px 0;
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
}

.instruction-content strong {
  color: #495057;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 20px 0;
  text-align: center;
}

.modal-header h3 {
  margin: 0;
  color: #495057;
  font-size: 20px;
}

.modal-body {
  padding: 20px;
  text-align: center;
}

.modal-body p {
  margin: 0 0 15px;
  color: #6c757d;
}

.final-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
}

.stat-item span:last-child {
  color: #2d3748;
}

.new-record {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b7500;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Responsive design */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .score-container {
    justify-content: center;
  }
  
  .game-controls {
    justify-content: center;
  }
  
  .sudoku-board {
    max-width: 350px;
  }
  
  .sudoku-cell {
    font-size: 16px;
  }
  
  .number-buttons {
    grid-template-columns: repeat(5, 1fr);
    max-width: 250px;
  }
  
  .number-btn {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .score-container {
    gap: 8px;
  }
  
  .score-box {
    min-width: 60px;
    padding: 8px 12px;
  }
  
  .score-label {
    font-size: 11px;
  }
  
  .score-value {
    font-size: 16px;
  }
  
  .sudoku-board {
    max-width: 300px;
  }
  
  .sudoku-cell {
    font-size: 14px;
  }
  
  .number-buttons {
    max-width: 200px;
  }
  
  .number-btn {
    font-size: 14px;
  }
  
  .game-container {
    padding: 15px;
  }
}