/* IconCaptcha — капча «нажмите иконки в указанном порядке» (js/icon-captcha.js) */

.icon-captcha {
    width: 100%;
    max-width: 320px;
    -webkit-user-select: none;
    user-select: none;
}

.icon-captcha .ic-stage {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #eef1f5;
    touch-action: manipulation;
    /* держит высоту до загрузки картинки (320x200) */
    aspect-ratio: 320 / 200;
}

.icon-captcha .ic-img {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
    -webkit-user-drag: none;
}

.icon-captcha .ic-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.icon-captcha .ic-mark {
    position: absolute;
    width: 26px;
    height: 26px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #fff;
    border: 2px solid #4b6fe8;
    color: #4b6fe8;
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    animation: icMarkPop 0.16s ease;
}

@keyframes icMarkPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.icon-captcha .ic-refresh {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #3c4654;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.icon-captcha .ic-refresh:hover {
    background: #fff;
}

.icon-captcha .ic-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    text-align: center;
    background: rgba(248, 250, 252, 0.88);
    color: #33404f;
    font-size: 14px;
    font-weight: 600;
}

.icon-captcha[data-state="loading"] .ic-overlay,
.icon-captcha[data-state="verifying"] .ic-overlay,
.icon-captcha[data-state="success"] .ic-overlay,
.icon-captcha[data-state="fail"] .ic-overlay,
.icon-captcha[data-state="error"] .ic-overlay {
    display: flex;
}

.icon-captcha[data-state="error"] .ic-overlay {
    cursor: pointer;
}

.icon-captcha .ic-spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid rgba(75, 111, 232, 0.25);
    border-top-color: #4b6fe8;
    animation: icSpin 0.8s linear infinite;
}

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

.icon-captcha .ic-result {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    line-height: 34px;
    color: #fff;
}

.icon-captcha .ic-result--ok {
    background: #16a34a;
}

.icon-captcha .ic-result--bad {
    background: #ef4444;
}

.icon-captcha[data-state="success"] .ic-stage {
    outline: 2px solid rgba(22, 163, 74, 0.55);
    outline-offset: -2px;
}

.icon-captcha .ic-task {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 32px;
}

.icon-captcha .ic-task-label {
    font-size: 13px;
    color: #55606e;
}

.icon-captcha .ic-task-img {
    height: 30px;
    width: auto;
}

.icon-captcha .ic-undo {
    margin-left: auto;
    padding: 2px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #4b6fe8;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
