.harness-story {
  border-block-end: 1px solid var(--line);
  padding: 1.4rem 0;
}
.harness-story summary {
  font-size: 1.15rem;
}
.harness-story p {
  margin: 0.65rem 0;
}
.roadmap-note {
  margin-top: 1.25rem;
  color: var(--soft);
  font-size: 0.94rem;
}
.roadmap-note strong {
  color: var(--ink);
}

.stream-console {
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
  overflow: hidden;
}
.stream-toolbar,
.stream-controls,
.stream-ident,
.stream-detail {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.stream-toolbar,
.stream-controls {
  justify-content: space-between;
}
.stream-toolbar,
.stream-detail {
  padding: 0.85rem clamp(0.9rem, 3vw, 2.25rem);
  border-block-end: 1px solid var(--line);
}
.stream-modes {
  display: flex;
  gap: 0.18rem;
  border: 1px solid var(--line);
  padding: 0.16rem;
  border-radius: 0.35rem;
}
.stream-modes button,
[data-stream-play] {
  font-size: 0.87rem;
  padding: 0.39rem 0.66rem;
  border-radius: 0.22rem;
}
.stream-modes button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--space);
}
[data-stream-play] {
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
[data-stream-play] i {
  font-size: 0.7rem;
}
.stream-body {
  padding: 1.3rem clamp(0.9rem, 3vw, 2.25rem) 1rem;
}
.stream-ident i,
.stream-detail i {
  color: var(--ice);
}
.stream-ident strong,
.stream-ident small {
  display: block;
}
.stream-ident strong {
  font: 500 1rem/1.35 var(--mono);
}
.stream-ident small,
.stream-ruler,
.stream-controls label {
  font: 0.75rem/1.5 var(--mono);
  color: var(--soft);
}
.stream-ribbon {
  display: grid;
  grid-template-columns: repeat(32, minmax(0, 1fr));
  gap: 2px;
  margin-top: 0.65rem;
}
.stream-ribbon button {
  position: relative;
  height: 2.2rem;
  overflow: hidden;
  isolation: isolate;
  border-block: 1px solid var(--line);
  background: var(--space);
  color: var(--soft);
  font: 0.72rem var(--mono);
}
.stream-ribbon button::before,
.stream-track::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
  background: color-mix(in srgb, var(--ice) 26%, var(--space));
}
@media (min-width: 651px) {
  .stream-ribbon button:nth-child(8n):not(:last-child) { margin-inline-end: 0.25rem; }
}
.stream-ribbon button[data-state="done"] {
  border-color: var(--ice);
  color: var(--ink);
}
.stream-ribbon button[aria-pressed="true"],
.stream-ribbon button:focus-visible {
  outline: 1px solid var(--ice);
  outline-offset: -2px;
  color: var(--ink);
}
.stream-ruler {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.65rem;
}
.stream-controls {
  margin: 1.3rem 0 0.6rem;
}
.stream-controls h3 {
  font-size: 1.05rem;
  font-weight: 550;
}
.stream-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stream-controls select {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.25rem 0.4rem;
  font: inherit;
  border-radius: 0.2rem;
}
.stream-lanes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.4rem;
}
.stream-lane {
  display: grid;
  grid-template-columns: max-content 1fr 4ch;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  font: 0.76rem/1.4 var(--mono);
}
.stream-lane span {
  color: var(--soft);
  white-space: nowrap;
}
.stream-lane b {
  font-weight: 400;
  text-align: right;
  color: var(--ice);
}
.stream-track {
  height: 0.48rem;
  position: relative;
  isolation: isolate;
  background: var(--space);
  overflow: hidden;
}
.stream-track::before {
  background: var(--ice);
  opacity: 0.7;
}
.stream-detail {
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.89rem;
  min-height: 3.7rem;
}
.stream-guides {
  margin-top: 1rem;
}
@media (max-width: 650px) {
  .stream-ribbon button {
    font-size: 0.57rem;
    height: 1.9rem;
  }
  .stream-lanes {
    grid-template-columns: 1fr;
  }
  .stream-controls {
    align-items: start;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .stream-controls h3 {
    font-size: 0.96rem;
  }
  .stream-toolbar {
    gap: 0.35rem;
  }
  .stream-modes button,
  [data-stream-play] {
    font-size: 0.76rem;
    padding: 0.38rem 0.45rem;
  }
  .stream-toolbar [data-stream-play] {
    white-space: nowrap;
  }
}
.harness-story summary {
  cursor: pointer;
}
.harness-story p {
  color: var(--soft);
  max-width: 60ch;
}
.stream-body {
  display: grid;
}
.stream-bridge {
  width: 100%;
  height: 3.2rem;
  display: block;
  pointer-events: none;
}
.stream-bridge path {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke: var(--line);
  transition: stroke 0.28s ease;
}
.stream-bridge [data-state="active"] path:first-child {
  stroke: color-mix(in srgb, var(--ink) 38%, var(--line));
}
.stream-bridge [data-state="done"] path:first-child {
  stroke: color-mix(in srgb, var(--ink) 61%, var(--line));
}
.stream-bridge .stream-pulse {
  stroke: var(--ink);
  stroke-width: 2px;
  stroke-linecap: round;
  opacity: 0;
  stroke-dasharray: 9 100;
}
.stream-console[data-playing] .stream-bridge [data-state="active"] .stream-pulse {
  opacity: 0.78;
  animation: stream-packet 1s linear infinite;
}
.stream-bridge g:nth-child(even) { --stream-offset: -0.34s; }
@keyframes stream-packet {
  from { stroke-dashoffset: 9; }
  to { stroke-dashoffset: -100; }
}
.stream-console .stream-bridge [data-state="active"] .stream-pulse {
  animation-delay: var(--stream-offset, 0s);
}
.stream-console[data-mode="merge"] .stream-controls { order: 0; margin: 0 0 0.36rem; }
.stream-console[data-mode="merge"] .stream-lanes { order: 1; }
.stream-console[data-mode="merge"] .stream-ribbon { order: 2; margin-top: 0.35rem; }
.stream-console[data-mode="merge"] .stream-ruler { order: 3; }
.stream-console[data-mode="merge"] .stream-bridge { order: 4; }
.stream-console[data-mode="merge"] .stream-ident { order: 5; }
.stream-console[data-mode="split"] .stream-ident { order: -1; }
.stream-console[data-mode="split"] .stream-lanes { order: 2; }
.stream-console[data-mode="split"] .stream-bridge { order: 1; transform: scaleY(-1); }
.stream-console[data-mode="split"] .stream-pulse { animation-direction: reverse; }
@media (prefers-reduced-motion: reduce) {
  .stream-console[data-playing] .stream-bridge [data-state="active"] .stream-pulse { animation: none; }
}
@media (max-width: 960px) {
  .stream-ribbon {
    grid-template-columns: repeat(16, minmax(0, 1fr));
  }
  .stream-ruler {
    display: none;
  }
}
@media (max-width: 650px) {
  .stream-ribbon {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .stream-ribbon button {
    font-size: 0.69rem;
  }
}
.stream-lanes {
  min-height: 8.9rem;
  align-content: start;
}
.stream-detail {
  min-height: 4.3rem;
}
.stream-access {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.4rem 0.9rem;
  padding: 0.75rem clamp(0.9rem, 3vw, 2.25rem);
  border-top: 1px solid var(--line);
}
.stream-access > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
}
.stream-access i {
  color: var(--ice);
}
.stream-access strong {
  font-size: 0.9rem;
}
.stream-access small,
.stream-access p {
  color: var(--soft);
  font: 0.75rem/1.45 var(--mono);
  overflow-wrap: anywhere;
}
.stream-access p {
  grid-column: 1/-1;
  min-height: 2.9em;
}
.stream-grant-actions button {
  font-size: 0.79rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
}
.stream-grant-actions button[aria-pressed="true"] {
  border-color: var(--ice);
  color: var(--ice);
}
@media (max-width: 650px) {
  .stream-lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.65rem;
    min-height: 7.2rem;
  }
  .stream-lane {
    grid-template-columns: minmax(0, 1fr) 4ch;
    gap: 0.15rem;
    font-size: 0.69rem;
  }
  .stream-track {
    order: 3;
    grid-column: 1/-1;
    height: 0.19rem;
  }
  .stream-detail {
    min-height: 6.3rem;
  }
  .stream-access {
    grid-template-columns: 1fr;
  }
  .stream-access p {
    min-height: 4.4em;
  }
  .stream-grant-actions button {
    min-height: 2.5rem;
  }
}

.stream-total {
  display: grid;
  gap: 0.38rem;
  padding: 0.72rem clamp(0.9rem, 3vw, 2.25rem);
  border-block-end: 1px solid var(--line);
}
.stream-total-label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.stream-total-label span { font: 0.78rem/1.4 var(--mono); }
.stream-total progress {
  appearance: none;
  width: 100%;
  height: 0.32rem;
  border: 0;
  border-radius: 1em;
  overflow: hidden;
  background: var(--space);
  color: var(--ink);
  accent-color: var(--ink);
}
.stream-total progress::-webkit-progress-bar { background: var(--space); }
.stream-total progress::-webkit-progress-value { background: linear-gradient(90deg, var(--soft), var(--ink)); }
.stream-total progress::-moz-progress-bar { background: linear-gradient(90deg, var(--soft), var(--ink)); }
.stream-total p {
  min-height: 1.45em;
  color: var(--soft);
  font: 0.72rem/1.45 var(--mono);
}
.stream-lane:has(small) { grid-template-columns: max-content minmax(0, 1fr) 4ch 6.5ch; }
.stream-lane small { text-align: right; font: inherit; color: var(--soft); }
.stream-lane[data-state="done"] small { color: var(--ink); }
.stream-file-state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--soft);
  font: 0.72rem/1.4 var(--mono);
}
.stream-file-state[data-state="complete"],
.stream-file-state[data-state="complete"] i { color: var(--ink); }
.stream-file-state[data-state="complete"] i { animation: stream-check 0.35s ease-out both; }
@keyframes stream-check {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
.stream-console[data-mode="merge"] .stream-ident {
  justify-self: center;
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  gap: 0.36rem 0.65rem;
  min-height: 4.25rem;
  width: min(100%, 20rem);
  padding: 0.52rem 0.73rem;
  border: 1px solid var(--line);
  border-radius: 0.42rem;
  background: linear-gradient(130deg, color-mix(in srgb, var(--ink) 6%, var(--surface)), var(--surface));
  transition: border-color 0.28s ease;
}
.stream-console[data-mode="merge"] .stream-file-state { grid-column: 2; }
.stream-console[data-phase="complete"] .stream-ident { border-color: var(--soft); }
@media (max-width: 650px) {
  .stream-total p { min-height: 2.9em; }
  .stream-lane:has(small) { grid-template-columns: minmax(0, 1fr) 4ch; }
  .stream-lane small { grid-column: 1 / -1; text-align: start; }
  .stream-lane { padding-block: 0.38rem; }
}
@media (prefers-reduced-motion: reduce) {
  .stream-file-state[data-state="complete"] i { animation: none; }
}
.stream-body {
  block-size: 24rem;
  align-content: start;
  overflow: auto;
  scrollbar-gutter: stable;
}
.stream-lanes {
  block-size: 8.9rem;
}
.stream-detail {
  min-block-size: 0;
  block-size: 4.5rem;
}
.stream-detail p {
  max-block-size: 100%;
  overflow: auto;
}
.stream-access p {
  min-block-size: 0;
  block-size: 2.9em;
  overflow: auto;
}
@media (max-width: 650px) {
  .stream-body { block-size: 31.1rem; }
  .stream-lanes { block-size: 9.1rem; }
  .stream-detail { block-size: 7rem; }
  .stream-access p { block-size: 4.4em; }
}

.stream-lanes:not(:has(.stream-lane:nth-child(5))) {
  min-block-size: 0;
  block-size: 4.35rem;
}
@media (max-width: 650px) {
  .stream-lanes:not(:has(.stream-lane:nth-child(5))) { block-size: 6.7rem; }
}

.stream-event {
  order: 6;
  position: relative;
  justify-self: center;
  visibility: hidden;
  min-width: 0;
  padding: 0.75rem 0 0.1rem;
  color: var(--ice);
}
.stream-console[data-mode="split"] .stream-event { display: none; }
.stream-event::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 0.75rem;
  background: var(--soft);
  transform-origin: top;
}
.stream-event > a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--space);
  font-size: 0.72rem;
}
.stream-event span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.18rem 0.55rem; }
.stream-event code { color: var(--soft); font: 0.68rem/1.25 var(--mono); }
.stream-event[data-emitted] { visibility: visible; }
.stream-event[data-emitted]::before { animation: stream-event-wire 0.16s ease-out both; }
.stream-event[data-emitted] > a {
  border-color: color-mix(in srgb, var(--ink) 50%, var(--line));
  animation: stream-event-in 0.45s ease-out both;
}
.stream-event[data-emitted] strong { color: var(--ink); }
@keyframes stream-event-wire { from { transform: scaleY(0); } }
@keyframes stream-event-in {
  from { opacity: 0.6; transform: translateY(-0.18rem); }
  40% { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 14%, var(--surface)); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .stream-event[data-emitted]::before,
  .stream-event[data-emitted] > a { animation: none; }
}

.stream-event > a:is(:hover, :focus-visible) { border-color: var(--soft); }
