.clr{
	clear: both;
}

.container{
  padding: 1%;
  height: 90%;
  margin: 0% 10%;
}

body{
  background-color: white;

}

.row{
  clear: both;
}

svg{
  z-index: -1;
}

p#title{
  text-align: center;
  letter-spacing: 3px;
  text-shadow: 3px 2px red;
  font-size: 10vh;
}

p#final{
  display: none;
  position: absolute;
  top: 10vh;
  text-align: center;
  background-color: yellow;
}
p#final.showKingIsInCheck{
  display: block;
  left: calc(50vw - 54px);
}
p#final.finish{
  display: block;
  left: calc(50vw - 92px);
}

.container-score{
  position: absolute;
  height: 7vh;
  width: 80vw;
  top: 2vh;
  left: calc(50vw - 98px - 12vw - 6vw);
}

.game-score{
  background: white;
  border: 1px solid black;
  width: 98px; height: 70px;
  float: left;
  margin-left: 12vw;
  text-align: center;
  font-size: 0px; /* hide text */
  display: none;
}

.game-score.animate{
  transform: scale(0);
  animation: pulsate 1s ease-in forwards;
  animation-delay: 0s;
  opacity: 1;
  display: inherit;
}

.game-score.setFont{
  font-size: 15px;
  display: inherit;
}

.game-table{
  position: absolute;
  top: 15vh;
  left: calc(50vw - 240px);  /* always in the middle */
  box-sizing: border-box;
}

.game-table.animate{
  transition-duration: 3s;
}

.cell{
  border: transparent;
  height: 60px;
  width: 60px;
  position: relative;
  float: left;
  box-sizing: border-box;
  white-space: nowrap;
}

.cell img{
  margin: auto;
  top: -275px;    /* positioned on top so it can make the animation */
  position: relative;
  width: 50px;
  pointer-events: none; /* prevents images from being clickable */
  transition-duration: 3s;
  left: 4px;
  opacity: 0;
}

button#start-game{
  position: absolute;
  top: 50%;
  height: 30px;
  width: 14vw;
  left: 43vw;
}

button#undo{
  position: absolute;
  top: 70%;
  float: left;
  width: 100px;
  height: 3vh;
  left: 20%;
  opacity: 0;
}

button#undo.animate{
  transition-delay: 3s;
  transition-duration: 3s;
  opacity: 1;
}

svg.start-page{
  width: 90vw;
  height: 80vh;
  position: absolute;
  top: 15vh;
  left: calc(50vw - 325px);
}

svg.board{
  width: 60vw;
  height: 80vh;
  position: absolute;
  top: 15vh;
  left: calc(50vw - 240px);
}

svg .pieces{
  fill: white;
  opacity:1;
  stroke:black;
  stroke-width: 20px;

  stroke-dasharray: 12000;  /* size of the arrow */
  stroke-dashoffset: 12000;  /* offset = deslocamento */
  animation: piece 3s ease forwards;
}

svg .swords{
  fill: white;
  opacity: 0.3;
  stroke:black;
  stroke-width: 1px;
  transform: translate(125px, 0px);

  stroke-dasharray: 2000;  /* size of the arrow */
  stroke-dashoffset: 4000;  /* offset = deslocamento */
  animation: swords 2s linear forwards; 
}

svg #sword1{
  animation: swords 2s linear forwards; 
}

svg #sword2{
  animation: swords1 2s linear forwards; 
  animation-delay: 0.7s;
}

svg #sword3{
  animation: swords 2s linear forwards; 
  animation-delay: 0.9s;
}

svg #sword4{
  animation: swords1 2s linear forwards; 
  animation-delay: 1.1s;
}

svg #sword5{
  animation: swords 2s linear forwards; 
  animation-delay: 1.3s;
}

svg #sword6{
  animation: swords1 2s linear forwards; 
  animation-delay: 1.5s;
}

svg #sword7{
  animation: swords1 2s linear forwards; 
  animation-delay: 1.7s;
}

svg #sword8{
  animation: swords2 2s linear forwards; 
  animation-delay: 1.9s;
}

svg .board-rect{
  fill: transparent;
  stroke-width: 2px;
  stroke:rgb(0,0,0);
  width: 480px;
  height: 480px;
  display: none;
}

.board-rect.animate{
  display: box;
  display: inherit;
  stroke-dasharray: 2000;  /* size of the arrow */
  stroke-dashoffset: 2000;  /* offset = deslocamento */
  animation: border 3s linear forwards;
}

.line{
  stroke: black;
  fill: transparent;
  stroke-width: 1px;

  stroke-dasharray: 480;
  stroke-dashoffset: 480;
}

#line1{display: none;}
#line1.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 0.5s;
}

#line2{display: none;}
#line2.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 0.7s;
}

#line3{display: none;}
#line3.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 0.9s;
}

#line4{display: none;}
#line4.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 1.1s;
}

#line5{display: none;}
#line5.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 1.3s;
}

#line6{display: none;}
#line6.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 1.5s;
}

#line7{display: none;}
#line7.animate{
  display: inline;
  animation: line 1s linear forwards;
  animation-delay: 1.7s;
}

@keyframes pulsate {
  from {
    transform: scale(0);
  }
  60%{
    transform: scale(1.05);
  }
  80%{
    transform: scale(1.05);
  }
  to {
    transform: scale(1);
  }
}

@keyframes piece{
  to {
    stroke-dashoffset: 0;
    fill: black;
  }
  30%{
    fill: white;}
}

@keyframes swords{
  to {
    stroke-dashoffset: 0;
    fill: lightgray;
  }
}

@keyframes swords1{
  to {
    stroke-dashoffset: 0;
    fill:#CC9640;
  }
}

@keyframes swords2{
  to {
    stroke-dashoffset: 0;
    fill:#35231A;
  }
}

@keyframes line{
  to {
    stroke-dashoffset: 0;
  }
  70%{     
    fill: white;}
}

@keyframes border{
  to {
    stroke-dashoffset: 0;
  }
}

/* TODO: svg gets messy when is witdh or height small */
@media(max-width: 800px){
  .game-table{
    left: 20vw;
  }
  svg.board{
    width: 75vw;
    left: 20vw;
  }
  svg.start-page{
    width: 90vw;
  }
}

/* max-height: 850px  OR max-width: 600px */
@media (max-height: 850px), (max-width: 600px){
  .game-table{
    top: 20vh;
    left: calc(50vw - 180px);
  }
  svg.board{
    top: 20vh;
    left: calc(50vw - 180px);
  }
  svg.start-page{
    left: 0vw;
    width: 100vw;
  }
  p#final{
    top: 14vh;
  }
  .container-score{
    height: 12vh;
  }
  .game-score{
    width: 10vh;
  }
  .cell{
    height: 45px;
    width: 45px;
  }
  .cell img{
    left: 0px;
  }
  svg .board-rect{
    width: 360px;
    height: 360px;
  }
  line{
    stroke-dasharray: 480;
    stroke-dashoffset: 480;
    transform: scale(0.75);
  }
  button#start-game{
    position: absolute;
    top: 50%;
    height: 20px;
    width: 20vw;
    left: 43vw;
  }
}