html, body {
    background: #f3f4f6;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", PingFang SC, Microsoft YaHei, sans-serif;
    /* 防止横向溢出导致页面可横向滚动 */
    overflow-x: hidden;
}

.main-content {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    /* 使用视口宽度，避免受外层容器撑宽影响 */
    max-width: min(420px, calc(100vw - 32px));
    margin: min(120px, 12vh) auto 60px;
    padding: 36px clamp(24px, 6vw, 32px) 28px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 3px rgba(0,0,0,.1);
}

/* 避免子元素内边距/边框导致的意外溢出 */
.main-content, .main-content * { box-sizing: border-box; }

.auth-logo {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-logo img {
    width: 56px;
    height: auto;
    display: block;
}

.auth-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-title {
    margin: 0;
    font-size: 28px;
    color: #111827;
    font-weight: 700;
}

.auth-subtitle {
    font-size: 15px;
    color: #6b7280;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    position: relative;
    width: 100%;
}

.form-control {
    width: 100%;
    border: 1px solid #d1d5db;
    background: #fafafa;
    border-radius: 8px;
    height: 44px;
    font-size: 16px;
    padding: 10px 14px;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #2563eb;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.form-label {
    display: none;
}

.form-button {
    width: 100%;
    padding: 12px 16px;
    background: #111827;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color .15s ease, transform .15s ease;
}

.form-button:hover,
.form-button:focus-visible {
    background: #000000;
    transform: translateY(-1px);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #475569;
}

.auth-actions a {
    color: #2563eb;
    text-decoration: none;
}

.auth-actions a:hover,
.auth-actions a:focus-visible {
    text-decoration: underline;
}

.auth-hint {
    margin-top: 12px;
    font-size: 14px;
    color: #475569;
}

.auth-hint a {
    color: #2563eb;
    text-decoration: none;
}

.auth-hint a:hover,
.auth-hint a:focus-visible {
    text-decoration: underline;
}

.error-msg {
    margin-top: 8px;
    font-size: 14px;
    color: #dc2626;
}

@media (max-width: 768px) {
    .main-content {
        margin: 96px auto 40px;
        max-width: min(420px, calc(100vw - 28px));
    }

    .auth-logo img {
        width: 48px;
    }
}

@media (max-width: 480px) {
    .main-content {
        gap: 16px;
        margin: 72px 16px 32px;
        max-width: calc(100vw - 24px);
        padding: 28px 18px 22px;
        border-radius: 10px;
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-subtitle {
        font-size: 14px;
    }

    .auth-logo {
        top: 14px;
        right: 14px;
    }

    .auth-logo img {
        width: 42px;
    }
}

/* 极小屏设备的兜底适配（例如老款 320px 宽设备） */
@media (max-width: 360px) {
    .main-content {
        margin: 60px 12px 24px;
        padding: 22px 14px 18px;
    }
    .form-control {
        height: 42px;
        font-size: 15px;
        padding: 9px 12px;
    }
    .form-button {
        padding: 11px 14px;
        font-size: 15px;
    }
    .auth-logo img {
        width: 36px;
    }
}
