﻿        :root {
            --bg-primary: #0F172A;
            --bg-secondary: #1E293B;
            --bg-tertiary: #1E293B;
            --bg-card: #1E293B;
            --accent-neon: #38BDF8;
            --accent-blue: #38BDF8;
            --text-primary: #E2E8F0;
            --text-secondary: #94A3B8;
            --border-color: #334155;
            --glow: 0 0 12px rgba(56,189,248,0.25);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
            color: var(--text-primary);
            margin: 0;
            padding: 0;
            width: 100vw;
            height: 100vh;
            overflow: hidden;
        }

        .container {
            display: grid;
            grid-template-columns: 288px 1fr 370px;
            width: 100%;
            height: 100vh;
            overflow: hidden;
            gap: 0;
            position: relative;
            transition: grid-template-columns 0.3s ease;
        }

        .container.right-collapsed {
            grid-template-columns: 288px 1fr 0px;
        }

        .right-sidebar {
            width: 370px;
            background: #0F172A;
            border-radius: 0;
            border: none;
            border-left: 1px solid #334155;
            padding: 0;
            box-shadow: none;
            position: relative;
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: row;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            transition: width 0.3s ease, opacity 0.25s ease, transform 0.3s ease;
        }

        .container.right-collapsed .right-sidebar {
            width: 0;
            opacity: 0;
            pointer-events: none;
            transform: translateX(100%);
        }

        /* Botão flutuante para reabrir sidebar */
        #toggleRightSidebarBtn {
            position: fixed;
            bottom: 16px;
            right: 16px;
            z-index: 999;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(15, 23, 42, 0.9);
            border: 1px solid #334155;
            color: #94A3B8;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            backdrop-filter: blur(8px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }
        #toggleRightSidebarBtn:hover {
            color: #00ffff;
            border-color: #00ffff;
            box-shadow: 0 0 12px rgba(0,255,255,0.2);
        }
        .container:not(.right-collapsed) #toggleRightSidebarBtn {
            right: 386px;
        }

        /* ═══ Smart Save Dialog (Ctrl+S) ═══ */
        .smart-save-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 9998;
            backdrop-filter: blur(3px);
        }
        .smart-save-panel {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 9999;
            background: #0F172A;
            border: 1px solid #334155;
            border-radius: 12px;
            padding: 20px;
            min-width: 320px;
            max-width: 420px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            font-family: Inter, system-ui, sans-serif;
        }
        .smart-save-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 14px;
            color: #E2E8F0;
            font-size: 15px;
            font-weight: 600;
        }
        .smart-save-close {
            background: none;
            border: none;
            color: #94A3B8;
            font-size: 20px;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
        }
        .smart-save-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
        .smart-save-name {
            width: 100%;
            padding: 10px 12px;
            background: #1E293B;
            border: 1px solid #334155;
            border-radius: 8px;
            color: #E2E8F0;
            font-size: 14px;
            outline: none;
            margin-bottom: 14px;
            box-sizing: border-box;
        }
        .smart-save-name:focus { border-color: #00ffff; box-shadow: 0 0 0 2px rgba(0,255,255,0.15); }
        .smart-save-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .smart-save-option {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 14px;
            background: #1E293B;
            border: 1px solid #334155;
            border-radius: 8px;
            color: #E2E8F0;
            cursor: pointer;
            transition: all 0.15s ease;
            text-align: left;
            font-family: inherit;
            font-size: 13px;
        }
        .smart-save-option:hover {
            border-color: #00ffff;
            background: rgba(0,255,255,0.05);
            box-shadow: 0 0 8px rgba(0,255,255,0.1);
        }
        .smart-save-icon { font-size: 20px; flex-shrink: 0; }
        .smart-save-label { font-weight: 600; flex: 1; }
        .smart-save-desc { color: #64748B; font-size: 11px; white-space: nowrap; }

        .left-sidebar {
            background: var(--bg-tertiary);
            border-radius: 0;
            border: none;
            border-right: 1px solid var(--border-color);
            padding: 0;
            box-shadow: none;
            position: relative;
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: row;
        }

        /* Content column inside left sidebar */
        .left-sidebar-content {
            flex: 1;
            min-width: 0;
            padding: 12px;
            overflow-y: auto;
            overflow-x: hidden;
            height: 100vh;
        }

        /* Toolbar column inside left sidebar (mirroring right-sidebar-toolbar) */
        .left-sidebar-toolbar {
            width: 46px;
            min-width: 46px;
            background: #0F172A;
            border-left: 1px solid #334155;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 8px 3px;
            gap: 5px;
            overflow-y: auto;
            height: 100vh;
        }

        .left-sidebar-toolbar .icon-action-btn {
            width: 34px;
            height: 30px;
            margin: 0;
            padding: 0;
            flex-shrink: 0;
        }

        .left-sidebar-toolbar .icon-action-btn.active {
            color: var(--accent-neon);
            border-color: rgba(56,189,248,0.35);
            background: rgba(56,189,248,0.12);
        }

        .left-sidebar-toolbar .toolbar-separator {
            width: 26px;
            height: 1px;
            background: #334155;
            margin: 4px 0;
            flex-shrink: 0;
        }

        .left-sidebar-toolbar .icon-action-btn::after {
            display: none !important;
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 0;
            position: relative;
            height: 100vh;
            overflow: hidden;
            min-width: 0;
        }

        /* .right-sidebar principal definido acima (com transitions para collapse) */

        /* Toolbar column inside right sidebar */
        .right-sidebar-toolbar {
            width: 46px;
            min-width: 46px;
            background: #0F172A;
            border-right: 1px solid #334155;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 8px 3px;
            gap: 5px;
            overflow-y: auto;
            height: 100vh;
        }

        .right-sidebar-toolbar .icon-action-btn {
            width: 34px;
            height: 32px;
            margin: 0;
            padding: 0;
            flex-shrink: 0;
        }

        /* Disable CSS ::after tooltips where JS tooltip takes over */
        .right-sidebar-toolbar .icon-action-btn::after,
        .left-sidebar-tools .icon-action-btn::after {
            display: none !important;
        }

        .right-sidebar-toolbar .toolbar-separator {
            width: 26px;
            height: 1px;
            background: #334155;
            margin: 2px 0;
            flex-shrink: 0;
        }

        /* Parameters column inside right sidebar */
        .right-sidebar-params {
            flex: 1;
            min-width: 0;
            padding: 16px;
            overflow-y: auto;
            height: 100vh;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }

        .subtitle {
            display: none;
        }

        /* ===== VISUALIZADOR SVG ===== */
        .svg-container {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0;
            background: var(--bg-primary);
            border-radius: 0;
            border: none;
            box-shadow: none;
            filter: none;
            padding: 0;
            position: relative;
            flex: 1;
            overflow: hidden;
            z-index: 0;
        }

        /* Left-sidebar gallery rectangular button */
        .gallery-rect-btn {
            width: 100%;
            padding: 8px 12px;
            border-radius: 10px;
            border: 1px solid var(--border-color);
            background: linear-gradient(90deg, rgba(56,189,248,0.06), rgba(0,128,255,0.02));
            color: var(--accent-neon);
            font-weight: 600;
            cursor: pointer;
            text-align: left;
        }

        .gallery-rect-btn:hover { box-shadow: 0 0 12px rgba(56,189,248,0.08); }

        /* Small discrete action buttons */
        .small-action-btn {
            padding: 6px 8px;
            min-width: 34px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.06);
            background: transparent;
            color: var(--text-secondary);
            font-size: 0.85em;
            cursor: pointer;
        }

        .small-action-btn:hover { border-color: var(--accent-neon); color: var(--accent-neon); }

        /* Icon-only action buttons with hover tooltip */
        .icon-action-btn {
            width: 40px;
            height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.04);
            background: transparent;
            color: var(--text-secondary);
            font-size: 1.05em;
            cursor: pointer;
            margin-right: 8px;
            position: relative;
        }
        .icon-action-btn:hover { color: var(--accent-neon); border-color: rgba(56,189,248,0.18); box-shadow: 0 4px 12px rgba(56,189,248,0.03); }
        .icon-action-btn::after {
            content: attr(data-title);
            position: absolute;
            top: -34px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.85em;
            white-space: nowrap;
            border: 1px solid var(--border-color);
            box-shadow: 0 2px 8px rgba(0,0,0,0.45);
            z-index: 9999; /* ensure tooltip stays on top */
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.14s ease;
        }
        .icon-action-btn:hover::after { opacity: 1; }

        /* Action buttons — now embedded in sidebar toolbar, not floating */
        .action-buttons {
            display: none; /* hidden — buttons moved into .right-sidebar-toolbar */
            position: fixed;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 6px;
            z-index: 100;
            background: rgba(30, 30, 40, 0.95);
            padding: 8px 6px;
            border-radius: 12px;
            border: 1px solid rgba(56,189,248, 0.2);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        }

        /* Active visual state for compact icon buttons (used for curve toggles) */
        .icon-action-btn.active {
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            color: var(--bg-primary);
            border-color: var(--accent-neon);
            box-shadow: 0 0 20px rgba(56,189,248,0.5);
        }

        /* Palette swatches — compact, no gap between colors */
        .palette-swatches { display:flex; gap:0; align-items:center; }
        .palette-swatches .swatch {
            width: 24px;
            height: 24px;
            border-radius: 4px;
            border: 1px solid rgba(255,255,255,0.06);
            cursor: pointer;
            box-shadow: 0 1px 2px rgba(0,0,0,0.25);
            transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
            flex-shrink: 0;
            margin-right: 0;
        }
        .palette-swatches .swatch:hover { transform: translateY(-2px); border-color: var(--accent-neon); box-shadow: 0 6px 18px rgba(0,128,255,0.08); }
        .palette-swatches .swatch.active { box-shadow: 0 0 0 3px rgba(56,189,248,0.06); border-color: var(--accent-neon); }

        /* temporary small badge to show action result */
        .temp-badge {
            position: absolute;
            top: -6px;
            right: -6px;
            background: #2ee6b6;
            color: #012; /* dark text */
            padding: 2px 6px;
            border-radius: 12px;
            font-size: 0.75em;
            box-shadow: 0 2px 8px rgba(0,0,0,0.35);
            z-index: 50;
            transform-origin: center;
        }
        /* Visual icon for minimal left-sidebar groups */
        .visual-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            border-radius: 6px;
            color: var(--accent-neon);
            margin-right: 8px;
            flex-shrink: 0;
        }

        /* Particle controls: vertical stacking to avoid overflow */
        .visual-group .particle-row { display:flex; flex-direction:column; align-items:flex-start; gap:6px; margin-top:8px; min-width:0; width:100%; }
        .visual-group .particle-row .opacity-display { align-self:flex-end; color:var(--text-secondary); font-size:0.9em; }
        .visual-inline .particle-row { width:100%; }
        .particle-row input { width:100%; }
        .particle-row .opacity-display { width:100%; text-align:right; }
        .particle-label { font-size:0.85em; color:#94A3B8; margin-top:2px; }

        /* Ensure small zoom buttons scale their svg icons neatly */
        .zoom-btn svg { width:14px; height:14px; display:block; }

        /* Palette swatches */
        .palette-swatches .swatch {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            border: 2px solid rgba(255,255,255,0.04);
            cursor: pointer;
            box-shadow: 0 1px 3px rgba(0,0,0,0.35);
            transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
            flex-shrink: 0;
        }
        .palette-swatches .swatch:hover { transform: translateY(-3px); border-color: var(--accent-neon); box-shadow: 0 6px 18px rgba(0,128,255,0.08); }
        .palette-swatches .swatch.active { box-shadow: 0 0 0 3px rgba(56,189,248,0.06); border-color: var(--accent-neon); }

        .palette-gallery { display:flex; gap:8px; flex-wrap:wrap; }
        .palette-preview { display:flex; gap:4px; padding:6px; border-radius:8px; border:1px solid rgba(255,255,255,0.04); cursor:pointer; }
        .palette-preview .p { width:18px; height:18px; border-radius:3px; }

        .hidden { display:none !important; }

        /* Tooltip on hover, without shifting layout */
        .visual-group, .visual-group * { position: relative; }
        .visual-group:hover::before {
            content: attr(data-title);
            position: absolute;
            top: -34px;
            left: 0;
            transform: translateY(0);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.86em;
            white-space: nowrap;
            border: 1px solid var(--border-color);
            box-shadow: 0 2px 8px rgba(0,0,0,0.5);
            z-index: 20;
        }

        /* Layout: default vertical stacking of sections; use .visual-inline for horizontal rows */
        .visual-group { display:block; margin-bottom:10px; }
        .visual-inline { display:flex; gap:8px; align-items:center; }
        .visual-inline .visual-icon { flex: 0 0 auto; }
        .visual-inline .toggle-label { flex: 0 0 auto; }

        /* Tooltip for individual small icons */
        .visual-icon { position: relative; cursor: pointer; }
        .visual-icon::after {
            content: attr(data-title);
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.85em;
            white-space: nowrap;
            border: 1px solid var(--border-color);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.12s ease;
            z-index: 9999;
        }
        .visual-icon:hover::after { opacity: 1; }

        /* Hide textual 'Ativado/Desativado' labels - the button visual state is the indicator */
        .toggle-text { display:none; }

        /* Opacity slider sizing and inline percent */
        .opacity-slider { width: 160px; }
        .opacity-display { min-width:40px; text-align:left; font-size:0.95em; color:var(--text-secondary); }

        /* Ensure toggles and icons align nicely */
        .toggle-label { display:inline-flex; align-items:center; gap:8px; }


        /* Sidebar on top of portal */
        .left-sidebar, .right-sidebar { z-index: 10; }

        /* Ensure top alignment */
        body { padding-top: 0; }
        .container { min-height: 100vh; align-items: stretch; padding-top: 0; }

        /* Section headers: icon + visible title */
        .section-header { display:flex; align-items:center; gap:8px; color:var(--text-secondary); margin-bottom:8px; }
        .section-header .section-title { font-size:1.02em; color:var(--text-primary); font-weight:600; }
        .section-icon { color:var(--accent-neon); flex:0 0 auto; }

        /* Controls inside sections should show name on hover only */
        .control-group h3 { display:none; }
        .control-icon { position:relative; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; color:var(--accent-neon); }
        .control-icon::after { content: attr(data-title); position:absolute; top:-28px; left:50%; transform:translateX(-50%); background:var(--bg-tertiary); color:var(--accent-neon); padding:4px 8px; border-radius:6px; font-size:0.86em; white-space:nowrap; border:1px solid var(--border-color); opacity:0; pointer-events:none; transition:opacity 0.12s ease; z-index:9999; }
        .control-icon:hover::after { opacity:1; }

        /* slider-group: place inputs and inline icon in one row */
        .slider-group { display:flex; gap:8px; align-items:center; }
        .control-inline-icon { position:relative; display:inline-flex; width:20px; height:20px; align-items:center; justify-content:center; color:var(--accent-neon); cursor:pointer; }
        .control-inline-icon::after { content: attr(data-title); position:absolute; top:-28px; left:50%; transform:translateX(-50%); background:var(--bg-tertiary); color:var(--accent-neon); padding:4px 8px; border-radius:6px; font-size:0.86em; white-space:nowrap; border:1px solid var(--border-color); opacity:0; pointer-events:none; transition:opacity 0.12s ease; z-index:9999; }
        .control-inline-icon:hover::after { opacity:1; }

        /* gallery rect button tooltip */
        .icon-with-hover { position:relative; }
        .icon-with-hover::after { content: attr(data-title); position:absolute; top:-34px; left:50%; transform:translateX(-50%); background:var(--bg-tertiary); color:var(--accent-neon); padding:4px 8px; border-radius:6px; font-size:0.86em; white-space:nowrap; border:1px solid var(--border-color); opacity:0; pointer-events:none; transition:opacity 0.12s ease; z-index:9999; }
        .icon-with-hover:hover::after { opacity:1; }

        .svg-container svg {
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, var(--bg-secondary) 0%, var(--bg-primary) 100%);
            border-radius: 10px;
        }

        /* ===== SELETOR DE TIPO DE CURVA ===== */
        .curve-type-selector {
            background: var(--bg-tertiary);
            border-radius: 15px;
            border: 1px solid var(--border-color);
            padding: 20px;
            margin-bottom: 5px;
        }

        .curve-type-selector h3 {
            display: none; /* Escondido - título aparece no hover */
        }

        .curve-type-selector {
            position: relative;
        }

        .curve-type-selector:hover::before {
            content: attr(data-title);
            position: absolute;
            top: -10px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 5px 10px;
            border-radius: 5px;
            font-size: 0.9em;
            white-space: nowrap;
            z-index: 1000;
            border: 1px solid var(--border-color);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }

        .curve-type-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 8px;
            justify-content: center;
        }

        .curve-type-btn {
            padding: 8px 10px;
            background: var(--bg-primary);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-secondary);
            font-size: 0.75em;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            width: 100%;
            min-height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .curve-type-btn:hover {
            border-color: var(--accent-neon);
            box-shadow: 0 0 15px rgba(56,189,248, 0.3);
        }

        .curve-type-btn.active {
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            color: var(--bg-primary);
            border-color: var(--accent-neon);
            box-shadow: 0 0 20px rgba(56,189,248, 0.5);
        }

        .curve-type-btn.active:hover {
            transform: scale(1.05);
        }

        .associated-curves {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            justify-content: center;
            margin-top: 10px;
        }

        .associated-curve-btn {
            padding: 7px 10px;
            background: #1E293B;
            border: 1px solid #334155;
            border-radius: 6px;
            color: #94A3B8;
            font-size: 11px;
            font-weight: 500;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: center;
            min-height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
        }

        .associated-curve-btn:hover {
            border-color: #38BDF8;
            color: #38BDF8;
        }

        .associated-curve-btn.active {
            background: rgba(56, 189, 248, 0.15);
            color: #38BDF8;
            border-color: #38BDF8;
        }

        /* ===== NOVAS CURVAS MATEMÁTICAS ===== */
        .advanced-curves {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 12px;
        }

        .advanced-curve-btn {
            background: #1E293B;
            border: 1px solid #334155;
            color: #E2E8F0;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s ease;
            text-align: center;
            min-height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            box-shadow: none;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }

        .advanced-curve-btn:hover {
            background: rgba(56,189,248,0.08);
            border-color: #38BDF8;
            color: #38BDF8;
            box-shadow: 0 0 8px rgba(56,189,248,0.15);
            transform: none;
        }

        .advanced-curve-btn.active {
            background: rgba(56,189,248,0.15);
            border-color: #38BDF8;
            color: #38BDF8;
            box-shadow: 0 0 12px rgba(56,189,248,0.3);
            animation: none;
        }

        /* Square icon-only curve buttons (Polar, Lotus, TLM) */
        .advanced-curve-btn.curve-icon-btn {
            width: 36px;
            height: 36px;
            min-height: 36px;
            padding: 0;
            font-size: 0;
        }
        .advanced-curve-btn.curve-icon-btn svg {
            width: 16px;
            height: 16px;
        }

        /* ═══════════════════════════════════════════════════════════════════ */
        /* CURVE ROW — inline activation button + drawer toggle              */
        /* ═══════════════════════════════════════════════════════════════════ */
        .curve-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 4px;
        }

        .curve-activate-btn {
            width: 34px;
            height: 34px;
            min-width: 34px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            border: 1px solid #334155;
            background: #1E293B;
            color: #94A3B8;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }
        .curve-activate-btn:hover {
            border-color: #38BDF8;
            color: #38BDF8;
            background: rgba(56,189,248,0.08);
        }
        .curve-activate-btn.active {
            border-color: #38BDF8;
            color: #38BDF8;
            background: rgba(56,189,248,0.15);
            box-shadow: 0 0 10px rgba(56,189,248,0.25);
        }
        .curve-activate-btn svg {
            width: 16px;
            height: 16px;
        }

        .curve-drawer-toggle {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border-radius: 8px;
            border: 1px solid #334155;
            background: #1E293B;
            color: #E2E8F0;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            text-align: left;
        }
        .curve-drawer-toggle:hover {
            background: rgba(56,189,248,0.06);
            border-color: rgba(56,189,248,0.3);
        }
        .curve-drawer-toggle .curve-drawer-label {
            flex: 1;
        }
        .curve-drawer-toggle .chevron-icon {
            color: #94A3B8;
            transition: transform 0.25s ease, color 0.2s;
            flex-shrink: 0;
        }
        .curve-drawer-toggle:hover .chevron-icon {
            color: #38BDF8;
        }
        .curve-drawer-toggle:not(.collapsed) .chevron-icon {
            transform: rotate(90deg);
            color: #38BDF8;
        }

        .curve-drawer {
            background: rgba(15,23,42,0.5);
            border: 1px solid #334155;
            border-top: none;
            border-radius: 0 0 8px 8px;
            padding: 12px 16px;
            margin-top: -4px;
            margin-bottom: 12px;
        }
        .curve-drawer.hidden {
            display: none;
        }

        /* --- Drawer Content Classes (Orion) --- */
        .drawer-group {
            margin-bottom: 10px;
        }
        .drawer-label {
            display: block;
            font-size: 11px;
            color: #94A3B8;
            margin-bottom: 4px;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            font-weight: 500;
            letter-spacing: 0.3px;
        }
        .drawer-label-inline {
            font-size: 11px;
            color: #94A3B8;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }
        .drawer-select {
            width: 100%;
            padding: 6px 10px;
            border-radius: 6px;
            border: 1px solid #334155;
            background: #0F172A;
            color: #E2E8F0;
            font-size: 12px;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            cursor: pointer;
            transition: border-color 0.2s;
        }
        .drawer-select:hover,
        .drawer-select:focus {
            border-color: #38BDF8;
            outline: none;
        }
        .drawer-color-row {
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .drawer-params {
            border-top: 1px solid #334155;
            padding-top: 8px;
        }
        .drawer-param-label {
            font-size: 10px;
            color: #94A3B8;
            min-width: 80px;
            display: inline-block;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }
        .drawer-footer {
            font-size: 9px;
            color: #475569;
            margin-top: 10px;
            text-align: center;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }

        /* ===== CONTROLES ===== */
        .controls {
            display: flex;
            flex-direction: column;
            gap: 2px;
            margin-bottom: 5px;
        }

        .control-group {
            background: var(--bg-secondary);
            padding: 6px; /* reduzido para compactidade */
            border-radius: 10px;
            border: 1px solid var(--border-color);
            margin-bottom: 2px;
        }

        .control-group h3 {
            display: none; /* Escondido - títulos aparecem no hover */
        }

        /* Inside right-sidebar, show h3 and small as Orion labels */
        .right-sidebar .control-group h3 {
            display: block;
            font-size: 11px;
            font-weight: 500;
            color: #94A3B8;
            margin-bottom: 8px;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            letter-spacing: 0.3px;
        }
        .right-sidebar .control-group small {
            display: block;
            font-size: 10px;
            color: #475569;
            margin-bottom: 8px;
            font-family: Inter, system-ui, -apple-system, sans-serif;
        }
        .right-sidebar .control-group {
            background: transparent;
            border: none;
            padding: 0;
            margin-bottom: 12px;
        }
        .right-sidebar .control-group + .control-group {
            padding-top: 10px;
            border-top: 1px solid #334155;
        }

        .control-group {
            position: relative;
        }

        .control-group:hover::before {
            content: attr(data-title);
            position: absolute;
            top: -10px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 4px 8px;
            border-radius: 5px;
            font-size: 0.9em;
            white-space: nowrap;
            z-index: 1000;
            border: 1px solid var(--border-color);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }

        .slider-container {
            margin-bottom: 12px;
        }

        .slider-container label {
            display: block;
            margin-bottom: 6px;
            color: var(--text-secondary);
            font-weight: 500;
            font-size: 0.95em;
        }

        .slider-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .slider-group input[type=range] {
            flex: 1; /* sliders ocupam o máximo de espaço horizontal disponível */
            margin-right: 10px;
        }

        .precise-controls {
            display: flex;
            align-items: center;
            gap: 6px; /* mais compact */
            margin-top: 6px;
        }

        .number-input {
            width: 78px; /* ampliado para acomodar 4 casas decimais */
            padding: 4px 6px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 0.95em;
            text-align: center;
            outline: none;
            transition: all 0.12s ease;
        }

        .number-input.compact-number { padding: 4px 6px; width: 78px; font-size:0.92em; }

        .number-input:focus {
            border-color: var(--accent-neon);
            box-shadow: 0 0 8px rgba(56,189,248, 0.22);
        }

        /* Mostrar setas nativas (mantemos aparência padrão do navegador para inputs numéricos) */
        .number-input::-webkit-outer-spin-button,
        .number-input::-webkit-inner-spin-button {
            -webkit-appearance: auto;
            appearance: auto;
            margin: 0;
        }

        .number-input[type=number] {
            -moz-appearance: number-input;
            appearance: number-input;
        }

        .arrow-buttons {
            display: none; /* external arrow controls removed in favor of native input spinners */
        }

        .arrow-btn {
            width: 30px;
            height: 20px;
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            border: none;
            border-radius: 3px;
            color: var(--bg-primary);
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .arrow-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 0 8px rgba(56,189,248, 0.5);
        }

        .arrow-btn:active {
            transform: scale(0.95);
        }

        .arrow-btn.up::before {
            content: "▲";
        }

        .arrow-btn.down::before {
            content: "▼";
        }

        /* Destaque para parâmetro ativo (controlado pelo teclado) */
        .control-group.active-param {
            border-color: #38BDF8;
            box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
            background: rgba(56, 189, 248, 0.05);
        }

        .control-group.active-param h3 {
            color: #38BDF8;
            text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
        }

        /* Mensagem de ajuda do teclado */
        .keyboard-help {
            background: linear-gradient(135deg, rgba(56,189,248, 0.1), rgba(0, 128, 255, 0.1));
            border: 1px solid var(--accent-neon);
            border-radius: 8px;
            padding: 10px;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .keyboard-help .help-icon {
            font-size: 20px;
            color: var(--accent-neon);
        }

        .keyboard-help .help-text {
            font-size: 0.85em;
            color: var(--text-primary);
            line-height: 1.4;
        }

        .keyboard-help .help-text strong {
            color: var(--accent-neon);
        }

        .keyboard-help .help-text small {
            color: var(--text-secondary);
            font-style: italic;
        }

        /* ===== CONTROLES VISUAIS ===== */
        .visual-controls {
            display: flex;
            flex-direction: column;
            gap: 10px;
            background: transparent;
            padding: 0;
            border: none;
            border-radius: 0;
        }

        .visual-controls h2 {
            margin-bottom: 15px;
            font-size: 1.3em;
            text-align: center;
            color: var(--accent-neon);
        }

        .visual-group {
            background: rgba(56,189,248, 0.05);
            padding: 10px;
            border-radius: 8px;
            border: 1px solid rgba(56,189,248, 0.2);
        }

        .visual-group h4 {
            color: var(--accent-blue);
            margin-bottom: 10px;
            font-size: 1em;
            text-align: center;
        }

        .zoom-controls {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
        }

        .zoom-btn {
            width: 40px;
            height: 40px;
            background: transparent;
            border: 1px solid rgba(255,255,255,0.9);
            border-radius: 50%;
            color: #fff;
            font-size: 18px;
            font-weight: normal;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
        }

        .zoom-btn:hover {
            transform: scale(1.06);
            border-color: rgba(255,255,255,1);
            background: rgba(255,255,255,0.02);
        }

        .zoom-btn:active {
            transform: scale(0.98);
        }

        .center-btn {
            width: 40px;
            height: 40px;
            background: transparent;
            border: 1px solid rgba(255,255,255,0.9);
            border-radius: 50%;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
            margin-left: 10px;
        }

        .center-btn:hover {
            transform: scale(1.06);
            border-color: rgba(255,255,255,1);
            background: rgba(255,255,255,0.02);
        }

        .center-btn:active {
            transform: scale(0.98);
        }

        .center-btn .unlock-icon {
            display: inline;
        }

        .center-btn .lock-icon {
            display: none;
        }

        .center-btn.locked .unlock-icon {
            display: none;
        }

        .center-btn.locked .lock-icon {
            display: inline;
        }

        .zoom-display {
            font-size: 1.2em;
            font-weight: bold;
            color: var(--accent-neon);
            min-width: 60px;
            text-align: center;
        }

        .color-picker {
            width: 100%;
            height: 40px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            background: var(--bg-primary);
            border: 2px solid var(--border-color);
            transition: all 0.2s ease;
        }

        .color-picker:hover {
            border-color: var(--accent-neon);
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
        }

        .gradient-select {
            width: 100%;
            padding: 8px 12px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 0.9em;
            outline: none;
            transition: all 0.2s ease;
        }

        .gradient-select:focus {
            border-color: var(--accent-neon);
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
        }

        .opacity-slider {
            width: 100%;
            height: 6px;
            background: var(--bg-primary);
            border-radius: 3px;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
        }

        .opacity-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            cursor: pointer;
            box-shadow: 0 0 10px var(--accent-neon);
            transition: all 0.2s ease;
        }

        .opacity-slider::-webkit-slider-thumb:hover {
            transform: scale(1.2);
            box-shadow: 0 0 20px var(--accent-neon);
        }

        .opacity-display {
            text-align: center;
            font-weight: bold;
            color: var(--accent-neon);
            font-size: 0.9em;
            margin-top: 5px;
        }

        /* ===== TOGGLE PARA NÚCLEO PULSANTE ===== */
        .toggle-label {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            cursor: pointer;
            user-select: none;
            position: relative;
        }

        .toggle-label:hover::before {
            content: attr(data-title);
            position: absolute;
            top: -25px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-tertiary);
            color: var(--accent-neon);
            padding: 5px 10px;
            border-radius: 5px;
            font-size: 0.9em;
            white-space: nowrap;
            z-index: 1000;
            border: 1px solid var(--border-color);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }

        .toggle-label input[type="checkbox"] {
            display: none;
        }

        .toggle-slider {
            position: relative;
            width: 50px;
            height: 24px;
            background: var(--bg-primary);
            border-radius: 12px;
            border: 2px solid var(--border-color);
            transition: all 0.3s ease;
        }

        .toggle-slider::before {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 18px;
            height: 18px;
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            border-radius: 50%;
            transition: all 0.3s ease;
            box-shadow: 0 0 8px rgba(56,189,248, 0.5);
        }

        .toggle-label input[type="checkbox"]:checked + .toggle-slider {
            background: rgba(56,189,248, 0.1);
            border-color: var(--accent-neon);
            box-shadow: 0 0 15px rgba(56,189,248, 0.3);
        }

        .toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
            left: 26px;
            box-shadow: 0 0 12px rgba(56,189,248, 0.8);
        }

        .toggle-text {
            color: var(--accent-neon);
            font-weight: bold;
            font-size: 0.9em;
            transition: all 0.3s ease;
        }

        .toggle-label input[type="checkbox"]:checked ~ .toggle-text {
            color: var(--accent-blue);
        }

        /* ===== BOTÕES DE AÇÃO ===== */
        .action-buttons {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin: 5px 0;
        }

        .action-btn {
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            color: var(--bg-primary);
            border: none;
            padding: 12px 15px;
            border-radius: 8px;
            font-size: 0.85em;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            width: 100%;
            text-align: center;
        }

        .action-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 0 20px rgba(56,189,248, 0.5);
        }

        .action-btn:active {
            transform: translateY(0);
        }

        .action-button:active {
            transform: translateY(0);
        }

        .border-controls {
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .border-controls label {
            font-size: 0.8em;
            color: var(--text-secondary);
            margin-bottom: 2px;
        }

        .border-input {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 5px;
            padding: 8px;
            color: var(--text-primary);
            font-size: 0.9em;
            width: 100%;
            text-align: center;
        }

        .border-input:focus {
            outline: none;
            border-color: var(--accent-neon);
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
        }

        .action-button.copy::before {
            content: "📋 ";
        }

        .action-button.download::before {
            content: "⬇️ ";
        }

        /* ===== INFORMAÇÕES MATEMÁTICAS ===== */
        .math-info {
            background: var(--bg-secondary);
            padding: 20px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            margin-top: 0px;
        }

        .math-info h3 {
            color: var(--accent-neon);
            margin-bottom: 15px;
            text-align: center;
            font-size: 1.2em;
        }

        .math-info h4 {
            color: var(--accent-blue);
            margin-bottom: 15px;
            text-align: center;
            font-size: 1.1em;
        }

        .math-info h5 {
            color: var(--text-primary);
            margin-bottom: 10px;
            font-size: 0.9em;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .curve-section, .controls-section, .parameters-section, .equation-section {
            margin-bottom: 15px;
        }

        .control-preset {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .preset-label {
            color: var(--accent-neon);
            font-weight: bold;
        }

        .preset-buttons {
            display: flex;
            gap: 5px;
        }

        .preset-btn {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.8em;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .preset-btn:hover {
            background: var(--accent-neon);
            color: var(--bg-primary);
            border-color: var(--accent-neon);
        }

        .parameters-section {
            background: rgba(56,189,248, 0.05);
            padding: 10px;
            border-radius: 6px;
            border: 1px solid rgba(56,189,248, 0.2);
        }

        .param-display {
            font-family: 'Courier New', monospace;
            color: var(--accent-blue);
            font-size: 0.85em;
            margin-bottom: 3px;
            text-align: center;
        }

        .equation {
            font-family: 'Courier New', monospace;
            background: var(--bg-primary);
            padding: 12px;
            border-radius: 6px;
            border: 1px solid rgba(56,189,248, 0.2);
            margin-bottom: 10px;
        }

        .equation-line {
            color: var(--text-primary);
            margin-bottom: 5px;
            text-align: center;
            font-size: 0.9em;
        }

        .equation-compact {
            font-family: 'Courier New', monospace;
            background: rgba(56,189,248, 0.05);
            padding: 8px;
            border-radius: 4px;
            border: 1px solid rgba(56,189,248, 0.1);
            color: var(--text-secondary);
            font-size: 0.8em;
            text-align: center;
            word-break: break-all;
        }

        /* ===== RESPONSIVIDADE ===== */
        /* ═══════════════════════════════════════════════════════
           📱 TABLET + MOBILE: ≤1100px → sidebars viram gavetas
           Cobre: iPad Air (820), iPad Pro (1024), Surface 7 (912),
           Zenbook Fold (853), e todos os phones
           ═══════════════════════════════════════════════════════ */
        @media (max-width: 1100px) {
            .container {
                grid-template-columns: 1fr !important;
                grid-template-rows: 1fr;
                padding: 0;
            }

            .controls {
                grid-template-columns: 1fr;
            }

            .svg-container svg {
                width: 100%;
                height: 100%;
            }

            /* --- SIDEBARS COMO GAVETAS DESLIZANTES --- */
            .left-sidebar {
                position: fixed;
                top: 0;
                left: -340px;
                width: 326px;
                height: 100vh;
                height: 100dvh;
                z-index: 2000;
                transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                border-right: 1px solid #334155;
                will-change: transform;
            }
            .left-sidebar-toolbar {
                height: 100dvh;
            }
            .left-sidebar.mobile-open {
                left: 0;
            }

            .right-sidebar {
                position: fixed;
                top: 0;
                right: -420px;
                width: 370px;
                max-width: 90vw;
                height: 100vh;
                height: 100dvh;
                z-index: 2000;
                transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                border-left: 1px solid #334155;
                will-change: transform;
            }
            .right-sidebar.mobile-open {
                right: 0;
            }

            .main-content {
                grid-column: 1;
                width: 100vw;
                height: 100vh;
                height: 100dvh;
            }

            .svg-container {
                width: 100vw;
                height: 100vh;
                height: 100dvh;
            }
        }

        /* ═══════════════════════════════════════════════════════
           📱 PHONE-ONLY: ≤768px → ajustes específicos de celular
           ═══════════════════════════════════════════════════════ */
        @media (max-width: 768px) {
            h1 {
                font-size: 1.4em;
                text-align: center;
                position: absolute;
                top: 8px;
                left: 50%;
                transform: translateX(-50%);
                z-index: 1000;
                background: rgba(10, 10, 10, 0.4);
                color: var(--accent-neon);
                padding: 3px 10px;
                border-radius: 8px;
                font-weight: bold;
                text-shadow: 0 0 10px var(--accent-neon);
                margin: 0;
                border: none;
                box-shadow: none;
                backdrop-filter: blur(3px);
            }

            /* --- PRIMITIVAS DE FORÇA COMPACTA MOBILE --- */
            #frequencyTranslatorPanel {
                margin-bottom: 8px !important;
                border-radius: 6px !important;
            }
            #frequencyTranslatorPanel > div:first-child {
                padding: 6px 10px !important;
                gap: 6px !important;
            }
            #frequencyTranslatorPanel > div:first-child span {
                font-size: 11px !important;
            }
            #frequencyTranslatorPanel > div:first-child svg:first-of-type {
                width: 13px !important;
                height: 13px !important;
            }
            #frequencyTranslatorPanel > div:first-child svg:last-of-type {
                width: 10px !important;
                height: 10px !important;
            }
            #freqTranslatorContent {
                padding: 2px 8px 8px 8px !important;
            }
            #freqTranslatorContent > div {
                margin: 3px 0 !important;
                padding: 3px 6px !important;
            }
            #freqTranslatorContent span {
                font-size: 10px !important;
            }

            .right-sidebar {
                width: 300px;
                right: -320px;
            }
        }

        /* --- 📱 BOTÕES FLUTUANTES MOBILE/TABLET --- */
        .mobile-sidebar-toggle {
            display: none;
            position: fixed;
            z-index: 1500;
            width: 40px;
            height: 40px;
            border-radius: 10px;
            border: 1px solid #334155;
            background: rgba(30, 41, 59, 0.92);
            color: #94A3B8;
            cursor: pointer;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(8px);
            box-shadow: 0 2px 12px rgba(0,0,0,0.4);
            transition: color 0.2s, border-color 0.2s, background 0.2s;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }
        .mobile-sidebar-toggle:active {
            background: rgba(56, 189, 248, 0.15);
            border-color: #38BDF8;
            color: #38BDF8;
        }
        .mobile-toggle-left {
            top: 12px;
            left: 12px;
        }
        .mobile-toggle-right {
            top: 12px;
            right: 12px;
        }
        @media (max-width: 1100px) {
            .mobile-sidebar-toggle {
                display: flex;
            }
        }

        /* --- 📱 OVERLAY ESCURO (MOBILE) --- */
        .mobile-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            z-index: 1900;
            opacity: 0;
            transition: opacity 0.3s ease;
            -webkit-tap-highlight-color: transparent;
        }
        .mobile-overlay.active {
            display: block;
            opacity: 1;
        }

        /* --- ⚡ GPU ACCELERATION (UNIVERSAL) --- */
        .svg-container,
        .svg-container svg {
            transform: translateZ(0);
            will-change: contents;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        .left-sidebar,
        .right-sidebar {
            transform: translateZ(0);
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        input[type="range"] {
            will-change: transform;
            transform: translateZ(0);
        }

        /* ===== TÍTULO SOBREPOSTO AO CANVAS ===== */
        h1 {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1000;
            background: rgba(10, 10, 10, 0.3);
            color: var(--accent-neon);
            padding: 5px 15px;
            border-radius: 10px;
            font-size: 1.8em;
            font-weight: bold;
            text-align: center;
            text-shadow: 0 0 15px var(--accent-neon);
            margin: 0;
            border: none;
            box-shadow: none;
            backdrop-filter: blur(5px);
        }

        /* ===== ANIMAÇÕES ===== */
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        /* ===== GALERIA DE FAVORITOS ===== */
        .gallery-sidebar {
            position: fixed;
            top: 0;
            right: -350px;
            width: 350px;
            height: 100vh;
            background: var(--bg-tertiary);
            border-left: 1px solid var(--border-color);
            box-shadow: -10px 0 20px rgba(0, 0, 0, 0.3);
            transition: right 0.3s ease;
            z-index: 10000;
            overflow-y: auto;
            padding: 20px;
        }

        .gallery-sidebar.open {
            right: 0;
        }

        .gallery-toggle {
            position: absolute;
            top: 50%;
            right: 10px;
            transform: translateY(-50%);
            background: var(--bg-tertiary);
            border: 2px solid var(--border-color);
            border-radius: 50%;
            width: 50px;
            height: 50px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            color: var(--accent-neon);
            transition: all 0.3s ease;
            z-index: 1000;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
        }

        .gallery-toggle:hover {
            border-color: var(--accent-neon);
            box-shadow: 0 0 20px rgba(56,189,248, 0.5);
            transform: translateY(-50%) scale(1.1);
        }

        .gallery-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border-color);
        }

        .gallery-title {
            color: var(--accent-neon);
            font-size: 1.2em;
            font-weight: bold;
        }

        .gallery-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 20px;
            cursor: pointer;
            padding: 5px;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        .gallery-close:hover {
            color: var(--accent-neon);
            background: rgba(56,189,248, 0.1);
        }

        .save-section {
            margin-bottom: 30px;
            padding: 15px;
            background: var(--bg-secondary);
            border-radius: 10px;
            border: 1px solid var(--border-color);
        }

        .save-section h3 {
            color: var(--accent-neon);
            margin-bottom: 15px;
            font-size: 1em;
        }

        .save-input {
            width: 100%;
            padding: 8px 12px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 0.9em;
            margin-bottom: 10px;
            outline: none;
        }

        .save-input:focus {
            border-color: var(--accent-neon);
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
        }

        .save-btn {
            width: 100%;
            padding: 10px;
            background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
            border: none;
            border-radius: 8px;
            color: var(--bg-primary);
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .save-btn:hover {
            transform: scale(1.02);
            box-shadow: 0 0 15px rgba(56,189,248, 0.5);
        }

        .gallery-list {
            max-height: calc(100vh - 300px);
            overflow-y: auto;
        }

        .gallery-item {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .gallery-item:hover {
            border-color: var(--accent-neon);
            box-shadow: 0 0 10px rgba(56,189,248, 0.3);
        }

        .gallery-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }
        .gallery-item-header h4 {
            color: var(--accent-neon);
            font-size: 0.85em;
            margin: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 180px;
        }
        .gallery-item-actions button {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            padding: 2px 4px;
            opacity: 0.7;
            transition: opacity .2s;
        }
        .gallery-item-actions button:hover { opacity: 1; }

        .gallery-item-preview {
            max-height: 180px;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.2);
            border-radius: 4px;
            margin: 6px 0;
            padding: 8px;
        }
        .gallery-item-preview img {
            max-width: 100%;
            max-height: 160px;
            object-fit: contain;
            border-radius: 4px;
        }
        .gallery-item-preview svg {
            width: 160px;
            height: 160px;
            max-width: 100%;
            display: block;
            overflow: visible;
        }

        .gallery-item-info {
            text-align: right;
            color: var(--text-secondary);
            font-size: 0.7em;
            opacity: 0.7;
        }

        .gallery-item-curves {
            color: var(--text-primary);
            font-size: 0.8em;
            margin-bottom: 3px;
            font-style: italic;
        }

        .gallery-item-params {
            color: var(--text-secondary);
            font-size: 0.8em;
            font-family: 'Courier New', monospace;
            margin-bottom: 3px;
        }

        .gallery-item-date {
            color: var(--text-secondary);
            font-size: 0.7em;
            opacity: 0.7;
        }

        .gallery-item-color {
            display: inline-block;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 2px solid var(--border-color);
            margin-left: 10px;
        }

        .delete-btn {
            float: right;
            background: none;
            border: none;
            color: #ff4444;
            font-size: 16px;
            cursor: pointer;
            padding: 2px 5px;
            border-radius: 3px;
            transition: all 0.2s ease;
        }

        .delete-btn:hover {
            background: rgba(255, 68, 68, 0.2);
            color: #ff6666;
        }

        .pulsing {
            animation: pulse 2s infinite;
        }

        /* ===== FOOTER (hidden in dashboard mode) ===== */
        .page-footer {
            display: none;
        }

        .page-footer p {
            margin: 0;
            opacity: 0.9;
        }

        .page-footer .equation-compact {
            margin-top: 10px;
            font-family: 'Courier New', monospace;
            font-size: 0.9em;
            opacity: 0.8;
        }

        /* ===== BOTÃO DE EXPANSÃO DE CURVAS ===== */
        .expand-curves-btn {
            background: linear-gradient(45deg, #2c3e50, #34495e);
            border: 2px solid #3498db;
            color: #ecf0f1;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s ease;
            text-align: center;
            min-height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
            margin: 8px 0;
            position: relative;
            overflow: hidden;
        }

        .expand-curves-btn:hover {
            background: linear-gradient(45deg, #34495e, #2c3e50);
            border-color: #5dade2;
            box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
            transform: translateY(-2px);
        }

        .expand-curves-btn .expand-icon {
            font-size: 16px;
            margin-right: 8px;
            transition: transform 0.3s ease;
        }

        .expand-curves-btn .expand-text {
            opacity: 0;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            transition: opacity 0.3s ease;
            font-size: 12px;
            white-space: nowrap;
        }

        .expand-curves-btn:hover .expand-text {
            opacity: 1;
        }

        .expand-curves-btn:hover .expand-icon {
            transform: scale(1.1);
        }

        .expand-curves-btn.expanded .expand-icon {
            transform: rotate(180deg);
        }

        /* ===== BOTÃO CURVAS AVANÇADAS ===== */
        .expand-btn {
            width: 100%;
            padding: 8px 14px;
            background: #1E293B;
            border: 1px solid #334155;
            border-radius: 6px;
            color: #94A3B8;
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            letter-spacing: 0.3px;
        }

        .expand-btn:hover {
            background: rgba(56,189,248,0.06);
            border-color: #38BDF8;
            color: #38BDF8;
        }

        .expand-btn:active {
            transform: scale(0.98);
        }

        /* ===== GAVETA DE CURVAS AVANÇADAS ===== */
        .advanced-curves-drawer {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.5s ease-in-out, opacity 0.3s ease;
            opacity: 0;
            margin-top: 10px;
        }

        .advanced-curves-drawer:not(.hidden) {
            max-height: 5000px; /* Altura generosa para scroll suave */
            overflow-y: auto;
            opacity: 1;
        }

        .advanced-curves-drawer.hidden {
            max-height: 0;
            opacity: 0;
            overflow: hidden;
        }

        /* Estilos para as seções dentro da gaveta */
        .advanced-curves-drawer h4 {
            margin: 15px 0 10px 0;
            color: var(--accent-neon);
            font-size: 1em;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 5px;
        }

        .advanced-curves-drawer .advanced-curves,
        .advanced-curves-drawer .associated-curves {
            margin-bottom: 15px;
        }

/* ===== MODAL DE SALVAMENTO AVANÇADO ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 11000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-tertiary);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(45deg, var(--bg-secondary), var(--bg-tertiary));
}

.modal-header h2 {
    color: var(--accent-neon);
    margin: 0;
    font-size: 1.4em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--accent-neon);
    background: rgba(56,189,248, 0.1);
}

.modal-body {
    padding: 25px;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.thumbnail-section {
    flex: 0 0 250px;
}

.thumbnail-section h3 {
    color: var(--accent-neon);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.thumbnail-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.thumbnail-container canvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.capture-status {
    color: var(--accent-green);
    font-weight: bold;
    font-size: 0.9em;
    text-align: center;
    padding: 8px 12px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 6px;
    border: 1px solid var(--accent-green);
}

.capture-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-neon));
    border: none;
    border-radius: 8px;
    color: var(--bg-primary);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 128, 255, 0.3);
}

.capture-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 128, 255, 0.4);
}

.form-section {
    flex: 1;
    min-width: 400px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--accent-neon);
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-neon);
    box-shadow: 0 0 15px rgba(56,189,248, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.parameters-display {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    color: var(--accent-neon);
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.cancel-btn,
.save-final-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.cancel-btn {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-neon);
    color: var(--accent-neon);
}

.save-final-btn {
    background: linear-gradient(45deg, var(--accent-neon), var(--accent-blue));
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(56,189,248, 0.3);
}

.save-final-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56,189,248, 0.4);
}

.save-final-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsividade */
@media (max-width: 900px) {
    .modal-body {
        flex-direction: column;
    }

    .thumbnail-section {
        flex: none;
        align-self: center;
    }

    .form-section {
        min-width: auto;
    }
}

/* ===================================================================
   CSS migrado do inline <style> em hipotrocoides_sagrados.html
   =================================================================== */

.geometry-recognition {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    border: 2px solid #38BDF8;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    color: #E2E8F0;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 0 20px rgba(56,189,248, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

.geometry-recognition strong {
    color: #38BDF8;
    font-weight: bold;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(56,189,248, 0.3); }
    to { box-shadow: 0 0 30px rgba(56,189,248, 0.6); }
}

/* Estilos da Galeria */
.icon-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.gallery-icon {
    width: 32px;
    height: 32px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-icon:hover {
    transform: scale(3);
    z-index: 1000;
    border-color: #38BDF8;
    box-shadow: 0 0 20px rgba(56,189,248, 0.5);
}

.gallery-icon:hover::after {
    content: attr(data-title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #38BDF8;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

/* Elementos Sagrados no Canvas - Integração Unificada */
.elemento-sagrado-overlay {
    cursor: move;
    transition: filter 0.2s ease;
}
.elemento-sagrado-overlay.selecionado {
    filter: drop-shadow(0 0 6px rgba(56,189,248,0.8));
}
.elemento-sagrado-overlay:hover {
    filter: drop-shadow(0 0 4px rgba(56,189,248,0.6));
}

.gallery-category {
    margin-bottom: 20px;
}

.gallery-category h5 {
    color: #38BDF8;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== SIDEBAR PROFISSIONAL - BOTÕES EM GRID ===== */
.btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 8px 0;
}
.btn-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.btn-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.pro-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    background: rgba(56,189,248, 0.08);
    border: 1px solid rgba(56,189,248, 0.25);
    border-radius: 8px;
    color: #E2E8F0;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}
.pro-btn:hover {
    background: rgba(56,189,248, 0.15);
    border-color: rgba(56,189,248, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56,189,248, 0.2);
}
.pro-btn:active {
    transform: translateY(0);
}
.pro-btn.active {
    background: rgba(56,189,248, 0.2);
    border-color: #38BDF8;
    color: #38BDF8;
}
.pro-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.pro-btn span {
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
}

/* Toggle compacto inline */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    margin: 4px 0;
}
.toggle-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #94A3B8;
}
.toggle-row svg {
    width: 16px;
    height: 16px;
    color: #38BDF8;
}

/* Seção colapsável */
.section-collapsible {
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #1E293B;
}
.section-header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #E2E8F0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    text-align: left;
}
.section-header-btn:hover {
    background: rgba(56,189,248,0.06);
}
.section-header-btn svg {
    width: 16px;
    height: 16px;
    color: #94A3B8;
    flex-shrink: 0;
}
.section-header-btn:hover svg {
    color: #38BDF8;
}
/* Active (expanded) header — subtle cyan glow */
.section-header-btn:not(.collapsed) {
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
.section-header-btn:not(.collapsed) svg:not(.chevron) {
    color: #38BDF8;
}
.section-header-btn .chevron {
    margin-left: auto;
    transition: transform 0.2s;
    color: #475569;
}
.section-header-btn:hover .chevron {
    color: #94A3B8;
}

/* ── Info badges: escopo do drawer ── */
.drawer-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #475569;
    background: rgba(56,189,248,0.08);
    border: 1px solid rgba(56,189,248,0.15);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: auto;
    margin-right: 4px;
    white-space: nowrap;
    text-transform: uppercase;
    pointer-events: auto;
    cursor: help;
    transition: color 0.2s, border-color 0.2s;
}
.drawer-scope-badge:hover {
    color: #38BDF8;
    border-color: rgba(56,189,248,0.4);
}

/* ── ⓘ Info button (replaces visible badge) ── */
.drawer-scope-info-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 12px;
    color: #475569;
    margin-right: 6px;
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.2s;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}
.drawer-scope-info-btn:hover {
    color: #38BDF8;
}
.drawer-scope-popover {
    position: fixed;
    z-index: 99999;
    background: #1E293B;
    color: #E2E8F0;
    border: 1px solid rgba(56,189,248,0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
    pointer-events: auto;
    line-height: 1.5;
    max-width: 280px;
}
.drawer-scope-popover strong {
    color: #38BDF8;
    font-weight: 600;
}
.section-header-btn.collapsed .chevron {
    transform: rotate(-90deg);
}
.section-content {
    padding: 12px 16px;
    background: rgba(15,23,42,0.5);
}
.section-content.hidden {
    display: none;
}

/* Slider inline compacto */
.slider-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}
.slider-inline svg {
    width: 16px;
    height: 16px;
    color: #38BDF8;
    flex-shrink: 0;
}
.slider-inline input[type="range"] {
    flex: 1;
    height: 4px;
}
.slider-inline .value {
    min-width: 36px;
    font-size: 11px;
    color: #94A3B8;
    text-align: right;
}

/* ===== BARRA DE AÇÕES LATERAL ESQUERDA (legacy - hidden) ===== */
.right-action-bar {
    display: none;
}

.right-action-bar .action-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15,23,42,0.5);
    color: #94A3B8;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.right-action-bar .action-icon-btn:hover {
    background: rgba(56,189,248, 0.15);
    border-color: rgba(56,189,248, 0.4);
    color: #38BDF8;
    transform: scale(1.05);
}

.right-action-bar .action-icon-btn:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid rgba(56,189,248, 0.3);
    z-index: 1000;
}

.right-action-bar .action-icon-btn.active {
    background: rgba(56,189,248, 0.2);
    border-color: #38BDF8;
    color: #38BDF8;
}

.right-action-bar .separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

/* ===== CONTROLES COMPACTOS COM ÍCONE LATERAL ===== */
.compact-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.compact-control .ctrl-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,0.5);
    border-radius: 6px;
    color: #94A3B8;
    flex-shrink: 0;
    cursor: help;
    transition: all 0.2s ease;
}

.compact-control .ctrl-icon svg {
    width: 16px;
    height: 16px;
}

/* Proteção: evita que transformações de zoom afetem ícones da UI */
.action-icon-btn svg,
.icon-action-btn svg,
.compact-control .ctrl-icon svg,
.left-sidebar svg,
.right-sidebar svg {
    transform: none !important;
}

/* Marca de ícones de UI estáticos */
.ui-icon-static,
.ui-icon-static * {
    transform: none !important;
}

/* Forçar empilhamento de seções no sidebar direito */
.right-sidebar-params {
    display: block;
}
.right-sidebar-params .section-collapsible,
.right-sidebar-params .advanced-curves,
.right-sidebar-params .associated-curves,
.right-sidebar-params .controls {
    width: 100%;
    box-sizing: border-box;
    display: block;
    margin-bottom: 12px;
}
.right-sidebar .advanced-curves,
.right-sidebar .associated-curves {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.right-sidebar .section-content {
    display: block;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}
.right-sidebar .section-content.hidden {
    display: none !important;
}

/* Orion theme — labels and text inside right sidebar */
.right-sidebar label {
    color: #94A3B8;
    font-size: 11px;
    font-family: Inter, system-ui, -apple-system, sans-serif;
}
.right-sidebar select {
    background: #0F172A;
    border: 1px solid #334155;
    color: #E2E8F0;
    font-size: 12px;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    border-radius: 6px;
    padding: 5px 8px;
}
.right-sidebar select:focus {
    border-color: #38BDF8;
    outline: none;
}
.right-sidebar .compact-control label {
    color: #94A3B8;
    font-size: 11px;
}
.right-sidebar p {
    color: #94A3B8;
    font-size: 10px;
    line-height: 1.5;
}
.right-sidebar h4 {
    color: #E2E8F0;
    font-size: 14px;
    font-weight: 500;
    font-family: Inter, system-ui, -apple-system, sans-serif;
}

.compact-control input[type="range"] {
    flex: 1;
    height: 4px;
    background: #1E293B;
    border-radius: 2px;
    outline: none;
    accent-color: #38BDF8;
}

.compact-control input[type="number"] {
    width: 50px;
    padding: 3px 5px;
    background: #0F172A;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #E2E8F0;
    font-size: 11px;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    text-align: center;
}
.compact-control input[type="number"]:focus {
    border-color: #38BDF8;
    outline: none;
}

.compact-control:hover .ctrl-icon {
    color: #38BDF8;
    background: rgba(56, 189, 248, 0.1);
    transform: scale(1.05);
}

/* ===== UNDO / REDO ===== */
.undo-redo-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}
.undo-redo-bar button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #94A3B8;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.undo-redo-bar button:hover:not(:disabled) {
    background: rgba(56,189,248, 0.1);
    border-color: rgba(56,189,248, 0.35);
    color: #38BDF8;
}
.undo-redo-bar button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.undo-redo-bar button svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   🔍 ORÁCULO DE ORION — Search field
   ═══════════════════════════════════════════════════════════════════ */
.orion-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}
.orion-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.orion-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 8px 32px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #E2E8F0;
    font-size: 12px;
    font-family: Inter, system-ui, sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.orion-search-input::placeholder {
    color: #475569;
}
.orion-search-input:focus {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════
   ✨ FLASH SEARCH — Glow highlight for found parameters
   ═══════════════════════════════════════════════════════════════════ */
@keyframes flash-search-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
    15%  { box-shadow: 0 0 12px 4px rgba(56, 189, 248, 0.5); }
    50%  { box-shadow: 0 0 8px 2px rgba(56, 189, 248, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}
.flash-search {
    animation: flash-search-pulse 2s ease-out;
    border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════════
   📏 RULER OVERLAY — CSS-only measurement ruler
   ═══════════════════════════════════════════════════════════════════ */
.ruler-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background:
        /* Minor gridlines every 20px */
        repeating-linear-gradient(
            to right,
            rgba(56, 189, 248, 0.45) 0px,
            rgba(56, 189, 248, 0.45) 1px,
            transparent 1px,
            transparent 20px
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(56, 189, 248, 0.45) 0px,
            rgba(56, 189, 248, 0.45) 1px,
            transparent 1px,
            transparent 20px
        ),
        /* Major gridlines every 100px */
        repeating-linear-gradient(
            to right,
            rgba(56, 189, 248, 0.7) 0px,
            rgba(56, 189, 248, 0.7) 1px,
            transparent 1px,
            transparent 100px
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(56, 189, 248, 0.7) 0px,
            rgba(56, 189, 248, 0.7) 1px,
            transparent 1px,
            transparent 100px
        );
}
/* Central axes — brighter */
.ruler-overlay::before,
.ruler-overlay::after {
    content: '';
    position: absolute;
    background: rgba(56, 189, 248, 0.85);
}
.ruler-overlay::before {
    /* Vertical center axis */
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
}
.ruler-overlay::after {
    /* Horizontal center axis */
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   ⚗️ MODO POTÊNCIA ALQUÍMICA — Quality indicator & Finalize panel
   ═══════════════════════════════════════════════════════════════ */

/* Quality indicator badge */
.quality-indicator {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 6px;
    text-align: center;
    letter-spacing: 0.3px;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
}
.quality-draft {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}
.quality-full {
    background: rgba(0, 255, 150, 0.2);
    color: #00ff96;
    border: 1px solid rgba(0, 255, 150, 0.3);
}

/* Active state for Draft/Full buttons */
#draftModeBtn.active,
#fullRenderBtn.active {
    background: rgba(0, 200, 255, 0.2) !important;
    border: 1px solid rgba(0, 200, 255, 0.5) !important;
    box-shadow: 0 0 6px rgba(0, 200, 255, 0.3);
}

/* Finalize panel (modal overlay) */
.finalize-panel {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.finalize-panel.open {
    display: flex;
}
.finalize-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}
.finalize-content {
    position: relative;
    z-index: 1;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    padding: 28px 32px;
    min-width: 280px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.08);
}
.finalize-content h3 {
    color: #ffd700;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: 0.5px;
}
.finalize-subtitle {
    color: #94a3b8;
    font-size: 12px;
    margin: 0 0 20px 0;
}
.finalize-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.finalize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}
.finalize-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.finalize-gallery {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.25);
    color: #ffd700;
}
.finalize-gallery:hover {
    background: rgba(255, 215, 0, 0.2);
}
.finalize-svg {
    background: rgba(0, 200, 255, 0.08);
    border-color: rgba(0, 200, 255, 0.2);
    color: #00c8ff;
}
.finalize-svg:hover {
    background: rgba(0, 200, 255, 0.16);
}
.finalize-png {
    background: rgba(138, 43, 226, 0.1);
    border-color: rgba(138, 43, 226, 0.2);
    color: #c89dff;
}
.finalize-png:hover {
    background: rgba(138, 43, 226, 0.18);
}
.finalize-gcode {
    background: rgba(0, 200, 100, 0.08);
    border-color: rgba(0, 200, 100, 0.2);
    color: #00c864;
}
.finalize-gcode:hover {
    background: rgba(0, 200, 100, 0.16);
}
.finalize-close {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    font-size: 12px;
    width: 100%;
}
.finalize-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════════
   🎭 PAINEL DE CAMADAS (Layer Manager)
   ═══════════════════════════════════════════════════════════════ */

.layer-stack-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.15);
    transition: all 0.15s ease;
    min-height: 28px;
}

.layer-item.active {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
}

.layer-item.inactive {
    opacity: 0.4;
    border-color: rgba(71, 85, 105, 0.3);
}

.layer-item.inactive .layer-label {
    font-style: italic;
}

.layer-icon {
    font-size: 13px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.layer-label {
    font-size: 10px;
    color: #CBD5E1;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-arrows {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}

.layer-arrow-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.4);
    color: #94A3B8;
    font-size: 8px;
    line-height: 1;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

.layer-arrow-btn:hover:not([disabled]) {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
    color: #38BDF8;
}

.layer-arrow-btn[disabled] {
    opacity: 0.2;
    cursor: default;
}