/* Fancy SMP — the assistant's bubble and its panel (static/assistant.js). Uses the site's own colour tokens. */

.ai-bubble { position: fixed; z-index: 60; inset-inline-end: 18px; inset-block-end: calc(18px + var(--tabs) + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--brand-hover), var(--brand)); color: #fff; font: 600 15px/1 var(--font);
  box-shadow: inset 0 1px 0 #ffffff33, 0 10px 30px #7c2ad877; transition: transform .2s var(--ease-spring), box-shadow .2s ease; }
.ai-bubble:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 #ffffff33, 0 14px 36px #8a2be299; }
.ai-bubble:active { transform: scale(.96); }
.ai-bubble svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-open .ai-bubble { opacity: 0; pointer-events: none; }

.ai-panel { position: fixed; z-index: 70; inset-inline-end: 18px; inset-block-end: calc(18px + var(--tabs) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(580px, calc(100dvh - var(--top) - var(--tabs) - 48px));
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--elevated); color: var(--text);
  box-shadow: 0 24px 60px #00000080; animation: ai-in .22s var(--ease-out); }
.ai-panel[hidden] { display: none; }
@keyframes ai-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .ai-panel { animation: none; } .ai-bubble { transition: none; } }

.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-block-end: 1px solid var(--hairline);
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 18%, var(--elevated)), var(--elevated)); }
.ai-head strong { display: block; color: var(--strong); font-size: 16px; }
.ai-head span { display: block; color: var(--subtle); font-size: 12.5px; margin-block-start: 2px; }
.ai-close { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--recessed); color: var(--subtle); cursor: pointer; }
.ai-close:hover { color: var(--strong); border-color: var(--line); }
.ai-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.ai-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ai-hello { margin: 0; color: var(--soft-text); line-height: 1.7; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--recessed); color: var(--soft-text); font: 500 13.5px/1.3 var(--font); cursor: pointer; text-align: start; }
.ai-chip:hover { border-color: var(--brand-line); color: var(--strong); }
.ai-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.7; font-size: 14.5px; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-start; background: var(--brand); color: #fff; border-end-start-radius: 4px; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-end; background: var(--recessed); border: 1px solid var(--hairline); border-end-end-radius: 4px; }
.ai-msg.note { color: var(--subtle); }
.ai-text p { margin: 0; }
.ai-text p + p { margin-block-start: 6px; }
.ai-text strong { color: var(--strong); unicode-bidi: isolate; }
.ai-text code { font-family: var(--mono); font-size: 13px; padding: 1px 6px; border-radius: 5px; background: var(--base); color: var(--brand-text); direction: ltr; unicode-bidi: isolate; }
.ai-text blockquote { margin: 8px 0; padding: 6px 12px; border-inline-start: 3px solid var(--brand-hover); border-radius: 6px; background: var(--base); color: var(--soft-text); }
.ai-msg.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.ai-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); animation: ai-dot 1s infinite ease-in-out; }
.ai-msg.typing span:nth-child(2) { animation-delay: .15s; }
.ai-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-block-start: 1px solid var(--hairline); background: var(--elevated); }
.ai-input { flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; resize: none;
  background: var(--recessed); color: var(--strong); font: 15px/1.5 var(--font); }
.ai-input:focus { outline: 0; border-color: var(--brand-hover); box-shadow: 0 0 0 3px var(--brand-soft); }
.ai-send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, var(--brand-hover), var(--brand)); color: #fff; }
.ai-send:disabled { opacity: .5; cursor: default; }
.ai-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: scaleX(-1); }

@media (max-width: 600px) {
  /* On a phone the bubble is a round button with no word on it, so it covers as little of the page as it can. */
  .ai-bubble { inset-inline-end: 12px; inset-block-end: calc(12px + var(--tabs) + env(safe-area-inset-bottom)); width: 48px; min-height: 48px; padding: 0; justify-content: center; }
  .ai-bubble span { display: none; }
  .ai-panel { inset-inline: 8px; inset-block-end: calc(8px + var(--tabs) + env(safe-area-inset-bottom)); width: auto; height: min(560px, calc(100dvh - var(--tabs) - 70px)); }
}
