body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}

.hidden {
  display: none !important;
}

.container {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  margin-top: 1em;
}

.progress {
  margin: 1em auto;
  width: 500px;
  display: none;
}

.progressbar {
  position: relative;
  width: 492px;
  border: 1px solid black;
  padding: 3px;
  margin: 2px 0px;
  border-radius: 15px;
}

.progresstext {
  position: absolute;
  width: 492px;
  margin: 3px 0px;
  text-align: center;
  font-size: 0.7em;
}

.progressfill {
  height: 20px;
  background-color: #1687e4;
  width: 0%;
  border-radius: 15px;
}

.sorter {
  margin: 0px auto;
  display: grid;
  grid-template-columns: 31% 34.5% 31%;
  place-content: space-between;
  width: 80%;
}

.button {
  border: 3px solid #0b2c40;
  text-align: center;
  padding: 10%;
  grid-column: 2 / 3;
  cursor: pointer;
  border-radius: 20px;
}

.starting.button {
  display: none;
  flex-flow: column;
  align-items: center;
  justify-content: center;
}

.starting.start.button {
  grid-row: span 6;
  min-height: 480px;
}

.starting.load.button {
  margin-top: 10px;
}

.sorting.button,
.finished.button {
  grid-row: span 2;
  display: none;
  margin-top: 10px;
  user-select: none;
}

.sorting.tie.button {
  grid-row-start: 1;
}

.sorting.undo.button {
  grid-row-start: 3;
}

.sorting.save.button {
  grid-row-start: 5;
}

.loading.button {
  grid-row: span 6;
  display: none;
}

.loading.button > div {
  width: 25px;
  height: 25px;
  margin: 50px auto;
  background-color: #333;

  border-radius: 100%;
  -webkit-animation: sk-scaleout 1s infinite ease-in-out;
  animation: sk-scaleout 1s infinite ease-in-out;
}

/* Animation taken from: http://tobiasahlin.com/spinkit/ */

.loading.button > span {
  margin: auto auto 20%;
  font-size: 0.7em;
}

@-webkit-keyframes sk-scaleout {
  0% {
    -webkit-transform: scale(0);
  }
  100% {
    -webkit-transform: scale(1);
    opacity: 0;
  }
}

@keyframes sk-scaleout {
  0% {
    -webkit-transform: scale(0);
    transform: scale(0);
  }
  100% {
    -webkit-transform: scale(1);
    transform: scale(1);
    opacity: 0;
  }
}

.button {
  user-select: none;
}

.sorter > .image {
  grid-row: 1 / 7;
  cursor: pointer;
}

.sorter > .text {
  display: none;
  cursor: pointer;
  user-select: none;
  margin-top: 10px;
}

.sorter > .text > p {
  padding: 5px 5px;
  text-align: center;
  line-height: 1.5em;
  font-size: 1.25em;
  font-weight: bold;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

.sorter > .left {
  grid-column: 1 / 2;
  border: 3px solid #0b2c40;
  border-radius: 20px;
  max-width: -webkit-fill-available;
  max-width: -moz-available;
}

.sorter > .right {
  grid-column: 3 / 4;
  border: 3px solid #0b2c40;
  border-radius: 20px;
  max-width: -webkit-fill-available;
  max-width: -moz-available;
}

.sort.image {
  overflow: hidden;
  position: relative;
  min-height: 150px;
}

/* This is used for the result screen one */
iframe.sort.image {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.sort.image iframe {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.sort.image img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s linear;
  pointer-events: none;
}

.sort.image .loader-outer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column;
  align-items: center;
  justify-content: center;
}

.sort.image .loader {
  display: none;
}

.sort.image.loading img {
  transition: none;
  opacity: 1;
}

.sort.image.loading .loader {
  display: block;
  color: #1687e4;
  border-color: #1687e4;
}

.sort.image.loading .loader-inner {
  background-color: #1687e4;
}

.sort.image.loading iframe {
  visibility: hidden;
  /* display: none; */
}

.options {
  margin: 1em auto;
  display: grid;
  text-align: left;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 10px;
  width: 50%;
}

.options > div {
  font-size: 1em;
}

label {
  cursor: pointer;
}

label:hover {
  color: #990000;
}

.options > .large.option,
.options > hr {
  grid-column: span 3;
  text-align: center;
  width: 100%;
}

.image.selector {
  margin-top: 0.5em;
  display: none;
  text-align: center;
  font-size: 0.75em;
}

.time.taken {
  margin-top: 0.5em;
  display: none;
  text-align: center;
  font-size: 0.75em;
}

.results {
  font-size: 1em;
  display: flex;
  align-content: flex-start;
  width: 80%;
  margin: 2em auto;
}

@media all and (min-width: 600px) {
  .results {
    flex-flow: column wrap;
    max-height: calc(5 * (175px + 2px) + 1 * (15px + 2px));
    /* 2px for borders */
  }
}

@media all and (max-width: 600px) {
  .results {
    flex-flow: column nowrap;
  }
}

.result {
  height: 15px;
  margin-bottom: -1px;
  display: grid;
  grid-template-columns: min-content;
  border: 1px solid #000;
  margin-right: 5px;
}

.result.image {
  height: 175px;
  overflow-x: clip;
}

.result.image img {
  height: 160px;
  width: 213.33px;
  object-fit: contain;
}

.result.spacer {
  height: 1px;
  background-color: #000;
}

.result.head {
  background-color: #000;
  color: #fff;
}

.result > .left {
  width: 35px;
  padding: 1px 3px 1px 0.5em;
  grid-column: 1 / 2;
  text-align: right;
}

.result.image .left {
  position: relative;
}

.result.image > .left span {
  position: absolute;
  top: 50%;
  right: 3px;
  margin-top: -0.375em;
}

.result > .right {
  padding: 1px 0em 1px 0em;
  grid-column: 2 / 3;
  border-left: 1px solid #000;
  text-align: center;
  width: 300px;
}

.info {
  margin: 2em auto 3em;
  display: block;
  text-align: center;
  font-size: 0.6875em;
  width: 80%;
  line-height: 1.2em;
}

a {
  color: #990000;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  color: #ff6600;
}

a:visited {
  color: #6600ff;
}

h2 {
  display: block;
  font-size: 1.5em;
  margin-top: 0.83em;
  margin-bottom: 0.83em;
  margin-left: 0;
  margin-right: 0;
  font-weight: bold;
  user-select: none;
}
h3 {
  display: block;
  font-size: 1.17em;
  margin-top: 1em;
  margin-bottom: 1em;
  margin-left: 0;
  margin-right: 0;
  font-weight: bold;
  user-select: none;
}

strong {
  font-weight: bold;
}

sub {
  font-size: 0.66em;
}

.home-img {
  max-width: -webkit-fill-available;
  max-width: -moz-available;
  border-radius: 300px;
  user-select: none;
}

.container:before {
  left: 0;
  transform: scaleX(-1);
}
.container:after {
  right: 0;
}

/** Hover Effects for options **/
.starting.start {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.starting.start:hover {
  background-color: #fbdbeb;
  transition: background 0.25s linear;
}

.starting.load {
  background-color: #fff9f3;
  transition: background 0.25s linear;
  user-select: none;
}
.starting.load:hover {
  background-color: #a4e6ff;
  transition: background 0.25s linear;
}
.left.sort.text {
  background-color: #fff9f3;
  transition: background 0.25s linear;
  user-select: none;
}
.left.sort.text:hover {
  background-color: #f8b5be;
  transition: background 0.25s linear;
}

.right.sort.text {
  background-color: #fff9f3;
  transition: background 0.25s linear;
  user-select: none;
}
.right.sort.text:hover {
  background-color: #c9daf8;
  transition: background 0.25s linear;
}

.sorting.tie {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.sorting.tie:hover {
  background-color: #fdebac;
  transition: background 0.25s linear;
}

.sorting.undo {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.sorting.undo:hover {
  background-color: #b5eba2;
  transition: background 0.25s linear;
}

.sorting.save {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.sorting.save:hover {
  background-color: #baaaed;
  transition: background 0.25s linear;
}

.finished.save {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.finished.save:hover {
  background-color: #515aa2;
  transition: background 0.25s linear;
}

.finished.share {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.finished.share:hover {
  background-color: #56848a;
  transition: background 0.25s linear;
}

.finished.list {
  background-color: #fff9f3;
  transition: background 0.25s linear;
}
.finished.list:hover {
  background-color: #dceba6;
  transition: background 0.25s linear;
}

.finished.getimg {
  background-color: #fff9f3;
}
.finished.getimg:hover {
  background-color: #ac74cc;
  transition: background 0.25s linear;
}

/**
Loading Screen
**/
.preloader {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: #1687e4;
  display: flex;
  flex-flow: column;
  align-items: center;
  justify-content: center;
}

.preloader p {
  height: 90px;
  text-align: center;
  color: #fff;
  font-size: 24px;
  margin-top: 2em;
}

.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 4px solid #fff;
  animation: loader 2s infinite ease;
  text-align: center;
  color: #fff;
  font-size: 24px;
}

.loader-inner {
  vertical-align: top;
  display: inline-block;
  width: 100%;
  background-color: #fff;
  animation: loader-inner 2s infinite ease-in;
}

@keyframes loader {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(180deg);
  }
  50% {
    transform: rotate(180deg);
  }
  75% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes loader {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(180deg);
  }
  50% {
    transform: rotate(180deg);
  }
  75% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes loader-inner {
  0% {
    height: 0%;
  }
  25% {
    height: 0%;
  }
  50% {
    height: 100%;
  }
  75% {
    height: 100%;
  }
  100% {
    height: 0%;
  }
}

@-webkit-keyframes loader-inner {
  0% {
    height: 0%;
  }
  25% {
    height: 0%;
  }
  50% {
    height: 100%;
  }
  75% {
    height: 100%;
  }
  100% {
    height: 0%;
  }
}

.lang-select {
  margin: 10px;
  text-align: center;
  display: none;
}

.disclaimer {
  margin: 10px;
}

body.starting .starting.start.button {
  display: flex;
}

body.starting .lang-select {
  display: block;
}

body.starting.has-save .starting.button {
  grid-row: span 3;
  display: flex;
}

body.sorting .progress,
body.sorting .sorting.button,
body.sorting .sort.text {
  display: block;
}

body.finished .finished.button,
body.finished .image.selector,
body.finished .time.taken,
body.finished .result .sort.image {
  display: block;
}

body.finished .options,
body.finished .info {
  display: none;
}

/**
 * Mobile Styling
 *
 * TODO(Darkpi): This doesn't undo most of the desktop display (like grid) so
 * the CSS is quite messy, but it looks okay :P
 */
@media only screen and (max-width: 767px) {
  .sorter {
    margin: 0px auto;
    place-content: space-between;
    width: 80%;
    display: block;
  }

  img.home-img {
    height: 250px;
  }

  .sort.text > p {
    top: 0;
    transform: none;
  }

  .sort.image {
    display: none;
  }

  body.sorting .sort.image {
    display: block;
  }

  .sorter > .image {
    margin-top: 10px;
  }

  .button {
    padding: 15px;
  }

  .finished.getimg.button {
    display: none;
  }

  .progress {
    width: 100%;
    text-align: center;
  }

  .progressbar {
    width: 96%;
    padding: 0%;
    margin: 2%;
  }

  .progresstext {
    width: 50px;
    position: inherit;
  }

  .progressfill {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .options {
    margin: 1em;
    display: grid;
    text-align: left;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    width: 85%;
  }

  .loader {
    left: 45%;
  }

  .lang-select {
    margin: 25px;
  }
} /** End Mobile Media **/
