/* ---------------------------------------------
   runbox — online compiler UI
   Palette:
     --bg-app:      #14141c   (deep charcoal shell)
     --bg-panel:    #1b1b26   (editor / console panels)
     --bg-raised:   #23232f   (titlebar, headers, inputs)
     --line:        #2e2e3d   (hairline borders)
     --text-main:   #e7e5e0   (primary text)
     --text-muted:  #7b7d8f   (secondary text)
     --accent:      #ffb454   (amber — run / focus / brand)
     --accent-dim:  #8a6a35
     --ok:          #6fd08c   (status green)
   Type: Inter (UI) + JetBrains Mono (code/console)
--------------------------------------------- */

* {
    box-sizing: border-box;
}

:root {
    --bg-app: #14141c;
    --bg-panel: #1b1b26;
    --bg-raised: #23232f;
    --line: #2e2e3d;
    --text-main: #e7e5e0;
    --text-muted: #7b7d8f;
    --accent: #ffb454;
    --accent-dim: #8a6a35;
    --ok: #6fd08c;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg-app);
    color: var(--text-main);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ---------- app shell ---------- */

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

/* ---------- titlebar ---------- */

.titlebar {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 46px;
    padding: 0 16px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.dots {
    display: flex;
    gap: 7px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

.dot-red { background: #ff5f57; }
.dot-amber { background: #febc2e; }
.dot-green { background: #28c840; }

.titlebar-name {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    justify-content: center;
}

.brand {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

.brand-accent {
    color: var(--accent);
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 6px var(--ok);
}

/* ---------- workspace ---------- */

.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    min-height: 0;
}

.editor-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    min-height: 0;
}

.output-pane {
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    min-height: 0;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 12px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- select ---------- */

.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

#language {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-app);
    color: var(--text-main);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 28px 6px 12px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

#language:hover {
    border-color: var(--accent-dim);
}

#language:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ---------- run button ---------- */

.run-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: #1a1400;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-family: "Inter", sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.run-btn:hover {
    background: #ffc571;
    box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.18);
}

.run-btn:active {
    transform: scale(0.97);
}

.run-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.run-icon {
    flex-shrink: 0;
}

/* ---------- editor body ---------- */

.editor-body {
    flex: 1;
    display: flex;
    min-height: 0;
    background: var(--bg-panel);
}

.gutter {
    width: 44px;
    flex-shrink: 0;
    padding: 14px 0;
    background: var(--bg-panel);
    border-right: 1px solid var(--line);
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #4a4b5c;
    text-align: right;
    user-select: none;
    overflow: hidden;
}

.gutter span {
    display: block;
    padding-right: 12px;
}

#code {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 14px 16px;
    tab-size: 4;
}

#code::placeholder {
    color: #4a4b5c;
}

.pane-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 14px;
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.divider {
    color: #3a3b4d;
}

/* ---------- console ---------- */

.clear-btn {
    background: none;
    border: 1px solid var(--line);
    color: var(--text-muted);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

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

.console {
    flex: 1;
    margin: 0;
    padding: 14px 16px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--ok);
    overflow-y: auto;
    white-space: pre-wrap;
}

.console-line.muted {
    color: var(--text-muted);
}

.console-line.error {
    color: #ff6b6b;
}

.console::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 14px;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---------- statusbar ---------- */

.statusbar {
    display: flex;
    gap: 8px;
    align-items: center;
    height: 26px;
    padding: 0 14px;
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(220px, 1fr);
    }

    .editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .titlebar-name {
        display: none;
    }
}