.captcha-wrapper {
    position: relative;
    width: 250px;
    max-width: 100%;
    margin: 12px auto;
}

.captcha-box {
    position: relative;
    width: 250px;
    height: 160px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* 建立独立层叠上下文与包含块，规避模态框 / 父级 backdrop-filter、transform 对
       绝对定位拼图块（.captcha-slider-img）定位上下文的干扰，确保 top/left 精确生效 */
    transform: translateZ(0);
}

.captcha-bg-container {
    position: relative;
    width: 100%;
    height: 100%;
}

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

.captcha-slider-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    border-radius: 0 0 12px 12px;
}

.captcha-slider-track {
    position: absolute;
    top: 38px;
    left: 10px;
    right: 10px;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    z-index: 10;
}

.captcha-hint-text {
    position: absolute;
    top: 12px;
    left: 60px;
    right: 10px;
    font-size: 13px;
    color: #666;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 10;
}

.captcha-slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.1s ease;
}

.captcha-progress-success {
    background: linear-gradient(90deg, #10b981, #059669);
}

.captcha-slider {
    position: absolute;
    top: 5px;
    left: 0;
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 2px solid #667eea;
    transition: all 0.2s;
    z-index: 20;
    pointer-events: auto;
}

.captcha-slider:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.captcha-slider-dragging {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    transform: scale(1.08);
}

.captcha-slider-loading {
    pointer-events: none;
}

.captcha-slider-loading .captcha-slider-icon {
    animation: captchaSpin 1s linear infinite;
}

.captcha-slider-success {
    background: #10b981;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.captcha-slider-success .captcha-slider-icon svg {
    stroke: #fff;
}

.captcha-slider-error {
    background: #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    animation: captchaShake 0.4s ease;
}

.captcha-slider-error .captcha-slider-icon svg {
    stroke: #fff;
}

.captcha-slider-content {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.captcha-slider-success .captcha-slider-content,
.captcha-slider-error .captcha-slider-content {
    background: transparent;
}

.captcha-slider-icon {
    transition: transform 0.2s;
}

.captcha-slider-dragging .captcha-slider-icon {
    transform: translateX(3px);
}

.captcha-slider-img {
    position: absolute;
    top: 10px;  /* 改为非零默认值（原为 0），确保即使在 reset 前也在可见区 */
    left: 0;
    width: 44px !important;  /* 防 max-width:100% 全局规则压缩 */
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
    z-index: 25;
    pointer-events: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: block;  /* 显式声明 */
    visibility: visible;  /* 显式声明 */
    opacity: 1;  /* 显式声明 */
    /* 确保不被全局 img { max-width:100% } 压缩到不可见尺寸 */
    max-width: none;
}

.captcha-status {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    min-height: 18px;
    transition: color 0.2s;
}

.captcha-status.error {
    color: #ef4444;
}

.captcha-status.success {
    color: #10b981;
    font-weight: 500;
}

.captcha-refresh {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    z-index: 20;
}

.captcha-refresh:hover {
    background: #fff;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.captcha-refresh-spinning {
    animation: captchaSpin 0.6s linear;
}

@keyframes captchaSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes captchaShake {
    0%, 100% { transform: translate(-50%, -50%); }
    20% { transform: translate(calc(-50% - 6px), -50%); }
    40% { transform: translate(calc(-50% + 6px), -50%); }
    60% { transform: translate(calc(-50% - 4px), -50%); }
    80% { transform: translate(calc(-50% + 4px), -50%); }
}

@media (max-width: 480px) {
    .captcha-wrapper {
        max-width: 100%;
        display: flex;
        justify-content: center;
    }
    
    .captcha-box {
        width: 250px;
        height: 160px;
    }
    
    .captcha-bg {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}