:root {
    --pull-refresh-accent: #f2b731;
}

html,
body {
    overscroll-behavior-y: none;
}

.pull-refresh {
    --pull-distance: 0px;
    --pull-progress: 0;
    --pull-arrow-rotation: 0deg;
    position: fixed;
    z-index: 160;
    top: max(5px, env(safe-area-inset-top, 0px));
    left: 50%;
    width: min(100%, 480px);
    height: 0;
    color: #c8d2e0;
    pointer-events: none;
    transform: translateX(-50%);
}

.pull-refresh__surface {
    position: absolute;
    top: 0;
    left: 50%;
    display: flex;
    min-width: 126px;
    height: 46px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 15px 0 10px;
    border: 1px solid rgba(134, 153, 179, .26);
    border-radius: 23px;
    background: linear-gradient(145deg, rgba(24, 36, 51, .97), rgba(12, 20, 30, .97));
    box-shadow: 0 13px 30px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .055);
    opacity: 0;
    backdrop-filter: blur(18px) saturate(135%);
    transform: translate3d(-50%, calc(var(--pull-distance) - 58px), 0) scale(.92);
    transition: transform 260ms cubic-bezier(.2, .85, .24, 1), opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    will-change: transform, opacity;
}

.pull-refresh.is-visible .pull-refresh__surface {
    opacity: 1;
    transform: translate3d(-50%, calc(var(--pull-distance) - 58px), 0) scale(1);
}

.pull-refresh.is-tracking .pull-refresh__surface {
    transition: opacity 90ms linear, border-color 120ms ease, box-shadow 120ms ease;
}

.pull-refresh[data-state="armed"] .pull-refresh__surface,
.pull-refresh[data-state="refreshing"] .pull-refresh__surface {
    border-color: rgba(242, 183, 49, .52);
    box-shadow: 0 15px 34px rgba(0, 0, 0, .42), 0 0 22px rgba(242, 183, 49, .1), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.pull-refresh[data-state="complete"] .pull-refresh__surface {
    border-color: rgba(0, 192, 135, .48);
    box-shadow: 0 15px 34px rgba(0, 0, 0, .42), 0 0 22px rgba(0, 192, 135, .1);
}

.pull-refresh[data-state="error"] .pull-refresh__surface {
    border-color: rgba(240, 68, 90, .48);
}

.pull-refresh__icon {
    position: relative;
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 50%;
    background: rgba(242, 183, 49, .075);
}

.pull-refresh__ring {
    position: absolute;
    inset: 0;
    width: 30px;
    height: 30px;
    overflow: visible;
    transform: rotate(-90deg);
}

.pull-refresh__ring-track,
.pull-refresh__ring-value {
    fill: none;
    stroke-width: 1.8;
}

.pull-refresh__ring-track {
    stroke: rgba(132, 149, 173, .2);
}

.pull-refresh__ring-value {
    stroke: var(--pull-refresh-accent);
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--pull-progress));
    stroke-linecap: round;
    transition: stroke-dashoffset 60ms linear;
}

.pull-refresh__arrow,
.pull-refresh__result {
    position: absolute;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--pull-refresh-accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.pull-refresh__arrow {
    transform: rotate(var(--pull-arrow-rotation));
    transition: transform 80ms linear;
}

.pull-refresh__result {
    display: none;
}

.pull-refresh__label {
    color: #cbd5e3;
    font-size: 11px;
    font-weight: 760;
    letter-spacing: .01em;
    white-space: nowrap;
}

.pull-refresh[data-state="refreshing"] .pull-refresh__ring {
    animation: pull-refresh-spin 820ms linear infinite;
}

.pull-refresh[data-state="refreshing"] .pull-refresh__ring-value {
    stroke-dasharray: 64 36;
    stroke-dashoffset: 0;
}

.pull-refresh[data-state="refreshing"] .pull-refresh__arrow,
.pull-refresh[data-state="complete"] .pull-refresh__arrow,
.pull-refresh[data-state="error"] .pull-refresh__arrow,
.pull-refresh[data-state="complete"] .pull-refresh__ring,
.pull-refresh[data-state="error"] .pull-refresh__ring {
    display: none;
}

.pull-refresh[data-state="complete"] .pull-refresh__result--complete,
.pull-refresh[data-state="error"] .pull-refresh__result--error {
    display: block;
}

.pull-refresh[data-state="complete"] .pull-refresh__icon {
    background: rgba(0, 192, 135, .1);
}

.pull-refresh[data-state="complete"] .pull-refresh__result {
    stroke: #00c087;
}

.pull-refresh[data-state="error"] .pull-refresh__icon {
    background: rgba(240, 68, 90, .1);
}

.pull-refresh[data-state="error"] .pull-refresh__result {
    stroke: #f0445a;
}

body.pull-refresh-active {
    user-select: none;
}

@keyframes pull-refresh-spin {
    to { transform: rotate(270deg); }
}

@media (min-width: 768px) {
    .pull-refresh { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pull-refresh__surface,
    .pull-refresh__ring-value,
    .pull-refresh__arrow {
        transition-duration: .01ms !important;
    }

    .pull-refresh[data-state="refreshing"] .pull-refresh__ring {
        animation-duration: 1.4s;
    }
}
