/* Compact adaptation of z-lab/website's StreamingSim component. */
:root {
  color-scheme: light;
  font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
  color: #171717;
  background: #fff;
  --blue: #1772d0;
  --muted: #666;
  --gap: 4px;
  --block-height: 30px;
  --robot-size: clamp(62px, calc((100dvh - 195px) / 2), 160px);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.animation { width: 100%; max-width: 760px; margin: auto; padding: 6px 8px; }
.legend { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 11px; color: var(--muted); }
.ramp { width: 36px; height: 9px; border-radius: 2px; background: linear-gradient(to right, #2467b4, #d0e0f0); }
.executed-key { width: 9px; height: 9px; border: 1px solid #171717; margin-left: 8px; border-radius: 2px; }
.lane + .lane { margin-top: 14px; }
.lane-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: 6px; }
h2 { margin: 0; font-size: 13px; font-weight: 700; }
.step-count { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.lane-body { display: grid; grid-template-columns: minmax(0, 1fr) var(--robot-size); gap: 14px; align-items: center; }
.track { position: relative; height: var(--block-height); --unit: calc(100% / 16); }
.slot, .chunk {
  position: absolute;
  top: 0;
  height: var(--block-height);
  left: calc(var(--x) * var(--unit));
  width: calc(var(--w) * var(--unit) - var(--gap));
  border-radius: 3px;
}
.slot { border: 1px dashed #d2d7dc; background: #f7f9fb; }
.slot-executed { border-style: dotted; background: transparent; }
.divider { position: absolute; top: -3px; bottom: -3px; left: calc(10 * var(--unit) - var(--gap) / 2); border-left: 1px solid #a7acb1; }
.chunk {
  background: oklch(calc(.88 - .36 * var(--noise)) calc(.045 + .1 * var(--noise)) 250);
  opacity: 0;
  transition: left .4s ease, width .4s ease, background .3s ease, opacity .3s ease;
}
.chunk.visible { opacity: 1; }
.chunk.executed { box-shadow: inset 0 0 0 1px #171717; }
.chunk.attends { outline: 2px solid var(--blue); outline-offset: 1px; }
.axis { display: grid; grid-template-columns: 62.5% 1fr; margin-top: 5px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.robot-frame { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: #f1f3f5; }
video { display: block; width: 100%; height: 100%; object-fit: cover; }
.finished { position: absolute; top: 4px; right: 4px; padding: 2px 5px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 9px; }
.progress { margin-top: 5px; height: 3px; overflow: hidden; background: #edf0f3; border-radius: 2px; }
.fill { height: 100%; width: 0; background: var(--blue); }
.controls { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
button { border: 1px solid #ddd; border-radius: 3px; padding: 3px 7px; background: #fff; color: var(--blue); font: inherit; font-size: 11px; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:disabled { color: #999; cursor: default; }
.status { margin-left: auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.note { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.compact-note { display: none; }
.teaser {
  --gap: 1.5px;
  --block-height: 16px;
  --robot-size: 64px;
}
.teaser .animation { padding: 2px 0; }
.teaser .legend, .teaser .step-count, .teaser [data-restart], .teaser .note, .teaser .status { display: none; }
.teaser h2 { font-size: 11px; line-height: 14px; }
.teaser .lane-heading { margin-bottom: 2px; }
.teaser .lane + .lane { margin-top: 6px; }
.teaser .lane-body { gap: 6px; }
.teaser .slot, .teaser .chunk { border-radius: 2px; }
.teaser .axis { font-size: 8px; margin-top: 4px; }
.teaser .progress { height: 2px; margin-top: 3px; }
.teaser .controls { margin-top: 5px; gap: 4px; }
.teaser button { padding: 0 3px; border: 0; font-size: 9px; line-height: 13px; }
.teaser .compact-note { display: inline; margin-left: auto; font-size: 8px; color: var(--muted); }
.teaser .finished { font-size: 7px; padding: 1px 3px; right: 2px; top: 2px; }
.teaser.load-error .compact-note { display: none; }
.teaser.load-error .status { display: inline; font-size: 8px; }
@media (max-width: 400px) {
  :root:not(.teaser) { --gap: 2px; --block-height: 22px; }
  .lane-body { gap: 8px; }
  .axis { font-size: 8px; }
  .status { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .chunk { transition: none; }
}
