/* KanColleAuto 全站自定义样式（Tailwind 之上的补充） */

body {
    font-family: "Microsoft Yahei", "微软雅黑", "Helvetica Neue", Arial, sans-serif;
    /* 避免出现/消失滚动条导致的横向跳动 */
    scrollbar-gutter: stable;
}

/* Valine 评论区与上方内容留出间距 */
#vcomments {
    margin-top: 1.5rem;
}

/* ---- 浮动提示（登录等页面 AJAX 反馈） ---- */
.alert-float {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 500px;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
.alert-float.slide-out {
    animation: slideOut 0.3s ease-in;
}
@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to   { transform: translateX(0);      opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0);      opacity: 1; }
    to   { transform: translateX(400px); opacity: 0; }
}

/* ---- 按钮加载态 ---- */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}
.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- 自建图片验证码 ---- */
.captcha-widget {
    width: 100%;
}

.captcha-label {
    display: block;
    margin-bottom: 0.25rem;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
}

.captcha-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px 42px;
    gap: 0.5rem;
    align-items: center;
}

.captcha-input {
    width: 100%;
    height: 42px;
    min-width: 0;
    padding: 0 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #fff;
    color: #111827;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.captcha-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: normal;
}

.captcha-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.captcha-image-button,
.captcha-refresh-button {
    height: 42px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f8fafc;
    color: #4b5563;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.captcha-image-button {
    width: 112px;
    padding: 0;
    overflow: hidden;
}

.captcha-image {
    display: block;
    width: 112px;
    height: 42px;
    object-fit: cover;
}

.captcha-refresh-button {
    display: inline-flex;
    width: 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.captcha-refresh-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.captcha-image-button:hover,
.captcha-refresh-button:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
}

.captcha-image-button:focus-visible,
.captcha-refresh-button:focus-visible {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.captcha-hint {
    margin: 0.35rem 0 0;
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1.25rem;
}

@media (max-width: 380px) {
    .captcha-controls {
        grid-template-columns: minmax(0, 1fr) 104px 40px;
        gap: 0.375rem;
    }

    .captcha-image-button,
    .captcha-image {
        width: 104px;
    }

    .captcha-refresh-button {
        width: 40px;
    }
}
