/* ===== Interactive benchmark replay ===== */
.benchmark-replay {
  --replay-blue: #3d67c6;
  --replay-blue-soft: #edf3ff;
  --replay-coral: #b85f58;
  --replay-coral-soft: #fff1ef;
  --replay-green: #357a5e;
  --replay-green-soft: #eaf6f0;
  --replay-purple: #78618f;
  --replay-purple-soft: #f3eef7;
  --replay-teal: #24766f;
  --replay-teal-soft: #e8f6f4;
  --replay-amber: #936326;
  --replay-amber-soft: #fbf4e7;
  margin: 3.4rem 0 .4rem;
  scroll-margin-top: 5rem;
}

.replay-heading {
  max-width: 720px;
  margin: 0 auto 1.25rem;
  text-align: center;
}

.replay-heading h3 {
  margin: .25rem 0 .35rem;
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.25;
}

.replay-heading > p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: .96rem;
  line-height: 1.55;
}

.replay-kicker {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  color: var(--replay-purple);
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
}

.replay-kicker span {
  width: .48rem;
  height: .48rem;
  border-radius: 50%;
  background: #36a16c;
  box-shadow: 0 0 0 4px rgba(54, 161, 108, .12);
  animation: replay-live-pulse 2.2s ease-out infinite;
}

.replay-console {
  overflow: hidden;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 39, 51, .1);
}

.replay-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #f6f8fb;
  border-bottom: 1px solid #dce2eb;
}

.replay-tab {
  position: relative;
  min-width: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: .65rem;
  border: 0;
  border-right: 1px solid #dce2eb;
  border-bottom: 3px solid transparent;
  padding: .72rem .85rem .62rem;
  background: transparent;
  color: #667085;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.replay-tab:last-child {
  border-right: 0;
}

.replay-tab:hover {
  background: #fff;
  color: var(--ink);
}

.replay-tab:focus-visible {
  z-index: 1;
  outline: 3px solid rgba(61, 103, 198, .24);
  outline-offset: -3px;
}

.replay-tab.is-active {
  border-bottom-color: var(--replay-purple);
  background: #fff;
  color: var(--ink);
}

.replay-tab-number {
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 1.8rem;
  display: grid;
  place-items: center;
  border: 1px solid #cbd4e1;
  border-radius: 5px;
  background: #fff;
  color: #667085;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .68rem;
  font-weight: 800;
}

.replay-tab.is-active .replay-tab-number {
  border-color: var(--replay-purple);
  background: var(--replay-purple);
  color: #fff;
}

.replay-tab strong,
.replay-tab small {
  display: block;
  min-width: 0;
}

.replay-tab strong {
  color: inherit;
  font-size: .82rem;
  line-height: 1.3;
}

.replay-tab small {
  margin-top: .16rem;
  color: #8791a2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .64rem;
  line-height: 1.3;
}

.replay-context {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  background: #fff;
}

.replay-context-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: .45rem .7rem;
}

.replay-index {
  border-right: 1px solid #d7dee8;
  padding-right: .7rem;
  color: var(--replay-purple);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .68rem;
  font-weight: 800;
}

.replay-context-copy strong {
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.35;
}

.replay-context-copy > span:last-child {
  color: #697386;
  font-size: .76rem;
  line-height: 1.45;
}

.replay-capabilities {
  flex: none;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .35rem;
}

.replay-capability {
  border: 1px solid currentColor;
  border-radius: 5px;
  padding: .24rem .48rem;
  font-size: .63rem;
  font-weight: 800;
  line-height: 1.2;
}

.replay-capability-basic {
  color: var(--replay-blue);
  background: var(--replay-blue-soft);
}

.replay-capability-memory {
  color: var(--replay-coral);
  background: var(--replay-coral-soft);
}

.replay-capability-skills {
  color: var(--replay-green);
  background: var(--replay-green-soft);
}

.replay-capability-subagent {
  color: var(--replay-purple);
  background: var(--replay-purple-soft);
}

.replay-stage {
  display: grid;
  grid-template-columns: .95fr 1.2fr 1fr;
  border-top: 1px solid #dce2eb;
  border-bottom: 1px solid #dce2eb;
  background: #f9fafc;
}

.replay-lane {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  min-height: 414px;
  padding: 1rem;
  border-right: 1px solid #dce2eb;
}

.replay-lane:last-child {
  border-right: 0;
}

.replay-dialogue {
  background: #fbfcfe;
}

.replay-execution {
  background: #f7f9fc;
}

.replay-evaluation {
  background: #fbfcfb;
}

.replay-lane-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: .62rem;
  margin-bottom: .8rem;
}

.replay-lane-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  border: 1px solid #cdd6e2;
  border-radius: 6px;
  background: #fff;
  color: #516175;
  font-size: .9rem;
  line-height: 1;
}

.replay-lane-head > div > span {
  display: block;
  color: #8993a2;
  font-size: .58rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.replay-lane-head h4 {
  margin: .12rem 0 0;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.3;
}

.replay-lane-body {
  min-width: 0;
}

.replay-event {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .32s ease, transform .32s ease, border-color .32s ease, box-shadow .32s ease;
}

.replay-event.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.replay-message {
  min-height: 92px;
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  align-items: start;
  gap: .55rem;
  margin-bottom: .75rem;
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  padding: .68rem;
  background: #fff;
}

.replay-message.is-active {
  border-color: #9eb4e7;
  box-shadow: 0 5px 14px rgba(61, 103, 198, .11);
}

.replay-avatar {
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--replay-blue-soft);
  color: var(--replay-blue);
  font-size: .7rem;
}

.replay-message-agent .replay-avatar {
  background: var(--replay-purple-soft);
  color: var(--replay-purple);
}

.replay-message-label {
  display: block;
  margin: .08rem 0 .23rem;
  color: #6b7585;
  font-size: .61rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.replay-message p {
  margin: 0;
  color: #263140;
  font-size: .78rem;
  line-height: 1.52;
}

.replay-message.is-active p::after {
  display: inline-block;
  width: 1px;
  height: .9em;
  margin-left: .18rem;
  background: currentColor;
  content: "";
  vertical-align: -.04em;
  animation: replay-cursor 1s steps(2, end) infinite;
}

.replay-trace {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: .58rem;
  padding: 0 0 .72rem;
}

.replay-trace:not(:last-child)::before {
  position: absolute;
  top: 2rem;
  bottom: 0;
  left: .98rem;
  width: 1px;
  background: #cfd8e5;
  content: "";
}

.replay-trace-marker {
  position: relative;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: .72rem;
  line-height: 1;
}

.replay-trace.is-active .replay-trace-marker {
  animation: replay-node-pulse 1.2s ease-out infinite;
}

.replay-trace-plan .replay-trace-marker,
.replay-trace-tool .replay-trace-marker {
  border-color: #9fb6ea;
  color: var(--replay-blue);
  background: var(--replay-blue-soft);
}

.replay-trace-memory .replay-trace-marker {
  border-color: #dfaaa6;
  color: var(--replay-coral);
  background: var(--replay-coral-soft);
}

.replay-trace-skill .replay-trace-marker {
  border-color: #9dc8b3;
  color: var(--replay-green);
  background: var(--replay-green-soft);
}

.replay-trace-subagent .replay-trace-marker {
  border-color: #b9a6cc;
  color: var(--replay-purple);
  background: var(--replay-purple-soft);
}

.replay-trace-environment .replay-trace-marker {
  border-color: #93c7c0;
  color: var(--replay-teal);
  background: var(--replay-teal-soft);
}

.replay-trace-copy {
  min-width: 0;
  padding-top: .02rem;
}

.replay-trace-type {
  display: block;
  color: #8791a1;
  font-size: .54rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.replay-trace-copy strong {
  display: block;
  margin-top: .08rem;
  color: #2a3443;
  font-size: .76rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.replay-trace-copy p {
  margin: .14rem 0 0;
  color: #697386;
  font-size: .68rem;
  line-height: 1.45;
}

.replay-trace-copy pre {
  margin: .42rem 0 0;
  overflow: hidden;
  border: 1px solid #29364a;
  border-radius: 5px;
  padding: .48rem .55rem;
  background: #1f2a3a;
  color: #dbe7f7;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .6rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.replay-policy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .14rem .48rem;
  margin-bottom: .72rem;
  border: 1px solid #ddcba8;
  border-radius: 6px;
  padding: .58rem .64rem;
  background: var(--replay-amber-soft);
}

.replay-policy span {
  grid-column: 1 / -1;
  color: #8c7658;
  font-size: .56rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.replay-policy strong {
  color: var(--replay-amber);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .72rem;
  line-height: 1.35;
}

.replay-policy small {
  min-width: 0;
  color: #74654f;
  font-size: .62rem;
  line-height: 1.4;
}

.replay-check {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
  border-bottom: 1px solid #dde4e8;
  padding: .48rem .1rem;
}

.replay-check-icon {
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  border: 1px solid #9ac6ae;
  border-radius: 50%;
  background: var(--replay-green-soft);
  color: var(--replay-green);
  font-size: .66rem;
  line-height: 1;
  transform: scale(.82);
  transition: transform .3s ease;
}

.replay-check.is-visible .replay-check-icon {
  transform: scale(1);
}

.replay-check > div > strong,
.replay-check > div > span {
  display: block;
  overflow-wrap: anywhere;
}

.replay-check strong {
  color: #2d3a35;
  font-size: .68rem;
  line-height: 1.35;
}

.replay-check div > span {
  margin-top: .1rem;
  color: #6c7772;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .58rem;
  line-height: 1.42;
}

.replay-verdict {
  min-height: 64px;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  gap: .62rem;
  margin-top: .75rem;
  border: 1px solid #9ac6ae;
  border-radius: 6px;
  padding: .55rem .65rem;
  background: var(--replay-green-soft);
}

.replay-verdict-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--replay-green);
  color: #fff;
  font-size: .82rem;
  line-height: 1;
}

.replay-verdict > div > span,
.replay-verdict > div > strong {
  display: block;
}

.replay-verdict > div > span {
  color: #638070;
  font-size: .55rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.replay-verdict > div > strong {
  margin-top: .1rem;
  color: #245d46;
  font-size: .72rem;
  line-height: 1.35;
}

.replay-lane-icon > i,
.replay-trace-marker > i,
.replay-check-icon > i,
.replay-verdict-icon > i {
  width: 1em;
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.replay-footer {
  position: relative;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .65rem .85rem .55rem 1rem;
  background: #fff;
}

.replay-progress {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: #e6eaf0;
}

.replay-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--replay-purple);
  transition: width .5s ease;
}

.replay-status {
  min-width: 0;
  color: #697386;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.35;
}

.replay-status::before {
  display: inline-block;
  width: .42rem;
  height: .42rem;
  margin-right: .42rem;
  border-radius: 50%;
  background: var(--replay-purple);
  content: "";
  vertical-align: .05rem;
}

.replay-controls {
  display: flex;
  gap: .35rem;
}

.replay-controls button {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid #cdd5df;
  border-radius: 5px;
  background: #fff;
  color: #526071;
  font-size: .68rem;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.replay-controls button:hover:not(:disabled) {
  border-color: var(--replay-purple);
  background: var(--replay-purple-soft);
  color: var(--replay-purple);
}

.replay-controls button:focus-visible {
  outline: 3px solid rgba(120, 97, 143, .24);
  outline-offset: 2px;
}

.replay-controls button:disabled {
  cursor: default;
  opacity: .45;
}

.replay-disclosure {
  margin: .72rem 0 0;
  color: #7b8493;
  font-size: .68rem;
  line-height: 1.45;
  text-align: center;
}

.replay-noscript {
  border: 1px solid #dce2eb;
  border-radius: 6px;
  padding: 1rem;
  color: var(--ink-soft);
  background: #f8fafc;
  font-size: .85rem;
  line-height: 1.6;
}

@keyframes replay-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 161, 108, .28); }
  70% { box-shadow: 0 0 0 7px rgba(54, 161, 108, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 161, 108, 0); }
}

@keyframes replay-node-pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 103, 198, .25); }
  75% { box-shadow: 0 0 0 6px rgba(61, 103, 198, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 103, 198, 0); }
}

@keyframes replay-cursor {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

@media (max-width: 920px) {
  .replay-stage {
    grid-template-columns: 1fr 1fr;
  }

  .replay-lane {
    min-height: 390px;
  }

  .replay-execution {
    border-right: 0;
  }

  .replay-evaluation {
    grid-column: 1 / -1;
    min-height: auto;
    border-top: 1px solid #dce2eb;
  }

  .replay-evaluation .replay-lane-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .7rem;
  }

  .replay-evaluation .replay-check {
    border: 1px solid #dce5df;
    border-radius: 6px;
    padding: .55rem;
  }

  .replay-verdict {
    max-width: 360px;
  }
}

@media (max-width: 720px) {
  .benchmark-replay {
    margin-top: 2.7rem;
  }

  .replay-heading h3 {
    font-size: 1.42rem;
  }

  .replay-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .replay-tabs::-webkit-scrollbar {
    display: none;
  }

  .replay-tab {
    flex: 0 0 190px;
  }

  .replay-context {
    align-items: flex-start;
    flex-direction: column;
  }

  .replay-context-copy {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .replay-context-copy > span:last-child {
    grid-column: 1 / -1;
  }

  .replay-capabilities {
    justify-content: flex-start;
  }

  .replay-stage {
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .replay-stage::-webkit-scrollbar {
    display: none;
  }

  .replay-lane {
    min-height: 430px;
    flex: 0 0 100%;
    border-right: 1px solid #dce2eb;
    border-bottom: 0;
    scroll-snap-align: start;
  }

  .replay-lane:last-child {
    border-right: 0;
  }

  .replay-execution {
    border-right: 1px solid #dce2eb;
  }

  .replay-evaluation {
    grid-column: auto;
    min-height: 430px;
  }

  .replay-dialogue .replay-lane-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
  }

  .replay-message {
    min-height: 116px;
    margin-bottom: 0;
  }

  .replay-evaluation {
    border-top: 0;
  }

  .replay-evaluation .replay-lane-body {
    grid-template-columns: 1fr;
    gap: .45rem;
  }

  .replay-evaluation .replay-check {
    min-height: 52px;
  }
}

@media (max-width: 480px) {
  .replay-console {
    margin-right: -.2rem;
    margin-left: -.2rem;
  }

  .replay-tab {
    flex-basis: 176px;
    min-height: 64px;
    padding-right: .65rem;
    padding-left: .65rem;
  }

  .replay-dialogue .replay-lane-body {
    grid-template-columns: 1fr;
  }

  .replay-message {
    min-height: 92px;
  }

  .replay-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: .8rem;
  }

  .replay-status {
    max-width: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .replay-kicker span,
  .replay-trace.is-active .replay-trace-marker,
  .replay-message.is-active p::after {
    animation: none;
  }

  .replay-event,
  .replay-progress span,
  .replay-check-icon {
    transition: none;
  }

  .replay-console.is-reduced-motion [data-replay-restart],
  .replay-console.is-reduced-motion [data-replay-toggle] {
    display: none;
  }
}
