/* Compact image-captcha dialog — frosted glass, denser layout. */
.xboard-core-dialog,
.xboard-core-dialog--captcha {
    box-sizing: border-box;
    width: fit-content;
    max-width: min(280px, calc(100vw - 24px));
    min-width: 0;
    height: fit-content;
    max-height: min(90vh, 360px);
    margin: auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(22px) saturate(1.15);
    -webkit-backdrop-filter: blur(22px) saturate(1.15);
    color: #1f2937;
    box-shadow:
        0 12px 40px rgba(15, 23, 42, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.55) inset;
    color-scheme: light;
}

.xboard-core-dialog::backdrop {
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.xboard-core-captcha-form {
    display: grid;
    gap: 10px;
    width: 248px;
    max-width: 100%;
    padding: 14px;
}

.xboard-core-captcha-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 20px;
}

.xboard-core-dialog h2,
.xboard-core-captcha-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: #344054;
}

.xboard-core-captcha-close {
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    min-height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #98a2b3;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.xboard-core-captcha-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #475467;
}

.xboard-core-captcha {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.xboard-core-captcha-pic {
    box-sizing: border-box;
    display: block;
    flex: none;
    position: relative;
    width: 132px;
    height: 42px;
    min-width: 132px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    background: rgba(242, 244, 247, 0.72);
    cursor: pointer;
}

.xboard-core-captcha-pic:disabled {
    cursor: default;
}

.xboard-core-captcha-pic.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: xboard-core-captcha-shimmer 1.2s ease-in-out infinite;
    pointer-events: none;
}

.xboard-core-captcha-pic img {
    display: block;
    width: 132px;
    height: 42px;
    object-fit: contain;
    transition: opacity 0.15s ease;
}

.xboard-core-captcha-pic img.is-hidden {
    opacity: 0;
    visibility: hidden;
}

@keyframes xboard-core-captcha-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.xboard-core-captcha-input {
    box-sizing: border-box;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #1f2937;
    font: inherit;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-align: center;
}

.xboard-core-captcha-input:focus {
    outline: none;
    border-color: #1f6f78;
    box-shadow: 0 0 0 3px rgba(31, 111, 120, 0.15);
}

.xboard-core-captcha-input::placeholder {
    letter-spacing: 0;
    color: #98a2b3;
    font-size: 12px;
}

.xboard-core-captcha-status {
    margin: 0;
    color: #d92d20;
    font-size: 12px;
    line-height: 1.3;
}

.xboard-core-captcha-status[hidden] {
    display: none;
}

.xboard-core-captcha-submit {
    box-sizing: border-box;
    width: 100%;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: #1f6f78;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.xboard-core-captcha-submit:hover:not(:disabled) {
    background: #185a61;
}

.xboard-core-captcha-submit:disabled {
    opacity: 0.55;
    cursor: default;
}

@media (prefers-color-scheme: dark) {
    .xboard-core-dialog,
    .xboard-core-dialog--captcha {
        border-color: rgba(255, 255, 255, 0.1);
        background: rgba(26, 34, 48, 0.72);
        color: #f2f4f7;
        color-scheme: dark;
        box-shadow:
            0 16px 48px rgba(0, 0, 0, 0.45),
            0 1px 0 rgba(255, 255, 255, 0.06) inset;
    }

    .xboard-core-dialog::backdrop {
        background: rgba(2, 6, 23, 0.55);
    }

    .xboard-core-dialog h2,
    .xboard-core-captcha-head h2 {
        color: #e4e7ec;
    }

    .xboard-core-captcha-close {
        color: #98a2b3;
    }

    .xboard-core-captcha-close:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #e4e7ec;
    }

    .xboard-core-captcha-pic {
        border-color: rgba(255, 255, 255, 0.1);
        background: rgba(15, 20, 28, 0.65);
    }

    .xboard-core-captcha-pic.is-loading::after {
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.12) 50%,
            transparent 100%
        );
        background-size: 200% 100%;
    }

    .xboard-core-captcha-input {
        border-color: rgba(255, 255, 255, 0.14);
        background: rgba(18, 24, 38, 0.55);
        color: #f2f4f7;
    }

    .xboard-core-captcha-input:focus {
        border-color: #2f8f98;
        box-shadow: 0 0 0 3px rgba(47, 143, 152, 0.22);
    }

    .xboard-core-captcha-submit {
        background: #2f8f98;
        color: #041316;
    }

    .xboard-core-captcha-submit:hover:not(:disabled) {
        background: #3aa3ad;
    }
}

html.dark .xboard-core-dialog,
html.dark .xboard-core-dialog--captcha {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(26, 34, 48, 0.72);
    color: #f2f4f7;
    color-scheme: dark;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

html.dark .xboard-core-dialog::backdrop {
    background: rgba(2, 6, 23, 0.55);
}

html.dark .xboard-core-dialog h2,
html.dark .xboard-core-captcha-head h2 {
    color: #e4e7ec;
}

html.dark .xboard-core-captcha-close {
    color: #98a2b3;
}

html.dark .xboard-core-captcha-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e4e7ec;
}

html.dark .xboard-core-captcha-pic {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(15, 20, 28, 0.65);
}

html.dark .xboard-core-captcha-pic.is-loading::after {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
}

html.dark .xboard-core-captcha-input {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(18, 24, 38, 0.55);
    color: #f2f4f7;
}

html.dark .xboard-core-captcha-input:focus {
    border-color: #2f8f98;
    box-shadow: 0 0 0 3px rgba(47, 143, 152, 0.22);
}

html.dark .xboard-core-captcha-submit {
    background: #2f8f98;
    color: #041316;
}

html.dark .xboard-core-captcha-submit:hover:not(:disabled) {
    background: #3aa3ad;
}

@media (max-width: 700px) {
    .xboard-core-dialog,
    .xboard-core-dialog--captcha {
        width: min(320px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        min-width: 0;
    }

    .xboard-core-captcha-form {
        width: 100%;
        max-width: 100%;
        padding: 14px;
        gap: 12px;
    }

    .xboard-core-captcha {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .xboard-core-captcha-pic,
    .xboard-core-captcha-pic img {
        width: 100%;
        min-width: 0;
        height: 48px;
    }

    .xboard-core-captcha-input {
        flex: none;
        width: 100%;
        min-width: 0;
        height: 44px;
        min-height: 44px;
        font-size: 16px;
        letter-spacing: 0.16em;
    }
}
