.em-overlay-open {
    overflow: hidden;
}

.em-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Color and opacity are set via CSS variables from JS */
    background: rgba(var(--em-overlay-color, 0, 0, 0), var(--em-overlay-opacity, 0.92));
    color: #f2f2f2;
    text-align: center;
    animation: em-overlay-fade-in var(--em-fade-in-ms, 180ms) ease-out;
}

/* Fade-out: added as a class just before removal */
.em-overlay.is-fading-out {
    animation: em-overlay-fade-out var(--em-fade-out-ms, 200ms) ease-in forwards;
}

.em-overlay__inner {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}

.em-overlay__logo {
    display: block;
    width: min(130px, 30vw);
    height: auto;
    margin: 0 auto 20px;
}

.em-overlay__message {
    font-size: clamp(1rem, 2vw, 1.75rem);
    line-height: 1.5;
    color: #f2f2f2;
}

.em-overlay__message p:last-child {
    margin-bottom: 0;
}

.em-overlay__resume-hint {
    display: none;
    margin-top: 18px;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.5;
    color: #ffffff;
    opacity: 0.92;
}

.em-overlay__resume-hint.is-visible {
    display: block;
}

/* Countdown */
.em-overlay__countdown {
    display: none;
    margin-top: 16px;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    opacity: 0.75;
    letter-spacing: -0.02em;
}

.em-overlay__countdown.is-visible {
    display: block;
}

.em-overlay__button {
    margin-top: 24px;
    padding: 12px 22px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    background: transparent;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.2;
    cursor: pointer;
}

.em-overlay__button:hover,
.em-overlay__button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.em-screen-reader {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes em-overlay-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes em-overlay-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@media (max-width: 600px) {
    .em-overlay {
        padding: 20px;
    }
    .em-overlay__button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .em-overlay,
    .em-overlay.is-fading-out {
        animation: none;
    }
}
