* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e, #16213e);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5rem;
  background: linear-gradient(45deg, #64ffda, #3f51b5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(100, 255, 218, 0.3);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(45deg, #3f51b5, #2196f3);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(63, 81, 181, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(63, 81, 181, 0.4);
}

button:active {
  transform: translateY(0);
}

button.playing {
  background: linear-gradient(45deg, #e91e63, #f44336);
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

input[type="range"] {
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 100px;
}

input[type="range"]::-webkit-slider-track {
  background: rgba(100, 255, 218, 0.3);
  height: 4px;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: #64ffda;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

.grid-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

#gameCanvas {
  border: 2px solid rgba(100, 255, 218, 0.3);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  cursor: crosshair;
  box-shadow: 0 0 30px rgba(100, 255, 218, 0.2);
  transition: all 0.3s ease;
}

#gameCanvas:hover {
  border-color: rgba(100, 255, 218, 0.6);
  box-shadow: 0 0 40px rgba(100, 255, 218, 0.3);
}

.stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.stat {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px 25px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  text-align: center;
  min-width: 120px;
  border: 1px solid rgba(100, 255, 218, 0.2);
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #64ffda;
}

.patterns {
  margin-top: 30px;
  text-align: center;
}

.patterns h3 {
  margin-bottom: 15px;
  color: #64ffda;
}

.pattern-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pattern-btn {
  background: linear-gradient(45deg, #673ab7, #9c27b0);
  font-size: 14px;
  padding: 8px 16px;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  h1 {
    font-size: 2rem;
  }
  .controls {
    flex-direction: column;
    align-items: center;
  }
  #gameCanvas {
    max-width: 100%;
  }
}
