* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game-wrapper {
  max-width: 500px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 24px;
  color: #4a5568;
  margin-bottom: 15px;
  letter-spacing: 2px;
}

.score-board {
  display: flex;
  justify-content: space-around;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-radius: 20px;
  padding: 15px;
  color: white;
}

.score {
  text-align: center;
}

.score .label {
  font-size: 14px;
  opacity: 0.9;
  display: block;
  margin-bottom: 5px;
}

.score .value {
  font-size: 32px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

#game-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  padding: 10px;
}

.game-canvas {
  width: 100%;
  max-width: 400px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.controls-panel {
  margin-bottom: 20px;
}

.direction-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 15px;
}

.middle-row {
  display: flex;
  gap: 15px;
  margin: 10px 0;
}

.dir-btn {
  width: 70px;
  height: 70px;
  border: none;
  background: linear-gradient(145deg, #f0f0f0, #d9d9d9);
  border-radius: 20px;
  box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.dir-btn:active {
  box-shadow: inset 5px 5px 10px #bebebe, inset -5px -5px 10px #ffffff;
  transform: scale(0.95);
}

.arrow {
  border: solid #4a5568;
  border-width: 0 6px 6px 0;
  display: inline-block;
  padding: 8px;
}

.arrow.up {
  transform: rotate(-135deg);
}

.arrow.down {
  transform: rotate(45deg);
}

.arrow.left {
  transform: rotate(135deg);
}

.arrow.right {
  transform: rotate(-45deg);
}

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.action-btn {
  padding: 12px 25px;
  border: none;
  border-radius: 15px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn.pause {
  background: linear-gradient(135deg, #ffd166, #f9a826);
  color: white;
  box-shadow: 0 5px 15px rgba(249, 168, 38, 0.3);
}

.action-btn.reset {
  background: linear-gradient(135deg, #ef476f, #d62828);
  color: white;
  box-shadow: 0 5px 15px rgba(239, 71, 111, 0.3);
}

.action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.settings {
  background: #f8f9fa;
  border-radius: 20px;
  padding: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-between;
  align-items: center;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a5568;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Range Slider */
input[type=range] {
  width: 120px;
  height: 5px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 5px;
  outline: none;
  -webkit-appearance: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  border: 2px solid #667eea;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 30px;
  text-align: center;
  max-width: 300px;
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal h2 {
  color: #4a5568;
  margin-bottom: 15px;
}

.modal p {
  color: #666;
  margin-bottom: 10px;
  font-size: 18px;
}

.modal-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 15px;
  font-size: 18px;
  font-weight: 600;
  margin-top: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Animations */
@keyframes eatFruit {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.fruit-eaten {
  animation: eatFruit 0.3s ease;
}

/* Responsive */
@media (max-width: 480px) {
  .game-wrapper {
    padding: 10px;
  }
  
  .dir-btn {
    width: 60px;
    height: 60px;
  }
  
  .settings {
    flex-direction: column;
    align-items: stretch;
  }
  
  .setting-item {
    justify-content: space-between;
  }
}