/* 标题图片样式 */
.header-image {
    max-height: 50px; /* 调整图片高度 */
    margin-left: 20px; /* 与左侧对齐 */
}

.game-header h1 {
    font-size: clamp(1rem, 3vw, 1.5rem); /* 最小16px，最大24px，根据视口宽度自动调整 */
    margin-right: 20px; /* 与右侧对齐 */
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 18px; /* 小屏幕下的固定尺寸 */
    }
}

/* 调整指令码标题样式（可选，保持与原有标题风格一致） */
.code-panel h3 {
    margin: 15px 0; /* 调整上下边距 */
    text-align: center; /* 文字居中 */
}

.game-footer {
    text-align: center; /* 文字水平居中 */
}

.game-footer p {
    margin: 0; /* 移除段落默认边距，避免上下空白 */
}

/* 解锁关卡样式 */
.code-btn, .level-btn {
    padding: 8px 12px;
    cursor: pointer;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
}

/* 新增：当前关卡按钮样式 */
.level-btn.active {
    background: #1E88E5; /* 蓝色背景 */
    color: white; /* 白色文字 */
}

.bird-light {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.bird-light img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.small-square.highlight {
    background-color: rgba(0, 120, 255, 0.3);
    border: 2px solid #0078ff;
}

.bird-drag-clone {
    filter: drop-shadow(0 0 8px rgba(0, 120, 255, 0.5));
}

/* 代码+图片组合样式 */
.code-with-image {
    display: flex;          /* 启用弹性布局 */
    flex-direction: column; /* 子元素垂直排列 */
    align-items: center;    /* 水平居中对齐 */
    gap: 4px;               /* 调整图片和剩余数字的间距（可根据需求调小数值） */
    /* 保留原有其他样式（如宽度、边距等） */
}

.code-img {
    width: 100%; /* 改为100%覆盖父容器，消除边缘空白 */
    max-width: 120px; 
    height: auto;
    border-radius: 4px;
    cursor: pointer; 
    pointer-events: auto; 
}

.task-map-container h2 {
    font-size: 1.5rem; /* 字体大小 */
    font-weight: bold; /* 加粗 */
    color: #2c3e50; /* 深色文字 */
    margin: 0; /* 重置默认边距 */
}

.channel-square {
    aspect-ratio: 1/1;
    z-index: 2;
    border: 1px solid #e0e0e0;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 50px;
    transition: width 0.2s, height 0.2s;
}

/* 主通道标题样式 */
.channel-title {
    text-align: center; /* 文字居中 */
    font-size: 1.2rem; /* 字体大小 */
    font-weight: bold; /* 加粗 */
    color: #2c3e50; /* 深色文字 */
    margin-bottom: 10px; /* 与通道容器的间距 */
}

.channel-container {
  position: relative; /* 让底图相对容器定位 */
}

.channel-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* 宽度完全匹配容器 */
  height: 100%; /* 高度完全匹配容器 */
  z-index: 1;
  background-size: contain; /* 保持图片比例并完整显示在容器内 */
  background-repeat: no-repeat; /* 防止图片重复 */
  background-position: center; /* 图片在容器内居中显示 */
}

/* 响应式调整不同屏幕下的背景图显示 */
@media (max-width: 768px) {
  .channel-bg {
    background-size: contain; /* 保持图片比例并完整显示在容器内 */
    
  }
}

    /* 调整三个通道容器之间的间距 */
    .channel-container + .channel-container {
        margin-top: 10px; /* 可以根据需要调整这个值 */
    }

/* 修改第2个通道容器的网格布局 */
#channelContainer2 {
    /* 改为2行4列的网格布局 */
    grid-template-columns: repeat(5, 1fr); /* 保持5列网格以预留左侧空位 */
    grid-template-rows: auto auto; /* 明确设置2行 */
}

/* 选择第2个通道容器内的所有方格 */
#channelContainer2 .channel-square {
    /* 让8个方格占用每行的后4列位置 */
    grid-column: span 1;
}

/* 调整第2个通道容器内方格的排列位置（适配底图元素） */
#channelContainer2 .channel-square:nth-child(2) { grid-column: 2; grid-row: 1; }  /* 原第1个方格 */
#channelContainer2 .channel-square:nth-child(3) { grid-column: 3; grid-row: 1; }  /* 原第2个方格 */
#channelContainer2 .channel-square:nth-child(4) { grid-column: 4; grid-row: 1; }  /* 原第3个方格 */
#channelContainer2 .channel-square:nth-child(5) { grid-column: 5; grid-row: 1; }  /* 原第4个方格 */
#channelContainer2 .channel-square:nth-child(6) { grid-column: 2; grid-row: 2; }  /* 原第5个方格 */
#channelContainer2 .channel-square:nth-child(7) { grid-column: 3; grid-row: 2; }  /* 原第6个方格 */
#channelContainer2 .channel-square:nth-child(8) { grid-column: 4; grid-row: 2; }  /* 原第7个方格 */
#channelContainer2 .channel-square:nth-child(9) { grid-column: 5; grid-row: 2; }  /* 原第8个方格 */

/* 第3个通道容器右对齐设置 */
#channelContainer3 {
    /* 保持5列网格结构以预留左侧空位（适配底图元素） */
    grid-template-columns: repeat(5, 1fr);
    /* 确保只显示一行 */
    grid-template-rows: auto;
}

/* 第3个通道容器内的方格位置调整 */
#channelContainer3 .channel-square:nth-child(2) { grid-column: 2; }  /* 原第1个方格 */
#channelContainer3 .channel-square:nth-child(3) { grid-column: 3; }  /* 原第2个方格 */
#channelContainer3 .channel-square:nth-child(4) { grid-column: 4; }  /* 原第3个方格 */
#channelContainer3 .channel-square:nth-child(5) { grid-column: 5; }  /* 原第4个方格 */

/* 小方格数字样式 */
.grid-number {
    position: absolute; /* 绝对定位居中 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 精确居中 */
    font-size: 14px; /* 数字大小（根据方格尺寸调整） */
    color: #333; /* 数字颜色 */
    pointer-events: none; /* 防止数字干扰点击事件 */
}

/* 小方格圆点样式 */
.small-square .color-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

#wait-image {
    pointer-events: auto;
}

.bird-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
    position: absolute;
    top: 50%;       /* 下移父容器高度的50% */
    left: 50%;      /* 右移父容器宽度的50% */
    transform: translate(-50%, -50%); /* 向左上回退自身尺寸的50% */
    z-index: 1;
    transform-origin: center;
    transition: opacity 0.3s ease;
    pointer-events: auto; /* 确保可以接收事件 */
}

/* 防止图片被选中和拖动 */
.code-img, .channel-code-img, .bird-image, .run-code-img, .reset-code-img {
    user-select: none; /* 防止文本选中 */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    -webkit-touch-callout: none; /* iOS Safari */
}

/* 针对拖拽需要重新启用指针事件 */
.code-img.dragging, .bird-image.dragging {
    pointer-events: auto;
}

/* 通道方格内的指令图片样式 */
.channel-code-img {
    width: 100%; /* 占满通道方格宽度 */
    height: 100%; /* 占满通道方格高度 */
    object-fit: contain; /* 保持图片比例，避免拉伸 */
    margin: 0; /* 移除原有边距，确保填满方格 */
}

/* 指令码图片下方剩余数量样式（替代原文字位置） */
.code-with-image .remaining-count {
    text-align: center;
    font-size: 16px; /* 增大字体（原14px） */
    color: white;
    margin: 5px 0;
    min-height: 22px; /* 增大最小高度（原18px） */
    background-color: #2196F3;
    border-radius: 50%;
    padding: 4px 8px; /* 增大内边距（原2px 6px） */
    display: inline-block;
    aspect-ratio: 1/1;
    line-height: 1;
}

/* 悬浮运行按钮样式 */
#runCode {
    position: fixed;     /* 固定定位 */
    z-index: 999;        /* 确保按钮在最上层 */
    background: none;    /* 无背景色 */
    border: none;        /* 无边框 */
    padding: 0;          /* 无内边距 */
    cursor: pointer;     /* 手型光标 */
    transition: all 0.3s; /* 过渡动画 */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); /* 图片阴影 */
    grid-column: 1 / 6;
    justify-self: center;
    margin-top: 10px;
}

#runCode:hover {
    transform: scale(1.1); /* 悬停时放大 */
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); /* 悬停时阴影加深 */
}

/* 添加按钮执行中的样式 */
#runCode.executing {
    opacity: 0.8;
    cursor: not-allowed;
    animation: pulse 1.5s infinite;
}
  
  /* 按钮中的图片样式 */
.run-code-img {
    width: 60px;
    height: 60px;
    max-width: 80px;
    object-fit: contain;
    border-radius: 4px;
}

/* 仅小鸟图片抖动，不影响方格边框 */
.bird-image.shake-horizontal {
animation: shake-horizontal 0.5s;
}

.bird-image.shake-vertical {
animation: shake-vertical 0.5s;
}

.game-alert.show {
    opacity: 1;
}

/* 提示样式 */
.game-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: clamp(10px, 3vw, 15px) clamp(20px, 5vw, 30px);
    font-size: clamp(1rem, 5vw, 1.5rem); /* 响应式字体 */
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    text-align: center;
    min-width: min(200px, 80vw); /* 最小宽度不超过视口80% */
    max-width: 90vw; /* 最大宽度为视口90% */
    word-wrap: break-word; /* 长单词自动换行 */
}

/* 成功提示的样式 */
.game-alert.success {
    background-color: rgb(11, 147, 201); /* 修改为天蓝色 */
    color: white;
}

/* 错误提示的样式 */
.game-alert.error {
    background-color: rgba(255, 0, 0, 0.85);
    color: white;
}

/* 警告提示的样式 */
.game-alert.warning {
    background-color: rgba(255, 215, 0, 0.9);
    color: #333;
}

.channel-square-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* 宽度与通道方格一致 */
    height: 100%; /* 高度与通道方格一致 */
    background-size: contain; /* 保持图片比例，完整显示在方格内 */
    background-repeat: no-repeat; /* 避免图片重复 */
    background-position: center; /* 图片在方格内居中 */
    z-index: 0; /* 确保底图在指令图片下方 */
}

.channel-square .code-img {
    position: relative;
    z-index: 3; /* 代码图片层级设为2，确保在底图上方 */
}

/* 添加指令码圆点指示器样式 */
.channel-square::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #cccccc; /* 灰色 */
    transition: background-color 0.3s;
    z-index: 2;
}

.channel-square.blue-dot::after {
    background-color: #1E88E5; /* 蓝色 */
}

/* 拖拽相关样式 */
.code-img.dragging {
    opacity: 0.8;/* 新增放大代码，1.1 表示放大到原尺寸的 1.1 倍 */
    pointer-events: none;
 
 }

.channel-square.drag-over {
    border: 2px dashed #1E88E5;
    border-radius: 4px;
    transition: border 0.2s;
}/* 拖拽虚线框 */

.code-img:active {
transform: none !important;
outline: none !important;
}

.drag-placeholder {
background-color: rgba(0, 0, 0, 0);
border-radius: 4px;
display: inline-block;
vertical-align: top;
}

/* 速度保存设置容器样式 */
.speed-save-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 8px;
    background-color: rgba(30, 136, 229, 0.1);
    border-radius: 4px;
}

.speed-save-container input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.speed-save-container label {
    margin: 0;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    user-select: none;
}

/* 速度控制滑块样式 */
.speed-control-panel {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-width: 280px;
    transition: transform 0.3s ease;
    transform-origin: bottom right;
    border: 1px solid #e0e0e0;
}

.speed-control-panel.collapsed {
    transform: scale(0.9);
    opacity: 0.7;
}

.speed-control-panel:hover {
    transform: scale(1);
    opacity: 1;
}

.speed-control {
    margin-bottom: 15px;
}

.speed-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.speed-control .speed-value {
    margin-left: 10px;
    font-weight: bold;
    color: #1E88E5;
    font-size: 0.9rem;
}

.speed-control input[type="range"] {
    width: 100%;
    height: 6px;
    margin: 8px 0;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #1E88E5;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #1565C0;
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #1E88E5;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

.speed-control input[type="range"]::-moz-range-thumb:hover {
    background: #1565C0;
}

/* 关闭按钮样式 */
.speed-panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    z-index: 101;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
}

.speed-panel-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.level-title {
    background-color: #1E88E5; /* Same blue as active level button */
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px 0;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.task-requirement-container nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.level-buttons-container {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 5px;
    max-width: calc(100% - 60px); /* 减去箭头宽度 */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* 隐藏滚动条 - Firefox */
}

.level-buttons-container::-webkit-scrollbar {
    display: none; /* 隐藏滚动条 - Chrome/Safari */
}

.scroll-arrow {
    background: transparent;
    border: none;
    color: #1E88E5;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    z-index: 1;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.scroll-arrow:hover {
    color: #0d47a1;
    transform: scale(1.2);
}

.scroll-arrow:disabled {
    color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* 需求弹窗 */
.task-requirement-container p {
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
    cursor: pointer; /* 添加指针样式 */
    padding: 8px; /* 增加内边距方便点击 */
    border-radius: 4px; /* 圆角 */
    transition: background-color 0.3s; /* 过渡效果 */
}

.task-requirement-container p:hover {
    background-color: rgba(30, 136, 229, 0.1); /* 悬停效果 */
}

/* 任务需求弹窗样式 */
.task-requirement-popup {
    resize: none;
    z-index: 999; /* 比普通弹窗低一级 */
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    padding: 20px !important;
    min-width: 200px;
    max-width: 90vw;
    width: auto;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2) !important;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(10px) !important;
    cursor: move !important;
}

#gameAlert {
    display: none;
    pointer-events: none;
}

#gameAlert.show {
    display: block;
    pointer-events: auto;
}

.task-requirement-popup .resize-handle {
    position: absolute;
    width: 10px;
    height: 100%;
    top: 0;
    cursor: col-resize;
    z-index: 10;
}

.task-requirement-popup .resize-handle.left {
    left: -5px;
}

.task-requirement-popup .resize-handle.right {
    right: -5px;
}

.task-requirement-popup .popup-content,
.task-requirement-popup .note-panel {
    width: 100%;
    box-sizing: border-box;
}

.task-requirement-popup .close-btn {
    position: absolute;
    top: -10px;
    right: 5px;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.task-requirement-popup .close-btn:hover {
    color: #333;
    transform: scale(1.2);
}

.task-requirement-popup h3 {
    margin-bottom: 15px;
    color: #1E88E5;
    font-size: 1.1rem;
    text-align: center;
    padding-bottom: 8px;
}

/* 添加笔记按钮样式 */
.note-btn {
    position: absolute;  /* 绝对定位 */
    bottom: 0px;      /* 位于窗口下方 */
    left: 50%;          /* 水平居中 */
    transform: translateX(-50%);  /* 精确居中 */
    cursor: pointer;
    color: #1E88E5;
    transition: all 0.3s;
    padding: 5px 15px;
    font-size: 1.5rem;
    z-index: 1;  /* 确保在窗口上方 */
}

.note-btn:hover {
    transform: translateX(-50%) scale(1.2);  /* 悬停放大效果 */
}

/* 笔记面板样式 */
.note-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0 0 8px 8px;
    margin-bottom: 5px;  /* 为底部按钮留出空间 */
}

.note-panel.show {
    max-height: 300px;
    padding: 10px;
}

#userNote {
    width: calc(100% - 16px); /* 减去padding */
    height: 120px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    margin-bottom: 10px;
}

.note-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.note-buttons button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.note-save-btn {
    background-color: #4CAF50;
    color: white;
}

.note-save-btn:hover {
    background-color: #3e8e41;
}

.note-clear-btn {
    background-color: #f44336;
    color: white;
}

.note-clear-btn:hover {
    background-color: #d32f2f;
}

.note-feedback-btn {
    background-color: #FFC107;
    color: #333;
}

.note-feedback-btn:hover {
    background-color: #FFA000;
}

/* 当前关卡徽章样式 */
.task-handle .current-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background-color: #1E88E5; /* 与活动关卡按钮相同的蓝色 */
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    margin-left: 8px;
    margin-right: 4px;
}

/* 调整手柄内部元素的垂直对齐 */
.task-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* 绘图工具样式 */
.drawing-tools {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #ddd;
    margin-top: 10px;
}

.drawing-tool {
    cursor: pointer;
    font-size: 1.5rem;
    color: #555;
    transition: all 0.3s;
    padding: 5px;
    border-radius: 4px;
    background: rgba(255,255,255,0.8);
}

.drawing-tool:hover {
    color: #1E88E5;
    transform: scale(1.1);
    background: rgba(30, 136, 229, 0.1);
}

.drawing-tool[data-tool="color"] {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #ddd;
}

/* 绘图画布样式 */
.drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* 确保画布能接收事件 */
    z-index: 1;
}

/* 使游戏板可绘图 */
.game-board.drawing-mode {
    position: relative;
}

.game-board.drawing-mode .big-square {
    pointer-events: auto;
}

/* 全局运行按钮样式 */       
.global-run-btn img {
    width: 60px;
    height: 60px;
}

/* 修改放大镜容器样式 */
.magnifier-container {
    position: fixed;
    height: 80%;
    aspect-ratio: 1/1; 
    border: 3px solid #1E88E5;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    z-index: 1000;
    display: none;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.magnifier-view {
    width: 100%;
    height: 100%;
    background-size: 400% 400%; /* 4倍放大 */
    background-repeat: no-repeat;
    transform: scale(1);
    transform-origin: center center;
}

/* 关闭按钮样式 */
.magnifier-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    background-color: rgba(65, 105, 225, 0.8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 1001;
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    transition: all 0.3s ease; /* 添加过渡效果使变化更平滑 */
}

.magnifier-close:hover {
    background-color: rgba(65, 105, 225, 1); /* 不透明度变为1 */
    transform: scale(1.1); /* 轻微放大效果 */
    box-shadow: 0 0 10px rgba(65, 105, 225, 0.6); /* 添加阴影效果 */
}

/* 速度控制滑块样式 */
.speed-control-panel {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-width: 280px;
    transition: transform 0.3s ease;
    transform-origin: bottom right;
}

/* 关闭按钮样式 */
.speed-panel-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    z-index: 101;
}

.speed-panel-close:hover {
    color: #333;
    transform: scale(1.2);
}

.speed-control {
    position: relative;
    padding-top: 10px; /* 为关闭按钮留出空间 */
    margin-bottom: 10px;
}

/* 经过方格样式 */
.small-square.passed-square {
    background-color: rgba(0, 255, 0, 0.3) !important;
    transition: background-color 0.5s ease;
}

/* 障碍方格样式 */
.small-square.obstacle-square {
    background-color: rgba(255, 0, 0, 0.3) !important;
    border: 2px dashed #ff0000 !important;
    animation: pulse-obstacle 2s infinite;
}

/* 任务导航箭头容器 */
.task-nav-arrows {
    display: flex;
    align-items: center;
    justify-content: center; /* 改为居中而不是两端对齐 */
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    position: relative;
    gap: 0px; /* 添加间距 */
}

/* 任务导航箭头按钮 */
.task-nav-arrow {
    background: transparent;
    border: none;
    color: #1E88E5;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 0px; /* 添加左右边距 */
}

/* 标题居中 */
.task-nav-arrows h3 {
    margin: 0;
    color: #1E88E5;
    font-size: 1.1rem;
    text-align: center;
    padding: 0 5px; /* 增加左右内边距 */
}

/* 关闭按钮位置调整 */
.task-nav-arrows .close-btn {
    position: absolute;
    top: -5px;
    right: 0;
}

/* 任务弹窗箭头禁用样式 */
.task-nav-arrow.disabled-arrow {
    color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.task-nav-arrow:disabled {
    color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* 富文本样式支持 */
.task-requirement-container p {
    line-height: 1.6;
    word-wrap: break-word;
}

.task-requirement-container p strong,
.task-requirement-container p b {
    font-weight: bold;
}

.task-requirement-container p em,
.task-requirement-container p i {
    font-style: italic;
}

.task-requirement-container p u {
    text-decoration: underline;
}

.task-requirement-container p code {
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.task-requirement-container p a {
    color: #0066cc;
    text-decoration: underline;
}

.task-requirement-container p a:hover {
    color: #004499;
}

.task-requirement-container p img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 5px 0;
}

/* 弹窗中的富文本样式 */
.popup-content {
    line-height: 1.6;
    overflow-y: auto;
    max-height: 200px;
}

.popup-content strong,
.popup-content b {
    font-weight: bold;
}

.popup-content em,
.popup-content i {
    font-style: italic;
}

.popup-content u {
    text-decoration: underline;
}

.popup-content code {
    background-color: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.popup-content a {
    color: #0066cc;
    text-decoration: underline;
}

.popup-content a:hover {
    color: #004499;
}

.popup-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 5px 0;
}
/* 富文本结束 */

/* 关卡最后任务提示框样式 */
.swal-deny-button {
    color: white; /* 确保文字颜色为白色 */
    transition: all 0.3s ease;
}

.swal-deny-button:hover {
    background-color: #218838; /* 悬停时的颜色 */
}

/* 障碍物脉动动画 */
@keyframes pulse-obstacle {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
}

/* 经过障碍方格时的样式（可选） */
.small-square.obstacle-square.passed-square {
    background-color: rgba(255, 100, 100, 0.5) !important;
    animation: none;
}

/* 响应式调整放大镜大小 */
@media (max-width: 768px) {
    .magnifier-container {
    width: 90vw; /* 90% 视窗宽度 */
    height: 90vw; /* 高度 = 宽度 */
    }
     .game-container {
        max-width: 95% ;
    }
}

/* 中等屏幕及以上调整布局 */
@media (min-width: 768px) {
    .game-container {
        flex-direction: row;
    }
    
    .left-container {
        width: 60%;
        margin-right: 0px;
    }
    
    .right-container {
        width: 40%;
        max-width: 450px; /* 不超过500px */
    }
}

@media (max-width: 480px) {
    .game-alert {
        font-size: 1rem;
        padding: 8px 16px;
    }
    
    .task-requirement-popup h3 {
        font-size: 1rem !important;
    }
    
    .task-requirement-popup .popup-content {
        font-size: 0.9rem !important;
    }
}

/* 等待图片的缩放动画 */
    @keyframes scale-in-out {
    0% {
      transform: translate(-50%, -50%) scale(0.9);
      opacity: 0.8;
    }
    50% {
      transform: translate(-50%, -50%) scale(1);
      opacity: 1;
    }
    100% {
      transform: translate(-50%, -50%) scale(0.9);
      opacity: 0.8;
    }
  }
  
    /* 定义脉动动画 */
  @keyframes pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(0,0,0,0.7)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(0,0,0,0.7)); }
  }
  
  /* 水平抖动（对应北/南方向） */
    @keyframes shake-horizontal {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
    }
    
    /* 垂直抖动（对应东/西方向） */
    @keyframes shake-vertical {
    0%, 100% { transform: translateY(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateY(-5px); }
    20%, 40%, 60%, 80% { transform: translateY(5px); }
    }