/* 菜单显隐按钮样式 */
#toggleMenu {
    position: fixed;
    top: 20px;  /* 设置距离顶部的间距，可以根据需要调整 */
    left: 50%;  /* 水平居中 */
    transform: translateX(-50%);  /* 通过 translateX 使按钮精确水平居中 */
    z-index: 100;
}

/* 使地图容器正常显示 */
#map {
    position: relative;
    height: 100vh;
    background-color: #121212;
    transition: margin-left 0.3s ease;
}

#map .ol-viewport {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 菜单的样式 */
.sidenav {
    position: absolute; /* 保持绝对定位 */
    top: 100px; /* 菜单距离顶部的距离 */
    left: 20px; /* 菜单距离左边的距离 */
    width: 600px; /* 菜单宽度 */
    background-color: rgba(20, 20, 20, 0.9); /* 更深的半透明背景，增强对比度 */
    border-radius: 15px; /* 圆角 */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7); /* 更柔和的阴影 */
    padding: 20px;
    z-index: 10; /* 保证菜单在地图上方 */
    transition: all 0.3s ease; /* 优化过渡效果，涵盖所有属性变化 */

    max-height: 75vh; /* 稍微增加最大高度限制 */
    overflow-y: auto; /* 启用垂直滚动条 */
}

/* 菜单文字样式优化 */
.sidenav h4 {
    margin-bottom: 15px;
    color: #4e92ff;
    text-align: center;
    font-weight: bold;
    font-size: 20px; /* 增大字体以提高可读性 */
}

.sidenav label,
.sidenav .checkbox input,
.sidenav .input {
    color: #e0e0e0; /* 文字颜色保持亮度一致 */
    font-size: 14px; /* 调整字体大小 */
}

.sidenav .checkbox input:checked {
    accent-color: #4e92ff;
}

/* 输入框、选择框、按钮样式优化 */
.input, .select, .button {
    border-radius: 8px; /* 增大圆角 */
    margin-bottom: 12px;
    background-color: #2c2c2c; /* 更深的背景色，与整体一致 */
    color: #fff;
    border: 1px solid #444;
    padding: 8px 10px; /* 增加内边距，提高舒适度 */
    font-size: 14px; /* 调整字体大小 */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.input:focus, .select:focus {
    background-color: #444;
    border-color: #4e92ff;
}

/* 去除下拉框背景宽度和高度的异常 */
.sidenav .select {
    position: relative; /* 使下拉框容器定位 */
    width: 100%; /* 保证下拉框的宽度和父容器一致 */
    padding: 0; /* 去除默认的 padding */
    background-color: transparent; /* 背景透明，使用原生下拉框的背景 */
    border: 1px solid #444; /* 边框颜色 */
    border-radius: 8px; /* 圆角 */
}

.sidenav .select select {
    width: 100%; /* 保证 select 的宽度和父容器一致 */
    padding: 8px; /* 设置适当的内边距 */
    font-size: 14px; /* 设置字体大小 */
    background-color: #2c2c2c; /* 设置背景颜色 */
    color: #fff; /* 设置文字颜色 */
    border: none; /* 去掉下拉框的默认边框 */
    border-radius: 8px; /* 圆角 */
}

.sidenav .select select:focus {
    outline: none; /* 去掉聚焦时的默认边框 */
    background-color: #444; /* 设置聚焦时的背景颜色 */
    border-color: #4e92ff; /* 设置聚焦时的边框颜色 */
}

/* 滚动条样式优化 */
.sidenav::-webkit-scrollbar {
    width: 10px; /* 略增滚动条宽度 */
    background-color: rgba(0, 0, 0, 0.1); /* 背景更浅 */
}

.sidenav::-webkit-scrollbar-thumb {
    background-color: rgba(100, 100, 100, 0.5); /* 更深的灰色滚动条 */
    border-radius: 5px;
}

.sidenav::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 100, 100, 0.8); /* 悬停时滚动条更深 */
}

/* 响应式布局优化 */
@media (max-width: 1024px) {
    /* 平板设备布局调整 */
    .sidenav {
        width: 80%; /* 使用更宽的百分比宽度 */
        left: 10%; /* 居中对齐 */
        top: 20px; /* 更紧凑的顶部间距 */
        max-height: 70vh; /* 调整高度限制 */
    }

    .sidenav h4 {
        font-size: 18px; /* 调整标题字体大小 */
    }

    .select, .input {
        width: 100%; /* 保持输入框宽度自适应 */
    }

    .scoreboard {
        width: 80%; /* 使计分板在平板设备上自适应 */
        top: 40px; /* 计分板距离顶部调整 */
        left: 10%; /* 计分板居中 */
    }
}

@media (max-width: 768px) {
    /* 手机设备布局调整 */
    .sidenav {
        width: 90%; /* 使用更宽的百分比宽度 */
        left: 5%; /* 居中对齐 */
        top: 20px; /* 更紧凑的顶部间距 */
        max-height: 60vh; /* 调整高度限制 */
    }

    .sidenav h4 {
        font-size: 16px; /* 调整标题字体大小 */
    }

    .select, .input {
        width: 100%; /* 保持输入框宽度自适应 */
    }

    .scoreboard {
        width: 90%; /* 使计分板在手机设备上自适应 */
        top: 60px; /* 调整计分板距离顶部的间距 */
        left: 5%; /* 计分板居中 */
        max-height: 60vh; /* 限制计分板的最大高度 */
    }

    .scoreboard table {
        font-size: 14px; /* 调整表格字体大小 */
    }

    .scoreboard th, .scoreboard td {
        padding: 10px; /* 调整表格单元格的内边距 */
    }
}

/* 右上角计分板样式 */
.scoreboard {
    position: fixed;
    top: 20px;
    right: 20px;
    border-radius: 15px;
    padding: 20px;
    z-index: 20;
    width: auto; /* 宽度根据内容自动调整 */
    max-height: 500px; /* 增加最大高度 */
    overflow-y: auto;
    overflow-x: hidden; /* 防止水平滚动 */
    background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* 添加柔和阴影 */
}

.scoreboard table {
    width: auto; /* 表格宽度根据内容自动调整 */
    color: #ffffff; /* 使整个表格的字体颜色为白色 */
    border-collapse: collapse;
    font-size: 16px; /* 增加字体大小 */
    margin-top: 10px;
    background-color: rgba(0, 0, 0, 0.6); /* 表格的半透明黑色背景 */
    border-radius: 10px; /* 表格边框圆角 */
    overflow: hidden; /* 防止内容溢出表格圆角 */
}

.scoreboard th {
    background-color: rgba(0, 0, 0, 0.8); /* 表头更深的半透明黑色背景 */
    font-weight: bold;
    font-size: 18px; /* 增加表头字体大小 */
    color: #ffffff; /* 表头文字颜色 */
    padding: 15px 20px;
    white-space: nowrap; /* 禁止换行 */
    text-align: center; /* 表头文字居中对齐 */
}

.scoreboard td {
    font-size: 16px;
    color: #ffffff; /* 字体颜色为白色 */
    background-color: rgba(0, 0, 0, 0.6); /* 单元格半透明黑色背景 */
    white-space: nowrap; /* 禁止换行 */
    text-align: center; /* 单元格文字居中对齐 */
    padding: 10px 15px; /* 单元格内间距 */
}

/* 鼠标悬停效果 */
.scoreboard tr:hover {
    background-color: rgba(255, 255, 255, 0.1); /* 悬停时的轻微高亮 */
    cursor: pointer;
}

/* 滚动条样式 */
.scoreboard::-webkit-scrollbar {
    width: 8px;
    background-color: transparent; /* 滚动条背景透明 */
}

.scoreboard::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3); /* 滚动条样式，半透明 */
    border-radius: 5px;
}

.scoreboard::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5); /* 悬停时滚动条样式 */
}

/* 屏幕唤醒状态指示器样式 */
.screen-wake-status {
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
}

.screen-wake-status:hover {
    transform: scale(1.05);
    background: rgba(0, 0, 0, 0.9) !important;
}

/* 移动端屏幕唤醒状态指示器优化 */
@media (max-width: 768px) {
    .screen-wake-status {
        font-size: 10px !important;
        padding: 3px 8px !important;
        top: 5px !important;
        right: 5px !important;
    }
    
    /* 确保在移动端菜单按钮不会与状态指示器重叠 */
    #toggleMenu {
        top: 10px !important;
        left: 10px !important;
        transform: none !important;
        font-size: 12px;
        padding: 5px 10px;
    }
}
