.demo-screen {
  container-type: inline-size;
}

.demo-scene {
  position: absolute;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 420ms ease, visibility 0s linear 420ms;
}

.demo-scene[data-active="true"] {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.demo-capture {
  display: block;
  width: 100%;
  height: 100%;
}

.demo-chat::after {
  position: absolute;
  inset: 82% 0 11%;
  background: #fafafa;
  content: "";
}

.demo-messages {
  position: absolute;
  inset: 49% 5% auto;
  color: #151520;
  font-size: 4.3cqw;
  line-height: 1.25;
}

.demo-messages p {
  margin: 0;
}

.demo-messages > .demo-request {
  box-sizing: border-box;
  width: fit-content;
  max-width: 88%;
  margin-inline-start: auto;
  padding: 2.8cqw 3.5cqw;
  border-radius: 4.2cqw 4.2cqw 1.2cqw 4.2cqw;
  color: #fff;
  background: var(--blue);
  font-weight: 550;
}

.demo-answer,
.demo-typing {
  margin-block-start: 4.2cqw;
}

.demo-answer > p {
  margin-block-end: 2.6cqw;
  font-weight: 550;
}

.demo-event {
  display: flex;
  align-items: center;
  gap: 3.2cqw;
  min-height: 10cqw;
  padding: 0.7cqw 3cqw;
  border: 1px solid #e8e8ef;
  border-inline-start: 0.8cqw solid var(--blue);
  border-radius: 2.7cqw;
  background: #fff;
  font-size: 3.8cqw;
}

.demo-event + .demo-event {
  margin-block-start: 1.6cqw;
}

.demo-event time {
  flex: 0 0 16cqw;
  color: #4d4d64;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.demo-event strong {
  font-weight: 650;
}

.demo-typing {
  position: absolute;
  display: none;
  align-items: center;
  gap: 1.2cqw;
  padding: 3.1cqw;
  border-radius: 4cqw;
  background: #eeeef3;
}

.demo-typing i {
  width: 1.35cqw;
  height: 1.35cqw;
  border-radius: 50%;
  background: #5c5a73;
}

@media (prefers-reduced-motion: no-preference) {
  .demo-chat[data-motion="true"] .demo-request {
    animation: demo-message-in 350ms 410ms both;
  }

  .demo-chat[data-motion="true"] .demo-typing {
    display: flex;
    animation: demo-typing-in 1420ms 820ms both;
  }

  .demo-chat[data-motion="true"] .demo-typing i {
    animation: demo-dot 650ms 860ms ease-in-out 2 both;
  }

  .demo-chat[data-motion="true"] .demo-typing i:nth-child(2) {
    animation-delay: 970ms;
  }

  .demo-chat[data-motion="true"] .demo-typing i:nth-child(3) {
    animation-delay: 1080ms;
  }

  .demo-chat[data-motion="true"] .demo-answer > p {
    animation: demo-message-in 400ms 2170ms both;
  }

  .demo-chat[data-motion="true"] .demo-event {
    animation: demo-message-in 400ms 2460ms both;
  }

  .demo-chat[data-motion="true"] .demo-event + .demo-event {
    animation-delay: 2680ms;
  }

  .demo[data-suspended="true"] .demo-chat[data-motion="true"] * {
    animation-play-state: paused;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-scene {
    transition: none;
  }
}

@keyframes demo-message-in {
  from {
    opacity: 0;
    transform: translateY(2.2cqw);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes demo-typing-in {
  0%, 100% {
    opacity: 0;
  }

  12%, 86% {
    opacity: 1;
  }
}

@keyframes demo-dot {
  0%, 100% {
    opacity: 0.45;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-0.8cqw);
  }
}
