/* The first lesson's response panel, alone in a lesson page: what the app has assembled on the left, the lines it
   arrived as on the right. Both sides keep one height while lines arrive, so the page never moves. */
.stream-replay { margin: 0 0 32px; }
/* The Try It row: the heading and its line, then the switch and Send at its right, 12 over the card. */
.stream-replay-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; }
.stream-replay-head > .stream-replay-actions { margin-left: auto; }
.stream-replay-card {
  border-radius: var(--radius-card);
  overflow: clip;
  background: var(--surface);
  box-shadow: var(--raise);
  outline: 1px solid transparent;
}
.stream-replay-actions { display: flex; align-items: center; gap: 20px; }
.stream-replay-actions .rq-toggle-row { gap: 12px; }
.stream-replay-actions .rq-toggle-row label { white-space: nowrap; }
.stream-replay-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  border-bottom: 1px solid var(--line);
}
.stream-replay-side { min-width: 0; }
.stream-replay-side + .stream-replay-side { border-left: 1px solid var(--line); }
/* The answer has no other view to switch to, so its heading only looks like the selected tab beside it. */
.stream-replay .rq-tabs h3 {
  margin: 0;
  padding: 13px 0;
  border-bottom: 2px solid var(--accent);
  font: inherit;
  color: var(--ink);
}
.stream-replay .rq-output-panel { height: 400px; min-height: 0; overflow: auto; }
.stream-replay #panel-request { padding: 20px 24px; }
.stream-replay #panel-request .rq-json { height: auto; border-top: 0; padding: 0; background: transparent; }
/* One block per received line, ruled off like an event; a wrapped line hangs under its own start, and breaks at a
   space or after a comma between fields (fieldBreaks), inside a word only where the word alone is wider than the pane. */
.stream-replay-raw { font: var(--text-xs) / 1.6 var(--mono); }
/* What a panel says while it holds nothing is a sentence of the page's, not data. */
.stream-replay-empty { font: 400 var(--text-sm) / 1.5 var(--sans); color: var(--muted); }
.stream-replay-raw p {
  margin: 0;
  padding: 7px 0 7px 2ch;
  border-bottom: 1px solid var(--line);
  text-indent: -2ch;
  overflow-wrap: break-word;
}
/* What the latest event added is filled, in the answer and on the raw lines that carried it. While a stream is
   open a caret stands where the answer last grew. A response without a stream arrives as one piece. */
.stream-new { border-radius: 2px; background: var(--ok-pale); box-shadow: 0 0 0 2px var(--ok-pale); color: inherit; }
.stream-replay-raw p.is-new { background: var(--ok-pale); box-shadow: -8px 0 0 var(--ok-pale), 8px 0 0 var(--ok-pale); }
.stream-replay-raw pre.is-new { border-radius: 1px; background: var(--ok-pale); box-shadow: 0 0 0 8px var(--ok-pale); }
.stream-caret {
  display: inline-block; width: 2px; height: 1.2em; margin: 0 -1px; vertical-align: text-bottom;
  background: var(--accent); animation: stream-caret 1s steps(2, jump-none) infinite;
}
@keyframes stream-caret { 50% { opacity: 0; } }
.stream-replay-key { margin: 0 0 0 auto; align-self: center; font: 400 var(--text-xs) / 1.3 var(--sans); color: var(--muted); }
.stream-replay-key .stream-new { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .stream-caret { animation: none; } }
.stream-replay .rq-metrics { justify-content: start; gap: 12px 48px; border-bottom: 0; padding: 14px 24px; }
.stream-replay .rq-metrics div { display: flex; align-items: baseline; gap: 8px; }
/* A value that updates keeps its width, so the values after it never move while a replay runs. */
.stream-replay .rq-metrics output { display: inline-block; min-width: 7ch; }
.stream-replay .rq-metrics #call-state { min-width: 12ch; }
/* What the panel is not, said once under the card, out of the way of what it shows. */
.stream-replay-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: var(--text-xs);
}
/* The answer and the raw lines stand one over the other where the card is under 900 wide, whatever the window, as
   the first lesson's workbench stacks its form over its response. */
.stream-replay-card { container: stream-replay / inline-size; }
@container stream-replay (max-width: 899px) {
  .stream-replay-split { grid-template-columns: minmax(0, 1fr); }
  .stream-replay-side + .stream-replay-side { border-left: 0; border-top: 1px solid var(--line); }
  .stream-replay .rq-output-panel { height: 280px; }
  .stream-replay #panel-answer { height: 400px; }
}
@media (max-width: 760px) {
  /* Send stays at the right of the Try It row; the switch takes a row of its own. */
  .stream-replay-actions { display: contents; }
  .stream-replay-actions .rq-primary { order: 1; margin-left: auto; }
  .stream-replay-actions .rq-toggle-row { order: 2; width: 100%; justify-content: space-between; }
  .stream-replay .rq-metrics { gap: 10px 32px; padding: 14px 18px; }
}
