* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-purple: #6366F1;
  --primary-dark: #4F46E5;
  --secondary-green: #10B981;
  --secondary-yellow: #F59E0B;
  --bg-main: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border-color: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
  --hover-bg: #F9FAFB;
  --accent-blue: #3B82F6;
  --accent-red: #EF4444;
  --success-bg: #ECFDF5;
  --success-text: #059669;
  --danger-bg: #FEE2E2;
  --danger-text: #DC2626;
}

[data-theme="dark"] {
  --primary-purple: #818CF8;
  --primary-dark: #6366F1;
  --secondary-green: #34D399;
  --secondary-yellow: #FBBF24;
  --bg-main: #111827;
  --bg-secondary: #1F2937;
  --bg-tertiary: #374151;
  --text-primary: #F9FAFB;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;
  --border-color: #374151;
  --border-light: #4B5563;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --hover-bg: #1F2937;
  --accent-blue: #60A5FA;
  --accent-red: #F87171;
  --success-bg: #064E3B;
  --success-text: #6EE7B7;
  --danger-bg: #7F1D1D;
  --danger-text: #FCA5A5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

#app {
  min-height: 100vh;
}

.landing-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #F0F4FF 0%, #E8F5E9 100%);
}

[data-theme="dark"] .landing-page {
  background: linear-gradient(135deg, #1a1f3a 0%, #1a2e1f 100%);
}

.landing-header {
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

[data-theme="dark"] .landing-header {
  background: rgba(17, 24, 39, 0.8);
}

.landing-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-purple);
}

.landing-nav {
  display: flex;
  gap: 1rem;
}

.landing-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.landing-hero {
  text-align: center;
  margin-bottom: 6rem;
}

.landing-title {
  font-size: 4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.landing-pronunciation {
  font-size: 1.5rem;
  color: var(--primary-purple);
  font-style: italic;
  margin-bottom: 2rem;
}

.landing-tagline {
  font-size: 2rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 3rem;
}

.highlight-free {
  color: var(--secondary-yellow);
  font-weight: 700;
}

.highlight-fun {
  color: var(--primary-purple);
  font-weight: 700;
}

#hero-3d-container {
  width: 100%;
  max-width: 500px;
  height: 300px;
  margin: 3rem auto;
  position: relative;
}

#hero-3d-canvas {
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
}

#building-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1000;
}

.landing-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 3rem;
}

.btn-cta {
  padding: 1rem 3rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-cta-primary {
  background: var(--secondary-yellow);
  color: #1F2937;
}

.btn-cta-primary:hover {
  background: #F59E0B;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-cta-secondary {
  background: var(--secondary-green);
  color: white;
}

.btn-cta-secondary:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.features-section {
  margin-top: 6rem;
}

.features-section h3 {
  text-align: center;
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h4 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s;
}

.auth-modal-content {
  background: var(--bg-main);
  padding: 2.5rem;
  border-radius: 1rem;
  max-width: 450px;
  width: 90%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}

.auth-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem;
  transition: color 0.2s;
}

.auth-modal-close:hover {
  color: var(--text-primary);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--bg-main);
  color: var(--primary-purple);
  box-shadow: var(--shadow-sm);
}

.auth-content {
  display: none;
}

.auth-content.active {
  display: block;
}

.auth-content h3 {
  text-align: center;
  color: var(--primary-purple);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.dashboard {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
}

.sidebar {
  width: 240px;
  background: var(--bg-main);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--hover-bg);
  color: var(--primary-purple);
  border-left-color: var(--primary-purple);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.25rem;
}

.sidebar-footer {
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
}

.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dashboard-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.icon-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--border-color);
}

.content-area {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

section {
  display: none;
}

section.active {
  display: block;
  animation: fadeIn 0.3s;
}

.welcome-section {
  margin-bottom: 2rem;
}

.user-greeting {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  font-weight: 700;
}

.greeting-text h2 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

#greeting-username {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.greeting-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-main);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-purple);
  margin-bottom: 0.25rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.performance-section {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.performance-section h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.difficulty-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
}

.difficulty-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.difficulty-header h4 {
  font-size: 1rem;
  color: var(--text-primary);
}

.difficulty-percent {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-red);
}

.difficulty-detail {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.level-progress-bar {
  width: 100%;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 1rem;
  overflow: hidden;
  position: relative;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-purple), var(--accent-blue));
  border-radius: 1rem;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
}

.quick-actions {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
}

.quick-actions h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.action-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.action-card:hover {
  background: var(--hover-bg);
  border-color: var(--primary-purple);
  transform: translateY(-2px);
}

.action-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.action-card h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.action-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--primary-purple);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--primary-purple);
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--primary-purple);
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: var(--primary-purple);
  color: white;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-full {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.auth-divider span {
  padding: 0 1rem;
}

.google-btn-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: var(--bg-main);
  color: var(--text-primary);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.error-message {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.card {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
}

.learn-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
}

.topic-sidebar {
  background: var(--bg-main);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  height: fit-content;
}

.topic-sidebar h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.topic-list {
  list-style: none;
}

.topic-item {
  margin-bottom: 0.5rem;
}

.topic-item button,
.topic-item .topic-btn {
  width: 100%;
  text-align: left;
  padding: 0.875rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item button:hover,
.topic-item .topic-btn:hover {
  background: var(--hover-bg);
  border-color: var(--primary-purple);
}

.topic-item button.active,
.topic-item .topic-btn.active {
  background: var(--primary-purple);
  color: white;
  border-color: var(--primary-purple);
}

.lesson-list {
  list-style: none;
  margin-top: 0.5rem;
  padding-left: 1rem;
}

.lesson-item {
  margin-bottom: 0.5rem;
}

.lesson-item button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}

.lesson-item button:hover {
  color: var(--primary-purple);
  border-left-color: var(--primary-purple);
  background: var(--hover-bg);
}

.flashcard-controls,
.quiz-controls {
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.flashcard-controls h2,
.quiz-controls h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.flashcard-container {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.flashcard {
  background: var(--bg-main);
  min-height: 300px;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  cursor: pointer;
  transition: transform 0.3s;
}

.flashcard:hover {
  transform: scale(1.02);
}

.flashcard-content {
  text-align: center;
  font-size: 1.25rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.flashcard-progress {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.rating-buttons {
  display: flex;
  gap: 1rem;
  justify-center;
  margin-top: 1rem;
}

.rating-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.rating-btn.got-it {
  background: var(--success-bg);
  color: var(--success-text);
}

.rating-btn.kinda {
  background: #FEF3C7;
  color: #92400E;
}

.rating-btn.dont-know {
  background: var(--danger-bg);
  color: var(--danger-text);
}

[data-theme="dark"] .rating-btn.kinda {
  background: #451A03;
  color: #FCD34D;
}

.quiz-question {
  background: var(--bg-main);
  padding: 2rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.quiz-question h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-choice {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.quiz-choice:hover {
  background: var(--hover-bg);
  border-color: var(--primary-purple);
}

.quiz-choice.selected {
  background: var(--primary-purple);
  color: white;
  border-color: var(--primary-purple);
}

.quiz-results {
  background: var(--bg-main);
  padding: 3rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.quiz-score {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary-purple);
  margin: 1rem 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0;
  }

  .landing-title {
    font-size: 2.5rem;
  }

  .landing-tagline {
    font-size: 1.5rem;
  }

  .features-grid,
  .stats-grid,
  .actions-grid {
    grid-template-columns: 1fr;
  }

  .learn-container {
    grid-template-columns: 1fr;
  }
}
