:root {
  color-scheme: dark;
  --type-scale: 1;
  --page: #111214;
  --surface: #1a1b1e;
  --surface-2: #202226;
  --ink: #e8e6df;
  --muted: #aaa9a4;
  --line: #3f4344;
  --green: #61ee9a;
  --green-soft: rgba(97,238,154,.13);
  --orange: #f58232;
  --blue: #68bfe8;
  --red: #f28a78;
  --shadow: 0 24px 70px rgba(0,0,0,.32);
  --reading-width: 760px;
  font-size: calc(18px * var(--type-scale));
}
html[data-theme="light"] {
  color-scheme: light;
  --page: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #eeece5;
  --ink: #1d231f;
  --muted: #5d655f;
  --line: #cbd0ca;
  --green: #08783e;
  --green-soft: rgba(8,120,62,.09);
  --orange: #c65718;
  --blue: #176c91;
  --red: #a83d2e;
  --shadow: 0 24px 65px rgba(26,35,29,.14);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.68; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .16em; }
img { max-width: 100%; height: auto; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--green); color: #08110c; padding: .7rem 1rem; border-radius: .4rem; }
.skip-link:focus { top: .75rem; }
.reading-progress { position: fixed; inset: 0 0 auto; height: 3px; background: transparent; z-index: 90; }
.reading-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,var(--green),var(--orange)); }
.reader-toolbar { position: sticky; top: 0; z-index: 100; min-height: 3.7rem; padding: .55rem max(1rem, env(safe-area-inset-left)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .8rem; border-bottom: 1px solid color-mix(in srgb,var(--line),transparent 20%); background: color-mix(in srgb,var(--page),transparent 8%); backdrop-filter: blur(16px); }
.reader-title { color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.reader-actions { justify-self: end; display: flex; gap: .35rem; }
.toolbar-button { border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); color: var(--ink); font: inherit; font-size: .74rem; font-weight: 700; padding: .42rem .64rem; cursor: pointer; }
.toolbar-button:hover, .toolbar-button:focus-visible { border-color: var(--green); color: var(--green); }
.toc-toggle { justify-self: start; }
.book-cover { min-height: calc(100vh - 3.7rem); display: grid; place-items: center; align-content: center; gap: 1.4rem; padding: 3rem 1rem; background: radial-gradient(circle at 50% 40%,rgba(245,130,50,.10),transparent 42%); }
.book-cover img { width: min(440px, 82vw); max-height: 72vh; object-fit: contain; box-shadow: var(--shadow); }
.begin-reading { text-decoration: none; color: var(--ink); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.begin-reading span { color: var(--green); }
.book-layout { width: min(1240px, 100%); margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0,1fr); gap: clamp(2rem,5vw,5.5rem); padding: 4rem 2rem 10rem; align-items: start; }
.book-toc { position: sticky; top: 5.2rem; max-height: calc(100vh - 6.2rem); overflow: auto; padding-right: 1rem; scrollbar-width: thin; }
.toc-heading { color: var(--green); font-size: .78rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .8rem; }
.toc-search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.toc-search { width: 100%; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); color: var(--ink); padding: .58rem .7rem; margin-bottom: 1rem; font: inherit; font-size: .72rem; }
.book-toc ul { list-style: none; padding: 0; margin: 0; }
.book-toc ul ul { margin: .18rem 0 .65rem .65rem; padding-left: .75rem; border-left: 1px solid var(--line); }
.book-toc li { margin: .18rem 0; }
.book-toc a { display: block; color: var(--muted); text-decoration: none; font-size: .68rem; line-height: 1.35; padding: .25rem .3rem; border-radius: .3rem; }
.book-toc a:hover, .book-toc a[aria-current="location"] { color: var(--green); background: var(--green-soft); }
.toc-empty { color: var(--muted); font-size: .72rem; }
.book-content { min-width: 0; width: min(100%, var(--reading-width)); }
.edition-label { display: inline-block; color: var(--green); border: 1px solid var(--green); border-radius: 999px; padding: .3rem .65rem; margin-bottom: 3.5rem; font-size: .66rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.book-content > section { margin-bottom: 5rem; }
h1,h2,h3,h4 { line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: clamp(2.35rem,6vw,4.2rem); margin: 7rem 0 1.6rem; padding-top: 1rem; }
h2 { font-size: clamp(1.6rem,3vw,2.25rem); margin: 4rem 0 1.1rem; color: var(--green); }
h3 { font-size: 1.25rem; margin: 2.7rem 0 .8rem; }
h4 { font-size: 1rem; margin: 2rem 0 .6rem; color: var(--green); }
p, li { max-width: 72ch; }
p { margin: 0 0 1rem; }
ul,ol { padding-left: 1.35rem; }
li { margin: .45rem 0; }
blockquote { margin: 1.4rem 0; padding: .2rem 0 .2rem 1.25rem; border-left: 3px solid var(--green); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 4rem 0; }
code { font-family: Menlo,Consolas,"Courier New",monospace !important; font-size: .95em; color: var(--green); }
pre, pre.sourceCode { position: relative; overflow: auto; background: #f4f6f8; color: #202830; border: 1px solid #626e7a; border-top: 12px solid #202830; border-radius: 4px; padding: 1rem 1.1rem; font-family: Menlo,Consolas,"Courier New",monospace !important; font-size: 1rem; line-height: 1.5; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
pre code, pre span, pre.sourceCode code, pre.sourceCode span { font-family: inherit !important; color: #202830; font-size: 1em; line-height: 1.5; margin: 0; padding: 0; }
pre .dt, pre .kw, pre .cf, pre .fu, pre .ot, pre .at { font-weight: 700; color: #173f70 !important; }
pre .dv, pre .fl, pre .cn { font-weight: 700; color: #68346c !important; }
pre .st, pre .ch, pre .ss { color: #185c3c !important; }
pre .co, pre .do, pre .cv { color: #454e59 !important; font-style: italic; }
table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.5rem 0; font-size: .84rem; }
th,td { border: 1px solid var(--line); padding: .62rem .75rem; vertical-align: top; }
th { color: var(--green); text-align: left; background: var(--surface); }
figure { margin: 2rem 0 2.5rem; }
figure img { display: block; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); }
figcaption, .figure-caption { color: var(--muted); font-size: .9rem; line-height: 1.5; font-style: italic; text-align: center; margin: .8rem auto 1.2rem; max-width: 95%; }
figcaption strong, .figure-caption strong { font-style: normal; font-weight: 700; }
.part-page { margin: 9rem 0 7rem; padding: 3rem 0; text-align: center; }
.part-page h1 { margin: 0 0 1.5rem; color: var(--green); font-size: 2.25rem; text-align: center; }
.part-page h1 .part-label { display: block; font-size: 3.25rem; margin-bottom: 0.6rem; }
.part-page h1 .part-name { display: block; }
.part-page p { font-size: 1.15rem; color: var(--muted); max-width: 55ch; margin-left: auto; margin-right: auto; text-align: center; }
.practice-exercise,.official-definition,.human-friction,.jason-anecdote,.reference-implementation,.free-edition-ad,.ai-prompt,.ai-response,.callout {
  position: relative; margin: 1.7rem 0; padding: 1.25rem 1.35rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface);
}
.team-triage-context { margin: 1.5em 0; padding: 1em; background: #f8f9f7; color: #202421; border: 1px solid #626a65; }
.team-triage-context p { color: #202421; margin: .5em 0; }
.team-triage-context .callout-kicker { color: #202421; }
.team-triage-context strong { font-weight: 700; }
.official-definition { border-left: 5px solid var(--green); }
.practice-exercise { border-left: 5px solid #719ca2; }
.human-friction { border-left: 5px solid var(--orange); }
.human-friction h3 { font-size: 1.4rem; line-height: 1.35; }
.carbon-callout { margin: 1.7rem 0; padding: 1.25rem; border: 1px solid #62666a; background: #303234; color: #fff; border-radius: 4px; }
.carbon-callout-mark { float: left; width: 34px; height: 34px; margin: 0 1rem .5rem 0; object-fit: contain; }
.carbon-callout::after { content: ""; display: block; clear: both; }
.carbon-callout code { background: #202224; color: #fff; }
.jason-anecdote { border-left: 5px solid var(--blue); }
.reference-implementation,.free-edition-ad { border-left: 5px solid var(--green); background: var(--green-soft); }
.ai-prompt,.ai-response { border-left: 5px solid var(--green); background: #0b0c0e; color: #e8e6df; font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
html[data-theme="light"] .ai-prompt,html[data-theme="light"] .ai-response { background: #181b19; color: #f2f1eb; }
.ai-response.actual { border-left-color: var(--blue); }
.ai-response.illustrative { border-left-color: var(--orange); }
.callout-kicker { display: block; margin-bottom: .65rem; color: var(--green); font: 900 .67rem/1.2 Inter,ui-sans-serif,sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.human-friction .callout-kicker { color: var(--orange); }
.jason-anecdote .callout-kicker { color: var(--blue); }
.copy-button { position: absolute; top: .55rem; right: .55rem; border: 1px solid #4d5350; background: #191c1a; color: #c8cbc8; border-radius: .35rem; padding: .25rem .45rem; font: 700 .62rem/1 Inter,sans-serif; cursor: pointer; }
.ai-subagent-card { display: grid; grid-template-columns: 92px 1fr; gap: 1.1rem; align-items: center; margin: 1.5rem 0; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; }
.agent-portrait { position: relative; width: 84px; height: 84px; }
.agent-portrait img { width: 84px; height: 84px; object-fit: contain; }
.agent-badge { position: absolute; right: -2px; bottom: 2px; padding: .18rem .35rem; background: var(--green); color: #07140c; border-radius: .3rem; font-size: .55rem; font-weight: 950; letter-spacing: .08em; }
.agent-name { font-size: 1.15rem; font-weight: 900; }
.agent-role { color: var(--green); font-size: .76rem; font-weight: 800; }
.agent-focus { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; margin-top: .2rem; }
.agent-description { margin: .7rem 0 0; font-size: .85rem; }
.persona-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .9rem; margin-top: 1rem; }
.persona-card { padding: 1rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--surface-2); }
.persona-card img { width: 58px; height: 58px; object-fit: contain; float: left; margin: 0 .75rem .45rem 0; }
.persona-card h4 { margin: .15rem 0; color: var(--ink); }
.persona-card .persona-role { color: var(--green); font-size: .72rem; font-weight: 700; }
.persona-card .ratings { clear: both; margin-top: .7rem; color: var(--orange); font-size: .76rem; }
.diagram { margin: 2rem 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); overflow-x: auto; }
.diagram-title { color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1rem; }
.flow-row { display: flex; align-items: stretch; gap: .45rem; min-width: 650px; }
.flow-node { flex: 1; display: grid; place-items: center; min-height: 80px; padding: .7rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface-2); text-align: center; font-size: .72rem; font-weight: 800; }
.flow-arrow { align-self: center; color: var(--green); font-size: 1.4rem; font-weight: 900; }
.flow-return { margin: .8rem auto 0; width: 80%; color: var(--muted); text-align: center; font-size: .7rem; border-top: 1px dashed var(--green); padding-top: .55rem; }
.layer-stack { width: min(650px,100%); margin: 0 auto; display: grid; gap: .42rem; }
.layer { padding: .7rem 1rem; border: 1px solid var(--line); background: var(--surface-2); text-align: center; font-size: .72rem; }
.layer.split { display: grid; grid-template-columns: 1fr 1fr; gap: .42rem; background: transparent; border: 0; padding: 0; }
.layer-arrow { text-align: center; color: var(--green); line-height: 1; }
.triage-dialog { margin: 2rem 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface); overflow: hidden; }
.triage-head { padding: .8rem 1rem; background: var(--surface-2); color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.triage-body { padding: 1.15rem; }
.triage-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.triage-action { padding: .7rem; border: 1px solid var(--green); border-radius: .5rem; color: var(--green); text-align: center; font-weight: 900; }
.triage-action.reject { border-color: var(--red); color: var(--red); }
.triage-comment { margin-top: .7rem; min-height: 58px; border: 1px solid var(--blue); border-radius: .5rem; padding: .7rem; color: var(--muted); }
.book-footer { margin-top: 8rem; padding-top: 2rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .75rem; }
.book-footer a { margin-left: auto; }
.toc-scrim { display: none; }
@media (max-width: 900px) {
  .reader-toolbar { grid-template-columns: auto 1fr auto; }
  .reader-title { justify-self: center; }
  .print-button { display: none; }
  .book-layout { display: block; padding: 3rem clamp(1rem,5vw,2.2rem) 7rem; }
  .book-content { margin: 0 auto; }
  .book-toc { position: fixed; z-index: 95; inset: 0 auto 0 0; width: min(88vw,340px); max-height: none; padding: 1.3rem; background: var(--page); border-right: 1px solid var(--line); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .toc-open .book-toc { transform: translateX(0); }
  .toc-scrim { position: fixed; display: block; z-index: 90; inset: 0; border: 0; background: rgba(0,0,0,.55); }
  .toc-scrim[hidden] { display: none; }
}
@media (max-width: 560px) {
  :root { font-size: calc(16.5px * var(--type-scale)); }
  .reader-title { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  .reader-actions { gap: .2rem; }
  .toolbar-button { padding: .4rem .48rem; }
  .book-cover { min-height: calc(100svh - 3.7rem); }
  .ai-subagent-card { grid-template-columns: 72px 1fr; gap: .8rem; padding: .85rem; }
  .agent-portrait,.agent-portrait img { width: 66px; height: 66px; }
  .persona-grid { grid-template-columns: 1fr; }
  h1 { margin-top: 5rem; }
}
@media print {
  :root { --page:#fff; --surface:#fff; --surface-2:#f4f4f2; --ink:#111; --muted:#444; --line:#bbb; --green:#176f43; }
  .reader-toolbar,.reading-progress,.book-toc,.begin-reading,.copy-button,.toc-scrim { display:none !important; }
  .book-cover { min-height: 100vh; break-after: page; }
  .book-layout { display:block; width:auto; padding:0; }
  .book-content { width:auto; max-width:none; }
  h1 { break-before: page; }
  .part-page { break-before: page; }
  a { color:inherit; text-decoration:none; }
}

.book-callout{border:1px solid var(--line);border-left:4px solid var(--green);padding:1.2rem;margin:2rem 0;background:var(--surface)}pre{overflow:auto;white-space:pre;line-height:1.4}code{font-family:ui-monospace,Menlo,Consolas,monospace}figure{margin:2rem 0}figcaption{font-size:.85rem;color:var(--muted)}.reading-panel{max-height:none}

.edition-links{display:flex;flex-wrap:wrap;gap:.7rem 1.5rem}.book-introduction h1{margin-top:2rem}.book-heading-1{font-size:clamp(2.35rem,6vw,4.2rem);margin:7rem 0 1.6rem;padding-top:1rem;color:var(--ink)}.book-heading-2{font-size:clamp(1.6rem,3vw,2.25rem);margin:4rem 0 1.1rem;color:var(--green)}.book-heading-3{font-size:1.25rem;margin:2.7rem 0 .8rem;color:var(--ink)}.book-heading-4{font-size:1rem;margin:2rem 0 .6rem;color:var(--green)}
