/* PURE CSS LAYOUT - NO JS INTERFERENCE */
body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    width: 100vw !important;
    height: 100vh !important;
}

html {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

* {
    box-sizing: border-box !important;
}

#app {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

#game-container {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    position: relative !important;
}

#game-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

body:not(.is-mobile) #game-container {
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
}

body:not(.is-mobile) #game-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
}

body.is-mobile #gamepad-container {
    height: 50vh !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

body.is-mobile #game-container {
    height: 50vh !important;
    width: 100vw !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

body.is-mobile #game-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
}

/* GameBoy Style Mobile Gamepad */
/* GameBoy Style Mobile Gamepad */
#gamepad-container {
    display: none;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 4px solid #444;
    border-radius: 8px;
    box-shadow: 
        inset 0 4px 8px rgba(0,0,0,0.8),
        0 8px 16px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.1);
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
    touch-action: manipulation;
    margin: 0;
}

.gamepad-button {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: linear-gradient(145deg, #666, #444);
    border: 3px solid #888;
    color: #00ff00;
    font-size: 2.2em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    text-shadow: 1px 1px 2px #000;
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.2),
        inset 0 -2px 4px rgba(0,0,0,0.4),
        0 4px 8px rgba(0,0,0,0.6);
    transition: all 0.1s ease;
}

.gamepad-button:active {
    background: linear-gradient(145deg, #555, #333);
    box-shadow: 
        inset 0 2px 6px rgba(0,0,0,0.6),
        0 2px 4px rgba(0,0,0,0.8);
    transform: translateY(2px);
}

/* Layout */
.gamepad-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    height: 100%;
    padding: 20px;
    width: 100%;
    gap: 10px;
}

.left-right-row {
    display: flex;
    justify-content: flex-start;
    gap: 40px;
    width: 100%;
    padding-left: 20px;
}

.jump-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    padding-right: 20px;
}

.jump-button {
    flex-shrink: 0;
    min-width: 80px;
}

/* Mobile Portrait */
@media only screen and (orientation: portrait) {
    body.is-mobile #gamepad-container {
        height: 50%;
        display: flex;
        margin: 0;
    }

    body.is-mobile #game-container {
        height: 50%;
    }
}
