html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    touch-action: manipulation;
    -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;
    background-color: #f0f0f0;
}

#app {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#game-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* Mobile frame for desktop only */
@media (min-width: 768px) {
    #game-container {
        max-width: 375px;
        max-height: 667px;
        border-radius: 32px;
        border: 16px solid #222;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
        box-sizing: content-box;
        padding: 0;
        margin: 0;
    }
    
}

/* Prevent scrolling when touching the canvas */
canvas {
    display: block;
    touch-action: none;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* Important: Make sure canvas fits properly */
canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Fix for desktop mode canvas positioning */
@media (min-width: 768px) {
    canvas {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    /* Ensure the canvas is positioned correctly within the frame */
    #game-container canvas {
        position: absolute !important;
        width: calc(100% - 0px) !important;
        height: calc(100% - 0px) !important;
    }
}


/* Mobile-specific styles */
@media (max-width: 768px) {
    html, body {
        width: 100vw;
        height: 100dvh; /* Use dynamic viewport height */
        margin: 0;
        padding: 0;
        overflow: hidden;
        position: fixed;
    }

    #app {
        width: 100vw;
        height: 100dvh;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    #game-container {
        width: 100vw !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        overflow: hidden;
    }

    canvas {
        width: 100vw !important;
        height: 100dvh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

