/* ═══════════════════════════════════════════════
   QUIZ SYSTEM — Brilliant-style Learning Checks
   ═══════════════════════════════════════════════ */

/* ─── PAGE PROGRESS BAR ──────────────────────── */
.quiz-page-progress {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 10, 15, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: -1rem -1rem 1.5rem;
  border-radius: 12px 12px 0 0;
}
.quiz-page-progress-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: fit-content;
}
.quiz-page-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(124, 247, 192, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.quiz-page-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-alt));
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.quiz-page-progress-count {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.quiz-page-progress-streak {
  font-size: 0.75rem;
  color: var(--accent-warm);
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s, transform 0.3s;
}
.quiz-page-progress-streak.visible {
  opacity: 1;
  transform: scale(1);
}

/* ─── KNOWLEDGE CHECK (inline) ───────────────── */
.knowledge-check {
  margin: 2rem 0;
  border: 1px solid rgba(124, 247, 192, 0.15);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(10, 14, 20, 0.6);
}
.kc-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  background: rgba(124, 247, 192, 0.06);
  border-bottom: 1px solid rgba(124, 247, 192, 0.1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.kc-icon { font-size: 1.1rem; }
.kc-body { padding: 1.2rem; }

/* ─── SECTION ASSESSMENT ─────────────────────── */
.section-assessment {
  margin: 2.5rem 0;
  border: 1px solid rgba(139, 211, 255, 0.2);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(10, 14, 20, 0.6);
}
.sa-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.4rem;
  background: rgba(139, 211, 255, 0.06);
  border-bottom: 1px solid rgba(139, 211, 255, 0.12);
  flex-wrap: wrap;
}
.sa-icon { font-size: 1.2rem; }
.sa-title {
  margin: 0;
  font-size: 1rem;
  color: var(--accent-alt);
  font-weight: 600;
  flex: 1;
}
.sa-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 140px;
}
.sa-progress-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(139, 211, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.sa-progress-bar {
  height: 100%;
  background: var(--accent-alt);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}
.sa-progress-text {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.sa-body { padding: 1.2rem 1.4rem; }

/* Assessment Results */
.sa-results {
  padding: 1.4rem;
  border-top: 1px solid rgba(139, 211, 255, 0.12);
  text-align: center;
  animation: quizFadeSlide 0.4s ease;
}
.sa-score {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.sa-score.score-high { color: var(--accent); }
.sa-score.score-mid { color: var(--accent-warm); }
.sa-score.score-low { color: var(--accent-danger); }
.sa-grade {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.sa-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.2rem;
}
.sa-breakdown-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: transform 0.2s;
}
.sa-breakdown-dot:hover { transform: scale(1.4); }
.sa-breakdown-dot.correct { background: var(--accent); }
.sa-breakdown-dot.wrong { background: var(--accent-danger); }
.sa-breakdown-dot.unanswered { background: var(--text-dim); }
.sa-retry-btn {
  font-family: var(--font);
  font-size: 0.82rem;
  padding: 0.5rem 1.4rem;
  border-radius: 8px;
  border: 1px solid var(--accent-alt);
  background: rgba(139, 211, 255, 0.1);
  color: var(--accent-alt);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.sa-retry-btn:hover { background: rgba(139, 211, 255, 0.2); }
.sa-retry-btn:active { transform: scale(0.97); }

/* ─── QUIZ BLOCK (individual question) ───────── */
.quiz-block {
  margin: 1.2rem 0;
  padding: 1.2rem;
  border-radius: 12px;
  background: rgba(13, 18, 26, 0.5);
  border: 1px solid rgba(124, 247, 192, 0.08);
  transition: border-color 0.3s;
  position: relative;
}
.quiz-block.answered { border-color: rgba(124, 247, 192, 0.15); }
.quiz-block.answered.correct { border-color: rgba(80, 250, 123, 0.25); }
.quiz-block.answered.wrong { border-color: rgba(255, 107, 107, 0.2); }

.quiz-question-number {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.quiz-question {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 1rem;
  font-weight: 500;
}
.quiz-question code {
  background: rgba(124, 247, 192, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

/* ─── MULTIPLE CHOICE / MULTI-SELECT OPTIONS ─── */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-option {
  font-family: var(--font);
  font-size: 0.84rem;
  padding: 0.7rem 1rem 0.7rem 2.6rem;
  border-radius: 10px;
  border: 1px solid rgba(124, 247, 192, 0.12);
  background: rgba(124, 247, 192, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
  line-height: 1.45;
  display: block;
  width: 100%;
}
.quiz-option::before {
  content: '';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(124, 247, 192, 0.25);
  transition: all 0.2s;
}
/* Multi-select uses square checkboxes */
[data-type="multi-select"] .quiz-option::before {
  border-radius: 4px;
}
.quiz-option:hover:not(:disabled) {
  border-color: rgba(124, 247, 192, 0.35);
  background: rgba(124, 247, 192, 0.06);
  color: var(--text);
}
.quiz-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(124, 247, 192, 0.08);
  color: var(--text);
}
.quiz-option.selected::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg);
}
/* Multi-select selected checkmark */
[data-type="multi-select"] .quiz-option.selected::before {
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--bg);
}
.quiz-option.correct-answer {
  border-color: rgba(80, 250, 123, 0.5);
  background: rgba(80, 250, 123, 0.08);
  color: #d7fbe8;
}
.quiz-option.correct-answer::before {
  border-color: #50fa7b;
  background: #50fa7b;
  box-shadow: inset 0 0 0 3px var(--bg);
}
.quiz-option.wrong-answer {
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.06);
  color: rgba(255, 150, 150, 0.9);
}
.quiz-option.wrong-answer::before {
  border-color: var(--accent-danger);
  background: var(--accent-danger);
  box-shadow: inset 0 0 0 3px var(--bg);
}
.quiz-option:disabled {
  cursor: default;
  opacity: 0.7;
}
.quiz-option.correct-answer:disabled,
.quiz-option.wrong-answer:disabled { opacity: 1; }

/* Option feedback icons */
.quiz-option-icon {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.quiz-option.correct-answer .quiz-option-icon,
.quiz-option.wrong-answer .quiz-option-icon { opacity: 1; }

/* Multi-select submit button */
.quiz-multi-submit {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.5rem 1.2rem;
  margin-top: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(124, 247, 192, 0.1);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  align-self: flex-start;
}
.quiz-multi-submit:hover { background: rgba(124, 247, 192, 0.2); }
.quiz-multi-submit:active { transform: scale(0.97); }
.quiz-multi-submit:disabled { opacity: 0.5; cursor: default; }

/* ─── FILL IN THE BLANK ─────────────────────── */
.quiz-input {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.quiz-text-input {
  flex: 1;
  min-width: 180px;
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(124, 247, 192, 0.2);
  background: rgba(6, 10, 15, 0.8);
  color: var(--text);
  transition: border-color 0.2s;
}
.quiz-text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 247, 192, 0.15);
}
.quiz-text-input.correct {
  border-color: #50fa7b;
  background: rgba(80, 250, 123, 0.06);
}
.quiz-text-input.wrong {
  border-color: var(--accent-danger);
  background: rgba(255, 107, 107, 0.06);
}
.quiz-text-input:disabled {
  opacity: 0.8;
  cursor: default;
}
.quiz-submit-btn {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(124, 247, 192, 0.1);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.quiz-submit-btn:hover { background: rgba(124, 247, 192, 0.2); }
.quiz-submit-btn:active { transform: scale(0.97); }
.quiz-submit-btn:disabled { opacity: 0.5; cursor: default; }

/* ─── CODE COMPLETION ────────────────────────── */
.quiz-code { display: flex; flex-direction: column; gap: 0.6rem; }
.quiz-terminal {
  background: var(--bg-code);
  border: 1px solid rgba(124, 247, 192, 0.15);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  position: relative;
}
.quiz-terminal code {
  font-size: 0.84rem;
  color: rgba(220, 240, 230, 0.85);
  line-height: 1.6;
  white-space: pre;
}
.quiz-code-input {
  font-family: var(--font);
  font-size: 0.84rem;
  width: clamp(80px, 20vw, 200px);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px dashed var(--accent);
  background: rgba(124, 247, 192, 0.06);
  color: var(--accent);
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.quiz-code-input:focus {
  outline: none;
  border-style: solid;
  background: rgba(124, 247, 192, 0.1);
  box-shadow: 0 0 8px rgba(124, 247, 192, 0.15);
}
.quiz-code-input.correct {
  border-color: #50fa7b;
  border-style: solid;
  color: #50fa7b;
  background: rgba(80, 250, 123, 0.08);
}
.quiz-code-input.wrong {
  border-color: var(--accent-danger);
  border-style: solid;
  color: var(--accent-danger);
  background: rgba(255, 107, 107, 0.06);
}
.quiz-code .quiz-submit-btn { align-self: flex-start; }

/* ─── ORDERING ───────────────────────────────── */
.quiz-ordering {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  counter-reset: order-item;
}
.quiz-order-item {
  counter-increment: order-item;
  font-family: var(--font);
  font-size: 0.84rem;
  padding: 0.65rem 1rem 0.65rem 3rem;
  border-radius: 10px;
  border: 1px solid rgba(124, 247, 192, 0.12);
  background: rgba(124, 247, 192, 0.03);
  color: var(--text-muted);
  cursor: grab;
  position: relative;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.quiz-order-item::before {
  content: counter(order-item);
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(124, 247, 192, 0.1);
  border: 1px solid rgba(124, 247, 192, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.quiz-order-item:hover {
  border-color: rgba(124, 247, 192, 0.3);
  background: rgba(124, 247, 192, 0.06);
}
.quiz-order-item:active, .quiz-order-item.dragging {
  cursor: grabbing;
  border-color: var(--accent);
  background: rgba(124, 247, 192, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10;
}
.quiz-order-item.correct-pos {
  border-color: rgba(80, 250, 123, 0.4);
  background: rgba(80, 250, 123, 0.06);
}
.quiz-order-item.correct-pos::before {
  background: rgba(80, 250, 123, 0.2);
  border-color: #50fa7b;
  color: #50fa7b;
}
.quiz-order-item.wrong-pos {
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.04);
}
.quiz-order-item.wrong-pos::before {
  background: rgba(255, 107, 107, 0.15);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}
.quiz-order-item:disabled, .quiz-ordering.answered .quiz-order-item {
  cursor: default;
}
/* Mobile ordering controls */
.quiz-order-controls {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.3rem;
}
.quiz-order-btn {
  font-family: var(--font);
  font-size: 0.7rem;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(124, 247, 192, 0.2);
  background: rgba(124, 247, 192, 0.05);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.quiz-order-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(124, 247, 192, 0.1); }
.quiz-order-submit {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.5rem 1.2rem;
  margin-top: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(124, 247, 192, 0.1);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.quiz-order-submit:hover { background: rgba(124, 247, 192, 0.2); }
.quiz-order-submit:active { transform: scale(0.97); }
.quiz-order-submit:disabled { opacity: 0.5; cursor: default; }

/* ─── SCENARIO ───────────────────────────────── */
.quiz-scenario {
  margin-bottom: 1rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(139, 211, 255, 0.15);
}
.quiz-scenario-label {
  padding: 0.5rem 1rem;
  background: rgba(139, 211, 255, 0.06);
  font-size: 0.78rem;
  color: var(--accent-alt);
  font-weight: 600;
  border-bottom: 1px solid rgba(139, 211, 255, 0.1);
}
.quiz-scenario-code {
  margin: 0;
  padding: 1rem 1.2rem;
  background: var(--bg-code);
  border: none;
  border-radius: 0;
}
.quiz-scenario-code code {
  font-size: 0.82rem;
  color: rgba(220, 240, 230, 0.85);
  line-height: 1.55;
}

/* ─── EXPLANATION ────────────────────────────── */
.quiz-explanation {
  display: none;
  margin-top: 0.8rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  background: rgba(124, 247, 192, 0.04);
  border-left: 3px solid var(--accent);
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.55;
  animation: quizFadeSlide 0.35s ease;
}
.quiz-explanation.visible { display: block; }
.quiz-explanation code {
  background: rgba(124, 247, 192, 0.1);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--accent);
}
.quiz-explanation.wrong-explanation {
  border-left-color: var(--accent-danger);
  background: rgba(255, 107, 107, 0.04);
}

/* Correct answer reveal (shown after wrong) */
.quiz-correct-reveal {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ─── RETRY BUTTON ───────────────────────────── */
.quiz-retry {
  font-family: var(--font);
  font-size: 0.75rem;
  padding: 0.35rem 0.9rem;
  margin-top: 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(124, 247, 192, 0.2);
  background: rgba(124, 247, 192, 0.05);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.quiz-retry:hover { border-color: var(--accent); color: var(--accent); background: rgba(124, 247, 192, 0.1); }

/* ─── STREAK BADGE ───────────────────────────── */
.quiz-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  font-size: 0.72rem;
  color: var(--accent-warm);
  font-weight: 600;
  animation: streakPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: absolute;
  top: -8px;
  right: 12px;
}
@keyframes streakPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── CELEBRATION (all correct) ──────────────── */
.quiz-celebrate {
  text-align: center;
  padding: 1.5rem;
  animation: quizFadeSlide 0.5s ease;
}
.quiz-celebrate-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; animation: celebrateBounce 0.6s ease; }
.quiz-celebrate-text { font-size: 1rem; color: var(--accent); font-weight: 600; }
.quiz-celebrate-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.3rem; }
@keyframes celebrateBounce {
  0% { transform: scale(0) rotate(-15deg); }
  50% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ─── ANIMATIONS ─────────────────────────────── */
@keyframes quizFadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes quizShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.quiz-block.shake { animation: quizShake 0.4s ease; }
@keyframes correctPulse {
  0% { box-shadow: 0 0 0 0 rgba(80, 250, 123, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(80, 250, 123, 0); }
  100% { box-shadow: 0 0 0 0 rgba(80, 250, 123, 0); }
}
.quiz-block.correct-pulse { animation: correctPulse 0.6s ease; }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 640px) {
  .quiz-page-progress { padding: 0.4rem 0.8rem; margin: -0.5rem -0.5rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .quiz-page-progress-track { order: 3; width: 100%; min-width: 100%; }
  .quiz-block { padding: 1rem; }
  .quiz-option { padding: 0.6rem 0.8rem 0.6rem 2.4rem; font-size: 0.8rem; }
  .quiz-option::before { left: 0.7rem; width: 16px; height: 16px; }
  .quiz-text-input { min-width: 120px; }
  .quiz-code-input { width: clamp(60px, 30vw, 160px); }
  .sa-header { flex-direction: column; align-items: flex-start; }
  .sa-progress { width: 100%; }
  .quiz-order-item { padding-right: 4rem; }
  /* Gamification responsive */
  .gamification-dashboard { padding: 0.8rem; margin: -0.5rem -0.5rem 0.3rem; }
  .gf-main-row { gap: 0.8rem; }
  .gf-level-section { min-width: 100%; }
  .gf-stats-row { width: 100%; justify-content: space-around; }
  .gf-achievements-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  #gamification-toast-container { right: 0.5rem; left: 0.5rem; max-width: none; }
}

/* ═══════════════════════════════════════════════
   GAMIFICATION — XP, Levels, Achievements, Toasts
   ═══════════════════════════════════════════════ */

/* ─── DASHBOARD ──────────────────────────────── */
.gamification-dashboard {
  background: rgba(6, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 247, 192, 0.12);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin: -1rem -1rem 0.5rem;
  position: relative;
  overflow: visible;
}
.gf-main-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.gf-level-section {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 200px;
  flex: 1;
}
.gf-level-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 247, 192, 0.2), rgba(139, 211, 255, 0.2));
  border: 2px solid rgba(124, 247, 192, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.gf-level-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.gf-level-info {
  flex: 1;
  min-width: 0;
}
.gf-level-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gf-xp-bar {
  height: 8px;
  background: rgba(124, 247, 192, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.2rem;
}
.gf-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #7cf7c0, #8bd3ff, #c084fc);
  background-size: 200% 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.gf-xp-fill.xp-pulse {
  animation: xpPulse 0.6s ease;
}
@keyframes xpPulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.6); box-shadow: 0 0 12px rgba(124, 247, 192, 0.5); }
  100% { filter: brightness(1); }
}
.gf-xp-text {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Stats Row */
.gf-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.gf-stat {
  text-align: center;
  min-width: 52px;
}
.gf-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.gf-stat-value.streak-hot {
  color: var(--accent-warm);
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.4);
}
.gf-stat-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Streak Warning */
.gf-streak-warning {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.2);
  font-size: 0.76rem;
  color: var(--accent-warm);
  animation: streakWarn 2s ease-in-out infinite;
}
@keyframes streakWarn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.gf-streak-warning-icon { font-size: 1rem; }

/* XP Floater */
.xp-floater {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
  animation: xpFloat 1.2s ease-out forwards;
  z-index: 60;
}
@keyframes xpFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  70% { opacity: 1; transform: translateY(-20px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.9); }
}

/* ─── ACHIEVEMENT SECTION ────────────────────── */
.gf-achievements-row {
  margin-top: 0.6rem;
  border-top: 1px solid rgba(124, 247, 192, 0.08);
  padding-top: 0.5rem;
}
.gf-achievements-toggle {
  font-size: 0.76rem;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
  user-select: none;
}
.gf-achievements-toggle:hover { color: var(--accent); }
.gf-achievements-toggle::after {
  content: '▸';
  transition: transform 0.2s;
  margin-left: auto;
}
.gf-achievements-toggle.open::after {
  transform: rotate(90deg);
}
.gf-achieve-count {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(124, 247, 192, 0.1);
  color: var(--accent);
  font-weight: 600;
}
.gf-achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
  animation: quizFadeSlide 0.3s ease;
}
.gf-achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.4rem;
  border-radius: 10px;
  border: 1px solid rgba(124, 247, 192, 0.08);
  background: rgba(13, 18, 26, 0.5);
  transition: all 0.2s;
  position: relative;
  text-align: center;
}
.gf-achievement.locked {
  opacity: 0.35;
  filter: grayscale(1);
}
.gf-achievement.unlocked {
  border-color: rgba(124, 247, 192, 0.25);
  background: rgba(124, 247, 192, 0.04);
}
.gf-achievement.unlocked:hover {
  border-color: rgba(124, 247, 192, 0.4);
  transform: translateY(-2px);
}
.gf-achievement-emoji {
  font-size: 1.4rem;
  line-height: 1;
}
.gf-achievement-name {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}
.gf-achievement.unlocked .gf-achievement-name {
  color: var(--text);
}
.gf-achievement-check {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.6rem;
  color: var(--accent);
  font-weight: 700;
}

/* ─── TOAST NOTIFICATIONS ────────────────────── */
#gamification-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 340px;
}
.gamification-toast {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(6, 10, 15, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 247, 192, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}
.gamification-toast.toast-visible {
  transform: translateX(0);
  opacity: 1;
}
.gamification-toast.toast-exit {
  transform: translateX(120%);
  opacity: 0;
}
.toast-achievement { border-color: rgba(255, 209, 102, 0.4); }
.toast-level-up { border-color: rgba(192, 132, 252, 0.4); }
.toast-page-complete { border-color: rgba(80, 250, 123, 0.4); }
.toast-freeze { border-color: rgba(139, 211, 255, 0.4); }
.toast-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.toast-achievement .toast-title { color: var(--accent-warm); }
.toast-level-up .toast-title { color: #c084fc; }
.toast-message {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── PRINT ──────────────────────────────────── */
@media print {
  .quiz-page-progress, .quiz-retry, .quiz-submit-btn, .quiz-multi-submit, .quiz-order-submit, .quiz-order-controls, .gamification-dashboard, #gamification-toast-container { display: none; }
  .quiz-explanation { display: block; }
}

/* ─── REDUCED MOTION ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .quiz-block, .quiz-streak-badge, .quiz-celebrate-emoji, .sa-results, .quiz-explanation, .xp-floater, .gf-streak-warning, .gamification-toast { animation: none; }
  .quiz-page-progress-fill, .sa-progress-bar, .gf-xp-fill { transition: none; }
  .gamification-toast { transform: none; opacity: 1; }
  .gamification-toast.toast-visible { transform: none; }
}
