/* ==========================================================================
   CosmicVerse — Character Speech Bubble
   ========================================================================== */

.cv-speech {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 2rem 0;
  font-size: 1rem;
  line-height: 1.7;
}

/* ---- Right variant ---- */
.cv-speech--right {
  flex-direction: row-reverse;
}

/* ---- Character column ---- */
.cv-speech__char {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: flex-start;  /* 吹き出しの高さに引っ張られない */
  flex-shrink: 0;
  width: 96px;
  gap: 0;
}

.cv-speech__avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  flex-shrink: 0;
  margin-bottom: 0;
}

.cv-speech__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cv-speech__avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--cv-bg-card, #111827);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.cv-speech__name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cv-text, #e2e8f4);
  text-align: center;
  margin: -12px 0 0;
  line-height: 1.2;
}

.cv-speech__role {
  font-size: 0.65rem;
  color: var(--cv-text-muted, #8892a4);
  text-align: center;
  margin: 2px 0 0;
  line-height: 1.3;
}

/* ---- Bubble ---- */
.cv-speech__bubble {
  position: relative;
  border-radius: 16px;
  padding: 14px 18px;
  max-width: calc(100% - 96px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  /* color/background は inline style でキャラ個別に設定 */
}

/* Triangle — left 向き（アバターが左） */
.cv-speech--left .cv-speech__bubble {
  border-top-left-radius: 4px;
}

.cv-speech--left .cv-speech__triangle {
  position: absolute;
  left: -10px;
  top: 20px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right-width: 10px;
  border-right-style: solid;
  /* border-right-color は inline style でバブル背景色と同色に */
}

/* Triangle — right 向き（アバターが右） */
.cv-speech--right .cv-speech__bubble {
  border-top-right-radius: 4px;
}

.cv-speech--right .cv-speech__triangle {
  position: absolute;
  right: -10px;
  top: 20px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left-width: 10px;
  border-left-style: solid;
  /* border-left-color は inline style でバブル背景色と同色に */
}

.cv-speech__text {
  margin: 0;
}

.cv-speech__text p {
  margin: 0 0 0.5em;
}

.cv-speech__text p:last-child {
  margin-bottom: 0;
}

/* ---- Type B (Light) overrides ---- */
.scheme-type-b .cv-speech__avatar {
  border-color: rgba(43, 76, 140, 0.2);
}

.scheme-type-b .cv-speech__name {
  color: var(--cv-text);
}

.scheme-type-b .cv-speech__role {
  color: var(--cv-text-muted);
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .cv-speech {
    gap: 10px;
  }

  .cv-speech__char {
    width: 72px;
  }

  .cv-speech__avatar {
    width: 68px;
    height: 68px;
  }

  .cv-speech__bubble {
    padding: 10px 14px;
    max-width: calc(100% - 86px);
    font-size: 0.9375rem;
  }
}
