Consider using a refernce to the deck instead of a global variable interator thingo
eg var/obj/item/toy/cards/parentdeck
where parentdeck is a variable name that describes the deck the hand belongs to

so when you do var/obj/item/toy/singlecard/H = new/obj/item/toy/singlecard(user.loc)
you can do the line H.parentdeck = src

and then to check if a card belongs to a deck, instead of if(C.deckno == src.deckno)
you do if (C.parentdeck == parentdeck) which will return true if they are both referencing the same deck

The only pitfall is that you might have to check if a reference is not null before attempting to do operations.
Also this might not be the proper way to do it, but I am pretty sure it is better to avoid declaring globals.