/* A conversation first; then three distinct surfaces around the same graph. */
.app-frame {
  cursor: zoom-in;
}
.app-capture-dialog {
  width: min(1200px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 1px solid #dce4ef;
  border-radius: 12px;
  background: white;
}
.app-capture-dialog::backdrop {
  background: #17283c7a;
  backdrop-filter: blur(5px);
}
.app-capture-dialog img {
  display: block;
  width: 100%;
}
.app-capture-close {
  position: fixed;
  top: 5vh;
  right: 4vw;
  border: 1px solid #dce4ef;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  background: white;
  cursor: pointer;
  font-size: 23px;
}
.demo-story {
  background: #fff;
  color: #203149;
}
.story-nav {
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(3vw, 24px);
  background: #ffffffec;
  backdrop-filter: blur(18px);
  border-bottom: 1px solid #e9edf3;
}
.story-nav nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 13px;
}
.story-nav .language {
  border: 0;
  background: none;
}
.case-intro {
  min-height: 72svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 70px 24px 80px;
}
.case-intro .eyebrow {
  color: #718096;
  font-size: 11px;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
}
.case-intro h1 {
  max-width: 1100px;
  font: 600 clamp(40px, 5.4vw, 76px) / 1.12 var(--display);
  letter-spacing: -0.045em;
  margin: 0 0 26px;
}
.case-intro > p:not(.eyebrow) {
  max-width: 740px;
  color: #65768b;
  font-size: 18px;
  line-height: 1.8;
  margin: 0;
}
.scroll-cue {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  margin-top: 48px;
  font-size: 12px;
  color: #718096;
}
.scroll-cue > span:last-child {
  font-size: 22px;
}
.case-chapters {
  position: sticky;
  top: 68px;
  z-index: 25;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  background: #fffffff0;
  border-bottom: 1px solid #e9edf3;
  backdrop-filter: blur(18px);
}
.case-chapters a {
  position: relative;
  font-size: 12px;
  padding: 16px 0;
  color: #8996a7;
}
.case-chapters a[aria-current="step"] {
  color: #315eef;
}
.case-chapters a[aria-current="step"]:after {
  content: "";
  position: absolute;
  height: 2px;
  bottom: 0;
  left: 0;
  right: 0;
  background: #315eef;
}
/* The requirement conversation occupies its own full-width first step. */
.foundation-scene {
  max-width: 900px;
  margin: auto;
  min-height: 100svh;
  padding: 80px 24px;
  scroll-margin-top: 140px;
}
.foundation-scene h2 {
  font: 600 clamp(28px, 3.2vw, 44px) / 1.2 var(--display);
  letter-spacing: -0.035em;
  margin: 0 0 16px;
}
.foundation-scene > p:not(.eyebrow) {
  color: #69798d;
  font-size: 15px;
  line-height: 1.7;
}
.foundation-scene .scene-companion-slot {
  margin-top: 32px;
}
/* Independent left dialogue, central viewer, and right application window. */
.case-journey {
  max-width: 1800px;
  padding: 0 3vw;
  margin: 0 auto;
  display: grid;
  grid-template-columns: clamp(220px, 18vw, 270px) minmax(0, 1fr) clamp(180px, 15vw, 230px);
  gap: 20px;
  align-items: start;
}
.case-narrative {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.case-visual {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 140px;
  height: calc(100svh - 168px);
  min-height: 490px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e9f1;
  border-radius: 12px;
  background: #fcfdff;
  box-shadow: 0 20px 70px -48px #27425d60;
}
.case-app-dock {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 206px;
  min-width: 0;
}
.case-app-dock[hidden] {
  display: none;
}
.case-scene {
  min-height: 94svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 0 80px;
  scroll-margin-top: 145px;
  opacity: 0.28;
  transition: opacity 0.25s;
}
.case-scene.is-active {
  opacity: 1;
}
.case-scene h2 {
  font: 600 clamp(25px, 2.3vw, 35px) / 1.22 var(--display);
  letter-spacing: -0.035em;
  margin: 0 0 18px;
}
.case-scene > p:not(.eyebrow) {
  font-size: 14px;
  line-height: 1.8;
  color: #65768b;
  margin: 0 0 22px;
}
.case-scene .eyebrow,
.foundation-scene .eyebrow {
  font-size: 10px;
  color: #7b8aa0;
  letter-spacing: 0.1em;
  margin: 0 0 16px;
}
.scene-surface {
  display: block;
  color: #315eef;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 8px;
  font-size: 10px;
}
.scene-steps {
  list-style: none;
  margin: 0 0 22px;
  padding: 0 0 0 12px;
  border-left: 1px solid #dce4ef;
}
.scene-steps li {
  margin-bottom: 15px;
}
.scene-steps span {
  color: #8695a8;
  font-size: 10px;
}
.scene-steps p {
  font-size: 12px;
  line-height: 1.8;
  margin: 4px 0 0;
  color: #52657e;
}
.scene-action {
  align-self: flex-start;
  border: 0;
  border-bottom: 1px solid #bacbf9;
  background: none;
  color: #315eef;
  padding: 8px 0;
  margin: 0 0 10px;
  font: 500 12px var(--body);
  cursor: pointer;
}
.scene-companion-slot {
  margin-top: 20px;
}
.scene-app-slot:empty {
  display: none;
}
/* Conversation is a small independent window after the flow is confirmed. */
.case-conversation,
.case-application {
  background: #fff;
  border: 1px solid #e2e9f1;
  border-radius: 10px;
  box-shadow: 0 12px 38px -28px #243d6360;
  overflow: hidden;
}
.conversation-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  background: #fff;
  color: #8090a3;
  font: 10px var(--body);
  padding: 13px 14px;
  cursor: pointer;
  text-align: left;
}
.conversation-toggle strong {
  font-size: 12px;
  color: #263c59;
}
.conversation-chevron {
  margin-left: auto;
  font-size: 14px;
}
.is-collapsed .conversation-chevron {
  transform: rotate(-90deg);
}
.is-collapsed .conversation-toggle {
  border-bottom: 0;
}
.conversation-turns {
  padding: 12px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d8e1ed transparent;
}
.conversation-turn {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.75;
}
.conversation-speaker {
  display: block;
  margin: 0 0 4px 3px;
  color: #8492a5;
  font-size: 10px;
}
.conversation-turn.codex .conversation-speaker {
  color: #315eef;
}
.conversation-turn p {
  margin: 0;
  padding: 7px 9px;
  color: #465a75;
}
.conversation-turn.user p {
  background: #f1f5fc;
  border-radius: 0 8px 8px 8px;
}
.conversation-turns[hidden],
.conversation-next[hidden],
.case-application[hidden] {
  display: none;
}
.conversation-next {
  display: block;
  margin: 0 18px 18px auto;
  border: 0;
  border-radius: 20px;
  padding: 10px 19px;
  color: #fff;
  background: #315eef;
  font: 500 12px var(--body);
  cursor: pointer;
}
.foundation-scene .conversation-turns {
  padding: 22px 26px;
  max-height: 660px;
}
.foundation-scene .conversation-turn {
  font-size: 15px;
}
.foundation-scene .conversation-toggle {
  padding: 16px 26px;
}
.foundation-scene .conversation-speaker {
  font-size: 11px;
}
.foundation-scene .conversation-turns:focus-visible {
  outline-offset: -4px;
}
.conversation-flow {
  margin: 15px 0 0;
  border-top: 1px solid #e7edf5;
  padding: 15px 0 0;
}
.conversation-flow figcaption {
  font-size: 12px;
  color: #72839a;
  padding: 0 9px;
}
.conversation-flow svg {
  width: 100%;
  height: auto;
  display: block;
}
.conversation-flow text {
  font: 12px var(--body);
  fill: #526985;
}
.conversation-flow .intent-symbol {
  font: 12px var(--mono);
  fill: #315eef;
}
.conversation-flow .intent-return {
  fill: #aa7748;
  font-size: 10px;
}
.conversation-flow circle {
  fill: #eef3ff;
  stroke: #aabfe8;
  stroke-width: 1.5;
}
.conversation-flow .intent-state circle {
  fill: #f1edf8;
  stroke: #a999c6;
}
.conversation-flow .intent-decision circle {
  fill: #fbf2df;
  stroke: #c7a663;
}
.conversation-flow > p {
  font-size: 11px;
  color: #7d8da1;
  padding: 0 9px;
}
.conversation-flow[data-confirmed="true"] figcaption {
  color: #27846d;
}
/* Application state comes from recorded responses, independently of the chat. */
.app-heading {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #edf0f5;
}
.app-heading strong {
  color: #344c69;
  font-size: 13px;
  font-weight: 500;
}
.app-heading > span {
  color: #8b98aa;
  font-size: 9px;
}
.case-application button {
  border: 0;
  background: none;
  color: #486b9c;
  font: 11px var(--body);
  cursor: pointer;
  padding: 4px 0;
}
.app-minimize {
  margin-left: auto;
}
.app-frame {
  display: block;
  width: 100%;
  height: auto;
  background: #f8fafc;
}
.app-frame[hidden],
.app-frame-empty[hidden] {
  display: none;
}
.app-frame-empty {
  padding: 30px 16px;
  color: #8796aa;
  font-size: 12px;
}
.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
}
.case-application > .app-status {
  margin: 0;
  padding: 0 14px 12px;
  line-height: 1.6;
}
.case-application > .app-restart {
  margin: 0 14px 14px;
}
.case-application.is-collapsed > :not(.app-heading) {
  display: none;
}
.app-status {
  color: #7c8da1;
  font-size: 10px;
  flex-basis: 100%;
}

.case-application .app-restart {
  margin-left: auto;
  font-size: 18px;
}
.case-application button:disabled {
  color: #a0acba;
  cursor: default;
}
.case-application[data-status="stale_review"] .app-status {
  color: #ad663d;
}
/* Graph controls and replay transport never overlap the graph itself. */
.case-view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e9eef5;
  background: #fff;
  flex-shrink: 0;
  font-size: 11px;
}
.case-view-heading > div {
  display: flex;
  align-items: center;
  gap: 7px;
}
.case-view-heading strong {
  font-size: 12px;
}
#case-view-name {
  color: #8191a6;
}
.view-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #315eef;
  box-shadow: 0 0 0 3px #315eef10;
}
.case-mode button,
.case-lenses button {
  font: 10px var(--body);
  background: none;
  border: 0;
  padding: 5px 7px;
  color: #8290a4;
  cursor: pointer;
  border-radius: 4px;
}
.case-mode button[aria-pressed="true"],
.case-lenses button[aria-pressed="true"] {
  background: #edf2ff;
  color: #315eef;
}
#case-interact {
  color: #315eef;
}
.case-lenses {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #fff;
  border-bottom: 1px solid #edf1f6;
  flex-shrink: 0;
}
.case-canvas {
  position: relative;
  flex: 1;
  min-height: 200px;
}
#case-graph {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fcfdff;
  pointer-events: none;
}
.case-visual.is-interacting #case-graph {
  pointer-events: auto;
}
#case-gestures {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 9px;
  color: #8c99aa;
  pointer-events: none;
}
.case-telemetry {
  position: absolute;
  bottom: 12px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  font: 9px/1.6 var(--mono);
  color: #7d8ca1;
}
.case-telemetry:empty {
  display: none;
}
.case-telemetry > span {
  background: #ffffffeb;
  border: 1px solid #e9eef5;
  border-radius: 4px;
  padding: 6px 8px;
}
.case-telemetry strong {
  color: #315eef;
  margin-left: 5px;
}
.case-telemetry .mismatch strong {
  color: #b27448;
}
.case-playback {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 43px;
  padding: 0 14px;
  border-top: 1px solid #e9edf3;
  background: #fff;
  flex-shrink: 0;
}
.case-playback[hidden] {
  display: none;
}
.case-playback button {
  border: 0;
  background: none;
  color: #315eef;
  font-size: 13px;
  padding: 6px;
  cursor: pointer;
}
.case-playback input {
  width: 130px;
  height: 2px;
  accent-color: #315eef;
}
#case-step {
  font: 9px var(--mono);
  color: #8c99aa;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.watch-options {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.watch-options legend {
  color: #8b99ab;
  font-size: 10px;
  margin-bottom: 12px;
}
.watch-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #516681;
  cursor: pointer;
}
.watch-options input {
  accent-color: #315eef;
}
.watch-name {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid #dbe4f0;
  background: none;
  font: 12px var(--body);
  margin-bottom: 10px;
}
.watch-save {
  align-self: flex-start;
  font: 12px var(--body);
  border: 0;
  border-radius: 5px;
  background: #315eef;
  color: #fff;
  padding: 9px 13px;
  margin-bottom: 12px;
  cursor: pointer;
}
.source-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  color: #6882a2;
  font: 10px/1.8 var(--mono);
}
.scene-check {
  color: #258b76;
  border-left: 2px solid #258b76;
  padding-left: 10px;
  font-size: 11px;
  line-height: 1.8;
  margin-bottom: 18px;
}
.rule-change {
  border-top: 1px solid #dfe7f1;
  padding: 14px 0;
  color: #4e6c92;
  font-size: 12px;
  line-height: 1.8;
}
.case-end {
  min-height: 55svh;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.case-end h2 {
  font: 600 clamp(30px, 4vw, 52px) / 1.2 var(--display);
  letter-spacing: -0.035em;
  margin: 0 0 28px;
}
.case-end .button {
  border-radius: 24px;
  padding: 12px 28px;
  font-size: 14px;
}
.case-footer {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 26px;
  font-size: 11px;
  color: #8795a7;
  padding: 30px 20px 50px;
  border-top: 1px solid #e9eef4;
}
.case-footer details {
  max-width: 310px;
}
.case-footer summary {
  cursor: pointer;
}
.case-footer p {
  line-height: 1.7;
}
.demo-story :focus-visible {
  outline: 2px solid #315eef;
  outline-offset: 4px;
}
.demo-story button:active {
  transform: scale(0.98);
}
@media (max-width: 1150px) {
  .case-journey {
    gap: 14px;
    padding: 0 20px;
    grid-template-columns: 210px minmax(0, 1fr) 170px;
  }
  #case-view-name {
    display: none;
  }
  .case-view-heading {
    padding: 9px;
  }
  .case-mode {
    gap: 1px !important;
  }
  .case-mode button {
    padding: 5px;
  }
  .app-heading {
    padding: 12px;
  }
  .app-heading > span {
    flex-basis: 100%;
  }
}
@media (max-width: 900px) {
  .story-nav {
    height: 56px;
    padding: 0 20px;
  }
  .case-chapters {
    top: 56px;
    height: 44px;
    gap: 18px;
  }
  .case-chapters a {
    font-size: 11px;
    padding: 13px 0;
  }
  .case-intro {
    min-height: 70svh;
  }
  .case-intro h1 {
    font-size: 40px;
    max-width: 540px;
  }
  .case-intro > p:not(.eyebrow) {
    font-size: 15px;
    max-width: 540px;
  }
  .foundation-scene {
    padding: 55px 20px;
    scroll-margin-top: 115px;
  }
  .foundation-scene h2 {
    font-size: 30px;
  }
  .foundation-scene .conversation-turns {
    padding: 18px 14px;
    max-height: 620px;
  }
  .foundation-scene .conversation-turn {
    font-size: 13px;
  }
  .case-journey {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 15px;
  }
  .case-visual {
    order: 0;
    width: 100%;
    height: 42svh;
    min-height: 300px;
    max-height: 450px;
    top: 110px;
    z-index: 10;
    border-radius: 9px;
  }
  .case-narrative {
    order: 1;
    width: 100%;
  }
  .case-scene {
    min-height: 94svh;
    padding: 44svh 12px 65px;
    scroll-margin-top: 110px;
  }
  .case-scene:first-child {
    padding-top: 45px;
  }
  .case-scene h2 {
    max-width: 600px;
    font-size: 29px;
  }
  .scene-steps p {
    font-size: 13px;
  }
  .scene-app-slot {
    margin-top: 20px;
  }
  .case-conversation {
    width: 100%;
  }
  .conversation-turns {
    max-height: 260px;
  }
  .case-application {
    margin-bottom: 20px;
  }
  .app-heading > span {
    flex-basis: auto;
  }
  .app-heading {
    padding: 14px;
  }
  .app-status {
    flex-basis: auto;
    margin-right: auto;
  }
  .case-view-heading {
    padding: 9px 10px;
  }
  .case-mode button,
  .case-lenses button {
    font-size: 9px;
  }
  #case-interact {
    display: none;
  }
  .case-lenses {
    padding: 5px 9px;
  }
  .case-telemetry {
    font-size: 8px;
    gap: 3px;
    bottom: 7px;
  }
  .case-telemetry > span {
    padding: 4px 5px;
  }
  .case-playback {
    height: 35px;
  }
  .case-playback input {
    width: 95px;
  }
  .conversation-flow text {
    font-size: 14px;
  }
  .conversation-flow .intent-return {
    font-size: 12px;
  }
  .case-footer {
    flex-wrap: wrap;
    gap: 18px;
  }
  #case-gestures {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .case-scene {
    transition: none;
    opacity: 1;
  }
  .demo-story button:active {
    transform: none;
  }
}

/* The editor floats beside the graph; its controls never resize a chapter. */
.view-editor {
  position: fixed;
  inset: auto auto 24px 24px;
  margin: 0;
  width: min(320px, calc(100vw - 48px));
  max-height: calc(100svh - 48px);
  padding: 24px;
  overflow: auto;
  border: 1px solid #dce4df;
  border-radius: 8px;
  background: #fff;
  color: #18332f;
  box-shadow: 0 12px 48px #18332f20;
}
.view-editor::backdrop {
  background: #18332f12;
}
.case-scene .view-editor h2 {
  margin: 0 28px 24px 0;
  font-size: 18px;
}
.view-editor-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #65776e;
  font-size: 23px;
  cursor: pointer;
}
.view-editor-trigger {
  display: block;
  margin-top: 14px;
}
