:root[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-editor: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #00599c;
    --accent-secondary: #004482;
    --editor-text: #d4d4d4;
    --editor-line: #333333;
    --success: #4caf50;
    --error: #f44336;
    --tip-bg: #2d2d2d;
}

:root[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-editor: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent-primary: #00599c;
    --accent-secondary: #0077cc;
    --editor-text: #333333;
    --editor-line: #f0f0f0;
    --success: #4caf50;
    --error: #f44336;
    --tip-bg: #f8f9fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Consolas', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navbar */
nav {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
}

.logo a:hover {
    color: var(--accent-primary);
}

.nav-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-primary);
}

/* Container Principal */
.container {
    display: flex;
    height: calc(100vh - 64px);
    padding: 1rem;
    gap: 1rem;
}

/* Painéis */
.panel {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Painel de Instruções */
.instructions .content {
    padding: 1.5rem;
    overflow-y: auto;
}

.instructions h2 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.explanation pre {
    background: var(--bg-editor);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    overflow-x: auto;
    color: var(--editor-text);
}

.task {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--accent-primary);
    border-radius: 4px;
    color: white;
}

/* Editor de Código */
.editor {
    background: var(--bg-editor);
}

.editor-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

#codeEditor {
    flex: 1;
    background: var(--bg-editor);
    color: var(--editor-text);
    border: none;
    padding: 1rem;
    font-family: 'Consolas', monospace;
    font-size: 1rem;
    resize: none;
    outline: none;
    width: 100%;
    height: 100%;
}

/* Painel de Saída */
.output-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.output-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    white-space: pre-wrap;
}

/* Botões */
.btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background: var(--accent-secondary);
}

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

.btn i {
    font-size: 0.9rem;
}

/* Botão de Próximo Nível */
.next-btn {
    margin: 1rem auto;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

/* Dicas */
.tip {
    background: var(--tip-bg);
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid var(--accent-primary);
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tip.show {
    opacity: 1;
}

.tip.answer {
    background: var(--accent-primary);
    color: white;
    border-left: 4px solid var(--text-primary);
}

#dicas {
    margin: 1rem 0;
}

/* Mensagens de Sucesso/Erro */
.success-message, .error-message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.success-message {
    background: var(--success);
    color: white;
}

.error-message {
    background: var(--error);
    color: white;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    transition: transform 0.3s;
}

.theme-toggle:hover {
    transform: rotate(180deg);
}

/* Animações */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Responsividade */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .panel {
        height: 400px;
    }

    .instructions .content {
        height: 350px;
    }

    #codeEditor {
        height: 300px;
    }

    .output-content {
        height: 300px;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    .nav-title {
        font-size: 1rem;
    }

    .container {
        padding: 0.5rem;
    }

    .panel {
        height: 350px;
    }
}

/* Button Container */
.button-container {
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}