/* Ensure the modal is a full-screen overlay, always on top */
.jokerfun-game-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #6450A7, #2C202C);
}

.jokerfun-game-modal.hidden {
    display: none !important;
}

/* --- Loading Indicator Styling --- */
.jokerfun-loading-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 2147483646;
    backdrop-filter: blur(4px);
}

.jokerfun-loading-spinner:not(:hidden) {
    display: flex !important;
}

.jokerfun-loading-spinner > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
}

.jokerfun-loading-spinner img {
    width: 96px !important;
    height: 96px !important;
    animation: spin 1s linear infinite !important;
    position: relative !important;
    transform-origin: center !important;
    will-change: transform !important;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Ensure the inner container for the game also takes full space */
#jokerfun-game-modal > div:first-child {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Ensure the game content area and its iframe fill their parent */
.jokerfun-game-content {
    width: 100%;
    height: 100%;
    z-index: 2147483645;
    position: relative;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: none !important;
    padding: 2rem !important;
    box-sizing: border-box !important;
}

.jokerfun-game-content:not(:empty) {
    display: block !important;
}

.jokerfun-game-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .jokerfun-game-content {
        padding: 0.5rem !important;
    }
}

/* Ensure iframe content doesn't overlap controls */
.jokerfun-game-content iframe {
    position: relative;
    z-index: 2147483645;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Close button styling */
.jokerfun-close-modal {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    z-index: 2147483647 !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
	min-height: 2.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    font-size: 1.875rem !important;
    font-weight: 700 !important;
    background-color: #dc2626 !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease-in-out !important;
	padding-top: 0.8rem !important;
}

.jokerfun-close-modal:hover {
    background-color: #b91c1c !important;
}

/* CSS to prevent body scroll when modal is active */
body.jokerfun-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* Specific styles for interacty iframes if they use padding hacks */
/* These styles should be applied if Interacty's embed changes, or if you want to ensure it works. */
/* The general idea is to make sure the iframe fills its parent div for full screen */
.interacty_padding {
    position: relative;
    padding: 0 !important;
    height: 100% !important;
    width: 100% !important;
}

.interacty_wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.interacty_wrapper iframe {
    border: none;
    width: 100%;
    height: 100%;
}