:root {
    /* 默认浅色主题变量 */
    --primary-color: #333;
    --text-color: #555;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --title-color: #2c3e50;
    --bio-color: #888;
    --name-color: #000;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 深色主题变量覆盖 */
[data-theme="dark"] {
    --primary-color: #f0f0f0;
    --text-color: #ddd;
    --bg-gradient: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --card-bg: rgba(30, 30, 30, 0.85);
    --title-color: #fff;
    --bio-color: #aaa;
    --name-color: #fff;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-gradient);
    overflow-x: hidden; /* 允许垂直滚动，禁止水平滚动 */
    position: relative; /* 为开关定位 */
    padding: 20px; /* 增加内边距，防止贴边 */
}

.container {
    text-align: center;
    perspective: 1000px;
}

/* 右上角开关样式 */
.theme-switch-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 100;
}

.theme-switch-text {
    margin-right: 8px;
    font-size: 0.9rem;
    color: var(--title-color);
    font-weight: 500;
}

.theme-switch {
    display: inline-block;
    height: 20px;
    position: relative;
    width: 40px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 2px;
    content: "";
    height: 16px;
    left: 2px;
    position: absolute;
    transition: .4s;
    width: 16px;
}

input:checked + .slider {
    background-color: #66bb6a;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 标题样式 */
.main-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--title-color);
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.5s, transform 0.5s, color 0.3s; /* 添加颜色过渡 */
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.main-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.cursor {
    display: inline-block;
    width: 3px;
    background-color: var(--title-color);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 卡片容器 */
.profile-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 30px;
    width: 650px;
    max-width: 90vw;
    backdrop-filter: blur(10px);
    transform-style: preserve-3d;
    transition: transform 0.1s ease, background 0.3s; /* 添加背景过渡 */
    text-align: left;
}

/* 头像区域 */
.avatar-container {
    flex-shrink: 0;
    transform: translateZ(20px);
}

.avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 8px 16px var(--shadow-color);
}

/* 内容区域 */
.info-container {
    flex-grow: 1;
    transform: translateZ(10px);
}

.name {
    font-size: 2rem;
    font-weight: 900;
    color: var(--name-color);
    margin-bottom: 8px;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.bio {
    font-size: 1rem;
    color: var(--bio-color);
    margin-bottom: 25px;
    font-weight: 400;
    transition: color 0.3s;
}

/* 社交链接区域 */
.social-links {
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateZ(30px);
}

/* 通用按钮交互 */
.btn {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.25);
}

/* GitHub 胶囊按钮 */
.github-btn {
    background-color: #181717;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .github-btn {
    background-color: #333; /* 深色模式下GitHub按钮稍微变灰一点 */
}

.github-btn i {
    font-size: 1.2rem;
}

/* 圆形图标按钮 */
.circle-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
}

.bg-bilibili { background-color: #00aeec; }
.bg-tiktok { background-color: #000000; }
[data-theme="dark"] .bg-tiktok { border: 1px solid #333; } /* 深色模式下给黑色按钮加个边框 */
.bg-music { background-color: #d81e06; }
.bg-email { background-color: #f1c40f; }

/* 响应式调整 */
@media (max-width: 768px) {
    .main-title {
        font-size: 2rem; /* 手机端标题调小 */
        margin-bottom: 25px;
    }

    .profile-card {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px; /* 减小左右内边距 */
        width: 100%;
        max-width: 400px; /* 限制手机端卡片最大宽度 */
        gap: 20px;
    }

    .avatar {
        width: 120px; /* 手机端头像调小 */
        height: 120px;
    }

    .name {
        font-size: 1.8rem;
    }
    
    .social-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px; /* 减小图标间距 */
    }
    
    .theme-switch-wrapper {
        top: 15px;
        right: 15px;
    }
}