/*
 * Panorama Content Protect — CSS-шар захисту
 * Всі правила застосовуються лише до body.panorama-protect-on
 * щоб не зачіпати адміна Mimino та WP-адмінку.
 */

/* ─── 1. Заборона виділення тексту ─────────────────────────────────── */
body.panorama-protect-on *:not(input):not(textarea):not(select):not([contenteditable="true"]):not([contenteditable]):not(.panorama-allow-select):not(.panorama-allow-select *) {
    -webkit-user-select: none;
    -moz-user-select:    none;
    -ms-user-select:     none;
    user-select:         none;
    -webkit-touch-callout: none; /* iOS: приховує меню «Зберегти/Скопіювати» при long-press */
}

/* Поля вводу та редактори - явно дозволяємо виділення */
body.panorama-protect-on input,
body.panorama-protect-on textarea,
body.panorama-protect-on select,
body.panorama-protect-on [contenteditable="true"],
body.panorama-protect-on [contenteditable],
body.panorama-protect-on .panorama-allow-select,
body.panorama-protect-on .panorama-allow-select * {
    -webkit-user-select: text;
    -moz-user-select:    text;
    -ms-user-select:     text;
    user-select:         text;
    -webkit-touch-callout: default;
}

/* ─── 2. Заборона drag зображень / відео / canvas ───────────────────── */
body.panorama-protect-on img,
body.panorama-protect-on video,
body.panorama-protect-on canvas,
body.panorama-protect-on picture {
    -webkit-user-drag: none;
    user-drag:         none;
    -webkit-touch-callout: none;
    /* pointer-events НЕ скасовуємо - ігрові картки мають бути клікабельні */
}

/* ─── 3. Захист від друку ───────────────────────────────────────────── */
@media print {
    body.panorama-protect-on > *:not(#panorama-print-warning) {
        display: none !important;
        visibility: hidden !important;
    }

    body.panorama-protect-on::before {
        content: "Друк цього сайту заборонено.  \00A9  Panorama Games — panorama.games";
        display:     block;
        font-size:   20px;
        font-family: sans-serif;
        padding:     60px 40px;
        text-align:  center;
        color:       #111;
    }
}

/* ─── 4. М'яка реакція на відкриті DevTools ────────────────────────── */

/* Блюр ключових елементів */
body.panorama-devtools-open img,
body.panorama-devtools-open video,
body.panorama-devtools-open canvas,
body.panorama-devtools-open .panorama-protect-content,
body.panorama-devtools-open .game-card,
body.panorama-devtools-open .game-card-image,
body.panorama-devtools-open .panorama-room-wrap,
body.panorama-devtools-open #panoramaRoom {
    filter:     blur(14px) !important;
    transition: filter 0.4s ease;
}

/* Знімаємо блюр коли DevTools закривають */
body:not(.panorama-devtools-open) img,
body:not(.panorama-devtools-open) video,
body:not(.panorama-devtools-open) canvas,
body:not(.panorama-devtools-open) .panorama-protect-content,
body:not(.panorama-devtools-open) .game-card,
body:not(.panorama-devtools-open) .panorama-room-wrap {
    filter:     none;
    transition: filter 0.4s ease;
}

/* Оверлей-повідомлення поверх контенту */
body.panorama-devtools-open::after {
    content:    attr(data-devtools-msg);
    position:   fixed;
    inset:      0;
    display:    flex;
    align-items:     center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    color:      #fff;
    font-size:  20px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    z-index:    2147483647; /* максимально можливий z-index */
    pointer-events: auto;
    cursor:     default;
    text-align: center;
    padding:    20px 40px;
    line-height: 1.5;
    white-space: pre-line;
}

/* ─── 5. Utility-класи ──────────────────────────────────────────────── */

/* .panorama-allow-select — дозволити виділення (напр. для /privacy-policy, /terms) */
.panorama-allow-select,
.panorama-allow-select * {
    -webkit-user-select: text !important;
    -moz-user-select:    text !important;
    user-select:         text !important;
    -webkit-touch-callout: default !important;
}

/* .panorama-allow-drag — дозволити drag (для ігрових drag-зон) */
.panorama-allow-drag,
.panorama-allow-drag * {
    -webkit-user-drag: auto !important;
    user-drag:         auto !important;
}

/* .panorama-protect-content — обертальний клас для секцій,
   які треба блюрити при відкритих DevTools */
.panorama-protect-content {
    transition: filter 0.4s ease;
}
