.arw-root {
  --arw-primary: #2563eb;
  --arw-secondary: #64748b;
  --arw-surface: #ffffff;
  --arw-text: #172033;
  --arw-muted: #6b7280;
  --arw-radius: 22px;
  --arw-font: Inter, sans-serif;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10050;
  font-family: var(--arw-font);
}

.arw-launcher {
  border: 0;
  min-width: 190px;
  height: 58px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--arw-primary), color-mix(in srgb, var(--arw-primary) 72%, #111827));
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24), 0 0 0 8px color-mix(in srgb, var(--arw-primary) 12%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  transform-origin: bottom right;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  will-change: transform;
}

.arw-launcher::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--arw-primary) 20%, transparent);
  opacity: 0.34;
  transform: scale(0.96);
  z-index: -1;
  animation: arw-launcher-glow 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: opacity, transform;
}

.arw-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  filter: saturate(1.05);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.3), 0 0 0 10px color-mix(in srgb, var(--arw-primary) 14%, transparent);
}

.arw-launcher:hover::before {
  animation-play-state: paused;
  opacity: 0.46;
  transform: scale(1.03);
}

@keyframes arw-launcher-glow {
  0% {
    opacity: 0.18;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.42;
    transform: scale(1.04);
  }
  100% {
    opacity: 0.18;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arw-launcher::before {
    animation: none;
  }
}

.arw-launcher-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.arw-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 118px));
  border-radius: var(--arw-radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--arw-text);
  border: 1px solid rgba(226, 232, 240, 0.92);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
}

.arw-root.is-open .arw-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.arw-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--arw-primary) 10%, #fff), #fff);
  border-bottom: 1px solid rgba(226, 232, 240, 0.84);
}

.arw-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--arw-primary) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--arw-primary) 20%, #fff);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.arw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.arw-title {
  flex: 1;
  min-width: 0;
}

.arw-title strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arw-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--arw-muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.arw-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.arw-minimize {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--arw-text);
  cursor: pointer;
}

.arw-messages {
  padding: 18px 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--arw-primary) 9%, transparent), transparent 32%),
    #f8fafc;
}

.arw-message {
  max-width: 86%;
  border-radius: 18px;
  padding: 11px 13px;
  font-size: 0.9rem;
  line-height: 1.42;
  white-space: normal;
  animation: arwBubbleIn 160ms ease both;
}

.arw-message.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.arw-message.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, var(--arw-primary), color-mix(in srgb, var(--arw-primary) 78%, #111827));
}

.arw-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--arw-muted);
}

.arw-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--arw-primary) 72%, #94a3b8);
  animation: arwTypingPulse 950ms ease-in-out infinite;
}

.arw-typing-dot:nth-child(2) {
  animation-delay: 140ms;
}

.arw-typing-dot:nth-child(3) {
  animation-delay: 280ms;
}

.arw-typing-label {
  margin-left: 4px;
  font-size: 0.78rem;
  font-weight: 800;
}

.arw-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 15px 12px;
  background: #f8fafc;
}

.arw-chip {
  border: 1px solid color-mix(in srgb, var(--arw-primary) 25%, #e2e8f0);
  color: color-mix(in srgb, var(--arw-primary) 82%, #111827);
  background: #fff;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.arw-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 13px;
  border-top: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.96);
}

.arw-input {
  border: 1.5px solid #dbe4f0;
  border-radius: 16px;
  padding: 12px 13px;
  outline: 0;
  min-width: 0;
  color: var(--arw-text);
  background: #fff;
}

.arw-input:focus {
  border-color: var(--arw-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--arw-primary) 13%, transparent);
}

.arw-send {
  border: 0;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  color: #fff;
  background: var(--arw-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.arw-send:disabled {
  opacity: 0.58;
  cursor: wait;
}

.arw-guide-highlight {
  position: relative;
  z-index: 2;
  outline: 3px solid color-mix(in srgb, var(--arw-primary, #2563eb) 82%, #fff) !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--arw-primary, #2563eb) 14%, transparent) !important;
  animation: arwGuidePulse 900ms ease-in-out infinite alternate;
}

.arw-guide-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 10049;
  max-width: min(520px, calc(100vw - 28px));
  transform: translate(-50%, 14px);
  opacity: 0;
  border-radius: 18px;
  padding: 12px 16px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
  font-family: var(--arw-font, Inter, sans-serif);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.arw-guide-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes arwBubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes arwTypingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes arwGuidePulse {
  from {
    filter: saturate(1);
  }
  to {
    filter: saturate(1.18);
  }
}

@media (max-width: 640px) {
  .arw-root {
    right: 14px;
    bottom: 14px;
  }

  .arw-launcher {
    min-width: 58px;
    width: 58px;
    padding: 0;
  }

  .arw-launcher-text {
    display: none;
  }

  .arw-panel {
    bottom: 72px;
    height: min(620px, calc(100vh - 94px));
  }
}
