:root {
  --primary-color: #6366f1;
  --secondary-color: #a855f7;
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --error: #ef4444;
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: radial-gradient(circle at top left, #1e1b4b, #0f172a);
  color: var(--text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.container {
  width: 95%;
  max-width: 1000px;
  padding: 2rem;
  z-index: 10;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 3rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.6s ease-out;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.btn {
  padding: 1.25rem 2rem;
  border-radius: 16px;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid transparent;
  appearance: none;
  -webkit-appearance: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.4);
}

/* Quiz Styles */
.quiz-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.question-text {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.options-grid {
  display: grid;
  gap: 1rem;
}

.option-btn {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
}

.option-btn.correct {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--success);
}

.option-btn.wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--error);
}

/* Nav Buttons */
.nav-button-container {
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.nav-btn {
  flex: 1;
  padding: 0.75rem 1rem;
}

.nav-btn-terminar {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    width: 100%;
    padding: 1rem;
  }

  .glass-card {
    padding: 1.5rem;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  /* Make Quiz Header wrap if needed */
  .quiz-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  /* Stack main menu buttons and increase text size of option buttons */
  .btn {
    padding: 1rem;
    font-size: 1rem;
    text-align: center;
    justify-content: center;
    flex-direction: column;
  }

  /* Make the answer options larger and easier to read on mobile */
  .option-btn {
    font-size: 1.15rem;
    padding: 1.25rem 1rem;
  }

  /* Question text */
  .question-text {
    font-size: 1.2rem;
  }

  /* Make the exit confirmation buttons stack on very small screens */
  #confirm-modal .glass-card>div[style*="display: flex"] {
    flex-direction: column;
  }

  /* Bottom navigation (Prev, Terminar, Next) */
  .nav-button-container {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }

  /* Ensure nav buttons fill available space when wrapped */
  .nav-btn {
    -webkit-box-flex: 1;
    flex: 1 1 45% !important;
    width: 48%;
    min-width: 100px;
    padding: 0.75rem 0.5rem !important;
    font-size: 0.95rem;
  }

  /* Terminar button can take full width if the others take half */
  .nav-btn-terminar {
    -webkit-box-flex: 1;
    flex: 1 1 100% !important;
    width: 100%;
    order: 3;
    /* Move to the bottom below prev/next */
  }

  /* Details in results stack nicely */
  #score-details>div>div[style*="display:flex;"] {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

  .btn {
    font-size: 0.95rem;
  }

  .glass-card {
    padding: 1rem;
  }

  /* Adjust font of options for very small screens */
  .option-btn {
    font-size: 1.1rem;
  }
}