/*
 *******************************************************************************
 * Project: Portfolio Website  -  IntelliJ "New UI" dark theme shell
 *
 * Author: Collin Turner
 * =============================================================================
 * (c) Copyright 2025 CollinDTurner All rights reserved.
 *******************************************************************************
*/

:root {
    /* chrome */
    --ide-bg:            #1e1f22;
    --ide-bg-panel:      #2b2d30;
    --ide-bg-editor:     #1e1f22;
    --ide-border:        #303236;
    --ide-border-strong: #1e1f22;

    /* text */
    --ide-fg:        #dfe1e5;
    --ide-fg-dim:    #9da0a8;
    --ide-fg-faint:  #6f737a;
    --ide-fg-editor: #bcbec4;

    /* interaction */
    --ide-hover:        #35373b;
    --ide-selected:     #2e436e;   /* focused selection (blue) */
    --ide-selected-dim: #3a3d41;   /* unfocused selection (grey) */
    --ide-accent:       #3574f0;   /* primary blue */
    --ide-run:          #5fb865;   /* run green */
    --ide-modified:     #e8a33d;

    /* editor syntax */
    --syn-comment:  #7a7e85;
    --syn-keyword:  #cf8e6d;
    --syn-string:   #6aab73;
    --syn-number:   #2aacb8;
    --syn-key:      #c77dbb;
    --syn-punct:    #bcbec4;
    --syn-tag:      #67a37c;
    --syn-func:     #56a8f5;

    /* scrollbar */
    --ide-scroll: #4b4d51;

    /* editor doc + gutter (adjustable in Settings) */
    --editor-font:   13px;
    --editor-lh:     1.55;
    --code-bg:       #2b2d30;
    --code-bg-block: #26282e;
    --gutter-fg:     #4b5059;
    --caret-line-bg: rgba(255, 255, 255, .05);

    --ui-font:   "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
    --mono-font: "JetBrains Mono", "SF Mono", "Consolas", "Liberation Mono", monospace;

    --toolbar-h: 40px;
    --stripe-w:  32px;
    --tabs-h:    35px;
    --status-h:  24px;
    --gutter-w:  52px;
    --project-width: 260px;
}

/* ---- IntelliJ Light -------------------------------------------------- */
:root[data-theme="light"] {
    --ide-bg:            #ffffff;
    --ide-bg-panel:      #f7f8fa;
    --ide-bg-editor:     #ffffff;
    --ide-border:        #ebecf0;
    --ide-border-strong: #d3d5db;

    --ide-fg:        #27282e;
    --ide-fg-dim:    #6c707e;
    --ide-fg-faint:  #9aa0ab;
    --ide-fg-editor: #080808;

    --ide-hover:        #eef1f5;
    --ide-selected:     #d4e2ff;
    --ide-selected-dim: #e6e6e6;
    --ide-accent:       #3574f0;
    --ide-run:          #3d8f3d;
    --ide-modified:     #b78900;

    --syn-comment:  #8c8c8c;
    --syn-keyword:  #0033b3;
    --syn-string:   #067d17;
    --syn-number:   #1750eb;
    --syn-key:      #871094;
    --syn-punct:    #1d1d1d;
    --syn-tag:      #0000d0;
    --syn-func:     #00627a;

    --ide-scroll: #c9ccd6;
    --code-bg:       #f0f1f3;
    --code-bg-block: #f7f8fa;
    --gutter-fg:     #a8adb8;
    --caret-line-bg: rgba(0, 0, 0, .045);
}

/* ---- High contrast ------------------------------------------------------ */
:root[data-theme="contrast"] {
    --ide-bg:            #000000;
    --ide-bg-panel:      #0d0d0d;
    --ide-bg-editor:     #000000;
    --ide-border:        #2f2f2f;
    --ide-border-strong: #000000;

    --ide-fg:        #ffffff;
    --ide-fg-dim:    #c6c6c6;
    --ide-fg-faint:  #949494;
    --ide-fg-editor: #ffffff;

    --ide-hover:        #1f1f1f;
    --ide-selected:     #1d5c99;
    --ide-selected-dim: #333333;
    --ide-accent:       #4ea1ff;
    --ide-run:          #4bd44b;
    --ide-modified:     #ffc400;

    --syn-comment:  #9b9b9b;
    --syn-keyword:  #ffa759;
    --syn-string:   #8ae234;
    --syn-number:   #6cdcff;
    --syn-key:      #ff9be5;
    --syn-punct:    #ffffff;
    --syn-tag:      #7fe0a0;
    --syn-func:     #7cc7ff;

    --ide-scroll: #4a4a4a;
    --code-bg:       #1a1a1a;
    --code-bg-block: #141414;
    --gutter-fg:     #6a6a6a;
    --caret-line-bg: rgba(255, 255, 255, .09);
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--ide-bg);
    color: var(--ide-fg);
    font-family: var(--ui-font);
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input  { font-family: inherit; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--ide-scroll); border: 3px solid transparent; background-clip: content-box; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #5c5f66; background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ============================================================ layout */
.ide {
    display: grid;
    grid-template-rows: var(--toolbar-h) 1fr var(--status-h);
    height: 100vh;
}

/* ============================================================ toolbar */
.ide-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    -webkit-user-select: none;
    user-select: none;
}
.tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--ide-fg-dim);
    font-size: 15px;
}
.tb-btn:hover { background: var(--ide-hover); color: var(--ide-fg); }
.tb-run { color: var(--ide-run); }
.tb-run:hover { background: rgba(95, 184, 101, 0.15); }
.tb-project { font-weight: 600; letter-spacing: .2px; }
.tb-vcs {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--ide-fg-dim);
}
.tb-vcs:hover { background: var(--ide-hover); }
.tb-vcs svg { width: 14px; height: 14px; fill: currentColor; }
.tb-spacer { flex: 1; }
.tb-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 200px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    background: var(--ide-bg);
    color: var(--ide-fg-faint);
}
.tb-search:focus-within { border-color: var(--ide-accent); }
.tb-search svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
.tb-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ide-fg);
    font-size: 12.5px;
}
.tb-search input::placeholder { color: var(--ide-fg-faint); }

/* ============================================================ body */
.ide-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.ide-body {
    display: flex;
    flex: 1;
    min-height: 0;
    background: var(--ide-bg);
}

/* left tool-window stripe */
.ide-stripe {
    width: var(--stripe-w);
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 0;
    background: var(--ide-bg-panel);
    border-right: 1px solid var(--ide-border-strong);
    -webkit-user-select: none;
    user-select: none;
}
.stripe-btn {
    writing-mode: vertical-rl;
    padding: 10px 0;
    margin: 2px 3px;
    border-radius: 5px;
    font-size: 11.5px;
    letter-spacing: .3px;
    color: var(--ide-fg-dim);
}
.stripe-btn:hover:not(:disabled) { background: var(--ide-hover); color: var(--ide-fg); }
.stripe-btn.active { background: var(--ide-selected-dim); color: var(--ide-fg); }
.stripe-btn:disabled { opacity: .45; cursor: default; }
.stripe-spacer { flex: 1; }

/* project tool window */
.ide-project {
    width: var(--project-width);
    flex: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--ide-bg);
    border-right: 1px solid var(--ide-border);
}
body.project-collapsed .ide-project,
body.project-collapsed .ide-resizer { display: none; }

.panel-header {
    display: flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--ide-fg-dim);
    -webkit-user-select: none;
    user-select: none;
}
.panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 4px 0 12px;
}
.panel-body[hidden] { display: none; }

/* structure tool window */
.structure { list-style: none; }
.structure-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px 0 12px;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    color: var(--ide-fg);
    -webkit-user-select: none;
    user-select: none;
}
.structure-row:hover { background: var(--ide-hover); }
.structure-row.selected { background: var(--ide-selected); }
.structure-row.lvl-2 { padding-left: 28px; }
.structure-row.lvl-3 { padding-left: 44px; }
.structure-icon {
    flex: none;
    width: 22px;
    text-align: right;
    font: 400 10px/1 var(--mono-font);
    color: var(--syn-comment);
}
.structure-row.lvl-1 .structure-icon::before { content: "#"; }
.structure-row.lvl-2 .structure-icon::before { content: "##"; }
.structure-row.lvl-3 .structure-icon::before { content: "###"; }
.structure-label { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.structure-empty {
    padding: 12px;
    color: var(--ide-fg-faint);
    font: 400 12px/1.4 var(--mono-font);
}

/* brief highlight on a heading jumped to from the Structure panel */
@keyframes structure-flash {
    0%, 35% { background: rgba(53, 116, 240, .25); }
    100% { background: transparent; }
}
.structure-flash { animation: structure-flash 1.2s ease-out; border-radius: 4px; }

/* resizer */
.ide-resizer {
    width: 5px;
    flex: none;
    margin-left: -3px;
    cursor: col-resize;
    z-index: 5;
}
.ide-resizer:hover, .ide-resizer.dragging { background: var(--ide-accent); opacity: .4; }

/* ============================================================ tree */
.tree, .tree ul { list-style: none; }
.tree-row {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding-right: 10px;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ide-fg);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.tree-row:hover { background: var(--ide-hover); }
.tree-file.selected > .tree-row { background: var(--ide-selected); }

.tree-chevron {
    width: 12px;
    height: 12px;
    flex: none;
    position: relative;
    color: var(--ide-fg-dim);
}
.tree-folder > .tree-row .tree-chevron::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    border: 4px solid transparent;
    border-left-color: currentColor;
    transition: transform .12s ease;
}
.tree-folder:not(.collapsed) > .tree-row .tree-chevron::before {
    transform: rotate(45deg);
    top: 4px;
    left: 1px;
}
.tree-folder.collapsed > .tree-children { display: none; }

.tree-icon {
    width: 16px;
    height: 16px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font: 700 9px/1 var(--mono-font);
    color: #1e1f22;
}
.tree-icon.icon-folder,
.tree-icon.icon-module {
    background: none;
    color: #a9b0bb;
}
.tree-icon.icon-folder::before,
.tree-icon.icon-module::before {
    content: "";
    width: 15px;
    height: 12px;
    background: currentColor;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h4l1.2 1.5h7.8a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-13a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h4l1.2 1.5h7.8a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-13a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
}
.tree-icon.icon-module::before { opacity: .9; }
.tree-icon.icon-md   { background: #4a88c7; }
.tree-icon.icon-md::after   { content: "M"; }
.tree-icon.icon-json { background: #e8a33d; }
.tree-icon.icon-json::after { content: "{}"; font-size: 8px; }
.tree-icon.icon-pdf  { background: #d6482f; }
.tree-icon.icon-pdf::after  { content: "PDF"; font-size: 6px; letter-spacing: -.3px; }
.tree-icon.icon-html { background: #e37933; }
.tree-icon.icon-html::after { content: "<>"; font-size: 8px; }
.tree-icon.icon-java { background: #e76f00; }
.tree-icon.icon-java::after { content: "J"; }
.tree-icon.icon-txt  { background: #8b9099; }
.tree-icon.icon-txt::after  { content: "T"; }
.tree-icon.icon-action { background: none; color: var(--ide-run); }
.tree-icon.icon-action::before {
    content: "";
    width: 13px;
    height: 13px;
    background: currentColor;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M9 1 3 9h4l-1 6 7-9H8z'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M9 1 3 9h4l-1 6 7-9H8z'/%3E%3C/svg%3E");
}

/* ============================================================ editor */
.ide-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-editor);
}

/* tab bar */
.editor-tabs {
    display: flex;
    align-items: stretch;
    height: var(--tabs-h);
    flex: none;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-user-select: none;
    user-select: none;
}
.editor-tabs::-webkit-scrollbar { height: 0; }

.tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px 0 12px;
    max-width: 220px;
    border-right: 1px solid var(--ide-border-strong);
    color: var(--ide-fg-dim);
    font-size: 12.5px;
    white-space: nowrap;
    position: relative;
    cursor: pointer;
}
.tab:hover { background: var(--ide-hover); }
.tab.active {
    background: var(--ide-bg-editor);
    color: var(--ide-fg);
}
.tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--ide-accent);
}
.tab.drag-over-left::before,
.tab.drag-over-right::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--ide-accent);
}
.tab.drag-over-left::before  { left: -1px; }
.tab.drag-over-right::before { right: -1px; }
.tab.dragging { opacity: .4; }

.tab .tree-icon { width: 15px; height: 15px; }
.tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex: none;
    color: var(--ide-fg-faint);
    font-size: 14px;
    line-height: 1;
    visibility: hidden;
}
.tab:hover .tab-close,
.tab.active .tab-close { visibility: visible; }
.tab.modified .tab-close::before { content: "\2022"; }        /* dot */
.tab-close::before { content: "\00d7"; }
.tab.modified:hover .tab-close::before,
.tab.modified .tab-close:hover::before { content: "\00d7"; }
.tab-close:hover { background: var(--ide-hover); color: var(--ide-fg); }

/* breadcrumb bar (under the tabs) */
.editor-crumbs {
    display: flex;
    align-items: center;
    gap: 1px;
    height: 24px;
    flex: none;
    padding: 0 10px;
    background: var(--ide-bg-editor);
    border-bottom: 1px solid var(--ide-border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    font-size: 11.5px;
    color: var(--ide-fg-dim);
    -webkit-user-select: none;
    user-select: none;
}
.editor-crumbs[hidden] { display: none; }
.editor-crumbs::-webkit-scrollbar { height: 0; }
.crumb {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 2px 5px;
    border-radius: 4px;
    white-space: nowrap;
    color: var(--ide-fg-dim);
    cursor: pointer;
}
.crumb:hover { background: var(--ide-hover); color: var(--ide-fg); }
.crumb-file { color: var(--ide-fg); cursor: default; }
.crumb .tree-icon { width: 13px; height: 13px; }
.crumb-sep {
    flex: none;
    padding: 0 2px;
    color: var(--ide-fg-faint);
    pointer-events: none;
}

/* editor content + gutter */
.editor-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    position: relative;
}
.editor-scroll {
    position: relative;
    min-height: 100%;
}
.gutter {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: var(--gutter-w);
    padding-top: 14px;
    text-align: right;
    font: 400 var(--editor-font) / calc(var(--editor-font) * var(--editor-lh)) var(--mono-font);
    color: var(--gutter-fg);
    background: var(--ide-bg-editor);
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}
.gutter span { display: block; padding-right: 14px; }
.gutter.hidden { display: none; }

.caret-line {
    position: absolute;
    left: var(--gutter-w);
    right: 0;
    z-index: 0;
    background: var(--caret-line-bg);
    pointer-events: none;
}
.caret-line[hidden] { display: none; }

.editor-panes { position: relative; z-index: 1; margin-left: var(--gutter-w); min-height: 200px; }
.editor-doc[hidden] { display: none; }

/* ---- Resume.pdf: an embedded "PDF viewer" pane ---- */
.pdfview {
    margin-left: calc(-1 * var(--gutter-w));   /* the gutter is hidden for this pane */
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-editor);
}
.pdfbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    flex: none;
    padding: 0 12px;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    font-size: 12px;
    color: var(--ide-fg-dim);
}
.pdfbar-name { font-family: var(--mono-font); }
.pdfbar-spacer { flex: 1; }
.pdfbar-btn {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    color: var(--ide-fg);
    font-size: 11.5px;
    text-decoration: none;
}
.pdfbar-btn:hover { background: var(--ide-hover); border-color: var(--ide-accent); }
.pdfstage {
    padding: 18px;
    background: #33353a;
    display: flex;
    justify-content: center;
}
.pdfframe {
    width: 100%;
    max-width: 820px;
    height: 760px;                 /* auto-fitted to content by ide.js on load */
    border: 0;
    background: #fff;
    box-shadow: 0 6px 28px rgba(0, 0, 0, .45);
}

/* ---- Skills.json: a collapsible JSON tree ---- */
.jsonview {
    margin-left: calc(-1 * var(--gutter-w));   /* the gutter is hidden for this pane */
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-editor);
}
.jsonbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    flex: none;
    padding: 0 12px;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    font-size: 12px;
    color: var(--ide-fg-dim);
}
.jsonbar-name { font-family: var(--mono-font); }
.jsonbar-hint { font-size: 11px; color: var(--ide-fg-faint); }
.jsonbar-spacer { flex: 1; }
.jsonbar-btn {
    height: 22px;
    padding: 0 10px;
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    color: var(--ide-fg);
    font-size: 11.5px;
}
.jsonbar-btn:hover { background: var(--ide-hover); border-color: var(--ide-accent); }

.jsontree {
    padding: 12px 14px 48px;
    font: 400 12.5px/1.7 var(--mono-font);
    color: var(--syn-punct);
    overflow-x: auto;
}
.jt-row { white-space: nowrap; }
.jt-leaf, .jt-close { padding-left: 12px; }
.jt-branch { cursor: pointer; border-radius: 3px; }
.jt-branch:hover { background: var(--ide-hover); }
.jt-children { margin-left: 3px; padding-left: 18px; border-left: 1px solid var(--ide-border); }
.jt-toggle { display: inline-block; width: 12px; color: var(--ide-fg-dim); font-size: 9px; }
.jt-toggle::before { content: "\25be"; }                          /* ▾ */
.jt-node.collapsed > .jt-row .jt-toggle::before { content: "\25b8"; }  /* ▸ */
.jt-node.collapsed > .jt-children,
.jt-node.collapsed > .jt-close { display: none; }
.jt-preview { display: none; color: var(--ide-fg-faint); }
.jt-node.collapsed > .jt-row .jt-preview { display: inline; }

.jt-key   { color: var(--syn-key); }
.jt-count { margin-left: 6px; color: var(--ide-fg-faint); font-size: 11px; }
.jt-str   { color: var(--syn-string); }
.jt-num   { color: var(--syn-number); }
.jt-bool,
.jt-null  { color: var(--syn-keyword); }

/* ============================================================ document styling */
.doc {
    max-width: 860px;
    padding: 14px 48px 80px 20px;
    font-size: var(--editor-font);
    line-height: calc(var(--editor-font) * var(--editor-lh));
    color: var(--ide-fg-editor);
}
.doc-loading, .doc-error { padding: 20px; color: var(--ide-fg-faint); font-family: var(--mono-font); }
.doc-error { color: #e2696b; }

.doc h1, .doc h2, .doc h3 { font-weight: 600; color: var(--ide-fg); line-height: 1.35; }
.doc h1 { font-size: 24px; margin: 6px 0 14px; }
.doc h2 { font-size: 18px; margin: 30px 0 10px; }
.doc h3 { font-size: 15px; margin: 20px 0 6px; }
.doc p  { margin: 10px 0; }
.doc ul, .doc ol { margin: 10px 0 10px 22px; }
.doc li { margin: 4px 0; }
.doc a { color: var(--syn-func); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc strong { color: var(--ide-fg); font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--ide-border); margin: 24px 0; }
.doc code {
    font-family: var(--mono-font);
    font-size: 12px;
    background: var(--code-bg);
    border: 1px solid var(--ide-border);
    border-radius: 4px;
    padding: 1px 5px;
}
.doc pre {
    font-family: var(--mono-font);
    font-size: 12.5px;
    line-height: 20px;
    background: var(--code-bg-block);
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 12px 0;
}
.doc pre code { background: none; border: 0; padding: 0; }
.doc kbd {
    font-family: var(--mono-font);
    font-size: 11px;
    background: var(--code-bg);
    border: 1px solid var(--ide-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 5px;
}
.doc blockquote {
    border-left: 3px solid var(--ide-border);
    padding-left: 14px;
    color: var(--ide-fg-dim);
    margin: 12px 0;
}

/* markdown "source" flavour: prefix headings with # like the raw file */
.doc-md h1::before,
.doc-md h2::before,
.doc-md h3::before {
    color: var(--syn-comment);
    font-weight: 400;
    font-family: var(--mono-font);
}
.doc-md h1::before { content: "# "; }
.doc-md h2::before { content: "## "; }
.doc-md h3::before { content: "### "; }

.doc-md .frontmatter {
    font-family: var(--mono-font);
    font-size: 12px;
    color: var(--syn-comment);
    border-left: 2px solid var(--ide-border);
    padding: 2px 0 2px 12px;
    margin-bottom: 18px;
    white-space: pre-wrap;
}
.doc-md .tag {
    display: inline-block;
    font-family: var(--mono-font);
    font-size: 11.5px;
    color: var(--syn-string);
    background: rgba(106, 171, 115, .1);
    border: 1px solid rgba(106, 171, 115, .25);
    border-radius: 4px;
    padding: 1px 7px;
    margin: 2px 4px 2px 0;
}

/* json "file" */
.doc-json pre { background: var(--ide-bg-editor); border: 0; padding: 0; font-size: 13px; line-height: 21px; }

/* generated syntax highlighting - see highlightCode() in ide.js */
.doc .hl-key   { color: var(--syn-key); }
.doc .hl-str   { color: var(--syn-string); }
.doc .hl-num   { color: var(--syn-number); }
.doc .hl-lit,
.doc .hl-kw    { color: var(--syn-keyword); }
.doc .hl-punct { color: var(--syn-punct); }
.doc .hl-com   { color: var(--syn-comment); font-style: italic; }
.doc .hl-fn    { color: var(--syn-func); }
.doc .hl-tag   { color: var(--syn-tag); }

.doc .headshot {
    float: right;
    width: 132px;
    height: 132px;
    border-radius: 8px;
    margin: 4px 0 12px 20px;
    object-fit: cover;
    border: 1px solid var(--ide-border);
}
.doc .kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 14px 0; }
.doc .kv dt { color: var(--syn-key); font-family: var(--mono-font); font-size: 12.5px; }
.doc .kv dd { color: var(--ide-fg-editor); }

.doc .timeline { border-left: 2px solid var(--ide-border); margin: 16px 0; padding-left: 20px; }
.doc .timeline .role { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc .timeline .when { color: var(--ide-fg-faint); font-family: var(--mono-font); font-size: 12px; white-space: nowrap; }
.doc .role-tags { margin: 8px 0 0; }

.doc .links { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.doc .links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--ide-border);
    border-radius: 8px;
    color: var(--ide-fg);
}
.doc .links a:hover { border-color: var(--ide-accent); background: var(--ide-hover); text-decoration: none; }
.doc .links svg { width: 16px; height: 16px; fill: currentColor; }

/* shields-style badges (README.md) */
.doc .badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.doc .badge {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--ide-border);
    border-radius: 4px;
    overflow: hidden;
    font-family: var(--mono-font);
    font-size: 11px;
    line-height: 1;
    text-decoration: none;
}
.doc a.badge:hover { border-color: var(--ide-accent); text-decoration: none; }
.doc .badge-k { padding: 4px 7px; background: var(--ide-bg-panel); color: var(--ide-fg-dim); }
.doc .badge-v { padding: 4px 7px; background: var(--code-bg); color: var(--ide-fg); }
.doc .badge-live { background: rgba(95, 184, 101, .18); color: var(--ide-run); }
.doc .badge-src { color: var(--syn-func); }

/* contact form (Contact.md) */
.cform { max-width: 460px; margin: 12px 0 20px; }
.cform-row { margin-bottom: 10px; }
.cform-row label {
    display: block;
    margin-bottom: 4px;
    font-family: var(--mono-font);
    font-size: 11.5px;
    color: var(--syn-key);
}
.cform input,
.cform textarea {
    width: 100%;
    padding: 7px 9px;
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    color: var(--ide-fg);
    font: inherit;
    font-size: 13px;
}
.cform textarea { min-height: 88px; resize: vertical; font-family: var(--mono-font); font-size: 12.5px; }
.cform input:focus,
.cform textarea:focus { outline: 0; border-color: var(--ide-accent); }
.cform-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cform-send {
    padding: 7px 16px;
    border-radius: 6px;
    background: var(--ide-accent);
    color: #fff;
    font-size: 12.5px;
}
.cform-send:hover { filter: brightness(1.08); }
.cform-copy {
    padding: 7px 12px;
    border: 1px solid var(--ide-border);
    border-radius: 6px;
    color: var(--ide-fg);
    font-size: 12.5px;
}
.cform-copy:hover { background: var(--ide-hover); border-color: var(--ide-accent); }
.cform-status { font-size: 11.5px; color: var(--ide-fg-dim); }
.cform-status.err { color: #e2696b; }
.cform-status.ok { color: var(--ide-run); }

/* style-guide fragment (reused from the standalone page) */
.doc .sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.doc .sg-swatch { border: 1px solid var(--ide-border); border-radius: 6px; overflow: hidden; font-family: var(--mono-font); font-size: 11px; }
.doc .sg-swatch .chip { height: 54px; }
.doc .sg-swatch .meta { padding: 6px 8px; color: var(--ide-fg-dim); }

/* ============================================================ welcome */
.welcome {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}
.welcome[hidden] { display: none; }
.welcome-inner { max-width: 420px; }
.welcome-logo {
    font-family: var(--mono-font);
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--ide-fg);
}
.welcome-logo::after { content: "_"; color: var(--ide-accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.welcome-sub { margin-top: 8px; color: var(--ide-fg-dim); }
.welcome-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 26px 0 18px; }
.welcome-links button {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--ide-border);
    border-radius: 7px;
    color: var(--ide-fg);
    font-family: var(--mono-font);
    font-size: 12px;
}
.welcome-links button:hover { border-color: var(--ide-accent); background: var(--ide-hover); }
.welcome-hint { color: var(--ide-fg-faint); font-size: 12px; }

/* ============================================================ status bar */
.ide-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 12px;
    background: var(--ide-bg-panel);
    border-top: 1px solid var(--ide-border-strong);
    color: var(--ide-fg-dim);
    font-size: 11.5px;
    -webkit-user-select: none;
    user-select: none;
}
.ide-status .st-spacer { flex: 1; }
.ide-status svg { width: 12px; height: 12px; fill: currentColor; vertical-align: -2px; margin-right: 4px; }
.ide-status .st-item { white-space: nowrap; }
.ide-status .st-item:hover { color: var(--ide-fg); }

.welcome-hint kbd {
    font-family: var(--mono-font);
    font-size: 11px;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 3px;
    padding: 0 4px;
}

/* ============================================================ bottom tool window */
.ide-bottom {
    position: relative;
    flex: none;
    height: var(--bottom-h, 240px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-editor);
    border-top: 1px solid var(--ide-border-strong);
}
.ide-bottom[hidden] { display: none; }

.bottom-resizer {
    position: absolute;
    top: -3px; left: 0; right: 0;
    height: 6px;
    cursor: row-resize;
    z-index: 5;
}
.bottom-resizer:hover, .bottom-resizer.dragging { background: var(--ide-accent); opacity: .4; }

.bottom-tabs {
    display: flex;
    align-items: stretch;
    height: 30px;
    flex: none;
    background: var(--ide-bg-panel);
    border-bottom: 1px solid var(--ide-border-strong);
    -webkit-user-select: none;
    user-select: none;
}
.bottom-tab {
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 12px;
    color: var(--ide-fg-dim);
    border-right: 1px solid var(--ide-border-strong);
    position: relative;
}
.bottom-tab.active { color: var(--ide-fg); background: var(--ide-bg-editor); }
.bottom-tab.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--ide-accent);
}
.bottom-spacer { flex: 1; }
.bottom-close {
    width: 30px;
    color: var(--ide-fg-faint);
    font-size: 16px;
    line-height: 1;
}
.bottom-close:hover { background: var(--ide-hover); color: var(--ide-fg); }

.bottom-body { flex: 1; min-height: 0; overflow: hidden; }

/* bottom tool-window panels (Problems / TODO / Git log / Terminal) */
.bpanel {
    height: 100%;
    overflow-y: auto;
    padding: 8px 12px;
    font: 400 12.5px/1.6 var(--mono-font);
    color: var(--ide-fg-editor);
}
.bpanel[hidden] { display: none; }
#bpanel-terminal { padding: 0; overflow: hidden; }

.bpanel-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 4px;
    color: var(--ide-fg-faint);
}
.bok { color: var(--ide-run); font-weight: 700; }

.bsection {
    margin: 12px 6px 4px;
    color: var(--ide-fg-faint);
    font-size: 10.5px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.bsection:first-child { margin-top: 2px; }

.brow {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 3px 6px;
    border-radius: 4px;
}
.brow[data-open] { cursor: pointer; }
.brow[data-open]:hover { background: var(--ide-hover); }
.brow .bmark { flex: none; color: var(--syn-comment); }
.brow .bhash { flex: none; color: var(--syn-func); }
.brow .btext { flex: 1; min-width: 0; }
.brow .bdate { flex: none; margin-left: auto; padding-left: 12px; color: var(--ide-fg-faint); }

/* ============================================================ terminal */
.term {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    overflow-y: auto;
    font: 400 12.5px/1.5 var(--mono-font);
    color: var(--ide-fg-editor);
}
.term-output { white-space: pre-wrap; word-break: break-word; }
.term-output .cmd   { color: var(--ide-fg); }
.term-output .err   { color: #e2696b; }
.term-output .muted { color: var(--ide-fg-faint); }
.term-output .accent { color: var(--syn-func); }
.term-output a { color: var(--syn-func); text-decoration: none; }
.term-output a:hover { text-decoration: underline; }
.term-block { margin: 2px 0 8px; }
.term-inputline { display: flex; align-items: baseline; gap: 8px; }
.term-prompt { flex: none; color: var(--ide-run); }
.term-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ide-fg);
    font: inherit;
}

/* ============================================================ search everywhere */
.se-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
    background: rgba(0, 0, 0, .45);
}
.se-overlay[hidden] { display: none; }

.se-modal {
    width: min(640px, 92vw);
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.se-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ide-border-strong);
}
.se-input-row input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ide-fg);
    font-size: 18px;
    font-weight: 500;
}
.se-input-row input::placeholder { color: var(--ide-fg-faint); }
.se-hint {
    flex: none;
    font-size: 11px;
    color: var(--ide-fg-dim);
    border: 1px solid var(--ide-border);
    border-radius: 4px;
    padding: 2px 7px;
}

.se-results {
    list-style: none;
    max-height: 46vh;
    overflow-y: auto;
    padding: 4px;
}
.se-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.se-row.active { background: var(--ide-selected); }
.se-row .tree-icon { width: 15px; height: 15px; }
.se-name { color: var(--ide-fg); overflow: hidden; text-overflow: ellipsis; }
.se-name b { color: #6fa8ff; font-weight: 700; }
.se-row.active .se-name b { color: #bcd7ff; }
.se-sub {
    margin-left: auto;
    padding-left: 16px;
    color: var(--ide-fg-faint);
    font-size: 11.5px;
    font-family: var(--mono-font);
    overflow: hidden;
    text-overflow: ellipsis;
}
.se-empty { padding: 16px 14px; color: var(--ide-fg-faint); font-family: var(--mono-font); }

.se-footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--ide-border-strong);
    color: var(--ide-fg-faint);
    font-size: 11px;
}
.se-footer kbd {
    font-family: var(--mono-font);
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-radius: 3px;
    padding: 0 4px;
    margin-right: 3px;
}

/* ============================================================ context menu */
.ctx-menu {
    position: fixed;
    z-index: 70;
    min-width: 180px;
    padding: 4px;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    font-size: 12.5px;
    -webkit-user-select: none;
    user-select: none;
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 6px 10px;
    border-radius: 5px;
    color: var(--ide-fg);
    white-space: nowrap;
    cursor: pointer;
}
.ctx-item.active:not(.disabled) { background: var(--ide-selected); }
.ctx-item.disabled { color: var(--ide-fg-faint); cursor: default; }
.ctx-item.danger { color: var(--ide-modified); }
.ctx-hint { color: var(--ide-fg-faint); font-family: var(--mono-font); font-size: 11px; }
.ctx-item.active:not(.disabled) .ctx-hint { color: var(--ide-fg-dim); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--ide-border); }

/* ============================================================ recent files */
.rf-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
    background: rgba(0, 0, 0, .35);
}
.rf-overlay[hidden] { display: none; }
.rf-modal {
    width: min(420px, 92vw);
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.rf-title {
    padding: 9px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ide-fg-dim);
    border-bottom: 1px solid var(--ide-border-strong);
}
.rf-list { list-style: none; max-height: 52vh; overflow-y: auto; padding: 4px; }
.rf-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.rf-row.active { background: var(--ide-selected); }
.rf-row .tree-icon { width: 15px; height: 15px; }
.rf-name { color: var(--ide-fg); overflow: hidden; text-overflow: ellipsis; }
.rf-sub {
    margin-left: auto;
    padding-left: 16px;
    color: var(--ide-fg-faint);
    font-size: 11.5px;
    font-family: var(--mono-font);
    overflow: hidden;
    text-overflow: ellipsis;
}
.rf-empty { padding: 16px 14px; color: var(--ide-fg-faint); font-family: var(--mono-font); font-size: 12px; }

/* ============================================================ settings dialog */
.cfg-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 14vh;
    background: rgba(0, 0, 0, .45);
}
.cfg-overlay[hidden] { display: none; }
.cfg-modal {
    width: min(440px, 92vw);
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.cfg-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ide-fg);
    border-bottom: 1px solid var(--ide-border-strong);
}
.cfg-body { padding: 6px 16px 12px; }
.cfg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
    border-bottom: 1px solid var(--ide-border);
    color: var(--ide-fg);
    font-size: 12.5px;
}
.cfg-row:last-child { border-bottom: 0; }
.cfg-row select {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--ide-fg);
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    padding: 4px 8px;
}
.cfg-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ide-accent); }
.cfg-stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    background: var(--ide-bg);
}
.cfg-stepper button {
    width: 24px;
    height: 24px;
    font-size: 14px;
    color: var(--ide-fg-dim);
}
.cfg-stepper button:hover { color: var(--ide-fg); background: var(--ide-hover); }
.cfg-stepper span { min-width: 26px; text-align: center; font-family: var(--mono-font); }
.cfg-danger {
    padding: 5px 12px;
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    color: var(--ide-modified);
}
.cfg-danger:hover { background: var(--ide-hover); }
.cfg-footer {
    display: flex;
    justify-content: flex-end;
    padding: 10px 16px;
    border-top: 1px solid var(--ide-border-strong);
}
.cfg-done {
    padding: 6px 16px;
    border-radius: 6px;
    background: var(--ide-accent);
    color: #fff;
    font-size: 12.5px;
}
.cfg-done:hover { filter: brightness(1.08); }

/* ---- go to line (Ctrl+G) ---- */
.gtl-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 16vh;
    background: rgba(0, 0, 0, .3);
}
.gtl-overlay[hidden] { display: none; }
.gtl-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    font-size: 12.5px;
    color: var(--ide-fg);
}
.gtl-box input {
    width: 88px;
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-radius: 5px;
    padding: 4px 8px;
    color: var(--ide-fg);
    font: inherit;
}
.gtl-box input:focus { outline: 0; border-color: var(--ide-accent); }

/* ============================================================ shortcuts cheat-sheet */
.ks-overlay {
    position: fixed;
    inset: 0;
    z-index: 62;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 9vh;
    background: rgba(0, 0, 0, .45);
}
.ks-overlay[hidden] { display: none; }
.ks-modal {
    width: min(720px, 94vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    overflow: hidden;
}
.ks-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ide-fg);
    border-bottom: 1px solid var(--ide-border-strong);
}
.ks-header .ks-hint { font-weight: 400; font-size: 11px; color: var(--ide-fg-faint); }
.ks-header .ks-hint kbd {
    font-family: var(--mono-font);
    font-size: 10px;
    border: 1px solid var(--ide-border);
    border-radius: 3px;
    padding: 0 4px;
}
.ks-body {
    padding: 10px 16px 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    align-content: start;
}
.ks-group { margin-bottom: 10px; }
.ks-group h4 {
    margin: 8px 0 3px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ide-fg-faint);
}
.ks-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    font-size: 12.5px;
}
.ks-row .ks-desc { color: var(--ide-fg-dim); min-width: 0; }
.ks-keys { flex: none; display: flex; gap: 4px; white-space: nowrap; }
.ks-keys kbd {
    font-family: var(--mono-font);
    font-size: 11px;
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--ide-fg);
}
@media (max-width: 640px) {
    .ks-body { grid-template-columns: 1fr; }
}

/* ============================================================ notification balloons */
.toast-stack {
    position: fixed;
    right: 16px;
    bottom: calc(var(--status-h) + 14px);
    z-index: 58;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(340px, 90vw);
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 16px 1fr 18px;
    gap: 2px 10px;
    padding: 11px 12px;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    border-left: 3px solid var(--ide-accent);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
    animation: toast-in .22s ease-out;
}
.toast.leaving { animation: toast-out .18s ease-in forwards; }
.toast.type-success { border-left-color: var(--ide-run); }
.toast-icon { grid-row: 1 / span 2; width: 16px; height: 16px; margin-top: 1px; color: var(--ide-accent); }
.toast.type-success .toast-icon { color: var(--ide-run); }
.toast-icon svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.toast-title { font-size: 12.5px; font-weight: 600; color: var(--ide-fg); }
.toast-body {
    font-size: 11.5px;
    color: var(--ide-fg-dim);
    font-family: var(--mono-font);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toast-close {
    grid-row: 1 / span 2;
    align-self: start;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    color: var(--ide-fg-faint);
    font-size: 14px;
    line-height: 1;
}
.toast-close:hover { background: var(--ide-hover); color: var(--ide-fg); }

@keyframes toast-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) {
    .toast, .toast.leaving { animation: none; }
}

/* ---- presentation mode ---- */
.pres-exit {
    display: none;
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 40;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--ide-bg-panel);
    border: 1px solid var(--ide-border);
    color: var(--ide-fg-dim);
    font-size: 11px;
}
.pres-exit kbd {
    font-family: var(--mono-font);
    background: var(--ide-bg);
    border: 1px solid var(--ide-border);
    border-radius: 3px;
    padding: 0 4px;
}
body.presentation .ide { grid-template-rows: 0 1fr 0; }
body.presentation .ide-toolbar,
body.presentation .ide-stripe,
body.presentation .ide-status,
body.presentation .ide-project,
body.presentation .ide-resizer,
body.presentation .toast-stack { display: none; }
body.presentation .pres-exit { display: flex; }

@media (max-width: 720px) {
    :root { --project-width: 200px; }
    .tb-search { width: 130px; }
    .tb-project { display: none; }
}

/* ---- narrow screens: Project panel becomes a slide-in drawer ---- */
.drawer-scrim { display: none; }

@media (max-width: 640px) {
    .ide-body { position: relative; }

    .ide-project {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(280px, 82vw);
        z-index: 30;
        border-right: 1px solid var(--ide-border-strong);
        box-shadow: 4px 0 24px rgba(0, 0, 0, .45);
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    /* stay mounted even when the desktop "collapsed" flag is set */
    body.project-collapsed .ide-project { display: flex; }
    body.drawer-open .ide-project { transform: none; }

    .ide-resizer { display: none; }

    .drawer-scrim {
        display: block;
        position: absolute;
        inset: 0 0 0 var(--stripe-w);
        z-index: 25;
        background: rgba(0, 0, 0, .45);
    }
    .drawer-scrim[hidden] { display: none; }

    .tb-search { width: 96px; }
    .doc { padding-left: 14px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .ide-project { transition: none; }
}
