/* One speech shape for callouts, house interactions and conversation text. */
.npc-speech:is(.dg-speech-bubble, .hi-bubble, .hi-dlg-text, .base-dialog-text, .dialog-speech-bubble) {
  --speech-ink: #203329;
  position: relative;
  isolation: isolate;
  padding: 10px 14px;
  background: #fff;
  color: #18251f;
  border: 2px solid var(--speech-ink);
  border-radius: 8px;
  box-shadow: none;
  overflow-wrap: anywhere;
}
.npc-speech:is(.dg-speech-bubble, .hi-bubble) { position: absolute; padding: 8px 12px; }
.npc-speech::after {
  content: "";
  position: absolute;
  top: 100%; left: 24px;
  width: 0; height: 0;
  transform: none;
  border: 6px solid transparent;
  border-top-color: var(--speech-ink);
}
.npc-speech:is(.dg-speech-bubble, .hi-bubble)::after { left: 50%; transform: translateX(-50%); }
.npc-speech[data-emotion="excited"] {
  --speech-shape: polygon(0 6px, 5% 0, 12% 6px, 20% 0, 28% 6px, 36% 0, 44% 6px, 52% 0, 60% 6px, 68% 0, 76% 6px, 84% 0, 92% 6px, 100% 0, calc(100% - 4px) 22%, 100% 40%, calc(100% - 4px) 58%, 100% 78%, calc(100% - 4px) 100%, 88% calc(100% - 6px), 80% 100%, 72% calc(100% - 6px), 64% 100%, 56% calc(100% - 6px), 48% 100%, 40% calc(100% - 6px), 32% 100%, 24% calc(100% - 6px), 16% 100%, 8% calc(100% - 6px), 0 100%, 4px 78%, 0 58%, 4px 40%, 0 22%);
  background: transparent;
  border-color: transparent;
  border-radius: 0;
}
.npc-speech[data-emotion="excited"]::before,
.npc-speech[data-emotion="excited"]::after {
  content: ""; position: absolute; inset: -2px;
  width: auto; height: auto; border: 0; transform: none;
  clip-path: var(--speech-shape); background: var(--speech-ink); z-index: -1;
}
.npc-speech[data-emotion="excited"]::after { inset: 1px; background: #fff5f0; }
.npc-voice-toggle {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  margin-left: auto; padding: 0; border: 1px solid #536a5b; border-radius: 6px;
  background: #fff; color: #203329; font: inherit; cursor: pointer;
}
.npc-voice-toggle:focus-visible { outline: 3px solid #298258; outline-offset: 2px; }
.base-dialog-head .npc-voice-toggle { margin-left: auto; }
.base-dialog-head .base-dialog-skip { margin-left: 0; }
.hi-dlg-body { padding: 2px 2px 8px; }
.base-dialog-overlay { padding: 10px 8px; }
.base-dialog-card { max-width: 560px; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.base-dialog-text.npc-speech { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.base-dialog-head > div:nth-child(2) { min-width: 0; }
@media (max-width: 480px) {
  .base-dialog-card { padding: 10px; gap: 8px; }
  .base-dialog-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 32px; gap: 4px 8px; }
  .base-dialog-head strong { font-size: 0.9rem; line-height: 1.25; }
  .base-dialog-head small { font-size: 0.72rem; }
  .base-dialog-head .base-dialog-skip { grid-column: 2 / 4; justify-self: end; }
  .base-dialog-head .npc-voice-toggle { margin: 0; }
}
