.fc-chat-widget {
  --chat-accent: var(--accent, #ffbd39);
  --chat-accent-glow: var(--accent-glow, rgba(255, 189, 57, .25));
  --chat-border: var(--border, #e8eaed);
  --chat-surface: var(--surface, #fff);
  --chat-surface-2: var(--surface-2, #f8f9fa);
  --chat-surface-3: var(--surface-3, #f1f3f4);
  --chat-text: var(--text-1, #202124);
  --chat-muted: var(--text-2, #5f6368);
  --chat-on-accent: #101010;
  font-family: 'Poppins', Arial, sans-serif;
}

body.dark .fc-chat-widget {
  --chat-on-accent: #080808;
}

.fc-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10010;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  background: var(--chat-accent);
  color: var(--chat-on-accent);
  box-shadow: 0 12px 32px var(--chat-accent-glow);
  box-shadow: 0 12px 32px var(--chat-accent-glow), 0 0 0 5px color-mix(in srgb, var(--chat-accent) 22%, transparent);
  cursor: pointer;
  font-size: 24px;
  transition: transform .2s ease, background .3s ease, color .3s ease;
  animation: fc-chat-dance 5s ease-in-out 1.2s infinite;
}

.fc-chat-launcher::before {
  content: '';
  position: absolute;
  inset: -8px;
  z-index: -1;
  border: 2px solid var(--chat-accent);
  border-radius: 50%;
  opacity: 0;
  animation: fc-chat-pulse 2.4s ease-out infinite;
}

.fc-chat-launcher:hover { transform: translateY(-3px) scale(1.07); animation-play-state: paused; }
.fc-chat-widget.has-engaged .fc-chat-launcher { animation: none; }
.fc-chat-widget.has-engaged .fc-chat-launcher::before { animation: none; }

.fc-chat-invite {
  position: fixed;
  right: 96px;
  bottom: 29px;
  z-index: 10010;
  min-width: 154px;
  padding: 10px 14px;
  border: 1px solid var(--chat-border);
  border-radius: 14px 14px 4px 14px;
  background: var(--chat-surface);
  color: var(--chat-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
  pointer-events: none;
  animation: fc-chat-invite 5s ease-in-out 1.2s infinite;
}
.fc-chat-invite strong,
.fc-chat-invite span { display: block; white-space: nowrap; }
.fc-chat-invite strong { font-size: 13px; line-height: 1.35; }
.fc-chat-invite span { color: var(--chat-muted); font-size: 11px; line-height: 1.5; }
.fc-chat-widget.is-open .fc-chat-invite,
.fc-chat-widget.has-engaged .fc-chat-invite { display: none; }

@keyframes fc-chat-dance {
  0%, 76%, 100% { transform: translateY(0) rotate(0); }
  80% { transform: translateY(-7px) rotate(-8deg); }
  84% { transform: translateY(0) rotate(7deg); }
  88% { transform: translateY(-4px) rotate(-5deg); }
  92% { transform: translateY(0) rotate(0); }
}
@keyframes fc-chat-pulse {
  0% { opacity: .55; transform: scale(.82); }
  75%, 100% { opacity: 0; transform: scale(1.25); }
}
@keyframes fc-chat-invite {
  0%, 72%, 100% { transform: translateY(0); }
  80%, 90% { transform: translateY(-4px); }
}
.fc-chat-launcher:focus-visible, .fc-chat-close:focus-visible,
.fc-chat-send:focus-visible, .fc-chat-input:focus-visible {
  outline: 3px solid var(--chat-accent-glow);
  outline-offset: 2px;
}

.fc-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 10009;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(570px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  background: var(--chat-surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.fc-chat-panel.open { opacity: 1; visibility: visible; transform: none; }
.fc-chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface-2);
}
.fc-chat-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--chat-accent);
  color: var(--chat-on-accent);
  font-size: 13px;
  font-weight: 800;
}
.fc-chat-heading { min-width: 0; flex: 1; }
.fc-chat-heading strong { display: block; color: var(--chat-text); font-size: 14px; }
.fc-chat-status { display: flex; align-items: center; gap: 6px; color: var(--chat-muted); font-size: 11px; }
.fc-chat-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.fc-chat-close { border: 0; background: transparent; color: var(--chat-muted); cursor: pointer; padding: 6px; font-size: 20px; }
.fc-chat-messages { flex: 1; overflow-y: auto; padding: 18px; overscroll-behavior: contain; scrollbar-width: thin; }
.fc-chat-message { display: flex; margin: 0 0 12px; }
.fc-chat-message.user { justify-content: flex-end; }
.fc-chat-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 15px 15px 15px 4px;
  background: var(--chat-surface-3);
  color: var(--chat-text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fc-chat-message.user .fc-chat-bubble {
  border-radius: 15px 15px 4px 15px;
  background: var(--chat-accent);
  color: var(--chat-on-accent);
}
.fc-chat-message.error .fc-chat-bubble { color: #b91c1c; background: #fee2e2; }
.fc-chat-typing .fc-chat-bubble { color: var(--chat-muted); }
.fc-chat-composer { display: flex; align-items: flex-end; gap: 9px; padding: 12px; border-top: 1px solid var(--chat-border); }
.fc-chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 110px;
  resize: none;
  border: 1px solid var(--chat-border);
  border-radius: 13px;
  background: var(--chat-surface-2);
  color: var(--chat-text);
  padding: 11px 13px;
  font: 13px/1.5 'Poppins', Arial, sans-serif;
}
.fc-chat-input::placeholder { color: var(--chat-muted); }
.fc-chat-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 13px;
  background: var(--chat-accent);
  color: var(--chat-on-accent);
  cursor: pointer;
}
.fc-chat-send:disabled { cursor: wait; opacity: .55; }

@media (max-width: 600px) {
  .fc-chat-launcher { right: 16px; bottom: 16px; }
  .fc-chat-invite { right: 88px; bottom: 23px; min-width: 140px; }
  .fc-chat-panel { right: 16px; bottom: 82px; height: min(560px, calc(100dvh - 106px)); }
}

@media (prefers-reduced-motion: reduce) {
  .fc-chat-launcher,
  .fc-chat-launcher::before,
  .fc-chat-invite { animation: none; }
}
