/* CS Competition Prep lesson page. Everything is scoped to .csl so it
   doesn't clash with MDB/Bootstrap class names used on the rest of the site. */
.csl {
  --csl-navy: #1f2a44;
  --csl-ink: #1f2a44;
  --csl-muted: #56627a;
  --csl-surface: #fbfcfe;
  --csl-surface-2: #e1e9f3;
  --csl-line: #c9d4e3;
  --csl-orange: #f28c28;
  --csl-orange-ink: #a84c08;
  --csl-blue: #2b6cb0;
  --csl-good: #22704a;
  --csl-good-bg: #ddf3e6;
  --csl-bad: #b42828;
  --csl-bad-bg: #fbe3e3;
  --csl-wait: #8a5a00;
  --csl-wait-bg: #fff1d6;
  --csl-shadow: 0 10px 30px rgba(31, 42, 68, 0.1);
  --csl-display: 'Fredoka', 'Trebuchet MS', Arial, sans-serif;
  --csl-body: 'Nunito', 'Segoe UI', Arial, sans-serif;
  font-family: var(--csl-body);
  color: var(--csl-ink);
  font-size: 17px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}
.csl-panel { padding: clamp(14px, 3vw, 36px); }
.csl *, .csl *::before, .csl *::after { box-sizing: border-box; }
.csl p { margin: 0; }
.csl h2, .csl h3 { font-family: var(--csl-display); font-weight: 600; color: var(--csl-ink); margin: 0; line-height: 1.2; text-wrap: balance; }
.csl a { text-decoration: none; }
.csl button { font: inherit; cursor: pointer; }
.csl a:focus-visible, .csl button:focus-visible, .csl input:focus-visible, .csl select:focus-visible, .csl textarea:focus-visible, .csl .csl-stage:focus-visible {
  outline: 3px solid var(--csl-blue); outline-offset: 3px;
}
.csl-muted { color: var(--csl-muted); font-weight: 400; font-size: 0.9em; }
.csl-eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--csl-orange-ink); }
.csl-empty { display: flex; gap: 12px; align-items: center; padding: 24px; background: var(--csl-surface); border: 1px dashed var(--csl-line); border-radius: 16px; color: var(--csl-muted); }

/* buttons + chips */
.csl-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 15px; line-height: 1.2;
  background: var(--csl-surface); color: var(--csl-ink); box-shadow: inset 0 0 0 1px var(--csl-line);
  transition: box-shadow .15s ease, filter .15s ease, transform .1s ease;
}
.csl-btn:hover { box-shadow: inset 0 0 0 2px var(--csl-navy); color: var(--csl-ink); }
.csl-btn:disabled { opacity: .45; cursor: default; box-shadow: inset 0 0 0 1px var(--csl-line); }
.csl-btn--primary { background: var(--csl-orange); color: var(--csl-navy); box-shadow: none; }
.csl-btn--primary:hover { filter: brightness(1.06); box-shadow: none; }
.csl-btn--primary:disabled { box-shadow: none; }
.csl-btn--ghost { background: transparent; }
.csl-btn--small { padding: 6px 12px; font-size: 13px; }
.csl-btn.is-danger { background: var(--csl-bad); color: #fff; box-shadow: none; }

.csl-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px;
  background: var(--csl-surface-2); color: var(--csl-ink);
}
.csl-chip--done { background: var(--csl-good-bg); color: var(--csl-good); }
.csl-chip--lock { background: #e7eaf0; color: #5b6475; }
.csl-chip--open { background: #e3edf9; color: var(--csl-blue); }
.csl-chip--wait { background: var(--csl-wait-bg); color: var(--csl-wait); }
.csl-chip--bad { background: var(--csl-bad-bg); color: var(--csl-bad); }
.csl-chip--link:hover { background: var(--csl-orange); color: var(--csl-navy); }

/* home */
.csl-flash { background: var(--csl-wait-bg); color: var(--csl-wait); font-weight: 700; padding: 12px 16px; border-radius: 12px; display: flex; gap: 10px; align-items: center; }
.csl-intro { display: flex; gap: 16px 28px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--csl-surface); border: 1px solid var(--csl-line); border-radius: 16px; padding: 16px 20px; }
.csl-intro > div:first-child { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.csl-intro p:not(.csl-eyebrow) { max-width: 70ch; }
.csl-intro--admin { border-style: dashed; }
.csl-progress { display: flex; flex-direction: column; gap: 6px; min-width: 220px; font-size: 14px; font-weight: 700; color: var(--csl-muted); }
.csl-progress__bar { height: 10px; background: var(--csl-surface-2); border-radius: 999px; overflow: hidden; }
.csl-progress__bar span { display: block; height: 100%; background: var(--csl-orange); border-radius: 999px; }

.csl-section { display: flex; flex-direction: column; gap: 12px; }
.csl-section__title { font-size: 22px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.csl-section__title span { font-family: var(--csl-body); font-size: 14px; font-weight: 700; color: var(--csl-muted); }
.csl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.csl-card {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center;
  background: var(--csl-surface); border: 1px solid var(--csl-line); border-radius: 16px; padding: 14px 16px; color: var(--csl-ink);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.csl-card:hover { transform: translateY(-2px); border-color: var(--csl-orange); box-shadow: var(--csl-shadow); color: var(--csl-ink); }
.csl-num {
  grid-row: span 3; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--csl-navy); color: #fff8ec; font-family: var(--csl-display); font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums;
}
.csl-card.is-done .csl-num { background: var(--csl-good); }
.csl-card__title { font-weight: 800; line-height: 1.25; min-width: 0; }
.csl-card__meta { font-size: 13px; color: var(--csl-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.csl-card__why { font-size: 12px; color: var(--csl-muted); line-height: 1.3; }
.csl-card.is-locked { background: #f1f4f8; cursor: not-allowed; }
.csl-card.is-locked:hover { transform: none; border-color: var(--csl-line); box-shadow: none; }
.csl-card.is-locked .csl-num { background: #9aa5b8; }
.csl-card.is-locked .csl-card__title { color: var(--csl-muted); }

.csl-quizcard {
  display: flex; align-items: center; gap: 16px; color: var(--csl-ink);
  background: linear-gradient(90deg, #fff6ea, var(--csl-surface) 60%); border: 2px solid #f6c48f; border-radius: 16px; padding: 14px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.csl-quizcard:hover { transform: translateY(-2px); box-shadow: var(--csl-shadow); color: var(--csl-ink); }
.csl-quizcard__icon { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--csl-orange); color: var(--csl-navy); font-size: 20px; }
.csl-quizcard__icon--alt { background: var(--csl-blue); color: #fff; }
.csl-quizcard__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.csl-quizcard__title { font-family: var(--csl-display); font-weight: 600; font-size: 19px; }
.csl-quizcard__sub { font-size: 14px; color: var(--csl-muted); }
.csl-quizcard.is-done { border-color: #9fd6b6; background: linear-gradient(90deg, #eaf8f0, var(--csl-surface) 60%); }
.csl-quizcard.is-locked { background: #f1f4f8; border-color: var(--csl-line); cursor: not-allowed; }
.csl-quizcard.is-locked:hover { transform: none; box-shadow: none; }
.csl-quizcard.is-locked .csl-quizcard__icon { background: #9aa5b8; color: #fff; }

/* chapter / quiz header bar */
.csl-bar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.csl-bar__title { flex: 1; min-width: 0; }
.csl-bar__title h2 { font-size: clamp(20px, 3vw, 30px); }
.csl-tabs { display: inline-flex; background: var(--csl-surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.csl-tabs a { padding: 7px 16px; border-radius: 999px; font-weight: 800; font-size: 15px; color: var(--csl-muted); }
.csl-tabs a[aria-pressed="true"] { background: var(--csl-surface); color: var(--csl-ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }

/* slides */
.csl-stage-outer { width: 100%; max-width: calc((100vh - 300px) * 16 / 9); min-width: min(100%, 300px); margin: 0 auto; }
.csl-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: var(--csl-navy); box-shadow: var(--csl-shadow); touch-action: pan-y; user-select: none; }
.csl-track { position: absolute; inset: 0; display: flex; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.csl-slot { position: relative; flex: 0 0 100%; height: 100%; overflow: hidden; }
.csl-slide { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(var(--csl-s, .5)); }
.csl-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.csl-dots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.csl-dot { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; background: var(--csl-line); }
.csl-dot[aria-current="true"] { background: var(--csl-orange); width: 28px; border-radius: 999px; }
.csl-count { font-size: 14px; font-weight: 700; color: var(--csl-muted); font-variant-numeric: tabular-nums; text-align: center; }
.csl-hint { display: none; font-size: 14px; color: var(--csl-muted); text-align: center; }
@media (max-width: 600px) and (orientation: portrait) { .csl-hint { display: block; } }

/* the 1920×1080 slide markup from the decks */
.csl-slide section { position: relative; width: 1920px; height: 1080px; overflow: hidden; display: block; }
.csl-slide section * { margin: 0; box-sizing: border-box; }
.csl-slide h1 { font-size: 96px; font-weight: 600; line-height: 1.1; }
.csl-slide h2 { font-size: 64px; font-weight: 600; line-height: 1.15; }
.csl-slide h3 { font-size: 44px; font-weight: 600; line-height: 1.2; }
.csl-slide p { font-size: 32px; line-height: 1.4; }
.csl-slide ul, .csl-slide ol { padding-left: 1.2em; }
.csl-slide table { border-collapse: collapse; width: 100%; text-align: left; }
.csl-slide th, .csl-slide td { padding: 0.35em 0.6em; border-bottom: 2px solid rgba(127, 140, 160, 0.35); vertical-align: top; }
.csl-slide th { font-weight: 800; }
.csl-slide x-shape { display: block; flex: none; }
.csl-slide x-shape[kind="ellipse"] { border-radius: 50%; }
.csl-slide x-shape[kind="rounded"] { border-radius: 16px; }
.csl-slide x-shape[kind="diamond"] { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.csl-slide x-shape[kind="arrow-right"] { clip-path: polygon(0 30%, 60% 30%, 60% 0, 100% 50%, 60% 100%, 60% 70%, 0 70%); }
.csl-slide x-shape[kind="arrow-left"] { clip-path: polygon(100% 30%, 40% 30%, 40% 0, 0 50%, 40% 100%, 40% 70%, 100% 70%); }
.csl-slide x-shape[kind="arrow-up"] { clip-path: polygon(30% 100%, 30% 40%, 0 40%, 50% 0, 100% 40%, 70% 40%, 70% 100%); }
.csl-slide x-shape[kind="arrow-down"] { clip-path: polygon(30% 0, 30% 60%, 0 60%, 50% 100%, 100% 60%, 70% 60%, 70% 0); }
.csl-slide x-connector { display: none; }
.csl-conn { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }

/* quiz */
.csl-quiz { max-width: 820px; width: 100%; margin: 0 auto; }
.csl-qcard { background: var(--csl-surface); border: 1px solid var(--csl-line); border-radius: 22px; padding: clamp(18px, 4vw, 34px); display: flex; flex-direction: column; gap: 18px; box-shadow: var(--csl-shadow); }
.csl-qtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.csl-qlabel { font-size: 14px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--csl-orange-ink); }
.csl-qprog { flex: 0 1 220px; height: 8px; background: var(--csl-surface-2); border-radius: 999px; overflow: hidden; }
.csl-qprog span { display: block; height: 100%; background: var(--csl-blue); }
.csl-qby { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15px; font-weight: 700; color: var(--csl-ink); background: #e3edf9; border-radius: 10px; padding: 8px 12px; }
.csl-qby i { color: var(--csl-blue); }
.csl-qby__ch { font-size: 13px; color: var(--csl-muted); }
.csl-timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; color: var(--csl-blue); font-variant-numeric: tabular-nums; margin-left: auto; }
.csl-note { font-size: 14px; font-weight: 700; color: var(--csl-wait); background: var(--csl-wait-bg); border-radius: 10px; padding: 8px 12px; }
.csl-credits { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.csl-chip--credit { background: #e3edf9; color: var(--csl-blue); font-size: 13px; padding: 4px 10px; }

/* ranking */
.csl-rank { max-width: 860px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.csl-tabs--wrap { flex-wrap: wrap; border-radius: 16px; align-self: flex-start; }
.csl-tabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font-weight: 800; font-size: 15px; color: var(--csl-muted); }
.csl-tabs button[aria-selected="true"] { background: var(--csl-surface); color: var(--csl-ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.csl-rankcard { gap: 10px; }
.csl-rankcard h3 { font-size: 22px; }
.csl-tablewrap { overflow-x: auto; }
.csl-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.csl-table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--csl-muted); padding: 8px 10px; border-bottom: 2px solid var(--csl-line); }
.csl-table td { padding: 10px; border-bottom: 1px solid var(--csl-line); }
.csl-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.csl-table tr.is-me td { background: #fff3e2; }
.csl-medal { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--csl-surface-2); font-family: var(--csl-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.csl-medal--1 { background: #f6c443; color: #5a3d00; }
.csl-medal--2 { background: #cfd6e0; color: #2f3846; }
.csl-medal--3 { background: #e0a46e; color: #4a2a0c; }
.csl-qtext { font-family: var(--csl-display); font-size: clamp(21px, 3vw, 30px); font-weight: 500; line-height: 1.3; }
.csl-opts { display: grid; gap: 10px; }
.csl-opt {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px; text-align: left;
  border: 2px solid var(--csl-line); background: #f3f7fc; border-radius: 14px; padding: 11px 16px; font-size: 18px; font-weight: 700; color: var(--csl-ink);
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.csl-opt:hover:not(:disabled) { border-color: var(--csl-orange); transform: translateX(2px); }
.csl-opt__letter { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--csl-surface-2); font-family: var(--csl-display); font-weight: 600; }
.csl-opt__txt { min-width: 0; }
.csl-opt__mark { font-size: 14px; font-weight: 800; }
.csl-opt:disabled { cursor: default; color: var(--csl-ink); }
.csl-opt.is-wrong { border-color: var(--csl-bad); background: var(--csl-bad-bg); color: var(--csl-bad); }
.csl-opt.is-wrong .csl-opt__txt { text-decoration: line-through; }
.csl-opt.is-right { border-color: var(--csl-good); background: var(--csl-good-bg); color: var(--csl-good); }
.csl-opt.is-locked:not(.is-right):not(.is-wrong) { opacity: .55; }
.csl-feedback { min-height: 26px; font-weight: 800; }
.csl-feedback.is-good { color: var(--csl-good); }
.csl-feedback.is-bad { color: var(--csl-bad); }
.csl-feedback__why { display: block; font-weight: 600; color: var(--csl-ink); margin-top: 4px; }
.csl-qfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.csl-result { align-items: center; text-align: center; }
.csl-result h3 { font-size: 24px; }
.csl-result h3.csl-retake { color: var(--csl-bad); max-width: 34ch; }
.csl-score { font-family: var(--csl-display); font-size: clamp(56px, 10vw, 88px); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.csl-score small { font-size: .45em; color: var(--csl-muted); }
.csl-remember { background: var(--csl-surface-2); border-radius: 14px; padding: 14px 18px; text-align: left; max-width: 60ch; }
.csl-remember b { color: var(--csl-orange-ink); }
.csl-review { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.csl-review__list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.csl-review .csl-chip { font-size: 13px; padding: 4px 10px; }
.csl-save { font-size: 14px; font-weight: 700; color: var(--csl-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.csl-save.is-bad { color: var(--csl-bad); }
.csl-row--start { justify-content: flex-start !important; }
.csl-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* our questions */
.csl-qwrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .csl-qwrap { grid-template-columns: minmax(0, 1fr); } }
.csl-form { gap: 10px; }
.csl-form h3, .csl-qlist h3 { font-size: 22px; }
.csl-form label { font-weight: 800; font-size: 15px; margin-top: 4px; }
.csl-form .form-control, .csl-form .form-select { font-family: var(--csl-body); font-size: 16px; background: #fff; border: 1px solid var(--csl-line); }
.csl-fopts { border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.csl-fopts legend { font-weight: 800; font-size: 15px; margin-bottom: 4px; float: none; width: auto; }
.csl-fopts legend span { font-weight: 400; color: var(--csl-muted); font-size: 14px; display: block; }
.csl-fopt { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px; }
.csl-fopt input[type="radio"] { width: 20px; height: 20px; accent-color: var(--csl-good); }
.csl-form .csl-fopt__letter { margin: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--csl-surface-2); font-family: var(--csl-display); font-weight: 600; cursor: pointer; }
.csl-fopt input[type="radio"]:checked + .csl-fopt__letter { background: var(--csl-good); color: #fff; }
.csl-form .csl-btn--primary { align-self: flex-start; }
.csl-qlist { display: flex; flex-direction: column; gap: 12px; }
#csl-qitems { display: flex; flex-direction: column; gap: 10px; }
.csl-qitem { background: var(--csl-surface); border: 1px solid var(--csl-line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.csl-qitem__top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.csl-qitem__q { font-weight: 800; }
.csl-qitem__opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.csl-qitem__opts li { padding: 4px 10px; border-radius: 8px; background: #f3f7fc; }
.csl-qitem__opts li.is-right { background: var(--csl-good-bg); color: var(--csl-good); font-weight: 700; }
.csl-qitem__note { font-size: 14px; background: var(--csl-wait-bg); border-radius: 8px; padding: 6px 10px; }
.csl-qitem__actions { display: flex; justify-content: flex-end; }

@media (max-width: 576px) {
  .csl { font-size: 16px; }
  .csl-opt { grid-template-columns: 34px 1fr; font-size: 16px; }
  .csl-opt__mark { grid-column: 2; }
  .csl-quizcard { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .csl-track, .csl-card, .csl-opt, .csl-quizcard, .csl-btn { transition: none; }
}
