.upgrade-popup-wrapper {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background-color: rgba(2, 39, 57, 0.6);
    align-items: center;
    justify-content: center;
    font-family: 'OpenSans', Arial, Helvetica, sans-serif;
}

.upgrade-popup-wrapper.open {
    display: flex;
}

.upgrade-popup-wrapper .upgrade-popup-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    max-width: 480px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.upgrade-popup-wrapper .upgrade-popup-title {
    font-family: TeX, serif;
    font-weight: bold;
    color: #1a1a1a;
    margin: 0 0 0.75rem;
}

.upgrade-popup-wrapper .upgrade-popup-message {
    color: #444;
    line-height: 1.5;
    margin-bottom: 1.75rem;
    font-size: 1.25em;
}

.upgrade-popup-wrapper .upgrade-popup-split-message {
    display: flex;
    flex-direction: column;
    row-gap: 1em;
    align-items: center;
}

.upgrade-popup-wrapper .upgrade-popup-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 1.15em;
}

.upgrade-popup-wrapper .upgrade-popup-btn-primary {
    background-color: #ff7000;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.6em 1.75em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.upgrade-popup-wrapper .upgrade-popup-btn-primary:hover {
    background-color: #e06200;
    color: #fff;
    text-decoration: none;
}

.upgrade-popup-wrapper .upgrade-popup-btn-secondary {
    background-color: transparent;
    color: #666;
    border: 1.5px solid #ccc;
    border-radius: 50px;
    padding: 0.6em 1.75em;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.upgrade-popup-wrapper .upgrade-popup-btn-secondary:hover {
    border-color: #999;
    color: #333;
}

.upgrade-popup-wrapper .upgrade-popup-hide-mobile {
    display: none;
}

.upgrade-popup-wrapper .upgrade-popup-btn-close {
    position:absolute;
    top: 0.3em;
    right: 0.3em;
    background: transparent;
    fill: #1a1a1a;
    border: 0;
    width: 28px;
    height: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
}

.upgrade-popup-wrapper .upgrade-popup-btn-close:hover {
    background: red;
    fill: #fafafa;
}

.upgrade-popup-wrapper .countdown-wrapper {
    display: none;
    position: relative;
    width: 28px;
    height: 28px;
    margin-left: 6px;
    flex-shrink: 0;
    vertical-align: middle;
}

.upgrade-popup-wrapper .countdown-circle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.upgrade-popup-wrapper .countdown-track {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    opacity: 0.25;
}

.upgrade-popup-wrapper .countdown-progress {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 56.55;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s linear;
}

.upgrade-popup-wrapper .countdown-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.upgrade-popup-wrapper [data-close]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ad panel — swaps in place of the popup card inside the same wrapper */
.ad-overlay-content {
    position: relative;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: min(90vw, 90vh);
}

.ad-overlay-image {
    display: block;
    width: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.ad-overlay-close {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5em;
    color: #111;
    padding: 0;
    line-height: 1;
}

.ad-overlay-close:hover:not(:disabled) {
    background: #e53e3e;
    border-color: #e53e3e;
    color: #fff;
}

.ad-overlay-close:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ad-close-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-overlay-close:disabled .ad-close-icon {
    display: none;
}

.ad-overlay-close .countdown-wrapper {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin-left: 0;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.ad-overlay-close .countdown-circle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ad-overlay-close .countdown-track {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    opacity: 0.25;
}

.ad-overlay-close .countdown-progress {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 56.55;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s linear;
}

.ad-overlay-close .countdown-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

@media (min-width: 768px) {
    .upgrade-popup-wrapper [data-mobile-only] {
        display: none;
    }
    .upgrade-popup-wrapper .upgrade-popup-hide-mobile {
        display: block;
    }
    .ad-overlay-content {
        width: min(65vw, 65vh);
    }
    .ad-overlay-image[data-portrait] {
        width: 65%;
    }
}
