/* 现代化拼豆图纸生成器样式 */



/* 默认隐藏移动端切换按钮 */
.mobile-toggle {
    display: none !important;
}

.mobile-label {
    display: none;
}


:root {
    --bg-primary: #ffffff;
    --bg-primary-solid: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --bg-hover: #f0f0f0;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --accent-color: #f97316;
    --accent-hover: #ea580c;
    --primary-color: #f97316;
    --primary-rgb: 249, 115, 22;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --toolbar-bg-end: #f9fafb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --toolbar-height: 60px;
    --panel-width: 280px;
}

body.dark-mode {
    /* 黑曜石背景色系 */
    --bg-primary: rgba(12, 12, 18, 0.85);
    --bg-primary-solid: #0c0c12;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --toolbar-bg-end: rgba(8, 8, 14, 0.9);
    --bg-secondary: #06060a;
    --bg-tertiary: rgba(25, 25, 35, 0.7);

    /* 高对比度文字 */
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;

    /* 霓虹色系 */
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff00ff;
    --neon-purple: #8b5cf6;
    --accent-color: #00f0ff;
    --accent-hover: #00d4e0;
    --primary-color: #00f0ff;
    --primary-rgb: 0, 240, 255;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    
    /* 玻璃边框 */
    --border-color: rgba(0, 240, 255, 0.15);
    --glass-border: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(139, 92, 246, 0.2), rgba(255, 0, 255, 0.3));
    
    /* 霓虹发光阴影 */
    --shadow-sm: 0 0 10px rgba(0, 240, 255, 0.1);
    --shadow-md: 0 0 20px rgba(0, 240, 255, 0.15), 0 4px 15px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 0 30px rgba(0, 240, 255, 0.2), 0 8px 32px rgba(0, 0, 0, 0.6);
    --neon-glow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.2);
}

/* ========== 未来主义暗黑模式样式 ========== */

/* 黑曜石渐变背景 */
body.dark-mode {
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 240, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 0, 255, 0.03) 0%, transparent 70%),
        linear-gradient(180deg, #06060a 0%, #0a0a10 50%, #08080e 100%);
    background-attachment: fixed;
}

/* 玻璃变形工具栏 */
body.dark-mode .top-toolbar {
    background: rgba(10, 10, 16, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    box-shadow: 
        0 1px 0 0 rgba(255, 255, 255, 0.03) inset,
        0 4px 30px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 240, 255, 0.05);
}

/* 霓虹Logo */
body.dark-mode .logo {
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

body.dark-mode .logo-text {
    background: linear-gradient(135deg, #00f0ff, #8b5cf6, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.4));
}

/* 玻璃变形按钮 */
body.dark-mode .toolbar-btn {
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 240, 255, 0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .toolbar-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), transparent, rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.dark-mode .toolbar-btn:hover:not(:disabled) {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

body.dark-mode .toolbar-btn:hover:not(:disabled)::before {
    opacity: 1;
}

body.dark-mode .toolbar-btn:hover:not(:disabled)::after {
    background: rgba(0, 240, 255, 0.1);
}

/* 玻璃变形侧边栏 */
body.dark-mode .left-panel {
    background: rgba(8, 8, 14, 0.85);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-color: rgba(0, 240, 255, 0.08);
}

body.dark-mode .left-panel {
    border-right: 1px solid rgba(0, 240, 255, 0.1);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
}

/* 玻璃变形区块 */
body.dark-mode .sidebar-section {
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
}

body.dark-mode .section-header {
    background: rgba(15, 15, 25, 0.6);
    border-bottom: 1px solid rgba(0, 240, 255, 0.06);
}

body.dark-mode .section-header:hover {
    background: rgba(0, 240, 255, 0.05);
}

body.dark-mode .section-title {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    letter-spacing: 1.5px;
}

body.dark-mode .section-content {
    background: rgba(10, 10, 18, 0.5);
}

/* 霓虹工具按钮 */
body.dark-mode .tool-btn {
    background: rgba(15, 15, 25, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

body.dark-mode .tool-btn:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 
        0 0 15px rgba(0, 240, 255, 0.2),
        inset 0 0 20px rgba(0, 240, 255, 0.05);
    color: var(--neon-cyan);
    transform: translateY(-3px);
}

body.dark-mode .tool-btn:hover svg {
    stroke: var(--neon-cyan);
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.6));
}

body.dark-mode .tool-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(139, 92, 246, 0.15));
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 
        0 0 25px rgba(0, 240, 255, 0.3),
        inset 0 0 30px rgba(0, 240, 255, 0.1);
}

body.dark-mode .tool-btn.active svg {
    stroke: var(--neon-cyan);
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.8));
}

/* 霓虹主按钮 */
body.dark-mode .btn-primary {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.9), rgba(139, 92, 246, 0.9));
    border: none;
    color: #000;
    font-weight: 600;
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.4),
        0 0 40px rgba(0, 240, 255, 0.2);
    text-shadow: none;
}

body.dark-mode .btn-primary:hover {
    background: linear-gradient(135deg, #00f0ff, #8b5cf6);
    box-shadow: 
        0 0 30px rgba(0, 240, 255, 0.6),
        0 0 60px rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
}

/* 玻璃变形次级按钮 */
body.dark-mode .btn-secondary {
    background: rgba(20, 20, 35, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.dark-mode .btn-secondary:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

/* 霓虹滑块 */
body.dark-mode .slider-control input[type="range"] {
    background: rgba(30, 30, 50, 0.5);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 4px;
}

body.dark-mode .slider-control input[type="range"]::-webkit-slider-thumb {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

body.dark-mode .slider-control input[type="range"]::-moz-range-thumb {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

/* 霓虹输入框 */
body.dark-mode .number-inline,
body.dark-mode .select-clean,
body.dark-mode select {
    background: rgba(15, 15, 25, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.15);
    color: var(--text-primary);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

body.dark-mode .number-inline:focus,
body.dark-mode .select-clean:focus,
body.dark-mode select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 
        0 0 0 3px rgba(0, 240, 255, 0.1),
        0 0 20px rgba(0, 240, 255, 0.2);
    outline: none;
}

/* 霓虹开关 */
body.dark-mode .toggle-slider {
    background: rgba(30, 30, 50, 0.6);
    border: none;
    box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.2);
}

body.dark-mode .toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

/* 玻璃变形画布区域 */
body.dark-mode .canvas-section {
    background: 
        radial-gradient(circle at 30% 30%, rgba(0, 240, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(139, 92, 246, 0.02) 0%, transparent 50%),
        linear-gradient(180deg, #050508 0%, #08080e 100%);
    background-image: 
        radial-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 30% 30%, rgba(0, 240, 255, 0.02) 0%, transparent 50%);
    background-size: 20px 20px, 100% 100%;
}

body.dark-mode #mainCanvas {
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(0, 240, 255, 0.1),
        inset 0 0 1px rgba(255, 255, 255, 0.1);
}

/* 霓虹选择框 */
body.dark-mode .selection-box {
    border: 2px solid var(--neon-cyan);
    background: rgba(0, 240, 255, 0.05);
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.3),
        inset 0 0 30px rgba(0, 240, 255, 0.05);
}

body.dark-mode .selection-box .grid-line {
    background: rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

body.dark-mode .selection-box .handle {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 
        0 0 15px rgba(0, 240, 255, 0.6),
        0 0 30px rgba(0, 240, 255, 0.3);
}

/* 玻璃变形调色板 */
body.dark-mode .palette-section {
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
}

body.dark-mode .palette-header {
    background: rgba(12, 12, 20, 0.6);
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
}

body.dark-mode .palette-tab {
    border-bottom: 2px solid transparent;
}

body.dark-mode .palette-tab:hover {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.05);
}

body.dark-mode .palette-tab.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 霓虹色块 */
body.dark-mode .color-swatch {
    box-shadow: 
        inset -2px -2px 6px rgba(0, 0, 0, 0.4),
        inset 2px 2px 6px rgba(255, 255, 255, 0.1),
        0 0 8px rgba(0, 240, 255, 0.1);
}

body.dark-mode .color-swatch:hover {
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.4),
        inset -2px -2px 6px rgba(0, 0, 0, 0.4);
}

body.dark-mode .color-swatch.selected {
    box-shadow: 
        0 0 0 3px var(--neon-cyan),
        0 0 20px rgba(0, 240, 255, 0.5);
}

/* 统计项 */
body.dark-mode .stat-item {
    background: rgba(15, 15, 25, 0.5);
    border: 1px solid rgba(0, 240, 255, 0.08);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

body.dark-mode .stat-item:hover {
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.2);
}

body.dark-mode .stat-count {
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan);
}

/* 玻璃变形模态框 */
body.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.dark-mode .modal-dialog {
    background: rgba(12, 12, 20, 0.95);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid rgba(0, 240, 255, 0.15);
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.8),
        0 0 100px rgba(0, 240, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-mode .modal-header {
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    background: rgba(0, 240, 255, 0.02);
}

body.dark-mode .modal-header h2 {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .modal-footer {
    background: rgba(8, 8, 15, 0.8);
    border-top: 1px solid rgba(0, 240, 255, 0.1);
}

/* 导出模态框 */
body.dark-mode .export-modal .modal-dialog {
    border: 1px solid rgba(0, 240, 255, 0.2);
}

body.dark-mode .export-subgroup {
    background: rgba(15, 15, 28, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(0, 240, 255, 0.08);
}

body.dark-mode .color-dot.selected {
    box-shadow: 
        0 0 0 2px var(--neon-cyan),
        0 0 15px rgba(0, 240, 255, 0.5);
}

/* 颜色选择模态框 */
body.dark-mode .color-group {
    border: 1px solid rgba(0, 240, 255, 0.1);
    overflow: hidden;
}

body.dark-mode .group-header {
    background: rgba(0, 240, 255, 0.03);
    border-bottom: 1px solid rgba(0, 240, 255, 0.08);
}

body.dark-mode .color-checkbox-item label {
    background: rgba(15, 15, 28, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

body.dark-mode .color-checkbox-item label:hover {
    border-color: rgba(0, 240, 255, 0.4);
    background: rgba(0, 240, 255, 0.05);
}

body.dark-mode .color-checkbox-item input:checked + label {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

/* 霓虹上传提示 */
body.dark-mode .upload-content svg {
    stroke: var(--neon-cyan);
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.5));
}

body.dark-mode .upload-content h2 {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .btn-upload-large {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #000;
    font-weight: 600;
    box-shadow: 
        0 0 30px rgba(0, 240, 255, 0.4),
        0 0 60px rgba(0, 240, 255, 0.2);
}

body.dark-mode .btn-upload-large:hover {
    box-shadow: 
        0 0 40px rgba(0, 240, 255, 0.6),
        0 0 80px rgba(0, 240, 255, 0.3);
}

/* SVG 图标通用样式 */
.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: inline-block;
    transition: fill 0.2s ease;
}

/* 默认状态（亮色模式）为深灰色 */
.tool-btn {
    color: var(--text-secondary);
}

/* 激活或悬停状态为蓝色 */
.tool-btn.active,
.tool-btn:hover {
    color: var(--accent-color);
}

/* 暗色模式下 */
body.dark-mode .tool-btn {
    color: rgba(255, 255, 255, 0.85); /* 默认为白色 */
}

/* 暗色模式下的激活/悬停状态为霓虹蓝 */
body.dark-mode .tool-btn.active,
body.dark-mode .tool-btn:hover {
    color: var(--neon-cyan);
    /* box-shadow 已经在 .tool-btn 定义中处理了，这里只改变文字颜色 */
}

/* 霓虹信息栏 */
body.dark-mode .canvas-info {
    background: rgba(10, 10, 18, 0.9);
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.dark-mode .canvas-info strong {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* 霓虹 Toast */
body.dark-mode .toast {
    background: rgba(12, 12, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 240, 255, 0.1);
}

body.dark-mode .toast-success {
    border-left: 4px solid #00ff88;
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 255, 136, 0.1);
}

body.dark-mode .toast-error {
    border-left: 4px solid #ff3366;
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 51, 102, 0.1);
}

body.dark-mode .toast-info {
    border-left: 4px solid var(--neon-cyan);
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 240, 255, 0.1);
}

/* 霓虹滚动条 */
body.dark-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: rgba(10, 10, 18, 0.5);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.3), rgba(139, 92, 246, 0.3));
    border-radius: 4px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.5), rgba(139, 92, 246, 0.5));
}

/* 霓虹分隔线 */
body.dark-mode .toolbar-divider {
    background: linear-gradient(180deg, transparent, rgba(0, 240, 255, 0.3), transparent);
}

body.dark-mode .divider {
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.2), transparent);
}

/* 锁定按钮霓虹效果 */
body.dark-mode .btn-chain {
    background: rgba(15, 15, 28, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.15);
}

body.dark-mode .btn-chain:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

body.dark-mode .btn-chain.active {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

/* 缩放按钮 */
body.dark-mode .btn-zoom {
    background: rgba(15, 15, 28, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.15);
}

body.dark-mode .btn-zoom:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

/* 当前颜色显示 */
body.dark-mode .current-color .color-swatch {
    box-shadow: 
        0 0 10px rgba(0, 240, 255, 0.2),
        inset -2px -2px 4px rgba(0, 0, 0, 0.3);
}

body.dark-mode .current-color .color-code {
    color: var(--neon-cyan);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease, color 0.3s ease;
    font-size: 14px;
}

/* 顶部工具栏 */
.top-toolbar {
    height: var(--toolbar-height);
    background: var(--bg-primary);
    background: linear-gradient(to bottom, var(--bg-primary), var(--toolbar-bg-end));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 24px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* 按钮微交互 */
.toolbar-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.toolbar-btn:hover:not(:disabled)::after {
    width: 150%;
    height: 150%;
    opacity: 0.1;
}

.toolbar-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(1px);
}

/* 键盘焦点可见性 */
.toolbar-btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-close:focus-visible,
.btn-icon:focus-visible,
.ws-tab:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

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

.toolbar-btn svg {
    stroke: var(--text-primary);
}

.toolbar-btn.icon-only {
    padding: 8px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 8px;
}

.toolbar-select {
    position: relative;
    padding: 0 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.edit-guard {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
    animation: fadeIn 0.3s ease;
}

.edit-guard__card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.theme-icon {
    font-size: 20px;
}

/* 主容器 */
.main-container {
    flex: 1;
    display: grid;
    grid-template-columns: var(--panel-width) 1fr; /* 改为两列布局 */
    overflow: hidden;
    height: calc(100vh - var(--toolbar-height));
}

/* 工作区标签页 */
.workspace-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border-color);
}

.ws-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.ws-tab:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}

.ws-tab.active {
    background: var(--bg-primary);
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

body.dark-mode .ws-tab:hover {
    background: rgba(255,255,255,0.05);
}

body.dark-mode .ws-tab.active {
    background: var(--bg-primary-solid); /* 使用不透明背景突出显示 */
    border: 1px solid rgba(0, 240, 255, 0.2);
}

/* 工作区容器 */
.workspace-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    height: 100%;
    position: relative;
}

/* 通用顶部工具栏 */
.top-bar-tools {
    height: 50px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0 20px;
    z-index: 10;
    animation: slideDown 0.3s ease;
    flex-shrink: 0;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.top-bar-tools .tool-btn {
    flex-direction: row;
    padding: 6px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.top-bar-tools .tool-btn svg {
    width: 20px;
    height: 20px;
    margin: 0;
}

.top-bar-tools .tool-btn span {
    display: none;
}

/* Generation Toolbar with Labels */
#genToolbar .tool-btn {
    width: auto;
    padding: 0 16px;
    gap: 8px;
}

#genToolbar .tool-btn span {
    display: inline-block;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 自定义工具光标 */
.cursor-pan { cursor: grab; }
.cursor-pan:active { cursor: grabbing; }

/* 侧边栏样式优化 */
.left-panel {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-section {
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapse-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.sidebar-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    max-height: 2000px;
}



.sidebar-section.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.btn-full {
    width: 100%;
}

.grid-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-sidebar-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    font-size: 13px;
    font-weight: 500;
    height: auto;
    min-height: 32px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.btn-sidebar-action svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.btn-sidebar-action.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

.btn-sidebar-action.active svg {
    stroke: white;
}

/* 按钮点击反馈 */
.btn-primary:active,
.btn-secondary:active,
.btn-sidebar-action:active,
.tool-btn:active,
.toolbar-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* 切换按钮样式优化 - iOS 风格 */
.toggle {
    position: relative;
    width: 50px;
    height: 30px;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.toggle.toggle-small {
    width: 40px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 999px;
    transition: background-color 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    top: 2px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle.toggle-small .toggle-slider:before {
    height: 20px;
    width: 20px;
    top: 2px;
    left: 2px;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-color);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle.toggle-small input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* 导出模态框优化 */
.export-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 32px;
}


.select-clean,
.color-system-select select,
select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
                      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 4px), calc(100% - 12px) calc(50% - 4px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.select-clean:focus,
select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* 基础工具栏美化 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}


.tool-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.tool-btn svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
}

.tool-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.tool-btn.active svg {
    stroke: white;
}



.canvas-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 链式锁定按钮容器 */
.chain-lock-container {
    display: flex;
    justify-content: flex-end;
    /* (90px input width - 24px button width) / 2 = 33px */
    padding-right: 33px; 
    margin: -8px 0;
    height: 0;
    overflow: visible;
    align-items: center;
    z-index: 10;
    position: relative;
    /* 向下偏移以视觉居中于两个输入框之间 (Label高度 + Gap) / 2 */
    transform: translateY(13px);
    pointer-events: none;
}

.btn-chain {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 4px; /* 改为方形圆角 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    pointer-events: auto;
}

.btn-chain svg {
    width: 14px;
    height: 14px;
}

.btn-chain:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(255, 138, 61, 0.08);
}

.btn-chain.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(255, 138, 61, 0.12);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.section-header:hover {
    background: var(--bg-tertiary);
}

.section-header.collapsible .collapse-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.sidebar-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.compact-inline .inline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.control-item label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.number-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    font-size: 14px;
}

.btn-decrease,
.btn-increase,
.btn-zoom {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.btn-auto-grid {
    width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-auto-grid.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(255, 138, 61, 0.12);
}

.btn-decrease:hover,
.btn-increase:hover,
.btn-zoom:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.btn-auto-grid:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.slider-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.number-inline {
    width: 90px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.number-inline:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.slider-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.slider-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.slider-control span {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.grid-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-controls span {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.control-item input[type="checkbox"] {
    margin-right: 8px;
}

/* 中央画布区域 */
.canvas-section {
    flex: 1; /* 关键：让画布区域填满父容器的剩余空间 */
    min-height: 0; /* 允许 flex item 缩小 */
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    /* 增加点阵背景效果 */
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
}

.upload-prompt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

.upload-content {
    text-align: center;
    padding: 40px;
}

.upload-content svg {
    stroke: var(--accent-color);
    margin-bottom: 24px;
}

.upload-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-upload-large {
    padding: 12px 32px;
    background: var(--accent-color);
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.25);
}

.btn-upload-large:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(249, 115, 22, 0.35);
}

.btn-upload-large:active {
    transform: translateY(0);
}

/* 顶部工具栏 (top-toolbar) */
.top-toolbar {
    height: 60px; /* 固定高度 */
    flex-shrink: 0; /* 禁止压缩 */
}

/* 画布信息栏 (canvas-info) */
.canvas-info {
    height: 40px; /* 固定高度 */
    flex-shrink: 0; /* 禁止压缩 */
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    /* 关键：允许 flex item 缩小到内容以下，确保不溢出 */
    min-height: 0; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.canvas-scroll {
    overflow: hidden;
    width: 100%;
    height: 100%;
    /* 移除 max-width/height，让它完全填满容器 */
    /* max-width: 100%; */
    /* max-height: 100%; */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    touch-action: none; /* 禁止浏览器默认行为，完全由 JS 控制 */
}

#mainCanvas {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    background: white;
    /* 关键：确保缩放时像素清晰锐利，实现矢量般的无损放大体验 */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: crosshair;
    transition: none;
    transform-origin: center center;
}

/* 游离式网格覆盖层 - 与图片分离，保持网格线粗细一致 */
.grid-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
    /* 性能优化：提示浏览器该元素会频繁变化 */
    will-change: transform, left, top, width, height;
    contain: layout style;
}

.grid-overlay .grid-line {
    position: absolute;
    background: rgba(59, 130, 246, 0.7);
    pointer-events: none;
    /* 确保线条始终清晰锐利 */
    image-rendering: crisp-edges;
    backface-visibility: hidden;
}

.grid-overlay .grid-line-v {
    width: 1px;
    height: 100%;
    top: 0;
}

.grid-overlay .grid-line-h {
    height: 1px;
    width: 100%;
    left: 0;
}

body.dark-mode .grid-overlay .grid-line {
    background: rgba(96, 165, 250, 0.8);
}

.selection-box {
    position: absolute;
    border: 2px solid #ff4d4f;
    background: transparent;
    pointer-events: auto;
    z-index: 10;
    /* 使用 box-shadow 实现反向遮罩：内部透明，外部半透明黑 */
    /* 9999px 足够覆盖大多数屏幕，inset 用于内阴影（这里主要靠外阴影） */
    box-shadow: 0 0 0 1px rgba(255, 77, 79, 0.35), inset 0 0 0 1px rgba(255, 77, 79, 0.25), 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.selection-box .drag-surface {
    position: absolute;
    inset: 0;
    cursor: move;
}

.selection-box .grid-line {
    position: absolute;
    background: rgba(255, 77, 79, 0.75);
    pointer-events: none;
}

.selection-box .handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ff4d4f;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(255, 77, 79, 0.35);
    cursor: pointer;
    z-index: 2;
    transform: translate(-50%, -50%);
}

.selection-box .handle-tl { left: 0%; top: 0%; cursor: nwse-resize; }
.selection-box .handle-tr { left: 100%; top: 0%; cursor: nesw-resize; }
.selection-box .handle-bl { left: 0%; top: 100%; cursor: nesw-resize; }
.selection-box .handle-br { left: 100%; top: 100%; cursor: nwse-resize; }

.selecting-mode #mainCanvas {
    cursor: crosshair;
}

.canvas-info {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 导出模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 320px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    gap: 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-card h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.canvas-info strong {
    color: var(--text-primary);
}

.palette-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
}

.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.palette-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.current-color {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.current-color .current-color-label {
    display: none; /* 隐藏文字标签，只显示色块和色号 */
}

.current-color .color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px; /* 方形 */
    border: 1px solid var(--border-color);
    background: transparent;
    box-sizing: border-box;
    box-shadow: var(--shadow-sm);
}

.current-color .color-code {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.current-color.empty .color-code {
    color: var(--text-tertiary, var(--text-secondary));
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.btn-icon svg {
    stroke: var(--text-primary);
}

.palette-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.palette-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.palette-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.palette-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.palette-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.palette-content::-webkit-scrollbar {
    display: none;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.color-system-select {
    margin-bottom: 16px;
}

.color-system-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

.all-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}

/* 颜色色块样式增强：拼豆质感 */
.color-swatch {
    aspect-ratio: 1;
    border-radius: 4px; /* 方形圆角 */
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    /* 简单的光影效果模拟立体感 */
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.1), inset 2px 2px 4px rgba(255,255,255,0.2), var(--shadow-sm);
}

.color-swatch:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-md), inset -2px -2px 4px rgba(0,0,0,0.1), inset 2px 2px 4px rgba(255,255,255,0.2);
    z-index: 10;
}

.color-swatch.selected {
    position: relative;
    box-shadow: 0 0 0 3px var(--accent-color), inset -2px -2px 4px rgba(0,0,0,0.1);
    transform: scale(1.1);
}

.stats-section {
    padding: 20px;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swatch-id {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
    line-height: 1;
    text-align: center;
    word-break: break-all;
    padding: 2px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateX(2px);
    background: var(--bg-tertiary);
}

.stat-color {
    width: 32px;
    height: 32px;
    border-radius: 4px; /* 方形 */
    border: none;
    flex-shrink: 0;
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.1), inset 1px 1px 2px rgba(255,255,255,0.3);
}

.stat-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-id {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-count {
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 10px;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-dialog {
    position: relative;
    background: var(--bg-primary);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    max-width: 620px;
    width: 92%;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    z-index: 2;
    pointer-events: auto;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-dialog {
    transform: scale(1);
}

.modal-dialog.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    padding: 7px 14px;
    font-size: 13px;
    min-width: 80px;
}

/* 导出模态专用样式 */
.export-modal .modal-dialog.export-dialog {
    max-width: 480px;
    width: 90%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.export-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.export-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
}

.export-footer {
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

.export-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
}

.export-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.export-subgroup {
    padding: 12px;
    margin-top: -8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-subgroup.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.export-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 180px;
}

.export-range input[type="range"] {
    flex: 1;
    height: 4px;
    accent-color: var(--accent-color);
}

.export-range-value {
    min-width: 20px;
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

.export-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.export-color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-dot:hover {
    transform: scale(1.1);
}

.color-dot.selected {
    border-color: var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.export-color-picker {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    cursor: pointer;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-item select,
.setting-item input[type="range"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.setting-item input[type="range"] {
    padding: 0;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


.btn-primary {
    background: var(--accent-color);
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.25);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(249, 115, 22, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

.modal-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.color-system-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 180px; /* 缩短选框宽度 */
}

.color-system-inline label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.selection-count {
    font-weight: 600;
    color: var(--text-primary);
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 16px; /* 调大字体 */
}

.selection-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.selection-actions .btn-secondary {
    padding: 8px 16px; /* 增大按钮内边距 */
    font-size: 14px; /* 增大按钮字体 */
    min-width: 80px;
}

.btn-tertiary {
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-tertiary:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

.color-group {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
}

.group-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-count {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 52px;
    text-align: right;
}

.group-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.group-actions {
    display: flex;
    gap: 6px;
}

.group-body {
    padding: 12px;
    background: var(--bg-primary);
}

.group-body.collapsed {
    display: none;
}

.color-checkbox-item .color-id {
    font-weight: 600;
    color: var(--text-primary);
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-color);
    color: var(--text-primary);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.color-checkbox-item input[type="checkbox"] {
    display: none;
}

.color-checkbox-item label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.color-checkbox-item label:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    background: var(--bg-primary);
}

.color-checkbox-item input:checked + label {
    border-color: var(--accent-color);
    background: rgba(255, 138, 61, 0.1);
    box-shadow: 0 4px 12px rgba(255, 138, 61, 0.15);
}

.color-sample {
    width: 36px;
    height: 36px;
    border-radius: 4px; /* 方形 */
    border: none;
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.1), inset 1px 1px 2px rgba(255,255,255,0.3);
}

.color-checkbox-item label span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inline-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Tooltip Styles */
.label-with-tooltip {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative; /* Set parent as relative positioning context */
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: help;
    /* position: relative; Removed to use parent's context */
}

.tooltip-icon:hover {
    color: var(--accent-color);
}

.tooltip-icon::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 0; /* Align with label start */
    /* transform: translateX(-50%); Removed centering */
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 13px;
    border-radius: 6px;
    white-space: pre-wrap; /* Allow wrapping */
    width: 220px; /* Fixed width to fit in sidebar */
    max-width: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
    text-align: left;
    font-weight: normal;
    line-height: 1.4;
}

.tooltip-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-4px); /* Only animate Y */
}

/* 面板遮罩层（由 JS 动态创建） */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.panel-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .toolbar-btn span:not(.mobile-label) {
        display: none;
    }

    .main-container {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 自定义工具光标 */
.cursor-pan { cursor: grab; }
.cursor-pan:active { cursor: grabbing; }
.cursor-brush { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/></svg>') 0 24, auto; }
.cursor-bucket { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M19 11l-8-8-9 9 8 8 5-5 9-9z"/><path d="M22 22l-5-10-5 5"/></svg>') 2 22, auto; }
.cursor-replace { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M23 4v6h-6"/><path d="M1 20v-6h6"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>') 12 12, auto; }
.cursor-eraser { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M20 20H7L3 16l10-10 8 8-1 6z"/><line x1="11" y1="14" x2="17" y2="20"/></svg>') 3 20, auto; }
.cursor-eyedropper { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M2 22l1-1 3 3-1 1zM14 8l-6 6"/><path d="M16 6l4-4 4 4-4 4-4-4z"/><line x1="12" y1="14" x2="12" y2="14"/></svg>') 2 22, auto; }

/* 移动端全面适配样式 */
@media (max-width: 768px) {
    :root {
        --toolbar-height: 56px;
        --panel-width: 85vw; /* 增加宽度利用率 */
    }

    /* 布局调整 */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .main-container {
        grid-template-columns: 1fr; /* 单列布局 */
        height: calc(100vh - var(--toolbar-height));
        overflow: hidden;
    }

    /* 顶部工具栏优化 */
    .top-toolbar {
        padding: 0 12px;
        justify-content: space-between;
        overflow-x: auto; /* 允许横向滚动 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* 隐藏滚动条 */
    }
    
    .top-toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar-center {
        display: flex; /* 移动端保持显示 */
        flex: 1;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 8px;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .toolbar-center::-webkit-scrollbar {
        display: none;
    }
    
    /* 核心功能按钮保持显示，但可滚动 */
    .toolbar-center.mobile-visible {
        display: flex;
    }
    
    .toolbar-btn {
        flex-shrink: 0; /* 防止按钮被压缩 */
        white-space: nowrap;
    }
    
    .toolbar-btn span:not(.mobile-label) {
        display: none; /* 隐藏文字只显示图标 */
    }

    /* 侧边面板改为底部抽屉式，允许实时预览 */
    .left-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 50vh; /* 占用一半屏幕高度 */
        background: var(--bg-primary);
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        border-right: none;
        border-left: none;
    }

    .left-panel {
        transform: translateY(100%);
    }

    .left-panel.show {
        transform: translateY(0);
    }

    /* 增大点击区域 (48x48px) */
    .toolbar-btn, 
    .btn-icon,
    .btn-close,
    .mobile-toggle {
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
    }

    /* 移动端显式切换按钮 */
    .mobile-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 2px;
        align-items: center;
        padding: 6px;
        transition: all 0.2s ease;
    }

    .mobile-toggle.active {
        background: var(--accent-color);
        border-color: var(--accent-color);
        color: white;
        box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
    }

    .mobile-toggle.active svg {
        stroke: white;
    }
    
    /* 移动端：工具栏置底，画布居中 */
    .workspace-area {
        flex-direction: column;
    }
    
    .top-bar-tools {
        order: 2; /* 置于底部 */
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        padding: 4px 10px;
        height: 64px;
        background: var(--bg-primary);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        justify-content: space-around;
    }
    
    .canvas-section {
        order: 1; /* 置于中部 */
        flex: 1;
    }

    /* 增加底部安全区适配 */
    .top-bar-tools {
        padding-bottom: max(4px, env(safe-area-inset-bottom));
        height: calc(60px + env(safe-area-inset-bottom));
    }

    /* 调整工具栏按钮间距，适应手指点击 */
    .top-bar-tools .toolbar-group {
        gap: 12px;
    }
    
    .top-bar-tools .tool-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    
    /* 隐藏不必要的分割线以节省空间 */
    .top-bar-tools .toolbar-divider {
        display: none;
    }
    
    /* 画布区域最大化 */
    .canvas-section {
        width: 100%;
        height: 100%;
        padding: 0;
    }
    
    /* 表单控件优化 */
    input[type="range"] {
        height: 24px; /* 更易拖动 */
    }
    
    .toggle {
        transform: scale(1.1); /* 略微放大开关 */
    }

    /* 字体大小基准调整 */
    html {
        font-size: 16px; /* 移动端基准 */
    }
    
    .section-title {
        font-size: 16px;
        padding: 16px;
    }
    
    /* 模态框全屏适配 */
    .modal-dialog {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }
}

/* Toast Notification Styles */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
}

/* Scroll Animations */
@keyframes animFadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes animSlideUp { 
    from { opacity: 0; transform: translateY(30px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes animSlideDown { 
    from { opacity: 0; transform: translateY(-30px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes animSlideLeft { 
    from { opacity: 0; transform: translateX(30px); } 
    to { opacity: 1; transform: translateX(0); } 
}

@keyframes animSlideRight { 
    from { opacity: 0; transform: translateX(-30px); } 
    to { opacity: 1; transform: translateX(0); } 
}

@keyframes animBlurIn { 
    from { opacity: 0; filter: blur(10px); transform: scale(0.95); } 
    to { opacity: 1; filter: blur(0); transform: scale(1); } 
}

.scroll-anim {
    /* Using animation-fill-mode: both ensures the 0% keyframe is applied 
       even when paused, effectively hiding the element initially without
       needing explicit opacity: 0 on the class (satisfying user request). */
    animation-duration: 0.8s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
    animation-play-state: paused;
}

.scroll-anim.anim-active {
    animation-play-state: running;
}

.anim-fade { animation-name: animFadeIn; }
.anim-up { animation-name: animSlideUp; }
.anim-down { animation-name: animSlideDown; }
.anim-left { animation-name: animSlideLeft; }
.anim-right { animation-name: animSlideRight; }
.anim-blur { animation-name: animBlurIn; }

.toast {
    background: rgba(30, 41, 59, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid #22c55e;
}

/* 颜色识别样式 */
.similar-colors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.similar-color-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.similar-color-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.similar-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.similar-color-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.similar-color-code {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.similar-color-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.similarity-score {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.picked-color-display {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.picked-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.picked-color-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

/* 缩放面板样式优化 */
#resizeActions .control-item {
    margin-bottom: 15px;
}

#resizeActions .chain-lock-container {
    margin: 10px 0;
}

#resizeActions .grid-actions-grid {
    margin-top: 20px !important;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-error {
    border-left: 4px solid #ef4444;
}
/* Language Selector Styles */
.toolbar-select {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 32px;
    padding: 0 8px;
}

.toolbar-select:hover {
    border-color: var(--primary-color);
}

.toolbar-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

body.dark-mode .toolbar-select {
    background-color: rgba(20, 20, 35, 0.6);
    border-color: rgba(0, 240, 255, 0.2);
    color: var(--text-primary);
}

body.dark-mode .toolbar-select:hover {
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Fix option background in dark mode */
body.dark-mode .toolbar-select option {
    background-color: #1a1a2e;
    color: #e0e0ff;
}

/* Language Dropdown */
.language-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 8px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    min-width: 160px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.dropdown-menu.show {
    display: flex;
    animation: fadeInDown 0.2s ease;
}

.dropdown-item {
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

.dropdown-item.active {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

body.dark-mode .dropdown-menu {
    background-color: #1a1a2e;
    border-color: rgba(0, 240, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}
