:root {
	color-scheme: dark;
	--bg: #000;
	--fg: #fff;
	--mut: #a3a3a3;
	--dim: #6b6b6b;
	--line: #262626;
	--panel: #0c0c0c;
	--raise: #161616;
	--sans: "Source Sans Pro", "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--r: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
code, pre { font-family: var(--mono); }
:not(pre) > code { font-size: .88em; padding: .1em .35em; border-radius: 5px; background: var(--raise); border: 1px solid var(--line); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 6px; }

/* Corner fan */
.fan-clip { position: absolute; z-index: 0; top: 0; left: 0; right: 0; height: 640px; overflow: hidden; pointer-events: none; }
.corner-fan {
	position: absolute; top: -60px; right: -150px; width: 460px; height: 460px;
	fill: url(#fan-shade); --hole: #000; opacity: .75; pointer-events: none;
	animation: spin 90s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.layout { position: relative; z-index: 1; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; height: 64px; padding: 0 24px; background: rgba(0, 0, 0, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--mut); text-decoration: none; margin-right: auto; }
.zero { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: #000; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; padding: 4px 10px 4px 7px; border-radius: 8px; }
.zero svg { width: 18px; height: 18px; fill: #000; --hole: #fff; }
.top-links { display: flex; gap: 20px; }
.top-links a { text-decoration: none; color: var(--mut); font: 14px var(--mono); }
.top-links a:hover { color: var(--fg); }

/* Buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center;
	font: 600 14px/1 var(--sans); color: var(--fg); text-decoration: none;
	padding: 0 16px; height: 38px; border-radius: 10px;
	border: 1px solid #333; background: transparent; cursor: pointer;
	transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: var(--raise); }
.btn:active { transform: scale(.97); }
.btn-primary { background: #fff; color: #000; border-color: #fff; min-width: 160px; }
.btn-primary:hover { background: #dedede; }
.btn-small { height: 32px; padding: 0 12px; font-size: 14px; min-width: 76px; border-radius: 9px; }

/* Layout */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; }
.side { position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); overflow-y: auto; padding: 32px 16px 32px 24px; border-right: 1px solid var(--line); }
.side ol { list-style: none; margin: 0; padding: 0; }
.side li ol { margin: 2px 0 6px 12px; padding-left: 10px; border-left: 1px solid var(--line); }
.side a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--mut); text-decoration: none; font-size: 14px; }
.side li ol a { font: 13px var(--mono); padding: 4px 10px; }
.side a:hover { color: var(--fg); }
.side a[aria-current="true"] { color: var(--fg); background: var(--raise); }
.content { min-width: 0; max-width: 940px; padding: 48px 48px 96px; }

/* Doc text */
.doc-sec { padding-top: 64px; }
.doc-sec:first-child { padding-top: 0; }
.content h1 { margin: 0 0 14px; font-size: clamp(30px, 3.6vw, 36px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.content h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; }
.content h3 { margin: 28px 0 6px; font-size: 16px; }
.content p { margin: 0 0 16px; color: var(--mut); max-width: 68ch; }
.content .lead { font-size: 17px; color: var(--mut); max-width: 60ch; margin-bottom: 24px; }
.content p strong { color: var(--fg); font-weight: 600; }

.install { display: flex; align-items: center; gap: 8px; max-width: 640px; margin: 0 0 16px; padding: 5px 5px 5px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.install code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; scrollbar-width: none; }
.install code::-webkit-scrollbar { display: none; }
.dollar { color: var(--dim); user-select: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Flow */
.flow { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: s; }
.flow > li { counter-increment: s; position: relative; padding: 0 0 26px 52px; }
.flow > li::before {
	content: counter(s); position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center;
	width: 32px; height: 32px; border-radius: 9px; background: var(--raise); border: 1px solid #333;
	color: var(--fg); font: 500 14px/1 var(--mono);
}
.flow > li::after { content: ""; position: absolute; left: 15.5px; top: 40px; bottom: 6px; width: 1px; background: var(--line); }
.flow > li:last-child { padding-bottom: 0; }
.flow > li:last-child::after { display: none; }
.flow h3 { margin: 5px 0 2px; font-size: 16px; }
.flow p { margin: 0; }
.models { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.models a {
	display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px;
	border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
	color: var(--fg); font-size: 13px; font-weight: 500; text-decoration: none; transition: border-color .12s ease;
}
.models a:hover { border-color: #444; }
.models .stack { display: inline-flex; }
.models .stack > * { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); }
.models .stack > :first-child { margin-left: 0; }
.models img, .models .ph { width: 22px; height: 22px; border-radius: 6px; flex: none; background: var(--raise); object-fit: cover; }
.models small { color: var(--dim); font-size: 12.5px; font-weight: 400; }
.flow p.verified { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--mut); }
.verified svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.flow .who-does { margin-left: 8px; font: 500 12.5px var(--sans); color: var(--dim); }

details.prompt { margin-top: 20px; max-width: 760px; }
details.prompt summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--fg); }
details.prompt pre { margin: 12px 0 0; padding: 16px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); color: var(--mut); }

/* Command explorer */
.cmdx { margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.cmdx .tab { font-family: var(--mono); font-size: 14px; }
.cmdx-panel { padding: 22px; }
.cmdx-panel[hidden] { display: none; }
.cmdx-panel > p { margin: 0 0 14px; }
.cmdx-line { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 14px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); }
.cmdx-line code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; scrollbar-width: none; }
.cmdx-out { margin: 12px 0 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.65; color: var(--mut); overflow-x: auto; border: 1px dashed var(--line); border-radius: var(--r); }
.opts { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.opts td { padding: 8px 0; border-top: 1px solid var(--line); vertical-align: top; color: var(--mut); }
.opts td:first-child { width: 190px; padding-right: 16px; color: var(--fg); font: 13px var(--mono); white-space: nowrap; }

/* Reference tables */
.ref { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 8px; }
.ref th { text-align: left; font-weight: 500; color: var(--dim); font-size: 13px; padding: 0 16px 8px 0; }
.ref td { padding: 10px 16px 10px 0; border-top: 1px solid var(--line); color: var(--mut); vertical-align: top; }
.ref td:first-child { color: var(--fg); font: 13px var(--mono); white-space: nowrap; }
.json { margin: 0 0 20px; padding: 16px 18px; font-size: 13px; line-height: 1.7; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); color: var(--mut); overflow-x: auto; }
.json b { font-weight: 400; color: var(--fg); }

/* Stage */
.stage { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
	position: relative; flex: none;
	font: 500 14px/1 var(--sans); color: var(--dim);
	background: none; border: 0; padding: 12px 16px 16px; cursor: pointer;
}
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 2px; background: #fff; }

.stage-body { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); }
.term { padding: 22px; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); min-width: 0; }
.who { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.ask p { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; min-height: 2.8em; }
.cmd { min-height: 6.6em; }
.term pre {
	margin: 0; font-size: 13px; line-height: 1.65;
	white-space: pre-wrap; overflow-wrap: anywhere;
	background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.cmd .ghost { visibility: hidden; }
.cmd .caret { display: inline-block; width: .55em; height: 1.05em; margin-bottom: -.18em; background: #fff; }
.cmd .dollar { color: var(--dim); user-select: none; }
.status { margin: 0; font-size: 14px; color: var(--mut); display: flex; align-items: center; gap: 10px; min-height: 22px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.status.running .dot { background: #fff; animation: pulse .9s ease-in-out infinite; }
.status.done .dot { background: #fff; }
.status.done { color: var(--fg); }
@keyframes pulse { 50% { opacity: .25; } }
.result { transition: opacity .25s ease; }
.result.off { opacity: 0; }
.result .k { color: var(--dim); }
.result .v { color: #fff; }

.view { position: relative; min-height: 400px; background: #050505; touch-action: pan-y; user-select: none; overflow: hidden; }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { display: none; }
.demo-3d #gl { display: block; }
.demo-3d #canvas { display: none; }
.view.grab { cursor: grab; }
.view.grab:active { cursor: grabbing; }
.view.slide { cursor: ew-resize; }
.split { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; display: none; }
.split::after {
	content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
	border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.split::before {
	content: "‹ ›"; position: absolute; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -54%);
	color: #000; font: 700 16px/1 var(--sans); white-space: nowrap;
}
.tag { position: absolute; top: 14px; font-size: 13px; padding: 4px 10px; border-radius: 8px; background: rgba(0, 0, 0, .6); color: #fff; backdrop-filter: blur(6px); display: none; }
.tag.before { left: 14px; }
.tag.after { right: 14px; }
.view-hint { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-size: 13px; color: rgba(255, 255, 255, .75); pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.view-hint.on { opacity: 1; }
.play {
	position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%);
	height: 44px; padding: 0 22px; border-radius: 12px; border: 0; cursor: pointer;
	background: #fff; color: #000; font: 600 14px/1 var(--sans); display: none;
}
.play:active { transform: translateX(-50%) scale(.96); }

/* Document demo */
.doc { position: absolute; inset: 0; display: none; grid-template-columns: 1fr 1.1fr; gap: 24px; padding: 26px; align-items: center; }
.paper { position: relative; overflow: hidden; border-radius: 4px; transform: rotate(-1.6deg); box-shadow: 0 12px 34px rgba(0, 0, 0, .6); max-height: 100%; aspect-ratio: 1; }
.paper img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan { position: absolute; left: 0; right: 0; height: 34px; margin-top: -34px; background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .28)); border-bottom: 2px solid #000; }
.md { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--fg); white-space: pre-wrap; overflow: hidden; min-width: 0; }
.demo-doc .doc { display: grid; }
.demo-doc canvas { display: none; }
.demo-edit.is-done .split, .demo-edit.is-done .tag { display: block; }
.demo-sound.is-done .play { display: block; }



/* Tasks */
.tools { display: flex; gap: 12px; margin: 8px 0 16px; }
.search { flex: 1; height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: 15px var(--sans); }
.search::placeholder { color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--mut); font: 500 13.5px/1 var(--sans); cursor: pointer; }
.chip:hover { color: var(--fg); }
.chip span { color: var(--dim); margin-left: 6px; }
.chip[aria-pressed="true"] { background: #fff; color: #000; border-color: #fff; }
.chip[aria-pressed="true"] span { color: inherit; opacity: .55; }
.rows { border-top: 1px solid var(--line); }
.row { border-bottom: 1px solid var(--line); }
.row summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) 16px; gap: 20px; align-items: center; padding: 14px 4px; cursor: pointer; list-style: none; }
.row summary::-webkit-details-marker { display: none; }
.row summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(45deg); transition: transform .15s ease; justify-self: end; margin-top: -4px; }
.row[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.row summary:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.row h3 { margin: 0; font-size: 15px; font-weight: 600; }
.row h3 code { margin-left: 8px; font-weight: 400; color: var(--dim); }
.row summary p { margin: 2px 0 0; color: var(--mut); font-size: 14px; }
.row .model { font-size: 13px; color: var(--mut); }
.row .model small { display: block; color: var(--dim); font-size: 12.5px; }
.row-body { padding: 4px 4px 22px; }
.row-body .ref { margin-top: 14px; }
.row-body .ref td:nth-child(3) { white-space: nowrap; font: 12.5px var(--mono); }
.req { color: var(--fg); font-size: 12px; margin-left: 6px; }
.meta-line { margin: 12px 0 0 !important; font-size: 13px; color: var(--dim) !important; }
.empty { padding: 32px 0; color: var(--mut); }

footer { margin-top: 96px; border-top: 1px solid var(--line); padding-top: 24px; display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 14px; color: var(--dim); }
footer span { margin-right: auto; }
footer a:hover { color: var(--fg); }

@media (max-width: 1080px) {
	.stage-body { grid-template-columns: 1fr; }
	.view { order: -1; min-height: 0; aspect-ratio: 16 / 10; }
	.term { border-right: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
	.corner-fan { width: 280px; height: 280px; top: -30px; right: -110px; }
	.layout { grid-template-columns: 1fr; }
	.side { display: none; }
	.top-links { display: none; }
	.content { padding: 32px 16px 64px; }
	.row summary { grid-template-columns: minmax(0, 1fr) 16px; }
	.row .model { display: none; }
	.doc { padding: 14px; gap: 12px; }
	.md { font-size: 10px; }
	.opts td:first-child { width: auto; }
}
@media (max-width: 520px) {
	.top { padding: 0 16px; }
	.top .btn { display: none; }
	.actions .btn { flex: 1 1 100%; }
	.row-body .ref thead { display: none; }
	.row-body .ref tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; border-top: 1px solid var(--line); padding: 10px 0; }
	.row-body .ref td { border: 0; padding: 0; }
	.row-body .ref td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; margin-top: 4px; }

}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.status.running .dot, .corner-fan { animation: none; }
}
