:root {
  /* Playground editor/console/sidebar and static code-preview blocks —
     these now follow the site's light/dark toggle. Light values below;
     dark overrides (matching the CodeMirror Dracula theme, used when
     data-theme="dark") are in :root[data-theme="dark"]. See
     playground/static/playground/run.js and static/highlight.js for how
     the CodeMirror "theme" option / cm-s-dracula class switch alongside
     these tokens. */
  --code-bg: #ffffff;
  --code-panel-bg: #f4f5f7;
  --code-border: #dde1e7;
  --code-text: #1e1f29;
  --code-muted: #626a7a;
  --code-accent: #0050dc;
  --code-danger: #d1453b;

  /* Light theme (default) tokens for general site chrome. */
  --bg: #f4f5f7;
  --panel-bg: #ffffff;
  --border: #dde1e7;
  --text: #1e1f29;
  --muted: #626a7a;
  --accent: #0050dc;
  --accent-dark: #1034a6;
  --danger: #d1453b;

  /* Home page hero code snippet — unlike --code-*, this DOES follow the
     site's light/dark toggle (it's a plain marketing illustration, not
     paired with a fixed-dark CodeMirror instance). Light values below;
     dark overrides in :root[data-theme="dark"]. */
  --hero-code-bg: #f4f5f7;
  --hero-code-border: transparent;
  --hero-code-text: #1e1f29;
  --hero-code-comment: #2e7d32;
  --hero-code-kw-action: #8250df;
  --hero-code-kw-block: #0057b7;
  --hero-code-type: #0b7285;
  --hero-code-string: #c2410c;
  --hero-code-var: #1e1f29;
  --hero-code-number: #1e1f29;

  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
  /* Dark theme tokens for general site chrome — identical to the fixed
     --code-* values above, since the whole site was originally dark-only,
     but kept as separate variables so the two can be tuned independently. */
  --bg: #1e1f29;
  --panel-bg: #282a36;
  --border: #3a3d4d;
  --text: #f1f2f6;
  --muted: #9aa0b4;
  --accent: #5b8ff8;
  --accent-dark: #3d6fe0;
  --danger: #ff6b6b;

  --code-bg: #1e1f29;
  --code-panel-bg: #282a36;
  --code-border: #3a3d4d;
  --code-text: #f1f2f6;
  --code-muted: #9aa0b4;
  --code-accent: #5b8ff8;
  --code-danger: #ff6b6b;

  /* Dark values match the real CodeMirror Dracula theme used everywhere
     else on the site (see codefr-mode.js/highlight.js), for consistency. */
  --hero-code-bg: #282a36;
  --hero-code-border: #3a3d4d;
  --hero-code-text: #f1f2f6;
  --hero-code-comment: #6272a4;
  --hero-code-kw-action: #ff79c6;
  --hero-code-kw-block: #ff79c6;
  --hero-code-type: #ffb86c;
  --hero-code-string: #f1fa8c;
  --hero-code-var: #50fa7b;
  --hero-code-number: #bd93f9;
}

/* Reskin Bulma to the brand palette above (HSL). Hue/saturation stay
   constant across themes (brand identity) and live on :root; lightness is
   Bulma's own light-mode default on :root, overridden for dark under
   [data-theme="dark"] below. The toggle in base.html always sets one of
   the two explicitly (never removes the attribute), so this never races
   with Bulma's own prefers-color-scheme fallback. */
:root {
  --bulma-scheme-h: 235;
  --bulma-scheme-s: 15%;
  --bulma-primary-h: 220deg;
  --bulma-primary-s: 88%;
  --bulma-link-h: 220deg;
  --bulma-link-s: 88%;
  --bulma-danger-h: 0deg;
  --bulma-danger-s: 100%;
}

:root[data-theme="dark"] {
  --bulma-scheme-main-l: 14%;      /* page background ~ --bg */
  --bulma-scheme-main-bis-l: 18%;  /* boxes/cards ~ --panel-bg */
  --bulma-scheme-main-ter-l: 22%;
  --bulma-background-l: 18%;
  --bulma-border-weak-l: 22%;
  --bulma-border-l: 26%;           /* ~ --border */
  --bulma-text-l: 65%;             /* body text ~ --muted */
  --bulma-text-strong-l: 95%;      /* headings/emphasis ~ --text */
  --bulma-primary-l: 63%;
  --bulma-link-l: 63%;
  --bulma-danger-l: 71%;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Grows to push the footer down on short pages, but never shrinks below its
   own content — lets body grow past 100vh and the page scroll normally on
   tall pages (docs, home, lists...). */
.site-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* The playground's two-pane editor (playground/style.css) fills remaining
   viewport height via a flex:1 chain rooted here, with its own panes
   scrolling internally instead of the page — the opposite of every other
   page, so it opts out of the natural-height behavior above. */
.site-main.playground-page {
  flex: 1 1 0%;
  min-height: 0;
}

.footer {
  --bulma-footer-padding: 2rem 1.5rem;
  flex-shrink: 0;
}

.inline-form {
  display: inline;
}

.empty-state {
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
}

.challenge-description {
  white-space: pre-wrap;
}

.code-preview {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 1rem 0;
}

.like-button.liked {
  border-color: var(--accent);
  color: var(--accent);
}

.button.is-primary,
.button.is-primary:hover,
.button.is-primary:focus {
  color: #ffffff;
}

.comments {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.comments h2 {
  font-size: 1.1rem;
  margin-top: 0;
}

.comment-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.comment-body {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 500px;
}

.comment-form button {
  align-self: flex-start;
}

.icon-illustration {
  margin-bottom: 0.5rem;
}

.icon-illustration svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
}

.icon-illustration-inline {
  display: inline-flex;
  vertical-align: middle;
}

.icon-illustration-inline svg {
  width: 1.3em;
  height: 1.3em;
  color: var(--accent);
}

/* Learning path: persistent chapter sidebar (learning/_sidebar.html) plus
   the matching locked/unlocked treatment reused on the chapter list boxes
   (learning/list.html). Locked chapters are visually muted and inert —
   never a clickable <a> — so "locked" reads clearly at a glance. */
.chapter-menu {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.chapter-menu-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border-left: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
}

a.chapter-item:hover {
  background: var(--bg);
}

.chapter-item.is-active {
  border-left-color: var(--accent);
  background: var(--bg);
  font-weight: 600;
}

.chapter-item.is-locked {
  color: var(--muted);
  cursor: not-allowed;
}

.chapter-index {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
}

.chapter-item.is-locked .chapter-index {
  background: transparent;
  border: 1px solid var(--border);
}

.chapter-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chapter-title {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-score {
  font-size: 0.75rem;
  color: var(--muted);
}

.chapter-item.is-done .chapter-icon svg {
  color: #2ea043;
}

.chapter-icon svg {
  width: 1.1em;
  height: 1.1em;
  color: var(--muted);
}

.box.is-locked {
  opacity: 0.65;
}

/* Home page hero: a fixed brand-blue banner (independent of the site's
   light/dark toggle) with a static, hand-colored code snippet that DOES
   follow the toggle — see --hero-code-* tokens above (dark values match
   the real CodeMirror Dracula theme used everywhere else on the site).
   Hand-colored rather than run through CodeMirror since this content never
   changes and shouldn't depend on loading CodeMirror just for the homepage. */
.hero-intro {
  background: #1034a6;
}

.hero-code-card {
  position: relative;
  background: var(--hero-code-bg);
  border: 1px solid var(--hero-code-border);
  border-radius: 10px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

.hero-code-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: #1034a6;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 4px;
}

.hero-code-snippet {
  margin: 0;
  background: transparent;
  color: var(--hero-code-text);
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
}

.hero-code-snippet .tok-comment { color: var(--hero-code-comment); }
.hero-code-snippet .tok-kw-action { color: var(--hero-code-kw-action); }
.hero-code-snippet .tok-kw-block { color: var(--hero-code-kw-block); }
.hero-code-snippet .tok-type { color: var(--hero-code-type); }
.hero-code-snippet .tok-string { color: var(--hero-code-string); }
.hero-code-snippet .tok-var { color: var(--hero-code-var); }
.hero-code-snippet .tok-number { color: var(--hero-code-number); }

/* ---------------------------------------------------------------------
   Site-wide animation & micro-interactions. Kept subtle and consistent
   rather than page-specific, since every page shares this stylesheet via
   base.html. Respects prefers-reduced-motion (rule at the very end).
   --------------------------------------------------------------------- */

@keyframes codefr-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes codefr-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes codefr-icon-flip {
  from { transform: rotate(0deg); }
  to { transform: rotate(180deg); }
}

html {
  scroll-behavior: smooth;
}

/* Every page's main content gently settles in on load. */
.site-main {
  /* short and without movement: a page must feel there the moment it is asked for */
  animation: codefr-fade-in 0.15s ease-out both;
}

/* Flash messages arrive with their own, slightly quicker fade so they
   don't look like part of the initial page settle. */
.site-main > .container > .notification {
  animation: codefr-fade-in 0.3s ease-out both;
}

/* Cards/boxes lift slightly on hover across the whole site (lesson list,
   home page feature boxes, locked-lesson panel, etc). Locked chapter
   entries opt out — they're inert, so a hover affordance would mislead. */
.box {
  transition: transform 0.15s ease;
}

/* Only where hovering exists (a touch screen has no hover: it would stay "stuck" after a tap), and never on a card that holds
   a form: lifting what you are typing in is disorienting. The shadow is a layer of its own that fades in (opacity), instead of
   an animated box-shadow, which the browser would repaint on every frame. */
@media (hover: hover) {
  .box:not(:has(input, select, textarea, form)) {
    position: relative;
  }

  .box:not(:has(input, select, textarea, form))::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
  }

  .box:not(:has(input, select, textarea, form)):hover {
    transform: translateY(-3px);
  }

  .box:not(:has(input, select, textarea, form)):hover::after {
    opacity: 1;
  }

  .box.is-locked:hover {
    transform: none;
  }

  .box.is-locked:hover::after {
    opacity: 0;
  }
}

/* One button size site-wide: every .button uses Bulma's "small" size,
   whatever size modifier (or none) a template puts on it. */
.button,
.button.is-normal,
.button.is-medium,
.button.is-large {
  --bulma-control-size: var(--bulma-size-small);
  --bulma-control-radius: var(--bulma-radius-small);
  min-height: 2.5em; /* icon-only buttons match text ones */
}

/* Buttons/links get a quick, tactile press instead of just Bulma's
   instant hover-color swap. */
.button,
.navbar-item,
a.chapter-item {
  transition: transform 0.1s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.button:active {
  transform: scale(0.96);
}

a.chapter-item:hover:not(.is-active) {
  transform: translateX(2px);
}

/* The sun/moon theme-toggle icon spins into place on toggle (nav.js adds
   this class right before it swaps the SVG, then removes it once the
   animation ends). */
#theme-toggle-icon.is-flipping {
  animation: codefr-icon-flip 0.3s ease;
}

/* ---------------------------------------------------------------------
   Lesson quiz: numbered question cards, selectable answer cards, a live
   progress bar and gentle entrance/selection animations (see quiz.js).
   --------------------------------------------------------------------- */

@keyframes codefr-quiz-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

@keyframes codefr-quiz-check {
  from { transform: rotate(45deg) scale(0); }
  to { transform: rotate(45deg) scale(1); }
}

@keyframes codefr-quiz-dot {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes codefr-quiz-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes codefr-quiz-ready {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

.quiz-score {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.quiz-score .tag {
  animation: codefr-fade-in-up 0.4s ease-out both;
}

.quiz-score.is-perfect .tag {
  animation: codefr-fade-in-up 0.4s ease-out both, codefr-quiz-pop 0.7s 0.5s ease-out both;
}

.quiz-score-bar {
  flex: 1;
  max-width: 14rem;
  height: 0.45rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.quiz-score-bar span {
  display: block;
  height: 100%;
  width: var(--score, 0%);
  background: var(--accent);
  border-radius: 999px;
  transform-origin: left center;
  animation: codefr-quiz-fill 0.9s 0.2s ease-out both;
}

.quiz-score.is-perfect .quiz-score-bar span {
  background: var(--bulma-success, #2f9e6b);
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.quiz-progress-bar {
  flex: 1;
  height: 0.5rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

/* The fill is always as wide as the track and grows with transform (the compositor's job), not with width (a layout change). */
.quiz-progress-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease, background-color 0.3s ease;
}

.quiz-progress-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.quiz-progress-label.is-complete {
  color: var(--bulma-success, #2f9e6b);
}

.quiz-form:has(.quiz-progress-label.is-complete) .quiz-progress-bar span {
  background: var(--bulma-success, #2f9e6b);
}

.quiz-list {
  gap: 1rem;
}

.quiz-card {
  padding: 1.1rem 1.25rem 1.25rem;
  border-radius: 12px;
  border-left: 4px solid var(--border);
  position: relative;
  transition: border-color 0.25s ease;
  animation: codefr-fade-in-up 0.45s ease-out both;
  animation-delay: calc(min(var(--i, 0), 6) * 70ms);
}

/* With JS, cards wait (invisible) until they scroll into view. */
.quiz-form[data-reveal] .quiz-card {
  animation: none;
  opacity: 0;
  transform: translateY(14px);
}

.quiz-form[data-reveal] .quiz-card.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.45s ease-out, transform 0.45s ease-out, border-color 0.25s ease;
}

.quiz-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.quiz-card.is-answered {
  border-left-color: var(--accent);
}

.quiz-card.is-answered::after {
  opacity: 1;
}

.quiz-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}

.quiz-card-head .quiz-question {
  flex: 1;
  min-width: 0;
}

.quiz-card-head .quiz-question > :last-child {
  margin-bottom: 0;
}

.quiz-number {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border: 2px solid var(--border);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.quiz-card.is-answered .quiz-number {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.quiz-number.is-popping {
  animation: codefr-quiz-pop 0.35s ease-out;
}

.quiz-hint {
  margin: -0.4rem 0 0.8rem 2.85rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-left: 2.85rem;
}

.quiz-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.quiz-option:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.quiz-option:active {
  transform: scale(0.99);
}

.quiz-option.is-checked,
.quiz-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-bg));
  box-shadow: 0 0 0 1px var(--accent);
}

.quiz-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quiz-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quiz-mark {
  position: relative;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: var(--panel-bg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.quiz-option input[type="checkbox"] + .quiz-mark {
  border-radius: 6px;
}

.quiz-option:hover .quiz-mark {
  border-color: var(--accent);
}

.quiz-option input:checked + .quiz-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.quiz-option input[type="radio"]:checked + .quiz-mark::after {
  content: "";
  position: absolute;
  inset: 0.25rem;
  border-radius: 50%;
  background: #ffffff;
  animation: codefr-quiz-dot 0.2s ease-out both;
}

.quiz-option input[type="checkbox"]:checked + .quiz-mark::after {
  content: "";
  position: absolute;
  left: 0.36rem;
  top: 0.08rem;
  width: 0.32rem;
  height: 0.65rem;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: codefr-quiz-check 0.2s ease-out both;
}

.quiz-option-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quiz-option-text code {
  font-size: 0.9em;
}

/* "Ready" pulse: a ring on a layer of its own that breathes with opacity and scale, not an animated box-shadow */
.quiz-submit.is-ready {
  position: relative;
}

.quiz-submit.is-ready::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 6px rgba(0, 80, 220, 0.18);
  pointer-events: none;
  animation: codefr-quiz-ready 1.6s ease-in-out infinite;
}

@media (max-width: 600px) {
  .quiz-options,
  .quiz-hint {
    margin-left: 0;
  }

  .quiz-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .quiz-progress-bar {
    flex: none;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.exercise-last-submission {
  margin-top: 0.75rem;
}

.exercise-last-submission summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.exercise-last-submission[open] summary {
  margin-bottom: 0.5rem;
}

.rubric-report {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

.rubric-report li {
  padding: 0.15rem 0;
}

.quiz-question p {
  font-weight: 600;
}

.difficulty-stars {
  color: var(--accent);
  letter-spacing: 1px;
}

/* select[data-chip-picker] is progressively enhanced into this by
   chip-multiselect.js — hidden via .is-chip-enhanced once the chips exist,
   so it stays the real (working) field for no-JS clients. */
select.is-chip-enhanced {
  display: none;
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-option {
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip-option:hover {
  border-color: var(--accent);
}

.chip-option.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.leaderboard-rank {
  flex: none;
  width: 1.8rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.leaderboard-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}

.leaderboard-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.leaderboard-points {
  flex: none;
  font-weight: 700;
  color: var(--accent);
}

/* ---------------------------------------------------------------------
   Schools dashboards (admin / teacher / student home pages): stat cards,
   meters, card grids and activity feeds, all built on the theme tokens.
   --------------------------------------------------------------------- */

.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.dash-header .title {
  margin-bottom: 0.15rem;
}

.dash-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plan-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.plan-banner.is-warning {
  border-color: #f0a500;
  background: color-mix(in srgb, #f0a500 12%, var(--panel-bg));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Six cards read best as 3x2 (instead of wrapping 5+1). */
.stat-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 760px) {
  .stat-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

a.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: inherit;
}

.stat-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.stat-icon svg {
  width: 1.45rem;
  height: 1.45rem;
}

.stat-card.is-warning .stat-icon {
  background: color-mix(in srgb, #f0a500 18%, transparent);
  color: #f0a500;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dash-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1.75rem 0 0.75rem;
}

.dash-section-title h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.dash-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
}

.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dash-card-title {
  font-weight: 700;
  margin: 0;
}

.dash-card-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.dash-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0.55rem 0 0.25rem;
}

.meter {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.meter.is-good > span { background: #2e9e5b; }
.meter.is-mid > span { background: #f0a500; }
.meter.is-low > span { background: var(--danger); }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.feed li:last-child {
  border-bottom: 0;
}

.feed-main {
  flex: 1;
  min-width: 0;
}

.feed-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.dash-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  font-size: 0.82rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.due-badge {
  flex: none;
  min-width: 4.2rem;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.due-badge.is-soon {
  background: color-mix(in srgb, #f0a500 18%, transparent);
  color: #b57a00;
}

.due-badge.is-overdue {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

.dash-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* Logged-in navbar: eight links plus the user menu are wider than a
   ~1280px screen at Bulma's default spacing (the page then scrolled
   sideways). Tighten the spacing on mid-size desktops and truncate long
   names instead of letting the bar overflow. */
.navbar-user {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1024px) and (max-width: 1500px) {
  .navbar-item,
  .navbar-link {
    padding-inline: 0.55rem;
    font-size: 0.92rem;
  }
}

@media (min-width: 1024px) and (max-width: 1239px) {
  .navbar-item,
  .navbar-link {
    padding-inline: 0.4rem;
    font-size: 0.85rem;
  }

  .navbar-user {
    max-width: 7rem;
  }
}

@media (min-width: 1024px) and (max-width: 1119px) {
  .navbar-item,
  .navbar-link {
    padding-inline: 0.12rem;
    font-size: 0.8rem;
  }

  .navbar-user {
    max-width: 5.5rem;
  }
}

/* ---------------------------------------------------------------------
   People management (teacher/student rosters, edit, CSV import).
   --------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-bar .input,
.filter-bar .select select {
  height: 2.5em;
}

.filter-bar .grow {
  flex: 1 1 14rem;
}

.roster {
  width: 100%;
  border-collapse: collapse;
}

.roster th {
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.roster td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.roster tr:last-child td {
  border-bottom: 0;
}

.roster tr.is-inactive .member-name,
.roster tr.is-inactive .avatar {
  opacity: 0.55;
}

.member {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 14rem;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.member-name {
  font-weight: 600;
  line-height: 1.25;
}

.member-email {
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-all;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.row-actions form {
  display: inline;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.import-example {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.82rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  white-space: pre;
  overflow-x: auto;
}

.table-scroll {
  overflow-x: auto;
}

/* Narrow screens: each roster row becomes a stacked card so the status and
   actions stay reachable without scrolling sideways. */
@media (max-width: 700px) {
  .roster.is-stackable thead {
    display: none;
  }

  .roster.is-stackable,
  .roster.is-stackable tbody,
  .roster.is-stackable tr,
  .roster.is-stackable td {
    display: block;
  }

  .roster.is-stackable tr {
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--border);
  }

  .roster.is-stackable tr:last-child {
    border-bottom: 0;
  }

  .roster.is-stackable td {
    border: 0;
    padding: 0.25rem 0.5rem;
  }

  .roster.is-stackable .row-actions {
    justify-content: flex-start;
  }
}

/* `display: flex` on feed rows would otherwise override the hidden attribute
   the class-page filter relies on. */
.feed li[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------
   School area layout: sidebar navigation + content (schools/school_base).
   --------------------------------------------------------------------- */

.school-layout {
  display: grid;
  width: 100%; /* <main> is a flex column: without this the layout shrinks to its content */
  box-sizing: border-box;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem;
  align-items: start;
}

/* Pages inside the layout keep their own section/container markup; strip
   the page-level padding and width so they fill the content column. */
.school-main .section {
  padding: 0 0 2rem;
}

.school-main .container {
  max-width: none;
  width: auto;
  padding: 0;
  margin: 0;
}

.school-nav {
  position: sticky;
  top: 1rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
}

.school-nav-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.25rem 0.9rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.school-logo {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  object-fit: contain;
  background: var(--bg);
}

.school-logo-initials {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

.school-nav-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.school-nav-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-nav-name span {
  color: var(--muted);
  font-size: 0.75rem;
}

.school-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.school-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

.school-nav-link:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--text);
}

.school-nav-link.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.school-nav-icon {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--muted);
}

.school-nav-link.is-active .school-nav-icon {
  color: var(--accent);
}

.school-nav-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.school-nav-link .tag {
  margin-left: auto;
}

.school-nav-section {
  margin: 1rem 0.65rem 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.school-layout > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .school-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
  }

  .school-nav {
    position: static;
    padding: 0.5rem;
  }

  .school-nav-head,
  .school-nav-section,
  .school-nav-classes {
    display: none;
  }

  .school-nav-list {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
  }

  .school-nav-link {
    white-space: nowrap;
  }
}

/* Checkmark list (homepage, course objectives). */
.list-check { list-style: none; padding: 0; margin: 0; }
.list-check li { position: relative; padding-left: 1.6em; margin-bottom: 0.6em; }
.list-check li::before {
    content: "✓";
    position: absolute; left: 0; top: 0;
    color: var(--accent);
    font-weight: 700;
}

.feed li.is-locked {
  opacity: 0.65;
}

/* Author-set display rules (e.g. Bulma's .textarea) must not defeat the
   `hidden` attribute that scripts toggle. */
[hidden] {
  display: none !important;
}

/* Skill tag checkboxes (exercise / question editors) */
.skill-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.skill-check { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Skill mastery heatmap */
.skill-cell {
  display: inline-block;
  min-width: 3.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  background: var(--border);
  color: var(--muted);
}
.skill-cell.is-mastered { background: #d9f2e3; color: #17663a; }
.skill-cell.is-progressing { background: #fdefc9; color: #7a5200; }
.skill-cell.is-weak { background: #fbdcdc; color: #9b1c1c; }
.skill-heatmap th { white-space: normal; min-width: 5.5rem; }
.skill-heatmap tfoot th { border-top: 2px solid var(--border); }
/* With ten skills or more the table scrolls sideways: the student's name stays in view. */
.skill-heatmap th:first-child,
.skill-heatmap td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel-bg);
  min-width: 11rem;
  box-shadow: 1px 0 0 var(--border);
}

@media (max-width: 700px) {
  /* A narrow screen keeps the name only: room is for the skills. */
  .skill-heatmap th:first-child,
  .skill-heatmap td:first-child {
    min-width: 6.5rem;
    max-width: 7.5rem;
  }

  .skill-heatmap td:first-child .avatar,
  .skill-heatmap td:first-child .member-email {
    display: none;
  }
}
.skill-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; }

[data-theme="dark"] .skill-cell.is-mastered { background: #1b4a31; color: #b7ecce; }
[data-theme="dark"] .skill-cell.is-progressing { background: #5b4313; color: #f9deaa; }
[data-theme="dark"] .skill-cell.is-weak { background: #5c2222; color: #f7c4c4; }

/* Teacher feedback on exercise code */
.feedback-note {
  border-left: 3px solid var(--accent);
  background: var(--panel-bg);
  border-radius: 0 8px 8px 0;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.5rem;
}
.feedback-note.is-new { border-left-color: #f0a500; }
.feedback-note p { margin: 0 0 0.2rem; }
.feedback-meta, .feedback-line { color: var(--muted); font-size: 0.78rem; }

/* Student history view (teacher) */
.code-lines { width: 100%; border-collapse: collapse; font-family: "Cascadia Code", "Fira Code", Consolas, monospace; font-size: 0.85rem; }
.code-lines td { padding: 0.05rem 0.5rem; vertical-align: top; }
.code-lines .ln { color: var(--muted); text-align: right; width: 2.5rem; user-select: none; }
.code-lines .src { white-space: pre-wrap; word-break: break-word; }
.code-lines .cm { width: 2rem; text-align: right; }
.code-lines tr.has-note td { background: rgba(240, 165, 0, 0.12); }
.code-lines .line-note td { font-family: inherit; padding-bottom: 0.4rem; }
.line-comment-btn { background: none; border: 0; cursor: pointer; color: var(--accent); padding: 0 0.25rem; opacity: 0.55; font-size: 0.8rem; }
.code-lines tr:hover .line-comment-btn { opacity: 1; }

/* A chip picker inside a grouped filter row takes the whole row and wraps,
   instead of overflowing it (Bulma keeps grouped controls from shrinking). */
.field.is-grouped > .control.filter-themes {
  flex: 1 1 100%;
  min-width: 0;
  flex-shrink: 1;
}

.control.filter-themes .select {
  display: block;
  height: auto;
  max-width: 100%;
}

/* Icon-only buttons (exercise cards): a square small button with an inline SVG;
   the meaning lives in title/aria-label. */
.button.icon-btn {
  width: 2.25em;
  padding-inline: 0;
  justify-content: center;
}

.button.icon-btn .btn-icon {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.exercise-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.exercise-actions form {
  margin: 0;
}

.button.icon-btn.has-badge {
  position: relative;
  overflow: visible;
}

.icon-badge {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

/* Two date inputs side by side must be allowed to shrink on narrow screens. */
.assign-dates > .column {
  min-width: 0;
}

.assign-dates .input {
  min-width: 0;
  width: 100%;
}

/* Reference pages: each heading carries a link to itself, shown on hover or keyboard focus. */
.content .headerlink {
  margin-left: 0.4rem;
  color: var(--code-muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.content :is(h1, h2, h3, h4, h5, h6):hover > .headerlink,
.content .headerlink:focus-visible {
  opacity: 1;
}

@media (pointer: coarse) {
  .content .headerlink {
    opacity: 0.5;
  }
}

.content :is(h1, h2, h3, h4, h5, h6)[id] {
  scroll-margin-top: 1rem;
}

/* A shared snippet with numbered lines: a click on a number links to that line. */
.code-lines {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0;
  overflow-x: auto;
}

.code-line {
  display: flex;
  scroll-margin-top: 4rem;
}

.code-line .line-no {
  flex: 0 0 3.2rem;
  padding-right: 0.8rem;
  text-align: right;
  color: var(--muted);
  opacity: 0.75;
  text-decoration: none;
  user-select: none;
}

.code-line .line-no:hover,
.code-line .line-no:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

.code-line .line-text {
  white-space: pre;
  flex: 1 0 auto;
  padding-right: 1rem;
}

.code-line.is-linked {
  background: rgba(255, 196, 0, 0.18);
  box-shadow: inset 3px 0 0 #e0a400;
}

.line-links-bar {
  margin-bottom: 0.5rem;
}

.line-links-help {
  margin: 0.4rem 0 1rem;
}

/* Moderating a challenge solution: approve and reject icons on one row; the
   reject comment form folds out below them. */
.moderation-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.4rem; }
.moderation-actions .inline-form { margin: 0; }
.reject-box { display: block; }
.reject-box > summary { list-style: none; cursor: pointer; }
.reject-box > summary, .reject-box button { box-sizing: border-box; }
.reject-box > summary::-webkit-details-marker { display: none; }
.reject-box[open] { flex-basis: 100%; }
.reject-box form { margin-top: 0.5rem; max-width: 32rem; }
.rejection-comment { margin: 0.5rem 0; }

/* Like button: heart icon + count; the heart fills once liked. */
.like-button { gap: 0.4rem; }
.like-button .btn-icon { width: 1.1em; height: 1.1em; }
.like-button.liked .btn-icon { fill: currentColor; }

/* The teacher's picker of activities on an assignment (assignments/_picker.html). */
.picker {
  margin-top: 1.5rem;
  scroll-margin-top: 1rem;
}

.picker-create .field {
  margin-bottom: 0.25rem;
}

.picker-create-lesson {
  margin-bottom: 0;
}

.picker-create .button span + span,
.picker-create .button .icon + span {
  margin-left: 0.35rem;
}

.picker-row {
  margin-bottom: 0.75rem;
}

.picker-details {
  margin-top: 0.5rem;
}

.picker-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
}

.picker-details > .content {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.picker-prompt {
  max-height: 22rem;
  overflow-y: auto;
}

.picker-row .level-left {
  flex: 1 1 auto;
  min-width: 0;
}

.picker-row .level-left > div {
  min-width: 0;
}

.picker-row p {
  overflow-wrap: anywhere;
}

.picker-row .level-right {
  flex: none;
  margin-left: 0.5rem;
  margin-top: 0;
}

.picker-details > .content .label {
  margin-top: 0.75rem;
}

@media (max-width: 600px) {
  .picker-create-lesson {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .picker-create-lesson > .control:first-child {
    flex: 1 0 100%;
  }

  .picker-create-lesson .select,
  .picker-create-lesson select {
    width: 100%;
  }
}

/* Free accounts: the banner under the navigation and the field only robots fill in (accounts/signup.html). */
.free-banner {
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}

.free-banner .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  justify-content: space-between;
  padding: 0 1.5rem;
}

/* Self-registration: a split screen, the presentation on the left and the form on the right (accounts/signup.html). */
.signup-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.site-main.signup-page {
  animation: none;
}

.signup-split {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

.signup-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3rem 3rem 3rem 1.5rem;
  color: #ffffff;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.14), transparent 38%),
    radial-gradient(circle at 92% 92%, rgba(255, 255, 255, 0.1), transparent 42%),
    linear-gradient(150deg, #0b2a7a 0%, #1034a6 48%, #0050dc 100%);
  overflow: hidden;
}

.signup-brand-inner {
  width: 100%;
  max-width: 30rem;
}

.signup-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.95;
}

.signup-brand-title {
  margin: 0 0 0.75rem;
  color: #ffffff;
  font-size: clamp(1.7rem, 2.6vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
}

.signup-lead {
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
  line-height: 1.55;
}

.signup-benefits {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.signup-benefits li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.95rem;
  line-height: 1.45;
}

.signup-benefits strong {
  display: block;
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 0.1rem;
}

.signup-benefit-icon {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.signup-benefit-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.signup-fineprint {
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
}

.signup-formside {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 1.5rem 3rem 3rem;
  background: var(--bg);
}

.signup-card {
  width: 100%;
  max-width: 30rem;
}

.signup-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 800;
}

.signup-sub {
  margin-bottom: 1.5rem;
  color: var(--muted);
}

.signup-errors {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--danger);
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(209, 69, 59, 0.1);
  font-size: 0.9rem;
}

.signup-errors:focus {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.signup-errors ul {
  margin: 0.4rem 0 0 1.1rem;
  list-style: disc;
}

.signup-errors a {
  color: inherit;
  text-decoration: underline;
}

.signup-group {
  border: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  min-width: 0;
}

.signup-group legend {
  margin-bottom: 0.6rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signup-group .field:not(:last-child) {
  margin-bottom: 1rem;
}

.signup-optional {
  color: var(--muted);
  font-weight: 400;
}

.signup-group .input {
  height: 2.75rem;
}

.signup-group .input[aria-invalid="true"] {
  border-color: var(--danger);
}

.signup-password {
  position: relative;
}

.signup-password .input {
  padding-right: 5.5rem;
}

.signup-reveal {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  padding: 0.25rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.signup-reveal:hover {
  background: rgba(91, 143, 248, 0.14);
}

.signup-reveal:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.signup-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.signup-rules li::before {
  content: "○";
  margin-right: 0.35rem;
}

.signup-rules li.is-met {
  color: #2e9e5b;
}

.signup-rules li.is-met::before {
  content: "✓";
}

.signup-formside .help.is-match {
  color: #2e9e5b;
}

.signup-formside .help.is-mismatch {
  color: var(--danger);
}

.signup-consents .field {
  margin-bottom: 0.9rem;
}

.signup-consents .checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  line-height: 1.4;
}

.signup-consents .checkbox input {
  margin-top: 0.25rem;
  flex: none;
}

.signup-consents .help {
  margin-left: 1.5rem;
}

.signup-submit {
  margin-top: 0.5rem;
  font-weight: 700;
}

.signup-switch {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 899px) {
  .signup-split {
    grid-template-columns: minmax(0, 1fr);
  }

  /* on a phone only the form is shown: the presentation is for screens wide enough to hold both */
  .signup-brand {
    display: none;
  }

  .signup-formside {
    padding: 2rem 1.25rem;
    justify-content: center;
  }
}

/* Login and confirmation pages share the registration's split screen (accounts/_split.html). */
.signup-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.signup-forgot {
  font-size: 0.85rem;
}

.signup-status-icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: rgba(80, 143, 248, 0.16);
  color: var(--accent);
}

.signup-status-icon.is-warning {
  background: rgba(240, 180, 40, 0.18);
  color: #d99a0b;
}

.signup-status-icon.is-success {
  background: rgba(46, 158, 91, 0.18);
  color: #2e9e5b;
}

.signup-status-icon.is-danger {
  background: rgba(209, 69, 59, 0.16);
  color: var(--danger);
}

.signup-status-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.signup-steps {
  margin: 0 0 0.75rem 1.2rem;
  padding: 0;
  list-style: decimal;
  line-height: 1.7;
}

.signup-aside {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.signup-aside-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
}

.signup-resend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.signup-resend .input {
  flex: 1 1 14rem;
  min-width: 0;
}

/* Profile page (accounts/profile.html): the left panel summarises the account instead of selling it. */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 800;
}

.profile-name {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
}

.profile-email {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.profile-facts {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}

.profile-facts dt {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-facts dd {
  margin: 0.1rem 0 0;
  color: #ffffff;
}

.profile-usage {
  padding: 1rem 1.1rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-usage-title {
  margin-bottom: 0.6rem;
  color: #ffffff;
  font-weight: 700;
}

.profile-usage-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
}

.profile-meter {
  height: 0.45rem;
  margin: 0.3rem 0 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.profile-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #ffffff;
}

.profile-upgrade {
  width: 100%;
  margin-top: 0.25rem;
}

.signup-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-link-button {
  margin-top: 0.6rem;
}

@media (max-width: 480px) {
  .signup-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

/* Upgrade page (accounts/upgrade.html). */
.upgrade-plan,
.upgrade-pending {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-bg);
}

.upgrade-plan-title {
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.upgrade-plan ul,
.upgrade-inline-benefits ul {
  margin: 0 0 0 1.1rem;
  list-style: disc;
  font-size: 0.92rem;
  line-height: 1.6;
}

.upgrade-pending {
  border-left: 4px solid var(--accent);
}

/* the school's benefits are in the presentation panel; on a phone, where it is hidden, a short list stands in for it */
.upgrade-inline-benefits {
  display: none;
  margin-bottom: 1.25rem;
}

@media (max-width: 899px) {
  .upgrade-inline-benefits {
    display: block;
  }
}

/* ---------------------------------------------------------------------
   Touch targets, text size and headings (audit of the interface against
   Apple's design rules). Controls are 44px high where fingers are used,
   buttons and hints are no smaller than 14px/13px, and large titles are
   set tighter than text.
   --------------------------------------------------------------------- */
.button {
  font-size: 0.875rem;
}

.help {
  font-size: 0.8125rem;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

/* the main button of a form is the loudest control of the page: not a small one */
.button.signup-submit {
  min-height: 2.75rem;
  font-size: 1rem;
}

.signup-reveal {
  min-height: 2rem;
  min-width: 4.5rem;
  padding: 0.4rem 0.75rem;
}

/* Titles: the bigger the type, the tighter the letters and the lines. Text keeps its normal spacing. */
.title.is-1, .title.is-2, .title.is-3, h1.title, .signup-title, .signup-brand-title {
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.title.is-4, .title.is-5, h2.title {
  letter-spacing: -0.01em;
  line-height: 1.25;
}

/* Bulma pulls a subtitle up under its title (-1.25rem) to make up for loose leading and a bottom margin this site does not use:
   with tight leading, that pull would make the two overlap. */
.title + .subtitle {
  margin-top: 0.75rem;
}

@media (pointer: coarse) {
  .button,
  .button.is-normal,
  .button.is-medium,
  .button.is-large,
  .navbar-item,
  .navbar-link,
  .navbar-burger,
  .select select,
  .input,
  .pagination-link,
  .pagination-previous,
  .pagination-next {
    min-height: 2.75rem;
  }

  .icon-btn {
    min-width: 2.75rem;
  }

  .signup-reveal {
    min-height: 2.75rem;
    min-width: 4.75rem;
  }

  /* checkboxes: a bigger box, and the whole line (label included) is the target */
  input[type="checkbox"],
  input[type="radio"] {
    width: 1.35rem;
    height: 1.35rem;
  }

  .checkbox,
  .radio {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 0;
  }

  /* links that sit alone on a line get room around them, not only the height of the text */
  .footer a,
  .signup-switch a,
  .signup-forgot,
  .dash-card-meta a,
  .help a {
    display: inline-block;
    padding: 0.7rem 0.3rem;
    margin: -0.7rem -0.3rem;
  }
}

/* ---------------------------------------------------------------------
   Navigation as a translucent layer: it stays at the top and the page
   scrolls under it, blurred. Where transparency is not wanted or not
   available it is a plain opaque bar again.
   --------------------------------------------------------------------- */
.navbar {
  --codefr-nav: #ffffff;
  position: sticky;
  top: 0;
  background-color: color-mix(in srgb, var(--codefr-nav) 74%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 1px 0 rgba(128, 128, 128, 0.2);
}

:root[data-theme="dark"] .navbar {
  --codefr-nav: #1e1f29;
}

/* the open menu of a phone covers content: it needs to be solid to stay readable */
.navbar-menu.is-active {
  background-color: var(--codefr-nav);
}

/* in-page links (#ajouter...) must not land under the bar, and the sticky side menus start below it */
html {
  scroll-padding-top: 4.5rem;
}

.chapter-menu,
.school-nav {
  top: 4.5rem;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .navbar {
    background-color: var(--codefr-nav);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .navbar {
    background-color: var(--codefr-nav);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .navbar {
    background-color: var(--codefr-nav);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 1px 0 currentColor;
  }
}

/* Documentation: the two sections, their landing page and the previous/next links (documentation/). */
.doc-tabs {
  margin-bottom: 1.5rem;
}

.doc-section-card {
  height: 100%;
}

.doc-section-summary {
  margin-bottom: 1rem;
  color: var(--muted);
}

.doc-section-pages {
  margin: 0 0 1.25rem 1.25rem;
  list-style: decimal;
  columns: 1;
  line-height: 1.8;
}

.doc-index-note {
  margin-top: 1.5rem;
  color: var(--muted);
}

.doc-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.doc-pager-link {
  display: flex;
  flex-direction: column;
  min-height: 2.75rem;
  max-width: 48%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
  font-weight: 600;
}

.doc-pager-link span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.doc-pager-link.is-next {
  margin-left: auto;
  text-align: right;
}

/* A documentation page: the text column may shrink below its widest table or code block (it scrolls sideways instead of
   pushing the page out), and the menu keeps a steady width whatever the longest title. */
.doc-content {
  min-width: 0;
}

.doc-content .content {
  overflow-x: auto;
}

.doc-content .content table {
  width: 100%;
}

.doc-sidebar .menu-list a {
  line-height: 1.35;
}

/* An example of the documentation with its "Essayer" button, which opens the program in the editor. */
.doc-code {
  margin: 1rem 0;
}

.doc-code-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}

.doc-code .code-preview {
  margin: 0;
}

.doc-try {
  font-size: 0.875rem;
}

/* Searching the documentation: the box beside the section tabs, and the results page. */
.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.doc-toolbar .doc-tabs {
  flex: 1 1 18rem;
  margin-bottom: 0;
}

.doc-search {
  display: flex;
  gap: 0.35rem;
  flex: 0 1 22rem;
  min-width: 0;
}

.doc-search .input {
  min-width: 0;
}

.doc-toolbar .doc-search {
  margin-bottom: 0.35rem;
}

.container > .doc-search {
  max-width: 32rem;
  margin: 0 0 1.5rem;
}

.doc-search-page .doc-search {
  flex: none;
}

.doc-search-count {
  margin-bottom: 1rem;
  color: var(--muted);
}

.doc-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-result + .doc-result {
  margin-top: 0.6rem;
}

.doc-result-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.doc-result-where {
  color: var(--muted);
  font-size: 0.8125rem;
}

.doc-result-title {
  font-weight: 600;
}

.doc-result-excerpt {
  color: var(--text);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.doc-result-excerpt mark {
  background: rgba(255, 213, 79, 0.45);
  color: inherit;
  border-radius: 2px;
}

/* Homework put away: the folded list under the current ones, and the note on its page. */
.archived-assignments {
  margin-top: 1.5rem;
}

.archived-assignments summary {
  cursor: pointer;
  color: var(--muted);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.archived-assignments .content {
  margin-top: 0.5rem;
}

.archived-note {
  margin-top: 0.75rem;
}

/* A challenge's star button and its figures (challenges/_stats.html): the star fills once given. */
.challenge-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0;
}

.challenge-stats .inline-form {
  margin: 0;
}

.star-button {
  gap: 0.4rem;
}

.star-button .btn-icon {
  width: 1.1em;
  height: 1.1em;
}

.star-button.is-starred {
  color: var(--star, #b7791f);
}

.star-button.is-starred .btn-icon {
  fill: currentColor;
}

.challenge-figure {
  color: var(--muted);
  font-size: 0.9rem;
}

/* A drawing shown as a picture: under an example of the documentation, and as the model of a drawing challenge. */
.doc-drawing {
  margin: 0 0 1.25rem;
  text-align: center;
}

.doc-drawing figcaption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.drawing-preview {
  max-width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Level and experience (gamification/_level.html), shown on the course list and the challenge list; the profile has its own meter. */
.level-card {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-bg);
}

.level-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.level-badge {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.8125rem;
}

.level-bar {
  display: block;
  width: 100%;
  height: 0.6rem;
  margin: 0 0 0.4rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}

.level-bar::-webkit-progress-bar {
  background: var(--border);
}

.level-bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.level-bar::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

.level-xp {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.profile-level {
  margin-bottom: 1.1rem;
}

.profile-xp {
  height: 0.45rem;
  margin: 0.3rem 0 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.profile-xp span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #ffffff;
}

/* The challenge of the day, at the top of the list of challenges. */
.daily-card {
  border-left: 4px solid #f0a500;
}

.daily-kicker {
  margin-bottom: 0.4rem;
}

.daily-card .title {
  margin-bottom: 0.4rem;
}

.daily-go {
  margin-top: 0.75rem;
}

.daily-card.is-done {
  border-left-color: #43a047;
}

/* "Prochain pas" / "Reprendre": the step that follows (learning/_next_step.html). */
.next-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--panel-bg);
}

.next-step-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.next-step-title {
  margin: 0.15rem 0;
  font-weight: 600;
}

.next-step-why {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.next-step.is-challenge {
  border-left-color: #f0a500;
}

.next-step-go {
  flex: 0 0 auto;
}

/* The list of chapters beside a lesson folds into one line on a phone (learning/_sidebar.html, chapter-menu.js). */
.chapter-menu-summary {
  display: none;
}

@media (max-width: 768px) {
  .chapter-menu {
    position: static;
  }

  .chapter-menu-title {
    margin-bottom: 0.4rem;
  }

  .chapter-menu-summary {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    background: var(--bg);
    cursor: pointer;
    font-weight: 600;
    list-style: none;
  }

  .chapter-menu-summary::-webkit-details-marker {
    display: none;
  }

  .chapter-menu-summary::after {
    content: "▾";
    margin-left: auto;
    padding-left: 0.5rem;
    color: var(--muted);
  }

  .chapter-menu-toggle[open] .chapter-menu-summary::after {
    content: "▴";
  }

  .chapter-menu-toggle[open] .chapter-list {
    margin-top: 0.6rem;
  }
}

/* The exercises of a chapter: where the student stands, and the statements of the ones already passed folded away. */
.exercise-overview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.exercise-overview .level-bar {
  flex: 1 1 12rem;
  margin: 0;
}

.exercise-overview-done {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.exercise-statement > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.exercise-statement[open] > summary {
  margin-bottom: 0.5rem;
}

.comment[id^="exercise-"] {
  scroll-margin-top: 5rem;
}

/* The bottom of a chapter: the neighbouring chapters, the next one shown closed with what it still takes. */
.lesson-pager {
  margin-top: 2rem;
}

.doc-pager-link.is-disabled {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .lesson-pager {
    flex-direction: column;
  }

  .lesson-pager .doc-pager-link {
    max-width: none;
  }

  .lesson-pager .doc-pager-link.is-next {
    margin-left: 0;
    text-align: left;
  }
}

/* The table of contents of a chapter, under the list of chapters (learning/_sidebar.html, lesson-toc.js). */
.lesson-toc {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.lesson-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-toc-item a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-left: 2px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

.lesson-toc-item a:hover {
  color: var(--text);
}

.lesson-toc-item a.is-current {
  border-left-color: var(--accent);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.lesson-toc-item.depth-1 a {
  padding-left: 1.25rem;
}

.lesson-toc-item.depth-2 a {
  padding-left: 2rem;
}

/* beside the text, the menu keeps to the height of the window and scrolls by itself when it is longer */
@media (min-width: 769px) {
  .chapter-menu {
    max-height: calc(100vh - 5.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 768px) {
  .lesson-toc {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }

  .lesson-toc-title {
    display: none;
  }
}

@media (pointer: coarse) {
  .lesson-toc-item a {
    padding-block: 0.65rem;
  }
}

/* The number of a challenge (its id): small and grey beside the title, to tell challenges apart and to quote them. */
.challenge-number {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

h1 .challenge-number,
h2 .challenge-number {
  font-size: 0.875rem;
}

/* The notice shown while the site is used without a connection (static/offline.js). */
.offline-banner {
  background: #fff3cd;
  color: #5c4400;
  padding: 0.5rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.offline-banner a { color: inherit; text-decoration: underline; }
:root[data-theme="dark"] .offline-banner { background: #3d3200; color: #ffe9a6; }

/* What the server answered for a submission made without a connection, until it has been seen (static/offline.js). */
.offline-results {
  background: #e8f3ff;
  color: #0b2a4a;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
}

.offline-result { margin: 0.25rem 0; }
.offline-result pre { white-space: pre-wrap; background: transparent; padding: 0.25rem 0; }
.offline-result.is-pass { color: #0b5d2b; }
.offline-result.is-fail { color: #8a2a00; }
.offline-result.is-refused { color: #7a5b00; }
.offline-results a { color: inherit; text-decoration: underline; }
:root[data-theme="dark"] .offline-results { background: #12304d; color: #d6e9ff; }
:root[data-theme="dark"] .offline-result.is-pass { color: #7ee2a0; }
:root[data-theme="dark"] .offline-result.is-fail { color: #ffb38a; }
:root[data-theme="dark"] .offline-result.is-refused { color: #ffe08a; }
