:root {
    --psp-bg: #fff;
    --psp-accent: #e21313;
}

html.psp-preloader-active,
html.psp-preloader-active body {
    overflow: hidden !important;
}

.psp-preloader {
    --psp-bg: var(--psp-config-bg, #fff);
    --psp-accent: var(--psp-config-accent, #e21313);
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--psp-accent) 7%, transparent), transparent 25%),
        linear-gradient(180deg, var(--psp-bg) 0%, color-mix(in srgb, var(--psp-bg) 96%, #000 4%) 100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .48s ease, visibility .48s ease;
    contain: layout paint style;
}

/* Fail-safe: the overlay is visible only after the head script explicitly
   marks the document active. A blocked/delayed JS file can never trap the UI. */
html.psp-preloader-active .psp-preloader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.psp-preloader.psp-is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.psp-wrap {
    position: relative;
    width: min(84vw, 520px);
    text-align: center;
    direction: rtl;
}

.psp-ripple {
    position: absolute;
    left: 50%;
    top: 42%;
    width: 170px;
    height: 170px;
    border: 1px solid color-mix(in srgb, var(--psp-accent) 16%, transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: psp-ripple 2.2s ease-out infinite;
    will-change: transform, opacity;
}
.psp-ripple-2 { animation-delay: .55s; }
.psp-ripple-3 { animation-delay: 1.1s; }

.psp-logo-box {
    position: relative;
    z-index: 2;
    width: clamp(150px, 30vw, 235px);
    aspect-ratio: 1 / 1;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    animation: psp-logo-enter .8s cubic-bezier(.2,.8,.2,1) both,
               psp-float 2.8s ease-in-out .9s infinite;
    will-change: transform, opacity;
}

.psp-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 18px rgba(0,0,0,.14));
}

.psp-shine {
    width: 240px;
    max-width: 68vw;
    height: 2px;
    margin: 0 auto;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, var(--psp-accent) 18%, var(--psp-accent) 28%, transparent 44%);
    background-size: 220% 100%;
    animation: psp-sweep 1.6s linear infinite;
}

.psp-brand {
    margin-top: 14px;
    color: #1b1b1b;
    font-family: Tahoma, Arial, sans-serif;
    font-size: clamp(17px, 2.3vw, 22px);
    font-weight: 700;
    line-height: 1.7;
}

.psp-subtitle {
    margin-top: 6px;
    color: #989898;
    font-family: Arial, sans-serif;
    font-size: 11px;
    letter-spacing: 4px;
    direction: ltr;
}

.psp-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.psp-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--psp-accent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--psp-accent) 35%, transparent);
    animation: psp-blink 1s ease-in-out infinite;
}
.psp-dots i:nth-child(2) { animation-delay: .15s; }
.psp-dots i:nth-child(3) { animation-delay: .3s; }

/* Lightweight internal-page mode. */
html.psp-mode-quick .psp-preloader {
    transition-duration: .28s;
}
html.psp-mode-quick .psp-ripple,
html.psp-mode-quick .psp-brand,
html.psp-mode-quick .psp-subtitle,
html.psp-mode-quick .psp-dots {
    display: none;
}
html.psp-mode-quick .psp-logo-box {
    width: clamp(82px, 17vw, 115px);
    margin-bottom: 13px;
    animation: psp-quick-pulse .75s ease-in-out infinite alternate;
}
html.psp-mode-quick .psp-shine {
    width: 130px;
    max-width: 40vw;
}

@keyframes psp-logo-enter {
    from { opacity: 0; transform: translateY(8px) scale(.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes psp-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes psp-sweep {
    to { background-position: -220% 0; }
}
@keyframes psp-blink {
    0%, 100% { opacity: .25; transform: translateY(0); }
    50%      { opacity: 1; transform: translateY(-4px); }
}
@keyframes psp-ripple {
    0%   { transform: translate(-50%, -50%) scale(.75); opacity: 0; }
    25%  { opacity: .35; }
    100% { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}
@keyframes psp-quick-pulse {
    from { transform: scale(.97); opacity: .88; }
    to   { transform: scale(1.025); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .psp-ripple,
    .psp-logo-box,
    .psp-shine,
    .psp-dots i {
        animation: none !important;
    }
}

@supports not (color: color-mix(in srgb, red, blue)) {
    .psp-preloader {
        background: linear-gradient(180deg, var(--psp-bg) 0%, #f7f7f7 100%);
    }
    .psp-ripple { border-color: rgba(226,19,19,.16); }
    .psp-dots i { box-shadow: 0 0 10px rgba(226,19,19,.28); }
}
