:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #efece5;
  --ink: #16151a;
  --ink-2: #4a4752;
  --ink-3: #6b6773;
  --line: #dcd8cf;
  --accent: #a3249f;          /* from the magenta in Kylar's own CodeHS CSS */
  --accent-ink: #ffffff;
  --accent-soft: #a3249f18;
  --code-bg: #14161b;
  --code-ink: #e7e9ee;
  --ok: #1d7a46;
  --radius: 14px;
  --shadow: 0 1px 2px #0000000d, 0 8px 24px #0000000f;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013; --surface: #17181d; --surface-2: #1f2027; --ink: #f1eff4; --ink-2: #c3bfcb; --ink-3: #9a96a3;
    --line: #2c2d35; --accent: #e070dc; --accent-ink: #1a0b19; --accent-soft: #e070dc1f; --ok: #5fd08f;
    --shadow: 0 1px 2px #00000040, 0 8px 24px #00000040; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013; --surface: #17181d; --surface-2: #1f2027; --ink: #f1eff4; --ink-2: #c3bfcb; --ink-3: #9a96a3;
  --line: #2c2d35; --accent: #e070dc; --accent-ink: #1a0b19; --accent-soft: #e070dc1f; --ok: #5fd08f;
  --shadow: 0 1px 2px #00000040, 0 8px 24px #00000040; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans); font-feature-settings: "ss01", "cv11";
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, kbd, pre { font-family: var(--mono); }
img { max-width: 100%; height: auto; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* header */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(10px); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.top nav { display: flex; gap: 4px; align-items: center; }
.top nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
@media (max-width: 560px) { .top nav .hide-sm { display: none; } }

/* hero */
.hero { padding: 48px 0 32px; display: grid; gap: 32px; align-items: center; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.15fr 1fr; padding: 72px 0 48px; } }
.eyebrow { font: 600 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.04; letter-spacing: -0.035em; margin: 0 0 18px; font-weight: 800; }
h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: clamp(17px, 2.2vw, 19px); color: var(--ink-2); max-width: 36em; margin: 0 0 24px; }
.split { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.split li { display: flex; gap: 12px; align-items: baseline; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 15px; color: var(--ink-2); }
.split code { font-size: 13px; color: var(--ink); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.hero-stage { justify-self: center; width: 100%; max-width: 360px; }
.hero-stage .frame { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; aspect-ratio: 402 / 482; }
.hero-stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.hero-stage figcaption { font-size: 13px; color: var(--ink-3); text-align: center; margin-top: 10px; }

/* program cards */
.section-title { font-size: 22px; letter-spacing: -0.02em; margin: 40px 0 16px; }
.cards { display: grid; gap: 16px; grid-template-columns: 1fr; padding: 0; margin: 0 0 56px; list-style: none; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0; font: 700 19px/1.25 var(--mono); letter-spacing: -0.02em; word-break: break-word; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; }
.card .idea { font-size: 14px; color: var(--ink-3); }
.card .go { margin-top: auto; font-weight: 600; font-size: 14px; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12px/1 var(--mono); padding: 6px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

/* program page */
.crumbs { font-size: 14px; color: var(--ink-3); margin: 28px 0 8px; }
.crumbs a { color: var(--ink-3); }
.ph h1 { font-family: var(--mono); font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.04em; word-break: break-word; margin-bottom: 8px; }
.ph .lede { margin-bottom: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-3); margin: 0 0 28px; padding: 0; list-style: none; }
.meta strong { color: var(--ink-2); font-weight: 600; }

.run { display: grid; gap: 24px; align-items: start; margin-bottom: 48px; }
@media (min-width: 900px) { .run { grid-template-columns: minmax(0, 402px) 1fr; } }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.stage .screen { width: 100%; aspect-ratio: 402 / 482; border: 0; display: block; border-radius: 6px; background: #fff; }
.stage .screen.console { aspect-ratio: auto; height: 300px; background: #14161b; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; }
.toolbar .hint { font-size: 13px; color: var(--ink-3); }

.btn { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 14px/1 var(--sans); padding: 10px 14px; border-radius: 10px; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }

.calc { display: flex; gap: 8px; margin-bottom: 10px; }
.calc input { flex: 1; min-width: 0; font: 16px/1.2 var(--mono); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; }
.calc input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.examples button { font: 13px/1 var(--mono); padding: 8px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; min-height: 32px; }
.examples button:hover { border-color: var(--accent); color: var(--accent); }

.pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; justify-content: center; margin-top: 12px; user-select: none; -webkit-user-select: none; }
.pad button { font: 700 16px/1 var(--mono); border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); touch-action: none; cursor: pointer; }
.pad button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pad .w { grid-column: 2; grid-row: 1; } .pad .a { grid-column: 1; grid-row: 2; } .pad .s { grid-column: 2; grid-row: 2; } .pad .d { grid-column: 3; grid-row: 2; }
.pad .space { grid-column: 1 / -1; grid-row: 3; height: 44px; }
.pad { grid-template-rows: 48px 48px 44px; }
@media (hover: hover) and (pointer: fine) { .pad.touch-only { display: none; } }

.prose h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 10px; }
.prose h2:not(:first-child) { margin-top: 28px; }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin: 0 0 12px; }
.prose ul { padding-left: 20px; margin: 0 0 12px; }
.prose code { font-size: .88em; background: var(--surface-2); color: var(--ink); padding: 1px 6px; border-radius: 6px; }
.prose kbd { font-size: .85em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--ink); }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 0 10px 10px 0; color: var(--ink-2); font-size: 15px; }

/* source */
.block { margin-bottom: 48px; }
.block > h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 6px; }
.block > .sub { color: var(--ink-3); font-size: 14px; margin: 0 0 16px; }
.hash { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--ink-3); padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); }
.hash code { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.hash .ok { color: var(--ok); font-weight: 600; }
.hash .bad { color: #d23b3b; font-weight: 600; }
.code { margin: 0; max-height: 640px; overflow: auto; background: var(--code-bg); color: var(--code-ink); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; line-height: 1.6; padding: 14px 0; tab-size: 4; }
.code code { display: block; counter-reset: ln; white-space: pre; min-width: max-content; }
.code .ln { display: block; padding: 0 18px 0 0; }
.code .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 3.2em; padding-right: 1.2em; text-align: right; color: #5c606c; user-select: none; -webkit-user-select: none; }
.token.comment { color: #7f8796; font-style: italic; }
.token.string, .token.template-string { color: #a8e0a1; }
.token.number, .token.boolean { color: #f5b97a; }
.token.keyword { color: #e08ee0; }
.token.function { color: #8bd5ff; }
.token.class-name { color: #ffd479; }
.token.operator, .token.punctuation { color: #b9bfcc; }
.token.regex { color: #f78c6c; }

/* evidence */
.shots { display: grid; gap: 16px; grid-template-columns: 1fr; margin: 0; padding: 0; list-style: none; }
@media (min-width: 760px) { .shots { grid-template-columns: repeat(3, 1fr); } }
.shots figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.shots a { display: block; }
.shots img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top left; border-bottom: 1px solid var(--line); }
.shots figcaption { padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font: 700 22px/1.2 var(--mono); letter-spacing: -0.03em; }
.stat span { font-size: 13px; color: var(--ink-3); }

/* footer */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
footer p { margin: 0 0 6px; }
.theme { background: none; border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: 13px; min-height: 32px; }
