.askpaca-root {
  --ap-accent: #5b7c5a;
  --ap-bg: #fff;
  --ap-text: #1a1a1a;
  --ap-muted: #666;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  color: var(--ap-text);
  box-sizing: border-box;
}
.askpaca-root * { box-sizing: border-box; }

.askpaca-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--ap-accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483000;
}
.askpaca-launcher:hover { filter: brightness(1.05); }

.askpaca-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: min(400px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  background: var(--ap-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483000;
}
.askpaca-panel.open { display: flex; }

.askpaca-header {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8faf7;
}
.askpaca-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}
.askpaca-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  color: var(--ap-muted);
}

.askpaca-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.askpaca-msg {
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 92%;
  line-height: 1.45;
}
.askpaca-msg.user {
  align-self: flex-end;
  background: #eef3ee;
}
.askpaca-msg.bot {
  align-self: flex-start;
  background: #f5f5f5;
}

.askpaca-sources {
  margin-top: 8px;
  font-size: 12px;
}
.askpaca-sources a {
  color: var(--ap-accent);
  text-decoration: none;
  display: block;
  margin-top: 4px;
}
.askpaca-sources a:hover { text-decoration: underline; }

.askpaca-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
}
.askpaca-input-row input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.askpaca-input-row button {
  border: none;
  background: var(--ap-accent);
  color: #fff;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}
.askpaca-input-row button:disabled { opacity: .5; cursor: not-allowed; }

/* Alpaca mascot (optional, small) */
.askpaca-alpaca {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.askpaca-mascot,
.askpaca-mascot-img,
.askpaca-mascot-svg {
  display: block;
}
.askpaca-header .askpaca-alpaca .askpaca-mascot,
.askpaca-header .askpaca-alpaca .askpaca-mascot-img,
.askpaca-header .askpaca-alpaca .askpaca-mascot-svg {
  width: 48px;
  height: 48px;
  object-fit: contain;
  object-position: center top;
}
.askpaca-mascot-img,
.askpaca-mascot-svg {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}
.askpaca-launcher .askpaca-mascot-img,
.askpaca-launcher .askpaca-mascot-svg {
  width: 44px;
}
.askpaca-alpaca .body { fill: #f4f0e6; stroke: #3d3d3d; stroke-width: 1.2; }
.askpaca-alpaca .neck { fill: #e8e0d0; }
.askpaca-alpaca .face { fill: #faf8f2; }
.askpaca-alpaca .eye { fill: #222; }
.askpaca-alpaca .nose { fill: #c9a88a; }

.askpaca-alpaca.state-thinking .head {
  animation: ap-bob 0.8s ease-in-out infinite;
}
.askpaca-alpaca.state-nod .head {
  animation: ap-nod 0.5s ease-in-out 2;
}
.askpaca-alpaca.state-point .arm {
  transform-origin: 18px 22px;
  animation: ap-point 0.6s ease-out forwards;
}

@keyframes ap-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes ap-nod {
  0%, 100% { transform: rotate(0); }
  40% { transform: rotate(8deg); }
  70% { transform: rotate(-4deg); }
}
@keyframes ap-point {
  to { transform: rotate(-25deg); }
}

@media (max-width: 480px) {
  .askpaca-root:not(.askpaca-root--inline) .askpaca-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 80px;
  }
  .askpaca-root:not(.askpaca-root--inline) .askpaca-launcher--float { right: 12px; bottom: 12px; }
}

/* —— Inline embed (e.g. marketing hero) —— */
.askpaca-root--inline {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.askpaca-root--inline .askpaca-launcher--float {
  display: none !important;
}
.askpaca-root--inline .askpaca-panel {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  height: 100%;
  box-shadow: 0 10px 28px rgba(80, 55, 20, 0.08);
  border: 1px solid rgba(234, 217, 192, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
}
.askpaca-root--inline .askpaca-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.askpaca-root--inline .askpaca-input-row {
  flex-shrink: 0;
}
.askpaca-root--inline .askpaca-header {
  flex-shrink: 0;
}
.askpaca-root--inline .askpaca-launcher--scroll {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 2147483000;
  width: 52px;
  height: 52px;
  border: 2px solid #2b2118;
  background: #fffaf2;
}
@media (min-width: 861px) {
  .askpaca-root--inline .askpaca-launcher--scroll {
    display: none !important;
  }
}

/* Liveliness: idle blink, typing dots, starter chips */
.askpaca-alpaca .head { transform-box: fill-box; transform-origin: 50% 90%; }
.askpaca-alpaca.state-idle .eye { animation: ap-blink 5s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ap-blink { 0%, 96%, 100% { transform: scaleY(1); } 98% { transform: scaleY(0.1); } }
.askpaca-typing:not(.askpaca-typing--alpaca) span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: #b9a08a; animation: ap-dot 1s infinite ease-in-out; }
.askpaca-typing:not(.askpaca-typing--alpaca) span:nth-child(2) { animation-delay: 0.15s; }
.askpaca-typing:not(.askpaca-typing--alpaca) span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ap-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.askpaca-typing--alpaca {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 2px 0;
}
.askpaca-typing--alpaca .askpaca-typing-mascot {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  animation: ap-typing-bounce 0.85s ease-in-out infinite;
}
.askpaca-typing--alpaca .askpaca-mascot-img,
.askpaca-typing--alpaca .askpaca-mascot-svg {
  width: 44px;
  height: 44px;
  object-fit: contain;
  object-position: center bottom;
}
@keyframes ap-typing-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.askpaca-empty-state {
  align-self: stretch;
  margin: 2px 0 10px;
  padding: 12px 12px 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #faf6ee 0%, #fff 100%);
  border: 1px solid #ead9c0;
}
.askpaca-starters-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a7563;
}
.askpaca-starters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.askpaca-starters button {
  border: 1px solid #d9c9b4;
  background: #fff;
  color: #4a3b30;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 0 rgba(80, 55, 20, 0.06);
}
.askpaca-starters button:hover { background: #f6efe7; border-color: #c9b59a; }
.askpaca-starters button:focus-visible { outline: 2px solid #5b7c5a; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .askpaca-alpaca *, .askpaca-typing span { animation: none !important; } }
