* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #050808;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: calc(100vh - 40px);
    padding: 8px;
    gap: 8px;
}

#canvas {
    background: #0d1912;
    border: 4px solid #2d4a3e;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 
        0 0 20px rgba(45, 74, 62, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

#touch-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 640px;
    padding: 12px 16px;
    gap: 24px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    border: 3px solid #2d4a3e;
}

#dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.dpad-row {
    display: flex;
    gap: 8px;
}

.dpad-btn {
    width: 76px;
    height: 76px;
    background: #2a2a2a;
    border: 4px solid #ffffff;
    border-radius: 12px;
    color: #ffffff;
    font-size: 28px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    box-shadow: 
        0 5px 0 #1a1a1a,
        0 0 15px rgba(255, 255, 255, 0.3);
}

.dpad-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #1a1a1a;
    background: #4a4a4a;
}

#action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    border: 5px solid;
    transition: all 0.1s;
    text-shadow: 2px 2px 2px rgba(0,0,0,0.8);
}

/* HIGHLY VISIBLE JUMP BUTTON */
.action-btn.jump {
    background: #22CC22;
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 
        0 6px 0 #15803d, 
        0 0 30px rgba(34, 197, 94, 0.8),
        inset 0 -4px 0 rgba(0,0,0,0.2);
    font-size: 11px;
}

.action-btn.jump:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #15803d, 0 0 20px rgba(34, 197, 94, 0.6);
}

.action-btn.attack {
    background: #DD3333;
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 
        0 6px 0 #991b1b, 
        0 0 25px rgba(239, 68, 68, 0.6),
        inset 0 -4px 0 rgba(0,0,0,0.2);
}

.action-btn.attack:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #991b1b;
}

.action-btn.grab {
    background: #3366DD;
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 
        0 6px 0 #1e40af, 
        0 0 25px rgba(59, 130, 246, 0.6),
        inset 0 -4px 0 rgba(0,0,0,0.2);
}

.action-btn.grab:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1e40af;
}

.action-btn.throw {
    background: #DD8833;
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 
        0 6px 0 #b45309, 
        0 0 25px rgba(245, 158, 11, 0.6),
        inset 0 -4px 0 rgba(0,0,0,0.2);
}

.action-btn.throw:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b45309;
}

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px;
    background: #050808;
    color: #4ade80;
    font-size: 10px;
    border-top: 2px solid #1a2f26;
}

#footer a {
    color: #fbbf24;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
    #touch-controls {
        opacity: 0.8;
    }
    
    #touch-controls:hover {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .dpad-btn {
        width: 64px;
        height: 64px;
        font-size: 22px;
    }
    
    .action-btn {
        width: 64px;
        height: 64px;
        font-size: 8px;
    }
    
    .action-btn.jump {
        font-size: 9px;
    }
    
    #touch-controls {
        padding: 8px 12px;
        gap: 16px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    #game-wrapper {
        flex-direction: row;
        padding: 4px;
    }
    
    #touch-controls {
        flex-direction: column;
        width: auto;
        max-width: none;
        height: 100%;
        justify-content: center;
    }
    
    .dpad-btn {
        width: 54px;
        height: 54px;
        font-size: 18px;
    }
    
    .action-btn {
        width: 54px;
        height: 54px;
        font-size: 7px;
    }
    
    .action-btn.jump {
        font-size: 8px;
    }
}