/* CurlyScript's front page (home.html, which the website build serves as index.html). */
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo-2-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('../fonts/baloo-2-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/nunito-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }

/* Layout: a JavaScript-yellow opening band that holds a real "predict the output" question,
   then quiet white sections (a route through the six schools, real lesson screens, the book,
   questions) and a navy closing band. The yellow is the one loud thing on the page. */
:root {
  --js: #F7DF1E;            /* JavaScript yellow: the opening band */
  --ink: #1D2742;           /* navy text, buttons, code panel */
  --ink-soft: #4F5A76;      /* secondary text, navy-tinted */
  --ground: #FFFFFF;
  --tint: #FBF8E8;          /* a pale yellow wash for the book section */
  --line: #E6E2CF;          /* rules, yellow-tinted */
  --paper: #FFFFFF;         /* the question card */
  --edge: #1D2742;          /* the question card's outline and offset shadow */
  --hero-bg: var(--js);
  --hero-head: var(--ink);
  --hero-text: #2B3554;
  --code-bg: #1D2742;
  --code-text: #EEF1F8;
  --code-key: #F7DF1E;
  --code-num: #FFB27A;
  --code-fn: #7FDCCB;
  --code-str: #A8E07A;
  --good: #0D7A6A;
  --good-bg: #E2F6F1;
  --bad: #B93834;
  --bad-bg: #FDECEB;
  --closing-bg: #1D2742;
  --closing-text: #EEF1F8;
  --rule-big: #F7DF1E;      /* the First Rule, on the navy band */
  /* the schools' own colors, as on the game's map */
  --s-kiddie: #E3C600;
  --s-elementary: #1FA89A;
  --s-middle: #E2558C;
  --s-summer: #F08A24;
  --s-high: #7B61FF;
  --s-college: #2BA84A;

  --font-display: 'Baloo 2', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem);
  --step-3: clamp(2.5rem, 1.4rem + 4.6vw, 4.4rem);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #EEF1F8; --ink-soft: #A9B2C9; --ground: #10162A; --tint: #161D33; --line: #2A3352; --paper: #1B2340; --edge: #F7DF1E;
    --hero-bg: #161D33; --hero-head: #F7DF1E; --hero-text: #D3D9E8;
    --code-bg: #0B1022; --good: #5ED6BF; --good-bg: #123B37; --bad: #FF8A80; --bad-bg: #3E1E24;
    --closing-bg: #F7DF1E; --closing-text: #1D2742; --rule-big: #1D2742;
    --s-kiddie: #F7DF1E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #EEF1F8; --ink-soft: #A9B2C9; --ground: #10162A; --tint: #161D33; --line: #2A3352; --paper: #1B2340; --edge: #F7DF1E;
  --hero-bg: #161D33; --hero-head: #F7DF1E; --hero-text: #D3D9E8;
  --code-bg: #0B1022; --good: #5ED6BF; --good-bg: #123B37; --bad: #FF8A80; --bad-bg: #3E1E24;
  --closing-bg: #F7DF1E; --closing-text: #1D2742; --rule-big: #1D2742;
  --s-kiddie: #F7DF1E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
cite { font-style: italic; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); font-weight: 800; }
h3 { font-size: var(--step-1); font-weight: 700; line-height: 1.15; }
p { margin: 0; }
.small { font-size: 0.9375rem; }
:focus-visible { outline: 3px solid var(--s-high); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.band .wrap { padding-block: clamp(56px, 8vw, 104px); }
.section-lede { margin-top: 14px; max-width: 58ch; color: var(--ink-soft); font-size: 1.125rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border-radius: 999px;
  font: 800 1.125rem/1 var(--font-body); text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(2px); }
.btn-ink { background: var(--hero-head); color: var(--hero-bg); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); }
.btn-js { background: var(--closing-text); color: var(--closing-bg); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); }

/* ---------- the opening band ---------- */
.hero { background: var(--hero-bg); color: var(--hero-text); border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--hero-head); font: 800 1.375rem/1 var(--font-display); }
.brand-mark { width: 36px; height: 36px; display: inline-block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.topbar-links { display: flex; align-items: center; gap: 22px; }
.topbar-links a { font-weight: 800; color: var(--hero-head); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.topbar-links a[aria-current="page"] { text-decoration: none; opacity: 0.7; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding-block: clamp(28px, 5vw, 64px) clamp(56px, 8vw, 96px);
}
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero-copy h1 { color: var(--hero-head); max-width: 15ch; }
.lede { font-size: 1.1875rem; max-width: 46ch; }
.hero-actions { display: grid; gap: 12px; justify-items: start; margin-top: 6px; }

/* ---------- the question ---------- */
.quiz {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--edge);
  border-radius: var(--radius);
  padding: 26px 24px 24px;
  box-shadow: 10px 10px 0 var(--edge);
  min-width: 0;
  margin-top: 44px;
}
.quiz-curly { position: absolute; width: 104px; right: 18px; top: -92px; transition: transform 0.25s ease; }
.quiz-curly svg { width: 100%; height: auto; display: block; }
.quiz.right .quiz-curly { transform: translateY(-6px) rotate(-4deg); }
.quiz-kind { font: 700 1rem/1 var(--font-display); color: var(--ink-soft); }
.quiz-code {
  margin: 12px 0 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 12px;
  padding: 18px 20px;
  font: 400 clamp(0.95rem, 0.85rem + 0.5vw, 1.125rem)/1.7 var(--font-code);
  overflow-x: auto;
}
.quiz-code .k { color: var(--code-key); }
.quiz-code .n { color: var(--code-num); }
.quiz-code .f { color: var(--code-fn); }
.quiz-code .s { color: var(--code-str); }
.quiz-q { font-size: 1.375rem; margin-top: 18px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.opt {
  min-height: 52px; padding: 10px 14px;
  font: 400 1.0625rem/1.2 var(--font-code);
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px;
  cursor: pointer; text-align: left;
}
.opt:hover:not(:disabled) { border-color: var(--ink-soft); }
.opt.is-right { border-color: var(--good); background: var(--good-bg); color: var(--good); font-weight: 700; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.opt:disabled { cursor: default; }
.quiz-feedback { margin-top: 16px; display: grid; gap: 12px; }
.quiz-feedback:empty { display: none; }
.quiz-feedback .verdict { font-weight: 800; }
.quiz-feedback.good .verdict { color: var(--good); }
.quiz-feedback.bad .verdict { color: var(--bad); }
.quiz-feedback code { font-family: var(--font-code); font-size: 0.95em; white-space: nowrap; }
.quiz-feedback .btn { background: var(--ink); color: var(--paper); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); }
.quiz-next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.link-btn { background: none; border: 0; padding: 6px 2px; font: 800 1.0625rem/1 var(--font-body); color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: pointer; }

/* ---------- welcome to the school ---------- */
.welcome-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.welcome-copy { display: grid; gap: 16px; max-width: 60ch; }
.welcome-copy h2 { margin-bottom: 6px; }
.welcome-copy p { font-size: 1.1875rem; }
.welcome-copy .welcome-last { font: 700 1.5rem/1.2 var(--font-display); margin-top: 4px; }
.staff { display: grid; gap: 18px; }
.staff h3 { color: var(--ink-soft); font-size: 1.125rem; }
.staff-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.staff-list li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 18px; align-items: center; }
.staff-art svg { width: 100%; height: auto; display: block; }
.staff-text { color: var(--ink-soft); }
.staff-text strong { display: block; color: var(--ink); font: 700 1.25rem/1.2 var(--font-display); margin-bottom: 2px; }

/* ---------- the route through the schools ---------- */
.route-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.route-intro { display: grid; gap: 16px; position: sticky; top: 32px; }
.route-intro p { color: var(--ink-soft); font-size: 1.125rem; max-width: 40ch; }
.text-link { color: var(--ink); font-weight: 800; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.route { list-style: none; margin: 0; padding: 0; display: grid; }
.stop { position: relative; padding: 0 0 34px 54px; display: grid; gap: 4px; }
.stop::before { /* the stop on the line */
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--stop); border: 4px solid var(--ground); box-shadow: 0 0 0 2px var(--stop);
}
.stop::after { /* the line to the next stop */
  content: ''; position: absolute; left: 18px; top: 32px; bottom: 0; width: 4px; border-radius: 2px;
  background: var(--line);
}
.stop:last-child { padding-bottom: 0; }
.stop:last-child::after { display: none; }
.stop-kiddie { --stop: var(--s-kiddie); }
.stop-elementary { --stop: var(--s-elementary); }
.stop-middle { --stop: var(--s-middle); }
.stop-summer { --stop: var(--s-summer); }
.stop-high { --stop: var(--s-high); }
.stop-college { --stop: var(--s-college); }
.stop-grades { font-weight: 700; color: var(--ink-soft); font-size: 0.9375rem; }
.stop p:last-child { max-width: 52ch; }

/* ---------- lesson screens ---------- */
.screens {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px); margin-top: 40px;
}
.screen { margin: 0; display: grid; gap: 16px; align-content: start; }
.screen img, .screen video {
  width: 100%; height: auto; aspect-ratio: 390 / 844; object-fit: cover; object-position: top;
  border: 6px solid var(--ink); border-radius: 30px; background: var(--paper);
}
.screen figcaption { font-size: 1rem; color: var(--ink-soft); max-width: 34ch; }
.screen figcaption strong { color: var(--ink); display: block; font-size: 1.0625rem; }

/* ---------- tinted bands and quotes from the lessons ---------- */
.book-band { background: var(--tint); border-block: 1px solid var(--line); }
.excerpt {
  margin: 8px 0 0; padding: 4px 0 4px 22px;
  border-left: 4px solid var(--s-elementary);
  display: grid; gap: 10px;
  font-size: 1.1875rem; line-height: 1.55;
}
.excerpt footer { font-size: 0.9375rem; color: var(--ink-soft); }

/* ---------- questions ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(28px, 6vw, 88px); align-items: start; }
.faq { margin: 0; display: grid; }
.faq > div { padding: 22px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.faq > div:last-child { border-bottom: 1px solid var(--line); }
.faq dt { font: 700 1.25rem/1.25 var(--font-display); }
.faq dd { margin: 0; color: var(--ink-soft); max-width: 60ch; }

/* ---------- closing ---------- */
.closing { background: var(--closing-bg); color: var(--closing-text); }
.closing-inner {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: clamp(20px, 4vw, 48px);
  align-items: center; padding-block: clamp(44px, 6vw, 72px);
}
.closing-curly svg { width: 100%; height: auto; display: block; }
.closing p { margin-top: 8px; opacity: 0.85; max-width: 48ch; }

.foot .foot-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding-block: 28px; color: var(--ink-soft); font-size: 0.9375rem;
}
.foot-links { display: flex; gap: 20px; }

/* ---------- the About page ---------- */
.about-hero { display: grid; gap: 20px; padding-block: clamp(24px, 4vw, 48px) clamp(48px, 7vw, 80px); }
.about-hero h1 { color: var(--hero-head); max-width: 20ch; font-size: clamp(2.2rem, 1.3rem + 3.6vw, 3.6rem); }
.about-hero .lede { max-width: 58ch; }
.prose { display: grid; gap: 16px; }
.prose > * { max-width: 66ch; }
.prose h2 { margin-bottom: 8px; }
.prose p { font-size: 1.125rem; }
.prose code { white-space: nowrap; font: 400 0.95em var(--font-code); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.prose .punch { font: 700 1.5rem/1.25 var(--font-display); margin-top: 8px; }
.prose a { text-underline-offset: 3px; }
.rule-band { background: var(--closing-bg); color: var(--closing-text); }
.rule-inner { display: grid; gap: 12px; padding-block: clamp(56px, 8vw, 96px); }
.rule-name { font: 700 1.25rem/1.2 var(--font-display); opacity: 0.85; }
.rule-text { font: 800 clamp(3rem, 1.6rem + 6vw, 6rem)/0.95 var(--font-display); color: var(--rule-big); letter-spacing: -0.01em; }
.rule-why { max-width: 60ch; font-size: 1.125rem; margin-top: 8px; opacity: 0.9; }
.promises { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 64px); margin-top: 32px; }
.promises h3 { margin-bottom: 14px; }
.promise-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.promise-list li { position: relative; padding-left: 38px; font-size: 1.0625rem; }
.promise-list li::before {
  position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 800 0.9rem/1 var(--font-body);
}
.promise-list.yes li::before { content: '\2713'; background: var(--good-bg); color: var(--good); }
.promise-list.no li::before { content: '\2715'; background: var(--bad-bg); color: var(--bad); }
.faculty { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: center; }
.faculty-art svg { width: 100%; height: auto; display: block; }
.faculty-quote { margin: 0; display: grid; gap: 14px; }
.faculty-quote blockquote { margin: 0; font: 800 clamp(1.6rem, 1.1rem + 2vw, 2.4rem)/1.15 var(--font-display); text-wrap: balance; }
.faculty-quote figcaption { color: var(--ink-soft); }

/* ---------- school pages ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.9375rem; font-weight: 700; color: var(--hero-text); }
.crumbs a { color: var(--hero-head); text-underline-offset: 3px; }
.school-dot { display: inline-block; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--stop, var(--hero-head)); margin-right: 0.3em; vertical-align: 0.08em; border: 3px solid var(--hero-head); }
.school-kiddie { --stop: var(--s-kiddie); }
.school-elementary { --stop: var(--s-elementary); }
.school-middle { --stop: var(--s-middle); }
.school-summer { --stop: var(--s-summer); }
.school-high { --stop: var(--s-high); }
.school-college { --stop: var(--s-college); }
.grade-band + .grade-band .wrap { border-top: 1px solid var(--line); }
.grade-band .wrap { padding-block: clamp(40px, 6vw, 72px); }
.grade-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.grade-head { display: grid; gap: 8px; }
.grade-label { font: 700 1.0625rem/1 var(--font-display); color: color-mix(in srgb, var(--stop, var(--ink-soft)) 55%, var(--ink)); }
.school-kiddie .grade-label { color: var(--ink-soft); }
.grade-count { color: var(--ink-soft); }
.grade-body { display: grid; gap: 14px; }
.grade-body h3 { font-size: 1.125rem; color: var(--ink-soft); }
.grade-body h3 + ul, .grade-body h3 + ol { margin-top: -4px; }
.learn-list, .lesson-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.learn-list code, .lesson-list code { font: 400 0.92em var(--font-code); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; overflow-wrap: anywhere; }
.lesson-list li::marker { font-weight: 800; color: var(--ink-soft); }
.lesson-list strong { display: block; }
.lesson-list span { color: var(--ink-soft); }
.school-nav .wrap { padding-block: 32px 56px; }
.school-nav-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.school-step { display: grid; gap: 2px; text-decoration: none; padding: 14px 18px; border: 2px solid var(--line); border-radius: 14px; min-width: min(100%, 220px); }
.school-step:hover { border-color: var(--ink-soft); }
.school-step span { font-size: 0.9375rem; color: var(--ink-soft); }
.school-step strong { font: 700 1.25rem/1.2 var(--font-display); }
.school-step.next { text-align: right; margin-left: auto; }
.route-wide .stop { padding-bottom: 40px; }
.stop-name { font-size: var(--step-1); font-weight: 700; line-height: 1.15; }
.stop h3 a, .stop-name a { text-underline-offset: 4px; text-decoration-thickness: 2px; }
.foot-schools { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-schools a, .foot-links a { color: var(--ink-soft); }

/* ---------- the course notes (learn/...) ---------- */
.foot-learn { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-learn a { color: var(--ink-soft); }
.hero-slim .note-hero { display: grid; gap: 14px; padding-block: clamp(16px, 3vw, 32px) clamp(32px, 5vw, 52px); }
.note-hero h1 { color: var(--hero-head); max-width: 24ch; font-size: clamp(2rem, 1.3rem + 2.8vw, 3.2rem); }
.note-meta { font-weight: 700; color: var(--hero-text); max-width: 60ch; }
.read-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(32px, 6vw, 72px); padding-block: clamp(36px, 5vw, 64px); align-items: start; }
.read-narrow { max-width: 820px; padding-block: clamp(28px, 4vw, 48px); }
.note { max-width: 70ch; min-width: 0; }
.note > p, .ncall-body > p { margin: 0 0 1.05em; line-height: 1.72; }
.note > h2, .note .gl-letter { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); margin: 1.6em 0 0.5em; scroll-margin-top: 16px; }
.note > :first-child { margin-top: 0; }
.note ul, .note ol { margin: 0 0 1.1em; padding-left: 1.4em; display: grid; gap: 6px; line-height: 1.6; }
.note li ul { margin: 6px 0 0; }
.note code, .glossary code, .cheat code, .page-list code { font: 400 0.9em var(--font-code); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; overflow-wrap: anywhere; }
.note kbd { font: 700 0.85em var(--font-code); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; background: var(--paper); }
.note a.term { color: inherit; text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.note a.term:hover { text-decoration-style: solid; }
.n-big { font: 800 clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem)/1.3 var(--font-display); margin: 0.6em 0 1em; color: var(--ink); }

/* code examples: the navy panel from the front page, with what it prints underneath */
.nc { margin: 1.4em 0 1.6em; }
.nc-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 6px; font: 700 0.875rem/1 var(--font-display); color: var(--ink-soft); }
.nc-badge { font: 800 0.75rem/1 var(--font-body); padding: 4px 8px; border-radius: 999px; }
.nc-badge.bad { background: var(--bad-bg); color: var(--bad); }
.nc-badge.good { background: var(--good-bg); color: var(--good); }
.nc-code, .nc textarea {
  display: block; width: 100%; margin: 0; padding: 16px 18px; border: 0; border-radius: 12px;
  background: var(--code-bg); color: var(--code-text); font: 400 0.95rem/1.65 var(--font-code);
  overflow-x: auto; white-space: pre; tab-size: 2; box-sizing: border-box;
}
.nc-code code { font: inherit; background: none; border: 0; padding: 0; color: inherit; overflow-wrap: normal; }
.nc textarea { resize: vertical; outline: 3px solid var(--code-key); outline-offset: -3px; }
.nc-wrong .nc-code { box-shadow: inset 4px 0 0 var(--bad); }
.nc-right .nc-code { box-shadow: inset 4px 0 0 var(--good); }
.t-kw, .t-lit { color: var(--code-key); }
.t-str, .t-sub { color: var(--code-str); }
.t-num, .t-cls { color: var(--code-num); }
.t-fn, .t-bi, .t-prop { color: var(--code-fn); }
.t-com { color: #9AA5C3; font-style: italic; }
.nc-out, .nc-console { margin-top: 8px; padding: 10px 16px 12px; border-radius: 12px; background: var(--tint); border: 1px solid var(--line); }
.nc-out-label { font: 700 0.8125rem/1.2 var(--font-display); color: var(--ink-soft); margin-bottom: 4px; }
.nc-out pre, .nc-console pre { margin: 0; font: 400 0.9rem/1.6 var(--font-code); white-space: pre-wrap; overflow-wrap: anywhere; }
.nc-console .err { color: var(--bad); }
.nc-console .muted { color: var(--ink-soft); font-style: italic; }
.nc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nc-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font: 800 0.9375rem/1 var(--font-body); color: var(--ink); background: var(--paper); border: 2px solid var(--line);
}
.nc-btn:hover { border-color: var(--ink-soft); }
.nc-btn.run { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.nc-btn:disabled { opacity: 0.6; cursor: progress; }
.nc-btn svg { width: 14px; height: 14px; }
.runner-frame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }

/* callouts: tips, Buggsy's warnings, the Professor's Corner... */
.ncall { margin: 1.4em 0 1.6em; padding: 16px 18px 6px; border-radius: 14px; background: var(--k-soft); border-left: 5px solid var(--k); }
.ncall-tip { --k: #C9A800; --k-soft: #FFF8D6; }
.ncall-bug { --k: #E05252; --k-soft: #FDECEB; }
.ncall-prof { --k: #6A4FE0; --k-soft: #EFEBFF; }
.ncall-try { --k: #1FA89A; --k-soft: #E2F6F1; }
.ncall-fun { --k: #D9487E; --k-soft: #FDE8F0; }
.ncall-recap { --k: #2BA84A; --k-soft: #E6F6EA; }
.ncall-note { --k: var(--ink-soft); --k-soft: var(--tint); }
.ncall-analogy { --k: #E07A12; --k-soft: #FFF0E0; }
.ncall-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ncall-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ground); color: var(--k); flex: none; }
.ncall-icon svg { width: 20px; height: 20px; }
.ncall-art { width: 46px; flex: none; }
.ncall-art svg { width: 100%; height: auto; display: block; }
.ncall-kind { display: block; font: 800 0.8125rem/1.2 var(--font-display); color: color-mix(in srgb, var(--k) 62%, var(--ink)); }
.ncall-title { display: block; font: 700 1.125rem/1.25 var(--font-display); }
.ncall-body .nc { margin: 0.6em 0 1em; }
.ncall-body ul, .ncall-body ol { margin-bottom: 0.9em; }

.n-table { overflow-x: auto; margin: 1.2em 0 1.4em; border: 1px solid var(--line); border-radius: 12px; }
.n-table table { border-collapse: collapse; width: 100%; font-size: 0.975rem; line-height: 1.5; }
.n-table th { text-align: left; background: var(--tint); font: 700 0.95rem/1.3 var(--font-display); padding: 10px 12px; }
.n-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.n-fig { margin: 1.4em 0 1.6em; }
.n-fig-art { background: #FFFDF6; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.n-fig-art svg { display: block; width: 100%; height: auto; }
.n-fig figcaption { margin-top: 8px; text-align: center; color: var(--ink-soft); font-size: 0.9375rem; }

/* the grade's other pages, beside the article */
.note-side { position: sticky; top: 20px; display: grid; gap: 18px; font-size: 0.9375rem; }
.side-title { font-size: 1.125rem; line-height: 1.2; }
.side-title a { text-decoration: none; }
.side-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.side-pages { margin: 0; padding-left: 1.6em; display: grid; gap: 7px; color: var(--ink-soft); }
.side-pages a { color: var(--ink-soft); text-decoration: none; }
.side-pages a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.side-pages [aria-current] { color: var(--ink); font-weight: 800; }
.side-pages li:has([aria-current])::marker { color: var(--stop, var(--ink)); font-weight: 800; }
.practice-card { display: grid; gap: 14px; padding: 18px; border-radius: 16px; background: var(--tint); border: 1px solid var(--line); line-height: 1.5; }
.practice-card .btn { min-height: 46px; font-size: 1rem; justify-self: start; }
.note-nav .wrap { padding-block: 0 56px; }

/* learn/: every grade */
.hub-grades { gap: 26px; }
.hub-grade { display: grid; gap: 6px; }
.hub-grade h3 a { text-underline-offset: 4px; text-decoration-thickness: 2px; }
.hub-grade p { color: var(--ink); max-width: 60ch; }
.hub-grade .muted { color: var(--ink-soft); }
.hub-grade summary { cursor: pointer; font-weight: 800; color: var(--ink-soft); width: max-content; }
.hub-grade details ol { margin: 8px 0 0; padding-left: 1.6em; display: grid; gap: 5px; }
.hub-grade details a { color: var(--ink-soft); }
.hub-school + .hub-school .wrap { border-top: 1px solid var(--line); }
.hub-school .wrap { padding-block: clamp(40px, 6vw, 72px); }
.hub-school h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
.page-list a { text-underline-offset: 3px; }
.grade-notes { margin-top: 4px; }

/* the glossary and the cheat sheet */
.gl-letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.gl-letters a { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); font-weight: 800; text-decoration: none; }
.gl-letters a:hover { border-color: var(--ink-soft); }
.glossary { margin: 0 0 1em; display: grid; gap: 4px; }
.glossary > div { padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.glossary > div:target { background: var(--tint); box-shadow: -12px 0 0 var(--tint), 12px 0 0 var(--tint); }
.glossary dt { font: 800 1.125rem/1.3 var(--font-display); }
.glossary dd { margin: 4px 0 0; line-height: 1.6; max-width: 66ch; }
.cs-jump { padding-top: clamp(28px, 4vw, 44px); }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 28px; padding-block: 24px clamp(48px, 6vw, 80px); }
.cheat { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cheat h2 { font-size: 1.375rem; scroll-margin-top: 16px; }
.cheat .nc-code { font-size: 0.875rem; }

@media (max-width: 960px) {
  .read-grid { grid-template-columns: minmax(0, 1fr); }
  .note-side { position: static; border-top: 1px solid var(--line); padding-top: 28px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ncall { --k-soft: var(--tint); }
  :root:not([data-theme="light"]) .n-fig-art { background: #FFFDF6; }
}
:root[data-theme="dark"] .ncall { --k-soft: var(--tint); }

/* ---------- ads on the reading pages ---------- */
.ad-slot { margin: 28px 0; padding: 10px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 140px; }
.ad-label { margin: 0 0 8px; font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); text-align: center; }
.adsbygoogle { display: block; }
/* nothing to show (no ad, or an ad blocker): no empty box */
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }

/* ---------- the install page (install.html) ---------- */
/* Each phone gets its own band: the four taps on the left, a drawing of the menu to look for on
   the right, with the item to tap in JavaScript yellow. */
.install-now { display: grid; gap: 8px; justify-items: start; }
.install-done { font-weight: 700; }
.device-pick { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--hero-head); justify-self: start; }
.device-pick button {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  font: 800 1rem/1 var(--font-body); background: transparent; color: var(--hero-bg);
}
.device-pick button[aria-pressed="true"] { background: var(--hero-bg); color: var(--hero-head); }
.howto + .howto .wrap { border-top: 1px solid var(--line); }
.howto[hidden], .device-pick[hidden], .install-now[hidden], .install-done[hidden] { display: none; }
.howto[hidden] + .howto .wrap { border-top: 0; }
.howto-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(28px, 6vw, 80px); align-items: center; }
.howto-text { display: grid; gap: 14px; }
.howto-browser { font: 700 var(--step-1)/1.2 var(--font-display); color: var(--ink-soft); }
.howto-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 18px; counter-reset: tap; }
.howto-steps li { counter-increment: tap; position: relative; padding-left: 54px; min-height: 40px; font-size: 1.125rem; }
.howto-steps li::before {
  content: counter(tap); position: absolute; left: 0; top: -3px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; background: var(--js); color: #1D2742; font: 800 1.25rem/1 var(--font-display);
  border: 2px solid var(--ink);
}
.howto-steps .aside { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 1rem; }
.howto-other { color: var(--ink-soft); border-left: 4px solid var(--js); padding-left: 14px; max-width: 60ch; }
.howto-other strong { color: var(--ink); }
.key {
  display: inline-grid; place-items: center; min-width: 1.9em; height: 1.6em; padding: 0 6px; margin-inline: 2px;
  border: 2px solid var(--ink); border-radius: 8px; font-weight: 800; line-height: 1; vertical-align: 0.05em;
}
.site-name { white-space: nowrap; }
.phone-figure { margin: 0; display: grid; gap: 10px; justify-items: center; }
.phone-figure figcaption { color: var(--ink-soft); text-align: center; max-width: 30ch; }
.phone { width: min(100%, 280px); height: auto; display: block; }
.ph-body { fill: var(--ink); }
.ph-screen { fill: var(--ground); }
.ph-notch { fill: var(--ink); }
.ph-line { fill: var(--line); }
.ph-line.soft { opacity: 0.7; }
.ph-sheet { fill: var(--paper); stroke: var(--line); stroke-width: 2; }
.ph-rule { fill: var(--line); }
.ph-bar { fill: var(--tint); stroke: var(--line); stroke-width: 2; }
.ph-hi { fill: var(--js); }
.ph-icon { fill: none; stroke: #1D2742; stroke-width: 2; }
.ph-plus { stroke: #1D2742; stroke-width: 2; stroke-linecap: round; }
.ph-text { font: 700 13px var(--font-body); fill: var(--ink-soft); }
.ph-text.small { font-size: 12px; font-weight: 400; }
.ph-text.strong { fill: #1D2742; font-weight: 800; }
.howto .ph-bar + .ph-text.strong { fill: var(--ink); }
@media (max-width: 860px) {
  .howto-grid { grid-template-columns: minmax(0, 1fr); }
  .phone { width: min(70%, 240px); }
}

/* ---------- narrow screens ---------- */
/* the top bar: logo and three links have to fit a 360px phone; on the very smallest
   screens the links move under the logo instead of spilling off the side */
@media (max-width: 560px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topbar { flex-wrap: wrap; gap: 6px 12px; padding-block: 14px; }
  .brand { gap: 8px; font-size: 1.2rem; }
  .brand-mark { width: 30px; height: 30px; }
  .topbar-links { gap: 14px; font-size: 0.975rem; }
}
@media (max-width: 860px) {
  .hero-grid, .route-grid, .faq-grid, .welcome-grid, .promises, .grade-grid { grid-template-columns: minmax(0, 1fr); }
  .faculty { grid-template-columns: 96px minmax(0, 1fr); }
  .route-intro { position: static; }
  .quiz { margin-top: 84px; }
  .screens {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(72%, 280px);
    overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px;
  }
  .screen { scroll-snap-align: start; }
  .closing-inner { grid-template-columns: 88px minmax(0, 1fr); }
  .closing-inner .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 420px) {
  .quiz { padding: 22px 16px 18px; box-shadow: 6px 6px 0 var(--edge); }
  .quiz-code { font-size: 0.8125rem; padding: 14px 14px; }
  .quiz-options { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* code shows exactly what you'd type: no joined-up => or !== from the code font */
/* (:root makes this outrank the panels that set the font with the font shorthand) */
:root code, :root pre, :root kbd, :root textarea, :root .opt, :root .quiz-code {
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
