.app-loading-dialog {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    border: 0;
    background: rgba(15, 23, 42, .32);
    color: #0f172a;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 160ms ease, visibility 0s linear 160ms;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-backdrop-filter: blur(4px) saturate(.9);
    backdrop-filter: blur(4px) saturate(.9);
}

.app-loading-dialog[open],
.app-loading-dialog[data-fallback-open="true"] {
    display: grid;
    place-items: center;
}

.app-loading-dialog[data-fallback-open="true"] {
    background: rgba(15, 23, 42, .32);
    -webkit-backdrop-filter: blur(4px) saturate(.9);
    backdrop-filter: blur(4px) saturate(.9);
}

.app-loading-dialog::backdrop {
    background: rgba(15, 23, 42, .32);
    -webkit-backdrop-filter: blur(4px) saturate(.9);
    backdrop-filter: blur(4px) saturate(.9);
}

.app-loading-dialog.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 160ms ease;
}

.app-loading-card {
    position: relative;
    width: min(318px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    padding: 25px 20px 21px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(219, 234, 254, .96);
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .99), rgba(248, 250, 252, .99));
    box-shadow: 0 28px 72px rgba(15, 23, 42, .32), 0 8px 24px rgba(37, 99, 235, .14), inset 0 1px 0 #fff;
    text-align: center;
    direction: rtl;
    pointer-events: auto;
    transform: translateY(12px) scale(.96);
    transition: transform 160ms ease;
}

.app-loading-dialog.is-visible .app-loading-card {
    transform: none;
}

.app-loading-card::before {
    content: "";
    position: absolute;
    inset: 0 17px auto;
    height: 4px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #22d3ee 0%, #2563eb 48%, #4f46e5 100%);
}

.app-loading-spinner {
    position: relative;
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(219, 234, 254, .78) 0 32%, rgba(255, 255, 255, 0) 68%);
}

.app-loading-spinner::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(from -35deg, #2563eb 0 31%, #4f46e5 31% 57%, #dbeafe 57% 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 0);
    animation: app-loading-spin .9s linear infinite;
}

.app-loading-spinner::after {
    content: "";
    position: absolute;
    inset: 15px;
    border-radius: 16px;
    background: rgba(37, 99, 235, .1);
    filter: blur(7px);
}

.app-loading-spinner img {
    position: relative;
    z-index: 1;
    width: 39px;
    height: 39px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(145deg, #2563eb, #06b6d4);
    box-shadow: 0 9px 20px rgba(37, 99, 235, .28);
}

.app-loading-copy {
    display: grid;
    gap: 8px;
    width: 100%;
}

.app-loading-copy strong {
    color: #0f172a;
    font-size: 19px;
    font-weight: 950;
    line-height: 1.5;
}

.app-loading-copy span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.75;
}

.app-loading-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 8px;
}

.app-loading-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 3px 8px rgba(37, 99, 235, .18);
    animation: app-loading-dot 1s ease-in-out infinite;
}

.app-loading-dots i:nth-child(2) { animation-delay: 120ms; }
.app-loading-dots i:nth-child(3) { animation-delay: 240ms; }

.app-loading-dismiss {
    min-height: 38px;
    margin: 0;
    padding: 8px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: #334155;
    background: #f8fafc;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}

.app-connection-notice {
    position: fixed;
    z-index: 2147483647;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    width: min(520px, calc(100vw - 28px));
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 13px;
    border: 1px solid #fdba74;
    border-radius: 17px;
    color: #7c2d12;
    background: rgba(255, 247, 237, .985);
    box-shadow: 0 14px 38px rgba(15, 23, 42, .18);
    direction: rtl;
    transform: translateX(-50%);
}

.app-connection-notice[hidden] {
    display: none !important;
}

.app-connection-notice[data-state="online"] {
    color: #14532d;
    border-color: #86efac;
    background: rgba(240, 253, 244, .985);
}

.app-connection-notice__icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: #ea580c;
    font-size: 18px;
    font-weight: 950;
}

.app-connection-notice[data-state="online"] .app-connection-notice__icon {
    background: #16a34a;
}

.app-connection-notice__copy {
    min-width: 0;
    display: grid;
    flex: 1 1 auto;
    gap: 2px;
}

.app-connection-notice__copy strong {
    font-size: 13px;
    font-weight: 950;
}

.app-connection-notice__copy span {
    font-size: 10px;
    font-weight: 750;
    line-height: 1.65;
}

.app-connection-notice__dismiss {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: currentColor;
    background: rgba(255, 255, 255, .7);
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.app-loading-dismiss:hover,
.app-loading-dismiss:focus-visible {
    color: #1d4ed8;
    border-color: #93c5fd;
    background: #eff6ff;
}

.app-loading-locked {
    cursor: wait !important;
}

.app-loading-soft-locked {
    pointer-events: none !important;
    cursor: wait !important;
    opacity: .72;
}

html.app-loading-active,
body.app-loading-active {
    cursor: wait;
}

body.app-loading-active {
    overflow: hidden;
}

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

@keyframes app-loading-dot {
    0%, 70%, 100% { opacity: .35; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 520px) {
    .app-loading-dialog {
        padding: max(14px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left));
    }

    .app-loading-card {
        width: min(292px, 100%);
        gap: 12px;
        padding: 22px 17px 19px;
        border-radius: 26px;
    }

    .app-loading-spinner {
        width: 68px;
        height: 68px;
    }

    .app-loading-spinner img {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .app-loading-copy strong {
        font-size: 17px;
    }

    .app-loading-copy span {
        font-size: 11px;
    }

    .app-connection-notice {
        top: max(9px, env(safe-area-inset-top));
        width: calc(100vw - 18px);
        padding: 10px 11px;
        border-radius: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-loading-dialog,
    .app-loading-card {
        transition: none !important;
    }

    .app-loading-spinner,
    .app-loading-spinner::before,
    .app-loading-spinner::after,
    .app-loading-spinner img,
    .app-loading-dots i {
        animation: none !important;
    }
}

@media print {
    .app-loading-dialog,
    .app-connection-notice {
        display: none !important;
    }
}
