@import url("./voice-input-control.css?v=20260910-lyric-motion");

.character-bubble {
  --bubble-content-width: 184px;
  --bubble-max-width: 520px;
  --bubble-min-height: 48px;
  --bubble-padding-block: 11px;
  --bubble-padding-inline: 16px;
  --bubble-font-size: 16px;
  --bubble-line-height: 1.42;
  --bubble-rest-transform: translateZ(0);
  --bubble-tail-x: 50%;
  isolation: isolate;
  width: min(var(--bubble-content-width), var(--bubble-max-width), calc(100vw - 24px));
  min-height: var(--bubble-min-height);
  padding: var(--bubble-padding-block) var(--bubble-padding-inline);
  border: 1px solid rgba(47, 53, 44, .31);
  border-radius: 999px;
  background: rgba(250, 246, 235, .97);
  box-shadow: 0 14px 34px rgba(54, 47, 38, .14), inset 0 1px rgba(255, 255, 255, .72);
  color: #2f332d;
  font-family: ui-rounded, "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: var(--bubble-font-size);
  font-weight: 750;
  line-height: var(--bubble-line-height);
  text-align: center;
  display: grid;
  place-items: center;
  transform: var(--bubble-rest-transform);
  transform-origin: var(--bubble-tail-x) 100%;
  transition:
    width 560ms cubic-bezier(.22, 1, .36, 1),
    min-height 360ms cubic-bezier(.22, 1, .36, 1),
    box-shadow 220ms ease,
    filter 220ms ease;
  will-change: width, transform, opacity;
}

.character-bubble::before { content: none; }

.character-bubble__text {
  width: 100%;
  min-width: 0;
  max-height: calc(2em * var(--bubble-line-height));
  display: -webkit-box;
  overflow: hidden;
  contain: paint;
  clip-path: inset(0);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
  line-break: strict;
  white-space: normal;
  font: inherit;
  letter-spacing: 0;
  text-align: center;
  align-self: center;
}

/* Calligraph moves individual glyph layers while they enter. Keep those
   layers inside the same two-line paint box as the bubble text. */
.character-bubble__text .calligraph-text {
  display: inline;
  max-width: 100%;
}

.character-bubble__text .calligraph-glyph {
  display: inline-block;
  vertical-align: baseline;
  line-height: inherit;
}

.mengmeng-calligraph,
.mengmeng-calligraph > span {
  font: inherit;
  vertical-align: baseline;
}

.mengmeng-calligraph {
  max-width: 100%;
  text-align: center;
}

.user-input-bubble {
  border-color: rgba(255, 255, 255, .98);
  background: rgba(255, 255, 255, .98);
  color: #315447;
  text-shadow: 0 1px rgba(255, 255, 255, .95);
  box-shadow:
    0 0 0 1px rgba(48, 84, 71, .12),
    0 0 18px rgba(255, 255, 255, .96),
    0 10px 30px rgba(42, 74, 61, .16),
    inset 0 1px rgba(255, 255, 255, 1);
}

.user-input-bubble .character-bubble__tail {
  border-color: rgba(255, 255, 255, .98);
  background: #fff;
  box-shadow: 3px 3px 8px rgba(50, 78, 65, .08);
}

.character-bubble__tail {
  position: absolute;
  z-index: -1;
  left: var(--bubble-tail-x);
  bottom: -7px;
  width: 15px;
  height: 15px;
  border-right: 1px solid rgba(47, 53, 44, .31);
  border-bottom: 1px solid rgba(47, 53, 44, .31);
  border-radius: 0 0 5px 0;
  background: rgba(250, 246, 235, .97);
  transform: translateX(-50%) rotate(45deg);
}

.character-bubble:is(:hover, :focus-visible) {
  filter: brightness(1.015);
  box-shadow: 0 16px 38px rgba(54, 47, 38, .17), inset 0 1px rgba(255, 255, 255, .78);
}

.character-bubble.is-entering {
  animation: character-bubble-enter 560ms cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes character-bubble-enter {
  0% {
    opacity: 0;
    transform: var(--bubble-rest-transform) translateY(12px) scale(.92);
    filter: blur(1.5px);
  }
  64% {
    opacity: 1;
    transform: var(--bubble-rest-transform) translateY(-1px) scale(1.008);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: var(--bubble-rest-transform) translateY(0) scale(1);
    filter: blur(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .character-bubble {
    transition-duration: .01ms !important;
  }
  .character-bubble.is-entering {
    animation: none !important;
  }
}
