/* Matrix host-only minimized Assistant skin. The shared @vl/ui-agent-chat panel,
   actions and expanded UI remain authoritative; this layer decorates collapse. */
#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) {
  right:18px !important;
  bottom:14px !important;
  width:144px !important;
  min-width:144px;
  height:172px !important;
  min-height:172px;
  max-height:172px;
  overflow:visible;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
body.matrix25d-full-ui-open #agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) {
  right:18px !important;
}
#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) > .chat-header {
  width:144px;
  height:172px;
  overflow:visible;
  background:transparent;
}
#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) > .chat-header > .chat-collapse-btn {
  width:144px;
  height:172px;
  padding:0;
  overflow:visible;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
  transform:none;
}
#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) > .chat-header > .chat-collapse-btn:hover {
  transform:none;
  box-shadow:none;
}
#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) > .chat-header > .chat-collapse-btn > .chat-collapse-badge {
  position:absolute;
  inset:0;
  display:block;
  width:144px;
  height:172px;
}
#agent-chat-mount .matrix-pet-stage {
  position:absolute;
  inset:0;
  display:grid;
  place-items:end center;
  transform-origin:50% 88%;
  animation:matrix-pet-idle 4.8s ease-in-out infinite;
}
#agent-chat-mount .matrix-pet-avatar {
  position:absolute;
  right:4px;
  bottom:23px;
  width:132px;
  height:132px;
  object-fit:contain;
  user-select:none;
  filter:drop-shadow(0 12px 8px rgba(22,18,8,.3));
  transform-origin:50% 82%;
  transition:filter .2s ease, transform .2s ease;
}
#agent-chat-mount .chat-collapse-btn:hover .matrix-pet-avatar {
  filter:drop-shadow(0 14px 10px rgba(22,18,8,.34)) drop-shadow(0 0 7px rgba(76,217,223,.52));
  transform:translateY(-3px) rotate(-2deg) scale(1.035);
}
#agent-chat-mount .matrix-pet-glow {
  position:absolute;
  right:25px;
  bottom:29px;
  width:92px;
  height:19px;
  border-radius:50%;
  background:radial-gradient(ellipse, rgba(76,217,223,.5), rgba(76,217,223,.06) 58%, transparent 72%);
  filter:blur(3px);
  animation:matrix-pet-glow 2.4s ease-in-out infinite;
}
#agent-chat-mount .matrix-pet-status {
  position:absolute;
  right:8px;
  bottom:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  min-width:118px;
  height:28px;
  padding:0 11px;
  border:1px solid rgba(208,170,92,.72);
  border-radius:999px;
  background:linear-gradient(180deg, rgba(29,42,54,.98), rgba(15,28,39,.98));
  box-shadow:0 6px 0 rgba(121,88,38,.18), 0 10px 24px rgba(32,22,9,.24), inset 0 1px rgba(255,255,255,.12);
  color:#f7f1dd;
  font:700 10px/1 var(--sans, system-ui);
  letter-spacing:.01em;
  white-space:nowrap;
}
#agent-chat-mount .matrix-pet-status i,
#agent-chat-mount .matrix-pet-fallback i {
  width:8px;
  height:8px;
  flex:none;
  border-radius:50%;
  background:#4ed9cf;
  box-shadow:0 0 0 4px rgba(78,217,207,.14), 0 0 10px rgba(78,217,207,.72);
}
#agent-chat-mount .matrix-pet-status b { color:#74e7e0; font-weight:800; }
#agent-chat-mount .matrix-pet-fallback { display:none; }

#agent-chat-mount .matrix-pet-state-working .matrix-pet-stage { animation:matrix-pet-work .82s ease-in-out infinite; }
#agent-chat-mount .matrix-pet-state-working .matrix-pet-status i { background:#f5c451; box-shadow:0 0 0 4px rgba(245,196,81,.16), 0 0 10px rgba(245,196,81,.72); }
#agent-chat-mount .matrix-pet-state-working .matrix-pet-status b { color:#ffd873; }
#agent-chat-mount .matrix-pet-state-success .matrix-pet-stage { animation:matrix-pet-success .72s cubic-bezier(.2,.9,.25,1.25) both; }
#agent-chat-mount .matrix-pet-state-success .matrix-pet-status i { background:#5fe0a0; box-shadow:0 0 0 4px rgba(95,224,160,.16), 0 0 10px rgba(95,224,160,.72); }
#agent-chat-mount .matrix-pet-state-success .matrix-pet-status b { color:#84f1ba; }
#agent-chat-mount .matrix-pet-state-error .matrix-pet-stage { animation:matrix-pet-error .46s ease-in-out 2; }
#agent-chat-mount .matrix-pet-state-error .matrix-pet-status i { background:#f0645d; box-shadow:0 0 0 4px rgba(240,100,93,.16), 0 0 10px rgba(240,100,93,.72); }
#agent-chat-mount .matrix-pet-state-error .matrix-pet-status b { color:#ff9a94; }

#agent-chat-mount .matrix-pet-result {
  position:absolute;
  right:112px;
  bottom:84px;
  z-index:4;
  display:grid;
  grid-template-columns:34px minmax(0,1fr);
  gap:9px 11px;
  width:min(360px, calc(100vw - 178px));
  padding:15px 16px 12px;
  overflow:visible;
  border:1px solid rgba(156,119,49,.35);
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,253,246,.99), rgba(248,241,222,.99));
  box-shadow:0 18px 44px rgba(49,35,14,.24), 0 3px 0 rgba(139,101,42,.18), inset 0 1px #fff;
  color:#28302e;
  font-family:var(--sans, system-ui);
  text-align:left;
  pointer-events:auto;
  opacity:0;
  transform:translate(12px, 10px) scale(.96);
  transform-origin:100% 100%;
  transition:opacity .2s ease, transform .28s cubic-bezier(.2,.85,.25,1.1);
}
#agent-chat-mount .matrix-pet-result[hidden] { display:none; }
#agent-chat-mount .matrix-pet-result::before,
#agent-chat-mount .matrix-pet-result::after {
  content:'';
  position:absolute;
  z-index:-1;
  right:18px;
  bottom:-8px;
  left:18px;
  height:20px;
  border:1px solid rgba(156,119,49,.22);
  border-radius:0 0 16px 16px;
  background:#efe4c8;
  box-shadow:0 6px 13px rgba(49,35,14,.1);
}
#agent-chat-mount .matrix-pet-result::after { right:29px; bottom:-14px; left:29px; background:#e5d6b3; }
#agent-chat-mount .matrix-pet-result.is-visible { opacity:1; transform:translate(0,0) scale(1); }
#agent-chat-mount .matrix-pet-result.is-leaving { opacity:0; transform:translate(8px,8px) scale(.98); }
#agent-chat-mount .matrix-pet-result__icon {
  display:grid;
  width:34px;
  height:34px;
  place-items:center;
  border:2px solid rgba(41,145,91,.22);
  border-radius:50%;
  background:#43c77e;
  box-shadow:0 0 0 5px rgba(67,199,126,.11);
  color:#fff;
  font-size:20px;
  font-weight:900;
}
#agent-chat-mount .matrix-pet-result.is-error .matrix-pet-result__icon { border-color:rgba(198,67,60,.22); background:#e65b54; box-shadow:0 0 0 5px rgba(230,91,84,.11); }
#agent-chat-mount .matrix-pet-result.is-attention .matrix-pet-result__icon { border-color:rgba(195,139,31,.22); background:#e5a936; box-shadow:0 0 0 5px rgba(229,169,54,.12); }
#agent-chat-mount .matrix-pet-result__copy { min-width:0; }
#agent-chat-mount .matrix-pet-result__copy b { display:block; overflow:hidden; color:#1d2727; font-size:14px; line-height:1.3; text-overflow:ellipsis; white-space:nowrap; }
#agent-chat-mount .matrix-pet-result__copy p { display:-webkit-box; margin:3px 0 9px; overflow:hidden; color:#626762; font-size:11px; line-height:1.45; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
#agent-chat-mount .matrix-pet-result__chips { display:flex; flex-wrap:wrap; gap:5px; }
#agent-chat-mount .matrix-pet-result__chips span { padding:4px 7px; border:1px solid rgba(127,105,66,.2); border-radius:999px; background:rgba(255,255,255,.7); color:#6a604d; font-size:9px; font-weight:700; }
#agent-chat-mount .matrix-pet-result__actions { grid-column:1/-1; display:flex; justify-content:flex-end; gap:6px; padding-top:9px; border-top:1px solid rgba(127,105,66,.14); }
#agent-chat-mount .matrix-pet-result__actions button { min-height:28px; padding:0 10px; border:0; border-radius:9px; background:transparent; color:#7b6741; font:800 10px/1 var(--sans, system-ui); cursor:pointer; }
#agent-chat-mount .matrix-pet-result__actions button:first-child { background:#263746; color:#f8f1dc; box-shadow:0 3px 0 #17242d; }
#agent-chat-mount .matrix-pet-result__actions button:hover { filter:brightness(1.08); }
#agent-chat-mount .chat-panel:not(.collapsed) > .matrix-pet-result { display:none; }

#agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet.matrix-pet-hidden {
  right:12px !important;
  bottom:12px !important;
  width:150px !important;
  min-width:150px;
  height:52px !important;
  min-height:52px;
  max-height:52px;
}
body.matrix25d-full-ui-open #agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet.matrix-pet-hidden { right:18px !important; }
#agent-chat-mount .chat-panel.collapsed.matrix-pet-hidden > .chat-header,
#agent-chat-mount .chat-panel.collapsed.matrix-pet-hidden > .chat-header > .chat-collapse-btn { width:150px; height:52px; }
#agent-chat-mount .matrix-pet-hidden .matrix-pet-stage { display:none; }
#agent-chat-mount .matrix-pet-hidden .matrix-pet-fallback { display:flex; align-items:center; gap:10px; }
#agent-chat-mount .matrix-pet-fallback b { color:#e6f7ff; font-size:12px; letter-spacing:.02em; }

.matrix-pet-menu {
  position:fixed;
  z-index:10050;
  display:grid;
  min-width:178px;
  padding:5px;
  border:1px solid rgba(208,170,92,.45);
  border-radius:12px;
  background:#142230f5;
  box-shadow:0 16px 36px rgba(4,10,16,.42);
}
.matrix-pet-menu button { padding:9px 10px; border:0; border-radius:8px; background:transparent; color:#edf5f2; font:700 11px/1.2 var(--sans, system-ui); text-align:left; cursor:pointer; }
.matrix-pet-menu button:hover { background:#ffffff12; color:#ffd873; }

@keyframes matrix-pet-idle {
  0%,100% { transform:translateY(0) rotate(0); }
  42% { transform:translateY(-5px) rotate(-1deg); }
  52% { transform:translateY(-5px) rotate(1.2deg); }
  64% { transform:translateY(-3px) rotate(0); }
}
@keyframes matrix-pet-work {
  0%,100% { transform:translateY(0) rotate(-1.5deg); }
  50% { transform:translateY(-5px) rotate(1.5deg); }
}
@keyframes matrix-pet-success {
  0% { transform:translateY(0) scale(1); }
  42% { transform:translateY(-19px) rotate(-4deg) scale(1.06); }
  68% { transform:translateY(2px) rotate(2deg) scale(.98); }
  100% { transform:translateY(0) rotate(0) scale(1); }
}
@keyframes matrix-pet-error {
  0%,100% { transform:translateX(0) rotate(0); }
  25% { transform:translateX(-5px) rotate(-2deg); }
  75% { transform:translateX(5px) rotate(2deg); }
}
@keyframes matrix-pet-glow { 0%,100% { opacity:.48; transform:scale(.92); } 50% { opacity:.92; transform:scale(1.08); } }

@media (max-width:760px) {
  #agent-chat-mount .chat-panel.collapsed.matrix-assistant-pet:not(.matrix-pet-hidden) { right:8px !important; bottom:8px !important; transform:scale(.88); transform-origin:100% 100%; }
  #agent-chat-mount .matrix-pet-result { right:72px; bottom:112px; width:min(320px, calc(100vw - 88px)); }
}
@media (prefers-reduced-motion:reduce) {
  #agent-chat-mount .matrix-pet-stage,
  #agent-chat-mount .matrix-pet-glow { animation:none !important; }
  #agent-chat-mount .matrix-pet-result { transition:none; }
}
