/**
 * Touch / coarse pointer: отключение липкого :hover (ghost cursor при скролле в WebView).
 * Десктоп с мышью не затрагивается — hover остаётся в исходных файлах.
 */

html[data-mobile="1"],
html.touch-ui {
    --btn-icon-hover-scale: 1;
}

@media (hover: none), (pointer: coarse) {
    :root {
        --btn-icon-hover-scale: 1;
    }
}

/* ——— Фоновая подсветка списков / карточек ——— */
html[data-mobile="1"] :is(
    .chat_msg,
    .lac_item,
    .lac_group-header,
    .lac_channel,
    .lac_drag,
    .lac_add_group,
    .lac_add_channel,
    .lac_voice_user,
    .LAUL_menu-item,
    .ifm_note_item,
    .ifm_pin_item,
    .user_item,
    .user_settings_lac_item,
    .project_roles_lac_item,
    .project_roles_members_suggest_item,
    .RADR_search-hit,
    .RADRD_bt,
    .users_search-row,
    .projects_search-tile,
    .hub_search-row,
    .hub_search-news-row,
    .IFM_lpd_create-tile,
    .IFM_text_status-history-item,
    .IFM_msg_forward-row,
    .rau_panel-btn,
    .chat_msg-att--audio,
    .chat_msg-att--m3u,
    .chat_msg-att--video,
    .chat_msg-att--file,
    .chat_msg-embed--link,
    .feed_radr-filter,
    .feed_radr-news,
    .IFM_audio_player-track,
    .IFM_attach_files-drag,
    .voice_stage-action,
    .ifm_select-list li,
    button.user_card-row,
    button.user_panel-menu-row,
    .user_card_header-menu-item,
    .user_panel-status_menu-item,
    .help_download-tile,
    .IFM_download-btn,
    .IFM_download-copy,
    .call_bar-action,
    .RADL_emoji_btn,
    .RADL_sticker_btn,
    .search_mode_tab,
    .chat_msg-tool,
    .chat_msg-reply-btn,
    .chat_msg-react-add
):hover {
    background-color: transparent !important;
}

/* Активные состояния (не hover) сохраняем */
html[data-mobile="1"] :is(
    .lac_item.is-active,
    .lac_group.is-active > .lac_group-header,
    .lac_channel.is-active,
    .search_mode_tab.is-active
) {
    background: rgba(255, 255, 255, 0.06) !important;
}

html[data-mobile="1"] :is(
    .RADR_search-hit.is-active,
    .IFM_audio_player-track.is-active
) {
    background: rgba(93, 92, 181, 0.28) !important;
}

/* ——— Сообщения чата ——— */
html[data-mobile="1"] .chat_msg:hover {
    background-color: transparent !important;
}

html[data-mobile="1"] .chat_msg.is-pinned:hover {
    background-color: rgb(93 92 181 / 12%) !important;
}

html[data-mobile="1"] .chat_msg.is-deleted:hover {
    background-color: transparent !important;
}

html[data-mobile="1"] .chat_msg:hover .chat_msg-toolbar {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* ——— LPD: hover меняет border ——— */
html[data-mobile="1"] :is(
    .LPD_project,
    .LPD_pin,
    .LPD_news_item,
    #LPD_favorites,
    #LPD_feed,
    #LPD_search,
    #LPD_create
):hover {
    border-color: var(--color-null-element-border) !important;
    border-width: 1px !important;
}

/* ——— Flyout-меню: только .is-open, не hover ——— */
html[data-mobile="1"] .LAUL_menu-item--flyout:hover .LAUL_flyout,
html[data-mobile="1"] #IFM_channel_more .LAUL_menu-item--flyout:hover .LAUL_flyout,
html[data-mobile="1"] #IFM_feed_news_more .LAUL_menu-item--flyout:hover .LAUL_flyout {
    display: none !important;
}

html[data-mobile="1"] .LAUL_menu-item--flyout.is-open .LAUL_flyout {
    display: block !important;
}

/* ——— Показ скрытых по hover элементов ——— */
html[data-mobile="1"] :is(
    .lac_channel:hover .lac_channel-more,
    .lac_channel:hover .lac_channel-edit,
    .lac_group-header:hover .lac_group-edit,
    .user_card_header-decorate:hover .user_card_header-decorate-label,
    .user_panel-menu-avatar:hover .avatar-change-hint,
    .user_card-avatar.is-editable:hover .avatar-change-hint,
    .feed_post-source:hover .feed_post-name,
    .feed_radr-news:hover .feed_radr-more,
    .chat_msg-embed--video:hover .chat_msg-embed-play
) {
    opacity: inherit;
    visibility: inherit;
    color: inherit;
    background: inherit;
}

html[data-mobile="1"] .lac_channel-more,
html[data-mobile="1"] .lac_group-edit {
    opacity: 0.55 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* ——— Ссылки и текст ——— */
/* .chat_msg-link исключён: long-press/selection иначе сбрасывает цвет и underline. */
html[data-mobile="1"] :is(
    #UI a:not(.chat_msg-link),
    .chat_msg-ref.is-ok,
    .chat_msg-forward-name.is-clickable,
    .chat_msg-forward-source,
    .auth_form-links a,
    .ifm_form-links a,
    .ifm_social_link,
    .hub_search-see_all,
    .hub_search-strip-more
):hover {
    color: inherit !important;
    text-decoration: inherit !important;
    opacity: inherit !important;
}

/* ——— Иконки-кнопки: без масштабирования ——— */
html[data-mobile="1"] :is(
    [id^="RAU_option-"],
    #RAU_search #RAU_option-search,
    #RAU_nav-search-bt,
    #RAU_search_overlay-close,
    #RAU_nav-help,
    #LPU_logo,
    #LPD_search,
    #LPD_create,
    #LPD_favorites,
    #LAUL_list_bt,
    #LAUL_pin,
    #LAM_create,
    #RADL_inputs-upload,
    #RADL_inputs-emoji,
    #RADL_inputs-scroll_end,
    #RADL_inputs-send,
    #RADL_inputs-draft_delete,
    .chat_msg-att-download,
    .chat_msg-att-stream,
    .RADR_search-iconbt,
    .projects_search-tile-action,
    .users_search-row-btn,
    .hub_search-bt,
    .hub_search-clear,
    .IFM_audio_player-btn,
    .IFM_audio_player-track-play,
    .IFM_audio_player-track-download,
    .IFM_audio_player-track-stream,
    .IFM_photo_viewer-btn,
    .IFM_video_player-btn
):hover {
    background-size: var(--btn-icon-size, 60%) !important;
}

/* ——— Кнопки с изменением background-color ——— */
html[data-mobile="1"] :is(
    .IFM_call_popup-btn--answer,
    .IFM_call_popup-btn--video,
    .IFM_call_popup-btn--decline,
    .IFM_call_popup-toggle,
    .auth_form-submit,
    .ifm_form-submit,
    .IFM_msg_forward-send,
    .RADL_dm_lock-friend,
    .market_buy_actions .user_panel-menu-btn,
    .user_card_header-decorate-btn,
    .user_card-kick,
    .user_card-ban,
    .project_edit_delete,
    #IFM_project_delete-confirm,
    #IFM_news_delete-confirm,
    #IFM_group_delete-confirm,
    #IFM_logout_confirm-ok,
    .IFM_screen_share_bar-stop,
    .radl_edit_back
):hover:not(:disabled):not(.is-disabled) {
    filter: none !important;
}

html[data-mobile="1"] .IFM_call_popup-btn--answer:hover {
    background-color: #2e7d32 !important;
}

html[data-mobile="1"] .IFM_call_popup-btn--video:hover {
    background-color: #1565c0 !important;
}

html[data-mobile="1"] .IFM_call_popup-btn--decline:hover {
    background-color: #c62828 !important;
}

html[data-mobile="1"] .IFM_call_popup-toggle:hover {
    background-color: #3a3a3a !important;
}

/* ——— Прочее ——— */
html[data-mobile="1"] .grecaptcha-badge:hover {
    bottom: -57px !important;
    right: -253px !important;
}

html[data-mobile="1"] #LAM_create:hover .lam_create-ico {
    transform: none !important;
}

html[data-mobile="1"] #RADR_search-sort:hover {
    transform: none !important;
}

html[data-mobile="1"] *::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb) !important;
}
