/* ============================================================
   CBQ Interstitial Ad — post-submit overlay (v4.3.0)
   Shown between Submit click and Result display. Free users only.
   ============================================================ */

/* v4.12.433 — CRITICAL FIX. Without this rule, the `display: flex`
   below overrides the browser's default `[hidden] { display: none }`
   user-agent stylesheet, making the overlay PERMANENTLY VISIBLE on
   every page load — even though the HTML has `<div ... hidden>`.
   The JS controller's MutationObserver never fired because `hidden`
   never had a chance to mutate (it was visually ignored), so the
   countdown logic never ran → ad stuck at "5" → user trapped. */
.cbq-interstitial[hidden] {
    display: none !important;
}

.cbq-interstitial {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: cbq-int-fade .22s ease-out;
}
@keyframes cbq-int-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cbq-interstitial.is-closing .cbq-interstitial-card {
    transform: scale(.95);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
}

.cbq-interstitial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cbq-interstitial-card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px -20px rgba(15,23,42,.5), 0 10px 30px -8px rgba(15,23,42,.2);
    animation: cbq-int-pop .28s cubic-bezier(.34, 1.56, .64, 1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
@keyframes cbq-int-pop {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.cbq-interstitial-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.cbq-interstitial-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .8px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 99px;
}

.cbq-interstitial-close {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #64748b;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    cursor: not-allowed;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
}
.cbq-interstitial-close.is-ready {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    cursor: pointer;
}
.cbq-interstitial-close.is-ready:hover  { background: #1e293b; }
.cbq-interstitial-close.is-ready:active { transform: scale(.94); }

.cbq-interstitial-timer {
    display: inline-block;
    min-width: 14px;
    text-align: center;
}
.cbq-interstitial-x { flex-shrink: 0; }

.cbq-interstitial-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    min-height: 260px;
}

.cbq-interstitial-body ins.adsbygoogle {
    display: block;
    width: 100%;
    min-height: 250px;
}

.cbq-interstitial-foot {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    flex-shrink: 0;
}

/* Mobile — full-screen on phones */
@media (max-width: 600px) {
    .cbq-interstitial { padding: 0; align-items: stretch; }
    .cbq-interstitial-card {
        border-radius: 0;
        max-height: 100vh;
        max-width: 100%;
    }
    .cbq-interstitial-head {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    .cbq-interstitial-body {
        padding: 16px;
    }
}

/* ============================================================
   v4.4.9 — Dark mode for interstitial ad
   ============================================================ */
html[data-mcqp-theme="dark"] .cbq-interstitial-card {
    background: #121a32;
    color: #e2e8f0;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-head {
    border-bottom-color: #233056;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-label {
    background: rgba(148,163,184,.15);
    color: #94a3b8;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-close {
    background: #182240;
    border-color: #233056;
    color: #cbd5e1;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-close.is-ready {
    background: #f8fafc;
    color: #0f172a;
    border-color: #f8fafc;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-body {
    background: #0b1020;
}
html[data-mcqp-theme="dark"] .cbq-interstitial-foot {
    background: #121a32;
    color: #94a3b8;
    border-top-color: #233056;
}
