:root {
    --compiler-bg: #f5f7fb;
    --compiler-panel: #ffffff;
    --compiler-panel-soft: #f8faff;
    --compiler-text: #142039;
    --compiler-muted: #68758d;
    --compiler-line: #dfe6f1;
    --compiler-primary: #06bbcc;
    --compiler-primary-2: #0798a8;
    --compiler-green: #08a66f;
    --compiler-green-soft: #eafbf4;
    --compiler-red: #dc3f4b;
    --compiler-red-soft: #fff0f1;
    --compiler-console: #101a30;
    --compiler-shadow: 0 10px 30px rgba(33, 49, 82, .07);
}

html[data-theme="dark"] {
    --compiler-bg: #0d1422;
    --compiler-panel: #111a2a;
    --compiler-panel-soft: #0d1625;
    --compiler-text: #e8eef8;
    --compiler-muted: #91a0b7;
    --compiler-line: #243149;
    --compiler-console: #090f1d;
    --compiler-shadow: 0 16px 40px rgba(0, 0, 0, .23);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.compiler-page {
    min-height: 100vh;
    color: var(--compiler-text);
    background: var(--compiler-bg);
    font-family: Inter, "Segoe UI", sans-serif;
}
button, select, textarea { font: inherit; }
button { color: inherit; }

.compiler-app { min-height: 100vh; }
.compiler-header {
    min-height: 94px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--compiler-line);
    background: color-mix(in srgb, var(--compiler-panel) 95%, transparent);
    backdrop-filter: blur(14px);
}
.compiler-brand-title { min-width: 0; display: flex; align-items: center; gap: 14px; }
.compiler-logo-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--compiler-primary), var(--compiler-primary-2));
    box-shadow: 0 10px 22px rgba(6, 187, 204, .25);
    font-size: 24px;
}
.compiler-brand-title h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.035em; }
.compiler-brand-title p { margin: 5px 0 0; color: var(--compiler-muted); font-size: 13px; font-weight: 500; }
.compiler-header-actions { display: flex; align-items: center; gap: 10px; }
.runtime-badge {
    min-width: 88px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid #bfead9;
    border-radius: 18px;
    color: #07855c;
    background: var(--compiler-green-soft);
    font-size: 12px;
    font-weight: 800;
}
.runtime-badge i { width: 8px; height: 8px; border-radius: 50%; background: #11b77b; box-shadow: 0 0 0 4px rgba(17, 183, 123, .12); }
.runtime-badge.checking { color: #7a6d2d; border-color: #f2e6aa; background: #fffbea; }
.runtime-badge.checking i { background: #d3aa2e; box-shadow: 0 0 0 4px rgba(211, 170, 46, .12); }
.runtime-badge.missing { color: #b23542; border-color: #f3cbd0; background: var(--compiler-red-soft); }
.runtime-badge.missing i { background: #e2515c; box-shadow: 0 0 0 4px rgba(226, 81, 92, .12); }
.compiler-language-select {
    width: 220px;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 7px 15px;
    border: 1px solid var(--compiler-line);
    border-radius: 13px;
    background: var(--compiler-panel);
}
.compiler-language-select span { color: var(--compiler-muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.compiler-language-select select { margin-top: 2px; border: 0; outline: 0; color: var(--compiler-text); background: transparent; font-size: 13px; font-weight: 700; cursor: pointer; }
.compiler-icon-button {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid var(--compiler-line);
    border-radius: 13px;
    color: var(--compiler-muted);
    background: var(--compiler-panel);
    cursor: pointer;
    font-size: 17px;
}
.compiler-icon-button:hover { color: var(--compiler-primary); border-color: #8ddce4; }

.compiler-main { padding: 14px 24px 24px; }
.compiler-new-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--compiler-primary), var(--compiler-primary-2));
    box-shadow: 0 8px 18px rgba(6, 187, 204, .22);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.compiler-tip { display: flex; align-items: center; gap: 8px; color: var(--compiler-muted); font-size: 11px; }
.compiler-tip i { color: var(--compiler-primary); }
.compiler-tip b { color: var(--compiler-text); }

.compiler-workspace {
    height: calc(100vh - 150px);
    min-height: 610px;
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(360px, .95fr);
    gap: 14px;
}
.compiler-editor-card,
.compiler-input-card,
.compiler-output-card {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--compiler-line);
    border-radius: 14px;
    background: var(--compiler-panel);
    box-shadow: var(--compiler-shadow);
}
.compiler-editor-card { display: flex; flex-direction: column; overflow: hidden; }
.compiler-tabs {
    min-height: 64px;
    display: flex;
    align-items: end;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid var(--compiler-line);
    background: var(--compiler-panel-soft);
}
.compiler-tabs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
.compiler-tab {
    min-width: 180px;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 -1px 8px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
    color: var(--compiler-muted);
    background: transparent;
    font-size: 11px;
    cursor: pointer;
}
.compiler-tab.active { color: var(--compiler-text); border-color: var(--compiler-line); background: var(--compiler-panel); font-weight: 700; }
.compiler-tab > span:nth-of-type(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compiler-tab .close-tab { opacity: .55; }
.compiler-tab .close-tab:hover { opacity: 1; color: var(--compiler-red); }
.language-chip {
    min-width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 6px;
    color: #fff;
    background: linear-gradient(135deg, var(--compiler-primary), var(--compiler-primary-2));
    font-size: 10px;
    font-weight: 800;
}
.dirty-dot { width: 6px; height: 6px; display: none; border-radius: 50%; background: #f59e0b; }
.compiler-tab.dirty .dirty-dot { display: block; }
.new-tab {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    display: grid;
    place-items: center;
    margin-bottom: -1px;
    border: 0;
    border-left: 1px solid var(--compiler-line);
    color: var(--compiler-muted);
    background: transparent;
    cursor: pointer;
    font-size: 16px;
}
.new-tab:hover { color: var(--compiler-primary); background: var(--compiler-panel); }
.compiler-toolbar {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--compiler-line);
}
.compiler-toolbar-left { min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compiler-toolbar-right { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.toolbar-new-program { flex: 0 0 auto; box-shadow: 0 6px 14px rgba(6, 187, 204, .18); }
.compiler-tip.compact { white-space: nowrap; font-size: 10px; }
.compiler-tool-group { min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.compiler-tool {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    color: #40506c;
    background: transparent;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}
html[data-theme="dark"] .compiler-tool { color: #b9c5d8; }
.compiler-tool:hover { color: var(--compiler-primary); background: #eefbfd; }
html[data-theme="dark"] .compiler-tool:hover { background: rgba(6, 187, 204, .12); }
.compiler-run-button {
    min-width: 235px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #0db47b, #079f6d);
    box-shadow: 0 8px 18px rgba(9, 169, 115, .2);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.compiler-run-button:hover { filter: brightness(.97); }
.compiler-run-button:disabled { opacity: .6; cursor: wait; }
.compiler-run-button kbd { padding: 3px 7px; border-radius: 5px; color: rgba(255,255,255,.94); background: rgba(0,0,0,.13); font-family: "JetBrains Mono", monospace; font-size: 8px; }

.compiler-editor-host { min-height: 0; flex: 1; background: var(--compiler-panel); }
.compiler-editor-host > textarea {
    width: 100%;
    height: 100%;
    resize: none;
    padding: 18px;
    border: 0;
    outline: 0;
    color: var(--compiler-text);
    background: var(--compiler-panel);
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
}
.compiler-editor-host .CodeMirror { height: 100%; color: var(--compiler-text); background: var(--compiler-panel); font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; line-height: 1.7; }
.compiler-editor-host .CodeMirror-gutters { border-right: 1px solid var(--compiler-line); background: var(--compiler-panel-soft); }
.compiler-editor-host .CodeMirror-linenumber { color: #8f9bb0; padding-right: 11px; }
.compiler-editor-host .CodeMirror-lines { padding: 14px 0; }
.compiler-editor-host .CodeMirror pre.CodeMirror-line,
.compiler-editor-host .CodeMirror pre.CodeMirror-line-like { padding: 0 14px; }
.compiler-editor-host .CodeMirror-activeline-background { background: rgba(6, 187, 204, .035); }
html[data-theme="dark"] .compiler-editor-host .CodeMirror-activeline-background { background: rgba(99, 102, 241, .08); }
.compiler-editor-host .CodeMirror-cursor { border-left: 2px solid var(--compiler-primary); }
.compiler-editor-host .CodeMirror-selected { background: rgba(6, 187, 204, .14) !important; }

/* Syntax colors intentionally optimized for quick scanning by beginners. */
.compiler-editor-host .cm-keyword { color: #295adf; }
.compiler-editor-host .cm-def { color: #202a3d; }
.compiler-editor-host .cm-variable { color: #25324a; }
.compiler-editor-host .cm-variable-2 { color: #6c3ad9; }
.compiler-editor-host .cm-string { color: #c62e2e; }
.compiler-editor-host .cm-number { color: #e65c14; }
.compiler-editor-host .cm-comment { color: #7c8da5; font-style: italic; }
.compiler-editor-host .cm-meta { color: #7a27d4; }
.compiler-editor-host .cm-operator { color: #37465e; }
html[data-theme="dark"] .compiler-editor-host .cm-def,
html[data-theme="dark"] .compiler-editor-host .cm-variable { color: #dfe7f5; }
html[data-theme="dark"] .compiler-editor-host .cm-variable-2 { color: #c4a7ff; }
html[data-theme="dark"] .compiler-editor-host .cm-keyword { color: #89a7ff; }
html[data-theme="dark"] .compiler-editor-host .cm-string { color: #ff9b95; }
html[data-theme="dark"] .compiler-editor-host .cm-number { color: #ffb46b; }
html[data-theme="dark"] .compiler-editor-host .cm-comment { color: #7990ad; }

/* VS Code-like suggestion popup */
.CodeMirror-hints {
    z-index: 3000 !important;
    min-width: 260px;
    max-width: 430px;
    max-height: 300px;
    padding: 6px;
    border: 1px solid var(--compiler-line) !important;
    border-radius: 10px !important;
    background: var(--compiler-panel) !important;
    box-shadow: 0 16px 42px rgba(20, 32, 57, .18) !important;
    font-family: Inter, sans-serif !important;
    font-size: 11px !important;
}
.CodeMirror-hint { display: flex; align-items: center; min-height: 31px; padding: 6px 9px !important; border-radius: 6px; color: var(--compiler-text) !important; }
.CodeMirror-hint-active { color: #fff !important; background: var(--compiler-primary) !important; }
.au-hint-label { display: flex; align-items: center; gap: 7px; width: 100%; }
.au-hint-kind { min-width: 45px; color: #0e9aaa; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.CodeMirror-hint-active .au-hint-kind { color: #ddd6fe; }
.au-hint-title { flex: 1; font-family: "JetBrains Mono", monospace; font-weight: 600; }

.compiler-side-panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; }
.compiler-input-card { padding: 0; overflow: hidden; }
.side-card-header {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--compiler-line);
}
.side-card-header > div { display: flex; align-items: center; gap: 10px; }
.side-card-header i { color: var(--compiler-primary); }
.side-card-header strong { font-size: 14px; }
.side-card-header > span:not(.output-status) { padding: 5px 9px; border-radius: 999px; color: var(--compiler-muted); background: var(--compiler-panel-soft); font-size: 9px; font-weight: 800; }
.compiler-input-card textarea {
    width: calc(100% - 28px);
    min-height: 100px;
    max-height: 145px;
    margin: 12px 14px 14px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--compiler-line);
    border-radius: 10px;
    outline: 0;
    color: var(--compiler-text);
    background: var(--compiler-panel);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    line-height: 1.55;
}
.compiler-input-card textarea:focus { border-color: #70d3dc; box-shadow: 0 0 0 3px rgba(6, 187, 204, .08); }
.compiler-output-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.output-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
}
.output-status.ready { color: #07855c; background: var(--compiler-green-soft); }
.output-status.running { color: #6b5c10; background: #fff9df; }
.output-status.success { color: #07855c; background: var(--compiler-green-soft); }
.output-status.error { color: #b23542; background: var(--compiler-red-soft); }
.compiler-result { min-height: 0; flex: 1; overflow: auto; padding: 14px; background: var(--compiler-panel); }
.compiler-empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--compiler-muted); }
.compiler-empty-state > span { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: var(--compiler-primary); background: #f0f2ff; font-size: 20px; }
html[data-theme="dark"] .compiler-empty-state > span { background: rgba(6,187,204,.14); }
.compiler-empty-state h3 { margin: 12px 0 4px; color: var(--compiler-text); font-size: 15px; }
.compiler-empty-state p { margin: 0; font-size: 10px; }
.compiler-result .compiler-block-title { margin: 0 0 8px; color: var(--compiler-text); font-size: 12px; font-weight: 800; }
.compiler-result .compiler-pre,
.compiler-result pre.output-box,
.compiler-result pre.error-output {
    min-height: 185px;
    margin: 0;
    overflow: auto;
    padding: 18px;
    border: 0;
    border-radius: 13px;
    color: #dfe8fb;
    background: linear-gradient(135deg, #111c33, var(--compiler-console));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.compiler-result pre.output-box { color: #59efb3; }
.compiler-result pre.error-output { color: #ff9da6; background: #22131b; }
.compiler-result .alert { border: 0; border-radius: 10px; font-size: 10px; }
.compiler-result .preview-frame { width: 100%; min-height: 100%; height: 100%; border: 1px solid var(--compiler-line); border-radius: 10px; background: #fff; }
.browser-runner-wrap { min-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.browser-runner-wrap .preview-frame { min-height: 360px; }

@media (max-width: 1160px) {
    .compiler-brand-title h1 { font-size: 20px; }
    .compiler-language-select { width: 175px; }
    .compiler-workspace { grid-template-columns: minmax(0, 1.55fr) minmax(330px, .95fr); }
    .compiler-tool span { display: none; }
    .compiler-tool { width: 40px; padding: 0; justify-content: center; }
    .compiler-run-button { min-width: 185px; }
}

@media (max-width: 860px) {
    .compiler-header { min-height: 78px; padding: 10px 14px; }
    .compiler-logo-mark { width: 44px; height: 44px; flex-basis: 44px; font-size: 18px; }
    .compiler-brand-title h1 { font-size: 15px; }
    .compiler-brand-title p { display: none; }
    .runtime-badge { display: none; }
    .compiler-language-select { width: 130px; min-height: 48px; }
    .compiler-icon-button { width: 46px; height: 46px; }
    .compiler-main { padding: 10px; }
    .compiler-topline { min-height: 60px; }
    .compiler-tip { display: none; }
    .compiler-workspace { height: auto; min-height: 0; display: flex; flex-direction: column; }
    .compiler-editor-card { height: 650px; }
    .compiler-side-panel { grid-template-rows: auto 520px; }
}

@media (max-width: 560px) {
    .compiler-header-actions { gap: 5px; }
    .compiler-brand-title { gap: 8px; }
    .compiler-logo-mark { display: none; }
    .compiler-language-select { width: 110px; padding-inline: 9px; }
    .compiler-icon-button { width: 42px; }
    .compiler-toolbar { align-items: stretch; flex-direction: column-reverse; }
    .compiler-tool-group { justify-content: space-between; }
    .compiler-run-button { width: 100%; }
    .compiler-editor-card { height: 610px; }
    .compiler-tab { min-width: 150px; }
}
.compiler-result pre.warning-output {
    color: #ffe29a;
    background: #241e10;
}
.compiler-result > pre.output-box:only-child {
    min-height: 100%;
}


@media (max-width: 1180px) {
    .compiler-toolbar { align-items: flex-start; }
    .compiler-toolbar-right { width: 100%; justify-content: space-between; }
    .compiler-tip.compact { order: 2; font-size: 9px; }
}

@media (max-width: 900px) {
    .compiler-main { padding-inline: 14px; }
    .compiler-workspace { height: calc(100vh - 140px); }
    .compiler-toolbar-left, .compiler-toolbar-right { width: 100%; }
    .compiler-toolbar-right { justify-content: space-between; }
}

@media (max-width: 760px) {
    .compiler-tip.compact { display: none; }
    .compiler-toolbar { gap: 10px; padding: 10px 12px; }
    .toolbar-new-program { width: 100%; justify-content: center; }
    .compiler-toolbar-left, .compiler-toolbar-right { width: 100%; }
    .compiler-run-button { width: 100%; min-width: 0; }
}


/* Safety: completely hide removed history/bookmark drawer UI if any cached script tries to inject it. */
.workspace-drawer,
.workspace-backdrop {
    display: none !important;
}

/* Aspire branding */
.aspire-brand-logo-link {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
}
.aspire-brand-logo {
    display: block;
    width: 150px;
    max-width: 20vw;
    height: auto;
    max-height: 54px;
    object-fit: contain;
}
.compiler-logo-mark { display: none !important; }
@media (max-width: 900px) {
    .aspire-brand-logo { width: 130px; max-width: 40vw; max-height: 46px; }
}
@media (max-width: 620px) {
    .aspire-brand-logo { width: 108px; max-width: 42vw; max-height: 40px; }
}

/* Responsive layout: keep overflow local to editors, tabs, and result regions. */
.compiler-app,
.compiler-main,
.compiler-workspace,
.compiler-header,
.compiler-brand-title,
.compiler-brand-title > div,
.compiler-header-actions,
.compiler-editor-card,
.compiler-side-panel,
.compiler-input-card,
.compiler-output-card,
.compiler-toolbar,
.compiler-toolbar-left,
.compiler-toolbar-right,
.compiler-editor-host,
.compiler-result {
    min-width: 0;
    max-width: 100%;
}

.compiler-editor-host .CodeMirror,
.compiler-editor-host .CodeMirror-scroll,
.compiler-editor-host .CodeMirror-sizer,
.compiler-editor-host .CodeMirror-lines {
    min-width: 0;
    max-width: 100%;
}

.compiler-editor-host .CodeMirror-scroll,
.compiler-tabs,
.compiler-result {
    -webkit-overflow-scrolling: touch;
}

.compiler-brand-title h1,
.compiler-brand-title p,
.side-card-header,
.compiler-result,
.compiler-result pre {
    overflow-wrap: anywhere;
}

.compiler-language-select select { width: 100%; min-width: 0; }

@media (max-width: 900px) {
    .compiler-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px 14px;
        padding: 12px 14px;
    }
    .compiler-brand-title { align-items: center; }
    .compiler-brand-title h1 { font-size: clamp(18px, 3vw, 21px); line-height: 1.2; }
    .compiler-brand-title p { display: block; margin-top: 3px; line-height: 1.35; }
    .compiler-header-actions { justify-content: flex-end; flex-wrap: wrap; }
    .runtime-badge { display: inline-flex; }
    .compiler-main { padding: 12px 14px 20px; }
    .compiler-workspace { height: auto; min-height: 0; display: flex; flex-direction: column; }
    .compiler-editor-card { width: 100%; height: 650px; min-height: 650px; }
    .compiler-side-panel { width: 100%; grid-template-rows: auto minmax(320px, 520px); }
    .compiler-output-card { min-height: 320px; }
}

@media (max-width: 600px) {
    .compiler-header { grid-template-columns: 1fr auto; padding: 10px 12px; }
    .compiler-brand-title { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; align-items: start; gap: 7px; width: 100%; }
    .aspire-brand-logo-link { width: fit-content; }
    .aspire-brand-logo { width: clamp(110px, 34vw, 130px); max-width: 100%; }
    .compiler-brand-title > div { width: 100%; }
    .compiler-brand-title h1 { font-size: clamp(18px, 5.2vw, 21px); }
    .compiler-brand-title p { font-size: 12px; }
    .compiler-header-actions { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) 44px; width: 100%; }
    .runtime-badge { min-width: 0; height: 44px; padding-inline: 10px; }
    .compiler-language-select { width: 100%; min-height: 48px; }
    .compiler-icon-button { width: 44px; height: 44px; }
    .compiler-main { padding: 10px; }
    .compiler-tabs { min-height: 58px; }
    .compiler-tab { min-width: 150px; height: 50px; margin-left: 6px; }
    .new-tab { position: sticky; right: 0; z-index: 3; width: 50px; height: 50px; flex-basis: 50px; background: var(--compiler-panel-soft); }
    .compiler-toolbar { flex-direction: column-reverse; align-items: stretch; gap: 8px; padding: 10px; }
    .compiler-toolbar-left, .compiler-toolbar-right { width: 100%; }
    .compiler-toolbar-right { display: block; }
    .compiler-tip.compact { display: none; }
    .compiler-run-button { width: 100%; min-width: 0; height: 48px; }
    .compiler-run-button kbd { display: none; }
    .toolbar-new-program { width: 100%; justify-content: center; }
    .compiler-tool-group { display: grid; grid-template-columns: repeat(5, minmax(44px, 1fr)); width: 100%; gap: 3px; }
    .compiler-tool { width: 100%; min-width: 44px; min-height: 44px; padding: 0 5px; justify-content: center; }
    .compiler-tool span { display: none; }
    .compiler-editor-card { height: 620px; min-height: 620px; }
    .compiler-editor-host .CodeMirror,
    .compiler-editor-host > textarea { font-size: 16px; }
    .compiler-input-card textarea { width: calc(100% - 20px); min-height: 130px; max-height: 240px; margin: 10px; font-size: 16px; }
    .compiler-side-panel { grid-template-rows: auto minmax(300px, 420px); gap: 10px; }
    .compiler-output-card { min-height: 300px; }
    .compiler-result { padding: 10px; }
    .CodeMirror-hints { min-width: 0; width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
}

@media (max-width: 360px) {
    .compiler-header-actions { grid-template-columns: minmax(0, 1fr) 44px; }
    .runtime-badge { grid-column: 1 / -1; justify-self: start; height: 38px; }
    .compiler-main { padding-inline: 8px; }
    .compiler-brand-title { gap: 6px; }
    .aspire-brand-logo { width: 110px; }
    .compiler-editor-card { height: 600px; min-height: 600px; }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 932px) {
    .compiler-header { padding-block: 8px; }
    .compiler-brand-title p, .runtime-badge { display: none; }
    .compiler-editor-card { height: 500px; min-height: 500px; }
}
