/* ---------- playground: one-factor-at-a-time interactive demo cards (OmniRetarget-style) ---------- */
.playground { --pg-accent: #6b4fa0; --pg-accent-dark: #563e84; --pg-accent-soft: #efeaf7; max-width: 1340px; margin: 0 auto; }
.pg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem; }
.pg-card { background: #fff; border-radius: 16px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.09); padding: 1.4rem 1.4rem 1.5rem; min-width: 0; }
.pg-head { text-align: center; margin-bottom: 1rem; }
.pg-title { font-size: 1.45rem; font-weight: 700; color: var(--text, #363636); margin: 0; line-height: 1.3; }
.pg-title i { color: var(--pg-accent); margin-right: 0.3rem; }
.pg-sub { font-style: italic; color: #7a7a7a; font-size: 0.95rem; margin: 0.3rem 0 0; min-height: 1.4em; }

/* selector panel */
.pg-panel { background: #f4f5f7; border-radius: 12px; padding: 0.95rem 1rem 0.7rem; }
.pg-panel-title { font-weight: 600; color: var(--text, #363636); font-size: 0.95rem; margin-bottom: 0.75rem; }
.pg-panel-title i { color: var(--pg-accent); margin-right: 0.2rem; }
.pg-tiles { display: grid; gap: 0.7rem; }
.pg-tile { font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.3rem;
  min-height: 6.4rem; padding: 0.7rem 0.4rem 0.6rem; border: 0; border-radius: 10px; background: #fff; color: var(--text, #363636);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); cursor: pointer; transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s; min-width: 0; }
.pg-tile i { color: var(--pg-accent); transition: color 0.15s; }
.pg-tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12); }
.pg-tile:focus-visible, .pg-launch:focus-visible, .pg-full:focus-visible { outline: 3px solid rgba(107, 79, 160, 0.45); outline-offset: 2px; }
.pg-tile-label { font-weight: 700; font-size: 1rem; line-height: 1.15; }
.pg-tile-sub { font-family: var(--mono, monospace); font-size: 0.7rem; color: #888; line-height: 1.2; text-align: center; }
.pg-tile.is-selected { background: var(--pg-accent); color: #fff; box-shadow: 0 4px 12px rgba(107, 79, 160, 0.35); }
.pg-tile.is-selected i, .pg-tile.is-selected .pg-tile-sub { color: #fff; }
.pg-tile.is-selected .pg-tile-sub { opacity: 0.85; }
.pg-tile:disabled { opacity: 0.45; cursor: not-allowed; }
.pg-fixed { font-family: var(--mono, monospace); font-size: 0.72rem; color: #8a8a8a; text-align: center; margin: 0.65rem 0 0; line-height: 1.4; }

/* offset slider */
.pg-slider { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); padding: 0.8rem 1rem 0.55rem; }
.pg-slider-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; }
.pg-slider-cap { font-size: 0.85rem; color: #777; }
.pg-readout { font-family: var(--mono, monospace); font-weight: 600; font-size: 1.35rem; color: #fff; background: var(--pg-accent); border-radius: 8px; padding: 0.05rem 0.6rem; }
.pg-slider-row { display: flex; align-items: center; gap: 0.7rem; }
.pg-slider-end { color: var(--pg-accent); opacity: 0.8; }
.pg-slider input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; cursor: pointer; margin: 0.6rem 0;
  background: linear-gradient(to right, var(--pg-accent) 0, var(--pg-accent) var(--pct, 0%), #dcdde2 var(--pct, 0%), #dcdde2 100%); }
.pg-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--pg-accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.pg-slider input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--pg-accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.pg-slider input[type=range]::-moz-range-track { background: transparent; }
.pg-ticks { display: flex; justify-content: space-between; margin: 0 calc(1.7rem + 1px) 0 calc(1.7rem + 3px); font-family: var(--mono, monospace); font-size: 0.68rem; color: #999; }
.pg-tick { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.pg-tick.minor::before { content: ''; width: 1px; height: 5px; background: #ccc; margin-top: 2px; }

/* buttons */
.pg-buttons { display: flex; gap: 0.7rem; margin: 1rem 0; }
.pg-launch, .pg-full { font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer; padding: 0.7rem 1rem; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.pg-launch { flex: 1; background: var(--pg-accent); color: #fff; border: 0; font-size: 1.02rem; box-shadow: 0 3px 10px rgba(107, 79, 160, 0.3); }
.pg-launch:hover:not(:disabled) { background: var(--pg-accent-dark); }
.pg-launch:disabled { background: #b9b3c4; box-shadow: none; cursor: not-allowed; }
.pg-launch i, .pg-full i { margin-right: 0.35rem; }
.pg-full { flex: 0 0 auto; background: #fff; color: var(--pg-accent); border: 2px solid var(--pg-accent); font-size: 0.92rem; }
.pg-full:hover { background: var(--pg-accent-soft); }

/* viewer */
.pg-viewer { position: relative; width: 100%; aspect-ratio: 16 / 10; border: 2px solid var(--pg-accent); border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, #fbfbfc 0%, #eceef1 55%, #dfe1e5 100%); }
.pg-viewer:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border: 0; border-radius: 0; }
.pg-viewer:-webkit-full-screen { aspect-ratio: auto; width: 100vw; height: 100vh; border: 0; border-radius: 0; }
.pg-canvas { position: absolute; inset: 0; cursor: grab; }
.pg-canvas:active { cursor: grabbing; }
.pg-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.pg-shot { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pg-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono, monospace); font-size: 0.85rem; color: #888; pointer-events: none; }
.pg-msg[hidden] { display: none; }
.pg-hud { position: absolute; display: flex; gap: 0.4rem; align-items: center; pointer-events: none; }
.pg-hud > * { pointer-events: auto; }
/* robot-camera inset (top-left): GL pixels are composited by playground.js at the same rect; this is the frame + label */
.pg-ego { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22); pointer-events: none; }
.pg-ego[hidden] { display: none; }
.pg-ego-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 0.3rem;
  box-sizing: border-box; padding: 2px 0.3rem 0; background: rgba(36, 38, 44, 0.9); color: #fff; font-family: var(--mono, monospace); font-size: 0.66rem;
  white-space: nowrap; overflow: hidden; pointer-events: auto; cursor: help; border-radius: 0 0 6px 6px; }
.pg-ego-bar i { font-size: 0.85em; opacity: 0.85; }
.pg-ego-bar b { font-weight: 600; }
.pg-ego-note { opacity: 0.7; }
.pg-hud-tr { top: 0.55rem; right: 0.6rem; }
.pg-hud-bl { bottom: 0.55rem; left: 0.7rem; right: 7rem; }
.pg-hud-br { bottom: 0.55rem; right: 0.7rem; }
.pg-badge { font-family: var(--mono, monospace); font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: 999px; background: #e3f1e5; color: #22693a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); opacity: 0; transform: translateY(-4px); transition: opacity 0.25s, transform 0.25s; }
.pg-badge.is-on { opacity: 1; transform: none; }
.pg-badge.is-on::before { content: '\2713\00a0'; }
.pg-caption, .pg-time { font-family: var(--mono, monospace); font-size: 0.72rem; color: #555; background: rgba(255, 255, 255, 0.8); border-radius: 6px; padding: 0.12rem 0.45rem; }
.pg-caption:empty, .pg-time:empty { display: none; }
.pg-seg { display: inline-flex; }
.pg-hud-tr button { font: inherit; font-size: 0.75rem; border: 1px solid #cfd0d5; background: rgba(255, 255, 255, 0.9); color: #444; padding: 0.15rem 0.5rem; cursor: pointer; border-radius: 6px; line-height: 1.5; }
.pg-seg button { border-radius: 0; margin-left: -1px; }
.pg-seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.pg-seg button:last-child { border-radius: 0 6px 6px 0; }
.pg-hud-tr button.is-on { background: var(--pg-accent); border-color: var(--pg-accent); color: #fff; }
/* play button in the empty sky right of the robot-camera inset (the centre holds the thrower in the default framings) */
.pg-overlay-play { position: absolute; left: 70%; top: 36%; width: 4.2rem; height: 4.2rem; margin: -2.1rem 0 0 -2.1rem; border-radius: 50%; border: 0;
  background: rgba(107, 79, 160, 0.88); color: #fff; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); transition: transform 0.15s, opacity 0.2s; }
.pg-overlay-play i { margin-left: 0.2rem; }
.pg-overlay-play:hover { transform: scale(1.06); }
.pg-viewer.is-started .pg-overlay-play { opacity: 0; pointer-events: none; }
.pg-hint { text-align: center; font-family: var(--mono, monospace); font-size: 0.75rem; color: #999; margin-top: 1.1rem; }
.pg-error { text-align: center; color: #9b2c22; }

@media screen and (max-width: 1100px) {
  .pg-grid { grid-template-columns: 1fr; max-width: 820px; margin: 0 auto; }
}
@media screen and (max-width: 600px) {
  .pg-card { padding: 1rem 0.75rem 1.1rem; border-radius: 12px; }
  .pg-panel { padding: 0.75rem 0.6rem 0.6rem; }
  .pg-tiles { gap: 0.4rem; }
  .pg-tile { min-height: 5.4rem; padding: 0.55rem 0.2rem 0.5rem; }
  .pg-tile-label { font-size: 0.88rem; }
  .pg-tile-sub { font-size: 0.6rem; }
  .pg-title { font-size: 1.2rem; }
  .pg-viewer { aspect-ratio: 4 / 3; }
  .pg-hud-bl { right: 0.7rem; bottom: 2.1rem; }
}
/* narrow viewers (< 440 px, class set by playground.js): phones and the 1100-1215 px two-column desktop */
.pg-viewer.is-narrow .pg-overlay-play { left: 72%; top: 34%; width: 3.4rem; height: 3.4rem; margin: -1.7rem 0 0 -1.7rem; font-size: 1.25rem; }
.pg-viewer.is-narrow .pg-hud-br { bottom: 0.3rem; right: 0.4rem; }   /* keep the time pill off the robot's feet */
.pg-viewer.is-narrow .pg-time { font-size: 0.66rem; }
.pg-viewer.is-narrow .pg-ego-bar { font-size: 0.5rem; gap: 0.25rem; padding: 1px 0.15rem 0; letter-spacing: -0.01em; }
.pg-noanim * { transition: none !important; }
.pg-caption:empty { display: none; }
