/* ==========================================================================
   MOBILE.CSS (Unified Master Container Rotation & Input Protection)
   ========================================================================== */

html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #050508;
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;

    /* --- MANDATORY INPUT BLOCKS --- */
    /* Locks down native browser text picking, pop-up highlights, and zoom prompts */
    -webkit-touch-callout: none; /* Disables long-press context menus on links/images */
    -webkit-user-select: none;   /* Safari & Chrome iOS */
    -khtml-user-select: none;     
    -moz-user-select: none;       
    -ms-user-select: none;        
    user-select: none;            
    
    /* Disables browser-level double-tap magnification and trackpad gestures */
    touch-action: none; 
}

/* THE MASTER CONTAINER: Rotates everything inside it simultaneously */
#gameWorld {
    position: absolute;
    width: 800px;
    height: 560px;
    background: #0b0c10;
    overflow: hidden;
    margin-bottom: 10px; /* Kept your spacing offset */
    border: 5px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.35);
    
    /* Center it on the phone screen, rotate sideways, and scale to fit the glass */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0.67);
    transform-origin: center center;
    box-sizing: border-box;

    /* Secondary reinforcement layer to keep game content from highlighting */
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* Keep the inner canvas flat and simple */
#levelCanvas {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    pointer-events: none; /* Prevents dragging individual map assets or tiles */
}

/* HUD POSITIONED ON THE SIDE IN LANDSCAPE PERSPECTIVE */
#hud {
    position: absolute;
    top: 40px; /* Kept your precise alignment setting */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none; /* Prevents hud text from accidentally catching clicks */
}

/* TOUCH PANELS: Now placed relative to our landscape 800x560 coordinate space! */
#touchControls {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    display: flex !important;
    justify-content: space-between;
    padding: 0 100px;    /* Kept your thumb padding width */
    box-sizing: border-box;
    z-index: 2000;
    pointer-events: none; /* Allows dead-zone taps to pass cleanly down to the engine */
}

/* Grow the touch target area while keeping the visible button compact */
.touch-target {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    pointer-events: auto;
    background: transparent;
    padding-bottom: 12px; /* Keep visible button at the bottom of the hit area */
}

.touch-target > .touch-btn {
    position: relative;
    z-index: 2;
}

.touch-target-left,
.touch-target-right {
    width: 26vw;
    height: 45vh;          /* Large vertical hit area so slightly-missed swipes still register */
}

.touch-target-jump {
    width: 26vw;
    height: 45vh;          /* Large vertical hit area for jump button accessibility */
}

/* JUMP BUTTON: Placed clean on the bottom left of our landscape world */
.dpad-actions {
    display: flex;
    pointer-events: auto; /* Re-enables touch registry on the action node cluster */
}

/* WALKING ARROWS: Placed clean on the bottom right of our landscape world */
.dpad-left-right {
    display: flex;
    gap: 15px;
    pointer-events: auto; /* Re-enables touch registry on the navigation node cluster */
}

/* Reset individual button arrow rotations since the parent box handles the rotation */
.touch-btn {
    width: 75px;
    height: 75px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: #ffffff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);

    /* --- INDIVIDUAL BUTTON INTERACTION SEALS --- */
    pointer-events: auto;          /* Explicitly permits active click registration */
    touch-action: manipulation;   /* Completely bypasses the browser's native 300ms double-tap delay */
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* Silences the ugly grey/blue box overlay on mobile Safari */
    
    -webkit-user-select: none;
    user-select: none;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.93);
}

.jump-btn {
    background: rgba(46, 204, 113, 0.35);
    border-color: rgba(46, 204, 113, 0.55);
}