/* ===== WIN BINGO preloader =====
   Full-screen brand splash shown while a page opens. The markup ships inline so
   it paints on the very first frame, and assets/js/preloader.js removes it as
   soon as the page is ready.

   Dark gold game theme by default. body.lt (admin + auth pages) re-tints it to
   the light/blue theme so it matches whatever it is covering. */

.app-preloader {
    /* Theme tokens, overridden below for the light theme. */
    --pre-accent:   #ffd24a;
    --pre-accent-2: #f5b50a;
    --pre-track:    rgba(255, 255, 255, .10);
    --pre-muted:    #8b93a7;
    --pre-bg-1:     #1a2140;
    --pre-bg-2:     #0b0e1a;

    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(900px 520px at 50% -10%, var(--pre-bg-1) 0%, var(--pre-bg-2) 62%),
                var(--pre-bg-2);
    transition: opacity .34s ease, visibility .34s ease;

    /* Safety net: if the script is blocked or missing entirely, do not trap the
       visitor behind a permanent overlay. Runs once, well after any real load. */
    animation: pre-failsafe 1ms linear 8s forwards;
}

body.lt .app-preloader {
    --pre-accent:   #2563eb;
    --pre-accent-2: #60a5fa;
    --pre-track:    #dde3ee;
    --pre-muted:    #64708a;
    --pre-bg-1:     #dde8fd;
    --pre-bg-2:     #eef1f7;
}

/* Added by preloader.js, then the element is removed outright. */
.app-preloader.is-done {
    opacity: 0;
    visibility: hidden;
}

.app-preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}

/* Visually hidden but still announced by screen readers. Scoped here because
   the project has no shared .sr-only utility. */
.app-preloader .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.app-preloader-logo {
    position: relative;
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
}

.app-preloader-logo img {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
    animation: pre-pop .7s cubic-bezier(.22, 1, .36, 1) both;
}

/* Gold arc sweeping round the logo, punched out with a mask so only the ring
   shows. Falls back to a plain disc on engines without mask support. */
.app-preloader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0 62%, var(--pre-accent) 78%, transparent 100%);
    -webkit-mask: radial-gradient(circle, transparent 0 44px, #000 46px);
    mask: radial-gradient(circle, transparent 0 44px, #000 46px);
    animation: pre-spin 1.15s linear infinite;
}

.app-preloader-brand {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.7rem;
    letter-spacing: .16em;
    color: var(--pre-accent);
    text-shadow: 0 2px 18px rgba(255, 210, 74, .28);
    animation: pre-rise .6s .08s cubic-bezier(.22, 1, .36, 1) both;
}

body.lt .app-preloader-brand { text-shadow: none; }

.app-preloader-tag {
    font-size: .78rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--pre-muted);
    animation: pre-rise .6s .16s cubic-bezier(.22, 1, .36, 1) both;
}

/* Indeterminate progress bar: a pill that sweeps across the track. */
.app-preloader-bar {
    position: relative;
    width: min(240px, 62vw);
    height: 5px;
    margin-top: 6px;
    border-radius: 99px;
    background: var(--pre-track);
    overflow: hidden;
    animation: pre-rise .6s .24s cubic-bezier(.22, 1, .36, 1) both;
}

.app-preloader-bar i {
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--pre-accent-2), var(--pre-accent));
    animation: pre-slide 1.25s cubic-bezier(.65, 0, .35, 1) infinite;
}

@keyframes pre-spin { to { transform: rotate(360deg); } }

@keyframes pre-slide {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(340%); }
}

@keyframes pre-pop {
    from { transform: scale(.86); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

@keyframes pre-rise {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes pre-failsafe { to { visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
    .app-preloader,
    .app-preloader img,
    .app-preloader-ring,
    .app-preloader-bar,
    .app-preloader-bar i,
    .app-preloader-brand,
    .app-preloader-tag {
        animation: none;
        transition: none;
    }
}
