/* All display text opts out of accidental selection, including headings,
   status lines and text outside game controls. Editors opt back in below.
   No page-wide touch-action or touch handlers: scrolling and zoom stay native. */
:where(body, body *) {
  -webkit-user-select: none;
  user-select: none;
}
:where(body) { -webkit-touch-callout: none; }

/* Source and license links retain their native open/copy-link menu, while
   their display text remains unselectable. App controls override this below. */
:where(a[href]) { -webkit-touch-callout: default; }

/* Keep this control boundary in sync with CONTROL_SURFACE_SELECTOR in JS. */
:where(
  button, [role="button"], [role="tab"], summary, label,
  input[type="button"], input[type="submit"], input[type="reset"],
  input[type="image"], input[type="checkbox"], input[type="radio"],
  input[type="range"], input[type="color"], input[type="file"],
  a.button, a.scene-edit, a.brand, a.back, a.skip, a.skip-link, .qm-site-nav a,
  a:is([href="/"], [href="/modeler/"], [href="/rpg/"], [href="/diagrams/"], [href="/scenarios/"], [href="/admin/login/"], [href="/question-manager/"]),
  [data-control-surface], [data-rpg-world], .habitat, .walk-scene,
  #room-canvas, #battle-scene, #stage, .still-viewport, .tva-visuals, .flange-visuals
) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* Native image/link dragging must not take over a pointer-driven control. */
:where(
  button, [role="button"], [role="tab"], summary, label,
  a.button, a.scene-edit, a.brand, a.back, a.skip, a.skip-link, .qm-site-nav a,
  a:is([href="/"], [href="/modeler/"], [href="/rpg/"], [href="/diagrams/"], [href="/scenarios/"], [href="/admin/login/"], [href="/question-manager/"]),
  [data-control-surface], [data-rpg-world], .habitat, .walk-scene,
  #room-canvas, #battle-scene, #stage, .still-viewport, .tva-visuals, .flange-visuals
) :where(img, image, a) {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* Labels and custom controls can contain editors. Keep selection, paste and
   the native editing menu available, including read-only recovery/share text. */
:where(
  input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  textarea, select, [contenteditable]:not([contenteditable="false"]),
  [contenteditable]:not([contenteditable="false"]) *
) {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  -webkit-user-drag: auto;
}
