/* BB Lab Replay: "See it in action" solution demos (js/bb-lab-replay.js, 2026-11-19).
   Colors come from the theme tokens, so Cyber, Neon, Reserve, Americana and Old Glory all follow automatically.
   The demo cursor and highlight ring move with live coordinates, so JS sets only --bb-replay-* custom properties. */

/* ---------- debrief buttons ---------- */
.bb-answer-key .bb-replay-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px 10px; margin:8px 0 6px; }
.bb-answer-key .bb-replay-label { font:700 13px var(--font-code, monospace); letter-spacing:.06em; text-transform:uppercase; opacity:.85; }
.bb-answer-key .bb-replay-btn.bb-action { min-height:36px !important; padding:6px 14px; gap:6px; font-size:15px;
  background: var(--theme-surface); color: var(--theme-ink) !important; border:1px solid var(--theme-primary); }
.bb-answer-key .bb-replay-btn.bb-action:hover, .bb-answer-key .bb-replay-btn.bb-action:focus-visible { background: var(--theme-primary); color: var(--theme-on-primary) !important; }
.bb-answer-key .bb-replay-btn:focus-visible { outline:3px solid var(--theme-focus); outline-offset:2px; }
.bb-answer-key .bb-replay-play { font-size:.8em; }
.bb-answer-key .bb-replay-all { margin:6px 0 16px; padding:12px 14px; border:1px dashed var(--theme-primary); border-radius:10px; }
.bb-answer-key .bb-replay-all-head { margin:0; font-weight:800; }
.bb-answer-key .bb-replay-all-note { margin:2px 0 8px; opacity:.85; }
.bb-answer-key .bb-replay-row { display:flex; flex-wrap:wrap; gap:8px 10px; }

/* ---------- while a demo plays ---------- */
html.bb-replay-on .bb-lab { outline:3px dashed var(--theme-primary); outline-offset:3px; }
.bb-replay-shield { position:fixed; inset:0; z-index:2147483050; background:transparent; cursor:not-allowed; }

.bb-replay-bar { position:fixed; top:0; left:0; right:0; z-index:2147483100; box-sizing:border-box;
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px 16px;
  padding:10px 16px; background: var(--theme-surface); color: var(--theme-ink);
  border-bottom:3px solid var(--theme-primary); box-shadow:0 6px 18px rgba(0,0,0,.35); font-family: var(--theme-font-body, sans-serif); }
.bb-replay-badge { padding:6px 10px; border-radius:6px; background: var(--theme-primary); color: var(--theme-on-primary);
  font:800 15px/1 var(--font-code, monospace); letter-spacing:.12em; }
.bb-replay-text { min-width:0; }
.bb-replay-task { margin:0; font-size:13px; font-weight:700; color: var(--theme-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bb-replay-caption { margin:2px 0 6px; font-size:17px; line-height:1.35; font-weight:600; }
.bb-replay-progress { display:block; width:100%; height:4px; border:0; border-radius:2px; background: var(--theme-inset); accent-color: var(--theme-primary); }
.bb-replay-progress::-webkit-progress-bar { background: var(--theme-inset); border-radius:2px; }
.bb-replay-progress::-webkit-progress-value { background: var(--theme-primary); border-radius:2px; }
.bb-replay-progress::-moz-progress-bar { background: var(--theme-primary); }
.bb-replay-controls { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.bb-replay-ctl.bb-action { min-height:38px !important; padding:6px 14px; font-size:15px; background: var(--theme-surface); color: var(--theme-ink) !important; border:1px solid var(--theme-border); }
.bb-replay-ctl.bb-action.bb-action--primary { background: var(--theme-primary); color: var(--theme-on-primary) !important; border-color: var(--theme-primary); }
.bb-replay-ctl.bb-action:disabled { opacity:.45; cursor:default; transform:none; }
.bb-replay-ctl:focus-visible { outline:3px solid var(--theme-focus); outline-offset:2px; }
.bb-replay-ctl[hidden] { display:none !important; }

/* The demo cursor: a plain arrow that reads on any lab screen, light or dark. */
.bb-replay-cursor { position:fixed; left:0; top:0; z-index:2147483120; width:28px; height:28px; pointer-events:none;
  transform:translate(var(--bb-replay-x, 50vw), var(--bb-replay-y, 50vh)); transition:transform .62s cubic-bezier(.3,.7,.2,1);
  filter:drop-shadow(0 2px 3px rgba(0,0,0,.55)); }
.bb-replay-cursor svg { display:block; width:100%; height:100%; transform-origin:4px 3px; transition:transform .12s; }
.bb-replay-cursor path { fill:#fff; stroke:#111; stroke-width:1.6; stroke-linejoin:round; }
.bb-replay-cursor.is-press svg { transform:scale(.8); }
.bb-replay-cursor.is-jump { transition:none; }
html.bb-replay-ended .bb-replay-cursor { opacity:.0; transition:opacity .3s; }

.bb-replay-ring { position:fixed; left:0; top:0; z-index:2147483080; pointer-events:none; box-sizing:border-box;
  width:var(--bb-replay-rw, 0); height:var(--bb-replay-rh, 0); transform:translate(var(--bb-replay-rx, 0), var(--bb-replay-ry, 0));
  border:3px solid var(--theme-focus); border-radius:8px; box-shadow:0 0 0 3px rgba(0,0,0,.4), 0 0 18px var(--theme-focus);
  opacity:0; transition:opacity .2s; }
.bb-replay-ring.is-on { opacity:1; animation:bb-replay-pulse 1.4s ease-in-out infinite; }
@keyframes bb-replay-pulse { 50% { box-shadow:0 0 0 3px rgba(0,0,0,.4), 0 0 4px var(--theme-focus); } }

/* The "why" popup beside the step (11/21). JS picks the side that covers the least and sets only --bb-replay-t*. */
.bb-replay-tip { position:fixed; left:0; top:0; z-index:2147483110; box-sizing:border-box; width:max-content; max-width:min(340px, calc(100vw - 16px));
  padding:10px 14px; border-radius:10px; background: var(--theme-surface); color: var(--theme-ink);
  border:2px solid var(--theme-focus); box-shadow:0 8px 22px rgba(0,0,0,.45);
  font:600 15px/1.4 var(--theme-font-body, sans-serif); pointer-events:none;
  transform:translate(var(--bb-replay-tx, -9999px), var(--bb-replay-ty, -9999px)); opacity:0; visibility:hidden; transition:opacity .2s; }
.bb-replay-tip.is-on { opacity:1; visibility:visible; }
.bb-replay-tip::before { content:''; position:absolute; width:12px; height:12px; background: var(--theme-surface);
  border:2px solid var(--theme-focus); border-width:0 0 2px 2px; }
.bb-replay-tip[data-side="right"]::before { left:-8px; top:calc(var(--bb-replay-ta, 20px) - 6px); transform:rotate(45deg); }
.bb-replay-tip[data-side="left"]::before { right:-8px; top:calc(var(--bb-replay-ta, 20px) - 6px); transform:rotate(-135deg); }
.bb-replay-tip[data-side="below"]::before { top:-8px; left:calc(var(--bb-replay-ta, 20px) - 6px); transform:rotate(135deg); }
.bb-replay-tip[data-side="above"]::before { bottom:-8px; left:calc(var(--bb-replay-ta, 20px) - 6px); transform:rotate(-45deg); }
html.bb-replay-ended .bb-replay-tip { opacity:0; }

/* Reduced motion: the cursor jumps (no gliding), the ring holds still, and the demo waits longer per step (JS). */
@media (prefers-reduced-motion: reduce) {
  .bb-replay-cursor, .bb-replay-cursor svg, .bb-replay-ring { transition:none; }
  .bb-replay-ring.is-on { animation:none; }
}
html.bb-replay-reduced .bb-replay-cursor, html.bb-replay-reduced .bb-replay-ring { transition:none; animation:none; }

@media (max-width: 760px) {
  .bb-replay-bar { grid-template-columns:auto minmax(0,1fr); padding:8px 12px; gap:6px 10px; }
  .bb-replay-controls { grid-column:1 / -1; justify-content:stretch; gap:6px; }
  .bb-replay-ctl.bb-action { flex:1 1 0; min-width:0; padding:6px 8px; font-size:14px; min-height:36px !important; }
  .bb-replay-caption { font-size:15px; }
  .bb-replay-badge { font-size:13px; }
  .bb-replay-cursor { width:24px; height:24px; }
}

/* ---------- frame mode (2026-11-20): the demo plays in a full-screen fresh copy of the same page ---------- */
.bb-replay-frame { position:fixed; inset:0; z-index:2147483000; width:100%; height:100%; border:0; margin:0; padding:0;
  background: var(--theme-page, var(--theme-surface)); }
/* Inside the copy its Mission Brief never shows (the copy also gets html.bb-replay-on, so the .bb-lab outline above applies). */
html.bb-replay-framed .bb-mission-overlay.bb-mission--brief { display:none !important; }

/* Mission v2: the whole-solution box sits above "Show the solution" and stays locked until it is open (Brett 11/21). */
.bb-replay-all.is-locked .bb-replay-row { opacity: .45; filter: grayscale(.6); }
.bb-replay-all.is-locked .bb-replay-btn { cursor: not-allowed; }
.bb-replay-lock { margin: 6px 0 0; font-size: 15px; opacity: .85; }
.bb-replay-lock::before { content: '\1F512\00a0'; }
.bb-mission-section > .bb-replay-all { margin:6px 0 16px; padding:12px 14px; border:1px dashed var(--theme-primary); border-radius:10px; }
.bb-mission-section > .bb-replay-all .bb-replay-all-head { margin:0; font-weight:800; }
.bb-mission-section > .bb-replay-all .bb-replay-all-note { margin:2px 0 8px; opacity:.85; }
