/* 诊断面板样式 */
.diagnostic-panel {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: #fff1f0;
    border: 2px solid #ff4d4f;
    border-radius: 8px;
    padding: 16px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-family: monospace;
}
.diagnostic-panel.show { display: block; }
.diag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #ffa39e;
    padding-bottom: 8px;
    color: #cf1322;
    font-weight: bold;
}
.diag-content {
    font-size: 12px;
    color: #434343;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255,255,255,0.5);
    padding: 8px;
    border-radius: 4px;
}
.diag-close {
    cursor: pointer;
    padding: 2px 8px;
    background: #ff4d4f;
    color: white;
    border-radius: 4px;
    border: none;
}

.login-error {
    display: none;
    margin-bottom: 0;
    padding: 0;
    background: #fff1f0;
    border: 1px solid #ffa39e;
    border-radius: 4px;
    color: #cf1322;
    font-size: 14px;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease, margin-bottom 0.25s ease, padding 0.25s ease, border-width 0.25s ease;
}

.login-error.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 15px;
    padding: 10px;
    max-height: 100px;
    border-width: 1px;
}

.login-error.hide {
    display: flex;
    opacity: 0;
    transform: translateY(-6px);
    margin-bottom: 0;
    padding: 0;
    max-height: 0;
    border-width: 0;
}

.login-error:not(.show):not(.hide) {
    display: none;
    margin-bottom: 0;
    padding: 0;
    max-height: 0;
}
.form-field {
    position: relative;
}

.form-field.field-attention .input-wrap {
    border-color: rgba(84, 184, 255, 0.7);
    box-shadow: 0 0 8px rgba(84, 184, 255, 0.25), 0 0 0 1px rgba(84, 184, 255, 0.15);
    animation: fieldPulseGlow 2s ease-in-out infinite;
}

@keyframes fieldPulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(84, 184, 255, 0.15), 0 0 0 1px rgba(84, 184, 255, 0.08); }
    50% { box-shadow: 0 0 12px rgba(84, 184, 255, 0.35), 0 0 0 1px rgba(84, 184, 255, 0.25); }
}

/* 悬浮提示 */
.field-tooltip {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 10;
}

.field-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.82);
}

.form-field.field-attention .field-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Password Toggle Override for Login Page */
.input-wrap .toggle-password {
    position: static;
    margin-left: 4px;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.input-wrap .toggle-password:hover {
    color: var(--text);
}
.input-wrap .toggle-password svg {
    width: 18px;
    height: 18px;
}

.login-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.login-actions .login-btn {
    flex: 1;
}

.login-btn .login-spinner {
    display: none;
    width: 22px;
    height: 22px;
    animation: loginBtnSpin 0.7s linear infinite;
}

.login-btn.is-loading .login-spinner {
    display: block;
}

.login-btn .login-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.85;
}

.login-btn.is-loading .login-icon {
    display: none;
}

.login-btn.is-loading span {
    display: none;
}

.login-btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
    justify-content: center;
}

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

.login-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.86);
}

.login-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ===== 密码错误反馈（D 方案） ===== */

/* Shake 抖动 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.shake {
    animation: shake 0.35s ease-in-out;
}

/* 密码错误时的红边框闪烁 */
.input-wrap.is-error {
    border-color: rgba(255, 80, 80, 0.85) !important;
    box-shadow: 0 0 0 1px rgba(255, 80, 80, 0.45), 0 0 16px rgba(255, 80, 80, 0.28) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 按钮错误态：短暂禁用 */
.login-btn.is-error {
    pointer-events: none;
    cursor: not-allowed;
}

/* ========== 登录页透明背景头像模式（无背景PNG头像） ========== */
/* `.is-transparent` 由 JS 检测后添加；`html.admin-login-avatar-transparent` 用于下次刷新时首帧提前应用 */
.login-avatar.is-transparent,
html.admin-login-avatar-transparent .login-avatar {
    position: relative;
    border-radius: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
}

.login-avatar.is-transparent #loginAvatarImg,
html.admin-login-avatar-transparent .login-avatar #loginAvatarImg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain !important;
    border-radius: 0 !important;
    min-width: 108% !important;
    min-height: 108% !important;
    width: 108% !important;
    height: 108% !important;
    flex: 0 0 auto !important;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

/* 首次访问尚未识别前，先隐藏头像容器，避免闪现错误样式 */
html.admin-login-avatar-pending .login-avatar {
    visibility: hidden;
}

/* Grok 角色主动画（替换原头像 + 小蓝/小黄） */
.grok-login-stage {
    width: 148px;
    height: 148px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.grok-login-stage svg {
    position: relative;
    width: 132px;
    height: 132px;
    color-scheme: dark;
    overflow: visible;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.35));
}

/* Grok 角色中文台词气泡：随表情淡入淡出，位于角色正下方 */
.grok-bubble {
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translate(-50%, 6px) scale(0.92);
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(30, 34, 40, 0.92);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12.5px;
    line-height: 1.4;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    z-index: 5;
}
.grok-bubble.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}
@media (max-width: 480px) {
    .grok-bubble { font-size: 11.5px; bottom: -2px; }
}

@media (max-width: 480px) {
    .grok-login-stage { width: 112px; height: 112px; margin-bottom: 16px; }
    .grok-login-stage svg { width: 100px; height: 100px; }
}

