@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
  --bg: #faf8f5;
  --text: #1a1512;
  --accent: #d64545;
  --accent-hover: #b83838;
  --secondary: #2a5f4d;
  --border: #e0dbd3;
  --card: #ffffff;
  --correct: #2a5f4d;
  --incorrect: #d64545;
  --muted: #6b6560;
  --shadow: rgba(26, 21, 18, 0.08);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px;
}

/* Header */
header {
  margin-bottom: 60px;
  animation: fadeIn 0.6s ease-out;
}

h1 {
  font-family: 'Crimson Pro', serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

h2 {
  font-family: 'Crimson Pro', serif;
  font-size: 2rem;
  margin-bottom: 12px;
  font-weight: 600;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 400;
}

/* Question Sets Section */
.question-sets-section {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  animation: fadeIn 0.6s ease-out 0.1s both;
}

.section-title {
  font-family: 'Crimson Pro', serif;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.sets-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#questionSetSelect {
  flex: 1;
  min-width: 250px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  background: var(--card);
}

/* Dialog */
.dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.dialog-content {
  background: var(--card);
  padding: 40px;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.dialog-content h2 {
  font-family: 'Crimson Pro', serif;
  margin-bottom: 20px;
}

.dialog-content input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  margin-bottom: 20px;
}

.dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
  animation: fadeIn 0.6s ease-out 0.2s both;
}

.stat-card {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.stat-value {
  font-family: 'Crimson Pro', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-correct {
  color: var(--correct);
}

.stat-incorrect {
  color: var(--incorrect);
}

/* Input Section */
.input-section {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  animation: fadeIn 0.6s ease-out 0.3s both;
}

.help-text {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', monospace;
  font-size: 0.95rem;
  resize: vertical;
  background: var(--bg);
  transition: all 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(214, 69, 69, 0.3);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text);
}

/* Loading Message */
.loading-message {
  display: none;
  margin-top: 16px;
  color: var(--muted);
  font-style: italic;
}

/* Quiz Section */
.quiz-section {
  animation: fadeIn 0.6s ease-out 0.4s both;
}

.question-card {
  background: var(--card);
  padding: 40px;
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  animation: slideUp 0.4s ease-out;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.question-number {
  font-family: 'Crimson Pro', serif;
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.question-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.question-stats {
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-delete {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: none;
  letter-spacing: 0;
}

.btn-delete:hover {
  background: var(--incorrect);
  color: white;
  border-color: var(--incorrect);
}

.question-text {
  font-family: 'Crimson Pro', serif;
  font-size: 1.5rem;
  line-height: 1.5;
  margin-bottom: 28px;
  font-weight: 500;
}

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

.option {
  padding: 18px 24px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  font-size: 1rem;
}

.option:hover:not(.disabled) {
  border-color: var(--accent);
  transform: translateX(4px);
}

.option.selected {
  border-color: var(--accent);
  background: rgba(214, 69, 69, 0.05);
}

.option.correct {
  border-color: var(--correct);
  background: rgba(42, 95, 77, 0.08);
}

.option.incorrect {
  border-color: var(--incorrect);
  background: rgba(214, 69, 69, 0.08);
}

.option.disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Feedback */
.feedback {
  margin-top: 24px;
  padding: 24px;
  border-radius: 10px;
  animation: slideUp 0.3s ease-out;
}

.feedback.correct {
  background: rgba(42, 95, 77, 0.08);
  border-left: 4px solid var(--correct);
}

.feedback.incorrect {
  background: rgba(214, 69, 69, 0.08);
  border-left: 4px solid var(--incorrect);
}

.feedback-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.feedback-text {
  line-height: 1.7;
}

.explanation {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-style: italic;
  color: var(--muted);
  line-height: 1.8;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

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

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

/* Responsive */
@media (max-width: 640px) {
  h1 {
    font-size: 2.5rem;
  }

  .question-card {
    padding: 24px;
  }

  .input-section {
    padding: 24px;
  }
}
