body {
  background: #031921;
  color: #fff;
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue",
    Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 0;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#game {
  display: flex;
  /*flex-direction: column;*/
  flex-direction: row;
  position: absolute;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#mapContainer {
  object-fit: contain;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  height: 100%;
  width: 50vw;
  position: relative;
}

#mapContainer .mapImage {
  position: absolute;
  width: 100%;
  top: calc((100vh - (50vw / 160 * 144))/2);
}

#mapContainer .mapImage.room, #mapContainer .mapImage.weapon {
  opacity: 0;
  transition: opacity 0.25s linear;
}

#mapContainer .mapImage.room.visible, #mapContainer .mapImage.weapon.visible {
  opacity: 1;
}

#currentRoomMap {
  display: block;
  position: absolute;
  top: calc((100vh - (50vw / 160 * 144))/2);
  left: 0;
  width: 50vw;
  height: calc((50vw / 160) * 144);
}

#currentRoom {
  display: block;
  position: absolute;
  background-color: white;
  opacity: 1;
  border-radius: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  animation: RoomGlow 1s infinite;
}

#currentRoom.room0 {
  top: 67%;
  left: 30%;
  width: 5%;
  height: 5%;
}

#currentRoom.room1 {
  top: 67%;
  left: 35%;
  width: 10%;
  height: 5%;
}

#currentRoom.room1::after {
  content: ' ';
  display: block;
  position: absolute;
  top: 100%;
  left: 0%;
  width: 50%;
  height: 120%;
  background-color: white;
}

#currentRoom.room2 {
  top: 61%;
  left: 35%;
  width: 5%;
  height: 6%;
}

#currentRoom.room3 {
  top: 56%;
  left: 30%;
  width: 15%;
  height: 5%;
}

#currentRoom.room4 {
  top: 50%;
  left: 45%;
  width: 5%;
  height: 11%;
}

#currentRoom.room5 {
  top: 44.5%;
  left: 50%;
  width: 5%;
  height: 16.5%;
}

#currentRoom.room6 {
  top: 55.5%;
  left: 55%;
  width: 20%;
  height: 5%;
}

#currentRoom.room7 {
  top: 55.5%;
  left: 75%;
  width: 5%;
  height: 5%;
}

#currentRoom.room8 {
  top: 28%;
  left: 45%;
  width: 5%;
  height: 22%;
}

#currentRoom.room9 {
  top: 34%;
  left: 50%;
  width: 5%;
  height: 10%;
}

#currentRoom.room10 {
  top: 39%;
  left: 35%;
  width: 10%;
  height: 5%;
}

#currentRoom.room11 {
  top: 39%;
  left: 55%;
  width: 15%;
  height: 5%;
}

#currentRoom.room12 {
  top: 34%;
  left: 55%;
  width: 15%;
  height: 5%;
}


#currentRoom.room13 {
  top: 28%;
  left: 70%;
  width: 4.7%;
  height: 10.5%;
}

#currentRoom.room14 {
  top: 28%;
  left: 50%;
  width: 10%;
  height: 5%;
}

#currentRoom.room15 {
  top: 28%;
  left: 60%;
  width: 5%;
  height: 5%;
}

#currentRoom.room16 {
  top: 28%;
  left: 65%;
  width: 5.15%;
  height: 5%;
}

#currentRoom.room17 {
  top: 28%;
  left: 75%;
  width: 10%;
  height: 5%;
}

#currentRoom.room17::after {
  content: ' ';
  display: block;
  position: absolute;
  top: 100%;
  left: 50%;
  width: 50%;
  height: 215%;
  background-color: white;
}

#currentRoom.room18 {
  top: 39%;
  left: 85%;
  width: 5%;
  height: 16%;
}

#currentRoom.room19 {
  top: 50%;
  left: 90%;
  width: 5%;
  height: 5%;
}

#currentRoom.room20 {
  top: 50%;
  left: 55%;
  width: 30%;
  height: 5%;
}

#currentRoom.room21 {
  top: 44.5%;
  left: 55%;
  width: 10%;
  height: 5%;
}

#currentRoom.room22 {
  top: 44.5%;
  left: 25%;
  width: 5%;
  height: 16.5%;
}

#currentRoom.room23 {
  top: 44.5%;
  left: 15%;
  width: 10%;
  height: 5%;
}

#currentRoom.room24 {
  top: 50%;
  left: 20%;
  width: 5%;
  height: 5%;
}

#currentRoom.room25 {
  top: 44.5%;
  left: 10%;
  width: 5%;
  height: 5%;
}

#currentRoom.room26 {
  top: 50%;
  left: 30%;
  width: 5%;
  height: 5%;
}


#game canvas {
  object-fit: contain;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /*height: 100%;*/
  width: 50vw;
}

#controller {
  display: none;
  position: fixed;
  bottom: 0px;
  height: 210px;
  width: 100%;
  touch-action: none;
  opacity: 0.8;
}

#controller_dpad {
  position: absolute;
  bottom: 20px;
  left: 0px;
  width: 184px;
  height: 184px;
  z-index: 2;
}

#controller_dpad:before {
  content: "";
  display: block;
  width: 48px;
  height: 48px;
  background: radial-gradient( ellipse at center, #3c3c3c 0%, #040404 59%, #222 60% );
  position: absolute;
  left: 68px;
  top: 68px;
  z-index: 3;
}

#controller_left {
  position: absolute;
  left: 20px;
  top: 68px;
  width: 48px;
  height: 48px;
  background: radial-gradient(ellipse at center, #313030 0%, #202020 80%);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  box-shadow: inset 0px 1px black,
              inset 0px 2px #9a9a9a7d,
              inset 0px -7px #040404,
              0px 3px 0px 3px black,
              0px 4px 4px 5px rgba(0,0,0,0.5);
  z-index: 2;
}


#controller_right {
  position: absolute;
  left: 116px;
  top: 68px;
  width: 48px;
  height: 48px;
  background: radial-gradient(ellipse at center, #313030 0%, #202020 80%);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  box-shadow: inset 0px 1px black,
              inset 0px 2px #9a9a9a7d,
              inset 0px -7px #040404,
              0px 3px 0px 3px black,
              0px 4px 4px 5px rgba(0,0,0,0.5);
  z-index: 2;
}

#controller_up {
  position: absolute;
  left: 68px;
  top: 20px;
  width: 48px;
  height: 48px;
  background: radial-gradient(ellipse at center, #313030 0%, #202020 80%);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  box-shadow: inset 0px 2px #9a9a9a7d,
              0px 1px 0px 3px black, 
              0px 4px 4px 5px rgba(0,0,0,0.5);
  z-index: 1;
}


#controller_down {
  position: absolute;
  left: 68px;
  top: 116px;
  width: 48px;
  height: 48px;
  background: radial-gradient(ellipse at center, #313030 0%, #202020 80%);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  box-shadow: inset 0px -7px #000,
              0px 4px 0px 3px black,
              0px 7px 4px 5px rgba(0,0,0,0.5);
  z-index: 3;
}


#controller-ba-backing {
  position: absolute;
  background: linear-gradient(rgba(0, 0, 0, 0.15),rgba(255, 255, 255, 0.15));
  width: 178px;
  height: 84px;
  right: 5px;
  rotate: -22deg;
  top: 45px;
  border-radius: 96px;
}

#controller_a {
  position: absolute;
  bottom: 110px;
  right: 20px;
}

#controller_b {
  position: absolute;
  bottom: 80px;
  right: 100px;
}

#controller_a:after,#controller_b:after {
  content: 'A';
  position: absolute;
  left: 52px;
  color: #4b479c;
  top: 46px;
  rotate: -22deg;
  font-size: 20px;
  font-style: italic;
}

#controller_b:after {
  content: 'B';
}

.roundBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 32px;
  color: transparent;
  line-height: 64px;
  width: 64px;
  height: 64px;
  border-radius: 64px;
  background: radial-gradient(ellipse at 0 0, #86104f 0%, #600635 100%);
  box-shadow: inset 0px -1px #b94382,
              0px 6px 0px rgb(85, 13, 52),
              0px 6px 0px 3px rgba(0,0,0,0.8),
              0px 8px 2px 5px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.capsuleBtn {
  font-weight: bold;
  font-size: 12px;
  color: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 40px;
  text-transform: uppercase;
  width: 54px;
  height: 20px;
  border-radius: 40px;
  background: radial-gradient(ellipse at center, #3c3c3c 0%, #131313 100%);
  box-shadow: inset 0px 6px 8px -3px rgba(255,255,255,0.4),
              inset 0px -1px #554d4d00, 
              0px 6px 0px rgb(9, 9, 9), 
              0px 6px 0px 3px rgba(0,0,0,0.8),
              0px 8px 2px 5px rgba(0, 0, 0, 0.5);
  font-style: italic;
  z-index: 2;
}

#controller_start {
  position: absolute;
  bottom: 30px;
  right: calc(50% - 90px);
}

#controller_start:after {
  content: "START";
  position: absolute;
  bottom: -26px;
  color: #4b479c;
  line-height: 12px;
}

#controller_select {
  position: absolute;
  bottom: 30px;
  right: calc(50% + -10px);
}

#controller_select:after {
  content: "SELECT";
  position: absolute;
  bottom: -26px;
  color: #4b479c;
  line-height: 12px;
}

#speaker-grill {
  position: absolute;
  width: 90px;
  height: 66px;
  color: grey;
  bottom: 8px;
  right: -11px;
  rotate: -30deg;
  display: flex;
  flex-direction: row;
  opacity: 0.85;
  z-index: 2;
}

.speaker-slot {
  position: relative;
  display: block;
  height: 48px;
  width: 6px;
  margin: 0px 3px;
  border-radius: 3px;
  box-shadow: inset 0px 0px 4px 1px rgba(0,0,0,0.2), 
              inset 2px 0px 1px 0px rgba(0,0,0,0.75);
}

#gb-corner {
  display: block;
  position: absolute;
  bottom: 0px;
  right: 0px;
  height: calc(100vh - calc(calc(100vw / 160) * 144));
  width: 100vw;
  right: 0px;
  z-index: 1;
  border-radius: 0 0 25px 5px;
  /* box-shadow: inset -5px -5px 5px 0px rgba(0,0,0,0.5),0 10px 0px 10px black; */
  box-shadow: inset 0px -5px 5px 0px rgba(0,0,0,0.5),
              0 10px 0px 10px black;
}

.speaker-slot:first-child {
  
}

.speaker-slot:first-child:after {
  background-color: transparent
}

#speaker-grill:after {
  position: absolute;
  width: 80px;
  height: 80px;
  background-color: #c3c3c3;
  border-radius: 0 0 40px 0;
  z-index: 1;
  rotate: 30deg;
  right: 10px;
  bottom: -5px;
  box-shadow: 20px 20px 5px 10px black,inset -5px -5px 5px;
}

#screen-edge {
  display: none;
}

.btnPressed {
  opacity: 0.5;
}

.spinner {
  height: 50px;
  width: 50px;
  margin: 0px auto;
  -webkit-animation: rotation 0.8s linear infinite;
  -moz-animation: rotation 0.8s linear infinite;
  -o-animation: rotation 0.8s linear infinite;
  animation: rotation 0.8s linear infinite;
  border-left: 10px solid #306850;
  border-right: 10px solid #306850;
  border-bottom: 10px solid #306850;
  border-top: 10px solid #88c070;
  border-radius: 100%;
  background-color: #031921;
}
@-webkit-keyframes rotation {
  from {
    -webkit-transform: rotate(0deg);
  }
  to {
    -webkit-transform: rotate(360deg);
  }
}
@-moz-keyframes rotation {
  from {
    -moz-transform: rotate(0deg);
  }
  to {
    -moz-transform: rotate(360deg);
  }
}
@-o-keyframes rotation {
  from {
    -o-transform: rotate(0deg);
  }
  to {
    -o-transform: rotate(360deg);
  }
}
@keyframes rotation {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media only screen and (max-width: 640px) {
  #game canvas {
    margin-top: 0px;
    width: 100%;
    max-width: 512px;
    border: 0px;
    border-radius: 0px;
  }
}

@media only screen and (max-device-width: 812px) and (orientation: portrait) {
  body {
    margin: 0;
  }

  #game {
    width: 100%;
    position: fixed;
    touch-action: none;
    background-color: #c3c3c3;
    flex-direction: column-reverse;
  }

  #mapContainer {
    width: 100vw;
  }

  #mapContainer .mapImage {
    top: 0;
  }

  #currentRoom {
    margin-top: -16.5%;
  }
  #controller {
    display: block;
  }

  #game canvas {
    margin: 0;
    display: block;
    width: 100% !important;
    height: auto !important;
    z-index: 2;
  }

  #screen-edge {
    /*display: block;*/
    width: 100vw;
    height: 32px;
    background-color: #5b5b5b;
    box-shadow: inset 0 -2px rgba(255,255,255,0.5),0 3px 1px rgba(0,0,0,0.75), inset 0 2px rgba(0,0,0,0.75);
    color: #27288f;
    line-height: 110px;
    font-size: 24px;
    font-weight: 400;
    font-style: italic;
    text-transform: uppercase;
    display: none;
  }

  #screen-edge .tm {
    font-size: 10px;
    font-weight: 600;
  }
}

@media only screen and (max-device-width: 320px) and (orientation: portrait) {
  #controller_dpad {
    left: -5px;
    bottom: -5px;
  }

  #controller_a {
    right: 5px;
    bottom: 95px;
  }

  #controller_b {
    right: 80px;
  }

  #controller_start {
    right: 5px;
  }

  #controller_select {
    right: 80px;
  }
}

@media only screen and (max-width: 500px) and (max-height: 400px) {
  #controller {
    display: none;
  }
}

/* Small devices in landscape */
@media only screen and (max-device-width: 300px) and (orientation: landscape) {
  html,
  body {
    height: 100%;
  }
  body {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #game:after {
    content: "PLEASE ROTATE ↻";
    font-size: 24px;
    font-weight: bold;
    color: #fff;
  }

  #game canvas {
    display: none;
    max-width: 480px;
  }

  #controller {
    display: none;
  }
}

/* Devices large enough for landscape */
@media only screen and (min-width: 300px) and (orientation: landscape) {
  #controller {
    bottom: 50%;
    transform: translateY(50%);
    opacity: 0.5;
  }

  #controller_select {
    bottom: -11vh;
    left: 25px;
  }

  #controller_start {
    bottom: -11vh;
    left: 105px;
  }

  #gb-corner, #speaker-grill {
    display: none;
  }

}


@keyframes RoomGlow {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.5;
  }
}