:root {
  color-scheme: light;
  --surface: #f3f6fd;
  --paper: #fff;
  --ink: #151f3b;
  --muted: #4d5c7f;
  --line: #d5def0;
  --accent: #2449db;
  --accent-deep: #1535b0;
  --blue-wash: #e8eeff;
  --red: #9f2a3e;
  --red-wash: #fcebef;
  --green: #09634b;
  --green-wash: #ddf4ea;
  --code: #101a35;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-deep); text-underline-offset: .18em; }
button, textarea { font: inherit; }
button, summary { cursor: pointer; }
a:focus-visible, button:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #3157f0; outline-offset: 4px; }
button[disabled] { cursor: wait; opacity: .65; }
h1, h2, h3, p { margin: 0; }
code, pre, textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.shell { width: min(1144px, calc(100% - 60px)); margin-inline: auto; }
.bar { border-bottom: 1px solid var(--line); background: var(--paper); }
.bar-inner, .footer { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
nav, .footer div { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
nav a, .footer a { color: var(--muted); text-decoration: none; font-size: .92rem; }
nav a:hover, .footer a:hover { text-decoration: underline; color: var(--accent-deep); }
.skip { position: absolute; left: 18px; top: -60px; padding: 8px 14px; background: white; z-index: 9; }
.skip:focus { top: 10px; }
main { min-height: calc(100vh - 150px); }
.hero { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(0, .86fr); align-items: center; gap: clamp(26px, 5vw, 85px); padding-block: clamp(48px, 7vw, 97px) clamp(45px, 6vw, 84px); }
h1 { font-size: clamp(3rem, 7vw, 5.95rem); line-height: .99; letter-spacing: -.055em; font-weight: 790; }
.hero-copy p { margin: 22px 0 28px; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.17rem); max-width: 36rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button { background: var(--accent); color: white; text-decoration: none; border: 1px solid var(--accent); border-radius: 8px; padding: 9px 15px; font-weight: 720; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }
.button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.button.secondary { color: var(--ink); background: var(--paper); border-color: var(--line); }
.button.secondary:hover { background: var(--blue-wash); border-color: #acbdf6; }
.hero-art { border: 1px solid #c4d0ec; background: #dfe9ff; border-radius: 17px; padding: clamp(14px, 3vw, 30px); }
.preview { overflow: hidden; border-radius: 11px; background: var(--code); color: #eaf0ff; box-shadow: 0 14px 30px #3152a225; }
.preview-header { padding: 13px 16px; border-bottom: 1px solid #40537f; color: #cfdbfa; display: flex; justify-content: space-between; align-items: center; font-size: .83rem; gap: 6px; }
.preview-header span:last-child { color: #a2b4de; }
.preview-body { padding: 15px 16px 17px; }
.trace { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 15px; align-items: center; }
.trace p { font-size: .82rem; color: #d1defb; }
.trace code { font-size: 1.1rem; }
.trace hr { grid-column: 1 / -1; width: 100%; border: 0; border-top: 1px solid #40537f; margin: 5px 0; }
.art-caption { margin-top: 10px; color: #344c85; font-size: .82rem; }
.pill { border-radius: 999px; font-size: .77rem; font-weight: 720; padding: 3px 8px; color: var(--accent-deep); background: var(--blue-wash); display: inline-flex; align-items: center; white-space: nowrap; }
.pill.fail { background: var(--red-wash); color: var(--red); }
.pill.pass { background: var(--green-wash); color: var(--green); }
.library { padding-bottom: 64px; }
.library-head { border-top: 1px solid var(--line); padding: 23px 0 16px; display: flex; gap: 14px; justify-content: space-between; align-items: end; flex-wrap: wrap; }
h2 { font-size: clamp(1.7rem, 4vw, 2.25rem); line-height: 1.13; letter-spacing: -.045em; }
.tally, .meta, .help { color: var(--muted); font-size: .87rem; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filters button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 5px 10px; border-radius: 6px; font-size: .86rem; font-weight: 650; }
.filters button[aria-pressed="true"] { background: var(--blue-wash); color: var(--accent-deep); border-color: #c5d2ff; }
.filters button:hover { border-color: #bfcbed; }
.lesson-list { display: grid; gap: 8px; }
.lesson-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px 19px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.lesson-row:hover { border-color: #a7b9e9; }
.lesson-row h3 { font-size: 1.1rem; line-height: 1.3; }
.lesson-row h3 a { color: var(--ink); text-decoration: none; }
.lesson-row h3 a:hover { color: var(--accent-deep); text-decoration: underline; }
.lesson-row .summary { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.row-meta { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.row-meta a { text-decoration: none; font-weight: 720; }
.footer { border-top: 1px solid var(--line); padding-block: 15px; color: var(--muted); }
.footer > span { font-weight: 700; }
.lesson { padding-block: 28px 64px; }
.back { display: inline-block; font-size: .9rem; margin-bottom: 19px; }
.lesson-head h1 { font-size: clamp(2.55rem, 6.3vw, 4.35rem); margin: 10px 0; }
.lesson-head .summary { color: var(--muted); font-size: 1.09rem; }
.workbench { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); align-items: start; gap: 22px; margin-top: 24px; }
.brief, .editor, .result, .solution { border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: clamp(14px, 2.1vw, 21px); }
.brief h2, .editor h2, .result h2, .solution h2 { font-size: 1.28rem; letter-spacing: -.02em; }
.brief p { margin: 9px 0 18px; color: var(--muted); overflow-wrap: anywhere; }
.brief details { border-top: 1px solid var(--line); padding-block: 9px; }
.brief details summary, .solution summary { font-weight: 700; }
.command { display: block; margin-top: 7px; background: var(--blue-wash); padding: 8px; border-radius: 5px; overflow-x: auto; font-size: .8rem; }
.editor-stack { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 13px; }
.editor-top { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
textarea { display: block; width: 100%; min-height: 320px; padding: 14px; color: #e9efff; background: var(--code); border: 1px solid #334976; border-radius: 8px; margin: 10px 0 12px; resize: vertical; tab-size: 2; font-size: .86rem; line-height: 1.6; }
.result .status { color: var(--muted); margin-top: 5px; }
.result .status[data-state="fail"], .result .status[data-state="error"] { color: var(--red); }
.result .status[data-state="pass"] { color: var(--green); font-weight: 750; }
.check-results { list-style: none; margin: 9px 0 0; padding: 0; }
.check-results li { padding-block: 8px; border-top: 1px solid var(--line); }
.check-results li p { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.check-results .pill { margin-right: 7px; }
.solution pre { margin-bottom: 0; overflow-x: auto; background: var(--code); color: #e9efff; padding: 12px; border-radius: 8px; font-size: .85rem; }
.solution p { margin-block: 8px; color: var(--muted); }
.preview-scroll { max-width: 100%; overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.layout-preview { display: block; border: 0; height: 180px; background: white; }
.exercise-runner { border: 0; height: 850px; position: fixed; left: -10000px; top: 0; pointer-events: none; }
.notice { margin-block: 40px; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .hero, .workbench { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 520px; }
  .lesson-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; }
  .lesson-row .row-category { grid-column: 1 / -1; }
}
@media (max-width: 470px) {
  .bar-inner, .footer { gap: 10px; }
  nav, .footer div { gap: 10px; }
  nav a, .footer a { font-size: .83rem; }
  .footer { align-items: start; flex-direction: column; }
  .lesson-row { grid-template-columns: 1fr; }
  .lesson-row .row-meta { justify-content: space-between; }
  .trace { gap: 9px; }
}
