/* 语义资产 — AI 对话演示（仅 semantic-typing 前缀，模块内样式） */

.semantic-typing--chat {
  width: 100%;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #334155;
}

@media (min-width: 1024px) {
  .semantic-typing--chat {
    margin-left: 0;
    margin-right: auto;
    max-width: none;
  }
}

.semantic-typing__shell {
  position: relative;
  border-radius: 1.35rem;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(167, 139, 250, 0.45),
    rgba(129, 140, 248, 0.25),
    rgba(255, 255, 255, 0.35)
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 18px 48px -20px rgba(15, 23, 42, 0.18),
    0 4px 16px -8px rgba(91, 33, 182, 0.12);
}

.semantic-typing__viewport {
  --semantic-viewport-h: min(22rem, 52vh);
  height: var(--semantic-viewport-h);
  min-height: var(--semantic-viewport-h);
  max-height: var(--semantic-viewport-h);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  border-radius: 1.3rem;
  padding: 1.1rem 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.semantic-typing__viewport::-webkit-scrollbar {
  width: 6px;
}
.semantic-typing__viewport::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.28);
  border-radius: 999px;
}

.semantic-typing__msg {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  animation: semantic-typing-msg-in 0.48s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.semantic-typing__msg:last-child {
  margin-bottom: 0;
}

.semantic-typing__msg--user {
  flex-direction: row-reverse;
}

@keyframes semantic-typing-msg-in {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.semantic-typing__avatar {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transform: translateZ(0);
}

.semantic-typing__avatar--user {
  color: #f8fafc;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 45%, #312e81 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35);
}

.semantic-typing__avatar--ai {
  color: #faf5ff;
  background: radial-gradient(circle at 30% 25%, #a78bfa 0%, #6d28d9 42%, #4c1d95 100%);
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.45),
    0 6px 18px rgba(91, 33, 182, 0.35);
}

.semantic-typing__avatar--ai.is-typing {
  animation: semantic-typing-avatar-breath 1.6s ease-in-out infinite;
}

@keyframes semantic-typing-avatar-breath {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(196, 181, 253, 0.45),
      0 6px 18px rgba(91, 33, 182, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(233, 213, 255, 0.75),
      0 0 22px rgba(167, 139, 250, 0.55),
      0 8px 22px rgba(91, 33, 182, 0.45);
  }
}

.semantic-typing__col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: calc(100% - 3rem);
}

.semantic-typing__msg--user .semantic-typing__col {
  align-items: flex-end;
}

.semantic-typing__msg--ai .semantic-typing__col {
  align-items: flex-start;
}

.semantic-typing__name {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.semantic-typing__name--user {
  color: #64748b;
}

.semantic-typing__name--ai {
  color: #6d28d9;
}

.semantic-typing__bubble {
  position: relative;
  border-radius: 1.15rem;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 28px -12px rgba(15, 23, 42, 0.14);
  transform: translateZ(0);
}

.semantic-typing__bubble--user {
  color: #f1f5f9;
  background: linear-gradient(155deg, #334155 0%, #1e293b 55%, #312e81 100%);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 32px -14px rgba(15, 23, 42, 0.45);
}

.semantic-typing__bubble--ai {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(196, 181, 253, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 32px -16px rgba(91, 33, 182, 0.18);
}

.semantic-typing__bubble-inner {
  font-size: 0.875rem;
  line-height: 1.62;
  word-break: break-word;
}

.semantic-typing__type-cursor {
  display: inline-block;
  margin-left: 1px;
  font-weight: 300;
  color: #a78bfa;
  vertical-align: text-bottom;
  animation: semantic-typing-cursor 0.9s step-end infinite;
}

.semantic-typing__type-cursor.is-hidden {
  display: none;
}

.semantic-typing__bubble--user .semantic-typing__type-cursor {
  color: #c4b5fd;
}

@keyframes semantic-typing-cursor {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .semantic-typing__msg {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .semantic-typing__avatar--ai.is-typing {
    animation: none;
  }
  .semantic-typing__type-cursor {
    animation: none;
    opacity: 0.55;
  }
  .semantic-typing__viewport {
    scroll-behavior: auto;
  }
}
