/* === Captcha Slider - 高级极简商业级滑块拼图 === */

.captcha-slider-wrap {
    width: 320px;
    margin: 0 auto 20px;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 图片区域 ── */
.captcha-image-area {
    width: 320px;
    height: 160px;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.captcha-slider-wrap.fail {
    animation: captchaShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes captchaShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

/* ── 缺口 SVG 遮罩 ── */
.captcha-hole-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ── 底部工具栏 ── */
.captcha-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    z-index: 3;
}

.captcha-refresh {
    width: 24px;
    height: 24px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.captcha-refresh:hover {
    color: #ffffff;
    transform: rotate(90deg);
}

/* ── 拼图块 ── */
.captcha-piece {
    position: absolute;
    z-index: 4;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)) drop-shadow(0 0 1px rgba(255,255,255,0.5));
    transition: left 0s;
}

.captcha-slider-wrap.success .captcha-piece {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ── 滑块轨道 ── */
.captcha-track {
    width: 320px;
    height: 44px;
    background: #f7f9fa;
    position: relative;
    overflow: hidden;
    border-top: 1px solid rgba(0,0,0,0.03);
}

/* 进度填充条 */
.captcha-track-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: rgba(0, 0, 0, 0.03);
    transition: none;
    pointer-events: none;
}

.captcha-slider-wrap.success .captcha-track-fill {
    background: rgba(16, 185, 129, 0.1);
    transition: background 0.3s ease;
}

.captcha-slider-wrap.fail .captcha-track-fill {
    background: rgba(239, 68, 68, 0.1);
    transition: background 0.3s ease;
}

/* 提示文字 */
.captcha-track-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8c92a4;
    font-size: 13px;
    font-weight: 400;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s;
    letter-spacing: 0.5px;
}

/* 滑块手柄外层 */
.captcha-handle {
    width: 52px;
    height: 44px;
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 3;
}

.captcha-handle:active {
    cursor: grabbing;
}

/* 滑块手柄内层（真正的视觉按钮） */
.captcha-handle-inner {
    width: 42px;
    height: 34px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.02);
}

.captcha-handle:hover .captcha-handle-inner {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #111827;
}

.captcha-handle:active .captcha-handle-inner {
    transform: scale(0.96);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.captcha-slider-wrap.success .captcha-handle-inner {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    border-color: transparent;
}

.captcha-slider-wrap.fail .captcha-handle-inner {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    border-color: transparent;
}

/* ── 暗色主题覆盖（login.html） ── */
body.moonshot-login .captcha-slider-wrap {
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body.moonshot-login .captcha-track {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.moonshot-login .captcha-track-fill {
    background: rgba(255, 255, 255, 0.05);
}

body.moonshot-login .captcha-slider-wrap.success .captcha-track-fill {
    background: rgba(16, 185, 129, 0.15);
}

body.moonshot-login .captcha-slider-wrap.fail .captcha-track-fill {
    background: rgba(239, 68, 68, 0.15);
}

body.moonshot-login .captcha-track-hint {
    color: rgba(255, 255, 255, 0.4);
}

body.moonshot-login .captcha-handle-inner {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.moonshot-login .captcha-handle:hover .captcha-handle-inner {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body.moonshot-login .captcha-slider-wrap.success .captcha-handle-inner {
    background: #10b981;
    border-color: rgba(16, 185, 129, 0.5);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

body.moonshot-login .captcha-slider-wrap.fail .captcha-handle-inner {
    background: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

/* ── 响应式 ── */
@media (max-width: 360px) {
    .captcha-slider-wrap,
    .captcha-image-area,
    .captcha-track {
        width: 280px;
    }
    .captcha-image-area {
        height: 140px;
    }
}
