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

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #e8e8e8;
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  border-radius: 2px;
  animation: confetti-fall 2s ease-out forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Header */
.app-header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
}

.logo h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-stats {
  display: flex;
  gap: 12px;
}

.streak-badge, .level-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 14px;
}

.level-num {
  font-weight: 700;
  color: #FFE66D;
}

.level-title {
  color: #95E1D3;
  font-size: 12px;
}

.xp-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xp-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ECDC4, #44A08D);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.xp-text {
  font-size: 13px;
  font-weight: 600;
  color: #4ECDC4;
  min-width: 60px;
}

/* Navigation */
.main-nav {
  display: flex;
  padding: 8px;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.nav-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(78, 205, 196, 0.3));
  color: #fff;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.section-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-desc {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
}

/* Lesson Cards */
.lessons-grid, .challenges-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card, .challenge-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
}

.lesson-card:hover, .challenge-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(78, 205, 196, 0.3);
}

.lesson-card.completed, .challenge-card.completed {
  opacity: 0.6;
}

.lesson-status, .challenge-status {
  font-size: 28px;
  min-width: 40px;
  text-align: center;
}

.lesson-card h3, .challenge-card h3 {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}

.challenge-card p {
  display: none;
}

.lesson-xp, .challenge-xp {
  background: rgba(78, 205, 196, 0.2);
  color: #4ECDC4;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* Active Lesson */
.lesson-active, .challenge-active {
  animation: fadeIn 0.3s ease;
}

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

.lesson-header, .challenge-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.scenario-card {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 230, 109, 0.15));
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.scenario-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.scenario-text {
  font-size: 18px;
  line-height: 1.6;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  padding: 18px 24px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
}

.option-btn:hover {
  background: rgba(78, 205, 196, 0.15);
  border-color: #4ECDC4;
  transform: translateX(8px);
}

/* Lesson Result */
.lesson-result {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.result-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.result-card.perfect {
  border: 2px solid rgba(78, 205, 196, 0.5);
}

.result-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-card h3 {
  font-size: 24px;
  margin-bottom: 16px;
  color: #4ECDC4;
}

.feedback {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.code-connection {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
}

.connection-label {
  font-size: 12px;
  color: #FFE66D;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}

.code-connection p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.xp-earned {
  font-size: 28px;
  font-weight: 800;
  color: #4ECDC4;
  margin-bottom: 20px;
}

.continue-btn {
  padding: 14px 32px;
  border: none;
  background: linear-gradient(135deg, #4ECDC4, #44A08D);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.continue-btn:hover {
  transform: scale(1.05);
}

/* Code Lab */
.eq-tip-banner {
  background: linear-gradient(135deg, rgba(149, 225, 211, 0.2), rgba(78, 205, 196, 0.2));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tip-icon {
  font-size: 24px;
}

.challenge-desc {
  font-size: 16px;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.code-editor-container {
  background: #0d1117;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.hint-btn, .run-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hint-btn {
  background: rgba(255, 230, 109, 0.2);
  color: #FFE66D;
}

.run-btn {
  background: linear-gradient(135deg, #4ECDC4, #44A08D);
  color: #fff;
}

.hint-btn:hover, .run-btn:hover {
  transform: scale(1.05);
}

.hint-box {
  background: rgba(255, 230, 109, 0.1);
  padding: 12px 16px;
  color: #FFE66D;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-editor {
  width: 100%;
  min-height: 300px;
  background: transparent;
  border: none;
  padding: 16px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: #c9d1d9;
  resize: vertical;
  outline: none;
}

.preview-container {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f0f0f0;
  color: #333;
  font-weight: 600;
}

.complete-btn {
  padding: 8px 20px;
  border: none;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.complete-btn:hover {
  transform: scale(1.05);
}

.preview-frame {
  width: 100%;
  height: 350px;
  border: none;
}

/* Progress Tab */
.progress-tab {
  padding-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: #4ECDC4;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.achievements-section h3, .journal-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.achievement-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.achievement-card.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.achievement-card.unlocked {
  background: linear-gradient(135deg, rgba(255, 230, 109, 0.15), rgba(78, 205, 196, 0.15));
  border: 1px solid rgba(255, 230, 109, 0.3);
}

.ach-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.ach-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.ach-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.journal-section {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 20px;
}

.journal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.journal-btn {
  padding: 8px 16px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.journal-form {
  margin-bottom: 16px;
}

.journal-form textarea {
  width: 100%;
  min-height: 100px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 12px;
}

.journal-form button {
  padding: 10px 24px;
  border: none;
  background: linear-gradient(135deg, #4ECDC4, #44A08D);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.journal-entry {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.entry-date {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  display: block;
  margin-bottom: 6px;
}

.journal-entry p {
  font-size: 14px;
  line-height: 1.5;
}

/* Footer */
.app-footer {
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  text-align: center;
}

.quote-rotator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 24px;
}

.quote-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.footer-links a {
  color: #4ECDC4;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .header-top {
    flex-direction: column;
    gap: 12px;
  }
  
  .level-title {
    display: none;
  }
  
  .nav-btn {
    font-size: 12px;
    padding: 10px 4px;
  }
  
  .stats-grid, .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .code-editor {
    font-size: 11px;
  }
  
  .editor-actions {
    flex-direction: column;
    gap: 4px;
  }
  
  .preview-frame {
    height: 280px;
  }
}