:root {
  --snake-logo-anim-delay: 0.9s;
  --snake-logo-anim-time: 0.6s;

  --snake-title-anim-delay: 1.1s;
  --snake-title-anim-time: 0.6s;

  --user-wrapper-anim-delay: 1.5s;
  --user-wrapper-anim-time: 0.6s;

  --start-button-anim-delay: 1.8s;
  --start-button-anim-time: 0.6s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  font-family: "Roboto", sans-serif;
  font-weight: 300;
  background: #09ca96;
}

input,
button {
  font-family: inherit;
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: white;
  display: block;
}

.loading-screen-animation {
  animation: loading-screen-anim 1s 1 ease-in-out forwards;
}

@keyframes loading-screen-anim {
  to {
    transform: translateY(-100vh);
  }
}

#loading-screen-spinner-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: loading-screen-spinner-anim 0.5s infinite linear;
  overflow: hidden;
  background: rgb(0, 113, 83);
  background: linear-gradient(
    90deg,
    rgba(0, 113, 83, 1) 0%,
    rgba(9, 202, 150, 1) 100%
  );
  transition: opacity 0.6s ease-in-out;
}

.loading-screen-animation-spinner-hide {
  opacity: 0 !important;
}

#loading-screen-spinner {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes loading-screen-spinner-anim {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.game-container {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.game {
  width: 100%;
  height: 100dvh;
}

.game-cover {
  background: #09ca96;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.game-cover #start {
  margin-top: 35px;
  width: 120px;
  height: 40px;
  cursor: pointer;
  border-radius: 24px;
  outline: none;
  border: none;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--start-button-anim-time)
      var(--start-button-anim-delay) ease-in-out,
    transform var(--start-button-anim-time) var(--start-button-anim-delay)
      ease-in-out,
    background 150ms ease-in-out, color 150ms ease-in-out;
  background: #000;
  color: #fff;
}

.game-start-btn-anim {
  opacity: 1 !important;
  transform: translateY(0) !important;
  transition: all 0.2s ease-in-out;
}

.game-cover #start:hover {
  color: #000;
  background: #fff;
}

.game-screen {
  background: #232526;
  background: -webkit-linear-gradient(to right, #414345, #232526);
  background: linear-gradient(to right, #414345, #232526);
  position: relative;
  display: flex;
  flex-direction: column;
}

.game-screen #exit {
  cursor: pointer;
  outline: none;
  border: 1px solid red;
  background: red;
  color: white;
  width: 50px;
  height: 25px;
  font-size: 10px;
  font-weight: bold;
  border-radius: 5px;
}

.game #navbar {
  flex-shrink: 0;
  width: 95%;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game #navbar #score {
  display: flex;
  align-items: center;
  justify-content: left;
  flex: 1;
  min-width: 0;
}

.game #navbar #score img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  margin-right: 8px;
  transform: translateY(-2px);
}

.game #navbar #score span {
  font-weight: bold;
  font-size: 26px;
  color: #000;
  letter-spacing: 10px;
}

.game-cover .game-title {
  text-align: center;
  cursor: default;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.game-cover .game-title h4 {
  padding: 0;
  margin: 0;
  color: #000;
  font-size: 42px;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--snake-title-anim-time) var(--snake-title-anim-delay)
    ease-in-out;
  letter-spacing: 18px;
}

.game-cover .game-title img {
  height: 200px;
  object-fit: contain;
  transform-origin: center;
  transform: scale(1.5);
  opacity: 0;
  background: none;
  pointer-events: none;
  transition: opacity var(--snake-logo-anim-time) var(--snake-logo-anim-time)
      ease-in-out,
    transform var(--snake-logo-anim-time) var(--snake-logo-anim-time)
      ease-in-out;
}

.game-logo-anim {
  opacity: 1 !important;
  transform: scale(1) !important;
}

.game-title-anim {
  opacity: 1 !important;
}

#dialog-cover {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.902);
  display: none;
  z-index: 9;
}
.dialog-box {
  position: absolute;
  width: 95%;
  max-width: 500px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: 5px;
  overflow: hidden;
  display: none;
  padding: 12px 4px;
}

.dialog-box h4 {
  text-align: center;
  font-size: 14px;
  font-weight: 300;
  color: #000;
  letter-spacing: 1px;
}

#dialog-box-buttons {
  margin-top: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog-btn {
  width: 70px;
  height: 30px;
  outline: none;
  border-radius: 5px;
  border: 1px solid black;
  cursor: pointer;
  font-weight: 300;
  margin: 5px;
  font-size: 12px;
}

#confirm-btn {
  background-color: red;
  color: white;
  border: 2px solid red;
  transition: all 0.1s ease-in-out;
}

#confirm-btn:hover {
  color: red;
  background-color: white;
}

#cancel-btn {
  background-color: white;
  border: 2px solid #ffd200;
  color: #3b3b3b;
}

#cancel-btn:focus {
  border: 2px solid #00b6ff;
  background-color: #ffd200;
  color: white;
}

#warning img {
  height: 30px;
  margin-left: 10px;
  opacity: 0.8;
  object-fit: contain;
  transform: translateY(5px);
}

.dialog-content {
  display: flex;
  justify-content: center;
  align-items: baseline;
  overflow: hidden;
}

.player-wrapper {
  box-sizing: border-box;
  position: absolute;
  top: -10px;
  display: flex;
  width: 95%;
  height: 60px;
  left: 50%;
  transform: translate(-50%, 0);
  align-items: center;
  align-content: center;
  font-weight: bold;
  color: white;
  letter-spacing: 1px;
  cursor: default;
  justify-content: space-between;
  font-size: 14px;
  background: none;
  opacity: 0;
  transition: opacity var(--user-wrapper-anim-time)
      var(--user-wrapper-anim-delay) linear,
    top var(--user-wrapper-anim-time) var(--user-wrapper-anim-delay) linear;
}

.display-player-wrapper {
  opacity: 1 !important;
  top: 10px !important;
}

.current-user-name {
  color: #000;
  letter-spacing: 1px;
  font-size: 17px;
  font-weight: 400;
}

#current-user-score-title {
  font-size: 17px;
  color: #000;
  letter-spacing: 1px;
  font-weight: 400;
}

.player-wrapper .player-sub-wrapper span {
  margin-left: 5px;
  text-transform: capitalize;
}

.player-sub-wrapper {
  width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-wrapper #current-user-score {
  width: 37%;
  text-align: right;
  cursor: default;
  display: block;
}

#players {
  cursor: pointer;
  width: 36px;
  height: 36px;
  border: none;
  background-color: white;
  outline: none;
  border-radius: 50%;
  font-size: 14px;
  color: #000;
  transition: all 150ms ease-in-out;
}

#players:hover {
  background-color: #000;
  color: #fff;
}

.add-user {
  width: 85%;
  max-width: 450px;
  height: 80%;
  max-height: 410px;
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 45px 18px 18px 18px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.user-cover {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(41, 41, 41, 0.7);
  z-index: 999;
  display: none;
}

.add-user input {
  height: 32px;
  display: block;
  outline: none;
  border: 1px solid rgba(128, 128, 128, 0.479);
  padding: 4px 6px;
  font-size: 18px;
  border-radius: 5px;
  letter-spacing: 1px;
}

.add-user input::-webkit-input-placeholder {
  font-size: 13px;
  font-weight: 300;
  color: #00000064;
}

.add-user input:-ms-input-placeholder {
  font-size: 13px;
  font-weight: 300;
  color: #00000064;
}

.add-user input::placeholder {
  font-size: 13px;
  font-weight: 300;
  color: #00000064;
}

.add-user input:focus {
  border: 1px solid #00b6ff;
}

.add-user #add-user-btn {
  background-color: #000;
  color: white;
  padding: 6px 25px;
  display: block;
  margin: auto;
  outline: none;
  border: 1px solid #000;
  border-radius: 5px;
  margin-top: 20px;
  cursor: pointer;
  font-size: 12px;
  transition: all 150ms ease-in-out;
}
.loading-spinner-wrap {
  text-align: center;
  color: #3b3b3b;
}

.loading-spinner {
  animation: loading-spinner 1s infinite linear;
  color: white;
}

.loading-spinner-content {
  font-size: 25px;
  animation: loading-spinner 1s infinite linear;
}

@keyframes loading-spinner {
  to {
    transform: rotate(360deg);
  }
}

.user-list-container .no-user {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  font-size: 13px;
  margin: 20px 0 0 0;
  padding: 0;
  color: grey;
  text-align: center;
  font-weight: 300;
  letter-spacing: 1px;
}

.add-user #add-user-btn:hover {
  background-color: white;
  color: #000;
  border: 1px solid #000;
}

.add-user .user-list {
  width: 100%;
  min-height: 0;
  flex: 1;
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.add-user .user-list #user-list-title {
  margin-top: 10px;
  width: 100%;
  display: block;
  border-bottom: 1px solid rgba(128, 128, 128, 0.479);
  color: grey;
  padding-bottom: 4px;
  font-size: 13px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.add-user .user-list .user-list-container {
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
  flex: 1;
}

.add-user .user-list .user-list-container::-webkit-scrollbar {
  width: 3px;
}

.add-user .user-list .user-list-container::-webkit-scrollbar-track {
  background: rgba(34, 34, 34, 0.125);
}

.add-user .user-list .user-list-container::-webkit-scrollbar-thumb {
  background-color: #0000007d;
  border-radius: 20px;
}

.add-user .user-list-container .remove-user {
  outline: none;
  border: none;
  background: none;
  display: none;
  cursor: pointer;
  color: #000;
  font-size: 18px;
  margin-right: 10px;
  width: 24px;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
}

.add-user .user-list li {
  list-style-type: none;
  width: 100%;
  height: 60px;
  cursor: pointer;
  padding: 0px 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  animation: add-player-anim 0.6s 1 ease-in-out forwards;
  box-sizing: border-box;
  letter-spacing: 2px;
}

@keyframes add-player-anim {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.add-user .user-list li:hover {
  background-color: #00b7ff5e;
}
.add-user .user-list li:hover .remove-user {
  display: flex;
}

.add-user .user-list li div {
  width: 80%;
}

.add-user .user-list .username {
  display: block;
  font-size: 15px;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #3b3b3b;
  font-weight: 400;
}

.add-user .user-list .user-score {
  display: block;
  font-size: 10px;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: grey;
}

.user-selected {
  background-color: #000 !important;
}

.user-selected i {
  color: #fff;
}

.user-selected span {
  color: white !important;
}
.add-user .add-user-close {
  position: absolute;
  right: 15px;
  top: 20px;
  color: #000;
  cursor: pointer;
  border-radius: 50%;
  outline: none;
  border: none;
}
.add-user .add-user-close i {
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-text-stroke: 2px white;
}
.add-user #player-present-error {
  color: red;
  font-size: 12px;
  display: block;
  margin-top: 8px;
  letter-spacing: 1px;
}

.game-cover #warn-the-player {
  position: absolute;
  width: 100%;
  height: 42px;
  bottom: 0;
  left: 0;
  color: #000;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: default;
  border-radius: 25px 25px 0 0;
  letter-spacing: 2px;
  font-size: 14px;
}

.game-screen {
  background: #09ca96;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-screen .game-container {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  position: relative;
}

.game-screen .game-container #controls {
  width: 100%;
  display: none;
  justify-content: center;
  max-width: 550px;
}

.show-controls {
  display: flex !important;
}

.game-screen .game-container #controls button {
  width: 60px;
  padding: 12px 0;
  flex: 1;
  border: none;
  border-bottom: 1px solid #000;
  border-right: 1px solid #000;
  outline: none;
  background: none;
  color: #000;
  font-size: 16px;
}

.game-screen .game-container #controls button i {
  pointer-events: none;
}

.game-screen .game-container #controls button:first-of-type {
  border-left: 1px solid #000;
}

.game-container #playground {
  width: 98vw;
  height: 98vw;
  max-width: 550px;
  max-height: 550px;
  aspect-ratio: 1/1;
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  grid-template-rows: repeat(21, 1fr);
  overflow: hidden;
  background: #192128;
}

.game-container .snake-body {
  background-color: #ffffff;
  z-index: 9;
}

.snake-food {
  display: flex;
  justify-content: center;
  align-items: center;
}

.snake-food img {
  width: 100%;
  height: 100%;
  transform: scale(0.8);
  pointer-events: none;
}

.game-over {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background-color: rgba(0, 0, 0, 0.902);
}

.game-over-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  box-sizing: border-box;
  border-radius: 10px;
  width: 95%;
  max-width: 600px;
  padding: 30px 10px;
}

.game-over-content h2,
.game-over-content h3,
.game-over-content h4,
.game-over-content h5 {
  margin: 0;
}

.game-over-content h2 {
  font-size: 36px;
  text-align: center;
  color: #000;
  letter-spacing: 16px;
  font-weight: 700;
}

.game-over-content h3 {
  color: #ffd903;
  font-size: 42px;
  letter-spacing: 8px;
  text-align: center;
}

.game-over-content h4 {
  color: rgb(0, 153, 255);
  margin: 15px 0;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

.game-over-content button {
  display: block;
  width: 80px;
  height: 30px;
  margin: auto;
  border-radius: 5px;
  border: none;
  outline: none;
  cursor: pointer;
  background: red;
  color: white;
  margin-top: 15px;
  font-size: 14px;
  font-weight: 300;
}

.gamepad {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 18px;
  cursor: pointer;
  background: #fff;
  border: none;
  outline: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 150ms ease-in-out;
}

.gamepad i {
  transition: all 150ms ease-in-out;
}

.gamepad:hover {
  background-color: #000;
}

.gamepad:hover i {
  color: #fff;
}

@media (max-width: 920px) {
  .game-cover .game-title h4 {
    font-size: 36px;
  }

  .game-cover .game-title img {
    height: 180px;
  }

  .game-cover #start {
    margin-top: 25px;
    width: 100px;
    height: 38px;
    font-size: 13px;
    letter-spacing: 2px;
  }

  .game-over-content h2 {
    font-size: 30px;
  }

  .game-over-content h3 {
    font-size: 28px;
  }

  .game-over-content h4 {
    font-size: 12px;
  }

  .game-over-content button {
    font-size: 12px;
  }

  .game-screen .game-container #controls {
    display: flex;
  }

  .gamepad {
    display: none;
  }
}
