* {
  box-sizing: border-box;
}

html, body {
  background-color: #4e7ca0;
  height: 100%;
  margin: 0;
  padding: 0;
}

.puzzle-container {
  height: 100%;
}

.puzzleboard {
  background-color: #4e7ca0;
  min-height: 65%;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

.row {
  height: 50%;
  position: relative;
  width: 100%;
}

/* Puzzleboard drop zone shapes */
.row > img {
  display: block;
  height: auto;
  width: 100%;
}

.row:last-of-type {
  padding-top: 1%;
}

.row div {
  display: inline-block;
  height: 100%;
  position: absolute;
  top: 0;
  width: 14%;
  z-index: 100;
}

.row:first-of-type div img {
  margin-top: 14.8%;
}

.row:last-of-type div img {
  margin-top: 7.8%;
}

.row div img {
  width: 100%;
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
}

/* Merry */
/* M */
.row:first-of-type div:first-of-type {
  margin-left: 15.8%;
}
/* E */
.row:first-of-type div:nth-child(3) {
  margin-left: 27.6%;
}
/* R */
.row:first-of-type div:nth-child(4) {
  margin-left: 39.7%;
}
/* R */
.row:first-of-type div:nth-child(5) {
  margin-left: 53.9%;
}
/* Y */
.row:first-of-type div:nth-child(6) {
  margin-left: 66.77%;
}

/* Christmas */
/* C */
.row:last-of-type div:first-of-type {
  margin-left: -.28%;
}
/* H */
.row:last-of-type div:nth-child(3) {
  margin-left: 10%;
}
/* R */
.row:last-of-type div:nth-child(4) {
  margin-left: 21%;
}
/* I */
.row:last-of-type div:nth-child(5) {
  margin-left: 30%;
}
/* S */
.row:last-of-type div:nth-child(6) {
  margin-left: 39.5%;
}
/* T */
.row:last-of-type div:nth-child(7) {
  margin-left: 49.7%;
}
/* M */
.row:last-of-type div:nth-child(8) {
  margin-left: 62.5%;
}
/* A */
.row:last-of-type div:nth-child(9) {
  margin-left: 73.8%;
}
/* S */
.row:last-of-type div:nth-child(10) {
  margin-left: 83.9%;
}

.tray {
  background-color: #86ac70;
  border: 1em solid #699965;
  bottom: 0;
  height: 35%;
  padding: 8em;
  position: relative;
  width: 100%;
}

/* Individual puzzle pieces with drop shadow and hover effect*/
.tray > img {
  position: absolute;
  transition: all .5s;
  width: 14%;

  -webkit-filter: drop-shadow(.1em .1em 0 #4a4848);
  filter: drop-shadow(.1em .1em 0 #4a4848);
}

.tray > img:hover {
  -webkit-transform: scale(1.05);
  transform: scale(1.05);

  -webkit-filter: drop-shadow(0 0 .6em #faffa6);
  filter: drop-shadow(0 0 .6em #faffa6);
}

button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  height: 3.5em;
  left: 0;
  margin: 0 auto;
  position: absolute;
  right: 0;
  text-align: center;
  top: -3em;
  transition: transform .3s;
  width: 7em;
  z-index: 100;
}

button:focus {
  outline: none;
}

button:active {
  -webkit-transform: scale(.9);
  transform: scale(.9);
}

button img {
  width: 5em;
}

button:nth-child(2) {
  display: none;
}

.xmas {
  -webkit-animation-delay: 0s, 11s;
  -webkit-animation-duration: 3s, 1s;
  -webkit-animation-iteration-count: 3, 1;
  -webkit-animation-name: spin, jingle;
  animation-delay: 0s, 11s;
  animation-duration: 3s, 1s;
  animation-iteration-count: 3, 1;
  animation-name: spin, jingle;
}

img[data-twirl] {
  -webkit-animation-delay: 0s, 11s;
  -webkit-animation-duration: .7s, 1s;
  -webkit-animation-iteration-count: 1, 1;
  -webkit-animation-name: twirl, jingle;
  animation-delay: 0s, 11s;
  animation-duration: .7s, 1s;
  animation-iteration-count: 1, 1;
  animation-name: twirl, jingle;
}

@-webkit-keyframes spin {
  0% {
    transform: rotate3d(1,2,1,0deg);
  }
  100% {
    transform: rotate3d(1,2,1,360deg);
  }
}

@keyframes spin {
  0% {
    transform: rotate3d(1,2,1,0deg);
  }
  100% {
    transform: rotate3d(1,2,1,360deg);
  }
}

@-webkit-keyframes twirl {
  0% {
    transform: rotate3d(0,1,0,0deg);
  }
  100% {
    transform: rotate3d(0,1,0,360deg);
  }
}

@keyframes twirl {
  0% {
    transform: rotate3d(0,1,0,0deg);
  }
  100% {
    transform: rotate3d(0,1,0,360deg);
  }
}

@-webkit-keyframes jingle {
  0% {
    transform: rotateZ(0);
  }
  25% {
    transform: rotateZ(-10deg);
  }
  50% {
    transform: rotateZ(10deg);
  }
  100% {
    transform: rotateZ(0deg);
  }
}

@keyframes jingle {
  0% {
    transform: rotateZ(0);
  }
  25% {
    transform: rotateZ(-10deg);
  }
  50% {
    transform: rotateZ(10deg);
  }
  100% {
    transform: rotateZ(0deg);
  }
}


@media (min-width: 2000px) {
  button {
    top: -4em;
    width: 9em;
  }

  button img {
    width: 7.5em;
  }
}

@media (max-width: 1024px) {
  button {
    height: 3em;
    top: -2em;
    width: 5em;
  }

  button:active {
    -webkit-transform: scale(.9);
    transform: scale(.9);
  }

  button img {
    width: 3.5em;
  }
}

@media (max-width: 768px) {
  .puzzleboard, .tray {
    height: 50vh;
    width: 768px;
  }
}