:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-editor: #282a36; /* Dracula bg */
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 10px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

header {
    text-align: center;
    padding: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Playground Layout */
.playground-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: 600px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .playground-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .editor-section, .output-section {
        min-height: 400px;
    }
}

.editor-section, .output-section {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
}

.panel-header > span i {
    margin-right: 8px;
    color: var(--text-muted);
}

.controls, .repl-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Editor */
#editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    font-size: 14px;
}

.CodeMirror {
    height: 100% !important;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* Console & REPL */
.console {
    flex: 1;
    background: #000;
    color: #fff;
    padding: 15px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-line {
    margin-bottom: 4px;
}

.console-line.user-input {
    color: var(--primary);
    font-weight: 500;
}

.console-line.user-input::before {
    content: ">>> ";
}

.console-line.system {
    color: var(--text-muted);
    font-style: italic;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin: 10px 0;
    padding-bottom: 5px;
}

.console-line.error {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    padding: 4px;
    border-left: 3px solid var(--error);
}

.console-line.result {
    color: var(--success);
    font-weight: 500;
}

/* REPL Input Area */
.repl-input-container {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #111;
    border-top: 1px solid var(--border);
}

.prompt {
    color: var(--primary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-weight: bold;
    margin-right: 10px;
    -webkit-user-select: none;
    user-select: none;
}

#repl-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    outline: none;
}

#repl-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s ease-out;
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text);
}

.modal-body {
    padding: 25px;
}

.modal-body section {
    margin-bottom: 25px;
}

.modal-body section:last-child {
    margin-bottom: 0;
}

.modal-body h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.modal-body p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.modal-body code {
    background: rgba(0,0,0,0.3);
    padding: 2px 5px;
    border-radius: 4px;
    color: #f1fa8c; /* Dracula yellow */
    font-family: monospace;
}

.modal-body pre {
    background: #111;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.modal-body pre code {
    background: transparent;
    padding: 0;
}

.modal-body ul {
    list-style: disc;
    padding-left: 20px;
    color: var(--text-muted);
}

.modal-body li {
    margin-bottom: 8px;
    font-size: 0.95rem;
}
