/*  A tap is a click, and one tap does it (from Elbe Satranç, 2026-09-04).

    The companion of touch-tap-fix.js, which cuts every :hover rule out of the
    stylesheets on a device a finger is used on. These are the rules that
    cannot be cut, only added:

      * no grey flash under a tap, and no text selection from a long press —
        except in the places where selecting text is the point;
      * `touch-action: manipulation` on everything, so the browser never waits
        a third of a second to see whether a second tap is coming. `*` carries
        no specificity, so the boards keep their own `touch-action: none` (a
        finger on a board moves a piece and never the page);
      * the way back from a pinch — the button touch-tap-fix.js makes, shown
        only while the page is actually zoomed.

    `hover: none` OR `pointer: coarse`: a phone with a stylus or a paired
    mouse still reports a hover, and still needs all of this. */

@media (hover: none), (pointer: coarse) {
    * { -webkit-tap-highlight-color: transparent; }

    body {
        -webkit-user-select: none;
        user-select: none;
    }

    input, textarea, select, [contenteditable],
    .chat-messages, .chat-text, .swal2-html-container,
    .tr-notation-body, pre, code {
        -webkit-user-select: text;
        user-select: text;
    }

    * {
        touch-action: manipulation;
    }
}

/*  Placed from the top left and moved by a transform, because on a pinched
    phone "bottom right" in CSS means the bottom right of the whole page, which
    is usually off the screen.

    Both palettes, written here together:
      light  #312E81 on #E0E7FF   11.4:1, border #A5B4FC   1.9:1 on white
      dark   #E5E7EB on #1F2937   12.6:1, border rgba(255,255,255,0.25)  */
.elbe-unzoom {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
    color: #312E81;
    background: #E0E7FF;
    border: 1px solid #A5B4FC;
    border-radius: 50%;
    box-shadow: 0 6px 18px -6px rgba(28, 22, 8, 0.55);
    transform-origin: top left;
    z-index: 2147483000;            /* over dialogs, over the bars, over everything */
    -webkit-tap-highlight-color: transparent;
}

.elbe-unzoom.show {
    display: flex;
}

body[data-bs-theme="dark"] .elbe-unzoom,
body.theme-dark .elbe-unzoom {
    color: #E5E7EB;
    background: #1F2937;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7);
}
