/* ============================================================
 * Neon Web 版 - 主样式表
 * ------------------------------------------------------------
 * 说明：
 *   1. 采用 CSS 变量集中管理主题色，方便统一换色。
 *   2. 按「全局 → 顶部工具栏 → 视图容器 → 设计区 → 网格区
 *      → 右键菜单 → 对话框 → 调色盘 → 播放 → 杂项修复」
 *      的顺序组织，便于维护和定位。
 *   3. 已合并原文件中的重复声明，行为与旧版保持一致。
 * ============================================================ */

/* ============================================================
 * 1. 全局变量与基础样式
 * ============================================================ */
 :root {
    /* 主题色变量 */
    --bg-dark: #1e1e1e;      /* 全局背景 */
    --bg-panel: #252526;     /* 面板背景 */
    --bg-item: #333;         /* 按钮/条目背景 */
    --accent: #007acc;       /* 主题强调色 */
    --text-main: #ccc;       /* 普通文字 */
    --text-bright: #fff;     /* 高亮文字 */
    --border: #444;          /* 常规边框 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
    user-select: none;       /* 避免拖拽时选中文字 */
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;        /* 主界面本身不滚动，各面板内部独立滚动 */
}


/* ============================================================
 * 2. 顶部工具栏
 * ============================================================ */
.top-toolbar {
    height: 50px;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    z-index: 100;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 通过 .hidden 类切换设计区/网格区工具栏 */
.toolbar-group.hidden { display: none !important; }

.login-btn {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
    margin-right: 10px;
}

/* 视图切换按钮固定到右侧 */
.view-switch-btn { margin-left: auto; }

/* 工具栏里的细分隔线 */
.divider {
    width: 1px;
    height: 24px;
    background: #444;
    margin: 0 5px;
}


/* ============================================================
 * 3. 通用按钮样式
 * ============================================================ */
.btn {
    background: var(--bg-item);
    color: var(--text-bright);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.btn:hover { background: #444; }

/* 主要动作按钮（蓝底） */
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
}
.btn.primary:hover { background: #005a9e; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 图标按钮：hover 时通过 ::after 展示 data-tip 提示 */
.btn-icon {
    padding: 6px 10px;
    font-size: 16px;
    position: relative;
}
.btn-icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: 0.2s;
    z-index: 1000;
}
.btn-icon:hover::after { visibility: visible; opacity: 1; }


/* ============================================================
 * 4. 主视图容器（设计区 / 网格区切换）
 * ============================================================ */
.view-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    height: 100%;
}
.view-container.hidden { display: none !important; }


/* ============================================================
 * 5. 设计区布局
 * ============================================================ */
.design-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---------- 5.1 左侧工具箱 ---------- */
.toolbox {
    width: 60px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding: 10px 0;
    gap: 5px;
    align-items: center;
    overflow-y: auto;
    z-index: 10;
}

.tool-group-title {
    font-size: 10px;
    color: #888;
    margin-top: 10px;
    margin-bottom: 2px;
}

.tool-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-item);
    color: #aaa;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 11px;
}
.tool-btn:hover { background: #444; color: #fff; }
.tool-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: #00aaff;
    box-shadow: 0 0 8px rgba(0, 122, 204, 0.5);
}

/* ---------- 5.2 中央画布区域 ---------- */
.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* 棋盘格背景，模拟透明底 */
    background-color: #2a2a2a;
    background-image:
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

canvas#mainCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    background: #000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transform-origin: center center;
    /* 实际位移/缩放由 JS 通过 style.transform 控制 */
}

/* ---------- 5.3 画布底部状态栏 ---------- */
#bottomStatusBar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: transparent;
    padding: 10px 15px;
    font-size: 13px;
    pointer-events: none; /* 不阻挡画布交互 */
    z-index: 20;
    display: flex;
    justify-content: space-between;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
}
#bottomStatusBar span:first-child {
    color: #00e5ff;
    font-weight: bold;
}
#bottomStatusBar span:last-child {
    color: #ffeb3b;
    font-weight: bold;
}
#selectionInfo {
    color: #ff9800;
    margin-left: 20px;
    font-weight: bold;
}


/* ============================================================
 * 6. 右侧面板（图层管理 + 属性面板）
 * ============================================================ */
.right-panel {
    width: 280px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    min-height: 0; /* 保证内部 flex 子项能够正常滚动 */
}

.panel-section {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    min-height: 0;
    overflow: hidden;
}

.panel-header {
    padding: 10px;
    background: #2d2d2d;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    display: flex;
    justify-content: space-between;
}

/* ---------- 6.1 图层工具按钮组 ----------
 * 说明：支持两种结构
 *   A. 旧版：.layer-tools 直接包含 .btn（通过 flex-wrap 自动换行）
 *   B. 新版：.layer-tools > .layer-tools-row * N（强制两行，每行均分）
 * 兼容两版 index.html。
 */
.layer-tools {
    display: flex;
    flex-direction: column; /* 新版按行堆叠 */
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px;
    background: #222;
    border-bottom: 1px solid var(--border);
}

/* 每一行：均分宽度、占满面板 */
.layer-tools-row {
    display: flex;
    gap: 4px;
    width: 100%;
}

/* 行内按钮：flex:1 均分；覆盖通用 .btn 部分尺寸 */
.layer-tools-row .btn,
.layer-tools .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 2px 4px;
    font-size: 11px;
    border-radius: 2px;
    text-align: center;
    justify-content: center;
}

/* 网格区「网格层管理」：+新建 / -删除 强制横排
 * 用 #viewGrid 限定，避免影响前台设计区（前台由 .layer-tools-row 实现两行布局） */
 #viewGrid .timeline .layer-tools {
    flex-direction: row;
}

/* ---------- 6.2 图层列表 ---------- */
.layer-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    max-height: 200px;
}

.layer-item {
    padding: 8px;
    background: var(--bg-item);
    margin-bottom: 4px;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    border: 1px solid transparent;
}
.layer-item.active {
    background: #094771;
    border-left: 3px solid var(--accent);
    border-color: #007acc;
}

/* ---------- 6.3 属性面板 ---------- */
.prop-content {
    padding: 10px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.prop-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.prop-row label { color: #aaa; }
.prop-row input[type="color"] {
    width: 40px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}
.prop-row input[type="range"] { width: 100px; }
.prop-row input[type="number"] {
    width: 60px;
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 3px;
}

.prop-divider {
    height: 1px;
    background: #444;
    margin: 5px 0;
}

/* ---------- 6.4 层级调整面板（位于图层管理与属性面板之间） ---------- */
.zorder-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;   /* 2x2 网格，与面板宽度自适应 */
    gap: 4px;
    padding: 8px;
    background: #222;
    border-top: 1px solid #2d2d2d;
}
.zorder-tools .btn {
    font-size: 11px;
    padding: 5px 4px;
    justify-content: center;
    text-align: center;
}
.zorder-tools .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ============================================================
 * 7. 网格区布局
 * ============================================================ */
.grid-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #333;
}

.grid-toolbar {
    min-height: 45px;
    background: #2d2d2d;
    display: flex;
    align-items: center;
    padding: 5px 15px;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ---------- 7.1 工具栏调色盘预览 ---------- */
.toolbar-palette-area {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #444;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 5px;
    height: 32px;
    width: 250px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}
.toolbar-palette-colors {
    display: flex;
    gap: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    align-items: stretch;
}
.toolbar-color-box {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    cursor: pointer;
    position: relative;
    border: none;
    box-sizing: border-box;
}
.toolbar-color-box.active { box-shadow: inset 0 0 0 2px #00e5ff; z-index: 2; }
.toolbar-color-box.pointer {
    /* 联动模式下的当前色指针高亮 */
    box-shadow:
        inset 0 0 0 2px #fff,
        inset 0 0 0 4px #00e5ff,
        0 0 8px rgba(0, 229, 255, 0.85);
    z-index: 3;
    position: relative;
}
/* 工具栏调色盘：空状态文字垂直+水平居中（仅作用于该固定区域） */
.toolbar-palette-colors .palette-empty-text {
    cursor: pointer;
    color: #888;
    font-size: 12px;
    width: 100%;
    height: 100%;
    display: flex;              /* 让文字成为弹性容器，实现居中 */
    align-items: center;        /* 垂直居中 */
    justify-content: center;    /* 水平居中 */
    text-align: center;
    transition: color 0.15s;
} 

.toolbar-palette-colors .palette-empty-text:hover { color: #00e5ff; }

.current-color-display {
    width: 26px;
    height: 26px;
    border: 2px solid #fff;
    border-radius: 3px;
    flex-shrink: 0;
}
.palette-empty-text {
    color: #888;
    font-size: 12px;
    width: 100%;
    text-align: center;
}

/* ---------- 7.2 基础色选择器 ---------- */
.color-palette {
    display: flex;
    gap: 2px;
    background: #111;
    padding: 2px;
    border-radius: 4px;
    border: 1px solid #444;
}
.color-box {
    width: 20px;
    height: 20px;
    cursor: pointer;
    border: 1px solid transparent;
}
.color-box:hover { border-color: #fff; }
.color-box.active {
    border: 2px solid #00e5ff;
    box-shadow: 0 0 5px #00e5ff;
}

/* ---------- 7.3 方向按钮组 ---------- */
.d-pad {
    display: flex;
    gap: 5px;
    align-items: center;
}
.d-pad .btn-dir {
    width: 28px;
    height: 28px;
    background: #444;
    border: 1px solid #555;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    font-family: 'Consolas', monospace;
    color: #00e5ff;
}
.d-pad .btn-dir:hover { background: #007acc; color: #fff; }
.d-pad .btn-dir:active { transform: translateY(1px); }

/* ---------- 7.4 网格画布容器 ---------- */
.grid-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}
.grid-canvas-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #555;
}
canvas#gridCanvas {
    background: #666;
    cursor: crosshair;
    image-rendering: pixelated; /* 像素化放大，避免模糊 */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transform-origin: center center;
    position: absolute;
    top: 50%;
    left: 50%;
}

/* ---------- 7.5 网格区底部状态栏 ---------- */
#gridBottomStatusBar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    font-size: 13px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
#gridBottomStatusBar #gridStatusLeft {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#gridBottomStatusBar #gridStatusHint {
    color: #999;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}
#gridBottomStatusBar #gridStatusCell {
    color: #00e5ff;
    font-weight: bold;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
}

/* ---------- 7.6 网格区暂停提示 ---------- */
#gridPauseHint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffeb3b;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 30;
    pointer-events: none;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* ---------- 7.7 网格区右侧时间轴（网格层管理） ---------- */
.timeline {
    width: 250px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.frame-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    max-height: 250px;
}
.frame-item {
    padding: 8px;
    background: var(--bg-item);
    margin-bottom: 4px;
    border: 1px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}
.frame-item.active {
    background: var(--accent);
    color: #fff;
}


/* ============================================================
 * 8. 右键上下文菜单
 * ============================================================ */
.context-menu {
    position: absolute;
    background: #fff;
    color: #000;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 1000;
    min-width: 160px;
    padding: 5px 0;
}
.menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 13px;
}
.menu-item:hover {
    background: var(--accent);
    color: #fff;
}
.menu-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}


/* ============================================================
 * 9. 模态对话框
 * ============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 需求1：遮罩层透明度 0.10（接近完全透明） */
    background: rgba(0, 0, 0, 0.10);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-content {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 6px;
    width: 350px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
}
.modal-content h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    cursor: move;        /* 标题栏可拖动 */
    user-select: none;
}
.modal-content input,
.modal-content select,
.modal-content textarea {
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 8px;
    border-radius: 3px;
    font-family: inherit;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


/* ============================================================
 * 10. 调色盘对话框
 * ============================================================ */
#paletteModal .modal-content {
    width: 750px;
    max-height: 95vh;
}
.palette-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
    background: #222;
    border: 1px solid #444;
}
.palette-row {
    display: flex;
    gap: 0;
    height: 16px;
}
.palette-swatch {
    flex: 1 1 0;
    min-width: 0;
    cursor: pointer;
    border: none;
}
.palette-swatch:hover { opacity: 0.8; }
.palette-swatch.selected-range { box-shadow: inset 0 0 0 1px yellow; }

.palette-preview-area {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 0;
    min-height: 30px;
    width: 100%;
    padding: 2px;
    background: #111;
    border: 1px dashed #555;
    border-radius: 4px;
    align-items: stretch;
}
.preview-swatch {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    border: none;
    cursor: pointer;
}
.preview-swatch:hover { box-shadow: inset 0 0 0 2px red; }

.palette-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
}
.palette-footer .btn { padding: 4px 10px; font-size: 12px; }

.custom-color-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 5px;
    padding: 5px;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    max-height: 100px;
    overflow-y: auto;
}
.custom-row-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}
.custom-row-control input[type="color"] {
    width: 30px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}
.border-color-preview {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    border: 1px solid #555;
    flex-shrink: 0;
}


/* ============================================================
 * 11. Loading 遮罩
 * ============================================================ */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 需求1：遮罩层透明度 0.10；去掉模糊，保持“接近完全透明” */
    background: rgba(0, 0, 0, 0.10);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}
#loadingOverlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}
.loading-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 320px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.loading-header {
    background: #2d2d2d;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}
#btnCloseLoading {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}
#btnCloseLoading:hover { color: #ff5252; }
.loading-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
    display: none;
    margin-top: 5px;
}
.progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.2s ease;
}


/* ============================================================
 * 12. 前台播放模式
 * ============================================================ */

/* body.playing 状态下隐藏所有 UI，只保留画布 */
body.playing .top-toolbar,
body.playing .toolbox,
body.playing .right-panel,
body.playing .timeline,
body.playing #gridTools,
body.playing #frontendTools {
    display: none !important;
}
body.playing .canvas-wrapper { flex: 1; }
body.playing #bottomStatusBar { bottom: 0; }

/* 播放停止按钮（历史遗留样式，如需可继续使用） */
#btnStopPlayback {
    background: #ff5252;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}
#btnStopPlayback:hover { background: #d32f2f; }


/* ============================================================
 * 13. 播放顶部控制条（浮动于画布上方）
 * ============================================================ */
#playbackTopBar {
    position: fixed;
    top: 12px;
    z-index: 9999;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    pointer-events: none; /* 空白区域不挡鼠标，子元素恢复 auto */
}
#playbackTopBar.hidden { display: none !important; }
#playbackTopBar > * { pointer-events: auto; }

#playbackControlBar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.92);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-width: 560px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
#playbackControlBar.hidden { display: none !important; }
#playbackControlBar .btn { padding: 4px 10px; font-size: 12px; }
#playbackControlBar input[type="range"] {
    flex: 1;
    min-width: 120px;
    -webkit-appearance: none;
    height: 6px;
    background: #111;
    border-radius: 3px;
    outline: none;
    border: 1px solid #555;
}
#playbackControlBar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
}
#playbackFrameDisplay {
    font-size: 12px;
    color: #00e5ff;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 8px;
    border-radius: 3px;
    min-width: 56px;
    text-align: center;
}
#playbackHint {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    text-shadow: 1px 1px 2px #000;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}


/* ============================================================
 * 14. 网格区时间轴/图标按钮
 * ============================================================ */
.timeline-controls input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: #111;
    border-radius: 3px;
    outline: none;
    border: 1px solid #555;
}
.timeline-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
}

/* 播放/暂停等图标按钮 */
.btn-icon-grid {
    padding: 2px 8px;
    font-size: 14px;
    font-weight: bold;
    min-width: 32px;
    justify-content: center;
}
.btn-icon-grid:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 当前帧输入框：聚焦时高亮边框 */
#currentFrameDisplay {
    transition: background 0.15s, border-color 0.15s;
}
#currentFrameDisplay:focus {
    background: #111 !important;
    border-color: #00e5ff !important;
}


/* ============================================================
 * 15. 输入框通用修复
 * ============================================================ */

/* 让数值输入框的增减按钮始终显示（合并原多处重复声明） */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    opacity: 1 !important;
    display: inline-block !important;
    visibility: visible !important;
    height: 22px;
}


/* ============================================================
 * 16. 联动开关标签（调色盘联动）
 * ============================================================ */
.linkage-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    padding: 2px 6px;
    border: 1px solid #444;
    border-radius: 3px;
    background: #2a2a2a;
}
.linkage-label:hover { background: #333; }
.linkage-label input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

/* 网格区工具栏里的「方式:」标签 */
.toolbar-label {
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    font-weight: 500;
}


/* ============================================================
 * 17. 轮廓裁切对话框（勾选项高亮）
 * ============================================================ */
#outlineClipModal input[type="radio"]:checked + span,
#outlineClipModal input[type="checkbox"]:checked + span {
    color: #00e5ff;
    font-weight: bold;
}

/* ============================================================
 * 18. 网格区黄色提示（工具栏下方居中，2秒自动消失）
 * ============================================================ */
 .grid-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #ffeb3b;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    opacity: 1;
    transition: opacity 0.3s;
}
.grid-toast.hidden { opacity: 0; pointer-events: none; }

/* ============================================================
 * 19. 网格右键菜单项禁用状态
 * ============================================================ */
 .menu-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
 * 20. 全局滚动条（黑色细小）— 需求4
 * ============================================================ */
 ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
    border: 1px solid #222;
}
::-webkit-scrollbar-thumb:hover { background: #666; }
::-webkit-scrollbar-corner { background: #1a1a1a; }

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}

/* ============================================================
 * 21. 工具栏溢出横向滚动 + 面板自适应 — 需求4
 * ============================================================ */
.top-toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
}
.top-toolbar .toolbar-group {
    flex-shrink: 0;
    min-width: 0;
}
.top-toolbar .btn {
    flex-shrink: 0;
}
.top-toolbar .view-switch-btn {
    position: sticky;
    right: 0;
    flex-shrink: 0;
}

.grid-toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
}
.grid-toolbar .btn,
.grid-toolbar select,
.grid-toolbar .d-pad,
.grid-toolbar .toolbar-label,
.grid-toolbar .divider,
.grid-toolbar .timeline-controls {
    flex-shrink: 0;
}

/* 让主容器的三段自适应高度 */
.design-main,
.grid-main {
    min-height: 0;
    height: 100%;
}
.view-container {
    min-height: 0;
    min-width: 0;
}

/* 左侧工具箱：始终出现纵向滚动条（内容多时） */
.toolbox {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* 右侧面板：保证子块内部滚动 */
.right-panel {
    min-height: 0;
    overflow: hidden;
}
.right-panel .panel-section {
    overflow: hidden;
    min-height: 0;
}
.right-panel .layer-list,
.right-panel .prop-content {
    overflow-y: auto;
    min-height: 0;
}

/* 后台网格区右侧时间轴面板 */
.timeline {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
 * 22. 后台网格区第二行工具栏横向溢出滚动 — 需求3
 * ============================================================ */
 .grid-toolbar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap;
}
.grid-toolbar > * {
    flex-shrink: 0 !important;
}
/* 内部的 slider 允许收缩到最小 80px，超出后整条工具栏滚动 */
.grid-toolbar #frameSlider {
    flex-shrink: 1 !important;
    min-width: 80px !important;
}
 /* ============================================================
 * 23. AI 图片转夜景对话框 — 横向两栏布局
 * ============================================================ */
#aiNightModal .ai-night-modal-content {
    width: 960px;
    max-width: 96vw;
    height: 88vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    overflow: hidden;
}

/* 顶部风险提示（固定） */
.ai-night-risk-tip {
    background: #3a1a1a;
    border: 1px solid #ff5252;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: #ff8a80;
    line-height: 1.5;
    flex-shrink: 0;
}

/* 主体两栏：左滚动 / 右预览 */
.ai-night-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 14px;
    overflow: hidden;
}

.ai-night-left {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
    min-height: 0;
}

.ai-night-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.ai-night-preview {
    flex: 1;
    min-height: 0;
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px;
}
.ai-night-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 3px;
}
.ai-night-preview-empty {
    color: #555;
    font-size: 12px;
}

/* 字段通用 */
.ai-night-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ai-night-field > label {
    font-size: 12px;
    color: #aaa;
}
.ai-night-field > input,
.ai-night-field > select,
.ai-night-field > textarea,
.ai-night-field > div > select,
.ai-night-field > div > input {
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
}
.ai-night-field > input:focus,
.ai-night-field > select:focus,
.ai-night-field > textarea:focus {
    border-color: #00e5ff;
}
.ai-night-field > textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* 行内多字段 */
.ai-night-row {
    display: flex;
    gap: 10px;
}
.ai-night-row > .ai-night-field {
    flex: 1;
    min-width: 0;
}

/* 认证参数行 */
.ai-night-auth-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-night-auth-row > label {
    min-width: 100px;
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}
.ai-night-auth-row > input {
    flex: 1;
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
    outline: none;
}
.ai-night-auth-row > input:focus {
    border-color: #00e5ff;
}
.ai-night-auth-row > .field-hint {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

/* 状态显示 */
#aiNightStatus {
    font-size: 12px;
    color: #4caf50;
    min-height: 18px;
    flex-shrink: 0;
}
#aiNightStatus.error { color: #ff5252; }
#aiNightStatus.success { color: #4caf50; }
#aiNightStatus.loading { color: #ffeb3b; }

/* 生成按钮 loading 态 */
#btnAiNightGenerate.loading {
    opacity: 0.7;
    cursor: wait;
}
#btnAiNightGenerate.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: aiNightSpin 0.6s linear infinite;
}
@keyframes aiNightSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
 * 24. 设置网格映射对话框 — 横向两栏布局
 * ============================================================ */
 .mapping-modal-content {
    width: 760px;
    max-width: 96vw;
    max-height: 90vh;
    overflow: hidden;
}
.mapping-body {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 14px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}
.mapping-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.mapping-section-title {
    color: #00e5ff;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 2px;
}
.mapping-row {
    display: flex;
    gap: 10px;
}
.mapping-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.mapping-field label {
    font-size: 12px;
    color: #aaa;
}
.mapping-field input {
    width: 100%;
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
}
.mapping-block {
    display: flex;
    gap: 12px;
    font-size: 13px;
    align-items: center;
    padding: 6px 8px;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    flex-wrap: wrap;
}
.mapping-radio-group {
    display: flex;
    gap: 20px;
    font-size: 13px;
    align-items: center;
}
#mappingMultiplierBlock input {
    width: 70px;
    background: #111;
    border: 1px solid #555;
    color: #fff;
    padding: 3px 6px;
    border-radius: 3px;
}

/* ============================================================
 * 25. 客服按钮 + 用户设置菜单 — 需求3
 * ============================================================ */
 .customer-btn {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
}
.customer-btn:hover { background: #1976D2; }

.user-menu-wrapper {
    position: relative;
    display: inline-block;
}
.user-menu-wrapper .user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 12px;
}
.user-menu-wrapper:hover .user-menu-trigger {
    background: #444;
}
.user-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 170px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 0;
    display: none;
    flex-direction: column;
    z-index: 3000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.user-menu-wrapper:hover .user-menu-dropdown {
    display: flex;
}
.user-menu-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
}
.user-menu-item:hover {
    background: #007acc;
    color: #fff;
}

/* ============================================================
 * 26. 霓虹特效 / 激光束对话框 — 需求2 & 需求5b
 * ============================================================ */
.neon-scroll {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 6px;
    max-height: 62vh;
    min-height: 0;
}
.neon-section {
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.neon-section-title {
    font-size: 13px;
    font-weight: bold;
    color: #00e5ff;
    margin-bottom: 4px;
}
.neon-val {
    display: inline-block;
    width: 42px;
    text-align: right;
    color: #ffeb3b;
    font-size: 12px;
}

/* ============================================================
 * 27. 拖入高亮提示 — 需求4
 * ============================================================ */
.drop-highlight {
    outline: 3px dashed #00e5ff !important;
    outline-offset: -6px;
    position: relative;
}
.drop-highlight::after {
    content: '松开鼠标以加载文件';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 229, 255, 0.9);
    color: #000;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    z-index: 50;
    pointer-events: none;
}

/* ============================================================
 * 28. 修复用户设置菜单显示层次问题 — 改进1
 * 使用 position: fixed 由 JS 定位，避免被 .top-toolbar 的
 * overflow 裁剪
 * ============================================================ */
 .user-menu-dropdown {
    position: fixed !important;
    margin-top: 0 !important;
    display: none;
    flex-direction: column;
    min-width: 170px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 0;
    z-index: 5000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}
/* 取消原来的 :hover 显示规则（由 JS 控制显示隐藏） */
.user-menu-wrapper:hover .user-menu-dropdown {
    display: none;
}

/* ===== 登录对话框样式（只使用 #loginMask / #loginBox 选择器，不影响其它弹窗） ===== */
#loginMask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    /* 需求1：遮罩层透明度 0.10 */
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
#loginBox {
    background: #232f36;
    border: 2px solid #4dd0e1;
    border-radius: 8px;
    padding: 22px 26px;
    min-width: 360px;
    max-width: 92vw;
    color: #e6f4f8;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 229, 255, 0.35);
    font-size: 13px;
}
#loginBox h3 {
    color: #00e5ff;
    margin: 0 0 14px 0;
    font-size: 16px;
    font-weight: bold;
}
#loginBox .tip {
    min-height: 16px;
    font-size: 12px;
    color: #f44336;
    margin-bottom: 8px;
}
#loginBox .item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}
#loginBox .item label {
    min-width: 60px;
    color: #aaa;
    font-size: 13px;
    text-align: right;
    flex-shrink: 0;
}
#loginBox .item input {
    flex: 1;
    padding: 7px 10px;
    background: #33454e;
    border: 1px solid #6e93a1;
    color: #ffffff;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
#loginBox .item input:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.45);
}
#loginBox .login-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 0 12px 0;
    font-size: 12px;
}
#loginBox .login-links a {
    color: #4dd0e1;
    text-decoration: underline;
    cursor: pointer;
}
#loginBox .login-links a:hover {
    color: #00e5ff;
}
#loginBox .code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
#loginBox .code-row img {
    width: 100px;
    height: 34px;
    background: #222;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    display: block;
}
#loginBox #loginBtn {
    width: 100%;
    padding: 9px 12px;
    background: #00e5ff;
    border: none;
    color: #000;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
#loginBox #loginBtn:hover {
    background: #00b8d4;
}

/* ===== 改进3：属性面板美化下拉框 ===== */
.prop-nice-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #0e0e0e;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2300e5ff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 6px;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
    padding: 5px 28px 5px 10px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    min-height: 26px;
    width: 100%;
    box-sizing: border-box;
}
.prop-nice-select:hover {
    border-color: #00e5ff;
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.28);
}
/* 需求2：属性面板“可见范围”下拉框取消鼠标划过的高亮效果 */
.prop-nice-select.prop-no-hover:hover {
    border-color: #333;
    box-shadow: none;
}
.prop-nice-select:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}
.prop-nice-select option {
    background: #1a1a1a;
    color: #fff;
}
.prop-hidden { 
    display: none !important;
 }

/* ===== 本轮：文字对话框字体行自适应（加载本机字体后名字很长，不能把字号下拉框挤出对话框） ===== */
#textModal #textFont {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
}
#textModal #textSize {
    flex: 0 0 80px;
    width: 80px;
    min-width: 80px;
}
#textModal #textColor {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
}

/* ===== LED 像素特效对话框 ===== */
#pixelFxModal .pfx-modal-content {
    width: 940px;
    max-width: 96vw;
    height: 88vh;
    max-height: 94vh;
    overflow: hidden;
}
.pfx-body {
    display: flex;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.pfx-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.pfx-col-left { flex: 0 0 328px; min-height: 0; }
.pfx-col-right { flex: 1 1 auto; border-left: 1px solid #333; padding-left: 14px; overflow: hidden; }
.pfx-col-right .pfx-hint { flex: 0 0 auto; margin-top: auto; border-top: 1px solid #2a2a2a; padding-top: 8px; }
.pfx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pfx-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pfx-field label { font-size: 12px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfx-field input, .pfx-field select { width: 100%; box-sizing: border-box; min-width: 0; }
.pfx-preview-wrap { display: flex; flex-direction: column; gap: 6px; }
.pfx-preview-title, .pfx-params-title { font-size: 12px; color: #00e5ff; font-weight: bold; }
#pfxPreview {
    width: 100%;
    height: auto;
    max-height: 190px;
    object-fit: contain;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    image-rendering: pixelated;
}
.pfx-hint { font-size: 12px; color: #888; line-height: 1.55; min-height: 34px; }
.pfx-hint.warn { color: #ff9800; }
.pfx-params {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-right: 6px;
}
.pfx-param { display: grid; grid-template-columns: 96px 1fr 46px; gap: 8px; align-items: center; }
.pfx-param > label { font-size: 12px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfx-param .val { font-size: 11px; color: #00e5ff; text-align: right; font-variant-numeric: tabular-nums; }
.pfx-param input[type="range"] { width: 100%; }
.pfx-param input[type="color"] { width: 100%; height: 24px; padding: 0; border: 1px solid #555; background: #111; border-radius: 3px; cursor: pointer; }
.pfx-param input[type="text"], .pfx-param select { width: 100%; box-sizing: border-box; }
.pfx-param.pfx-wide { grid-template-columns: 96px 1fr; }
.pfx-group-title { font-size: 11px; color: #666; letter-spacing: 1px; margin-top: 2px; border-bottom: 1px dashed #333; padding-bottom: 3px; }

/* ===== 节拍/选区粘贴对话框 ===== */
.paste-block {
    margin-top: 12px;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
}
.paste-label {
    font-size: 12px;
    color: #00e5ff;
    font-weight: bold;
    margin-bottom: 6px;
}
.paste-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: #ddd;
}
.paste-radios label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.paste-hint {
    font-size: 11px;
    color: #888;
    line-height: 1.55;
    margin-top: 6px;
}
.paste-desat {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: #ddd;
    flex-wrap: wrap;
}
.paste-desat input[type="color"] {
    width: 42px;
    height: 24px;
    padding: 0;
    border: 1px solid #555;
    background: #111;
    border-radius: 3px;
    cursor: pointer;
}
.paste-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
    max-height: 56px;
    overflow-y: auto;
}
.paste-swatch {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid #444;
    cursor: pointer;
    flex: 0 0 auto;
}
.paste-swatch:hover { border-color: #00e5ff; }
.paste-swatch.selected {
    border: 2px solid #00e5ff;
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.85);
}
.paste-modal-content {
    width: 520px;
    max-width: 96vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.paste-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}
.paste-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.paste-color-name {
    font-size: 12px;
    color: #bbb;
    min-width: 56px;
}
.paste-check {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #ddd;
    white-space: nowrap;
}
.paste-swatches.inline {
    margin-top: 0;
    max-height: none;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 2px 0;
}

/* ============================================================================
 * 登录窗口双栏改造 + 作品列表 + 作品预览弹窗（本次新增，覆盖旧 #loginBox 规则）
 * ========================================================================== */
#loginMask {
    align-items: center;
    justify-content: center;
}

#loginBox {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    /* 需求：高度增加 1/5，并保持水平垂直居中（居中由 #loginMask 的 flex 控制） */
    min-height: 462px;
    min-width: 900px;
    max-width: 94vw;
    padding: 22px 24px;
    box-sizing: border-box;
}

/* 左栏：登录区 */
.login-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.login-pane-left {
    flex: 0 0 330px;
    justify-content: center;
}

.login-pane-left h3 {
    margin: 0 0 14px 0;
}

/* 细分隔线（颜色不刺眼） */
.login-divider {
    flex: 0 0 1px;
    width: 1px;
    /* 与左右栏各留 28px 间距，视觉更舒展 */
    margin: 2px 28px;
    background: #3a4a52;
    opacity: 0.55;
}

/* 右栏：作品列表区 */
.login-pane-right {
    flex: 1 1 auto;
    min-width: 520px;
    justify-content: flex-start;
}

.works-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    color: #4dd0e1;
    font-size: 13px;
    font-weight: bold;
}

.works-count {
    color: #8fa7b2;
    font-size: 12px;
    font-weight: normal;
}

/* 2 列 × 2 行 */
.works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    height: 336px;
    min-height: 0;
}

.work-card {
    display: flex;
    flex-direction: column;
    background: #1b262c;
    border: 1px solid #34505c;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    min-height: 0;
}

.work-card:hover {
    border-color: #00e5ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 229, 255, 0.18);
}

.work-thumb {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #0c1418 center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.work-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.work-thumb.no-cover::after {
    content: "WEBM";
    color: #3f5b66;
    font-size: 20px;
    letter-spacing: 2px;
}

.work-play {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.85);
    color: #06121a;
    font-size: 12px;
}

.work-name {
    flex: 0 0 auto;
    padding: 6px 8px;
    font-size: 12px;
    color: #cfe3ea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #162127;
}

/* 空列表提示：右栏居中 */
.works-empty {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #7d949e;
    font-size: 13px;
    line-height: 1.8;
    padding: 0 20px;
}

/* 分页（美化） */
.works-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    min-height: 30px;
}

.works-page-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    border: 1px solid #3a5560;
    background: #1a262c;
    color: #b9d3dc;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}

.works-page-btn:hover:not(:disabled) {
    border-color: #00e5ff;
    color: #00e5ff;
}

.works-page-btn.active {
    background: #00e5ff;
    border-color: #00e5ff;
    color: #041014;
    font-weight: bold;
}

.works-page-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* 登录窗口内错误提示（替代原生 alert） */
#loginBox .tip.tip-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.5;
    min-height: 0;
}

.login-links {
    display: flex;
    gap: 34px;
    justify-content: flex-end;
    padding-right: 12px;
    margin: 6px 0 0 0;
    font-size: 12px;
}

.login-links a {
    color: #4dd0e1;
    text-decoration: underline;
    cursor: pointer;
}

.login-links a:hover {
    color: #00e5ff;
}

/* 作品预览弹窗（黑色风格，与其它对话框一致） */
.work-preview-content {
    width: 720px;
    max-width: 94vw;
    display: flex;
    flex-direction: column;
}

.work-preview-stage {
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    overflow: hidden;
}

.work-preview-stage video {
    width: 100%;
    max-height: 58vh;
    background: #000;
    display: block;
}

.work-preview-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #8fa7b2;
    word-break: break-all;
}

/* 小屏适配：窄屏改为上下排列 */
@media (max-width: 860px) {
    #loginBox {
        flex-direction: column;
        min-width: 0;
        width: 92vw;
        min-height: 0;
        max-height: 92vh;
        overflow-y: auto;
    }

    .login-divider {
        width: auto;
        height: 1px;
        flex: 0 0 1px;
        margin: 14px 0;
    }

    .login-pane-right {
        min-width: 0;
    }

    .works-grid {
        height: 320px;
    }
}

/* 登录窗口 LOGO（高 110 × 宽 415，居中） */
.login-logo {
    display: block;
    width: 415px;
    height: 110px;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 12px auto;
}


/* ===== P5：登录左栏输入框美化 + 验证码右对齐 + 右栏标题行链接 ===== */
.login-pane-left .item input[type=text],
.login-pane-left .item input[type=password] {
    height: 36px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #3a5058;
    background: #101a1f;
    color: #e6f1f5;
    font-size: 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.login-pane-left .item input[type=text]:focus,
.login-pane-left .item input[type=password]:focus {
    border-color: #00e5ff;
    background: #0d1a20;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, .15);
}

.login-pane-left .item label {
    color: #8fa7b2;
    font-size: 12px;
    margin-bottom: 2px;
}

/* 验证码行：输入框与图片同高，图片右边与输入框右边对齐 */
.login-pane-left .code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.login-pane-left .code-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.login-pane-left .code-row img#captchaImg {
    flex: 0 0 auto;
    width: 108px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid #3a5058;
    background: #0b1317;
    object-fit: contain;
    cursor: pointer;
}

/* 右栏标题行：作品标题在左，教程/客服靠右，两个链接紧挨并右对齐对话框 */
.works-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.works-head .login-links {
    margin-left: auto;
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    padding-right: 0;
    align-items: baseline;
}

/* 登录提示：位于「立即使用」按钮下方 */
#loginBox .tip {
    margin-top: 10px;
    margin-bottom: 0;
    min-height: 0;
}

/* ===== P6：作品预览窗口置顶（高于登录窗口，不遮挡其下的登录框）+ 宽高各 +25% ===== */
#workPreviewModal {
    z-index: 12000;            /* #loginMask = 10000 */
}
#workPreviewModal .work-preview-content {
    width: 900px;              /* 720 * 1.25 */
    max-width: 96vw;
}
#workPreviewModal .work-preview-stage video {
    max-height: 72vh;          /* 58vh ≈ 72vh（+25%） */
    min-height: 320px;
}
#workPreviewModal .work-preview-stage {
    min-height: 330px;
}

/* ===== CID（设备标识）行：位于密码下方，与输入框右对齐 ===== */
.cid-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 2px 0 6px 0;
    padding: 6px 8px;
    border-radius: 6px;
    background: #0f1a20;
    border: 1px solid #2b3f47;
    cursor: pointer;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.cid-row .cid-label {
    flex: 0 0 auto;
    color: #8fa7b2;
    font-size: 12px;
    line-height: 18px;
}
.cid-row code {
    flex: 1 1 auto;
    min-width: 0;
    color: #4dd0e1;
    font-size: 11px;
    line-height: 15px;
    word-break: break-all;
    white-space: normal;
    font-family: Consolas, monospace;
}

/* ===== 右键菜单：画布对齐子菜单 ===== */
.context-menu .has-sub { position: relative; }
.context-menu .has-sub .sub-arrow { float: right; margin-left: 12px; opacity: .7; }
.context-menu .has-sub .submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -4px;
    min-width: 132px;
    background: #161d21;
    border: 1px solid #2e4048;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 6px 18px rgba(0,0,0,.5);
    z-index: 1002;
}
.context-menu .has-sub:hover .submenu { display: block; }
.context-menu .has-sub .submenu .menu-item { white-space: nowrap; }

/* ===== 压缩进度对话框 ===== */
#imgCompressModal { z-index: 13000; }
#imgCompressModal .modal-content { color: #d7e3e8; }
#imgCompressModal #imgCompressBar { background: linear-gradient(90deg,#00e5ff,#4dd0e1); }

/* ===== 时间输入框右侧上下调节箭头（与 number 输入框 spinner 同风格） ===== */
.time-wrap { display: inline-flex; align-items: stretch; height: 30px; }
.time-wrap input {
    width: 100px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    box-sizing: border-box;
}
.time-spin {
    display: flex;
    flex-direction: column;
    width: 17px;
    border: 1px solid #33454e;
    border-left: none;
    border-radius: 0 4px 4px 0;
    overflow: hidden;
    background: #10171a;
}
.time-spin .spin-btn {
    flex: 1 1 50%;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: #10171a;
    color: #9fb6c0;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.time-spin .spin-btn:first-child { border-bottom: 1px solid #2b3b42; }
.time-spin .spin-btn:hover { background: #17323b; color: #4dd0e1; }
.time-spin .spin-btn:active { background: #00b8d4; color: #04151a; }

/* ===== 点光属性面板：加大行距 ===== */
.prop-pointlight-box .prop-row { margin-bottom: 12px; gap: 8px; align-items: center; }
.prop-pointlight-box .prop-row label { min-width: 42px; }
.prop-pointlight-box .prop-row input[type="range"] { flex: 1 1 auto; }

/* ===== 网格映射对话框：同行选择器 / 按钮不溢出 ===== */
.mapping-inline { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:6px 0; }
.mapping-inline > span { font-size:12px; color:#aaa; white-space:nowrap; }
.mapping-inline select,
#mapRowModeSelect { flex:1 1 auto; min-width:140px; height:30px; padding:0 8px; }
#mappingModal .mapping-modal-content { max-height:88vh; display:flex; flex-direction:column; }
#mappingModal .mapping-body { overflow:auto; flex:1 1 auto; }
#mappingModal .modal-actions { flex:0 0 auto; position:sticky; bottom:0; background:transparent; padding:8px 0 0 0; margin-bottom:0; }

/* 动画方向/元素顺序标签字号与对话框一致 */
#mappingModal .mapping-inline label,
#mappingModal .mapping-inline label span,
#mappingModal #directionBlock span,
#mappingModal #elementOrderBlock span { font-size: inherit; }

/* 映射对话框统一字号（与“网格行加倍”一致） */
#mappingModal .mapping-radio-group label,
#mappingModal .mapping-radio-group label span,
#mappingModal .mapping-inline > span,
#mappingModal .mapping-inline label,
#mappingModal .mapping-inline label span,
#mappingModal #directionBlock span,
#mappingModal #elementOrderBlock span,
#mappingModal .mapping-field label { font-size: 12px; }

/* 发光字特效对话框：字号与 LED 像素特效一致 */
#glowFxModal { font-size: 12px; }
#glowFxModal h3 { font-size: 15px; }
#glowFxModal .gfx-row { display:flex; align-items:center; gap:8px; margin:6px 0; flex-wrap:wrap; font-size:12px; }
#glowFxModal .gfx-label { width:90px; color:#aaa; font-size:12px; }
#glowFxModal label, #glowFxModal span, #glowFxModal select, #glowFxModal input { font-size:12px; }
#glowFxModal .gfx-grid { display:grid; grid-template-columns:90px 1fr 90px 1fr; gap:6px 10px; align-items:center; font-size:12px; }
#glowFxModal .gfx-seq-box { border:1px solid #2a3a44; border-radius:6px; padding:8px; margin:8px 0; background:#0f1519; }
#glowFxModal .gfx-seq-title { font-size:12px; color:#aaa; margin-bottom:6px; }
#glowFxModal .gfx-seq-list { display:flex; gap:6px; flex-wrap:wrap; min-height:28px; }
#glowFxModal .gfx-seq-item { display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border:1px solid #2a3a44; border-radius:12px; font-size:12px; color:#00e5ff; }
#glowFxModal .gfx-seq-item .gfx-x { cursor:pointer; color:#ff5252; font-weight:bold; }

/* pfx-above-glow 弹窗层级 */
#pixelFxModal { z-index: 10060; }
