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

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  color: #1e293b;
  padding: 40px 20px;
  line-height: 1.6;
}

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

/* Header Styling */
.quiz-header {
  text-align: center;
  padding: 30px 20px;
  margin-bottom: 40px;
}

.quiz-title {
  font-size: 36px;
  color: #1a202c;
  font-weight: 700;
  margin-bottom: 10px;
}

.progress-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  margin: 20px auto 0;
  max-width: 400px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a42d3a, #27020b);
  transition: width 0.3s ease;
}

/* Toolbar Styling */
.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 32px;
  background: white;
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

input[type="search"] {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

input[type="search"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a5568;
  white-space: nowrap;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

/* Question Container */
.question-container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.question-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 25px;
}

.q-number {
  background: #1a202c;
  color: white;
  min-width: 45px;
  height: 45px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.question-text {
  font-size: 18px;
  color: #2d3748;
  font-weight: 500;
  flex: 1;
  padding-top: 8px;
  white-space: pre-wrap;
}

/* Options Styling */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  font-size: 15px;
  color: #2d3748;
}

.option::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: transparent;
  transition: background 0.2s ease;
}

.option:hover {
  border-color: #cbd5e0;
  transform: translateX(4px);
  background: #f7fafc;
}

.option:hover::before {
  background: #667eea;
}

.option.selected {
  border-color: #667eea;
  background: #f7faff;
}

.option.selected::before {
  background: #667eea;
}

.option.correct {
  border-color: #48bb78;
  background: #f0fff4;
}

.option.correct::before {
  background: #48bb78;
}

.option.incorrect {
  border-color: #f56565;
  background: #fff5f5;
}

.option.incorrect::before {
  background: #f56565;
}

.option strong {
  color: #1a202c;
  margin-right: 8px;
}

/* Answer Section */
.answer {
  margin-top: 20px;
  padding: 16px 20px;
  font-size: 14px;
  color: #4a5568;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.answer strong {
  color: #2d3748;
}

/* Explanation Section */
.explanation {
  margin-top: 16px;
  padding: 20px;
  font-size: 14px;
  background: #fffbeb;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  color: #78350f;
}

.explanation strong {
  color: #92400e;
  display: block;
  margin-bottom: 10px;
}

.explanation-content {
  line-height: 1.8;
  white-space: pre-wrap;
  color: #78350f;
}

/* Question Image Styling */
.question-image {
  margin: 20px 0;
  text-align: center;
}

.question-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.question-image img:hover {
  transform: scale(1.02);
}

/* Fill-in-Blank Styling */
.fill-blank-input-container {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.fill-blank-input {
  flex: 1;
  padding: 14px 18px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.fill-blank-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.fill-blank-input:disabled {
  background: #f7fafc;
  color: #718096;
  cursor: not-allowed;
}

.show-answer-btn {
  padding: 14px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.show-answer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.show-answer-btn:active {
  transform: translateY(0);
}

/* Submit Button for Select-All Questions */
.submit-btn {
  margin-top: 16px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  width: 100%;
  max-width: 200px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Checkbox-specific option styling */
.option.checkbox-option {
  cursor: default;
  padding: 12px 16px;
}

.option.checkbox-option:hover {
  transform: none;
}

.option.checkbox-option.correct-missed {
  border-color: #f59e0b;
  background: #fffbeb;
}

.option.checkbox-option.correct-missed::before {
  background: #f59e0b;
}

/* Feedback for select-all questions */
.answer.correct-feedback {
  background: #f0fff4;
  border-left-color: #48bb78;
  color: #22543d;
}

.answer.incorrect-feedback {
  background: #fff5f5;
  border-left-color: #f56565;
  color: #742a2a;
}

/* Footer */
.footer {
  text-align: center;
  color: #718096;
  font-size: 14px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.footer code {
  background: #f7fafc;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: #667eea;
  font-size: 13px;
}

.footer a {
  color: #667eea;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(102, 126, 234, 0.3);
  transition: border-color 0.2s ease;
}

.footer a:hover {
  border-bottom-color: #667eea;
}

/* Loading and Error States */
.status-message {
  text-align: center;
  color: #718096;
  font-size: 16px;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .quiz-title {
    font-size: 28px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .question-header {
    flex-direction: column;
    gap: 12px;
  }

  .q-number {
    align-self: flex-start;
  }

  .question-text {
    padding-top: 0;
  }

  .question-container {
    padding: 20px;
  }

  .question-image {
    margin: 16px 0;
  }
}
