#agent {
  position: absolute;
  right: 0;
  top: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0);
  width: 28rem;
  height: 40rem;
  margin-top: -20rem;
  margin-right: -4rem;
  opacity: 0;
  transform: scale(0.5);
  border-radius: 0;
  transition: opacity .5s ease, transform .5s ease;
  will-change: opacity, transform;
}

@media screen and (max-width: 1000px) {
  #agent {
    position: relative !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-top: 0 !important;
    margin-right: 0 !important;
  }

  .script-loaded {
    transform: scale(1) translateX(-50%) !important;
  }
}

.script-loaded {
  opacity: 1 !important;
  transform: scale(1) translateY(-100px) !important;
}

#agent>canvas {
  mask-image: linear-gradient(to bottom,
      rgba(0, 0, 0, 1) 80%,
      rgba(0, 0, 0, 0) 90%);
}

#agent .chatbox {
  position: absolute;
  bottom: 5%;
  width: 80%;
  height: 50px;
  left: 50%;
  transform: translateX(-50%);
}

#agent .chatbox .history {
  position: absolute;
  top: 0%;
  width: 100%;
  height: 300px;
  transform: translateY(calc(-100% - 5px));
  color: black;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  mask-image: linear-gradient(to top,
      rgba(0, 0, 0, 1) 80%,
      rgba(0, 0, 0, 0) 95%);
  pointer-events: auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  font-size: 14px;
  gap: 5px;
}

#agent .chatbox .history::before {
  content: '';
  margin-top: auto;
  margin-bottom: 100px;
}


#agent .chatbox .history .me,
#agent .chatbox .history .bot,
#agent .chatbox .history .pending {
  width: fit-content;
  max-width: 80%;
  padding: 6px 12px;
  line-height: 1.25;
  display: inline-block;
  animation: scaleIn 0.25s ease forwards;
  transform-origin: bottom right;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#agent .chatbox .history a {
  color: var(--c-blue);
}

#agent .chatbox .history .pending,
#agent .chatbox .history .bot {
  background-color: white;
  transform-origin: bottom left;
  border-radius: 0px 20px 20px 20px;
}

#agent .chatbox .history .me {
  background-color: var(--c-beige);
  border-radius: 20px 0px 20px 20px;
  align-self: flex-end;
}

.pending {
  font-family: monospace;
}

.pending::after {
  content: "···";
  animation: wave 1.5s infinite linear;
}

@keyframes wave {
  0% {
    content: "\00a0";
  }

  33% {
    content: "·";
  }

  66% {
    content: "··";
  }

  100% {
    content: "···";
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

#agent .chatbox .footer {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}

#agent .chatbox .btn {
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  cursor: pointer;
  background: var(--c-beige);
  position: relative;
  overflow: hidden;
  padding: 0;
  transition: background-color 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#agent .chatbox .btn:disabled {
  opacity: 1;
}

#agent .chatbox .btn:disabled img {
  opacity: 0.5;
}

#agent .chatbox .chat {
  border-radius: 50px;
  height: 50px;
  width: 100%;
  background: white;
  padding: 20px 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#agent .chatbox .chat:disabled {
  background: white;
  opacity: 1;
}

#agent .chatbox .chat::placeholder {
  font-style: italic;
  color: #888;
  opacity: 0.5;
}

#agent .chatbox .chat:focus::placeholder {
  opacity: 0.2;
}

#agent .chatbox .chat button {
  border-radius: 5px;
  height: 50px;
  width: 50px;
  cursor: pointer;
}

#agent img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 15%;
  object-fit: contain;
  box-sizing: border-box;
  transform: scale(1);
  transition: transform 0.2s ease;
}

#agent .hidden {
  transform: scale(0);
}

#agent .recording {
  animation: pulse 1s ease infinite;
  background-color: rgb(255, 93, 93) !important;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}