:root {
  --bslib-sidebar-main-bg: #f8f8f8;
}

.popover {
  --bs-popover-header-bg: #222;
  --bs-popover-header-color: #fff;
}

.popover .btn-close {
  filter: var(--bs-btn-close-white-filter);
}

/* Cambridge Supervisions: subtle typography polish */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background-color: #f7f8fa;
}

main.content {
  max-width: 900px;
  margin: auto;
}

h2, h3 { margin-top: 2rem; }
main ul, main ol { margin-bottom: 1rem; }
main p { line-height: 1.5; }
pre code { font-size: 0.9em; }
.callout { margin: 1rem 0; }

/* ===============================
   MCQ layout + feedback (webexercises)
   Scope everything to .mcq-we wrapper
   =============================== */
.mcq-we {
  --mcq-correct: #15803d;   /* green-700 */
  --mcq-incorrect: #b91c1c; /* red-700 */
}

/* Each question as a card */
.mcq-we-q {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  border-left: 5px solid #0d6efd;
}

.mcq-we .webex-radiogroup,
.mcq-we .webex-checkboxgroup { display: block; }

/* Stack options vertically with nice spacing */
.mcq-we label {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin: .25rem 0;
  line-height: 1.5;
}

/* Improve answer affordances */
.mcq-we .webex-radiogroup label,
.mcq-we .webex-checkboxgroup label {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mcq-we .webex-radiogroup label:hover,
.mcq-we .webex-checkboxgroup label:hover {
  background: #eef3ff;
}

/* Tweak control alignment */
.mcq-we input[type="radio"],
.mcq-we input[type="checkbox"] {
  margin-top: .15rem;
}

/* Make the checked option a little bolder for readability */
.mcq-we input[type="radio"]:checked + span,
.mcq-we input[type="checkbox"]:checked + span,
.mcq-we label:has(input:checked) { font-weight: 500; }

/* Feedback text */
.mcq-we label.webex-correct::after,
.mcq-we li.webex-correct > label::after,
.mcq-we div.webex-correct > label::after,
.mcq-we input.webex-correct + label::after,
.mcq-we .webex-solution-true > label::after {
  content: " Correct";
  color: var(--mcq-correct);
  font-weight: 600;
  margin-left: .35rem;
}
.mcq-we label.webex-incorrect::after,
.mcq-we li.webex-incorrect > label::after,
.mcq-we div.webex-incorrect > label::after,
.mcq-we input.webex-incorrect + label::after,
.mcq-we .webex-solution-false > label::after {
  content: " Incorrect";
  color: var(--mcq-incorrect);
  font-weight: 600;
  margin-left: .35rem;
}

/* Also tint the whole line when correctness is known */
.mcq-we label.webex-correct,
.mcq-we li.webex-correct > label,
.mcq-we div.webex-correct > label,
.mcq-we input.webex-correct + label,
.mcq-we .webex-solution-true > label {
  color: var(--mcq-correct);
}
.mcq-we label.webex-incorrect,
.mcq-we li.webex-incorrect > label,
.mcq-we div.webex-incorrect > label,
.mcq-we input.webex-incorrect + label,
.mcq-we .webex-solution-false > label {
  color: var(--mcq-incorrect);
}

/* Optional: hint styling */
.mcq-we details.hint {
  margin-top: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(0,0,0,0.03);
}

.mcq-we details.hint summary {
  font-weight: 600;
  cursor: pointer;
}

/* feedback driven by our script */
.mcq-we label.is-correct::after {
  content: " Correct"; color: #15803d; font-weight: 600; margin-left: .35rem;
}
.mcq-we label.is-incorrect::after {
  content: " Incorrect"; color: #b91c1c; font-weight: 600; margin-left: .35rem;
}
/* optional tint for the whole line */
.mcq-we label.is-correct  { color: #15803d; }
.mcq-we label.is-incorrect{ color: #b91c1c; }

/* ===============================
   Quiz Controls & Leaderboard
   =============================== */

/* Quiz submission controls - proper action bar */
.quiz-controls {
  background: #ffffff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  margin-top: 1.5rem;
}

.quiz-controls p {
  margin: 1.1rem 0 0.4rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

#nickname {
  flex: 1 1 260px;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.16);
}

#quiz-submit {
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: none;
  background: #0d6efd;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

#quiz-submit:hover {
  filter: brightness(0.95);
}

.quiz-controls button[type="button"]:not(#quiz-submit) {
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.16);
  background: #fff;
  cursor: pointer;
}

/* Quiz result message: make it visible and rewarding */
#quiz-result {
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(13,110,253,0.08);
  border: 1px solid rgba(13,110,253,0.20);
  font-weight: 700;
}

#quiz-result::before {
  content: "\1F3AF ";
}

/* Hidden answer key (visible in DOM but not rendered) */
.mcq-key {
  display: none;
}

/* Post-submit feedback styling */
label.is-correct {
  outline: 2px solid currentColor;
  border-radius: 6px;
  padding: 0.15rem 0.25rem;
}

label.is-incorrect {
  outline: 2px dashed currentColor;
  border-radius: 6px;
  padding: 0.15rem 0.25rem;
}

.quiz-feedback-line {
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.quiz-feedback-line.hidden {
  display: none;
}

/* Leaderboard table - credible and worth competing for */
#leaderboard {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
  margin-top: 0.6rem;
}

#leaderboard th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: rgba(0,0,0,0.06);
  font-weight: 700;
}

#leaderboard td {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* highlight top rows */
#leaderboard tr:nth-child(2) td { font-weight: 800; }
#leaderboard tr:nth-child(3) td,
#leaderboard tr:nth-child(4) td { font-weight: 700; }
/* ===============================
   Song Form Styling (topic2ludic)
   =============================== */
.song-form {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-left: 5px solid #0d6efd;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.song-form > p {
  margin: 0;
  display: contents;
}

.song-form p label {
  display: block;
  margin-bottom: 0.4rem;
}

.song-form p input[type="text"] {
  display: block;
  width: 100%;
}

.song-form label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  display: block;
}

.song-form input[type="text"],
.song-form textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.song-form input[type="text"]:focus,
.song-form textarea:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.song-form button {
  padding: 0.75rem 1.5rem;
  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.song-form button:hover {
  background: #0b5ed7;
}

.song-form button:active {
  background: #0a58ca;
}

.song-status {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: #f0f7ff;
  color: #0c63e4;
  font-weight: 500;
  border-left: 4px solid #0d6efd;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: pre-wrap;
}