* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'sans';
}

@font-face {
  font-family: 'sans';
  src: url('../assets/px.ttf');
}

body {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr auto;
}

a {
  text-decoration: none;
  color: black;
  cursor: pointer;
}

button {
  background: white;
  border-radius: 20px;
  border: solid 1px black;
  cursor: pointer;
}

#grid-buttons {
  z-index: 5;
}

#grid-buttons button {
  width: 115px;
  padding: 7px;
  margin: 0 10px;
}

button:disabled {
  color: lightgrey;
  border-color: lightgrey;
}

#controls-panel {
  backdrop-filter: blur(5px);
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  z-index: 10;
}

button#close-controls-button {
  padding: 25px 20px;
  border-radius: 0px;
  border: none;
  border-left: solid 2px black;
  font-size: 30px;
  writing-mode: tb;
  transform: rotate(180deg);
  text-align: center;
}

#controls-wrapper {
  width: 295px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.75);
  border-right: solid 2px black;
  flex-direction: column;
}

#controls-wrapper:not(.hidden) {
  display: flex;
}

.settings-panel {
  width: 100%;
}

.settings-panel:first-child {
  margin-bottom: 30px;
}

.settings-panel div:not(:last-child) {
  margin-bottom: 5px;
}

.settings-panel p {
  margin-bottom: 15px;
  opacity: 0.45;
  font-size: 15px;
}

button.download {
  align-self: flex-end;
  font-size: 18px;
  padding: 15px;
  border-radius: 50px;
  transition: box-shadow 0.2s ease-in-out;
  background: black;
  color: white;
  width: 100%;
  padding: 7px 15px;
  margin-top: 8px;
}

button.download:disabled {
  cursor: default;
  background: none;
  color: lightgrey;
}

input,
select,
.switch {
  background: none;
  margin-right: 10px;
  outline: none;
  padding: 5px 10px;
  width: 65px;
  border: solid 1px black;
  border-radius: 20px;
  height: 28px;
  font-size: 13px;
}

select {
  padding: 5px;
  text-overflow: ellipsis;
}

label {
  font-size: 13px;
}

.settings-panel div span {
  color: rgb(160, 160, 160);
  margin-left: 5px;
  font-size: 13px;
}

#loop-control {
  display: flex;
  align-items: center;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.switch-dot {
  left: 5px;
  width: 18px;
  height: 18px;
  background: black;
  opacity: 30%;
  position: absolute;
  border-radius: 50%;
}

.switch.active .switch-dot {
  opacity: 100%;
  left: 40px;
}

.settings-panel div.switch {
  margin-bottom: 0;
}

#scanimate-button {
  font-size: 18px;
  margin-top: 20px;
  padding: 7px;
  background: black;
  color: white;
  width: 100%;
}

#render-playground {
  position: relative;
  padding: 30px;
  grid-column: 1 / 3;
  grid-row: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

#render-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#render-wrapper,
.displayable-canvas,
#grids,
.grid {
  max-width: 55vw;
  max-height: 55vh;
}

#loader:not(.hidden) {
  z-index: 10;
  pointer-events: none;
  top: 0;
  position: absolute;
  height: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  font-size: 5vw;
}

#grids {
  position: absolute;
}

.settings-panel div:has(> input) {
  height: 28px;
  display: flex;
  align-items: center;
}

input[type='range']:focus {
  outline: none;
}

input[type='range']:disabled {
  opacity: 30%;
  cursor: default;
}

input[type='range'] {
  appearance: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  height: 1px;
  background: black;
  border-radius: 5px;
  border: none;
}

input[type='range']::-webkit-slider-thumb {
  outline: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: black;
  border-radius: 50%;
}

#frames_amount {
  margin-left: 8px;
  width: 50px;
}

label[for='frames_amount'] {
  margin-left: 7px;
}

#grid-slider:not(.hidden) {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40vw;
}

input[type='range']#grid-slider-input {
  width: 100%;
  height: 32px;
  border-radius: 30px;
  padding: 5px;
  background: none;
  border: solid 1px black;
  margin: 0;
}

input[type='range']#grid-slider-input::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
}

#grid-label {
  margin-bottom: 10px;
  text-align: center;
}

#upload-video-button.before-click {
  background: black;
  color: white;
}

#upload-video-button {
  height: 125px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
}

#upload-video-button label {
  cursor: pointer;
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#upload-video-button label div {
  font-size: 18px;
  border: solid 1px black;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  padding: 7px 15px;
}

#upload-video-button input {
  display: none;
}

#upload-video-button video {
  z-index: 0;
  position: absolute;
  height: 100%;
}

.hidden,
div.hidden {
  display: none;
}

.invisible {
  visibility: hidden;
}

/* header */
header {
  grid-column: 1 / 3;
  grid-row: 1;
}

div#tour {
  z-index: 20;
  line-height: 25px;
  text-align: right;
  width: 25vw;
  font-size: 20px;
  position: fixed;
  top: 65px;
  right: 10px;
  padding: 15px 20px;
}

button#tour-button {
  font-size: 20px;
  padding: 5px 15px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(2px);
  z-index: 10;
  position: relative;
}

button#close-modal-button {
  position: absolute;
  right: 10px;
  top: 10px;
  border: none;
  background: none;
}

#modal {
  line-height: 30px;
  text-align: left;
  border: solid 1px black;
  padding: 20px 25px;
  position: absolute;
  width: 30vw;
  margin-top: 10px;
  right: 25px;
  backdrop-filter: blur(5px);
  z-index: 10;
  background: rgba(255, 255, 255, 0.25);
}

/* footer */
footer {
  grid-column: 1 / 3;
  grid-row: 3;
}

@media all and (max-width: 1000px) {
  div#tour {
    width: 30vw;
  }

  #modal {
    width: 50vw;
  }
}

@media all and (min-width: 1000px) and (max-width: 1200px) {
  div#tour {
    width: 35vw;
  }

  #modal {
    width: 50vw;
  }
}

@media all and (max-width: 850px) {
  button#close-controls-button {
    font-size: 15px;
  }

  button#close-controls-button {
    padding: 8px;
  }

  #controls-wrapper {
    width: 275px;
  }

  #upload-video-button {
    height: 100px;
  }

  #upload-video-button label div,
  #scanimate-button,
  button.download {
    font-size: 15px;
  }

  div#tour {
    display: none;
  }

  #modal {
    display: none;
  }

  #grid-slider:not(.hidden) {
    width: 80%;
  }

  input[type='range']#grid-slider-input {
    height: 24px;
    padding: 4px;
  }

  input[type='range']#grid-slider-input::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }

  #render-wrapper,
  .displayable-canvas,
  #grids,
  .grid {
    max-width: 65vw;
  }

  #grid-buttons button {
    margin: 0 5px;
  }
}
