:root {
  --bg: #0b0d11; --panel: #12161c; --line: #232a34; --text: #d8dee6; --muted: #8b96a5;
  --accent: #ffb000; --link: #3ec9f0; --error: #ff8080;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

header.top { border-bottom: 1px solid var(--line); background: var(--panel); }
header.top .inner, main { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
header.top .inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 56px; }
header.top .brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: 0.02em; }
header.top .brand span { color: var(--accent); }
header.top nav { display: flex; gap: 16px; margin-left: auto; font-size: 14px; }
main { padding-top: 24px; padding-bottom: 64px; }

/* gallery */
.intro { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; margin-bottom: 8px; }
.intro p { margin: 0; max-width: 60ch; color: var(--muted); }
#filter { font: inherit; width: min(320px, 100%); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
#filter:focus { outline: 2px solid var(--link); outline-offset: -1px; }
section.category { margin-top: 36px; }
section.category h2 { margin: 0; font-size: 20px; }
section.category > p { margin: 2px 0 14px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); color: inherit; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card .thumb { aspect-ratio: 16 / 9; background: #000; display: flex; align-items: center; justify-content: center; }
.card img { display: block; max-width: 100%; max-height: 100%; image-rendering: auto; }
.card .body { padding: 10px 12px 12px; }
.card h3 { margin: 0 0 2px; font-size: 15px; }
.card p { margin: 0; font-size: 13px; color: var(--muted); }
#empty { margin-top: 36px; color: var(--muted); }

/* example page */
.crumbs { font-size: 13px; color: var(--muted); }
h1 { margin: 2px 0 4px; font-size: 26px; }
.lead { margin: 0 0 16px; color: var(--muted); max-width: 80ch; }
.stage { background: #000; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stage canvas { display: block; width: 100%; }
.stage .fallback img { display: block; width: 100%; }
.stage .fallback p { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel); font-size: 14px; }
.stage .fallback .error { color: var(--error); }
.notice { margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--panel); font-size: 14px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 860px) { .columns { grid-template-columns: minmax(0, 1fr); } }
.box { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-width: 0; }
.box > h2 { margin: 0; padding: 8px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.box > h2 .spacer { flex: 1; }
.box .content { padding: 12px; }
.box + .box { margin-top: 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls:empty::after { content: "none"; color: var(--muted); font-size: 13px; }
button, input { font: inherit; }
button { padding: 4px 12px; border-radius: 6px; border: 1px solid var(--line); background: #1b222c; color: var(--text); cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; }
button:disabled:hover { border-color: var(--line); }
button.tab { border: 0; background: none; padding: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--muted); }
button.tab[aria-selected="true"] { color: var(--accent); }
.variables { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; font-size: 13px; }
.variables:empty::after { content: "none"; color: var(--muted); }
.variables input:not([type="checkbox"]) { width: 100%; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.variables input[type="checkbox"] { justify-self: start; }
.status { font-size: 13px; color: var(--muted); }
.transport { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; }
.transport[hidden], .transport [hidden] { display: none; }
.transport input[type="range"] { flex: 1; accent-color: var(--accent); }
.transport .clock { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
/* One width for "play" and "pause", so the bar beside it stays put. */
#pause { width: 7ch; text-align: center; padding-left: 0; padding-right: 0; }
.transport select { font: inherit; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: #1b222c; color: var(--text); }
#log { height: 9.5em; overflow: auto; font-size: 12px; white-space: pre-wrap; }
#log:empty::after { content: "nothing yet"; color: var(--muted); }
#log .error { color: var(--error); }
#sound-note { color: var(--error); }
#log .time { color: var(--muted); }
pre#source { margin: 0; padding: 12px; overflow: auto; max-height: 70vh; font-size: 12.5px; line-height: 1.45; tab-size: 2; }
.j-key { color: #9cdcfe; } .j-str { color: #ce9178; } .j-num { color: #b5cea8; } .j-lit { color: #569cd6; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; font-size: 14px; }
footer { margin-top: 48px; font-size: 13px; color: var(--muted); }
