@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

.captcha-container {
    position: relative;
    width: 200px;
    height: 50px;
    background-color: #f3f3f3;
    border: 1px solid #ccc;
    overflow: hidden;
    border-radius: 8px;
}

/* Background dots and texture */
.captcha-container::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background-image: 
        radial-gradient(circle, rgba(0, 0, 0, 0.12) 1px, transparent 1px),
        radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
        radial-gradient(circle, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
    background-size: 8px 8px, 12px 12px, 20px 20px;
    background-position: 0 0, 5px 5px, 2px 8px;
}

/* Background lines + visual noise */
.captcha-container::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0px, transparent 2px, transparent 10px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 0px, transparent 3px, transparent 10px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0px, transparent 2px, transparent 10px),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.02) 0px, transparent 3px, transparent 10px);
}

/* Horizontal middle line */
.middle-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(-2deg); /* slightly distorted */
    z-index: 3;
    pointer-events: none;
}

/* Main CAPTCHA area */
.captcha {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 4;
    font-family: 'VT323', monospace;
    font-weight: bold;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 8px;
}

/* Positioning each character with some distortion */
.captcha-char {
    position: absolute;
    left: calc(var(--i) * 20%);
    top: calc(10% + var(--rand) * 2%);
    color: #222;
    text-shadow: 3px 2px 0 #cdcdcd;
}
/* Refresh button styling */
#refresh-captcha {
    padding: 10px 16px;
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    background-color:gainsboro;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Hover and focus effects */
#refresh-captcha:hover,
#refresh-captcha:focus {
    color: #ffffff;
    background-color: #000000; /* Darker blue */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    outline: none;
}
