/* ========================================
   移动端触控优化
   解决长按保存图片和拖拽问题
   ======================================== */

/* 全局禁止长按菜单和文本选择 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 允许输入框选择文本 */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 卡片特殊处理 - 防止长按保存图片 */
.card img,
.card svg {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: none !important;
}

/* 卡片本身需要能够接收拖拽事件 */
.card {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    pointer-events: auto !important;
    /* 移除 touch-action: none 以允许拖拽 */
}

/* 所有可拖拽区域 - 保留触控能力 */
.card-slot,
.tableau-column,
.stock-slot,
.waste-slot,
.foundation-slot {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    /* 移除 touch-action: none 以允许拖拽 */
}

/* 游戏板区域 */
.game-board,
.top-row,
.tableau-container,
.stock-waste-container,
.foundations-container {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* 禁止图片的默认拖拽行为 */
img {
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
}

/* 按钮和链接保持可点击 */
button,
a,
.nav-link,
.dropdown-toggle {
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* 移动端特定优化 */
@media screen and (max-width: 767px) {
    /* 增加触控目标大小 */
    .card {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 优化滚动性能 */
    .game-board {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    /* 防止双击缩放 */
    body {
        touch-action: pan-x pan-y;
    }
}

/* iOS Safari 特殊处理 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari 长按菜单完全禁用 */
    .card,
    .card *,
    .card img {
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
    }
    
    /* 防止iOS Safari的弹性滚动影响拖拽 */
    .game-board {
        overscroll-behavior: contain;
    }
}

/* Android Chrome 特殊处理 */
@media screen and (max-width: 767px) {
    /* 禁用Android长按选择 */
    body {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* 优化Android触控响应 */
    .card {
        will-change: transform;
    }
}

