/* ==========================================================================
   CodeMaster - shared page vocabulary for every inner page (course, lesson, solve, account, small pages).
   Builds on cm2.css (tokens, header, buttons on Home). Light, white, Onest, .NET purple, rounded panels.
   ========================================================================== */

:root {
  --u: 28px; --ink-2: var(--muted); --font-code: var(--mono); --rule: var(--line);
  --warn: #B26A00; --err-bg: #FDECEA; --ok-bg: #E6F4EC;
}
html { scroll-padding-top: 88px; }
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
footer { margin-top: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #D9CCFF; color: var(--ink); }
:not(pre) > code { font-family: var(--mono); font-size: .86em; color: var(--brand-d); background: var(--soft); padding: 1px 6px; border-radius: 5px; }

/* ---- page frame -------------------------------------------------------------- */
.cm-page { width: min(1200px, 100% - 48px); margin-inline: auto; padding: 40px 0 80px; position: relative; }
.cm-page--wide { width: min(1400px, 100% - 48px); }
.cm-page h1 { font-size: clamp(32px, 4.2vw, 48px); line-height: 1.12; margin-bottom: 14px; }
.cm-page h2 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; }
.lede { font-size: 20px; line-height: 1.6; color: var(--muted); max-width: 38em; margin: 0 0 28px; }
.note { color: var(--muted); }
.hint { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 20px; max-width: 40em; }
.h-small { font: 700 18px/1.4 var(--font); margin: 0 0 8px; letter-spacing: 0; }
.crumbs { font: 500 15.5px/1.5 var(--font); color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs span[aria-hidden] { margin: 0 8px; opacity: .55; }
.cm-link { font-weight: 600; }

/* a number that leads a row: a small purple tile (the heading variants are hidden) */
.hang { display: inline-grid; place-items: center; flex: none; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; background: var(--soft); color: var(--brand); font: 700 16px/1 var(--font); }
.course-head .hang, .solve-head .hang { display: none; }
.hang-row { position: relative; }

/* ---- buttons / forms ---------------------------------------------------------- */
.cm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: 700 16.5px/1 var(--font); text-decoration: none; cursor: pointer; transition: background-color .12s, border-color .12s; }
.cm-btn:hover { background: var(--soft); border-color: var(--brand); color: var(--brand-d); text-decoration: none; }
.cm-btn--solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.cm-btn--solid:hover { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }
.cm-btn--sm { min-height: 38px; padding: 0 16px; font-size: 15.5px; border-radius: 8px; }
.cm-btn[disabled], .cm-btn.is-busy { opacity: .6; pointer-events: none; }

.cm-field { display: block; margin: 0 0 20px; }
.cm-field > .lbl, .cm-field > label.lbl { display: block; font: 600 16px/1.4 var(--font); margin-bottom: 6px; }
.cm-field input[type=text], .cm-field input[type=email], .cm-field input[type=password], .cm-field input[type=number], .cm-field select, .cm-field textarea {
  display: block; width: 100%; min-height: 48px; padding: 10px 14px; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; font: 400 18px/1.4 var(--font); color: var(--ink);
}
.cm-field textarea { resize: vertical; }
.cm-field input:focus, .cm-field textarea:focus, .cm-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(81, 43, 212, .18); }
.cm-field input::placeholder, .cm-field textarea::placeholder { color: #7D789A; }
.cm-field .hint { margin: 4px 0 0; font-size: 15px; }
.cm-field .err, .field-validation-error { display: block; color: var(--err); font-size: 15px; line-height: 1.4; margin-top: 4px; }
.validation-summary-errors { color: var(--err); background: var(--err-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 20px; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.cm-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.cm-check input { appearance: none; width: 22px; height: 22px; margin: 0; border: 1.5px solid var(--line); border-radius: 6px; background: #fff; display: grid; place-content: center; }
.cm-check input:checked { background: var(--brand); border-color: var(--brand); }
.cm-check input:checked::before { content: ""; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }

.cm-aside { background: var(--soft); border-radius: 12px; padding: 14px 18px; margin: 0 0 24px; color: var(--muted); }
.cm-aside.ok { background: var(--ok-bg); color: var(--ok); font-weight: 500; }
.cm-aside.pen { background: var(--err-bg); color: var(--err); font-weight: 500; }
.cm-aside.done { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--ok-bg); color: var(--ok); }
.cm-aside.done p { margin: 0; font: 700 19px/1.4 var(--font); }

/* ---- lists as cards ------------------------------------------------------------ */
.cm-rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.cm-rows > li { border-bottom: 1px solid var(--line); }
.cm-rows > li:last-child { border-bottom: 0; }
.cm-row { display: flex; align-items: center; gap: 14px; padding: 15px 20px; color: var(--ink); text-decoration: none; }
a.cm-row:hover { background: var(--soft); text-decoration: none; }
a.cm-row:hover .row-title { color: var(--brand); }
.row-title { font: 700 18.5px/1.35 var(--font); color: var(--ink); }
.row-sub { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 3px 0 0; }
.row-lead { flex: 1; }
.row-end { white-space: nowrap; color: var(--muted); font-weight: 600; font-size: 16px; }
.row-main { min-width: 0; }
.cm-row--two { display: block; padding: 15px 20px; }
.cm-row--two > .hang { float: left; margin-right: 14px; }
.cm-row--two .row-top { display: flex; align-items: center; gap: 12px; min-height: 34px; }
.cm-row--two .row-sub { margin-left: 48px; }
.sub-row { cursor: default; }

.mark { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.22em; flex: none; }
.mark path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mark--ok { color: var(--ok); } .mark--no { color: var(--err); } .mark--part { color: var(--warn); }
.circled { display: inline-block; padding: 4px 16px; border-radius: 999px; background: var(--soft); color: var(--brand); font: 800 22px/1.2 var(--font); }
.hl { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 3px; }

.cm-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 16px; }
.cm-table th { text-align: left; font: 700 15px/1.4 var(--font); background: var(--soft); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cm-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
.cm-table tr:last-child td { border-bottom: 0; }
.cm-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; padding: 0; }
.facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 110px; padding: 10px 16px; background: var(--soft); border-radius: 12px; }
.facts dt { font: 500 14px/1.3 var(--font); color: var(--muted); }
.facts dd { margin: 0; font: 700 18px/1.4 var(--font); }
.facts dd a { color: var(--ink); text-decoration: none; } .facts dd a:hover { color: var(--brand); }
.fact-timer dd { font-variant-numeric: tabular-nums; }
.fact-timer.is-warn dd { color: var(--err); }

/* ---- course / lessons --------------------------------------------------------- */
.course-head h1 { max-width: 16em; }
.course-sec { margin-top: 48px; }
.course-sec > h2 { margin-bottom: 16px; }
.course-sec.hang-row > .hang { margin-bottom: 8px; }
.sec-tools { margin: -4px 0 14px; }

.prose { font: 400 19px/1.8 var(--font); max-width: 44em; margin-top: 28px; }
.prose > * { margin: 0 0 1.1em; }
.prose h2 { font-size: 28px; line-height: 1.25; margin: 1.8em 0 .6em; }
.prose h3 { font-size: 22px; line-height: 1.3; margin: 1.5em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; } .prose li > p { margin: 0; }
.prose :not(pre) > code { font: 500 .85em/1 var(--mono); }
.prose strong { font-weight: 700; }
.prose a { font-weight: 500; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--brand); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-size: 16.5px; }
.prose th { text-align: left; background: var(--soft); padding: 8px 12px; border-bottom: 2px solid var(--line); }
.prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; }
.prose pre { background: var(--code); color: var(--code-ink); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font: 400 15.5px/1.7 var(--mono); }
.prose pre code { font: inherit; background: none; color: inherit; padding: 0; }
.code-block { max-width: min(100%, 46em); margin: 0 0 1.3em; border-radius: 12px; overflow: hidden; }

/* ---- solve: the same panes as the playground ----------------------------------- */
.ws-left .crumbs { margin-bottom: 12px; font-size: 14.5px; }
.ws-left h1 { font-size: 26px; line-height: 1.25; margin-bottom: 4px; }
.ws-left .facts { margin: 14px 0 20px; gap: 8px; }
.ws-left .facts > div { min-width: 0; padding: 7px 12px; border-radius: 10px; }
.ws-left .facts dd { font-size: 16px; }
.statement { font: 400 17.5px/1.75 var(--font); white-space: pre-line; margin: 0 0 24px; }
.statement code { font: 500 .85em var(--mono); }
.examples { margin-bottom: 24px; }
.examples code { white-space: pre-wrap; font-size: 14px; background: none; padding: 0; color: var(--ink); }
.brief-links ul { margin: 0; padding-left: 1.1em; } .brief-links li { line-height: 1.9; }
.ws .out { display: block; margin: 0; white-space: pre-wrap; font: 400 16.5px/1.7 var(--mono); padding-left: 14px; border-left: 4px solid var(--line); min-height: 1.7em; }
.ws .out.is-error, .ws .out.error { color: var(--err); border-left-color: var(--err); }
.ed-bar .run--ghost { background: transparent; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35) inset; }
.ed-bar .run--ghost:hover { background: rgba(255, 255, 255, .12); }
.ws .guest-note { margin: 0; padding: 10px 16px; font-size: 15.5px; background: var(--soft); border-top: 1px solid var(--line); }
.work-hint { margin: 10px 0 0; font-size: 14.5px; color: var(--muted); }

/* ---- the teacher's marking becomes a result dialog ------------------------------- */
.result-overlay { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(23, 19, 43, .55); }
.result-overlay.open { display: flex; }
.result-card { width: min(520px, 100%); background: #fff; border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(23, 19, 43, .5); padding: 30px 32px; }
.result-mark { min-height: 56px; margin-bottom: 4px; }
.result-mark svg { width: 56px; height: 56px; }
.result-mark .mark path { stroke-width: 3.2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.result-overlay.open .result-mark .mark path { animation: draw .5s .1s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.result-title { font: 800 28px/1.2 var(--font); margin: 6px 0 8px; }
.result-fail .result-title { color: var(--err); }
.result-success .result-title { color: var(--ok); }
.result-details { margin: 0 0 16px; color: var(--muted); white-space: pre-line; font-size: 16.5px; line-height: 1.6; }
.result-bar-wrap { height: 10px; border-radius: 999px; background: var(--soft); overflow: hidden; margin-bottom: 18px; }
.result-bar { height: 100%; width: 0; border-radius: 999px; background: var(--brand); transition: width .8s cubic-bezier(.2, .7, .2, 1); }
.result-success .result-bar { background: var(--ok); }
.result-points { min-height: 40px; margin-bottom: 16px; font: 800 24px/1.2 var(--font); color: var(--brand); }
.result-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.badge-earned { display: inline-flex; align-items: center; gap: 8px; background: var(--soft); padding: 4px 14px 4px 5px; border-radius: 999px; font: 600 15px/1.2 var(--font); }
.badge-earned .badge-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #FFE08A; font-size: 16px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.badge-toast { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(23, 19, 43, .35); padding: 10px 18px 10px 10px; transform: translateX(130%); transition: transform .38s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
.badge-toast.show { transform: none; } .badge-toast.hide { opacity: 0; }
.badge-toast-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #FFE08A; font-size: 22px; flex: none; }
.badge-toast-content { display: flex; flex-direction: column; }
.badge-toast-label { font: 500 13.5px/1.3 var(--font); color: var(--muted); }
.badge-toast-title { font: 700 17px/1.3 var(--font); }

/* ---- sign in / register ------------------------------------------------------------ */
.auth-page { display: grid; place-items: start center; padding-top: 56px; }
.auth-in { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px 32px 30px; box-shadow: 0 24px 60px -34px rgba(81, 43, 212, .45); }
.auth-in--wide { width: min(800px, 100%); }
.auth-in h1 { font-size: 30px; margin-bottom: 8px; }
.auth-in .lede { font-size: 17px; margin-bottom: 24px; }
.form-options { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin: 0 0 22px; font-size: 16px; }
.auth-submit { width: 100%; }
.auth-alt { margin: 20px 0 0; color: var(--muted); text-align: center; }
.register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 700px) { .register-grid { grid-template-columns: 1fr; } .auth-in { padding: 26px 20px; } }

/* ---- profile ------------------------------------------------------------------------ */
.pf-head h1 { font-size: clamp(34px, 4.6vw, 52px); margin-bottom: 8px; }
.pf-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 18px; color: var(--muted); font-weight: 500; }
.pf-bio { max-width: 34em; }
.pf-facts { margin-top: 24px; gap: 14px; }
.pf-facts > div { min-width: 150px; padding: 16px 22px; }
.pf-facts dd { font: 800 38px/1.1 var(--font); color: var(--brand); }
.pf-sec { margin-top: 48px; }
.pf-sec > h2 { margin-bottom: 18px; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sticker { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sticker .disc { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 2px dashed var(--line); font-size: 30px; line-height: 1; margin-bottom: 6px; }
.sticker.earned { border-color: #D9CCFF; background: #FBF9FF; }
.sticker.earned .disc { background: #FFE08A; border: 0; }
.sticker.legendary.earned .disc, .sticker.epic.earned .disc { box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--brand); }
.st-title { font: 700 16.5px/1.3 var(--font); }
.st-desc { font: 400 14px/1.45 var(--font); color: var(--muted); }
.sticker.locked { opacity: .75; } .sticker.locked .st-title { color: var(--muted); }
.cm-modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(23, 19, 43, .55); }
.cm-modal.open { display: flex; }
.cm-modal-card { width: min(520px, 100%); background: #fff; border-radius: 18px; padding: 28px 30px; box-shadow: 0 30px 80px -20px rgba(23, 19, 43, .5); }
.cm-modal-card h2 { font-size: 26px; margin-bottom: 18px; }
.cm-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---- progress ------------------------------------------------------------------------ */
.stats-sec { margin-top: 44px; }
.stats-sec > h2 { margin-bottom: 16px; }
.summary .sum-val { font: 800 22px/1.2 var(--font); color: var(--brand); }
.heatmap-wrapper { overflow-x: auto; padding-bottom: 6px; }
.heatmap-months { display: grid; grid-template-columns: repeat(53, 15px); font: 500 12.5px/20px var(--font); color: var(--muted); height: 22px; }
.heatmap-grid { display: grid; grid-template-rows: repeat(7, 12px) !important; grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; width: max-content; }
.heatmap-cell { width: 12px; height: 12px; background: var(--soft); border-radius: 3px; }
.heatmap-cell.level-1 { background: #D9CCFF; } .heatmap-cell.level-2 { background: #A98FF0; } .heatmap-cell.level-3 { background: #7B55E0; } .heatmap-cell.level-4 { background: var(--brand); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; font: 500 14px/1 var(--font); color: var(--muted); }
.heatmap-legend .legend-label { margin: 0 6px; }
.weekly-chart { display: flex; align-items: flex-end; gap: 8px; height: 230px; padding-top: 26px; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-value { font: 600 14px/20px var(--font); color: var(--brand); }
.bar-label { font: 500 12px/16px var(--font); color: var(--muted); margin-top: 4px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.courses-list .course-row { margin-bottom: 20px; }
.course-head-row, .course-head { }
.course-name { font: 700 19px/1.3 var(--font); }
.progress-bar { height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.progress-fill.progress-done { background: var(--ok); }

/* ---- small pages -------------------------------------------------------------------------- */
.err-page { padding-top: 72px; }
.err-code { font: 800 clamp(88px, 14vw, 170px)/.95 var(--font); color: var(--brand); margin: 0 0 18px; letter-spacing: -.04em; }
.err-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.err-rid { margin-top: 24px; font-size: 15.5px; }
.verdict { display: inline-flex; align-items: center; gap: 10px; font: 700 18px/1 var(--font); color: var(--ok); background: var(--ok-bg); padding: 10px 16px; border-radius: 999px; margin: 0 0 18px; }
.verdict .mark { width: 24px; height: 24px; }
.verify-facts { margin-bottom: 24px; }
.verify-facts .who { font-size: 26px; line-height: 1.3; }
.about-page .prose { margin-top: 0; }

@media (max-width: 899px) {
  .cm-page, .cm-page--wide { width: min(100% - 32px, 1200px); padding-top: 28px; }
  .facts { gap: 8px; }
  .ws .out { font-size: 15.5px; }
}

/* ==========================================================================
   Desk - the Playground's workspace, used by content pages (Home, lessons, a lesson, leaderboard).
   Lavender canvas, white panes with a tab-style bar on top, code always on the dark panel.
   No shadows, no gradients: panes are separated by the canvas showing through.
   ========================================================================== */
.desk { --gap: 10px; display: grid; gap: var(--gap); align-items: start; align-content: start; min-height: calc(100dvh - 72px); padding: var(--gap) max(var(--gap), (100% - 1560px) / 2); background: var(--soft); }
.desk > * { min-width: 0; }
.desk a:focus-visible, .desk button:focus-visible, .desk input:focus-visible { outline-offset: -3px; }

/* the strip on top of a pane: looks like the Playground's selected tab */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; min-height: 45px; padding: 0 14px 0 10px; background: var(--soft); border-bottom: 1px solid var(--line); flex: none; }
.bar-t { position: relative; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 14px; font: 600 16px/1 var(--font); letter-spacing: 0; color: var(--brand); }
.bar-t::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.bar-note { color: var(--muted); font-size: 15.5px; line-height: 1.4; padding: 6px 0; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.bar-link { font: 600 15.5px/1.3 var(--font); color: var(--brand); text-decoration: none; }
.bar-link:hover { text-decoration: underline; }
.bar-crumbs { margin: 0; padding: 12px 4px; font-size: 15px; }

.pane-in { padding: 30px 32px 32px; }
.pane-in--side { padding: 24px 22px 6px; }
.pane-h { font: 800 clamp(36px, 3.4vw, 52px)/1.06 var(--font); letter-spacing: -.025em; margin: 0 0 16px; max-width: 14em; }
.pane-h--side { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 10px; }
.pane-lead { font-size: 19px; line-height: 1.6; color: var(--muted); max-width: 34em; margin: 0 0 24px; }
.pane-in--side .pane-lead { font-size: 17px; margin-bottom: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.empty { margin: 0; padding: 16px 22px 24px; color: var(--muted); }

/* rows: number, title, value on the right, description under the title */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; column-gap: 14px; row-gap: 2px; align-items: baseline; padding: 15px 22px; color: var(--ink); text-decoration: none; }
.list--plain a { grid-template-columns: minmax(0, 1fr) auto; }
.list--tight a { padding: 10px 18px; column-gap: 12px; }
.list a:hover { background: #F8F6FE; }
.list a:hover .li-t { color: var(--brand); }
.list a[aria-current] { background: var(--soft); box-shadow: inset 3px 0 0 var(--brand); }
.list a[aria-current] .li-t, .list a[aria-current] .li-n { color: var(--brand); }
.li-n { font: 500 15px/1.5 var(--font); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.li-t { font: 600 18px/1.4 var(--font); }
.list--tight .li-t { font-size: 16.5px; font-weight: 500; }
.list--tight a[aria-current] .li-t { font-weight: 700; }
.li-e { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: var(--muted); font: 500 15.5px/1.4 var(--font); text-align: right; }
.li-d { grid-column: 2 / -1; color: var(--muted); font-size: 16px; line-height: 1.5; }
.list--plain .li-d { grid-column: 1 / -1; }
.meter { display: block; width: 96px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); }

/* code panel outside the Playground (desk pages and the Home hero) */
.desk .editor, .h-tray .editor { border-radius: 12px; background: var(--code); border-color: var(--code); }
.desk .ed-bar, .h-tray .ed-bar { gap: 12px; padding: 8px 10px 8px 16px; flex: none; }
.desk .ed-bar .run, .h-tray .ed-bar .run { margin-left: auto; }
pre.code { flex: 1; margin: 0; padding: 18px 20px 20px 12px; color: var(--code-ink); font: 400 16.5px/1.75 var(--mono); overflow-x: auto; }
.code-lines { counter-reset: ln; }
.code-lines .cl { display: block; min-height: 1.75em; white-space: pre; }
.code-lines .cl::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.2ch; margin-right: 20px; text-align: right; color: var(--cm); opacity: .7; user-select: none; }
.con-input { display: block; width: 100%; padding: 4px 0 6px; border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; background: none; font: 400 16.5px/1.6 var(--mono); color: var(--ink); }
.con-input:focus { outline: none; border-bottom-color: var(--brand); }
.con-hint { margin: 10px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---- side pane + main pane (lessons, a lesson, leaderboard) ---- */
.desk-two { grid-template-columns: minmax(260px, 23rem) minmax(0, 1fr); }
.side { position: sticky; top: 82px; max-height: calc(100dvh - 92px); }
.side-in { flex: 1; min-height: 0; overflow: auto; padding-bottom: 12px; }
.side-course { margin: 0; padding: 16px 18px 8px; font: 700 15.5px/1.4 var(--font); letter-spacing: 0; color: var(--muted); }
.pane-in .side-course { padding: 4px 0 0; }
.side-course a { color: var(--ink); text-decoration: none; }
.side-course a:hover { color: var(--brand); text-decoration: underline; }

.grp { scroll-margin-top: 82px; padding-bottom: 10px; }
.grp + .grp { border-top: 1px solid var(--line); }
.grp-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 26px 22px 10px; }
.grp-h h2 { font: 700 24px/1.25 var(--font); letter-spacing: -.01em; margin: 0; }
.grp-h h2 a { color: var(--ink); text-decoration: none; }
.grp-h h2 a:hover { color: var(--brand); }

/* ---- a lesson ---- */
.desk-read .doc { grid-column: 2; grid-row: 1; }
.desk-read .side { grid-column: 1; grid-row: 1; }
.doc-in { padding: 40px clamp(22px, 5vw, 64px) 48px; }
.doc-h { font-size: clamp(34px, 3.2vw, 46px); max-width: 20em; margin-bottom: 4px; }
.doc .prose { margin-top: 20px; max-width: 42em; }
.doc .code-block { max-width: min(100%, 44em); }
.doc-nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.doc-nav a { display: flex; flex-direction: column; gap: 4px; padding: 18px 24px; color: var(--ink); text-decoration: none; }
.doc-nav a:hover { background: #F8F6FE; }
.doc-nav a:hover .dn-t { color: var(--brand); }
.doc-nav .dn-next { grid-column: 2; text-align: right; border-left: 1px solid var(--line); }
.dn-dir { font: 500 14.5px/1.4 var(--font); color: var(--muted); }
.dn-t { font: 700 18px/1.35 var(--font); }

/* ---- leaderboard ---- */
.lb-me { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 8px; }
.lb-me > div { padding: 10px 14px; border-radius: 10px; background: var(--soft); }
.lb-me dt { font: 500 14px/1.3 var(--font); color: var(--muted); }
.lb-me dd { margin: 2px 0 0; font: 700 22px/1.3 var(--font); font-variant-numeric: tabular-nums; }
.lb-me > div:first-child dd { color: var(--brand); }
.picks { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.filter-btn { padding: 10px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font: 500 16.5px/1.3 var(--font); color: var(--ink); }
.filter-btn:hover { background: #F8F6FE; color: var(--brand); }
.filter-btn.active { background: var(--soft); color: var(--brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); border-radius: 0 8px 8px 0; }
.sort-btn { position: relative; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--muted); font: 600 16px/1 var(--font); }
.sort-btn:hover { color: var(--ink); }
.sort-btn.active { color: var(--brand); }
.sort-btn.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.lb-head, .lb-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 110px 90px 110px; gap: 12px; align-items: center; padding: 0 22px; }
.lb-head { padding-block: 12px; border-bottom: 1px solid var(--line); font: 600 14.5px/1.3 var(--font); color: var(--muted); }
.lb-row { padding-block: 13px; color: var(--ink); text-decoration: none; }
.lb-row + .lb-row { border-top: 1px solid var(--line); }
.lb-row:hover { background: #F8F6FE; }
.lb-row:hover .lb-name { color: var(--brand); }
.col-rank { font-variant-numeric: tabular-nums; }
.lb-row .col-rank { color: var(--muted); font-weight: 600; }
.lb-name { font: 600 17.5px/1.3 var(--font); }
.lb-tag { margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: var(--soft); color: var(--brand); font: 600 13px/1.4 var(--font); }
.col-points, .col-tasks, .col-streak { text-align: right; font-variant-numeric: tabular-nums; }
.lb-row .col-points { font-weight: 700; }
.lb-row .col-tasks, .lb-row .col-streak { color: var(--muted); }
.lb-row-me { background: var(--soft); box-shadow: inset 3px 0 0 var(--brand); }
.lb-row-me .col-rank { color: var(--brand); }
.lb-row-me .lb-tag { background: #fff; }

@media (max-width: 900px) {
  .desk { --gap: 8px; min-height: 0; }
  .desk-two { grid-template-columns: minmax(0, 1fr); }
  .desk-read .doc, .desk-read .side { grid-column: 1 / -1; grid-row: auto; }
  .side { position: static; max-height: none; }
  .pane-in { padding: 22px 20px 24px; }
  .pane-in--side { padding: 20px 18px 4px; }
  .doc-in { padding: 26px 20px 32px; }
  .list a { padding: 14px 18px; }
  .list--tight a { padding: 10px 16px; }
  pre.code { font-size: 14.5px; padding: 14px 14px 16px 6px; }
  .code-lines .cl::before { margin-right: 12px; }
  .doc-nav { grid-template-columns: 1fr; }
  .doc-nav .dn-next { grid-column: 1; text-align: left; border-left: 0; border-top: 1px solid var(--line); }
  .lb-head, .lb-row { grid-template-columns: 52px minmax(0, 1fr) 80px; padding: 0 16px; }
  .lb-head { padding-block: 10px; } .lb-row { padding-block: 12px; }
  .col-tasks, .col-streak { display: none; }
  .lb-me { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .lb-me > div { padding: 8px 10px; }
  .lb-me dd { font-size: 19px; }
  .picks { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 0 16px 6px; }
  .filter-btn, .filter-btn.active { padding: 8px 12px; border-radius: 8px; box-shadow: none; }
  .filter-btn { background: #F8F6FE; }
  .filter-btn.active { background: var(--brand); color: #fff; }
  .bar-note { flex-basis: 100%; padding: 0 4px 10px 14px; }
}

/* ==========================================================================
   Home - a plain front page. White sections, big quiet type; the one workspace on the page is
   the runnable sample in the hero (same tray, editor and console as the Playground).
   ========================================================================== */
.h-hero { padding: 64px 0 84px; }
.h-hero-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; align-items: center; }
.h-hero h1 { font-size: clamp(42px, 5vw, 64px); line-height: 1.04; letter-spacing: -.03em; max-width: 11em; }
.h-lede { font-size: 20px; line-height: 1.6; color: var(--muted); max-width: 30em; margin: 20px 0 28px; }
.h-tray { display: grid; gap: 10px; padding: 10px; border-radius: 16px; background: var(--soft); }
.h-tray pre.code { min-height: 200px; }
.h-tray .con .card-body { min-height: 104px; }

.h-sec { padding: 88px 0; }
.h-soft { background: var(--soft); }
.h-sec:not(.h-soft) + .h-sec:not(.h-soft) { padding-top: 0; }
.h-sec:not(.h-soft) + .h-sec:not(.h-soft) > .wrap { border-top: 1px solid var(--line); padding-top: 72px; }
.h-head { max-width: 40em; margin-bottom: 40px; }
.h-head h2, .h-about h2, .h-faq-wrap h2 { font-size: clamp(30px, 3.2vw, 40px); line-height: 1.15; margin-bottom: 10px; }
.h-head p { font-size: 19px; line-height: 1.55; color: var(--muted); margin: 0; }
.h-head--row { max-width: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }

/* how it works: each step shows the piece of the product it talks about */
.h-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; counter-reset: st; }
.h-steps > li { counter-increment: st; }
.h-steps h3 { display: flex; gap: 12px; align-items: baseline; margin: 22px 0 6px; font-size: 22px; line-height: 1.3; letter-spacing: -.01em; }
.h-steps h3::before { content: counter(st); color: var(--brand); }
.h-steps h3 + p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.h-shot { height: 172px; padding: 18px 20px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.h-shot--code { padding: 20px 0; background: var(--code); border-color: var(--code); }
.h-shot--code pre.code { padding: 0 18px; font-size: 13.5px; line-height: 1.85; overflow: hidden; }
.shot-t { display: block; margin-bottom: 6px; font: 700 17px/1.3 var(--font); }
.shot-p { margin: 0 0 14px; color: var(--muted); font-size: 15.5px; line-height: 1.5; }
.shot-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; color: var(--muted); font-size: 14.5px; }
.shot-ex span + code { margin-right: 8px; }
.shot-tests { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; font: 500 15.5px/1.4 var(--font); }
.shot-tests li { display: flex; align-items: center; gap: 8px; }
.shot-hidden { color: var(--muted); font-weight: 400; }
.shot-ok { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ok); font: 700 16px/1.3 var(--font); }

.h-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; }
.h-feats li { padding-top: 20px; border-top: 1px solid var(--line); }
.h-feats h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.3; letter-spacing: -.01em; }
.h-feats p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }

/* courses: a real sequence (each unlocks the next), so they sit on one line */
.h-path { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
.h-path::before { content: ""; position: absolute; top: 21px; left: 22px; right: calc((100% - 72px) / 4 - 22px); height: 2px; background: var(--line); }
.h-path a { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-right: 8px; color: var(--ink); text-decoration: none; }
.node { position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border: 2px solid var(--brand); border-radius: 50%; background: #fff; color: var(--brand); font: 700 18px/1 var(--font); }
.h-soft .node { background: var(--soft); }
.h-path a:hover .node { background: var(--brand); color: #fff; }
.h-path a:hover .p-t { color: var(--brand); }
.p-t { font: 700 22px/1.25 var(--font); }
.p-d { color: var(--muted); font-size: 16.5px; line-height: 1.5; }
.p-m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; font: 600 15.5px/1.4 var(--font); }
.p-m .meter { width: 100%; }

.h-lessons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; }
.h-lessons li { border-bottom: 1px solid var(--line); }
.h-lessons li:nth-child(-n+2) { border-top: 1px solid var(--line); }
.h-lessons a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 16px 0; color: var(--ink); text-decoration: none; }
.h-lessons a:hover .l-t { color: var(--brand); }
.l-t { font: 600 18.5px/1.4 var(--font); }
.l-c { color: var(--muted); font-size: 15.5px; white-space: nowrap; }

.h-about, .h-faq-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; }
.h-about .h-lede { margin: 0; }
.h-about-text { font-size: 18px; line-height: 1.7; }
.h-about-text p { margin: 0 0 1em; }
.h-faq details { border-bottom: 1px solid var(--line); }
.h-faq details:first-child { border-top: 1px solid var(--line); }
.h-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; list-style: none; cursor: pointer; font: 600 19px/1.4 var(--font); }
.h-faq summary::-webkit-details-marker { display: none; }
.h-faq summary::after { content: "+"; flex: none; color: var(--brand); font: 400 28px/1 var(--font); transition: transform .2s; }
.h-faq details[open] summary::after { transform: rotate(45deg); }
.h-faq summary:hover { color: var(--brand); }
.h-faq details p { max-width: 36em; margin: -4px 0 22px; color: var(--muted); font-size: 17.5px; line-height: 1.65; }

.h-cta { padding: 0 0 88px; }
.h-cta-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding: 40px 44px; border-radius: 16px; background: var(--soft); }
.h-cta-in h2 { font-size: clamp(26px, 2.6vw, 32px); line-height: 1.2; margin-bottom: 4px; }
.h-cta-in p { margin: 0; color: var(--muted); font-size: 18px; }
.h-cta-in .actions { margin: 0; }

@media (max-width: 980px) {
  .h-hero { padding: 32px 0 48px; }
  .h-hero-in, .h-about, .h-faq-wrap { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .h-about, .h-faq-wrap { gap: 20px; }
  .h-sec { padding: 56px 0; }
  .h-sec:not(.h-soft) + .h-sec:not(.h-soft) > .wrap { padding-top: 48px; }
  .h-head { margin-bottom: 28px; }
  .h-steps, .h-feats { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .h-feats { gap: 24px; }
  .h-tray { padding: 8px; gap: 8px; }
  .h-tray pre.code { min-height: 0; }
  .h-path { grid-template-columns: minmax(0, 1fr); }
  .h-path::before { display: none; }
  .h-path li:not(:last-child) > a { position: relative; }
  .h-path li:not(:last-child) > a::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 2px; background: var(--line); }
  .h-path a { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 16px; row-gap: 4px; padding: 0 0 28px; }
  .h-path li:last-child a { padding-bottom: 0; }
  .node { grid-row: span 3; margin: 0; }
  .h-lessons { grid-template-columns: minmax(0, 1fr); }
  .h-lessons li:nth-child(2) { border-top: 0; }
  .h-faq summary { font-size: 18px; }
  .h-cta { padding-bottom: 56px; }
  .h-cta-in { padding: 28px 22px; }
}

/* ============================================================
   Footer: quiet link columns, then one hairline row with the
   copyright and the author.
   ============================================================ */
.foot { border-top: 1px solid var(--line); background: #fff; padding: 48px 0 28px; color: var(--muted); font-size: 16px; }
.foot-top { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 32px 48px; padding-bottom: 40px; }
.foot-about .brand { font-size: 19px; }
.foot-about .brand i { width: 28px; height: 28px; border-radius: 7px; font-size: 16px; }
.foot-about p { margin: 12px 0 0; max-width: 26em; line-height: 1.6; }
.foot-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.foot-col h2 { margin: 0 0 6px; font: 600 16px/1.3 var(--font); color: var(--ink); }
.foot-col a { padding: 4px 0; color: var(--muted); font: 400 16px/1.4 var(--font); text-decoration: none; }
.foot-col a:hover { color: var(--ink); }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; }
.foot-by { margin: 0; }
.foot-by > a, .foot-by > span { color: var(--ink); font-weight: 500; text-decoration: none; }
.foot-by > a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot-mail { margin-left: 16px; color: var(--muted); }
.foot a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

@media (max-width: 760px) {
  .foot { padding-top: 40px; }
  .foot-top { grid-template-columns: 1fr 1fr; padding-bottom: 32px; }
  .foot-about { grid-column: 1 / -1; }
  .foot-base { flex-direction: column; }
}
