:root {
  --main-size: 40rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow: hidden;
}

html {
  font-size: 62.5%;
}

body {
  display: block;
  width: 100vw;
  height: 100vh;
  background-image: linear-gradient(to right bottom, #62add8, #7345f3);
  background-repeat: no-repeat;
  background-size: cover;
  font-family: sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#main-content {
  display: block;
  background-color: rgba(216, 218, 226, 0.4);
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 5rem;
  border-radius: 2rem;
}

#title {
  color: #fff;
  font-size: 5rem;
  margin-bottom: 2rem;
  text-transform: uppercase;
}

.pixel-paint {
  display: inline-block;
  text-align: right;
  width: var(--main-size);
}

#color-palette {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.color {
  display: inline-block;
  width: 4rem;
  height: 4rem;
  border: 1px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  border-radius: 0.5rem;
  transition: transform 0.2s ease-out;
}

.color:hover {
  transform: translateY(-0.3rem);
  transform: scale(1.1);
  box-shadow: 0.5rem 0.5rem 0.5rem rgba(0, 0, 0, 0.3);
}

.color:active {
  transform: translateY(0.3rem);
  box-shadow: none;
}

.selected {
  transform: translateY(0.7rem);
  transform: scale(1.1);
}

.selected:hover {
  box-shadow: none;
}

.options {
  display: flex;
  width: 100%;
  margin: 1rem 0;
  justify-content: space-between;
  align-items: center;
}

.input {
  border: none;
  outline: none;
  color: #474747;
}

.input:focus {
  flex-grow: 1;
  border: 2px solid #d6daf0;
}

/* Source: https://www.w3schools.com/howto/howto_css_hide_arrow_number.asp */
.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#board-size {
  width: 15rem;
  padding: 0.8rem 1.4rem;
  border-radius: 0.4rem;
  text-align: center;
  transition: all .4s ease-in-out;
}

.btn {
  margin: 1rem 0 1rem 1rem;
  padding: 0.8rem 1.4rem;
  width: 8rem;
  border: none;
  border-radius: 0.4rem;
  cursor: pointer;
  background-color: white;
  color: #474747;
}

.btn:hover {
  background-color: #d6daf0;
}

#pixel-board {
  height: var(--main-size);
  width: var(--main-size);
  display: grid;
  grid-template-rows: repeat(var(--grid-size), 1fr);
  grid-template-columns: repeat(var(--grid-size), 1fr);
}

.pixel {
  display: inline-block;
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

#credit {
  color: white;
  font-size: 1.2rem;
  margin-top: 1rem;
  font-style: italic;
}

/* MEDIA QUERIES */

/* WIDTH */

@media (max-width: 768px) {
  :root {
    --main-size: 50rem;
  }

  #color-palette {
    height: 24rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .color {
    height: 11rem;
    width: 11rem;
  }

  .input {
    font-size: 2.3rem;
    height: 6rem;
    width: 13rem;
  }

  .btn {
    font-size: 2.3rem;
    height: 6rem;
    width: 13rem;
    border-radius: 1rem;
    padding: 0.6rem 1rem;
  }

  #credit {
    font-size: 2rem;
  }

}

@media (max-width: 660px) {
  #main-content {
    background-color: transparent;
  }
}

@media (max-width: 600px) {
  :root {
    --main-size: 40rem;
  }

  #color-palette {
    height: 19rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .input {
    font-size: 1.7rem;
    height: 3.4rem;
    width: 12rem;
  }

  .btn {
    font-size: 1.5rem;
    height: 3.4rem;
    width: 12rem;
    border-radius: 0.4rem;
    padding: 0.6rem 1rem;
  }

  .color {
    height: 8.5rem;
    width: 8.5rem;
  }
  
  #credit {
    font-size: 1.5rem;
  }
}

@media (max-width: 500px) {
  :root {
    --main-size: 35rem;
  }

  #main-content {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .btn {
    width: 6rem;
    padding: 0.6rem 1rem;
  }

  #board-size {
    width: 12rem;
    padding: 0.6rem 1rem;
  }
}

@media (max-width: 320px) {
  :root {
    --main-size: 25rem;
  }

  #color-palette {
    height: 12rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .color {
    height: 5.5rem;
    width: 5.5rem;
  }

  .btn {
    width: 6rem;
    padding: 0.6rem 1rem;
  }

  #board-size {
    width: 7rem;
    padding: 0.6rem 1rem;
  }
}

/* HEIGHT */

@media (max-height: 720px) {
  :root {
    --main-size: 25rem;
  }

  #main-content {
    padding: 3rem;
  }

  .pixel-paint {
    width: 25rem;
  }

  #color-palette {
    height: 12rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .color {
    height: 5.5rem;
    width: 5.5rem;
  }

  .btn {
    width: 6rem;
    padding: 0.6rem 1rem;
  }

  #board-size {
    width: 7rem;
    padding: 0.6rem 1rem;
  }
}

@media (max-height: 660px) {
  :root {
    --main-size: 25rem;
  }

  #main-content {
    background-color: transparent;
  }

  #title {
    font-size: 3rem;
  }

  .pixel-paint {
    width: 25rem;
  }

  #color-palette {
    height: 12rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .color {
    height: 5.5rem;
    width: 5.5rem;
  }

  .btn {
    width: 6rem;
    padding: 0.6rem 1rem;
  }

  #board-size {
    width: 7rem;
    padding: 0.6rem 1rem;
  }
}

@media (max-height: 525px) {
  #color-palette {
    height: 3rem;
    flex-wrap: wrap;
    align-content: space-between;
  }

  .color {
    height: 3rem;
    width: 3rem;
  }
}
