@font-face {
  font-family: pressStart2P;
  src: url("../res/PressStart2P-Regular.ttf") format("truetype");
}

* {
  font-family: pressStart2P;
  box-sizing: border-box;
}

:root {
  --main-bg-color: #4a3933;
  --bg-blocks: #e45826;
  --main-txt-color: #e6d5b8;
  --border: 3px solid #e6d5b8;
  --div-bg-color: #f0a500;
  --game-width: 426px;
  --game-height: 506px;
}
.flex-ctr {
  display: flex;
  justify-content: center;
  align-items: center;
}
html {
  overflow: hidden;
  margin: 0;
  height: 100%;
}
body {
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  width: 100vw;
  margin: 0 auto;
  padding: 0;
  background: var(--main-bg-color);
  color: var(--main-txt-color);
  overflow: hidden;
}

/* Custom Button Styling */
button {
  background-color: rgba(255, 255, 255, 0);
  border: var(--border);
  color: var(--main-txt-color);
  padding: 10px;
  text-shadow: 0 0 10px rgb(0, 0, 0);
  box-shadow: 0 0 10px rgb(0, 0, 0);
}
button:hover,
button:focus {
  background-color: rgba(255, 255, 255, 0.3);
}
button:focus {
  outline: 1px solid rgba(255, 255, 255, 1);
  outline-offset: -4px;
}
button:active {
  transform: scale(0.99);
}



#game-window {
  width: var(--game-width);
  flex-direction: column;
  transform-origin: 50% 0;
  box-shadow: 0 0 10px var(--bg-blocks);
}
table {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  cursor: none;
  table-layout: fixed;
  width: 100%;
  height: var(--game-height);
  background-color: var(--div-bg-color);
  border: var(--border);
  border-spacing: 0;
}


#overlay {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  display: flex;
  position: absolute;
  flex-direction: column;
  justify-content: space-around;
  text-align: center;
  width: var(--game-width);
  top: 0;
  height: var(--game-height);
  padding: 10px;
  border: var(--border);
  background-color: rgba(0, 0, 0, 0.5);
  -webkit-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
  -webkit-animation-duration: 0.75s;
          animation-duration: 0.75s;
  -webkit-animation-iteration-count: 1;
          animation-iteration-count: 1;
  text-shadow: 0 0 10px rgb(0, 0, 0);
  line-height: 2;
}
#btn-container {
  display: flex;
  justify-content: space-around;
}

#score-keeper {
  display: flex;
  font-size: 0.7em;
  justify-content: space-between;
  align-items: stretch;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  width: 100%;
}
#score-keeper > * {
  border: var(--border);
  display: flex;
  align-items: center;
  padding: 3px;
  line-height: 1.5;
  text-align: center;
  background: var(--bg-blocks);
}
#music-toggle:checked ~ #volume-slider {
  display: inline;
}
#volume-slider {
  display: none;
  width: 50%;
}
@-webkit-keyframes green-flash-in {
  0% {
    background-color: rgba(255, 255, 255, 0.7);
  }
  25% {
    background-color: rgba(31, 255, 0, 0.8);
  }
  50% {
    background-color: rgb(30, 255, 0, 0.5);
  }
  75% {
    background-color: rgb(30, 255, 0, 0.8);
  }
  100% {
    background-color: rgb(30, 255, 0, 0.5);
  }
}
@keyframes green-flash-in {
  0% {
    background-color: rgba(255, 255, 255, 0.7);
  }
  25% {
    background-color: rgba(31, 255, 0, 0.8);
  }
  50% {
    background-color: rgb(30, 255, 0, 0.5);
  }
  75% {
    background-color: rgb(30, 255, 0, 0.8);
  }
  100% {
    background-color: rgb(30, 255, 0, 0.5);
  }
}
@-webkit-keyframes red-flash-in {
  0% {
    background-color: rgba(255, 255, 255, 0.7);
  }
  25% {
    background-color: rgba(255, 0, 0, 0.8);
  }
  50% {
    background-color: rgba(255, 0, 0, 0.5);
  }
  75% {
    background-color: rgba(255, 0, 0, 0.8);
  }
  100% {
    background-color: rgba(255, 0, 0, 0.5);
  }
}
@keyframes red-flash-in {
  0% {
    background-color: rgba(255, 255, 255, 0.7);
  }
  25% {
    background-color: rgba(255, 0, 0, 0.8);
  }
  50% {
    background-color: rgba(255, 0, 0, 0.5);
  }
  75% {
    background-color: rgba(255, 0, 0, 0.8);
  }
  100% {
    background-color: rgba(255, 0, 0, 0.5);
  }
}
/* credits */
#credit {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  display: flex;
  font-size: 0.5em;
  width: 100%;
  text-align: center;
  justify-content: space-between;
  background: var(--bg-blocks);
}
#credit a {
  border: var(--border);
  padding: 5px;
  line-height: 1.5;
  text-decoration: none;
  color: var(--main-txt-color);
}
#credit a:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/*sprite related css */
.preload {
  background: url("../res/player/p20x20.png") no-repeat -9999px -9999px;
  background: url("../res/player/bug20x20.png") no-repeat -9999px -9999px;
}
td {
  height: 20px;
  width: 20px;
  background-color: rgba(0, 0, 0, 0);
}
td[id] {
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}
#snake-head {
  -webkit-animation-duration: 500ms;
          animation-duration: 500ms;
  -webkit-animation-timing-function: steps(6);
          animation-timing-function: steps(6);
}
#snake-head.pUp {
  background: url("../res/player/p20x20.png") 0 -20px;
  -webkit-animation-name: p-up;
          animation-name: p-up;
}
@-webkit-keyframes p-up {
  100% {
    background-position: -120px -20px;
  }
}
@keyframes p-up {
  100% {
    background-position: -120px -20px;
  }
}

#snake-head.pDown {
  background: url("../res/player/p20x20.png") 0 -60px;
  -webkit-animation-name: p-down;
          animation-name: p-down;
}
@-webkit-keyframes p-down {
  100% {
    background-position: -120px -60px;
  }
}
@keyframes p-down {
  100% {
    background-position: -120px -60px;
  }
}

#snake-head.pLeft {
  background: url("../res/player/p20x20.png") 0 -40px;
  -webkit-animation-name: p-left;
          animation-name: p-left;
}
@-webkit-keyframes p-left {
  100% {
    background-position: -120px -40px;
  }
}
@keyframes p-left {
  100% {
    background-position: -120px -40px;
  }
}

#snake-head.pRight {
  background: url("../res/player/p20x20.png") 0 0;
  -webkit-animation-name: p-right;
          animation-name: p-right;
}

@-webkit-keyframes p-right {
  100% {
    background-position: -120px 0;
  }
}

@keyframes p-right {
  100% {
    background-position: -120px 0;
  }
}
#bug-1 {
  background: url("../res/player/bug20x20.png") 0 -60px;

  -webkit-animation-duration: 300ms;

          animation-duration: 300ms;
  -webkit-animation-timing-function: steps(3);
          animation-timing-function: steps(3);
  -webkit-animation-direction: alternate;
          animation-direction: alternate;
  -webkit-animation-name: bug-1;
          animation-name: bug-1;
}
@-webkit-keyframes bug-1 {
  100% {
    background-position: -60px -60px;
  }
}
@keyframes bug-1 {
  100% {
    background-position: -60px -60px;
  }
}
#bug-2 {
  background: url("../res/player/bug20x20.png") 0 -40px;

  -webkit-animation-duration: 300ms;

          animation-duration: 300ms;
  -webkit-animation-timing-function: steps(3);
          animation-timing-function: steps(3);

  -webkit-animation-direction: alternate;

          animation-direction: alternate;
  -webkit-animation-name: bug-2;
          animation-name: bug-2;
}
@-webkit-keyframes bug-2 {
  100% {
    background-position: -60px -40px;
  }
}
@keyframes bug-2 {
  100% {
    background-position: -60px -40px;
  }
}
#bug-3 {
  background: url("../res/player/bug20x20.png") 0 0;

  -webkit-animation-duration: 300ms;

          animation-duration: 300ms;
  -webkit-animation-timing-function: steps(3);
          animation-timing-function: steps(3);

  -webkit-animation-direction: alternate;

          animation-direction: alternate;
  -webkit-animation-name: bug-3;
          animation-name: bug-3;
}
@-webkit-keyframes bug-3 {
  100% {
    background-position: -60px 0;
  }
}
@keyframes bug-3 {
  100% {
    background-position: -60px 0;
  }
}
