/* Code page — in-browser Python playground (editor + console + tasks). */

/* ---- Lesson prose (rendered markdown) ---- */
.code-prose h2 { font-size: 1.5rem; font-weight: 600; color: #e2e8f0; margin: 1.7rem 0 .6rem; }
.code-prose h3 { font-size: 1.25rem; font-weight: 600; color: #e2e8f0; margin: 1.3rem 0 .45rem; }
.code-prose p { margin: .9rem 0; }
.code-prose ul, .code-prose ol { margin: .9rem 0 .9rem 1.5rem; list-style: revert; }
.code-prose li { margin: .4rem 0; }
.code-prose strong { color: #f1f5f9; }
/* Tables in lesson steps (trace tables, wrong/right/why tables): without cell padding
   and rules the columns ran together ("gets Output"). Neutral rgba rules read in both
   themes; wide tables scroll inside the step instead of the page. */
.code-prose table {
  display: block; max-width: 100%; overflow-x: auto;
  border-collapse: collapse; margin: 1rem 0; font-size: .95em;
}
.code-prose th, .code-prose td {
  padding: .4rem .7rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid rgba(148, 163, 184, .22);
}
.code-prose th { font-weight: 600; border-bottom-color: rgba(148, 163, 184, .45); }
/* Links in lesson prose (the usage → setup cross-reference, resource links). The
   lesson page has no [data-course], so --accent-rgb is unset here — use a fixed
   sky accent rather than the per-course variable. */
.code-prose a {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(125, 211, 252, .5);
  transition: color .15s ease, text-decoration-color .15s ease;
}
.code-prose a:hover { color: #bae6fd; text-decoration-color: #bae6fd; }
/* Lesson images (markdown ![](…)). Wide self-drawn SVGs (intrinsic ~720px) scale to
   the column; small logos keep their intrinsic size. Centered as their own block. */
.code-prose img {
  display: block;
  margin: 1.4rem auto;
  max-width: 100%;
  max-height: 22rem; /* room for denser teaching photos in prose lessons */
  height: auto;
  border-radius: 0.75rem;
  /* Figures carry width/height (templating._size_code_figures) so their room is kept before
     they load; when max-height clamps a tall one, contain keeps its proportions. */
  object-fit: contain;
}
/* A paragraph holding several images → a centered logo strip (not stacked blocks). */
.code-prose p:has(img + img) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  margin: 1.4rem 0;
}
.code-prose p:has(img + img) img { display: inline-block; margin: 0; max-height: 2.6rem; width: auto; border-radius: 0; }
/* `![alt](src)` immediately followed by `*caption*` → an em caption under the image. */
.code-prose img + em {
  display: block;
  margin: -0.6rem auto 0;
  text-align: center;
  font-style: normal;
  font-size: 0.8rem;
  color: #e2e8f0;
}
/* Inline Lucide icons from the {icon:NAME} shortcode (e.g. on section headings) —
   the same icon set the Know page uses. Sized to the surrounding text, accent-tinted. */
.code-prose .code-ico {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.16em;
  margin-right: 0.42em;
  color: #7dd3fc;
}
.code-prose code {
  background: rgba(148, 163, 184, .16);
  padding: .08em .35em;
  border-radius: .3rem;
  font-size: .92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-prose pre {
  background: #0b1020;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: .6rem;
  padding: .7rem .9rem;
  overflow-x: auto;
  margin: .6rem 0;
  font-size: 15px;     /* keep code compact; don't inherit the larger prose body size */
  line-height: 1.5;    /* and not the airy prose line-height */
}
.code-prose pre code { background: none; padding: 0; }
/* Highlighted example blocks: code-playground.js tags the <pre> with cm-s-exercise
   and fills the <code> with cm-* token spans via CodeMirror.runMode, reusing the
   editor palette below. This sets the base (untokenized) text to the editor's. */
.code-prose pre.cm-s-exercise code { color: #e2e8f0; }

.code-task-prompt code {
  background: rgba(148, 163, 184, .16);
  padding: .08em .35em;
  border-radius: .3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Editor (CodeMirror 5 replaces the textarea) ---- */
.code-editor { display: none; }
.code-task .CodeMirror {
  margin-top: .85rem;   /* CodeMirror replaces the <textarea> and drops its mt-3, so add the gap here */
  height: auto;
  min-height: 5.5rem;
  border-radius: .6rem;
  border: 1px solid rgba(148, 163, 184, .18);
  font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-task .CodeMirror-scroll { min-height: 5.5rem; }
/* Phones: the editor wraps (lineWrapping, set in code-playground.js) and a
   prose code block stays inside the card. Without min-width: 0 the pre's
   long line widens the page and overflow-x never gets a box to scroll in. */
@media (max-width: 767px) {
  .code-task .CodeMirror,
  .code-prose pre { max-width: 100%; }
  .code-prose pre { min-width: 0; }
  .CodeMirror-wrap .CodeMirror-line { overflow-wrap: anywhere; }
}

/* ---- Editor theme "exercise": calm dark, matched to the site (replaces Dracula) ---- */
/* codemirror.css defaults to a WHITE editor + #f7f7f7 gutter — the wrapper and gutter
   backgrounds MUST be set here, or dropping Dracula would render the editor bright. */
.cm-s-exercise.CodeMirror { background: var(--reading-surface, #01040e); color: #e2e8f0; }
.cm-s-exercise .CodeMirror-gutters { background: #0b1020; border: none; }
.cm-s-exercise .CodeMirror-linenumber { color: #4b5872; }
.cm-s-exercise .CodeMirror-cursor { border-left: 1px solid #67e8f9; }
.cm-s-exercise .CodeMirror-selected { background: rgba(99, 102, 241, .3); }
.cm-s-exercise.CodeMirror-focused .CodeMirror-selected { background: rgba(99, 102, 241, .3); }
.cm-s-exercise .CodeMirror-line::selection,
.cm-s-exercise .CodeMirror-line > span::selection,
.cm-s-exercise .CodeMirror-line > span > span::selection { background: rgba(99, 102, 241, .35); }
.cm-s-exercise .CodeMirror-activeline-background { background: rgba(255, 255, 255, .025); }
.cm-s-exercise .CodeMirror-matchingbracket { color: #67e8f9 !important; text-decoration: underline; }
.cm-s-exercise .cm-comment { color: #e2e8f0; }
.cm-s-exercise .cm-keyword { color: #c4b5fd; }
.cm-s-exercise .cm-builtin { color: #7dd3fc; }
.cm-s-exercise .cm-def { color: #67e8f9; }
.cm-s-exercise .cm-variable { color: #e2e8f0; }
.cm-s-exercise .cm-variable-2 { color: #e2e8f0; }
.cm-s-exercise .cm-variable-3, .cm-s-exercise .cm-type { color: #7dd3fc; }
.cm-s-exercise .cm-property { color: #93c5fd; }
.cm-s-exercise .cm-operator { color: #e2e8f0; }
.cm-s-exercise .cm-string { color: #86efac; }
.cm-s-exercise .cm-string-2 { color: #86efac; }
.cm-s-exercise .cm-number { color: #fcd34d; }
.cm-s-exercise .cm-atom { color: #c4b5fd; }
.cm-s-exercise .cm-meta { color: #e2e8f0; }
.cm-s-exercise .cm-bracket { color: #e2e8f0; }
.cm-s-exercise .cm-error { color: #fca5a5; }

/* ---- Toolbar buttons ---- */
.code-btn {
  border-radius: 9999px;
  padding: .35rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  cursor: pointer;
  transition: background .15s, color .15s, opacity .15s;
}
.code-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); color: #fff; }
.code-btn:disabled { opacity: .4; cursor: not-allowed; }
.code-check.is-checking:disabled { cursor: progress; }
/* Keyboard focus ring — matches .code-continue / .code-example-run so every
   control in the playground shares one focus style (these pills otherwise fell
   back to the UA default outline). */
.code-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(34, 211, 238, .6); }
.code-btn-primary { background: rgba(34, 211, 238, .16); color: #67e8f9; border-color: rgba(34, 211, 238, .3); }
.code-btn-primary:hover:not(:disabled) { background: rgba(34, 211, 238, .26); color: #a5f3fc; }
.code-btn-check { background: rgba(99, 102, 241, .16); color: #c7d2fe; border-color: rgba(99, 102, 241, .3); }
.code-btn-check:hover:not(:disabled) { background: rgba(99, 102, 241, .26); color: #e0e7ff; }
.code-btn-hint { background: rgba(251, 191, 36, .16); color: #fcd34d; border-color: rgba(251, 191, 36, .32); }
.code-btn-arrow { min-width: 2.4rem; font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: grab; color: #c4b5fd; border-color: rgba(167, 139, 250, .35); background: rgba(167, 139, 250, .12); }
.code-btn-arrow:active { cursor: grabbing; }
.code-btn-hint:hover:not(:disabled) { background: rgba(251, 191, 36, .26); color: #fde68a; }

/* Icon-only run/stop/reset buttons — the symbol replaces the text label; the
   localized word lives in title/aria-label. Same vertical height as the text
   Check button keeps the toolbar row aligned. */
.code-run, .code-stop, .code-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .35rem .55rem;
}
.code-run svg, .code-stop svg, .code-reset svg { width: 17px; height: 17px; display: block; }

/* Hint is icon-only (lightbulb → spinner while loading); Check keeps its text but
   gains a leading checkmark, so both use inline-flex with a small leading icon. */
.code-hint { display: inline-flex; align-items: center; justify-content: center; padding: .35rem .55rem; }
.code-check { display: inline-flex; align-items: center; gap: .35rem; }
.code-hint svg, .code-check svg { width: 17px; height: 17px; display: block; }
.code-hint .icon-spinner { display: none; }
.code-hint.is-loading .icon-hint { display: none; }
.code-hint.is-loading .icon-spinner { display: block; animation: code-spin .7s linear infinite; }
@keyframes code-spin { to { transform: rotate(1turn); } }

/* ---- Console ---- */
.code-console {
  background: #05070f;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: .6rem;
  padding: .6rem .8rem;
  min-height: 2.5rem;
  max-height: 16rem;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}
.code-console-empty { color: #e2e8f0; }   /* slate-400: readable hint on the dark console (design audit) */
html[data-theme="light"] .code-console-empty { color: #475569; }
/* Output is appended as inline spans whose text carries its own newlines; the
   console <pre> (white-space: pre-wrap) renders the breaks. The inline input is
   appended after the last span, so a newline-less prompt keeps it on the same
   line — like a local terminal. */
.code-out  { color: #e2e8f0; }
.code-err  { color: #fca5a5; }
.code-sys  { color: #e2e8f0; }
.code-echo { color: #67e8f9; }
.code-console-input {
  display: inline;
  width: 24ch;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  caret-color: #22d3ee;
}

/* Linux terminal REPL (shell tasks): the console IS a live shell you type into. */
.code-terminal { min-height: 7rem; max-height: 24rem; cursor: text; }
.code-prompt { color: #4ade80; }      /* green prompt, like a real shell */
.code-terminal .code-term-input { width: 48ch; }   /* roomier than the input() box */

/* ---- Check result ---- */
.code-result { border-radius: .6rem; padding: .55rem .8rem; font-size: .82rem; }
.code-result-pending { color: #e2e8f0; }
.code-result-pass { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .35); color: #86efac; }
.code-result-fail { background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .3); color: #fca5a5; }
.code-result-line { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; color: #e2e8f0; margin-top: .25rem; white-space: pre-wrap; }
.code-result-label { color: #e2e8f0; }
/* Multi-line SQL result grid in the check result box (expected vs got). */
.code-result-grid { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; color: #e2e8f0; white-space: pre; overflow-x: auto; margin: .15rem 0 .4rem; padding: .35rem .55rem; background: rgba(2, 6, 23, .5); border-radius: .35rem; }
/* First-difference highlight in a stdout "expected vs got" line: the run of
   characters from where the two strings diverge. The underline makes a
   highlighted *space* visible too (so a comma-vs-space difference is obvious). */
.code-diff-hl {
  border-radius: .15rem;
  padding: 0 .05rem;
  background: rgba(248, 113, 113, .3);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, .45);
  text-decoration: underline;
  text-decoration-color: rgba(254, 202, 202, .85);
  text-underline-offset: 2px;
}
/* dom (HTML/CSS) check result: a ✓/✗ requirements checklist — a friendly to-do
   list shown on pass AND fail, so the beginner sees partial progress, not a diff. */
.code-check-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.code-check-item { display: flex; align-items: flex-start; gap: .45rem; font-size: .9rem; line-height: 1.45; margin-top: .28rem; color: #e2e8f0; }
.code-check-mark { flex: none; width: 1.05rem; text-align: center; font-weight: 700; }
.code-check-item.is-ok .code-check-mark { color: #86efac; }
.code-check-item.is-no .code-check-mark { color: #fca5a5; }
.code-check-item.is-no { color: #fecdd3; }

/* ---- Hint panel (AI-generated, sits below the result box) ---- */
.code-hint-panel { border-radius: .6rem; padding: .55rem .8rem; font-size: .85rem; line-height: 1.5; background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .22); color: #fde9b8; }
.code-hint-panel.code-hint-pending { background: none; border-color: transparent; color: #e2e8f0; }
.code-hint-panel.code-hint-fail { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .3); color: #fca5a5; }
.code-hint-panel p { margin: 0 0 .45rem; }
.code-hint-panel p:last-child { margin-bottom: 0; }
.code-hint-panel ul, .code-hint-panel ol { margin: .1rem 0 .45rem; padding-left: 1.2rem; }
.code-hint-panel li { margin: .12rem 0; }
.code-hint-panel code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; background: rgba(2, 6, 23, .45); padding: .05rem .3rem; border-radius: .25rem; }
.code-hint-panel strong { color: #fef3c7; }

/* ---- Completed task ---- */
.code-task.code-session-done { border-color: rgba(34, 197, 94, .35); }

/* ---- Modern-browser guard ---- */
.code-runtime-warning {
  border-radius: .6rem;
  padding: .7rem .9rem;
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .3);
  color: #fca5a5;
  font-size: .85rem;
}

/* ---- Runnable examples in lesson prose (```python blocks) ---- */
/* Prefixed with .code-prose so these win over the generic .code-prose pre rules. */
.code-prose .code-example { position: relative; margin: .6rem 0; }
.code-prose .code-example > pre { margin: 0; }

.code-example-run {
  position: absolute;
  bottom: .6rem;   /* ≈ centered on the last code line (sits just above the bottom padding) */
  right: .5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 9999px;
  background: rgba(11, 16, 32, .82);   /* near the code-block bg, opaque enough to sit over code */
  color: #67e8f9;
  border: 1px solid rgba(148, 163, 184, .22);
  cursor: pointer;
  opacity: .85;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
/* The ▶ sits in a strip of its own under the last code line: laid over the code it hid the
   end of a long last line (a trailing comment, a long print) on lessons and references. */
div.code-example:has(> .code-example-run) > pre { padding-bottom: 2.65rem; }
div.code-example > .code-example-run { bottom: .4rem; }
.code-example-run:hover:not(:disabled) { opacity: 1; background: rgba(34, 211, 238, .28); color: #a5f3fc; border-color: rgba(34, 211, 238, .4); }
.code-example-run:disabled { opacity: .3; cursor: not-allowed; }
.code-example-run:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(34, 211, 238, .6); }
.code-example-run .icon-play, .code-example-run .icon-stop { width: 15px; height: 15px; display: block; }
.code-example-run .icon-stop { display: none; }
.code-example-run.is-running { background: rgba(11, 16, 32, .82); color: #fca5a5; border-color: rgba(248, 113, 113, .45); }
.code-example-run.is-running .icon-play { display: none; }
.code-example-run.is-running .icon-stop { display: block; }

.code-prose .code-example-output {
  margin: -.1rem 0 .8rem;
  background: #070b16;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: .6rem;
  padding: .5rem .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 14rem;
  overflow: auto;
}
.code-prose .code-example-output::before {
  content: attr(data-label);
  display: block;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #475569;
  margin-bottom: .3rem;
}

/* ---- HTML/CSS live preview (iframe) ----
   The task preview (replaces the console on html lessons) and the auto-rendered
   preview under each prose ```html example. White canvas (a rendered page expects
   light); code-html.js auto-sizes the height to the content after each render, so
   the heights below are just the pre-render default. */
.code-preview {
  display: block;
  width: 100%;
  height: 9rem;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: .6rem;
  background: #ffffff;
}

/* LaTeX compiled-PDF preview pane (code-latex.js paints into it). No height cap, so
   the WHOLE page is shown (it used to clip at 32rem and scroll). */
.code-pdf {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: .6rem;
  background: var(--reading-surface, #01040e);
  padding: .7rem;
}
.code-pdf-empty, .code-pdf-pending {
  display: block;
  padding: 1.4rem .8rem;
  text-align: center;
  color: #e2e8f0;
  font-size: .85rem;
}
.code-pdf-pending { color: #e2e8f0; }
.code-pdf-bar { display: flex; justify-content: flex-end; margin-bottom: .5rem; }
.code-pdf-download {           /* lesson page has no [data-course] accent — use a fixed sky */
  font-size: .78rem;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: .4rem;
  padding: .2rem .6rem;
  transition: background .15s ease;
}
.code-pdf-download:hover { background: rgba(56, 189, 248, .14); }
.code-pdf-pages { display: flex; flex-direction: column; gap: .55rem; align-items: center; }
.code-pdf-page {            /* a server-rasterized page PNG */
  display: block;
  width: 100%;
  height: auto;
  border-radius: .25rem;
  box-shadow: 0 2px 14px -4px rgba(0, 0, 0, .7);
}
.code-pdf-error {
  margin: 0;
  padding: .6rem .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #fda4af;
  white-space: pre-wrap;
  word-break: break-word;
}
.code-prose .code-example-preview {
  display: block;
  width: 100%;
  height: 8rem;
  margin: -.1rem 0 .8rem;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: .6rem;
  background: #ffffff;
}

/* ---- Lesson layout + step-through (progressive disclosure) ---- */
/* Narrow, centered reading column so lines stay short (ESL readability). */
.code-lesson { max-width: 42rem; margin-inline: auto; }
/* LaTeX lessons show a full PDF page beside the editor, so they get a wider working
   column (the <main> wrapper allows up to max-w-5xl) — a bigger, readable preview. */
.code-lesson[data-language="latex"] { max-width: 58rem; }
.code-step { scroll-margin-top: 5rem; }     /* auto-scroll clears the sticky header */
.code-step:focus { outline: none; }          /* programmatic focus on reveal — no ring on the section */
.code-step + .code-step { margin-top: 1.5rem; }

/* Icon-only step nav (mirrors /learn's .lx-nav): Back left · Restart middle · Continue right. */
.code-nav { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1.6rem; }
.code-continue {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border-radius: 9999px;
  padding: .5rem 1.15rem;
  font-size: .95rem;
  font-weight: 600;
  color: #67e8f9;
  background: rgba(34, 211, 238, .16);
  border: 1px solid rgba(34, 211, 238, .35);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.code-continue:hover { background: rgba(34, 211, 238, .26); color: #a5f3fc; border-color: rgba(34, 211, 238, .5); }
.code-continue:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(34, 211, 238, .6); }
.code-continue svg { width: 15px; height: 15px; }

/* Back + Restart — circular ghost buttons. The reveal engine sets [disabled] (not
   [hidden]) so they fade in place rather than vanish, keeping the bar's layout stable. */
.code-back, .code-restart {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.code-back {
  width: 2.5rem; height: 2.5rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
}
.code-back:hover:not(:disabled) { color: #e2e8f0; background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .18); }
.code-back:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(148, 163, 184, .5); }
.code-back svg { width: 1.05rem; height: 1.05rem; }
.code-back:disabled { opacity: 0; pointer-events: none; }   /* nothing before step 1 */

/* Restart — more muted than Back (secondary action), but kept at the same 2.5rem tap
   target (≥44px-ish) rather than /learn's sub-spec 2rem. */
.code-restart {
  width: 2.5rem; height: 2.5rem;
  color: #e2e8f0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .08);
}
.code-restart:hover:not(:disabled) { color: #e2e8f0; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); }
.code-restart:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(148, 163, 184, .5); }
.code-restart svg { width: 1.05rem; height: 1.05rem; }
.code-restart:disabled { opacity: 0; pointer-events: none; }   /* nothing to restart on step 1 */

/* Continue — the larger primary CTA. Inherits its cyan fill/colour/radius from the
   base .code-continue rule above (SHARED with /learn — never edit that rule); scoped
   here under .code-nav so this geometry-only override can't touch /learn's button. */
.code-nav .code-continue { width: 3rem; height: 3rem; padding: 0; gap: 0; justify-content: center; }
.code-nav .code-continue svg { width: 1.3rem; height: 1.3rem; }
.code-nav .code-continue-label { display: none; }
.code-nav .code-continue.is-next-lesson { width: auto; padding: 0 1rem; gap: .5rem; }
.code-nav .code-continue.is-next-lesson .code-continue-label { display: inline; }
.code-nav .code-continue:disabled { visibility: hidden; } /* no onward arrow after the final step; keep Restart centred */
/* ---- Landing index: per-course accent lesson cards ----
   Mirrors the .practice-card system in 06-landing.css: one --accent-rgb var per
   course (set on the [data-course] wrapper so the section label inherits it too)
   drives the badge, label, hover border/gradient, chevron, and focus ring. The
   neutral glass base stays on the card via Tailwind utilities; only accent-driven
   bits + the glass/gloss polish live here. */
/* Per-language accent families — vivid and grouped so the colour reads the language at
   a glance: Python → blues, Java → orange, C → violet, SQL → teal, HTML/CSS → fuchsia,
   plus LaTeX emerald / Linux amber / Cyber rose. Same-language courses (incl. the
   Practice tracks) share a hue. (The accent is a subtle glow/border + the icon, so the
   warm hues don't overwhelm the dark-blue background.) */
[data-course]                 { --accent-rgb: 56, 189, 248; }   /* default sky */
[data-course="python-basics"] { --accent-rgb: 56, 189, 248; }   /* sky — Python */
[data-course="pet-world"], [data-course="pet-world-pseudocode"] { --accent-rgb: 255, 209, 102; }   /* gold — Pet World */
[data-course="turtle-art"]    { --accent-rgb: 34, 211, 238; }   /* cyan — Turtle Art */
[data-course="arduino"]       { --accent-rgb: 45, 212, 191; }   /* teal — Arduino (the board's colour) */
[data-course="robots"]        { --accent-rgb: 96, 165, 250; }   /* blue — Robot Challenges (the VEX robot) */
[data-course="circuits"]      { --accent-rgb: 250, 204, 21; }   /* amber — Circuit Builder (lamp glow), /code/circuits */
[data-course="labs"]          { --accent-rgb: 167, 139, 250; }  /* violet — Physics Labs, /code/labs */
[data-course="bug-hunts"], [data-course="bug-hunts-pseudocode"] { --accent-rgb: 251, 146, 60; }   /* orange — Bug Hunts */
[data-course="igcse-cs"]      { --accent-rgb: 59, 130, 246; }   /* blue — Python (IGCSE CS) */
[data-course="a-level-cs"]    { --accent-rgb: 96, 165, 250; }   /* blue — Python */
[data-course="igcse-pseudocode"] { --accent-rgb: 129, 140, 248; }  /* indigo — IGCSE 0478 pseudocode */
[data-course="as-pseudocode"]    { --accent-rgb: 167, 139, 250; }  /* violet — AS 9618 pseudocode */
[data-course="ap-csp"]        { --accent-rgb: 251, 146, 60; }   /* orange — AP pair (CS Principles) */
[data-course="ap-csa"]        { --accent-rgb: 249, 115, 22; }   /* deeper orange — AP pair (CS A, Java/coffee) */
[data-course="c-basics"]      { --accent-rgb: 167, 139, 250; }  /* violet — C */
[data-course="sql-databases"] { --accent-rgb: 45, 212, 191; }   /* teal — SQL / databases */
[data-course="web-basics"]    { --accent-rgb: 232, 121, 249; }  /* fuchsia — HTML/CSS */
[data-course="javascript"]    { --accent-rgb: 250, 204, 21; }   /* yellow — JavaScript (brand) */
[data-course="latex"]         { --accent-rgb: 52, 211, 153; }   /* emerald — LaTeX / typesetting */
[data-course="linux"]         { --accent-rgb: 251, 191, 36; }   /* amber — Linux / the terminal */
[data-course="cyber-security"]{ --accent-rgb: 244, 63, 94; }    /* rose — security */
[data-course="practice-python"] { --accent-rgb: 56, 189, 248; }   /* sky — Python */
[data-course="practice-java"]   { --accent-rgb: 251, 146, 60; }   /* orange — Java (matches ap-csa) */
[data-course="practice-c"]      { --accent-rgb: 167, 139, 250; }  /* violet — C (matches c-basics) */

/* Course icon tile in the card header — accent-tinted (mirrors .practice-card-icon-bg, which
   isn't loaded on /code). The header cascades --accent-rgb from [data-course]. */
.code-course-icon { background-color: rgba(var(--accent-rgb), .12); color: rgb(var(--accent-rgb)); }

/* Glossy frosted glass, tinted + glowing in each course's accent. Layers:
   1. a top-lit ACCENT gradient FILL — brightest top-left, fading down: the
      gloss/sheen, now carrying the course colour at rest (a flat fill looks matte).
   2. backdrop-filter blur + saturate — the page (starfield + gradient) frosts
      through, so the card is genuinely see-through, not a flat dark panel.
   3. an inset 1px top highlight — the bright specular edge that reads as glass.
   4. an outer accent GLOW (the 0 0 …-blur shadow) — soft at rest, bright on hover.
   5. a soft drop shadow — lifts the card off the background for depth.
   The `background` shorthand intentionally clears Tailwind's gradient; the
   `backdrop-filter` overrides Tailwind's backdrop-blur-sm (this stylesheet loads
   after the bundle). */
.code-card {
  position: relative;   /* anchors the ::after glint overlay */
  background: linear-gradient(155deg, rgba(var(--accent-rgb), .12) 0%, rgba(var(--accent-rgb), .05) 46%, rgba(255, 255, 255, .025) 100%);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-color: rgba(var(--accent-rgb), .26);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .22), 0 0 16px -4px rgba(var(--accent-rgb), .34), 0 10px 26px -16px rgba(0, 0, 0, .7);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.code-card:hover {
  border-color: rgba(var(--accent-rgb), .62);
  background: linear-gradient(155deg, rgba(var(--accent-rgb), .26) 0%, rgba(var(--accent-rgb), .11) 50%, rgba(255, 255, 255, .035) 100%);
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .3), 0 0 30px -2px rgba(var(--accent-rgb), .6), 0 18px 38px -14px rgba(var(--accent-rgb), .5);
}
.code-card:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .6); outline-offset: 1px; }

/* Number square — a glossy, glowing accent glass chip: top-lit accent gradient
   fill, a bright inset top edge + accent ring, an outer accent glow, and a faint
   text-glow on the number. Glows harder with the card on hover. */
.code-card-badge {
  position: relative;   /* anchors the .code-card-idx lesson-number tag */
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .44) 0%, rgba(var(--accent-rgb), .16) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgb(var(--accent-rgb));
  text-shadow: 0 0 10px rgba(var(--accent-rgb), .45);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .35), inset 0 0 0 1px rgba(var(--accent-rgb), .42), 0 0 12px -2px rgba(var(--accent-rgb), .5);
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.code-card:hover .code-card-badge {
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .58) 0%, rgba(var(--accent-rgb), .24) 100%);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .45), inset 0 0 0 1px rgba(var(--accent-rgb), .6), 0 0 18px 0 rgba(var(--accent-rgb), .7);
  transform: scale(1.07) rotate(-4deg);   /* the icon "wakes up" with the card */
}

/* Chevron in a rimmed glass circle — a real "go" affordance anchoring the
   card's right edge (a bare 16px chevron read as a stray tick once the tiles
   went single-line). Fills with accent + a soft glow on hover. The width/height
   override the template's h-4/w-4 (this sheet loads after the bundle); the
   16px glyph keeps its size inside the 28px ring (border-box: 28 − 2·6). */
.code-card-chevron {
  width: 1.75rem;
  height: 1.75rem;
  padding: .34rem;
  border-radius: 9999px;
  border: 1px solid rgba(var(--accent-rgb), .32);
  background: rgba(var(--accent-rgb), .10);
  color: rgba(var(--accent-rgb), .8);
  transition: color .18s ease, transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.code-card:hover .code-card-chevron {
  color: #fff;
  background: rgba(var(--accent-rgb), .30);
  border-color: rgba(var(--accent-rgb), .75);
  box-shadow: 0 0 12px -2px rgba(var(--accent-rgb), .65);
  transform: translateX(2px);
}

/* Lesson number — an index tag pinned to the icon tile's top-left corner, so
   the plain numeral (1, 2, 3 …) reads as part of the button's focal element
   instead of floating between the icon and the title. This lets every card —
   numbered lesson and bookend alike — share the clean [badge][title] rhythm.
   A dark, accent-ringed chip keeps the number legible over the icon's glow;
   it brightens (accent fill, white digit) with the card on hover. Bookend
   tiles (about/setup/resources) sit outside the sequence and render none. */
.code-card-idx {
  position: absolute;
  top: -0.4rem;
  left: -0.4rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.22rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.42rem;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgb(var(--accent-rgb));
  background: rgba(6, 10, 22, 0.92);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.55), 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}
.code-card:hover .code-card-idx {
  color: #fff;
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .95), rgba(var(--accent-rgb), .68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 10px -1px rgba(var(--accent-rgb), .7);
}

/* ---- Lesson-tile motion ----
   1. Hover GLINT: a light band sweeps across the glass once per hover — an
      ::after overlay animating background-position (no overflow clipping, so
      the card's outer glow and the badge glow stay intact; pointer-events off,
      and passing OVER the content is exactly how a glass glint reads).
      background-size 200% ⇒ position 200%→-100% carries the band fully
      off-left → fully off-right.
   2. Unfold STAGGER: when a course (or practice panel) opens, its tiles rise
      in sequentially — --i is set inline per card; delays are capped via min()
      so a 26-lesson course doesn't crawl. fill-mode backwards (not both) keeps
      cards hidden through their delay yet releases transform for hover after. */
.code-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .15) 50%, transparent 58%);
  background-size: 200% 100%;
  background-position: 200% 0;
  opacity: 0;
}
.code-card:hover::after { animation: code-card-glint .7s ease-out .05s 1 both; }
@keyframes code-card-glint {
  0%   { opacity: 0; background-position: 200% 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; background-position: -100% 0; }
}
.code-course[open] .code-course-body .code-card,
.code-practice-body.is-open .code-card {
  animation: code-card-in .38s cubic-bezier(.22, .9, .32, 1) backwards;
  animation-delay: calc(40ms + min(var(--i, 0), 18) * 22ms);
}
@keyframes code-card-in {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
}
@media (prefers-reduced-motion: reduce) {
  .code-card:hover::after,
  .code-course[open] .code-course-body .code-card,
  .code-practice-body.is-open .code-card { animation: none; }
  .code-card:hover,
  .code-card:hover .code-card-badge,
  .code-card:hover .code-card-chevron { transform: none; }
}

.code-course-label { color: rgb(var(--accent-rgb)); }   /* section label, colored to its block */

/* ---- Landing index: collapsible course accordion ----
   Each course is a <details> styled as a SUBTLE glass card — a faint neutral
   fill + a low-alpha accent border — so the header reads as a card without
   competing with the inner .code-card lesson tiles (avoid glass-on-glass). The
   accent (per [data-course]) colours the title, the lesson-count pill, and the
   chevron. No backdrop-filter here: the closed list is small and the subtle fill
   is enough; the frosted glass stays reserved for the lesson tiles. */
.code-course {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, .02) 100%);
  border-color: rgba(var(--accent-rgb), .2);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .04), 0 8px 24px -18px rgba(0, 0, 0, .8);
  transition: border-color .18s ease, background .18s ease;
}
/* Brighten the (rounded) card on header hover via :has, so the fill follows the
   border radius — a summary:hover background would square off the top corners
   since the <details> is intentionally not overflow-hidden. */
.code-course:has(> summary:hover) {
  border-color: rgba(var(--accent-rgb), .34);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .08) 0%, rgba(var(--accent-rgb), .03) 100%);
}
.code-course[open] { border-color: rgba(var(--accent-rgb), .3); }

.code-course-count {
  color: rgb(var(--accent-rgb));
  background: rgba(var(--accent-rgb), .12);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .24);
}
.code-course-chevron { color: rgba(var(--accent-rgb), .6); }
.code-course[open] .code-course-chevron,
.code-course:has(> summary:hover) .code-course-chevron { color: rgb(var(--accent-rgb)); }

/* ---- Landing index: Resources button + overlay ----
   The button sits in the header row, left of the lesson-count pill, and appears
   only once the course is unfolded. It carries the course accent (it's inside
   [data-course]); the <dialog> does too (it's a DOM child of <details data-course>,
   so --accent-rgb cascades even though showModal() promotes it to the top layer). */
.code-course-resources-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .55rem;
  border-radius: .375rem;
  font-size: .75rem;
  font-weight: 600;
  color: rgb(var(--accent-rgb));
  background: rgba(var(--accent-rgb), .12);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .24);
  transition: background .15s ease, box-shadow .15s ease;
}
.code-course-resources-btn:hover {
  background: rgba(var(--accent-rgb), .2);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .4);
}
.code-course-resources-btn:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .6); outline-offset: 1px; }
.code-course-resources-btn svg { width: .9rem; height: .9rem; }
/* "Appears when one unfolds the course" — hidden while collapsed. */
.code-course:not([open]) .code-course-resources-btn { display: none; }
@media (max-width: 480px) { .code-course-resources-label { display: none; } }

/* The unfolded content area is the positioning context for the Resources panel,
   so the panel overlays the lesson grid (not the whole viewport). */
.code-course-body { position: relative; }
.code-resources-pop {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 30;
  width: min(23rem, calc(100% - 1rem));
  max-height: min(70vh, 30rem);
  overflow-y: auto;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: .9rem;
  color: #e2e8f0;
  /* Accent-tinted glass — the page/cards frost through behind it. */
  background: linear-gradient(162deg, rgba(var(--accent-rgb), .16) 0%, rgba(13, 21, 40, .9) 58%);
  backdrop-filter: blur(22px) saturate(155%);
  -webkit-backdrop-filter: blur(22px) saturate(155%);
  border: 1px solid rgba(var(--accent-rgb), .34);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .08),
              0 22px 48px -18px rgba(0, 0, 0, .8),
              0 0 36px -12px rgba(var(--accent-rgb), .4);
  /* Closed → unfolds from the button (top-right) on .is-open. */
  transform-origin: top right;
  transform: translateY(-8px) scale(.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .2s cubic-bezier(.2, .8, .2, 1), visibility .2s;
}
.code-resources-pop.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .code-resources-pop { transition: opacity .12s ease, visibility .12s; transform: none; }
}
.code-resources-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: .5rem;
  color: #e2e8f0;
  transition: background .12s ease, color .12s ease;
}
.code-resources-close:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.code-resources-close svg { width: 1rem; height: 1rem; }
.code-resources-title {
  font-family: "Sora", "Sora Fallback", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0 1.75rem .9rem 0;     /* right margin clears the ✕ */
}
.code-resources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.code-resources-link {
  display: block;
  padding: .6rem .7rem;
  border-radius: .6rem;
  background: rgba(255, 255, 255, .03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  text-decoration: none;
  transition: background .14s ease, box-shadow .14s ease, transform .14s ease;
}
.code-resources-link:hover {
  background: rgba(var(--accent-rgb), .1);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .4);
  transform: translateY(-1px);
}
.code-resources-link:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .6); outline-offset: 1px; }
.code-resources-link-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .9rem;
  font-weight: 600;
  color: #e2e8f0;
}
.code-resources-link:hover .code-resources-link-title { color: #fff; }
.code-resources-ext { width: .8rem; height: .8rem; flex-shrink: 0; color: rgb(var(--accent-rgb)); }
.code-resources-note { display: block; margin-top: .15rem; font-size: .78rem; color: #e2e8f0; }
.code-resources-seeall {
  display: inline-block;
  margin-top: 1rem;
  font-size: .82rem;
  font-weight: 600;
  color: rgb(var(--accent-rgb));
  text-decoration: none;
}
.code-resources-seeall:hover { filter: brightness(1.15); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Landing index: Practice tracks (fixed button row + unfolding bodies) ----
   Three language buttons stay on one line in .code-practice-row; clicking one
   (aria-expanded) reveals its challenges full-width in .code-practice-bodies BELOW
   the row, independently — the other buttons never move. The buttons reuse the
   .code-course card surface; data-course carries the per-language --accent-rgb. */
.code-practice { margin-top: 2.5rem; }
.code-practice-head { margin-bottom: 1rem; max-width: 48rem; }
.code-practice-head h2 {
  font-family: "Sora", "Sora Fallback", system-ui, sans-serif;
  font-size: 1.5rem; line-height: 2rem; font-weight: 600;
  letter-spacing: -0.015em; color: #fff;
}
.code-practice-head p { margin-top: .25rem; font-size: .875rem; line-height: 1.4rem; color: #e2e8f0; }

/* Three buttons on one line, always (stack only on phones). */
.code-practice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  align-items: start;
}
@media (max-width: 640px) { .code-practice-row { grid-template-columns: 1fr; } }

/* The <button> reuses .code-course's card surface; these add the button reset plus
   the hover/open states .code-course normally gets from summary:hover and [open]
   (neither applies to a <button>). */
.code-practice-card {
  width: 100%; text-align: left; font: inherit; color: inherit;
  -webkit-appearance: none; appearance: none;
}
.code-practice-card:hover {
  border-color: rgba(var(--accent-rgb), .34);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .08) 0%, rgba(var(--accent-rgb), .03) 100%);
}
.code-practice-card[aria-expanded="true"] { border-color: rgba(var(--accent-rgb), .3); }
.code-practice-card[aria-expanded="true"] .code-course-chevron {
  transform: rotate(90deg); color: rgb(var(--accent-rgb));
}

/* Bodies unfold full-width below the row; only open ones show. Bespoke class (not
   Tailwind .hidden — see the layer gotcha); multiple may be open and stack here. */
.code-practice-bodies { margin-top: .75rem; display: flex; flex-direction: column; gap: .75rem; }
.code-practice-body { display: none; }
.code-practice-body.is-open { display: block; }

.code-practice-stars {
  margin-top: .15rem; font-size: .8rem; letter-spacing: .08em;
  color: #fbbf24;   /* amber-400 — difficulty stars read consistently across tracks */
  white-space: nowrap;
}

/* ---- Reference overlay ------------------------------------------------------
   The header "Reference" button opens this modal <dialog> in place (see
   code-playground.js). Mirrors the practice page's knowledge-base overlay
   (.handout-dialog* in eXam/practice_take.html) so the two read the same; the
   body wrapper .learn-content-body comes from the conditionally-loaded
   06-landing.css. Panel bg == .learn-content-body bg (rgb(3,9,26)) so the
   rendered handout has no visible edge inside the frame. */
.code-reference-dialog {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0; color: inherit;
  width: min(880px, 94vw); max-width: 94vw; max-height: 86vh; overflow-y: auto; scrollbar-gutter: stable;
  border-radius: 1.25rem;
  background: rgb(3, 9, 26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 70px -24px rgba(0, 0, 0, 0.72),
    0 0 100px -30px rgba(34, 211, 238, 0.15);
}
.code-reference-dialog::backdrop {
  background: rgba(1, 4, 14, 0.74);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  animation: code-ref-fade 0.2s ease;
}
.code-reference-dialog[open] { margin: auto; animation: code-ref-pop 0.24s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes code-ref-pop  { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes code-ref-fade { from { opacity: 0; } to { opacity: 1; } }
.code-reference-dialog-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.95rem 2rem 0.95rem 3rem; border-radius: 1.25rem 1.25rem 0 0;
  background: linear-gradient(to bottom, rgb(8, 16, 36), rgb(3, 9, 26));
}
.code-reference-dialog-head::after {
  content: ""; position: absolute; left: 3rem; right: 2rem; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12) 18%, rgba(255, 255, 255, 0.12) 82%, transparent);
}
.code-reference-dialog-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 1.65rem; height: 1.65rem; border-radius: 0.55rem;
  color: rgb(165, 243, 252); background: rgba(34, 211, 238, 0.10);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.22);
}
.code-reference-dialog-title { flex: 1 1 auto; }
.code-reference-dialog-body { padding: 1.15rem 2rem 1.75rem 3rem; }
.code-reference-dialog-close {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 1.85rem; height: 1.85rem; border-radius: 0.6rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
.code-reference-dialog-close:hover { background: rgba(255, 255, 255, 0.09); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.code-reference-dialog-close:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.6); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .code-reference-dialog[open], .code-reference-dialog::backdrop { animation: none; }
}

/* ---- Landing: course list as a 2-up grid (1 col on phones) ----
   Collapsed courses sit two-per-row for a denser overview; an OPENED course spans
   the full width so its lesson grid keeps room for up to 3 columns. align-items:start
   so a collapsed card never stretches to match a taller (open) neighbour. */
.code-course-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
@media (min-width: 768px) {
  .code-course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .code-course-grid > details[open] { grid-column: 1 / -1; }
}

/* ==========================================================================
   Club plan (plans/2026-09-15-programming-club-code-page.md): input() awareness,
   error cards, hint levels, stuck nudges, stretch/project badges.
   ========================================================================== */

/* ---- input(): the program is waiting for the keyboard ---- */
.code-input-banner {
  display: flex; align-items: center; gap: .55rem;
  margin-top: .5rem; padding: .5rem .75rem;
  border-radius: .6rem;
  background: rgba(34, 211, 238, .12);
  border: 1px solid rgba(34, 211, 238, .5);
  color: #a5f3fc; font-size: .95rem; font-weight: 600; line-height: 1.4;
  animation: code-wait-pulse 1.4s ease-in-out 3;
}
.code-input-banner svg { width: 22px; height: 22px; flex: none; color: #67e8f9; }
.code-input-banner.is-nudge { animation: code-wait-pulse 1s ease-in-out 3; }
/* A task's console, or the output box under a prose example (/code lessons, /know/reference). */
.code-console.is-waiting,
.code-prose .code-example-output.is-waiting {
  border-color: rgba(34, 211, 238, .65);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
}
.code-console .code-console-input.is-waiting,
.code-prose .code-example-output .code-console-input.is-waiting {
  width: 34ch;                 /* the placeholder "type here, then press Enter ↵" must fit */
  padding: 0 .35rem;
  border-radius: .25rem;
  background: rgba(34, 211, 238, .12);
  outline: 1px dashed rgba(34, 211, 238, .75);
}
.code-console-input::placeholder { color: #5eead4; opacity: .8; }
.code-waiting-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .65rem; border-radius: 9999px;
  font-size: .78rem; font-weight: 600; color: #67e8f9;
  background: rgba(34, 211, 238, .12); border: 1px solid rgba(34, 211, 238, .35);
}
.code-waiting-pill svg { width: 15px; height: 15px; }
@keyframes code-wait-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
  50%      { box-shadow: 0 0 0 7px rgba(34, 211, 238, .2); }
}

/* Java / C: "this program reads input" panel before a free run. */
.code-stdin-panel {
  margin-top: .5rem; padding: .6rem .75rem; border-radius: .6rem;
  background: rgba(34, 211, 238, .07); border: 1px solid rgba(34, 211, 238, .38);
  color: #cffafe; font-size: .88rem;
}
.code-stdin-panel-title { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: #67e8f9; }
.code-stdin-panel-title svg { width: 18px; height: 18px; }
.code-stdin-panel p { margin: .2rem 0 .45rem; color: #e2e8f0; }
.code-stdin-panel textarea {
  display: block; width: 100%; min-height: 4.2rem; resize: vertical;
  padding: .4rem .55rem; border-radius: .4rem;
  background: #05070f; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, .3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem;
}
.code-stdin-panel textarea:focus { outline: none; border-color: rgba(34, 211, 238, .7); }
.code-stdin-panel-actions { display: flex; gap: .45rem; margin-top: .5rem; flex-wrap: wrap; }

/* "Check types this input for your program" above a verdict. */
.code-result-stdin { margin-bottom: .3rem; font-size: .78rem; color: #e2e8f0; }
.code-result-stdin code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: .05rem .35rem; border-radius: .25rem; background: rgba(2, 6, 23, .5); color: #e2e8f0; white-space: pre-wrap;
}

/* ---- Error explanation card ---- */
.code-error-card {
  margin-top: .5rem; padding: .6rem .8rem; border-radius: .6rem;
  background: rgba(251, 146, 60, .09); border: 1px solid rgba(251, 146, 60, .38);
  color: #fed7aa; font-size: .9rem; line-height: 1.55;
}
.code-error-card-head { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: #fdba74; }
.code-error-card-head svg { width: 18px; height: 18px; flex: none; }
.code-error-card-tag { margin-left: auto; font-size: .7rem; font-weight: 600; color: #fb923c; opacity: .8; }
.code-error-card-body { margin-top: .2rem; }
.code-error-card-body p { margin: 0 0 .3rem; }
.code-error-card-body p:last-child { margin-bottom: 0; }
.code-error-card-zh { color: #fde2c4; }
.code-error-card-line { font-weight: 600; color: #fde68a; }
.code-error-card code, .code-error-card-ai code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em;
  padding: .05rem .3rem; border-radius: .25rem; background: rgba(2, 6, 23, .45); color: #fff7ed;
}
.code-error-card-ai { margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed rgba(251, 146, 60, .32); color: #ffedd5; }
.code-error-card-ai.is-pending { color: #e2e8f0; }
/* The AI half is unavailable (no key, provider refused, offline). The free catalogue
   card above is unaffected — this line only explains the gap, so it stays quiet. */
.code-error-card-ai-off { color: #e2e8f0; }
.code-error-card-ai p { margin: 0 0 .3rem; }
.code-error-card-ai p:last-child { margin-bottom: 0; }
.code-error-card-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .45rem; }
.code-btn-teacher { background: rgba(244, 114, 182, .14); color: #f9a8d4; border-color: rgba(244, 114, 182, .35); }
.code-btn-teacher:hover:not(:disabled) { background: rgba(244, 114, 182, .24); color: #fbcfe8; }
.CodeMirror .code-error-line { background: rgba(248, 113, 113, .16); }
.CodeMirror .code-error-token { text-decoration: underline wavy #f87171; text-underline-offset: 3px; }
/* A short note pinned under the exact spot (CodeMirror addWidget); click to dismiss. */
.code-error-bubble-row { padding: 8px 0 4px; }
.code-error-bubble {
  position: relative; display: inline-block; max-width: min(18rem, 75vw);
  padding: .3rem .6rem; border-radius: .5rem; cursor: pointer;
  font: 600 .78rem/1.35 system-ui, sans-serif; white-space: normal;
  color: #fff1f2; background: #b91c1c; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  animation: code-bubble-in .18s ease-out;
}
.code-error-bubble::before {
  content: ""; position: absolute; top: -6px; left: var(--arrow-x, 8px);
  border: 6px solid transparent; border-top: 0; border-bottom-color: #b91c1c;
}
@keyframes code-bubble-in { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .code-error-bubble { animation: none; } }

/* ---- Hint levels and stuck nudges ---- */
.code-hint-level {
  display: block; margin-bottom: .15rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fbbf24;
}
.code-hint-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .45rem; }
.code-hint-actions .code-btn.is-locked { opacity: .55; cursor: not-allowed; }
.code-hint-lock { align-self: center; font-size: .82rem; opacity: .8; }
.code-hint-line { margin-top: .4rem; }
.code-hint-line code { padding: .1rem .35rem; border-radius: .3rem; background: rgba(250, 204, 21, .12); white-space: pre-wrap; }
.code-hint-panel .code-hint-note { margin-top: .45rem; font-size: .8rem; color: #e2e8f0; }
.code-result .code-result-unchanged { margin: 0 0 .4rem; font-size: .8rem; font-weight: 600; color: #fcd34d; }
.code-btn-hint.is-nudging { animation: code-hint-nudge 1.1s ease-in-out 5; }
@keyframes code-hint-nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
  50%      { box-shadow: 0 0 0 7px rgba(251, 191, 36, .3); }
}
.code-nudge-tip { font-size: .78rem; font-weight: 600; color: #fcd34d; }

/* ---- Stretch task / project badges ---- */
.code-task-badge {
  display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .35rem;
  padding: .12rem .55rem; border-radius: 9999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: #fde68a; background: rgba(250, 204, 21, .12); border: 1px solid rgba(250, 204, 21, .38);
}
.code-task-badge svg { width: 13px; height: 13px; }
.code-task.is-stretch { border-color: rgba(250, 204, 21, .28); }
[data-lock-card].is-locked { opacity: .55; }
.code-card-lock { display: block; font-size: .7rem; color: #e2e8f0; }

@media (prefers-reduced-motion: reduce) {
  .code-input-banner, .code-input-banner.is-nudge, .code-btn-hint.is-nudging { animation: none; }
}
/* A drill whose prerequisite lesson is unfinished. Revealed by code-requires.js only
   when it is genuinely unmet; the lesson body (data-lesson-work) is hidden with it. */
.code-prereq { margin: .9rem 0 0; padding: .6rem .8rem; border-radius: .6rem;
  border: 1px solid rgba(251,146,60,.30); background: rgba(251,146,60,.08);
  color: #fed7aa; font-size: .9rem; line-height: 1.5; }
.code-prereq[hidden] { display: none; }
[data-lesson-work][hidden] { display: none; }
.code-prereq-link { display: inline-block; margin-left: .4rem; color: #fdba74;
  font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.code-prereq-link:hover { color: #fff; }
/* A Chinese-keyboard mark in student code, underlined before Run so it is never sent to Python. */
.cm-code-cn-punct, .code-cn-punct { border-bottom: 2px solid #fb7185; }

/* Shown under a failed verdict when the very same code was checked again — the point is
   to say something NEW, since repeating the verdict is what produced 1,183 rage clicks. */
.code-result-note { margin-top: .45rem; font-size: .86rem; line-height: 1.45;
  color: #fcd34d; font-weight: 500; }
.code-result-viz { display: inline-block; margin-top: .4rem; padding: .25rem .6rem;
  border-radius: .45rem; border: 1px solid rgba(56,189,248,.40);
  background: rgba(56,189,248,.10); color: #7dd3fc; font-size: .85rem; font-weight: 600; }
.code-result-viz:hover { background: rgba(56,189,248,.20); color: #e0f2fe; }

/* ---- Course hubs: curriculum discovery and private progress ---- */
.code-track-switcher { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.code-track-switcher a { padding: .5rem .8rem; border: 1px solid rgba(148, 163, 184, .4); border-radius: .5rem; color: #7dd3fc; font-size: .85rem; }
.code-track-switcher a[aria-current] { border-color: #22d3ee; text-decoration: underline; text-underline-offset: .2em; }
.code-hub-card.is-locked { opacity: 1; }
.code-course-progress progress { appearance: none; border: 1px solid rgba(148, 163, 184, .4); border-radius: 999px; overflow: hidden; background: transparent; }
.code-course-progress progress::-webkit-progress-bar { background: transparent; }
.code-course-progress progress::-webkit-progress-value { background: #22d3ee; border-radius: 999px; }
.code-course-progress progress::-moz-progress-bar { background: #22d3ee; border-radius: 999px; }
.code-pathways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; padding: 1.25rem; margin-bottom: 2rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: 1rem; }
.code-pathways h2 { grid-column: 1 / -1; font-size: 1.1rem; font-weight: 600; color: #e2e8f0; }
.code-pathways a { display: flex; flex-direction: column; gap: .4rem; padding: .8rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: .75rem; }
.code-pathways strong, .code-course-overview { color: #7dd3fc; }
.code-pathways span { font-size: .85rem; color: #e2e8f0; }
.code-course-overview { display: inline-block; margin: .25rem 0 1rem; text-decoration: underline; text-underline-offset: .2em; font-size: .9rem; }
.code-course-progress { margin-top: 1.25rem; padding: 1rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: .75rem; color: #e2e8f0; font-size: .9rem; }
.code-course-progress progress { width: 100%; height: .65rem; margin-top: .65rem; accent-color: #22d3ee; }
/* Each label + control is one field in a wrapping row (search twice as wide), so a filter added
   later gets its own cell (Stage and Topic once all sat in one cell over Show, 11-27). */
.code-course-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin: 1rem 0; padding: 1rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: .75rem; }
.code-filter-field { display: flex; flex: 1 1 9.5rem; flex-direction: column; gap: .4rem; min-width: 0; }
.code-filter-field--search { flex: 2 1 17rem; }
.code-course-filters label { font-size: .85rem; color: #e2e8f0; }
.code-course-filters input, .code-course-filters select { min-width: 0; width: 100%; padding: .65rem; border: 1px solid rgba(148, 163, 184, .4); border-radius: .5rem; color: #e2e8f0; background: var(--reading-surface, #01040e); }
.code-course-filters p { flex: 1 1 100%; color: #e2e8f0; font-size: .8rem; }
.code-hub-card { flex-wrap: wrap; align-content: flex-start; }
.code-hub-card.is-complete { border-color: rgba(52, 211, 153, .6); }
.code-hub-status { display: block; margin-top: .35rem; font-size: .8rem; color: #e2e8f0; }
.code-hub-card.is-complete .code-hub-status { color: #6ee7b7; }
.code-hub-prerequisites { width: 100%; padding: 0 1rem .8rem; font-size: .8rem; color: #e2e8f0; }
.code-hub-prerequisites a { display: block; margin-top: .35rem; color: #7dd3fc; text-decoration: underline; text-underline-offset: .2em; }
.code-course-hub :is(a, input, select):focus-visible, .code-pathways a:focus-visible { outline: 2px solid #38bdf8; outline-offset: 3px; }
.code-course-progress[hidden], .code-course-filters[hidden], .code-hub-card[hidden] { display: none; }
html.space-root:not([data-theme="light"]) :is(.code-course, .code-course-body, .code-card, .code-task, .code-result, .code-hint-panel, .code-error-card, .code-resources-pop, .code-resources-link, .code-reference-dialog, .code-reference-dialog-head, .code-prereq, .code-pathways, .code-hub-card) { background: var(--reading-surface, #01040e); }
@media (max-width: 600px) {
  .code-pathways { grid-template-columns: 1fr; }
}

/* Course hubs and the next-step choices share readable, responsive cards. */
.code-course-hub { width: 100%; max-width: 60rem; margin-inline: auto; }
.code-hub-card { min-height: 5.25rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .14); }
.code-hub-title { line-height: 1.5; overflow-wrap: anywhere; }
.code-course-start { color: #a5f3fc; border-color: rgba(34, 211, 238, .45); }
.code-pathways { gap: 1rem; border-color: rgba(125, 211, 252, .3); }
.code-pathways a { --pathway-accent: 56, 189, 248; position: relative; padding: 1.1rem; gap: .65rem; border-color: rgba(var(--pathway-accent), .4); border-top-width: 3px; background: linear-gradient(135deg, var(--reading-surface, #01040e), #000 90%); box-shadow: inset 0 1px rgba(var(--pathway-accent), .24), inset 0 -1px rgba(var(--pathway-accent), .12), 0 6px 18px -8px rgba(var(--pathway-accent), .35); transition: transform .18s ease, border-color .18s ease; }
.code-pathways a:nth-of-type(2) { --pathway-accent: 129, 140, 248; }
.code-pathways a:nth-of-type(3) { --pathway-accent: 192, 132, 252; }
.code-pathways a:hover { transform: translateY(-2px); border-color: rgb(var(--pathway-accent)); }
.code-pathways strong { color: rgb(var(--pathway-accent)); font-size: 1rem; }
.code-pathways .code-pathway-icon { color: rgb(var(--pathway-accent)); display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid rgba(var(--pathway-accent), .4); border-radius: .65rem; background: linear-gradient(135deg, rgba(var(--pathway-accent), .26), rgba(var(--pathway-accent), .08)); box-shadow: inset 0 1px rgba(var(--pathway-accent), .25); }
.code-pathway-icon svg { width: 1.5rem; height: 1.5rem; }
@media (prefers-reduced-motion: reduce) { .code-pathways a { transition: none; } .code-pathways a:hover { transform: none; } }

/* Course discovery: distinct header, controls and lesson cards. */
html.space-root:not([data-theme="light"]) #site-main :is(.code-course-hub, .code-lesson) { background: transparent; }
.code-course-hub { max-width: 54rem; }
.code-course-hub > header { padding: 1.5rem; border: 1px solid rgb(56 189 248 / .3); border-left: 3px solid #38bdf8; border-radius: 1rem; background: var(--reading-surface, #01040e); box-shadow: 0 6px 20px -12px rgb(56 189 248 / .35); }
.code-course-hub .code-track-switcher a { font-weight: 600; border-radius: .75rem; background: var(--reading-surface, #01040e); box-shadow: inset 0 1px rgb(148 163 184 / .12); }
.code-course-hub .code-track-switcher a[aria-current] { border-color: #38bdf8; box-shadow: inset 0 -3px #38bdf8, 0 3px 12px -8px #38bdf8; text-decoration: none; }
.code-course-hub :is(.code-course-progress, .code-course-filters) { border-color: rgb(125 211 252 / .24); background: var(--reading-surface, #01040e); }
.code-course-hub [data-course-lessons] { gap: .75rem; }
.code-course-hub .code-hub-card { --hub-accent: 56 189 248; border-color: rgb(var(--hub-accent) / .32); border-left-width: 3px; box-shadow: inset 0 1px rgb(var(--hub-accent) / .12), 0 5px 12px -10px rgb(var(--hub-accent) / .6); transition: border-color .18s ease, transform .18s ease; }
.code-course-hub .code-hub-card[data-difficulty="2"] { --hub-accent: 96 165 250; }
.code-course-hub .code-hub-card[data-difficulty="3"] { --hub-accent: 167 139 250; }
.code-course-hub .code-hub-card[data-difficulty="4"] { --hub-accent: 244 114 182; }
.code-course-hub .code-hub-card[data-difficulty="5"] { --hub-accent: 251 146 60; }
html.space-root:not([data-theme="light"]) .code-course-hub .code-hub-card { background: linear-gradient(135deg, color-mix(in srgb, rgb(var(--hub-accent)) 12%, var(--reading-surface)), color-mix(in srgb, rgb(var(--hub-accent)) 4%, var(--reading-surface)) 95%); }
.code-course-hub .code-hub-card:hover { border-color: rgb(var(--hub-accent) / .7); transform: translateY(-1px); }
.code-course-hub .code-hub-card.is-complete { border-color: #34d399; }
.code-course-hub .code-hub-number { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid rgb(var(--hub-accent) / .32); background: linear-gradient(135deg, rgb(var(--hub-accent) / .22), rgb(var(--hub-accent) / .07)); color: rgb(var(--hub-accent)); }
.code-course-hub .code-hub-title { font-weight: 600; font-size: .9375rem; }
@media (max-width: 767px) { .code-course-hub > header { padding: 1.1rem; } }
@media (prefers-reduced-motion: reduce) { .code-course-hub .code-hub-card { transition: none; } .code-course-hub .code-hub-card:hover { transform: none; } }

.code-hub-number svg { width: 1.5rem; height: 1.5rem; }
.code-lesson .code-step { --step-accent: 56 189 248; }
.code-lesson .code-step:nth-child(5n + 2) { --step-accent: 129 140 248; }
.code-lesson .code-step:nth-child(5n + 3) { --step-accent: 192 132 252; }
.code-lesson .code-step:nth-child(5n + 4) { --step-accent: 244 114 182; }
.code-lesson .code-step:nth-child(5n + 5) { --step-accent: 251 178 52; }
.code-lesson .code-step.is-stretch { --step-accent: 251 178 52; }
.code-lesson .code-step.code-session-done { --step-accent: 52 211 153; }
html.space-root:not([data-theme="light"]) #site-main .code-lesson .code-step { border-color: rgb(var(--step-accent) / .4); border-left: 3px solid rgb(var(--step-accent) / .7); background: linear-gradient(135deg, color-mix(in srgb, rgb(var(--step-accent)) 10%, var(--reading-surface)), color-mix(in srgb, rgb(var(--step-accent)) 3%, var(--reading-surface)) 95%); box-shadow: inset 0 1px rgb(var(--step-accent) / .18), 0 5px 15px -10px rgb(var(--step-accent) / .4); }
html.space-root:not([data-theme="light"]) #site-main .code-lesson .code-step .code-prose { background: transparent; }
/* Each revealed step keeps its own frame and a clear gap from the previous one. */
.code-lesson .code-steps { border: 0; border-radius: 0; overflow: visible; background: transparent; }
.code-lesson .code-step:not(.code-task) { padding: 1.2rem 1.5rem 1.5rem; border: 1px solid rgb(148 163 184 / .26); border-top-color: rgb(125 211 252 / .35); border-radius: 1rem; background: var(--reading-surface, #01040e); box-shadow: 0 5px 16px -10px rgb(0 0 0 / .8); }
.code-lesson .code-step + .code-step { margin-top: 1.25rem; }
.code-lesson .code-prose > :first-child { margin-top: 0; }
.code-lesson .code-prose > :last-child { margin-bottom: 0; }
.code-lesson .code-task { border-radius: 1rem; }
.code-lesson .code-task.code-session-done { border-color: #34d399; box-shadow: inset 4px 0 #34d399, inset 0 0 0 1px rgb(52 211 153 / .3); background: var(--reading-surface, #050914); }
.code-task.code-session-done .code-task-prompt { border-bottom: 1px solid rgb(52 211 153 / .4); padding-bottom: .65rem; }
@media (max-width: 767px) { .code-lesson .code-step:not(.code-task) { padding: 1rem; } }

/* Pseudocode workshops keep reading surfaces on the shared dark page tokens. */
.code-curriculum, .code-exam-panel {
  background: var(--reading-surface, #01040e); border: 1px solid var(--border-soft, rgba(148,163,184,.25));
  padding: 1rem; margin: 1rem 0; border-radius: .8rem; color: var(--text-primary, #e2e8f0);
}
.code-curriculum h2 { font-weight: 600; margin-bottom: .5rem; }
.code-curriculum p, .code-exam-panel p { margin: .5rem 0; line-height: 1.6; }
.code-curriculum a, .code-exam-panel a, .code-hint-panel a { color: var(--link, #67e8f9); text-decoration: underline; }
.code-curriculum-label, .code-support-status { display: block; font-size: .8rem; line-height: 1.5; color: var(--text-secondary, #94a3b8); }
.code-hint-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .75rem 0; }
.code-exam .code-step[hidden] { display: block !important; }
.code-exam .code-step { margin-bottom: 1rem; }
.code-exam .code-nav, .code-exam .code-reset, .code-exam .code-run, .code-exam .code-stop,
.code-exam .code-check { display: none !important; }
.code-exam:not(.is-reviewed) .code-hint { display: none !important; }
.code-exam .code-reference-btn { display: none !important; }
/* Phones: the lesson's actions go under the title (owner 11-27, visual scan: beside it they
   squeezed the title to a word per line and, in Russian/Thai, ran 44px off the screen). */
@media (max-width: 639px) {
  .code-lesson-head { flex-wrap: wrap; }
  .code-lesson-head > h1 { flex: 1 1 100%; }
  .code-lesson-actions { flex-wrap: wrap; flex-shrink: 1; min-width: 0; margin-top: 0; }
}
.code-practice-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.code-practice-card { grid-column: span 2; }
.code-pseudocode-card { grid-column: span 3; }
.code-pseudocode-card .code-course-label { white-space: normal; overflow-wrap: anywhere; }
.code-practice-group-label { grid-column: 1 / -1; margin-top: .75rem; }
.code-practice-group-label h3 { font-size: 1rem; font-weight: 600; }
.code-practice-group-label p { color: var(--text-secondary, #94a3b8); font-size: .875rem; }
.code-practice-card { min-width: 0; }
[data-course="practice-igcse-pseudocode"] { --accent-rgb: 129, 140, 248; }
[data-course="practice-as-pseudocode"] { --accent-rgb: 192, 132, 252; }

html.space-root:not([data-theme="light"]) #site-main .code-lesson .code-step,
html.space-root:not([data-theme="light"]) .code-course-hub .code-hub-card {
  background: var(--reading-surface, #01040e);
}
@media (max-width: 640px) { .code-practice-row { grid-template-columns: 1fr; } }



.code-reasoning label { font-weight: 600; }
.code-reasoning textarea {
  width: 100%; padding: .75rem; border: 1px solid #64748b; border-radius: .5rem;
  background: var(--reading-surface, #01040e); color: inherit; resize: vertical; line-height: 1.6;
}
.code-reflection-rubric ul { padding-left: 1.2rem; list-style: disc; line-height: 1.7; }
.code-exam:not(.is-reviewed) .code-reflection-rubric { display: none; }


@media (max-width: 640px) { .code-practice-card, .code-pseudocode-card { grid-column: 1 / -1; } }


html.space-root:not([data-theme="light"]) #site-main .code-practice-card { background: var(--reading-surface, #01040e); }

/* ---- /code landing, dark: colour and glow on the page's dark base (owner, 2026-11-15) ----
   The reading-surface rule above paints these near-black; navigation cards are not reading
   text, so their accent tint and glow are layered OVER that same dark base (never a lighter
   fill), which keeps the base rule's intent and brings back each course's colour. */
html.space-root:not([data-theme="light"]) #site-main .code-pathways {
  position: relative;
  isolation: isolate;
  padding: 1.5rem;
  border-color: rgba(125, 211, 252, .26);
  border-radius: 1.25rem;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(56, 189, 248, .16), transparent 55%),
    radial-gradient(90% 80% at 100% 0%, rgba(192, 132, 252, .15), transparent 55%),
    radial-gradient(70% 70% at 50% 120%, rgba(129, 140, 248, .12), transparent 60%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 46px -14px rgba(129, 140, 248, .5),
              0 24px 50px -30px rgba(0, 0, 0, .9);
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways::before {
  content: ""; position: absolute; z-index: -1; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(110deg, rgba(56, 189, 248, .75), rgba(129, 140, 248, .35) 45%, rgba(192, 132, 252, .75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways h2 {
  display: flex; align-items: center; gap: .65rem; font-size: 1.2rem; font-weight: 700;
  letter-spacing: -.01em; color: #f1f5f9;
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways h2::before {
  content: ""; width: .3rem; height: 1.15rem; border-radius: 9999px;
  background: linear-gradient(180deg, #38bdf8, #c084fc); box-shadow: 0 0 12px rgba(129, 140, 248, .8);
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways a {
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(var(--pathway-accent), .2) 0%, rgba(var(--pathway-accent), .07) 48%, rgba(var(--pathway-accent), .02) 100%),
    var(--reading-surface, #01040e);
  border-color: rgba(var(--pathway-accent), .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 22px -6px rgba(var(--pathway-accent), .45),
              0 12px 26px -16px rgba(0, 0, 0, .8);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways a::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .13) 50%, transparent 60%);
  background-size: 200% 100%; background-position: 200% 0;
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways a:hover::after { animation: code-card-glint .7s ease-out .05s 1 both; }
html.space-root:not([data-theme="light"]) #site-main .code-pathways a:hover {
  border-color: rgb(var(--pathway-accent));
  background:
    linear-gradient(155deg, rgba(var(--pathway-accent), .32) 0%, rgba(var(--pathway-accent), .12) 52%, rgba(var(--pathway-accent), .03) 100%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 34px -4px rgba(var(--pathway-accent), .65),
              0 18px 36px -16px rgba(var(--pathway-accent), .45);
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways .code-pathway-icon {
  background: linear-gradient(150deg, rgba(var(--pathway-accent), .48), rgba(var(--pathway-accent), .16));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 0 0 1px rgba(var(--pathway-accent), .5),
              0 0 16px -2px rgba(var(--pathway-accent), .6);
  transition: transform .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-pathways a:hover .code-pathway-icon { transform: scale(1.07) rotate(-4deg); }
html.space-root:not([data-theme="light"]) #site-main .code-pathways strong { text-shadow: 0 0 14px rgba(var(--pathway-accent), .45); }
html.space-root:not([data-theme="light"]) #site-main .code-pathways span:not(.code-pathway-icon) { color: #cbd5e1; }

/* Course rows: a tinted glass header with a soft accent glow; open, the whole card lights up. */
html.space-root:not([data-theme="light"]) #site-main .code-course {
  background:
    linear-gradient(160deg, rgba(var(--accent-rgb), .11) 0%, rgba(var(--accent-rgb), .03) 55%, rgba(var(--accent-rgb), .015) 100%),
    var(--reading-surface, #01040e);
  border-color: rgba(var(--accent-rgb), .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 18px -8px rgba(var(--accent-rgb), .45),
              0 10px 24px -18px rgba(0, 0, 0, .85);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course:has(> summary:hover) {
  border-color: rgba(var(--accent-rgb), .55);
  background:
    linear-gradient(160deg, rgba(var(--accent-rgb), .18) 0%, rgba(var(--accent-rgb), .06) 55%, rgba(var(--accent-rgb), .02) 100%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 28px -6px rgba(var(--accent-rgb), .55),
              0 14px 30px -18px rgba(0, 0, 0, .9);
}
html.space-root:not([data-theme="light"]) #site-main .code-course[open] {
  border-color: rgba(var(--accent-rgb), .55);
  background:
    radial-gradient(90% 320px at 0% 0%, rgba(var(--accent-rgb), .22), transparent 70%),
    radial-gradient(70% 260px at 100% 100%, rgba(var(--accent-rgb), .13), transparent 70%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 1px rgba(var(--accent-rgb), .12),
              0 0 44px -10px rgba(var(--accent-rgb), .55), 0 24px 50px -28px rgba(0, 0, 0, .95);
}
html.space-root:not([data-theme="light"]) #site-main .code-course[open] > summary {
  border-radius: 1rem 1rem 0 0;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .16), rgba(var(--accent-rgb), .03) 70%, transparent);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-body {
  background: transparent;
  border-top-color: rgba(var(--accent-rgb), .28);
  padding: 1rem;
}
html.space-root:not([data-theme="light"]) #site-main .code-course[open] .code-course-icon {
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .45), rgba(var(--accent-rgb), .15));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 16px -2px rgba(var(--accent-rgb), .6);
}
html.space-root:not([data-theme="light"]) #site-main .code-course[open] .code-course-label { text-shadow: 0 0 16px rgba(var(--accent-rgb), .5); }
html.space-root:not([data-theme="light"]) #site-main .code-course-overview {
  display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .9rem; padding: .3rem .75rem;
  border-radius: 9999px; font-size: .85rem; font-weight: 600; text-decoration: none;
  color: rgb(var(--accent-rgb)); background: rgba(var(--accent-rgb), .1);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35);
  transition: background .18s ease, box-shadow .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course-overview:hover {
  background: rgba(var(--accent-rgb), .2); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .6), 0 0 16px -4px rgba(var(--accent-rgb), .6);
}

/* Lesson tiles: the frosted accent glass from .code-card, on the dark base. */
html.space-root:not([data-theme="light"]) #site-main .code-card {
  background:
    linear-gradient(155deg, rgba(var(--accent-rgb), .2) 0%, rgba(var(--accent-rgb), .07) 46%, rgba(255, 255, 255, .02) 100%),
    var(--reading-surface, #01040e);
  border-color: rgba(var(--accent-rgb), .34);
}
html.space-root:not([data-theme="light"]) #site-main .code-card:hover {
  background:
    linear-gradient(155deg, rgba(var(--accent-rgb), .3) 0%, rgba(var(--accent-rgb), .12) 50%, rgba(255, 255, 255, .03) 100%),
    var(--reading-surface, #01040e);
}
@media (prefers-reduced-motion: reduce) {
  html.space-root:not([data-theme="light"]) #site-main .code-pathways a:hover::after { animation: none; }
  html.space-root:not([data-theme="light"]) #site-main .code-pathways a:hover .code-pathway-icon { transform: none; }
}

/* ---- /code/<course> hubs, dark: the course's colour and glow on the dark base (owner, 2026-11-15).
   The article carries data-course, so --accent-rgb is the course's own colour; lesson cards keep
   their per-lesson --hub-accent. Tints sit over --reading-surface, never a lighter fill. */
html.space-root:not([data-theme="light"]) #site-main .code-course-hub > header {
  position: relative; isolation: isolate; overflow: hidden;
  border-color: rgba(var(--accent-rgb), .4); border-left-color: rgb(var(--accent-rgb));
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(var(--accent-rgb), .32), transparent 60%),
    radial-gradient(80% 120% at 100% 100%, rgba(129, 140, 248, .14), transparent 60%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 44px -14px rgba(var(--accent-rgb), .6),
              0 22px 48px -30px rgba(0, 0, 0, .9);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub > header h1 span { filter: drop-shadow(0 0 18px rgba(var(--accent-rgb), .35)); }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub > header p:last-child span {
  background: rgba(var(--accent-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .3);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-track-switcher a {
  color: rgb(var(--accent-rgb)); border-color: rgba(var(--accent-rgb), .35);
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .12), rgba(var(--accent-rgb), .03)), var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-track-switcher a:hover {
  border-color: rgba(var(--accent-rgb), .75); transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 18px -4px rgba(var(--accent-rgb), .6);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-track-switcher a[aria-current] {
  color: #fff; border-color: rgb(var(--accent-rgb));
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .45), rgba(var(--accent-rgb), .16)), var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 24px -4px rgba(var(--accent-rgb), .7);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub :is(.code-course-progress, .code-course-filters) {
  border-color: rgba(var(--accent-rgb), .28);
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .09), rgba(var(--accent-rgb), .02) 60%), var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 24px -12px rgba(var(--accent-rgb), .45);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-progress progress { border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .08); }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-progress progress::-webkit-progress-value { background: linear-gradient(90deg, rgb(var(--accent-rgb)), #a78bfa); box-shadow: 0 0 10px rgba(var(--accent-rgb), .8); }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-progress progress::-moz-progress-bar { background: linear-gradient(90deg, rgb(var(--accent-rgb)), #a78bfa); }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-start {
  color: #fff; font-weight: 600; border-color: rgba(var(--accent-rgb), .7);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .5), rgba(129, 140, 248, .3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 26px -6px rgba(var(--accent-rgb), .75);
  transition: transform .18s ease, box-shadow .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-start:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 36px -4px rgba(var(--accent-rgb), .9);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub > h2 { display: flex; align-items: center; gap: .65rem; }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub > h2::before {
  content: ""; width: .3rem; height: 1.1rem; border-radius: 9999px;
  background: linear-gradient(180deg, rgb(var(--accent-rgb)), #a78bfa); box-shadow: 0 0 12px rgba(var(--accent-rgb), .8);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-card {
  position: relative;
  background:
    linear-gradient(150deg, rgb(var(--hub-accent) / .17) 0%, rgb(var(--hub-accent) / .055) 50%, rgb(var(--hub-accent) / .02) 100%),
    var(--reading-surface, #01040e);
  border-color: rgb(var(--hub-accent) / .36); border-left-color: rgb(var(--hub-accent) / .85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 18px -7px rgb(var(--hub-accent) / .55),
              0 10px 22px -16px rgba(0, 0, 0, .85);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease, background .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-card:hover {
  border-color: rgb(var(--hub-accent) / .75);
  background:
    linear-gradient(150deg, rgb(var(--hub-accent) / .3) 0%, rgb(var(--hub-accent) / .1) 52%, rgb(var(--hub-accent) / .03) 100%),
    var(--reading-surface, #01040e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 30px -4px rgb(var(--hub-accent) / .6),
              0 16px 32px -16px rgb(var(--hub-accent) / .45);
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-card.is-complete { border-color: rgb(52 211 153 / .7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 22px -6px rgb(52 211 153 / .55); }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-number {
  border-color: rgb(var(--hub-accent) / .5);
  background: linear-gradient(150deg, rgb(var(--hub-accent) / .45), rgb(var(--hub-accent) / .14));
  text-shadow: 0 0 10px rgb(var(--hub-accent) / .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 14px -2px rgb(var(--hub-accent) / .55);
  transition: transform .18s ease, box-shadow .18s ease;
}
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-card:hover .code-hub-number { transform: scale(1.07) rotate(-4deg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 20px 0 rgb(var(--hub-accent) / .7); }
@media (prefers-reduced-motion: reduce) {
  html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-card:hover .code-hub-number, html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-course-start:hover, html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-track-switcher a:hover { transform: none; }
}
/* 30 Code Nights banner on the /code landing (the hub's own sheet is code-nights.css). */
.cn-banner { display: flex; align-items: center; gap: .9rem; margin: 0 0 1.5rem; padding: .85rem 1rem; border: 1px solid rgba(255, 209, 102, .3); border-radius: 1rem; background: linear-gradient(120deg, #0f0e2e 0%, #231a55 70%, #3a1d63 100%); color: #f4f1ff; text-decoration: none; transition: border-color .15s, transform .15s; }
.cn-banner:hover, .cn-banner:focus-visible { border-color: rgba(255, 209, 102, .7); transform: translateY(-1px); outline: none; }
.cn-banner:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.8); }
.cn-banner-moon { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff8dc, #ffe9a8 60%, #e9c46a); box-shadow: 0 0 22px 4px rgba(255, 233, 168, .25); }
.cn-banner-text { display: grid; min-width: 0; }
.cn-banner-text strong { font-size: 1rem; font-weight: 800; color: #ffe9a8; }
.cn-banner-text span { color: #c9c3ec; font-size: .88rem; line-height: 1.35; }
.cn-banner-cta { flex: none; margin-left: auto; padding: .45rem .85rem; border-radius: .7rem; background: #ffd166; color: #24133f; font-weight: 800; font-size: .85rem; white-space: nowrap; }
@media (max-width: 560px) { .cn-banner-cta { display: none; } }
/* ── Media inside lesson cards (code-clips.js) ─────────────────────────────────────────
   A looping concept clip (![alt](…mp4), same .lx-anim markup as /learn) and a snippet of
   the narrated lesson video (.code-clip: one chapter, opened by its button). */
.code-prose video.lx-anim {
  display: block;
  width: 100%;
  max-height: 24rem;
  margin: 1.4rem auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, .18);
  background: #0b1220;
  cursor: pointer;
  object-fit: contain;
}
.code-prose video.lx-anim + em { display: block; margin: -0.6rem auto 0; text-align: center; font-style: normal; font-size: .8rem; color: #e2e8f0; }
.code-clip { margin: 1rem 0 0.4rem; }
.code-clip-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  max-width: 100%;
  padding: .5rem .9rem .5rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, .35);
  background: rgba(14, 165, 233, .10);
  color: #bae6fd;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.code-clip-btn:hover, .code-clip-btn:focus-visible { background: rgba(14, 165, 233, .18); border-color: rgba(125, 211, 252, .6); }
.code-clip-btn svg { width: 1rem; height: 1rem; flex: none; }
.code-clip-time { font-weight: 500; color: #7dd3fc; opacity: .8; font-variant-numeric: tabular-nums; }
.code-clip.is-open .code-clip-btn { display: none; }
.code-clip-video { display: block; width: 100%; margin-top: .25rem; border-radius: .75rem; background: #000; aspect-ratio: 16 / 9; }
.code-clip-video[hidden] { display: none; }
html[data-theme="light"] .code-clip-btn { color: #075985; background: rgba(14, 165, 233, .08); border-color: rgba(2, 132, 199, .35); }
html[data-theme="light"] .code-clip-time { color: #0369a1; }

/* ---- /code landing + course hubs: readable hierarchy (design audit 2026-11-24) ----
   Owner standard: no grey text on dark blue, numbers on tinted chips at real contrast,
   meaningful icons ≥ 20px. Numbers and glyphs on accent-tinted chips are the accent mixed
   toward white (keeps the hue, lifts 2.9–4.4:1 to ≥ 7:1). Hub sections only; the lesson
   runner and editor rules above are untouched. */
.code-group-label { font-size: .8125rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #e2e8f0; }
.code-course-sub { margin-top: .1rem; font-size: .8125rem; line-height: 1.35; color: #e2e8f0; }
.code-course-count { font-size: .78rem; letter-spacing: .01em; }
.code-card-title { font-size: .9375rem; line-height: 1.35; }
.code-card-badge { width: 2.5rem; height: 2.5rem; }
.code-card-badge > svg { width: 1.3rem; height: 1.3rem; }
.code-card-num { font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.code-card-idx { min-width: 1.2rem; height: 1.2rem; font-size: .72rem; }
.code-course-resources-btn svg { width: 1.1rem; height: 1.1rem; }
.code-practice-head p { font-size: .9375rem; line-height: 1.5rem; color: #e2e8f0; }
.code-practice-group-label p { color: #e2e8f0; }
.code-practice-stars { font-size: .875rem; }
/* The drill number, beside the stars once the badge shows the drill's own glyph. */
.code-practice-num { font-size: .75rem; font-weight: 600; letter-spacing: 0; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.code-curriculum-label { font-size: .8125rem; color: #e2e8f0; }
html.space-root:not([data-theme="light"]) .code-course-count { color: color-mix(in srgb, rgb(var(--accent-rgb)) 45%, #fff); background: rgba(var(--accent-rgb), .16); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .45); }
html.space-root:not([data-theme="light"]) .code-card-badge { color: color-mix(in srgb, rgb(var(--accent-rgb)) 45%, #fff); }
html.space-root:not([data-theme="light"]) .code-card-badge > svg { color: color-mix(in srgb, rgb(var(--accent-rgb)) 70%, #fff); }
html.space-root:not([data-theme="light"]) .code-card-idx { color: color-mix(in srgb, rgb(var(--accent-rgb)) 55%, #fff); }

/* Course hub: the way back is a real button, not 12px grey on the coloured hero (2.2:1). */
.code-hub-back { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.25rem; max-width: 100%; padding: .3rem .85rem .3rem .55rem; border-radius: .75rem; line-height: 1.3; border: 1px solid rgba(226, 232, 240, .28); background: rgba(2, 6, 23, .55); color: #f1f5f9; font-size: .875rem; font-weight: 600; text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.code-hub-back svg { width: 1.1rem; height: 1.1rem; flex: none; }
.code-hub-back:hover { border-color: rgba(226, 232, 240, .6); background: rgba(2, 6, 23, .8); color: #fff; }
.code-hub-back:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.code-course-hub .code-hub-number { font-size: .875rem; }
.code-hub-status { font-size: .8125rem; }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-number { color: color-mix(in srgb, rgb(var(--hub-accent)) 40%, #fff); text-shadow: none; }
html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-number svg { color: color-mix(in srgb, rgb(var(--hub-accent)) 72%, #fff); }
/* Phones: course names and their one-line pitch wrap (two lines at most) instead of being cut
   to "Python for AP CS Pr…" beside the lesson-count pill. */
@media (max-width: 640px) {
  .code-hub-back { font-size: .8125rem; }
  .code-course > summary { align-items: flex-start; }
  .code-course > summary .code-course-icon, .code-course > summary .code-course-count, .code-course > summary .code-course-chevron { margin-top: .15rem; }
  .code-course-label, .code-course-sub, .code-practice-card .code-course-label { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .code-course-label { line-height: 1.3; }
  .code-card-title { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
}

/* /code landing polish: course and practice blurbs get two lines at every width (one line
   cut "Your pet walks the moves your Python prints. Re…"); on phones the three next-step
   choices are compact rows (icon left) instead of three tall cards. */
.code-course .code-course-sub { white-space: normal; text-overflow: clip; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
@media (max-width: 600px) {
  .code-pathways { gap: .6rem; padding: 1rem; }
  .code-pathways a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: .85rem; row-gap: .1rem; padding: .8rem .9rem; }
  .code-pathways .code-pathway-icon { grid-row: 1 / 3; }
  .code-pathways a > span:not(.code-pathway-icon) { font-size: .82rem; line-height: 1.35; }
}
.code-hint-cost { margin: 0 0 .4rem; font-size: .8rem; color: var(--muted, #94a3b8); }
/* ---- Course hub (/code/<course>), 2026-12-02 redesign: a hero with progress and the start
   button, then the lessons as one path split into parts (each ending in its project), each
   card naming what the lesson teaches. --accent-rgb is the course's colour ([data-course]). */
.code-course-hub { max-width: 52rem; }
.code-course-hub > header.code-hub-hero { position: relative; overflow: hidden; margin-bottom: 1.75rem; padding: 1.5rem 1.75rem 1.6rem; border: 1px solid rgba(var(--accent-rgb, 56, 189, 248), .38); border-radius: 1.4rem;
  background: radial-gradient(circle at 100% 0, rgba(var(--accent-rgb, 56, 189, 248), .24), transparent 55%), linear-gradient(160deg, rgba(var(--accent-rgb, 56, 189, 248), .1), var(--reading-surface, #01040e) 70%);
  box-shadow: 0 18px 40px -28px rgba(var(--accent-rgb, 56, 189, 248), .8); }
.code-hub-hero-row { display: flex; align-items: center; gap: 1.1rem; margin-top: 1.1rem; }
.code-hub-hero-icon { display: grid; place-items: center; flex: none; width: 4rem; height: 4rem; border-radius: 1.1rem; color: rgb(var(--accent-rgb, 56, 189, 248));
  border: 1px solid rgba(var(--accent-rgb, 56, 189, 248), .45); background: linear-gradient(140deg, rgba(var(--accent-rgb, 56, 189, 248), .3), rgba(var(--accent-rgb, 56, 189, 248), .06)); }
.code-hub-hero-icon svg { width: 2.2rem; height: 2.2rem; }
.code-hub-hero h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; color: #f8fafc; }
.code-hub-sub { margin: .35rem 0 0; font-size: 1.02rem; color: #e2e8f0; }
.code-hub-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.code-hub-chips li { padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: #e2e8f0; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); }
.code-hub-chips li.is-lang { color: rgb(var(--accent-rgb, 56, 189, 248)); border-color: rgba(var(--accent-rgb, 56, 189, 248), .4); }
.code-hub-hero-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem 1.5rem; margin-top: 1.4rem; }
html.space-root #site-main .code-course-hub .code-hub-hero .code-course-progress { margin: 0; box-shadow: none; padding: 0; border: 0; background: transparent; font-size: .85rem; }
.code-hub-hero .code-course-progress progress { height: .55rem; margin-top: .5rem; border-color: rgba(255, 255, 255, .15); }
.code-hub-hero .code-course-progress progress::-webkit-progress-value { background: rgb(var(--accent-rgb, 34, 211, 238)); }
.code-hub-hero .code-course-progress progress::-moz-progress-bar { background: rgb(var(--accent-rgb, 34, 211, 238)); }
html.space-root #site-main .code-course-hub .code-hub-hero .code-course-start { display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.35rem; border: 0; border-radius: .95rem; font-size: .95rem; font-weight: 700; color: #04121c;
  background: linear-gradient(135deg, rgb(var(--accent-rgb, 56, 189, 248)), color-mix(in srgb, rgb(var(--accent-rgb, 56, 189, 248)) 70%, #fff)); box-shadow: 0 8px 22px -10px rgba(var(--accent-rgb, 56, 189, 248), .9); transition: transform .15s ease, box-shadow .15s ease; text-decoration: none; }
.code-hub-hero .code-course-start svg { width: 1.05rem; height: 1.05rem; }
html.space-root #site-main .code-course-hub .code-hub-hero .code-course-start:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(var(--accent-rgb, 56, 189, 248), 1); }
.code-hub-intro { margin: 0 0 .5rem; font-size: .92rem; line-height: 1.6; color: #e2e8f0; }

.code-hub-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: 2rem 0 .5rem; }
.code-hub-list-head h2 { margin: 0; font-size: 1.2rem; font-weight: 700; color: #f1f5f9; }
.code-course-hub .code-hub-list-head .code-course-filters { flex: 0 1 30rem; margin: 0; padding: 0; gap: .5rem; border: 0; background: transparent; }
.code-hub-list-head .code-filter-field { flex: 1 1 9rem; }
.code-hub-list-head .code-filter-field--search { flex: 2 1 13rem; }
.code-hub-list-head .code-course-filters :is(input, select) { padding: .5rem .7rem; font-size: .875rem; border-radius: .65rem; }
.code-hub-list-head .code-course-filters p { margin: 0; text-align: right; font-size: .75rem; color: #e2e8f0; }
.code-hub-empty { margin: 1rem 0; color: #e2e8f0; }

.code-hub-part { margin-top: 1.5rem; }
.code-hub-part[hidden] { display: none; }
.code-hub-part-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .8rem; margin: 0 0 .7rem; }
.code-hub-part-name { font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: rgb(var(--accent-rgb, 56, 189, 248)); }
.code-hub-part-goal { font-size: .85rem; color: #e2e8f0; }
.code-hub-path, .code-hub-grid { margin: 0; padding: 0; list-style: none; }
.code-hub-path { display: flex; flex-direction: column; gap: .65rem; }
.code-hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.code-course-hub .code-hub-card { position: relative; display: flex; flex-wrap: wrap; align-items: center; min-height: 0; border-radius: 1rem; border-width: 1px; border-style: solid; }
.code-hub-path > .code-hub-card:not(:last-child)::after { content: ""; position: absolute; left: calc(1rem + 1.25rem - 1px); top: 100%; width: 2px; height: .65rem; background: rgb(var(--hub-accent) / .45); }
.code-hub-link { display: flex; flex: 1 1 0; min-width: 0; align-items: center; gap: .95rem; padding: .85rem 1rem; text-decoration: none; }
.code-hub-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: .1rem; }
.code-course-hub .code-hub-title { font-size: 1rem; font-weight: 650; line-height: 1.35; color: #f1f5f9; }
.code-hub-topics { font-size: .84rem; line-height: 1.45; color: #e2e8f0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.code-course-hub .code-hub-status { margin-top: .2rem; font-size: .76rem; color: #e2e8f0; }
.code-hub-video { flex: none; padding-right: .9rem; }
.code-hub-tag { align-self: flex-start; margin-bottom: .15rem; padding: .05rem .5rem; border-radius: 999px; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #451a03; background: #fbbf24; }
.code-course-hub .code-hub-card.is-project { --hub-accent: 251 191 36; }
html.space-root:not([data-theme="light"]) .code-course-hub .code-hub-card.is-project { background: linear-gradient(120deg, rgb(251 191 36 / .16), rgb(251 191 36 / .03) 70%), var(--reading-surface, #01040e); border-color: rgb(251 191 36 / .55); }
.code-course-hub .code-hub-card.is-complete .code-hub-number { color: #052e16; background: #34d399; border-color: #34d399; }
.code-hub-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .9rem; margin-top: 2.5rem; }
.code-hub-more-card { display: flex; gap: .9rem; padding: 1.1rem 1.2rem; border: 1px solid rgba(148, 163, 184, .28); border-radius: 1rem; background: var(--reading-surface, #01040e); color: #e2e8f0; font-size: .875rem; text-decoration: none; }
a.code-hub-more-card:hover { border-color: rgba(var(--accent-rgb, 56, 189, 248), .6); }
.code-hub-more-card strong { display: block; margin-bottom: .2rem; font-size: .98rem; color: #f1f5f9; }
.code-hub-more-icon { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: .75rem; color: rgb(var(--accent-rgb, 56, 189, 248)); background: rgba(var(--accent-rgb, 56, 189, 248), .14); }
.code-hub-more-icon svg { width: 1.3rem; height: 1.3rem; }
.code-hub-resources { flex-direction: column; gap: .4rem; }
.code-hub-resources h2 { margin: 0; font-size: .98rem; font-weight: 650; color: #f1f5f9; }
.code-hub-resources ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.code-hub-resources a { color: #7dd3fc; text-decoration: underline; text-underline-offset: .2em; }
@media (max-width: 640px) {
  .code-course-hub > header.code-hub-hero { padding: 1.15rem 1.1rem 1.25rem; }
  .code-hub-hero-icon { width: 3.1rem; height: 3.1rem; border-radius: .9rem; }
  .code-hub-hero-icon svg { width: 1.7rem; height: 1.7rem; }
  .code-hub-hero-foot { grid-template-columns: 1fr; }
  .code-course-hub .code-hub-hero .code-course-start { justify-content: center; }
  .code-course-hub .code-hub-list-head .code-course-filters { flex-basis: 100%; }
  .code-hub-grid { grid-template-columns: 1fr; }
  .code-hub-link { padding: .75rem .8rem; gap: .75rem; }
  .code-hub-path > .code-hub-card:not(:last-child)::after { left: calc(.8rem + 1.25rem - 1px); }
  .code-hub-video { padding: 0 .8rem .75rem 4.05rem; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .code-hub-hero .code-course-start { transition: none; } html.space-root #site-main .code-course-hub .code-hub-hero .code-course-start:hover { transform: none; } }
html[data-theme="light"] #site-main .code-course-hub > header.code-hub-hero { background: radial-gradient(circle at 100% 0, rgba(var(--accent-rgb, 56, 189, 248), .2), transparent 55%), linear-gradient(160deg, rgba(var(--accent-rgb, 56, 189, 248), .1), var(--reading-surface, #fff) 70%); box-shadow: 0 10px 30px -22px rgb(30 64 110 / .45); }
html[data-theme="light"] .code-hub-hero h1, html[data-theme="light"] .code-hub-list-head h2, html[data-theme="light"] .code-hub-more-card strong, html[data-theme="light"] .code-hub-resources h2 { color: #0f1d33; }
html[data-theme="light"] .code-hub-sub, html[data-theme="light"] .code-hub-intro, html[data-theme="light"] .code-hub-part-goal, html[data-theme="light"] .code-hub-more-card { color: #334155; }
html[data-theme="light"] .code-hub-chips li { color: #1e293b; background: rgb(255 255 255 / .7); border-color: #cbd5e1; }
html[data-theme="light"] :is(.code-hub-chips li.is-lang, .code-hub-part-name, .code-hub-hero-icon, .code-hub-more-icon) { color: color-mix(in srgb, rgb(var(--accent-rgb, 56, 189, 248)) 55%, #0f172a); }
html[data-theme="light"] #site-main .code-course-hub .code-hub-hero .code-course-start { color: #fff; background: color-mix(in srgb, rgb(var(--accent-rgb, 56, 189, 248)) 60%, #0f172a); }
html[data-theme="light"] .code-course-hub .code-hub-title { color: #13223a; }
html[data-theme="light"] .code-hub-topics { color: #475569; }
html[data-theme="light"] .code-course-hub .code-hub-status, html[data-theme="light"] .code-hub-list-head .code-course-filters p { color: #475569; }
html[data-theme="light"] #site-main .code-course-hub .code-hub-card.is-project { background: linear-gradient(120deg, rgb(251 191 36 / .2), rgb(251 191 36 / .04) 70%), var(--reading-surface, #fff); border-color: #e3a92b; }
html[data-theme="light"] .code-hub-resources a { color: #075c78; }
html[data-theme="light"] #site-main .code-course-hub .code-hub-list-head .code-course-filters, html.space-root:not([data-theme="light"]) #site-main .code-course-hub .code-hub-list-head .code-course-filters { border: 0; background: transparent; box-shadow: none; }
/* /code landing: each course is one link tile to its hub (12-02); room for the whole subtitle. */
.code-course.code-course-tile { align-items: flex-start; text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.code-course-tile .code-course-sub { -webkit-line-clamp: 3; line-clamp: 3; }
.code-course-tile .code-course-count, .code-course-tile .code-course-chevron { margin-top: .55rem; }
.code-course-tile:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb, 56, 189, 248), .7); }
@media (prefers-reduced-motion: reduce) { .code-course-tile, .code-course-tile:hover { transition: none; transform: none; } }

/* ▼▼ LIGHT THEME — GENERATED by scripts/build_light_theme.py from the rules above. Do not edit by hand: run the builder. Hand tuning goes in 36-theme-light.css. ▼▼ */
html[data-theme="light"] .code-prose h2{color:rgb(44 63 88)}
html[data-theme="light"] .code-prose h3{color:rgb(44 63 88)}
html[data-theme="light"] .code-prose strong{color:rgb(38 66 94)}
html[data-theme="light"] .code-prose a{color:rgb(0 90 133);text-decoration-color:rgb(0 85 125/0.85)}
html[data-theme="light"] .code-prose a:hover{color:rgb(1 87 132);text-decoration-color:rgb(1 87 132)}
html[data-theme="light"] .code-prose img + em{color:rgb(44 63 88)}
html[data-theme="light"] .code-prose .code-ico{color:rgb(0 90 133)}
html[data-theme="light"] .code-prose pre{background-color:rgb(247 247 251)}
html[data-theme="light"] .code-prose pre.cm-s-exercise code{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise.CodeMirror{background:var(--reading-surface, rgb(252 252 253));color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .CodeMirror-gutters{background-color:rgb(247 247 251)}
html[data-theme="light"] .cm-s-exercise .CodeMirror-activeline-background{background-color:rgb(15 23 42/0.025)}
html[data-theme="light"] .cm-s-exercise .CodeMirror-matchingbracket{color:rgb(2 111 126)!important}
html[data-theme="light"] .cm-s-exercise .cm-comment{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-keyword{color:rgb(28 0 132)}
html[data-theme="light"] .cm-s-exercise .cm-builtin{color:rgb(0 90 133)}
html[data-theme="light"] .cm-s-exercise .cm-def{color:rgb(2 111 126)}
html[data-theme="light"] .cm-s-exercise .cm-variable{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-variable-2{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-variable-3,html[data-theme="light"] .cm-s-exercise .cm-type{color:rgb(0 90 133)}
html[data-theme="light"] .cm-s-exercise .cm-property{color:rgb(0 63 133)}
html[data-theme="light"] .cm-s-exercise .cm-operator{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-string{color:rgb(12 113 49)}
html[data-theme="light"] .cm-s-exercise .cm-string-2{color:rgb(12 113 49)}
html[data-theme="light"] .cm-s-exercise .cm-number{color:rgb(126 96 0)}
html[data-theme="light"] .cm-s-exercise .cm-atom{color:rgb(28 0 132)}
html[data-theme="light"] .cm-s-exercise .cm-meta{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-bracket{color:rgb(44 63 88)}
html[data-theme="light"] .cm-s-exercise .cm-error{color:rgb(131 1 1)}
html[data-theme="light"] .code-btn{color:rgb(44 63 88);background-color:rgb(15 23 42/0.06);border-color:rgb(15 23 42/0.126)}
html[data-theme="light"] .code-btn:hover:not(:disabled){background-color:rgb(15 23 42/0.12);color:rgb(51 63 82)}
html[data-theme="light"] .code-btn:focus-visible{box-shadow:0px 0px 0px 2px rgb(14 158 180/0.55)}
html[data-theme="light"] .code-btn-primary{color:rgb(2 111 126)}
html[data-theme="light"] .code-btn-primary:hover:not(:disabled){color:rgb(1 111 124)}
html[data-theme="light"] .code-btn-check{color:rgb(0 27 133)}
html[data-theme="light"] .code-btn-check:hover:not(:disabled){color:rgb(0 30 133)}
html[data-theme="light"] .code-btn-hint{color:rgb(126 96 0)}
html[data-theme="light"] .code-btn-arrow{color:rgb(28 0 132)}
html[data-theme="light"] .code-btn-hint:hover:not(:disabled){color:rgb(117 94 0)}
html[data-theme="light"] .code-console{background-color:rgb(251 251 253);color:rgb(44 63 88)}
html[data-theme="light"] .code-console-empty{color:rgb(44 63 88)}
html[data-theme="light"] .code-out{color:rgb(44 63 88)}
html[data-theme="light"] .code-err{color:rgb(131 1 1)}
html[data-theme="light"] .code-sys{color:rgb(44 63 88)}
html[data-theme="light"] .code-echo{color:rgb(2 111 126)}
html[data-theme="light"] .code-console-input{color:rgb(44 63 88);caret-color:rgb(6 107 122)}
html[data-theme="light"] .code-prompt{color:rgb(18 112 52)}
html[data-theme="light"] .code-result-pending{color:rgb(44 63 88)}
html[data-theme="light"] .code-result-pass{color:rgb(12 113 49)}
html[data-theme="light"] .code-result-fail{color:rgb(131 1 1)}
html[data-theme="light"] .code-result-line{color:rgb(44 63 88)}
html[data-theme="light"] .code-result-label{color:rgb(44 63 88)}
html[data-theme="light"] .code-result-grid{color:rgb(44 63 88);background-color:rgb(250 251 252/0.5)}
html[data-theme="light"] .code-diff-hl{box-shadow:0px 0px 0px 1px rgb(184 10 10/0.55);text-decoration-color:rgb(133 0 0/0.85)}
html[data-theme="light"] .code-check-item{color:rgb(44 63 88)}
html[data-theme="light"] .code-check-item.is-ok .code-check-mark{color:rgb(12 113 49)}
html[data-theme="light"] .code-check-item.is-no .code-check-mark{color:rgb(131 1 1)}
html[data-theme="light"] .code-check-item.is-no{color:rgb(133 0 16)}
html[data-theme="light"] .code-hint-panel{color:rgb(132 94 0)}
html[data-theme="light"] .code-hint-panel.code-hint-pending{color:rgb(44 63 88)}
html[data-theme="light"] .code-hint-panel.code-hint-fail{color:rgb(131 1 1)}
html[data-theme="light"] .code-hint-panel code{background-color:rgb(250 251 252/0.45)}
html[data-theme="light"] .code-hint-panel strong{color:rgb(117 94 0)}
html[data-theme="light"] .code-runtime-warning{color:rgb(131 1 1)}
html[data-theme="light"] .code-example-run{background-color:rgb(247 247 251/0.82);color:rgb(2 111 126)}
html[data-theme="light"] .code-example-run:hover:not(:disabled){color:rgb(1 111 124)}
html[data-theme="light"] .code-example-run:focus-visible{box-shadow:0px 0px 0px 2px rgb(14 158 180/0.55)}
html[data-theme="light"] .code-example-run.is-running{background-color:rgb(247 247 251/0.82);color:rgb(131 1 1)}
html[data-theme="light"] .code-prose .code-example-output{background-color:rgb(249 250 252);color:rgb(44 63 88)}
html[data-theme="light"] .code-pdf{background:var(--reading-surface, rgb(252 252 253))}
html[data-theme="light"] .code-pdf-empty,html[data-theme="light"] .code-pdf-pending{color:rgb(44 63 88)}
html[data-theme="light"] .code-pdf-pending{color:rgb(44 63 88)}
html[data-theme="light"] .code-pdf-download{color:rgb(2 107 154)}
html[data-theme="light"] .code-pdf-error{color:rgb(133 0 16)}
html[data-theme="light"] .code-continue{color:rgb(2 111 126)}
html[data-theme="light"] .code-continue:hover{color:rgb(1 111 124)}
html[data-theme="light"] .code-continue:focus-visible{box-shadow:0px 0px 0px 2px rgb(14 158 180/0.55)}
html[data-theme="light"] .code-back{color:rgb(44 63 88);background-color:rgb(15 23 42/0.05);border-color:rgb(15 23 42/0.14)}
html[data-theme="light"] .code-back:hover:not(:disabled){color:rgb(44 63 88);background-color:rgb(15 23 42/0.09);border-color:rgb(15 23 42/0.18)}
html[data-theme="light"] .code-back:focus-visible{box-shadow:0px 0px 0px 2px rgb(77 94 116/0.55)}
html[data-theme="light"] .code-restart{color:rgb(44 63 88);border-color:rgb(15 23 42/0.112)}
html[data-theme="light"] .code-restart:hover:not(:disabled){color:rgb(44 63 88);background-color:rgb(15 23 42/0.06);border-color:rgb(15 23 42/0.18)}
html[data-theme="light"] .code-restart:focus-visible{box-shadow:0px 0px 0px 2px rgb(77 94 116/0.55)}
html[data-theme="light"] .code-course-icon{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-card{background-image:linear-gradient(155deg, rgba(var(--accent-rgb), .12) 0%, rgba(var(--accent-rgb), .05) 46%, rgb(15 23 42/0.025) 100%);box-shadow:0px 5px 16px -4px rgb(15 23 42/0.12),0px 10px 26px -16px rgb(15 23 42/0.2)}
html[data-theme="light"] .code-card:hover{background-image:linear-gradient(155deg, rgba(var(--accent-rgb), .26) 0%, rgba(var(--accent-rgb), .11) 50%, rgb(15 23 42/0.035) 100%);box-shadow:0px 9px 30px -2px rgb(15 23 42/0.12),0px 18px 38px -14px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-card-badge{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a);text-shadow:none;box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .42) 62%,#0f172a),0px 4px 12px -2px rgb(15 23 42/0.12)}
html[data-theme="light"] .code-card:hover .code-card-badge{box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .6) 62%,#0f172a),0px 5px 18px rgb(15 23 42/0.12)}
html[data-theme="light"] .code-card-chevron{color:color-mix(in srgb,rgba(var(--accent-rgb), .8) 44%,#0f172a)}
html[data-theme="light"] .code-card:hover .code-card-chevron{color:rgb(51 63 82);box-shadow:0px 4px 12px -2px rgb(15 23 42/0.12)}
html[data-theme="light"] .code-card-idx{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a);background-color:rgb(249 250 252/0.92);box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), 0.55) 62%,#0f172a),0px 1px 3px rgb(15 23 42/0.144)}
html[data-theme="light"] .code-card:hover .code-card-idx{color:rgb(51 63 82);box-shadow:0px 3px 10px -1px rgb(15 23 42/0.12)}
html[data-theme="light"] .code-card::after{background-image:linear-gradient(105deg, transparent 42%, rgb(15 23 42/0.15) 50%, transparent 58%)}
html[data-theme="light"] .code-course-label{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-course{background-image:linear-gradient(180deg, rgb(15 23 42/0.05) 0%, rgb(15 23 42/0.02) 100%);box-shadow:0px 8px 24px -18px rgb(15 23 42/0.2)}
html[data-theme="light"] .code-course-count{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a);box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .24) 62%,#0f172a)}
html[data-theme="light"] .code-course-chevron{color:color-mix(in srgb,rgba(var(--accent-rgb), .6) 44%,#0f172a)}
html[data-theme="light"] .code-course[open] .code-course-chevron,html[data-theme="light"] .code-course:has(> summary:hover) .code-course-chevron{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-course-resources-btn{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a);box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .24) 62%,#0f172a)}
html[data-theme="light"] .code-course-resources-btn:hover{box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .4) 62%,#0f172a)}
html[data-theme="light"] .code-resources-pop{color:rgb(44 63 88);background-image:linear-gradient(162deg, rgba(var(--accent-rgb), .16) 0%, rgb(245 246 250/0.9) 58%);box-shadow:0px 22px 48px -18px rgb(15 23 42/0.2),0px 11px 36px -12px rgb(15 23 42/0.12)}
html[data-theme="light"] .code-resources-close{color:rgb(44 63 88)}
html[data-theme="light"] .code-resources-close:hover{background-color:rgb(15 23 42/0.06);color:rgb(51 63 82)}
html[data-theme="light"] .code-resources-title{color:rgb(38 66 94)}
html[data-theme="light"] .code-resources-link{background-color:rgb(15 23 42/0.03);box-shadow:inset 0px 0px 0px 1px rgb(15 23 42/0.144)}
html[data-theme="light"] .code-resources-link:hover{box-shadow:inset 0px 0px 0px 1px color-mix(in srgb,rgba(var(--accent-rgb), .4) 62%,#0f172a)}
html[data-theme="light"] .code-resources-link-title{color:rgb(44 63 88)}
html[data-theme="light"] .code-resources-link:hover .code-resources-link-title{color:rgb(51 63 82)}
html[data-theme="light"] .code-resources-ext{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-resources-note{color:rgb(44 63 88)}
html[data-theme="light"] .code-resources-seeall{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-practice-head h2{color:rgb(51 63 82)}
html[data-theme="light"] .code-practice-head p{color:rgb(44 63 88)}
html[data-theme="light"] .code-practice-card[aria-expanded="true"] .code-course-chevron{color:color-mix(in srgb,rgb(var(--accent-rgb)) 44%,#0f172a)}
html[data-theme="light"] .code-practice-stars{color:rgb(127 92 0)}
html[data-theme="light"] .code-reference-dialog{border-color:rgb(15 23 42/0.112);background-color:rgb(249 250 252);box-shadow:0px 30px 70px -24px rgb(15 23 42/0.2),0px 30px 100px -30px rgb(15 23 42/0.05)}
html[data-theme="light"] .code-reference-dialog::backdrop{background-color:rgb(252 252 253/0.74)}
html[data-theme="light"] .code-reference-dialog-head{background-image:linear-gradient(to bottom, rgb(246 248 250), rgb(249 250 252))}
html[data-theme="light"] .code-reference-dialog-head::after{background-image:linear-gradient(90deg, transparent, rgb(15 23 42/0.12) 18%, rgb(15 23 42/0.12) 82%, transparent)}
html[data-theme="light"] .code-reference-dialog-icon{color:rgb(1 111 124);box-shadow:inset 0px 0px 0px 1px rgb(14 158 180/0.374)}
html[data-theme="light"] .code-reference-dialog-close{color:rgb(44 63 88);background-color:rgb(15 23 42/0.04);box-shadow:inset 0px 0px 0px 1px rgb(15 23 42/0.144)}
html[data-theme="light"] .code-reference-dialog-close:hover{background-color:rgb(15 23 42/0.09);color:rgb(51 63 82);box-shadow:inset 0px 0px 0px 1px rgb(15 23 42/0.16)}
html[data-theme="light"] .code-input-banner{color:rgb(1 111 124)}
html[data-theme="light"] .code-input-banner svg{color:rgb(2 111 126)}
html[data-theme="light"] .code-console.is-waiting,html[data-theme="light"] .code-prose .code-example-output.is-waiting{box-shadow:0px 0px 0px 3px rgb(14 158 180/0.272)}
html[data-theme="light"] .code-console-input::placeholder{color:rgb(12 114 98)}
html[data-theme="light"] .code-waiting-pill{color:rgb(2 111 126)}
html[data-theme="light"] .code-stdin-panel{color:rgb(0 107 117)}
html[data-theme="light"] .code-stdin-panel-title{color:rgb(2 111 126)}
html[data-theme="light"] .code-stdin-panel p{color:rgb(44 63 88)}
html[data-theme="light"] .code-stdin-panel textarea{background-color:rgb(251 251 253);color:rgb(44 63 88)}
html[data-theme="light"] .code-result-stdin{color:rgb(44 63 88)}
html[data-theme="light"] .code-result-stdin code{background-color:rgb(250 251 252/0.5);color:rgb(44 63 88)}
html[data-theme="light"] .code-error-card{color:rgb(133 71 0)}
html[data-theme="light"] .code-error-card-head{color:rgb(133 68 0)}
html[data-theme="light"] .code-error-card-tag{color:rgb(167 75 0)}
html[data-theme="light"] .code-error-card-zh{color:rgb(131 70 1)}
html[data-theme="light"] .code-error-card-line{color:rgb(117 94 0)}
html[data-theme="light"] .code-error-card code,html[data-theme="light"] .code-error-card-ai code{background-color:rgb(250 251 252/0.45);color:rgb(133 74 0)}
html[data-theme="light"] .code-error-card-ai{color:rgb(133 76 0)}
html[data-theme="light"] .code-error-card-ai.is-pending{color:rgb(44 63 88)}
html[data-theme="light"] .code-error-card-ai-off{color:rgb(44 63 88)}
html[data-theme="light"] .code-btn-teacher{color:rgb(127 6 72)}
html[data-theme="light"] .code-btn-teacher:hover:not(:disabled){color:rgb(125 7 74)}
html[data-theme="light"] .code-hint-level{color:rgb(127 92 0)}
html[data-theme="light"] .code-hint-panel .code-hint-note{color:rgb(44 63 88)}
html[data-theme="light"] .code-result .code-result-unchanged{color:rgb(126 96 0)}
html[data-theme="light"] .code-nudge-tip{color:rgb(126 96 0)}
html[data-theme="light"] .code-task-badge{color:rgb(117 94 0)}
html[data-theme="light"] .code-card-lock{color:rgb(44 63 88)}
html[data-theme="light"] .code-prereq{color:rgb(133 71 0)}
html[data-theme="light"] .code-prereq-link{color:rgb(133 68 0)}
html[data-theme="light"] .code-prereq-link:hover{color:rgb(51 63 82)}
html[data-theme="light"] .code-result-note{color:rgb(126 96 0)}
html[data-theme="light"] .code-result-viz{color:rgb(0 90 133)}
html[data-theme="light"] .code-result-viz:hover{color:rgb(1 79 132)}
html[data-theme="light"] .code-track-switcher a{color:rgb(0 90 133)}
html[data-theme="light"] .code-pathways h2{color:rgb(44 63 88)}
html[data-theme="light"] .code-pathways strong,html[data-theme="light"] .code-course-overview{color:rgb(0 90 133)}
html[data-theme="light"] .code-pathways span{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-progress{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-filters label{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-filters input,html[data-theme="light"] .code-course-filters select{color:rgb(44 63 88);background:var(--reading-surface, rgb(252 252 253))}
html[data-theme="light"] .code-course-filters p{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-status{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-card.is-complete .code-hub-status{color:rgb(16 111 73)}
html[data-theme="light"] .code-hub-prerequisites{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-prerequisites a{color:rgb(0 90 133)}
html[data-theme="light"] .code-hub-card{box-shadow:0px 2px 8px rgb(15 23 42/0.045)}
html[data-theme="light"] .code-course-start{color:rgb(1 111 124)}
html[data-theme="light"] .code-pathways a{background-image:linear-gradient(135deg, var(--reading-surface, rgb(252 252 253)), rgb(255 255 255) 90%);box-shadow:inset 0px 1px rgb(15 23 42/0.14),inset 0px -1px rgb(15 23 42/0.14),0px 6px 18px -8px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-pathways strong{color:color-mix(in srgb,rgb(var(--pathway-accent)) 44%,#0f172a)}
html[data-theme="light"] .code-pathways .code-pathway-icon{color:color-mix(in srgb,rgb(var(--pathway-accent)) 44%,#0f172a);box-shadow:inset 0px 1px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-course-hub > header{background:var(--reading-surface, rgb(252 252 253));box-shadow:0px 6px 20px -12px rgb(15 23 42/0.112)}
html[data-theme="light"] .code-course-hub .code-track-switcher a{background:var(--reading-surface, rgb(252 252 253));box-shadow:inset 0px 1px rgb(15 23 42/0.038)}
html[data-theme="light"] .code-course-hub .code-track-switcher a[aria-current]{box-shadow:inset 0px -3px rgb(15 23 42/0.2),0px 3px 12px -8px rgb(15 23 42/0.2)}
html[data-theme="light"] .code-course-hub :is(.code-course-progress, .code-course-filters){background:var(--reading-surface, rgb(252 252 253))}
html[data-theme="light"] .code-course-hub .code-hub-card{box-shadow:inset 0px 1px rgb(15 23 42/0.14),0px 5px 12px -10px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-course-hub .code-hub-number{color:color-mix(in srgb,rgb(var(--hub-accent)) 44%,#0f172a)}
html[data-theme="light"] .code-lesson .code-step:not(.code-task){background:var(--reading-surface, rgb(252 252 253));box-shadow:0px 5px 16px -10px rgb(15 23 42/0.2)}
html[data-theme="light"] .code-lesson .code-task.code-session-done{box-shadow:inset 4px 0px rgb(15 23 42/0.2),inset 0px 0px 0px 1px rgb(35 159 114/0.51);background:var(--reading-surface, rgb(250 251 252))}
html[data-theme="light"] .code-curriculum,html[data-theme="light"] .code-exam-panel{background:var(--reading-surface, rgb(252 252 253));color:var(--text-primary, rgb(44 63 88))}
html[data-theme="light"] .code-curriculum a,html[data-theme="light"] .code-exam-panel a,html[data-theme="light"] .code-hint-panel a{color:var(--link, rgb(2 111 126))}
html[data-theme="light"] .code-curriculum-label,html[data-theme="light"] .code-support-status{color:var(--text-secondary, rgb(61 75 94))}
html[data-theme="light"] .code-practice-group-label p{color:var(--text-secondary, rgb(61 75 94))}
html[data-theme="light"] .code-reasoning textarea{border-color:rgb(116 132 155);background:var(--reading-surface, rgb(252 252 253))}
html[data-theme="light"] .cn-banner{background-image:linear-gradient(120deg, rgb(243 243 249) 0%, rgb(235 233 244) 70%, rgb(235 230 242) 100%);color:rgb(28 0 133)}
html[data-theme="light"] .cn-banner:focus-visible{box-shadow:0px 0px 0px 3px rgb(15 23 42/0.16)}
html[data-theme="light"] .cn-banner-moon{box-shadow:0px 7px 22px 4px rgb(15 23 42/0.055)}
html[data-theme="light"] .cn-banner-text strong{color:rgb(125 93 0)}
html[data-theme="light"] .cn-banner-text span{color:rgb(41 30 102)}
html[data-theme="light"] .code-clip-btn{color:rgb(1 87 132)}
html[data-theme="light"] .code-clip-time{color:rgb(0 90 133)}
html[data-theme="light"] .code-clip-video{background-color:rgb(255 255 255)}
html[data-theme="light"] .code-group-label{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-sub{color:rgb(44 63 88)}
html[data-theme="light"] .code-practice-head p{color:rgb(44 63 88)}
html[data-theme="light"] .code-practice-group-label p{color:rgb(44 63 88)}
html[data-theme="light"] .code-practice-num{color:rgb(44 63 88)}
html[data-theme="light"] .code-curriculum-label{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-back{border-color:rgb(15 23 42/0.18);background-color:rgb(250 251 252/0.55);color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-back:hover{border-color:rgb(15 23 42/0.18);background-color:rgb(250 251 252/0.8);color:rgb(51 63 82)}
html[data-theme="light"] .code-hint-cost{color:var(--muted, rgb(61 75 94))}
html[data-theme="light"] .code-course-hub > header.code-hub-hero{background-image:radial-gradient(circle at 100% 0, rgba(var(--accent-rgb, 56, 189, 248), .24), transparent 55%), linear-gradient(160deg, rgba(var(--accent-rgb, 56, 189, 248), .1), var(--reading-surface, rgb(252 252 253)) 70%);box-shadow:0px 18px 40px -28px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-hub-hero-icon{color:color-mix(in srgb,rgb(var(--accent-rgb, 56, 189, 248)) 44%,#0f172a)}
html[data-theme="light"] .code-hub-hero h1{color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-sub{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-chips li{color:rgb(44 63 88);background-color:rgb(15 23 42/0.07);border-color:rgb(15 23 42/0.112)}
html[data-theme="light"] .code-hub-chips li.is-lang{color:color-mix(in srgb,rgb(var(--accent-rgb, 56, 189, 248)) 44%,#0f172a)}
html[data-theme="light"] .code-hub-hero .code-course-progress progress{border-color:rgb(15 23 42/0.18)}
html[data-theme="light"].space-root #site-main .code-course-hub .code-hub-hero .code-course-start{box-shadow:0px 8px 22px -10px rgb(15 23 42/0.14)}
html[data-theme="light"].space-root #site-main .code-course-hub .code-hub-hero .code-course-start:hover{box-shadow:0px 12px 26px -10px rgb(15 23 42/0.14)}
html[data-theme="light"] .code-hub-intro{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-list-head h2{color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-list-head .code-course-filters p{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-empty{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-part-name{color:color-mix(in srgb,rgb(var(--accent-rgb, 56, 189, 248)) 44%,#0f172a)}
html[data-theme="light"] .code-hub-part-goal{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-hub .code-hub-title{color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-topics{color:rgb(44 63 88)}
html[data-theme="light"] .code-course-hub .code-hub-status{color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-more-card{background:var(--reading-surface, rgb(252 252 253));color:rgb(44 63 88)}
html[data-theme="light"] .code-hub-more-card strong{color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-more-icon{color:color-mix(in srgb,rgb(var(--accent-rgb, 56, 189, 248)) 44%,#0f172a)}
html[data-theme="light"] .code-hub-resources h2{color:rgb(38 66 94)}
html[data-theme="light"] .code-hub-resources a{color:rgb(0 90 133)}
/* ▲▲ LIGHT THEME END ▲▲ */
