.puzzle-captcha {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.puzzle-captcha-summary {
    width: 100%;
    min-height: 54px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    border-radius: 16px;
    background:
        radial-gradient(circle at 18% 20%, rgba(56, 189, 248, 0.18), transparent 32%),
        linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    color: #0f2f4f;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.puzzle-captcha-summary i {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #fff;
    flex: 0 0 auto;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

.puzzle-captcha-summary-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.puzzle-captcha-summary-title {
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
}

.puzzle-captcha-summary-subtitle {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.puzzle-captcha-summary.is-success {
    border-color: rgba(34, 197, 94, 0.45);
    background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
}

.puzzle-captcha-summary.is-success i {
    background: linear-gradient(135deg, #22c55e 0%, #059669 100%);
}

.puzzle-captcha-summary.is-success .puzzle-captcha-summary-title {
    color: #047857;
}

.puzzle-captcha-status {
    min-height: 20px;
    font-size: 13px;
    font-weight: 800;
    color: #64748b;
}

.puzzle-captcha-status.is-success {
    color: #059669;
}

.puzzle-captcha-status.is-error {
    color: #dc2626;
}

.puzzle-captcha-dialog-status {
    position: sticky;
    top: 0;
    z-index: 500;
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.45;
    word-break: break-word;
    pointer-events: auto;
    isolation: isolate;
    scroll-margin-top: 12px;
}

.puzzle-captcha-floating-status {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 14100;
    width: min(92vw, 430px);
    transform: translate3d(-50%, 0, 0);
    display: none;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid #fecaca;
    background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%);
    color: #991b1b;
    font-size: 13px;
    font-weight: 950;
    line-height: 1.45;
    box-shadow: 0 24px 60px rgba(127, 29, 29, 0.26);
    pointer-events: auto;
    word-break: break-word;
}

.puzzle-captcha-floating-status:not([hidden]) {
    display: flex;
}

.puzzle-captcha-floating-status::before {
    content: "!";
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-top: 1px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 1000;
}

.puzzle-captcha-dialog.is-open .puzzle-captcha-floating-status.is-error:not([hidden]) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: captchaStatusDrop 0.18s ease-out both;
}

.puzzle-captcha-dialog-status:not([hidden]) {
    display: flex;
}

.puzzle-captcha-dialog-status::before {
    content: "!";
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin-top: 1px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 1000;
}

.puzzle-captcha-dialog-status.is-error {
    background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%);
    border-color: #fecaca;
    color: #b91c1c;
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.20);
}

.puzzle-captcha-dialog-status.is-error::before {
    background: #dc2626;
    color: #fff;
}

.puzzle-captcha-dialog-status.is-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
    border-color: #bbf7d0;
    color: #047857;
    box-shadow: 0 10px 22px rgba(16, 185, 129, 0.12);
}

.puzzle-captcha-dialog-status.is-success::before {
    content: "✓";
    background: #059669;
    color: #fff;
}

.puzzle-captcha.is-failed .puzzle-captcha-panel,
.puzzle-captcha-dialog.is-failed .puzzle-captcha-panel {
    border-color: rgba(239, 68, 68, 0.45);
}

.puzzle-captcha.is-failed .puzzle-captcha-dialog-status.is-error,
.puzzle-captcha-dialog.is-failed .puzzle-captcha-dialog-status.is-error {
    animation: captchaStatusShake 0.22s ease both;
}

.puzzle-captcha-dialog.is-open .puzzle-captcha-dialog-status.is-error {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@keyframes captchaStatusShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

@keyframes captchaStatusDrop {
    from {
        transform: translate3d(-50%, -8px, 0);
        opacity: 0;
    }
    to {
        transform: translate3d(-50%, 0, 0);
        opacity: 1;
    }
}

.puzzle-captcha-dialog {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw;
    height: 100dvh;
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 14000 !important;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 50% 20%, rgba(14, 165, 233, 0.22), transparent 28%),
        rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.puzzle-captcha-dialog.is-open {
    display: flex !important;
}

.puzzle-captcha-panel {
    position: relative;
    isolation: isolate;
    width: min(94vw, 430px);
    max-height: calc(100dvh - 36px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,248,253,0.98) 100%);
    box-shadow: 0 34px 80px rgba(15, 23, 42, 0.28);
    animation: puzzlePanelIn 0.18s ease-out;
}

@keyframes puzzlePanelIn {
    from {
        transform: translateY(10px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.puzzle-captcha-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.puzzle-captcha-panel-title,
.puzzle-captcha-panel-subtitle {
    display: block;
}

.puzzle-captcha-panel-title {
    font-size: 18px;
    font-weight: 900;
    color: #0f172a;
}

.puzzle-captcha-panel-subtitle {
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.puzzle-captcha-close,
.puzzle-captcha-refresh,
.puzzle-captcha-alt {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 12px;
    background: #eef6ff;
    color: #2563eb;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.puzzle-captcha-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.puzzle-captcha-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.puzzle-captcha-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 900;
    color: #2563eb;
}

.puzzle-captcha-managed {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    margin-top: 4px;
    border: 1px solid rgba(191, 219, 254, 0.85);
    border-radius: 18px;
    background:
        radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.18), transparent 34%),
        linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    color: #0f2f4f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 14px 28px rgba(15, 23, 42, 0.08);
}

.puzzle-captcha-managed strong,
.puzzle-captcha-managed span {
    display: block;
}

.puzzle-captcha-managed strong {
    font-size: 14px;
    font-weight: 1000;
    color: #0f172a;
}

.puzzle-captcha-managed span {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.45;
}

.puzzle-captcha-managed-ring {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 4px solid rgba(37, 99, 235, 0.16);
    border-top-color: #2563eb;
    animation: puzzleManagedSpin 0.86s linear infinite;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

@keyframes puzzleManagedSpin {
    to {
        transform: rotate(360deg);
    }
}

.puzzle-captcha.is-managed-check .puzzle-captcha-managed,
.puzzle-captcha-dialog.is-managed-check .puzzle-captcha-managed {
    display: flex;
}

.puzzle-captcha.is-managed-check .puzzle-captcha-head,
.puzzle-captcha.is-managed-check .puzzle-captcha-stage,
.puzzle-captcha.is-managed-check .puzzle-captcha-slider,
.puzzle-captcha.is-managed-check .puzzle-captcha-numeric,
.puzzle-captcha-dialog.is-managed-check .puzzle-captcha-head,
.puzzle-captcha-dialog.is-managed-check .puzzle-captcha-stage,
.puzzle-captcha-dialog.is-managed-check .puzzle-captcha-slider,
.puzzle-captcha-dialog.is-managed-check .puzzle-captcha-numeric {
    display: none;
}

.puzzle-captcha-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 320 / 160;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: #eaf3ff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45), 0 18px 34px rgba(15, 23, 42, 0.1);
}

.puzzle-captcha-bg {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.puzzle-captcha-piece {
    position: absolute;
    left: 0;
    top: 0;
    width: 58px;
    height: 58px;
    pointer-events: none;
    filter: drop-shadow(0 10px 16px rgba(15, 23, 42, 0.28));
    transition: none;
    will-change: transform;
}

.puzzle-captcha-slider {
    position: relative;
    min-height: 56px;
    margin-top: 14px;
    border-radius: 16px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(180deg, #f8fbff 0%, #eaf3ff 100%);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 12px 26px rgba(15, 23, 42, 0.08);
}

.puzzle-captcha-slider-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.24) 0%, rgba(37, 99, 235, 0.18) 100%);
    transition: none;
    will-change: width;
}

.puzzle-captcha-slider-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 72px;
    color: #475569;
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    user-select: none;
}

.puzzle-captcha-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.34);
    cursor: grab;
    z-index: 2;
    touch-action: none;
    transition: box-shadow 0.12s ease;
    will-change: transform;
}

.puzzle-captcha-handle:active,
.puzzle-captcha.is-dragging .puzzle-captcha-handle,
.puzzle-captcha-dialog.is-dragging .puzzle-captcha-handle {
    cursor: grabbing;
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.42);
}

.puzzle-captcha.is-verified .puzzle-captcha-slider,
.puzzle-captcha-dialog.is-verified .puzzle-captcha-slider {
    border-color: rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
}

.puzzle-captcha.is-verified .puzzle-captcha-slider-label,
.puzzle-captcha-dialog.is-verified .puzzle-captcha-slider-label {
    color: #047857;
}

.puzzle-captcha.is-verified .puzzle-captcha-handle,
.puzzle-captcha-dialog.is-verified .puzzle-captcha-handle {
    background: linear-gradient(135deg, #22c55e 0%, #059669 100%);
    box-shadow: 0 14px 26px rgba(5, 150, 105, 0.28);
}

.puzzle-captcha.is-loading .puzzle-captcha-handle,
.puzzle-captcha.is-verified .puzzle-captcha-handle,
.puzzle-captcha-dialog.is-loading .puzzle-captcha-handle,
.puzzle-captcha-dialog.is-verified .puzzle-captcha-handle {
    pointer-events: none;
}

.puzzle-captcha-numeric {
    display: none;
    gap: 12px;
    margin-top: 12px;
}

.puzzle-captcha.is-numeric-mode .puzzle-captcha-stage,
.puzzle-captcha.is-numeric-mode .puzzle-captcha-slider,
.puzzle-captcha-dialog.is-numeric-mode .puzzle-captcha-stage,
.puzzle-captcha-dialog.is-numeric-mode .puzzle-captcha-slider {
    display: none;
}

.puzzle-captcha.is-numeric-mode .puzzle-captcha-numeric,
.puzzle-captcha-dialog.is-numeric-mode .puzzle-captcha-numeric {
    display: grid;
}

.puzzle-captcha-numeric-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.88);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.20), transparent 36%),
        linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 14px 26px rgba(15, 23, 42, 0.08);
}

.puzzle-captcha-numeric-label {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.puzzle-captcha-numeric-question {
    display: block;
    color: #0f172a;
    font-size: clamp(28px, 8vw, 42px);
    letter-spacing: 0.20em;
    font-weight: 1000;
    line-height: 1;
    user-select: none;
}

.puzzle-captcha-numeric-input {
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid #bfdbfe;
    background: #fff;
    color: #0f172a;
    text-align: center;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.12em;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 10px 22px rgba(15, 23, 42, 0.06);
}

.puzzle-captcha-numeric-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.puzzle-captcha-numeric-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 8px;
}

.puzzle-captcha-back,
.puzzle-captcha-numeric-refresh,
.puzzle-captcha-numeric-submit {
    min-height: 42px;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.puzzle-captcha-back,
.puzzle-captcha-numeric-refresh {
    background: #eef6ff;
    color: #2563eb;
}

.puzzle-captcha-numeric-submit {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

@media (max-width: 768px) {
    .puzzle-captcha-floating-status {
        top: max(10px, env(safe-area-inset-top, 0px));
        width: calc(100vw - 20px);
        border-radius: 14px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .puzzle-captcha-dialog {
        align-items: center;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .puzzle-captcha-panel {
        width: 100%;
        max-width: 430px;
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        border-radius: 22px;
        padding: 16px;
    }

    .puzzle-captcha-stage {
        border-radius: 16px;
    }

    .puzzle-captcha-slider {
        min-height: 54px;
    }

    .puzzle-captcha-handle {
        width: 46px;
        height: 46px;
    }

    .puzzle-captcha-slider-label {
        font-size: 13px;
        padding: 0 64px;
    }

    .puzzle-captcha-numeric-actions {
        grid-template-columns: 1fr;
    }
}
