/* Styles for correct and incorrect answer buttons */
.option-btn.correct {
  background-color: #28a745 !important; /* Green background for correct answers */
  color: #fff; /* White text */
}
.option-btn.incorrect {
  background-color: #df0e23 !important; /* Red background for incorrect answers */
  color: #fff; /* White text */
}

/* CSS variable for secondary color, initially set but overwritten by JS */
:root {
  --secondary: #007bff; /* Default blue, will be set randomly by JS */
}

/* Global body styles for font, background, and centering content */
body {
  font-family: Arial, sans-serif;
  background-color: #000; /* Black background */
  color: #fff; /* White text */
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Main quiz container styling: size, background, padding, and shadow */
.container {
  width: 100%;
  max-width: 600px;
  margin: 24px auto;
  padding: 24px 20px;
  background: #111; /* Dark gray background */
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Style for the displayed flag image */
.flag-img {
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 20px 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2); /* Subtle shadow */
}

/* Layout for the answer buttons container - vertical stack with spacing */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* Styling each answer button */
.option-btn {
  padding: 12px 15px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background-color: var(--secondary); /* Uses secondary color variable */
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

/* Hover effect on answer buttons for better interactivity */
.option-btn:hover {
  filter: brightness(1.2);
}

/* Styles for Next and Retry buttons, hidden by default */
#next-btn, #retry-btn {
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 16px;
  display: none; /* Hidden initially */
  background-color: var(--secondary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  max-width: 320px;
  box-sizing: border-box;
}

/* Hover effect for Next and Retry buttons */
#next-btn:hover, #retry-btn:hover {
  filter: brightness(1.2);
}

/* Styling for the result text shown at the end of the quiz */
#result {
  font-size: 18px;
  margin-top: 20px;
  font-weight: bold;
  word-break: break-word; /* Allows long text to wrap properly */
}

/* Responsive styles for screens smaller than 900px */
@media (max-width: 900px) {
  .container {
    max-width: 98vw;
    padding: 16px 2vw;
  }
  .card {
    max-width: 98vw;
    padding: 1.5rem 1vw;
  }
  .flag-img {
    max-width: 90vw;
  }
  .options, #next-btn, #retry-btn {
    max-width: 98vw;
  }
  #username {
    width: 95%;
    font-size: 1rem;
  }
}

/* Responsive styles for screens smaller than 600px */
@media (max-width: 600px) {
  .container {
    padding: 10px 1vw;
    border-radius: 8px;
  }
  .card {
    padding: 1rem 2vw;
    border-radius: 10px;
  }
  .flag-img {
    margin: 10px 0;
    border-radius: 6px;
  }
  .option-btn, #next-btn, #retry-btn {
    font-size: 15px;
    padding: 10px 8px;
    border-radius: 7px;
  }
  #result {
    font-size: 16px;
  }
  #username {
    font-size: 0.95rem;
    padding: 0.4rem;
    border-radius: 6px;
  }
}

/* Responsive styles for screens smaller than 400px */
@media (max-width: 400px) {
  .container {
    padding: 6px 0.5vw;
    border-radius: 5px;
  }
  .card {
    padding: 0.5rem 1vw;
    border-radius: 6px;
  }
  .flag-img {
    margin: 6px 0;
    border-radius: 4px;
  }
  .option-btn, #next-btn, #retry-btn {
    font-size: 13px;
    padding: 8px 5px;
    border-radius: 5px;
  }
  #result {
    font-size: 13px;
  }
  #username {
    font-size: 0.9rem;
    padding: 0.3rem;
    border-radius: 4px;
  }
  /* Adjust list styling inside the welcome section for small screens */
  #welcome-section ul {
    padding-left: 0.7rem;
    font-size: 13px;
  }
}
