.replay-flow-root {
  --rf-green: #91cf26;
  --rf-amber: #e4b46a;
  position: relative;
  border: 1px solid #323b2b;
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 35%, #17211280, transparent 65%), #0c100b;
  overflow: hidden;
}
.rf-toolbar,
.rf-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
}
.rf-toolbar { border-bottom: 1px solid #293024; }
.rf-live { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #c7cebf; }
.rf-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--rf-green); box-shadow: 0 0 12px #91cf2633; }
.rf-paused .rf-live i { background: #69745e; box-shadow: none; }
.rf-add-controls,
.rf-playback { display: flex; align-items: center; gap: 10px; }
.rf-add-controls button { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid #39452d; border-radius: 4px; font-size: 12px; background: #1c2816; color: #dce8d0; }
.rf-add-controls button span { color: var(--rf-green); font-size: 17px; line-height: 1; }
.rf-add-controls button:hover { border-color: var(--rf-green); background: #26381a; }
.replay-flow-root button:disabled { opacity: 0.35; cursor: default; }
.rf-diagram {
  position: relative;
  display: grid;
  grid-template-columns: minmax(145px, 0.8fr) minmax(300px, 2fr) minmax(145px, 0.8fr);
  align-items: center;
  gap: clamp(26px, 4vw, 62px);
  min-height: 365px;
  padding: 36px 28px;
}
.rf-connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.rf-link { fill: none; stroke-width: 1.4; opacity: 0.78; }
.rf-link-data { stroke: var(--rf-green); stroke-dasharray: 5 8; animation: rf-travel 1.2s linear infinite; animation-play-state: paused; }
.rf-link-control { stroke: var(--rf-amber); stroke-dasharray: 2 6; opacity: 0.7; animation: rf-travel 1.8s linear infinite; animation-play-state: paused; }
.rf-playing .rf-link { animation-play-state: running; }
.rf-column,
.rf-center { position: relative; min-width: 0; }
.rf-column { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding-top: 62px; }
.rf-column-title { display: flex; justify-content: space-between; margin-bottom: 15px; color: #d0d7c8; text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; font-weight: 700; }
.rf-column-title span { color: #748168; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rf-participants { display: grid; gap: 12px; }
.rf-participant { position: relative; z-index: 3; display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 72px; padding: 14px 12px; border: 1px solid #384330; border-radius: 5px; background: #141b10; transition: border-color 0.3s, background 0.3s; }
.rf-participant-copy { min-width: 0; }
.rf-participant strong { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; }
.rf-participant-status { display: block; color: #929f86; margin-top: 5px; font-size: 10px; white-space: nowrap; }
.rf-device { width: 24px; height: 29px; flex: 0 0 24px; display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid #5c6a4d; border-radius: 3px; }
.rf-device i { display: block; height: 10px; width: 2px; background: #5c6a4d; }
.rf-learner .rf-device { transform: rotate(90deg); }
.rf-activity { position: absolute; width: 4px; height: 4px; background: #60704f; border-radius: 50%; right: 7px; top: 7px; }
.rf-participant[data-phase="writing"],
.rf-participant[data-phase="reading"] { border-color: #6d9d36; background: #1b2813; }
.rf-participant[data-phase="writing"] .rf-device i,
.rf-participant[data-phase="reading"] .rf-device i,
.rf-participant[data-phase="reading"] .rf-activity,
.rf-participant[data-phase="writing"] .rf-activity { background: var(--rf-green); }
.rf-participant[data-phase="claimed"],
.rf-participant[data-phase="attaching"] { border-color: #8b7144; }
.rf-participant[data-phase="attaching"] .rf-activity { background: var(--rf-amber); }
.rf-manager { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; width: min(270px, 100%); min-height: 62px; margin: 0 auto 25px; padding: 11px 16px; border: 1px solid #615339; border-radius: 5px; background: #211e16; }
.rf-manager::after { content: ""; position: absolute; height: 25px; top: 100%; left: 50%; border-left: 1px dashed #615339; }
.rf-manager-icon { font-size: 28px; line-height: 1; color: var(--rf-amber); }
.rf-manager strong { display: block; font-size: 13px; }
.rf-manager div > span { display: block; margin-top: 4px; color: #b5a588; font-size: 10px; }
.rf-manager-light { width: 5px; height: 5px; border-radius: 50%; background: #736346; margin-left: auto; }
.rf-manager[data-active="true"] .rf-manager-light { background: var(--rf-amber); box-shadow: 0 0 12px #e4b46a66; }
.rf-buffer { padding: 17px; border: 1px solid #415532; border-radius: 6px; background: #11180ecc; }
.rf-buffer-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.rf-buffer-title strong { font-size: 14px; }
.rf-buffer-title > span { color: #7e8d70; font-size: 9px; letter-spacing: 0.07em; text-transform: uppercase; }
.rf-shards { display: grid; gap: 17px; }
.rf-shard-title { display: flex; justify-content: space-between; margin-bottom: 8px; color: #94a485; font-size: 9px; }
.rf-shard-title > span:last-child { color: #68785c; }
.rf-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.rf-slot { position: relative; z-index: 3; min-width: 0; height: 64px; overflow: hidden; border: 1px solid #34402b; border-radius: 3px; background: #131b0f; color: #718264; transition: border-color 0.3s, background 0.3s; }
.rf-slot-number { position: absolute; top: 5px; left: 5px; font-size: 8px; font-variant-numeric: tabular-nums; opacity: 0.8; }
.rf-slot-payload { position: absolute; inset: 23px 8px 20px; display: flex; flex-direction: column; gap: 3px; transform-origin: left; transform: scaleX(var(--fill, 0)); transition: transform 0.6s; }
.rf-slot-payload i { height: 2px; background: currentColor; opacity: 0.5; }
.rf-slot-payload i:nth-child(2) { width: 75%; }
.rf-slot-payload i:nth-child(3) { width: 90%; }
.rf-slot-state { position: absolute; bottom: 5px; inset-inline: 0; text-align: center; font-size: 8px; }
.rf-slot[data-state="claimed"] { border-color: #846a3e; background: #2b2417; color: var(--rf-amber); }
.rf-slot[data-state="writing"] { border-color: #a9894e; background: #3a2e1a; color: #e4b46a; }
.rf-slot[data-state="ready"] { border-color: #648e35; background: #304d1c; color: #c4ed8f; }
.rf-slot[data-state="reading"] { border-color: #c1e2a0; background: #658e39; color: #effbdc; box-shadow: 0 0 0 2px #91cf2615; }
.rf-slot-lease { display: none; position: absolute; right: 5px; top: 9px; height: 6px; width: 7px; border-radius: 1px; background: #e8f5d6; }
.rf-slot-lease::before { content: ""; position: absolute; left: 1px; top: -4px; width: 5px; height: 5px; border: 1px solid #e8f5d6; border-radius: 4px 4px 0 0; }
.rf-slot[data-state="reading"] .rf-slot-lease { display: block; }
.rf-footer { border-top: 1px solid #293024; padding-block: 17px; }
.rf-legend { display: flex; flex-wrap: wrap; gap: 17px; }
.rf-legend > span { display: inline-flex; align-items: center; gap: 6px; color: #9aa58e; font-size: 10px; white-space: nowrap; }
.rf-legend i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid #4c5b3f; background: #172011; }
.rf-legend [data-state="writing"] { background: #c39a54; border-color: #c39a54; }
.rf-legend [data-state="ready"] { background: #6d9d3a; border-color: #6d9d3a; }
.rf-legend [data-state="reading"] { background: #bce292; border-color: #e8f5d6; box-shadow: 0 0 0 2px #91cf261a; }
.rf-playback button { padding: 4px 0; font-size: 10px; color: #9aa58e; white-space: nowrap; }
.rf-playback button + button { margin-left: 5px; }
.rf-playback button:hover { color: #e2edda; }
.rf-announcement { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.replay-scope { max-width: 790px; margin-top: 18px; color: #929d88; font-size: 13px; line-height: 1.7; }
.rf-paused .rf-slot-payload { transition: none; }
@keyframes rf-travel { to { stroke-dashoffset: -52; } }
@media (max-width: 1050px) {
  .rf-diagram { grid-template-columns: minmax(122px, 0.8fr) minmax(260px, 2fr) minmax(122px, 0.8fr); gap: 24px; padding-inline: 20px; }
  .rf-device { display: none; }
  .rf-participant { padding-inline: 11px; }
  .rf-buffer { padding: 13px; }
  .rf-slots { gap: 4px; }
  .rf-toolbar, .rf-footer { padding-inline: 20px; }
}
@media (max-width: 720px) {
  .rf-toolbar { align-items: flex-start; flex-direction: column; gap: 14px; padding: 20px; }
  .rf-add-controls { width: 100%; gap: 8px; }
  .rf-add-controls button { flex: 1; justify-content: center; font-size: 11px; padding-inline: 8px; }
  .rf-diagram { grid-template-columns: 1fr; gap: 31px; padding: 23px 20px; }
  .rf-column { padding-top: 0; }
  .rf-participants { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rf-participant { min-height: 62px; padding: 10px 12px; }
  .rf-participant strong { font-size: 12px; }
  .rf-participant-status { font-size: 9px; }
  .rf-column-title { margin-bottom: 11px; }
  .rf-manager { margin-bottom: 22px; min-height: 58px; }
  .rf-manager::after { height: 22px; }
  .rf-buffer { padding: 15px; }
  .rf-slot { height: 64px; }
  .rf-footer { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px 20px; }
  .rf-legend { width: 100%; justify-content: space-between; gap: 8px; }
  .rf-playback { width: 100%; justify-content: flex-end; }
  .rf-playback button { min-height: 44px; min-width: 44px; padding-inline: 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .replay-flow-root *, .replay-flow-root *::before, .replay-flow-root *::after { animation: none !important; transition: none !important; }
}
