@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/jbm-var.woff2') format('woff2');
}
:root {
  --bg: #1a1418; --bg-2: #221a20; --bg-3: #2b2128;
  --fg: #e8ddd9; --fg-dim: #b5a8a5; --fg-muted: #9b8f91;
  --hl: #d8992f; --accent: #e0705f; --link: #efe4d9;
  --rule: #352e39; --ok: #61c554; --selection: #d8992f44;
  --tile: #16181d; --tile-rule: #2a2d36;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8e4dc; --bg-2: #faf8f3; --bg-3: #f1eee7;
  --fg: #1a1a1a; --fg-dim: #4a4a4a; --fg-muted: #5e5a54;
  --hl: #8b2e1f; --accent: #b0261c; --link: #1a1a1a;
  --rule: #cdc7bc; --ok: #2a6b22; --selection: #8b2e1f2e;
}
html[data-theme="light"] :is(.tile, .core, .panel) { box-shadow: 0 1px 2px #1a1a1a12, 0 2px 6px #1a1a1a0a; }
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100%;
}
::selection { background: var(--selection); color: var(--fg); }
a { color: var(--link); text-decoration: none; border-bottom: 1px dotted var(--link); }
a:hover { color: var(--hl); border-color: var(--hl); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px 80px; }
header { border-bottom: 1px solid var(--rule); background: linear-gradient(180deg, var(--bg-3), var(--bg-2)); }
header .bar { max-width: 980px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 10px; }
header a.brand { display: inline-flex; align-items: baseline; gap: 0; flex: none; color: var(--fg); border: none; text-decoration: none; line-height: 1; }
header a.brand .kb-mark { height: 18px; width: auto; display: block; fill: currentColor; align-self: center; }
header a.brand .kb-dot { fill: var(--hl); }
header a.brand .brand-sub { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin-left: 1px; }
header .theme-toggle { margin-left: auto; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; padding: 0; cursor: pointer; color: var(--fg-dim); background: var(--bg-2); border: 1px solid var(--rule); border-radius: 4px; }
header .theme-toggle svg { width: 15px; height: 15px; display: block; }
header .theme-toggle:hover { color: var(--hl); border-color: var(--hl); }
header .theme-toggle[hidden] { display: none; }
header .theme-toggle .sun, html[data-theme="light"] header .theme-toggle .moon { display: none; }
html[data-theme="light"] header .theme-toggle .sun { display: block; }
header .kofi { font-size: 12px; color: var(--hl); white-space: nowrap; margin-left: auto; }
header .theme-toggle:not([hidden]) + .kofi { margin-left: 4px; }
header .kofi img { vertical-align: -2px; }
@media (max-width: 520px) { header .kofi-label { display: none; } }

h1 { font-size: 26px; font-weight: 700; margin: 32px 0 8px; letter-spacing: -0.01em; }
h1 .pipe { color: var(--hl); }
h2 { font-size: 18px; margin: 28px 0 10px; }
.sub { color: var(--fg-dim); font-size: 14px; margin: 0 0 6px; max-width: 700px; text-wrap: pretty; }
.crumbs { color: var(--fg-muted); font-size: 12px; margin-top: 22px; }
.crumbs a { color: var(--fg-dim); }
.privacy {
  display: inline-flex; align-items: center; gap: 7px; color: var(--ok); font-size: 12px; margin: 14px 0 8px;
  border: 1px solid var(--rule); border-left: 2px solid var(--ok); background: var(--bg-2); padding: 6px 12px; border-radius: 3px;
}
.privacy::before { content: '\25CF'; }

.btn {
  display: inline-flex; flex-direction: column; gap: 1px; background: var(--hl); color: var(--bg); border: 1px solid var(--hl);
  font: inherit; font-size: 12px; font-weight: 600; padding: 8px 14px; border-radius: 4px; cursor: pointer; line-height: 1.35;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn .dl-meta { font-weight: 400; font-size: 11px; opacity: 0.85; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--rule); }
.btn.ghost:hover { color: var(--hl); border-color: var(--hl); background: transparent; }
.btn.disabled, .btn.disabled:hover {
  background: transparent; color: var(--fg-muted); border: 1px dashed var(--rule); cursor: not-allowed;
}

.core { margin: 22px 0 6px; border: 1px solid var(--hl); border-left: 3px solid var(--hl); border-radius: 5px; background: var(--bg-2); padding: 14px 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.core .ct { font-weight: 700; font-size: 14px; }
.core .cd { color: var(--fg-dim); font-size: 12px; margin-top: 2px; max-width: 560px; }
.core .btn { margin-left: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 22px 0 0; padding: 0; list-style: none; }
.tile { border: 1px solid var(--rule); border-radius: 6px; background: var(--bg-2); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tile .tn { font-weight: 700; font-size: 14px; border: none; }
.tile .tn:hover { color: var(--hl); }
.tile .tm { color: var(--fg-muted); font-size: 11px; }

.stage { position: relative; aspect-ratio: 1; width: 100%; background: var(--tile); border: 1px solid var(--tile-rule); border-radius: 5px; overflow: hidden; }
.stage canvas, .stage img.ph, .stage img.first { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.stage .play {
  position: absolute; inset: auto 8px 8px auto; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid #ffffff55; background: #16181dcc; color: #fff; cursor: pointer;
}
.stage .play[hidden] { display: none; }
.stage .play svg { width: 14px; height: 14px; fill: currentColor; }
.stage .badge { position: absolute; left: 8px; top: 8px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: #ffffffb0; border: 1px solid #ffffff40; border-radius: 3px; padding: 1px 6px; background: #16181d99; }

.motion { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; margin-top: 8px; align-items: start; }
@media (max-width: 760px) { .motion { grid-template-columns: 1fr; } }
.motion .stage { max-width: 420px; }
.facts { color: var(--fg-muted); font-size: 12px; margin: 10px 0 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags li { font-size: 11px; color: var(--fg-dim); border: 1px solid var(--rule); border-radius: 3px; padding: 0 7px; }
.panel { border: 1px solid var(--rule); border-radius: 6px; background: var(--bg-2); padding: 16px 18px; margin-top: 16px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); margin: 0 0 10px; }
.picker { border: none; padding: 0; margin: 0; min-width: 0; }
.picker legend { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); padding: 0; margin-bottom: 8px; }
.picker .seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.picker label { position: relative; cursor: pointer; }
.picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picker label span { display: block; padding: 7px 14px; font-size: 12px; color: var(--fg-dim); background: var(--bg-3); border-right: 1px solid var(--rule); }
.picker label:last-child span { border-right: none; }
.picker input:checked + span { background: var(--hl); color: var(--bg); font-weight: 600; }
.picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.dls { display: flex; flex-wrap: wrap; gap: 10px; }
.note { color: var(--fg-muted); font-size: 12px; margin: 10px 0 0; max-width: 560px; text-wrap: pretty; }
.note a { color: var(--fg-dim); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 12px; }

.prose { margin-top: 52px; border-top: 1px solid var(--rule); padding-top: 10px; }
.prose p { color: var(--fg-dim); margin: 0 0 12px; max-width: 700px; text-wrap: pretty; }
.prose code { background: var(--bg-3); padding: 1px 5px; border-radius: 3px; font-size: 13px; color: var(--fg); }

footer { border-top: 1px solid var(--rule); margin-top: 48px; padding-top: 20px; color: var(--fg-muted); font-size: 12px; }
footer a { color: var(--fg-dim); }
footer .dot { opacity: .6; }

.nf { max-width: 640px; margin: 0 auto; padding: 80px 20px; text-align: center; }
.nf .code { color: var(--hl); font-size: 56px; font-weight: 700; letter-spacing: -0.02em; }
.nf p { color: var(--fg-dim); margin: 10px 0 24px; }
.stage img.first[hidden] { display: none; }
.stage img.first[hidden] { display: none; }
.prose pre.lic { background: var(--bg-3); color: var(--fg-dim); padding: 14px 16px; border-radius: 6px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; max-width: 700px; margin: 0 0 12px; }
