* {
  box-sizing: border-box;
}

body {
  --cellWidth: 20px;
  --cellHeight: 20px;

  background-image: url(./assets/images/bg.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  height: 100%;
  font-family: "Noto Sans JP", sans-serif;
}

.info {
  margin: 0px auto;
  width: max-content;
  border-radius: 5px;
  border-bottom-left-radius: 0px;
  border-bottom-right-radius: 0px;
}

.scores {
  color: rgb(240, 240, 243);
  text-align: center;
  display: flex;
  justify-content: center;
}

.score {
  text-align: center;
  margin: 10px 20px;
  width: fit-content;
  font-size: 1.1rem;
  display: flex;
}

.score-number,
.high-score-number {
  margin: 0 8px;
}

.controls {
  display: flex;
  justify-content: space-between;
}

button {
  height: 2rem;
  width: 6rem;
  background-color: #007bff;
  border: none;
  outline: none;
  color: #ffffff;
  border-radius: 5px;
  padding: 10px;
  padding-bottom: 30px;
  font-size: 89.9%;
}

button:hover:enabled {
  border-color: #007bff;
  background-color: #fff;
  color: #007bff;
}

button:disabled {
  color: #887474;
  background-color: #111f6a;
  border-color: #111f6a;
}

.material-icons.hidden {
  display: none;
}

.btn-start {
  margin-right: 0px;
}

.btn-newGame,
.btn-audio,
.btn-bgm {
  margin-left: 0px;
  vertical-align: bottom;
}

.game-board {
  position: relative;
}

.board {
  width: calc(var(--cellWidth) * 20.1);
  height: calc(var(--cellHeight) * 15);
  margin: 0px auto;
  border: 1px solid rgb(0, 0, 0);
  border-right: none;
  border-top: none;
}

.info {
  width: calc(var(--cellWidth) * 20.05);
}

.cell {
  float: left;
  background-color: rgb(21, 112, 85);
  width: var(--cellWidth);
  height: var(--cellHeight);
  margin: 0;
  padding: 0;
  border: 1px solid rgb(0, 0, 0);
  border-left: none;
  border-bottom: none;
}

.snake-head__first-position,
.snake-head__second-position {
  background-color: rgb(222, 177, 51);
}

.snake-head__first-position::before {
  content: "";
  background-color: yellow;
  border: solid 1px black;
  border-radius: 50%;
  position: relative;
  width: 5px;
  height: 5px;
  display: block;
  top: calc(75% - 5px);
  left: calc(75% - 5px);
}

.snake-head__first-position::after {
  content: "";
  background-color: yellow;
  border: solid 1px black;
  border-radius: 50%;
  position: relative;
  width: 5px;
  height: 5px;
  top: calc(25% - 10px);
  left: calc(75% - 5px);
  display: block;
}

.snake-head__second-position::before {
  content: "";
  background-color: yellow;
  border: solid 1px black;
  border-radius: 50%;
  position: relative;
  width: 5px;
  height: 5px;
  display: block;
  top: calc(25% - 5px);
  left: calc(25% - 2px);
}

.snake-head__second-position::after {
  content: "";
  background-color: yellow;
  border: solid 1px black;
  border-radius: 50%;
  position: relative;
  width: 5px;
  height: 5px;
  top: calc(25% - 12px);
  left: calc(75% - 5px);
  display: block;
}

.hasSnake {
  background-color: rgb(247, 36, 36);
}

.hasSnakeHead {
  background-color: rgb(222, 177, 51);
}

.food {
  background-color: rgb(139, 0, 139);
  border: solid 2px gold;
  animation: change-background 1s forwards;
}

#game-over {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-left: auto;
  margin-right: auto;
  font-size: 4rem;
  letter-spacing: 3px;
  color: rgb(224, 223, 233);
  font-weight: 900;
  animation: blinking 1.2s forwards;
  display: none;
  text-align: center;
  z-index: 1000;
}

.restart-msg {
  display: block;
  font-size: 1.2rem;
  font-weight: 400;
  margin: 0;
}

.desc {
  color: white;
  margin: 0;
  margin-left: 2rem;
  opacity: 0;
}

.hard {
  text-align: center;
  color: white;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-box {
  position: relative;
  display: inline-block;
  height: 1.6rem;
}

.switch {
  background-color: #887474;
  display: inline-block;
  width: 4rem;
  height: 100%;
}

#switch__checkbox {
  opacity: 0;
}

.slider {
  position: absolute;
  background-color: rgb(247, 240, 240);
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  margin-left: 27px;
  width: 30%;
  height: 80%;
  transform: translateX(0%);
  transition: all 0.2s;
}

#switch__checkbox:checked ~ .switch > .slider {
  margin: auto;
  transform: translateX(100%);
}

#switch__checkbox:checked ~ .switch {
  background-color: #007bff;
}

@keyframes change-background {
  0% {
    background-color: rgb(238, 105, 238);
  }
  50% {
    background-color: rgb(212, 25, 212);
  }
  100% {
    background-color: rgb(139, 0, 139);
  }
}

@keyframes blinking {
  0%,
  30%,
  60%,
  100% {
    opacity: 1;
  }
  15%,
  45%,
  75% {
    opacity: 0;
  }
}

@media only screen and (max-width: 500px) {
  .snake-head__second-position::before {
    top: 7px;
    left: 2px;
  }
  .snake-head__second-position::after {
    top: 0px;
    left: 11px;
  }
  .snake-head__first-position::before {
    top: 11px;
    left: 8px;
  }
  .snake-head__first-position::after {
    top: -5px;
    left: 8px;
  }
}
