/* ── Quiz modal overlay ─────────────────────────────────── */
.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(4, 9, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: quizFadeIn 0.25s ease;
}

@keyframes quizFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.quiz-panel {
  background: #0b1829;
  border: 1px solid rgba(77, 217, 236, 0.25);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: quizSlideUp 0.3s ease;
}

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

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.quiz-badge {
  font-family: 'Courier New', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: #4dd9ec;
  background: rgba(77, 217, 236, 0.1);
  border: 1px solid rgba(77, 217, 236, 0.2);
  border-radius: 3px;
  padding: 3px 9px;
}

.quiz-progress {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: rgba(146, 189, 212, 0.5);
  letter-spacing: 0.06em;
}

.quiz-question {
  font-size: 1.02rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.5;
  margin: 16px 0 20px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 20px;
}

.quiz-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(77, 217, 236, 0.15);
  border-radius: 8px;
  color: #92bdd4;
  font-size: 0.88rem;
  padding: 11px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.quiz-option:hover:not(:disabled) {
  background: rgba(77, 217, 236, 0.07);
  border-color: rgba(77, 217, 236, 0.35);
  color: #e2e8f0;
}

.quiz-option.selected {
  border-color: rgba(77, 217, 236, 0.6);
  background: rgba(77, 217, 236, 0.1);
  color: #4dd9ec;
}

.quiz-option.correct {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
}

.quiz-option.wrong {
  border-color: rgba(240, 96, 96, 0.5);
  background: rgba(240, 96, 96, 0.08);
  color: #f06060;
}

.quiz-option:disabled { cursor: default; }

.quiz-explanation {
  background: rgba(77, 217, 236, 0.05);
  border-left: 3px solid rgba(77, 217, 236, 0.4);
  border-radius: 0 6px 6px 0;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: #92bdd4;
  line-height: 1.55;
  margin-bottom: 20px;
  display: none;
}

.quiz-explanation.visible { display: block; }

.quiz-result-tag {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.quiz-result-tag.correct { color: #4ade80; }
.quiz-result-tag.wrong   { color: #f06060; }

.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-next-btn {
  background: #4dd9ec;
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 10px 24px;
  cursor: pointer;
  transition: opacity 0.15s;
  display: none;
}
.quiz-next-btn:hover { opacity: 0.85; }
.quiz-next-btn.visible { display: block; }

.quiz-skip-btn {
  background: transparent;
  border: 1px solid rgba(77, 217, 236, 0.2);
  border-radius: 6px;
  color: rgba(146, 189, 212, 0.5);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.quiz-skip-btn:hover {
  border-color: rgba(77, 217, 236, 0.4);
  color: #92bdd4;
}

.quiz-reveal-btn {
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  color: rgba(245, 158, 11, 0.7);
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.quiz-reveal-btn:hover {
  border-color: rgba(245, 158, 11, 0.55);
  color: #f59e0b;
}

.quiz-chat-hint {
  text-align: center;
  font-size: 0.72rem;
  color: rgba(146, 189, 212, 0.4);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(77, 217, 236, 0.07);
}

.quiz-chat-link {
  background: none;
  border: none;
  color: #4dd9ec;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.quiz-chat-link:hover { opacity: 0.8; }

/* ── Summary screen ─────────────────────────────────────── */
.quiz-summary {
  text-align: center;
  padding: 8px 0;
}
.quiz-summary-score {
  font-family: 'Courier New', monospace;
  font-size: 3rem;
  font-weight: 900;
  color: #4dd9ec;
  text-shadow: 0 0 20px rgba(77, 217, 236, 0.4);
  margin: 12px 0 4px;
}
.quiz-summary-label {
  font-size: 0.8rem;
  color: rgba(146, 189, 212, 0.6);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.quiz-summary-xp {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #f59e0b;
  margin-bottom: 24px;
}
.quiz-done-btn {
  background: #4dd9ec;
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 12px 32px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.quiz-done-btn:hover { opacity: 0.85; }

/* ── Pre/Post improvement block ─────────────────────────── */
.quiz-improvement {
  background: rgba(0, 242, 255, 0.05);
  border: 1px solid rgba(0, 242, 255, 0.18);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 20px;
  text-align: left;
}
.quiz-improvement-label {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: rgba(0, 242, 255, 0.5);
  margin-bottom: 8px;
}
.quiz-improvement-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}
.quiz-imp-pre  { color: #94a3b8; }
.quiz-imp-post { color: #e2e8f0; font-weight: 700; }
.quiz-imp-arrow { color: rgba(0, 242, 255, 0.6); font-size: 1.1rem; }
.quiz-imp-delta { font-size: 0.8rem; font-weight: 700; }

/* ── Learning moment cards ──────────────────────────────── */
.quiz-badge-learn {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}
.quiz-badge-reflect {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
}
.quiz-learning-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.quiz-learning-sub {
  font-size: 0.75rem;
  color: rgba(146, 189, 212, 0.5);
  font-family: 'Courier New', monospace;
}
.quiz-learning-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f0f8ff;
  margin-bottom: 12px;
  line-height: 1.4;
}
.quiz-learning-body {
  font-size: 0.88rem;
  color: #a8c8e0;
  line-height: 1.65;
  margin-bottom: 18px;
}
.quiz-learning-term {
  background: rgba(0, 242, 255, 0.05);
  border-left: 3px solid rgba(0, 242, 255, 0.4);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin-bottom: 20px;
}
.quiz-term-label {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(0, 242, 255, 0.5);
  margin-bottom: 4px;
}
.quiz-term-name {
  display: block;
  font-weight: 700;
  color: #00f2ff;
  font-size: 0.92rem;
  margin-bottom: 6px;
}
.quiz-term-def {
  font-size: 0.82rem;
  color: #92bdd4;
  line-height: 1.55;
}
.quiz-learning-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ── AI badge ───────────────────────────────────────────── */
.quiz-ai-badge {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* ── Reflection input ───────────────────────────────────── */
.quiz-reflection-input {
  width: 100%;
  background: rgba(0, 242, 255, 0.04);
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 8px;
  color: #d0e8f0;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 12px 14px;
  resize: vertical;
  margin: 12px 0 8px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.quiz-reflection-input:focus { border-color: rgba(0, 242, 255, 0.5); }
.quiz-reflection-hint {
  font-size: 0.75rem;
  color: rgba(146, 189, 212, 0.45);
  font-style: italic;
  margin-bottom: 4px;
}

/* ── Reflection AI result ───────────────────────────────── */
.quiz-refl-result {
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
  text-align: left;
}
.quiz-refl-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.quiz-refl-stars {
  font-size: 1rem;
  letter-spacing: 2px;
}
.quiz-refl-pts {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #3fb950;
}
.quiz-refl-feedback {
  font-size: 0.83rem;
  color: #a8c8e0;
  line-height: 1.5;
}
