:root {
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.8);
    --text-main: #1a1a1a;
    --text-light: #666666;
    --accent-color: #d9778c; 
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background: linear-gradient(-45deg, #f5f7fa, #e8ebf2, #fdfbfb, #f3e7e9);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    display: flex;
    width: 95%; 
    max-width: 1200px; 
    height: 85vh;
    gap: 20px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 左侧导航 */
.sidebar {
    width: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    flex-shrink: 0;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    /* 下面两行是强制居中的关键 */
    display: block;
    margin: 0 auto 15px auto; 
}

.email {
    font-size: 0.9rem; 
    color: var(--text-light); 
    font-weight: 500;
    letter-spacing: 0.5px;
    /* 下面三行确保邮箱文字也绝对居中，不会把头像挤歪 */
    width: 100%;
    text-align: center;
    margin: 0 auto 40px auto;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 12px 20px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.5);
    color: var(--text-main);
}

.nav-btn.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 右侧内容区 */
.content {
    flex-grow: 1;
    padding: 30px 40px; /* 减小上下内边距 */
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease;
    height: 100%; /* 让 section 占满 content 高度 */
    flex-direction: column; /* 垂直弹性布局 */
}

.section.active {
    display: flex; /* 改为 flex 以支持内部元素自适应高度 */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 首页排版 - 紧凑化调整 */
.intro { flex-shrink: 0; }
.intro h2 {
    font-size: 1.6rem;
    margin: 0 0 10px 0; /* 减小下边距 */
}
.intro p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
    margin: 0;
}

.counter-box {
    margin: 15px 0; /* 大幅减小上下边距 */
    padding: 8px 15px; 
    background: rgba(255, 255, 255, 0.85); 
    border: 1px solid rgba(217, 119, 140, 0.3); 
    border-radius: 8px;
    display: inline-block;
    align-self: flex-start; /* 靠左对齐，不拉伸 */
    box-shadow: 0 2px 10px rgba(0,0,0,0.03); 
    flex-shrink: 0;
}

.counter-box p {
    margin: 0;
    font-size: 0.85rem; 
    color: var(--text-light);
}

.highlight-num {
    font-size: 1rem; 
    font-weight: bold;
    color: var(--accent-color);
}

.heatmap-container {
    margin: 10px 0 15px 0; 
    flex-shrink: 0;
    width: 100%;
}
.heatmap-container h3 { 
    font-size: 0.9rem; 
    color: var(--text-light); 
    margin: 0 0 8px 0;
}
.heatmap {
    width: 100%;
    overflow-x: auto; /* 如果屏幕太小，允许横向滑动查看完整热力图 */
    padding-bottom: 5px;
}
.github-chart {
    min-width: 600px; /* 保证热力图不会被挤压变形 */
    height: auto;
    display: block;
    opacity: 0.9; /* 稍微透明一点，更契合玻璃拟物风 */
}

/* 弹幕与留言 - 自动填满剩余空间 */
.danmaku-container {
    margin-top: 5px;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 15px;
    background: rgba(255,255,255,0.3);
    overflow: hidden;
    flex-grow: 1; /* 核心：自动占据下方所有剩余空间 */
    display: flex;
    flex-direction: column;
    min-height: 180px; /* 防止屏幕太小时被挤没 */
}

.danmaku-screen {
    flex-grow: 1; /* 弹幕屏幕占满容器剩余高度 */
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.danmaku-item {
    position: absolute;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(255,255,255,0.8);
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    animation: moveLeft linear forwards;
}

/* 刚发送的弹幕专属样式 */
.self-danmaku {
    border: 1.5px solid var(--accent-color);
    background: #ffffff;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(217, 119, 140, 0.2);
}

@keyframes moveLeft {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

.input-area {
    display: flex;
    padding: 10px;
    gap: 10px;
    background: white;
    flex-shrink: 0;
}

.input-area input {
    flex-grow: 1;
    border: none;
    background: #f5f5f5;
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
    transition: all 0.3s;
}
.input-area input:focus { background: #eaeaea; }

.input-area button {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* 项目与博客列表简易样式 */
.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px;}
.project-card { background: rgba(255,255,255,0.5); padding: 20px; border-radius: 15px; text-decoration: none; color: inherit; transition: 0.3s;}
.project-card:hover { background: white; transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.05);}
.project-icon { font-size: 2rem; margin-bottom: 10px;}
.blog-item { padding: 15px 0; border-bottom: 1px solid rgba(0,0,0,0.05);}
.blog-date { font-size: 0.8rem; color: var(--text-light);}
.blog-item h3 { margin: 5px 0 0 0;}
.blog-item a { text-decoration: none; color: var(--text-main);}

@media (max-width: 768px) {
    .container { flex-direction: column; height: auto; margin: 20px 0; width: 95%; }
    .sidebar { width: auto; padding: 20px; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 20px;}
    .avatar { width: 60px; height: 60px; margin: 0;}
    .email { margin: 0; align-self: center;} 
    .nav-menu { flex-direction: row; justify-content: center;}
    .project-grid { grid-template-columns: 1fr; }
    .content { padding: 20px; }
}

/* 统一调整右侧所有页面（包括 Toyprojects 和 Blog）的主标题与副标题间距 */
.section h2 {
    margin-top: 0;
    margin-bottom: 4px; /* 控制主标题下方的距离，数值越小离得越近，可以改成 0 */
}

.section > p {
    margin-top: 0;      /* 移除副标题默认的顶部距离 */
    margin-bottom: 20px; /* 副标题和下方内容的距离 */
    color: var(--text-light); /* 让副标题颜色变浅一点，更有层次感 */
}