/* ====== [ styles.css ] ====== */
/* =========================================
   0. 游戏主界面 (Main Menu)
   ========================================= */
#gameMainMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    z-index: 10000000; /* 提升至 1000w，确保覆盖 999w 的加载条 */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.menu-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 40px 60px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
}

.game-title {
    font-size: 48px;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 2px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 200px;
}

.menu-btn {
    padding: 12px 24px;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn.primary {
    background-color: #2ecc71;
    color: white;
}

.menu-btn.primary:hover {
    background-color: #27ae60;
    transform: scale(1.05);
}

.menu-btn.secondary {
    background-color: #3498db;
    color: white;
}

.menu-btn.secondary:hover:not(:disabled) {
    background-color: #2980b9;
    transform: scale(1.05);
}

.menu-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

.menu-footer {
    margin-top: 30px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

/* =========================================
   1. 全局基础样式 (Global)
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 0;
    margin: 0;
    background-color: #f4f4f4;
    min-height: 100vh;
}

/* =========================================
   2. 顶部素材抽屉 (Sprite Drawer)
   ========================================= */
#spriteDrawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 4px solid #007bff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 200000 !important;
    /* 最高层级 */
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: 85vh;
    overflow-y: auto;
}

#spriteDrawer.open {
    transform: translateY(0);
}

.drawer-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.sprite-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 8px;
}

#tilemapSelector {
    padding: 5px;
    font-size: 14px;
    min-width: 200px;
}

#spriteSheetContainer {
    position: relative;
    border: 2px solid #ccc;
    background: #e0e0e0 url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPgo8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSIjZmZmIi8+CjxwYXRoIGQ9Ik0wIDBINFY0SDB6bTQgNGg0djRINHoiIGZpbGw9IiNlZWUiLz4KPC9zdmc+');
    display: inline-block;
    cursor: crosshair;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#activeSpriteSheet {
    display: block;
    max-width: 100%;
}

.selection {
    position: absolute;
    border: 2px solid red;
    background-color: rgba(255, 0, 0, 0.2);
    pointer-events: none;
}

#closeDrawerBtn {
    margin-left: 15px;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

#closeDrawerBtn:hover {
    color: #000;
}

/* =========================================
   3. 主工具栏 (Main Toolbar)
   ========================================= */
.main-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    color: white;
    z-index: 5000 !important;
    box-sizing: border-box;
}

#main-toolbar-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 7px;
    background-color: #c28222;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.main-toolbar::-webkit-scrollbar {
    height: 0px;
    background: transparent;
}

.main-toolbar button {
    padding: 3px 8px;
    flex-shrink: 0;
    border: 1px solid #555;
    background: #47549c;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.main-toolbar button:hover {
    background-color: #5562aa;
    border-color: #fff;
}

.main-toolbar button:active {
    transform: translateY(1px);
}

.main-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 激活工具按钮时的样式 */
.btn-active {
    background-color: #ffc107 !important;
    color: #000 !important;
    border: 2px solid #fff !important;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    transform: scale(1.05);
}

/* =========================================
   4. 画布与视口容器 (Viewport & Canvas)
   ========================================= */
#mapContainer {
    margin-top: 80px;
}

#map-wrapper {
    position: relative;
    margin-top: 52px;
    margin-bottom: 0;
    width: 1888px;
    min-height: calc(100vh - 52px);
    padding: 24px 0 0;
    background-color: transparent;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#canvas-settings-bar {
    position: fixed;
    top: 54px;
    left: 18px;
    transform: none;
    z-index: 1002;
    flex: 0 0 auto;
}

#mapCanvas {
    width: 1888px;
    height: 896px;
    display: grid;
    grid-template-columns: repeat(118, 16px);
    grid-auto-rows: 16px;
    background-color: #fafaf9;
    cursor: none;
    border: none;
    position: relative;

    /* 变换与渲染优化 */
    transform-origin: center center !important;
    transition: transform 0.1s ease-out;
    flex-shrink: 0;
    margin: auto;
    backface-visibility: hidden;
    will-change: transform;

    /* 核心：设为 auto 让浏览器平滑处理 */
    image-rendering: auto !important;

    /* 交互核心 */
    pointer-events: auto !important;
    overflow: visible !important;
}

/* 画布边框浮层 — 不挡交互，不被溢出子元素遮挡 */
#mapCanvas::after {
    content: '';
    position: absolute;
    inset: 0;
    outline: 4px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 999999;
}

/* 4.1 层级结构与点击穿透逻辑 (Layer System) */

/* 底层：背景图层 */
#bgLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* 穿透，点到下一层 */
}

#bgLayer .ref-building {
    pointer-events: auto;
    /* 背景图实体可点击 */
}

/* 中层：瓦片层 */
.tile {
    width: 16px;
    height: 16px;
    background-size: auto;
    background-repeat: no-repeat;
    background-position: 0 0;
    position: relative;
    z-index: 5;
    pointer-events: none;
    /* 默认穿透，方便操作背景 */
}

.tile.show-grid {
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

/* 顶层：普通建筑/参考层 */
#referenceLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* 容器穿透 */
}

/* =========================================
   5. 游戏实体与交互元素 (Entities & Interaction)
   ========================================= */

/* 5.1 通用可交互建筑/物体 */
.ref-building {
    position: absolute;
    pointer-events: auto !important;
    /* 恢复点击 */
    cursor: grab;
    border: 1px dashed rgba(0, 0, 255, 0.0);
    box-sizing: border-box;
    transition: box-shadow 0.2s, border 0.2s;
}

.ref-building:hover {
    border: 1px dashed blue;
    box-shadow: 0 0 10px rgba(0, 0, 255, 0.3);
    z-index: 510;
}

.ref-building.is-dragging {
    opacity: 0.6;
    z-index: 600;
    border: 2px solid red;
    cursor: grabbing;
}

.ref-building.editor-multi-selected {
    border: 1px dashed rgba(255, 145, 0, 0.96);
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.55), 0 0 18px rgba(255, 153, 0, 0.26);
    z-index: 520;
}

.ref-building.editor-multi-selected:hover {
    border-color: rgba(255, 145, 0, 1);
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.62), 0 0 20px rgba(255, 153, 0, 0.3);
}

/* 5.2 碰撞块 (Collision Block) */
.collision-block {
    position: absolute;
    background: none;
    pointer-events: none;
    box-sizing: border-box;
}

body.editor-mode .collision-block {
    background-color: rgba(255, 0, 0, 0.4);
    border: 2px solid red;
    pointer-events: auto;
    cursor: grab;
    z-index: 10000;
}

body.editor-mode .ref-building {
    transition: none;
}

body.editor-mode .ref-building:hover {
    border: 1px dashed rgba(0, 102, 255, 0.55);
    box-shadow: none;
    z-index: auto;
}

body.editor-mode .collision-block:hover {
    background-color: rgba(255, 0, 0, 0.4);
    border-color: red;
    box-shadow: none;
}

body.editor-mode .collision-block.is-dragging {
    background-color: rgba(255, 0, 0, 0.6);
    border-color: yellow;
}

body.debug-mode .collision-block {
    background-color: rgba(0, 255, 0, 0.3);
    border: 1px solid green;
}

/* 5.3 编辑器主角 (Test Character) */
#editorCharacter {
    position: absolute;
    width: 96px;
    height: 144px;
    background-image: url('images/player_spritesheet.png');
    background-position: -96px 0;
    background-repeat: no-repeat;
    z-index: 8000;
    pointer-events: auto;
    cursor: move;
    opacity: 0.9;
    transform-origin: bottom center;
    transform: scale(0.38);
}

#editorCharacter.in-room {
    transform: scale(0.8);
}

#editorCollisionBox {
    position: absolute;
    border: 2px solid #00ff00;
    background-color: rgba(0, 255, 0, 0.2);
    pointer-events: none;
    width: 20px;
    left: 38px;
    height: 10px;
    top: 127px;
    /* 修正后的高度 */
}

#editorCharacter.colliding #editorCollisionBox {
    border: 3px solid #00ff00;
    background-color: rgba(0, 255, 0, 0.5);
    z-index: 100001;
}

/* 5.4 辅助光标 (Ghost Cursor) */
#ghostCursor {
    position: fixed;
    pointer-events: none !important;
    display: none;
    z-index: 1000;
    opacity: 0.8;
    border: 2px solid transparent;
    box-sizing: content-box;
    top: 0;
    left: 0;
    contain: layout paint style;
    will-change: transform, left, top;
    overflow: visible;
}

#ghostCursor.eraser-mode {
    background: rgba(255, 0, 0, 0.3);
    border: 2px solid red;
}

#ghostCursor.brush-mode {
    border: none;
    outline: 1px dashed yellow;
    background-repeat: no-repeat;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.ghost-template-canvas {
    display: block !important;
    position: absolute;
    inset: 0;
    pointer-events: none;
    image-rendering: pixelated;
}

.sprite-view-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
    image-rendering: pixelated;
}

.ref-building.dynamic-preview {
    overflow: visible;
}

/* 5.5 右键选区 */
#rightDragBox {
    position: absolute;
    display: none;
    z-index: 1500;
    pointer-events: none;
    background-color: rgba(0, 123, 255, 0.2);
    border: 2px dashed #007bff;
}

#rightDragBox.eraser-mode {
    background-color: rgba(220, 53, 69, 0.2);
    border: 2px dashed #dc3545;
}

.editor-context-menu {
    position: fixed;
    display: none;
    width: max-content;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(50, 100, 180, 0.95);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(6px);
    z-index: 12000;
}

.editor-context-menu button {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    color: #f8fbff;
    text-align: left;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.editor-context-menu button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.editor-context-menu button[data-action="delete-selected"]:hover:not(:disabled) {
    background: rgba(255, 80, 80, 0.3);
}

.editor-context-menu button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* =========================================
   6. 控制手柄与标签 (Handles & Labels)
   ========================================= */

/* 缩放手柄 */
.resize-handle {
    width: 12px;
    height: 12px;
    background-color: #ff9800;
    border: 1px solid #fff;
    position: absolute;
    right: -6px;
    bottom: -6px;
    cursor: nwse-resize;
    z-index: 601;
    display: none;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.ref-building:hover .resize-handle,
.ref-building.is-dragging .resize-handle {
    display: block;
}

/* 旋转手柄 */
.rotate-handle {
    position: absolute;
    top: -40px;
    height: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    /* 热区加宽 */
    background-color: transparent;
    z-index: 10000;
    display: none;
    cursor: grab;
}

.rotate-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background-color: #007bff;
    transform: translateX(-50%);
}

.rotate-handle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background-color: #ffffff;
    border: 2px solid #007bff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.ref-building:hover .rotate-handle,
.ref-building.is-dragging .rotate-handle,
.ref-building.is-rotating .rotate-handle {
    display: block;
}

.ref-building.is-rotating .rotate-handle {
    cursor: grabbing;
}

.ref-building.is-rotating .rotate-handle::before {
    background-color: #ff0000;
}

.ref-building.is-rotating .rotate-handle::after {
    border-color: #ff0000;
}

/* 标签预览 - 同步游戏中的样式 */
.editor-label-preview {
    position: absolute;
    font-size: 12px;
    background: rgba(255, 187, 0, 0.7);
    /* 同步游戏：0.7 透明度黄底 */
    color: #0004ff;
    /* 同步游戏：亮蓝色文字 */
    padding: 1px 4px;
    /* 同步游戏：内边距 */
    border-radius: 3px;
    /* 同步游戏：小圆角 */
    border: none;
    /* 同步游戏：去除白边框 */

    /* 核心定位 */
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 5000;
    user-select: none;

    /* 编辑器特有交互 */
    pointer-events: auto !important;
    cursor: move;
    transition: background 0.2s;
}

.editor-label-preview:hover {
    background: rgba(255, 187, 0, 1.0);
    /* 悬停时加深，方便识别 */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* 门预览 */
.editor-door-preview {
    position: absolute;
    border: 2px solid #ff00ff;
    background: rgba(255, 0, 255, 0.3);
    pointer-events: auto !important;
    cursor: move;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    user-select: none;
}

.editor-door-preview:hover {
    background: rgba(255, 0, 255, 0.5);
    border-color: #fff;
}

.door-resize-handle {
    width: 8px;
    height: 8px;
    background-color: white;
    border: 1px solid #ff00ff;
    position: absolute;
    right: -4px;
    bottom: -4px;
    cursor: nwse-resize;
    z-index: 4001;
}

/* 层数标记 */
.layer-count-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Arial', sans-serif;
    font-size: 10px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    pointer-events: none;
    z-index: 200;
    user-select: none;
}

/* =========================================
   7. 状态与模式覆盖 (State Overrides)
   ========================================= */

/* 7.1 绘画模式 (Drawing Mode) */
body.drawing-mode .tile {
    pointer-events: auto !important;
    cursor: inherit;
}

body.drawing-mode .ref-building {
    pointer-events: none !important;
    opacity: 0.8;
}

body.drawing-mode #bgLayer,
body.drawing-mode #referenceLayer {
    pointer-events: none !important;
}

/* 7.2 背景编辑模式 (BG Edit Mode) */
body.bg-edit-active #bgLayer {
    z-index: 2000 !important;
}

body.bg-edit-active #referenceLayer,
body.bg-edit-active .tile {
    opacity: 0.3;
    pointer-events: none !important;
}

/* 未按下调整背景时：背景图不可交互 (无拖拽、缩放、右键、hover) */
body:not(.bg-edit-active) #bgLayer .ref-building {
    pointer-events: none !important;
}
body:not(.bg-edit-active) #bgLayer .ref-building:hover {
    border-color: transparent !important;
    box-shadow: none !important;
}

/* 7.3 路径录制模式 (Picking Mode) */
#path-picking-status {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: #00ff00;
    padding: 10px 20px;
    border-radius: 50px;
    z-index: 6000;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border: 2px solid #00ff00;
}

#stop-picking-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

#stop-picking-btn:hover {
    background: #0056b3;
}

body.picking-mode #mapCanvas {
    cursor: crosshair !important;
    pointer-events: auto !important;
}

/* 录制模式下禁用干扰元素 */
body.picking-mode .ref-building,
body.picking-mode .collision-block,
body.picking-mode .editor-door-preview,
body.picking-mode .editor-label-preview,
body.picking-mode .resize-handle,
body.picking-mode .rotate-handle,
body.picking-mode .door-resize-handle {
    pointer-events: none !important;
}

/* 路径点样式 */
.path-point-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #ff0000;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 7000;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0);
    }

    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 7.4 连线拖拽模式 */
body.dragging-connection .connection-line.connected {
    pointer-events: none !important;
}

/* =========================================
   8. UI 组件与弹窗 (UI Components & Modals)
   ========================================= */

/* 通用弹窗覆盖层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

/* 通用弹窗内容 */
.modal-content {
    background: white;
    width: 900px;
    /* 大尺寸 */
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.close-modal {
    cursor: pointer;
    font-size: 24px;
    color: #999;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-actions {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
}

/* 表单元素 */
fieldset {
    border: 1px solid #ecf0f1;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    background: #ffffff;
}

legend {
    font-weight: bold;
    color: #007bff;
    padding: 0 5px;
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#group-room .form-row > .col {
    min-width: 180px;
}

#group-room .room-door-row > .col {
    min-width: 120px;
}

.col label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.col input,
.col select {
    padding: 8px 10px;
    border: 1px solid #dfe4ea;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #2f3542;
}

.col input:focus,
.col select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.small-input {
    width: 80px !important;
    min-width: 80px !important;
    flex: 0 0 auto !important;
    text-align: left;
    padding: 6px !important;
}

.checkbox-row {
    align-items: center;
    padding-top: 5px;
}

.checkbox-row label {
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.type-group {
    display: none;
    /* JS控制显示 */
    background-color: #f9fbfd;
    border-color: #cce5ff;
}

/* 自定义下拉框 */
.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    height: 30px;
}

.select-trigger:hover {
    border-color: #007bff;
}

.thumb-preview {
    width: 24px;
    height: 24px;
    object-fit: contain;
    background: #eee;
    margin-right: 8px;
    border: 1px solid #ddd;
    border-radius: 2px;
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 3000;
    display: none;
}

.select-options.open {
    display: block;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.option-item:last-child {
    border-bottom: none;
}

.option-item:hover {
    background-color: #f0f8ff;
}

.option-item.selected {
    background-color: #e7f1ff;
    font-weight: bold;
    color: #007bff;
}

.option-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background: #f9f9f9;
    margin-right: 10px;
    border: 1px solid #eee;
}

/* 坐标显示器 */
#coord-display {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #00ff00;
    padding: 8px 15px;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 16px;
    font-weight: bold;
    z-index: 6000;
    pointer-events: none;
    user-select: none;
    border: 1px solid #333;
}

/* 全局路径视图 */
.global-path-line {
    fill: none;
    stroke: #ff00ff;
    stroke-width: 2;
    stroke-dasharray: 8, 4;
    stroke-opacity: 0.6;
}

.global-path-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #ff00ff;
    border: 1px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 5001;
    opacity: 0.9;
    pointer-events: auto !important;
    cursor: grab;
    transition: transform 0.1s;
}

.global-path-dot:hover {
    transform: translate(-50%, -50%) scale(1.3);
    background-color: #ff55ff;
}

.global-path-dot.is-dragging {
    cursor: grabbing;
    background-color: #ffffff;
    border-color: #ff00ff;
}

/* =========================================
   9. 素材库选择弹窗 (Asset Grid Modal)
   ========================================= */
#assetSelectionModal {
    z-index: 200003 !important;
}

#assetSelectionModal .modal-content {
    max-height: 85vh;
    margin: auto;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.asset-trigger-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    min-width: 180px;
    height: 36px;
    transition: all 0.2s;
}

.asset-trigger-btn:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.asset-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 15px;
    padding: 10px;
    max-height: 55vh;
    overflow-y: auto;
    border-top: 1px solid #eee;
}

/* 素材库分类标签 */
.asset-tab {
    padding: 7px 14px;
    border: 1px solid #ddd;
    border-bottom: none;
    background: #eee;
    color: #666;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
}
.asset-tab:hover { background: #f0f0f0; color: #333; }
.asset-tab.active {
    background: #fff !important;
    color: #007bff !important;
    border-top: 3px solid #007bff;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

.asset-card {
    border: 2px solid #eee;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
    background: #fff;
}

.asset-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.asset-card.selected {
    border-color: #007bff;
    background-color: #e7f1ff;
}

.asset-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 8px;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPgo8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSIjZmZmIi8+CjxwYXRoIGQ9Ik0wIDBINFY0SDB6bTQgNGg0djRINHoiIGZpbGw9IiNlZWUiLz4KPC9zdmc+');
}

.asset-card span {
    font-size: 12px;
    color: #333;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

/* 服务器自带素材右下角“示例”标记 */
.asset-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    display: none;
}
.asset-card:hover .asset-delete-btn {
    display: block;
}
.asset-badge-local {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(76, 217, 100, 0.88);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    pointer-events: none;
}
.asset-badge-example {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(255,152,0,0.88);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    pointer-events: none;
}


/* 卡片需要 relative 定位才能让 absolute 的标记对齐 */
.asset-card {
    position: relative;
}

/* 动态角色控制按钮 */
.asset-card.dynamic-card {
    height: auto !important;
    padding-bottom: 5px;
}

.aspect-btn-group {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    width: 100%;
}

.aspect-btn {
    font-size: 10px;
    padding: 2px 4px;
    border: 1px solid #ccc;
    background: #f8f9fa;
    border-radius: 3px;
    cursor: pointer;
    color: #555;
    transition: all 0.1s;
    white-space: nowrap;
}

.aspect-btn:hover {
    background: #e7f5ff;
    border-color: #339af0;
    color: #1c7ed6;
    transform: translateY(-1px);
}

.aspect-btn[data-type="load"]:hover {
    border-color: #40c057;
    color: #2b8a3e;
}

.aspect-btn[data-type="graphic"]:hover {
    border-color: #fab005;
    color: #f08c00;
}

.aspect-btn[data-type="motion"]:hover {
    border-color: #be4bdb;
    color: #9c36b5;
}

/* 动画预览画布 */
.anim-preview-canvas {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPgo8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSIjZmZmIi8+CjxwYXRoIGQ9Ik0wIDBINFY0SDB6bTQgNGg0djRINHoiIGZpbGw9IiNlZWUiLz4KPC9zdmc+');
    border: 1px solid #ccc;
    /* ★ 预览框同步改为 auto，防止预览图也出现虚线 ★ */
    image-rendering: auto;
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* =========================================
   10. 节点编辑器 (Node Editor)
   ========================================= */

/* 10.1 节点编辑器专用弹窗覆盖 */
#controlModal .modal-content {
    width: 95vw !important;
    height: 92vh !important;
    /* 默认高度 */
    max-width: none !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    /* 增加过渡效果 */
    transition: height 0.2s ease-out;
}

/* =========================================
   13. 蓝图弹窗收起模式 (UI Fixes)
   ========================================= */

/* 1. 修复默认高度，移除 HTML 内联样式后的默认值 */
#controlModal .modal-content {
    width: 95vw;
    /* 默认宽 */
    height: 92vh;
    /* 默认高 (统一高度，解决忽高忽低问题) */
    max-width: none;
    max-height: none;
    display: flex;
    flex-direction: column;
    transition: height 0.2s ease-out, width 0.2s ease-out;
    /* 增加宽度过渡 */
}

/* 2. 收起模式下的遮罩层 */
#controlModal.collapsed-pointer-pass {
    background-color: transparent !important;
    backdrop-filter: none !important;
    /* ★关键：强制移除模糊，变清晰 */
    pointer-events: none;
    justify-content: flex-start;
    padding-top: 10px;
}

/* 3. 收起模式下的内容框 */
#controlModal.collapsed-pointer-pass .modal-content {
    pointer-events: auto;
    width: auto !important;
    /* ★关键：宽度自适应，不再是固定的 400px */
    min-width: 200px;
    /* 给个最小宽 */
    height: auto !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    /* 边框细一点 */
    background-color: rgba(255, 255, 255, 0.9);
    /* 稍微透明一点点，不挡视野 */
}

#controlModal.collapsed-pointer-pass .close-modal {
    display: none;
}

#controlModal.collapsed-pointer-pass #blueprintChainNav,
#controlModal.collapsed-pointer-pass #blueprintChainPager {
    display: none !important;
}

#controlModal.collapsed-pointer-pass .modal-header {
    padding: 6px 12px;
    min-height: 36px;
    gap: 6px;
}

#controlModal.collapsed-pointer-pass .modal-header h3 {
    font-size: 14px;
    line-height: 1.1;
    margin-right: 0;
    flex: 1 1 auto;
}

#controlModal.collapsed-pointer-pass .modal-header > div:last-child {
    gap: 6px !important;
    height: 22px !important;
}

#controlModal .modal-header {
    padding: 8px 14px;
    gap: 8px;
    align-items: center;
}

#controlModal .modal-header h3 {
    flex: 0 1 auto;
    margin-right: 2px;
    font-size: 15px;
    line-height: 1.15;
    white-space: nowrap;
}

#controlModal #blueprintChainNav {
    min-height: 24px;
    max-height: 52px;
}

#controlModal #blueprintChainPager {
    display: none;
    align-self: center;
}

#controlModal .bp-chain-page-btn {
    width: 19px;
    height: 18px;
    padding: 0;
    border: 1px solid #c9a227;
    background: linear-gradient(180deg, #fff7cc, #ffe48a);
    color: #6b4d00;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#controlModal .bp-chain-page-btn:hover {
    background: linear-gradient(180deg, #ffeaa7, #ffd86b);
}

#controlModal .bp-chain-page-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

#controlModal .close-modal {
    font-size: 22px;
    line-height: 1;
}

/* 10.2 画布与变换层 */
#nodeGraphCanvas {
    width: 100%;
    height: 100%;
    background-color: #f0f2f5;
    background-image: radial-gradient(#cbd5e0 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    user-select: none;
    cursor: grab;
}

#nodeGraphCanvas:active {
    cursor: grabbing;
}

#graphTransformLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    pointer-events: none;
}

#graphTransformLayer .graph-node,
#graphTransformLayer svg {
    pointer-events: auto;
}

/* 10.3 节点样式 */
.graph-node {
    position: absolute;
    width: 220px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e4e8;
    color: #333;
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    flex-direction: column;
    cursor: grab;
    z-index: 10;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.1s;
}

.graph-node:active {
    cursor: grabbing;
    transform: scale(1.02);
}

.graph-node.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

.node-header {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    padding: 10px;
    border-radius: 8px 8px 0 0;
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
}

.node-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.node-control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #555;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: 1px solid #ced4da;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 1px;
    left: 1px;
    transition: transform 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active {
    background-color: #28a745;
    border-color: #28a745;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* 状态点 */
.node-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #adb5bd;
}

/* 激活/非激活状态 */
.graph-node.active-node .node-header {
    background: linear-gradient(to bottom, #d4edda, #c3e6cb);
    color: #155724;
    border-bottom-color: #c3e6cb;
}

.graph-node.active-node .node-status-dot {
    background-color: #28a745;
    box-shadow: 0 0 5px #28a745;
}

.graph-node.inactive-node .node-header {
    background: linear-gradient(to bottom, #f8d7da, #f5c6cb);
    color: #721c24;
    border-bottom-color: #f5c6cb;
}

.graph-node.inactive-node .node-status-dot {
    background-color: #dc3545;
    box-shadow: 0 0 5px #dc3545;
}

/* 10.4 端口样式 (Ports) */
.node-port {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #555;
    position: absolute;
    top: 19px !important;
    /* 统一垂直居中 */
    cursor: crosshair;
    transition: transform 0.1s, border-color 0.1s;
    z-index: 20;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.graph-node[data-id="node-boot"] .port-out {
    top: 19px !important;
    /* 强制 Boot 节点对齐 */
}

.node-port:hover {
    transform: scale(1.4);
    border-color: #fff;
    background-color: #007bff;
}

.node-port.connected {
    background-color: #28a745;
    border-color: #28a745;
}

.port-in {
    left: -6px;
}

.port-out {
    right: -6px;
}

/* 10.5 连线样式 (Lines) */
#graphSvgLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.connection-line {
    fill: none;
    stroke: #999;
    stroke-width: 4px;
    /* 默认粗细 */
    transition: stroke-width 0.2s, stroke 0.2s;
    stroke-linecap: round;
    cursor: pointer;
    pointer-events: stroke;
    /* 确保能点到线 */
}

/* 已连接的稳定线条 */
.connection-line.connected {
    stroke: #007bff;
    stroke-width: 5px;
}

.connection-line.connected:hover {
    stroke-width: 8px;
    stroke: #ff4d4d;
}

/* 拖拽中的虚线 */
.connection-line.active {
    stroke: #28a745;
    stroke-width: 4px;
    stroke-dasharray: 5, 5;
    pointer-events: none;
}

/* 10.6 右键菜单 */
#graphContextMenu {
    position: absolute;
    background: #ffffff;
    border: 1px solid #d1d1d1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 5px 0;
    z-index: 10000;
    display: none;
    width: 160px;
}

.ctx-item {
    padding: 10px 15px;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctx-item:hover {
    background-color: #f1f3f5;
    color: #007bff;
}

.ctx-item.disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background-color: #fff;
}

/* 10.7 节点类型配色 */
.graph-node[data-type="decoration"] .node-header {
    background: linear-gradient(to bottom, #ffe8cc, #ffd8a8);
    color: #d9480f;
    border-bottom-color: #ffc078;
}

.graph-node[data-type="decoration"] .node-status-dot {
    background-color: #fd7e14;
}

.graph-node[data-type="room"] .node-header {
    background: linear-gradient(to bottom, #d0ebff, #a5d8ff);
    color: #1864ab;
    border-bottom-color: #74c0fc;
}

.graph-node[data-type="room"] .node-status-dot {
    background-color: #228be6;
}

.graph-node[data-type="collider"] .node-header {
    background: linear-gradient(to bottom, #ffe3e3, #ffc9c9);
    color: #c92a2a;
    border-bottom-color: #ffa8a8;
}

.graph-node[data-type="collider"] .node-status-dot {
    background-color: #fa5252;
}

.graph-node[data-type="dynamic"] .node-header {
    background: linear-gradient(to bottom, #f3d9fa, #eebefa);
    color: #862e9c;
    border-bottom-color: #da77f2;
}

.graph-node[data-type="dynamic"] .node-status-dot {
    background-color: #be4bdb;
}

.graph-node[data-type="player"] .node-header {
    background: linear-gradient(to bottom, #d3f9d8, #b2f2bb);
    color: #2b8a3e;
    border-bottom-color: #8ce99a;
}

.graph-node[data-type="player"] .node-status-dot {
    background-color: #40c057;
}

.graph-node[data-type="timer"] .node-header {
    background: linear-gradient(to bottom, #e3fafc, #c5f6fa);
    color: #0b7285;
    border-bottom-color: #99e9f2;
}

.graph-node[data-type="timer"] .node-status-dot {
    background-color: #22b8cf;
}

.graph-node[data-type="background"] .node-header {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    color: #495057;
    border-bottom-color: #dee2e6;
}

.node-target-info {
    font-size: 11px;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px;
    border-radius: 4px;
    margin-bottom: 5px;
    word-break: break-all;
    border: 1px dashed rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.2s;
}

.node-target-info:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.5);
}

.node-target-info strong {
    display: block;
    margin-bottom: 2px;
    color: #555;
    font-size: 10px;
}

.node-input-time {
    width: 70px;
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 11px;
    text-align: right;
    color: #333;
    font-family: monospace;
}

/* =========================================
   11. 画布设置与缩放 UI (Canvas Controls)
   ========================================= */

/* 左侧设置栏 */
#canvas-settings-bar {
    position: fixed;
    top: 54px;
    left: 20px;
    min-height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 2px 9px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    z-index: 1001;
    font-size: 10px;
    pointer-events: auto;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 500;
}

#canvas-settings-bar .item-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spinner {
    -moz-appearance: textfield;
    appearance: textfield;
}

#canvas-settings-bar .adjust-btn {
    background: #e9ecef;
    border: 1px solid #ccc;
    color: #555;
    width: 18px;
    height: 19px;
    line-height: 15px;
    padding: 0;
    font-size: 9px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

#canvas-settings-bar .adjust-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

#canvas-settings-bar .adjust-btn:active {
    background: #0056b3;
    color: white;
}

#canvas-settings-bar input[type="number"] {
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    border-radius: 3px;
    padding: 0;
    font-size: 11px;
    height: 17px;
    line-height: 19px;
    box-shadow: none;
    width: 34px !important;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

#canvas-settings-bar .scene-meta-group {
    gap: 4px;
}

#canvas-settings-bar .scene-meta-input {
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    border-radius: 3px;
    padding: 0 6px;
    font-size: 11px;
    height: 17px;
    line-height: 17px;
    box-shadow: none;
    width: 68px;
}

#canvas-settings-bar .scene-name-input {
    width: 84px;
}

#canvas-settings-bar .scene-meta-input:focus {
    border-color: #007bff;
    outline: none;
}

#canvas-settings-bar input[type="number"]:focus {
    border-color: #007bff;
    outline: none;
}

#canvas-settings-bar button {
    background: #007bff;
    border: none;
    color: white;
    padding: 0 8px;
    height: 17px;
    line-height: 17px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: background 0.2s;
}

#canvas-settings-bar button:hover {
    background: #0056b3;
}

#canvas-settings-bar .canvas-inline-tool-btn {
    height: 17px;
    line-height: 17px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

#canvas-settings-bar .canvas-inline-tool-btn:hover {
    filter: brightness(0.94);
}

#canvas-settings-bar #toggleGrid.canvas-inline-tool-btn,
#canvas-settings-bar #toggleLayerNumbersBtn.canvas-inline-tool-btn,
#canvas-settings-bar #togglePathsBtn.canvas-inline-tool-btn,
#canvas-settings-bar #toggleReference.canvas-inline-tool-btn {
    background: #5c6f82;
    border-color: #4c5e70;
}

#canvas-settings-bar .vert-sep {
    width: 1px;
    height: 14px;
    background: #ddd;
    margin: 0 3px;
}

#canvas-settings-bar input[type="range"] {
    height: 2px;
    border-radius: 1px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
    appearance: none;
    border: 0.5px solid #ced4da;
    width: 60px !important;
    margin: 0;
}

#canvas-settings-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3);
    margin-top: -2px;
}

/* 右侧缩放控制栏 */
#zoom-control-panel {
    position: fixed;
    top: 54px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 2px 8px;
    min-height: 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    z-index: 1001;
    font-size: 12px;
    font-family: 'Segoe UI', sans-serif;
    min-width: 200px;
}

#zoom-control-panel input[type="range"] {
    width: 50px;
    height: 4px;
    border-radius: 2px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: none;
}

#zoom-control-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#zoom-control-panel #zoom-value-text {
    min-width: 35px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

/* =========================================
   12. 画布管理弹窗 (New Canvas Modal)
   ========================================= */
.canvas-action-btn {
    height: 19px !important;
    padding: 0 8px !important;
    border-radius: 3px !important;
    border: none !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.canvas-action-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

#add-canvas-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
}

#add-canvas-btn:hover {
    background: linear-gradient(135deg, #27ae60, #219150) !important;
}

#del-canvas-btn {
    background: linear-gradient(135deg, #ff4d4d, #e60000) !important;
}

#del-canvas-btn:hover {
    background: linear-gradient(135deg, #e60000, #cc0000) !important;
}

#newCanvasModal .modal-content {
    width: 380px !important;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

#newCanvasModal .modal-header {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    padding: 18px 25px;
    border-bottom: 1px solid #eee;
}

#newCanvasModal .modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 0.5px;
}

#newCanvasModal .modal-body {
    padding: 25px;
}

#newCanvasModal .form-group {
    margin-bottom: 18px;
}

#newCanvasModal .form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #95a5a6;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#newCanvasModal input {
    width: 100%;
    background: #fdfdfd;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: #2c3e50;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

#newCanvasModal input:focus {
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

#newCanvasModal .form-group-row {
    display: flex;
    gap: 15px;
    margin-bottom: 18px;
}

#newCanvasModal .modal-footer {
    padding: 15px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#newCanvasModal .modal-footer button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#cancelNewCanvasBtn {
    background: #eee;
    border: none;
    color: #666;
}

#cancelNewCanvasBtn:hover {
    background: #e0e0e0;
}

#confirmNewCanvasBtn {
    background: #3498db;
    border: none;
    color: white;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

#confirmNewCanvasBtn:hover {
    background: #2980b9;
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
    transform: translateY(-1px);
}

/* 下拉菜单基础样式 */
/* ====== 核心修复：允许下拉菜单溢出显示 ====== */
/* --- 1. 提升工具栏层级，确保压过缩放条 --- */
.main-toolbar {
    z-index: 5000 !important;
    overflow: visible !important;
}

#main-toolbar-content {
    overflow: visible !important;
}

/* --- 2. 下拉菜单基础样式 (默认隐藏) --- */
.dropdown-content {
    display: none;
    /* 默认关闭 */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff !important;
    min-width: 220px;
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 999999 !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 0;
    margin-top: 5px;
}

/* --- 3. 关键：当拥有 .show 类时才显示 --- */
.dropdown-content.show {
    display: block !important;
}

.dropdown-content button {
    background-color: #ffffff !important;
    color: #333 !important;
    padding: 12px 16px !important;
    width: 100%;
    text-align: left;
    border: none !important;
    font-size: 14px !important;
    cursor: pointer;
    display: block;
}

.dropdown-content button:hover {
    background-color: #f1f1f1 !important;
    color: #007bff !important;
}

.project-folder-menu {
    min-width: 180px;
    z-index: 1000000 !important;
}

.project-folder-menu button[data-action="reset"] {
    color: #d35400 !important;
    font-weight: 700;
}

/* --- 强制所有游戏内的图片使用高质量平滑缩放 --- */
/* 1. 通用设置：开启平滑模式，重置性能提示 */
.building-img,
.dynamic-npc,
#editorCharacter {
    image-rendering: auto !important;
    image-rendering: -webkit-optimize-contrast !important;
    /* Chrome 优化 */
    will-change: auto;
    /* 牺牲一点性能换取画质 */
}

/* 2. 仅针对【建筑图片】和【动态NPC】：移除 transform (主要是移除 translateZ) */
/* 这样可以消除它们缩放时的锯齿 */
.building-img,
.dynamic-npc {
    transform: none;
}

/* 3. ★★★ 修复点：编辑器主角 (Test Character) ★★★ */
/* 千万不要对它设置 transform: none，否则它会变回巨大的原图尺寸 */
/* 我们只需让它保持默认 CSS 里的 scale(0.38) 即可，这里什么都不用写，或者显式写回缩放 */
#editorCharacter {
    /* 确保它不使用 GPU 加速的 translateZ 即可，保留 scale */
    /* 如果之前被覆盖了，这里强制声明一下：*/
    transform: scale(0.38);
}

/* 室内模式下的主角缩放 (确保不被覆盖) */
#editorCharacter.in-room {
    transform: scale(0.8);
}

/* 确保画布本身也是平滑的 */
#mapCanvas {
    image-rendering: auto !important;
}

/* 导出配置节点的特殊样式 */
.graph-node[data-type="export_config"] .node-header {
    background: linear-gradient(to bottom, #e0e0e0, #cfcfcf);
    color: #333;
    border-bottom-color: #999;
}

.graph-node[data-type="export_config"] .node-status-dot {
    background-color: #333;
    box-shadow: 0 0 5px #000;
}

.graph-node[data-type="export_config"] {
    border: 2px solid #666;
}

/* 搜索栏容器 */
/* ====== 搜索栏组件样式 ====== */
/* 搜索栏容器 */
#game-search-bar {
    position: absolute;
    display: none;
    /* 默认隐藏 */
    width: 320px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    /* 强阴影 */
    border: 3px solid #007bff;
    /* 蓝色粗边框确保可见 */
    padding: 10px;
    z-index: 9999999 !important;
    /* 强制最顶层 */
    animation: popIn 0.2s ease-out;
}

/* 引擎切换器 */
#game-search-switcher {
    width: 75px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    font-size: 12px;
    color: #333;
    outline: none;
    cursor: pointer;
    padding-left: 2px;
}

#game-search-switcher:hover {
    background-color: #e9ecef;
}

/* 简单的弹出动画 */
@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 内部布局 */
.search-bar-inner {
    display: flex;
    gap: 8px;
    position: relative;
    align-items: center;
}

/* 输入框 */
#game-search-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    color: #333 !important;
    /* 强制黑色文字 */
    background: #fff !important;
    height: 32px;
}

/* 搜索按钮 */
#game-search-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
    height: 32px;
    padding: 0 10px;
}

#game-search-btn:hover {
    background: #0056b3;
}

/* 关闭按钮 (红叉) */
#game-search-close {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 26px;
    height: 26px;
    background: #ff4d4d;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    cursor: pointer;
    font-weight: bold;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    user-select: none;
}

#game-search-close:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* 作用范围编辑器覆盖层 (选中的那个框) */
.hitbox-overlay {
    position: absolute;
    border: 2px solid #00ff00;
    /* 绿色边框 */
    background-color: rgba(0, 255, 0, 0.1);
    /* 淡淡的绿底，不要太浓 */
    pointer-events: none;
    z-index: 20000;
    display: none;
}

/* 所有的绿色视觉引导框 (未选中的那些框) */
.hitbox-visual-guide {
    /* 保持清晰，只显示细线 */
    border: 1px dashed rgba(0, 255, 0, 0.7) !important;
    background-color: rgba(0, 255, 0, 0.05) !important;
}

/* ★★★ 修改：进入范围编辑模式时的物体样式 ★★★ */
body.hitbox-mode .ref-building {
    /* 移除之前的 opacity 和 grayscale，消除“雾气”感 */
    cursor: pointer;
    /* 加上过渡动画，让交互更顺滑 */
    transition: box-shadow 0.1s, transform 0.1s;
}

/* 鼠标悬停在物体上时，加个绿色外发光提示 */
body.hitbox-mode .ref-building:hover {
    outline: 2px solid #00ff00;
    z-index: 19000 !important;
    /* 悬停时临时置顶，方便点击 */
}

/* 当前正在编辑的物体 */
body.hitbox-mode .ref-building.selected-for-hitbox {
    /* 选中时更明显的发光 */
    box-shadow: 0 0 15px #00ff00;
    z-index: 19999 !important;
    /* 确保手柄不被遮挡 */
}

/* 8个绿色拖拽手柄 */
.hit-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #00ff00;
    border: 1px solid #fff;
    z-index: 20001;
    pointer-events: auto;
    /* 必须能点 */
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* 手柄位置定义 */
.hit-n {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.hit-s {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.hit-w {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: w-resize;
}

.hit-e {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: e-resize;
}

.hit-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.hit-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.hit-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.hit-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* ★★★ 新增：作用范围模式下，隐藏传送门预览和它的手柄 ★★★ */
body.hitbox-mode .editor-door-preview {
    display: none !important;
}

.combat-range-guide {
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 18950;
    box-sizing: border-box;
}

.combat-detect-range {
    border: 2px dashed rgba(52, 152, 219, 0.95);
    background: rgba(52, 152, 219, 0.08);
    box-shadow: 0 0 0 1px rgba(52, 152, 219, 0.2) inset;
}

.combat-attack-range {
    border: 2px solid rgba(255, 99, 71, 0.95);
    background: rgba(255, 99, 71, 0.12);
    box-shadow: 0 0 16px rgba(255, 99, 71, 0.18);
}

.combat-range-label {
    position: absolute;
    left: 50%;
    top: 50%;
    pointer-events: none;
    z-index: 18960;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.combat-detect-label {
    background: rgba(41, 128, 185, 0.9);
}

.combat-attack-label {
    background: rgba(231, 76, 60, 0.92);
}

.combat-info-card {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, calc(-100% - 14px));
    min-width: 132px;
    max-width: 196px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(16, 20, 26, 0.88);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    color: #eef3f7;
    pointer-events: none;
    z-index: 18970;
    backdrop-filter: blur(4px);
}

.combat-info-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    margin-bottom: 4px;
}

.combat-info-role {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff5ea;
    background: linear-gradient(135deg, rgba(255, 159, 67, 0.95), rgba(231, 76, 60, 0.92));
}

.combat-info-row {
    font-size: 11px;
    line-height: 1.45;
    color: rgba(238, 243, 247, 0.92);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 3px;
    margin-top: 3px;
}

body.combat-range-mode .ref-building {
    cursor: default;
    transition: box-shadow 0.12s, transform 0.12s, outline-color 0.12s;
}

body.combat-range-mode .ref-building:not(.dynamic-preview):not([data-role="enemy"]) {
    opacity: 0.78;
}

body.combat-range-mode .ref-building:hover {
    outline: 2px solid rgba(255, 159, 67, 0.95);
    z-index: 19000 !important;
}

body.combat-range-mode .editor-door-preview {
    display: none !important;
}

.spawn-point-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.spawn-point-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 240px;
    height: 240px;
    margin-left: -120px;
    margin-top: -120px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 159, 67, 0.78);
    background: radial-gradient(circle, rgba(255, 159, 67, 0.1) 0%, rgba(255, 159, 67, 0.04) 48%, rgba(255, 159, 67, 0) 72%);
    box-sizing: border-box;
}

.spawn-point-core {
    position: relative;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fffdf8;
    background: linear-gradient(135deg, #ff9f43, #ee5253);
    box-shadow: 0 6px 18px rgba(238, 82, 83, 0.28);
}

.spawn-point-template {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -54px);
    max-width: 136px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(30, 85, 180, 0.9);
    color: #fff6ea;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    z-index: 2;
}

.spawn-point-meta {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, 28px);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.spawn-point-wave,
.spawn-point-count {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(45, 60, 165, 0.86);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.spawn-point-group {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, 56px);
    max-width: 132px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #7a4b12;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 12px rgba(122, 75, 18, 0.14);
    z-index: 2;
}

.ref-building.spawn-group-highlight {
    box-shadow: 0 0 0 3px rgba(255, 184, 77, 0.55), 0 0 24px rgba(255, 159, 67, 0.22);
}

.ref-building.spawn-group-highlight .spawn-point-ring {
    border-color: rgba(255, 184, 77, 0.96);
    background: radial-gradient(circle, rgba(255, 184, 77, 0.14) 0%, rgba(255, 184, 77, 0.06) 48%, rgba(255, 184, 77, 0) 72%);
}

.ref-building.spawn-group-selected {
    box-shadow: 0 0 0 4px rgba(255, 99, 71, 0.72), 0 0 30px rgba(238, 82, 83, 0.34);
    z-index: 19020 !important;
}

.ref-building.spawn-group-selected .spawn-point-ring {
    border-color: rgba(255, 99, 71, 0.98);
    background: radial-gradient(circle, rgba(255, 99, 71, 0.18) 0%, rgba(255, 99, 71, 0.08) 48%, rgba(255, 99, 71, 0) 72%);
}

.spawn-group-link-overlay {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 18980;
}

.spawn-group-link-line {
    stroke: rgba(255, 184, 77, 0.85);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 8 8;
    filter: drop-shadow(0 3px 8px rgba(255, 159, 67, 0.18));
}

.spawn-group-link-line.is-active-link {
    stroke: rgba(255, 99, 71, 0.95);
    stroke-width: 5;
    stroke-dasharray: 0;
}

.spawn-group-link-badge circle {
    fill: rgba(24, 28, 36, 0.92);
    stroke: rgba(255, 184, 77, 0.92);
    stroke-width: 2;
}

.spawn-group-link-badge text {
    fill: #fff4e8;
    font-size: 11px;
    font-weight: 700;
}

.spawn-group-link-badge.is-active-badge circle {
    fill: rgba(231, 76, 60, 0.96);
    stroke: rgba(255, 245, 234, 0.96);
}

.spawn-group-browser {
    margin-top: 2px;
    padding: 8px;
    border: 1px solid #d7e6f6;
    border-radius: 8px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
}

.spawn-group-browser-title {
    margin-bottom: 6px;
    color: #4f6b85;
    font-size: 11px;
    font-weight: 700;
}

.spawn-group-browser-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 168px;
    overflow-y: auto;
}

.spawn-group-browser-item {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #c8d7e8;
    border-radius: 7px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.spawn-group-browser-item:hover {
    border-color: #7aa7d8;
    box-shadow: 0 6px 16px rgba(62, 115, 173, 0.12);
    transform: translateY(-1px);
}

.spawn-group-browser-item.is-active {
    border-color: #f08c55;
    box-shadow: 0 0 0 2px rgba(240, 140, 85, 0.14);
    background: linear-gradient(180deg, #fffaf6 0%, #fff3ea 100%);
}

.spawn-group-browser-main {
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.spawn-group-browser-name {
    color: #25364a;
    font-size: 12px;
    font-weight: 700;
}

.spawn-group-browser-meta,
.spawn-group-browser-template {
    color: #6b7b8d;
    font-size: 11px;
    line-height: 1.35;
}

.spawn-group-browser-waves {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.spawn-group-browser-wave {
    padding: 4px 7px;
    border: 1px solid #ccd9e6;
    border-radius: 999px;
    background: #f7fbff;
    color: #48627c;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.spawn-group-browser-wave span {
    color: #7a8897;
    font-size: 10px;
}

.spawn-group-browser-wave:hover {
    border-color: #7aa7d8;
    background: #eef6ff;
}

.spawn-group-browser-wave.is-current-wave {
    border-color: #f08c55;
    background: #fff1e7;
    color: #9c4f1c;
}

.spawn-group-browser-wave.is-current-wave span {
    color: #b96b34;
}

/* =========================================
   14. 弹窗头部按钮样式优化 (修复版)
   ========================================= */

#collapseControlModal {
    /* 1. 字号调小：V 字符天生瘦高，18px 看起来才和 24px 的 × 差不多大 */
    font-size: 12px !important;

    /* 2. 字体选择：Verdana 的 V 比较宽扁，更容易居中 */
    font-family: "Verdana", sans-serif;

    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 24px;
    /* 保持行高一致 */

    display: inline-block;

    /* 3. 位置微调：之前是负数(往上)，现在改成正数(往下)或0，让它沉下来 */
    transform: translateY(1px);

    user-select: none;
    transition: color 0.2s, transform 0.2s;
}

#collapseControlModal:hover {
    color: #333;
    /* 悬停时只放大，不改变位置 */
    transform: translateY(1px) scale(1.12);
}

/* 编辑器内存弹窗专用动画 */
@keyframes editor-mem-blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.mem-diag-warn {
    color: #ffcc00;
    animation: editor-mem-blink 1.5s infinite;
}

.mem-diag-error {
    color: #ff4d4d;
    animation: editor-mem-blink 1s infinite;
}

.mem-diag-info {
    color: #00ccff;
}

/* 确保按钮在缩放条左侧美观 */
#editor-mem-btn:hover {
    background: #555;
    border-color: #888;
}

/* 顶部执行按钮样式 */
#headerRunBtn {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    cursor: pointer;
    line-height: 1;
    /* 保持行高一致 */
    display: inline-block;
    user-select: none;

    /* ★★★ 这里调高度 ★★★ */
    /* 正数往下移，负数往上移。比如 4px, 5px, 6px... */
    transform: translateY(1px);

    transition: transform 0.2s, color 0.2s;
    margin-right: 2px;
    /* 给右边留点空隙 */
}

/* 鼠标悬停效果 (保持下移的同时放大) */
#headerRunBtn:hover {
    color: #1e7e34;
    /* 必须保留 translateY，否则悬停时会跳回原位 */
    transform: translateY(1px) scale(1.12);
}

/* =========================================
   15. 实体模板与属性面板 (Templates & Properties)
   ========================================= */

/* 实体模板库专属样式 */
.template-item { padding: 8px; background: #fff; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s; }
.template-item:hover { background: #f0f7ff; border-color: #007bff; }
.template-item.active { background: #e7f1ff; border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,0.2); }
.template-item img { width: 32px; height: 32px; object-fit: contain; background: #eee; border-radius: 2px; }
.template-item .tpl-info { flex: 1; overflow: hidden; }
.template-item .tpl-name { font-weight: bold; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-item .tpl-meta { font-size: 11px; color: #888; }
.template-item .tpl-use-btn { padding: 2px 6px; font-size: 12px; background: #28a745; color: white; border: none; border-radius: 3px; cursor: pointer; }
.tpl-move-btn { padding: 1px 4px; font-size: 9px; background: #e9ecef; border: 1px solid #ccc; color: #666; border-radius: 2px; cursor: pointer; line-height: 1; }
.tpl-move-btn:hover { background: #007bff; color: white; border-color: #007bff; }
.tpl-move-btn:disabled { opacity: 0.3; cursor: default; }

.prop-group { margin-bottom: 12px; }
.prop-group label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.prop-group input, .prop-group select { width: 100%; padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

/* --- END OF FILE --- */
.reward-point-preview {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    pointer-events: none;
}

.reward-point-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 76px;
    height: 76px;
    margin-left: -38px;
    margin-top: -38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 191, 0, 0.95);
    background: radial-gradient(circle, rgba(255, 239, 181, 0.26), rgba(255, 205, 86, 0.08) 68%, transparent 72%);
    box-shadow: 0 0 22px rgba(255, 193, 7, 0.22);
}

.reward-point-core {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(180deg, #fff1a8, #f5b800);
    color: #7a4a00;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(245, 184, 0, 0.26);
}

.reward-point-meta,
.reward-point-item,
.reward-point-group {
    position: relative;
    z-index: 1;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 252, 244, 0.92);
    border: 1px solid rgba(230, 188, 67, 0.6);
    color: #7a5200;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reward-point-meta {
    display: flex;
    gap: 6px;
    font-weight: 700;
}
