/* ═══════════════════════════════════════════════════════════════════
   ExamFlow code.css — Code Academy (code.js) and certificates (cert.js,
   verify.html). Loads after components.css; uses its tokens and layers.
   Code surfaces (editor, output, terminal) are dark in both themes, like
   .code-block. The certificate is printed paper: fixed light colours.
═══════════════════════════════════════════════════════════════════ */
@layer components {
  /* ═══ Learn home: Code Academy ══════════════════════════════════ */
  .code-home { margin-top: var(--sp-6); }
  .course-card__code[data-group="code"] { background: var(--xp-bg); color: var(--xp-text); gap: 2px; font-size: var(--fs-caption); }
  .course-card__code[data-group="code"] svg { width: 22px; height: 22px; }
  .course-logo { display: block; width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .12)); }
  .code-hero__badge { position: relative; display: inline-grid; flex: none; }
  .course-logo--lg { position: absolute; right: -6px; bottom: -6px; width: 38px; height: 38px; padding: 5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); filter: none; z-index: 1; }
  .course-card__code[data-course="html"] { background: var(--brand-soft); color: var(--primary-text); }
  .course-card__code[data-course="css"] { background: var(--info-bg); color: var(--info-text); }
  .course-card__code[data-course="javascript"] { background: var(--warning-bg); color: var(--warning-text); }
  .course-card__code[data-course="java"] { background: var(--danger-bg); color: var(--danger-text); }
  .course-card__code[data-course="c"] { background: var(--sunken); color: var(--text-2); }
  .course-card__code[data-course="git"] { background: var(--success-bg); color: var(--success-text); }
  .course-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
  .code-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
  .code-flame, .code-stat {
    display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap-min); padding: 6px 14px 6px 10px;
    border: 2px solid var(--border); border-radius: var(--r-full); background: var(--surface); font-size: var(--fs-label); color: var(--text-1);
  }
  .code-flame > span, .code-stat > span { display: grid; line-height: 1.2; }
  .code-flame small, .code-stat small { font-size: var(--fs-caption); color: var(--text-2); }
  .code-flame svg, .code-stat svg { width: 22px; height: 22px; flex-shrink: 0; }
  .code-flame svg { color: var(--text-disabled); }
  .code-flame[data-on="warm"] svg { color: var(--warning); }
  .code-flame[data-on="today"] { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--brand-soft); }
  .code-flame[data-on="today"] svg { color: var(--brand); animation: code-flicker 2.4s var(--ease-standard) infinite alternate; transform-origin: 50% 90%; }
  .code-stat svg { color: var(--xp-text); }
  .code-strip__keys { margin-left: auto; min-height: var(--tap-min); }
  @keyframes code-flicker { from { transform: scale(1); } to { transform: scale(1.08) rotate(-3deg); } }

  /* Bug of the day */
  .bod { display: grid; gap: var(--sp-3); margin-top: var(--sp-2); }
  .bod__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
  .bod__eyebrow { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; font: 800 var(--fs-h3) var(--font-display); }
  .bod__eyebrow > svg { color: var(--danger-text); width: 22px; height: 22px; }
  .bod__head .link-btn { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap-min); }
  .bod .cblock { padding: 0; border: 0; }

  /* ═══ Course page ═════════════════════════════════════════════════ */
  .code-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); }
  .code-hero__text { flex: 1 1 280px; display: grid; gap: var(--sp-3); min-width: 0; }
  .code-hero__desc { margin: 0; color: var(--text-2); font-size: var(--fs-body); }
  .code-hero__stats { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin: 0; }
  .code-hero__stats div { display: grid; }
  .code-hero__stats dt { font-size: var(--fs-caption); font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
  .code-hero__stats dd { margin: 0; font: 800 var(--fs-h2)/1.1 var(--font-display); }
  .code-hero__stats small { font-size: var(--fs-label); color: var(--text-2); font-weight: 700; }
  .code-hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
  .code-hero__actions .btn { text-decoration: none; }
  @media (max-width: 599px) { .code-hero { justify-content: center; } .code-hero__actions .btn { flex: 1 1 100%; } }
  .code-ring { position: relative; display: inline-grid; place-items: center; width: 56px; height: 56px; flex-shrink: 0; color: var(--brand); }
  .code-ring--lg { width: 112px; height: 112px; }
  .code-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
  .code-ring circle { fill: none; stroke-width: 3.2; }
  .code-ring__track { stroke: var(--border); }
  .code-ring__value { stroke: currentColor; stroke-linecap: round; transition: stroke-dasharray var(--dur-celebrate) var(--ease-standard); }
  .code-ring__label { font: 800 var(--fs-h3) var(--font-display); color: var(--text-1); }
  .code-ring--lg .code-ring__label { font-size: var(--fs-h1); }
  .code-ring__label small { font-size: .55em; }
  .code-mini { width: 56px; height: 6px; color: var(--success); flex-shrink: 0; }
  .code-final { display: flex; gap: var(--sp-4); align-items: flex-start; }
  .code-final__icon { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: var(--r-full); background: var(--xp-bg); color: var(--xp-text); }
  .code-final[data-kind="locked"] .code-final__icon { background: var(--sunken); color: var(--text-2); }
  .code-final[data-kind="passed"] .code-final__icon { background: var(--success-bg); color: var(--success-text); }
  .code-final__text { flex: 1; display: grid; gap: var(--sp-3); justify-items: start; min-width: 0; }
  .code-final__text .meter { color: var(--brand); }
  .code-final__lead { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--text-2); }
  .code-final .btn, .code-exam .btn { text-decoration: none; }
  .code-runself { display: grid; gap: var(--sp-3); }
  .code-exam { display: grid; gap: var(--sp-4); }
  .code-rules li svg { color: var(--primary-text); }
  .code-exam__action { display: grid; gap: var(--sp-3); justify-items: start; }
  .code-attempts .row__end { display: inline-flex; align-items: center; gap: var(--sp-2); }

  /* ═══ Chapter ════════════════════════════════════════════════════ */
  .code-ch { display: grid; gap: var(--stack-gap); min-width: 0; }
  .code-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); padding-block: var(--sp-3); }
  .code-top__row { display: grid; gap: 6px; flex: 1 1 220px; font-size: var(--fs-label); color: var(--text-2); }
  .code-top__row > span { display: inline-flex; align-items: center; gap: 6px; }
  .code-top__row .meter { color: var(--success); height: 6px; }
  .code-top__keys { min-height: var(--tap-min); display: inline-flex; align-items: center; gap: 4px; }
  .cblock {
    position: relative; display: grid; gap: var(--sp-4); min-width: 0; padding: var(--sp-5) var(--card-pad) var(--sp-6);
    background: var(--surface); border: 2px solid var(--border); border-radius: var(--r-lg);
  }
  .cblock > * { min-width: 0; }
  @media (min-width: 900px) { .cblock { padding: var(--sp-6) var(--sp-8) var(--sp-8); } }
  .cblock--lesson > .cblock__md, .cblock__md { max-width: 68ch; }
  .cblock--challenge { border-color: color-mix(in srgb, var(--xp) 30%, var(--border)); }
  .cblock--challenge[data-state="passed"] { border-color: color-mix(in srgb, var(--success) 55%, var(--border)); }
  .cblock--play { border-color: var(--border); }
  .cblock__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .cblock__kind { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font: 700 var(--fs-caption) var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--xp-text); }
  .cblock__kind svg { width: 18px; height: 18px; }
  .cblock__title { margin: 0; font: 800 var(--fs-h2)/var(--lh-h2) var(--font-display); }
  .cblock__subtitle { margin: 0 0 var(--sp-2); font: 700 var(--fs-body) var(--font-body); color: var(--text-1); padding: 0; }
  .cblock__subtitle:focus { outline: none; }
  .cblock__md { font-size: var(--fs-body-lg); line-height: 1.6; }
  .cblock__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0; }
  @media (max-width: 599px) { .cblock__actions > .btn:not([data-size="sm"]) { flex: 1 1 0; } }
  .cblock__fb:empty, .cblock__help:empty { display: none; }
  .cblock__fb .notice p { margin: 0; }
  .cblock__fb .notice .md { margin-top: 4px; }
  .cblock__help { display: grid; gap: var(--sp-3); }
  .cblock__helpbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .cblock__helpbar:empty { display: none; }
  .cblock__hints { margin: 0; padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 1.2em); border-radius: var(--r-md); background: var(--warning-bg); color: var(--text-1); display: grid; gap: var(--sp-2); }
  .cblock__hints li::marker { color: var(--warning-text); font-weight: 800; }
  .cblock__hints li:focus { outline: none; }
  .cblock__sol { display: grid; gap: var(--sp-3); justify-items: start; }
  .cblock__sol .code-block { width: 100%; margin: 0; }
  /* Pass: the status badge pops and "+XP" floats up once (no confetti; nothing under reduced motion). */
  .cblock__float { position: absolute; right: var(--sp-5); top: var(--sp-4); pointer-events: none; opacity: 0; font: 800 var(--fs-h3) var(--font-display); color: var(--xp-text); }
  .cblock.is-celebrating .cblock__float { animation: code-float 1.2s var(--ease-standard) forwards; }
  .cblock.is-celebrating .cblock__status .badge { animation: code-pop var(--dur-slow) var(--ease-celebrate); }
  .cblock.is-celebrating { animation: code-glow 1.2s var(--ease-standard); }
  @keyframes code-float { 0% { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-28px); } }
  @keyframes code-pop { from { transform: scale(.6); } to { transform: scale(1); } }
  @keyframes code-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
  @media (prefers-reduced-motion: reduce) { .cblock.is-celebrating, .cblock.is-celebrating .cblock__float, .cblock.is-celebrating .cblock__status .badge, .code-flame svg { animation: none !important; } }

  /* Syntax colours (on --code-bg, both themes) */
  .tk-kw { color: #FF9F5C; }
  .tk-str, .tk-str2 { color: #A5E075; }
  .tk-num { color: #F8C555; }
  .tk-com { color: #A8978A; font-style: italic; }
  .tk-fn { color: #7FD1FF; }
  .tk-type { color: #E7A6FF; }
  .tk-tag { color: #FF8F80; }
  .tk-attr { color: #F8C555; }
  .tk-punc { color: #CDBCAC; }

  /* ═══ Editor ═════════════════════════════════════════════════════ */
  .ced { --ced-fs: 14px; --ced-lh: 1.6; min-width: 0; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); color: var(--code-fg); border: 2px solid #4A3D32; }
  .ced:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
  @media (max-width: 640px) { .ced { --ced-fs: 16px; } }
  .ced__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 40px; padding: 0 14px; border-bottom: 1px solid #4A3D32; font: 700 var(--fs-caption) var(--font-body); letter-spacing: .04em; color: #CDBCAC; }
  .ced__file { display: inline-flex; align-items: center; gap: 6px; text-transform: none; font-family: var(--font-code); letter-spacing: 0; }
  .ced__lang { text-transform: uppercase; }
  .ced__tools { display: inline-flex; align-items: center; gap: var(--sp-2); }
  .ced__wrap { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap-min); padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; color: #CDBCAC; font: 700 var(--fs-caption) var(--font-body); cursor: pointer; }
  .ced__wrap:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .ced__wrap[aria-pressed="true"] { color: #FF9F5C; }
  .ced__wrap:focus-visible { outline: 3px solid #FF9F5C; outline-offset: -3px; }
  /* Long lines scroll sideways inside the editor (never the page); Wrap soft-wraps them instead. */
  .ced[data-wrap="on"] .ced__hl, .ced[data-wrap="on"] .ced__ta { white-space: pre-wrap; overflow-wrap: anywhere; }
  .ced[data-wrap="on"] .ced__ta { overflow-x: hidden; }
  .ced[data-wrap="on"] .ced__gutter { display: none; }
  .ced__body { display: flex; min-width: 0; }
  .ced__gutter { flex: 0 0 auto; overflow: hidden; padding: 12px 0; background: rgba(255, 255, 255, .03); border-right: 1px solid #3A2F26; user-select: none; }
  .ced__nums { margin: 0; padding: 0 10px 0 12px; text-align: right; color: #A8978A; font: 400 var(--ced-fs)/var(--ced-lh) var(--font-code); min-width: 2.6em; }
  .ced__errn { display: inline-block; min-width: 100%; margin-right: -10px; padding-right: 10px; background: rgba(255, 122, 112, .22); color: #FFB4AB; font-weight: 700; }
  .ced__area { position: relative; flex: 1 1 auto; min-width: 0; }
  .ced__hl, .ced__ta {
    margin: 0; padding: 12px 14px; border: 0; border-radius: 0; font: 400 var(--ced-fs)/var(--ced-lh) var(--font-code);
    white-space: pre; tab-size: 4; letter-spacing: 0; word-spacing: 0; font-variant-ligatures: none;
  }
  .ced__hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--code-fg); }
  .ced__hl code { font: inherit; }
  .ced__ta { position: relative; display: block; width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; resize: none; overflow: auto; background: transparent; color: transparent; caret-color: #FFE2CC; -webkit-text-fill-color: transparent; outline: none; }
  .ced__ta:focus, .ced__ta:focus-visible { outline: none; box-shadow: none; }
  .ced__ta::selection { background: rgba(255, 159, 92, .35); }
  .ced__keys { display: none; gap: 6px; overflow-x: auto; padding: 6px; border-top: 1px solid #4A3D32; scrollbar-width: none; }
  @media (pointer: coarse) { .ced__keys { display: flex; } }
  .ced__key { flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 0 10px; border: 1px solid #5A4A3D; border-radius: var(--r-sm); background: #3A2F26; color: #F7EFE8; font: 700 16px var(--font-code); cursor: pointer; touch-action: manipulation; }
  .ced__key:active { background: #5A4A3D; }

  .cstdin { border: 2px solid var(--border); border-radius: var(--r-md); padding: 0 var(--sp-3); margin-bottom: var(--sp-3); }
  .cstdin > summary { min-height: var(--tap-min); display: flex; align-items: center; cursor: pointer; font-weight: 700; font-size: var(--fs-label); color: var(--text-2); }
  .cstdin[open] { padding-bottom: var(--sp-3); }
  .cstdin__ta { min-height: 72px; }

  /* Output */
  .cout { display: grid; min-width: 0; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); color: var(--code-fg); border: 2px solid #4A3D32; }
  .cout__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 40px; padding: 0 14px; border-bottom: 1px solid #4A3D32; font: 700 var(--fs-caption) var(--font-body); color: #CDBCAC; letter-spacing: .04em; text-transform: uppercase; }
  .cout__title { display: inline-flex; align-items: center; gap: 6px; }
  .cout__title svg { width: 16px; height: 16px; }
  .cout__ms { font-family: var(--font-code); text-transform: none; }
  .cout__log { margin: 0; padding: 12px 14px; max-height: 280px; overflow: auto; font: 400 var(--fs-label)/1.55 var(--font-code); white-space: pre-wrap; overflow-wrap: anywhere; }
  .cout__log:focus-visible { outline: 3px solid #FF9F5C; outline-offset: -3px; }
  .cout__err { color: #FF8F80; }
  .cout__note { color: #A8978A; }
  .cout__frame { display: block; width: 100%; height: 260px; border: 0; background: #fff; }
  .cout__frame + .cout__log { border-top: 1px solid #4A3D32; max-height: 140px; }
  .cout__tests { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-3); display: grid; gap: var(--sp-2); border-top: 1px solid #4A3D32; }
  .ctest { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--sp-2); align-items: start; font-size: var(--fs-label); }
  .ctest svg { width: 20px; height: 20px; color: #A5E075; }
  .ctest[data-ok="false"] svg { color: #FF8F80; }
  .ctest__name { margin: 0; font-weight: 700; }
  .ctest__detail { margin: 2px 0 0; color: #CDBCAC; overflow-wrap: anywhere; }
  .ctest__detail .md-code, .cout .md-code { background: rgba(255, 255, 255, .1); color: #F7EFE8; }
  .ctest__in { display: block; margin-top: 2px; }
  .code-hidden-frame { position: absolute; width: 1280px; height: 800px; left: -99999px; top: 0; border: 0; visibility: hidden; pointer-events: none; }

  /* ═══ Choices (predict, fix) ═════════════════════════════════════ */
  .copts, .fixlines { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--sp-2); }
  .copt { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: var(--sp-3); min-height: 52px; padding: 8px 14px; border: 2px solid var(--border-2); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
  .copt input, .fixline input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .copt__key { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 2px solid var(--border-strong); font: 800 var(--fs-label) var(--font-display); color: var(--text-2); }
  .copt__text { font: 400 var(--fs-label)/1.5 var(--font-code); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-1); }
  @media (hover: hover) { .copt:hover, .fixline:hover { border-color: var(--primary); } }
  .copt:has(input:checked) { border-color: var(--primary); background: var(--brand-soft); }
  .copt:has(input:checked) .copt__key { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
  .copt:has(input:focus-visible), .fixline:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
  .copt[data-mark="right"], .fixline[data-mark="right"] { border-color: var(--success-text); background: var(--success-bg); }
  .copt[data-mark="wrong"], .fixline[data-mark="wrong"] { border-color: var(--danger-text); background: var(--danger-bg); }
  .fixlines__code { display: grid; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); padding: 6px 0; }
  .fixline { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; min-height: 44px; border: 2px solid transparent; cursor: pointer; }
  .fixline__n { text-align: right; padding-right: 10px; color: #A8978A; font: 400 var(--fs-label) var(--font-code); }
  /* Long lines wrap (keeping indentation) instead of scrolling: a sideways-scrolling line inside a
     radio label can't be reached by keyboard. */
  .fixline__code { font: 400 var(--fs-label)/1.5 var(--font-code); color: var(--code-fg); white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; padding-right: 12px; }
  .fixline:has(input:checked) { background: rgba(255, 159, 92, .18); border-color: #FF9F5C; }
  .fixline[data-mark="right"] { background: rgba(125, 220, 58, .16); border-color: #7DDC3A; }
  .fixline[data-mark="wrong"] { background: rgba(255, 122, 112, .16); border-color: #FF7A70; }
  .fixline[data-mark] .fixline__code { color: var(--code-fg); }

  /* Fill */
  .fill { margin: 0; }
  .fill__pre { white-space: pre-wrap; line-height: 2.2; }
  .fill__in {
    display: inline-block; min-width: 4ch; max-width: 100%; height: 32px; margin: 0 2px; padding: 0 6px; vertical-align: baseline;
    border: 2px solid #FF9F5C !important; border-radius: var(--r-xs); background: #3A2F26 !important; color: #FFF !important; font: 400 var(--fs-label) var(--font-code);
  }
  .fill__in:focus-visible { outline: 3px solid #FFE2CC; outline-offset: 1px; }
  .fill__in[data-mark="right"] { border-color: #7DDC3A !important; }
  .fill__in[data-mark="wrong"] { border-color: #FF7A70 !important; text-decoration: underline wavy #FF7A70; }

  /* Order (Parsons) */
  .order { list-style: none; margin: 0; padding: 6px; display: grid; gap: 6px; border-radius: var(--r-md); background: var(--code-bg); counter-reset: ord; }
  .order__item {
    --d: 0; position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-2);
    min-height: 48px; padding-right: 4px; border: 2px solid #4A3D32; border-radius: var(--r-sm); background: #2F251D; color: var(--code-fg);
    transition: transform var(--dur-fast) var(--ease-standard), border-color var(--dur-fast);
  }
  .order__item[data-depth="1"] { --d: 1; } .order__item[data-depth="2"] { --d: 2; } .order__item[data-depth="3"] { --d: 3; }
  .order__item[data-depth="4"] { --d: 4; } .order__item[data-depth="5"] { --d: 5; } .order__item[data-depth="6"] { --d: 6; }
  .order__code { font: 400 var(--fs-label)/1.4 var(--font-code); white-space: pre; overflow-x: auto; padding-left: calc(var(--d) * 1.25em); }
  .order__handle { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-sm); background: transparent; color: #CDBCAC; cursor: grab; touch-action: none; }
  .order__handle:focus-visible { outline: 3px solid #FF9F5C; outline-offset: -3px; }
  .order__item[data-grabbed], .order__item[data-dragging] { border-color: #FF9F5C; background: #3A2F26; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); z-index: 1; }
  .order__item[data-dragging] { cursor: grabbing; }
  .order__item[data-grabbed] .order__handle { color: #FF9F5C; }
  .order__item[data-mark="right"] { border-color: #7DDC3A; }
  .order__item[data-mark="wrong"] { border-color: #FF7A70; }
  .order__x { color: #CDBCAC; width: 44px; height: 44px; }
  .order__x:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .order__bank { display: grid; gap: var(--sp-2); }
  .order__bank-title { margin: 0; font-size: var(--fs-label); font-weight: 700; color: var(--text-2); }
  .order__banklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .order__banklist:empty::after { content: "Nothing set aside."; font-size: var(--fs-small); color: var(--text-3); }
  .order__banked { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 4px 4px 4px 12px; border: 2px dashed var(--border-2); border-radius: var(--r-sm); }
  .order__banked .order__code { color: var(--text-1); padding-left: 0; }
  .order__banked .order__code [class^="tk-"] { color: inherit; }

  /* ═══ Git terminal + graph ═══════════════════════════════════════ */
  .gwork { display: grid; gap: var(--sp-4); min-width: 0; }
  .ggoal__desc { display: flex; gap: 6px; align-items: baseline; margin: 0; }
  .gwork__grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 1100px) { .gwork__grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
  .gterm { display: grid; min-width: 0; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); color: var(--code-fg); border: 2px solid #4A3D32; }
  .gterm__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 44px; padding: 0 6px 0 14px; border-bottom: 1px solid #4A3D32; font: 700 var(--fs-caption) var(--font-body); color: #CDBCAC; text-transform: uppercase; letter-spacing: .04em; }
  .gterm__bar > span { display: inline-flex; align-items: center; gap: 6px; }
  .gterm__reset { color: #FF9F5C; text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px; }
  .gterm__screen { height: 260px; overflow: auto; padding: 12px 14px; }
  .gterm__screen:focus-visible { outline: 3px solid #FF9F5C; outline-offset: -3px; }
  .gterm__pre { margin: 0; font: 400 var(--fs-label)/1.55 var(--font-code); white-space: pre-wrap; overflow-wrap: anywhere; }
  .gterm__cmd { color: #FFE2CC; font-weight: 500; }
  .gterm__ps2 { color: #7DDC3A; }
  .gterm__line { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: 6px 6px 6px 14px; border-top: 1px solid #4A3D32; }
  .gterm__line > .btn { flex-shrink: 0; }
  .gterm__ps { flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 var(--fs-label) var(--font-code); color: #7DDC3A; }
  .gterm__in { flex: 1 1 0; width: auto; min-width: 0; height: 44px; padding: 0 8px; border: 0 !important; border-radius: var(--r-sm); background: rgba(255, 255, 255, .06) !important; color: #FFF !important; font: 400 var(--fs-label) var(--font-code); }
  .gterm__in:focus-visible { outline: 3px solid #FF9F5C; outline-offset: 0; }
  .gterm__chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px; border-top: 1px solid #4A3D32; scrollbar-width: thin; }
  .gterm__chips .chip { flex-shrink: 0; height: 44px; font-family: var(--font-code); font-size: var(--fs-small); background: #3A2F26; color: #F7EFE8; border-color: #5A4A3D; }
  .gedit { display: grid; gap: var(--sp-2); padding: var(--sp-3); border-top: 1px solid #4A3D32; background: #201913; }
  .gedit__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-label); font-weight: 700; color: #F7EFE8; }
  .gedit__ta { background: #120D0A !important; color: #F7EFE8 !important; border-color: #7A6958 !important; }
  .gedit__bar { display: flex; gap: var(--sp-2); }
  .gside { display: grid; gap: var(--sp-3); align-content: start; min-width: 0; }
  .ggraph { min-height: 96px; overflow-x: auto; padding: var(--sp-3); border: 2px solid var(--border); border-radius: var(--r-md); background: var(--sunken); }
  .ggraph__empty { display: flex; gap: 6px; align-items: center; margin: 0; }
  .ggraph__svg { display: block; overflow: visible; }
  .ggraph__edge { fill: none; stroke: var(--border-strong); stroke-width: 2.5; }
  .ggraph__node circle { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }
  .ggraph__node[data-lane="1"] circle { stroke: var(--info-text); } .ggraph__node[data-lane="2"] circle { stroke: var(--xp-text); }
  .ggraph__node[data-lane="3"] circle { stroke: var(--success-text); } .ggraph__node[data-lane="4"] circle { stroke: var(--warning-text); }
  .ggraph__node[data-head] circle:not(.ggraph__halo) { fill: var(--primary); }
  .ggraph__halo { fill: none !important; stroke-width: 2 !important; stroke-dasharray: 3 3; }
  .ggraph__label { font: 700 11.5px var(--font-body); fill: var(--text-1); }
  .ggraph__label--head { fill: var(--primary-text); }
  .ggraph__label--remote { fill: var(--info-text); font-style: italic; }
  .ghub { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 2px solid var(--border); border-radius: var(--r-md); }
  .ghub__title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
  .ghub__repo { font: 500 var(--fs-small) var(--font-code); color: var(--text-2); overflow-wrap: anywhere; }
  .ghub__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-label); }
  .ghub__list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; }
  .ghub__list li > span { overflow-wrap: anywhere; }
  .ghub__list small { display: block; color: var(--text-2); font-size: var(--fs-caption); }
  .ghub__list svg { color: var(--text-2); }
  .ghub__sha { font: 400 var(--fs-caption) var(--font-code); color: var(--text-2); }
  .ggoal { padding: var(--sp-3) var(--sp-4); border: 2px solid var(--border); border-radius: var(--r-md); }
  .ggoal__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
  .ggoal__item { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--sp-2); align-items: start; font-size: var(--fs-label); color: var(--text-2); }
  .ggoal__item svg { width: 20px; height: 20px; color: var(--border-strong); }
  .ggoal__item[data-ok="true"] { color: var(--text-1); }
  .ggoal__item[data-ok="true"] svg { color: var(--success-text); animation: code-pop var(--dur-slow) var(--ease-celebrate); }

  /* ═══ Chapter end ════════════════════════════════════════════════ */
  /* Inline code: a light tinted chip that keeps the line height (a later components.css .md-code
     rule meant for <pre class="md-code"> made inline code dark, padded blocks). */
  code.md-code {
    margin: 0; padding: .05em .35em; border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent); border-radius: 5px;
    background: color-mix(in srgb, var(--brand) 9%, var(--surface)); color: var(--text-1); font-size: .88em; line-height: inherit;
    white-space: normal; overflow: visible; box-decoration-break: clone; -webkit-box-decoration-break: clone;
  }
  .cout code.md-code, .ctest__detail code.md-code { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #F7EFE8; }
  .code-block__lang:empty { display: none; }
  .code-explain__n { font-weight: 700; font-size: var(--fs-small); color: var(--text-2); }
  .code-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
  .code-checklist li { display: flex; gap: var(--sp-2); align-items: center; color: var(--text-2); }
  .code-checklist li svg { width: 20px; height: 20px; color: var(--border-strong); flex-shrink: 0; }
  .code-checklist li[data-ok="true"] { color: var(--text-1); }
  .code-checklist li[data-ok="true"] svg { color: var(--success-text); }
  .more-links a.more-link { text-decoration: none; color: inherit; }

  /* ═══ Certificate view ═══════════════════════════════════════════ */
  .cert-view { display: grid; gap: var(--stack-gap); }
  .cert-skel { aspect-ratio: 297 / 210; height: auto; }
  .cert-stage { padding: var(--sp-3); border-radius: var(--r-lg); background: var(--sunken); }
  .cert-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
  .cert-actions .btn { text-decoration: none; }
  @media (max-width: 599px) { .cert-actions .btn { flex: 1 1 100%; } }
  .cert-verify { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
}

/* The certificate: A4 landscape paper, sized in container units so it scales to any width. */
@layer components {
  .cert { container-type: inline-size; width: 100%; aspect-ratio: 297 / 210; background: #FFFBF7; color: #3D3229; box-shadow: var(--float-2); font-family: var(--font-body); }
  .cert__frame {
    position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 4cqw 6cqw 3.4cqw; border: 1cqw solid #FF6B00; outline: .25cqw solid #E5D5C3; outline-offset: -2.4cqw;
    background: radial-gradient(circle at 0 0, #FFEEDC 0 9cqw, transparent 9.1cqw), radial-gradient(circle at 100% 100%, #FFEEDC 0 9cqw, transparent 9.1cqw);
  }
  .cert__head { align-self: stretch; display: flex; align-items: center; gap: 1.2cqw; }
  .cert__logo { width: 4.4cqw; height: 4.4cqw; }
  .cert__brand { font: 800 2.8cqw/1 var(--font-display); color: #3D3229; }
  .cert__kind { margin-left: auto; font: 700 1.5cqw var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #B34700; }
  .cert__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1cqw 0; }
  .cert__sum { margin: 1cqw 0 0; font: 600 1.45cqw var(--font-body); color: #6B5B4C; }
  .cert__eyebrow { margin: 0; font: 700 1.8cqw var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: #B34700; }
  .cert__lead { margin: 1cqw 0 0; font-size: 1.7cqw; color: #6B5B4C; }
  .cert__name { margin: .8cqw 0 .2cqw; padding-bottom: .5cqw; border-bottom: .35cqw solid #FF6B00; font: 800 5.6cqw/1.1 var(--font-display); color: #3D3229; max-width: 90%; overflow-wrap: anywhere; }
  .cert__title { margin: .8cqw 0 0; font: 800 3.6cqw/1.15 var(--font-display); color: #3D3229; }
  .cert__skills { list-style: none; margin: 1.4cqw 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6cqw; max-width: 85%; }
  .cert__skills li { padding: .3cqw 1cqw; border-radius: 99px; background: #FFEEDC; color: #8A3A08; font: 600 1.3cqw var(--font-body); }
  .cert__accr { margin: 1cqw 0 0; font-size: 1.3cqw; font-style: italic; color: #6B5B4C; }
  .cert__foot { align-self: stretch; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 2cqw; text-align: left; }
  .cert__facts { margin: 0; display: grid; gap: .8cqw; }
  .cert__facts dt { font: 700 1.05cqw var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: #7A6A5A; }
  .cert__facts dd { margin: 0; font: 700 1.6cqw var(--font-body); color: #3D3229; }
  .cert__id { font-family: var(--font-code) !important; letter-spacing: .06em; }
  .cert__sign { display: grid; justify-items: center; gap: .3cqw; }
  .cert__partner { max-height: 5cqw; max-width: 14cqw; object-fit: contain; margin-bottom: .6cqw; }
  .cert__sig { font: italic 800 3.4cqw/1 var(--font-display); color: #B34700; transform: rotate(-4deg); }
  .cert__sigline { padding-top: .5cqw; border-top: .15cqw solid #9C8670; font: 600 1.2cqw var(--font-body); color: #6B5B4C; min-width: 20cqw; text-align: center; }
  .cert__qr { justify-self: end; display: grid; justify-items: center; gap: .3cqw; font: 600 1.05cqw var(--font-body); color: #6B5B4C; }
  .cert-qr { width: 11cqw; height: 11cqw; display: block; }
}

/* Print / Save as PDF: only the certificate, on one landscape A4 page (cert.js print()). */
@media print {
  @page { size: A4 landscape; margin: 0; }
  html.ef-print-cert, html.ef-print-cert body { background: #fff !important; width: 297mm; height: 210mm; overflow: hidden; }
  html.ef-print-cert body > *:not(#certPrint) { display: none !important; }
  html.ef-print-cert #certPrint { display: block !important; width: 297mm; height: 210mm; }
  html.ef-print-cert #certPrint .cert { width: 297mm; height: 210mm; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
#certPrint { display: none; }

/* Code shows exactly the characters a student types: no ligatures (">=" must not become "⩾"). */
@layer components {
  code, pre, kbd, samp, .code-pre, .ced__hl, .ced__ta, .ced__nums, .md-code, .gterm__pre, .gterm__in, .gterm__ps,
  .fixline__code, .fill__pre, .fill__in, .order__code, .copt__text, .cout__log, .cert__id, .ghub__sha {
    font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
  }
  /* Find the bug: 44 px line targets on touch, normal code line height with a mouse. */
  @media (pointer: fine) and (hover: hover) and (min-width: 900px) {
    .fixline { min-height: 0; padding-block: 1px; }
    .fixline__code { line-height: 1.6; }
  }
}

/* ═══ SQL (efSql): tables panel, result tables, text view ═══════════
   Light panels use the theme tokens; result tables inside the dark
   output panel use the code colours (same in both themes). */
@layer components {
  .sqltables { min-width: 0; border: 2px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
  .sqltables__sum { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap-min); padding: 0 var(--sp-3); cursor: pointer; font: 700 var(--fs-label) var(--font-body); color: var(--text-1); }
  .sqltables__sum svg { width: 18px; height: 18px; color: var(--primary-text); }
  .sqltables__n { color: var(--text-2); font-weight: 600; }
  .sqltables__sum:focus-visible, .sqlt__sum:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--r-sm); }
  .sqltables__body { display: grid; gap: 0; min-width: 0; padding: 0 var(--sp-3) var(--sp-2); }
  .sqltables__msg { margin: 0 0 var(--sp-2); font-size: var(--fs-label); color: var(--text-2); }
  .sqlt { min-width: 0; border-top: 1px solid var(--border); }
  .sqlt[open] { padding-bottom: var(--sp-3); }
  .sqlt__sum { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--sp-2); min-height: var(--tap-min); cursor: pointer; }
  .sqlt__name { font: 700 var(--fs-label) var(--font-code); color: var(--text-1); }
  .sqlt__meta { font-size: var(--fs-small); color: var(--text-2); }
  .sqlt__cols { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-2); padding: 0; }
  .sqlt__cols li { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: var(--r-full); background: var(--sunken); font-size: var(--fs-small); color: var(--text-1); }
  .sqlt__cols code { font: 600 var(--fs-small) var(--font-code); }
  .sqlt__type { font: 400 var(--fs-caption) var(--font-code); color: var(--text-2); }
  .sqlt__tag { font: 700 var(--fs-caption) var(--font-body); color: var(--primary-text); }
  .sqlt__more { margin: 6px 0 var(--sp-2); font-size: var(--fs-small); color: var(--text-2); }

  .sqlgrid { max-width: 100%; max-height: 340px; overflow: auto; overscroll-behavior-x: contain; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
  .sqlgrid:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .sqlgrid table { width: max-content; min-width: 100%; border-collapse: collapse; font: 400 var(--fs-small)/1.45 var(--font-code); }
  .sqlgrid th, .sqlgrid td { padding: 6px 12px; text-align: left; white-space: pre; border-bottom: 1px solid var(--border); }
  .sqlgrid th { position: sticky; top: 0; z-index: 1; background: var(--sunken); color: var(--text-1); font-weight: 700; }
  .sqlgrid td { color: var(--text-1); }
  .sqlgrid tbody tr:last-child td { border-bottom: 0; }
  .sqlgrid .sqlnum { text-align: right; font-variant-numeric: tabular-nums; }
  .sqlgrid .sqlnull { color: var(--text-3); font-style: italic; font-size: var(--fs-caption); letter-spacing: .06em; }

  .cout__tools { display: inline-flex; align-items: center; gap: var(--sp-2); }
  .cout__toggle { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap-min); padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; color: #CDBCAC; font: 700 var(--fs-caption) var(--font-body); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
  .cout__toggle:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .cout__toggle[aria-pressed="true"] { color: #FF9F5C; }
  .cout__toggle:focus-visible { outline: 3px solid #FF9F5C; outline-offset: -3px; }
  .sqlres { display: grid; gap: var(--sp-3); min-width: 0; padding: 12px 14px; }
  .sqlres > .cout__note, .sqlres__set > .cout__note { margin: 0; font: 400 var(--fs-label)/1.55 var(--font-body); }
  .sqlres__set { min-width: 0; }
  .sqlres__cap { margin: 0 0 6px; font: 700 var(--fs-caption) var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: #CDBCAC; }
  .sqlres__err { margin: 0; font: 400 var(--fs-label)/1.55 var(--font-code); white-space: pre-wrap; overflow-wrap: anywhere; }
  .cout .sqlgrid { border-color: #5A4A3D; background: #2A211A; }
  .cout .sqlgrid:focus-visible { outline-color: #FF9F5C; }
  .cout .sqlgrid th { background: #3A2F26; color: #F7EFE8; border-bottom-color: #5A4A3D; }
  .cout .sqlgrid td { color: #F7EFE8; border-bottom-color: #3A2F26; }
  .cout .sqlgrid .sqlnull { color: #C9B8A8; }
  .ctest__exp { margin-top: 4px; }
  .ctest__exp > summary { display: inline-flex; align-items: center; min-height: var(--tap-min); cursor: pointer; color: #FF9F5C; font-weight: 700; }
  .ctest__exp > summary:focus-visible { outline: 3px solid #FF9F5C; outline-offset: 2px; border-radius: 4px; }
  .ctest__exp .sqlgrid + .sqlgrid { margin-top: var(--sp-2); }
  .lesson__run { display: grid; justify-items: start; gap: var(--sp-2); min-width: 0; }
  .lesson__run > .sqltables { justify-self: stretch; }
  .lesson__code > .cout--sql[hidden] { display: none; }

  /* "Watch it work" animated diagrams (visuals.js) */
  .cviz { display: grid; gap: var(--sp-3); }
  .cviz:focus { outline: none; }
  .cviz__count { margin-left: auto; }
  .cviz__stage { border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--border); padding: var(--sp-2); }
  .cviz__svg { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; overflow: visible; }
  .cviz__cap { margin: 0; min-height: 3em; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-1); }
  .cviz__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .cviz__bar .btn { min-width: 44px; min-height: 44px; }
  .cviz__dots { display: flex; gap: 6px; margin: 0 0 0 auto; padding: 0; list-style: none; }
  .cviz__dots li { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); opacity: .45; transition: background .25s, opacity .25s, transform .25s; }
  .cviz__dots li.on { background: var(--primary); opacity: 1; }
  .cviz__dots li.on:last-of-type, .cviz__dots li.on:has(+ li:not(.on)) { transform: scale(1.35); }
  /* SVG pieces: theme colours */
  .cviz .vz-tx { fill: var(--text-1); font: 600 12px/1 var(--font-body); }
  .cviz .vz-mono { fill: var(--text-1); font: 500 11.5px/1 var(--font-code); }
  .cviz .vz-cap { fill: var(--text-2); font: 600 10.5px/1 var(--font-body); }
  .cviz .vz-bold { font-weight: 800; }
  .cviz .vz-big { font-size: 16px; font-weight: 800; }
  .cviz .vz-huge { font: 800 26px/1 var(--font-display); }
  .cviz .vz-muted { fill: var(--text-3); }
  .cviz .vz-bad { fill: var(--danger-text); }
  .cviz .vz-on-a { fill: var(--on-primary); }
  .cviz .vz-on-dark { fill: #F5EDE4; }
  .cviz .vz-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
  .cviz .vz-dash { stroke-dasharray: 6 4; fill: transparent; }
  .cviz .vz-a { fill: var(--primary); stroke: none; }
  .cviz .vz-b { fill: var(--info-bg); stroke: var(--info); stroke-width: 1.5; }
  .cviz .vz-c { fill: var(--success-bg); stroke: var(--success); stroke-width: 1.5; }
  .cviz .vz-d { fill: var(--warning-bg); stroke: var(--warning); stroke-width: 1.5; }
  .cviz .vz-soft { opacity: .9; }
  .cviz .vz-m { fill: color-mix(in srgb, var(--warning) 18%, var(--surface)); stroke: var(--warning); stroke-dasharray: 5 4; }
  .cviz .vz-bd { fill: var(--text-2); }
  .cviz .vz-p { fill: color-mix(in srgb, var(--success) 22%, var(--surface)); }
  .cviz .vz-chrome { fill: var(--border); }
  .cviz .vz-scan { fill: color-mix(in srgb, var(--primary) 22%, transparent); }
  .cviz .vz-th { fill: var(--sunken); stroke: var(--border-strong); stroke-width: 1; }
  .cviz .vz-td { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
  .cviz .vz-console { fill: #211A14; stroke: none; }
  .cviz .vz-line { fill: transparent; transition: fill .3s ease; }
  .cviz .vz-line.is-hot { fill: color-mix(in srgb, var(--primary) 18%, transparent); }
  .cviz .vz-col { fill: color-mix(in srgb, var(--info) 0%, transparent); transition: fill .3s; }
  .cviz .is-hot > .vz-col, .cviz .is-hot .vz-col { fill: color-mix(in srgb, var(--info) 16%, transparent); }
  .cviz .vz-ring { fill: none; stroke: var(--primary); stroke-width: 3; opacity: 0; transition: opacity .3s; }
  .cviz .is-hot > .vz-ring, .cviz .is-hot.vz-ring { opacity: 1; }
  .cviz .vz-arrow { stroke: var(--text-2); stroke-width: 2; fill: none; }
  .cviz .vz-head { fill: var(--text-2); }
  .cviz .vz-track { stroke: var(--border-strong); stroke-width: 3; fill: none; }
  .cviz .vz-node-a { fill: var(--primary); } .cviz .vz-node-b { fill: var(--info); } .cviz .vz-node-c { fill: var(--success); }
  .cviz .vz-dot { fill: var(--primary); }
  .cviz .vz-ghost { opacity: .6; }
  .cviz .vz-badbox { stroke: var(--danger); }
  .cviz .is-hot > .vz-b, .cviz .is-hot > .vz-c, .cviz .is-hot > rect.vz-box { stroke: var(--primary); stroke-width: 3; }
  .cviz .vz-row-bad.is-hot { opacity: .22; }
  .cviz .vz-row-ok.is-hot rect.vz-td { fill: color-mix(in srgb, var(--success) 14%, var(--surface)); }
  .cviz [data-s] { opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .45s var(--ease-celebrate); }
  .cviz [data-s].is-in { opacity: 1; transform: none; }
  .cviz [data-off]:not([data-s]).is-out { opacity: 0; transition: opacity .3s; }
  .cviz [data-tf] { transition: transform .7s var(--ease-standard); }
  .cviz [data-on] { transition: opacity .35s ease; }
  @media (prefers-reduced-motion: reduce) { .cviz [data-s], .cviz [data-tf], .cviz .vz-line, .cviz [data-on] { transition: none; } .cviz [data-s] { transform: none; } }

  /* Booked final exams */
  .exam-book { display: grid; gap: var(--sp-3); }
  .exam-book__row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--sp-3); }
  .exam-book .btn { justify-self: start; }
  .exam-booked { display: grid; gap: var(--sp-2); padding: var(--sp-4); border-radius: var(--r-lg); background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 10%, var(--surface)), var(--surface) 75%);
    border: 2px solid color-mix(in srgb, var(--primary) 30%, var(--border)); }
  .exam-booked[data-open] { border-color: var(--success); background: linear-gradient(160deg, color-mix(in srgb, var(--success) 12%, var(--surface)), var(--surface) 75%); }
  .exam-booked__eyebrow { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 700; color: var(--primary-text); }
  .exam-booked[data-open] .exam-booked__eyebrow { color: var(--success-text); }
  .exam-booked__when { margin: 0; font: 800 var(--fs-h2)/1.2 var(--font-display); color: var(--text-1); }
  .exam-booked__count { margin: 0; font-weight: 600; color: var(--text-2); }
  .exam-booked .btn[data-size="lg"] { justify-self: start; animation: ef-pulse 1.8s ease-in-out infinite; }
  .exam-book__tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
  @media (max-width: 479px) { .exam-book__row { grid-template-columns: 1fr; } .exam-book .btn, .exam-booked .btn[data-size="lg"] { justify-self: stretch; } }
  @media (prefers-reduced-motion: reduce) { .exam-booked .btn[data-size="lg"] { animation: none; } }

  /* Boss challenge (the last challenge of a chapter with 3 or more) */
  .cblock[data-boss="1"] { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); box-shadow: 0 4px 0 color-mix(in srgb, var(--warning) 35%, var(--border)), inset 0 0 0 1px color-mix(in srgb, var(--warning) 25%, transparent); }
  .cblock__boss { animation: code-boss 2.4s ease-in-out infinite; }
  .cblock[data-state="passed"] .cblock__boss { animation: none; }
  @keyframes code-boss { 0%, 100% { transform: none; } 50% { transform: rotate(-3deg) scale(1.05); } }
  @media (prefers-reduced-motion: reduce) { .cblock__boss { animation: none; } }
}
