@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121920;
  --soft: #14263c;
  --line: #2d3942;
  --muted: #a7b3bb;
  --text: #f2f5f0;
  --accent: #80b7ff;
  --accent-hover: #b8d8ff;
  --primary: #004aad;
  --code: #080c11;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --display: var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; scrollbar-color: var(--line) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: none; text-underline-offset: 4px; }
button { font-family: inherit; cursor: pointer; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button:disabled { cursor: not-allowed; opacity: .5; }
svg { flex-shrink: 0; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.skip-link { position: fixed; top: 12px; left: 24px; z-index: 10; padding: 14px 20px; background: var(--accent); color: var(--bg); transform: translateY(-160%); border-radius: 6px; }
.skip-link:focus { transform: translateY(0); }
.wrap { max-width: 1352px; margin: 0 auto; padding: 0 36px; }
.topbar { min-height: 74px; margin: 24px -16px 0; padding: 12px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; padding: 11px 14px; background: #fff; border-radius: 5px; flex-shrink: 0; }
.brand img { display: block; width: 126px; height: auto; }
.site-name { padding-left: 26px; border-left: 1px solid var(--line); font-size: 15px; font-weight: 500; white-space: nowrap; }
.site-name span { display: block; margin-top: 4px; color: var(--muted); font: 11px var(--mono); }
.top-nav { display: flex; gap: 26px; margin-left: auto; align-items: center; font-size: 14px; color: var(--muted); }
.top-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.top-nav a:hover { color: var(--accent); }
.top-nav .home-link { color: var(--accent); border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; }
.hero { display: grid; grid-template-columns: 1.06fr 1fr; gap: 44px; align-items: center; padding: 76px 0 64px; }
h1 { font: 500 clamp(50px, 6.25vw, 88px)/1.06 var(--display); letter-spacing: -.04em; margin: 0 0 28px; }
h1 em { color: var(--accent); font-style: normal; }
.dek { font-size: 18px; line-height: 1.7; max-width: 540px; color: var(--muted); margin: 0; }
.hero-actions { display: flex; align-items: center; gap: 24px; margin-top: 30px; }
.primary-link { display: inline-flex; align-items: center; gap: 16px; padding: 15px 20px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; min-height: 48px; transition: background .2s; }
.primary-link:hover { background: #075ecf; }
.text-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.text-link:hover { color: var(--accent); }
.text-link span { text-decoration: underline; }
.hero-map { position: relative; width: 100%; max-width: 570px; aspect-ratio: 1.18; justify-self: end; }
.map-lines { width: 100%; height: 100%; overflow: visible; }
.map-orbit { fill: none; stroke: var(--accent); stroke-width: 1; opacity: .5; }
.map-rule { fill: none; stroke: var(--line); stroke-width: 1; }
.map-dot { fill: var(--accent); }
.map-core { fill: var(--panel); stroke: var(--accent); stroke-width: 1; }
.map-video { fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.map-node { position: absolute; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 162px; padding: 14px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; transition: border-color .2s, background .2s; }
.map-node:hover { border-color: var(--accent); background: var(--soft); }
.map-node b { font-size: 14px; font-weight: 500; }
.map-node span { min-width: 0; }
.map-node small { display: block; color: var(--muted); font: 11px/1.6 var(--mono); margin-top: 4px; }
.map-node .icon { width: 14px; height: 14px; }
.node-motion { top: 13%; left: 0; }
.node-visuals { top: 24%; right: 0; }
.node-audio { bottom: 20%; left: 2%; }
.node-finish { bottom: 9%; right: 2%; }
.map-caption { position: absolute; top: 66%; width: 100%; margin: 0; text-align: center; font: 11px var(--mono); color: var(--accent); pointer-events: none; }
.hero-meta { padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font: 11px/1.7 var(--mono); letter-spacing: .025em; }
.hero-meta p { margin: 0; }
.hero-meta .counts { display: flex; gap: 30px; }
.hero-meta b { color: var(--text); font-weight: 500; }
#toolkit { padding-top: 80px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-head h2, .pipeline h2 { font: 500 clamp(28px, 3.2vw, 42px)/1.15 var(--display); letter-spacing: -.04em; margin: 0; }
.section-head p { color: var(--muted); font: 11px/1.7 var(--mono); margin: 0; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 24px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 11px 15px; border-radius: 7px; font-size: 13px; line-height: 20px; min-height: 44px; transition: background .2s, color .2s, border-color .2s; }
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter.active { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.filter.active::before { content: ''; display: inline-block; width: 5px; height: 5px; background: currentColor; border-radius: 50%; margin: 0 8px 2px 0; }
.result-count { flex-shrink: 0; color: var(--muted); font: 11px var(--mono); font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding-bottom: 80px; }
.card { display: grid; grid-template-columns: 310px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-top { padding: 28px; border-right: 1px solid var(--line); min-width: 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 30px; }
.num { color: var(--muted); font: 11px var(--mono); font-variant-numeric: tabular-nums; }
.tag { color: var(--accent); font: 11px/1.5 var(--mono); text-align: right; }
.name-row { display: flex; flex-direction: column; gap: 9px; }
.name-row h3 { margin: 0; font: 500 30px/1.2 var(--display); letter-spacing: -.04em; }
.repo { font: 11px/1.7 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.desc { margin: 20px 0; font-size: 14px; line-height: 1.8; color: #c3d0d6; }
.why { font-size: 12px; line-height: 1.7; color: var(--muted); }
.why strong { color: var(--text); font-weight: 500; }
.card-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 20px; }
.github { color: var(--accent); font: 11px/1.7 var(--mono); text-decoration: underline; text-decoration-color: transparent; }
.github:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
.card-actions .github { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
.license { color: var(--muted); font: 11px/1.7 var(--mono); }
.stage-wrap { padding: 18px; min-width: 0; }
.stage { position: relative; aspect-ratio: 16/9; background: var(--code); border-radius: 7px; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; display: grid; place-items: center; }
.stage:fullscreen canvas { width: 100%; height: 100%; object-fit: contain; }
.stage iframe, .stage video { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; background: var(--code); }
.stage-caption { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 12px; }
.stage-caption strong { font-size: 14px; font-weight: 500; line-height: 1.5; }
.live { color: var(--accent); font: 11px/1.6 var(--mono); text-align: right; }
.live::before { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--accent); }
.stage-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.scene-tab, .play-toggle, .expand { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 10px 12px; border-radius: 6px; min-height: 44px; font-size: 12px; }
.scene-tab:hover, .play-toggle:hover, .expand:hover { color: var(--text); border-color: var(--accent); }
.scene-tab[aria-pressed='true'] { color: var(--accent); background: var(--soft); border-color: var(--accent); }
.scene-tab[aria-pressed='true']::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.play-toggle { margin-left: auto; }
.expand { color: var(--text); }
[hidden] { display: none !important; }
.study-note { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 13px 0 0; }
.study-note a { text-decoration: underline; }
.study-note a:hover { color: var(--accent); }
.examples { grid-column: 1/-1; padding: 0 28px; border-top: 1px solid var(--line); }
.examples summary { cursor: pointer; color: var(--muted); padding: 18px 0; font: 11px/1.6 var(--mono); letter-spacing: .035em; }
.examples summary:hover { color: var(--accent); }
.examples[open] { padding-bottom: 22px; }
.production-note { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 75ch; margin: 4px 0 16px; }
.examples .github { display: inline-block; min-height: 36px; padding: 8px 0; }
.codebox { background: var(--code); border: 1px solid var(--line); border-radius: 6px; margin-top: 12px; overflow: hidden; }
.code-title { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font: 11px var(--mono); }
.copy { border: 0; background: transparent; color: var(--accent); font: 11px var(--mono); min-height: 36px; padding: 8px; }
.codebox pre { margin: 0; padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: #e4efff; font: 12px/1.8 var(--mono); tab-size: 2; }
.empty { display: none; padding: 32px; color: var(--muted); }
.pipeline { padding: 48px 0 60px; border-top: 1px solid var(--line); }
.pipeline > p { color: var(--muted); font-size: 16px; line-height: 1.7; margin: 14px 0 34px; }
.flow { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
.step { border-top: 1px solid var(--line); padding: 18px 0; }
.step b { display: flex; align-items: center; gap: 12px; color: var(--accent); font: 11px var(--mono); }
.step b .icon { margin-left: auto; width: 14px; height: 14px; }
.step span { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.note { margin-top: 14px; max-width: 90ch; color: var(--muted); font-size: 12px; line-height: 1.8; }
.note strong { color: var(--text); font-weight: 500; }
.footer { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; border-top: 1px solid var(--line); padding: 32px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.footer-brand { color: var(--text); display: flex; gap: 14px; align-items: center; font-size: 14px; margin-bottom: 10px; }
.footer-brand span { color: var(--muted); font: 11px var(--mono); }
.footer p { margin: 0; }
.footer a { color: var(--accent); text-decoration: underline; }
.video-poster { position: absolute; inset: 0; padding: 0; border: 0; background: var(--code); color: #fff; width: 100%; height: 100%; }
.video-poster img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .8; transition: opacity .2s; }
.video-poster:hover img { opacity: 1; }
.video-poster span { position: absolute; bottom: 8%; left: 5%; right: 5%; width: fit-content; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 7px; background: #0b0f14ed; text-align: left; font-size: 14px; line-height: 1.5; }
.real-anime { position: absolute; inset: 0; background: #14263c; padding: 8%; overflow: hidden; color: var(--text); }
.real-anime small { font: 12px var(--mono); color: var(--accent); }
.real-anime h4 { font: 500 clamp(24px,4vw,64px)/1.3 var(--display); letter-spacing: -.04em; margin: 12% 0 6%; }
.real-anime h4 span { display: inline-block; white-space: pre; }
.real-anime p { font-size: 13px; color: #b8d8ff; }
.real-bars { height: 70%; display: flex; align-items: end; gap: 5%; margin: 5% 0; }
.real-bars i { width: 12%; height: var(--height); background: var(--accent); transform-origin: bottom; position: relative; }
.real-bars i:nth-child(2n) { background: #477abb; }
.real-bars span { position: absolute; bottom: 10px; left: 10px; color: var(--code); font: 12px var(--mono); }
.speech-output { position: absolute; inset: 0; background: #121e2e; display: flex; flex-direction: column; justify-content: space-around; padding: 3% 0; }
.speech-title { font: 11px var(--mono); color: #b8d8ff; padding-left: 6%; letter-spacing: .1em; }
.speech-output canvas { width: 100%; height: auto; max-height: 75%; object-fit: contain; }
.speech-output audio { width: 88%; height: 38px; margin: 0 auto; }
.engine-error { padding: 32px; color: #ffabbc; font-size: 16px; line-height: 1.7; }

@media (max-width: 1100px) {
  .hero { gap: 24px; }
  .hero-map { aspect-ratio: 1; }
  .map-node { width: 145px; padding: 12px; }
  .map-caption { top: 65%; }
  .card { grid-template-columns: 270px minmax(0,1fr); }
  .card-top { padding: 22px; }
  .stage-caption { align-items: flex-start; flex-direction: column; gap: 6px; }
  .play-toggle { margin-left: 0; }
}
@media (max-width: 820px) {
  .wrap { padding: 0 24px; }
  .topbar { margin: 16px 0 0; padding: 12px 16px; gap: 18px; }
  .brand img { width: 108px; }
  .site-name { border: 0; padding: 0; }
  .top-nav { gap: 18px; }
  .top-nav .home-link { display: none; }
  .hero { padding: 64px 0 44px; gap: 16px; }
  h1 { font-size: clamp(44px,7vw,62px); }
  .dek { font-size: 16px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 10px; }
  .hero-map { min-width: 0; }
  .map-node { width: 140px; gap: 5px; padding: 10px; }
  .map-node b { font-size: 12px; }
  .map-node small { font-size: 11px; }
  .map-caption { font-size: 11px; }
  .hero-meta { align-items: flex-start; flex-direction: column; gap: 12px; }
  #toolkit { padding-top: 56px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .filter-bar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .card { grid-template-columns: 230px minmax(0,1fr); }
  .card-top { padding: 20px; }
  .card-meta { align-items: flex-start; gap: 8px; }
  .stage-wrap { padding: 12px; }
  .scene-tab, .play-toggle, .expand { font-size: 11px; padding: 10px; }
  .flow { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px 24px; }
}
@media (max-width: 620px) {
  .wrap { padding: 0 20px; }
  .topbar { padding: 10px 12px; gap: 14px; border-radius: 13px; }
  .brand { padding: 9px 10px; }
  .brand img { width: 92px; }
  .site-name { font-size: 13px; }
  .site-name span { display: none; }
  .top-nav { margin-left: auto; }
  .top-nav a { font-size: 12px; white-space: nowrap; }
  .top-nav a[href='#workflow'] { display: none; }
  .hero { grid-template-columns: minmax(0,1fr); padding: 54px 0 28px; gap: 16px; }
  h1 { font-size: clamp(43px,11vw,66px); margin-bottom: 22px; }
  .dek { max-width: 40ch; font-size: 16px; }
  .hero-actions { flex-direction: row; align-items: center; gap: 20px; margin-top: 24px; }
  .primary-link { padding: 13px 16px; gap: 10px; font-size: 13px; }
  .text-link { font-size: 13px; gap: 6px; }
  .hero-map { max-width: 440px; justify-self: center; aspect-ratio: 1.18; }
  .map-node { width: 145px; padding: 12px; }
  .map-caption { font-size: 11px; top: 96%; }
  .hero-meta { font-size: 11px; padding: 20px 0; }
  .hero-meta .counts { gap: 20px; flex-wrap: wrap; }
  #toolkit { padding-top: 48px; }
  .section-head { margin-bottom: 22px; }
  .section-head p { font-size: 11px; }
  .filters { gap: 7px; }
  .filter { padding: 10px 12px; font-size: 12px; }
  .grid { gap: 22px; padding-bottom: 48px; }
  .card { display: block; }
  .card-top { padding: 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .card-meta { margin-bottom: 20px; }
  .name-row { gap: 7px; }
  .name-row h3 { font-size: 28px; }
  .desc { margin: 16px 0; }
  .card-actions { margin-top: 14px; gap: 6px; }
  .stage-wrap { padding: 12px; }
  .stage-caption strong { font-size: 13px; }
  .stage[data-engine='LIVE REMOTION'] { aspect-ratio: 4/3; }
  .stage-controls { gap: 7px; }
  .scene-tab { padding: 10px 12px; }
  .examples { padding: 0 22px; }
  .examples summary { font-size: 11px; }
  .real-anime small { font-size: 11px; }
  .real-anime h4 { font-size: 28px; }
  .real-anime p { font-size: 11px; }
  .video-poster span { padding: 10px 12px; gap: 8px; font-size: 11px; }
  .pipeline { padding: 36px 0 40px; }
  .pipeline > p { font-size: 14px; }
  .flow { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .footer { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 360px) {
  .topbar { gap: 10px; }
  .brand img { width: 80px; }
  .hero-map { aspect-ratio: .95; }
  .map-node { width: 128px; padding: 10px; gap: 6px; }
  .map-node .icon { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

.inline-example { background: var(--panel); }
.inline-example .stage { border-radius: 0; }
.inline-example #example-controls { height: 56px; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.inline-example #example-controls button { padding: 6px 10px; }
.inline-example .scene-tab[aria-pressed='true']::after { display: none; }
