/* Tailwind provides base styling; these are minimal helpers if needed */
.chat-msg { max-width: 80%; }
.chat-user { align-self: flex-end; }
.chat-assistant { align-self: flex-start; }

/* Focus ring for keyboard users */
:focus-visible { outline: 2px solid rgb(99 102 241); outline-offset: 2px; }

/* Spinner fallback (if Tailwind animate-spin not present for any reason) */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }

/* Smooth section transitions (do not override Tailwind 'hidden') */
#tab-learn, #tab-practice, #tab-quiz, #tab-review, #tab-games { transition: opacity 150ms ease; }

/* App wide visuals */
html, body { font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; }
.app-bg {
  background: radial-gradient(1200px 600px at -10% -20%, rgba(220, 38, 38, 0.15), transparent 50%),
              radial-gradient(1000px 500px at 110% -10%, rgba(37, 99, 235, 0.12), transparent 55%),
              radial-gradient(1000px 600px at 50% 120%, rgba(249, 115, 22, 0.12), transparent 55%),
              #1e293b;
}
.dark .app-bg {
  background: radial-gradient(1200px 600px at -10% -20%, rgba(220, 38, 38, 0.15), transparent 50%),
              radial-gradient(1000px 500px at 110% -10%, rgba(37, 99, 235, 0.12), transparent 55%),
              radial-gradient(1000px 600px at 50% 120%, rgba(249, 115, 22, 0.12), transparent 55%),
              #1e293b;
}

/* Glass and hover lift (neutral, clear glass) */
.glass-card {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(10px);
}
.dark .glass-card {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(10px);
}

/* Welcome auth gate styles */
.welcome-card {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(15,23,42,0.9), rgba(15,23,42,0.75));
  color: rgb(226 232 240);
  box-shadow: 0 24px 60px rgba(2,6,23,0.45);
}
.icon-badge {
  width: 44px; height: 44px; border-radius: 9999px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.35), rgba(37,99,235,0.35));
  border: 1px solid rgba(99,102,241,0.5);
  box-shadow: 0 8px 22px rgba(37,99,235,0.25);
}
.welcome-title { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.2px; }
.welcome-sub { font-size: 0.9rem; color: rgb(148 163 184); margin-top: 0.15rem; }
.welcome-list { margin-top: 0.6rem; font-size: 0.85rem; color: rgb(203 213 225); list-style: none; padding: 0; }
.welcome-list li { position: relative; padding-left: 1.1rem; margin: 0.2rem 0; }
.welcome-list li::before { content: '✓'; position: absolute; left: 0; color: rgb(16 185 129); }
.welcome-fine { margin-top: 0.5rem; font-size: 0.75rem; color: rgb(148 163 184); }

.btn-primary {
  padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: 0.5rem; color: white;
  background: linear-gradient(135deg, rgb(59 130 246), rgb(37 99 235));
  border: 1px solid rgb(37 99 235);
  box-shadow: 0 10px 24px rgba(37,99,235,0.35);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 120ms ease;
}
.btn-primary:hover { filter: brightness(0.98); transform: translateY(-1px); }
.btn-secondary {
  padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: 0.5rem;
  border: 1px solid rgba(148,163,184,0.35); color: rgb(203 213 225);
  background: rgba(15,23,42,0.35);
}

/* Auth modal styles */
.auth-card {
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 0.9rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(15,23,42,0.78));
  color: rgb(226 232 240);
  box-shadow: 0 28px 72px rgba(2,6,23,0.55);
}
.auth-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem;
}
.auth-title { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
.auth-sub { font-size: .8rem; color: rgb(148 163 184); margin-bottom: .5rem; }
.auth-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .75rem; }

.input-wrap {
  display: flex; align-items: center; gap: .5rem; margin-top: .25rem;
  padding: .5rem .6rem; border-radius: .55rem;
  border: 1px solid rgba(71,85,105,.6);
  background: rgba(2,6,23,.35);
}
.input-wrap:focus-within {
  border-color: rgba(99,102,241,.8);
  box-shadow: 0 0 0 2px rgba(99,102,241,.25);
}
.input-icon { width: 16px; height: 16px; color: rgb(148 163 184);
  display: grid; place-items: center; }
.input-field { flex: 1; background: transparent; border: 0; outline: none; color: rgb(226 232 240); font-size: .9rem; }
.input-help { font-size: 11px; color: rgb(148 163 184); margin-top: .25rem; }

.btn-muted { border: 1px solid rgba(148,163,184,0.35); color: rgb(203 213 225); background: rgba(15,23,42,0.35); }

/* Lesson tickets */
.ticket-card {
  background: rgba(139, 92, 246, 0.18); /* indigo/purple pastel */
  border-color: rgba(168, 85, 247, 0.45);
}
.ticket-card:hover {
  background: rgba(139, 92, 246, 0.22);
}

.btn-lift { transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
.btn-lift:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(2, 6, 23, 0.08); }

.card-hover { transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12); }

/* Flashcard area shows pointer */
#practice-flashcard { cursor: pointer; }

/* Grid flashcards */
.flashcard {
  cursor: pointer;
  perspective: 800px;
  position: relative;
}
/* persistent learned badge */
.learned-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: rgba(16,185,129,0.85);
  color: white;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(16,185,129,0.35);
  z-index: 2;
}
.flashcard-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 300ms ease;
  min-height: 120px;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backface-visibility: hidden;
}
.flashcard-back { transform: rotateY(180deg); } 

/* Navigation tiles */
.tile-btn {
  transition: transform 180ms ease, box-shadow 200ms ease, background-color 150ms ease;
}
.tile-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.22);
}
.tile-btn:focus-visible {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 3px;
}

/* Start forward quiz CTA — nicer blue */
#startForwardQuizBtn,
[data-action="start-forward-quiz"] {
  background-color: rgb(59 130 246); /* blue-500 fallback */
  background-image: linear-gradient(135deg, rgb(59 130 246), rgb(37 99 235)); /* blue-500 → blue-600 */
  color: white;
  border-color: rgb(37 99 235); /* blue-600 */
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 120ms ease;
}
#startForwardQuizBtn:hover,
[data-action="start-forward-quiz"]:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
#startForwardQuizBtn:active,
[data-action="start-forward-quiz"]:active { transform: translateY(0); } 

/* Matching game — modern styles and animations */
.match-item {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: rgb(226 232 240);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.65));
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 200ms ease;
  backdrop-filter: blur(6px);
}
.match-item:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(2, 6, 23, 0.28); }
.match-item:focus-visible { outline: 2px solid rgb(99 102 241); outline-offset: 3px; }
.match-item.selected {
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.75), rgba(30, 58, 138, 0.7));
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.35);
  animation: match-bounce 260ms ease;
}
.match-item.correct {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.85), rgba(5, 150, 105, 0.8));
  border-color: rgba(16, 185, 129, 0.8);
  color: white;
  animation: match-pop 320ms ease;
}
.match-item.wrong { animation: match-shake 420ms ease; }
.match-item.disabled { opacity: 0.45; pointer-events: none; }

/* Connector overlay */
#game-connector-overlay { position: absolute; inset: 0; pointer-events: none; }
.connector-line { stroke: rgba(148, 163, 184, 0.6); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.connector-line.active { stroke: rgba(99, 102, 241, 0.9); filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.45)); }
.connector-line.correct { stroke: rgba(16, 185, 129, 0.95); filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.55)); }

/* Sparkles for correct match */
.sparkle { position: absolute; pointer-events: none; font-size: 12px; opacity: 0; transform: translate(-50%, -50%) scale(0.6); animation: sparkle-fly 900ms ease forwards; }

@keyframes match-bounce { 0% { transform: translateY(0); } 40% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
@keyframes match-pop { 0% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes match-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@keyframes sparkle-fly {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(0deg); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + (var(--dx, 0) * 1px)), calc(-50% + (var(--dy, 0) * 1px))) scale(1.1) rotate(360deg); }
} 

/* Falling Words game */
.falling-area { position: relative; background: linear-gradient(180deg, rgba(2,6,23,0.15), rgba(2,6,23,0.35)); }
.falling-word {
  position: absolute;
  left: 12.5%; /* will be overridden per lane using translateX */
  transform: translate(-50%, -50%);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: white;
  background: linear-gradient(180deg, rgba(99,102,241,0.75), rgba(37,99,235,0.75));
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.35);
  white-space: nowrap;
  pointer-events: none;
}
.falling-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,6,23,0.55); font-size: 42px; color: white; text-shadow: 0 6px 24px rgba(0,0,0,0.45); z-index: 2; }
.falling-choice { position: relative; min-height: 2.25rem; }
.falling-choice.correct { background: linear-gradient(180deg, rgba(16,185,129,0.85), rgba(5,150,105,0.85)); color: white; border-color: rgba(16,185,129,0.8); }
.falling-choice.wrong { animation: match-shake 420ms ease; }
.falling-choice.flash { box-shadow: 0 0 0 2px rgba(239,68,68,0.6) inset; }
.falling-lane-hint { position: absolute; inset: 0; pointer-events: none; display: grid; grid-template-columns: repeat(4, 1fr); opacity: 0.06; }
.falling-lane-hint > div { border-right: 1px solid rgba(148,163,184,0.3); }
.falling-lane-hint > div:last-child { border-right: none; } 

/* Split Decision */
.sd-pair.correct { color: rgb(16 185 129); }
.sd-pair.wrong { color: rgb(239 68 68); animation: match-shake 420ms ease; }
.sd-btn.sd-true { background: linear-gradient(180deg, rgba(16,185,129,0.15), rgba(5,150,105,0.15)); }
.sd-btn.sd-false { background: linear-gradient(180deg, rgba(239,68,68,0.15), rgba(220,38,38,0.15)); }
.sd-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,6,23,0.55); color: white; font-size: 36px; text-shadow: 0 6px 24px rgba(0,0,0,0.45); z-index: 2; } 

/* Quiz visuals */
.quiz-card { background: linear-gradient(180deg, rgba(2,6,23,0.35), rgba(2,6,23,0.6)); border: 1px solid rgba(51,65,85,0.65); box-shadow: 0 12px 30px rgba(2,6,23,0.32); }
.quiz-question { font-size: 1.125rem; font-weight: 600; letter-spacing: 0.2px; color: #ffffff !important; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
#quiz-question { color: #ffffff !important; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.quiz-question-animate { animation: quiz-fade-in 240ms ease; }
.quiz-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.quiz-choice {
  position: relative; text-align: left; padding: 0.6rem 0.75rem; border-radius: 0.5rem;
  border: 1px solid rgba(148,163,184,0.25); color: rgb(226 232 240);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.65));
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.22);
  transition: transform 140ms ease, box-shadow 160ms ease, background 160ms ease;
}
.quiz-choice:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(2, 6, 23, 0.3); }
.quiz-choice:focus-visible { outline: 2px solid rgb(99 102 241); outline-offset: 3px; }
.quiz-choice.correct { background: linear-gradient(180deg, rgba(16,185,129,0.85), rgba(5,150,105,0.8)); border-color: rgba(16,185,129,0.8); color: white; animation: match-pop 300ms ease; }
.quiz-choice.wrong { border-color: rgba(239,68,68,0.6); background: linear-gradient(180deg, rgba(127,29,29,0.35), rgba(69,10,10,0.35)); animation: match-shake 420ms ease; }
.quiz-choice.disabled { opacity: 0.7; pointer-events: none; }
.quiz-feedback { min-height: 1.25rem; color: rgb(226 232 240); }
.quiz-progress-pill { padding: 0.2rem 0.5rem; border-radius: 9999px; background: rgba(99,102,241,0.15); color: rgb(148,163,184); }
.quiz-next { background: linear-gradient(135deg, rgb(59 130 246), rgb(37 99 235)); color: white; border: 1px solid rgb(37 99 235); box-shadow: 0 8px 22px rgba(37, 99, 235, 0.3); }
.quiz-next:hover { filter: brightness(0.98); }
.quiz-input { color: #0f172a; background: #fff; } /* ensure readable in light mode */
.dark .quiz-input { color: #e2e8f0; background: transparent; }
.quiz-input.correct { box-shadow: 0 0 0 2px rgba(16,185,129,0.8) inset; }
.quiz-input.wrong { box-shadow: 0 0 0 2px rgba(239,68,68,0.7) inset; }
#quizPassAE, #quizPassEA { padding: 0.1rem 0.5rem; border-radius: 9999px; background: rgba(15,23,42,0.6); border: 1px solid rgba(51,65,85,0.6); }

@keyframes quiz-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } } 
#stepLearn, #stepPractice, #stepQuizAE, #stepQuizEA { cursor: pointer; }

/* Enhanced Progress Bar Styling */
.header-progress {
  transition: all 0.3s ease;
}

.header-progress:hover {
  transform: translateY(-0.5px);
}

/* Level indicator animations */
#levelIndicator {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress text enhancements */
#headerLevelProgress {
  transition: all 0.4s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#headerLevelProgress:hover {
  transform: scale(1.05);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

/* Level milestone styling */
#levelMilestone {
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Simple Progress Styling */
#headerProgressBar {
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px; /* Ensure progress bar is always visible */
}

.integrated-progress-bar {
  position: relative;
  background: linear-gradient(135deg, 
    rgba(51, 65, 85, 0.4) 0%, 
    rgba(30, 41, 59, 0.6) 50%, 
    rgba(51, 65, 85, 0.4) 100%);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.2),
    0 0.5px 1px rgba(255, 255, 255, 0.1);
}

.progress-subtle-glow {
  filter: drop-shadow(0 0 3px currentColor);
  transition: all 0.5s ease-out;
}

.emoji-subtle {
  transition: all 0.3s ease;
}

.emoji-subtle:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px currentColor);
}



/* Enhanced shimmer effect with level progression */
.progress-fill {
  position: relative;
  overflow: hidden;
  border-radius: inherit;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: level-shimmer 2.5s infinite;
}

@keyframes level-shimmer {
  0% { left: -100%; opacity: 0.5; }
  50% { opacity: 1; }
  100% { left: 100%; opacity: 0.3; }
}

/* Level-specific progress enhancement */
.progress-fill:hover::after {
  animation-duration: 1.8s;
}

/* Progress bar milestone effects */
.progress-milestone-glow {
  box-shadow: 
    0 0 10px currentColor,
    0 0 20px rgba(16, 185, 129, 0.3),
    inset 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Dynamic level indicator pulse */
@keyframes level-indicator-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
    filter: brightness(1.2);
  }
}



/* Level-specific progress colors with subtle glow */
.level-progress-glow {
  transition: all 0.5s ease-out;
}





/* Responsive design */
@media (max-width: 768px) {
  .header-progress {
    gap: 0.5rem;
    padding: 6px 10px;
    border-radius: 10px;
  }
  
  .header-progress .text-sm {
    font-size: 0.75rem;
  }
  
  .integrated-progress-bar {
    width: 96px;
  }
  
  .emoji-subtle {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .header-progress {
    gap: 0.375rem;
    padding: 4px 8px;
  }
  
  .header-progress .text-sm {
    font-size: 0.7rem;
  }
  
  .integrated-progress-bar {
    width: 80px;
  }
  
  .header-progress:hover {
    transform: translateY(-1px) scale(1.01);
  }
  
  /* Reduce animation complexity on mobile */
  .progress-fill::after {
    animation-duration: 4s;
  }
}

/* Smooth progress bar fill animation */
.progress-fill {
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced focus states for accessibility */
.header-progress:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
}

/* ===== ENHANCED SETTINGS MODAL STYLES ===== */

/* Settings Modal Card */
.settings-card {
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.95) 0%, 
    rgba(15, 23, 42, 0.98) 100%),
    linear-gradient(45deg, rgba(59, 130, 246, 0.02), rgba(147, 51, 234, 0.02));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(71, 85, 105, 0.4);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(148, 163, 184, 0.08) inset,
    0 0 20px rgba(59, 130, 246, 0.05) inset;
  animation: settings-modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}

.dark .settings-card {
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.95) 0%, 
    rgba(30, 41, 59, 0.95) 100%);
  border: 1px solid rgba(71, 85, 105, 0.3);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

@keyframes settings-modal-enter {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Settings Header */
.settings-header {
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.8) 0%, 
    rgba(15, 23, 42, 0.9) 100%);
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.dark .settings-header {
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.8) 0%, 
    rgba(30, 41, 59, 0.6) 100%);
  border-bottom: 1px solid rgba(71, 85, 105, 0.2);
}

.settings-icon {
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  animation: settings-icon-pulse 2s ease-in-out infinite;
}

@keyframes settings-icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Close Button */
.settings-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: #64748b;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-close-btn:hover {
  color: #475569;
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.3);
  transform: scale(1.05);
}

.dark .settings-close-btn {
  color: #94a3b8;
  background: rgba(71, 85, 105, 0.2);
  border: 1px solid rgba(71, 85, 105, 0.3);
}

.dark .settings-close-btn:hover {
  color: #cbd5e1;
  background: rgba(71, 85, 105, 0.3);
  border-color: rgba(71, 85, 105, 0.4);
}

/* Settings Sections */
.settings-section {
  padding: 1rem;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, 
    rgba(51, 65, 85, 0.4) 0%, 
    rgba(30, 41, 59, 0.6) 100%);
  border: 1px solid rgba(71, 85, 105, 0.3);
  transition: all 0.3s ease;
}

.settings-section:hover {
  background: linear-gradient(180deg, 
    rgba(51, 65, 85, 0.6) 0%, 
    rgba(30, 41, 59, 0.8) 100%);
  border-color: rgba(71, 85, 105, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark .settings-section {
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.6) 0%, 
    rgba(15, 23, 42, 0.4) 100%);
  border: 1px solid rgba(71, 85, 105, 0.2);
}

.dark .settings-section:hover {
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.8) 0%, 
    rgba(15, 23, 42, 0.6) 100%);
  border-color: rgba(71, 85, 105, 0.3);
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-icon {
  font-size: 1rem;
  opacity: 0.8;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.025em;
}

.dark .section-title {
  color: #e5e7eb;
}

/* Section Content */
.section-content > * + * {
  margin-top: 0.75rem;
}

/* Account Info */
.account-info {
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.5rem;
  border: 1px solid rgba(55, 65, 81, 0.4);
}

.dark .account-info {
  background: rgba(17, 24, 39, 0.6);
  border-color: rgba(55, 65, 81, 0.4);
}

.account-email {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.email-icon {
  font-size: 0.875rem;
  opacity: 0.7;
}

.email-text {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 500;
}

.dark .email-text {
  color: #9ca3af;
}

/* Account Actions */
.account-actions {
  margin-top: 0.75rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid;
  cursor: pointer;
}

.sync-btn {
  color: #3b82f6;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  border-color: rgba(59, 130, 246, 0.3);
}

.sync-btn:hover {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.signout-btn {
  color: #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border-color: rgba(239, 68, 68, 0.3);
}

.signout-btn:hover {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Custom Select */
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.custom-select {
  appearance: none;
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e2e8f0;
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.9) 0%, 
    rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(71, 85, 105, 0.5);
  border-radius: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.custom-select:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.custom-select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.dark .custom-select {
  color: #e5e7eb;
  background: linear-gradient(180deg, 
    rgba(30, 41, 59, 0.9) 0%, 
    rgba(15, 23, 42, 0.9) 100%);
  border-color: rgba(55, 65, 81, 0.5);
}

.dark .custom-select:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.dark .custom-select:focus {
  border-color: rgba(59, 130, 246, 0.7);
}

.select-arrow {
  position: absolute;
  right: 0.75rem;
  color: #6b7280;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.dark .select-arrow {
  color: #9ca3af;
}

.custom-select:focus + .select-arrow {
  transform: rotate(180deg);
}

/* Error Message */
.error-message {
  font-size: 0.75rem;
  color: #ef4444;
  min-height: 1rem;
  font-weight: 500;
  padding: 0.25rem 0;
}

/* Legal Links */
.legal-links {
  margin-bottom: 0.75rem;
}

.legal-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(71, 85, 105, 0.4);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.legal-link:hover {
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(71, 85, 105, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .legal-link {
  color: #9ca3af;
  background: rgba(17, 24, 39, 0.4);
  border-color: rgba(55, 65, 81, 0.4);
}

.dark .legal-link:hover {
  color: #d1d5db;
  background: rgba(17, 24, 39, 0.6);
  border-color: rgba(55, 65, 81, 0.6);
}

/* Data Actions - Grid layout handled by Tailwind classes in HTML */

.data-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: 1px solid;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-align: left;
}

.export-btn {
  color: #059669;
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.1), rgba(4, 120, 87, 0.05));
  border-color: rgba(5, 150, 105, 0.3);
}

.export-btn:hover {
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.15), rgba(4, 120, 87, 0.1));
  border-color: rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.delete-btn {
  color: #dc2626;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.1), rgba(185, 28, 28, 0.05));
  border-color: rgba(220, 38, 38, 0.3);
}

.delete-btn:hover {
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.15), rgba(185, 28, 28, 0.1));
  border-color: rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

/* Privacy Note */
.privacy-note {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.4;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(71, 85, 105, 0.3);
}

.dark .privacy-note {
  color: #9ca3af;
  border-color: rgba(55, 65, 81, 0.3);
}

/* Settings Footer */
.settings-footer {
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.8) 0%, 
    rgba(30, 41, 59, 0.9) 100%);
  border-top: 1px solid rgba(71, 85, 105, 0.3);
}

.dark .settings-footer {
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.6) 0%, 
    rgba(30, 41, 59, 0.8) 100%);
  border-top: 1px solid rgba(71, 85, 105, 0.2);
}

/* Save Button */
.save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: 1px solid #2563eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.save-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.save-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* Modal Backdrop Enhancement */
#settingsModal.flex {
  backdrop-filter: blur(8px);
  animation: backdrop-fade-in 0.25s ease-out;
}

@keyframes backdrop-fade-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

/* Responsive Design */
@media (max-width: 640px) {
  .settings-card {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  
  .settings-header {
    padding: 1rem;
  }
  
  .settings-content {
    padding: 1rem;
  }
  
  .settings-content > * + * {
    margin-top: 1rem;
  }
  
  .settings-footer {
    padding: 1rem;
  }
}

@media (min-width: 1024px) {
  .settings-section {
    padding: 1.5rem;
  }
  
  .section-header {
    margin-bottom: 1rem;
  }
  
  .section-icon {
    font-size: 1.125rem;
  }
  
  .section-title {
    font-size: 1rem;
  }
}

/* Focus States for Accessibility */
.action-btn:focus-visible,
.data-action-btn:focus-visible,
.legal-link:focus-visible,
.save-btn:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: 2px;
}

/* Loading States */
.save-btn.loading {
  opacity: 0.8;
  cursor: not-allowed;
}

.save-btn.loading svg {
  animation: spin 1s linear infinite;
}

/* Learned List Scrollable Container */
.learned-list-container {
  flex: 1;
  max-height: calc(100vh - 12rem); /* Constrain height to match main content */
  overflow-y: scroll; /* Always show scrollbar */
  overflow-x: hidden;
  padding-right: 0.5rem; /* More space for always-visible scrollbar */
  scrollbar-width: auto; /* Use default width for better visibility */
  scrollbar-color: rgba(148, 163, 184, 0.7) rgba(30, 41, 59, 0.5); /* More visible colors */
  min-height: 0; /* Allow flex item to shrink */
}

/* Custom scrollbar for webkit browsers - always visible */
.learned-list-container::-webkit-scrollbar {
  width: 10px; /* Wider for better visibility */
}

.learned-list-container::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.6); /* More visible track */
  border-radius: 5px;
}

.learned-list-container::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7); /* More visible thumb */
  border-radius: 5px;
  transition: background 0.2s ease;
}

.learned-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.9); /* Even more visible on hover */
}

/* Smooth scrolling */
.learned-list-container {
  scroll-behavior: smooth;
}

/* Add subtle fade at bottom to indicate more content */
.learned-list-container::after {
  content: '';
  position: sticky;
  bottom: 0;
  display: block;
  height: 1rem;
  background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.8));
  pointer-events: none;
  margin-top: -1rem;
}

/* ===== ENHANCED CELEBRATION STYLES ===== */

/* Achievement Modal */
.achievement-card {
  background: linear-gradient(145deg, 
    rgba(30, 41, 59, 0.98) 0%, 
    rgba(15, 23, 42, 0.95) 50%,
    rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 0 60px rgba(59, 130, 246, 0.3);
  animation: achievement-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.achievement-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.1) 0%, 
    rgba(147, 51, 234, 0.1) 25%,
    rgba(236, 72, 153, 0.1) 50%,
    rgba(249, 115, 22, 0.1) 75%,
    rgba(59, 130, 246, 0.1) 100%);
  border-radius: inherit;
  opacity: 0.5;
  z-index: -1;
}

@keyframes achievement-enter {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(50px) rotateX(15deg);
  }
  50% {
    transform: scale(1.05) translateY(-10px) rotateX(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotateX(0deg);
  }
}

.achievement-content {
  position: relative;
  z-index: 1;
}

.achievement-emoji {
  filter: drop-shadow(0 0 20px currentColor);
  animation: achievement-emoji-float 3s ease-in-out infinite;
}

@keyframes achievement-emoji-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.1); }
}

.achievement-title {
  text-shadow: 0 2px 10px rgba(59, 130, 246, 0.5);
  animation: achievement-title-glow 2s ease-in-out infinite alternate;
}

@keyframes achievement-title-glow {
  0% { text-shadow: 0 2px 10px rgba(59, 130, 246, 0.5); }
  100% { text-shadow: 0 2px 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(147, 51, 234, 0.3); }
}

.achievement-level {
  animation: achievement-level-pulse 1.5s ease-in-out infinite;
}

@keyframes achievement-level-pulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.achievement-btn {
  box-shadow: 
    0 4px 14px rgba(59, 130, 246, 0.4),
    0 0 20px rgba(59, 130, 246, 0.2) inset;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.achievement-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent);
  transition: left 0.5s ease;
}

.achievement-btn:hover::before {
  left: 100%;
}

.achievement-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 25px rgba(59, 130, 246, 0.5),
    0 0 30px rgba(59, 130, 246, 0.3) inset;
}

.achievement-glow {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle, 
    rgba(59, 130, 246, 0.2) 0%, 
    rgba(147, 51, 234, 0.1) 50%, 
    transparent 70%);
  border-radius: 2rem;
  z-index: -2;
  animation: achievement-glow-pulse 3s ease-in-out infinite;
}

@keyframes achievement-glow-pulse {
  0%, 100% { 
    opacity: 0.5; 
    transform: scale(1); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1); 
  }
}

/* Screen Flash Effect */
.screen-flash {
  animation: screen-flash-effect 0.4s ease-out;
}

@keyframes screen-flash-effect {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* Enhanced Confetti Styles */
.level-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  user-select: none;
  font-weight: bold;
}

/* Progress Milestone Celebrations */
.milestone-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, 
    rgba(16, 185, 129, 0.95) 0%, 
    rgba(5, 150, 105, 0.95) 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 
    0 10px 25px rgba(16, 185, 129, 0.3),
    0 0 20px rgba(16, 185, 129, 0.2) inset;
  z-index: 1000;
  animation: milestone-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes milestone-slide-in {
  0% {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.milestone-notification.slide-out {
  animation: milestone-slide-out 0.3s ease-in forwards;
}

@keyframes milestone-slide-out {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }
}

/* Responsive Achievement Modal */
@media (max-width: 640px) {
  .achievement-card {
    margin: 1rem;
    border-radius: 1rem;
  }
  
  .achievement-content {
    padding: 1.5rem;
  }
  
  .achievement-emoji {
    font-size: 3rem;
    margin-bottom: 1rem;
  }
  
  .achievement-title {
    font-size: 1.5rem;
  }
  
  .achievement-level {
    font-size: 1.125rem;
  }
}

/* Accessibility improvements for celebrations */
@media (prefers-reduced-motion: reduce) {
  .achievement-card,
  .achievement-emoji,
  .achievement-title,
  .achievement-level,
  .achievement-glow {
    animation: none !important;
  }
  
  .screen-flash {
    display: none !important;
  }
  
  .level-confetti {
    display: none !important;
  }
} 