/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation; /* 新增触摸事件优化 */
}

/* 主容器-包含地图与通道指令库 */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0px;
    width: 95%; /* 使用百分比宽度 */
    max-width: 72.5%; /* 72.5%; 1200px 增大最大宽度,地图边长 */
    margin: 0 auto;
    height: 90.2vh; /* 高度 */
}

/* 左侧容器样式 */
.left-container {
    width: 100%;
    position: relative;
    margin-top: 0;
    height: 100%; /* 添加高度100% */
}

/* 右侧容器样式    */
.right-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%; /* 添加高度100%    */
    max-width: 500px; /* 设置最大宽度为500px    */
}

/* 任务地图容器样式 */
.task-map-container {
    text-align: center; /* 文字居中 */
    margin-bottom: 20px; /* 与下方游戏板的间距 */
}

/* 地图容器 */
.game-board {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1/1;
    border: 0px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: flex-start;
    position: relative;
    transition: margin-top 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    margin-top: 0 !important; /* 强制覆盖可能的动态样式 */
    transition: none !important;
}

/* 代码面板样式 */
.code-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0px;
    background: #f5f5f5;
    border-radius: 8px;
    height: 100%; /* 添加高度100% */
}

/* 通道容器 */
.channel-container {
    position: relative;
    min-width: 300px;
    z-index: 2; /* 通道容器层叠顺序高于指令库 */
    display: none;
    grid-template-columns: repeat(5, 1fr); 
    grid-template-rows: auto auto; /* 两行均自适应内容高度 */
    row-gap: 20px; /* 增大行间距（原8px→20px） */
    column-gap: 8px; /* 保持列间距不变 */
    padding: 0px;
    padding-bottom: 15px;  
    background: #e9ecef;
    border-radius: 8px;
    margin-bottom: -5px !important;
}

/* 指令库容器样式，添加可滚动效果 */
.code-blocks {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 4px;
    column-gap: 10px;
    margin: 15px 0;
    background: #e9ecef;
    border-radius: 8px;
    padding: 15px;
    height: calc(100% - 20px); /* 减去通道容器的margin-bottom */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    min-width: 300px;
    z-index: 1;
}

/* 标题容器样式（粘性定位保持在顶部） */
.game-header {
    position: sticky;
    top: 0;
    background-color: rgb(255, 255, 255);
    z-index: 200;
    padding: 5px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex; /* 使用flex布局 */
    align-items: center; /* 垂直居中对齐 */
    justify-content: space-between; /* 两端对齐 */
}

/* 任务需求容器样式 */
.task-requirement-container {
    position: fixed; /* 固定定位，相对于视口 */
    width: 100%;
    background: rgba(240, 248, 255, 0.95);
    border-radius: 0 0 8px 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 99;
    transition: transform 0.4s ease-out;
    transform: translateY(-100%); /* 初始隐藏在视口上方 */
    top: 50px; /* 标题栏高度（根据实际样式调整） */
    padding-top: 5px; /* 移除上内边距 */
}

/* 任务需求容器滑出状态 */
.task-requirement-container.slide-out {
    transform: translateY(0);
}

/* 任务需求容器的手柄 */
.task-handle {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 35px;
    padding: 0 10px;
    background: rgba(240, 248, 255, 0.8);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    transition: background-color 0.3s;
}

.task-handle:hover {
    background-color: rgba(224, 240, 255, 0.8);
}

/* 大正方形与地图比例 */
:root {
    --map-ratio: calc(48/53 * 100%); /* 默认使用4x4比例 */
}

.big-square {
    width: var(--map-ratio);
    aspect-ratio: 1/1; 
    background: transparent;
    border: 0px solid #90caf9;
    display: grid;
    grid-gap: 0;
}

/* 不同网格尺寸的样式 */
.big-square.grid-3x3 {
    grid-template-columns: repeat(3, 1fr);
}

.big-square.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.big-square.grid-5x5 {
    grid-template-columns: repeat(5, 1fr);
}

.big-square.grid-6x6 {
    grid-template-columns: repeat(6, 1fr);
}

.small-square {
    aspect-ratio: 1/1; /* 保持小正方形 */
    background: transparent; /* 无背景 */
    border: 0px solid #1f1f402d; /* 边框更细 */
    position: relative; /* 为数字绝对定位提供参考 */
    pointer-events: none; /* 让小正方形不阻挡画布事件 */
    z-index: 20;
}


/* 左下方小正方形的小鸟图片样式 */
.bird-square {
    background-position: center; /* 图片在小正方形内居中 */
    background-repeat: no-repeat; /* 图片不重复 */
}