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

.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;
}

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

.progressfill {
  height: 20px;
  background-color: lightgreen;
  width: 0%;
}

.sorter {
  margin: 0px auto;
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  grid-gap: 5px;
  width: 540px;
}

.button {
  border: 2px solid #333;
  border-radius: 8px;
  text-align: center;
  padding: 15px 30px;
  cursor: pointer;
  background: white;
  font-size: 1.1em;
  font-weight: bold;
  min-width: 200px;
  transition: all 0.2s ease;
  grid-column: 2 / 3;
}

.button:hover {
  background: #f0f0f0;
  border-color: #555;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.starting.load.button {
  display: none;
}

.sorting.button, .finished.button {
  display: none;
}

.loading.button {
  display: none;
}

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

  border-radius: 100%;  
  -webkit-animation: sk-scaleout 1.0s infinite ease-in-out;
  animation: sk-scaleout 1.0s 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.0);
    opacity: 0;
  }
}

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

.sorter > .image {
  width: 240px;
  height: 360px;
  margin: auto;
  grid-row: 1 / 7;
  cursor: pointer;
  object-fit: cover;
  object-position: top;
}

.sorter > .text {
  width: 240px;
  height: 60px;
  display: none;
  text-align: center;
}

.sorter > .text > p {
  margin: 0.5em 0px 0px;
  width: 100%;
  text-align: center;
  font-size: 0.8em;
  line-height: 1.5em;
}

.sorter > .left {
  grid-column: 1 / 2;
  border: 1px solid #000000;
}

.sorter > .right {
  grid-column: 3 / 4;
  border: 1px solid #000000;
}



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

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

label {
  cursor: pointer;
}

label:hover {
  color: #990000;
}

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

/* New character selection styles */
.character-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-gap: 15px;
  margin-top: 15px;
  width: 100%;
}

.character-square {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 3px solid #4CAF50;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
  background: white;
  width: 160px;
  height: 160px;
  aspect-ratio: 1;
}

.character-square:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.character-square.unselected {
  border-color: #ccc !important;
  opacity: 0.6;
}

.character-square.disabled {
  border-color: #ccc !important;
  opacity: 0.3;
  cursor: not-allowed;
}

.character-square.disabled:hover {
  transform: none;
  box-shadow: none;
}

.character-square img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  margin-bottom: 0;
  object-fit: cover;
  object-position: top;
}

.character-square .character-name {
  font-size: 1.6em;
  text-align: center;
  line-height: 1.2;
  font-weight: bold;
  color: #333;
  margin-top: auto;
}

.character-square.unselected .character-name {
  color: #999;
}

.character-square.disabled .character-name {
  color: #ccc;
}

/* Hide character checkboxes */
.options input[type="checkbox"][id^="cb-character-"] {
  display: none !important;
}

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

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

.results {
  font-size: 0.75em;
  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;
  width: 211px;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #000;
  margin-right: 5px;
}

.result.image {
  height: 175px;
}

.result.image img {
  height: 160px;
  width: 160px;
  object-fit: cover;
  object-position: top;
}

.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 {
  width: 160px;
  padding: 1px 0em 1px 0em;
  grid-column: 2 / 3;
  border-left: 1px solid #000;
  text-align: center;
}

.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;
}