/**
 * Cat-Captcha 组件样式（v1.0.0 美化版）
 * 设计规范：大圆角、柔和层级阴影、品牌渐变、细腻动效
 */
.lwcap-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(16, 18, 27, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: lwcap-fade .18s ease-out;
}

.lwcap-panel {
    width: 356px;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid rgba(20, 24, 33, 0.06);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 17, 22, 0.28), 0 4px 14px rgba(15, 17, 22, 0.1);
    overflow: hidden;
    animation: lwcap-pop .24s cubic-bezier(.18, .89, .32, 1.08);
}

.lwcap-shake { animation: lwcap-shake .35s ease; }

.lwcap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: linear-gradient(180deg, #fbfcff 0%, #f4f6fb 100%);
    border-bottom: 1px solid rgba(20, 24, 33, 0.06);
}

.lwcap-title { font: 600 14px/20px -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2430; }

.lwcap-tools { display: flex; gap: 2px; }

.lwcap-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #5a6272;
    cursor: pointer;
    transition: background .14s, color .14s, transform .14s;
}
.lwcap-btn-icon:hover { background: rgba(71, 83, 255, 0.1); color: #4753ff; }
.lwcap-btn-icon:active { transform: scale(.92); }

.lwcap-body { padding: 14px; min-height: 214px; }

/* 加载态 */
.lwcap-loading {
    min-height: 214px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #5a6272;
    font: 400 13px/18px -apple-system, "PingFang SC", sans-serif;
}
.lwcap-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(71, 83, 255, 0.14);
    border-top-color: #4753ff;
    border-right-color: rgba(71, 83, 255, 0.6);
    border-radius: 50%;
    animation: lwcap-spin .7s linear infinite;
}

/* 滑块 */
.lwcap-slider .lwcap-img-wrap,
.lwcap-click .lwcap-img-wrap {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: inset 0 0 0 1px rgba(20, 24, 33, 0.05);
}
.lwcap-img-wrap .lwcap-bg { display: block; width: 100%; -webkit-user-drag: none; -webkit-touch-callout: none; }
.lwcap-piece { position: absolute; left: 0; filter: drop-shadow(1px 3px 4px rgba(0, 0, 0, 0.35)); pointer-events: none; }

/* D-4（v1.0.16 盲对准）：精段方向反馈——服务端不再下发目标坐标，
   只回方向 + 冷暖，前端以气泡提示 + 接近发光（warmer）呈现 */
.lwcap-fine-hint {
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    max-width: calc(100% - 16px);
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(18, 22, 32, 0.78);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    z-index: 6;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: opacity 0.18s ease;
}
.lwcap-fine-hint-warm { background: rgba(24, 106, 58, 0.88); }
.lwcap-piece-warm { filter: drop-shadow(0 0 6px rgba(110, 231, 183, 0.85)) drop-shadow(1px 3px 4px rgba(0, 0, 0, 0.35)); }

/* D-3.2 item3（v2.5 旋转对准）：旋转手柄——拖拽/滚轮旋转拼图块使其与缺口对齐 */
.lwcap-rot-knob {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(18, 22, 32, 0.78);
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    cursor: grab;
    z-index: 4;
    touch-action: none;
    /* v1.2.1：呼吸光圈引导首次注意，交互后停止（.used） */
    animation: lwcap-rot-pulse 1.8s ease-in-out infinite;
}
.lwcap-rot-knob:hover { background: rgba(18, 22, 32, 0.92); border-color: #fff; }
.lwcap-rot-knob:active { cursor: grabbing; }
.lwcap-rot-knob.used { animation: none; }
@keyframes lwcap-rot-pulse {
    0%, 100% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(255, 255, 255, 0.5); }
    50% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 7px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .lwcap-rot-knob { animation: none; }
}
/* 居中旋转符号（固定不随角度转，表达控件功能） */
.lwcap-rot-knob-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    pointer-events: none;
}
/* 角度指示点（随角度转，提供旋转反馈） */
.lwcap-rot-knob-needle {
    position: absolute;
    left: 50%;
    top: 3px;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    transform-origin: 50% 15px;
}

.lwcap-track {
    position: relative;
    height: 40px;
    margin-top: 12px;
    background: linear-gradient(180deg, #f2f4f9 0%, #e9ecf3 100%);
    border: 1px solid rgba(20, 24, 33, 0.08);
    border-radius: 10px;
    overflow: hidden;
}
.lwcap-track-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, rgba(71, 83, 255, 0.1), rgba(71, 83, 255, 0.26));
    border-radius: 10px 0 0 10px;
    transition: width .05s linear;
}
.lwcap-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 44px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #eef1f8 100%);
    border: 1px solid rgba(20, 24, 33, 0.12);
    border-radius: 9px;
    color: #4753ff;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 2px 6px rgba(15, 17, 22, 0.16);
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.lwcap-thumb:hover { border-color: #4753ff; box-shadow: 0 3px 10px rgba(71, 83, 255, 0.28); }
.lwcap-thumb:active { cursor: grabbing; border-color: #4753ff; transform: scale(1.03); }

/* 点选 */
.lwcap-prompt {
    margin: 0 0 10px;
    padding: 6px 10px;
    font: 500 13px/18px -apple-system, "PingFang SC", sans-serif;
    color: #3a4253;
    background: #f4f6fb;
    border-radius: 8px;
    letter-spacing: .3px;
}
.lwcap-click-wrap { cursor: crosshair; }
.lwcap-mark {
    position: absolute;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4753ff;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font: 700 12px/1 -apple-system, "PingFang SC", sans-serif;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(71, 83, 255, 0.5);
    animation: lwcap-pop .18s ease-out;
}
.lwcap-mark::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px solid rgba(71, 83, 255, 0.45);
    border-radius: 50%;
    animation: lwcap-pulse 1s ease-out infinite;
}
.lwcap-click-ops { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.lwcap-mini {
    padding: 4px 12px;
    background: #fff;
    border: 1px solid rgba(20, 24, 33, 0.12);
    border-radius: 8px;
    color: #5a6272;
    font: 400 12px/18px -apple-system, "PingFang SC", sans-serif;
    cursor: pointer;
    transition: border-color .14s, color .14s, background .14s;
}
.lwcap-mini:hover { border-color: #4753ff; color: #4753ff; background: rgba(71, 83, 255, 0.04); }
.lwcap-click-count { font: 400 12px/18px -apple-system, "PingFang SC", sans-serif; color: #8b93a3; }

/* v1.0.24（D-15）：点选盲确认按钮——不显示计数器，用户点齐目标后手动提交 */
.lwcap-click-confirm {
    padding: 4px 18px;
    background: #4753ff;
    border: 1px solid #4753ff;
    border-radius: 8px;
    color: #fff;
    font: 500 12px/18px -apple-system, "PingFang SC", sans-serif;
    cursor: pointer;
    transition: background .14s, transform .14s, opacity .14s;
}
.lwcap-click-confirm:hover { background: #3a45e8; }
.lwcap-click-confirm:active { transform: scale(.97); }
.lwcap-click-confirm:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* 触发框（极验风格智能验证按钮） */
.lwcap-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid rgba(20, 24, 33, .14);
    border-radius: 10px;
    color: #5a6272;
    font: 500 14px/20px -apple-system, "PingFang SC", sans-serif;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.lwcap-trigger:hover { border-color: rgba(71, 83, 255, .5); box-shadow: 0 2px 8px rgba(71, 83, 255, .12); color: #4753ff; }
.lwcap-trigger:active { transform: scale(.99); }
.lwcap-trigger-ic { display: inline-flex; align-items: center; justify-content: center; }
.lwcap-trigger-ic .ic-check { display: none; }
.lwcap-trigger-verified {
    border-color: rgba(14, 168, 109, .5);
    background: rgba(14, 168, 109, .05);
    color: #0ea86d;
}
.lwcap-trigger-verified:hover { color: #0b8a59; border-color: rgba(14, 168, 109, .6); }
.lwcap-trigger-verified .ic-shield { display: none; }
.lwcap-trigger-verified .ic-check { display: block; }
.lwcap-trigger-loading { pointer-events: none; opacity: .75; }
.lwcap-trigger-loading .ic-shield { animation: lwcap-spin 1s linear infinite; }

/* 结果态 */
.lwcap-result {
    min-height: 214px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font: 500 15px/22px -apple-system, "PingFang SC", sans-serif;
}
.lwcap-ok { color: #0ea86d; }
.lwcap-ok .ok-ring { stroke-dasharray: 101; stroke-dashoffset: 101; animation: lwcap-draw .45s .1s ease-out forwards; }
.lwcap-ok .ok-check { stroke-dasharray: 22; stroke-dashoffset: 22; animation: lwcap-draw .3s .5s ease-out forwards; }
.lwcap-err { color: #d2483d; cursor: pointer; }

/* 底栏 */
.lwcap-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fafbfe;
    border-top: 1px solid rgba(20, 24, 33, 0.05);
}
.lwcap-brand {
    font: 700 11px/14px -apple-system, sans-serif;
    color: #b6bcc8;
    letter-spacing: .6px;
    background: linear-gradient(90deg, #4753ff, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .15s;
}
.lwcap-brand:hover { opacity: .75; }
.lwcap-tip { font: 400 11px/14px -apple-system, "PingFang SC", sans-serif; color: #8b93a3; }
.lwcap-tip-err { color: #d2483d; }

/* 动画 */
@keyframes lwcap-fade { from { opacity: 0; } }
@keyframes lwcap-pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }
@keyframes lwcap-spin { to { transform: rotate(360deg); } }
@keyframes lwcap-draw { to { stroke-dashoffset: 0; } }
@keyframes lwcap-pulse { from { opacity: .9; transform: scale(.8); } to { opacity: 0; transform: scale(1.5); } }
@keyframes lwcap-shake {
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* 小屏适配 */
@media (max-width: 400px) {
    .lwcap-panel { max-width: 100%; }
    .lwcap-body { padding: 12px; }
}

/* v1.0.20：减弱动态效果偏好（前庭障碍/晕动症用户）——关闭装饰性动画与过渡，
   保留 spinner（进行中状态仍需可见，仅降为静态图标） */
@media (prefers-reduced-motion: reduce) {
    .lwcap-overlay,
    .lwcap-panel,
    .lwcap-mark,
    .lwcap-piece,
    .lwcap-btn,
    .lwcap-slider-btn { animation: none !important; transition: none !important; }
    .lwcap-ok .ok-ring,
    .lwcap-ok .ok-check { animation: none !important; stroke-dashoffset: 0 !important; }
    .lwcap-shake { animation: none !important; }
}
/* ============ v1.1.0 前端体验优化 ============ */

/* 轨道提示文字（拖动后淡出，复位重现） */
.lwcap-track-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 400 12px/18px -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #9aa3b5;
    letter-spacing: .5px;
    pointer-events: none;
    transition: opacity .2s ease;
}

/* 可撤销的最新点选标记（其余标记保持穿透） */
.lwcap-mark-last {
    pointer-events: auto;
    cursor: pointer;
    transform: scale(1.12);
}
.lwcap-mark-last:hover {
    background: #d2483d;
    box-shadow: 0 2px 8px rgba(210, 72, 61, .5);
}

/* 刷新按钮点击旋转反馈 */
.lwcap-spin-once { animation: lwcap-spin .55s ease; }

/* 无障碍：键盘聚焦可见 */
.lwcap-thumb:focus-visible,
.lwcap-close:focus-visible,
.lwcap-refresh:focus-visible,
.lwcap-mini:focus-visible,
.lwcap-click-confirm:focus-visible,
.lwcap-trigger:focus-visible {
    outline: 2px solid #4753ff;
    outline-offset: 2px;
}

/* ---------- 深色模式（跟随系统） ---------- */
@media (prefers-color-scheme: dark) {
    .lwcap-overlay { background: rgba(0, 0, 0, 0.62); }
    .lwcap-panel {
        background: #1b1f2a;
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.35);
    }
    .lwcap-head {
        background: linear-gradient(180deg, #232838 0%, #1d2230 100%);
        border-bottom-color: rgba(255, 255, 255, 0.07);
    }
    .lwcap-title { color: #e8ebf4; }
    .lwcap-btn-icon { color: #9aa3b5; }
    .lwcap-btn-icon:hover { background: rgba(122, 131, 255, 0.18); color: #8b95ff; }
    .lwcap-loading { color: #9aa3b5; }
    .lwcap-spinner { border-color: rgba(139, 149, 255, 0.18); border-top-color: #8b95ff; border-right-color: rgba(139, 149, 255, 0.55); }
    .lwcap-track { background: linear-gradient(180deg, #242a38 0%, #1f2431 100%); border-color: rgba(255, 255, 255, 0.09); }
    .lwcap-track-fill { background: linear-gradient(90deg, rgba(122, 131, 255, 0.14), rgba(122, 131, 255, 0.3)); }
    .lwcap-track-hint { color: #6d7689; }
    .lwcap-thumb {
        background: linear-gradient(180deg, #2b3140 0%, #242a38 100%);
        border-color: rgba(255, 255, 255, 0.14);
        color: #8b95ff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    }
    .lwcap-thumb:hover { border-color: #8b95ff; box-shadow: 0 3px 10px rgba(139, 149, 255, 0.3); }
    .lwcap-prompt { color: #cdd3e0; background: #232838; }
    .lwcap-mini { background: #232838; border-color: rgba(255, 255, 255, 0.12); color: #9aa3b5; }
    .lwcap-mini:hover { border-color: #8b95ff; color: #8b95ff; background: rgba(122, 131, 255, 0.08); }
    .lwcap-click-confirm { background: #5a63ff; border-color: #5a63ff; }
    .lwcap-click-confirm:hover { background: #4a53f5; }
    .lwcap-click-count { color: #7d8598; }
    .lwcap-trigger {
        background: #1b1f2a;
        border-color: rgba(255, 255, 255, 0.14);
        color: #9aa3b5;
    }
    .lwcap-trigger:hover { border-color: rgba(139, 149, 255, 0.5); color: #8b95ff; box-shadow: 0 2px 8px rgba(139, 149, 255, 0.14); }
    .lwcap-trigger-verified { background: rgba(16, 185, 129, 0.08); border-color: rgba(52, 211, 153, 0.5); color: #34d399; }
    .lwcap-trigger-verified:hover { color: #34d399; border-color: rgba(52, 211, 153, 0.6); }
    .lwcap-result { color: #e8ebf4; }
    .lwcap-ok { color: #34d399; }
    .lwcap-err { color: #f87171; }
    .lwcap-foot { background: #181c26; border-top-color: rgba(255, 255, 255, 0.05); }
    .lwcap-tip { color: #7d8598; }
    .lwcap-tip-err { color: #f87171; }
    .lwcap-brand {
        background: linear-gradient(90deg, #7a83ff, #a78bfa);
        -webkit-background-clip: text;
        background-clip: text;
    }
    .lwcap-fine-hint { background: rgba(10, 12, 18, 0.85); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
}
