.chat-panel {
  position: relative;
  overflow: hidden;
}

.brain-loading {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: #e8eef8;
}

.brain-loading[hidden] {
  display: none;
}

.brain-loading span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2778f3, #7759dd, #37b8dc);
  animation: brain-progress 1.25s ease-in-out infinite;
}

.thinking-message {
  animation: thinking-enter .22s ease-out;
}

.thinking-message .thinking-bubble {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 280px;
  background: linear-gradient(110deg, #f3f7fd 20%, #f9fbff 45%, #f3f7fd 70%);
  background-size: 220% 100%;
  animation: thinking-shimmer 2.2s linear infinite;
}

.thinking-label strong,
.thinking-label small {
  display: block;
}

.thinking-label strong {
  font-size: 12px;
  color: #41506a;
}

.thinking-label small {
  margin-top: 2px;
  color: #8b97aa;
  font-size: 9px;
}

.thinking-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4c82d4;
  animation: thinking-dot 1.15s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) { animation-delay: .16s; }
.thinking-dots i:nth-child(3) { animation-delay: .32s; }
.ask-form button:disabled { cursor: wait; opacity: .72; }
.ask-form textarea[readonly] { background: #f5f7fa; color: #7d899c; }

@keyframes brain-progress {
  0% { transform: translateX(-115%); }
  55% { transform: translateX(125%); }
  100% { transform: translateX(285%); }
}

@keyframes thinking-dot {
  0%, 65%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes thinking-shimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -40% 0; }
}

@keyframes thinking-enter {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .brain-loading span,
  .thinking-message .thinking-bubble,
  .thinking-dots i {
    animation-duration: 2.5s;
  }
  .thinking-message { animation: none; }
}
