        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif; background: #0a0a0f; color: #e0e0e0; overflow: hidden; height: 100vh; }
        #canvas-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; background: #0a0a0f; }
        #canvas-container.transparent-bg { background: repeating-conic-gradient(#222 0% 25%, #333 0% 50%) 0 0 / 20px 20px; }
        canvas { display: block; }
        .header { position: fixed; top: 0; left: 0; right: 0; min-height: 64px; background: linear-gradient(180deg, rgba(15, 15, 25, 0.95), rgba(15, 15, 25, 0.8)); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255, 255, 255, 0.06); display: flex; align-items: center; justify-content: space-between; padding: 4px 24px; z-index: 100; }
        .logo { display: flex; align-items: center; gap: 12px; }
        .logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, #8b5cf6, #06b6d4); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
        .logo-text { font-size: 18px; font-weight: 600; background: linear-gradient(135deg, #8b5cf6, #06b6d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
        .header-actions { display: flex; gap: 12px; }
        .btn { padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
        .btn-secondary { background: rgba(255, 255, 255, 0.06); color: #e0e0e0; border: 1px solid rgba(255, 255, 255, 0.1); }
        .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
        .btn-primary { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }
        .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
        .control-panel { position: fixed; top: 72px; right: 16px; width: 340px; max-height: calc(100vh - 88px); background: rgba(20, 20, 30, 0.85); backdrop-filter: blur(20px); border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.08); overflow: hidden; z-index: 50; display: flex; flex-direction: column; animation: slideIn 0.3s ease; }
        @keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
        .panel-tabs { display: flex; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding: 8px; gap: 4px; flex-wrap: wrap; }
        .panel-tab { flex: 1; min-width: 60px; padding: 8px 10px; border: none; background: transparent; color: #888; font-size: 12px; font-weight: 500; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
        .panel-tab:hover { color: #ccc; background: rgba(255, 255, 255, 0.05); }
        .panel-tab.active { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
        .panel-content { flex: 1; overflow-y: auto; padding: 16px; }
        .panel-content::-webkit-scrollbar { width: 6px; }
        .panel-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
        .tab-pane { display: none; }
        .tab-pane.active { display: block; }
        .control-group { margin-bottom: 20px; }
        .control-group-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
        .control-row { margin-bottom: 14px; }
        .control-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
        .control-label span { font-size: 13px; color: #ccc; }
        .control-value { font-size: 12px; color: #8b5cf6; font-weight: 500; font-family: monospace; }
        input[type="range"] { width: 100%; height: 6px; -webkit-appearance: none; background: rgba(255, 255, 255, 0.1); border-radius: 3px; outline: none; }
        input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, #8b5cf6, #7c3aed); cursor: pointer; box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4); }
        .color-input-wrapper { display: flex; align-items: center; gap: 10px; }
        input[type="color"] { width: 40px; height: 32px; border: none; border-radius: 6px; cursor: pointer; background: transparent; }
        input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
        input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.1); }
        .color-hex { font-family: monospace; font-size: 12px; color: #888; }
        select { width: 100%; padding: 10px 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #e0e0e0; font-size: 13px; cursor: pointer; outline: none; }
        select:hover { background: rgba(255, 255, 255, 0.08); }
        .toggle-wrapper { display: flex; align-items: center; justify-content: space-between; }
        .toggle { position: relative; width: 44px; height: 24px; background: rgba(255, 255, 255, 0.1); border-radius: 12px; cursor: pointer; transition: all 0.3s; }
        .toggle.active { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
        .toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: all 0.3s; }
        .toggle.active::after { left: 22px; }
        .presets-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
        .preset-btn { padding: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; cursor: pointer; transition: all 0.2s; text-align: center; }
        .preset-btn:hover { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.3); }
        .preset-btn.active { background: rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.5); }
        .preset-icon { font-size: 24px; margin-bottom: 6px; }
        .preset-name { font-size: 11px; color: #ccc; font-weight: 500; }
        .n-selector { display: flex; gap: 6px; flex-wrap: wrap; }
        .n-btn { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #ccc; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
        .layer-btn { flex: 1; padding: 6px 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #ccc; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
        .layer-btn:hover { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.3); }
        .layer-btn.active { background: linear-gradient(135deg, #8b5cf6, #7c3aed); border-color: transparent; color: white; }
        .n-btn:hover { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.3); }
        .n-btn.active { background: linear-gradient(135deg, #8b5cf6, #7c3aed); border-color: transparent; color: white; }
        .info-panel { position: fixed; bottom: 16px; left: 16px; background: rgba(20, 20, 30, 0.85); backdrop-filter: blur(20px); border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.08); padding: 16px 20px; z-index: 50; }
        .info-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
        .info-row + .info-row { margin-top: 8px; }
        .info-label { color: #888; }
        .info-value { color: #e0e0e0; font-family: monospace; }
        .equation-display { background: rgba(0, 0, 0, 0.3); border-radius: 8px; padding: 12px 16px; margin-top: 12px; font-family: 'Times New Roman', serif; font-size: 18px; text-align: center; color: #a78bfa; }
        .equation-sup { font-size: 12px; vertical-align: super; }
        .loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0a0a0f; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; transition: opacity 0.5s; }
        .loading-overlay.hidden { opacity: 0; pointer-events: none; }
        .loading-spinner { width: 60px; height: 60px; border: 3px solid rgba(139, 92, 246, 0.2); border-top-color: #8b5cf6; border-radius: 50%; animation: spin 1s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loading-text { margin-top: 20px; color: #888; font-size: 14px; }

        /* Colormap Editor */
        .colormap-editor { margin-top: 12px; }
        .colormap-gradient { height: 32px; border-radius: 8px; position: relative; cursor: crosshair; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.1); }
        .colormap-stop { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid white; box-shadow: 0 2px 6px rgba(0,0,0,0.4); cursor: grab; transform: translate(-50%, -50%); top: 50%; transition: transform 0.1s; z-index: 10; }
        .colormap-stop:hover { transform: translate(-50%, -50%) scale(1.2); }
        .colormap-stop.dragging { cursor: grabbing; transform: translate(-50%, -50%) scale(1.3); z-index: 20; }
        .colormap-stop.selected { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.4), 0 2px 6px rgba(0,0,0,0.4); }
        .stop-controls { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
        .stop-controls input[type="color"] { width: 36px; height: 28px; }
        .stop-controls .btn { padding: 6px 10px; font-size: 11px; }
        .stop-position { width: 60px; padding: 6px 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; color: #e0e0e0; font-size: 12px; text-align: center; }

        /* Color Palette */
        .color-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
        .palette-color { width: 28px; height: 28px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
        .palette-color:hover { transform: scale(1.15); border-color: white; }
        .palette-section { margin-bottom: 16px; }
        .palette-title { font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }

        /* Colormap Presets */
        .colormap-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
        .colormap-preset { height: 24px; flex: 1; min-width: 70px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
        .colormap-preset:hover { border-color: rgba(255,255,255,0.3); }
        .colormap-preset.active { border-color: #8b5cf6; }

        /* Product Gradient Presets */
        .product-presets-wrap { margin-bottom: 12px; }
        .product-presets-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; user-select: none; }
        .product-presets-toggle:hover { color: #bbb; }
        .product-presets-toggle .arrow { display: inline-block; transition: transform 0.2s; font-size: 8px; }
        .product-presets-toggle .arrow.open { transform: rotate(90deg); }
        .product-presets { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 3px; align-items: center; }
        .product-preset-checkbox { width: 14px; height: 14px; accent-color: #8b5cf6; cursor: pointer; margin: 0; }
        .product-preset { height: 20px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 600; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,0.8), 0 1px 2px rgba(0,0,0,0.6); user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
        .product-preset:hover { border-color: rgba(255,255,255,0.3); transform: scale(1.02); }
        .product-preset.active { border-color: #8b5cf6; }

        /* Header Export Controls */
        .export-group { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
        .header-scale-select { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 4px; color: #aaa; font-size: 10px; padding: 2px 4px; cursor: pointer; outline: none; }
        .header-scale-select:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
        .header-select-row { display: flex; gap: 2px; }
        .header-select-row .header-scale-select { flex: 1; min-width: 0; }
        .header-toggle-group { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, 0.1); border-right: 1px solid rgba(255, 255, 255, 0.1); }
        .header-toggle-label { font-size: 9px; color: #888; text-transform: uppercase; white-space: nowrap; }
        .header .btn { height: 32px; }
