:root {
    --text-gray: #6b7280;
    --input-border: #e5e7eb;
    --error: #ef4444;
}

html[data-theme="dark"] {
    --text-gray: #9ca3af;
    --input-border: #334155;
    --error: #f87171;
}

body {
    height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 20px;
    transition: background 0.2s ease;
    animation: fadeIn 0.3s ease;
    position: relative;
}

.hero-title {
    position: relative;
    font-size: 78px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 10px;
    transform-style: preserve-3d;
    transition: all 0.15s ease-out;
    text-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
    cursor: default;
    font-family: "MiSans", "PingFang SC", "Helvetica Neue", "Arial", sans-serif;
}

@media (max-width:768px) {
    .hero-title {
        font-size: 48px;
        letter-spacing: 6px;
    }
    
    .login-box {
        width: 90%;
        padding: 32px 24px;
    }
    
    .login-box h2 {
        font-size: 22px;
        margin-bottom: 24px;
    }
    
    input {
        padding: 12px 12px 12px 40px;
        font-size: 14px;
    }
    
    button {
        padding: 12px;
        font-size: 15px;
    }
    
    .login-avatar {
        width: 76px;
        height: 76px;
        font-size: 30px;
    }
}

.hero-title::after {
    content: "NVISTAR";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: lightSweep 4.5s infinite linear;
    pointer-events: none;
    font-family: inherit;
}

@keyframes lightSweep {
    0% {
        background-position: -200% 0%;
    }

    100% {
        background-position: 200% 0%;
    }
}

.title-container {
    perspective: 1200px;
}

.login-box {
    width: 420px;
    max-width: 90%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    padding: 40px 32px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .login-box {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.login-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(59, 130, 246, 0.03) 50%,
        transparent 100%
    );
    animation: shimmer 8s infinite linear;
    pointer-events: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.login-box h2 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.login-box h2::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    margin: 12px auto 0;
    border-radius: 2px;
}

/* 输入框容器 */
.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group.password-group {
    position: relative;
}
/* M-hM->M-^SM-eM-^EM-%M-fM-!M-^FM-fM- M-^GM-gM--M-> */
.input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}


/* 密码显示/隐藏按钮 */
.password-toggle {
    position: absolute;
    right: 14px;
    bottom: 14px; /* 从底部定位，确保在输入框内居中 */
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 10;
    user-select: none;
}

.password-toggle.visible {
    display: flex; /* 有内容时显示 */
}

.password-toggle:hover {
    color: #3b82f6;
    transform: scale(1.1);
}

.password-toggle::before {
    content: '👁';
}

.password-toggle.active::before {
    content: '🙈';
}

input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1; /* 输入框层级低于图标 */
}

html[data-theme="dark"] input {
    background: rgba(30, 41, 59, 0.8);
}

input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

html[data-theme="dark"] input:focus {
    background: #1e293b;
}

input:focus + .input-icon,
.input-group:focus-within input::placeholder {
    color: #94a3b8;
    font-size: 14px;
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    margin-top: 16px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.error {
    color: var(--error);
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--error);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-gray);
    font-size: 14px;
}

.link a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

.link a:hover {
    color: #8b5cf6;
}

.link a:hover::after {
    width: 100%;
}

/* ==============================================
   登录页头像显示
   ============================================== */
.login-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    overflow: hidden;
    box-shadow: 
        0 8px 24px rgba(59, 130, 246, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.login-avatar::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-avatar:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 
        0 12px 32px rgba(59, 130, 246, 0.4),
        0 0 0 4px rgba(255, 255, 255, 0.8);
}

.login-avatar:hover::before {
    opacity: 1;
}

.login-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.login-avatar:hover img {
    transform: scale(1.1);
}

.login-avatar-name {
    margin-top: 10px;
    font-size: 15px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 👇 修复主题按钮不居中！！！ */
.theme-switch {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--box);
    border: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    z-index: 999;
}

/* ==============================================
   浏览器自动填充检测动画
   ============================================== */
@keyframes onAutoFillStart {
    from { /* no-op */ }
    to   { /* no-op */ }
}

input:-webkit-autofill,
input:autofill {
    animation-name: onAutoFillStart;
    animation-duration: 0.1s;
    animation-fill-mode: both;
}