@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* * {
  border : 1px solid red;
} */

body {
  background-color: #212529;
  color: white;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  max-height: 100vh;
}

.game-title {
  animation: glowing 2s infinite;
}

#game-board {
  position: relative;
  width: 400px;
  height: 400px;
  border: 1px solid #454d55;
  background-color: #343a40;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#game-board::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 1;
}

.control-button {
  position: relative;
  width: 123px;
  height: 123px;
  margin: 0 auto;
  margin-top: 50px; /* Space above the control area */
}

.control-button .arrow {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #007bff;
  border: 0;
  cursor: pointer; /* Pointer cursor on hover */
  transition: background-color 0.3s ease;
}

/* Up Arrow */
.control-button .up {
  top: 0;
  left: 50%;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform: translateX(-50%);
}

/* Down Arrow */
.control-button .down {
  bottom: 0;
  left: 50%;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform: translateX(-50%) rotate(180deg);
}

/* Left Arrow */
.control-button .left {
  top: 50%;
  left: 0;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform: translateY(-50%) rotate(270deg);
}

/* Right Arrow */
.control-button .right {
  top: 50%;
  right: 0;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform: translateY(-50%) rotate(90deg);
}

.control-button .arrow:hover {
  background-color: #0056b3;
}

@media screen and (min-width: 767px) {
  .control-button {
    display: none;
  }
}
@media screen and (max-width: 768px) {
  .control-button {
    display: block;
    width: 200px;
    height: 200px;
  }
  
  .control-button .arrow {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #007bff;
    border: 0;
    cursor: pointer; /* Pointer cursor on hover */
  }
  
}

.moving-border {
  width: 400px;
  height: 400px;
  position: relative;
  background: #111;
  padding: 4px;
}

.moving-border::before,
.moving-border::after {
  content: "";
  position: absolute;
  inset: -0.2rem;
  z-index: -2;
  background: linear-gradient(var(--angle),
      #032146, #C3F2FF, #b00);
  animation: rotate 10s linear infinite;
}

.moving-border::after {
  filter: blur(10px);
}

@keyframes glow {
  0% {
    background: linear-gradient(145deg, #28a745, #218838);
  }
  50% {
    background: linear-gradient(145deg, #34c759, #28a745);
  }
  100% {
    background: linear-gradient(145deg, #28a745, #218838);
  }
}

@keyframes move {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}

.snake {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(145deg, #28a745, #218838);
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid #1e7e34;
  transition: background 0.3s ease, transform 0.3s ease;
  animation: glow 2s infinite alternate, move 1s infinite ease-in-out;
}

.snake:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.1) 10px,
    transparent 10px,
    transparent 20px
  );
  border-radius: 4px;
}

.snake:hover {
  transform: scale(1.1);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 0, 0.5);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 0, 0.5);
  }
}

.food {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #fefe0c, #f8e71c);
  border-radius: 50%;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  animation: pulse 1.5s infinite;
}


.score-board {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 1.5rem;
  color: #fff;
}

.start-menu,
.game-over-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: none;
  z-index: 2;
}

.start-menu button,
.game-over-menu button {
  margin-top: 10px;
}

@keyframes rotate {
  0% {
    --angle: 0deg;
  }

  100% {
    --angle: 360deg;
  }
}

@keyframes glowing {
  0%, 100% {
    color: #fff;
    text-shadow: 0 0 5px #ffffff,
      0 0 10px #ffffff,
      0 0 20px #ffffff,
      0 0 40px #ffffff;
  }
  
  50% {
    text-shadow: none;
    color: #fff;
  }
}
