* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;   /* 禁止 iOS 自动调整字号 */
    text-size-adjust: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #050f1a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
    /* 宽高由 JS 写死像素，不依赖 CSS 百分比 */
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(58, 155, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(58, 155, 255, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 8s linear infinite;
    mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 70%);
}
@keyframes gridMove {
    0% { transform: translate(0,0) rotate(0deg); }
    100% { transform: translate(60px,60px) rotate(1deg); }
}

/* ===== 主卡片 ===== */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    background: rgba(18, 38, 62, 0.65);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-radius: 48px;
    padding: 40px 36px 36px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(100,180,255,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    margin: 20px 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 6px;
}

.auth-logo-img {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 0 15px rgba(0, 200, 255, 0.4));
    transition: transform 0.3s ease;
}
.auth-logo:hover .auth-logo-img {
    transform: scale(1.02);
}

.auth-logo-text {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(120deg, #E0F0FF, #7BC5FF, #3A9BFF);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 5s ease infinite;
    letter-spacing: -0.5px;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.auth-subtitle {
    font-size: 0.85rem;
    color: rgba(180,210,240,0.7);
    letter-spacing: 2px;
    font-weight: 400;
    margin-top: 2px;
}

/* ===== 表单 ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(180,210,240,0.8);
    letter-spacing: 0.5px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-group .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.form-group .input-wrapper i {
    position: absolute;
    left: 16px;
    color: rgba(100,180,255,0.4);
    font-size: 1rem;
    transition: color 0.3s;
    pointer-events: none;
}
.form-group .input-wrapper:focus-within i {
    color: #7bc5ff;
}
.form-group input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(100,180,255,0.15);
    border-radius: 40px;
    font-size: 16px;                  /* 强制 16px，iOS 不 zoom 的硬性要求 */
    color: #e8f0fe;
    font-family: inherit;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}
.form-group input::placeholder {
    color: rgba(180,210,240,0.3);
}
.form-group input:focus {
    border-color: rgba(100,180,255,0.6);
    background: rgba(0,0,0,0.5);
    box-shadow: 0 0 0 3px rgba(60,160,255,0.1);
}
.toggle-pwd-label {
    cursor: pointer;
    color: rgba(180,210,240,0.4);
    transition: color 0.3s;
    font-size: 0.9rem;
    margin-left: 4px;
}
.toggle-pwd-label:hover {
    color: rgba(180,210,240,0.8);
}

.form-extra {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: rgba(180,210,240,0.6);
    padding: 4px 4px 0;
}
.form-extra label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.form-extra input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3A9BFF;
    cursor: pointer;
}

.btn-submit {
    padding: 16px;
    border: none;
    border-radius: 60px;
    background: linear-gradient(135deg, #1a4c8c, #3A9BFF);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
    letter-spacing: 1px;
    box-shadow: 0 8px 24px rgba(58,155,255,0.25);
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}
.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(58,155,255,0.4);
}
.btn-submit:active { transform: scale(0.98); }
.btn-submit::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: btnShine 4s ease-in-out infinite;
}
@keyframes btnShine {
    0% { transform: translateX(-100%) rotate(25deg); }
    100% { transform: translateX(100%) rotate(25deg); }
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: rgba(180,210,240,0.4);
}

.auth-message {
    padding: 12px 16px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 10px;
    animation: fadeUp 0.3s ease;
}
.auth-message.show { display: flex; }
.auth-message.success {
    background: rgba(46,204,113,0.2);
    border: 1px solid rgba(46,204,113,0.3);
    color: #7ddfa0;
}
.auth-message.error {
    background: rgba(231,76,60,0.2);
    border: 1px solid rgba(231,76,60,0.3);
    color: #f1948a;
}
.auth-message.info {
    background: rgba(58,155,255,0.15);
    border: 1px solid rgba(58,155,255,0.25);
    color: #7bc5ff;
}
.auth-message i { font-size: 1.1rem; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.7rem;
    color: rgba(180,210,240,0.2);
    letter-spacing: 1px;
}

/* ===== 移动端：置顶 + 不依赖 vh + 无缩放 ===== */
@media (max-width: 768px) {
    body {
        display: block !important;
        align-items: initial !important;
        justify-content: initial !important;
        min-height: 0 !important;         /* 不依赖 vh，键盘弹起高度变化不影响 */
        height: auto !important;
        padding: 20px !important;
        overflow: visible !important;      /* 让 document 自己滚 */
    }
    .auth-container {
        margin: 0 auto !important;
        max-height: none !important;
        overflow: visible !important;
        /* 移动端降一档毛玻璃，减少视口变化时重绘压力 */
        backdrop-filter: blur(8px) saturate(1.2) !important;
        -webkit-backdrop-filter: blur(8px) saturate(1.2) !important;
    }
    /* 移动端所有输入框强制 16px，防止 iOS 自动 zoom */
    .form-group input,
    .form-group input:focus {
        font-size: 16px !important;
    }
}

@media (max-width: 520px) {
    .auth-container { padding: 28px 20px; }
    .auth-logo-text { font-size: 1.3rem; }
    .auth-logo-img { height: 38px; }
    .form-group input { padding: 12px 14px 12px 42px; }   /* 不写 font-size，交给上面的 16px */
    .btn-submit { padding: 14px; font-size: 0.95rem; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: rgba(18,38,62,0.3); }
::-webkit-scrollbar-thumb { background: rgba(100,180,255,0.3); border-radius: 4px; }