.auth-shell.auth-pending {
  visibility: hidden;
}

.message-entering {
  animation: message-arrive 360ms ease-out both;
}

.thinking-message {
  position: relative;
  overflow: hidden;
  min-width: min(360px, 82%);
  border: 1px solid rgba(103, 232, 249, 0.22);
}

.thinking-message::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.08) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: thinking-sheen 1.8s ease-in-out infinite;
  pointer-events: none;
}

.thinking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-top: 9px;
  color: #cffafe;
}

.thinking-phase {
  min-width: 9em;
}

.thinking-dots {
  display: inline-flex;
  gap: 5px;
}

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

.thinking-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 280ms;
}

.message.assistant {
  max-width: min(860px, 94%);
}

.markdown-body {
  color: #f8fafc;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.markdown-body > :first-child {
  margin-top: 8px;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 24px 0 10px;
  color: #ffffff;
  font-size: 1.08rem;
  line-height: 1.4;
  letter-spacing: 0;
}

.markdown-body h3 {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.24);
  font-size: 1.22rem;
}

.markdown-body p {
  margin: 10px 0;
  white-space: normal;
}

.markdown-body strong {
  color: #a5f3fc;
  font-weight: 800;
}

.markdown-body em {
  color: #c7d2fe;
}

.markdown-body a {
  color: #67e8f9;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 10px 0;
  padding-left: 24px;
}

.markdown-body li {
  margin: 5px 0;
  padding-left: 3px;
}

.markdown-body blockquote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 3px solid #67e8f9;
  border-radius: 0 10px 10px 0;
  background: rgba(8, 145, 178, 0.12);
  color: #e0f2fe;
}

.markdown-body code {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  color: #fde68a;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  margin: 14px 0;
  padding: 15px 17px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #0b1028;
}

.markdown-body pre code {
  display: block;
  min-width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  white-space: pre;
}

.markdown-body hr {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
}

.markdown-table-wrap {
  margin: 15px 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
}

.markdown-body table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.25);
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(79, 70, 229, 0.3);
  color: #ffffff;
  font-weight: 800;
}

.markdown-body tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-body tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.035);
}

.markdown-body .align-center {
  text-align: center;
}

.markdown-body .align-right {
  text-align: right;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

@keyframes message-arrive {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes thinking-sheen {
  0%, 25% {
    transform: translateX(-100%);
  }
  70%, 100% {
    transform: translateX(100%);
  }
}

@keyframes thinking-dot {
  0%, 70%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-entering,
  .thinking-message::after,
  .thinking-dots i {
    animation: none;
  }
}
