/* Object generalization: 3D replays of the chair policy pushing each object, and Fig. 5 */
.shelf {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  align-items: start;
  gap: 24px;
}
.shelf__main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.shelf__main > * { grid-area: auto; }

.shelf__stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: radial-gradient(ellipse at 50% 30%, #1b1d22, #070809 70%);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  cursor: grab;
}
.shelf__stage:active { cursor: grabbing; }
.shelf__stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; outline: none; transition: opacity .4s; }
.shelf__stage[data-state="loading"] canvas { opacity: .35; }
.shelf__stage[data-state="unavailable"] canvas { opacity: 0; }

.shelf__loading {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: rgba(22, 24, 28, .92); font-size: 14px; color: var(--ink-2); pointer-events: none; white-space: nowrap;
}
.shelf__stage[data-state="unavailable"] .spinner { display: none; }
.shelf__stage[data-state="ready"] .shelf__loading { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }

.shelf__chip {
  position: absolute; left: 14px; top: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: 999px; background: rgba(10, 11, 13, .75); font: 500 12px/1 var(--mono); letter-spacing: .03em;
  color: var(--ink-2); pointer-events: none; font-variant-numeric: tabular-nums; transition: color .3s, background .3s;
}
.shelf__chip:empty { display: none; }
.shelf__chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--spot); }
.shelf__chip.is-ok { color: var(--goal-ink); background: rgba(14, 32, 22, .82); }
.shelf__chip.is-ok::before { background: var(--goal); }
.shelf__stage:not(.is-live) .shelf__chip { display: none; }

.shelf__stage .drag-hint { right: 14px; top: 14px; }
.shelf__stage:not(.is-live) .drag-hint, .shelf__stage.was-dragged .drag-hint { opacity: 0; }

.shelf__label { position: absolute; inset: auto 18px 16px; display: grid; gap: 2px; color: var(--ink); pointer-events: none; text-shadow: 0 1px 12px #000; }
.shelf__label b { font: 400 1.6rem/1.05 var(--serif); }
.shelf__label span { color: var(--ink-2); font-size: .82rem; }
.shelf__label span:empty { display: none; }

.shelf__transport { gap: 12px; }
.shelf__transport .scrub { padding-top: 0; }
.shelf__starts { display: flex; align-items: center; gap: 8px; flex: none; }
.shelf__starts-k { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.shelf__starts .seg { flex: none; }
.shelf__starts .seg button { min-width: 48px; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.shelf__starts[hidden] { display: none; }
.shelf__chip.is-static::before { background: var(--ink-3); }
.transport button:disabled, .transport input:disabled { opacity: .45; cursor: default; }
.shelf__detail { margin: 0 4px; min-height: 1.5em; font-size: 14.5px; color: var(--ink-2); }

.shelf__side { min-width: 0; }
.shelf__list { display: grid; align-items: start; gap: 7px; }
.shelf__group-label { color: var(--ink-2); font: 550 .81rem/1.3 var(--sans); }
.shelf__group-label:not(:first-child) { margin-top: 6px; }
.shelf__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.shelf__options button {
  min-height: 36px; padding: 6px 9px; text-align: left; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink-2); font-size: .81rem; line-height: 1.35; cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.shelf__options button:hover { border-color: var(--line-2); color: var(--ink); }
.shelf__options button[aria-checked="true"] { border-color: color-mix(in srgb, var(--goal) 40%, transparent); background: var(--goal-wash); color: var(--goal-ink); }

.shelf__bars { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.shelf__bars h3 { color: var(--ink); font: 600 .94rem/1.3 var(--sans); }
.shelf__bars p { margin: 5px 0 12px; color: var(--ink-2); font-size: .78rem; line-height: 1.5; }
.shelf__bars .hbars { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.shelf__bars .hbar { display: grid; grid-template-columns: minmax(122px, .9fr) minmax(50px, 1fr) 48px; align-items: center; gap: 8px; font-size: .77rem; }
.shelf__bars .hbar__name { color: var(--ink-2); }
.shelf__bars .hbar__track { position: relative; height: 6px; border-radius: 5px; background: var(--surface-2); }
.shelf__bars .hbar__fill { position: absolute; inset: 0 auto 0 0; width: var(--v); border-radius: 5px; background: #578c70; }
.shelf__bars .hbar__val { text-align: right; font: 600 .76rem var(--mono); }
.shelf__bars .hbar.is-selected .hbar__name { color: var(--ink); }
.shelf__bars .hbar.is-selected .hbar__fill { background: var(--goal); }
.shelf__interval { position: absolute; inset: 0 auto 0 var(--lo); width: calc(var(--hi) - var(--lo)); border-inline: 1px solid var(--ink); }
.shelf__interval::before { position: absolute; top: 50%; width: 100%; height: 1px; background: var(--ink); content: ""; }

@media (max-width: 900px) {
  .shelf { grid-template-columns: minmax(0, 1fr); }
  .shelf__stage { aspect-ratio: 4 / 3; }
}
@media (max-width: 560px) {
  .shelf__transport { flex-wrap: wrap; gap: 8px 10px; border-radius: 22px; }
  .shelf__transport .scrub { flex: 1 1 0; min-width: 90px; }
  .shelf__transport .transport__restart { display: none; }
  .shelf__starts { width: 100%; justify-content: space-between; padding: 0 4px 2px; }
  .shelf__label b { font-size: 1.3rem; }
}
@media (pointer: coarse) { .shelf__options button { min-height: 44px; } }
@media (max-width: 400px) { .shelf__bars .hbar { grid-template-columns: 109px minmax(34px, 1fr) 43px; } }
