 :root {
            --bg: #0d0d0f;
            --surface: #15151a;
            --card: #1c1c24;
            --border: #2a2a38;
            --accent: #7c6dfa;
            --accent2: #6dfabc;
            --accent3: #fa6d8a;
            --text: #e8e8f0;
            --muted: #7878a0;
            --correct: #2ecc71;
            --wrong: #e74c3c;
        }
        
        * { box-sizing: border-box; margin: 0; padding: 0; }
        
        body {
            background: var(--bg);
            color: var(--text);
            font-family: 'Inter', 'Syne', sans-serif;
            min-height: 100vh;
            padding: 20px;
            line-height: 1.5;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            inset: 0;
            background-image:
                linear-gradient(rgba(124,109,250,0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(124,109,250,0.03) 1px, transparent 1px);
            background-size: 40px 40px;
            pointer-events: none;
            z-index: 0;
        }
        
        .compiler-container {
            max-width: 1400px;
            margin: 0 auto;
            position: relative;
            z-index: 1;
        }
        
        h1 {
            text-align: center;
            font-family: 'Syne', sans-serif;
            font-size: clamp(28px, 4vw, 42px);
            font-weight: 800;
            background: linear-gradient(135deg, var(--accent), var(--accent2));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 8px;
            letter-spacing: -1px;
        }

        .subtitle {
            text-align: center;
            color: var(--muted);
            font-size: 15px;
            margin-bottom: 25px;
        }
        
        .editor-panel {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin-bottom: 20px;
        }
        
        @media (max-width: 768px) {
            .editor-panel { grid-template-columns: 1fr; }
            h1 { font-size: 24px; }
        }
        
        .panel {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 24px;
            display: flex;
            flex-direction: column;
        }
        
        .panel h3 {
            font-family: 'Syne', sans-serif;
            font-size: 17px;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
        }
        
        /* ========== EDITOR COM TERMINAL ========== */
        .code-editor-wrapper {
            background: #1E1E1E;
            border: 1px solid #3C3C3C;
            border-radius: 10px;
            overflow: hidden;
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .code-editor-header {
            background: #2D2D2D;
            padding: 8px 16px;
            font-size: 13px;
            color: #CCCCCC;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #3C3C3C;
            flex-shrink: 0;
        }
        
        .code-editor-body {
            display: flex;
            flex: 1;
            min-height: 400px;
            overflow: hidden;
        }
        
        .line-numbers {
            padding: 16px 10px 16px 16px;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 15px;
            line-height: 1.8;
            color: #858585;
            background: #1A1A1A;
            border-right: 1px solid #3C3C3C;
            text-align: right;
            user-select: none;
            white-space: pre;
            overflow: hidden;
            min-width: 50px;
            flex-shrink: 0;
        }
        
        .code-content {
            position: relative;
            flex: 1;
            overflow: hidden;
        }
        
        .code-highlight {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 16px;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 15px;
            line-height: 1.8;
            white-space: pre-wrap;
            word-wrap: break-word;
            overflow: auto;
            background: #1E1E1E;
            tab-size: 4;
            z-index: 1;
            color: #D4D4D4;
        }
        
        .code-textarea {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: 100%;
            padding: 16px;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 15px;
            line-height: 1.8;
            resize: none;
            outline: none;
            border: none;
            background: transparent !important;
            color: transparent !important;
            caret-color: #FFFFFF;
            tab-size: 4;
            z-index: 2;
            overflow: auto;
            -webkit-text-fill-color: transparent !important;
        }

        /* Cores da sintaxe */
        .code-highlight .preprocessor { color: #C586C0; }
        .code-highlight .header-file { color: #CE9178; }
        .code-highlight .keyword { color: #569CD6; font-weight: 600; }
        .code-highlight .type { color: #569CD6; }
        .code-highlight .function { color: #DCDCAA; }
        .code-highlight .string { color: #CE9178; }
        .code-highlight .format { color: #E57373; }
        .code-highlight .number { color: #B5CEA8; }
        .code-highlight .comment { color: #6A9955; font-style: italic; }
        .code-highlight .brace { color: #FFD700; }

        /* Botão expandir */
        .btn-expand {
            background: transparent;
            border: 1px solid #555;
            color: #CCCCCC;
            cursor: pointer;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 13px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 5px;
            font-family: 'Inter', sans-serif;
        }
        .btn-expand:hover {
            background: #3C3C3C;
            border-color: #888;
            color: #fff;
        }

        /* Overlay e Expansão */
        .code-overlay {
            pointer-events: none;
            display: none;
            position: fixed;
            inset: 0;
            z-index: 9998;
            cursor: pointer;
        }
        .code-overlay.show {
            display: block;
        }

        .code-editor-wrapper.expanded {
    pointer-events: auto;
            position: fixed;
            top: 20px;
            left: 20px;
            right: 20px;
            bottom: 20px;
            z-index: 9999;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
        }
        .code-editor-wrapper.expanded .code-editor-body {
            height: calc(100vh - 80px) !important;
        }
        .code-editor-wrapper.expanded .line-numbers {
            font-size: 20px !important;
            line-height: 2 !important;
            padding: 22px 10px 22px 22px !important;
        }
        .code-editor-wrapper.expanded .code-highlight,
        .code-editor-wrapper.expanded .code-textarea {
            font-size: 20px !important;
            line-height: 2 !important;
            padding: 22px !important;
        }

        /* Input textarea */
        textarea.input-area {
            width: 100%;
            flex: 1;
            background: #0a0a0d;
            color: #e8e8f0;
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 18px;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 15px;
            line-height: 1.8;
            resize: vertical;
            outline: none;
            min-height: 400px;
        }
        textarea.input-area:focus {
            border-color: var(--accent);
            box-shadow: 0 0 20px rgba(124,109,250,0.15);
        }
        
        #output-area {
            width: 100%;
            min-height: 200px;
            max-height: 400px;
            background: #0a0a0d;
            color: var(--accent2);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 18px;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 15px;
            line-height: 1.7;
            white-space: pre-wrap;
            overflow-y: auto;
        }
        
        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 10px;
            font-family: 'Syne', sans-serif;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        
        .btn-run {
            background: var(--correct);
            color: #fff;
            font-size: 18px;
            padding: 16px 40px;
            border-radius: 14px;
            box-shadow: 0 8px 25px rgba(46,204,113,0.3);
        }
        .btn-run:hover { background: #27ae60; transform: translateY(-2px); }
        .btn-run:disabled { background: #555; cursor: not-allowed; }
        
        .btn-clear { background: var(--border); color: var(--muted); font-size: 13px; }
        .btn-clear:hover { background: #3a3a48; color: var(--text); }

        .btn-save {
            background: #9C27B0;
            color: #fff;
            font-size: 13px;
            box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
        }
        .btn-save:hover {
            background: #7B1FA2;
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
        }

        .btn-download {
            background: #FF9800;
            color: #fff;
            font-size: 13px;
            box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
        }
        .btn-download:hover {
            background: #F57C00;
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
        }
        
        .btn-example {
            background: rgba(124,109,250,0.1);
            color: var(--accent);
            border: 1px solid rgba(124,109,250,0.25);
            font-size: 13px;
            padding: 8px 18px;
        }
        .btn-example:hover { background: rgba(124,109,250,0.2); border-color: var(--accent); }
        
        .button-group {
            display: flex;
            gap: 10px;
            margin-top: 14px;
            flex-wrap: wrap;
            flex-shrink: 0;
        }

        .run-section {
            text-align: center;
            margin: 25px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }
        
        .status-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 12px;
            font-size: 14px;
            color: var(--muted);
            font-weight: 500;
        }
        
        .spinner {
            display: none;
            width: 24px;
            height: 24px;
            border: 3px solid var(--border);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        .spinner.show { display: inline-block; }
        @keyframes spin { to { transform: rotate(360deg); } }
        
        .error { color: var(--wrong) !important; font-weight: 600; }
        .success { color: var(--correct) !important; font-weight: 600; }

        /* Toast notification */
        .toast {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: #2ecc71;
            color: white;
            padding: 12px 24px;
            border-radius: 12px;
            font-family: 'Syne', sans-serif;
            font-weight: 700;
            font-size: 14px;
            z-index: 10001;
            transition: transform 0.4s ease;
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .toast.show {
            transform: translateX(-50%) translateY(0);
        }

        /* Modal para nome do arquivo */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.7);
            z-index: 10002;
            align-items: center;
            justify-content: center;
        }
        .modal-overlay.show {
            display: flex;
        }
        .modal {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 30px;
            width: 90%;
            max-width: 450px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.8);
        }
        .modal h2 {
            font-family: 'Syne', sans-serif;
            font-size: 20px;
            margin-bottom: 10px;
            color: var(--text);
        }
        .modal p {
            color: var(--muted);
            font-size: 13px;
            margin-bottom: 20px;
        }
        .modal input {
            width: 100%;
            padding: 12px 16px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            color: var(--text);
            font-family: 'Fira Code', monospace;
            font-size: 15px;
            margin-bottom: 20px;
            outline: none;
        }
        .modal input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 15px rgba(124,109,250,0.2);
        }
        .modal-buttons {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        .btn-modal-save {
            background: #9C27B0;
            color: #fff;
            padding: 10px 24px;
            border: none;
            border-radius: 10px;
            font-family: 'Syne', sans-serif;
            font-weight: 700;
            cursor: pointer;
            font-size: 14px;
        }
        .btn-modal-cancel {
            background: var(--border);
            color: var(--muted);
            padding: 10px 24px;
            border: none;
            border-radius: 10px;
            font-family: 'Syne', sans-serif;
            font-weight: 700;
            cursor: pointer;
            font-size: 14px;
        }

        /* ========== SIDEBAR ========== */
        .hamburger-btn {
            position: fixed;
            top: 20px;
            left: 20px;
            z-index: 200;
            width: 44px;
            height: 44px;
            background: rgba(21,21,26,0.85);
            backdrop-filter: blur(16px);
            border: 1px solid var(--border);
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 5px;
            cursor: pointer;
            transition: all 0.3s;
        }
        .hamburger-btn:hover { border-color: var(--accent); }
        .hamburger-line {
            width: 20px;
            height: 2px;
            background: var(--text);
            border-radius: 2px;
            transition: all 0.3s;
        }
        .hamburger-btn.open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
        .hamburger-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
        .hamburger-btn.open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
        
        .sidebar-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.6);
            backdrop-filter: blur(4px);
            z-index: 250;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
        }
        .sidebar-overlay.show { opacity: 1; pointer-events: all; }
        
        .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: 280px;
            height: 100vh;
            background: rgba(21,21,26,0.95);
            backdrop-filter: blur(20px);
            border-right: 1px solid var(--border);
            z-index: 260;
            transform: translateX(-100%);
            transition: transform 0.35s;
            display: flex;
            flex-direction: column;
            padding: 0;
        }
        .sidebar.open { transform: translateX(0); }
        .sidebar-header {
            padding: 24px 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .sidebar-logo {
            width: 36px;
            height: 36px;
            background: linear-gradient(135deg, var(--accent), var(--accent2));
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 18px;
            color: #fff;
        }
        .sidebar-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; }
        .sidebar-nav {
            flex: 1;
            padding: 16px 12px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            overflow-y: auto;
        }
        .sidebar-link {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            border-radius: 10px;
            color: var(--muted);
            text-decoration: none;
            font-size: 14px;
            transition: all 0.3s;
            font-weight: 500;
        }
        .sidebar-link:hover { background: rgba(124,109,250,0.1); color: var(--text); }
        .sidebar-link.active { background: rgba(124,109,250,0.15); color: #fff; }
        .sidebar-link .icon {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }
        .sidebar-footer {
            padding: 16px 20px;
            border-top: 1px solid var(--border);
            font-size: 11px;
            color: var(--muted);
            text-align: center;
            font-family: 'Space Mono', monospace;
        }

        @media (max-width: 600px) {
            body { padding: 10px; }
            .panel { padding: 16px; }
            .code-highlight, .code-textarea, .line-numbers { font-size: 13px; padding: 14px; }
            .btn-run { font-size: 16px; padding: 14px 30px; }
        }