/* 5sigmas voice reports — small, progressive visual explanations. */

.s5v,
.s5v * {
  box-sizing: border-box;
}

.s5v {
  --ink: #08191c;
  --muted: #5b686b;
  --line: rgba(8, 25, 28, .13);
  --surface: #f7faf9;
  --paper: #ffffff;
  --green: #24863c;
  --green-soft: #e9f6e9;
  --teal: #087e8d;
  --teal-soft: #e5f6f8;
  --blue: #2d65d4;
  --blue-soft: #edf2ff;
  --amber: #d98a00;
  --amber-soft: #fff3da;
  --red: #c74439;
  --red-soft: #fff0ed;
  width: min(100%, 860px);
  min-width: 0;
  margin: 0 auto;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, Inter, "Segoe UI", sans-serif;
  container-name: s5v;
  container-type: inline-size;
}

.s5v--wide {
  width: min(100%, 1040px);
}

.s5v__canvas {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(19px, 3.2cqi, 31px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(circle at 4% 5%, rgba(8, 126, 141, .08), transparent 26%),
    radial-gradient(circle at 96% 8%, rgba(217, 138, 0, .08), transparent 25%),
    linear-gradient(180deg, #fff, #fbfcfc);
  box-shadow: 0 17px 42px rgba(13, 31, 34, .09);
}

.s5v__canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .28;
  background-image:
    linear-gradient(rgba(8, 25, 28, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 25, 28, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

.s5v__canvas > * {
  position: relative;
  z-index: 1;
}

.s5v__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: clamp(18px, 3cqi, 27px);
}

.s5v__head > div {
  min-width: 0;
}

.s5v__head h3 {
  max-width: 18ch;
  margin: 5px 0 0;
  color: var(--ink) !important;
  font-size: clamp(1.55rem, 4cqi, 2.55rem);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.052em;
}

.s5v__head p {
  max-width: 34ch !important;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.76rem, 1.55cqi, .92rem);
  font-weight: 650;
  line-height: 1.4;
  text-align: right;
}

.s5v__kicker {
  display: block;
  color: var(--teal);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.s5v code {
  color: inherit;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.s5v__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.s5v__steps button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  color: var(--muted);
  font: 800 .72rem/1 inherit;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}

.s5v__steps button:hover {
  transform: translateY(-1px);
  border-color: rgba(8, 25, 28, .35);
}

.s5v[data-step="1"] [data-s5v-step="1"],
.s5v[data-step="2"] [data-s5v-step="2"],
.s5v[data-step="3"] [data-s5v-step="3"],
.s5v[data-step="4"] [data-s5v-step="4"],
.s5v[data-step="5"] [data-s5v-step="5"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff !important;
}

.s5v__steps--tabs {
  justify-content: flex-start;
  margin: 0 0 18px;
}

.s5v__copy {
  min-height: 1.45em;
  margin-top: 13px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
}

.s5v__copy [data-s5v-copy] {
  display: none;
}

.s5v[data-step="1"] [data-s5v-copy="1"],
.s5v[data-step="2"] [data-s5v-copy="2"],
.s5v[data-step="3"] [data-s5v-copy="3"],
.s5v[data-step="4"] [data-s5v-copy="4"],
.s5v[data-step="5"] [data-s5v-copy="5"] {
  display: inline;
}

.s5v__rule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 15px;
  background: var(--ink);
  color: #eef8f6;
}

.s5v__rule b {
  color: #9fe0b0 !important;
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.s5v__rule span {
  color: #eef8f6 !important;
  font-size: .76rem;
  font-weight: 720;
  line-height: 1.35;
}

.s5v__wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 50px;
}

.s5v__wave i {
  width: 5px;
  height: 13px;
  border-radius: 99px;
  background: currentColor;
  animation: s5v-wave 1.05s ease-in-out infinite;
}

.s5v__wave i:nth-child(2) { animation-delay: -.22s; }
.s5v__wave i:nth-child(3) { animation-delay: -.68s; }
.s5v__wave i:nth-child(4) { animation-delay: -.38s; }
.s5v__wave i:nth-child(5) { animation-delay: -.84s; }
.s5v__wave i:nth-child(6) { animation-delay: -.53s; }
.s5v__wave i:nth-child(7) { animation-delay: -.11s; }
.s5v__wave i:nth-child(8) { animation-delay: -.75s; }

/* Reactive / proactive contract */
.s5v-contract__tracks {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 7px 0;
}

.s5v-contract__track {
  display: grid;
  grid-template-columns: 92px auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.s5v-contract__track--talk {
  grid-template-columns: 92px auto minmax(30px, 1fr) auto;
}

.s5v-contract__track > b {
  color: var(--muted);
  font-size: .67rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.s5v-contract__node {
  position: relative;
  z-index: 2;
  min-width: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 850;
  text-align: center;
  transition: .35s ease;
}

.s5v-contract__line {
  height: 3px;
  border-radius: 99px;
  background: rgba(8, 25, 28, .12);
}

.s5v-contract__packet {
  position: absolute;
  top: 67px;
  left: 100px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--teal);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(8, 126, 141, .12);
  transition: left .55s cubic-bezier(.2, .8, .2, 1);
}

.s5v-contract[data-step="1"] [data-at="1"],
.s5v-contract[data-step="2"] [data-at="2"],
.s5v-contract[data-step="3"] [data-at="3"] {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  transform: translateY(-2px);
}

.s5v-contract[data-step="2"] .s5v-contract__packet { left: 52%; }
.s5v-contract[data-step="3"] .s5v-contract__packet { left: calc(100% - 30px); border-color: var(--amber); }

/* Safe window */
.s5v-window__scene {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
}

.s5v-window__lane {
  position: absolute;
  top: 22px;
  left: 22px;
  width: calc(100% - 44px);
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: center;
}

.s5v-window__lane b {
  font-size: .75rem;
  white-space: nowrap;
}

.s5v-window__lane .s5v__wave {
  justify-content: flex-start;
  color: var(--blue);
}

.s5v-window__quiet {
  opacity: 0;
  color: var(--green);
  font-size: .7rem;
  font-weight: 850;
  transition: opacity .35s ease;
}

.s5v-window__result,
.s5v-window__queue,
.s5v-window__speech {
  position: absolute;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .74rem;
  font-weight: 850;
  transition: .55s cubic-bezier(.2, .8, .2, 1);
}

.s5v-window__result {
  top: 120px;
  left: 24px;
  background: var(--teal-soft);
  color: var(--teal);
}

.s5v-window__queue {
  top: 120px;
  left: calc(50% - 35px);
  border: 1px dashed rgba(217, 138, 0, .45);
  background: var(--amber-soft);
  color: #9a6200;
}

.s5v-window__speech {
  top: 112px;
  right: 24px;
  opacity: .2;
  background: var(--green-soft);
  color: var(--green);
  transform: scale(.9);
}

.s5v-window[data-step="2"] .s5v__wave--user i {
  height: 4px;
  animation: none;
  opacity: .28;
}

.s5v-window[data-step="2"] .s5v-window__quiet { opacity: 1; }
.s5v-window[data-step="2"] .s5v-window__result { left: calc(50% - 53px); }
.s5v-window[data-step="2"] .s5v-window__queue { opacity: 0; transform: scale(.9); }
.s5v-window[data-step="2"] .s5v-window__speech { opacity: 1; transform: scale(1); }

/* Four clocks */
.s5v-clocks__grid {
  display: grid;
  gap: 9px;
}

.s5v-clocks__row {
  display: grid;
  grid-template-columns: 28px 78px minmax(0, 1fr) 82px;
  gap: 10px;
  align-items: center;
  min-height: 51px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
}

.s5v-clocks__row > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
}

.s5v-clocks__row b { font-size: .75rem; }
.s5v-clocks__row em {
  color: var(--muted);
  font-size: .65rem;
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.s5v-clocks__track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(8, 25, 28, .09);
}

.s5v-clocks__track i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  animation: s5v-clock 3.7s ease-in-out infinite alternate;
}

.s5v-clocks__row--model > span,
.s5v-clocks__row--model .s5v-clocks__track i { background-color: var(--teal); color: #fff; }
.s5v-clocks__row--play > span,
.s5v-clocks__row--play .s5v-clocks__track i { background-color: var(--amber); color: #fff; }
.s5v-clocks__row--tool > span,
.s5v-clocks__row--tool .s5v-clocks__track i { background-color: var(--green); color: #fff; }
.s5v-clocks__row:nth-child(2) i { animation-delay: -.9s; }
.s5v-clocks__row:nth-child(3) i { animation-delay: -1.8s; }
.s5v-clocks__row:nth-child(4) i { animation-delay: -2.6s; }

/* Activity gate */
.s5v-gate__map {
  position: relative;
  min-height: 235px;
}

.s5v-gate__source,
.s5v-gate__hub,
.s5v-gate__out {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 20px rgba(8, 25, 28, .07);
}

.s5v-gate__source {
  top: 83px;
  left: 2%;
  width: 80px;
  height: 54px;
  border-radius: 50%;
  color: var(--teal);
  font-size: .68rem;
  font-weight: 900;
}

.s5v-gate__hub {
  top: 65px;
  left: 27%;
  width: 125px;
  height: 90px;
  border-radius: 24px;
  border-color: rgba(217, 138, 0, .35);
  background: var(--amber-soft);
  color: #8d5b00;
  font-size: .83rem;
  font-weight: 900;
}

.s5v-gate__out {
  right: 2%;
  width: 130px;
  min-height: 52px;
  padding: 8px;
  border-radius: 14px;
  opacity: .35;
  transition: .35s ease;
}

.s5v-gate__out[data-out="1"] { top: 8px; }
.s5v-gate__out[data-out="2"] { top: 91px; }
.s5v-gate__out[data-out="3"] { top: 174px; }
.s5v-gate__out b { font-size: .72rem; }
.s5v-gate__out span { color: var(--muted); font-size: .64rem; font-weight: 750; }
.s5v-gate__map svg { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; }
.s5v-gate__map path { fill: none; stroke: rgba(8, 25, 28, .14); stroke-width: 4; stroke-linecap: round; transition: stroke .35s ease; }
.s5v-gate[data-step="1"] [data-out="1"],
.s5v-gate[data-step="2"] [data-out="2"],
.s5v-gate[data-step="3"] [data-out="3"] { opacity: 1; border-color: var(--green); background: var(--green-soft); transform: translateX(-4px); }
.s5v-gate[data-step="1"] [data-path="1"],
.s5v-gate[data-step="2"] [data-path="2"],
.s5v-gate[data-step="3"] [data-path="3"] { stroke: var(--green); }

/* Barge-in */
.s5v-barge__scene {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  padding: 12px 0;
}

.s5v-barge__item {
  display: grid;
  min-height: 124px;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  transition: .4s ease;
}

.s5v-barge__item > span {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.1rem;
  font-weight: 900;
}

.s5v-barge__item b { font-size: .78rem; }
.s5v-barge__item em { color: var(--muted); font-size: .66rem; font-style: normal; font-weight: 800; }
.s5v-barge__interrupt { position: absolute; top: 0; bottom: 0; left: -3%; width: 80px; opacity: 0; transition: left .55s ease, opacity .2s ease; }
.s5v-barge__interrupt i { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; border-radius: 99px; background: var(--red); box-shadow: 0 0 0 7px rgba(199, 68, 57, .08); }
.s5v-barge__interrupt b { position: absolute; bottom: -4px; left: 50%; padding: 4px 7px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: .64rem; transform: translateX(-50%); }
.s5v-barge[data-step="2"] .s5v-barge__interrupt { left: 48%; opacity: 1; }
.s5v-barge[data-step="2"] [data-kind="response"],
.s5v-barge[data-step="2"] [data-kind="playback"] { border-color: rgba(199, 68, 57, .36); background: var(--red-soft); opacity: .62; transform: scale(.96); }
.s5v-barge[data-step="2"] [data-kind="response"] em,
.s5v-barge[data-step="2"] [data-kind="playback"] em { position: relative; color: transparent; }
.s5v-barge[data-step="2"] [data-kind="response"] em::before,
.s5v-barge[data-step="2"] [data-kind="playback"] em::before { content: "cancelled"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font-size: .64rem; }
.s5v-barge[data-step="2"] [data-kind="operation"] { border-color: rgba(36, 134, 60, .36); background: var(--green-soft); transform: translateY(-4px); }

/* Batch */
.s5v-batch__scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(150px, .7fr);
  gap: 14px;
  align-items: center;
}

.s5v-batch__tools { display: grid; gap: 9px; }
.s5v-batch__tools span {
  position: relative;
  padding: 11px 12px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 820;
  transition: .35s ease;
}
.s5v-batch__tools span::before { content: ""; position: absolute; top: 50%; left: 14px; width: 10px; height: 10px; border: 3px solid rgba(8, 126, 141, .28); border-radius: 50%; transform: translateY(-50%); }
.s5v-batch__funnel { display: flex; align-items: center; justify-content: center; gap: 5px; }
.s5v-batch__funnel i { width: 16px; height: 3px; border-radius: 99px; background: rgba(8, 25, 28, .12); }
.s5v-batch__close { padding: 18px; border: 1px solid rgba(36, 134, 60, .32); border-radius: 18px; background: var(--green-soft); color: var(--green); font-size: .86rem; font-weight: 880; line-height: 1.25; opacity: .2; transform: scale(.92); transition: .4s ease; }
.s5v-batch[data-step="2"] [data-tool="1"],
.s5v-batch[data-step="3"] [data-tool="1"],
.s5v-batch[data-step="3"] [data-tool="2"],
.s5v-batch[data-step="4"] [data-tool] { color: var(--teal); border-color: rgba(8, 126, 141, .3); background: var(--teal-soft); }
.s5v-batch[data-step="2"] [data-tool="1"]::before,
.s5v-batch[data-step="3"] [data-tool="1"]::before,
.s5v-batch[data-step="3"] [data-tool="2"]::before,
.s5v-batch[data-step="4"] [data-tool]::before { border-color: var(--teal); background: var(--teal); }
.s5v-batch[data-step="4"] .s5v-batch__close { opacity: 1; transform: scale(1); }
.s5v-batch__progress { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 15px; }
.s5v-batch__progress i { width: 31px; height: 4px; border-radius: 99px; background: rgba(8, 25, 28, .12); }
.s5v-batch__progress b { min-width: 20px; color: var(--muted); font-size: .66rem; }
.s5v-batch[data-step="2"] .s5v-batch__progress i:nth-child(1),
.s5v-batch[data-step="3"] .s5v-batch__progress i:nth-child(-n+2),
.s5v-batch[data-step="4"] .s5v-batch__progress i { background: var(--teal); }

/* Runtime */
.s5v-runtime__stack {
  position: relative;
  display: grid;
  gap: 10px;
}
.s5v-runtime__surface,
.s5v-runtime__lower > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}
.s5v-runtime__surface { border-color: rgba(45, 101, 212, .28); background: var(--blue-soft); }
.s5v-runtime__surface > span,
.s5v-runtime__lower > div > span { display: grid; width: 51px; height: 36px; place-items: center; border-radius: 11px; background: var(--ink); color: #fff; font-size: .64rem; font-weight: 900; text-transform: uppercase; }
.s5v-runtime__surface b,
.s5v-runtime__lower b { font-size: .82rem; }
.s5v-runtime__surface small,
.s5v-runtime__lower small { color: var(--muted); font-size: .64rem; font-weight: 750; }
.s5v-runtime__bus { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; border-radius: 14px; background: var(--ink); color: #fff; }
.s5v-runtime__bus i { width: 10px; height: 10px; border-radius: 50%; background: #9fe0b0; box-shadow: 0 0 0 6px rgba(159, 224, 176, .12); animation: s5v-pulse 1.7s ease-in-out infinite; }
.s5v-runtime__bus b { color: #9fe0b0; font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.s5v-runtime__bus code { padding: 0; border: 0; background: transparent !important; box-shadow: none; color: #eaf4f2; font-size: .65rem; }
.s5v-runtime__lower { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.s5v-runtime__packet { position: absolute; top: 55px; left: 9%; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(217, 138, 0, .12); animation: s5v-runtime-packet 5.5s ease-in-out infinite; }

/* Architecture map */
.s5v-arch-map__panels { min-height: 126px; }
.s5v-arch-map__pipe { display: none; min-height: 126px; align-items: center; justify-content: center; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255, 255, 255, .78); }
.s5v-arch-map[data-step="1"] [data-panel="1"],
.s5v-arch-map[data-step="2"] [data-panel="2"],
.s5v-arch-map[data-step="3"] [data-panel="3"] { display: flex; }
.s5v-arch-map__pipe span,
.s5v-half__pipe span { display: grid; min-width: 78px; min-height: 55px; place-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 15px; background: #fff; font-size: .7rem; font-weight: 860; text-align: center; }
.s5v-arch-map__pipe i,
.s5v-half__pipe > i { color: var(--muted); font-style: normal; font-weight: 900; }
.s5v .is-audio { border-color: rgba(45, 101, 212, .32) !important; background: var(--blue-soft) !important; color: var(--blue); }
.s5v .is-model { border-color: rgba(8, 126, 141, .32) !important; background: var(--teal-soft) !important; color: var(--teal); }
.s5v .is-text { border-color: rgba(217, 138, 0, .32) !important; background: var(--amber-soft) !important; color: #8e5c00; }

/* Cascade friction */
.s5v-cascade__pipe { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 15px 0; }
.s5v-cascade__pipe span { min-width: 68px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--muted); font-size: .7rem; font-weight: 850; text-align: center; transition: .3s ease; }
.s5v-cascade__pipe i { width: 26px; height: 3px; border-radius: 99px; background: rgba(8, 25, 28, .12); }
.s5v-cascade[data-step="1"] [data-at="1"],
.s5v-cascade[data-step="2"] [data-at="1"], .s5v-cascade[data-step="2"] [data-at="2"],
.s5v-cascade[data-step="3"] [data-at="1"], .s5v-cascade[data-step="3"] [data-at="2"], .s5v-cascade[data-step="3"] [data-at="3"],
.s5v-cascade[data-step="4"] [data-at]:not([data-at="5"]),
.s5v-cascade[data-step="5"] [data-at] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); transform: translateY(-2px); }
.s5v-cascade__meter { display: flex; align-items: center; gap: 10px; max-width: 520px; margin: 11px auto 0; }
.s5v-cascade__meter > i { flex: 1; height: 7px; overflow: hidden; border-radius: 99px; background: rgba(8, 25, 28, .09); }
.s5v-cascade__meter > i::before { content: ""; display: block; width: calc(var(--s5v-step, 1) * 20%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--amber)); transition: width .35s ease; }
.s5v-cascade__meter b { color: var(--muted); font-size: .65rem; }

/* Prosody loss */
.s5v-prosody-loss__scene { display: grid; grid-template-columns: 1fr 70px 1fr; gap: 14px; align-items: center; }
.s5v-prosody-loss__scene .s5v__wave { color: var(--blue); }
.s5v-prosody-loss__gate { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 17px; background: var(--ink); color: #fff; font-size: .68rem; font-weight: 900; }
.s5v-prosody-loss__text { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; font-size: .92rem; font-weight: 850; text-align: center; }
.s5v-prosody-loss__features { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.s5v-prosody-loss__features span { padding: 5px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: .64rem; font-weight: 830; transition: .4s ease; }
.s5v-prosody-loss[data-step="2"] .s5v-prosody-loss__features span { opacity: .15; transform: translateY(8px); }
.s5v-prosody-loss[data-step="2"] .s5v__wave { opacity: .22; filter: grayscale(1); }

/* Half cascade */
.s5v-half__pipe { display: flex; align-items: stretch; justify-content: center; gap: 8px; }
.s5v-half__pipe span { min-width: 105px; }
.s5v-half__pipe small { display: block; margin-top: 4px; color: var(--muted); font-size: .64rem; font-weight: 720; line-height: 1.25; }

/* Speech plan */
.s5v-speech-plan { --pace: .92; --energy: .42; --pause: 180; }
.s5v-speech-plan__demo { display: grid; grid-template-columns: 1fr 190px; gap: 15px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.s5v-speech-plan__quote { font-size: clamp(.92rem, 2.6cqi, 1.25rem); font-weight: 850; line-height: 1.25; }
.s5v-speech-plan__demo .s5v__wave { color: var(--teal); transform: scaleX(calc(.75 + var(--pace) * .25)); }
.s5v-speech-plan__demo .s5v__wave i { max-height: calc(12px + var(--energy) * 52px); animation-duration: calc(1.55s - var(--pace) * .48s); }
.s5v-speech-plan__controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.s5v-speech-plan__controls label { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; padding: 10px 11px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .8); color: var(--muted); font-size: .65rem; font-weight: 850; }
.s5v-speech-plan__controls input { grid-column: 1 / -1; width: 100%; accent-color: var(--teal); }
.s5v-speech-plan__controls output { color: var(--teal); font-size: .64rem; }

/* Duplex */
.s5v-duplex__timeline { position: relative; display: grid; gap: 15px; padding: 14px 0 7px; }
.s5v-duplex__timeline > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; }
.s5v-duplex__timeline b { font-size: .7rem; }
.s5v-duplex__wave { position: relative; display: block; height: 44px; overflow: hidden; border-radius: 13px; background: rgba(8, 25, 28, .05); }
.s5v-duplex__wave::before { content: ""; position: absolute; top: 50%; width: 72%; height: 20px; border-radius: 50%; border-top: 4px solid currentColor; border-bottom: 4px solid currentColor; transform: translateY(-50%); animation: s5v-duplex 4.3s linear infinite; }
.s5v-duplex__wave--user { color: var(--blue); }
.s5v-duplex__wave--agent { color: var(--teal); }
.s5v-duplex__wave--user::before { left: -15%; }
.s5v-duplex__wave--agent::before { left: 38%; animation-delay: -1.7s; }
.s5v-duplex__timeline em { position: absolute; right: 16%; bottom: 13px; padding: 4px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: .64rem; font-style: normal; font-weight: 850; animation: s5v-backchannel 4.3s ease-in-out infinite; }
.s5v-duplex__cursor { position: absolute; top: 6px; bottom: 0; left: 54%; width: 2px; background: var(--amber); box-shadow: 0 0 0 5px rgba(217, 138, 0, .08); animation: s5v-cursor 4.3s linear infinite; }

/* Relative latency */
.s5v-latency__rows { display: grid; gap: 12px; }
.s5v-latency__rows > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 11px; align-items: center; }
.s5v-latency__rows b { font-size: .72rem; }
.s5v-latency__bar { display: flex; height: 35px; overflow: hidden; border-radius: 11px; background: rgba(8, 25, 28, .06); }
.s5v-latency__bar i { display: block; height: 100%; animation: s5v-bar-in .9s ease both; }
.s5v-latency__bar .vad { width: 14%; background: #9aa7aa; }
.s5v-latency__bar .stt { width: 22%; background: var(--blue); }
.s5v-latency__bar .model { width: 28%; background: var(--teal); }
.s5v-latency__bar .audio { width: 35%; background: var(--teal); }
.s5v-latency__bar .tts { width: 22%; background: var(--amber); }
.s5v-latency__bar .s2s { width: 45%; background: var(--green); }
.s5v-latency__bar .buffer { width: 14%; background: #252c2e; }
.s5v-latency__legend { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; margin-top: 12px; }
.s5v-latency__legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .64rem; font-weight: 780; }
.s5v-latency__legend span::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: currentColor; }
.s5v-latency__legend .stt { color: var(--blue); }
.s5v-latency__legend .model { color: var(--teal); }
.s5v-latency__legend .tts { color: var(--amber); }
.s5v-latency__legend .buffer { color: #252c2e; }

/* Decision */
.s5v-decision__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.s5v-decision__cards > div { display: grid; min-height: 105px; place-items: center; align-content: center; gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #fff; opacity: .45; transition: .35s ease; text-align: center; }
.s5v-decision__cards b { font-size: .78rem; }
.s5v-decision__cards span { color: var(--muted); font-size: .64rem; font-weight: 740; }
.s5v-decision[data-step="1"] [data-choice="1"],
.s5v-decision[data-step="2"] [data-choice="2"],
.s5v-decision[data-step="3"] [data-choice="3"] { opacity: 1; border-color: var(--teal); background: var(--teal-soft); transform: translateY(-4px); }

/* Surface / cognitive plane */
.s5v-surface__architecture { position: relative; display: grid; gap: 9px; }
.s5v-surface__top { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 78px; padding: 13px 15px; border: 1px solid rgba(45, 101, 212, .3); border-radius: 18px; background: var(--blue-soft); }
.s5v-surface__top > span { display: grid; min-height: 44px; place-items: center; border-radius: 12px; font-size: .66rem; font-weight: 900; }
.s5v-surface__top b { font-size: .86rem; }
.s5v-surface__top small,
.s5v-surface__bottom small { color: var(--muted); font-size: .64rem; font-weight: 740; }
.s5v-surface__envelopes { display: flex; justify-content: center; gap: 28px; min-height: 40px; align-items: center; color: var(--teal); font: 800 .62rem/1 "JetBrains Mono", monospace; }
.s5v-surface__bottom { display: grid; grid-template-columns: 1.2fr .8fr; gap: 9px; }
.s5v-surface__bottom > div { display: grid; gap: 5px; min-height: 75px; align-content: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.s5v-surface__bottom b { font-size: .78rem; }
.s5v-surface__packet { position: absolute; top: 77px; left: 48%; width: 11px; height: 11px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(217, 138, 0, .11); animation: s5v-surface-packet 4.8s ease-in-out infinite; }

/* Voice prompt */
.s5v-voice-prompt__flow { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px auto minmax(0, .8fr); gap: 12px; align-items: center; }
.s5v-voice-prompt__samples { display: grid; gap: 8px; }
.s5v-voice-prompt__samples span { display: grid; grid-template-columns: 35px 1fr; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.s5v-voice-prompt__samples i { display: block; width: 31px; height: 22px; border-radius: 7px; background: repeating-linear-gradient(90deg, var(--teal) 0 3px, transparent 3px 6px); opacity: .75; }
.s5v-voice-prompt__samples b { font-size: .67rem; }
.s5v-voice-prompt__flow > em { color: var(--muted); font-style: normal; font-weight: 900; }
.s5v-voice-prompt__pack { display: grid; min-height: 90px; place-items: center; border-radius: 22px; background: var(--ink); color: #fff; font-size: .76rem; font-weight: 900; line-height: 1.05; text-align: center; }
.s5v-voice-prompt__output { display: grid; gap: 3px; place-items: center; padding: 9px; border: 1px solid rgba(36, 134, 60, .28); border-radius: 17px; background: var(--green-soft); color: var(--green); }
.s5v-voice-prompt__output .s5v__wave { min-height: 42px; }
.s5v-voice-prompt__output b { font-size: .64rem; }

@keyframes s5v-wave {
  0%, 100% { height: 10px; opacity: .38; }
  50% { height: 42px; opacity: 1; }
}

@keyframes s5v-clock {
  from { width: 18%; transform: translateX(-5%); }
  to { width: 72%; transform: translateX(32%); }
}

@keyframes s5v-pulse {
  0%, 100% { transform: scale(.75); opacity: .5; }
  50% { transform: scale(1); opacity: 1; }
}

@keyframes s5v-runtime-packet {
  0%, 12% { top: 55px; left: 9%; }
  45% { top: 122px; left: 50%; }
  78%, 100% { top: 196px; left: 84%; }
}

@keyframes s5v-duplex {
  from { transform: translate(-25%, -50%); }
  to { transform: translate(115%, -50%); }
}

@keyframes s5v-backchannel {
  0%, 30%, 68%, 100% { opacity: 0; transform: translateY(5px); }
  42%, 56% { opacity: 1; transform: translateY(0); }
}

@keyframes s5v-cursor {
  from { left: 10%; }
  to { left: 92%; }
}

@keyframes s5v-bar-in {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

@keyframes s5v-surface-packet {
  0%, 15% { top: 60px; left: 18%; }
  48% { top: 114px; left: 50%; }
  76%, 100% { top: 184px; left: 78%; }
}

@container s5v (max-width: 680px) {
  .s5v__head {
    display: grid;
    gap: 8px;
    align-items: start;
  }

  .s5v__head h3 {
    max-width: 22ch;
    font-size: clamp(1.45rem, 7.4cqi, 2rem);
  }

  .s5v__head p {
    max-width: 48ch !important;
    text-align: left;
  }

  .s5v-contract__track,
  .s5v-contract__track--talk {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 7px 9px;
  }

  .s5v-contract__track > b {
    grid-row: 1 / span 5;
    align-self: stretch;
    display: grid;
    align-items: center;
    border-right: 1px solid var(--line);
  }

  .s5v-contract__line {
    width: 3px;
    height: 18px;
    margin-left: 34px;
  }

  .s5v-contract__node {
    width: 100%;
  }

  .s5v-contract__packet {
    display: none;
  }

  .s5v-gate__map {
    min-height: 370px;
  }

  .s5v-gate__source { top: 0; left: calc(50% - 40px); }
  .s5v-gate__hub { top: 75px; left: calc(50% - 62px); }
  .s5v-gate__out { right: auto; width: calc(100% - 24px); left: 12px; }
  .s5v-gate__out[data-out="1"] { top: 184px; }
  .s5v-gate__out[data-out="2"] { top: 244px; }
  .s5v-gate__out[data-out="3"] { top: 304px; }
  .s5v-gate__map svg { display: none; }
  .s5v-gate[data-step="1"] [data-out="1"],
  .s5v-gate[data-step="2"] [data-out="2"],
  .s5v-gate[data-step="3"] [data-out="3"] { transform: translateY(-2px); }

  .s5v-barge__scene {
    grid-template-columns: 1fr;
  }

  .s5v-barge__item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 64px;
    justify-items: start;
    padding: 10px 12px;
  }

  .s5v-barge__item > span { width: 37px; height: 37px; }
  .s5v-barge__interrupt { top: 30%; right: 0; bottom: auto; left: 0; width: 100%; height: 60px; }
  .s5v-barge__interrupt i { top: 50%; right: 0; bottom: auto; left: 0; width: 100%; height: 3px; }
  .s5v-barge__interrupt b { top: 50%; bottom: auto; left: 50%; transform: translate(-50%, -50%); }
  .s5v-barge[data-step="2"] .s5v-barge__interrupt { left: 0; top: 42%; }

  .s5v-batch__scene {
    grid-template-columns: 1fr;
  }

  .s5v-batch__funnel { transform: rotate(90deg); }
  .s5v-batch__close { text-align: center; }

  .s5v-runtime__surface,
  .s5v-runtime__lower > div,
  .s5v-surface__top {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .s5v-runtime__surface small,
  .s5v-runtime__lower small,
  .s5v-surface__top small {
    grid-column: 2;
  }

  .s5v-runtime__lower,
  .s5v-surface__bottom {
    grid-template-columns: 1fr;
  }

  .s5v-runtime__packet,
  .s5v-surface__packet {
    display: none;
  }

  .s5v-runtime__bus {
    display: grid;
    grid-template-columns: auto auto;
    gap: 5px 10px;
    padding: 9px 12px;
  }

  .s5v-runtime__bus code {
    grid-column: 1 / -1;
    text-align: center;
  }

  .s5v-arch-map__pipe,
  .s5v-half__pipe {
    flex-direction: column;
    min-height: 0;
  }

  .s5v-arch-map__pipe span,
  .s5v-half__pipe span {
    width: min(100%, 280px);
  }

  .s5v-arch-map__pipe i,
  .s5v-half__pipe > i {
    transform: rotate(90deg);
  }

  .s5v-cascade__pipe {
    flex-direction: column;
  }

  .s5v-cascade__pipe i {
    width: 3px;
    height: 18px;
  }

  .s5v-cascade__pipe span {
    width: min(100%, 260px);
  }

  .s5v-prosody-loss__scene {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .s5v-prosody-loss__gate {
    width: 50px;
    height: 50px;
  }

  .s5v-speech-plan__demo,
  .s5v-speech-plan__controls {
    grid-template-columns: 1fr;
  }

  .s5v-duplex__timeline > div {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .s5v-decision__cards {
    grid-template-columns: 1fr;
  }

  .s5v-decision__cards > div {
    min-height: 74px;
  }

  .s5v-surface__top {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .s5v-surface__top > span {
    justify-self: center;
    width: 130px;
  }

  .s5v-surface__envelopes {
    display: grid;
    gap: 7px;
    text-align: center;
  }

  .s5v-voice-prompt__flow {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .s5v-voice-prompt__flow > em {
    transform: rotate(90deg);
    justify-self: center;
  }

  .s5v-voice-prompt__pack {
    width: 110px;
    justify-self: center;
  }
}

@container s5v (max-width: 440px) {
  .s5v__canvas {
    padding: 17px 13px;
    border-radius: 20px;
  }

  .s5v__steps {
    gap: 6px;
  }

  .s5v__steps button {
    flex: 1 1 auto;
    min-height: 32px;
    padding: 6px 8px;
    font-size: .65rem;
  }

  .s5v-window__scene {
    min-height: 235px;
  }

  .s5v-window__lane {
    grid-template-columns: 72px 1fr;
  }

  .s5v-window__quiet {
    grid-column: 2;
  }

  .s5v-window__result { top: 137px; left: 12px; }
  .s5v-window__queue { top: 137px; left: calc(50% - 33px); }
  .s5v-window__speech { top: 186px; right: 12px; }
  .s5v-window[data-step="2"] .s5v-window__result { left: 12px; top: 186px; }

  .s5v-clocks__row {
    grid-template-columns: 27px 68px minmax(0, 1fr);
  }

  .s5v-clocks__row em {
    grid-column: 2 / -1;
    text-align: left;
  }

  .s5v-latency__rows > div {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .s5v-latency__legend {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .s5v *,
  .s5v *::before,
  .s5v *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
