/* chispa.css — widget de Chispa (diseño de Tirso, design/chispa/file.css) */
:root { --chispa-terra: #C96F4A; --chispa-cream: #F7F1E8; --chispa-ink: #2B211C; }
#chispa-root { position: fixed; bottom: 24px; right: 24px; z-index: 9999; font-family: system-ui, sans-serif; }
#chispa-fab { width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--chispa-terra); padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.25); position: relative;
  animation: chispa-pulse 2.6s infinite; }
#chispa-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
@keyframes chispa-pulse { 0%,100% { box-shadow: 0 8px 24px rgba(0,0,0,.25), 0 0 0 0 rgba(201,111,74,.5);} 50% { box-shadow: 0 8px 24px rgba(0,0,0,.25), 0 0 0 12px rgba(201,111,74,0);} }
#chispa-dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff; }
#chispa-panel { position: absolute; bottom: 80px; right: 0; width: 380px; max-width: calc(100vw - 48px);
  height: 520px; max-height: calc(100vh - 120px); background: #fff; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.28);
  transform-origin: bottom right; transition: transform .22s ease, opacity .22s ease; }
#chispa-panel.chispa-hidden { transform: scale(.6); opacity: 0; pointer-events: none; }
.chispa-header { background: var(--chispa-terra); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.chispa-avatar-sm { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.chispa-header div { flex: 1; display: flex; flex-direction: column; }
.chispa-status { font-size: 12px; opacity: .85; }
#chispa-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
#chispa-messages { flex: 1; overflow-y: auto; padding: 14px; background: var(--chispa-cream); display: flex; flex-direction: column; gap: 10px; }
.chispa-msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.chispa-msg.bot { background: #fff; color: var(--chispa-ink); border-bottom-left-radius: 4px; align-self: flex-start; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chispa-msg.user { background: var(--chispa-terra); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.chispa-typing { font-style: italic; opacity: .6; }
#chispa-actions { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: #fff; border-top: 1px solid #eee; }
#chispa-actions button { white-space: nowrap; border: 1px solid var(--chispa-terra); background: #fff; color: var(--chispa-terra);
  border-radius: 999px; padding: 8px 13px; font-size: 13px; cursor: pointer; }
#chispa-actions button:hover { background: var(--chispa-terra); color: #fff; }
#chispa-form { display: flex; padding: 10px; background: #fff; border-top: 1px solid #eee; gap: 8px; }
#chispa-input { flex: 1; border: 1px solid #ddd; border-radius: 999px; padding: 10px 14px; font-size: 14px; outline: none; }
#chispa-form button { width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--chispa-terra); color: #fff; cursor: pointer; font-size: 16px; }

/* Studio: the app's global input/label styles would otherwise reach the widget. */
#chispa-root #chispa-input { height: 42px; width: auto; min-width: 0; background: #fff; font: 14px system-ui, sans-serif; color: var(--chispa-ink); }
#chispa-root #chispa-input:focus { border-color: var(--chispa-terra); outline: none; }
#chispa-fab:focus-visible, #chispa-root button:focus-visible { outline: 3px solid var(--chispa-ink); outline-offset: 2px; }
.chispa-msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.chispa-header strong { font-size: 16px; }
/* Stay clear of the landing editor's sticky save bar. */
body:has(.savebar) #chispa-root { bottom: 96px; }
@media (max-width: 480px) { #chispa-root { right: 16px; bottom: 16px; } #chispa-fab { width: 56px; height: 56px; }
  #chispa-panel { bottom: 72px; height: calc(100vh - 110px); max-width: calc(100vw - 32px); } }
@media (prefers-reduced-motion: reduce) { #chispa-fab { animation: none; } #chispa-panel { transition: none; } }

/* Avatar: cream ring so the terracotta character doesn't sink into the terracotta button/header. */
#chispa-fab { background: #FFF7EE; padding: 3px; }
#chispa-fab video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.chispa-avatar-sm { box-shadow: 0 0 0 2px #FFF7EE; background: #FFF7EE; }
/* Quick actions wrap onto two lines instead of a scrollbar. */
#chispa-actions { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 10px 12px 8px; }
#chispa-actions button { padding: 7px 12px; font-size: 13px; }
#chispa-actions[hidden] { display: none; }
/* Nudge: Chispa offers a guide on the hard screens (chispa.js). */
#chispa-nudge { position: absolute; bottom: 78px; right: 0; width: 290px; max-width: calc(100vw - 48px);
  background: #fff; color: var(--chispa-ink); border-radius: 16px; border-bottom-right-radius: 4px; padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.22); animation: chispa-in .3s ease both; }
#chispa-nudge p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; }
#chispa-nudge div { display: flex; gap: 8px; flex-wrap: wrap; }
#chispa-nudge button { border-radius: 999px; padding: 8px 14px; font: 600 13px system-ui, sans-serif; cursor: pointer;
  border: 1px solid var(--chispa-terra); }
#chispa-nudge .yes { background: var(--chispa-terra); color: #fff; }
#chispa-nudge .no { background: #fff; color: var(--chispa-terra); }
@keyframes chispa-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { #chispa-nudge { bottom: 70px; max-width: calc(100vw - 32px); } }
@media (prefers-reduced-motion: reduce) { #chispa-nudge { animation: none; } }
