body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.select, #answers {
  width: 100%;
}

#answers {
  overflow-y: hidden;
  overflow-x: auto;
  text-align: center;
  border: 1px solid #485fc7;
  border-radius: 6px;
  color: black;
}

#answers input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

#answers span {
  display: block;
  padding: 10px;
  border-radius: 3px;
  transition: background-color 0.3s ease;
}

#answers input[type="radio"]:checked + span {
  background-color: #485fc7;
  color: white;
}

#answers input[type="radio"].correct + span {
  background-color: hsl(141, 71%, 48%)!important;
  color: white;
}

#answers input[type="radio"].wrong + span {
  background-color: hsl(348, 100%, 61%)!important;
  color: white;
}

#answers label {
  cursor: pointer;
}

#answers input[type="radio"]:not(:checked) + span:hover {
  background-color: #f7f7f7!important;
}

#answers input[type="radio"]:focus + span {
  box-shadow: 0 0 0 2px #485fc7;
}

.tag {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.tag:hover {
  background-color: #3e8ed0;
}

.tag.is-light {
  background-color: #f5f5f5;
  color: #363636;
}

#quiz-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

@media screen and (max-width: 768px) {
  .panel-block {
      padding: 0.5rem;
  }

  #quiz-tabs {
      justify-content: center;
      gap: 0.25rem;
  }

  .tag {
      margin: 0.1rem;
      font-size: 0.9rem;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body {
      background-color: #121212;
      color: #e0e0e0;
  }

  .hero.is-link {
      background-color: #1a237e;
  }

  .box, .panel {
      background-color: #1e1e1e;
      color: #e0e0e0;
  }

  .panel-heading {
      background-color: #3e8ed0;
      color: #e0e0e0;
  }

  .tag {
      background-color: #2c2c2c;
      color: #e0e0e0;
  }

  .tag:hover {
      background-color: #3e8ed0;
  }

  .tag.is-light {
      background-color: #3e8ed0;
      color: #e0e0e0;
  }

  .button.is-link {
      background-color: #3e8ed0;
  }

  #answers {
      border-color: #3e8ed0;
      color: #e0e0e0;
  }

  #answers input[type="radio"]:not(:checked) + span:hover {
      background-color: #2c2c2c!important;
  }

  .footer {
      background-color: #1e1e1e;
      color: #e0e0e0;
  }

  a {
      color: #64b5f6;
  }

  a:hover {
      color: #90caf9;
  }

  /* Fix for question text color, but not inner span */
  #question {
      color: #e0e0e0;
  }

  #question span:not(.question-subtitle) {
      color: #121212;
  }

  /* Fix for checkbox text color */
  .checkbox {
      color: #e0e0e0;
  }

  /* Improve checkbox visibility when checked */
  input[type="checkbox"]:checked {
      filter: invert(100%) hue-rotate(180deg) brightness(1.7);
  }

  /* Custom checkbox styles on hover */
  .checkbox:hover {
    color: #e0e0e0;
  }

  #quiz-info-footer {
    color: #fff;
  }

  input#hard-input:not(.answered) {
    background-color: #2c2c2c;
    color: #e0e0e0;
  }
}

/* High contrast mode for better accessibility */
@media (prefers-contrast: high) {
  body {
      background-color: black;
      color: white;
  }

  .box, .panel {
      background-color: #333;
      color: white;
  }

  .button, .tag {
      border: 2px solid white;
  }
}

/* Reduced motion for users who prefer less animation */
@media (prefers-reduced-motion: reduce) {
  * {
      transition: none !important;
  }
}

div.control span.tag {
  text-align: center;
}