* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #7209b7;
  --success: #4cc9f0;
  --error: #f72585;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --light-gray: #e9ecef;
  --border-radius: 12px;
  --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: var(--dark);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

header {
  text-align: center;
  padding: 30px 0;
  width: 100%;
}

h1 {
  color: var(--primary);
  font-size: 2.8rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h1 i {
  margin-right: 10px;
  color: var(--secondary);
}

.tagline {
  color: var(--gray);
  font-size: 1.2rem;
  margin-bottom: 30px;
}

.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 30px;
  margin-bottom: 30px;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

/* Landing Page Styling */
#landing-page {
  text-align: center;
}

.categories-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.category-card {
  background: var(--light);
  border-radius: var(--border-radius);
  padding: 20px 15px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-card:hover {
  background: var(--light-gray);
  border-color: var(--primary);
  transform: scale(1.03);
}

.category-card.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.category-card i {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--primary);
}

.category-card.selected i {
  color: white;
}

.difficulty-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0 30px;
  flex-wrap: wrap;
}

.difficulty-btn {
  padding: 12px 25px;
  background: var(--light);
  border: 2px solid var(--light-gray);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

.difficulty-btn:hover {
  background: var(--light-gray);
}

.difficulty-btn.selected {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

.btn {
  padding: 15px 35px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

.btn:disabled {
  background: var(--gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn i {
  font-size: 1.2rem;
}

/* Quiz Page Styling */
#quiz-page {
  display: none;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--light-gray);
}

.question-counter {
  font-size: 1.1rem;
  color: var(--gray);
}

.score-display {
  font-weight: bold;
  color: var(--primary);
  font-size: 1.3rem;
}

.question-card {
  margin-bottom: 30px;
}

.question-text {
  font-size: 1.5rem;
  line-height: 1.4;
  margin-bottom: 25px;
  color: var(--dark);
}

.answers-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.answer-btn {
  padding: 18px 20px;
  background: var(--light);
  border: 2px solid var(--light-gray);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 15px;
}

.answer-btn:hover {
  background: var(--light-gray);
  border-color: var(--primary);
}

.answer-btn.selected {
  background: rgba(67, 97, 238, 0.1);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.answer-btn.correct {
  background: rgba(76, 201, 240, 0.2);
  border-color: var(--success);
  color: var(--dark);
}

.answer-btn.incorrect {
  background: rgba(247, 37, 133, 0.1);
  border-color: var(--error);
  color: var(--dark);
}

.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--light-gray);
  border-radius: 50%;
  font-weight: bold;
  flex-shrink: 0;
}

.answer-btn.selected .answer-letter {
  background: var(--primary);
  color: white;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
}

.progress-bar {
  height: 8px;
  background: var(--light-gray);
  border-radius: 4px;
  overflow: hidden;
  flex-grow: 1;
  margin-right: 20px;
}

.progress {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.5s ease;
}

/* Results Page Styling */
#results-page {
  display: none;
  text-align: center;
}

.result-icon {
  font-size: 5rem;
  color: var(--primary);
  margin: 20px 0;
}

.score-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0% 0%, var(--light-gray) 0% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 30px auto;
  position: relative;
}

.score-circle-inner {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.final-score {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary);
  line-height: 1;
}

.score-text {
  color: var(--gray);
  font-size: 1.2rem;
}

.result-details {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  margin: 30px 0;
  gap: 20px;
}

.result-box {
  padding: 20px;
  background: var(--light);
  border-radius: var(--border-radius);
  min-width: 150px;
}

.result-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
}

.result-label {
  color: var(--gray);
  margin-top: 5px;
}

.feedback {
  font-size: 1.4rem;
  margin: 20px 0;
  color: var(--dark);
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 40px 0;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--light-gray);
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-message {
  text-align: center;
  padding: 30px;
  background: rgba(247, 37, 133, 0.1);
  border-radius: var(--border-radius);
  color: var(--error);
  margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 10px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .card {
    padding: 20px;
  }

  .categories-container {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .question-text {
    font-size: 1.3rem;
  }

  .quiz-footer {
    flex-direction: column;
    gap: 20px;
  }

  .progress-bar {
    margin-right: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
  }

  .difficulty-container {
    flex-direction: column;
    align-items: center;
  }

  .difficulty-btn {
    width: 100%;
    max-width: 200px;
  }

  .answer-btn {
    padding: 15px;
    font-size: 1rem;
  }

  .score-circle {
    width: 150px;
    height: 150px;
  }

  .score-circle-inner {
    width: 120px;
    height: 120px;
  }

  .final-score {
    font-size: 2.2rem;
  }
}
