
:root {
    --captcha-bg: #2d2d2d;
    --captcha-border: #444;
    --icon-color: #ccc;
    --icon-hover-bg: #3a3a3a;
    --glow-success-color: rgba(46, 204, 113, 0.9);
    --glow-fail-color: rgba(231, 76, 60, 0.9);
}

@keyframes rainbow-glow {
    20% { filter: drop-shadow(0 0 1px #ff0000) drop-shadow(0 0 1px #ff0000) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    23% { filter: drop-shadow(0 0 1px #ff7f00) drop-shadow(0 0 1px #ff7f00) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    26% { filter: drop-shadow(0 0 1px #ffff00) drop-shadow(0 0 1px #ffff00) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    29% { filter: drop-shadow(0 0 1px #00ff00) drop-shadow(0 0 1px #00ff00) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    31% { filter: drop-shadow(0 0 1px #0000ff) drop-shadow(0 0 1px #0000ff) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    33% { filter: drop-shadow(0 0 1px #4b0082) drop-shadow(0 0 1px #4b0082) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    35% { filter: drop-shadow(0 0 1px #9400d3) drop-shadow(0 0 1px #9400d3) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    37% { filter: drop-shadow(0 0 1px #ff0000) drop-shadow(0 0 1px #ff0000) drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
    39% { filter: drop-shadow(0px 2px 3px rgba(0,0,0,0.4)); }
}

@keyframes glow-success-animation {
    0%, 100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 0px var(--glow-success-color); }
    50% { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 15px var(--glow-success-color); }
}

@keyframes glow-fail-animation {
    0%, 100% { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 0px var(--glow-fail-color); }
    10%, 30%, 50%, 70%, 90% { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 15px var(--glow-fail-color); }
    20%, 40%, 60%, 80% { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 0px var(--glow-fail-color); }
}

.captcha-container {
    position: relative;
    background-color: var(--captcha-bg);
    border: 1px solid var(--captcha-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 8px 12px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 19px;
    max-width: 95%;
    margin: 20px auto;
    transition: opacity 1.8s ease-in-out; 
}

.captcha-container.is-hiding {
    opacity: 0;
}


.captcha-main-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.captcha-image-container {
    position: relative;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.7);
    border: 1px solid #111;
    transition: box-shadow 0.3s ease;
}

.captcha-image-container.glow-success {
    animation: glow-success-animation 1s ease-out;
}

.captcha-image-container.glow-fail {
    animation: glow-fail-animation 2.5s ease-out;
}

.captcha-image-container .captcha-bg-image {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 0.5s ease-in-out;
}

.captcha-placeholder {
    position: absolute;
    background-color: transparent;
    -webkit-mask-image: var(--mask-url);
    mask-image: var(--mask-url);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

.captcha-image-container .captcha-puzzle-piece {
    position: absolute;
    cursor: grab;
    transition: transform 0.2s ease-out, filter 0.2s ease-out, top 0.3s ease-out, left 0.3s ease-out, opacity 0.5s ease-in-out;
    touch-action: none;
    filter: drop-shadow(0px 2px 3px rgba(0,0,0,0.4));
    animation: rainbow-glow 3s linear infinite;
}

.captcha-image-container .captcha-puzzle-piece:active {
    cursor: grabbing;
    transform: scale(1.1);
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.6));
    animation: none;
    z-index: 10;
}

.captcha-image-container .captcha-puzzle-piece.is-dragging {
    cursor: grabbing;
    transition: none !important;
    transform: none !important;
    animation: none !important;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) !important;
    z-index: 10;
}


.captcha-puzzle-piece.is-solved {
    opacity: 0;
    pointer-events: none;
    animation: none;
    transition-delay: 0.5s; 
}


.captcha-instruction {
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 10px;
}

.captcha-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--captcha-border);
}

.captcha-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.captcha-button:hover {
    background-color: var(--icon-hover-bg);
}
.captcha-button svg {
    width: 24px;
    height: 24px;
    fill: var(--icon-color);
}

#captchaMessage {
    width: 100%;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}
