/* floating launcher; the bot runs in an iframe, sealed off from this page */

.assist-fab {
  position:fixed; right:22px; bottom:22px; z-index:900;
  display:flex; align-items:center; gap:9px;
  padding:0 16px 0 13px; height:46px; border-radius:23px;
  background:var(--c-brand); color:var(--c-bg); border:0;
  font-size:14px; font-weight:700; cursor:pointer;
  box-shadow:0 8px 22px var(--c-shadow);
  transition:transform 0.18s, background 0.18s;
}
.assist-fab:hover { background:var(--c-brand-hi); transform:translateY(-2px); }
.assist-fab:focus-visible { outline:2px solid var(--c-brand-hi); outline-offset:3px; }
/* Pika's face is green; it needs a light plate to read on the green pill
   and on the dark title bar alike */
.assist-fab .pika-face,
.assist-bar .pika-face {
  width:28px; height:28px; flex:none; border-radius:50%;
  background:#ffffff; padding:2px; box-sizing:border-box;
  object-fit:contain;
}
.assist-fab[aria-expanded="true"] { display:none; }

/* first visit only: three slow rings, four seconds in, then still */
@keyframes assistRing {
  0%   { box-shadow:0 8px 22px var(--c-shadow), 0 0 0 0 rgba(var(--c-ring-rgb),0.80), 0 0 0 0 rgba(var(--c-ring-rgb),0.45); }
  55%  { box-shadow:0 8px 22px var(--c-shadow), 0 0 0 16px rgba(var(--c-ring-rgb),0), 0 0 0 7px rgba(var(--c-ring-rgb),0.22); }
  100% { box-shadow:0 8px 22px var(--c-shadow), 0 0 0 30px rgba(var(--c-ring-rgb),0), 0 0 0 30px rgba(var(--c-ring-rgb),0); }
}
@keyframes assistNudge {
  0%, 100% { transform:translateY(0) scale(1); }
  20%      { transform:translateY(-8px) scale(1.07); }
  40%      { transform:translateY(0) scale(1); }
  55%      { transform:translateY(-4px) scale(1.03); }
  70%      { transform:translateY(0) scale(1); }
}
.assist-fab.is-calling {
  /* runs until the panel is opened - the class is what stops it */
  animation:assistRing 1.9s ease-out infinite,
            assistNudge 1.9s ease-in-out infinite;
}
.assist-fab.is-calling:hover { animation:none; }

@media (prefers-reduced-motion:reduce) {
  .assist-fab.is-calling { animation:none; }
}


/* display:flex below beats the browser rule for [hidden], so say it here. */
.assist-panel[hidden] { display:none; }
.assist-panel {
  position:fixed; right:22px; bottom:22px; z-index:901;
  width:396px; height:min(640px, calc(100vh - 44px));
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--c-surface-2); border:1px solid var(--c-line-4);
  border-radius:14px; box-shadow:0 18px 50px var(--c-shadow-strong);
  animation:assist-in 0.2s ease both;
}
@keyframes assist-in { from { opacity:0; transform:translateY(14px); } }

.assist-bar {
  display:flex; align-items:center; gap:10px;
  padding:10px 10px 10px 14px; border-bottom:1px solid var(--c-line-3);
  background:var(--c-surface-4); color:var(--c-text-1); font-size:14px;
}
.assist-bar b { flex:1; font-weight:600; }
.assist-bar .assist-x + .assist-x { margin-left:-4px; }
.assist-x {
  width:30px; height:30px; flex:none; border-radius:8px;
  background:none; border:1px solid var(--c-line-5); color:var(--c-text-2);
  cursor:pointer; display:grid; place-items:center;
}
.assist-x:hover { border-color:var(--c-brand-edge); color:var(--c-text-1); }
.assist-x:focus-visible { outline:2px solid var(--c-brand); outline-offset:2px; }
.assist-x svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; }

.assist-panel iframe { flex:1; width:100%; border:0; display:block; }

/* Expanded: a large centred card instead of the corner one. */
.assist-panel.is-big {
  width:min(1040px, 94vw); height:min(820px, 90vh);
  right:auto; left:50%; bottom:5vh; transform:translateX(-50%);
  animation:none;
}
.assist-big .ico-out { display:none; }
.assist-panel.is-big .assist-big .ico-out { display:block; }
.assist-panel.is-big .assist-big .ico-in { display:none; }

@media (max-width:560px) {
  /* the launcher floats over the page, so the last row needs room under it */
  .container { padding-bottom:88px; }
  .assist-fab { right:14px; bottom:14px; }
  .assist-panel, .assist-panel.is-big {
    right:0; left:0; bottom:0; width:auto; height:88vh;
    transform:none; border-radius:14px 14px 0 0;
  }
  .assist-big { display:none; }   /* already full width on a phone */
}
@media (prefers-reduced-motion:reduce) {
  .assist-fab { transition:none; }
  .assist-fab:hover { transform:none; }
  .assist-panel { animation:none; }
}
@media not all and (prefers-color-scheme: dark) {
/* ---- Light mode: the launcher takes the reference's blue gradient ---- */
    :root:not([data-theme="dark"]) .assist-fab {
    background:linear-gradient(135deg, #0d74bd 0%, #0a5e9e 100%);
    color:#ffffff; box-shadow:0 4px 14px rgba(11, 111, 184, 0.3);
}
    :root:not([data-theme="dark"]) .assist-fab:hover { background:linear-gradient(135deg, #0a68ae 0%, #084f84 100%); }
}

/* ---- Light mode: the launcher takes the reference's blue gradient ---- */
:root[data-theme="light"] .assist-fab {
  background:linear-gradient(135deg, #0d74bd 0%, #0a5e9e 100%);
  color:#ffffff; box-shadow:0 4px 14px rgba(11, 111, 184, 0.3);
}
:root[data-theme="light"] .assist-fab:hover { background:linear-gradient(135deg, #0a68ae 0%, #084f84 100%); }
