/* ide.css: the parts of the page that look like a JetBrains IDE (IntelliJ IDEA, PyCharm; New UI, the "Dark" theme
   and editor scheme): the code cells (editor, gutter, toolbar, status bar, output) and the tool window at the bottom
   (Run, Debug, Terminal). Colours are the theme's own (its Gray, Blue, Green, Red, Orange ramps and the Dark
   scheme's syntax colours); the icons are drawn for this site (ide.js). The page around stays in the site's style. */
:root {
  --jb-bg: var(--c1E1F22);        /* editor, consoles (Gray1) */
  --jb-panel: var(--c2B2D30);     /* tool windows, status bar (Gray2) */
  --jb-line: var(--c393B40);      /* borders (Gray3) */
  --jb-dark: var(--c1E1F22);      /* splitters between panes */
  --jb-fg: var(--cBCBEC4);        /* editor text */
  --jb-ui: var(--cDFE1E5);        /* interface text (Gray12) */
  --jb-ui2: var(--c9DA0A8);       /* secondary interface text (Gray9) */
  --jb-mute: var(--c6F737A);      /* types, hints (Gray7) */
  --jb-accent: var(--c3574F0);    /* Blue6 */
  --jb-link: var(--c548AF7);      /* Blue8 */
  --jb-sel: var(--c2E436E);       /* selected row (Blue2) */
  --jb-hover: var(--cFFFFFF16);
  --jb-press: var(--cFFFFFF26);
  --jb-green: var(--c5FAD65);
  --jb-red: var(--cDB5C5C);
  --jb-mono: 'JetBrains Mono', ui-monospace, 'DejaVu Sans Mono', monospace;
  --jb-font: system-ui, -apple-system, 'Segoe UI', 'Noto Sans', 'Atkinson Hyperlegible Next', sans-serif;
  --code: 14px;
}

/* ---- icons and toolbar buttons -------------------------------------------------------------------------------------- */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.ico .f { fill: currentColor; stroke: none; }
.ico.green { color: var(--jb-green); }
.ico.red { color: var(--jb-red); }
.ico.blue { color: var(--jb-link); }
.ico.gray { color: var(--cCED0D6); }
.ico.wide { stroke-width: 2; }
.ico.mute path:last-child { stroke: var(--cCED0D6); stroke-width: 1.5; }
.tb { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--cCED0D6); cursor: pointer; transition: background-color 0.12s, box-shadow 0.12s; }
@media (hover: hover) { .tb:hover:not(:disabled) { background: var(--jb-hover); } }   /* a tap leaves no hover behind */
.tb:active:not(:disabled) { background: var(--jb-press); }
.tb:disabled { cursor: default; }
.tb:disabled .ico { color: var(--c5A5D63); }
.tb[aria-pressed="true"] { background: var(--jb-line); }
.tb:focus-visible { outline: 2px solid var(--sodium, var(--cE9D49C)); outline-offset: 2px; border-radius: 6px; }   /* the site's focus ring, as on every other control */
.tb-sep { width: 1px; height: 20px; flex: none; background: var(--c43454A); margin: 0 6px; }
.tb-gap { flex: none; width: 8px; }

/* ---- a code cell: an editor window ---------------------------------------------------------------------------------- */
.cell { margin-block: var(--s4, 16px) 4px; border: 1px solid var(--jb-line); border-radius: 8px; background: var(--jb-bg); overflow: hidden; font-family: var(--jb-font); font-size: 13px; line-height: 1.4; color: var(--jb-ui); font-variant-numeric: normal; }
.cell:focus-within { border-color: var(--c4E5157); }
.cell-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px 0 0; border-block-end: 1px solid var(--jb-line); }
.cell-tab { align-self: stretch; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px 0 14px; position: relative; white-space: nowrap; font-size: 13px; }
.cell-tab::after { content: ''; position: absolute; inset: auto 6px 0 6px; height: 2px; border-radius: 2px 2px 0 0; background: var(--c4E5157); }
.cell:focus-within .cell-tab::after { background: var(--sodium, var(--cE9D49C)); }   /* the editor in use: the site's sodium, not the IDE's blue */
.cell-name { color: var(--jb-ui); min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* the cell's title (edu.js); the tab's tooltip has all of it */
.cell-tab { min-width: 0; }
.cell.edited .cell-name { color: var(--c6B9BFA); }   /* a changed file's tab, as in IntelliJ */
.cell.edited .cell-name::after { content: ' *'; color: var(--c6B9BFA); }
.cell-state { flex: 1 1 6rem; min-width: 0; color: var(--jb-ui2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.cell[data-state="running"] .cell-state, .cell[data-state="waiting"] .cell-state { color: var(--c73BD79); }
.cell[data-state="paused"] .cell-state { color: var(--c6B9BFA); }
.cell[data-state="running"] .cell-state::before, .cell[data-state="waiting"] .cell-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 0.9s ease-in-out infinite; flex: none; }
.cell[data-state="error"] .cell-state { color: var(--cE37774); }
.cell[data-state="running"] { border-color: var(--c436946); }
.cell[data-state="paused"] { border-color: var(--c35538F); }
.cell-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.cell-tools .tb { width: 32px; height: 32px; }
/* The named buttons: a cell's Run, Debug and Maximize, the tool window's Maximize. One shape: 32 px, a ground and a
   1 px edge, the icon then the word (13 px, 500), 6 px apart; 8 px between two of them. The rest are icons. */
.tb:has(.tb-label) { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 10px; background: var(--cFFFFFF0A); box-shadow: inset 0 0 0 1px var(--c4E5157); }
.tb:has(.tb-label) + .tb:has(.tb-label) { margin-inline-start: 6px; }
@media (hover: hover) { .tb:has(.tb-label):hover:not(:disabled) { background: var(--cFFFFFF1A); box-shadow: inset 0 0 0 1px var(--c6F737A); } }
.tb:has(.tb-label):active:not(:disabled) { background: var(--jb-press); }
.tb:has(.tb-label)[aria-pressed="true"] { background: var(--cE9D49C1F); box-shadow: inset 0 0 0 1px var(--cE9D49CA6); }
.tb:has(.tb-label)[aria-pressed="true"] .tb-label, .tb:has(.tb-label)[aria-pressed="true"] .ico { color: var(--sodium, var(--cE9D49C)); }
.tb-label { color: var(--jb-ui); font: 500 13px/1 var(--jb-font); white-space: nowrap; }
.tb:disabled .tb-label { color: var(--c5A5D63); }
.tb:disabled:has(.tb-label) { box-shadow: inset 0 0 0 1px var(--c393B40); background: transparent; }

.cell-banner { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 2px 10px; padding: 9px 12px; background: var(--c25324D); border-block-end: 1px solid var(--c35538F); font-size: 13px; line-height: 1.45; }
.cell-banner[hidden] { display: none; }
.cell-banner .ico { margin-top: 2px; color: var(--c6B9BFA); }
.cell-banner p { margin: 0; max-width: none; }
.cell-banner .acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.cell-orig { grid-column: 1 / -1; margin-top: 6px; border: 1px solid var(--jb-line); border-radius: 6px; overflow: hidden auto; max-height: 22em; scrollbar-width: thin; scrollbar-color: var(--c4E5157) transparent; }
.cell-orig[hidden] { display: none; }
.lnk { padding: 0; border: 0; background: none; color: var(--c6B9BFA); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--c6B9BFA66); text-underline-offset: 2px; }
.lnk:hover { color: var(--c99BBFF); }

.cell-status { display: flex; align-items: center; gap: 14px; min-height: 24px; padding: 0 10px; background: var(--jb-panel); border-block-start: 1px solid var(--jb-line); color: var(--jb-ui2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-sp { flex: 1; }
.sb-mode { font-family: var(--jb-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 0 6px; border-radius: 4px; background: var(--jb-line); color: var(--jb-ui); line-height: 17px; }
.sb-mode[hidden], .sb-mod[hidden] { display: none; }
.sb-mode[data-mode="insert"] { background: var(--c375239); color: var(--cA0DBA5); }
.sb-mode[data-mode="visual"] { background: var(--c35538F); color: var(--cD1E0FF); }
.sb-mode[data-mode="replace"] { background: var(--c5E3838); color: var(--cF2B1AA); }
.sb-mod { color: var(--c6B9BFA); overflow: hidden; text-overflow: ellipsis; }

/* before the editor starts (and without scripts): the plain code */
.ed textarea { display: block; width: 100%; margin: 0; padding: 8px 24px 12px 58px; border: 0; resize: none; overflow: auto hidden; background: var(--jb-bg); color: var(--jb-fg); font: var(--code)/1.5 var(--jb-mono); font-variant-ligatures: none; white-space: pre; tab-size: 4; outline: none; }

/* ---- CodeMirror as a JetBrains editor -------------------------------------------------------------------------------- */
:is(.cell, .tw) .cm-editor { background: var(--jb-bg); color: var(--jb-fg); font-family: var(--jb-mono); font-size: var(--code); font-variant-ligatures: none; }
:is(.cell, .tw) .cm-editor.cm-focused { outline: none; }
:is(.cell, .tw) .cm-editor .cm-scroller { font-family: inherit; line-height: 1.5; scrollbar-width: thin; scrollbar-color: var(--c4E5157) transparent; }
.cell .cm-editor .cm-content { padding: 8px 0 12px; caret-color: var(--cCED0D6); }
.cell .cm-editor .cm-line { padding: 0 24px 0 8px; }
.cell .cm-editor .cm-gutters { background: var(--jb-bg); border: 0; color: var(--c4B5059); padding-inline-start: 6px; }
.cell .cm-editor .cm-gutter .cm-gutterElement { padding: 0; }
.cell .cm-editor .cm-lineNumbers .cm-gutterElement { position: relative; padding: 0 4px 0 10px; min-width: 34px; text-align: right; cursor: pointer; }
.cell .cm-editor .cm-activeLineGutter { background: transparent; }
.cell .cm-editor.cm-focused .cm-activeLineGutter { color: var(--cA1A3AB); }
.cell .cm-editor .cm-activeLine { background: transparent; }
.cell .cm-editor.cm-focused .cm-activeLine { background: var(--c828CD212); }   /* var(--c26282E) over the editor ground, see-through for the selection */
:is(.cell, .tw) .cm-editor .cm-cursor, :is(.cell, .tw) .cm-editor .cm-dropCursor { border-left: 2px solid var(--cCED0D6); }
:is(.cell, .tw) .cm-editor .cm-selectionLayer .cm-selectionBackground,
:is(.cell, .tw) .cm-editor.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground { background: var(--c214283); }
:is(.cell, .tw) .cm-editor .cm-content ::selection { background: transparent; }
.cell .cm-editor .cm-usage { background: var(--c373B39); }   /* the name under the caret, where it occurs */
:is(.cell, .tw) .cm-editor .cm-matchingBracket, :is(.cell, .tw) .cm-editor.cm-focused .cm-matchingBracket { background: var(--c43454A); color: inherit; font-weight: 700; outline: none; }
:is(.cell, .tw) .cm-editor .cm-nonmatchingBracket, :is(.cell, .tw) .cm-editor.cm-focused .cm-nonmatchingBracket { background: transparent; color: var(--cF75464); }
.cell .cm-editor .cm-specialChar { color: var(--cF75464); }

/* indentation guides: one 1 px line at the start of each enclosing block's indent */
.cell .cm-editor .cm-line.cm-ig { position: relative; }
.cell .cm-editor .cm-line.cm-ig::before { content: ''; position: absolute; top: 0; bottom: 0; left: 8px; pointer-events: none; background: repeating-linear-gradient(90deg, var(--c313438) 0 1px, transparent 1px 4ch); }
.cm-ig1::before { width: 4ch; } .cm-ig2::before { width: 8ch; } .cm-ig3::before { width: 12ch; } .cm-ig4::before { width: 16ch; }
.cm-ig5::before { width: 20ch; } .cm-ig6::before { width: 24ch; } .cm-ig7::before { width: 28ch; } .cm-ig8::before { width: 32ch; }
.cm-ig9::before { width: 36ch; } .cm-ig10::before { width: 40ch; } .cm-ig11::before { width: 44ch; } .cm-ig12::before { width: 48ch; }

/* folding: chevrons when the pointer is over the gutter, the folded text as a small "..." box */
.cell .cm-editor .cm-foldGutter .cm-gutterElement { width: 16px; display: grid; place-items: center; cursor: pointer; }
.cm-fold { width: 14px; height: 14px; fill: none; stroke: var(--c868A91); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.cell .cm-editor .cm-gutters:not(:hover) .cm-fold.open { opacity: 0; }
.cell .cm-editor .cm-foldPlaceholder { background: var(--c393B40); color: var(--c868991); border: 0; border-radius: 4px; padding: 0 5px; margin: 0 2px; }

/* breakpoints over the line numbers (a click toggles one; the pointer shows where it would go) */
.cm-bp, .cm-exec-mark { position: absolute; inset: 0; pointer-events: none; }
.cm-bp::before { content: ''; position: absolute; top: 50%; right: 5px; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--jb-red); }
.cell .cm-editor .cm-lineNumbers .cm-gutterElement:hover:not(:has(.cm-bp)) { color: transparent; }
.cell .cm-editor .cm-lineNumbers .cm-gutterElement:hover:not(:has(.cm-bp))::after { content: ''; position: absolute; top: 50%; right: 5px; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--cDB5C5C73); }
.cm-exec-mark { z-index: 1; }
.cm-exec-mark::after { content: ''; position: absolute; top: 50%; right: 3px; width: 15px; height: 11px; margin-top: -5.5px; background: var(--c9DB8F2); clip-path: polygon(0 18%, 58% 18%, 58% 0, 100% 50%, 58% 100%, 58% 82%, 0 82%); }
.cm-exec-mark.cm-exec-caller::after { background: var(--c868A91); }
.cm-exec-mark.cm-exec-exc::after { background: var(--cF75464); }
/* stopped on a breakpoint's line: the arrow goes inside the red dot, in white */
.cell .cm-editor .cm-lineNumbers .cm-gutterElement:has(.cm-bp) .cm-exec-mark::after { right: 7px; width: 8px; height: 8px; margin-top: -4px; background: var(--cFFFFFF); clip-path: polygon(0 22%, 45% 22%, 45% 0, 100% 50%, 45% 100%, 45% 78%, 0 78%); }
.cell .cm-editor .cm-bp-line { background: var(--cFF3C5026); }
.cell .cm-editor .cm-exec-line.cm-exec-top { background: var(--c3C7DFF73); }
.cell .cm-editor .cm-exec-line.cm-exec-caller { background: var(--c5A6EA038); }
.cell .cm-editor .cm-exec-line.cm-exec-exc { background: var(--cF754644D); }
/* Mute breakpoints (Debug tab): the dots turn grey and their lines lose the red, as in IntelliJ */
.bp-muted .cm-bp::before { background: var(--c6F737A); }
.bp-muted .cell .cm-editor .cm-bp-line { background: transparent; }
.bp-muted .cell .cm-editor .cm-lineNumbers .cm-gutterElement:has(.cm-bp) .cm-exec-mark::after { background: var(--c1E1F22); }
.cell .cm-editor .cm-flash { animation: jb-flash 1.6s ease-out; }
@keyframes jb-flash { from { background: var(--c548AF766); } to { background: transparent; } }

/* the debugger's values at the ends of the lines */
.cm-iv { margin-inline-start: 3ch; color: var(--c868A91); font-style: italic; }
.cm-iv > span + span { margin-inline-start: 3ch; }
.cm-iv-mod { color: var(--cB2AE60); }
.cm-exec-line.cm-exec-top .cm-iv { color: var(--cA9BDE0); }
.cm-exec-line.cm-exec-top .cm-iv-mod { color: var(--cD9D27A); }

/* the search bar (Ctrl+F) and Vim's command line */
:is(.cell, .tw) .cm-editor .cm-panels { background: var(--jb-panel); color: var(--jb-ui); font-family: var(--jb-font); }
:is(.cell, .tw) .cm-editor .cm-panels-top { border-bottom: 1px solid var(--jb-line); }
:is(.cell, .tw) .cm-editor .cm-panels-bottom { border-top: 1px solid var(--jb-line); }
.cell .cm-editor .cm-textfield { background: var(--jb-bg); border: 1px solid var(--c4E5157); border-radius: 4px; color: var(--jb-ui); font: 13px var(--jb-mono); }
.cell .cm-editor .cm-textfield:focus { border-color: var(--jb-accent); outline: none; }
.cell .cm-editor .cm-button { background: var(--jb-panel); background-image: none; border: 1px solid var(--c4E5157); border-radius: 4px; color: var(--jb-ui); }
/* the find bar: CodeMirror's search panel as editor.js arranges it (IntelliJ's look; more specific than CodeMirror's own) */
.cell .cm-editor .cm-panels .cm-search { display: grid; gap: 5px; padding: 6px 40px 6px 8px; font-size: 13px; }
.cell .cm-editor .cm-panels .cm-search .jb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; }
.cell .cm-editor .cm-panels .cm-search .jb-field { flex: 0 1 330px; min-width: 150px; height: 28px; display: flex; align-items: center; gap: 2px; padding: 0 3px 0 7px; margin-inline-end: 8px; background: var(--jb-bg); border: 1px solid var(--c4E5157); border-radius: 4px; }
.cell .cm-editor .cm-panels .cm-search .jb-field:focus-within { border-color: var(--jb-accent); }
.cell .cm-editor .cm-panels .cm-search .jb-field.none { border-color: var(--cDB5C5C); background: var(--c3A2323); }
.cell .cm-editor .cm-panels .cm-search .jb-field .cm-textfield { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 4px; border: 0; background: transparent; outline: none; font: 13px var(--jb-mono); color: var(--jb-ui); }
.cell .cm-editor .cm-panels .cm-search .jb-field .cm-textfield::placeholder { color: var(--jb-mute); font-family: var(--jb-font); }
.cell .cm-editor .cm-panels .cm-search .jb-fi { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.cell .cm-editor .cm-panels .cm-search .jb-field > .jb-fi { color: var(--jb-ui2); }
.cell .cm-editor .cm-panels .cm-search .jb-opts { display: flex; gap: 1px; flex: none; }
.cell .cm-editor .cm-panels .cm-search label { position: relative; display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin: 0; padding: 0 3px; border-radius: 4px; font: 600 11.5px/1 var(--jb-mono); color: var(--jb-ui2); white-space: pre; cursor: pointer; }
.cell .cm-editor .cm-panels .cm-search label:hover { background: var(--jb-hover); color: var(--jb-ui); }
.cell .cm-editor .cm-panels .cm-search label:has(input:checked) { background: var(--c3574F040); color: var(--cDFE1E5); box-shadow: inset 0 0 0 1px var(--c3574F0); }
.cell .cm-editor .cm-panels .cm-search label:has(input:focus-visible) { outline: 2px solid var(--jb-accent); }
.cell .cm-editor .cm-panels .cm-search label input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cell .cm-editor .cm-panels .cm-search .jb-count { min-width: 6.5em; margin-inline-end: 4px; color: var(--jb-ui2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell .cm-editor .cm-panels .cm-search .jb-field.none + .jb-count { color: var(--cE37774); }
.cell .cm-editor .cm-panels .cm-search .jb-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--c43454A); }
.cell .cm-editor .cm-panels .cm-search button.jb-ib { width: 26px; height: 26px; display: inline-grid; place-items: center; margin: 0; padding: 0; border: 0; border-radius: 5px; background: transparent; background-image: none; color: var(--cCED0D6); cursor: pointer; }
.cell .cm-editor .cm-panels .cm-search button.jb-ib:hover { background: var(--jb-hover); }
.cell .cm-editor .cm-panels .cm-search button.jb-ib:active { background: var(--jb-press); }
.cell .cm-editor .cm-panels .cm-search button[name=close] { position: absolute; top: 7px; right: 8px; }
.cell .cm-editor .cm-panels .cm-search button.cm-button:not(.jb-ib) { height: 26px; margin: 0 4px 0 0; padding: 0 12px; border: 1px solid var(--c4E5157); border-radius: 4px; background: transparent; background-image: none; color: var(--jb-ui); font: 13px var(--jb-font); cursor: pointer; }
.cell .cm-editor .cm-panels .cm-search button.cm-button:not(.jb-ib):hover { background: var(--jb-hover); }
.cell .cm-editor .cm-panels .cm-search button:focus-visible { outline: 2px solid var(--jb-accent); outline-offset: -1px; }
.cell .cm-editor .cm-searchMatch { background: var(--c114957); outline: 1px solid var(--c165E70); }
.cell .cm-editor .cm-searchMatch-selected { background: var(--c1D6A7D); }
.cell .cm-editor .cm-vim-panel { background: var(--jb-panel); color: var(--jb-ui); font-family: var(--jb-mono); padding: 2px 10px; }
.cell .cm-editor .cm-vim-panel input { color: var(--jb-ui); font: inherit; }
.cell .cm-editor .cm-fat-cursor { background: var(--cCED0D6) !important; color: var(--jb-bg) !important; outline: none !important; }
.cell .cm-editor:not(.cm-focused) .cm-fat-cursor { display: none; }

/* Python, in the Dark scheme's colours (PyCharm) */
.jb-kw { color: var(--cCF8E6D); }
.jb-str { color: var(--c6AAB73); }
.jb-kw .jb-str, .jb-str .jb-kw { color: var(--cCF8E6D); }   /* an f-string's braces */
.jb-esc { color: var(--cCF8E6D); }
.jb-num { color: var(--c2AACB8); }
.jb-cmt { color: var(--c8F949C); }   /* PyCharm has var(--c7A7E85): too faint on var(--c1E1F22) (4.0:1); this is 5.4:1 */
.jb-fn { color: var(--c56A8F5); }
.jb-meta, .jb-meta * { color: var(--cB3AE60); }
.jb-self { color: var(--c94558D); }
.jb-builtin, .jb-builtin .jb-kw { color: var(--c8888C6); }
.jb-kwarg { color: var(--cAA4926); }
.jb-doc, .jb-doc .jb-str { color: var(--c7DA38A); font-style: italic; }   /* PyCharm's var(--c5F826B), lighter, 5.9:1 instead of 3.8:1 */
.jb-dunder, .jb-dunder .jb-fn { color: var(--cB200B2); }

/* ---- a cell's output: a console, then its figures --------------------------------------------------------------------- */
.cell .out { display: grid; gap: 10px; padding: 10px 14px 14px; background: var(--jb-bg); border-block-start: 1px solid var(--jb-line); }
.cell .out[hidden] { display: none; }
.cell .out pre { margin: 0; font: 13px/1.5 var(--jb-mono); font-variant-ligatures: none; color: var(--jb-fg); white-space: pre; max-height: 30em; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--c4E5157) transparent; }
.cell .out pre.err { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--cF75464); }
.cell .out .tb-exc { font-weight: 600; }
.cell .out .tb-mark { color: var(--cE37774); }
.c-in { color: var(--c6AAB73); font-style: italic; }
.tb-link { color: var(--jb-link); text-decoration: underline; text-decoration-color: var(--c548AF799); text-underline-offset: 2px; }
.tb-link:hover { text-decoration-color: currentColor; }
.cell .out .note { margin: 0; font-size: 12.5px; color: var(--jb-ui2); }
.cell .out .out-from { margin: 0; font-size: 12px; color: var(--c868A91); display: flex; align-items: center; gap: 8px; }
.cell .out .out-from::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c868A91); flex: none; }
.cell.saved-out .out .fig img, .cell.saved-out .out pre { opacity: 0.86; }
.cell .out .fig { margin: 0; }
.cell .out .fig img { display: block; width: 100%; height: auto; border-radius: 4px; }
.cell .out .fig.zoomable img { cursor: zoom-in; }
.cell .out .fig.zoom { overflow-x: auto; }
.cell .out .fig.zoom img { max-width: none; cursor: zoom-out; }   /* its width: half its pixels (edu.js) */

/* ---- the tool window ----------------------------------------------------------------------------------------------------- */
.tw { position: fixed; inset: auto 0 0 0; z-index: 40; display: flex; flex-direction: column; background: var(--jb-panel); color: var(--jb-ui); font: 13px/1.4 var(--jb-font); font-variant-numeric: normal; border-block-start: 1px solid var(--c111214); box-shadow: 0 -8px 28px var(--c00000055); }
.tw-grip { position: absolute; inset: -4px 0 auto 0; height: 8px; cursor: ns-resize; z-index: 1; touch-action: none; }
.tw-grip:focus-visible { outline: 2px solid var(--sodium, var(--cE9D49C)); outline-offset: -3px; }
.tw.dragging, .tw.dragging * { user-select: none; }
.tw-head { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px 0 4px; flex: none; }   /* 4 px round a 32 px row: the bar is 40 px */
.tw[data-open="true"] .tw-head { border-block-end: 1px solid var(--jb-dark); }
.tw-tabs { display: flex; gap: 2px; }
.tw-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--jb-ui2); font: 500 13px/1 var(--jb-font); cursor: pointer; white-space: nowrap; transition: background-color 0.12s, color 0.12s; }
@media (hover: hover) { .tw-tab:hover { background: var(--jb-hover); color: var(--jb-ui); } }
.tw-tab[aria-selected="true"] { background: var(--jb-line); color: var(--jb-ui); }
.tw-tab:focus-visible { outline: 2px solid var(--sodium, var(--cE9D49C)); outline-offset: -2px; }
/* the tool window's Maximize: named and framed, right after the tabs (a rule between) */
.tw-head > .tb-max { margin-inline-start: 13px; position: relative; }
.tw-head > .tb-max::before { content: ''; position: absolute; inset-inline-start: -8px; top: 6px; bottom: 6px; width: 1px; background: var(--c43454A); }
.tw-dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--jb-link); }
.tw-dot.on { display: inline-block; }
.tw-title { color: var(--jb-ui2); margin-inline-start: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-sp { flex: 1; }
.tw-body { flex: 1; min-height: 0; display: flex; }
.tw[data-open="false"] .tw-body, .tw[data-open="false"] .tw-head > .tb[data-act="hide"] { display: none; }   /* Maximize stays: it opens the window whole */
.tw-pane { flex: 1; min-width: 0; min-height: 0; display: flex; }
.tw-pane[hidden] { display: none; }
.tw-vbar { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 3px; border-inline-end: 1px solid var(--jb-dark); }
.tw-vbar .tb-sep { width: 18px; height: 1px; margin: 4px 0; }
.tw-hbar { display: flex; align-items: center; gap: 1px; padding: 3px 6px; border-block-end: 1px solid var(--jb-dark); overflow-x: auto; scrollbar-width: none; flex: none; }
.tw-state { flex: 1 1 auto; min-width: 8em; margin-inline-start: 10px; color: var(--jb-ui2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-console { flex: 1; min-width: 0; margin: 0; padding: 6px 12px; overflow: auto; background: var(--jb-bg); color: var(--jb-fg); font: 13px/1.5 var(--jb-mono); font-variant-ligatures: none; white-space: pre; scrollbar-width: thin; scrollbar-color: var(--c4E5157) transparent; }
.tw-console.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.tw-console:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--sodium, var(--cE9D49C)); }
/* nothing run yet: one quiet line in the middle of the pane, not an empty grey area */
.tw-run .tw-console:empty { display: grid; place-items: center; }
.tw-run .tw-console:empty::before { content: 'Run a cell to see its output here'; font: 13px/1.4 var(--jb-font); color: var(--jb-mute); white-space: normal; text-align: center; }
.c-err { color: var(--cF75464); }
.c-sys { color: var(--c868A91); }
.c-echo { color: var(--jb-fg); }
.tw-console .fig { margin: 6px 0; }
.tw-console .fig img { display: block; max-width: min(100%, 720px); height: auto; border-radius: 4px; }

.tw-debug { flex-direction: column; }
.dbg-sub { display: none; }
.dbg-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(170px, 24%) minmax(0, 1fr) minmax(190px, 30%); }
.dbg-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-inline-end: 1px solid var(--jb-dark); }
.dbg-pane:last-child { border: 0; }
.pane-h { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 6px 0 10px; color: var(--jb-ui2); font-size: 12px; border-block-end: 1px solid var(--jb-dark); flex: none; }
.pane-h .ico { color: var(--jb-ui2); }
.frames { list-style: none; margin: 0; padding: 3px 0; overflow: auto; flex: 1; }
.frames .frame { display: flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.frames .frame .ico { color: var(--jb-ui2); }
.frames .frame:hover { background: var(--cFFFFFF0B); }
.frames .frame[aria-selected="true"] { background: var(--jb-sel); }
.frames .frame:focus-visible { outline: 1px solid var(--jb-accent); outline-offset: -1px; }
.fr-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fr-at { color: var(--jb-ui2); }
.dbg-evalrow { gap: 8px; padding: 3px 6px 3px 10px; }
.dbg-eval { flex: 1; min-width: 0; height: 24px; padding: 0 8px; background: var(--jb-bg); border: 1px solid var(--c4E5157); border-radius: 4px; color: var(--jb-ui); font: 12.5px var(--jb-mono); }
.dbg-eval::placeholder { color: var(--jb-mute); font-family: var(--jb-font); }
.dbg-eval:focus { border-color: var(--jb-accent); outline: none; }
.dbg-watch-in { flex: none; margin: 4px 8px; }
.dbg-watch-in[hidden] { display: none; }
.vt-host { flex: 1; min-height: 0; overflow: auto; padding: 2px 0 6px; scrollbar-width: thin; scrollbar-color: var(--c4E5157) transparent; }
.vt, .vt ul { list-style: none; margin: 0; padding: 0; }
.vt-row { display: flex; align-items: center; min-height: 24px; padding-inline-end: 8px; white-space: nowrap; cursor: default; }
.vt-row:hover { background: var(--cFFFFFF0B); }
.vt-row.sel { background: var(--jb-sel); }
.vt-row:focus-visible { outline: 1px solid var(--jb-accent); outline-offset: -1px; }
.vt-tw { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
li[aria-expanded] > .vt-row { cursor: pointer; }
li[aria-expanded] > .vt-row .vt-tw::before { content: ''; width: 5px; height: 5px; border-right: 1.5px solid var(--jb-ui2); border-bottom: 1.5px solid var(--jb-ui2); transform: translateX(-1px) rotate(-45deg); }
li[aria-expanded="true"] > .vt-row .vt-tw::before { transform: translateY(-1px) rotate(45deg); }
.vt-ico { width: 12px; height: 12px; flex: none; margin: 0 7px 0 3px; border-radius: 3px; background: var(--c6F737A); }
.vt-ico.k-num, .vt-ico.k-bool, .vt-ico.k-none { background: var(--c2AACB8); border-radius: 50%; }
.vt-ico.k-str { background: var(--c6AAB73); border-radius: 50%; }
.vt-ico.k-seq, .vt-ico.k-map { background: var(--cC77DBB); }
.vt-ico.k-arr { background: var(--cE08855); }
.vt-ico.k-obj, .vt-ico.k-cls { background: var(--c548AF7); }
.vt-ico.k-fn { background: var(--cB3AE60); border-radius: 50%; }
.vt-ico.k-mod, .vt-ico.k-group { background: transparent; border: 1.5px solid var(--c868A91); border-radius: 2px; }
.vt-ico.k-exc { background: var(--jb-red); }
.vt-ico.k-ret { background: var(--jb-green); }
.vt-ico.k-watch { background: transparent; border: 1.5px solid var(--cCED0D6); border-radius: 50%; }
.vt-ico.k-result { background: transparent; border: 1.5px solid var(--cCF8E6D); }
.vt-ico.k-more { background: transparent; }
.vt-n { color: var(--cC77DBB); }
.vt-row .vt-n { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.vt-eq { color: var(--jb-ui2); white-space: pre; }
.vt-t { color: var(--jb-mute); white-space: pre; flex: none; }
.vt-v { color: var(--cF0AC81); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vt-v.k-group, .vt-v.k-more { color: var(--jb-mute); }
.vt-v.changed { color: var(--jb-link); }
.vt-err { color: var(--cE37774); overflow: hidden; text-overflow: ellipsis; }
.vt-msg, .vt-wait { color: var(--jb-mute); padding: 8px 12px; white-space: normal; }
.vt-wait { padding: 3px 0 3px 46px; }
.vt-result > .vt-row { background: var(--cFFFFFF08); }
.vt-x { margin-inline-start: auto; width: 22px; height: 22px; opacity: 0; }
.vt-row:hover .vt-x, .vt-row:focus-within .vt-x, .vt-row.sel .vt-x { opacity: 1; }

.term-wrap { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--jb-bg); cursor: text; }
.term-out { flex: 0 1 auto; padding-block-end: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-in { display: flex; align-items: flex-start; gap: 8px; padding: 0 12px 10px; font: 13px/1.5 var(--jb-mono); flex: 1 0 auto; }
.term-ps { color: var(--c868A91); white-space: pre; flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.term-in.asking .term-ps { color: var(--c6AAB73); }
.term-ed { flex: 1; min-width: 0; }
.tw .cm-editor { background: transparent; font-size: 13px; }
.tw .cm-editor .cm-content { padding: 0; caret-color: var(--cCED0D6); }
.tw .cm-editor .cm-line { padding: 0; }

/* ---- on a phone: the tool window is a bottom sheet; the debugger shows one pane at a time --------------------------------- */
@media (max-width: 720px) {
  /* the title and its state on the first row, the toolbar on the second: Run on the title's edge (the page's text edge,
     the cell reaching 8 px further out), the icons on the far end */
  .cell-head { flex-wrap: wrap; min-height: 0; padding: 0; gap: 0; }
  .cell-tab { padding: 10px 12px 10px 8px; }
  .cell-tab::after { inset-inline: 4px; }
  .cell-state { order: 2; flex: 1 1 0; justify-content: flex-end; padding-inline-end: 12px; }
  .cell-tools { order: 3; flex: 1 0 100%; padding: 8px 8px 8px; border-block-start: 1px solid var(--jb-line); }
  .cell-tools .tb-gap { flex: 1 1 auto; }
  .cell-tools .tb-max .tb-label { display: none; }   /* Maximize keeps its frame, not its word */
  .cell-tools .tb.tb-max { padding: 0; width: 32px; justify-content: center; }
  .cell .cm-editor .cm-line { padding-inline-end: 14px; }
  .cell .cm-editor .cm-lineNumbers .cm-gutterElement { min-width: 26px; padding-inline-start: 4px; }
  .cell .out { padding-inline: 10px; }
  .tw { border-radius: 12px 12px 0 0; }
  .tw-grip { inset: 0 0 auto 0; height: 14px; }
  .tw-grip::before { content: ''; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--c5A5D63); }
  .tw-head { padding-top: 10px; min-height: 44px; touch-action: none; }   /* the header drags the sheet too (ide.js) */
  .tw-title { display: none; }
  .tw-tab { height: 32px; }
  .dbg-sub { display: flex; gap: 2px; padding: 4px 6px; border-block-end: 1px solid var(--jb-dark); }
  .dbg-subtab { flex: 1; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--jb-ui2); font: inherit; }
  .dbg-subtab[aria-selected="true"] { background: var(--jb-line); color: var(--jb-ui); }
  .dbg-main { grid-template-columns: minmax(0, 1fr); }
  .dbg-pane { display: none; border: 0; }
  .dbg-pane.on { display: flex; }
  .tw-hbar { flex-wrap: wrap; row-gap: 0; }
  .tw-state { order: 2; flex: 1 0 100%; margin: 0 4px 3px; font-size: 12px; white-space: normal; line-height: 1.35; }
  .tw-vbar { padding-inline: 2px; }
}
@media (max-width: 720px) { .tw-head > .tb-max .tb-label { display: none; } .tw-head > .tb.tb-max { padding: 0; width: 32px; justify-content: center; } }
@media (max-width: 720px) and (pointer: coarse) { .cell-tools .tb.tb-max, .tw-head > .tb.tb-max { width: 38px; } }
@media (pointer: coarse) {
  .tb, .cell-tools .tb { width: 38px; height: 38px; }
  .tb:has(.tb-label) { width: auto; height: 38px; }
  .tw-hbar .tb { width: 38px; height: 38px; }
  .vt-row, .frames .frame { min-height: 32px; }
}
/* iOS zooms into any text field set smaller than 16 px */
@supports (-webkit-touch-callout: none) { :is(.cell, .tw) .cm-editor, .dbg-eval { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .cell .cm-editor .cm-flash { animation: none; background: var(--c548AF733); } .tb, .tw-tab { transition: none; } }
@media print { .tw, .cell-tools, .cell-status { display: none !important; } }

/* A maximized cell (edu.js, Cell.maximize): the whole window above the tool window, like the IDE's maximized editor,
   all of it for the code; its output goes to the tool window's Run tab below (Arash, 2026-11-05: the output beside the
   code "beats the purpose of maximizing it, put in the bottom tabs"). Its head (the tab, the toolbar) never shrinks */
.cell.max { position: fixed; inset: 0 0 var(--tw-h, 0px) 0; z-index: 39; margin: 0; border-radius: 0; border-width: 0 0 1px;
  display: flex; flex-direction: column; box-shadow: 0 -2px 0 var(--jb-bg); }   /* the shadow: no hairline of the page above it at a scroll between two pixels */
.cell.max > .cell-head, .cell.max > .cell-banner { flex: none; }
.cell.max > .ed { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cell.max .ed-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cell.max .cm-editor { flex: 1 1 auto; min-height: 0; }
.cell.max .cm-scroller { overflow: auto; }
.cell.max > .out { display: none; }
.cell-head .tb:not(:has(.tb-label))[aria-pressed="true"] { background: var(--jb-line); }
html.cell-max, html.cell-max body { overflow: hidden; }
html.cell-max, html.tw-max { scrollbar-gutter: auto; }   /* the page behind is still: no empty scrollbar's room beside the whole window */

/* A maximized tool window (ide.js, maximize): the whole window, the page behind it still; the same button, Ctrl+Shift+F12
   (focus in it) or Esc outside an editor brings it back to its height. --tw-h keeps the height it comes back to. */
.tw.max { inset: 0 !important; height: auto !important; z-index: 45; border-radius: 0; border-block-start: 0; box-shadow: 0 -2px 0 var(--jb-panel); }
.tw.max .tw-grip { display: none; }
html.tw-max, html.tw-max body { overflow: hidden; }
