/* Dialogue blocks — chat-style lines with per-take audio controls */

.dialogue-block {
  --dialogue-bubble-bg: var(--bg-block-md-quote, #eeeeee);
  --dialogue-bubble-fg: var(--color-text-md-content, #24292e);
  --dialogue-muted: var(--color-text-sub, #8e8e8e);
  --dialogue-btn-bg: var(--bg-body, #fff);
  --dialogue-btn-border: var(--color-divider-md-border, rgba(0, 0, 0, 0.12));
  --dialogue-gap: 0.85rem;

  display: flex;
  flex-direction: column;
  gap: var(--dialogue-gap);
  margin: 1.25rem 0;
  max-width: 50rem;
  padding: 0.9rem 0.85rem 0.75rem;
  border: 1px solid var(--dialogue-btn-border);
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
  background: var(--dialogue-btn-bg);
}

html[color-mode="dark"] .dialogue-block {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

.dialogue-line {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  max-width: 92%;
}

.dialogue-line.is-left {
  align-self: flex-start;
  flex-direction: row;
}

.dialogue-line.is-right {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.dialogue-line.is-hidden {
  display: none;
}

/* Avatar image, or name / speaker-key badge when no avatar */
.dialogue-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.4rem;
  object-fit: cover;
  background: var(--dialogue-bubble-bg);
}

.dialogue-avatar-name {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.4rem;
  background: var(--dialogue-bubble-bg);
  color: var(--dialogue-muted);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  padding: 0.15rem;
  overflow: hidden;
  word-break: break-all;
}

.dialogue-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.dialogue-line.is-left .dialogue-body {
  align-items: flex-start;
}

.dialogue-line.is-right .dialogue-body {
  align-items: flex-end;
}

.dialogue-bubble {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.55rem;
  background: var(--dialogue-bubble-bg);
  color: var(--dialogue-bubble-fg);
  font-size: 1rem;
  line-height: 1.55;
  /* Match markdown body typography; keep bubble readable */
  font-family: inherit;
  word-wrap: break-word;
}

.dialogue-audios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.dialogue-line.is-right .dialogue-audios {
  flex-direction: row-reverse;
}

/* Circular play / pause control */
.dialogue-audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--dialogue-btn-border);
  border-radius: 50%;
  background: var(--dialogue-btn-bg);
  color: var(--dialogue-bubble-fg);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.dialogue-audio-btn:hover,
.dialogue-audio-btn:focus-visible {
  outline: none;
  border-color: var(--color-text-md-code, #e96900);
  color: var(--color-text-md-code, #e96900);
}

.dialogue-audio-btn.is-playing {
  border-color: var(--color-text-md-code, #e96900);
  color: var(--color-text-md-code, #e96900);
}

/* Original = primary; recording = slightly quieter chrome */
.dialogue-audio-btn.is-original {
  background: var(--dialogue-bubble-bg);
}

.dialogue-audio-btn.is-recording {
  opacity: 0.92;
}

.dialogue-audio-btn .iconfont {
  font-size: 0.95rem;
  line-height: 1;
}

.dialogue-audio-btn.is-hidden {
  display: none;
}

.dialogue-more-takes {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--dialogue-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dialogue-more-takes:hover,
.dialogue-more-takes:focus-visible {
  color: var(--color-text-md-code, #e96900);
  outline: none;
}

/* Full-width expand / collapse bar at the bottom of the block */
.dialogue-expand {
  appearance: none;
  align-self: stretch;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--dialogue-btn-border);
  border-radius: 0.4rem;
  background: var(--dialogue-bubble-bg);
  color: var(--dialogue-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.dialogue-expand:hover,
.dialogue-expand:focus-visible {
  outline: none;
  color: var(--color-text-md-code, #e96900);
  border-color: var(--color-text-md-code, #e96900);
}
