:root {
    /* =========================================
       1. 变量定义
       ========================================= */
    /* Light Mode (默认) */
    --bg-color: #f4f6f8;
    --sidebar-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #546e7a;
    --text-date: #888888;
    --accent-color: #0366d6;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --border-color: #eaeaea;
    --border-radius: 12px;
    --tag-bg: #eef3f8;
    --tag-text: #333;
    --hover-bg: #eef3f8;
    
    /* 图标底色 */
    --icon-bg-blue: #e3f2fd;
    --icon-bg-orange: #fff3e0;
    --icon-bg-green: #e8f5e9;
    
    /* 状态条 */
    --alert-bg: #e3f2fd;
    --alert-border: #2196f3;
    --alert-text: #0d47a1;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #121212;
    --sidebar-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0bec5;
    --text-date: #9aa0a6;
    --accent-color: #448aff;
    --card-bg: #1e1e1e;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --border-color: #333333;
    --tag-bg: #2c2c2c;
    --tag-text: #e0e0e0;
    --hover-bg: #2c2c2c;
    
    --icon-bg-blue: #152b39;
    --icon-bg-orange: #33261a;
    --icon-bg-green: #1b3320;
    
    --alert-bg: #1a2733;
    --alert-border: #1565c0;
    --alert-text: #90caf9;
}

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

html {
    scroll-behavior: smooth; /* 平滑滚动 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s; /* 暗色模式切换动画 */
}

/* 中文字体优化 */
body.lang-zh {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

.about-text a {
    color: var(--accent-color);
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s;
}

.about-text a:hover {
    border-bottom-color: var(--accent-color);
}

.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

/* =========================================
   Sidebar
   ========================================= */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto; 
    /* 隐藏滚动条逻辑 */
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-right: 1px solid var(--border-color);
    text-align: center;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.avatar img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 4px solid var(--card-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.name {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.tagline {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.sub-tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.location-tag {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    margin-top: -15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.location-tag i {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.social-icons {
    margin-bottom: 35px;
}

.social-icons a {
    font-size: 1.3rem;
    margin: 0 10px;
    color: var(--text-secondary);
}

.social-icons a:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

.nav-menu ul {
    list-style: none;
    width: 100%;
}

.nav-menu li {
    margin-bottom: 12px;
}

.nav-menu a {
    display: block;
    padding: 12px 20px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
}

.nav-menu a:hover, .nav-menu a.active {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    font-weight: 600;
}

.nav-menu i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.footer-note {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 侧边栏内的语言切换按钮 (桌面端) */
.sidebar-btn {
    margin-top: -15px; 
    margin-bottom: 25px;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.sidebar-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background-color: var(--hover-bg);
}

/* =========================================
   Main Content
   ========================================= */
.main-content {
    flex: 1;
    padding: 20px 50px 50px;
    overflow-y: auto;
}

section {
    margin-bottom: 30px;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

/* Info Cards */
.info-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: background 0.3s, box-shadow 0.3s;
}

.about-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.fun-fact {
    font-style: italic;
    color: var(--text-secondary);
    /* font-size: 1rem; */
    margin-top: 20px;
}

/* Lists */
.content-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-item {
    display: flex;
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    align-items: flex-start;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    position: relative;
}

.list-item:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.list-img {
    width: 55px;
    height: 55px;
    background: var(--bg-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-right: 25px;
    flex-shrink: 0;
    overflow: hidden;
}

.list-img img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    display: block;
}

.list-content {
    flex: 1;
}

.list-content h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-primary);
    line-height: 1.4;
}

.list-content .date {
    /* font-size: 0.9rem; */
    color: var(--text-date);
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.list-content p {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Project Stats */
.project-stats {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-weight: 500;
}

.project-stats i {
    margin-right: 5px;
    color: var(--accent-color);
}

/* Clickable Block for Pubs */
.clickable-block {
    cursor: pointer;
}
.clickable-block:hover {
    background-color: var(--hover-bg);
}

.block-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* PDF Icon */
.pdf-container {
    background-color: #ffebee;
    color: #c62828;
    z-index: 2;
    position: relative;
}
/* 暗色模式下 PDF 图标微调 */
[data-theme="dark"] .pdf-container {
    background-color: #3e2723;
    color: #ef5350;
}

/* DOI / Official Link Icon */
.doi-container {
    background-color: #e3f2fd;
    color: #1565c0;
    z-index: 2;
    position: relative;
}
/* 暗色模式下 DOI 图标微调 */
[data-theme="dark"] .doi-container {
    background-color: #0b2e59;
    color: #64b5f6;
}

/* 通用链接与悬浮动画 */
.pdf-link, .doi-link {
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.2s;
}

.pdf-link:hover, .doi-link:hover {
    transform: scale(1.2);
}

/* Publications Specific */
.pub-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}
.pub-authors {
    font-style: italic;
    color: var(--text-primary);
    opacity: 0.9;
    font-size: 1rem;
    margin-bottom: 4px;
    line-height: 1.3;
}
.envelope-icon {
    font-size: 0.7em;
    margin-left: 4px;
    color: var(--accent-color);
    vertical-align: super;
    opacity: 0.8;
}
.pub-venue {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.list-content h3 {
    margin-bottom: 4px; 
}

/* Skills & Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* 新版分组样式适配 */
.skill-group {
    margin-bottom: 20px;
}
.skill-group h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Status Alert */
.status-alert {
    background-color: var(--alert-bg); 
    border-left: 5px solid var(--alert-border); 
    color: var(--alert-text); 
    padding: 15px 20px;
    margin: 20px 0; 
    border-radius: 4px; 
    font-size: 1.1rem;
    display: flex;           
    align-items: flex-start; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    line-height: 1.5;        
}

.status-alert i {
    font-size: 1.2rem;
    margin-right: 12px;
    color: var(--alert-border);
    margin-top: 3px;     
    flex-shrink: 0;      
}

.alert-content {
    flex: 1; 
}

/* =========================================
   Floating Buttons
   适配 HTML 中的 floating-controls 结构
   ========================================= */
.floating-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002; /* 保证在最上层 */
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 12px;
    pointer-events: none; /* 容器不阻挡点击 */
}

.icon-btn {
    pointer-events: auto; /* 按钮本体可点击 */
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--card-bg); /* 跟随主题变色 */
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.3s;
}

.icon-btn:hover {
    transform: scale(1.1);
    color: var(--accent-color);
}

/* 桌面端逻辑：隐藏菜单和语言按钮，只留主题按钮 */
#menuToggle { display: none; }
/* #mobileLangToggle { display: none; } */

/* 滚动自动隐藏动画 */
.buttons-hidden {
    transform: translateX(150%);
    opacity: 0;
    pointer-events: none;
}

/* =========================================
   Mobile / Responsive Base Elements
   ========================================= */
.mobile-header {
    display: none;
}

.page-welcome {
    margin-bottom: 20px; 
    padding-left: 5px;   
}

.page-welcome h1 {
    font-weight: 700;   
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.5px; 
}

/* =========================================
   通用列表排版 (全局生效：经历/教育/奖项/助教)
   ========================================= */

/* 1. 经历与教育头部对齐 (换行靠左规则提取至全局) */
.item-header {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px 10px;
}

.item-header h3 {
    flex: 0 1 auto;
    margin-right: 5px;
    padding: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.2;
}

.item-header .info-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
}

.item-header .date {
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-date);
    font-weight: 500;
    margin-left: 0; /* 使得其可以自然换行靠左 */
    line-height: 1.2;
}

.gpa {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
    background-color: var(--tag-bg);
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1;      /* 修正胶囊高度 */
    display: inline-block;
}

.edu-activities {
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
    line-height: 1.5;
}

/* 2. 奖项与助教列表排版 (兼容逻辑提取至全局) */
.intro-list {
    list-style: none;
}

.intro-list li {
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    flex-wrap: wrap;       
    justify-content: space-between; 
    align-items: flex-start;
    gap: 5px;
    text-align: left;
}

.intro-list i {
    color: var(--accent-color);
    width: 20px;
    text-align: center;
}

.intro-list .date,
.intro-list li .date {
    white-space: nowrap;    
    flex-shrink: 0;        
    margin-left: auto;      
    color: var(--text-date);
}

/* 荣誉 (Awards) 专用逻辑：保持同行对齐，自然右浮动 */
#awards .intro-list li {
    flex-wrap: nowrap; /* 禁止图标和文字被拆分到两行 */
}

#awards .intro-list li > i {
    margin-top: 4px;
    margin-right: 8px;
    flex-shrink: 0;
}

#awards .intro-list li > span:not(.date) {
    flex: 1 1 auto;
    padding-right: 5px;
    display: block; /* 允许超长的文字在自身容器内部自然换行 */
}

/* 助教 (Teaching) 专用逻辑：块级+内联排版，日期永远跟随末尾 */
#teaching .intro-list li {
    display: block; 
    position: relative;
    line-height: 1.6;
    margin-bottom: 15px;
}

#teaching .intro-list li > div.ta-left {
    display: inline;
}

#teaching .intro-list li i {
    display: inline-block;
    margin-right: 8px;
}

#teaching .intro-list li .date {
    float: right; 
    margin-left: 10px;
    margin-top: 0; 
}

#teaching .intro-list li::after {
    content: "";
    display: table;
    clear: both;
}

/* =========================================
   代码标签
   ========================================= */
.inline-code {
    background: #f0f0f0; /* 默认浅色 */
    padding: 2px 5px;
    border-radius: 4px;
    color: #d63384;
    font-family: monospace;
    font-style: normal;
}

/* 暗色模式适配 */
[data-theme="dark"] .inline-code {
    background: #333;
    color: #ff80ab;
}

/* =========================================
   移动端响应式
   ========================================= */
@media (max-width: 768px) {
    /* 1. 字体与基础设置 */
    body { font-size: 15px; }
    .about-text, .list-content p, .intro-list li { font-size: 1rem; line-height: 1.5; }
    h2 { font-size: 1.35rem; margin-bottom: 12px; }
    .status-alert { font-size: 1rem !important; padding: 12px 15px; }
    .tags { gap: 8px; }
    .tag { font-size: 0.85rem; padding: 5px 12px; }

    /* 2. 侧边栏与菜单 */
    #menuToggle, #mobileLangToggle { display: flex; }
    #menuToggle {
        background-color: var(--accent-color);
        color: white;
        border: none;
    }
    .sidebar-btn { display: none; }
    .sidebar {
        position: fixed; left: -100%; top: 0; bottom: 0; width: 260px;
        z-index: 1001; transition: left 0.3s ease-in-out;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1); border-right: none;
        height: 100vh; overflow-y: auto;
    }
    .sidebar.active { left: 0; }
    .sidebar .profile-section { display: none; }
    .container { flex-direction: column; }
    .main-content { padding: 15px; }
    .overlay {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5); z-index: 999; display: none;
    }
    .overlay.active { display: block; }

    /* 3. Header */
    .mobile-header {
        display: flex;
        flex-wrap: wrap; 
        justify-content: space-between; 
        align-items: center; 
        background: var(--card-bg);
        padding: 10px 15px; 
        margin-bottom: 20px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        gap: 10px; 
    }

    .mobile-avatar img {
        width: 45px; height: 45px;
        border-radius: 50%;
        border: 1px solid var(--border-color);
        display: block; 
    }

    .mobile-info {
        flex: 1 1 auto; 
        display: flex;
        flex-direction: column;
        justify-content: center; 
        min-width: 150px; 
    }

    .mobile-title-row {
        display: flex;
        align-items: baseline;
        gap: 8px;
        flex-wrap: wrap; 
    }
    .mobile-title-row .name {
        font-size: 1.15rem;
        font-weight: 700;
        margin: 0;
        line-height: 1.2;
    }

    .mobile-info .location-tag {
        display: flex !important; 
        align-items: center;
        gap: 3px;
        font-size: 0.8rem;        
        white-space: nowrap;
        margin: 0;          
    }
    .mobile-info .tagline {
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin: 2px 0 0 0; 
        line-height: 1.2;
    }

    .mobile-header .social-icons {
        display: flex;
        align-items: center;
        margin: 0; 
        flex-shrink: 0;
    }

    /* 4. 经历/教育列表 */
    .list-item { padding: 18px; }
    .list-img { width: 45px; height: 45px; margin-right: 15px; }

    .item-header .date {
        font-size: 0.9rem;
    }
    
    /* 5. 奖项/助教列表 */
    .intro-list .date,
    .intro-list li .date {
        font-size: 0.9rem !important;
    }
}