:root {
  --brand-indigo: #4f46e5;
  --brand-orange: #f97316;
  --brand-teal: #06b6d4;
  --bg-primary: #f8fafc;
  --text-primary: #0f172a;
  --brand-gradient: linear-gradient(
    135deg,
    var(--brand-indigo) 0%,
    #6366f1 100%
  );
}

body {
  font-family: "Gluten", cursive;
  padding-top: 64px;
  background-color: var(--bg-primary);
  background-image: linear-gradient(0deg, var(--bg-primary) 0%, #eef2ff 100%);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
}

.dark body {
  background-color: var(--text-primary);
  background-image: linear-gradient(135deg, #0f172a 0%, #1e1b4b 74%);
  color: #f8fafc;
}

/* Hot Deals Marquee Bar */
.hot-deals-bar {
  background: linear-gradient(
    90deg,
    #ec4899,
    #f43f5e,
    #f59e0b,
    #f43f5e,
    #ec4899
  );
  background-size: 200% auto;
  animation: bg-shift 4s linear infinite;
  color: white;
  height: 38px;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.hot-deals-marquee {
  display: flex;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  padding-left: 100%;
}

.hot-deals-item {
  display: flex;
  align-items: center;
  margin-right: 4rem;
}

.hot-deals-badge {
  background: #ffffff;
  color: #f43f5e;
  padding: 3px 10px;
  border-radius: 9999px;
  margin-right: 12px;
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.1em;
}

.hot-deals-code {
  margin-left: 6px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  letter-spacing: 0.15em;
  border: 1px dashed rgba(255, 255, 255, 0.6);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 13px;
  font-weight: 900;
  text-shadow: none;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes bg-shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}



/* Glassmorphism utility class */
.glass {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(79, 70, 229, 0.15);
}

.dark .glass {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.app-container::-webkit-scrollbar,
.history-panel::-webkit-scrollbar,
#dashboard-main-content::-webkit-scrollbar,
#quiz-content-wrapper::-webkit-scrollbar {
  width: 10px;
}

.app-container::-webkit-scrollbar-track,
.history-panel::-webkit-scrollbar-track,
#dashboard-main-content::-webkit-scrollbar-track,
#quiz-content-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 20px;
}

.app-container::-webkit-scrollbar-thumb,
.history-panel::-webkit-scrollbar-thumb,
#dashboard-main-content::-webkit-scrollbar-thumb,
#quiz-content-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, #6366f1 100%);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.3s ease;
}

.app-container::-webkit-scrollbar-thumb:hover,
.history-panel::-webkit-scrollbar-thumb:hover,
#dashboard-main-content::-webkit-scrollbar-thumb:hover,
#quiz-content-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6366f1 0%, var(--brand-indigo) 100%);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

.dark .app-container::-webkit-scrollbar-thumb,
.dark .history-panel::-webkit-scrollbar-thumb,
.dark #dashboard-main-content::-webkit-scrollbar-thumb,
.dark #quiz-content-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #818cf8 0%, var(--brand-indigo) 100%);
}

.dark .app-container::-webkit-scrollbar-thumb:hover,
.dark .history-panel::-webkit-scrollbar-thumb:hover,
.dark #dashboard-main-content::-webkit-scrollbar-thumb:hover,
.dark #quiz-content-wrapper::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #94a3b8 0%, #818cf8 100%);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.6);
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flashcard-flip {
  animation: flashcardFlip 0.6s ease-out;
}

@keyframes flashcardFlip {
  from {
    transform: perspective(1000px) rotateY(90deg);
    opacity: 0;
  }

  to {
    transform: perspective(1000px) rotateY(0deg);
    opacity: 1;
  }
}

.retro-option-btn.correct {
  background-color: #22c55e !important;
  /* green-500 */
  color: white !important;
}

.retro-option-btn.correct:active {
  transform: translateY(0);
  box-shadow: 0 4px 0 0 #111827;
}

.retro-option-btn.incorrect {
  background-color: #ef4444 !important;
  /* red-500 */
  color: white !important;
}

.retro-option-btn.incorrect:active {
  transform: translateY(0);
  box-shadow: 0 4px 0 0 #111827;
}

/* Default state for options */
.retro-option-btn {
  background-color: #d1d5db;
  /* gray-300 */
  color: #1f2937;
  /* gray-800 */
}

.dark .retro-option-btn {
  background-color: #4b5563;
  /* gray-600 */
  color: #f9fafb;
  /* gray-50 */
}

select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-enter {
  animation: fadeIn 0.3s ease-out;
}

.modal-leave {
  animation: fadeOut 0.3s ease-in;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.history-item.active {
  background-color: #e5e7eb;
  /* dark:bg-gray-700 */
}

.dark .history-item.active {
  background-color: #4b5563;
  /* dark:bg-gray-600 */
}

.duck-loader {
  width: 100px;
  height: 100px;
  margin-bottom: 1rem;
}

.duck-loader svg {
  animation: waddle 0.7s infinite ease-in-out;
}

@keyframes waddle {
  0%,
  100% {
    transform: rotate(-8deg) translateY(0px);
  }

  50% {
    transform: rotate(8deg) translateY(-8px);
  }
}

/* Slim Select Styles Override */
.ss-main,
.ss-content,
.ss-search input,
.ss-option {
  font-family: "Gluten", cursive !important;
}

.ss-main {
  border-radius: 0.375rem;
  border-width: 1px;
}

.ss-content {
  max-height: 40vh;
  /* Limits the list height to 40% of the browser window's height */
  overflow-y: auto;
  /* Adds a vertical scrollbar only when the list is too long */
}

/* --- Enhanced Dark Mode Styles --- */
.dark .ss-main {
  background-color: #374151;
  /* gray-700 */
  border-color: #4b5563;
  /* gray-600 */
  color: #f3f4f6;
  /* gray-100 */
}

.dark .ss-content {
  background-color: #374151;
  /* gray-700 */
  border-color: #4b5563;
  /* gray-600 */
}

/* Style for dropdown list items in dark mode */
.dark .ss-option {
  background-color: var(--brand-indigo);
  color: #ffffff;
  transition: background-color 0.2s ease-in-out;
  /* Adds a smooth hover effect */
}

/* Style for hovered/selected list items in dark mode */
.dark .ss-option:hover,
.dark .ss-option.ss-highlighted {
  background-color: #4338ca;
  /* A slightly darker indigo for hover effect */
  color: #ffffff;
}

/* Fix: Set text and placeholder color for the search input */
.dark .ss-search input {
  background-color: #4b5563;
  /* gray-600 */
  color: #f3f4f6;
  /* gray-100 */
}

.dark .ss-search input::placeholder {
  color: #9ca3af;
  /* gray-400 */
}

/* Fix: Set text color for the "No results" message */
.dark .ss-no-results {
  color: #9ca3af;
  /* gray-400 */
}

/* Fix: Ensure selected items in multi-select are visible */
.dark .ss-value-text {
  color: #f3f4f6;
  /* gray-100 */
}

/* --- Preloader Styles --- */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  /* Match light mode background */
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.5s,
    visibility 0.5s;
}

.dark #preloader {
  background-color: #0f172a;
  /* Match dark mode background */
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo {
  width: 80px;
  height: 80px;
  z-index: 10;
}

.pulsing-circles::before,
.pulsing-circles::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: rgba(139, 92, 246, 0.3);
  /* Indigo color with opacity */
  animation: pulse-ring 2s infinite ease-out;
}

.pulsing-circles::after {
  animation-delay: -1s;
}

@keyframes pulse-ring {
  0% {
    width: 0;
    height: 0;
    opacity: 0.5;
  }

  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

.loader-text {
  position: absolute;
  bottom: 15%;
  text-align: center;
  width: 100%;
  padding: 0 20px;
  color: #4a5568;
  /* A soft dark color for light mode */
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.dark .loader-text {
  color: #d1d5db;
  /* A soft light color for dark mode */
}

/* --- End Preloader Styles --- */

/* --- Mobile Responsiveness Fixes --- */
@media (max-width: 640px) {
  /* Fix hamburger menu alignment */
  #mobile-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }

  /* Fix mobile menu items centering */
  #mobile-menu .px-2 {
    text-align: center;
  }

  /* Fix mobile auth buttons centering */
  #mobile-auth-buttons {
    text-align: center;
  }

  #mobile-auth-buttons button {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0.5rem auto;
    text-align: center;
  }

  /* Fix mobile user info centering */
  #mobile-user-info .flex {
    justify-content: center;
    text-align: center;
  }

  #mobile-user-info .ml-3 {
    margin-left: 0;
    text-align: center;
  }

  /* Fix leaderboard table responsiveness */
  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Fix quiz/exam interface centering */
  #quiz-content-wrapper {
    padding: 1rem;
    padding-bottom: 10rem; /* Increased padding to clear fixed bottom nav */
    text-align: center;
    overflow-y: visible;
  }

  /* Explanation container scroll functionality */
  #explanation-preview,
  #explanation-full {
    max-height: none;
    overflow-y: visible;
  }

  /* Options container scroll for large option lists */
  .options-container {
    max-height: 400px;
    overflow-y: auto;
  }

  /* Question text scroll for very long questions */
  #quiz-content-wrapper .text-xl {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
  }

  .retro-option-btn {
    text-align: center;
    justify-content: center;
  }

  /* Fix dashboard elements centering */
  #dashboard-welcome {
    text-align: center;
  }

  #dashboard-welcome .w-16 {
    margin: 0 auto 1rem;
  }

  /* Fix filter view centering */
  #filter-view .flex-col {
    text-align: center;
  }

  #filter-view .w-10 {
    margin: 0 auto;
  }

  /* Fix account view centering */
  /* Account View Mobile Fixes */
  #account-view {
    padding: 0.5rem;
    margin: 0 auto;
    text-align: center;
  }

  #account-view .bg-white\/80,
  #account-view .dark\:bg-gray-900\/80 {
    padding: 1rem;
    margin: 0 auto;
    text-align: center;
  }

  #account-view .flex-col {
    text-align: center;
  }

  #account-view .h-24 {
    margin: 0 auto;
  }

  #account-view .flex {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  #account-view .gap-6 {
    gap: 1rem;
  }

  #account-view .space-y-1 {
    text-align: center;
  }

  #account-view .text-center,
  #account-view .sm\:text-left {
    text-align: center !important;
  }

  #account-view #account-back-btn {
    margin: 1rem auto 0 auto;
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  #account-view #account-management-container {
    text-align: center;
  }

  #account-view #account-management-container .flex {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  #account-view #change-password-btn,
  #account-view #account-logout-btn {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
  }

  #account-view #account-stats-container {
    text-align: center;
    margin-top: 2rem;
  }

  #account-view #account-stats-container h3 {
    margin-bottom: 1.5rem;
  }

  #account-view .grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
  }

  #account-view .bg-gray-200\/50,
  #account-view .dark\:bg-gray-800\/50 {
    margin: 0 auto;
    max-width: 100%;
    padding: 1.5rem;
  }

  #account-view .mt-8 {
    margin-top: 2rem;
  }

  #account-view canvas {
    margin: 0 auto;
    max-width: 100%;
  }

  /* Ensure proper spacing for mobile buttons */
  .retro-btn {
    margin: 0.25rem auto;
    display: inline-flex;
  }
}

/* Additional fixes for very small screens */
@media (max-width: 390px) {
  #mobile-menu .px-2 {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #mobile-auth-buttons button {
    max-width: 240px;
  }

  /* Account view fixes for very small screens */
  #account-view .bg-white\/80,
  #account-view .dark\:bg-gray-900\/80 {
    padding: 0.75rem;
  }

  #account-view .h-24 {
    height: 5rem;
    width: 5rem;
    font-size: 2.5rem;
  }

  #account-view h2 {
    font-size: 1.5rem;
  }

  #account-view .text-4xl {
    font-size: 2.5rem;
  }

  #account-view .p-6 {
    padding: 1rem;
  }

  #account-view .text-lg {
    font-size: 1.125rem;
  }

  #account-view .retro-btn {
    font-size: 0.875rem;
    padding: 0.75rem 1.25rem;
    min-width: 140px;
    width: 100%;
    max-width: 260px;
    margin: 0.25rem auto;
  }

  #account-view #change-password-btn,
  #account-view #account-logout-btn {
    max-width: 260px;
    padding: 0.75rem 1.25rem;
  }
}

/* Quiz/Exam Interface Mobile Fixes */
@media (max-width: 640px) {
  #quiz-content-wrapper {
    padding: 0.5rem;
    padding-bottom: 12rem; /* Even more padding for mobile small screens */
    margin: 0 auto;
    text-align: center;
    overflow-y: visible;
  }

  /* Dynamic content area scroll for mobile */
  .dynamic-content-area {
    max-height: none;
    overflow-y: visible;
  }

  /* Hide SVG icon container on mobile */
  #quiz-content-wrapper .flex > div:first-child {
    display: none;
  }

  #quiz-content-wrapper .quiz-container,
  #quiz-content-wrapper .exam-container {
    padding: 1rem;
    margin: 0 auto;
    text-align: center;
  }

  #quiz-content-wrapper .quiz-question,
  #quiz-content-wrapper .exam-question {
    text-align: center;
    margin: 0 auto 1rem auto;
    max-width: 100%;
  }

  #quiz-content-wrapper .quiz-options,
  #quiz-content-wrapper .exam-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    width: 100%;
    max-width: 320px;
  }

  #quiz-content-wrapper .quiz-option,
  #quiz-content-wrapper .exam-option {
    width: 100%;
    margin: 0.25rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  #quiz-content-wrapper .quiz-navigation,
  #quiz-content-wrapper .exam-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem auto;
    flex-wrap: wrap;
  }

  #quiz-content-wrapper .quiz-progress,
  #quiz-content-wrapper .exam-progress {
    margin: 0 auto 1rem auto;
    text-align: center;
  }

  #quiz-content-wrapper .quiz-timer,
  #quiz-content-wrapper .exam-timer {
    margin: 0 auto 1rem auto;
    text-align: center;
  }
}

/* Additional quiz/exam fixes for very small screens */
@media (max-width: 390px) {
  #quiz-content-wrapper .quiz-options,
  #quiz-content-wrapper .exam-options {
    max-width: 280px;
  }

  #quiz-content-wrapper .quiz-option,
  #quiz-content-wrapper .exam-option {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
  }

  #quiz-content-wrapper .quiz-navigation,
  #quiz-content-wrapper .exam-navigation {
    gap: 0.375rem;
  }

  #quiz-content-wrapper .quiz-navigation .retro-btn,
  #quiz-content-wrapper .exam-navigation .retro-btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.875rem;
    min-width: 80px;
  }
}

/* --- End Mobile Responsiveness Fixes --- */

/* Micro-animations */
.retro-btn {
  transition:
    transform 0.1s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.retro-btn:hover {
  transform: translateY(-2px);
}

.retro-btn:active {
  transform: translateY(1px);
}

/* Preloader Enhancements */
#preloader .loader-text {
  margin-top: 1rem;
  font-weight: bold;
  color: #4b5563;
  /* gray-600 */
  font-size: 1.1rem;
  transition: opacity 0.3s ease;
}

.dark #preloader .loader-text {
  color: #9ca3af;
  /* gray-400 */
}

/* Account Page Premium Animations */
@keyframes gradient-x {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-gradient-x {
  background-size: 200% 200%;
  animation: gradient-x 15s ease infinite;
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out;
}

/* Custom scrollbar for account page */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4f46e5, #7c3aed);
}

/* Dark mode scrollbar */
.dark .custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #818cf8, #a78bfa);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
}

/* --- New Quiz UI Styles --- */

/* Quiz Card Container */
.quiz-card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
}

.dark .quiz-card-glass {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

/* Modern Option Button */
.option-btn-modern {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-align: left;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  font-weight: 500;
  border: 2px solid transparent;
  background-color: white;
  color: #374151; /* gray-700 */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.dark .option-btn-modern {
  background-color: #374151; /* gray-700 */
  color: #e5e7eb; /* gray-200 */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.option-btn-modern:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border-color: #a5b4fc; /* indigo-300 */
}

.dark .option-btn-modern:hover:not(:disabled) {
  border-color: #6366f1; /* indigo-500 */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.option-btn-modern:active:not(:disabled) {
  transform: translateY(0);
}

/* Selected/Correct/Incorrect States */
.option-btn-modern.selected {
  border-color: #6366f1; /* indigo-500 */
  background-color: #eef2ff; /* indigo-50 */
  color: #4338ca; /* indigo-700 */
}

.dark .option-btn-modern.selected {
  border-color: #818cf8; /* indigo-400 */
  background-color: rgba(99, 102, 241, 0.2); /* indigo-500 with opacity */
  color: #e0e7ff; /* indigo-100 */
}

.option-btn-modern.correct {
  border-color: #22c55e !important; /* green-500 */
  background-color: #f0fdf4 !important; /* green-50 */
  color: #15803d !important; /* green-700 */
}

.dark .option-btn-modern.correct {
  background-color: rgba(34, 197, 94, 0.2) !important;
  color: #dcfce7 !important; /* green-100 */
}

.option-btn-modern.incorrect {
  border-color: #ef4444 !important; /* red-500 */
  background-color: #fef2f2 !important; /* red-50 */
  color: #b91c1c !important; /* red-700 */
}

.dark .option-btn-modern.incorrect {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #fee2e2 !important; /* red-100 */
}

/* Option Letter Badge */
.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: #f3f4f6; /* gray-100 */
  color: #6b7280; /* gray-500 */
  font-size: 0.875rem;
  font-weight: 700;
  margin-right: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.dark .option-letter {
  background-color: #4b5563; /* gray-600 */
  color: #d1d5db; /* gray-300 */
}

.option-btn-modern:hover .option-letter,
.option-btn-modern.selected .option-letter {
  background-color: #c7d2fe; /* indigo-200 */
  color: #4338ca; /* indigo-700 */
}

.dark .option-btn-modern:hover .option-letter,
.dark .option-btn-modern.selected .option-letter {
  background-color: #4f46e5; /* indigo-600 */
  color: white;
}

.option-btn-modern.correct .option-letter {
  background-color: #86efac; /* green-300 */
  color: #14532d; /* green-900 */
}

.dark .option-btn-modern.correct .option-letter {
  background-color: #22c55e;
  color: white;
}

.option-btn-modern.incorrect .option-letter {
  background-color: #fca5a5; /* red-300 */
  color: #7f1d1d; /* red-900 */
}

.dark .option-btn-modern.incorrect .option-letter {
  background-color: #ef4444;
  color: white;
}

/* Progress Bar Container */
.quiz-progress-container {
  height: 12px;
  background-color: #e5e7eb; /* gray-200 */
  border-radius: 9999px;
  overflow: hidden;
  margin: 10px 0;
  position: relative;
  display: block;
}

.dark .quiz-progress-container {
  background-color: #374151; /* gray-700 */
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 9999px;
  transition: width 0.5s ease-out;
}

/* Results Circle Animation */
.score-circle-svg {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.score-circle-bg {
  fill: none;
  stroke-width: 8;
}

.score-circle-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283; /* 2 * PI * 45 */
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Result Card Hover Effect */
.result-stat-card {
  transition: transform 0.2s;
}

.result-stat-card:hover {
  transform: translateY(-2px);
}
/* --- On Fire (Streak) Animations --- */
@keyframes fire-flicker {
  0%,
  100% {
    transform: scale(1) translateY(0);
    filter: drop-shadow(0 0 5px #fbbf24);
  }
  25% {
    transform: scale(1.05) translateY(-2px);
    filter: drop-shadow(0 0 10px #f59e0b);
  }
  50% {
    transform: scale(1.1) translateY(-1px);
    filter: drop-shadow(0 0 15px #ef4444);
  }
  75% {
    transform: scale(1.05) translateY(-3px);
    filter: drop-shadow(0 0 10px #f97316);
  }
}

@keyframes fire-glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow:
      0 0 20px rgba(239, 68, 68, 0.8),
      0 0 40px rgba(249, 115, 22, 0.4);
  }
}

.on-fire-icon {
  animation: fire-flicker 0.4s infinite alternate ease-in-out;
  display: inline-block;
}

.on-fire-card {
  animation: fire-glow 2s infinite ease-in-out;
  border-color: #ef4444 !important;
  background: linear-gradient(
    to bottom right,
    rgba(239, 68, 68, 0.1),
    rgba(249, 115, 22, 0.05)
  ) !important;
}

.streak-burn {
  position: relative;
  overflow: hidden;
}

.streak-burn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(239, 68, 68, 0.1) 0%,
    transparent 70%
  );
  animation: rotate 4s linear infinite;
  pointer-events: none;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Premium Quiz Filter Redesign --- */
:root {
  --quiz-primary: #8b5cf6;
  --quiz-primary-hover: #7c3aed;
  --quiz-accent: #fbbf24;
  --quiz-accent-hover: #f59e0b;
  --quiz-card-bg: #fffdf5;
  --quiz-border-gradient: linear-gradient(90deg, #fbbf24, #a78bfa, #f472b6);
}

.dark {
  --quiz-card-bg: #1e293b;
}

.premium-quiz-card {
  background: var(--quiz-card-bg);
  border-radius: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.1);
}

.premium-quiz-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--quiz-border-gradient);
}

.lux-select-group {
  position: relative;
  margin-bottom: 1.25rem;
}

.lux-label {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.dark .lux-label {
  color: #94a3b8;
}

.lux-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #f1f5f9;
  border-radius: 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #1e293b;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
}

.dark .lux-select {
  background-color: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.lux-select:focus {
  outline: none;
  border-color: var(--quiz-primary);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.quiz-mode-selector {
  background: #f1f5f9;
  padding: 0.375rem;
  border-radius: 1rem;
  display: flex;
  gap: 0.25rem;
}

.dark .quiz-mode-selector {
  background: #334155;
}

.quiz-mode-option {
  flex: 1;
  text-align: center;
  padding: 0.625rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-mode-option:has(input:checked) {
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  color: var(--quiz-primary);
}

.dark .quiz-mode-option:has(input:checked) {
  background: #1e293b;
  color: var(--brand-indigo);
}

.btn-generate {
  background: linear-gradient(135deg, var(--brand-orange) 0%, #fb923c 100%);
  color: white;
  padding: 1.125rem;
  border-radius: 1.25rem;
  font-weight: 800;
  font-size: 1.125rem;
  width: 100%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.3);
  transition: all 0.3s;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(249, 115, 22, 0.4);
}

.btn-favorite {
  background: rgba(6, 182, 212, 0.08);
  border: 2px solid rgba(6, 182, 212, 0.2);
  color: #0891b2;
  padding: 0.875rem;
  border-radius: 1.25rem;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.dark .btn-favorite {
  color: var(--brand-teal);
}

.btn-favorite:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
}

.premium-icon-box {
  width: 3.5rem;
  height: 3.5rem;
  background: white;
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .premium-icon-box {
  background: #334155;
}

/* Float Animation */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* --- Luxury Auth Redesign --- */
.lux-auth-card {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.lux-auth-input-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.lux-auth-field {
  width: 100%;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  font-weight: 500;
  color: #1e293b;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .lux-auth-field {
  background: #0f172a;
  border-color: #1e293b;
  color: #f1f5f9;
}

.lux-auth-field:focus {
  outline: none;
  border-color: var(--brand-indigo);
  background: white;
  box-shadow:
    0 0 0 4px rgba(79, 70, 229, 0.1),
    0 10px 15px -3px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.dark .lux-auth-field:focus {
  background: #1e293b;
  box-shadow:
    0 0 0 4px rgba(79, 70, 229, 0.2),
    0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.lux-auth-field::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.lux-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lux-divider::before,
.lux-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}

.dark .lux-divider::before,
.dark .lux-divider::after {
  border-color: #334155;
}

.lux-divider:not(:empty)::before {
  margin-right: 1rem;
}

.lux-divider:not(:empty)::after {
  margin-left: 1rem;
}

.lux-google-btn {
  width: 100%;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  background: white !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 1.25rem !important;
  padding: 0.25rem !important; /* Slimmer padding for the iframe container */
  transition: all 0.3s !important;
  overflow: hidden;
}

.dark .lux-google-btn {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.lux-google-btn:hover {
  border-color: var(--brand-indigo) !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

/* Modal Animations */
@keyframes lux-modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lux-modal-content {
  animation: lux-modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lux-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.auth-error-shake {
  animation: lux-shake 0.3s ease-in-out;
}

/* Skeleton loading states */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.2) 25%,
    rgba(148, 163, 184, 0.35) 50%,
    rgba(148, 163, 184, 0.2) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 0.5rem;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(71, 85, 105, 0.3) 25%,
    rgba(71, 85, 105, 0.5) 50%,
    rgba(71, 85, 105, 0.3) 75%
  );
  background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
  to {
    background-position: 200% 0;
  }
}

.skeleton-text {
  height: 1rem;
}
.skeleton-title {
  height: 1.5rem;
  width: 70%;
}
.skeleton-card {
  height: 4rem;
}
.skeleton-option {
  height: 3rem;
}
.skeleton-question {
  height: 2.5rem;
  width: 100%;
  margin-bottom: 0.75rem;
}
.skeleton-block {
  height: 6rem;
  border-radius: 0.75rem;
}

/* Contextual tooltips */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
  max-width: 240px;
  white-space: normal;
  text-align: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 100;
  pointer-events: none;
  animation: tooltip-fade 0.15s ease;
}
.dark [data-tooltip]:hover::after {
  background: rgba(30, 41, 59, 0.98);
  color: #f1f5f9;
}
[data-tooltip][data-tooltip-pos="bottom"]:hover::after {
  bottom: auto;
  top: 100%;
  transform: translateX(-50%) translateY(6px);
}
@keyframes tooltip-fade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
  }
}
[data-tooltip][data-tooltip-pos="bottom"]:hover::after {
  animation: tooltip-fade-bottom 0.15s ease;
}
@keyframes tooltip-fade-bottom {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(6px);
  }
}

/* Breadcrumb */
.breadcrumb-nav.hidden {
  display: none;
}
.breadcrumb-link {
  cursor: pointer;
}
.breadcrumb-nav ol {
  list-style: none;
}
.breadcrumb-nav li {
  display: inline-flex;
  align-items: center;
}

/* Accessibility: font size */
html.a11y-font-large {
  font-size: 112.5%;
}
html.a11y-font-larger {
  font-size: 125%;
}

/* Accessibility: high contrast */
html.a11y-high-contrast body,
html.a11y-high-contrast .retro-btn,
html.a11y-high-contrast input,
html.a11y-high-contrast select,
html.a11y-high-contrast textarea {
  border-width: 2px;
  border-color: currentColor;
}
html.a11y-high-contrast .retro-option-btn,
html.a11y-high-contrast .retro-button-primary,
html.a11y-high-contrast .retro-btn {
  border-width: 2px;
}
html.a11y-high-contrast:not(.dark) body {
  background: #fff;
  color: #111;
}
html.a11y-high-contrast.dark body {
  background: #0a0a0a;
  color: #f5f5f5;
}
html.a11y-high-contrast a {
  text-decoration: underline;
}
