/* ============================================================
   Practice Challenges + Interactive Quiz components
   Reusable across all chapters. Pairs with chapter.css.
   ============================================================ */

/* ---------- Practice Challenges ---------- */
.challenges { display: grid; gap: 1rem; margin: 1.4rem 0; }
.challenge {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--c-amber); border-radius: 13px;
  padding: 1.2rem 1.4rem; transition: all 0.2s ease;
}
.challenge:hover { box-shadow: 0 10px 26px rgba(20,30,80,0.07); transform: translateY(-2px); }
.challenge .cnum {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--c-amber), #f59e0b);
}
.challenge .cbody h4 { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 0.3rem; }
.challenge .cbody p { font-size: 0.9rem !important; color: var(--ink-soft) !important; margin: 0 !important; line-height: 1.6 !important; }
.challenge .cbody code {
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; font-size: 0.82rem; color: var(--c-purple);
}
.challenge .chint { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.4rem; font-style: italic; }

/* ---------- Quiz ---------- */
.quiz {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 1.8rem; box-shadow: 0 8px 30px rgba(20,30,80,0.05);
}
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.quiz-head h3 { font-size: 1.2rem; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.quiz-progress { font-size: 0.82rem; color: var(--ink-faint); font-weight: 600; }
.quiz-sub { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 1.3rem; }

/* Score banner */
.quiz-score {
  display: none; align-items: center; gap: 1rem;
  border-radius: 12px; padding: 1rem 1.3rem; margin-bottom: 1.3rem;
}
.quiz-score.show { display: flex; }
.quiz-score .qs-emoji { font-size: 2rem; line-height: 1; }
.quiz-score .qs-text b { font-size: 1.15rem; }
.quiz-score.pass { background: var(--c-green-bg); color: #065f46; }
.quiz-score.partial { background: var(--c-amber-bg); color: #92400e; }

/* Question card */
.q-card { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.q-card:first-of-type { border-top: none; }
.q-text { font-weight: 600; color: var(--ink); font-size: 0.98rem; margin-bottom: 0.8rem; display: flex; gap: 8px; }
.q-text .qn {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px;
  background: var(--c-purple-bg); color: var(--c-purple);
  font-size: 0.78rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.q-opts { display: grid; gap: 0.5rem; padding-left: 32px; }
.q-opt {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 0.6rem 0.9rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--panel);
  font-size: 0.9rem; color: var(--ink-soft); transition: all 0.15s ease;
}
.q-opt:hover { border-color: var(--c-purple); background: var(--c-purple-bg); }
.q-opt input { accent-color: var(--c-purple); width: 16px; height: 16px; flex-shrink: 0; }
.q-opt.selected { border-color: var(--c-purple); background: var(--c-purple-bg); color: var(--ink); font-weight: 500; }

/* Graded states */
.q-opt.correct { border-color: var(--c-green); background: var(--c-green-bg); color: #065f46; font-weight: 600; }
.q-opt.incorrect { border-color: var(--c-red); background: #fde8e8; color: #991b1b; font-weight: 600; }
.q-opt .mark { margin-left: auto; font-weight: 800; }
.q-explain {
  display: none; margin: 0.6rem 0 0 32px; padding: 0.7rem 1rem;
  border-radius: 9px; background: var(--c-blue-bg); border-left: 3px solid var(--c-blue);
  font-size: 0.85rem; color: var(--ink-soft); line-height: 1.55;
}
.q-explain.show { display: block; }
.q-explain b { color: var(--ink); }

/* Buttons row */
.quiz-actions { display: flex; gap: 0.7rem; margin-top: 1.5rem; flex-wrap: wrap; align-items: center; }
.quiz-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.8rem; }
.quiz-note a { color: var(--c-purple); font-weight: 600; }

.btn-check {
  background: linear-gradient(135deg, var(--c-purple), #a855f7); color: #fff;
  border: none; padding: 0.7rem 1.5rem; border-radius: 9px;
  font-weight: 700; font-size: 0.9rem; cursor: pointer; font-family: inherit;
  transition: all 0.2s ease;
}
.btn-check:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(124,58,237,0.3); }
.btn-reset {
  background: var(--panel-2); color: var(--ink-soft); border: 1px solid var(--line);
  padding: 0.7rem 1.3rem; border-radius: 9px; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; font-family: inherit; transition: all 0.2s ease;
}
.btn-reset:hover { background: #fde8e8; color: #991b1b; border-color: transparent; }
