/* Navbar styles */
.navbar {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: linear-gradient(90deg, #4f8cff 0%, #38f9d7 100%);
  padding: 4px 16px 4px 0;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-btn {
  background: #fff;
  color: #4f8cff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.12);
  transition: background 0.2s, color 0.2s, transform 0.1s;
  outline: none;
  letter-spacing: 1px;
}
.nav-btn:hover {
  background: #4f8cff;
  color: #fff;
  transform: translateY(-2px) scale(1.05);
}

/* Game boundary styling */
#boundary {
  position: relative;
  width: 700px;
  height: 700px;
  margin: 40px auto 20px auto;
  background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
  border: 4px solid #4f8cff;
  border-radius: 24px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
  overflow: hidden;
}

/* Snake segment styling */
.snake-segment {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(67, 233, 123, 0.3);
  border: 2px solid #1de9b6;
  transition: box-shadow 0.2s;
  animation: snakePulse 0.7s infinite alternate;
}

@keyframes snakePulse {
  0% { box-shadow: 0 2px 8px rgba(67, 233, 123, 0.3); }
  100% { box-shadow: 0 4px 16px rgba(67, 233, 123, 0.5); }
}

/* Food styling */
#food {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 30% 30%, #ffb347 60%, #ffcc33 100%);
  border-radius: 50%;
  box-shadow: 0 2px 12px 0 rgba(255, 204, 51, 0.4);
  border: 2px solid #ff9800;
  animation: foodBounce 0.8s infinite alternate;
}

@keyframes foodBounce {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

/* Score display styling */
#score {
  display: block;
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  color: #4f8cff;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px #b3c6ff;
  letter-spacing: 2px;
}

/* Controls container beside the boundary */
.controls-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  margin-top: 45px;
  margin-left: 80px;
  gap: 18px;
  height: 700px;
}

/* Layout for game and controls */
.game-layout {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  margin-top: 0;
  width: 100%;
}

.game-layout > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Style all control buttons consistently */
#keys, #pause, #restart, #mouse {
  background: linear-gradient(90deg, #4f8cff 0%, #38f9d7 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.2);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  outline: none;
  letter-spacing: 1px;
}
#keys:hover, #pause:hover, #restart:hover, #mouse:hover {
  background: linear-gradient(90deg, #38f9d7 0%, #4f8cff 100%);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.25);
}
#mouse {
  background: linear-gradient(90deg, #ffb347 0%, #ffcc33 100%);
  color: #333;
  border: 2px solid #ff9800;
  box-shadow: 0 2px 12px 0 rgba(255, 204, 51, 0.18);
}
#mouse:hover {
  background: linear-gradient(90deg, #ffcc33 0%, #ffb347 100%);
  color: #222;
  border-color: #ffb347;
}

body {
  background: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
  min-height: 100vh;
  font-family: 'Segoe UI', 'Arial', sans-serif;
}

h1 {
  text-align: center;
  margin-top: 32px;
  margin-bottom: 12px;
  font-size: 2.7rem;
  font-weight: 800;
  color: #4f8cff;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px #b3c6ff;
}

.rules {
  font-size: 1.2rem;
  font-weight: 400;
  color: #020f28;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px #b3c6ff;
  text-align: left;
  margin-top: 18px;
  max-width: 700px;
}