:root { color-scheme: light; }

#scooby-widget * { box-sizing: border-box; }

#scooby-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  width: auto;
  height: auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Floating launcher button */
#scooby-widget #launcher {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, #b89b5e, #8f753f);
  color: white;
  box-shadow: 0 8px 20px rgba(143, 117, 63, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(184,155,94,0.6); }
  70% { box-shadow: 0 0 0 12px rgba(184,155,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(184,155,94,0); }
}

#scooby-widget #launcher:hover { opacity: .94; }
#scooby-widget #launcher:active { transform: translateY(1px); }

/* Panel */
#scooby-widget #panel {
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;

  position: absolute;
  right: 0;
  bottom: 64px;

  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 130px);

  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  overflow: hidden;
  display: none;

  border: 1px solid rgba(0,0,0,.08);
}
#scooby-widget #panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Top bar */
#scooby-widget #topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: #f4f2ec;
}
#scooby-widget #title {
  font-weight: 900;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: .2px;
  color: #111827;
  padding-top: 2px;
}
#scooby-widget #close {
  width: 32px;
  height: 32px;
  border: 0;
  background: rgba(0,0,0,.04);
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  color: #111827;
  user-select: none;
}
#scooby-widget #close:hover { background: rgba(0,0,0,.07); }

/* Messages */
#scooby-widget #msgs {
  height: calc(100% - 130px);
  padding: 16px;
  overflow-y: auto;
  background: #f6f6f6;
}
#scooby-widget .row { display: flex; margin: 10px 0; }
#scooby-widget .user { justify-content: flex-end; }
#scooby-widget .bot { justify-content: flex-start; }

#scooby-widget .bubble {
  padding: 10px 12px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-wrap: break-word;
}
#scooby-widget .user .bubble {
  background: #1a1a1a;
  color: white;
  border-bottom-right-radius: 6px;
}
#scooby-widget .bot .bubble {
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(0,0,0,.06);
  border-bottom-left-radius: 6px;
}

/* Typing dots */
#scooby-widget .typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
#scooby-widget .typing span {
  width: 6px;
  height: 6px;
  background: #9f8652;
  border-radius: 50%;
  animation: scooby-blink 1.4s infinite both;
}
#scooby-widget .typing span:nth-child(2) { animation-delay: 0.2s; }
#scooby-widget .typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes scooby-blink {
  0% { opacity: 0.2; transform: translateY(0); }
  20% { opacity: 1; transform: translateY(-2px); }
  40% { opacity: 0.2; transform: translateY(0); }
  100% { opacity: 0.2; }
}

/* Bottom bar */
#scooby-widget #bottombar {
  padding: 16px;
  padding-bottom: 16px; /* <-- you were missing this semicolon in HTML */
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
  display: flex;
  gap: 10px;
  align-items: center;
}
#scooby-widget #q {
  flex: 1;
  height: 42px;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: #111827;
}
#scooby-widget #q::placeholder { color: rgba(17,24,39,.55); }

#scooby-widget #send {
  height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, #b89b5e, #8f753f);
  color: white;
  box-shadow: 0 8px 20px rgba(143, 117, 63, 0.35);
  white-space: nowrap;
}
#scooby-widget #send:hover { opacity: .94; }
#scooby-widget #send:active { transform: translateY(1px); }

/* Small screens */
@media (max-width: 420px) {
  #scooby-widget { right: 12px; bottom: 12px; }
  #scooby-widget #panel { width: calc(100vw - 24px); right: 12px; bottom: 76px; }
}
