/* AI Engineer Path. Two themes (Mono Dark, Mono Light), switched by <html data-theme="dark|light">.
   Typeface: JetBrains Mono (SIL Open Font License), bundled in vendor/fonts by scripts/vendor.js. */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-21BB, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-21BB, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-21BB, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-21BB, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-latin-ext-800-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 800; font-display: swap; src: url("../vendor/fonts/jetbrains-mono-cyrillic-800-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
/* Paper theme (light, default) and its warm dark twin. Cream sheets, ink outlines, hard "pop" shadows, pastel tiles. */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --app-bg: #f4ebe0; --island-bg: #f9f2e8; --raised-bg: #f3eadd; --hover-bg: #ece2d3; --card: #faf3e9;
  --border: #ddd3c5; --border-strong: #c6bbac; --ink: #1d1b18; --ink-2: #34302b; --drop: #1d1b18;
  --text: #34302b; --text-strong: #1d1b18; --text-ui: #34302b; --muted: #6f6961;
  --line-no: #b0a698; --caret-row: #f3eadd; --selection: #dccdf0;
  --accent: #5a43a6; --accent-soft: #e7ddf5; --accent-text: #ffffff; --link: #5a43a6;
  --green: #2f8a43; --red: #c0392b; --yellow: #a5650c; --amber: #e8a33a;
  --ok-bg: #e8efd9; --ok-border: #c9d6b3; --ok-text: #24521c;
  --bad-bg: #fbebe7; --bad-border: #ebbcb3; --bad-text: #8f2a22;
  --info-bg: #ebe3f1; --info-border: #d5c8e2; --info-text: #4b3a7a;
  --warn-bg: #fbe5bd; --warn-text: #6d4a0c;
  --code-bg: #efe5d6; --code-text: #1d1b18;
  --kw: #5a43a6; --str: #2a7a3d; --num: #1f63a0; --com: #8f877c; --def: #b8602f;
  --deco: #a5650c; --builtin: #a83a58; --self: #7c63d0;
  --btn-bg: #fbf7f1; --btn-border: #1d1b18; --btn-hover: #f6e6c9;
  --primary-bg: #cfe3b2; --primary-border: #1d1b18; --primary-hover: #b2d491; --primary-text: #1d1b18;
  --danger-bg: #f6cfc7; --danger-hover: #ebbcb3; --danger-text: #7d241d;
  --tile-green: #cfe3b2; --tile-violet: #e7ddf5; --tile-orange: #fcdcbd; --tile-mint: #dff0de; --tile-sand: #f6e6c9; --tile-blue: #d6e5f6; --tile-rose: #f6cfc7; --tile-paper: #fbf7f1;
  --pkt-req: #e8834d; --pkt-res: #7fc278; --grid: #e6ddd0;
  --shadow: 0 18px 40px -22px rgba(80, 60, 35, .55);
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 1px 0 rgba(80, 60, 35, .06), 0 10px 22px -16px rgba(80, 60, 35, .35);
  --pop: 1.5px 2.5px 0 var(--drop);
  --scroll: #c6bbac;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, "DejaVu Sans Mono", Menlo, monospace;
  --sans: var(--mono);
  --radius: 14px;
  --gap: 10px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #211e1a; --island-bg: #28241f; --raised-bg: #2e2923; --hover-bg: #38322a; --card: #292520;
  --border: #3a342c; --border-strong: #4f473d; --ink: #efe6d6; --ink-2: #ddd3c2; --drop: #050403;
  --text: #ddd3c2; --text-strong: #efe6d6; --text-ui: #ddd3c2; --muted: #a3998b;
  --line-no: #675d4f; --caret-row: #2e2923; --selection: #493563;
  --accent: #b9a2ea; --accent-soft: #493563; --accent-text: #1d1b18; --link: #c3b0f0;
  --green: #7fc278; --red: #e5534b; --yellow: #e3ae3c; --amber: #e8a33a;
  --ok-bg: #3f4c2b; --ok-border: #505c38; --ok-text: #bae5b3;
  --bad-bg: #51312b; --bad-border: #694239; --bad-text: #ebb2ad;
  --info-bg: #4f3e5c; --info-border: #5d4a70; --info-text: #dccdf5;
  --warn-bg: #5a4b30; --warn-text: #ebd5ad;
  --code-bg: #37312a; --code-text: #efe6d6;
  --kw: #b9a2ea; --str: #9fd08f; --num: #8fc0ea; --com: #8d7f6c; --def: #e8a07a;
  --deco: #e3ae3c; --builtin: #e58fa8; --self: #a892e0;
  --btn-bg: #2e2923; --btn-border: #c6bfb7; --btn-hover: #38322a;
  --primary-bg: #3f4c2b; --primary-border: #c6bfb7; --primary-hover: #505c38; --primary-text: #efe6d6;
  --danger-bg: #5c3931; --danger-hover: #694239; --danger-text: #ebb2ad;
  --tile-green: #3f4c2b; --tile-violet: #493563; --tile-orange: #5a4531; --tile-mint: #3c5c3a; --tile-sand: #5d4d32; --tile-blue: #344961; --tile-rose: #5c3931; --tile-paper: #37312a;
  --pkt-req: #e8834d; --pkt-res: #7fc278; --grid: #2f2a24;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .9);
  --card-shadow: inset 0 1px 0 rgba(255, 240, 220, .04), 0 1px 0 rgba(0, 0, 0, .11), 0 10px 22px -16px rgba(0, 0, 0, .63);
  --scroll: #4f473d;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--app-bg); color: var(--text-ui); font: 12.5px/1.5 var(--sans); overflow: hidden; font-feature-settings: "zero" 0; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--selection); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; }
::-webkit-scrollbar-corner, ::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-color: var(--scroll) transparent; scrollbar-width: thin; }

.app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr) 26px; height: 100vh; height: 100dvh; }

/* ── toolbar (flat on the window background, as in Islands) ─────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-width: 0; }
.brand { font-weight: 800; font-size: 15px; color: var(--text-strong); letter-spacing: -.2px; white-space: nowrap; }
.brand-py { background: var(--ink); color: var(--app-bg); padding: 1px 6px; border-radius: 5px; margin-right: 2px; }
.brand-rest { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--pkt-res); }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { flex: none; }
.crumbs .last { color: var(--text-strong); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.icon-btn { background: color-mix(in srgb, var(--tile-paper) 70%, transparent); border: 1.3px solid var(--border-strong); padding: 6px; border-radius: 9px; color: var(--text-ui); display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; }
.icon-btn:hover { background: var(--hover-bg); }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 8px; border: 1.5px solid var(--btn-border); background: var(--btn-bg); color: var(--text-strong); white-space: nowrap; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), var(--pop); transition: transform .06s, box-shadow .06s; }
.tool-btn:not(:disabled):active { transform: translate(1px, 1.5px); box-shadow: none; }
.tool-btn:hover { background: var(--btn-hover); }
.tool-btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.tool-btn.run svg { color: var(--green); }
.tool-btn.check { background: var(--primary-bg); border-color: var(--primary-border); color: var(--primary-text); padding-left: 14px; padding-right: 14px; }
.tool-btn.check:hover { background: var(--primary-hover); }
.tool-btn.danger { background: var(--danger-bg); color: var(--danger-text); }
.tool-btn.danger:hover { background: var(--danger-hover); }
.link-btn { background: none; border: 0; padding: 0 2px; color: var(--link); }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.progress-pill { font-size: 11.5px; font-weight: 600; color: var(--text-strong); padding: 3px 11px; border: 1.3px solid var(--ink-2); border-radius: 13px; white-space: nowrap; background: var(--tile-sand); box-shadow: 0 1.5px 0 var(--drop); }
.runtime { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.runtime .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.runtime.ready .dot { background: var(--green); }
.runtime.busy .dot { background: var(--yellow); animation: pulse 1s infinite; }
.runtime.error .dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

/* ── layout: three islands ─────────────── */
.body { display: grid; grid-template-columns: var(--w-tree, 300px) minmax(0, var(--f-lesson, 1fr)) minmax(0, var(--f-work, 1fr)); gap: var(--gap); padding: 2px 12px 4px; min-height: 0; }
.app.tree-hidden .body { grid-template-columns: minmax(0, var(--f-lesson, 1fr)) minmax(0, var(--f-work, 1fr)); }
.app.tree-hidden .project { display: none; }
.project, .lesson, .work { background: var(--island-bg); border: 1.3px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: hidden; min-height: 0; min-width: 0; }
.project { background: transparent; border-color: transparent; box-shadow: none; }
.toolwin { min-height: 0; display: flex; flex-direction: column; }
.toolwin-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); flex: none; }
.toolwin-title .muted, .toolwin-title .subtab, .toolwin-title .link-btn { text-transform: none; letter-spacing: 0; }
.muted { color: var(--muted); font-weight: 400; }

/* ── project tree ─────────────── */
.tree { overflow: auto; padding: 2px 6px 20px; flex: 1; font-size: 13px; }
.node { display: flex; align-items: center; gap: 6px; height: 27px; padding: 0 8px 0 4px; margin: 1px 2px 1px 0; white-space: nowrap; cursor: pointer; color: var(--text-ui); user-select: none; border-radius: 7px; border: 1.3px solid transparent; }
.node:hover { background: var(--hover-bg); }
.node.active { background: var(--primary-bg); color: var(--text-strong); border-color: var(--ink); box-shadow: var(--pop); font-weight: 600; }
.node.locked { color: var(--muted); }
.node.locked.leaf { cursor: not-allowed; }
.node .twist { width: 12px; flex: none; color: var(--muted); font-size: 9px; text-align: center; }
.node .ic { width: 16px; flex: none; text-align: center; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.node .ic svg { width: 14px; height: 14px; }
.node .label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.node .count { font-size: 11px; color: var(--muted); flex: none; }
.node .ok { color: var(--green); }
.node .cur { color: var(--yellow); }
.node .lock { opacity: .75; font-size: 11px; }
.node.lv1 { padding-left: 16px; }
.node.lv2 { padding-left: 32px; }
.node.lv3 { padding-left: 48px; }
.node.path .label { font-weight: 600; color: var(--text-strong); }
.node .num { color: var(--muted); }
.node .tag { font-size: 10px; padding: 0 5px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--muted); flex: none; line-height: 14px; }
.node.file .label { color: var(--text); }
.node.file.active .label { color: var(--text-strong); }
.folder-ic { color: #d5b07a; stroke: var(--ink-2); stroke-width: .7; }
.tree > .node.path:nth-of-type(2n) .folder-ic { color: #7fc278; }
.node.lv1:nth-of-type(5n+1) .folder-ic { color: #7fc278; } .node.lv1:nth-of-type(5n+2) .folder-ic { color: #7c63d0; } .node.lv1:nth-of-type(5n+3) .folder-ic { color: #e8834d; } .node.lv1:nth-of-type(5n+4) .folder-ic { color: #2f86ce; } .node.lv1:nth-of-type(5n) .folder-ic { color: #2a9d8f; }
.file-md { color: var(--def); font: 700 9px var(--mono); }
.file-py { color: var(--num); font: 700 9px var(--mono); }

/* ── tabs ─────────────── */
.tabs { display: flex; align-items: stretch; height: 34px; border-bottom: 1px solid var(--border); overflow-x: auto; flex: none; scrollbar-width: none; padding: 0 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; font-size: 12.5px; }
.tab:hover { color: var(--text-strong); }
.tab.active { border-bottom-color: var(--ink); color: var(--text-strong); font-weight: 700; }
.tab .ok { color: var(--green); }
.tab .py { color: var(--num); font: 700 9px var(--mono); }

/* ── lesson pane ─────────────── */
.lesson { display: flex; flex-direction: column; }
.lesson-scroll { overflow: auto; flex: 1; }
.doc { max-width: 900px; padding: 18px 26px 60px; color: var(--text); font-size: 13px; line-height: 1.7; }
.doc h1 { font-size: 30px; line-height: 1.2; font-weight: 800; letter-spacing: -.5px; color: var(--text-strong); margin: 6px 0 10px; }
.doc h2 { font-size: 17px; font-weight: 800; letter-spacing: -.2px; color: var(--text-strong); margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.doc h3 { font-size: 12.5px; font-weight: 700; color: var(--def); margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin: 3px 0; }
.doc b, .doc strong { color: var(--text-strong); font-weight: 600; }
.doc a { color: var(--link); }
.doc code, .task code { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); color: var(--code-text); padding: 1px 5px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.doc .meta { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.doc .intro { color: var(--text-ui); }
.badge-opt { display: inline-block; font-size: 11px; padding: 2px 9px; margin-left: 8px; border: 1.3px solid var(--ink-2); border-radius: 12px; color: var(--text-strong); background: var(--tile-violet); box-shadow: 0 1.5px 0 var(--drop); vertical-align: middle; font-weight: 600; letter-spacing: 0; }
.codeblock { position: relative; margin: 0 0 12px; background: var(--raised-bg); border: 1px solid var(--border); border-radius: 8px; }
.codeblock pre { margin: 0; padding: 10px 14px; overflow: auto; font: 13px/1.55 var(--mono); color: var(--text); tab-size: 4; }
.codeblock.diagram pre { font-size: 12px; line-height: 1.3; color: var(--text-strong); }
.codeblock .bar { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px 3px 14px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted); border-radius: 8px 8px 0 0; }
.codeblock .bar button { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; color: var(--green); padding: 2px 6px; border-radius: 4px; }
.codeblock .bar button:hover { background: var(--hover-bg); }
.example-out { margin: -6px 0 12px; }
.console { font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text-ui); background: var(--raised-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; max-height: 320px; overflow: auto; }
.console .err { color: var(--red); }
.console .dim { color: var(--muted); }
.pitfalls { list-style: none; padding: 0; margin: 0 0 12px; }
.pitfalls li { position: relative; padding: 6px 10px 6px 30px; margin: 0 0 6px; background: var(--warn-bg); border-left: 3px solid var(--yellow); border-radius: 0 6px 6px 0; color: var(--warn-text); }
.pitfalls li::before { content: "!"; position: absolute; left: 10px; top: 6px; width: 14px; height: 14px; line-height: 14px; text-align: center; font-weight: 700; font-size: 11px; color: var(--island-bg); background: var(--yellow); border-radius: 50%; margin-top: 3px; }
.doc table { border-collapse: collapse; margin: 0 0 12px; font-size: 13px; }
.doc th, .doc td { border: 1px solid var(--border-strong); padding: 4px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--raised-bg); color: var(--text-strong); font-weight: 600; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cheat { background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 14px; box-shadow: 0 1px 0 rgba(80, 60, 35, .08); }
.cheat h3 { margin-top: 0; }
.cheat ul { margin: 0; padding-left: 18px; }
.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border); }
.topic-overview .pat-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.qa { border: 1px solid var(--border-strong); border-radius: 10px; margin: 0 0 8px; background: var(--card); box-shadow: 0 1px 0 rgba(80, 60, 35, .08); }
.qa summary { cursor: pointer; padding: 9px 14px; color: var(--text-strong); font-weight: 600; list-style-position: outside; }
.qa summary:hover { background: var(--hover-bg); border-radius: 8px; }
.qa .answer { padding: 2px 14px 4px; border-top: 1px solid var(--border); }
.qa .answer > :first-child { margin-top: 10px; }
.qa-tools { display: flex; gap: 14px; margin: 0 0 12px; }
.empty-note { color: var(--muted); padding: 30px 0; }

/* ── work pane ─────────────── */
.work { display: grid; grid-template-rows: 34px auto minmax(70px, 1fr) minmax(70px, var(--h-run, 34%)); }
.task { padding: 10px 16px; background: var(--raised-bg); border-bottom: 1px solid var(--border); color: var(--text); font-size: 13.5px; line-height: 1.6; max-height: 34vh; overflow: auto; }
.work.task-sized .task, .work.task-sized .task.tall { height: var(--h-task); max-height: none; }
.task .task-head { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--def); margin-bottom: 4px; font-weight: 700; }
.task .task-head .state { text-transform: none; letter-spacing: 0; color: var(--green); }
.task.tall { max-height: 68vh; }
.task .task-toggle { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: 11px; padding: 1px 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.task .task-toggle:hover { color: var(--text-strong); background: var(--hover-bg); }
.task h2 { font-size: 15px; margin: 2px 0 8px; }
.task h3 { font-size: 13.5px; margin: 10px 0 4px; }
.task table { font-size: 12.5px; margin: 6px 0 10px; }
.task .codeblock { margin: 6px 0 10px; }
.task p { margin: 0 0 6px; }
.task .hint { margin-top: 6px; padding: 8px 12px; background: var(--ok-bg); border: 1px solid var(--ok-border); border-radius: 10px; color: var(--ok-text); }
.editor-host { min-height: 0; position: relative; overflow: hidden; }
.run:not(.tool-btn) { border-top: 1px solid var(--border); min-height: 0; }
.run .toolwin-title { border-bottom: 1px solid var(--border); font-weight: 400; }
.subtabs { display: flex; gap: 2px; height: 100%; }
.subtab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 10px; color: var(--muted); font-size: 12px; }
.subtab.active { border-bottom-color: var(--ink); color: var(--text-strong); font-weight: 700; }
.run-actions { display: flex; gap: 14px; font-size: 12px; }
.run-body { flex: 1; min-height: 0; overflow: auto; }
.pane { display: none; padding: 8px 12px 14px; }
.pane.active { display: block; }
.tests { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tests li { display: flex; gap: 8px; padding: 3px 0; align-items: flex-start; }
.tests .k { width: 16px; flex: none; text-align: center; font-weight: 700; }
.tests .ok .k { color: var(--green); }
.tests .bad .k { color: var(--red); }
.tests .pending .k { color: var(--muted); }
.tests .bad .t { color: var(--text-strong); }
.tests .m { font: 12px/1.45 var(--mono); color: var(--bad-text); white-space: pre-wrap; word-break: break-word; margin-top: 1px; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; border: 1px solid; }
.banner.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.banner.fail { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.banner.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.banner .grow { flex: 1; }
#pane-output .console { border: 0; background: none; padding: 0; max-height: none; }

/* ── status bar ─────────────── */
.statusbar { display: flex; align-items: center; gap: 10px; padding: 0 14px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.sb-sep { width: 1px; height: 12px; background: var(--border-strong); }
.sb-right { margin-left: auto; display: flex; gap: 14px; align-items: center; }

/* ── overlays ─────────────── */
.overlay { position: fixed; inset: 0; background: rgba(40, 30, 18, .5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; }
.dialog { width: min(380px, 92vw); background: var(--island-bg); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.dialog h2 { margin: 0 0 6px; font-size: 17px; color: var(--text-strong); font-weight: 600; }
.dialog p { margin: 0 0 12px; }
.dialog label { display: block; font-size: 12px; margin: 10px 0 0; color: var(--text-ui); }
.dialog input { display: block; width: 100%; margin-top: 4px; height: 32px; padding: 0 8px; background: var(--raised-bg); color: var(--text-strong); border: 1px solid var(--border-strong); border-radius: 6px; font: 13px var(--sans); outline: none; }
.dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }
.boot { position: fixed; inset: 0; background: var(--app-bg); display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; z-index: 200; color: var(--text-ui); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CodeMirror ─────────────── */
.CodeMirror { height: 100%; font: 13.5px/1.55 var(--mono); background: var(--island-bg); color: var(--text); }
.editor-host .CodeMirror { position: absolute; inset: 0; }
.CodeMirror-gutters { background: var(--island-bg); border-right: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--line-no); padding: 0 8px 0 10px; min-width: 28px; }
.CodeMirror-cursor { border-left: 1.5px solid var(--text-strong); }
.CodeMirror-activeline-background { background: var(--caret-row); }
.CodeMirror-activeline .CodeMirror-linenumber { color: var(--text-ui); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--selection) !important; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: var(--selection); }
div.CodeMirror span.CodeMirror-matchingbracket { color: inherit; background: var(--accent-soft); font-weight: bold; }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: var(--red); background: var(--bad-bg); }
.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { padding: 0 8px; }
.cm-s-islands span.cm-keyword, .hl .cm-keyword { color: var(--kw); }
.cm-s-islands span.cm-string, .hl .cm-string { color: var(--str); }
.cm-s-islands span.cm-number, .hl .cm-number { color: var(--num); }
.cm-s-islands span.cm-comment, .hl .cm-comment { color: var(--com); font-style: italic; }
.cm-s-islands span.cm-def, .hl .cm-def { color: var(--def); }
.cm-s-islands span.cm-builtin, .hl .cm-builtin { color: var(--builtin); }
.cm-s-islands span.cm-meta, .hl .cm-meta { color: var(--deco); }
.cm-s-islands span.cm-operator, .hl .cm-operator, .cm-s-islands span.cm-variable, .hl .cm-variable, .cm-s-islands span.cm-property, .hl .cm-property { color: var(--text); }
.cm-s-islands span.cm-variable-2, .hl .cm-variable-2 { color: var(--self); }
.cm-s-islands span.cm-atom, .hl .cm-atom { color: var(--kw); }
.cm-s-islands span.cm-error, .hl .cm-error { color: var(--red); }

/* ── responsive ─────────────── */
@media (max-width: 1180px) {
  .body { grid-template-columns: var(--w-tree, 260px) minmax(0, 1fr); grid-template-rows: minmax(0, var(--f-lesson-row, 1fr)) minmax(0, var(--f-work-row, 1.25fr)); }
  .split.s-main { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 7px; cursor: row-resize; }
  .split.s-main::after { left: 50%; top: 2px; width: 44px; height: 3px; margin: 0 0 0 -22px; }
  .project { grid-row: 1 / span 2; }
  .app.tree-hidden .body { grid-template-columns: minmax(0, 1fr); }
  .crumbs { display: none; }
}
@media (max-width: 760px) {
  body { overflow-y: auto; overflow-x: hidden; }
  .lesson, .work { max-width: 100vw; margin-bottom: var(--gap); }
  .statusbar { position: static; height: 24px; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto 24px; }
  .toolbar { position: sticky; top: 0; z-index: 20; height: 44px; background: var(--app-bg); }
  .body { display: block; }
  .project { position: fixed; top: 44px; bottom: 6px; left: 6px; width: min(320px, 88vw); z-index: 30; box-shadow: var(--shadow); display: flex; }
  .lesson-scroll { overflow: visible; }
  .doc { padding: 14px 14px 30px; }
  .work { display: block; }
  .split { display: none; }
  .editor-host { height: 320px; }
  .run:not(.tool-btn) { min-height: 180px; }
  .task { max-height: none; }
  .runtime span, .progress-pill, .brand-rest { display: none; }
  .toolbar .tool-btn span { display: none; }
  .toolbar .tool-btn { padding: 0 9px; }
  .sb-right > span { display: none; }
}

/* ── copy buttons, docs links ───────────────────────────────────────────── */
.codeblock .cb-copy { position: absolute; top: 5px; right: 6px; background: var(--island-bg); border: 1px solid var(--border); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 5px; opacity: 0; transition: opacity .12s; }
.codeblock:hover .cb-copy, .codeblock .cb-copy:focus { opacity: 1; }
.codeblock .cb-copy:hover { color: var(--text-strong); border-color: var(--border-strong); }
.codeblock .bar .cb-copy { position: static; opacity: 1; background: none; border: 0; color: var(--muted); font-size: 11.5px; }
.codeblock .bar .bar-btns { display: inline-flex; gap: 2px; }
.codeblock .bar button.viz-btn { color: var(--accent); }
.doc-links { margin: 14px 0 6px; padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.doc-links h3 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.doc-links ul { margin: 0; padding-left: 18px; }
.doc-links li { margin: 2px 0; }
.doc-links a { color: var(--link); text-decoration: none; }
.doc-links a:hover { text-decoration: underline; }
.doc-links .host { color: var(--muted); font-size: 11.5px; }

/* ── step-by-step visualiser ────────────────────────────────────────────── */
.viz-win { width: min(1280px, 97vw); height: min(860px, 95vh); display: flex; flex-direction: column; background: var(--island-bg); border: 1.5px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.viz-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.viz-head b { color: var(--text-strong); }
.viz-info { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 180px; }
.viz-info b, .viz-info code { color: var(--text-strong); }
.viz-ctl { display: inline-flex; align-items: center; gap: 4px; }
.viz-ctl input[type=range] { width: 160px; accent-color: var(--accent); }
.viz-ctl select { background: var(--btn-bg); color: var(--text-strong); border: 1px solid var(--btn-border); border-radius: 6px; height: 26px; font: inherit; font-size: 12px; }
.viz-note { padding: 5px 12px; font-size: 12.5px; background: var(--warn-bg); color: var(--warn-text); border-bottom: 1px solid var(--border); }
.vz-err { color: var(--red); }
.viz-body { flex: 1; display: flex; min-height: 0; }
.viz-code { width: 42%; min-width: 260px; overflow: auto; border-right: 1px solid var(--border); padding: 8px 0; font: 13px/1.6 var(--mono); background: var(--island-bg); }
.vl { display: flex; white-space: pre; padding-right: 12px; }
.vl .vg { width: 38px; text-align: right; color: var(--line-no); flex: none; user-select: none; }
.vl .va { width: 20px; text-align: center; color: transparent; flex: none; }
.vl.prev { background: color-mix(in srgb, var(--green) 9%, transparent); }
.vl.cur { background: var(--accent-soft); }
.vl.cur .va { color: var(--accent); }
.vl.cur.ret .va { color: var(--green); }
.viz-mem { flex: 1; position: relative; overflow: auto; display: flex; gap: 46px; padding: 10px 16px 24px; align-items: flex-start; }
#vizArrows { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; overflow: visible; }
#vizArrows path { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: .85; }
#vizArrows marker path { fill: var(--accent); stroke: none; }
.viz-col { flex: none; min-width: 170px; }
.viz-col.grow { flex: 1; min-width: 240px; }
.viz-col h4, .viz-out h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.viz-col h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: .8; }
.vz-frame, .vz-obj { border: 1.3px solid var(--ink-2); border-radius: 9px; background: var(--card); box-shadow: 0 1.5px 0 var(--drop); margin: 0 0 10px; padding: 6px 8px 7px; font: 12.5px/1.45 var(--mono); width: max-content; max-width: 100%; }
.vz-frame { min-width: 150px; opacity: .72; }
.vz-frame.active { opacity: 1; background: var(--tile-green); }
.vz-obj { margin: 0 0 12px 0; }
#vizHeap { display: flex; flex-direction: column; align-items: flex-start; padding-left: 18px; }
.vz-obj.hot { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
#vizArrows path.hot { stroke-width: 2.6; opacity: 1; }
.vz-type { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.vz-type small { opacity: .8; }
.vz-kv { border-collapse: collapse; }
.vz-kv td { padding: 1px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.vz-kv tr:last-child td { border-bottom: 0; }
.vz-kv td:first-child { color: var(--text-strong); border-right: 1px solid var(--border); }
.vz-seq { display: flex; flex-wrap: wrap; }
.vz-cell { border: 1px solid var(--border); margin: 0 -1px -1px 0; padding: 1px 7px 2px; text-align: center; min-width: 26px; }
.vz-cell i { display: block; font-style: normal; font-size: 9.5px; color: var(--line-no); }
.vz-prim { color: var(--num); } .vz-str { color: var(--str); } .vz-misc { color: var(--muted); font-style: italic; }
.vz-ref { color: var(--accent); cursor: default; }
.vz-empty, .vz-more { color: var(--muted); font-size: 11.5px; font-style: italic; }
@keyframes vzFlash { 0% { background: color-mix(in srgb, var(--yellow) 55%, transparent); } 100% { background: transparent; } }
@keyframes vzPop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes vzBox { 0% { box-shadow: 0 0 0 3px var(--yellow); } 100% { box-shadow: 0 0 0 0 transparent; } }
.vz-kv tr.chg td { animation: vzFlash 1s ease-out; }
.vz-obj.new { animation: vzPop .35s ease-out; }
.vz-obj.chg { animation: vzBox 1s ease-out; }
.viz-out { border-top: 1px solid var(--border); padding: 8px 12px 10px; }
.viz-out .console { max-height: 110px; min-height: 22px; }
@media (max-width: 800px) { .viz-body { flex-direction: column; } .viz-code { width: auto; max-height: 38%; border-right: 0; border-bottom: 1px solid var(--border); } .viz-ctl input[type=range] { width: 90px; } }

/* ── request-flow viewer (back-end exercises): paper sheet, isometric stage, guide on the right ───────────── */
.fl-win { background: var(--app-bg); }
.fl-card { background: var(--card); border: 1.3px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); min-width: 0; }
.fl-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px 8px; flex: none; }
.fl-headl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fl-crumb { font-size: 12px; font-weight: 500; color: var(--ink-2); } .fl-crumb span { color: var(--muted); }
#flCase { max-width: 720px; height: 34px; padding: 0 8px; background: transparent; color: var(--text-strong); border: 1.3px solid transparent; border-radius: 9px; font: 800 19px var(--mono); letter-spacing: -.3px; text-overflow: ellipsis; cursor: pointer; margin-left: -9px; }
#flCase:hover, #flCase:focus { border-color: var(--border-strong); background: var(--tile-paper); outline: none; }
#flCase option { font: 500 13px var(--mono); }
.fl-tags { display: flex; gap: 8px; flex: none; }
.fl-tagp { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1.3px solid var(--ink-2); border-radius: 13px; font-size: 11px; font-weight: 600; color: var(--text-strong); box-shadow: 0 1.5px 0 var(--drop); white-space: nowrap; background: var(--tile-paper); }
.fl-tagp.sand { background: var(--tile-sand); } .fl-tagp.violet { background: var(--tile-violet); } .fl-tagp.mint { background: var(--tile-mint); } .fl-tagp.rose { background: var(--tile-rose); }
.fl-main { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 4px 14px 14px; }
.fl-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fl-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.fl-canvas { position: absolute; inset: 60px 10px 32px; }
#flSvg { width: 100%; height: 100%; display: block; overflow: visible; font-family: var(--mono); }
.fl-hud { position: absolute; top: 12px; left: 12px; right: 250px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.fl-hchip { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 96px; max-width: 250px; padding: 6px 11px 7px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: color-mix(in srgb, var(--tile-paper) 92%, transparent); box-shadow: 0 1px 0 rgba(80, 60, 35, .08); }
.fl-hchip::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; transition: background .4s; }
.fl-hchip[data-level=good]::before { background: #4caf50; } .fl-hchip[data-level=warn]::before { background: var(--amber); } .fl-hchip[data-level=bad]::before { background: #e5534b; }
.fl-hchip span { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fl-hchip b { font-size: 14px; font-weight: 800; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.fl-hchip[data-level=warn] b { color: var(--yellow); } .fl-hchip[data-level=bad] b { color: var(--red); }
.fl-tools { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 8px; align-items: center; }
.fl-tools select { height: 30px; background: var(--btn-bg); color: var(--text-strong); border: 1.3px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 12px; padding: 0 4px; }
.fl-legend { position: absolute; left: 14px; right: 14px; bottom: 9px; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; color: var(--muted); }
.fl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fl-legend i { width: 9px; height: 9px; border-radius: 50%; border: 1.3px solid var(--ink-2); background: var(--pkt-req); }
.fl-legend i.lg-res { background: var(--pkt-res); } .fl-legend i.lg-err { background: var(--red); }
.fl-envs { margin-left: auto; gap: 14px !important; } .fl-envs span { cursor: help; } .fl-envs .fl-ic { width: 14px; height: 14px; color: var(--muted); }
.fl-ic { width: 26px; height: 26px; flex: none; color: var(--ink); }
/* the scene */
.fl-grid path { stroke: var(--grid); stroke-width: 1; fill: none; }
.iso path, .iso ellipse { stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; fill: var(--k); }
.iso .f-l { fill: color-mix(in srgb, var(--k) 88%, var(--ink)); } .iso .f-r { fill: color-mix(in srgb, var(--k) 76%, var(--ink)); } .iso .f-ring { fill: none; opacity: .55; }
.t-blue { --k: var(--tile-blue); } .t-sand { --k: var(--tile-sand); } .t-violet { --k: var(--tile-violet); } .t-mint { --k: var(--tile-mint); } .t-green { --k: var(--tile-green); }
.t-orange { --k: var(--tile-orange); } .t-rose { --k: var(--tile-rose); } .t-paper { --k: var(--tile-paper); }
.t-plat { --k: color-mix(in srgb, var(--tile-paper) 80%, var(--app-bg)); } .t-plat path { stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.fl-screen .f-frame { fill: var(--ink-2); } .fl-screen .f-glass { fill: var(--tile-violet); stroke-width: 1; } .fl-screen .f-line { stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; opacity: .55; fill: none; }
.fl-zone { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; fill: var(--muted); }
.fl-name { font-weight: 800; fill: var(--ink); text-anchor: middle; }
#flSvg .fl-ic { color: var(--ink); overflow: visible; }
.fl-pill rect { fill: var(--tile-paper); stroke: var(--ink); stroke-width: 1.4; filter: drop-shadow(1px 1.8px 0 var(--drop)); }
.fl-pill text { font-size: 11px; font-weight: 700; fill: var(--ink); }
.fl-pill.wire rect { fill: var(--tile-sand); } .fl-pill.wire.res rect { fill: var(--tile-green); } .fl-pill.wire.err rect { fill: var(--tile-rose); }
.fl-node { opacity: .5; transition: opacity .25s; cursor: help; }
.fl-node.seen, .fl-node.active { opacity: 1; }
.fl-lift { transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
.fl-node.active .fl-lift { transform: translateY(-7px); }
.fl-ring { fill: transparent; stroke: transparent; stroke-width: 1.6; stroke-linejoin: round; transition: fill .25s, stroke .25s; }
.fl-node.active .fl-ring { fill: color-mix(in srgb, var(--pkt-res) 26%, transparent); stroke: var(--pkt-res); stroke-dasharray: 6 4; animation: flDash 1s linear infinite; }
.fl-node.fail .fl-ring, .fl-node.warn .fl-ring { fill: color-mix(in srgb, var(--red) 20%, transparent); stroke: var(--red); }
.fl-node.ok .fl-ring { fill: color-mix(in srgb, var(--pkt-res) 40%, transparent); stroke: var(--green); }
#flEdges path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
#flEdges path.old { stroke: var(--border-strong); stroke-width: 1.6; }
#flEdges path.sig { stroke: var(--ink); stroke-width: 2.2; stroke-dasharray: 9 5; animation: flDash .6s linear infinite; }
#flEdges path.sig.err { stroke: var(--red); }
#flSvg marker path { stroke: none; fill: var(--ink); } #flSvg marker.mk-err path { fill: var(--red); } #flSvg marker.mk-old path { fill: var(--border-strong); }
@keyframes flDash { from { stroke-dashoffset: 14; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { #flEdges path.sig, .fl-node.active .fl-ring { animation: none; } .fl-lift { transition: none; } }
.fl-token circle { fill: var(--pkt-req); stroke: var(--ink); stroke-width: 1.6; } .fl-token .halo { stroke: none; opacity: .28; }
.fl-token.res circle { fill: var(--pkt-res); } .fl-token.err circle { fill: var(--red); }
/* timeline of the scenario */
.fl-timeline { flex: none; padding: 10px 14px 12px; }
.fl-tl-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.fl-tl-head b { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.fl-strip { display: flex; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.fl-chip { position: relative; flex: 1 0 104px; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0 4px; background: none; border: 0; color: var(--muted); font-size: 10.5px; line-height: 1.3; text-align: center; }
.fl-chip::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 1.5px; background: var(--border-strong); z-index: 0; }
.fl-chip:first-child::before { display: none; }
.fl-chip.done::before, .fl-chip.active::before { background: var(--ink-2); }
.fl-chip i { position: relative; z-index: 1; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; border: 1.4px solid var(--ink-2); background: var(--tile-paper); font-style: normal; font-weight: 700; font-size: 11.5px; color: var(--text-strong); }
.fl-chip.done i { background: var(--tile-green); }
.fl-chip.active i { background: var(--primary-hover); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pkt-res) 35%, transparent), var(--pop); }
.fl-chip.active { color: var(--text-strong); font-weight: 700; }
.fl-chip span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.fl-chip.k-note i, .fl-chip.k-idle i, .fl-chip.k-startup i { border-style: dashed; }
.fl-st { display: inline-block; padding: 0 6px; border-radius: 8px; font-size: 10px; font-weight: 800; line-height: 15px; color: var(--ink); border: 1.2px solid var(--ink-2); background: var(--tile-paper); }
.fl-st.s2 { background: var(--tile-green); } .fl-st.s3 { background: var(--tile-blue); } .fl-st.s4 { background: var(--tile-sand); } .fl-st.s5 { background: var(--tile-rose); }
/* guide */
.fl-guide { width: 350px; flex: none; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.fl-nowcard { flex: none; padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 12px; max-height: 52%; }
.fl-now { overflow: auto; min-height: 96px; }
.fl-nowtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fl-count { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.fl-now .fl-l { font-size: 16px; font-weight: 800; line-height: 1.35; letter-spacing: -.2px; }
.fl-l { font: 12.5px/1.45 var(--mono); color: var(--text-strong); word-break: break-word; }
.fl-d { font: 11.5px/1.5 var(--mono); color: var(--muted); white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.fl-callout { display: flex; gap: 10px; margin-top: 12px; padding: 10px 11px; border: 1px solid var(--info-border); border-radius: 10px; background: var(--info-bg); }
.fl-callout .fl-ic { width: 28px; height: 28px; padding: 5px; border: 1.3px solid var(--ink-2); border-radius: 8px; background: var(--tile-violet); }
.fl-callout b { display: block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.fl-callout p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.fl-nav { display: flex; gap: 10px; flex: none; }
.fl-nav .tool-btn { height: 38px; justify-content: center; } .fl-nav #flPrev { flex: none; } .fl-nav #flNext { flex: 1; }
.fl-steps { flex: 1; min-height: 80px; display: flex; flex-direction: column; padding: 10px 8px 8px; }
.fl-steps h4, .fl-foot h4 { margin: 0 6px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.fl-log { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.fl-log li { display: flex; gap: 8px; padding: 5px 6px; border-radius: 7px; cursor: pointer; border: 1.3px solid transparent; }
.fl-log li:hover { background: var(--hover-bg); }
.fl-log li.cur { background: var(--tile-green); border-color: var(--ink); box-shadow: var(--pop); }
.fl-log li.future { opacity: .4; }
.fl-log li.stop .fl-l { color: var(--red); }
.fl-tag { flex: none; width: 88px; font-size: 9.5px; font-weight: 700; line-height: 16px; height: 18px; margin-top: 1px; text-align: center; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--tile-paper); color: var(--text-ui); overflow: hidden; white-space: nowrap; }
.fl-tag.c-db, .fl-tag.c-redis, .fl-tag.c-kafka, .fl-tag.c-storage, .fl-tag.c-external { background: var(--tile-violet); }
.fl-tag.c-client { background: var(--tile-mint); } .fl-tag.c-handler { background: var(--tile-orange); }
.fl-foot { flex: none; max-height: 24%; overflow: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.fl-foot pre { margin: 0 6px; font: 11px/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text-ui); }
.task-flow { margin-left: 10px; background: var(--tile-violet); border: 1.3px solid var(--ink-2); color: var(--text-strong); border-radius: 12px; padding: 0 10px; font-size: 11px; font-weight: 700; height: 22px; box-shadow: 0 1.5px 0 var(--drop); text-transform: none; letter-spacing: 0; }
.task-flow:hover { background: var(--accent-soft); filter: brightness(.97); }
@media (max-width: 980px) { .fl-main { flex-direction: column; overflow: auto; } .fl-guide { width: auto; } .fl-stage { flex: none; height: 420px; } .fl-nowcard, .fl-foot { max-height: none; } .fl-steps { max-height: 260px; } .fl-tags { display: none; } .fl-hud { right: 12px; top: 50px; } .fl-canvas { top: 104px; } }

.viz-col h4 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.viz-col h4 .fl-ic { width: 18px; height: 18px; }

.lang-btn { font: 700 11px var(--mono); width: auto; padding: 0 8px; letter-spacing: .04em; gap: 4px; }
.lang-caret { font-size: 9px; opacity: .7; }
.lang-menu { position: fixed; z-index: 60; min-width: 190px; padding: 6px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: var(--pop), var(--shadow); }
.lang-menu-title { padding: 5px 9px 7px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lang-menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 9px; border: 1.3px solid transparent; border-radius: 8px; background: none; color: var(--text-strong); font: 500 13px var(--mono); text-align: left; }
.lang-menu button b { width: 24px; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.lang-menu button span { flex: 1; } .lang-menu button i { font-style: normal; font-weight: 800; }
.lang-menu button:hover, .lang-menu button:focus-visible { background: var(--hover-bg); outline: none; }
.lang-menu button.active { background: var(--primary-bg); border-color: var(--ink); font-weight: 700; } .lang-menu button.active b { color: var(--text-strong); }

/* ── mini animations in how_it_works.md ─────────────────────────────────── */
.anim-card { margin: 4px 0 22px; padding: 0; background: var(--card); border: 1.3px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); overflow: hidden; }
.anim-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 0 14px; }
.anim-head b { flex: 1; font-size: 13.5px; font-weight: 800; letter-spacing: -.2px; color: var(--text-strong); }
.anim-tag { font-size: 10px; font-weight: 700; padding: 2px 9px; border: 1.3px solid var(--ink-2); border-radius: 12px; background: var(--tile-violet); color: var(--text-strong); box-shadow: 0 1.5px 0 var(--drop); }
.anim-btn { width: 30px; height: 26px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--btn-bg); color: var(--text-strong); font-size: 10px; box-shadow: var(--pop); }
.anim-btn:active { transform: translate(1px, 1.5px); box-shadow: none; }
.anim-svg { display: block; width: 100%; height: auto; font-family: var(--mono); background-image: linear-gradient(30deg, transparent 49.4%, var(--grid) 49.4%, var(--grid) 50.6%, transparent 50.6%), linear-gradient(-30deg, transparent 49.4%, var(--grid) 49.4%, var(--grid) 50.6%, transparent 50.6%); background-size: 62px 36px; }
.an-el { transition: opacity .35s, transform .6s cubic-bezier(.3, .7, .2, 1); }
.an-el.off { opacity: 0; pointer-events: none; }
.an-el.dim { opacity: .32; }
.an-el rect { fill: var(--tile-paper); stroke: var(--ink); stroke-width: 1.4; transition: fill .3s; }
.an-el[class*=" t-"]:not(.k-block):not(.k-cyl) rect { fill: var(--k); }
.k-cell rect, .k-card rect, .k-pill rect { filter: drop-shadow(1px 1.8px 0 var(--drop)); }
.k-cell.off rect, .k-card.off rect, .k-pill.off rect { filter: none; }
.an-el text { fill: var(--ink); font-size: 11.5px; }
.an-el .an-v { font-size: 13.5px; font-weight: 700; text-anchor: middle; }
.an-el .an-idx { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.an-el .an-ct { font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; fill: var(--muted); }
.an-el .an-cl { font-size: 12px; font-weight: 600; white-space: pre; }
.an-el .an-bl { font-size: 11.5px; font-weight: 800; text-anchor: middle; }
.an-el .an-note { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; fill: var(--muted); }
.an-el .an-big { font-size: 13px; font-weight: 800; }
.k-pill text { font-weight: 700; text-anchor: middle; }
.k-code rect { fill: var(--ink); stroke: var(--ink); } .k-code text { fill: var(--app-bg); font-size: 13px; font-weight: 700; white-space: pre; }
.k-zone rect { fill: color-mix(in srgb, var(--tile-paper) 55%, transparent); stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.an-el .fl-ic { color: var(--ink); overflow: visible; }
.an-el.hot rect { fill: var(--tile-green); stroke-width: 2; }
.an-el.bad rect { fill: var(--tile-rose); stroke: var(--red); stroke-width: 2; }
.k-code.hot rect, .k-code.bad rect { fill: var(--ink); stroke: var(--ink); }
.k-block .iso, .k-cyl .iso { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.k-block.hot .iso, .k-cyl.hot .iso, .k-block.hot > .fl-ic, .k-cyl.hot > .fl-ic { transform: translateY(-5px); }
.k-block.hot .iso path, .k-cyl.hot .iso path, .k-cyl.hot .iso ellipse { stroke-width: 2.1; }
.k-block.hot .iso, .k-cyl.hot .iso { filter: drop-shadow(0 7px 0 color-mix(in srgb, var(--pkt-res) 60%, transparent)); }
.k-block.bad .iso, .k-cyl.bad .iso { filter: drop-shadow(0 5px 0 color-mix(in srgb, var(--red) 45%, transparent)); }
.k-block.bad .iso, .k-cyl.bad .iso { --k: var(--tile-rose); }
.an-el.k-arrow.t-err .an-alab rect { fill: var(--tile-rose); stroke: var(--red); }
/* commits of the Git scenes */
.k-dot circle { fill: var(--tile-paper); stroke: var(--ink); stroke-width: 1.5; filter: drop-shadow(1px 1.8px 0 var(--drop)); transition: fill .3s; }
.k-dot[class*=" t-"] circle { fill: var(--k); }
.k-dot.off circle { filter: none; }
.k-dot .an-v { font-size: 11.5px; }
.k-dot.hot circle { fill: var(--tile-green); stroke-width: 2.3; }
.k-dot.bad circle { fill: var(--tile-rose); stroke: var(--red); stroke-width: 2.3; }
/* image layers (slabs) and containers (crates) of the Docker scenes */
.an-el .an-sl { font-size: 11px; font-weight: 700; }
.k-slab .iso { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.k-slab.hot .iso { transform: translateY(-3px); filter: drop-shadow(0 4px 0 color-mix(in srgb, var(--pkt-res) 60%, transparent)); }
.k-slab.hot .iso path { stroke-width: 2; }
.k-slab.bad .iso { --k: var(--tile-rose); filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--red) 45%, transparent)); }
.k-crate rect.cr-body, .k-crate.hot rect.cr-body { fill: color-mix(in srgb, var(--k) 42%, var(--card)); filter: drop-shadow(1.5px 2.5px 0 var(--drop)); }
.k-crate.off rect.cr-body { filter: none; }
.k-crate .cr-head { fill: var(--k); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.k-crate .cr-rib { stroke: var(--ink); stroke-width: 1; opacity: .11; fill: none; }
.k-crate .cr-t { font-size: 11px; font-weight: 800; }
.k-crate .cr-lamp { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; transition: fill .3s; }
.k-crate.hot .cr-lamp { fill: var(--pkt-res); animation: crLamp 1.2s ease-in-out infinite; }
.k-crate.hot rect.cr-body { stroke-width: 2.2; }
.k-crate.bad rect.cr-body { fill: color-mix(in srgb, var(--tile-rose) 70%, var(--card)); stroke: var(--red); stroke-width: 2.2; }
.k-crate.bad .cr-head { fill: var(--tile-rose); stroke: var(--red); } .k-crate.bad .cr-lamp { fill: var(--red); }
@keyframes crLamp { 50% { opacity: .35; } }
.an-line { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.an-line.dash { stroke-dasharray: 5 4; stroke-width: 1.3; }
.k-arrow.t-err .an-line { stroke: var(--red); }
.k-arrow.run .an-line { stroke-width: 2.3; stroke-dasharray: 8 5; animation: flDash .6s linear infinite; }
.anim-svg marker path { fill: var(--ink); } .anim-svg marker.err path { fill: var(--red); }
.an-alab rect { fill: var(--tile-sand); stroke: var(--ink-2); stroke-width: 1.1; filter: none; } .an-alab text { font-size: 10.5px; font-weight: 700; text-anchor: middle; }
.an-pkt circle { fill: var(--pkt-req); stroke: var(--ink); stroke-width: 1.5; } .an-pkt .halo { stroke: none; opacity: .28; }
.an-pkt.res circle { fill: var(--pkt-res); } .an-pkt.err circle { fill: var(--red); }
@keyframes anChg { 0% { fill: var(--pkt-req); } 100% { fill: var(--ink); } }
.an-el text.chg { animation: anChg 1.1s ease-out; }
.anim-cap { display: flex; gap: 10px; align-items: baseline; min-height: 52px; padding: 8px 14px 4px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.5; color: var(--text-strong); }
.anim-n { flex: none; font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--muted); font-variant-numeric: tabular-nums; }
.anim-dots { display: flex; gap: 0; padding: 2px 14px 12px; }
.anim-dots button { position: relative; width: 22px; height: 22px; margin-right: 18px; border-radius: 50%; border: 1.3px solid var(--ink-2); background: var(--tile-paper); color: var(--text-strong); font-size: 10px; font-weight: 700; padding: 0; }
.anim-dots button::after { content: ""; position: absolute; left: 100%; top: 50%; width: 18px; height: 1.5px; margin-left: 1.3px; background: var(--border-strong); }
.anim-dots button:last-child::after { display: none; }
.anim-dots button.done { background: var(--tile-green); } .anim-dots button.done::after { background: var(--ink-2); }
.anim-dots button.cur { background: var(--primary-hover); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pkt-res) 35%, transparent), var(--pop); }
@media (prefers-reduced-motion: reduce) { .k-arrow.run .an-line, .an-el text.chg, .k-crate.hot .cr-lamp { animation: none; } .an-el, .k-block .iso, .k-cyl .iso, .k-slab .iso { transition: none; } }

/* ── draggable borders between the panes (js/app.js: splitters) ─────────── */
.lesson, .work, .run:not(.tool-btn) { position: relative; }
.split { position: absolute; z-index: 6; touch-action: none; }
.split::after { content: ""; position: absolute; border-radius: 3px; background: var(--border-strong); opacity: 0; transition: opacity .15s, background .15s; }
.split:hover::after, .split.drag::after { opacity: 1; background: var(--ink-2); }
.split.s-tree, .split.s-main { left: 0; top: 0; bottom: 0; width: 7px; cursor: col-resize; }
.split.s-tree::after, .split.s-main::after { left: 2px; top: 50%; width: 3px; height: 44px; margin-top: -22px; }
.split.s-task, .split.s-run { left: 0; right: 0; top: 0; height: 7px; cursor: row-resize; }
.split.s-task::after, .split.s-run::after { left: 50%; top: 2px; width: 44px; height: 3px; margin-left: -22px; }
.app.tree-hidden .split.s-tree { display: none; }
body.resizing { user-select: none; cursor: col-resize; } body.resizing.rows { cursor: row-resize; }
body.resizing .CodeMirror, body.resizing .doc { pointer-events: none; }

/* ── author's notes ─────────────────────────────────────────────────────── */
.notes > h2:first-child { margin-top: 10px; }
.notes > p { font-size: 13.5px; line-height: 1.75; }
.notes > h2 { border-bottom: 0; padding-bottom: 0; margin-top: 30px; }
.notes > h2::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 9px; border: 1.4px solid var(--ink); border-radius: 50%; background: var(--pkt-res); }
.so { display: flex; gap: 12px; margin: 0; padding: 14px 16px 10px 12px; border: 1.3px solid var(--ink-2); background: var(--card); }
.so-q { margin-top: 12px; border-radius: 12px 12px 0 0; background: var(--tile-paper); }
.so-a { border-top: 0; border-radius: 0 0 12px 12px; background: var(--ok-bg); border-color: var(--ink-2); box-shadow: var(--pop); margin-bottom: 22px; }
.so-side { flex: none; width: 30px; }
.so-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1.4px solid var(--ink); border-radius: 8px; background: var(--tile-sand); font-weight: 800; font-size: 13px; color: var(--text-strong); box-shadow: 0 1.5px 0 var(--drop); }
.so-a .so-mark { background: var(--primary-hover); border-radius: 50%; }
.so-body { flex: 1; min-width: 0; }
.doc .so-title { margin: 3px 0 8px; font-size: 14.5px; font-weight: 800; letter-spacing: -.2px; text-transform: none; color: var(--text-strong); line-height: 1.4; }
.so-label { margin: 5px 0 8px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ok-text); }
.so-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.qa-tag { font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--tile-blue); color: var(--text-strong); border: 1px solid var(--border-strong); }
.so .codeblock { background: var(--island-bg); }
.sub-note { margin: 18px 0 6px; padding: 12px 16px 6px; border: 1.3px solid var(--ink-2); border-radius: 12px; background: var(--tile-sand); box-shadow: var(--pop); }
.sub-note-h { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.sub-note .so-mark { width: 24px; height: 24px; font-size: 12px; background: var(--tile-paper); }
.sub-note p { font-size: 13.5px; line-height: 1.7; margin: 6px 0 8px; }
.sub-note code { background: var(--tile-paper); }

/* step-by-step visualiser: CPython's memory drawn as fixed zones (call stack | private heap) */
.viz-mem { gap: 30px; padding: 10px 12px 24px; }
.vz-zone { flex: none; min-width: 190px; border: 1.5px dashed var(--ink-2); border-radius: 12px; padding: 8px 10px 10px; background: color-mix(in srgb, var(--card) 55%, transparent); }
.vz-zone.vz-heap { flex: 1; min-width: 320px; }
.vz-zone h4 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-strong); font-weight: 700; }
.vz-zone h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); flex-basis: 100%; }
.vz-zone h4 .fl-ic { width: 18px; height: 18px; }
.vz-left { flex: none; width: 250px; display: flex; flex-direction: column; gap: 12px; }
.vz-left .vz-zone { min-width: 0; }
.viz-code { width: 36%; }
.vz-sub { border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px 4px 8px; margin: 0 0 10px; background: var(--island-bg); }
.vz-sub h5 { margin: 0 0 8px; font-size: 11.5px; font-weight: 600; color: var(--text-strong); }
.vz-sub h5 small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.35; }
.vz-chips { display: flex; flex-wrap: wrap; gap: 16px 10px; align-items: flex-start; padding: 6px 0 2px 18px; }
.vz-chips .vz-obj { margin: 0; }
.vz-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 8px 4px; }
.vz-chip .vz-type { margin: 0; }
.vz-rc { margin-left: 8px; font-size: 10.5px; font-style: normal; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 8px; padding: 0 5px; white-space: nowrap; }
.vz-rc.soft, .vz-rc.imm { color: var(--muted); border-color: var(--border); }
.vz-in { cursor: default; border-bottom: 1px dotted var(--line-no); }
.vz-obj[data-z="imm"] { border-style: dashed; }
.vz-zone.vz-gone { background: color-mix(in srgb, var(--red) 5%, var(--island-bg)); }
#vizGone { display: flex; flex-direction: column; gap: 8px; }
.vz-ghost { max-width: 100%; }
.vz-ghosts { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.vz-row { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: stretch; }
.vz-row .vz-sub { flex: 1 1 230px; min-width: 0; }
.vz-row .vz-sub.vz-live { flex: 3 1 300px; }
#vizDefs { flex-direction: column; gap: 10px; }
.vz-chip { white-space: nowrap; }
.vz-sub h5[title] { cursor: help; }
.vz-ghost .vz-obj { opacity: .55; border-style: dashed; margin: 0; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); }
.vz-ghost.wait .vz-obj { opacity: .85; text-decoration: none; border-color: var(--yellow); }
.vz-ghost.freed, .vz-ghost.gc { animation: vzPop .35s ease-out; }
.vz-why { font-size: 11.5px; line-height: 1.35; color: var(--muted); margin-bottom: 4px; }
.vz-why b { color: var(--red); font-weight: 600; margin-right: 3px; }
.vz-ghost.wait .vz-why b { color: var(--warn-text); }
.vz-ghost.gc .vz-why b { color: var(--green); }
.vz-legend { margin: 2px 2px 0; font-size: 11px; line-height: 1.4; color: var(--muted); }
#vizArrows path.z-imm, #vizArrows path.z-const, #vizArrows path.z-code { opacity: .42; stroke-dasharray: 4 3; }
#vizArrows path.hot { opacity: 1; stroke-dasharray: none; }
.vz-in.hot { background: var(--accent-soft); }
@media (max-width: 800px) { .viz-mem { flex-direction: column; } .vz-left { width: auto; } }

/* Tests tab: the code of every check, editable for experiments */
.tests .tb { flex: 1; min-width: 0; }
.tcode, .thelp { margin: 2px 0 6px; }
.tcode > summary, .thelp > summary { cursor: pointer; color: var(--muted); font-size: 12px; user-select: none; }
.tcode > summary:hover, .thelp > summary:hover { color: var(--text-strong); }
.tcode .edited { color: var(--num); font-weight: 700; margin-left: 6px; }
.tsrc { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 7px 10px; font: 12.5px/1.5 var(--mono); tab-size: 4; white-space: pre; overflow: auto; resize: vertical;
  color: var(--text); background: var(--raised-bg); border: 1px solid var(--border); border-radius: 8px; outline: none; }
.tsrc:focus { border-color: var(--btn-border); }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; }
.mini { height: 24px; padding: 0 10px; border-radius: 6px; border: 1.5px solid var(--btn-border); background: var(--btn-bg); color: var(--text-strong); font: 700 12px var(--mono); cursor: pointer; }
.mini.ghost { background: transparent; font-weight: 400; }
.mini:disabled { opacity: .5; cursor: default; }
.tnote { color: var(--muted); font-size: 11.5px; }
.tres { margin-top: 5px; padding: 6px 10px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text-ui); background: var(--raised-bg); border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow: auto; }
.tres .err { color: var(--bad-text); } .tres .good { color: var(--green); } .tres .val { color: var(--text-strong); font-weight: 700; } .tres .dim { color: var(--muted); }
.own { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.own-h { font-weight: 700; color: var(--text-strong); }
.thelp table { margin-top: 4px; border-collapse: collapse; font-size: 12px; }
.thelp td { padding: 2px 10px 2px 0; vertical-align: top; color: var(--text-ui); }
.thelp code { font-family: var(--mono); color: var(--code-text); white-space: nowrap; }

/* Lesson player: captions over the step-by-step visualiser */
.lesson-btn { margin: 2px 0 12px; height: 34px; }
.lesson-btn small { margin-left: 8px; font-weight: 400; color: var(--muted); }
.viz.ls-on #vizPlay, .viz.ls-on #vizSpeed { display: none; }
.ls-bar { border-bottom: 1px solid var(--border); background: var(--raised-bg); }
.ls-top { display: flex; align-items: center; gap: 10px; padding: 7px 12px 0; flex-wrap: wrap; }
.ls-top b { color: var(--text-strong); }
.ls-badge { font: 700 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--ink); color: var(--island-bg); }
.ls-scenes { display: inline-flex; gap: 4px; }
.ls-scenes button { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); background: transparent; color: var(--muted); font: 700 11px var(--mono); cursor: pointer; }
.ls-scenes button.on { border-color: var(--ink); color: var(--text-strong); background: var(--btn-bg); }
.ls-ctl { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.ls-cap { padding: 8px 14px 10px; min-height: 74px; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.ls-scene { display: block; font: 700 11px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.ls-text { opacity: .62; transition: opacity .25s; }
.ls-text.fresh { opacity: 1; }
.ls-text code, .ls-rem code { font-family: var(--mono); font-size: 13px; background: var(--code-bg); color: var(--code-text); padding: 1px 5px; border-radius: 4px; }
.ls-rem { margin: 2px 0 6px; padding-left: 20px; }
.ls-end { display: inline-flex; gap: 8px; }
.ls-prog { height: 3px; background: var(--border); }
.ls-prog i { display: block; height: 100%; width: 0; background: var(--green); transition: width .3s; }
