/* CATEGORY OVERLAY FUNCTIONALITY FIX */

/* 1. ENSURE PROPER OVERLAY VISIBILITY */
.overlay-menu {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(135deg, rgba(255, 192, 203, 0.4) 0%, rgba(255, 182, 193, 0.5) 50%, rgba(221, 160, 221, 0.4) 100%) !important;
    backdrop-filter: blur(15px) !important;
    border-radius: 25px !important;
    z-index: 99999 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 30px !important;
}

/* 2. ACTIVE STATE WITH MAXIMUM SPECIFICITY */
.overlay-menu.active,
#categoryOverlay.active,
.overlay-menu.active.overlay-menu,
#categoryOverlay.active#categoryOverlay,
div.overlay-menu.active,
div#categoryOverlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    z-index: 999999 !important;
}

/* 3. FORCE CATEGORY BUTTON CLICKABILITY */
#categoryButton {
    position: relative !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* 4. ENSURE OVERLAY CONTENT IS VISIBLE WHEN ACTIVE */
.overlay-menu.active .overlay-menu-content,
#categoryOverlay.active .overlay-menu-content {
    transform: scale(1) translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* 5. FIX FOR MULTI-DEVICE MODE POSITIONING */
#multiSetup .overlay-menu,
#singleSetup .overlay-menu,
#lobby .overlay-menu {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* 6. ENSURE PARENT CONTAINERS HAVE PROPER POSITIONING */
#multiSetup,
#singleSetup,
#lobby {
    position: relative !important;
}

/* 7. DEBUG STYLES (TEMPORARY) */
.overlay-menu.debug-test {
    background: rgba(255, 0, 0, 0.5) !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 999999 !important;
}

/* 8. FORCE PROPER STACKING CONTEXT */
.overlay-menu {
    isolation: isolate !important;
}

/* 9. PREVENT INTERFERENCE FROM OTHER ELEMENTS */
.overlay-menu * {
    pointer-events: auto !important;
}

/* 10. BACKUP POSITIONING SYSTEM */
@media (max-width: 768px) {
    .overlay-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* 11. NUCLEAR OPTION - FORCE VISIBILITY WHEN ACTIVE */
#singleSetup .overlay-menu.active,
#multiSetup .overlay-menu.active,
#lobby .overlay-menu.active,
body .overlay-menu.active,
html .overlay-menu.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}

/* 12. SPECIFIC TARGETING FOR categoryOverlay */
#categoryOverlay.active[class*="overlay"] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 13. OVERRIDE THE ORIGINAL playful-design-v2.css RULE */
/* The original rule has high specificity and !important for hidden state, so override it */
.overlay-menu.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    z-index: 99999 !important;
}

/* 14. ENSURE ALL TRANSITIONS ARE OVERRIDDEN */
.overlay-menu.active,
.overlay-menu.active * {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
}

/* 15. MULTI-DEVICE MODE SPECIFIC FIXES */
/* Force button visibility in multi-device mode */
#multiSetup .setting-button,
#multiSetup #categoryButton {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    min-width: 200px !important;
    min-height: 50px !important;
    height: auto !important;
    position: relative !important;
    z-index: 1000 !important;
}

/* Force settings buttons row to be visible */
#multiSetup .settings-buttons-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    margin: 20px 0 !important;
}

/* Force setting button container to be visible */
#multiSetup .setting-button-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    flex: 1 !important;
    min-width: 200px !important;
    width: 396px !important;
    height: 64px !important;
}

/* 16. NUCLEAR OPTION - FORCE EXACT DIMENSIONS IN MULTI-DEVICE MODE */
#multiSetup #categoryButton,
#multiSetup #hostCategoryButton,
#lobby #hostCategoryButton {
    width: 320px !important;
    height: 44px !important;
    min-width: 320px !important;
    min-height: 44px !important;
    max-width: 320px !important;
    max-height: 44px !important;
    flex: none !important;
}

#multiSetup .settings-buttons-row {
    width: 396px !important;
    height: 64px !important;
    min-width: 396px !important;
    min-height: 64px !important;
}