/* 导入圆润字体 - 使用 Nunito */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS 变量定义 */
:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --bg-light: #fafbfc;
    --bg-dark: #0a0a0b;
    --card-light: rgba(255, 255, 255, 0.9);
    --card-dark: rgba(17, 24, 39, 0.8);
    --text-light: #1f2937;
    --text-dark: #f9fafb;
    --text-secondary-light: #6b7280;
    --text-secondary-dark: #9ca3af;
    --shadow-light: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-dark: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --border-light: rgba(255, 255, 255, 0.2);
    --border-dark: rgba(255, 255, 255, 0.1);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-6: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

/* 主题变量 */
[data-theme="light"] {
    --bg: var(--bg-light);
    --card-bg: var(--card-light);
    --text-primary: var(--text-light);
    --text-secondary: var(--text-secondary-light);
    --shadow: var(--shadow-light);
    --border: var(--border-light);
}

[data-theme="dark"] {
    --bg: var(--bg-dark);
    --card-bg: var(--card-dark);
    --text-primary: var(--text-dark);
    --text-secondary: var(--text-secondary-dark);
    --shadow: var(--shadow-dark);
    --border: var(--border-dark);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* HTML 和 Body */
html,
body {
    min-height: 100%;
    /* 移除 overflow: hidden; */
}

html {
    overflow-x: hidden; /* 防止横向滚动 */
    overflow-y: auto; /* 允许纵向滚动 */
}

html.loading {
    opacity: 0;
}

html.loaded {
    opacity: 1;
    transition: opacity 0.6s ease;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.6;
    overflow-x: hidden; /* 防止横向滚动 */
}

/* 动态背景 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

.bg-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 20s ease-in-out infinite;
}

.shape:nth-child(1) {
    width: 300px;
    height: 300px;
    background: var(--gradient-1);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    width: 200px;
    height: 200px;
    background: var(--gradient-2);
    top: 60%;
    right: 20%;
    animation-delay: -5s;
}

.shape:nth-child(3) {
    width: 250px;
    height: 250px;
    background: var(--gradient-3);
    bottom: 20%;
    left: 30%;
    animation-delay: -10s;
}

.shape:nth-child(4) {
    width: 180px;
    height: 180px;
    background: var(--gradient-4);
    top: 30%;
    right: 10%;
    animation-delay: -15s;
}

/* 动画关键帧 */
@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -40px) rotate(90deg);
    }
    50% {
        transform: translate(-20px, 20px) rotate(180deg);
    }
    75% {
        transform: translate(40px, 10px) rotate(270deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rainbow-flow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 800% 50%;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 主容器 */
.container {
    min-height: 100vh; /* 改为 min-height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    gap: 1.2rem;
}

/* 右上角任务管理按钮 */
.tasks-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.tasks-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

.tasks-toggle.show {
    opacity: 1;
    visibility: visible;
}

.tasks-toggle i {
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

/* 头像区域 */
.avatar-section {
    text-align: center;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 0.1rem;
    cursor: pointer;
}

.avatar-ring {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--gradient-1);
    animation: spin 8s linear infinite;
}

.avatar-ring::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--bg);
}

.avatar {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

.avatar-container:hover .avatar {
    transform: scale(1.2);
}

/* 标题区域 */
.title-section h1 {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(90deg,
            #ff8c00 0%,
            #ff8c00 15%,
            #ffff00 30%,
            #00ff00 40%,
            #00ffff 50%,
            #0000ff 60%,
            #ff8c00 70%,
            #ffff00 85%,
            #ff8c00 100%);
    background-size: 800% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-flow 120s linear infinite, fadeIn 1.5s ease-out forwards;
    opacity: 0;
    will-change: background-position;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.1));
    letter-spacing: 0.05em;
}

.subtitle {
    font-family: 'Nunito', 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.typing-cursor {
    animation: blink 1s infinite;
}

/* 导航卡片网格 */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    width: 100%;
    max-width: 750px;
    margin-bottom: 1.6rem;
}

/* 导航卡片样式 */
.nav-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem 1.2rem;
    text-decoration: none;
    color: var(--text-primary);
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-align: center;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-card:nth-child(2)::before {
    background: var(--gradient-2);
}

.nav-card:nth-child(3)::before {
    background: var(--gradient-3);
}

.nav-card:nth-child(4)::before {
    background: var(--gradient-4);
}

.nav-card:nth-child(5)::before {
    background: var(--gradient-5);
}

.nav-card:nth-child(6)::before {
    background: var(--gradient-6);
}

.nav-card:hover::before {
    transform: scaleX(1);
}

.nav-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.25);
}

/* 导航卡片图标 */
.nav-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    transition: all 0.3s ease;
}

.nav-card:nth-child(2) .nav-card-icon {
    background: var(--gradient-2);
}

.nav-card:nth-child(3) .nav-card-icon {
    background: var(--gradient-3);
}

.nav-card:nth-child(4) .nav-card-icon {
    background: var(--gradient-4);
}

.nav-card:nth-child(5) .nav-card-icon {
    background: var(--gradient-5);
}

.nav-card:nth-child(6) .nav-card-icon {
    background: var(--gradient-6);
}

.nav-card:hover .nav-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.nav-card-icon i {
    font-size: 1.5rem;
    color: white;
}

.nav-card h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.nav-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* 社交链接 */
.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-link {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    will-change: transform, box-shadow; /* 添加 will-change 优化 */
    transform: translateZ(0); /* 强制硬件加速 */
}

.social-link:hover {
    transform: translateY(-2px) scale(1.1) translateZ(0); /* 保持 translateZ(0) */
    box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 明确指定过渡属性 */
}

.social-link i {
    font-size: 1.2rem;
    transform: translateZ(0); /* 图标也添加硬件加速 */
}

/* 页脚 */
.footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 加载动画 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in:nth-child(1) { animation-delay: 0.1s; }
.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.4s; }
.fade-in:nth-child(5) { animation-delay: 0.5s; }
.fade-in:nth-child(6) { animation-delay: 0.6s; }

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem; /* 增加上下内边距 */
        gap: 0.8rem; /* 增加间距 */
        min-height: auto; /* 移动端不强制最小高度 */
    }

    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem; /* 增加间距 */
        max-width: 400px;
    }

    .nav-card {
        padding: 1rem 0.8rem; /* 增加内边距 */
        min-height: 100px; /* 增加最小高度 */
    }

    .avatar-container {
        width: 80px;
        height: 80px;
    }

    .nav-card-icon {
        width: 36px; /* 增加图标大小 */
        height: 36px;
    }

    .nav-card-icon i {
        font-size: 1.1rem; /* 增加图标字体大小 */
    }

    .title-section h1 {
        font-size: clamp(2.5rem, 6vw, 3.5rem);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.5rem; /* 确保有足够的内边距 */
        gap: 0.6rem;
    }

    .nav-grid {
        max-width: 320px;
        gap: 0.6rem;
    }
    
    .nav-card {
        min-height: 90px; /* 确保卡片有足够高度 */
    }
}

/* 移除高度限制的媒体查询，让内容自然流动 */
@media (max-height: 600px) {
    .container {
        gap: 0.5rem; /* 减少间距但不要太小 */
        padding: 0.5rem; /* 保持适当的内边距 */
    }

    .avatar-container {
        width: 60px;
        height: 60px;
    }

    .nav-card {
        min-height: 70px; /* 保持最小高度 */
        padding: 0.6rem; /* 保持适当的内边距 */
    }

    .title-section h1 {
        font-size: 1.8rem; /* 适当减小但不要太小 */
        margin-bottom: 0.3rem;
    }

    .subtitle {
        font-size: 0.9rem; /* 适当减小但保持可读性 */
    }
}

/* 确保在非常小的屏幕上也能正常显示 */
@media (max-height: 480px) {
    .container {
        justify-content: flex-start; /* 不居中，从顶部开始 */
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .nav-grid {
        margin-bottom: 1rem; /* 减少底部边距 */
    }
}