#sg-widget {
  font-family: "Space Grotesk", "Trebuchet MS", system-ui, sans-serif;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  color: #1c1c1c;
}

#sg-widget .sg-launch {
  background: linear-gradient(135deg, #f6b26b, #f28c8c);
  border: none;
  color: #1c1c1c;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(20, 20, 20, 0.2);
}

#sg-widget .sg-launch.is-hidden {
  display: none;
}

#sg-widget .sg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1c1c1c;
}

#sg-widget .sg-panel {
  width: min(360px, 90vw);
  height: min(520px, 70vh);
  background: radial-gradient(circle at top, #fff7f1, #f7efe7);
  border-radius: 20px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#sg-widget .sg-panel.is-open {
  display: flex;
  animation: sg-pop 200ms ease-out;
}

#sg-widget .sg-header {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1c1c1c;
  color: #fef6ec;
}

#sg-widget .sg-title {
  font-size: 16px;
  font-weight: 600;
}

#sg-widget .sg-subtitle {
  font-size: 12px;
  opacity: 0.75;
}

#sg-widget .sg-close {
  background: transparent;
  border: none;
  color: #fef6ec;
  font-size: 20px;
  cursor: pointer;
}

#sg-widget .sg-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(247, 239, 231, 0.6));
}

#sg-widget .sg-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

#sg-widget .sg-user {
  align-self: flex-end;
  background: #1c1c1c;
  color: #fff7f1;
}

#sg-widget .sg-assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #1c1c1c;
}

#sg-widget .sg-support {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #1c1c1c;
}

#sg-widget .sg-system {
  align-self: center;
  background: #fde6c8;
  color: #5b3b1d;
}

#sg-widget .sg-status {
  align-self: center;
  font-size: 12px;
  color: #5b3b1d;
  background: #fde6c8;
  padding: 6px 10px;
  border-radius: 999px;
}

#sg-widget .sg-status[data-mode="thinking"] {
  animation: sg-thinking 1.4s ease-in-out infinite;
}

#sg-widget .sg-input {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fffdfb;
}

#sg-widget .sg-input input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  font-size: 14px;
}

#sg-widget .sg-input button {
  border: none;
  background: #f28c8c;
  color: #1c1c1c;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

#sg-widget .sg-privacy {
  padding: 8px 16px 14px;
  font-size: 11px;
  color: #6a5b52;
  text-align: center;
}

#sg-widget .sg-privacy a {
  color: inherit;
}

@keyframes sg-pop {
  0% {
    transform: translateY(10px) scale(0.98);
    opacity: 0.7;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes sg-thinking {
  0% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-1px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
}

@media (max-width: 640px) {
  #sg-widget {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }
  #sg-widget .sg-panel {
    width: 100%;
  }
}

/* Markdown Content */
#sg-widget .sg-bubble p {
  margin: 0 0 8px 0;
}
#sg-widget .sg-bubble p:last-child {
  margin: 0;
}
#sg-widget .sg-bubble ul, #sg-widget .sg-bubble ol {
  margin: 0 0 8px 0;
  padding-left: 20px;
}
#sg-widget .sg-bubble ul:last-child, #sg-widget .sg-bubble ol:last-child {
  margin: 0;
}
#sg-widget .sg-bubble code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}
#sg-widget .sg-bubble pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.9em;
  margin: 8px 0;
}
#sg-widget .sg-bubble a {
  color: inherit;
  text-decoration: underline;
  opacity: 0.8;
}

/* Heading styles */
#sg-widget .sg-bubble h1,
#sg-widget .sg-bubble h2,
#sg-widget .sg-bubble h3 {
  margin: 0.5em 0 0.3em 0;
  font-weight: 600;
  line-height: 1.3;
}
#sg-widget .sg-bubble h1 {
  font-size: 1.1em;
}
#sg-widget .sg-bubble h2 {
  font-size: 1.05em;
}
#sg-widget .sg-bubble h3 {
  font-size: 1em;
}
#sg-widget .sg-bubble h1:first-child,
#sg-widget .sg-bubble h2:first-child,
#sg-widget .sg-bubble h3:first-child {
  margin-top: 0;
}
#sg-widget .sg-bubble h1:last-child,
#sg-widget .sg-bubble h2:last-child,
#sg-widget .sg-bubble h3:last-child {
  margin-bottom: 0;
}

/* Blockquote styles */
#sg-widget .sg-bubble blockquote {
  margin: 0.5em 0;
  padding-left: 12px;
  border-left: 3px solid rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.7);
  font-style: italic;
}
#sg-widget .sg-bubble blockquote p {
  margin: 0.3em 0;
}

/* Improved code block contrast for dark bubbles */
#sg-widget .sg-user pre,
#sg-widget .sg-user code {
  background: rgba(255, 255, 255, 0.15);
  color: #fff7f1;
}
#sg-widget .sg-user pre {
  border: 1px solid rgba(255, 255, 255, 0.2);
}
#sg-widget .sg-user code {
  border: 1px solid rgba(255, 255, 255, 0.15);
}
