:root {
  --block-width: 5px;
  --grey: #ccdddd;
  --blue: #4e82ff;
  --green: #00aa66;
  --deep-blue: #000066;
  --lime-green: #a6ff75;
  --red: #ff6699;
  --pink: #ff66cc;
  --purple: #9900ff;
  --orange: #ffcc00;
  --yellow: #ffee66;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(var(--blue), var(--lime-green));
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.grid-container {
  display: grid;
  gap: 1px;
}

.grid-item {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  color: var(--blue);
  border: 1px solid transparent;
  padding: 3px;
  width: var(--block-width);
  aspect-ratio: 1 / 1;
  font-family: courier;
  font-size: 10px;
}

.active {
  background-color: var(--red);
  color: var(--deep-blue);
}
.food {
  background-color: var(--blue);
  color: #fff;
}
.obstacle {
  background-color: white;
  opacity: 0.5;
}

/* ==== Game-over feedback (replaces the alert() pop-ups) ==== */
.container {
  position: relative;
}
.crash {
  background-color: var(--deep-blue);
  opacity: 1;
}
.shake {
  animation: shake 0.4s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .shake {
    animation: none;
  }
}
.message {
  position: absolute;
  margin: 0;
  padding: 12px 20px;
  max-width: 80vw;
  background: #fff;
  color: var(--deep-blue);
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.message[hidden] {
  display: none;
}
