/* Shared by the pre-React startup screen and every blocking operation. */
:root {
    --app-loader-accent: #233776;
    --app-loader-layer: 2147483646;
}

#app-loader[hidden] { display: none !important; }
#app-loader {
    position: fixed;
    inset: 0;
    z-index: var(--app-loader-layer);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(255, 255, 255, .88);
    color: #374151;
    pointer-events: auto;
    touch-action: none;
    font-family: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
}
#app-loader[data-mode="startup"] { background: #fff; }
#app-loader:focus { outline: none; }
#app-loader .app-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 440px;
    text-align: center;
}
#app-loader .app-loader-spinner { position: relative; width: 48px; height: 48px; margin-bottom: 8px; }
#app-loader .app-loader-spinner::before,
#app-loader .app-loader-spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: 4px solid #e5e7eb;
    border-top-color: var(--app-loader-accent);
    border-radius: 50%;
    animation: app-loader-spin 1s linear infinite;
}
#app-loader .app-loader-spinner::after {
    border-color: transparent;
    border-top-color: var(--app-loader-accent);
    opacity: .2;
    animation: app-loader-ping 1s cubic-bezier(0, 0, .2, 1) infinite;
}
#app-loader h3 { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 600; }
#app-loader p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: #6b7280; }
#app-loader button {
    border: 0;
    border-radius: 6px;
    background: var(--app-loader-accent);
    color: white;
    padding: 10px 20px;
    min-height: 44px;
    cursor: pointer;
    font: inherit;
}
#nprogress { pointer-events: none; }
#nprogress .bar { z-index: 2147483647 !important; }
@keyframes app-loader-spin { to { transform: rotate(360deg); } }
@keyframes app-loader-ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    #app-loader .app-loader-spinner::before { animation: none; }
    #app-loader .app-loader-spinner::after { display: none; }
}

/* Navigation keeps the same interaction lock with only a green progress bar. */
#app-loader[data-mode="navigation"] { background: transparent; }
#app-loader[data-mode="navigation"] .app-loader-content {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
#app-loader[data-mode="navigation"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 35%;
    height: 3px;
    background: #10b981;
    animation: app-loader-progress 1.1s ease-in-out infinite alternate;
}
body[aria-busy="true"] #nprogress { display: none; }
@keyframes app-loader-progress {
    from { transform: translateX(0); }
    to { transform: translateX(186%); }
}
@media (prefers-reduced-motion: reduce) {
    #app-loader[data-mode="navigation"]::before { animation: none; width: 100%; }
}
