/* Conversation polish v126
   Keeps chat media compact, fixes X DM light surfaces, and preserves intrinsic media ratio. */

html[data-social-app="whatsapp"] .bubble.media{
  width:min(66%,240px)!important;
  max-width:min(66%,240px)!important;
}
html[data-social-app="whatsapp"] .bubble.media .media-wrap{
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
}
html[data-social-app="whatsapp"] .bubble.media .media-wrap>img{
  display:block!important;
  width:auto!important;
  max-width:100%!important;
  height:auto!important;
  max-height:360px!important;
  object-fit:contain!important;
  margin:0 auto!important;
}

html[data-social-app="imessage"] .im-media{
  width:min(66%,240px)!important;
  max-width:min(66%,240px)!important;
}
html[data-social-app="imessage"] .im-media-wrap{
  width:100%!important;
  max-width:100%!important;
}
html[data-social-app="imessage"] .im-media-wrap>img{
  display:block!important;
  width:auto!important;
  max-width:100%!important;
  height:auto!important;
  max-height:360px!important;
  object-fit:contain!important;
  margin:0 auto!important;
}

/* Match the dedicated iMessage export renderer to the live room sizing. */
.imx-media{
  width:min(66%,240px)!important;
  max-width:min(66%,240px)!important;
}
.imx-media img{
  width:auto!important;
  max-width:100%!important;
  height:auto!important;
  max-height:360px!important;
  object-fit:contain!important;
  margin:0 auto!important;
}

/* X DM: every large surface follows the active theme instead of falling back to #000. */
html[data-social-app="x"] .x56-dm-list,
html[data-social-app="x"] .x56-dm-profile-intro,
html[data-social-app="x"] .x56-dm-reply-context{
  background:var(--x-bg)!important;
  color:var(--x-text)!important;
}
html[data-social-app="x"] .x56-dm-input-pill{
  background:var(--x-surface-2)!important;
  border-color:var(--x-border)!important;
  color:var(--x-text)!important;
}
html[data-social-app="x"] .x56-dm-bubble.in{
  background:var(--x-incoming)!important;
  color:var(--x-text)!important;
}
html[data-theme="light"][data-social-app="x"] .x56-dm-reply-card{
  background:rgba(15,20,25,.06)!important;
}
html[data-theme="light"][data-social-app="x"] .x56-dm-bubble.out .x56-dm-reply-card{
  background:rgba(255,255,255,.16)!important;
}
html[data-theme="light"][data-social-app="x"] .x56-dm-photo,
html[data-theme="light"][data-social-app="x"] .x56-dm-photo img,
html[data-theme="light"][data-social-app="x"] .x56-dm-draft-media{
  background:var(--x-surface-2)!important;
}
