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

/* CSS 变量定义 */
:root {
    /* 主色调 */
    --primary: #6366f1;
    --secondary: #8b5cf6;
    
    /* 背景色 */
    --bg-light: #fafbfc;
    --bg-dark: #0a0a0b;
    
    /* 卡片背景 */
    --card-light: rgba(255, 255, 255, 0.9);
    --card-dark: rgba(32, 32, 32, 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;
}

/* 公共过渡效果类 */
.theme-transition {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* HTML 和 Body */
html {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100%;
}

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);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100%;
}

/* 应用公共过渡类 */
html,
body {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 动画关键帧 */
@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;
    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);
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.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;
}

/* 头像区域 */
.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;
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-ring::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--bg);
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.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;
    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', monospace;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.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);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-align: center;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6),
                background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.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;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 社交链接 */
.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);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.2);
}

.social-link i {
    font-size: 1.2rem;
}

/* 页脚 */
.footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 加载动画 */
.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; }

/* 深色主题特殊样式 */
[data-theme="dark"] .nav-card,
[data-theme="dark"] .social-link,
[data-theme="dark"] .tasks-toggle {
    backdrop-filter: blur(20px) saturate(180%);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

::-webkit-scrollbar-track {
    background: var(--bg);
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 响应式设计 */
@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;
    }
}