/* Snake 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, #28a745, #20c997);
  padding: 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 8px 32px rgba(40, 167, 69, 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;
}

.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;
  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);
}

.game-container {
  position: relative;
  margin: 0 auto;
  width: 400px;
  height: 400px;
  border: 3px solid #28a745;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(40, 167, 69, 0.2);
  overflow: hidden;
}

#gameCanvas {
  background: linear-gradient(45deg, #fff 25%, transparent 25%), 
              linear-gradient(-45deg, #fff 25%, transparent 25%), 
              linear-gradient(45deg, transparent 75%, #fff 75%), 
              linear-gradient(-45deg, transparent 75%, #fff 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 600;
  color: #28a745;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #28a745;
  pointer-events: none;
}

.speed-control {
  margin: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.speed-label {
  font-weight: 600;
  color: #495057;
}

.speed-slider {
  width: 150px;
  height: 6px;
  border-radius: 3px;
  background: #e1e8ed;
  outline: none;
  -webkit-appearance: none;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #28a745;
  cursor: pointer;
}

.speed-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #28a745;
  cursor: pointer;
  border: none;
}

.speed-value {
  font-weight: 600;
  color: #28a745;
  min-width: 20px;
  text-align: center;
}

.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;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
}

.stat-item span:last-child {
  color: #28a745;
}

.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;
  }
  
  .game-container {
    width: 320px;
    height: 320px;
  }
  
  #gameCanvas {
    width: 300px;
    height: 300px;
  }
  
  .speed-control {
    flex-direction: column;
    gap: 10px;
  }
  
  .speed-slider {
    width: 200px;
  }
}

@media (max-width: 480px) {
  .game-container {
    width: 280px;
    height: 280px;
  }
  
  #gameCanvas {
    width: 260px;
    height: 260px;
  }
  
  .score-container {
    gap: 10px;
  }
  
  .score-box {
    min-width: 60px;
    padding: 8px 12px;
  }
  
  .score-label {
    font-size: 11px;
  }
  
  .score-value {
    font-size: 16px;
  }
}