body, html {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff; /* 设置背景颜色为白色 */
    font-family: 'HarmonyOS Sans SC', sans-serif; /* 应用自定义字体 */
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff; /* 设置背景颜色为白色 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #636C76;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.navbar {
    width: 100%;
    background-color: rgba(248, 248, 248, 0.8); /* 设置半透明背景 */
    border-bottom: 1px solid #e7e7e7;
    position: fixed;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px); /* 添加高斯模糊 */
    -webkit-backdrop-filter: blur(10px); /* 添加高斯模糊 */
}

.navbar ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.navbar li {
    float: left;
}

.navbar li a {
    display: block;
    color: #333;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

.navbar li a:hover {
    background-color: #ddd;
    color: black;
}

.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    max-width: 1220px; /* 固定宽度为屏幕的60% */
    
    margin: 70px auto 20px auto; /* 使 container 有上下边距，并水平居中 */
    padding: 20px;
    border-radius: 8px; /* 移除边框阴影 */
    flex-direction: row; /* 默认是水平布局 */
    flex-grow: 1; /* 使 container 扩展以填满剩余空间 */
}

.profile {
    text-align: left; /* 居左对齐 */
    margin: 20px;
    width: 300px; /* 设置 profile 宽度为300px */
    flex-shrink: 0; /* 确保 profile 不会被压缩 */
    position: -webkit-sticky;
    position: sticky;
    top: 100px; /* 固定位置 */
}

.profile img {
    border-radius: 50%;
    width: 296px; /* 设置头像宽度为296px */
    height: 296px; /* 设置头像高度为296px */
    border: 2.3px solid #d6d6d6; /* 设置灰色边框 */
}

.profile a {
    color: #0366d6;
    text-decoration: none;
}

.profile a:hover {
    text-decoration: underline;
}

.profile h2 {
    margin: 10px 0;
    color: #1F2328; /* 设置昵称颜色 */
}

.profile p#username {
    font-size: 20px; /* 设置用户名大小 */
    color: #636C76; /* 设置用户名颜色 */
    font-family: 'HarmonyOS Sans SC Light', sans-serif; /* 设置用户名字体 */
    font-weight: 300; /* 设置字体粗细为300 */
    margin: 0; /* 去掉用户名外边距 */
}

.profile p#bio {
    margin: 10px 0;
    color: #1F2328; /* 设置简介颜色 */
}

.repos {
    flex-grow: 1;
    text-align: left;
    margin: 20px;
}

.repos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.repos-header h3 {
    margin: 0;
    color: #000; /* 设置标题为黑色 */
}

.repos-header a {
    color: #666;
    text-decoration: none;
    font-weight: normal; /* 不加粗 */
    margin-right: 10px; /* 添加右边外边距 */
}

.repos-header a:hover {
    text-decoration: underline;
}

.repos ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.repos li.repo-item {
    margin: 10px 10px 5px 0; /* 去掉左边距 */
    padding: 20px; /* 添加填充以保持内边距一致 */
    background-color: #f2f3f5;
    border-radius: 8px;
    width: calc(50% - 10px); /* 每行两个仓库，减去间距 */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px; /* 确保最小高度 */
}

.repos li.repo-item:nth-child(2n) {
    margin-right: 0; /* 去掉右边距 */
}

.repos li.repo-item a {
    text-decoration: none; /* 去掉下划线 */
}

.repos li.repo-item a:hover {
    text-decoration: underline; /* 添加下划线 */
}

.repos a {
    color: #0366d6;
    text-decoration: none;
    font-weight: bold;
}

.repos p {
    margin: 5px 0;
    color: #555;
}

.repos p.repo-details {
    margin-top: auto; /* 确保此元素在列表项的底部 */
    margin-bottom: 0; /* 确保底部外边距为0 */
}

footer {
    text-align: center;
    margin: 20px;
    font-size: 0.9em;
    color: #666;
    padding-bottom: 20px; /* 增加底部边距 */
}

footer a {
    color: #666666; /* 设置footer中的a标签颜色 */
    text-decoration: none; /* 去掉下划线 */
}

footer a:visited, footer a:active {
    color: #666666; /* 去掉点击后的效果 */
    text-decoration: none;
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    body, html {
        background-color: #0d1017; /* 深色背景 */
        color: #e0e0e0; /* 浅色字体 */
    }
    #loading-overlay {
        background-color: #0d1017; /* 深色背景 */
    }
    .spinner {
        border-left-color: #e0e0e0;
    }
    .navbar {
        background-color: rgba(30, 30, 30, 0.8); /* 深色背景 */
        border-bottom: 1px solid #2e2e2e;
        backdrop-filter: blur(10px); /* 添加高斯模糊 */
        -webkit-backdrop-filter: blur(10px); /* 添加高斯模糊 */
    }
    .navbar li a {
        color: #e0e0e0;
    }
    .navbar li a:hover {
        background-color: #333;
        color: #fff;
    }
    .container {
        background: none; /* 移除container背景 */
    }
    .profile h2, .profile p#bio {
        color: #e0e0e0; /* 浅色字体 */
    }
    .profile p#username {
        color: #9e9e9e; /* 浅色字体 */
    }
    .repos-header h3 {
        color: #e0e0e0; /* 浅色字体 */
    }
    .repos-header a {
        color: #9e9e9e; /* 浅色链接 */
    }
    .repos li.repo-item {
        background-color: #2e2e2e; /* 深色背景 */
        color: #e0e0e0; /* 浅色字体 */
    }
    .repos a {
        color: #82aaff; /* 浅蓝色链接 */
    }
    .repos p {
        color: #b0b0b0; /* 浅色字体 */
    }
    footer {
        color: #9e9e9e; /* 浅色字体 */
    }
    footer a {
        color: #9e9e9e; /* 浅色链接 */
    }
}

/* 移动设备布局 */
@media (max-width: 768px) {
    .container {
        width: 90vw; /* 固定宽度为屏幕的90% */
        flex-direction: column; /* 垂直布局 */
        align-items: center; /* 居中对齐 */
    }

    .profile {
        width: 100%; /* 宽度为100% */
        text-align: left; /* 文本居左对齐 */
        position: static; /* 取消固定位置 */
        display: flex; /* 使用 flex 布局 */
        flex-direction: column; /* 垂直布局 */
        align-items: flex-start; /* 左对齐 */
    }

    .profile img {
        width: 60px; /* 设置头像宽度为60px */
        height: 60px; /* 设置头像高度为60px */
        margin-bottom: 10px; /* 头像和下方文本之间的间距 */
    }

    .profile .info {
        display: flex; /* 使用 flex 布局 */
        flex-direction: row; /* 水平布局 */
        align-items: center; /* 垂直居中对齐 */
    }

    .profile .info div {
        display: flex;
        flex-direction: column;
    }

    .profile .info h2, .profile .info p#username {
        margin: 0;
    }

    .repos {
        width: 100%; /* 宽度为100% */
        text-align: left; /* 文本居左对齐 */
    }

    .repos li.repo-item {
        width: 100%; /* 移动设备上每行一个仓库 */
        margin-right: 0; /* 去掉右边距 */
    }
}
