#ghost-ai-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#ghost-ai-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #4834d4);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#ghost-ai-bubble:hover {
  transform: scale(1.06);
}
#ghost-ai-bubble svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

#ghost-ai-bubble .ghost-ai-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #ff4757;
  border-radius: 50%;
  border: 2px solid #0a0e27;
  display: none;
}

#ghost-ai-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  height: 520px;
  background: #0a0e27;
  border: 1px solid #2a2f52;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#ghost-ai-panel.open {
  display: flex;
}

#ghost-ai-header {
  background: linear-gradient(135deg, #6c5ce7, #4834d4);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#ghost-ai-header h3 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
#ghost-ai-header .ghost-ai-sub {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 11px;
}
#ghost-ai-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.85;
}
#ghost-ai-close:hover {
  opacity: 1;
}

#ghost-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#ghost-ai-messages::-webkit-scrollbar {
  width: 6px;
}
#ghost-ai-messages::-webkit-scrollbar-thumb {
  background: #2a2f52;
  border-radius: 3px;
}

.ghost-ai-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ghost-ai-msg.user {
  align-self: flex-end;
  background: #6c5ce7;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ghost-ai-msg.assistant {
  align-self: flex-start;
  background: #161b3d;
  color: #e8e9f3;
  border: 1px solid #2a2f52;
  border-bottom-left-radius: 4px;
}
.ghost-ai-msg.system-note {
  align-self: center;
  background: transparent;
  color: #7a7f9e;
  font-size: 11.5px;
  text-align: center;
  max-width: 100%;
}
.ghost-ai-msg.error {
  align-self: flex-start;
  background: #3a1a1a;
  color: #ff9b9b;
  border: 1px solid #5a2a2a;
}

.ghost-ai-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 13px;
  background: #161b3d;
  border: 1px solid #2a2f52;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ghost-ai-typing span {
  width: 6px;
  height: 6px;
  background: #6c5ce7;
  border-radius: 50%;
  animation: ghost-ai-bounce 1.2s infinite ease-in-out;
}
.ghost-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ghost-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ghost-ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#ghost-ai-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #2a2f52;
  background: #0a0e27;
}
#ghost-ai-input {
  flex: 1;
  background: #161b3d;
  border: 1px solid #2a2f52;
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  resize: none;
}
#ghost-ai-input:focus {
  border-color: #6c5ce7;
}
#ghost-ai-input::placeholder {
  color: #5a5f7e;
}
#ghost-ai-send {
  background: #6c5ce7;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
#ghost-ai-send:hover {
  background: #5b4bd6;
}
#ghost-ai-send:disabled {
  background: #3a3d5c;
  cursor: not-allowed;
}

#ghost-ai-login-banner {
  padding: 10px 14px;
  background: #1a1530;
  border-bottom: 1px solid #2a2f52;
  font-size: 12px;
  color: #b8b9d4;
  text-align: center;
}
#ghost-ai-login-banner a {
  color: #a29bfe;
  font-weight: 600;
  text-decoration: none;
}
#ghost-ai-login-banner a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  #ghost-ai-panel {
    width: calc(100vw - 32px);
    height: 70vh;
    right: -8px;
  }
}

/* GHOST-BUBBLE START */
#ghost-ai-bubble{position:relative}
#ghost-ai-bubble .ghost-ai-ghost{position:relative;z-index:2;width:36px;height:41px;overflow:visible;display:block;animation:gx-float 2.4s ease-in-out infinite;filter:drop-shadow(0 4px 4px rgba(0,0,0,.35))}
#ghost-ai-bubble .ghost-ai-ghost .gx-body{fill:#f5f3ff;stroke:none}
#ghost-ai-bubble .ghost-ai-ghost .gx-mouth{fill:#2d2250;stroke:none}
#ghost-ai-bubble .ghost-ai-ghost .gx-eyes{transform-box:fill-box;transform-origin:center;animation:gx-blink 5s infinite}
#ghost-ai-bubble .ghost-ai-ghost .gx-eye{fill:#5ff6ff;stroke:none;animation:gx-eye-colors 6s linear infinite,gx-glow 1.8s ease-in-out infinite}
#ghost-ai-bubble .gx-ring{position:absolute;inset:0;border-radius:50%;z-index:1;pointer-events:none;opacity:0;transition:opacity .25s ease;
  background:conic-gradient(#5b5f68,#d9dde3 10%,#ffffff 14%,#aeb3bc 20%,#6e737c 35%,#c9cdd4 50%,#f5f7fa 54%,#8d929b 62%,#5b5f68 75%,#b8bcc4 90%,#5b5f68);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 6px),#000 calc(100% - 5px));
  mask:radial-gradient(farthest-side,transparent calc(100% - 6px),#000 calc(100% - 5px));
  animation:gx-chase 3.2s linear infinite}
#ghost-ai-bubble .gx-shine{position:absolute;inset:0;border-radius:50%;overflow:hidden;z-index:1;pointer-events:none;opacity:0;transition:opacity .25s ease}
#ghost-ai-bubble .gx-shine::before{content:"";position:absolute;top:-20%;bottom:-20%;left:-60%;width:45%;transform:skewX(-20deg);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);animation:gx-shine 1.4s ease-in-out infinite}
#ghost-ai-bubble:hover .gx-ring,#ghost-ai-bubble:focus-visible .gx-ring,#ghost-ai-bubble:active .gx-ring,#ghost-ai-bubble:hover .gx-shine,#ghost-ai-bubble:focus-visible .gx-shine,#ghost-ai-bubble:active .gx-shine{opacity:1}
#ghost-ai-bubble:hover .ghost-ai-ghost .gx-eye,#ghost-ai-bubble:focus-visible .ghost-ai-ghost .gx-eye,#ghost-ai-bubble:active .ghost-ai-ghost .gx-eye{animation-duration:1.2s,1.8s}
@keyframes gx-float{0%,100%{transform:translateY(3px) rotate(-6deg)}50%{transform:translateY(-6px) rotate(6deg)}}
@keyframes gx-glow{0%,100%{opacity:.65}50%{opacity:1}}
@keyframes gx-blink{0%,94%,100%{transform:scaleY(1)}96%{transform:scaleY(.1)}}
@keyframes gx-eye-colors{0%,100%{fill:#5ff6ff}25%{fill:#ff4fd8}50%{fill:#ffd23f}75%{fill:#7cff6b}}
@keyframes gx-chase{to{transform:rotate(360deg)}}
@keyframes gx-shine{0%{left:-60%}60%,100%{left:120%}}
@media (prefers-reduced-motion:reduce){#ghost-ai-bubble .ghost-ai-ghost,#ghost-ai-bubble .ghost-ai-ghost .gx-eyes,#ghost-ai-bubble .ghost-ai-ghost .gx-eye,#ghost-ai-bubble .gx-ring,#ghost-ai-bubble .gx-shine::before{animation:none}}
/* GHOST-BUBBLE END */
