/* Installed iOS controls are actions, so holding their artwork or labels must
   not start WebKit text selection, a copy menu or the browser tap highlight.
   Include descendants: a label/span/SVG is often the actual touch target. */
html[data-native-ios='true'] :where(button, a[href], summary, label, [role='button'], [role='link'], [role='tab'], [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], [role='option'], [role='switch'], [role='checkbox'], [role='radio'], [role='slider'], svg[tabindex], [data-native-action]),
html[data-native-ios='true'] :where(button, a[href], summary, label, [role='button'], [role='link'], [role='tab'], [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], [role='option'], [role='switch'], [role='checkbox'], [role='radio'], [role='slider'], svg[tabindex], [data-native-action]) * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* WebKit can carry :focus-visible from a field, restored dialog focus or a
   zero-detail activation into the next touch. Show action focus frames only
   during keyboard navigation, including component outlines and shadow rings.
   Leave editing fields and their caret alone. No marker yet means touch. */
html[data-native-ios='true']:not([data-native-input='keyboard']) :focus:not(:where(
  input:not([type='button'], [type='submit'], [type='reset'], [type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file'], [type='image']),
  textarea, select, [contenteditable]:not([contenteditable='false']), [contenteditable]:not([contenteditable='false']) *
)) {
  outline: none !important;
}

html[data-native-ios='true']:not([data-native-input='keyboard']) :focus-visible:not(:where(
  input:not([type='button'], [type='submit'], [type='reset'], [type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file'], [type='image']),
  textarea, select, [contenteditable]:not([contenteditable='false']), [contenteditable]:not([contenteditable='false']) *
)) {
  box-shadow: none !important;
}

/* Labels can contain fields. Keep their native caret, editing and copy/paste,
   including rich-text descendants and explicitly copyable control content.
   Ordinary page prose remains selectable without an opt-in. */
html[data-native-ios='true'] :where(input, textarea, select, [contenteditable=''], [contenteditable='true'], [contenteditable='plaintext-only'], [data-native-selectable]),
html[data-native-ios='true'] :where([contenteditable=''], [contenteditable='true'], [contenteditable='plaintext-only'], [data-native-selectable]) * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

