:root {
    --font-ui: Arial, Helvetica, sans-serif;
    --font-code: Consolas, "Courier New", monospace;
    --editor-font-size: 14px;
    --editor-line-height: 20px;
    --sidebar-bg: #1f6098;
    --sidebar-top: #1a5b90;
    --sidebar-item: #2c6ca2;
    --sidebar-item-hover: #3375ad;
    --sidebar-item-active: #c7d8e8;
    --workspace-bg: #32353b;
    --toolbar-top: #a7a8ab;
    --toolbar-bottom: #7f8185;
    --editor-bg: #2f3135;
    --editor-gutter: #35383e;
    --editor-gutter-border: #4b4f57;
    --input-bg: #e5e7eb;
    --output-head: #232a33;
    --output-bg: #10161f;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: var(--font-ui);
    background: var(--sidebar-bg);
}

.layout {
    width: 100%;
    height: 100vh;
    display: flex;
    overflow: hidden;
    background: var(--sidebar-bg);
}

.sidebar {
    width: 268px;
    min-width: 268px;
    display: flex;
    flex-direction: column;
    color: #fff;
    border-right: 1px solid #1a4f7e;
    background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bg) 14%, var(--sidebar-bg) 100%);
}

.brand {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: #1a5c92;
}

.brand-image-slot {
    display: block;
    width: 100%;
    height: auto;
}

.menu-head {
    padding: 12px 16px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    color: #dbe8f4;
    font: italic 14px/1.2 Georgia, "Times New Roman", serif;
    white-space: nowrap;
}

.menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--sidebar-item);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(0, 0, 0, 0.16);
    color: #ecf5fc;
    text-decoration: none;
    text-align: center;
    font-size: 13px;
    line-height: 1.1;
    font-weight: 700;
}

.menu-item:hover {
    background: var(--sidebar-item-hover);
}

.menu-item.active {
    background: var(--sidebar-item-active);
    color: #1f557f;
}

.menu-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 2px;
    background: #e84b4b;
    color: #fff;
    font-size: 9px;
    line-height: 1.1;
    text-transform: lowercase;
}

.footer-links {
    margin-top: auto;
    padding: 8px 10px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.17);
    color: #d5e4f2;
    text-align: center;
}

.footer-row {
    display: block;
    font-size: 11px;
    line-height: 1.4;
    white-space: normal;
}

.footer-link {
    color: #ebf5ff;
    text-decoration: none;
}

.footer-link:visited {
    color: #ebf5ff;
}

.footer-link:hover {
    color: #ffffff;
}

.footer-sep {
    padding: 0 3px;
    color: #bdd2e8;
}

.footer-copy {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.2;
    color: #e4edf6;
    text-align: center;
}

.workspace {
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--workspace-bg);
}

.toolbar {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 6px;
    border-bottom: 1px solid #6f7278;
    background: linear-gradient(180deg, var(--toolbar-top) 0%, var(--toolbar-bottom) 100%);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}

.toolbar-left {
    flex: 1 1 auto;
}

.toolbar-right {
    flex: 0 0 auto;
}

.mini-icon-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #72767d;
    border-radius: 1px;
    background: linear-gradient(180deg, #fafafa 0%, #e0e1e4 100%);
    color: #3f434b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
}

.mini-icon-btn-accent {
    border-color: #be7a1b;
    background: linear-gradient(180deg, #f5bf67 0%, #e79d34 100%);
    color: #ffffff;
}

.btn {
    height: 22px;
    border: 1px solid transparent;
    border-radius: 1px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-run {
    border-color: #2a8f2f;
    background: linear-gradient(180deg, #62cb62 0%, #45b147 100%);
}

.btn-debug {
    border-color: #3c78a5;
    background: linear-gradient(180deg, #5c98c8 0%, #4a83b2 100%);
}

.btn-stop {
    border-color: #b44a4a;
    background: linear-gradient(180deg, #eb8b8b 0%, #d86a6a 100%);
}

.btn-share {
    border-color: #c07b2c;
    background: linear-gradient(180deg, #f1b261 0%, #e5963c 100%);
}

.btn-save {
    border-color: #3d8bb2;
    background: linear-gradient(180deg, #75b9db 0%, #5ba4cd 100%);
}

.btn-beautify {
    border-color: #3a9ab5;
    background: linear-gradient(180deg, #89d0e7 0%, #63bdd8 100%);
}

.btn-caret {
    font-size: 9px;
    margin-left: 1px;
}

.btn:hover,
.mini-icon-btn:hover,
.panel-icon-btn:hover,
.controls-close:hover {
    filter: brightness(1.06);
}

.language-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #15181d;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.language-select {
    min-width: 104px;
    height: 22px;
    border: 1px solid #71757d;
    border-radius: 1px;
    background: #fbfbfc;
    color: #20252b;
    padding: 0 6px;
    font-size: 12px;
}

.editor-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--workspace-bg);
    border-bottom: 1px solid #4c5058;
}

.editor-tabs {
    height: 27px;
    display: flex;
    align-items: flex-end;
    background: #3f4248;
    border-bottom: 1px solid #5d6168;
}

.file-tab {
    height: 27px;
    min-width: 92px;
    border: 0;
    border-right: 1px solid #82a9ca;
    background: linear-gradient(180deg, #3d87c6 0%, #2f79b8 100%);
    color: #f5fbff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.editor-frame {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    overflow: hidden;
    background: var(--editor-bg);
}

.line-numbers {
    padding: 8px 8px 8px 0;
    border-right: 1px solid var(--editor-gutter-border);
    background: var(--editor-gutter);
    color: #7a8089;
    text-align: right;
    white-space: pre;
    user-select: none;
    overflow: hidden;
    font-family: var(--font-code);
    font-size: var(--editor-font-size);
    line-height: var(--editor-line-height);
    font-weight: 400;
}

.editor-area {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background-color: var(--editor-bg);
    background-image: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent 84px,
        rgba(255, 255, 255, 0.04) 84px,
        rgba(255, 255, 255, 0.04) 85px
    );
}

.highlight-layer,
#editor {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    border: 0;
    outline: none;
    padding: 8px 10px;
    font-family: var(--font-code);
    font-size: var(--editor-font-size);
    line-height: var(--editor-line-height);
    font-weight: 400;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
    max-width: 100%;
    max-height: 100%;
}

.highlight-layer {
    pointer-events: none;
    color: #e5e8ec;
    background: transparent;
}

.highlight-layer code {
    display: block;
}

#editor {
    display: block;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: #f0f3f7;
    -webkit-text-fill-color: transparent;
}

#editor::selection {
    background: rgba(255, 255, 255, 0.2);
}

.token-comment {
    color: #c88a63;
}

.token-string {
    color: #9fcb73;
}

.token-preprocessor {
    color: #5f9dcf;
}

.token-keyword {
    color: #e3a656;
}

.token-number {
    color: #6fc3db;
}

.controls-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #b8bdc5;
    border-bottom: 1px solid #afb4bc;
    background: var(--input-bg);
    color: #232931;
}

.controls-panel.is-collapsed {
    display: none;
}

.controls-bar.is-hidden,
.controls-body.is-hidden {
    display: none;
}

.controls-bar {
    height: 23px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px;
    border-bottom: 1px solid #c4c9d0;
    background: #f2f3f5;
}

.controls-icons {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.panel-icon-btn,
.controls-close {
    border: 0;
    background: transparent;
    color: #555c65;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.panel-icon-btn {
    width: 14px;
    height: 14px;
}

.controls-title {
    flex: 1 1 auto;
    text-align: center;
    color: #4a5057;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
}

.controls-close {
    width: 16px;
    height: 16px;
    color: #8f959c;
}

.controls-body {
    display: grid;
    gap: 9px;
    padding: 8px;
    background: var(--input-bg);
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.1;
}

.control-row > span {
    flex: 0 0 auto;
    white-space: nowrap;
}

.control-row input {
    flex: 1 1 auto;
    min-width: 0;
    height: 22px;
    border: 1px solid #9ca2aa;
    background: #ffffff;
    color: #232a32;
    padding: 0 6px;
    font: 12px var(--font-ui);
}

.stdin-mode-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    line-height: 1.2;
}

.stdin-mode-row > span {
    flex: 0 0 auto;
}

.stdin-mode-row label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stdin-box {
    width: 100%;
    min-height: 122px;
    border: 1px solid #9ca2aa;
    background: #ffffff;
    color: #232a32;
    padding: 7px;
    resize: none;
    font: 12px/17px var(--font-code);
}

.output-panel {
    display: none;
    flex-direction: column;
    flex: 0 0 140px;
    min-height: 140px;
    border-top: 1px solid #4e535c;
    background: var(--output-bg);
    color: #dbe1e7;
}

.output-panel.is-visible {
    display: flex;
}

.output-head {
    padding: 7px 10px;
    border-bottom: 1px solid #343a42;
    background: var(--output-head);
    color: #f1f4f7;
    font-size: 12px;
    line-height: 1.1;
}

#outputText {
    margin: 0;
    padding: 8px 10px;
    flex: 1 1 auto;
    overflow: auto;
    white-space: pre-wrap;
    color: #dbe1e8;
    font: 12px/18px var(--font-code);
}

@media (max-width: 1180px) {
    html,
    body {
        overflow: auto;
    }

    .layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
    }

    .workspace {
        min-height: 100vh;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .toolbar-right {
        margin-left: auto;
    }
}