/* The real mascot asset stays intact; only its presentation moves. */
body .search-companion {
  display: flex; align-items: center; gap: 8px; width: max-content;
  max-width: 100%; margin: 0 0 0 auto; z-index: 3; color: var(--polish-accent);
}
body .search-companion .companion-cat {
  display: grid; place-items: center; width: 76px; height: 76px; flex: none;
  padding: 0; border: 0; background: transparent; box-shadow: none; border-radius: 18px;
  cursor: grab; touch-action: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
body .search-companion .companion-cat:hover, body .search-companion .companion-cat:active { background: transparent; transform: none; }
body .search-companion .companion-cat img { width: 76px; height: 76px; object-fit: contain; transform-origin: 50% 88%; pointer-events: none; }
body .search-companion .companion-bubble {
  display: flex; align-items: center; gap: 9px; width: 244px; min-height: 53px;
  padding: 9px 10px 9px 14px; border: 1px solid var(--polish-border); border-radius: 17px 17px 17px 5px;
  background: var(--glass-bg); box-shadow: inset 0 1px 0 var(--glass-shine),0 7px 18px #00000012;
}
body .search-companion .companion-line {
  display: block; flex: 1; min-width: 0; max-width: none; padding: 0; background: none;
  border: 0; border-radius: 0; font-size: 12px; font-weight: 600; line-height: 1.55;
  min-height: 36px; overflow-wrap: anywhere; align-content: center;
}
body .search-companion .companion-pause {
  flex: none; width: 34px; min-height: 30px; padding: 3px; border: 0; border-radius: 8px;
  background: transparent; color: var(--polish-muted); font-size: 10px; cursor: pointer;
}
body .search-companion .companion-pause:hover { background: var(--polish-soft); color: var(--polish-copy); }
/* Single, spaced-out gestures: preserve the drawing and avoid a constant bounce. */
html[data-motion='full'] .search-companion.is-running .companion-cat img { animation: none; }
html[data-motion='full'] .search-companion.is-running[data-action='breathe'] .companion-cat img { animation: companion-breathe 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='peek'] .companion-cat img { animation: companion-peek 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='settle'] .companion-cat img { animation: companion-settle 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='stretch'] .companion-cat img { animation: companion-stretch 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='nod'] .companion-cat img { animation: companion-nod 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='sway'] .companion-cat img { animation: companion-sway 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='look'] .companion-cat img { animation: companion-look 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running[data-action='cozy'] .companion-cat img { animation: companion-cozy 2.8s ease-in-out both; }
html[data-motion='full'] .search-companion.is-running.is-speaking .companion-line { animation: companion-speak .28s ease both; }
body .search-companion:not(.is-running) .companion-cat img { animation: none; }
@keyframes companion-breathe { 0%,100% { transform: none; } 50% { transform: translateY(-1.5px); } }
@keyframes companion-peek { 0%,100% { transform: none; } 38%,58% { transform: translateX(3px) rotate(3deg); } }
@keyframes companion-settle { 0%,100% { transform: none; } 35% { transform: translateY(2px) rotate(-1deg); } 70% { transform: translateY(-1px); } }
@keyframes companion-stretch { 0%,100% { transform: none; } 40%,58% { transform: translateY(-3px) rotate(-.8deg); } }
@keyframes companion-nod { 0%,100% { transform: none; } 32% { transform: translateY(2px) rotate(1.5deg); } 65% { transform: translateY(-1px); } }
@keyframes companion-sway { 0%,100% { transform: none; } 30% { transform: translateX(-2px) rotate(-2deg); } 70% { transform: translateX(2px) rotate(2deg); } }
@keyframes companion-look { 0%,100% { transform: none; } 28% { transform: translateX(-3px) rotate(-3deg); } 65% { transform: translateX(2px) rotate(2deg); } }
@keyframes companion-cozy { 0%,100% { transform: none; } 40%,70% { transform: translateY(1px) rotate(2.5deg); } }
@keyframes companion-speak { from { opacity: .3; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (min-width:1250px) {
  body .search-companion { position: absolute; left: 0; right: auto; top: -79px; max-width: none; }
}
@media (min-width:861px) and (max-width:1249px) {
  body .search-title { gap: 14px; }
  body .search-title kbd { margin-left: auto; }
  body .search-companion { margin-left: 0; }
}
@media (max-width:860px) {
  body .search-title { flex-wrap: wrap; gap: 10px; }
  body .search-companion { position: relative; left: auto; right: auto; top: auto; order: -1; flex-basis: 100%; margin: -32px 0 2px; max-width: 100%; }
  body .search-companion .companion-cat, body .search-companion .companion-cat img { width: 64px; height: 64px; }
  body .search-companion .companion-bubble { width: min(244px,calc(100% - 72px)); min-width: 0; padding: 8px 8px 8px 11px; gap: 5px; }
  body .search-companion .companion-line { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  body .search-companion .companion-cat img, body .search-companion .companion-line { animation: none !important; }
}
/* A floated companion is portalled to body: glass panels cannot trap its fixed positioning. */
body .search-companion.is-floating {
  position: fixed; right: auto; bottom: auto; margin: 0; width: max-content;
  max-width: calc(100vw - 16px); flex-basis: auto; z-index: 90;
}
body .search-companion.is-floating .companion-bubble { width: min(270px,calc(100vw - 100px)); backdrop-filter: blur(12px); }
body .search-companion .companion-home {
  flex: none; width: 30px; padding: 3px 1px; min-height: 30px; border: 0;
  border-radius: 7px; background: transparent; color: var(--polish-muted); font: inherit; font-size: 10px; cursor: pointer;
}
body .search-companion .companion-home[hidden] { display: none; }
body .search-companion .companion-home:hover { background: var(--polish-soft); color: var(--polish-copy); }
body .search-companion.is-dragging { user-select: none; }
body .search-companion.is-dragging .companion-cat { cursor: grabbing; }
body .search-companion.is-dragging .companion-cat img { animation: none !important; }
body .search-companion.is-covered, body .search-companion.companion-placeholder { visibility: hidden; pointer-events: none; }

/* Closing chatter keeps the drag handle visible and the speech controls out of Tab order. */
body .search-companion .companion-bubble { position: relative; padding-right: 35px; }
body .search-companion .companion-bubble[hidden] { display: none; }
body .search-companion.is-quiet { gap: 0; flex-basis: auto; }
body .search-companion .companion-close {
  position: absolute; top: 4px; right: 4px; display: grid; place-items: center;
  width: 27px; height: 27px; min-height: 27px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--polish-muted); font: inherit; font-size: 19px; cursor: pointer;
}
body .search-companion .companion-close:hover { background: var(--polish-soft); color: var(--polish-copy); }
body .search-companion .companion-close:focus-visible { outline: 2px solid var(--ui-focus,var(--polish-accent)); outline-offset: 1px; }
html[data-motion='off'] .search-companion .companion-cat img,
html[data-motion='off'] .search-companion .companion-line { animation: none !important; }
