/* Live demo embedded in the project page: the released policy running in the browser (MuJoCo WASM).
   Shown where it can run (live-demo.js unhides it). Built from github.com/chengxuxin/chengxuxin.github.io
   (_parkour/, _amo/); everything is scoped to .live-demo-inline. */
.live-demo-inline {
  --ld-bg: #fbfbf9;
  --ld-text: #1c1c1a;
  --ld-muted: #6b6b64;
  --ld-faint: #6d6d66;
  --ld-accent: #c2410c;
  --ld-hairline: rgba(20, 20, 15, 0.18);
  --ld-chip: rgba(20, 20, 15, 0.05);
  --ld-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 18px auto 0;
  text-align: left;
}

.live-demo-inline .ld-panel {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #bbb;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ld-bg);
  outline: none;
}

.live-demo-inline .ld-poster,
.live-demo-inline .ld-canvas,
.live-demo-inline .ld-tether {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.live-demo-inline .ld-poster { object-fit: cover; transition: opacity 0.6s ease, filter 0.3s ease; }
.live-demo-inline .ld-canvas { display: block; opacity: 0; transition: opacity 0.6s ease; }
.live-demo-inline.is-live .ld-canvas { touch-action: none; }   /* until started, swipes still scroll the page */
.live-demo-inline.is-live .ld-canvas { opacity: 1; }
.live-demo-inline.is-live .ld-poster { opacity: 0; }
.live-demo-inline.is-live.is-swapping .ld-canvas { opacity: 0; transition-duration: 0.3s; }
.live-demo-inline:not(.is-open):hover .ld-poster { filter: brightness(0.97); }

/* start button over the poster */
.live-demo-inline .ld-start {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px 9px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(251, 251, 249, 0.92);
  box-shadow: 0 2px 14px rgba(20, 20, 15, 0.12);
  font: 500 13px/1.2 var(--ld-mono);
  letter-spacing: 0.03em;
  color: var(--ld-text);
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.3s ease;
}
.live-demo-inline .ld-start:hover { color: var(--ld-accent); }
.live-demo-inline .ld-start i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ld-accent);
  animation: ld-live-dot 2.4s ease-in-out infinite;
}
.live-demo-inline .ld-start small {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ld-faint);
  letter-spacing: 0.02em;
}
.live-demo-inline.is-open .ld-start { opacity: 0; pointer-events: none; }

@keyframes ld-live-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.45); }
  50% { box-shadow: 0 0 0 4px rgba(194, 65, 12, 0); }
}

/* overlays (appear once started) */
.live-demo-inline .ld-head,
.live-demo-inline .ld-gauges,
.live-demo-inline .ld-presets,
.live-demo-inline .ld-controls,
.live-demo-inline .ld-time,
.live-demo-inline .ld-status {
  position: absolute;
  opacity: 0;
  transition: opacity 0.35s ease;
  font-family: var(--ld-mono);
}
.live-demo-inline.is-open .ld-head,
.live-demo-inline.is-open .ld-status { opacity: 1; }
.live-demo-inline.is-open.is-live .ld-gauges,
.live-demo-inline.is-open.is-live .ld-presets,
.live-demo-inline.is-open.is-live .ld-controls,
.live-demo-inline.is-open.is-live .ld-time,
.live-demo-inline.is-open.is-live .ld-tether { opacity: 1; }

.live-demo-inline .ld-head {
  top: 14px; left: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 3px;
  pointer-events: none;
}
.live-demo-inline .ld-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ld-text);
}
.live-demo-inline .ld-title i { width: 6px; height: 6px; border-radius: 50%; background: var(--ld-accent); }
.live-demo-inline .ld-hint { font-size: 10.5px; color: var(--ld-faint); transition: opacity 0.6s ease; }
.live-demo-inline.is-touched .ld-hint { opacity: 0.45; }

.live-demo-inline .ld-course { margin-top: 5px; font-size: 10.5px; color: var(--ld-faint); }
.live-demo-inline .ld-course span { transition: color 0.2s ease; }
.live-demo-inline .ld-course span.on { color: var(--ld-accent); }
.live-demo-inline .ld-course em { font-style: normal; opacity: 0.7; }
.live-demo-inline .ld-course i { font-style: normal; margin: 0 8px; opacity: 0.5; }

/* chips */
.live-demo-inline .chip {
  display: inline-block;
  margin: 0;
  font: 11.5px/1.5 var(--ld-mono);
  letter-spacing: 0.01em;
  color: var(--ld-muted);
  background: var(--ld-chip);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.live-demo-inline .chip:hover,
.live-demo-inline .chip.on { color: var(--ld-accent); border-color: var(--ld-accent); background: transparent; }

.live-demo-inline .ld-controls,
.live-demo-inline .ld-presets { left: 18px; bottom: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.live-demo-inline .ld-presets { max-width: 55%; }
.live-demo-inline .ld-speed { display: flex; align-items: center; gap: 8px; margin: 0 0 0 10px; font-size: 10.5px; color: var(--ld-faint); font-weight: 400; }
.live-demo-inline .ld-speed input { width: 100px; margin: 0; accent-color: var(--ld-accent); }
.live-demo-inline .ld-speed output { min-width: 56px; color: var(--ld-muted); }
.live-demo-inline .ld-time { right: 18px; bottom: 18px; font-size: 10.5px; color: var(--ld-faint); pointer-events: none; }

/* AMO gauges: command (accent) vs what the robot does (ink) */
.live-demo-inline .ld-gauges { right: 18px; bottom: 16px; display: grid; gap: 7px; font-size: 10px; color: var(--ld-faint); }
.live-demo-inline .ld-gauge { display: grid; grid-template-columns: 44px 110px 50px; align-items: center; gap: 10px; }
.live-demo-inline .ld-g-val { text-align: right; color: var(--ld-muted); }
.live-demo-inline .ld-g-track { position: relative; height: 14px; cursor: pointer; }
.live-demo-inline .ld-g-track::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; border-top: 1px solid var(--ld-hairline); }
.live-demo-inline .ld-g-track i { position: absolute; top: 2px; width: 2px; height: 10px; margin-left: -1px; transition: left 0.08s linear; }
.live-demo-inline .ld-g-cmd { background: var(--ld-accent); }
.live-demo-inline .ld-g-real { background: var(--ld-text); opacity: 0.55; }

/* AMO drag points + tether */
.live-demo-inline .ld-tether { pointer-events: none; overflow: visible; opacity: 0; transition: opacity 0.4s ease; }
.live-demo-inline .ld-tether line { stroke: var(--ld-accent); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0; transition: opacity 0.2s ease; }
.live-demo-inline.is-grabbing .ld-tether line { opacity: 1; }
.live-demo-inline .ld-h-dot { fill: var(--ld-bg); stroke: var(--ld-accent); stroke-width: 1.8; transition: r 0.15s ease, fill 0.15s ease; }
.live-demo-inline .ld-h-ring { fill: none; stroke: var(--ld-accent); stroke-width: 1.2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.live-demo-inline .ld-h.is-hot .ld-h-dot { r: 8; }
.live-demo-inline .ld-h.is-active .ld-h-dot { fill: var(--ld-accent); }
.live-demo-inline.is-live:not(.is-touched) .ld-h-ring { animation: ld-ping 2s ease-out infinite; }
@keyframes ld-ping { from { transform: scale(1); opacity: 0.7; } to { transform: scale(2.6); opacity: 0; } }

/* loading / status */
.live-demo-inline .ld-status { left: 0; right: 0; bottom: 20px; text-align: center; font-size: 10.5px; letter-spacing: 0.04em; color: var(--ld-faint); pointer-events: none; }
.live-demo-inline .ld-status span { display: none; }
.live-demo-inline.is-open:not(.is-live) .ld-loading { display: inline; }
.live-demo-inline.is-fallen .ld-fallen { display: inline; }
.live-demo-inline .ld-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; transition: opacity 0.4s ease; }
.live-demo-inline .ld-progress i { display: block; width: 0; height: 100%; background: var(--ld-accent); transition: width 0.4s ease; }
.live-demo-inline.is-live .ld-progress { opacity: 0; }

/* phones: a portrait panel, overlays stacked along the bottom */
@media (max-width: 720px) {
  .live-demo-inline .ld-panel { aspect-ratio: 3 / 4; }
  .live-demo-inline.ld-tall .ld-panel { aspect-ratio: 9 / 16; }      /* a standing humanoid + controls */
  .live-demo-inline .ld-head { left: 14px; right: 14px; }
  .live-demo-inline .ld-controls { left: 14px; right: 14px; bottom: 40px; row-gap: 10px; }
  .live-demo-inline .ld-speed { margin-left: 0; }
  .live-demo-inline .ld-time { left: 14px; right: auto; bottom: 14px; }
  .live-demo-inline .ld-gauges { left: 14px; right: 14px; bottom: 14px; }
  .live-demo-inline .ld-gauge { grid-template-columns: 44px 1fr 50px; }
  .live-demo-inline .ld-presets { left: 14px; right: 14px; bottom: 124px; max-width: none; }
  .live-demo-inline .chip { padding: 6px 12px; }
}
