.npc-conversations-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1110;
  background: rgba(2, 8, 10, 0.7);
  backdrop-filter: blur(3px);
}

.npc-conversations[hidden],
.npc-conversations-backdrop[hidden] {
  display: none;
}

.npc-conversations {
  position: fixed;
  z-index: 1120;
  top: 5.5rem;
  right: 1.25rem;
  bottom: 1.25rem;
  width: min(48rem, calc(100vw - 2.5rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f3f1eb;
  background: #071416;
  border: 1px solid rgba(100, 190, 177, 0.34);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.npc-conversations__header {
  min-height: 5rem;
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(100, 190, 177, 0.22);
}

.npc-conversations__identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.npc-conversations__header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.npc-conversations__header-button {
  position: relative;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #d9ddd8;
  background: #102426;
  border: 1px solid rgba(100, 190, 177, 0.38);
  border-radius: 50%;
  font: 700 0.7rem/1 Montserrat, sans-serif;
}

.npc-conversations__header-button span {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.2rem;
  display: grid;
  place-items: center;
  color: #071416;
  background: #d7a76e;
  border: 2px solid #071416;
  border-radius: 999px;
  font-size: 0.58rem;
}

.npc-conversations__header-button[hidden],
.npc-conversations__overlay[hidden] { display: none; }

.npc-conversations__portrait {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  color: #071416;
  background: #6fc4b7;
  border: 1px solid rgba(215, 167, 110, 0.55);
  border-radius: 50%;
  font: 800 0.9rem/1 Montserrat, sans-serif;
}

.npc-conversations__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.npc-conversations__eyebrow {
  color: #6fc4b7;
  font: 700 0.72rem/1.2 Montserrat, sans-serif;
  text-transform: uppercase;
}

.npc-conversations__header h2 {
  margin: 0.18rem 0 0;
  font: 600 1.6rem/1.1 "Cormorant Garamond", serif;
}

.npc-conversations__close,
.npc-conversations__composer [data-npc-message-submit] {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: inherit;
  background: #102426;
  border: 1px solid rgba(100, 190, 177, 0.38);
  border-radius: 50%;
}

.npc-conversations__commands {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.55rem;
}

.npc-conversations__scene-button {
  min-height: 2.45rem;
  padding: 0.45rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #e8e9e5;
  background: #102426;
  border: 1px solid rgba(100, 190, 177, 0.38);
  border-radius: 4px;
  font: 700 0.74rem/1.2 Montserrat, sans-serif;
}

.npc-conversations__scene-button small { color: #d7a76e; font-size: 0.68rem; }
.npc-conversations__scene-button:disabled { opacity: 0.55; }

.npc-conversations__body {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
}

.npc-conversations__contacts {
  padding: 0.75rem;
  overflow-y: auto;
  border-right: 1px solid rgba(100, 190, 177, 0.2);
}

.npc-contact {
  width: 100%;
  min-height: 4.1rem;
  padding: 0.55rem;
  display: grid;
  grid-template-columns: 2.65rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  color: #e8e9e5;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.npc-contact:hover,
.npc-contact:focus-visible,
.npc-contact.is-active {
  background: #102426;
  border-color: rgba(100, 190, 177, 0.38);
}

.npc-contact__portrait {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #071416;
  font: 800 0.88rem/1 Montserrat, sans-serif;
  background: #6fc4b7;
  border-radius: 50%;
}

.npc-contact__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.npc-contact__name,
.npc-contact__excerpt {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.npc-contact__name { font: 700 0.86rem/1.3 Montserrat, sans-serif; }
.npc-contact__excerpt { margin-top: 0.2rem; color: #9ba9a6; font-size: 0.72rem; }
.npc-contact.is-unavailable { opacity: 0.7; }
.npc-contact.is-unavailable .npc-contact__portrait { filter: saturate(0.45); }

.npc-conversations__thread {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.npc-conversations__welcome {
  margin: auto;
  color: #9ba9a6;
  text-align: center;
}

.npc-conversations__welcome i { color: #6fc4b7; font-size: 1.6rem; }

.npc-conversations__messages {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 1.25rem;
  overflow-y: auto;
  list-style: none;
}

.npc-message {
  width: fit-content;
  max-width: min(34rem, 86%);
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: #102426;
  border-left: 2px solid #6fc4b7;
}

.npc-message--player {
  margin-left: auto;
  background: #2a2119;
  border-left: 0;
  border-right: 2px solid #df9659;
}

.npc-message--scene {
  width: 100%;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(215, 167, 110, 0.5);
}

.npc-message--scene button {
  width: 100%;
  padding: 0;
  display: block;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.npc-message--scene img { width: 100%; aspect-ratio: 3 / 2; display: block; object-fit: cover; }
.npc-message--scene span { display: block; padding: 0.65rem 0.8rem; }

.npc-conversations__overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  padding: 0 1rem 1rem;
  overflow-y: auto;
  background: #071416;
}

.npc-conversations__overlay > header {
  position: sticky;
  z-index: 2;
  top: 0;
  margin: 0 -1rem 0.8rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #071416;
  border-bottom: 1px solid rgba(100, 190, 177, 0.2);
}

.npc-conversations__overlay h3 {
  margin: 0;
  color: #aab5b2;
  font: 700 0.72rem/1.2 Montserrat, sans-serif;
  text-transform: uppercase;
}

.npc-conversations__overlay > header button {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  color: #f3f1eb;
  background: #102426;
  border: 1px solid rgba(100, 190, 177, 0.38);
  border-radius: 50%;
}

.npc-conversations__gallery-view {
  margin-bottom: 0.8rem;
  overflow: hidden;
  background: #0b1b1d;
  border: 1px solid rgba(215, 167, 110, 0.42);
}

.npc-conversations__gallery-view img {
  width: 100%;
  max-height: 55vh;
  display: block;
  object-fit: contain;
  background: #020708;
}

.npc-conversations__gallery-view p {
  margin: 0;
  padding: 0.65rem 0.8rem;
  color: #d9ddd8;
  font-size: 0.78rem;
}

.npc-conversations__media {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.npc-media {
  width: 5rem;
  min-width: 5rem;
  padding: 0;
  overflow: hidden;
  color: #e8e9e5;
  text-align: left;
  background: #102426;
  border: 1px solid rgba(100, 190, 177, 0.3);
  border-radius: 4px;
}

.npc-media.is-active { border-color: #d7a76e; }

.npc-media img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; }
.npc-media span {
  display: block;
  padding: 0.35rem 0.4rem;
  overflow: hidden;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.npc-conversations__composer {
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid rgba(100, 190, 177, 0.2);
}

.npc-conversations__relationship > div {
  display: grid;
  gap: 0.65rem;
}

.npc-relationship-mark {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  background: #102426;
  border-left: 2px solid #d7a76e;
}

.npc-relationship-mark--friction { border-color: #d66a62; }
.npc-relationship-mark--repair { border-color: #6fc4b7; }
.npc-relationship-mark span,
.npc-relationship-mark strong,
.npc-relationship-mark small { display: block; }
.npc-relationship-mark strong { font: 700 0.72rem/1.25 Montserrat, sans-serif; }
.npc-relationship-mark small { margin-top: 0.2rem; color: #aab5b2; font-size: 0.68rem; line-height: 1.3; }
.npc-conversations__relationship-empty {
  margin: 0;
  padding: 1rem;
  color: #aab5b2;
  background: #102426;
  border-left: 2px solid #6fc4b7;
}

.npc-conversations__composer label {
  display: block;
  margin-bottom: 0.4rem;
  color: #aab5b2;
  font-size: 0.75rem;
}

.npc-conversations__composer > div { display: flex; gap: 0.65rem; align-items: flex-end; }
.npc-conversations__composer textarea {
  min-height: 3rem;
  max-height: 8rem;
  flex: 1;
  resize: vertical;
  color: #f3f1eb;
  background: #0b1b1d;
  border: 1px solid rgba(100, 190, 177, 0.32);
  border-radius: 4px;
  padding: 0.7rem;
}
.npc-conversations__composer p { min-height: 1rem; margin: 0.35rem 0 0; color: #d7a76e; font-size: 0.75rem; }
.npc-conversations__composer .npc-conversations__availability {
  min-height: 0;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  color: #d9ddd8;
  background: rgba(215, 167, 110, 0.1);
  border-left: 2px solid #d7a76e;
}

@media (max-width: 720px) {
  .npc-conversations {
    inset: 0;
    width: 100%;
  }

  .npc-conversations__body { grid-template-columns: 4.6rem minmax(0, 1fr); }
  .npc-conversations__contacts { padding: 0.45rem; }
  .npc-contact { min-height: 3.8rem; grid-template-columns: 1fr; padding: 0.45rem; }
  .npc-contact__portrait { margin: auto; }
  .npc-contact__copy { display: none; }
  .npc-conversations__messages { padding: 0.85rem; }
  .npc-message { max-width: 92%; }
  .npc-conversations__header { min-height: 4.5rem; padding: 0.75rem; }
  .npc-conversations__portrait { width: 2.5rem; height: 2.5rem; }
  .npc-conversations__header h2 { font-size: 1.35rem; }
  .npc-conversations__eyebrow { font-size: 0.6rem; }
  .npc-conversations__header-button { width: 2.35rem; min-width: 2.35rem; height: 2.35rem; }
  .npc-conversations__overlay { position: fixed; z-index: 1130; inset: 4.5rem 0 0; padding: 0.75rem; }
  .npc-conversations__gallery-view img { max-height: 50vh; }
}

@media (prefers-reduced-motion: reduce) {
  .npc-conversations-backdrop { backdrop-filter: none; }
}
