.popad-overlay {
    --popad-surface: #fff;
    --popad-text: #172b29;
    --popad-muted: #6b7d79;
    --popad-line: #e6eeeb;
    --popad-soft: #f5f8f7;
    --popad-accent: #078365;
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 24px;
    border: 0;
    box-sizing: border-box;
    color: var(--popad-text);
    background: rgba(7, 17, 24, .64);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}
.popad-overlay::backdrop { background: transparent; }
.popad-overlay:not(.is-open) { display: none !important; }
.popad-overlay *, .popad-overlay *::before, .popad-overlay *::after { box-sizing: border-box; }
.popad-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 740px;
    max-height: calc(100dvh - 48px);
    overflow: auto;
    background: var(--popad-surface);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 22px;
    box-shadow: 0 32px 100px rgba(0,0,0,.34), 0 8px 24px rgba(0,0,0,.12);
    animation: popad-in .28s ease-out;
    isolation: isolate;
}
.popad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 68px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--popad-line);
    flex-shrink: 0;
}
.popad-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.popad-brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--popad-line);
    border-radius: 11px;
    background: var(--popad-soft);
    color: var(--popad-accent);
    overflow: hidden;
}
.popad-brand-logo { width: 28px; height: 28px; object-fit: contain; }
.popad-brand-name { color: var(--popad-text);  font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.popad-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--popad-line);
    border-radius: 50%;
    background: var(--popad-soft);
    color: var(--popad-muted);
    cursor: pointer;
    transition: background .18s, color .18s;
}
.popad-close:hover { background: var(--popad-line); color: var(--popad-text); }
.popad-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 80px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--popad-soft);
}
.popad-image, .popad-video {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(65dvh, max(120px, calc(100dvh - 220px)));
    object-fit: contain;
}
.popad-video { background: #080e14; }
.popad-video::-webkit-media-controls { display: none !important; }
.popad-sound-toggle {
    position: absolute;
    bottom: 14px;
    inset-inline-end: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 50%;
    background: rgba(10,20,28,.75);
    color: #fff;
    cursor: pointer;
}
.popad-sound-toggle.is-muted .popad-sound-waves,
.popad-sound-toggle:not(.is-muted) .popad-sound-slash { display: none; }
.popad-body { padding: 20px 22px 16px; border-top: 1px solid var(--popad-line); flex-shrink: 0; text-align: start; }
.popad-content-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.popad-title { margin: 0; color: var(--popad-text);  font-weight: 750; line-height: 1.65; overflow-wrap: anywhere; }
.popad-title-fallback { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.popad-actions { display: flex; gap: 8px; flex-shrink: 0; }
.popad-actions:empty { display: none; }
.popad-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}
.popad-btn-primary { background: var(--popad-accent); color: #fff; }
.popad-btn-primary:hover { background: #05684f; color: #fff; text-decoration: none; }
.popad-btn-ghost { background: var(--popad-soft); color: var(--popad-text); border-color: var(--popad-line); }
.popad-btn-ghost:hover { background: var(--popad-line); }
.popad-timer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--popad-line); }
.popad-hint { color: var(--popad-muted);  line-height: 1.7; }
.popad-progress { position: relative; width: 110px; height: 3px; flex: 0 0 110px; overflow: hidden; border-radius: 99px; background: var(--popad-line); }
.popad-progress-bar { position: absolute; inset: 0; width: 100%; background: var(--popad-accent); transform-origin: left center; border-radius: inherit; }
html[dir="rtl"] .popad-progress-bar { transform-origin: right center; }
.popad-overlay button:focus-visible, .popad-overlay a:focus-visible { outline: 3px solid #34d399; outline-offset: 3px; }
html.dark .popad-overlay {
    --popad-surface: #14201f;
    --popad-text: #eff7f4;
    --popad-muted: #a2b5af;
    --popad-line: #2a3a36;
    --popad-soft: #1b2a27;
    --popad-accent: #16a37c;
}
@keyframes popad-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 600px) {
    .popad-overlay { padding: 12px; }
    .popad-card { max-height: calc(100dvh - 24px); border-radius: 16px; }
    .popad-header { min-height: 60px; padding: 12px 16px; }
    .popad-body { padding: 16px; }
    .popad-content-row { align-items: stretch; flex-direction: column; gap: 14px; }
    .popad-actions .popad-btn { flex: 1; }
    .popad-timer { gap: 12px; margin-top: 14px; padding-top: 12px; }
    .popad-progress { width: 70px; flex-basis: 70px; }
    .popad-hint {  }
}
@media (prefers-reduced-motion: reduce) { .popad-card { animation: none; } .popad-overlay button, .popad-overlay a { transition: none; } }
