@import url('tokens.css');

:root {
  color-scheme: dark;
  --ground: #101d32;
  --paper: #f3f5f8;
  --control: #192b46;
  --title: "Source Serif 4", Georgia, serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
  --display: 4.25rem;
  --type-body: 1.125rem;
  --type-ui: .875rem;
  --type-meta: .75rem;
  --gap-xs: .375rem;
  --gap-s: .625rem;
  --gap-m: 1rem;
  --gap-l: 1.5rem;
  --gap-xl: 2.5rem;
  --radius: .5rem;
  --gutter: 5vw;
  --header-height: 4.5rem;
  --scene-ink: #080f1e;
  --scene-floor: #142b48;
  --scene-blue: #244975;
  --scene-light: #6791bb;
  --panel: #0b1321;
  --panel-edge: #2f4565;
  --panel-text: #edf4fe;
  --panel-muted: #bacce4;
  --scene-fade: .42s;
}
:root:not([data-direction="c"]) {
  --muted: #b8c8de;
  --accent: #83b9ff;
  --edge: #93b4e83b;
}
:root[lang="zh"] {
  --title: "Source Serif 4", "Noto Serif SC", "Songti SC", serif;
  --body: "Instrument Sans", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
}
:root:not([data-direction="c"])[data-theme="light"] {
  color-scheme: light;
  --ground: #edf2fa;
  --paper: #14243b;
  --muted: #192d48;
  --accent: #164b8e;
  --edge: #2e54844b;
  --control: #e2eafa;
  --scene-ink: #e2eaf5;
  --scene-floor: #afc1d8;
  --scene-blue: #6285ac;
  --scene-light: #d6e5f4;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
html { background: var(--ground); color: var(--paper) }
body { margin: 0; font-family: var(--body); line-height: 1.55 }
button, input { font: inherit }
button, a, input { -webkit-tap-highlight-color: transparent }
button, a { touch-action: manipulation }
button { cursor: pointer }
button:disabled { cursor: default }
a { color: inherit }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }

.site-bar {
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  min-height: var(--header-height);
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--scene-ink), transparent 30%);
  display: flex;
  align-items: center;
  gap: var(--gap-xl);
  border-bottom: 1px solid var(--edge);
  font-size: var(--type-ui);
}
.wordmark { font-family: var(--title); font-size: 1.25rem; white-space: nowrap }
.site-bar nav, .site-controls { display: flex; flex-wrap: wrap; gap: var(--gap-m); align-items: center }
.site-bar nav a { color: var(--muted); text-decoration: none }
.site-bar nav a:hover, .site-bar nav [aria-current] { color: var(--paper); text-decoration: underline; text-underline-offset: .4em }
.site-controls { margin-inline-start: auto; gap: var(--gap-xs) }
.site-controls button, .icon-button, .step-controls button, .camera-controls button {
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--control);
  color: var(--paper);
  padding: var(--gap-xs) var(--gap-s);
}
.site-controls button:hover, .icon-button:hover, .step-controls button:hover, .camera-controls button:hover { border-color: var(--accent) }

.feature {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 37fr) minmax(0, 57fr);
  column-gap: 6%;
  align-items: center;
  padding: calc(var(--header-height) + var(--gap-m)) var(--gutter) var(--gap-xl);
  background:
    linear-gradient(90deg, var(--scene-ink) 0%, color-mix(in srgb, var(--scene-ink), transparent 8%) 26%, transparent 66%),
    radial-gradient(ellipse at 83% 92%, color-mix(in srgb, var(--scene-light), #fff 16%) 0%, transparent 30%),
    radial-gradient(ellipse at 82% 3%, var(--scene-light) 0%, transparent 43%),
    radial-gradient(ellipse at 78% 75%, var(--scene-blue) 6%, transparent 55%),
    linear-gradient(165deg, var(--scene-ink), var(--scene-floor));
}
.intro { grid-column: 1; grid-row: 1; position: relative; z-index: 3; min-width: 0 }
.intro h1 {
  margin: 0;
  font: 400 var(--display)/.99 var(--title);
  letter-spacing: -.025em;
  text-wrap: balance;
}
:lang(zh) .intro h1 { line-height: 1.18; font-weight: 600 }
.intro p {
  margin: var(--gap-l) 0 var(--gap-xl);
  color: var(--muted);
  max-width: 28em;
  font-size: var(--type-body);
}
.text-link { display: inline-flex; align-items: baseline; gap: var(--gap-s); color: var(--accent); text-underline-offset: .28em; font-weight: 600 }
.text-link:hover { color: var(--paper) }
.details { width: 90%; max-width: 58rem; padding: var(--gap-xl) 0; margin: auto; border-top: 1px solid var(--edge) }
.details h2 { margin: 0 0 var(--gap-m); font: 400 2rem/1.2 var(--title) }
.details p, .details ol { max-width: 65ch; color: var(--muted) }
.details li + li { margin-top: var(--gap-xs) }

.exhibit { grid-column: 2; grid-row: 1; margin: 0; min-width: 0 }
.render-layer, .scene-poster {
  position: absolute;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}
.render-layer { width: 100%; height: 100%; inset: 0 }
/* Feather the painted layer while keeping projected text sharp. */
.render-layer, .work-poster, .home-poster, .home-scene .scene-fallback {
  mask-image: linear-gradient(to right, transparent var(--scene-left-out, 0%), #000 var(--scene-left-in, 0%),
      #000 var(--scene-right-in, 100%), transparent var(--scene-right-out, 100%)),
    linear-gradient(to bottom, transparent, #000 4%, #000 var(--scene-bottom-in, 86%), transparent);
  mask-composite: intersect;
}
[data-render="webgl"] > .render-layer, .workflow[data-render="webgl"] .render-layer { visibility: visible; opacity: 1 }
[data-render="webgl"] :is(.desk-still, .chip-still) { visibility: hidden }
@keyframes scene-poster-out { from { opacity: 1 } to { opacity: 0; visibility: hidden } }
@keyframes scene-overlay-in { from { opacity: 0 } to { opacity: 1 } }
[data-presented] .scene-poster { animation: scene-poster-out var(--scene-fade) ease both }
[data-fade-paused] :is(.scene-poster, .role-row, .desk-label, .work-screen) { animation-play-state: paused }
@media (prefers-reduced-motion: reduce) {
  :root { --scene-fade: 0s }
}
figcaption { margin-top: var(--gap-s); font-size: var(--type-meta); color: var(--muted); line-height: 1.45 }

.workflow { --role-label-height: 44px; align-self: end; margin-block-end: clamp(0rem, 100svh - 47rem, 4.5rem) }
.work-stage {
  --screen-top: 16.5%;
  --screen-left: 54%;
  --screen-width: 37.6%;
  --screen-height: 27%;
  --agent-0-x: 57%;
  --agent-1-x: 73%;
  --agent-2-x: 87%;
  --agent-0-y: calc(100% * var(--role-label-row));
  --agent-1-y: var(--agent-0-y);
  --agent-2-y: 64%;
  --tray-top: 66.5%;
  --agent-hit-height: min(8.6vw, 8rem);
  --agent-hit-width: 10vw;
  --drag-left: 48%;
  --drag-top: 15%;
  --drag-width: 50%;
  --drag-height: 59%;
  position: absolute;
  inset: 0;
  touch-action: pan-y;
}
.work-overlay, .workflow > figcaption { position: relative; z-index: 3 }
:root[data-theme="dark"] .workflow :is(.work-status, figcaption) {
  width: fit-content;
  padding: var(--gap-xs) var(--gap-s);
  border-radius: var(--radius);
  color: var(--paper);
  background: color-mix(in srgb, var(--scene-ink) 88%, transparent);
}
.work-stage .render-layer, .work-poster {
  z-index: 1;
  height: 80%;
}
.work-stage .render-layer { inset-inline-start: 40%; width: 60%; --scene-left-in: 10% }
.work-poster {
  inset: 0 0 auto;
  overflow: hidden;
  container-type: inline-size;
  --scene-left-out: 40%;
  --scene-left-in: 46%;
  /* 26 × 36 / 58 world units across the Blender image, at the live camera scale. */
  --poster-width: min(100.2922cqw, calc(var(--work-height) * 2.6241));
}
.work-poster img {
  position: absolute;
  width: var(--poster-width);
  height: auto;
  left: calc(71.8% - var(--poster-width) * .5);
  top: calc(var(--work-height) * .449 - var(--poster-width) * .28125);
}
/* Match the static image to the idle scene. The CSS stills cover manual steps while loading. */
.workflow[data-render][data-state="idle"] .work-poster:has(img[data-ready]) {
  visibility: visible;
  opacity: 1;
}
body:not([data-page="home"]) .workflow[data-render][data-state="idle"]:not([data-presented]) .work-stage:has(.work-poster img[data-ready]) :is(.desk-still, .work-screen) {
  opacity: 0;
}
.workflow[data-render]:not([data-presented]) :is(.role-row, .role-description, .desk-label, .card-label) {
  visibility: hidden;
}
.workflow[data-presented] :is(.role-row, .desk-label),
.workflow[data-presented][data-state="idle"] .work-stage:has(.work-poster img[data-ready]) .work-screen {
  animation-name: scene-overlay-in;
  animation-duration: var(--scene-fade);
  animation-timing-function: ease;
  animation-fill-mode: both;
}
.drag-surface {
  position: absolute;
  z-index: 1;
  top: var(--drag-top);
  left: var(--drag-left);
  width: var(--drag-width);
  height: var(--drag-height);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.work-stage[data-dragging] .drag-surface { cursor: grabbing }
@media (prefers-reduced-motion: reduce), (pointer: coarse) {
  .drag-surface { pointer-events: none }
}
.work-screen {
  position: absolute;
  z-index: 2;
  top: var(--screen-top, 8%);
  left: var(--screen-left, 19%);
  width: var(--screen-width, 61%);
  height: var(--screen-height, 47%);
  pointer-events: none;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--gap-xs);
  padding: var(--gap-s);
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid #7290bb70;
  background: #0c1628;
  color: var(--panel-text);
  font-size: clamp(.625rem, 1vw, .85rem);
  line-height: 1.2;
}
.screen-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--gap-xs); color: var(--panel-muted) }
.screen-step { color: #a8cfff; text-align: end }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-xs) }
.sample { min-width: 0; padding: var(--gap-xs); background: #1c2b43; border: 1px solid #476282; border-radius: 3px; display: flex; align-items: flex-start; flex-direction: column; gap: .22em }
.sample-label { width: 100%; color: #b7c7db; font-size: .86em }
.sample-label::after {
  content: "";
  display: block;
  height: clamp(.65rem, 2.4vw, 1.8rem);
  margin-top: var(--gap-xs);
  background: linear-gradient(140deg, #244767, #4c7a9f 64%, #294f72);
  clip-path: polygon(0 53%, 34% 6%, 58% 43%, 78% 20%, 100% 64%, 100% 100%, 0 100%);
}
.after.pending .sample-label::after { visibility: hidden }
.sample-line { display: flex; align-items: center; gap: .34em; flex-wrap: wrap }
.sample-summary { color: #cedaed }
.sample-action { padding: .14em .32em; border-radius: 2px; background: #a8cfff; color: #13223a; font-weight: 700; white-space: nowrap }
.after { border-color: #70a9e9 }
.after.pending .sample-line, .after.pending .sample-summary, .after.pending .sample-action { visibility: hidden }
.diff { position: relative; font-family: var(--mono); color: #ffbaa7; border-left: 2px solid #996150; padding-left: var(--gap-xs) }
.diff div + div { color: #b1e3d6 }
.diff.pending { visibility: hidden }
.mobile-diff { display: none }
[data-review="diff"] .diff::after {
  content: "";
  position: absolute;
  inset: var(--scan-progress, 0%) 0 auto;
  height: 2px;
  background: #a0eaff;
  box-shadow: 0 0 8px #9bf0ff;
  pointer-events: none;
}
:is([data-review="button"], [data-review="still"]) .after .sample-action {
  outline: 2px solid #a0eaff;
  outline-offset: 1px;
}
[data-review="still"] .diff > div {
  background: #223b56;
  box-shadow: inset 0 -1px #a0eaff;
}
.desk-label, .card-label {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  font: 600 var(--type-meta)/1.2 var(--body);
}
.desk-label {
  top: var(--tray-top, 72%);
  left: var(--tray-left, 95%);
  transform: translate(-50%, var(--gap-xs));
  color: var(--panel-text);
  background: var(--panel);
  border-radius: 3px;
  padding: 0 var(--gap-xs);
}
.card-label {
  left: 0;
  top: 0;
  color: #18243b;
  background: #fff0cd;
  border-radius: 3px;
  padding: var(--gap-xs);
  transform: translate(var(--card-x), var(--card-y)) translate(-50%, -100%);
}
.desk-still {
  position: absolute;
  inset: 15% 1.5% auto 48%;
  height: 59%;
  transform: perspective(100vw) rotateY(var(--yaw, 0deg));
  pointer-events: none;
}
.still-table {
  position: absolute;
  inset: 2% 13% 52% 10%;
  border: 5px solid #1a304c;
  border-top-color: #7794b5;
  border-radius: 5px;
  background: #0d1626;
  box-shadow: 0 .6rem 1.8rem #05091485;
}
.still-table::after {
  position: absolute;
  content: "";
  inset: 100% 46% -34%;
  background: linear-gradient(90deg, #1d324e, #6284ad 52%, #2c4768);
  border-bottom: 5px solid #182b46;
}
.still-rail { position: absolute; inset: 83% 2% auto; height: 7%; border: 1px solid #667e9f; background: #101c31; border-radius: 5px; transform: skewX(-8deg); box-shadow: 0 .6rem 1.3rem #060c18aa }
.still-card { position: absolute; top: 8%; left: var(--still-card, 26%); width: 9%; height: 88%; border-radius: 2px; background: linear-gradient(150deg, #fcf1d6, #b99a70); box-shadow: 1px 3px 6px #040914 }
[data-state="idle"] { --still-card: 1% }
[data-state="instruction"] { --still-card: 17% }
[data-state="implementation"] { --still-card: 46% }
[data-state="review"] { --still-card: 64% }
[data-state="decision"] { --still-card: 87% }
.still-planner, .still-builder, .still-reviewer {
  position: absolute;
  transform: translateX(-50%);
  transform-origin: bottom center;
  bottom: 16%;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 40% 31%, #fbfff8 2%, #d1d9e3 48%, #5c708f 83%);
  box-shadow: 0 .7rem 1rem #090e1980;
}
.still-planner {
  left: 17.3%;
  border-radius: 47% 56% 45% 51%;
  background: radial-gradient(ellipse at 39% 28%, #ffc3a4 2%, #d97757 48%, #753c3d 87%);
}
.still-builder { left: 50.6% }
.still-reviewer {
  left: 78.9%;
  bottom: 17%;
  width: 10%;
  aspect-ratio: .68;
  border-radius: 45% 45% 36% 36%;
}
.still-planner b, .still-builder b {
  position: absolute;
  inset: 35% 16% 25%;
  display: block;
  border-radius: 48%;
  background: radial-gradient(ellipse at 34% 52%, #b4efff 0 6%, transparent 9%),
    radial-gradient(ellipse at 66% 52%, #b4efff 0 6%, transparent 9%), linear-gradient(165deg, #353e51, #0b1420);
}
.still-planner b {
  inset-inline: 23%;
  background: radial-gradient(ellipse at 34% 52%, #ffd1a6 0 6%, transparent 9%),
    radial-gradient(ellipse at 66% 52%, #ffd1a6 0 6%, transparent 9%), linear-gradient(165deg, #553739, #251c25);
}
.still-builder i { position: absolute; inset: -9% -10% 4%; border: 2px solid #26374d; border-top-color: #b3e4f4; border-right-color: transparent; border-radius: 50%; transform: rotate(-27deg) }
.still-keyboard {
  position: absolute;
  inset: 88% 3% -12%;
  border: 2px solid #536c8c;
  border-bottom-color: #26374d;
  border-radius: 12%;
  background: repeating-linear-gradient(90deg, #26374d 0 5%, #afc5da 5% 14%);
  box-shadow: 0 .25rem .5rem #090e1980;
  transform: perspective(3em) rotateX(30deg);
}
.still-keyboard::before, .still-keyboard::after {
  content: "";
  position: absolute;
  top: -46%;
  width: 21%;
  height: 63%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 35% 24%, #a6b6cd, #26374d 68%);
}
.still-keyboard::before { left: 17% }
.still-keyboard::after { right: 17% }
[data-state="implementation"] .still-keyboard { border-top-color: #ffcb92 }
[data-state="implementation"] .still-keyboard::before { translate: 0 44% }
.still-reviewer b {
  position: absolute;
  inset: -12% -38% 50%;
  border-radius: 49% 49% 43% 43%;
  background: linear-gradient(152deg, #f2f7fc, #899eb7 66%, #465d79);
}
.still-reviewer b::after {
  content: "";
  position: absolute;
  inset: 26% 9% 16%;
  border: 2px solid #3b6079;
  border-radius: 42%;
  background: radial-gradient(circle at 28% 51%, #edffff 0 7%, transparent 10%),
    radial-gradient(circle at 69% 51%, #edffff 0 7%, transparent 10%),
    linear-gradient(155deg, #bdf0f9bb, #509cbed9);
}
.still-antenna {
  position: absolute;
  inset: -41% -38% 71% auto;
  width: 8%;
  border-radius: 50%;
  background: linear-gradient(#adf4ff 28%, #7c90ac 28%);
  transform: rotate(20deg);
}
.still-lens {
  position: absolute;
  inset: -1% auto auto -20%;
  width: 52%;
  aspect-ratio: 1;
  border: 2px solid #a7eefb;
  border-radius: 50%;
  background: #a7eefb32;
  box-shadow: 0 0 0 2px #35516a;
}
.workflow:is([data-review="diff"], [data-review="button"], [data-review="still"]) .still-lens {
  box-shadow: 0 0 .5rem #9bf0ff, 0 0 0 2px #35516a;
}
.still-planner i { position: absolute; inset: 12% 45% auto; height: 16%; border-radius: 50%; background: #ffd7ae; box-shadow: 0 0 .5rem #ffb282 }
.still-planner i:first-child { translate: -90% 43%; rotate: -26deg; scale: .76 }
.still-planner i:nth-child(2) { translate: 94% 34%; rotate: 26deg; scale: .84 }
.still-tray { position: absolute; inset: 84% 3% 11% 88%; border: 2px solid #859cba; border-radius: 3px; background: #273b57 }
.role-row { position: absolute; z-index: 2; inset: 0; pointer-events: none }
[data-role="0"] { --agent-x: var(--agent-0-x); --agent-y: var(--agent-0-y) }
[data-role="1"] { --agent-x: var(--agent-1-x); --agent-y: var(--agent-1-y) }
[data-role="2"] { --agent-x: var(--agent-2-x); --agent-y: var(--agent-2-y) }
.role-row button {
  position: absolute;
  inset: var(--agent-y) auto auto var(--agent-x);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  min-width: 44px;
  min-height: var(--role-label-height);
  align-content: center;
  padding: var(--gap-xs);
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--panel-text);
  text-align: center;
  white-space: nowrap;
  font-size: var(--type-ui);
  line-height: 1.2;
  pointer-events: auto;
}
.role-row button::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--agent-hit-height)) auto 100% 50%;
  width: var(--agent-hit-width);
  transform: translateX(-50%);
}
.role-row button span { font-size: var(--type-meta) }
.role-row button:focus-visible { outline-color: #83b9ff }
.role-row button:is(:hover,[aria-pressed="true"],.current-role) strong { text-decoration: underline; text-decoration-color: #83b9ff; text-underline-offset: .25em }
.role-description {
  position: absolute;
  z-index: 4;
  left: var(--bubble-x, 73%);
  top: calc(var(--bubble-y, 65%) - var(--agent-hit-height));
  transform: translate(-50%, -95%);
  margin: 0;
  padding: var(--gap-xs) var(--gap-s);
  max-width: min(14rem, 78vw);
  color: var(--panel-text);
  background: #0e1c30;
  border: 1px solid #6585ab;
  border-radius: var(--radius);
  font-size: var(--type-ui);
  line-height: 1.35;
  pointer-events: none;
}
.role-description[data-active="0"] { --bubble-x: var(--agent-0-x); --bubble-y: var(--agent-0-y) }
.role-description[data-active="1"] { --bubble-x: var(--agent-1-x); --bubble-y: var(--agent-1-y) }
.role-description[data-active="2"] { --bubble-x: min(var(--agent-2-x), calc(100% - 7rem)); --bubble-y: var(--agent-2-y) }
.work-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-s); margin: var(--gap-s) 0 }
.primary-button { min-height: 44px; border-radius: 999px; border: 1px solid transparent; padding: var(--gap-xs) var(--gap-m); background: var(--accent); color: #10203a; font-weight: 700 }
:root:not([data-direction="c"])[data-theme="light"] .primary-button:not([aria-disabled="true"]) { color: #fff }
.primary-button:not([aria-disabled="true"]):hover { filter: brightness(1.15) }
.primary-button[aria-disabled="true"] { background: var(--control); color: var(--muted); border-color: var(--edge); cursor: default }
.step-controls, .camera-controls { display: flex; gap: var(--gap-xs); font-size: var(--type-ui) }
.step-controls button:disabled { opacity: .54 }
.camera-controls { margin-inline-start: auto }
.camera-controls button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 -2px var(--accent) }
.work-status { margin: 0; display: flex; flex-wrap: wrap; column-gap: var(--gap-s); align-items: baseline; line-height: 1.4; font-size: var(--type-ui); color: var(--muted) }
.work-status strong { color: var(--paper) }

.fps-label { font: var(--type-meta)/1 var(--mono); color: var(--panel-muted) }
.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 74fr) minmax(0, 24fr);
  grid-template-areas: "label label" "work output" "timeline output";
  row-gap: var(--gap-xs);
  column-gap: var(--gap-l);
  padding: var(--gap-s);
  color: var(--panel-text);
  color-scheme: dark;

}
.edit-layout :focus-visible { outline-color: #83b9ff }
.edit-demo-label {
  position: relative;
  z-index: 2;
  grid-area: label;
  justify-self: start;
  padding: var(--gap-xs) var(--gap-s);
  border-radius: 3px;
  background: var(--panel);
  color: var(--panel-text);
  font-size: var(--type-meta);
}
.edit { margin-bottom: var(--gap-xl) }
.work-view { grid-area: work; min-width: 0 }
.output-view { grid-area: output; align-self: end; margin-block-end: var(--gap-m); min-width: 0 }
.monitor {
  z-index: -1;
  position: relative;
  background: #0a1526;
  border: 5px solid #172942;
  border-top-color: #7089a8;
  border-left-color: #3b5877;
  border-radius: 5px;
  box-shadow: 0 0 0 1px #10203b, 0 .5rem 1.25rem #030a14a8;
}
.monitor-main { grid-area: 2 / 1 / 4 / 2; margin: calc(-1 * var(--gap-s)) }
.monitor-portrait { grid-area: output; align-self: end; aspect-ratio: .51; margin-block-end: var(--gap-s); margin-inline: calc(-1 * var(--gap-s)) }
.feature:not([data-render="webgl"]) .monitor::before, .feature:not([data-render="webgl"]) .monitor::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  transform: translateX(-50%);
}
.monitor::before {
  top: 100%;
  width: 13%;
  height: var(--gap-xl);
  border-radius: 0 0 5px 5px;
  background: linear-gradient(90deg,#233953,#7897bd 43%,#294367 98%);
}
.monitor::after {
  top: calc(100% + var(--gap-l));
  width: 46%;
  height: var(--gap-l);
  background: linear-gradient(168deg,#7692b4 4%,#3a5271 42%,#172a43 94%);
  border-bottom: 4px solid #101f36;
  border-radius: 3px;
  transform: translateX(-50%) perspective(12rem) rotateX(31deg);
  box-shadow: 0 .8rem 1rem #08142491;
}
.view-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0 var(--gap-xs); min-height: 1.65rem; padding: 0 var(--gap-xs); color: var(--panel-muted); font-size: var(--type-meta); line-height: 1.25 }
.view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2.48;
  border: 1px solid #475c7f;
  border-radius: 3px;
  background: radial-gradient(ellipse at 56% 54%, #24395b, #111b2e 70%);
}
#portrait { aspect-ratio: 9/16; background: radial-gradient(ellipse at 52% 43%, #293f67, #101a2d 70%) }
[data-page="pebble"] .feature > .render-layer { z-index: 1 }
.crop { position: absolute; z-index: 2; inset: 11% 18%; border: 1px solid #a3c7f091; pointer-events: none }
.crop::after { content: ""; position: absolute; inset: -3px 25%; background: linear-gradient(#192b44,#192b44) top / 100% 5px no-repeat,linear-gradient(#192b44,#192b44) bottom / 100% 5px no-repeat; opacity: .7 }
.caption { position: absolute; z-index: 2; bottom: 7%; left: 7%; right: 7%; margin: 0; padding: var(--gap-xs); border-radius: 4px; background: #0a1425ec; color: #f3f5f8; text-align: center; font-weight: 700; font-size: clamp(.68rem,1.05vw,1rem); line-height: 1.22; overflow-wrap: anywhere }
.chip-still { position: absolute; top: 45%; left: 50%; width: 40%; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(-36deg) skew(13deg, 8deg); border-radius: 9%; background: repeating-linear-gradient(90deg,#dcad67 0 2px,transparent 2px 9px),repeating-linear-gradient(0deg,#af7844 0 2px,#173a47 2px 9px); border: .3rem solid #3b647a; box-shadow: .25rem .3rem #0d2028,.5rem .65rem 1.2rem #080f1c; }
#portrait .chip-still { width: 54%; top: 43% }
.chip-still i { position: absolute; inset: 13%; background: #1d4c58; border: 2px solid #bd9464 }
.chip-still i + i { inset: 23%; background: linear-gradient(155deg,#8aa1b7,#2b4057 39%,#7f6047 72%,#344d66); border-color: #bf9c77; box-shadow: .2rem .25rem #142332 }
.chip-still b { position: absolute; inset: 36%; border: 1px solid #c0ab8b; background: repeating-linear-gradient(90deg,#bf9666 0 1px,#2c4d61 1px 4px) }
[data-shot="1"] .chip-still { transform: translate(-43%, -42%) rotate(-22deg) skew(12deg, 12deg) scale(1.75) }
[data-shot="2"] .chip-still { transform: translate(-50%, -50%) rotate(-44deg) skew(11deg, 6deg) scale(.91) }
.outliner { display: flex; flex-wrap: wrap; gap: .12rem var(--gap-s); padding: var(--gap-xs) var(--gap-xs) 0; margin: 0; list-style: none; font-size: var(--type-meta); color: var(--panel-muted) }
.outliner li.selected { color: #b8d9ff; font-weight: 700; text-decoration: underline; text-underline-offset: .22em }
.timeline { position: relative; z-index: 2; grid-area: timeline; min-width: 0; border-top: 1px solid var(--panel-edge); background: #0a1526 }
.transport { display: flex; justify-content: space-between; align-items: center; padding: var(--gap-xs) 0 0; gap: var(--gap-xs) }
.transport-buttons { display: flex; flex-wrap: wrap; gap: 3px }
.transport-buttons > :is(button, span) {
  border: 1px solid #4d6384;
  border-radius: 3px;
  background: #1b2b43;
  color: var(--panel-text);
  min-width: 2.35rem;
  min-height: 2.25rem;
  font-family: var(--mono);
  line-height: 1;
  font-size: var(--type-ui);
}
.transport-buttons > span { display: inline-grid; place-items: center }
.transport-buttons button:not([aria-disabled="true"]):hover { border-color: #83b9ff }
.transport-buttons button[aria-disabled="true"] { opacity: .54; cursor: default }
#timecode { margin-inline-start: auto; color: #b8d9ff; font: var(--type-ui)/1 var(--mono) }
.track-grid { position: relative; display: grid; grid-template-columns: minmax(2.4em, 12%) minmax(0, 1fr); gap: 3px; font-size: var(--type-meta); }
.ruler { position: relative; min-height: 44px; background: repeating-linear-gradient(90deg,#466184 0 1px,transparent 1px calc(100% / 24)) left bottom / 100% .45rem no-repeat; }
.marks { display: flex; justify-content: space-between; padding-top: var(--gap-xs); color: var(--panel-muted); font: .95em/1 var(--mono); pointer-events: none }
.marks span:nth-child(2), .marks span:nth-child(3) { position: absolute; left: 33.33%; transform: translateX(-50%) }
.marks span:nth-child(3) { left: 66.67% }
#frame { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; appearance: none; background: transparent; cursor: ew-resize; touch-action: pan-y }
#frame::-webkit-slider-thumb { appearance: none; width: 1px; height: 1px; opacity: 0 }
#frame::-moz-range-thumb { border: 0; width: 1px; height: 1px; opacity: 0 }
.track-name { color: var(--panel-muted); align-self: center; overflow-wrap: anywhere; padding-inline-start: .12rem }
.track-clips {
  min-height: 1.48rem;
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 2px;
  padding: 1px;
  background: #15243a;
  border-radius: 3px;
}
.clip { display: flex; align-items: center; gap: 4px; min-width: 0; padding: .13rem .28rem; text-align: start; font-size: inherit; line-height: 1.18; font-family: inherit; overflow-wrap: anywhere; border: 1px solid #478282; border-radius: 2px; background: #235255; color: #f0fffb }
.clip.active { border-color: #b7efe0; background-color: #326e70; }
.clip.close { grid-column: 2 }
.clip.end { grid-column: 3 }
.shot-chip::before { content: ""; flex: 0 0 1.6em; height: 1em; background: linear-gradient(145deg,#b28452,#a7b3cc 45%,#263c5a 49%,#b58a59 79%); transform: rotate(-18deg); border: 1px solid #93a9ae }
.shot-chip.close::before { background: linear-gradient(140deg,#799bc9,#203850 52%,#bf9761 56%,#80654e) }
.shot-chip.end::before { transform: rotate(19deg) }
.clip.sound { grid-column: 2; background: #514567; border-color: #816f9d }
.clip.sound + .clip.sound { grid-column: 3 }
.subtitles .clip { background: #263d62; border-color: #536f97; color: #e5effe }
.subtitles .clip.active, .subtitles .clip:hover { background: #35578d; border-color: #a7ceff }
.waveform { grid-column: span 3; min-height: 1.3rem; background: repeating-linear-gradient(90deg,#97a5e8 0 1px,transparent 1px 4px); clip-path: polygon(0 49%,4% 43%,6% 28%,8% 47%,10% 11%,12% 35%,15% 18%,17% 38%,20% 12%,24% 25%,27% 39%,30% 8%,32% 48%,35% 43%,38% 20%,41% 5%,44% 31%,48% 22%,50% 40%,53% 10%,57% 31%,60% 16%,62% 45%,65% 43%,69% 22%,73% 5%,75% 27%,79% 17%,81% 43%,84% 28%,88% 10%,92% 32%,94% 45%,100% 48%,100% 52%,94% 55%,92% 68%,88% 90%,84% 72%,81% 57%,79% 83%,75% 73%,73% 95%,69% 78%,65% 57%,62% 55%,60% 84%,57% 69%,53% 90%,50% 60%,48% 78%,44% 69%,41% 95%,38% 80%,35% 57%,32% 52%,30% 92%,27% 61%,24% 75%,20% 88%,17% 62%,15% 82%,12% 65%,10% 89%,8% 53%,6% 72%,4% 57%,0 51%) }
.playhead { position: absolute; grid-column: 2; left: var(--head, 0%); top: 1.42rem; bottom: 0; width: 1px; pointer-events: none; z-index: 1; background: #b5ddff; transform: translateX(-50%) }
.playhead::before { position: absolute; content: ""; top: 0; left: -4px; width: 9px; height: 8px; background: #b5ddff; clip-path: polygon(0 0,100% 0,100% 58%,50% 100%,0 58%) }
.track-tip { position: absolute; z-index: 3; bottom: calc(100% + .3rem); right: 0; max-width: 100%; display: grid; gap: .13rem; padding: var(--gap-xs) var(--gap-s); color: #f6f9ff; background: #172b49; border: 1px solid #6788b1; border-radius: 4px; font-size: var(--type-meta); pointer-events: none }
.debug { position: fixed; z-index: 6; top: var(--gap-xs); right: var(--gap-xs); max-width: calc(100% - 1rem); padding: var(--gap-xs) var(--gap-s); border: 1px solid #6285ad; background: #071020ed; border-radius: 4px; color: #eaf3ff; pointer-events: none }
.debug pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .69rem/1.35 var(--mono) }

@media (max-width: 1150px) {
  :root { --display: 3.375rem }
}
@media (761px <= width <= 1000px) {
  .work-screen { font-size: .625rem; padding: var(--gap-xs); gap: .2rem }
  .sample { padding: .2rem; gap: .14em }
}
@media (width <= 1300px) { .sample-label::after { display: none } }
@media (min-width: 761px) and (max-height: 650px) {
  .feature { min-height: max(100svh, 38rem) }
  .sample-label::after { height: var(--gap-m) }
}
@media (max-width: 760px) {
  :root { --display: 2.375rem; --type-body: 1.05rem; --gutter: 4vw; --header-height: 4.5rem }
  .site-bar { position: relative; gap: var(--gap-s); flex-wrap: wrap }
  .site-bar nav { gap: var(--gap-s) }
  .site-controls button { padding-inline: var(--gap-xs) }
  .feature {
    min-height: calc(100svh - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-l);
    padding-block: var(--gap-l) var(--gap-xl);
    background:
      linear-gradient(180deg, var(--scene-ink) 0%, transparent 48%, var(--scene-ink) 97%),
      radial-gradient(ellipse at 65% 63%, var(--scene-blue) 0%, transparent 64%),
      linear-gradient(175deg, var(--scene-ink), var(--scene-floor));
  }
  .intro p { margin: var(--gap-s) 0 var(--gap-m) }
  .intro h1 { text-wrap: initial }
  .workflow { align-self: stretch; margin: 0 }
  .work-stage {
    --art-height: clamp(15rem, 71vw, 23rem);
    --screen-left: 17.5%;
    --screen-top: 6%;
    --screen-width: 65%;
    --screen-height: 36%;
    --tray-left: 92%;
    --tray-top: 75%;
    --agent-0-x: 20%;
    --agent-1-x: 50%;
    --agent-2-x: 77%;
    --agent-0-y: 76%;
    --agent-1-y: var(--agent-0-y);
    --agent-2-y: var(--agent-0-y);
    --agent-hit-width: 16vw;
    --agent-hit-height: 16vw;
    --drag-left: 1%;
    --drag-top: 5%;
    --drag-width: 98%;
    --drag-height: 76%;
    position: relative;
    height: calc(var(--art-height) + var(--role-space, 0px));
    margin-inline: calc(-1 * var(--gutter));
  }
  .work-stage .render-layer { inset-inline-start: 0; width: 100%; height: var(--art-height); --scene-left-in: 0% }
  .work-poster {
    --poster-width: min(173.2320cqw, calc(var(--art-height) * 3.4705));
    height: var(--art-height);
    --scene-left-out: 0%;
    --scene-left-in: 0%;
  }
  .work-poster img {
    left: calc(50.5% - var(--poster-width) * .5);
    top: calc(var(--art-height) * .43 - var(--poster-width) * .28125);
  }
  .desk-still { inset: 5% 3% auto; height: 83% }
  .still-table { inset-inline: 13% }
  .work-screen { font-size: var(--type-meta); gap: var(--gap-xs); padding: var(--gap-xs); justify-content: flex-start }
  .work-screen .diff, .screen-bar > span:first-child { display: none }
  .mobile-diff { display: block; margin-top: var(--gap-xs); padding-block: var(--gap-xs); color: var(--panel-text); background: #182a43; font-size: var(--type-meta) }
  .sample { padding: .14rem; gap: .13em }
  .desk-label { transform: translate(-50%, calc(44px + var(--gap-xs))); font-size: .625rem }
  .role-row button, .role-description { padding-inline: var(--gap-xs) }
  .role-row button { max-width: 31vw; white-space: normal }
  .role-row button span { font-size: .69rem }
  .role-description[data-active="0"] { --bubble-x: max(var(--agent-0-x), 7.1rem) }
  .edit { margin: 0 }
  .edit-layout { grid-template-columns: minmax(0, 59fr) minmax(0, 41fr); grid-template-areas: "label label" "work output" "timeline timeline"; align-items: center; gap: var(--gap-s); padding: 0 }
  .monitor-main { grid-area: work; align-self: stretch; margin: calc(-1 * var(--gap-xs)) }
  .monitor-portrait { align-self: center; margin: 0; width: min(100%, 9rem); justify-self: center }
  .monitor::before, .monitor::after { display: none }
  .timeline { margin-top: var(--gap-xs); padding: var(--gap-xs); border: 1px solid var(--panel-edge); border-radius: 4px }
  .view { aspect-ratio: 1.35 }
  .output-view { align-self: center; margin: 0; width: min(calc(100% - var(--gap-s)), 8rem); justify-self: center }
  .view-heading { font-size: .6875rem }
  :is(.site-controls, .work-controls, .transport-buttons) button,
  .subtitles .clip, .site-bar nav a, .text-link { min-height: 44px; min-width: 44px }
  .site-bar nav a, .text-link { display: inline-flex; align-items: center }
  .camera-controls { margin-inline-start: 0 }
  @container (width > 15rem) {
    .workflow[data-render] .work-stage {
      --role-space: calc(var(--role-label-height) + var(--gap-xs));
    }
    .workflow[data-render="webgl"] .role-row {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--gap-xs);
      inset: var(--art-height) var(--gutter) 0;
    }
    .workflow[data-render="webgl"] .role-row button {
      position: relative;
      inset: auto;
      transform: none;
      max-width: none;
      font-size: var(--type-meta);
    }
    .workflow[data-render="webgl"] .role-row button::before { display: none }
    .workflow[data-render="webgl"] .role-description {
      top: auto;
      bottom: calc(var(--role-space) + var(--gap-xs));
      left: clamp(7.1rem, var(--bubble-x), calc(100% - 7.1rem));
      transform: translateX(-50%);
    }
  }
}
/* Keep zoomed text in normal flow when it can no longer fit inside the 3D monitors. */
@container (max-width: 15rem) {
  .work-stage {
    --art-height: 71vw;
    display: grid;
    grid-template-areas: "roles" "screen";
    gap: var(--gap-s);
    height: auto;
    padding: var(--art-height) var(--gutter) 0;
  }
  .work-stage .render-layer { height: var(--art-height) }
  .desk-still { top: 0; height: var(--art-height) }
  .desk-label {
    left: min(var(--tray-left), calc(100% - 2rem));
    transform: translate(-50%, var(--gap-xs));
  }
  .card-label {
    transform: translate(clamp(2.8rem, var(--card-x), calc(100vw - 2.8rem)), var(--card-y)) translate(-50%, -100%);
  }
  .work-screen {
    grid-area: screen;
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    overflow: visible;
  }
  .role-row {
    grid-area: roles;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap-xs);
  }
  .role-row button { position: relative; inset: auto; transform: none; max-width: none; overflow-wrap: anywhere }
  .edit-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "label" "work" "output" "timeline" }
}
@media (max-width: 340px) {
  :root { --display: 2.125rem }
  .site-bar { padding-block: var(--gap-xs) }
  .site-bar nav, .site-controls { row-gap: var(--gap-xs) }
  .clip { padding-inline: .12rem }
}
.step-controls button[aria-disabled="true"] { opacity: .54; cursor: default }
@media (min-width: 761px) {
  .workflow {
    --work-height: max(100svh, 38rem);
    --role-label-row: .66;
    --role-label-top: calc(var(--work-height) * var(--role-label-row));
    /* Let the controls flow below the labels when a short desktop wraps its text. */
    padding-block-start: calc(var(--role-label-top) + var(--role-label-height) - var(--header-height));
  }
  .workflow[data-render] {
    --role-label-top: calc(var(--work-height) * .449 + min(21vw, var(--work-height) * .55) + var(--gap-s));
  }
  .workflow[data-render="webgl"] .role-row button { top: var(--role-label-top) }
  .workflow[data-render="webgl"] .role-row button::before {
    top: calc(var(--agent-y) - var(--role-label-top) - var(--agent-hit-height));
    bottom: auto;
    height: var(--agent-hit-height);
  }
  .work-stage { height: var(--work-height) }
  [data-debug] { --debug-width: clamp(0px, 90vw - 28rem, 36rem) }
  [data-debug] .site-controls { margin-inline-end: var(--debug-width) }
  [data-debug] .debug { max-width: var(--debug-width) }
}
@media (max-width: 760px) {
  .debug { position: relative; width: max-content; margin: var(--gap-xs) 3% 0 auto; inset: auto }
}

.shot-chip[data-preview]::before {
  background: var(--preview) center / cover no-repeat;
  transform: none;
}

/* Keep live HTML inside the loaded display hardware and retain the original static art. */
.workflow[data-render="webgl"] .work-screen {
  transform: var(--screen-transform, none);
  transform-origin: 0 0;
  background: transparent;
}
:is(.feature, .pebble-scene)[data-render="webgl"] .edit { position: relative; z-index: 2 }
:is(.feature, .pebble-scene)[data-render="webgl"] .edit-layout { transform-origin: 0 0 }
:is(.feature, .pebble-scene)[data-render="webgl"] :is(.view, #portrait) { background: transparent }
:is(.feature, .pebble-scene)[data-render="webgl"] .monitor { visibility: hidden }
:is(.feature, .pebble-scene)[data-render="webgl"] :is(.view-heading, .outliner) { position: relative; z-index: 2 }
.chip-poster { inset: 0; width: 100%; height: 100%; object-fit: cover }
:is(.feature, .pebble-scene)[data-render] .edit[data-shot="0"] .chip-poster[data-ready] { visibility: visible; opacity: 1 }
:is(.feature, .pebble-scene)[data-render="loading"] .edit[data-shot="0"] .view:has(.chip-poster[data-ready]) .chip-still {
  visibility: hidden;
}
@media (min-width: 761px) {
  :is(.feature, .pebble-scene)[data-render="webgl"] .timeline { background: transparent }
  :root:not([data-direction="c"])[data-theme="dark"] .feature:is(
    [data-render="webgl"],
    [data-render="loading"]:has(.edit[data-shot="0"] .chip-poster[data-ready]),
    :has(.workflow[data-render="webgl"], .workflow[data-render="loading"][data-state="idle"] .work-poster img[data-ready])
  ) {
    background:
      linear-gradient(90deg, var(--scene-ink) 0%, var(--scene-ink) 22%, transparent 62%),
      radial-gradient(ellipse at 82% 21%, #293e60 0%, transparent 53%),
      radial-gradient(ellipse at 82% 89%, #1e304a 0%, transparent 38%),
      #0a111f;
  }
}
@container (max-width: 15rem) {
  .workflow[data-render="webgl"] .work-screen { background: #0c1628; transform: none }
}
