:root {
    --cf-bg: #f5f7fa;
    --cf-card: #ffffff;
    --cf-border: #e2e8f0;
    --cf-ink: #1d1d1f;
    --cf-muted: #64748b;
    --cf-accent: #1473e6;
    --cf-ok: #16a34a;
    --cf-err: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--cf-bg);
    color: var(--cf-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
}

.cf {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cf__card {
    width: 100%;
    background: var(--cf-card);
    border: 1px solid var(--cf-border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    padding: 28px 24px 22px;
    text-align: center;
}

.cf__logo {
    width: 44px;
    height: auto;
    display: block;
    margin: 0 auto 16px;
}

.cf__title {
    margin: 0 0 10px;
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cf__lead {
    margin: 0 0 22px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--cf-muted);
}

.cf__phase {
    animation: cf-fade-in 0.35s ease-out both;
}

.cf__phase--check,
.cf__phase--busy,
.cf__phase--ok {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.cf__brand {
    display: flex;
    justify-content: center;
    width: 100%;
}

@keyframes cf-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.cf__row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: min(100%, 300px);
    margin: 0 auto;
    padding: 14px 16px;
    border: 1px solid var(--cf-border);
    border-radius: 6px;
    background: #fafbfc;
    cursor: pointer;
    user-select: none;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.cf__row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.cf__row:focus-visible {
    border-color: var(--cf-accent);
    box-shadow: 0 0 0 3px rgba(20, 115, 230, 0.25);
}

.cf__row.is-checking {
    pointer-events: none;
    border-color: #bfdbfe;
    background: #f0f7ff;
    animation: cf-row-pulse 1s ease-in-out infinite;
}

@keyframes cf-row-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(20, 115, 230, 0.15); }
    50% { box-shadow: 0 0 0 4px rgba(20, 115, 230, 0.12); }
}

.cf__row.is-busy {
    pointer-events: none;
    opacity: 0.55;
}

.cf__checkbox {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.cf__box {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: 2px solid #94a3b8;
    border-radius: 4px;
    background: #fff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.cf__row:hover .cf__box {
    border-color: #64748b;
}

.cf__box-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #dbeafe;
    border-top-color: var(--cf-accent);
    border-radius: 50%;
    animation: cf-spin 0.65s linear infinite;
}

.cf__row.is-checking .cf__box {
    border-color: var(--cf-accent);
    background: #fff;
    transform: scale(1.05);
}

.cf__row.is-checking .cf__box-spinner {
    display: block;
}

.cf__checkbox:checked + .cf__box:not(.cf__box--done) {
    border-color: var(--cf-accent);
}

.cf__box.cf__box--done {
    border-color: var(--cf-ok);
    background: var(--cf-ok);
    transform: scale(1);
    animation: cf-check-pop 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.cf__box.cf__box--done::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    animation: cf-tick-in 0.35s 0.1s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes cf-check-pop {
    0% { transform: scale(0.85); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes cf-tick-in {
    to { transform: rotate(45deg) scale(1); }
}

.cf__label {
    font-size: 0.9375rem;
    color: var(--cf-ink);
    transition: color 0.2s;
}

.cf__row.is-checking .cf__label {
    color: var(--cf-accent);
    font-weight: 500;
}

.cf__fine {
    margin: 18px 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
}

.cf__phase--busy {
    padding: 8px 0 4px;
}

.cf__progress-wrap {
    width: min(100%, 280px);
    height: 6px;
    margin: 0 auto 18px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.cf__progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1473e6, #3b9cff);
    transition: none;
}

.cf__progress-bar.is-running {
    animation: cf-progress-fill var(--cf-verify-duration, 2s) ease-in-out forwards;
}

@keyframes cf-progress-fill {
    0% { width: 8%; }
    35% { width: 52%; }
    70% { width: 78%; }
    100% { width: 100%; }
}

.cf__busy-text {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--cf-muted);
    text-align: center;
    width: 100%;
}

.cf__dots::after {
    content: "";
    animation: cf-dots 1.4s steps(4, end) infinite;
}

@keyframes cf-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

.cf__phase--ok {
    padding: 12px 0 4px;
}

.cf__ok-ring {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(22, 163, 74, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cf-ok-ring 0.6s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes cf-ok-ring {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.cf__ok-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cf-ok);
    color: #fff;
    font-size: 1.125rem;
    line-height: 36px;
    font-weight: 700;
    animation: cf-ok-pop 0.5s 0.15s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes cf-ok-pop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.cf__ok-text {
    color: var(--cf-ink);
    font-weight: 600;
}

.cf__ok-sub {
    margin: 6px 0 0;
    font-size: 0.8125rem;
    color: var(--cf-muted);
    text-align: center;
    width: 100%;
}

.cf__error {
    margin: 16px auto 0;
    width: 100%;
    max-width: 300px;
    font-size: 0.875rem;
    color: var(--cf-err);
    text-align: center;
}

@keyframes cf-spin {
    to { transform: rotate(360deg); }
}

[hidden] { display: none !important; }

@media (max-width: 480px) {
    .cf__card {
        padding: clamp(22px, 6vw, 28px) clamp(16px, 5vw, 24px) clamp(18px, 5vw, 22px);
        border-radius: 10px;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.07);
    }

    .cf__logo {
        width: 40px;
        margin-bottom: 14px;
    }

    .cf__title {
        font-size: clamp(1.2rem, 5.5vw, 1.375rem);
        margin-bottom: 8px;
    }

    .cf__lead {
        font-size: clamp(0.875rem, 3.8vw, 0.9375rem);
        margin-bottom: 18px;
        line-height: 1.45;
    }

    .cf__row {
        width: min(100%, 300px);
        padding: 14px;
        gap: 10px;
        min-height: 52px;
    }

    .cf__label {
        font-size: clamp(0.875rem, 3.8vw, 0.9375rem);
        line-height: 1.35;
    }

    .cf__fine {
        margin-top: 16px;
        font-size: 0.6875rem;
        line-height: 1.4;
    }

    .cf__busy-text {
        font-size: clamp(0.875rem, 3.8vw, 0.9375rem);
        text-align: center;
    }

    .cf__ok-sub {
        font-size: clamp(0.75rem, 3.4vw, 0.8125rem);
        text-align: center;
    }

    .cf__error {
        font-size: clamp(0.8125rem, 3.6vw, 0.875rem);
        line-height: 1.4;
    }
}

@media (max-width: 360px) {
    .cf__row {
        padding: 12px;
    }

    .cf__box {
        width: 22px;
        height: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cf__phase,
    .cf__row.is-checking,
    .cf__progress-bar.is-running,
    .cf__ok-ring,
    .cf__ok-icon,
    .cf__box.cf__box--done,
    .cf__box.cf__box--done::after {
        animation: none !important;
    }
    .cf__progress-bar.is-running { width: 100%; }
}
