/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
  color: #1a1a1a;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* Screen management */
.screen {
  display: block;
}

.screen.hidden {
  display: none;
}

/* Loading screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
  gap: 20px;
  z-index: 9999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Welcome screen */
#welcome-screen {
  background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 80vh;
  padding: 40px 20px;
}

.welcome-emoji {
  font-size: 120px;
  margin-bottom: 32px;
  animation: wave 1s ease-in-out infinite alternate;
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(20deg); }
}

.welcome-title {
  font-size: 36px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease;
}

.welcome-message {
  font-size: 18px;
  color: #1a1a1a;
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 500px;
  animation: fadeInUp 0.8s ease;
}

.welcome-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 40px;
  max-width: 500px;
  animation: fadeInUp 1s ease;
}

.welcome-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 18px 48px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
  animation: fadeInUp 1.2s ease;
}

.welcome-btn:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.welcome-btn:active {
  transform: translateY(0);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px 0;
}

.app-title {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.app-subtitle {
  font-size: 16px;
  color: #666;
}

/* Section titles */
.section-title {
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 16px;
}

/* Track cards */
.tracks-section {
  margin-top: 28px;
}

#tracks-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.track-card {
  background: white;
  border-radius: 26px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.track-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.1);
}

.track-card:active {
  transform: translateY(0);
}

.track-emoji {
  font-size: 48px;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 20px;
  flex-shrink: 0;
}

.track-icon {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 20px;
  flex-shrink: 0;
}

.track-content {
  flex: 1;
  min-width: 0;
}

.track-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.track-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.4;
}

.track-meta {
  font-size: 13px;
  color: #2563eb;
  font-weight: 500;
}

/* Course screen */
.back-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #2563eb;
  cursor: pointer;
  padding: 8px 12px;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

.course-header {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 28px;
}

.course-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.course-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.course-description {
  font-size: 15px;
  color: #666;
  line-height: 1.5;
}

/* Course detail screen */
.course-detail-card {
  background: white;
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

.course-detail-illustration {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 20px;
  margin: 0 auto 24px;
  display: block;
}

.course-detail-title {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 16px;
  text-align: center;
}

.course-detail-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.course-detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
  font-size: 15px;
  color: #2563eb;
  font-weight: 500;
}

.start-course-btn {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px 24px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.start-course-btn:hover {
  background: #1d4ed8;
}

.start-course-btn:active {
  transform: scale(0.98);
}

/* Days list */
.days-section {
  margin-top: 28px;
}

#days-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-card {
  background: white;
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.day-card:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.day-number {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.day-arrow {
  font-size: 18px;
  color: #2563eb;
}

.day-card.completed {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  border: 1.5px solid rgba(37, 99, 235, 0.3);
}

.day-card.completed .day-number {
  color: #2563eb;
  font-weight: 700;
}

.day-card.completed .day-arrow {
  color: #10b981;
  font-weight: 700;
}

/* Lesson screen */
.lesson-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

#lesson-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 24px;
  line-height: 1.3;
}

#lesson-video {
  margin-bottom: 24px;
}

.lesson-video-player {
  width: 100%;
  border-radius: 16px;
  background: #000;
}

.no-video {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-size: 15px;
}

.lesson-task,
.lesson-checklist {
  margin-top: 24px;
}

.lesson-task h3,
.lesson-checklist h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 12px;
}

#lesson-task-text {
  font-size: 15px;
  color: #444;
  line-height: 1.6;
}

#lesson-checklist-items {
  list-style: none;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checklist-item span {
  font-size: 15px;
  color: #444;
  line-height: 1.5;
}

.muted {
  color: #999;
  font-size: 14px;
}

/* Error state */
.error {
  text-align: center;
  padding: 40px 20px;
  color: #ef4444;
  font-size: 16px;
}

/* Streak counter */
.streak-card {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(247, 147, 30, 0.05) 100%);
  border: 1.5px solid rgba(255, 107, 53, 0.3);
  border-radius: 20px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.streak-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 107, 53, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.streak-content {
  flex: 1;
}

.streak-title {
  font-size: 16px;
  font-weight: 700;
  color: #FF6B35;
  margin-bottom: 2px;
}

.streak-message {
  font-size: 13px;
  color: rgba(26, 26, 26, 0.7);
}

.streak-badge {
  background: #FF6B35;
  color: white;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}

/* Progress block */
.progress-card {
  background: white;
  border-radius: 28px;
  padding: 26px 28px 26px 22px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 28px;
}

.progress-text {
  flex: 1;
}

.progress-text h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.progress-text p {
  font-size: 15px;
  color: #666;
  margin-bottom: 18px;
}

.continue-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.continue-btn:hover {
  background: #1d4ed8;
}

.progress-image {
  flex-shrink: 0;
}

.progress-placeholder {
  width: 150px;
  height: 150px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.progress-image-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 24px;
}

/* Lesson task section */
.lesson-task-section {
  margin: 24px 0;
}

.lesson-task-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.lesson-task-section p {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
}

/* Chat styles */
.chat-box {
  background: rgba(37, 99, 235, 0.04);
  border-radius: 16px;
  padding: 20px;
  margin: 24px 0;
}

.chat-prompt {
  margin-bottom: 16px;
}

.chat-prompt p {
  font-size: 15px;
  color: #1a1a1a;
  font-weight: 600;
}

.chat-send-btn {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  margin-bottom: 16px;
}

.chat-input {
  width: 100%;
  min-height: 100px;
  max-height: 200px;
  padding: 12px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: #2563eb;
}

.chat-send-btn:hover {
  background: #1d4ed8;
}

.chat-send-btn:active {
  transform: scale(0.98);
}

.chat-send-btn.loading {
  position: relative;
  pointer-events: none;
  background: #1d4ed8;
}

.chat-send-btn.loading::after {
  content: '';
  position: absolute;
  right: 24px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-color: white;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Chat history */
.chat-history {
  margin: 24px 0;
}

.chat-message {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 12px;
}

.user-message {
  background: #e0e7ff;
  border-left: 4px solid #2563eb;
}

.curator-message {
  background: #d1fae5;
  border-left: 4px solid #10b981;
}

.message-label {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.message-text {
  font-size: 15px;
  color: #1a1a1a;
  line-height: 1.6;
}

/* Complete lesson button */
.complete-lesson-btn {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.2s, transform 0.1s;
}

.complete-lesson-btn:hover {
  background: #1d4ed8;
}

.complete-lesson-btn:active {
  transform: scale(0.98);
}

.complete-lesson-btn.completed {
  background: #10b981;
  cursor: default;
}

.complete-lesson-btn.completed:hover {
  background: #10b981;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  font-size: 15px;
  font-weight: 600;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

/* Celebration overlay */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.celebration-overlay.show {
  opacity: 1;
}

.celebration-content {
  background: white;
  border-radius: 28px;
  padding: 48px 40px;
  text-align: center;
  max-width: 90%;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-overlay.show .celebration-content {
  transform: scale(1);
}

.celebration-emoji {
  font-size: 80px;
  margin-bottom: 24px;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.celebration-title {
  font-size: 32px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 12px;
}

.celebration-message {
  font-size: 18px;
  color: #666;
  margin-bottom: 24px;
}

.celebration-sparkles {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 24px;
}

.celebration-sparkles span {
  display: inline-block;
  animation: sparkle 1s ease-in-out infinite;
}

.celebration-sparkles span:nth-child(1) {
  animation-delay: 0s;
}

.celebration-sparkles span:nth-child(2) {
  animation-delay: 0.2s;
}

.celebration-sparkles span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.3) rotate(180deg); opacity: 0.7; }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .container {
    padding: 16px;
  }

  .track-emoji {
    width: 80px;
    height: 80px;
    font-size: 40px;
  }

  .app-title {
    font-size: 28px;
  }

  .progress-card {
    flex-direction: column-reverse;
    text-align: center;
  }

  .progress-placeholder {
    width: 120px;
    height: 120px;
    font-size: 48px;
  }

  .notification {
    right: 16px;
    left: 16px;
    transform: translateY(-100px);
  }

  .notification.show {
    transform: translateY(0);
  }

  .celebration-content {
    padding: 36px 24px;
    width: 90%;
  }

  .celebration-emoji {
    font-size: 64px;
  }

  .celebration-title {
    font-size: 28px;
  }

  .celebration-message {
    font-size: 16px;
  }
}
