/* 基础样式 */
body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: darkslategray;
    margin: 0;
    padding: 1em; /* 添加内边距，防止内容紧贴屏幕边缘 */
}

/* 容器布局 */
.container {
    display: flex;
    flex-direction: column; /* 移动端改为垂直布局 */
    align-items: center;
    gap: 4em;
    width: 1100px;
    padding: 1em;
}

/* 控制面板样式 */
.control-panel {
    opacity: 100%;
    border-radius: 0.5em;
    padding: 1.5em;
    width: 370px;
    box-sizing: border-box;
}

/* 规则说明区域 */
.rules {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5em;
    border-radius: 0.5em;
    color: white;
    max-width: 380px;
    box-sizing: border-box;
}

/* 规则标题样式 */
h2 {
    margin-top: 0;
    color: burlywood;
}

/* 规则段落样式 */
p {
    margin: 0.5em 0;
    font-size: 0.9em;
}

/* 棋盘区域 */
.board {
    background-color: burlywood;
    font-size: 32px; /* 减小字体大小，适应移动端 */
    border: 0.2em solid tan;
    box-shadow: 0 0.4em 2em rgba(0, 0, 0, 0.3);
}

/* 已访问格子的阴影效果 */
.shadow {
    background-color: #4e3f20 !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

/* 棋盘行样式 */
ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    display: flex;
}

/* 棋盘格子样式 */
li {
    width: 40px; /* 使用固定像素值 */
    height: 40px; /* 使用固定像素值 */
    text-align: center;
    line-height: 40px; /* 使用固定像素值 */
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center; /* 确保内容居中 */
    box-sizing: border-box; /* 确保内边距和边框不影响格子大小 */
}

/* 棋盘格子交替颜色 */
ul:nth-child(odd) li:nth-child(even),
ul:nth-child(even) li:nth-child(odd) {
    background-color: rgba(0, 0, 0, 0.3);
}

/* 数字标记样式 */
li.marked {
    font-size: 16px; /* 使用固定像素值 */
    padding: 0; /* 去除内边距 */
    margin: 0; /* 去除外边距 */
}

/* 媒体查询：平板及更大设备 */
@media (min-width: 768px) {
    .container {
        flex-direction: row; /* 大屏幕恢复水平布局 */
    }

    .board {
        font-size: 44px; /* 恢复原始字体大小 */
    }

    li {
        width: 60px;
        height: 60px;
        line-height: 50px;
    }

    li.marked {
        font-size: 24px; /* 大屏幕下调整数字标记字体大小 */
    }
}

/* 链接样式 */
a {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6); /* 设置文字透明度为60% */
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white; /* 鼠标悬停时恢复100%透明度 */
}

/* 模式选择器样式 */
.mode-selector {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.mode-btn {
    padding: 0.5em 1em;
    background-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    text-align: center;
    flex: 1;
}

/* 整体左上角圆角 */
.mode-btn:first-child {
    border-radius: 0.5em 0 0 0;
}

/* 整体右上角圆角 */
.mode-btn:last-child {
    border-radius: 0 0.5em 0 0;
}

.mode-btn.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* 游戏规则区域 */
.rules {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1.5em;
    border-radius: 0 0 0.5em 0.5em; /* 底部圆角 */
    color: white;
}

.vertical-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

label {
    display: flex;
    gap: 0.5em;
    font-size: 0.9em;
    cursor: pointer;
}

input {
    margin: 0;
    cursor: pointer;
}
