body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: #f0f0f0;
    overflow: hidden;
}
#gameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding-bottom: 20px;
}
canvas {
    background-color: #333;
    margin-top: 10px;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.5);
}
#controlCard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    gap: 10px;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    margin-bottom: 20px;
}
#startButton {
    padding: 8px 16px;
    background-color: #28a745;
    color: white;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#startButton:hover {
    background-color: #218838;
}
#scoreDisplay {
    font-size: 18px;
    color: #333;
    background-color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
}
#scorePopup {
    display: none; /* 初始隐藏 */
    position: fixed; /* 固定定位 */
    top: 50%; /* 垂直居中 */
    left: 50%; /* 水平居中 */
    transform: translate(-50%, -50%); /* 使其居中 */
    background-color: #282c34; /* 深色背景 */
    border-radius: 10px; /* 圆角 */
    padding: 20px; /* 内边距 */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5); /* 阴影效果 */
    z-index: 10; /* 确保在其他元素之上 */
    text-align: center; /* 文本居中 */
    animation: fadeIn 0.3s; /* 添加淡入动画 */
    color: #61dafb; /* 字体颜色 */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#leaderboard {
    background-color: #fff;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    max-height: 100px;
    overflow-y: auto;
    box-sizing: border-box;
    margin-top: 10px;
}

/* 新增样式以确保排行榜在游戏区域上方 */
#leaderboard {
    position: absolute;
    top: 0; /* 将排行榜置顶 */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 15px;
    z-index: 5; /* 确保在游戏区域上方 */
    height: 80px; /* 设置排行榜高度 */
    overflow: hidden; /* 隐藏溢出内容 */
    display: flex; /* 使用flex布局 */
    flex-direction: row; /* 横向排列 */
    justify-content: space-between; /* 均匀分布 */
    align-items: center; /* 垂直居中 */
    width: 90%; /* 设置排行榜宽度为90% */
    max-width: 600px; /* 最大宽度 */
}

#leaderboard h3 {
    margin: 0; /* 去掉默认的margin */
    padding: 0; /* 去掉默认的padding */
    font-weight: normal; /* 去掉加粗 */
    font-size: 16px; /* 设置字体大小为16px（可根据需要调整） */
    white-space: nowrap; /* 确保文本不换行 */
}

#leaderboardList {
    display: flex; /* 使用flex布局 */
    flex-direction: row; /* 横向排列 */
    margin: 0; /* 去掉默认的margin */
    padding: 0; /* 去掉默认的padding */
    list-style-type: none; /* 去掉列表样式 */
    justify-content: space-around; /* 均匀分布 */
    width: 100%; /* 使列表占满宽度 */
    white-space: nowrap; /* 确保条目在一行上显示 */
}

#leaderboardList li {
    height: 18px; /* 每个条目的高度 */
    line-height: 20px; /* 垂直居中 */
}

#gameContainer {
    margin-top: 95px; /* 设置游戏区域与排行榜之间的间距 */
    display: flex;
    flex-direction: column;
    align-items: center; /* 水平居中 */
}

#controlCard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    gap: 10px;
    width: 90%; /* 设置控制卡宽度为90% */
    max-width: 600px; /* 最大宽度 */
    box-sizing: border-box;
    margin-bottom: 5px;
}

#startButton {
    padding: 5px 30px; /* 设置按钮的高度为较低的值 */
    background-color: #28a745;
    color: white;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#startButton:hover {
    background-color: #218838;
}

#scoreDisplay {
    font-size: 18px;
    color: #333;
    background-color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
}

/* 输入框样式 */
#playerName {
    padding: 10px;
    border: none;
    border-radius: 5px;
    margin-top: 10px;
    width: 80%; /* 设置宽度 */
    max-width: 300px; /* 最大宽度 */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); /* 阴影效果 */
}

/* 按钮样式 */
#submitButton, #restartButton {
    padding: 10px 20px; /* 设置按钮内边距 */
    background-color: #61dafb; /* 按钮背景颜色 */
    color: #282c34; /* 按钮文字颜色 */
    border: none; /* 去掉边框 */
    border-radius: 5px; /* 圆角 */
    cursor: pointer; /* 鼠标指针样式 */
    transition: background-color 0.3s; /* 背景颜色过渡效果 */
    margin-left: 10px; /* 增加按钮间距 */
}

#submitButton:hover, #restartButton:hover {
    background-color: #21a1f1; /* 悬停时的背景颜色 */
}

/* 使弹出窗口中的内容居中 */
#scorePopup > div {
    display: flex;
    flex-direction: column;
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}
