.replay-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 28, 20, 0.48);
}
.replay-section .section-eyebrow,
.replay-section h2,
.replay-section .lead { text-align: center; }
.replay-section h2 {
  margin-right: auto;
  margin-bottom: 14px;
  margin-left: auto;
}
.replay-section .lead { margin: 0 auto 36px; }
.replay-section > .wrap > .section-eyebrow,
.replay-section > .wrap > h2,
.replay-section > .wrap > .lead {
  text-align: center;
}

.replay-section > .wrap > .lead {
  margin-left: auto;
  margin-right: auto;
}

.replay-card {
  max-width: 840px;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(7, 19, 13, 0.76);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}
.replay-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(49, 242, 139, 0.05);
}
.replay-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--grey-green);
}
.replay-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aurora);
  box-shadow: 0 0 14px rgba(49, 242, 139, 0.72);
}
.replay-dev-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--near-black);
  background: var(--aurora);
  padding: 4px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.replay-turns {
  display: grid;
  gap: 16px;
  max-height: 660px;
  overflow-y: auto;
  padding: 22px;
  scrollbar-color: rgba(167, 184, 173, 0.4) transparent;
}
.replay-turn { display: flex; max-width: min(82%, 620px); }
.replay-turn--user { justify-self: end; }
.replay-turn--assistant { justify-self: start; }
.replay-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: max(15px, 0.98rem);
  line-height: 1.62;
  color: var(--off-white);
}
.replay-turn--user .replay-message {
  border: 1px solid rgba(49, 242, 139, 0.44);
  border-radius: 14px 14px 3px 14px;
  padding: 13px 15px;
  background: rgba(49, 242, 139, 0.13);
}
.replay-turn--assistant .replay-message {
  border-left: 2px solid rgba(49, 242, 139, 0.62);
  padding: 4px 0 4px 15px;
  color: var(--grey-green);
}
.replay-tool {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--grey-green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
}
.replay-tool-state {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  color: var(--aurora);
}
.replay-tool-state::after { content: "✓"; }
.replay-card.replay--animating .replay-tool-state {
  border: 2px solid rgba(49, 242, 139, 0.35);
  border-top-color: var(--aurora);
  border-radius: 50%;
  color: transparent;
}
.replay-tool-result { color: var(--off-white); }
.replay-tool.is-complete .replay-tool-state {
  border: 0;
  width: 15px;
  height: 15px;
  color: var(--aurora);
}
.replay-tool.is-complete .replay-tool-state::after { content: "✓"; }
.replay-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
}
.replay-links a,
.replay-restart {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--aurora);
}
.replay-links a:hover,
.replay-links a:focus-visible { color: var(--off-white); }
.replay-restart {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 10px;
  background: transparent;
  cursor: pointer;
}
.replay-restart:hover,
.replay-restart:focus-visible { border-color: var(--aurora); color: var(--off-white); }
.replay-card.replay--animating .replay-turn { opacity: 0; transform: translateY(8px); }
.replay-card.replay--animating .replay-turn.is-visible { opacity: 1; transform: none; transition: opacity 0.3s ease, transform 0.3s ease; }
.replay-card.replay--animating .replay-tool-result { display: none; }
.replay-card.replay--animating .replay-tool.is-complete .replay-tool-result { display: inline; }
.replay-card.replay--animating .replay-tool.is-complete .replay-tool-state {
  border: 0;
  color: var(--aurora);
}
.replay-card.replay--animating .replay-tool.is-pending .replay-tool-state { animation: replay-spin 0.85s linear infinite; }
@keyframes replay-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .replay-card { border-radius: 12px; }
  .replay-card-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .replay-turns { max-height: none; padding: 18px; gap: 18px; }
  .replay-turn { max-width: 94%; }
  .replay-links { align-items: stretch; }
  .replay-restart { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .replay-card.replay--animating .replay-turn { opacity: 1; transform: none; }
}
