/* iMessage interaction contract v125
   Match WhatsApp's event ownership without changing iMessage visuals. */

/* Decorative glass/header containers must never be the tap target. */
html[data-social-app="imessage"] .imessage-v19 .chat-navbar,
html[data-social-app="imessage"] .imessage-v19 .chat-navbar-inner{
  pointer-events:none!important;
}

/* Only actual header controls receive interaction. */
html[data-social-app="imessage"] .imessage-v19 .im19-back,
html[data-social-app="imessage"] .imessage-v19 #cv-back,
html[data-social-app="imessage"] .imessage-v19 .im19-video,
html[data-social-app="imessage"] .imessage-v19 #im19-info,
html[data-social-app="imessage"] .imessage-v19 .im19-person,
html[data-social-app="imessage"] .imessage-v19 .im19-person *,
html[data-social-app="imessage"] .imessage-v19 .im63-group-hitbox{
  pointer-events:auto!important;
}

/* The thread owns vertical pan only. It never sits above the composer. */
html[data-social-app="imessage"] .imessage-v19 .imessage-scroll-v19,
html[data-social-app="imessage"] .imessage-v19 #cv-scroll{
  z-index:1!important;
  pointer-events:auto!important;
  touch-action:pan-y!important;
}

/* Composer mirrors the stable WA interaction stack: whole shell + real controls active. */
html[data-social-app="imessage"] .imessage-v19 .composer{
  z-index:60!important;
  pointer-events:auto!important;
}
html[data-social-app="imessage"] .imessage-v19 .composer-field-wrap,
html[data-social-app="imessage"] .imessage-v19 #cv-input,
html[data-social-app="imessage"] .imessage-v19 .composer button,
html[data-social-app="imessage"] .imessage-v19 .composer input,
html[data-social-app="imessage"] .imessage-v19 .composer textarea{
  pointer-events:auto!important;
  touch-action:manipulation;
}

/* Overlay must fully own taps while visible; hidden overlay owns none. */
html[data-social-app="imessage"] #overlay-root{
  pointer-events:none!important;
}
html[data-social-app="imessage"] #overlay-root.show{
  pointer-events:auto!important;
}
html[data-social-app="imessage"] #overlay-root.show .sheet,
html[data-social-app="imessage"] #overlay-root.show .card-modal,
html[data-social-app="imessage"] #overlay-root.show .sheet *,
html[data-social-app="imessage"] #overlay-root.show .card-modal *{
  pointer-events:auto;
}
