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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
  position: relative;
}

.course-selector {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.course-selector select {
  background: white;
  color: #333;
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 200px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.course-selector select:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #5a67d8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.header-content {
  margin: 0 auto;
  max-width: 600px;
}

.language-selector select {
  background: white;
  color: #333;
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 130px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.language-selector select:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #5a67d8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.language-selector select option {
  background: white;
  color: #333;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: repeating-linear-gradient(
    to right, 
    #4CAF50 0, 
    #4CAF50 calc(100% / var(--total-segments) - 3px), 
    #6b70d6 calc(100% / var(--total-segments) - 3px), 
    #6b70d6 calc(100% / var(--total-segments))
  );
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

main:not(:has(.finish-dialog)).progress-fill {
  translate: calc(-100% / var(--total-segments));
}

.card-container {
  min-height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  transition: height 0.3s ease-in-out;
}

.card {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  text-align: center;
  transform: translateY(20px);
  opacity: 0;
  animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.card p {
  line-height: 1.6;
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.code-example {
  background: #3f4b60;
  border: 1px solid #4a5568;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
  font-family: 'Courier New', monospace;
  text-align: left;
  color: #e2e8f0;
  font-size: 1.1rem;
  font-weight: 600;
}

.highlight {
  background: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

/* Inline code styling for both concept and quiz cards */
code,
.inline-code {
  background: #3f4b60;
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.95em;
  font-weight: 700;
  display: inline-block;
  line-height: 1.2;
  white-space: nowrap;
  margin: 0 2px;
}

.quiz-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 700px;
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 15px;
  padding: 25px;
}

.quiz-option {
  background: white;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quiz-option .code-example {
  margin: 10px 0;
  font-size: 0.95rem;
  padding: 10px;
}

.quiz-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.quiz-option.correct {
  border-color: #4CAF50;
  background: #f8fff8;
}

.quiz-option.incorrect {
  border-color: #f44336;
  background: #fff8f8;
}

.quiz-option h3 {
  color: #667eea;
  margin-bottom: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.quiz-option.revealed h3 {
  opacity: 1;
}

.finish-dialog {
  background: white;
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 100%;
}

.finish-dialog h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 2rem;
}

.finish-dialog .score {
  font-size: 3rem;
  font-weight: bold;
  color: #4CAF50;
  margin: 20px 0;
}

.finish-dialog .message {
  font-size: 1.2rem;
  margin-bottom: 30px;
  line-height: 1.6;
}

.restart-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.restart-btn:hover {
  background: #5a67d8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

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

.nav-btn {
  background: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #667eea;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card-counter {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header {
    margin-bottom: 20px;
    margin-top: 55px; /* Add top margin to prevent overlap with selectors */
  }

  header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  header p {
    font-size: 1rem;
  }

  .progress-bar {
    margin-bottom: 20px;
  }

  .card-container {
    margin-bottom: 10px;
    min-height: 300px; /* Reduce min-height for mobile */
  }

  .card {
    padding: 10px;
  }

  .quiz-card {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 10px;
  }

  .quiz-option {
    padding: 5px;
    min-height: 100px;
  }

  .navigation {
    gap: 10px;
  }

  .nav-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .course-selector {
    top: 5px;
    left: 5px;
  }

  .course-selector select {
    font-size: 0.85rem;
    padding: 6px 10px;
    min-width: 140px;
  }

  .language-selector {
    top: 5px;
    right: 5px;
  }

  .language-selector select {
    font-size: 0.85rem;
    padding: 6px 10px;
    min-width: 100px;
  }

  .finish-dialog {
    padding: 25px;
  }

  .finish-dialog h2 {
    font-size: 1.6rem;
    margin-bottom: 15px;
  }

  .finish-dialog .score {
    font-size: 2.5rem;
    margin: 15px 0;
  }

  .finish-dialog .message {
    font-size: 1.1rem;
    margin-bottom: 25px;
  }

  .restart-btn {
    padding: 12px 25px;
    font-size: 1rem;
  }
}