.arp-flow {
  overflow: hidden;
  border: 1px solid rgba(12, 48, 62, .14);
  border-radius: 10px;
  background: #071f2b;
  box-shadow: 0 24px 60px rgba(6, 31, 43, .16);
  max-width: 100%;
}

.arp-flow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .85fr);
  min-height: 340px;
}

.arp-sequence {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, .1);
  background:
    radial-gradient(circle at 18% 18%, rgba(54, 231, 188, .13), transparent 28%),
    #071f2b;
}

.arp-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  padding: var(--space-3) var(--space-3) .8rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background:
    linear-gradient(90deg, rgba(126, 228, 201, .1) 1px, transparent 1px),
    rgba(255, 255, 255, .02);
  background-size: 33.333% 100%;
}

.arp-lane {
  display: grid;
  justify-items: center;
  gap: .2rem;
  min-width: 0;
  color: rgba(237, 249, 246, .75);
  text-align: center;
  font-size: .76rem;
  font-weight: 750;
}

.arp-lane span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(108px, 100%);
  min-height: 44px;
  padding: .35rem .55rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(226, 244, 239, .93));
  color: var(--ink);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .22);
  font-size: .95rem;
  font-weight: 900;
}

.arp-lane small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.arp-sequence-stage {
  position: relative;
  min-height: 260px;
  padding: var(--space-3);
  background:
    linear-gradient(90deg, rgba(206, 236, 229, .1) 1px, transparent 1px),
    linear-gradient(rgba(206, 236, 229, .07) 1px, transparent 1px);
  background-size: 33.333% 100%, 32px 32px;
}

.arp-event {
  position: absolute;
  left: var(--left);
  right: calc(100% - var(--right));
  top: var(--top);
  min-width: 72px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #36e7bc, #6fa7e8);
  box-shadow: 0 0 18px rgba(54, 231, 188, .34);
  transform-origin: left center;
}

.arp-event.reverse {
  background: linear-gradient(90deg, #6fa7e8, #36e7bc);
}

.arp-event.active {
  animation: arpDraw .42s ease-out both;
}

.arp-event::before {
  content: attr(data-kind);
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: .28rem .62rem;
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .18);
  font-size: .8rem;
  font-weight: 900;
}

.arp-event::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -4px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d9fff4;
  box-shadow: 0 0 14px rgba(217, 255, 244, .9);
}

.arp-event.reverse::after {
  left: -2px;
  right: auto;
}

.arp-trace {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: .85rem;
  padding: var(--space-3);
  min-width: 0;
  background:
    radial-gradient(circle at 80% 18%, rgba(111, 167, 232, .16), transparent 28%),
    #071f2b;
}

.arp-trace-header {
  display: grid;
  gap: .2rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  color: #eefaf7;
}

.arp-trace-header span {
  color: rgba(126, 228, 201, .72);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.arp-trace-header strong {
  font-size: 1rem;
  line-height: 1.35;
}

.arp-terminal {
  margin: 0;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  padding: var(--space-3);
  overflow: auto;
  background: #04131b;
  color: #bdfbe8;
  font: 700 .86rem/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.arp-terminal .dim {
  color: rgba(189, 251, 232, .62);
}

.arp-flow-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, #0b2734, #09212d);
  color: #eefaf7;
}

.arp-flow-panel [data-step-text] {
  color: rgba(238, 250, 247, .78);
  overflow-wrap: anywhere;
}

.arp-flow-panel .progress {
  background: rgba(255, 255, 255, .1);
}

.arp-flow-panel .progress span {
  background: linear-gradient(90deg, #36e7bc, #6fa7e8);
}

.arp-panel-actions {
  display: grid;
  gap: .75rem;
  min-width: min(360px, 100%);
}

.arp-flow-panel .control-button.primary {
  border-color: rgba(126, 228, 201, .62);
  background: rgba(126, 228, 201, .18);
}

.arp-step-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .4rem;
}

.arp-step-button {
  display: grid;
  gap: .08rem;
  min-width: 0;
  min-height: 46px;
  padding: .45rem .5rem;
  border: 1px solid rgba(213, 239, 233, .14);
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 250, 247, .72);
  text-align: left;
  cursor: pointer;
}

.arp-step-button:hover {
  border-color: rgba(126, 228, 201, .5);
  color: #fff;
  background: rgba(126, 228, 201, .1);
}

.arp-step-button[aria-current="step"] {
  border-color: rgba(126, 228, 201, .85);
  background: rgba(126, 228, 201, .16);
  color: #fff;
}

.arp-step-button.done {
  color: rgba(238, 250, 247, .9);
}

.arp-step-button strong {
  font-size: .72rem;
  line-height: 1;
}

.arp-step-button span {
  overflow: hidden;
  color: inherit;
  font-size: .74rem;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes arpDraw {
  from {
    transform: scaleX(.08);
    opacity: .45;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .arp-flow-grid {
    grid-template-columns: 1fr;
  }

  .arp-flow-panel {
    grid-template-columns: 1fr;
  }

  .arp-panel-actions {
    min-width: 0;
  }

  .arp-sequence {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }
}

@media (max-width: 560px) {
  .arp-flow-grid {
    min-height: auto;
  }

  .arp-flow-panel {
    gap: .85rem;
    padding: .85rem;
  }

  .arp-flow-panel .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
  }

  .arp-flow-panel .control-button {
    min-height: 40px;
    padding: .42rem .3rem;
    width: 100%;
  }

  .arp-flow-panel [data-step-text] {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .arp-step-list {
    gap: .3rem;
  }

  .arp-step-button {
    place-items: center;
    min-height: 38px;
    padding: .35rem .2rem;
    text-align: center;
  }

  .arp-step-button span {
    display: none;
  }

  .arp-lanes {
    gap: .25rem;
    padding: .75rem .5rem .6rem;
  }

  .arp-lane span {
    width: 100%;
    min-height: 34px;
    padding: .28rem .25rem;
    font-size: .68rem;
  }

  .arp-lane small {
    font-size: .58rem;
  }

  .arp-sequence-stage {
    min-height: 250px;
  }

  .arp-event::before {
    top: -30px;
    max-width: 112px;
    font-size: .7rem;
  }

  .arp-trace {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arp-event.active {
    animation: none;
  }
}
