:root {
    --bg: #0b0e14;
    --surface: #151921;
    --surface-hover: #1c222d;
    --border: #2a3241;
    --text: #f0f6fc;
    --text-dim: #8b949e;
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --success: #3fb950;
    --danger: #f85149;
    --font-mono: 'Fira Code', 'JetBrains Mono', 'SF Mono', monospace;
    --font-sans: 'Inter', -apple-system, system-ui, sans-serif;
    --header-h: 60px;
}

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

html,
body {
    height: 100%;
    width: 100%;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    overflow: hidden;
}

.playground {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* --- Header --- */
header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.logo-area h1 span {
    color: var(--accent);
}

.action-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Custom Select Styling */
.example-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.example-picker:hover {
    border-color: var(--text-dim);
}

.example-picker span {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 500;
}

select {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    padding: 4px 0;
}

/* Run Button */
#run {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.2);
}

#run:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(88, 166, 255, 0.3);
}

#run:active {
    transform: translateY(0);
}

/* --- Workspace --- */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    /* Prevent workspace itself from scrolling */
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pane-border {
    width: 1px;
    background-color: var(--border);
}

.pane-header {
    height: 36px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

/* Editor Wrapper for Line Numbers */
.editor-wrapper {
    flex: 1;
    display: flex;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.line-numbers {
    width: 48px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    padding: 24px 8px;
    text-align: right;
    user-select: none;
    overflow: hidden;
    flex-shrink: 0;
}

.editor-view {
    flex: 1;
    position: relative;
    background: var(--bg);
}

#code,
#highlighting {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    tab-size: 4;
    white-space: pre;
    word-wrap: normal;
    overflow: auto;
    border: none;
    outline: none;
    box-sizing: border-box;
}

#code {
    background: transparent;
    color: transparent;
    caret-color: var(--text);
    resize: none;
    z-index: 1;
}

#highlighting {
    z-index: 0;
    pointer-events: none;
}

/* Syntax Highlighting Colors */
.token-comment {
    color: #6a737d;
    font-style: italic;
}

.token-keyword {
    color: #ff7b72;
    font-weight: 600;
}

.token-string {
    color: #a5d6ff;
}

.token-number {
    color: #d2a8ff;
}

.token-operator {
    color: #79c0ff;
}

.token-function {
    color: #d2a8ff;
}

.token-boolean {
    color: #79c0ff;
    font-weight: 600;
}

.token-null {
    color: #79c0ff;
}

/* Output Specific */
.output-container {
    flex: 1;
    background: #010409;
    overflow: auto;
    padding: 24px;
}

#output {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #d1d5db;
    white-space: pre-wrap;
}

.clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--text-dim);
}

/* --- Footer --- */
footer {
    height: 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 11px;
    color: var(--text-dim);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--success);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

@media (max-width: 800px) {
    .workspace {
        flex-direction: column;
    }

    .pane-border {
        height: 1px;
        width: 100%;
    }
}