body {
  margin: 40px auto;
  max-width: 640px;
  line-height: 1.6;
  font-size: 18px;
  font-family: sans-serif;
  color: #444;
  padding: 0 10px;
}

h1 {
  line-height: 1.2;
}

#game-wrapper {
  display: flex;
  flex-flow: column;
}

#game {
  width: 640px;
  height: 480px;
  line-height: 0;
}
#game .weapon {
  background-color: blue;
}
#game .health {
  background-color: gold;
}

.gameover, .gamewon {
  position: relative;
  z-index: -1;
}
.gameover .tile, .gamewon .tile {
  opacity: 0.4;
}
.gameover .hidden, .gamewon .hidden {
  opacity: 0.2;
  visibility: visible;
}
.gameover::before, .gamewon::before {
  content: "GAME OVER";
  display: block;
  text-align: center;
  line-height: 480px;
  width: 640px;
  height: 480px;
  font-size: 38px;
  z-index: 100;
  opacity: 1;
  position: absolute;
  left: 0px;
  top: 0px;
}
.gameover + #global-controls :not(.reset), .gamewon + #global-controls :not(.reset), .gameover ~ #infos, .gamewon ~ #infos {
  opacity: 0.2;
  pointer-events: none;
}

.gamewon::before {
  content: "YOU WIN!";
}

.tile {
  width: 2.5%;
  height: 3.33333%;
  display: inline-block;
  background-color: gray;
  position: relative;
}
.tile > span {
  position: absolute;
  bottom: 50%;
  left: 0px;
  text-align: center;
  font-size: 10.66667px;
}

.player.p1 {
  background: repeating-linear-gradient(to bottom right, lime, lime 6px, red 6px, red 8px);
}

.player.p2 {
  background: repeating-linear-gradient(to bottom left, lime, lime 6px, blue 6px, blue 8px);
}

.player.dead.p1 {
  background: repeating-linear-gradient(to bottom right, #444, #444 6px, red 6px, red 8px);
}
.player.dead.p2 {
  background: repeating-linear-gradient(to bottom left, #444, #444 6px, blue 6px, blue 8px);
}

.wall {
  background-color: rebeccapurple;
}

.enemy {
  background-color: red;
}

.boss {
  box-sizing: border-box;
  background: radial-gradient(circle farthest-corner, #ff0000, #660000);
  z-index: 3;
  animation-duration: 2s;
  animation-name: bossspin;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: linear;
}
.boss > span {
  left: 2px;
}
@keyframes bossspin {
  from {
    transform: scale(1);
  }
  85% {
    transform: scale(1);
  }
  to {
    transform: scale(1.5);
  }
}
.hidden {
  visibility: hidden;
}

.exit {
  box-sizing: border-box;
  background-color: #444;
  border: 0px solid #5e5e5e;
  animation-duration: 2s;
  animation-name: exitflash;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: ease-in-out;
}
@keyframes exitflash {
  from {
    border-width: 0px;
  }
  to {
    border-width: 5.33333px;
  }
}
.floor {
  width: 4em;
  flex: none;
}

#infos {
  display: flex;
  flex-flow: column;
}

#global-controls, .info {
  display: flex;
  flex-flow: row;
  align-items: center;
  margin: 0.5em 0;
}

#global-controls {
  justify-content: space-between;
}

.info {
  width: 100%;
}
.info .player {
  width: 16px;
  height: 16px;
  flex: none;
  margin-right: 1em;
}
.info .controls {
  flex: none;
  position: relative;
  width: 60px;
  height: 40px;
}
.info .controls button {
  width: 20px;
  height: 20px;
  padding: 0px;
}
.info .controls button:nth-child(1) {
  position: absolute;
  left: 20px;
  top: 0px;
}
.info .controls button:nth-child(2) {
  position: absolute;
  left: 0px;
  top: 10px;
}
.info .controls button:nth-child(3) {
  position: absolute;
  left: 20px;
  top: 20px;
}
.info .controls button:nth-child(4) {
  position: absolute;
  left: 40px;
  top: 10px;
}
.info > span {
  text-align: center;
}
.info .health, .info .level {
  flex: auto;
  position: relative;
  z-index: -2;
  background: none;
}
.info .health .health_bar, .info .health .xp_bar, .info .level .health_bar, .info .level .xp_bar {
  z-index: -1;
  position: absolute;
  left: 0px;
  top: 0px;
  height: 100%;
}
.info .health_bar, .info .xp_bar {
  transition: width 0.25s linear;
}
.info .health_bar {
  background-color: gold;
}
.info .xp_bar {
  background-color: #ff8080;
}
.info .level {
  width: 6em;
  flex: none;
}
.info .weapon {
  width: 12em;
  flex: none;
  border: 2px solid blue;
  box-sizing: border-box;
}
.info .weapon.new {
  animation-duration: 0.5s;
  animation-name: flashnew;
}
@keyframes flashnew {
  from {
    background-color: blue;
    color: white;
  }
  to {
    background-color: white;
    color: #444;
  }
}
