body,
html {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body {
  font-family: 'Montserrat', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #005ca8;
}

h1 {
  text-align: center;
  margin-top: 20px;
}

p {
  color: #666;
  line-height: 1.6;
  margin: 20px;
}

.container {
  width: 80%;
  margin: auto;
  overflow: hidden;
}

button {
  display: inline-block;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 5px;
}

.question {
  text-align: center;
  min-width: 80%;
  max-width: 100%;
  margin: 20px 0;
  display: block;
  justify-content: center;
  align-items: center; /* Center content horizontally */
}

.question.active {
  display: block; /* Display the active question */
}

.question h2 {
  margin-bottom: 10px;
}

.question label {
  display: inline-flex;
  justify-content: center; /* Center text horizontally */
  align-items: center; /* Center text vertically */
  vertical-align: middle;
  margin: 10px;
  cursor: pointer;
  user-select: none;
  color: #005ca8;
  padding: 10px 20px;
  background-color: white;
  border: 2px solid #005ca8;
  border-radius: 50px; /* Rounded left and right sides */
  transition: background-color 0.3s, color 0.3s;
  width: 160px;
  height: 40px;
  text-align: center; /* Center text */
}

.question label .answer-text {
  display: inline-block;
  font-size: 16px;
  max-width: 100%;
  white-space: wrap;
  word-wrap: break-word;
  overflow: hidden; /* Hide overflow text */
  text-overflow: ellipsis;
  text-align: center; /* Center text */
}

.question input[type='button'] {
  position: relative;
  opacity: 1;
  cursor: pointer;
  display: none;
}

.question input[type='button'] + label:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 25px;
  height: 25px;
  border: 2px solid #005ca8;
  border-radius: 50px; /* Rounded left and right sides */
  background-color: white;
  transition: background-color 0.3s, color 0.3s;
}

.question label:hover,
.question input[type='button'].active + label {
  background-color: #005ca8;
  color: white;
}

.question input[type='text'] {
  display: block;
  margin: 10px auto;
}

.navigation {
  display: flex;
  justify-content: space-between;
  width: 100%;
  position: absolute;
  bottom: 40px;
  padding: 0 20px;
}

.navigation button {
  margin: 0 10px;
}

.nav-button {
  display: inline-block;
  padding: 10px 20px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  background-color: #f4f4f400;
  color: #005ca8;
  border: none;
  border-radius: 5px;
  z-index: 1000;
}

.nav-button:hover {
  color: #0030a8;
}

.nav-button-left {
  margin-right: auto;
}

.nav-button-right {
  margin-left: auto;
}

.nav-button-submit {
  margin-left: auto;
}

.question-number {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 18px;
  color: #005ca8;
}

.start-screen {
  text-align: center;
  display: flex; /* Change to flex */
  flex-direction: column; /* Center content vertically */
  justify-content: center; /* Center content vertically */
  align-items: center; /* Center content horizontally */
  height: 100vh; /* Ensure the start screen takes up the full viewport height */
}

.start-screen .home-button {
  position: absolute;
  top: 10px;
  left: 10px;
  width: fit-content;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border: 3px solid #005ca8;
  background-color: #f4f4f4;
  color: #005ca8;
  border-radius: 50px;
  transition: background-color 0.3s, color 0.3s; /* Smooth transition */
  display: inline-flex; /* Use flex to align items */
  align-items: center; /* Center items vertically */
}

.start-screen .home-button i {
  margin-right: 10px; /* Add space between icon and text */
}

.start-screen button#startButton {
  background-color: #f4f4f4;
  color: #005ca8;
  border: 6px solid #005ca8;
  padding: 10px 80px;
  font-size: 32px;
  cursor: pointer;
  border-radius: 50px;
  transition: background-color 0.3s, color 0.3s; /* Smooth transition */
}

.start-screen button#startButton:hover {
  background-color: #005ca8;
  color: #f4f4f4;
}

/* Ensure the start screen and questions are scrollable */
main {
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

.section {
  height: 100vh; /* Ensure each section takes up the full viewport height */
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center; /* Center content horizontally */
  position: relative; /* Needed for absolute positioning of navigation */
}

.question-number-overlay {
  position: fixed;
  top: 10px;
  left: 10px;
  font-size: 18px;
  background-color: white;
  padding: 5px 10px;
  border-radius: 5px;
  z-index: 1000;
}

.question-navigation {
  position: fixed; /* Fix the position */
  bottom: 20px; /* Position at the bottom */
  left: 50%; /* Center horizontally */
  transform: translateX(-50%); /* Center horizontally */
  display: flex;
  flex-wrap: wrap; /* Allow buttons to wrap to a new line */
  justify-content: center; /* Center the buttons */
  gap: 5px; /* Add some space between the buttons */
  margin: 10px 0; /* Add some margin for spacing */
  width: 65%; /* Limit the width of the navigation */
  z-index: 999;
  background-color: transparent;
}

.question-navigation button {
  width: 40px; /* Set a fixed width for all navigation buttons */
  height: 40px; /* Set a fixed height for all navigation buttons */
  display: inline-flex;
  justify-content: center; /* Center text horizontally */
  align-items: center; /* Center text vertically */
  margin: 5px;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
  color: #005ca8;
  background-color: white;
  border: 2px solid #005ca8;
  border-radius: 50%; /* Rounded left and right sides */
  transition: background-color 0.3s, color 0.3s;
}

.question-navigation button.active {
  background-color: #005ca8;
  color: white;
}

.home-button {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border: 3px solid #005ca8;
  background-color: #f4f4f4;
  color: #005ca8;
  border-radius: 50px;
  transition: background-color 0.3s, color 0.3s; /* Smooth transition */
  display: none; /* Initially hidden */
}

.home-button:hover {
  background-color: #005ca8;
  color: #f4f4f4;
}

/* Hide scrollbar when not needed */
main::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

main {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 24px;
  color: #005ca8;
}

.results {
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  padding: 20px;
}

.results .home-button {
  position: absolute;
  top: 10px;
  left: 10px;
  width: fit-content;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border: 3px solid #005ca8;
  background-color: #f4f4f4;
  color: #005ca8;
  border-radius: 50px;
  transition: background-color 0.3s, color 0.3s; /* Smooth transition */
  display: inline-flex; /* Use flex to align items */
  align-items: center; /* Center items vertically */
}

.results .home-button i {
  margin-right: 10px; /* Add space between icon and text */
}

.results .home-button:hover {
  background-color: #005ca8;
  color: #f4f4f4;
}

.results a {
  color: #666;
  font-weight: normal;
  text-decoration: none; /* Remove underline from links */
}

.results a:hover {
  color: #181717;
}

.top-results {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-bottom: 20px;
  padding: 20px;
}

.top-results h3 {
  font-size: 24px;
  font-weight: normal;
  margin-right: 30px;
}

.other-results {
  align-items: center;
  max-width: fit-content;
}

.other-results .result-item {
  align-items: center;
  width: 100%; /* Adjust width to fit two columns */
}

.other-results h3 {
  font-size: 14px; /* Slightly smaller than top-results */
}

.results-list {
  align-items: center;
  width: 100%;
  max-width: 80%;
  margin-bottom: 50px;
}

.results-list div {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 5px;
}

.results-list div span {
  font-weight: bold;
}

/* Default visibility for headers */
.desktop-header {
  display: block;
}

.mobile-header {
  display: none;
}

/* Responsive styles */
@media (max-width: 900px) {
  .question {
    max-width: 90%;
  }

  .question label {
    width: 10%;
    padding: 0px;
  }

  .question label .answer-text {
    font-size: 12px;
  }

  .question h2 {
    font-size: 18px;
  }

  button {
    width: auto;
    padding: 15px;
    font-size: 14px;
  }
  .question-navigation {
    display: none;
  }
  .question-navigation button {
    display: none;
  }

  .nav-button-left {
    display: none;
  }

  .nav-button-right {
    display: none;
  }

  .top-results h3 {
    font-size: 16px;
    margin-bottom: none;
  }

  .other-results {
    display: none;
  }
  .desktop-header {
    display: none; /* Hide desktop header on mobile */
  }

  .mobile-header {
    display: block; /* Show mobile header on mobile */
  }
}

@media (max-width: 480px) {
  .question {
    max-width: 100%;
  }
  .question label {
    width: 20%;
    padding: 5px;
  }

  .question label .answer-text {
    font-size: 10px;
  }

  .question h2 {
    font-size: 16px;
  }

  button {
    width: fit-content;
    padding: 10px;
    font-size: 12px;
  }
  .question-navigation {
    display: none;
  }
  .question-navigation button {
    display: none;
  }
  .nav-button-left {
    display: none;
  }

  .nav-button-right {
    display: none;
  }

  .top-results {
    flex-direction: column; /* Stack top results vertically */
    align-items: flex-start;
    margin-left: auto;
  }

  .top-results h3 {
    font-size: 16px;
    margin-right: 10px;
  }

  .other-results {
    display: none;
  }
  .desktop-header {
    display: none; /* Hide desktop header on mobile */
  }

  .mobile-header {
    display: block; /* Show mobile header on mobile */
  }
}
