.gpt-convo {
  --crawl-perspective: 400px;
  --crawl-tilt: 25deg;
  --crawl-opacity-floor: 0.15;
  --crawl-falloff: 0.2;
  --crawl-fade: 42%;

  --crawl-yellow: #ffe81f;
  --scrim: oklch(7% 0.02 270 / 0.93);

  position: fixed;
  inset: var(--vv-top, 0px) 0 var(--kb-inset, 0px) 0;
  z-index: 1000;
}

.gpt-convo[hidden] {
  display: none;
}


.gpt-convo__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--duration-slow, 0.4s) var(--ease-out, ease-out);
}

.gpt-convo.is-open .gpt-convo__scrim {
  opacity: 1;
}


.gpt-convo__stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--duration-slow, 0.4s) var(--ease-out, ease-out);
  pointer-events: none;
}

.gpt-convo.is-open .gpt-convo__stars {
  opacity: 1;
}


.gpt-convo__stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr;
  padding: 5.5rem 1.25rem var(--crawl-bottom-clear, 13rem);
  pointer-events: none;
}

.gpt-convo__stage > * {
  pointer-events: auto;
}

.gpt-convo__close,
.gpt-convo__koffie {
  position: absolute;
  top: 1.1rem;
  opacity: 0;
  transition: opacity var(--duration-slow, 0.4s) var(--ease-out, ease-out);
}

.gpt-convo.is-open .gpt-convo__close,
.gpt-convo.is-open .gpt-convo__koffie {
  opacity: 1;
}

.gpt-convo__koffie {
  right: 4.75rem;
  text-decoration: none;
}

.gpt-convo__close {
  right: 1.25rem;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid oklch(100% 0 0 / 0.16);
  border-radius: 50%;
  background: oklch(100% 0 0 / 0.06);
  color: var(--color-text, #fff);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--duration-fast, 0.2s) var(--ease-out, ease-out),
              opacity var(--duration-slow, 0.4s) var(--ease-out, ease-out);
}

.gpt-convo__close:hover {
  background: oklch(100% 0 0 / 0.14);
}


.gpt-crawl {
  perspective: var(--crawl-perspective);
  height: 100%;
  width: 100%;
  max-width: min(66rem, calc(100vw - 3rem));
  margin-inline: auto;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 var(--crawl-fade));
  mask-image: linear-gradient(to bottom, transparent 0%, #000 var(--crawl-fade));
}

.gpt-crawl__list {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: flex-end;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: rotateX(var(--crawl-tilt));
  transform-origin: 50% 100%;
}

.gpt-msg {
  --f: calc(1 / (1 + var(--crawl-falloff) * var(--depth, 0)));

  width: 100%;
  opacity: calc(var(--crawl-opacity-floor) + (1 - var(--crawl-opacity-floor)) * var(--f));
  transition: opacity var(--duration-slow, 0.4s) var(--ease-out, ease-out);
}

.gpt-msg__body {
  display: inline-block;
  max-width: 75%;
  color: var(--crawl-yellow);
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  line-height: 1.35;
  text-wrap: pretty;
}

.gpt-msg--user {
  text-align: right;
}

.gpt-msg--user .gpt-msg__body {
  font-weight: 700;
}

.gpt-msg--bot {
  text-align: left;
}

.gpt-msg--bot .gpt-msg__body {
  font-weight: 400;
}

@keyframes gpt-msg-in {
  from {
    opacity: 0;
    transform: translateY(1.6rem) scale(0.96);
  }
}

.gpt-msg.is-new {
  animation: gpt-msg-in var(--duration-slow, 0.45s) var(--ease-out, ease-out) 1;
}


.floating-cta[data-open="true"] {
  z-index: 1001;
  width: min(52rem, calc(100vw - 1.5rem));
  border-radius: var(--radius-lg);
}


@media (prefers-reduced-motion: reduce) {
  .gpt-crawl__list {
    transform: none;
  }

  .gpt-crawl {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .gpt-msg {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .gpt-msg.is-new {
    animation: none;
  }

  .gpt-convo__scrim,
  .floating-cta__input {
    transition: none;
  }
}

@media (max-width: 40rem) {
  .gpt-convo__stage {
    padding-top: 4.5rem;
    padding-inline: 0.9rem;
  }

  .gpt-msg__body {
    max-width: 88%;
  }

  :root.kb-open .gpt-crawl {
    --crawl-fade: 18%;
  }

  .gpt-convo__koffie {
    right: auto;
    left: 0.9rem;
  }
}
