/* Long-horizon context replay: a clip strip that moves under its planners, and the segment walk. */
.replay[data-slug="consistency"] .replay-stage { container-type: inline-size; }
/* The strip's visible window in display units: all eight clips, or c15 to c20 on narrow stages. */
.cs { --w0: 0; --span: 83; display: grid; gap: 14px 16px; grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: "head head" "tl glob" "plan log"; }
.cs-still, .cs-still * { transition: none !important; }
.cs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cs li.is-off, .cs-segs li[data-st="off"] { visibility: hidden; }
.cs .t-ok { color: var(--rp-ok); }
.cs .t-warn, .cs-segs li[data-st="pend"] { color: var(--rp-warn); }
.cs .t-bad { color: var(--rp-bad); }
.cs .t-muted { color: var(--muted, #a9b1c2); }

.cs-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; color: var(--muted, #a9b1c2); }
.cs-note { margin-left: auto; }
.cs-key { display: inline-flex; align-items: center; gap: 7px; }
.cs-key i { width: 14px; height: 14px; border: 1px dashed rgba(var(--brass-rgb),.8); border-width: 0 1px; background: rgba(var(--brass-rgb),.12); }

/* Ruler, seams and clip strip */
.cs-tl { grid-area: tl; min-width: 0; align-self: center; }
.cs-lanes { position: relative; }
.cs-ruler { position: relative; height: 30px; margin-bottom: 10px; }
.cs-strip { position: relative; height: 50px; border-radius: 6px; background: rgba(var(--cream-rgb),.035); clip-path: inset(-12px 0); }
.cs-band, .cs-clip {
  --l: clamp(0%, (var(--x) - var(--w0)) / var(--span) * 100%, 100%);
  --r: clamp(0%, (var(--x) + var(--w) - var(--w0)) / var(--span) * 100%, 100%);
  position: absolute; top: 0; bottom: 0; left: calc(var(--l) + 1px); width: max(0px, calc(var(--r) - var(--l) - 2px));
}
.cs-seam, .cs-pin, .cs-mark { left: calc((var(--x) - var(--w0)) / var(--span) * 100%); }
.cs-band, .cs-clip { border-radius: 6px; transition: left .9s var(--rp-ease), width .9s var(--rp-ease), opacity .45s, border-color .4s, background .4s, color .4s; }
.cs-band { border: 1px solid rgba(var(--cream-rgb),.12); background: rgba(var(--cream-rgb),.03); color: var(--muted, #a9b1c2); font-size: 12px; line-height: 28px; padding-left: 15px; white-space: nowrap; }
.cs-band.is-active { border-color: var(--brass, #e9b46c); background: rgba(var(--brass-rgb),.13); color: var(--cream, #f1ebe0); }
.cs-band.is-done { color: var(--rp-ok); }
.cs-band.is-snap { border-style: dashed; border-color: rgba(250,194,81,.55); }
.cs-band.is-bad { border-color: var(--rp-bad); background: rgba(227,154,134,.1); color: var(--rp-bad); }
.cs-seam { position: absolute; top: -4px; bottom: -9px; width: 20px; margin-left: -10px; border: 1px dashed rgba(var(--brass-rgb),.4); border-width: 0 1px; background: rgba(var(--brass-rgb),.05); pointer-events: none; transition: left .9s var(--rp-ease), border-color .4s, background .4s; }
.cs-seam.is-on { border-color: var(--brass, #e9b46c); background: rgba(var(--brass-rgb),.16); }
.cs-clip { display: grid; align-content: center; gap: 2px; padding: 0 6px; background: var(--rp-sunk, #0b0f1a); border: 1px solid rgba(var(--cream-rgb),.16); }
.cs-id { font-size: 13px; line-height: 1.15; color: var(--cream, #f1ebe0); }
.cs-t { font-size: 12px; line-height: 1.15; color: var(--muted, #a9b1c2); font-variant-numeric: tabular-nums; }
.cs-clip.is-off { opacity: 0; }
.cs-clip.is-new { border-color: var(--brass, #e9b46c); background: rgba(var(--brass-rgb),.12); }
.cs-clip.is-in { box-shadow: inset 0 3px 0 var(--brass, #e9b46c); }
.cs-clip.is-hit { border-color: var(--rp-bad); background: rgba(227,154,134,.16); }
.cs-clip.cs-cut { padding: 0; border-color: var(--rp-bad); background: repeating-linear-gradient(135deg, rgba(227,154,134,.65) 0 3px, transparent 3px 7px); }
.cs-pin { position: absolute; top: -9px; bottom: -9px; width: 2px; margin-left: -1px; border-radius: 1px; background: currentColor; opacity: 0; transition: opacity .3s, color .3s; }
.cs-pin::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cs-pin.is-on { opacity: 1; }
.cs-sweep { position: absolute; inset: -6px 0; pointer-events: none; opacity: 0; border-radius: 6px; background: linear-gradient(90deg, transparent, rgba(var(--brass-rgb),.32), transparent) no-repeat; background-size: 28% 100%; }
.cs-sweep.is-on { animation: cs-sweep 1.2s var(--rp-ease) both; }
@keyframes cs-sweep { 0% { opacity: 1; background-position: -30% 0; } 85% { opacity: 1; } 100% { opacity: 0; background-position: 130% 0; } }
.cs-marks { position: relative; height: 18px; margin-top: 14px; }
.cs-mark { position: absolute; top: 0; font-size: 12px; line-height: 18px; white-space: nowrap; opacity: 0; transition: opacity .3s, left .9s var(--rp-ease); }
.cs-mark.r { transform: translateX(-100%); }
.cs-mark.is-on { opacity: 1; }

/* Global choices, planner call, receipt */
.cs-glob { grid-area: glob; display: grid; gap: 8px; align-content: start; align-self: center; }
.cs-glob .rp-label { margin: 0; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-chip { font-size: 12px; line-height: 1.4; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(var(--brass-rgb),.55); background: rgba(var(--brass-rgb),.08); color: var(--cream, #f1ebe0); transition: border-color .3s, color .3s, background .3s; }
.cs-chip.is-warn { border-color: var(--rp-warn); color: var(--rp-warn); background: rgba(250,194,81,.1); }
.cs-foot { font-size: 12px; line-height: 1.5; min-height: 1.5em; color: var(--muted, #a9b1c2); }
.cs-plan { grid-area: plan; }
.cs-log { grid-area: log; }
.cs-reads { color: #e0d8c9; line-height: 1.5; min-height: 1.5em; margin-bottom: 10px; overflow-wrap: anywhere; }
.cs-ops li { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 26px; font-size: 13px; }
.cs-ops li.is-struck > span:first-child { text-decoration: line-through; color: var(--muted, #a9b1c2); }
.cs-log ul { gap: 4px; }
.cs-log li { font-size: 12px; line-height: 1.5; min-height: 18px; }

/* Mode 3: the segment walk */
.cs-b { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "track" "segs"; }
.cs-key .cs-dot { width: 10px; height: 10px; border: 1.5px solid var(--cream, #f1ebe0); border-radius: 50%; background: none; }
.cs-track { grid-area: track; position: relative; height: 158px; }
.cs-win { position: absolute; top: 18px; height: 62px; border: 1px dashed rgba(var(--brass-rgb),.75); border-radius: 4px; background: rgba(var(--brass-rgb),.08); transition: left .9s var(--rp-ease), opacity .4s; }
.cs-win > span { position: absolute; top: calc(100% + 4px); font-size: 12px; line-height: 16px; color: var(--brass, #e9b46c); white-space: nowrap; }
.cs-win > span:first-child { left: -1px; }
.cs-win > span:last-child { right: -1px; }
.cs-tgt { position: absolute; top: 18px; height: 62px; border-left: 1px dashed var(--brass, #e9b46c); transition: left .9s var(--rp-ease), opacity .4s; }
.cs-tgt > span { position: absolute; top: -18px; left: 0; transform: translateX(-50%); font-size: 12px; line-height: 16px; color: var(--brass, #e9b46c); white-space: nowrap; }
.cs-track [data-st="off"] { opacity: 0; }
.cs-axis { position: absolute; left: 0; right: 0; top: 68px; height: 1px; background: rgba(var(--cream-rgb),.3); }
.cs-cand { position: absolute; top: 0; width: 0; height: 80px; transition: opacity .4s; }
.cs-cand i { position: absolute; top: 63px; left: -5px; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--muted, #a9b1c2); background: var(--rp-panel, #101522); transition: border-color .3s, background .3s; }
.cs-cand b { position: absolute; top: 22px; left: 0; transform: translateX(-50%); font-weight: 400; font-size: 12px; line-height: 16px; color: var(--muted, #a9b1c2); white-space: nowrap; }
.cs-cand b.r { transform: translateX(calc(-100% + 5px)); }
.cs-cand.row1 b { top: 42px; }
.cs-cand::before { content: ""; position: absolute; left: 0; top: 38px; height: 25px; border-left: 1px solid rgba(var(--cream-rgb),.22); }
.cs-cand.row1::before { top: 58px; height: 5px; }
.cs-cand[data-st="in"] i { border-color: var(--brass, #e9b46c); }
.cs-cand[data-st="in"] b { color: var(--brass, #e9b46c); }
.cs-cand[data-st="pick"] i { border-color: var(--rp-ok); background: var(--rp-ok); }
.cs-cand[data-st="pick"] b { color: var(--rp-ok); }
.cs-cand[data-st="out"] { opacity: .42; }
.cs-bar, .cs-ghost { position: absolute; text-align: center; font-size: 12px; white-space: nowrap; border-radius: 4px; transition: opacity .4s, border-color .3s, background .3s; }
.cs-bar { top: 106px; height: 24px; line-height: 22px; border: 1px solid rgba(var(--brass-rgb),.55); background: rgba(var(--brass-rgb),.16); color: var(--cream, #f1ebe0); }
.cs-bar + .cs-bar { border-left-width: 0; }
.cs-bar.b1 { border-color: rgba(250,194,81,.75); background: rgba(250,194,81,.14); }
.cs-bar.b2 { border-color: rgba(156,200,164,.7); background: rgba(156,200,164,.14); }
.cs-bar[data-st="pend"] { border: 1px dashed var(--rp-warn); background: none; color: var(--rp-warn); }
.cs-ghost { top: 136px; height: 20px; line-height: 18px; border: 1px dashed var(--rp-bad); color: var(--rp-bad); background: rgba(227,154,134,.07); }
.cs-segs { grid-area: segs; }
.cs-segs ul { grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; gap: 4px 28px; }
.cs-segs li { font-size: 12px; line-height: 1.5; color: var(--cream, #f1ebe0); font-variant-numeric: tabular-nums; }

/* Narrow stages: one column and shorter labels; under 420px the strip shows c15 to c20. */
@container (max-width: 599px) {
  .cs { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "tl" "glob" "plan" "log"; gap: 12px; }
  .cs-b { grid-template-areas: "head" "track" "segs"; }
  .cs-long { display: none; }
  .cs-note { margin-left: 0; }
  .cs-glob { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
  .cs-chips { order: 3; flex-basis: 100%; }
  .cs-segs ul { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 420px) {
  .cs { --w0: 9; --span: 65; }
  .cs-c14 { display: none; }
  .cs-c21 > span { display: none; }
  .cs-clip { padding: 0 4px; }
  .cs-id { font-size: 12px; }
  .cs-seam { width: 18px; margin-left: -9px; }
  .cs-band { padding-left: 12px; }
  .cs-ops li { font-size: 12px; gap: 6px; }
  .cs-chips { gap: 5px; }
  .cs-chip { padding: 2px 7px; }
}
@container (max-width: 270px) {
  .cs-reads { min-height: 3em; }
}
