.corpy-loader[hidden] {
    display: none;
}

.corpy-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.corpy-loader.is-visible {
    opacity: 1;
    visibility: visible;
}

.corpy-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 124, 137, 0.3);
    backdrop-filter: blur(9px) saturate(0.84);
    -webkit-backdrop-filter: blur(9px) saturate(0.84);
}

.corpy-loader-scene {
    position: relative;
    width: min(440px, calc(100vw - 32px));
    height: 130px;
}

.corpy-loader-route {
    position: absolute;
    top: 65px;
    width: 124px;
    height: 2px;
    overflow: hidden;
    background: repeating-linear-gradient(90deg, #a2e1e7 0 9px, transparent 9px 18px);
    opacity: 0.9;
}

.corpy-loader-route::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, #087c89, transparent);
    content: "";
    transform: translateX(-110%);
    animation: corpy-loader-route 1.9s ease-in-out infinite;
}

.corpy-loader-route-left { left: 52px; }
.corpy-loader-route-right { right: 52px; transform: scaleX(-1); }

.corpy-loader-token {
    position: absolute;
    top: 37px;
    z-index: 3;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid #d7eef0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 34px -22px rgba(8, 124, 137, 0.65);
}

.corpy-loader-candidate-token {
    left: 0;
    animation: corpy-loader-candidate 1.9s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.corpy-loader-vacancy-token {
    right: 0;
    animation: corpy-loader-vacancy 1.9s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.corpy-loader-token-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 10px;
    background: #e1f7f5;
    color: #087c89;
    font-size: 14px;
}

.corpy-loader-core {
    position: absolute;
    top: 28px;
    left: 50%;
    z-index: 4;
    width: 74px;
    height: 74px;
    transform: translateX(-50%);
}

.corpy-loader-logo-wrap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #b9e8ed;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 22px 44px -28px rgba(8, 124, 137, 0.72);
    animation: corpy-loader-core 1.9s ease-in-out infinite;
}

.corpy-loader-logo-wrap img {
    width: 58px;
    height: 58px;
}

html.corpy-loader-active,
html.corpy-loader-active body { overflow: hidden; }

[data-corpy-submitting="true"] { cursor: wait; }

.corpy-inline-loading {
    display: flex !important;
    min-height: 30px;
    align-items: center;
    gap: 9px;
}

.corpy-inline-loading::before {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    border: 1px solid #b9e8ed;
    border-radius: 9px;
    background: #fff url('/static/corpy_logo.svg') center / 15px 15px no-repeat;
    box-shadow: 0 5px 12px -8px rgba(8, 124, 137, 0.75);
    content: "";
    animation: corpy-inline-pulse 1.25s ease-in-out infinite;
}

@keyframes corpy-inline-pulse {
    0%, 100% { transform: var(--corpy-inline-base-transform, translateZ(0)) scale(0.92); box-shadow: 0 5px 12px -8px rgba(8, 124, 137, 0.55); }
    50% { transform: var(--corpy-inline-base-transform, translateZ(0)) scale(1.05); box-shadow: 0 0 0 5px rgba(99, 216, 225, 0.12); }
}

@keyframes corpy-loader-candidate {
    0%, 15%, 88%, 100% { opacity: 1; transform: translateX(0) rotate(-3deg); }
    48%, 62% { opacity: 1; transform: translateX(150px) rotate(2deg) scale(0.92); }
    72% { opacity: 0; transform: translateX(158px) scale(0.78); }
    73%, 82% { opacity: 0; transform: translateX(0) rotate(-3deg); }
}

@keyframes corpy-loader-vacancy {
    0%, 15%, 88%, 100% { opacity: 1; transform: translateX(0) rotate(3deg); }
    48%, 62% { opacity: 1; transform: translateX(-150px) rotate(-2deg) scale(0.92); }
    72% { opacity: 0; transform: translateX(-158px) scale(0.78); }
    73%, 82% { opacity: 0; transform: translateX(0) rotate(3deg); }
}

@keyframes corpy-loader-route {
    0%, 14% { transform: translateX(-110%); }
    50%, 64%, 100% { transform: translateX(110%); }
}

@keyframes corpy-loader-core {
    0%, 42%, 78%, 100% { transform: scale(1); }
    55%, 65% { transform: scale(1.07); }
}

@media (max-width: 480px) {
    .corpy-loader-scene { width: min(280px, calc(100vw - 24px)); height: 110px; }
    .corpy-loader-route { top: 55px; width: 70px; }
    .corpy-loader-route-left { left: 42px; }
    .corpy-loader-route-right { right: 42px; }
    .corpy-loader-token { top: 32px; width: 46px; height: 46px; border-radius: 15px; }
    .corpy-loader-token-icon { width: 27px; height: 27px; border-radius: 9px; font-size: 12px; }
    .corpy-loader-core { top: 23px; width: 64px; height: 64px; }
    .corpy-loader-logo-wrap { border-radius: 18px; }
    .corpy-loader-logo-wrap img { width: 50px; height: 50px; }

    @keyframes corpy-loader-candidate {
        0%, 15%, 88%, 100% { opacity: 1; transform: translateX(0) rotate(-3deg); }
        48%, 62% { opacity: 1; transform: translateX(96px) rotate(2deg) scale(0.92); }
        72% { opacity: 0; transform: translateX(102px) scale(0.78); }
        73%, 82% { opacity: 0; transform: translateX(0) rotate(-3deg); }
    }

    @keyframes corpy-loader-vacancy {
        0%, 15%, 88%, 100% { opacity: 1; transform: translateX(0) rotate(3deg); }
        48%, 62% { opacity: 1; transform: translateX(-96px) rotate(-2deg) scale(0.92); }
        72% { opacity: 0; transform: translateX(-102px) scale(0.78); }
        73%, 82% { opacity: 0; transform: translateX(0) rotate(3deg); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .corpy-loader,
    .corpy-loader-route::after,
    .corpy-loader-token,
    .corpy-loader-logo-wrap {
        animation: none !important;
        transition: none !important;
    }
    .corpy-inline-loading::before { animation: none !important; }
}
