:root {
  --primary: #4f46e5;
  --secondary: #10b981;
  --dark: #1f2937;
  --light: #f9fafb;
  --gray: #6b7280;
  --charcoal: #333333; /* New charcoal color variable */
  font-size: 16px;
}

@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #333333; /* Changed to charcoal */
  color: var(--light); /* Changed text color to light for contrast */
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh; /* Ensure full viewport coverage */
}

/* Question Visibility */
.question {
  display: none;
  background-color: rgba(255, 255, 255, 0.1); /* Slightly transparent white */
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.question:first-child {
  display: block;
}

/* Answer Buttons */
.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
  width: 100%;
  max-width: min(600px, 90vw);
  padding: 0 1rem;
}

.option {
  background-color: rgba(255, 255, 255, 0.1); /* Semi-transparent white */
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-weight: 500;
  font-size: 1rem;
  color: var(--light); /* Light text for contrast */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  word-break: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

@media (max-width: 480px) {
  .option {
    padding: 1rem 0.75rem;
    font-size: 0.95rem;
  }
}

.option:hover {
  background-color: rgba(79, 70, 229, 0.3); /* Semi-transparent primary color */
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.option:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.5);
}

.option.selected {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  animation: pulse 0.5s ease;
}

.navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
}

@media (max-width: 600px) {
  .navigation {
    flex-direction: column;
    gap: 0.75rem;
  }
}

button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
  button {
    width: 100%;
  }
}

button:hover {
  background-color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background-color: var(--gray);
  cursor: not-allowed;
}

.result-container {
  text-align: center;
  padding: 2rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin: 1rem 0;
  display: flex;               /* NEW */
  flex-direction: column;      /* NEW */
  align-items: center;         /* NEW */
}

.result-image {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  margin: 1rem 0;
  background: rgba(255, 255, 255, 0.1); /* Semi-transparent background */
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.loading {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(79,70,229,.3);
  border-radius: 50%;
  border-top-color: #4f46e5;
  animation: spin 1s ease-in-out infinite;
}

/* Loading Spinner Styles */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(79, 70, 229, 0.3);
  border-radius: 50%;
  border-top-color: #4f46e5;
  animation: spin 1s ease-in-out infinite;
  margin: 2rem auto; /* Center spinner */
}

/* Hide/Show Utility Classes */
.hidden {
  display: none;
}
.visible {
  display: block;
}

#restartBtn {
  display: block;
  margin: 1.5rem auto 0 auto; /* Centers horizontally */
  width: fit-content;
  min-width: 200px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}