/* The transparent outer dialog makes room for the robot above its window. */
.cr-assistant-dialog.has-mascot {
  --cr-mascot-perch: 140px;
  --cr-mascot-size: 180px;
  --cr-mascot-left: 24px;
  --cr-mascot-image: url('cr-mascot-perched-sprite.png');
  height: min(950px, calc(100dvh - 20px));
  max-height: calc(100dvh - 20px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.cr-assistant-dialog.has-mascot > .cr-assistant-dialog-frame {
  position: relative;
  height: calc(100% - var(--cr-mascot-perch));
  max-height: none;
  margin-top: var(--cr-mascot-perch);
  border: 1px solid #6679c5;
  border-radius: 25px;
  background: radial-gradient(ellipse at 100% 0, #332b693d, transparent 55%), #0a1229;
  box-shadow: 0 36px 110px #000b, 0 0 65px #6655d52b;
}

.has-mascot > .cr-dialog-mascot {
  position: absolute;
  z-index: 5;
  top: 0;
  left: var(--cr-mascot-left);
  width: var(--cr-mascot-size);
  aspect-ratio: 1;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 8px 10px #02081766);
}

.has-mascot .cr-dialog-mascot-art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background-image: var(--cr-mascot-image);
  background-repeat: no-repeat;
  background-size: 200% 100%;
  background-position: 0 0;
}

/* Only the eye changes, so the seated robot stays completely still. */
.has-mascot .cr-dialog-mascot-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--cr-mascot-image);
  background-repeat: no-repeat;
  background-size: 200% 100%;
  background-position: 100% 0;
  clip-path: polygon(32% 26%, 48% 26%, 48% 36%, 32% 36%);
  opacity: 0;
  animation: cr-mascot-wink 7.4s steps(1, end) infinite;
}

.has-mascot .cr-assistant-dialog-head {
  min-height: 85px;
  padding-left: 190px;
}

.has-mascot .cr-assistant-dialog-head > img,
.has-mascot .cr-assistant-dialog-head > .logo {
  display: none;
}

.has-mascot .cr-assistant-dialog-head > div {
  min-width: 0;
}

.has-mascot #assistantDialogTitle {
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.has-mascot #assistantDialogClose {
  flex-shrink: 0;
}

/* The conversation replaces the introductory card as soon as it starts. */
.has-mascot #chat:has(#messages .bubble) .chat-welcome {
  display: none;
}

@keyframes cr-mascot-wink {
  0%, 97% { opacity: 0; }
  97.3%, 99% { opacity: 1; }
  99.1%, 100% { opacity: 0; }
}

@media (max-width: 600px) {
  .cr-assistant-dialog.has-mascot {
    --cr-mascot-perch: 100px;
    --cr-mascot-size: 140px;
    --cr-mascot-left: 10px;
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .cr-assistant-dialog.has-mascot > .cr-assistant-dialog-frame {
    border-radius: 18px;
  }

  .has-mascot .cr-assistant-dialog-head {
    gap: 8px;
    min-height: 92px;
    padding: 11px 12px 11px 150px;
  }

  .has-mascot #assistantDialogTitle {
    font-size: 15px;
    line-height: 1.3;
  }

  .has-mascot .cr-assistant-dialog-head p {
    font-size: 9px;
    line-height: 1.4;
  }

  .has-mascot .cr-business-summary {
    gap: 5px;
    margin-bottom: 8px;
    padding: 6px 3px;
  }

  .has-mascot .cr-business-summary > div {
    padding-inline: 5px;
  }

  .has-mascot .cr-business-summary dt {
    margin-bottom: 2px;
    font-size: 8px;
  }

  .has-mascot .cr-business-summary dd {
    font-size: 9px;
    line-height: 1.35;
  }

  .has-mascot #chat.active .chat-messages {
    min-height: 40px;
  }
}

/* Landscape and short windows retain the existing scrollable chat body. */
@media (max-height: 620px) {
  .cr-assistant-dialog.has-mascot {
    --cr-mascot-perch: 55px;
    --cr-mascot-size: 80px;
    --cr-mascot-left: 16px;
  }

  .has-mascot .cr-assistant-dialog-head {
    min-height: 65px;
    padding: 10px 16px 10px 108px;
  }

  .has-mascot #assistantDialogTitle {
    font-size: 17px;
  }

  .has-mascot .cr-assistant-dialog-head p {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .has-mascot .cr-dialog-mascot-art::after {
    animation: none;
    opacity: 0;
  }
}
