body {
    font-family: sans-serif;
    margin: 0;
    background-color: #111; /* 深黑色背景 */
    color: #eee; /* 浅灰色文字 */
    line-height: 1.6;
    overflow-x: hidden; /* 防止水平滚动 */
}

header {
    background-color: rgba(0, 0, 0, 0.8); /* 半透明黑色头部 */
    color: #fff;
    padding: 1em 2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed; /* 固定在顶部 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 100; /* 确保在内容上方 */
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

nav li {
    margin-left: 1.5em;
}

nav a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #fff;
}

main {
    padding-top: 60px; /* 留出头部的高度 */
}

.section {
    padding: 4em 2em;
    text-align: center;
}

.section h2 {
    color: #fff;
    margin-bottom: 1em;
    font-size: 2em;
}

/* 照片部分样式 */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1em;
    margin-top: 2em;
}

.photo-grid img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* 链接部分样式 */
.link-list {
    list-style: none;
    padding: 0;
}

.link-list li {
    margin-bottom: 1em;
}

.link-list a {
    display: inline-block;
    color: #bbb;
    text-decoration: none;
    padding: 0.8em 1.5em;
    border: 1px solid #333;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.link-list a:hover {
    background-color: #333;
    color: #fff;
}

.link-list i {
    margin-left: 0.5em;
}

/* 游戏部分样式 */
#game .game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#snakeCanvas {
    background-color: #222;
    border: 2px solid #555;
    border-radius: 5px;
    margin: 1em auto;
    display: block;
}

.game-controls {
    margin-top: 1em;
    display: flex;
    align-items: center;
}

#startButton {
    padding: 0.8em 1.5em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#startButton:hover {
    background-color: #45a049;
}

#score {
    margin-left: 1em;
    font-size: 1.2em;
    color: #fff;
}

/* 下载部分样式 */
.download-list {
    list-style: none;
    padding: 0;
}

.download-list li {
    margin-bottom: 1em;
}

.download-list a {
    display: inline-block;
    color: #bbb;
    text-decoration: none;
    padding: 0.8em 1.5em;
    background-color: #222;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.download-list a:hover {
    background-color: #444;
    color: #fff;
}

.download-list i {
    margin-left: 0.5em;
}

footer {
    background-color: #222;
    color: #888;
    text-align: center;
    padding: 1em;
    position: relative; /* 解决可能的固定定位元素遮挡问题 */
}