#uaa-root,
#uaa-root * {
  box-sizing: border-box;
}

#uaa-root[hidden],
#uaa-root [hidden] {
  display: none !important;
}

.uaa-root {
  --uaa-user-level: 0;
  --uaa-ai-level: 0;
  position: fixed;
  z-index: 2147482000;
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #171822;
  text-align: start;
  isolation: isolate;
}

.uaa-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--uaa-button-text);
  background: linear-gradient(140deg, var(--uaa-brand), var(--uaa-brand-2));
  box-shadow: 0 14px 38px rgba(27, 24, 68, .27), 0 4px 12px rgba(27, 24, 68, .2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px) scale(.88);
  pointer-events: none;
  transition: opacity .25s ease, transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.uaa-launcher.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.uaa-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 44px rgba(27, 24, 68, .32), 0 5px 14px rgba(27, 24, 68, .2);
}

.uaa-launcher:focus-visible,
.uaa-header-action:focus-visible,
.uaa-send:focus-visible,
.uaa-control:focus-visible,
.uaa-voice-close:focus-visible {
  outline: 3px solid rgba(33, 212, 253, .8);
  outline-offset: 3px;
}

.uaa-chat-icon {
  width: 31px;
  height: 31px;
  fill: currentColor;
}

.uaa-launcher-image {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.uaa-launcher-pulse {
  position: absolute;
  inset: -5px;
  z-index: -1;
  border: 2px solid var(--uaa-brand-2);
  border-radius: inherit;
  opacity: 0;
  animation: uaa-launcher-pulse 2.5s ease-out infinite;
}

.is-chat-open > .uaa-launcher,
.is-voice-open > .uaa-launcher {
  opacity: 0;
  transform: scale(.75);
  pointer-events: none;
}

.uaa-chat-panel {
  position: absolute;
  bottom: 78px;
  width: min(var(--uaa-panel-width), calc(100vw - 28px));
  height: min(620px, calc(100vh - 125px));
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(25, 26, 39, .1);
  border-radius: 24px;
  background: var(--uaa-panel);
  box-shadow: 0 28px 80px rgba(16, 17, 31, .24), 0 5px 18px rgba(16, 17, 31, .1);
  opacity: 0;
  transform: translateY(18px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2, .8, .2, 1);
}

.uaa-position-right .uaa-chat-panel {
  right: 0;
}

.uaa-position-left .uaa-chat-panel {
  left: 0;
  transform-origin: bottom left;
}

.uaa-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.uaa-chat-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 76px;
  padding: 13px 16px;
  color: var(--uaa-button-text);
  background: linear-gradient(130deg, var(--uaa-brand), var(--uaa-brand-2));
}

.uaa-chat-header::after {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: rgba(255, 255, 255, .22);
  content: "";
}

.uaa-header-avatar {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}

.uaa-header-avatar span {
  width: 23px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.uaa-header-avatar span::before,
.uaa-header-avatar span::after {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 5px 2px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.uaa-header-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.uaa-header-copy strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uaa-header-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: rgba(255, 255, 255, .86);
  font-size: 11px;
}

.uaa-header-copy i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #56e59a;
  box-shadow: 0 0 0 3px rgba(86, 229, 154, .18);
}

.uaa-header-action {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: inherit;
  background: rgba(255, 255, 255, .12);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s ease;
}

.uaa-header-action:hover {
  background: rgba(255, 255, 255, .23);
}

.uaa-header-action svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.uaa-messages {
  position: absolute;
  inset: 76px 0 74px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 15px 26px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(0, 0, 0, .18) transparent;
  scrollbar-width: thin;
}

.uaa-message {
  display: flex;
  width: 100%;
  animation: uaa-message-in .2s ease both;
}

.uaa-message.is-user {
  justify-content: flex-start;
}

.uaa-message.is-assistant {
  justify-content: flex-end;
}

.uaa-bubble {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 17px;
  box-shadow: 0 1px 2px rgba(20, 21, 34, .07);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.is-assistant .uaa-bubble {
  border: 1px solid rgba(23, 24, 34, .06);
  border-bottom-right-radius: 5px;
  color: var(--uaa-assistant-text);
  background: var(--uaa-assistant-bg);
}

.is-user .uaa-bubble {
  border-bottom-left-radius: 5px;
  color: var(--uaa-user-text);
  background: var(--uaa-user-bg);
}

.uaa-channel-badge {
  align-self: flex-start;
  margin-bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  color: currentColor;
  background: rgba(127, 127, 127, .13);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .01em;
}

.uaa-typing {
  position: absolute;
  right: 18px;
  bottom: 69px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
  padding: 5px 9px;
  border-radius: 999px;
  color: #696b79;
  background: var(--uaa-panel);
  box-shadow: 0 3px 14px rgba(20, 21, 34, .08);
  font-size: 10px;
}

.uaa-typing span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--uaa-brand);
  animation: uaa-dot 1s ease-in-out infinite;
}

.uaa-typing span:nth-child(2) { animation-delay: .13s; }
.uaa-typing span:nth-child(3) { animation-delay: .26s; }
.uaa-typing em { margin-right: 4px; font-style: normal; }

.uaa-chat-form {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 74px;
  padding: 11px 12px;
  border-top: 1px solid rgba(23, 24, 34, .08);
  background: var(--uaa-panel);
}

.uaa-chat-form textarea {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 46px;
  max-height: 110px;
  margin: 0;
  padding: 12px 13px;
  resize: none;
  border: 1px solid rgba(23, 24, 34, .13);
  border-radius: 15px;
  outline: none;
  color: #171822;
  background: #f8f8fb;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.uaa-chat-form textarea:focus {
  border-color: var(--uaa-brand-2);
  box-shadow: 0 0 0 3px rgba(91, 75, 219, .1);
}

.uaa-send {
  display: grid;
  flex: 0 0 45px;
  place-items: center;
  width: 45px;
  height: 45px;
  margin: 0 0 1px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: var(--uaa-button-text);
  background: linear-gradient(140deg, var(--uaa-brand), var(--uaa-brand-2));
  cursor: pointer;
  transition: opacity .16s ease, transform .16s ease;
}

.uaa-send:hover { transform: translateY(-1px); }
.is-busy .uaa-send { opacity: .5; pointer-events: none; }
.uaa-send svg { width: 21px; height: 21px; fill: currentColor; transform: rotate(180deg); }

.uaa-chat-error {
  position: absolute;
  inset: auto 10px 77px;
  z-index: 3;
  padding: 8px 11px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  background: #fff1f2;
  box-shadow: 0 6px 20px rgba(127, 29, 29, .12);
  font-size: 12px;
}

.uaa-voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  color: #fff;
  background: color-mix(in srgb, var(--uaa-overlay) var(--uaa-overlay-alpha), transparent);
  opacity: 0;
  backdrop-filter: blur(var(--uaa-overlay-blur));
  -webkit-backdrop-filter: blur(var(--uaa-overlay-blur));
  transition: opacity .25s ease;
}

@supports not (background: color-mix(in srgb, #000 80%, transparent)) {
  .uaa-voice-overlay { background: rgba(8, 8, 22, .86); }
}

.uaa-voice-overlay.is-open { opacity: 1; }

.uaa-voice-close {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font: 300 30px/1 sans-serif;
  cursor: pointer;
}

.uaa-voice-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  padding: 70px 24px max(38px, env(safe-area-inset-bottom));
}

.uaa-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--uaa-orb-size);
  height: var(--uaa-orb-size);
  margin-bottom: 42px;
  border-radius: 50%;
  transform: scale(calc(1 + var(--uaa-ai-level) * .09));
  transition: transform .12s linear;
}

.uaa-orb::before {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--uaa-voice-primary), var(--uaa-voice-secondary), #bd63ff, var(--uaa-voice-primary));
  box-shadow: 0 0 70px color-mix(in srgb, var(--uaa-voice-primary) 55%, transparent), inset 0 0 30px rgba(255, 255, 255, .25);
  content: "";
  animation: uaa-orb-rotate 9s linear infinite;
}

.uaa-orb::after {
  position: absolute;
  inset: 19%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .75), rgba(255, 255, 255, .08) 28%, rgba(10, 9, 35, .65) 70%);
  content: "";
}

.uaa-halo {
  position: absolute;
  inset: -8%;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  opacity: calc(.22 + var(--uaa-user-level) * .6);
  transform: scale(calc(1 + var(--uaa-user-level) * .16));
  transition: transform .08s linear, opacity .08s linear;
}

.uaa-halo-two {
  inset: -18%;
  border-color: color-mix(in srgb, var(--uaa-voice-secondary) 40%, transparent);
  opacity: calc(.1 + var(--uaa-ai-level) * .45);
  transform: scale(calc(1 + var(--uaa-ai-level) * .12));
}

.uaa-orb-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40%;
  height: 40%;
}

.uaa-wave {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 46px;
}

.uaa-wave i {
  width: 4px;
  height: 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, .5);
  animation: uaa-wave .9s ease-in-out infinite alternate;
  animation-play-state: paused;
}

.voice-listening .uaa-wave i,
.voice-speaking .uaa-wave i,
.voice-thinking .uaa-wave i { animation-play-state: running; }
.uaa-wave i:nth-child(2) { height: 24px; animation-delay: -.25s; }
.uaa-wave i:nth-child(3) { height: 35px; animation-delay: -.45s; }
.uaa-wave i:nth-child(4) { height: 22px; animation-delay: -.15s; }
.uaa-wave i:nth-child(5) { animation-delay: -.35s; }

.uaa-voice-status {
  min-height: 32px;
  margin: 0 0 13px;
  color: #fff;
  font-size: clamp(18px, 3vw, 23px);
  font-weight: 600;
  letter-spacing: -.015em;
  text-align: center;
}

.uaa-level {
  width: min(210px, 55vw);
  height: 3px;
  overflow: hidden;
  margin-bottom: 20px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
}

.uaa-level span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--uaa-voice-primary), var(--uaa-voice-secondary));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .07s linear;
}

.uaa-consent {
  max-width: 520px;
  margin: 0 0 26px;
  color: rgba(255, 255, 255, .64);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.uaa-voice-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.uaa-control {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.uaa-control:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .17); }
.uaa-control svg { width: 25px; height: 25px; fill: currentColor; }
.is-muted .uaa-mute { color: #ffb4b4; background: rgba(190, 39, 56, .28); }

.uaa-stop {
  width: 68px;
  height: 68px;
  border-color: rgba(255, 255, 255, .28);
  background: linear-gradient(145deg, #ee4d67, #c62443);
}

.uaa-stop span {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  background: #fff;
}

.voice-error .uaa-orb { filter: grayscale(.65); }
.voice-connecting .uaa-orb::before { animation-duration: 3s; }
.voice-speaking .uaa-orb::before { animation-duration: 4s; }

.uaa-inline-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #5b4bdb;
  cursor: pointer;
}

#uaa-root .screen-reader-text {
  position: absolute !important;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

html.uaa-dialog-open,
html.uaa-dialog-open body {
  overflow: hidden !important;
}

@keyframes uaa-launcher-pulse {
  0% { opacity: .55; transform: scale(.92); }
  70%, 100% { opacity: 0; transform: scale(1.28); }
}

@keyframes uaa-message-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes uaa-dot {
  0%, 70%, 100% { transform: translateY(0); opacity: .45; }
  35% { transform: translateY(-3px); opacity: 1; }
}

@keyframes uaa-orb-rotate {
  to { transform: rotate(360deg); }
}

@keyframes uaa-wave {
  to { transform: scaleY(.35); opacity: .6; }
}

@media (max-width: 520px) {
  .uaa-root {
    right: 14px !important;
    left: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .uaa-chat-panel {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px !important;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px !important;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 20px;
    transform-origin: bottom center;
  }

  .uaa-chat-header { min-height: 70px; padding: 10px 12px; }
  .uaa-messages { inset: 70px 0 72px; }
  .uaa-bubble { max-width: 88%; }
  .uaa-orb { width: min(var(--uaa-orb-size), 65vw); height: min(var(--uaa-orb-size), 65vw); margin-bottom: 32px; }
  .uaa-consent { max-width: 86vw; }
}

@media (prefers-reduced-motion: reduce) {
  #uaa-root *, #uaa-root *::before, #uaa-root *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
