/* Brand identity for ordinary assistant replies. Keep generated-file service cards compact. */
.bubble.assistant:not(.generated-file-only){
  position:relative;
  padding-top:50px;
}
.bubble.assistant:not(.generated-file-only)::before{
  content:'';
  position:absolute;
  top:10px;
  left:12px;
  width:28px;
  height:28px;
  box-sizing:border-box;
  border:1px solid rgba(112,162,255,.34);
  border-radius:50%;
  background:#0b1528 url('/images/med-v-karmane-logo.jpg') center/cover no-repeat;
  box-shadow:0 4px 14px rgba(0,0,0,.24),0 0 0 2px rgba(46,123,255,.06);
  pointer-events:none;
}
.bubble.assistant:not(.generated-file-only)::after{
  content:'Мёд в кармане';
  position:absolute;
  top:15px;
  left:49px;
  right:52px;
  overflow:hidden;
  color:#eef4ff;
  font-size:12.5px;
  font-weight:750;
  line-height:18px;
  letter-spacing:-.01em;
  white-space:nowrap;
  text-overflow:ellipsis;
  pointer-events:none;
}

/* Keep the temporary "Думаю…" bubble compact while preserving the same assistant identity. */
.bubble.assistant.streaming{
  width:fit-content;
  max-width:88%;
  min-width:156px;
  min-height:0;
  box-sizing:border-box;
  padding:47px 12px 11px;
  display:flex;
  align-items:flex-start;
  gap:7px;
  line-height:1.45;
}
.bubble.assistant.streaming::after{
  right:12px;
}
.bubble.assistant.streaming .spinner{
  width:18px;
  height:18px;
  margin-right:0;
  flex:0 0 18px;
}
.bubble.assistant.streaming .stream-content{
  display:block;
  min-width:0;
  max-width:100%;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* JSON AI animation shown in the background only while the assistant says "Думаю…". */
.chat-page #messages{
  position:relative;
  z-index:4;
}

.ai-thinking-animation{
  position:fixed;
  left:50%;
  top:44%;
  z-index:3;
  width:clamp(136px,17vw,176px);
  height:clamp(136px,17vw,176px);
  pointer-events:none;
  opacity:0;
  visibility:hidden;
  transform:translate3d(-50%,-50%,0) scale(.94);
  transition:opacity .26s ease,transform .26s ease,visibility 0s linear .26s;
  will-change:opacity,transform;
  filter:drop-shadow(0 0 26px rgba(75,135,255,.28));
}

.ai-thinking-animation.is-visible{
  opacity:.58;
  visibility:visible;
  transform:translate3d(-50%,-50%,0) scale(1);
  transition-delay:0s;
}

.ai-thinking-animation svg{
  display:block;
  width:100%!important;
  height:100%!important;
  overflow:visible;
  background:transparent!important;
}

@media(max-width:520px){
  .bubble.assistant:not(.generated-file-only){
    padding-top:48px;
  }
  .bubble.assistant:not(.generated-file-only)::before{
    top:10px;
    left:11px;
    width:27px;
    height:27px;
  }
  .bubble.assistant:not(.generated-file-only)::after{
    top:14px;
    left:47px;
    font-size:12px;
  }
  .bubble.assistant.streaming{
    min-width:150px;
    padding:46px 11px 10px;
  }
  .ai-thinking-animation{
    top:43%;
    width:138px;
    height:138px;
  }
}

@media(prefers-reduced-motion:reduce){
  .ai-thinking-animation{
    transition:opacity .15s linear,visibility 0s linear .15s;
  }
}

/* Theme-aware assistant identity contrast. */
html[data-site-theme="day"] .bubble.assistant:not(.generated-file-only)::after{
  color:#244b5d!important;
}
html[data-site-theme="day"] .bubble.assistant:not(.generated-file-only)::before{
  border-color:rgba(47,106,130,.24);
  box-shadow:0 4px 14px rgba(43,75,90,.14),0 0 0 2px rgba(37,121,232,.05);
}
html[data-site-theme="night"] .bubble.assistant:not(.generated-file-only)::after{
  color:#eef4ff!important;
}
