/* ==========================================
   MOBILE TOUCH & SCROLL FIX - COMPLETE
   Disable ALL scrolling outside game board
   ========================================== */

/* MOBILE: Allow normal scrolling */
@media (max-width: 768px) {
    html {
        overflow-y: auto;
        overflow-x: hidden;
    }

    body {
        overflow-y: auto;
        overflow-x: hidden;
        position: static;
        min-height: 100vh;
    }
}

/* Desktop: Normal scrolling */
@media (min-width: 769px) {
    html {
        overflow-y: auto;
        overflow-x: hidden;
    }

    body {
        overflow-y: auto;
        overflow-x: hidden;
        position: static;
        min-height: 100vh;
    }

    .container {
        position: static;
        overflow: visible;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
}

/* Prevent page scroll when touching game areas */
.game-board,
.game-container,
#game-board,
#game-canvas,
canvas {
    touch-action: none !important;
    overscroll-behavior: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Prevent text selection during gameplay */
.game-board *,
.game-container *,
#game-board *,
canvas {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Prevent pull-to-refresh on entire page */
body {
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
}

/* Smooth tap highlights */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Buttons should allow tap without zoom */
button,
.btn,
.play-btn,
.control-btn,
.key,
.dpad-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Hardware acceleration for smooth animations */
.tile,
.cell,
.letter-tile,
.card,
.game-board,
canvas {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Fix iOS Safari viewport - MOBILE ONLY */
@media (max-width: 768px) {
    @supports (-webkit-touch-callout: none) {
        html {
            height: -webkit-fill-available;
        }
        body {
            height: -webkit-fill-available;
        }
        .container {
            height: -webkit-fill-available;
        }
    }
}

/* Prevent zoom on input focus (iOS) */
input,
textarea,
select {
    font-size: 16px !important;
}

/* Prevent double tap zoom */
html {
    touch-action: manipulation;
}

/* Minimum touch target size */
@media (max-width: 768px) {
    button,
    .btn,
    .cell,
    .tile,
    .key {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Extra protection - disable all overscroll */
* {
    -webkit-overflow-scrolling: auto !important;
}
