:root {
    /* 亮色模式 - 现代高级感 */
    --primary-color: #111827;
    /* 近乎黑的深蓝灰 */
    --accent-color: #f97316;
    /* 活力橙 */
    --accent-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --link-color: #0ea5e9;
    --bg-color: #f3f4f6;
    /* 浅灰背景，不再是纯白 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    /* 毛玻璃背景 */
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-bg: rgba(255, 255, 255, 0.6);
    --text-color: #374151;
    --text-secondary: #6b7280;
    --border-color: rgba(0, 0, 0, 0.06);
    --sidebar-width: 300px;
    --content-max-width: 1000px;
    --font-main: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;

    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-hover: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
}

/* 暗黑模式 - 深邃星空 */
body.dark-mode {
    --primary-color: #f9fafb;
    --accent-color: #fbbf24;
    --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    --link-color: #38bdf8;
    --bg-color: #0f172a;
    /* 深蓝黑 */
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(31, 41, 55, 0.4);
    --text-color: #e5e7eb;
    --text-secondary: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    letter-spacing: -0.015em;
    display: flex;
    min-height: 100vh;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    /* 防止水平滚动 */
}

/* Responsive Design for Laptop/Tablet */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
        /* 减小侧边栏宽度 */
    }

    .main-content {
        padding: 100px 30px 40px;
        /* 减小内边距 */
    }

    .sidebar {
        padding: 30px 20px;
    }

    .avatar {
        width: 100px;
        height: 100px;
    }
}

/* Background Animation Blobs */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

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

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #c084fc;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #60a5fa;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: #f472b6;
    animation-delay: -10s;
}

body.dark-mode .blob {
    opacity: 0.15;
}

body.dark-mode .blob-1 {
    background: #4c1d95;
}

body.dark-mode .blob-2 {
    background: #1e3a8a;
}

body.dark-mode .blob-3 {
    background: #831843;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

a:hover {
    color: var(--accent-color);
}

/* Language Display Control */
.lang-en {
    display: none;
}

.lang-zh {
    display: inline;
}


/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 20px;
    right: 50%;
    transform: translateX(50%);
    width: auto;
    min-width: 600px;
    padding: 10px 30px;
    border-radius: 50px;
    /* Pill shape */
    display: flex;
    justify-content: space-between;
    /* Separate controls and links */
    align-items: center;
    z-index: 100;
    transition: all 0.3s ease;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.nav-links {
    display: flex;
    flex: 1;
    /* 占据剩余空间 */
    justify-content: space-evenly;
    /* 均匀分布 */
    gap: 20px;
    /* 减小间距，让 space-evenly 发挥作用 */
    align-items: center;
}

.top-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 6px 0;
    display: flex;
    /* Ensure spans behave correctly */
    align-items: center;
}

.top-nav a:hover,
.top-nav a.active {
    color: var(--primary-color);
}

.top-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
}

/* Controls */
.nav-controls {
    display: flex;
    gap: 20px;
    margin-right: 40px;
    /* Space between controls and links */
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    align-items: center;
}

.control-btn {
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.control-btn:hover {
    color: var(--primary-color);
    transform: scale(1.05);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    height: calc(100vh - 40px);
    left: 20px;
    top: 20px;
    border-radius: 24px;
    padding: 60px 30px;
    text-align: center;
    z-index: 10;
    overflow-y: auto;
    /* Glass Effect */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);

    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 24px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.5s ease;
}

.avatar:hover {
    transform: rotate(5deg) scale(1.05);
}

.author-name {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

.author-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-weight: 500;
}

.author-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: auto;
    /* Push contacts to bottom */
}

.contact-list {
    list-style: none;
    width: 100%;
    margin-top: auto;
    /* Push to bottom */
    padding-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.contact-list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    /* Fixed width for alignment */
}

.contact-list a,
.contact-list span {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.contact-list-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.8;
    white-space: nowrap;
}

body.dark-mode .contact-list a,
body.dark-mode .contact-list span {
    background: rgba(255, 255, 255, 0.1);
}

.contact-list a:hover,
.contact-list span:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(234, 88, 12, 0.4);
}

/* Main Content */
.main-content {
    margin-left: calc(var(--sidebar-width) + 40px);
    padding: 120px 40px 60px;
    /* 减少左右 padding */
    max-width: 1400px;
    /* 增加最大宽度 */
}

/* About Section Layout */
#about {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
}

#about-content {
    flex: 1;
    min-width: 300px;
}

#skill-galaxy-container {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    /* 限制技能云最大宽度 */
    height: 400px !important;
    /* 增加高度 */
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 20px;
    box-shadow: var(--shadow-glass);
    margin-top: 0 !important;
    /* 移除内联样式的 margin */
}

/* Section Styling */
section {
    margin-bottom: 100px;
}

h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    font-weight: 800;
    display: flex;
    align-items: center;
    color: var(--primary-color);
    letter-spacing: -0.03em;
    gap: 15px;
    /* Add gap between elements */
}

h2 span:first-child {
    margin-right: 0;
    font-size: 1.8rem;
}

/* Remove margin-right as we use gap */

/* About Text */
#about-content p {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 24px;
    line-height: 1.8;
    text-align: left;
    /* 左对齐，不使用两端对齐 */
    word-wrap: break-word;
    /* 允许长单词换行 */
    overflow-wrap: break-word;
    /* 现代浏览器的换行 */
}

/* News List - Glass Cards */
.news-list li {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.news-list li:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-hover);
}

body.dark-mode .news-list li:hover {
    background: rgba(31, 41, 55, 0.8);
}

.news-date {
    font-weight: 700;
    min-width: 100px;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
}

/* Publication Cards - High End */
.paper-item {
    display: flex;
    margin-bottom: 40px;
    padding: 24px;
    border-radius: 24px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.paper-item:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--shadow-hover);
    background: var(--glass-bg);
}

.paper-img-box {
    width: 280px;
    flex-shrink: 0;
    margin-right: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.paper-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.paper-item:hover .paper-img-box img {
    transform: scale(1.1);
}

.conf-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.paper-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-color);
    line-height: 1.3;
}

.paper-authors {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 1rem;
}

.paper-links a {
    display: inline-block;
    padding: 8px 20px;
    margin-right: 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.paper-links a:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

/* Scroll Animation Classes */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {

    /* Body布局改为纵向堆叠 */
    body {
        flex-direction: column;
        display: block;
        /* 改为block布局避免flex问题 */
    }

    /* 隐藏背景动画，性能优化 */
    .bg-animation {
        display: none;
    }

    /* 顶部导航 - 固定在顶部 */
    .top-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        transform: none;
        min-width: auto;
        padding: 10px 15px;
        overflow-x: auto;
        flex-wrap: nowrap;
        z-index: 1000;
    }

    .nav-controls {
        flex-shrink: 0;
        gap: 10px;
        margin-right: 12px;
        padding-right: 12px;
    }

    .control-btn {
        font-size: 0.85rem;
    }

    .nav-links {
        gap: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links a {
        white-space: nowrap;
        font-size: 0.85rem;
    }

    /* 侧边栏 - 移到顶部导航下方，完全占据宽度 */
    .sidebar {
        position: static;
        /* 改为静态定位 */
        width: 100%;
        height: auto;
        left: auto;
        top: auto;
        margin-top: 52px;
        /* 为顶部导航留出空间 */
        margin-bottom: 0;
        padding: 30px 20px 25px;
        border-radius: 0;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: none;
        border-bottom: 1px solid var(--border-color);
    }

    .avatar {
        width: 90px;
        height: 90px;
        margin-bottom: 12px;
    }

    .author-name {
        font-size: 1.4rem;
        margin-bottom: 6px;
    }

    .author-title {
        font-size: 0.8rem;
        margin-bottom: 15px;
    }

    .author-desc {
        font-size: 0.85rem;
        line-height: 1.6;
        margin-bottom: 20px;
    }

    .contact-list {
        gap: 10px;
        margin-top: 15px;
        padding-top: 15px;
    }

    .contact-list li {
        width: auto;
    }

    .contact-list a,
    .contact-list span {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .contact-list-label {
        font-size: 0.6rem;
    }

    /* 主内容区 */
    .main-content {
        margin-left: 0;
        margin-top: 0;
        padding: 25px 20px 40px;
        max-width: 100%;
    }

    /* 板块间距减小 */
    section {
        margin-bottom: 40px;
    }

    /* 标题 */
    h2 {
        font-size: 1.4rem;
        margin: 30px 0 20px;
    }

    h2:first-of-type {
        margin-top: 0;
        /* 第一个标题取消上边距 */
    }

    h2 span:first-child {
        font-size: 1.2rem;
    }

    /* About */
    #about-content p {
        font-size: 0.95rem;
        line-height: 1.7;
        margin-bottom: 18px;
    }

    /* News */
    .news-list li {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px;
        margin-bottom: 10px;
    }

    .news-date {
        min-width: auto;
        margin-bottom: 6px;
        font-size: 0.75rem;
    }

    .news-list li .news-content {
        font-size: 0.9rem;
    }

    /* 论文卡片 */
    .paper-item {
        flex-direction: column;
        padding: 18px;
        margin-bottom: 25px;
    }

    .paper-img-box {
        width: 100%;
        max-height: 200px;
        /* 限制图片容器最大高度 */
        margin-right: 0;
        margin-bottom: 14px;
    }

    .paper-img-box img {
        width: 100%;
        height: 100%;
        max-height: 200px;
        /* 限制图片最大高度 */
        object-fit: cover;
        /* 保持比例裁剪 */
    }

    .paper-title {
        font-size: 1.05rem;
        margin-bottom: 10px;
    }

    .paper-authors {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }

    .paper-links a {
        padding: 6px 14px;
        font-size: 0.75rem;
        margin-right: 6px;
        margin-bottom: 6px;
    }
}

/* --- Cool Features Styles --- */

/* 1. Terminal Easter Egg */
.terminal-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.terminal-trigger:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--accent-color);
    color: #000;
}

.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-window {
    width: 800px;
    height: 500px;
    max-width: 90vw;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.terminal-header {
    height: 40px;
    background: #1e293b;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #334155;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.terminal-buttons .close {
    background: #ff5f56;
}

.terminal-buttons .minimize {
    background: #ffbd2e;
}

.terminal-buttons .maximize {
    background: #27c93f;
}

.terminal-title {
    flex: 1;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.terminal-body {
    flex: 1;
    padding: 20px;
    color: #38bdf8;
    overflow-y: auto;
    font-size: 1rem;
}

.terminal-input-line {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.terminal-input-line input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* 2. Visitor Globe */
#visitor-globe canvas {
    outline: none;
}