:root {
  --balabala-widget-blue: #007fff;
  --balabala-widget-blue-dark: #004a99;
  --balabala-widget-yellow: #f7d618;
}

.balabala-ai-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--balabala-widget-blue), var(--balabala-widget-blue-dark));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  animation: balabala-ai-breathe 2.6s ease-in-out infinite;
}

.balabala-ai-launcher svg {
  width: 28px;
  height: 28px;
  position: relative;
  z-index: 1;
}

.balabala-ai-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--balabala-widget-yellow);
  opacity: 0.7;
  animation: balabala-ai-halo 2.6s ease-out infinite;
}

@keyframes balabala-ai-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

@keyframes balabala-ai-halo {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.9); opacity: 0; }
}

.balabala-ai-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 2px solid var(--balabala-widget-blue);
}

.balabala-ai-panel.open {
  display: flex;
}

.balabala-ai-header {
  background: linear-gradient(120deg, var(--balabala-widget-blue), var(--balabala-widget-blue-dark));
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.balabala-ai-header svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.balabala-ai-header strong {
  flex: 1;
  font-size: 15px;
}

.balabala-ai-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.balabala-ai-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7fafc;
}

.balabala-ai-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.balabala-ai-msg.user {
  align-self: flex-end;
  background: var(--balabala-widget-yellow);
  color: #1a1a1a;
}

.balabala-ai-msg.assistant {
  align-self: flex-start;
  background: #e7edf5;
  color: #1a1a1a;
}

.balabala-ai-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e2e2e2;
}

.balabala-ai-form input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.balabala-ai-form button {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  background: var(--balabala-widget-blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.balabala-ai-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (prefers-color-scheme: dark) {
  .balabala-ai-panel { background: #14181d; border-color: #2c5a8a; }
  .balabala-ai-log { background: #0f1216; }
  .balabala-ai-msg.assistant { background: #232a33; color: #eee; }
  .balabala-ai-form { border-top-color: #333; }
  .balabala-ai-form input { background: #1c2128; border-color: #3a3a3a; color: #eee; }
}
