/* Backdrop - Maximum Z-Index so no page elements can cover or overlap */
.culinary-math-modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 2147483647 !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.culinary-math-modal-backdrop.is-active {
    opacity: 1 !important;
}

/* Dialog Container - Maximized Height & Full Space Utilization */
.culinary-math-modal-dialog {
    width: 96vw !important;
    max-width: 1220px !important;
    height: 90vh !important;
    height: 90dvh !important;
    max-height: 900px !important;
    min-height: 520px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden !important;
    position: relative !important;
    margin: 0 auto !important;
    transform: scale(0.97) translateY(8px);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.culinary-math-modal-backdrop.is-active .culinary-math-modal-dialog {
    transform: scale(1) translateY(0) !important;
}

.culinary-math-modal-backdrop.is-fullscreen {
    padding: 0 !important;
}

.culinary-math-modal-backdrop.is-fullscreen .culinary-math-modal-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Prevent any theme .embed-responsive / 16by9 auto-wrap interference */
#culinary_math_modal .embed-responsive,
#culinary_math_modal .embed-responsive-16by9 {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

/* Modal Iframe - Absolutely Fills 100% of Dialog with No Dead Space */
.culinary-math-iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
}

/* Always Light Theme */

/* Responsive Modal Adjustments (Full Maximized Viewport on Mobile) */
@media (max-width: 768px) {
    .culinary-math-modal-backdrop {
        padding: 0 !important;
    }
    .culinary-math-modal-dialog {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        min-height: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
    .culinary-math-iframe {
        width: 100% !important;
        height: 100% !important;
    }
}