/* CW apps are instruments, not editable documents. Protect the surrounding
   page as well as the key itself: a long press/drag that starts on playfield
   padding must not select the game and open iPad Copy/Look Up/Translate.
   Keep this separate from touch-action (double-tap zoom) and do not intercept
   pointer/touch events: their timing and cancellation belong to the keyer. */
:where(*) {
    /* Override browser defaults (notably dialog) without overriding app rules.
       Explicit inheritance also carries a report's selection exception through
       its descendants, until a nested control starts a protected subtree. */
    -webkit-user-select: inherit;
    user-select: inherit;
    -webkit-touch-callout: inherit;
}

:root {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Explicit selection islands, including editable fields nested in protected
   settings/keyer controls. Text remains copyable in completed reports, result
   tables and chat logs. Future reports can opt in with .cw-selectable. */
:is(
    input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]):not([type="image"]),
    textarea,
    [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"],
    .cw-selectable, .session-complete, .results-wrap,
    #view-progress, #view-sessions, [role="log"]
) {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* A button within a copyable report is still a control, not report text. Its
   descendants inherit this policy, as do labels inside a screen key. */
:is(button, select, option, [role="button"], .pd-zone, .pd-strip) {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
