:root {
  /* Layout: IDE shell. Project folders | sentences ⇄ code, side by side | explain strip + terminal beneath.
   * Look: a precision instrument. A charcoal chassis; matte, anodised rose metal for the frames and title
   * plates, with engraved labels; dark glass wells for code; one green-phosphor CRT for the terminal.
   * The Windows 95 bones (title bars, bevels, keycaps) stay, drawn as fine machined detail. Always dark. */
  --paper: #0E0F11;
  --panel: #16171A;
  --panel-2: #22242A;
  --field: #0A0B0D;
  --rule: #2B2D33;
  --ink: #ECE6E8;
  --ink-2: #BEB4B8;
  --ink-3: #91878C;
  --accent: #E8AABA;
  --accent-ink: #1C0F13;
  --accent-soft: rgba(232, 170, 186, .14);
  --slot-bg: rgba(242, 182, 64, .17);
  --slot-ink: #F6CD74;
  --kw: #F0A6B8;
  --str: #9FE6BF;
  --num: #F2C46B;
  --op: #C9A9F0;
  --var: #8FD1E3;
  --com: #8C8287;
  --fn: #FFB98C;
  --good: #8FE4B9;
  --warn: #F2C060;
  --bad: #FF8496;
  --band: rgba(232, 170, 186, .075);
  --link: rgba(242, 182, 64, .13);
  --sel: rgba(143, 228, 185, .24);
  --term-bg: #040605;
  --term-ink: #A9F3C7;
  --term-dim: #62997D;
  --term-accent: #F2C060;
  --term-bad: #FF8A98;
  --term-good: #7FF0B2;
  --shadow: 0 22px 60px rgba(0, 0, 0, .6), 0 4px 12px rgba(0, 0, 0, .45);

  /* Oxblood metal: matte anodised aluminium for the frames and title plates, a faint brushed grain and a
   * machined horizon; labels in pink, pressed into it */
  --rose-hi: #F4CDD7;
  --rose: #D59BAA;
  --rose-lo: #A86B7D;
  --rose-deep: #5E2B3A;
  --metal:
    linear-gradient(100deg, transparent 22%, rgba(255, 214, 226, .07) 38%, transparent 56%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .02) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #6C2537 0%, #5A1C2D 46%, #4E1727 54%, #421321 100%);
  --metal-flat:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #54192A, #431422);
  --metal-ink: #F6D3DC;
  --metal-ink-2: #DDAAB8;
  --engrave: 0 -1px 0 rgba(0, 0, 0, .55);
  --machined: inset 0 1px 0 rgba(255, 196, 212, .2), inset 0 -1px 0 rgba(0, 0, 0, .55);
  --metal-edge: rgba(255, 196, 212, .16);

  /* Keycaps and wells: the Windows 95 parts, machined */
  --oxblood: #5E2B3A;
  --mint: #A8E6CE;
  --peach: #FFC6A5;
  --honey: #F2B640;
  --phosphor: #A9F3C7;
  --bevel-hi: rgba(255, 255, 255, .07);
  --bevel-lo: #08090A;
  --bevel-dark: #000;
  --title: var(--metal);
  --title-ink: var(--metal-ink);
  --title-dim: var(--metal-ink-2);
  --face: linear-gradient(180deg, #6E2539 0%, #5C1E30 55%, #4E1928 100%);
  --face-hover: linear-gradient(180deg, #7D2C43 0%, #6A2438 55%, #5A1E30 100%);
  --face-ink: #F8DDE4;
  --pressed: #3B111E;
  --raised: inset 0 1px 0 rgba(255, 190, 210, .2), inset 0 -1px 0 rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .55), 0 0 0 1px #14060B;
  --card: linear-gradient(180deg, #24262B 0%, #1E2024 100%);
  --card-raised: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px #050506;
  --sunken: inset 0 2px 5px rgba(0, 0, 0, .65), inset 0 0 0 1px #000, 0 1px 0 rgba(255, 255, 255, .05);
  --texture: radial-gradient(rgba(255, 255, 255, .032) 1px, transparent 1.3px) 0 0 / 5px 5px;
  color-scheme: dark;

  --f-ui: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-say: "Atkinson Hyperlegible Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --f-py: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --lh: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--f-ui); }
button, input, textarea { font: inherit; color: inherit; }
code { font-family: var(--f-py); font-size: .92em; }

/* ---------- Shell ---------- */
.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--rule); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 24px; height: 24px; color: var(--accent); flex: none; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.lang-chip {
  font: 600 11px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 4px; background: var(--slot-bg); color: var(--slot-ink);
}
.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.folder-name { font: 12.5px var(--f-py); color: var(--ink-3); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-name.unsaved::after { content: " •"; color: var(--warn); }
#btnStop { color: var(--term-bad); border-color: var(--term-bad); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 13px; border-radius: 6px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink); font-weight: 600; font-size: 13px;
}
.btn:hover { background: var(--panel-2); }
.btn:focus-visible, .tree-item:focus-visible, .ac-item:focus-visible, .ix-insert:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary svg { width: 13px; height: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* File menu */
.menu { position: relative; }
.menu-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 210px;
  display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--panel); box-shadow: var(--shadow);
}
.menu-list[hidden] { display: none; }
.menu-list [role="menuitem"] {
  display: flex; justify-content: space-between; align-items: center; gap: 18px; text-align: left;
  border: 0; border-radius: 5px; background: none; padding: 7px 10px; cursor: pointer;
  font: 600 13px var(--f-ui); color: var(--ink);
}
.menu-list [role="menuitem"][hidden] { display: none; }
.menu-list [role="menuitem"]:hover, .menu-list [role="menuitem"]:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--rule); }
.desk-only { display: none; }
.desktop .desk-only { display: inline-block; }

/* New project */
.new-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 14px; }
.new-kind {
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink);
}
.new-kind b { font-size: 14px; }
.new-kind span { font-size: 12.5px; color: var(--ink-3); }
.new-kind:hover { border-color: var(--accent); }
.new-kind[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.new-kind[aria-checked="true"] b { color: var(--accent); }
.new-kind:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.new-save { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.workspace { position: relative; display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 0; }

/* ---------- Sidebar: folders + problems ---------- */
.side {
  border-right: 1px solid var(--rule); background: var(--panel);
  display: flex; flex-direction: column; min-height: 0; overflow: auto; padding-bottom: 12px;
}
.side-h {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); padding: 14px 16px 6px; display: flex; align-items: center; gap: 8px;
}
.count { font-weight: 700; letter-spacing: 0; text-transform: none; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--panel-2); color: var(--ink-2); }
.count.bad { background: var(--bad); color: var(--panel); }
.tree-root { display: flex; align-items: center; gap: 7px; padding: 2px 16px 6px; font-family: var(--f-py); font-size: 12.5px; color: var(--ink-2); }
.tree-root svg { width: 15px; height: 15px; color: var(--ink-3); }
.tree { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.tree-item {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 2px 8px;
  text-align: left; padding: 7px 8px 7px 10px; border-radius: 6px; border: 0; background: none; cursor: pointer; color: var(--ink);
}
.tree-item:hover { background: var(--panel-2); }
.tree-item.active { background: var(--accent-soft); }
.tree-item.active .ti-title { color: var(--accent); }
.ti-icon { width: 16px; height: 16px; margin-top: 2px; color: var(--ink-3); grid-row: span 2; }
.tree-item.active .ti-icon { color: var(--accent); }
.ti-title { font-weight: 600; }
.ti-file { grid-column: 2; font-family: var(--f-py); font-size: 11.5px; color: var(--ink-3); }
.ti-badge { grid-column: 3; grid-row: 1; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 9px; background: var(--bad); color: var(--panel); }
.ti-badge.warn { background: var(--warn); }

.problems { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.problems li button {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: 6px 8px 6px 10px; border-radius: 6px;
  display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 8px; font-size: 12.5px; color: var(--ink-2);
}
.problems li button:hover { background: var(--panel-2); }
.problems .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--bad); }
.problems .warn .dot { background: var(--warn); }
.problems .where { display: block; font-weight: 600; color: var(--ink); font-size: 12px; }
.problems .none { padding: 4px 10px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Work area ---------- */
.work { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto var(--term-row, minmax(130px, 24%)); min-width: 0; min-height: 0; }
/* folded away: the terminal keeps only its header; the help strip, a slim bar */
.work.term-shut { grid-template-rows: minmax(0, 1fr) auto auto; }
.work.reading.term-shut { grid-template-rows: minmax(0, 1fr) auto; }
.term-shut .term-body, .term-shut .preview-wrap, .term-shut .term-grip { display: none !important; }
.panes { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.pane-py { border-left: 1px solid var(--rule); background: var(--paper); }
.pane-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--rule); }
.pane-title { min-width: 0; }
.pane-h h2 { margin: 0; font-size: 15px; font-weight: 700; text-wrap: balance; }
.pane-h p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.pane-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.file-tag { flex: none; font-family: var(--f-py); font-size: 11.5px; color: var(--ink-3); padding: 3px 7px; border: 1px solid var(--rule); border-radius: 4px; }

/* Sentence editor: a transparent textarea over a highlighted copy of the same text. */
.editor { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); }
.gutter { overflow: hidden; background: var(--panel); border-right: 1px solid var(--rule); min-width: 44px; }
#gutterInner { padding: 12px 0; font: 12px/var(--lh) var(--f-py); color: var(--ink-3); text-align: right; will-change: transform; }
.gl { height: var(--lh); padding: 0 10px 0 8px; position: relative; font-variant-numeric: tabular-nums; }
.gl.cur { color: var(--ink); font-weight: 500; }
.gl.err { color: var(--bad); font-weight: 700; }
.gl.warn { color: var(--warn); font-weight: 700; }
.gl.err::before, .gl.warn::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 0 2px 2px 0; background: currentColor; }
.codewrap { position: relative; overflow: hidden; min-width: 0; }
.hl, #ta, .u-ta {
  position: absolute; inset: 0; margin: 0; padding: 12px 16px 40px 14px;
  font: 14.5px/var(--lh) var(--f-say); letter-spacing: 0; tab-size: 4;
  white-space: pre; overflow-wrap: normal; word-break: normal; border: 0;
}
.hl { overflow: hidden; color: var(--ink); pointer-events: none; z-index: 1; }
#ta, .u-ta { overflow: auto; background: transparent; color: transparent; caret-color: var(--ink); resize: none; outline: none; z-index: 2; }
#ta::selection, .u-ta::selection { background: var(--sel); color: transparent; }
.band { position: absolute; left: 0; right: 0; height: var(--lh); background: var(--band); z-index: 0; pointer-events: none; }
.band-link { background: var(--link); }

.s-kw { color: var(--kw); font-weight: 600; }
.s-op { color: var(--op); }
.s-conn { color: var(--ink-3); }
.s-str { color: var(--str); }
.s-num { color: var(--num); }
.s-var { color: var(--var); }
.s-fn { color: var(--fn); }
.s-com { color: var(--com); font-style: italic; }
.s-raw { color: var(--ink-2); }
.s-fill { color: var(--ink-3); opacity: .75; font-style: italic; }
.s-step { color: var(--accent); font-weight: 600; }
.s-slot { background: var(--slot-bg); color: var(--slot-ink); border-radius: 3px; }
.s-err { text-decoration: underline wavy var(--bad); text-decoration-skip-ink: none; text-underline-offset: 4px; }
.s-warn { text-decoration: underline wavy var(--warn); text-decoration-skip-ink: none; text-underline-offset: 4px; }

/* Autocomplete */
.ac {
  position: absolute; z-index: 5; min-width: 300px; max-width: min(520px, calc(100% - 16px)); max-height: 260px; overflow: auto;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); padding: 4px;
}
.ac-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 9px; border-radius: 5px; cursor: pointer; }
.ac-item.on { background: var(--accent-soft); }
.ac-say { font: 13.5px/1.35 var(--f-say); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-kind { font-size: 11px; color: var(--ink-3); align-self: center; }
.ac-py { grid-column: 1 / -1; font: 12px/1.3 var(--f-py); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-foot { padding: 5px 9px 3px; font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--rule); margin-top: 4px; }
kbd { font: 600 10.5px/1 var(--f-py); padding: 2px 4px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; background: var(--panel-2); color: var(--ink-2); }

/* Python view */
.pycode { flex: 1; overflow: auto; padding: 12px 0 40px; font: 13.5px/var(--lh) var(--f-py); min-height: 0; }
.pl { display: grid; grid-template-columns: 46px minmax(0, 1fr); min-width: max-content; cursor: pointer; }
.pl:hover { background: var(--band); }
.pl.linked { background: var(--link); }
.pl .ln { text-align: right; padding-right: 14px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; user-select: none; position: relative; }
.pl.note .ln::after { content: ""; position: absolute; right: 5px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .7; }
.pl.hdr { cursor: default; }
.pl .pc { white-space: pre; padding-right: 16px; }
.p-kw { color: var(--kw); font-weight: 500; }
.p-str { color: var(--str); }
.p-num { color: var(--num); }
.p-com { color: var(--com); font-style: italic; }
.p-bi { color: var(--op); }
.p-fn { color: var(--fn); }
.p-bad { color: var(--bad); }

/* Explain strip */
.explain {
  border-top: 1px solid var(--rule); background: var(--panel); padding: 10px 16px 12px;
  max-height: 24vh; overflow: auto; font-size: 13px;
}
.ex-map { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: start; }
.ex-cell { min-width: 0; }
.ex-lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.ex-say { font: 13.5px/1.5 var(--f-say); overflow-wrap: anywhere; }
.ex-py { font: 13px/1.5 var(--f-py); white-space: pre-wrap; overflow-wrap: anywhere; }
.ex-arrow { color: var(--ink-3); padding-top: 16px; }
.ex-notes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-notes li { padding-left: 16px; position: relative; color: var(--ink-2); max-width: 90ch; }
.ex-notes li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.ex-notes li.warn { color: var(--ink); }
.ex-notes li.warn::before { background: var(--warn); border-radius: 1px; transform: rotate(45deg); }
.ex-notes li.err { color: var(--ink); font-weight: 600; }
.ex-notes li.err::before { background: var(--bad); border-radius: 1px; }
.ex-notes code, .problems code, .ix code { background: var(--panel-2); padding: 0 4px; border-radius: 3px; }
.ex-hint { color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ex-guide { color: var(--ink-2); margin: 0 0 6px; max-width: 90ch; }

/* Terminal */
.term { display: flex; flex-direction: column; min-height: 0; background: var(--term-bg); color: var(--term-ink); }
.term-h { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: 12px; }
.term-title { font-weight: 700; letter-spacing: .09em; text-transform: uppercase; font-size: 11px; color: var(--term-dim); }
.term-tabs { display: flex; gap: 2px; }
.term-tab { border: 0; background: none; color: var(--term-dim); font: 700 11px var(--f-ui); letter-spacing: .09em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.term-tab[aria-selected="true"] { color: var(--term-ink); background: rgba(255, 255, 255, .08); }
.term-tab:focus-visible { outline: 2px solid var(--term-accent); }
.preview-wrap { flex: 1; min-height: 0; background: #fff; }
.preview-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
#btnPick[aria-pressed="true"] { color: var(--term-accent); border-color: var(--term-accent); }
.work.web { grid-template-rows: minmax(0, 1fr) auto var(--web-row, minmax(220px, 44%)); }
.work.web.term-shut { grid-template-rows: minmax(0, 1fr) auto auto; }
.role.r-page { background: var(--slot-bg); color: var(--slot-ink); }
.role.r-styles { background: var(--accent-soft); color: var(--op); }
.role.r-components, .role.r-script, .role.r-server { background: var(--accent-soft); color: var(--accent); }
.pj-node.r-page rect { stroke: var(--slot-ink); stroke-width: 2; }
.pj-node.r-styles rect { fill: var(--accent-soft); }
.py-status { color: var(--term-dim); font-size: 12px; margin-right: auto; }
.py-status.ready { color: var(--term-good); }
.py-status.bad { color: var(--term-bad); }
.term-btn { background: transparent; color: var(--term-dim); border-color: rgba(255, 255, 255, .14); }
.term-btn:hover { background: rgba(255, 255, 255, .06); }
.term-body { flex: 1; overflow: auto; padding: 8px 16px 10px; font: 13px/1.55 var(--f-py); min-height: 0; }
.term-log { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-sys { color: var(--term-dim); }
.t-ok { color: var(--term-good); }
.t-err { color: var(--term-bad); }
.t-echo { color: var(--term-accent); }
.t-cmd { color: var(--term-ink); }
.t-cmd::before { content: "❯ "; color: var(--term-dim); }
.t-py { color: var(--term-dim); }
.t-link { color: var(--term-accent); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.t-help { color: var(--term-dim); }
.term-form { display: flex; align-items: baseline; gap: 8px; }
.term-prompt { color: var(--term-dim); flex: none; }
.term-prompt.asking { color: var(--term-accent); font-weight: 500; }
.term-in { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--term-ink); font: 13px/1.55 var(--f-py); padding: 0; caret-color: var(--term-accent); }
.term-in::placeholder { color: var(--term-dim); opacity: .7; }
.term-in.asking { color: var(--term-accent); }

/* Index drawer */
.index {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 20;
  background: var(--panel); border-left: 1px solid var(--rule); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.index-h { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 18px 8px; }
.index-h h2 { margin: 0; font-size: 20px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.index-search { padding: 4px 18px 10px; border-bottom: 1px solid var(--rule); }
.index-search input { width: 100%; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); }
.index-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.index-body { overflow: auto; padding: 4px 18px 28px; }
.ix h3 { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ix p { margin: 0 0 8px; color: var(--ink-2); }
.ix-rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ix-rules li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px; }
.ix-rules .n { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.ix-rules b { display: block; }
.ix-rules span { color: var(--ink-2); }
.ix-group { font-weight: 700; font-size: 13px; margin: 14px 0 4px; color: var(--ink); }
.ix-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--rule); }
.ix-say { font: 13px/1.45 var(--f-say); overflow-wrap: anywhere; }
.ix-py { font: 12px/1.4 var(--f-py); color: var(--ink-3); overflow-wrap: anywhere; }
.ix-tip { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.ix-insert { grid-row: 1 / span 3; grid-column: 2; align-self: start; border: 1px solid var(--rule); background: var(--panel); border-radius: 5px; padding: 3px 8px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--accent); }
.ix-insert:hover { background: var(--accent-soft); }
.ix-words { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ix-words td { padding: 4px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.ix-words td:first-child { font-family: var(--f-say); padding-right: 10px; }
.ix-words td:last-child { font-family: var(--f-py); color: var(--ink-2); text-align: right; }
.ix-how { padding: 8px 0; border-top: 1px solid var(--rule); }
.ix-how b { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; }
.ix-how pre { margin: 6px 0 0; font: 12.5px/1.5 var(--f-say); white-space: pre-wrap; color: var(--ink-2); background: var(--paper); padding: 6px 8px; border-radius: 5px; }
.ix-toggle { font: 600 11px var(--f-ui); letter-spacing: 0; text-transform: none; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 0; }
.ix-empty { color: var(--ink-3); padding: 12px 0; }

/* ---------- Mode switch ---------- */
.modes { display: inline-flex; margin-left: 10px; padding: 3px; border-radius: 8px; background: var(--panel-2); }
.modes button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.modes button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 30, 50, .15); }
.modes button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-pad { padding: 4px 16px 0; }
.side-note { padding: 2px 16px; color: var(--ink-3); font-size: 12.5px; margin: 0; }
.work.reading { grid-template-rows: minmax(0, 1fr) var(--term-row, minmax(130px, 24%)); }
/* Unity: the code reaches three quarters of the way down; the terminal has the rest (its own height, dragged
   apart from Write's), and none of it when it's folded away */
.work.unity { grid-template-rows: minmax(0, 1fr) var(--unity-row, minmax(110px, 21%)); }
.work.unity.term-shut { grid-template-rows: minmax(0, 1fr) auto; }
.p-dec { color: var(--fn); }
.bad-text { color: var(--bad); }

/* Section outline (Read mode sidebar) */
.outline { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.ol-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); font-size: 13px; }
.ol-item:hover { background: var(--panel-2); }
.ol-item.on { background: var(--accent-soft); }
.ol-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-l { font: 11px var(--f-py); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip { font: 700 9.5px/1 var(--f-ui); letter-spacing: .07em; text-transform: uppercase; padding: 3px 5px; border-radius: 3px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.chip.k-tool { background: var(--accent-soft); color: var(--accent); }
.chip.k-route { background: var(--slot-bg); color: var(--slot-ink); }
.chip.k-class { background: var(--accent-soft); color: var(--op); }
.chip.k-start { background: var(--slot-bg); color: var(--slot-ink); }
.chip.k-component, .chip.k-handler { background: var(--accent-soft); color: var(--accent); }
.chip.k-part, .chip.k-head { background: var(--slot-bg); color: var(--slot-ink); }
.chip.k-style, .chip.k-media { background: var(--accent-soft); color: var(--op); }
.chip.k-type { background: var(--accent-soft); color: var(--var); }
.chip.k-test { background: rgba(143, 228, 185, .12); color: var(--good); }
.chip.k-data, .chip.k-heading { background: var(--slot-bg); color: var(--slot-ink); }
.warn-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: var(--panel); font: 700 11px/1 var(--f-ui); }

/* Read view */
.read { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); }
.read-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--rule); }
.read-title { min-width: 0; }
.read-title h2 { margin: 0; font-size: 15px; font-family: var(--f-py); font-weight: 500; }
.read-title p { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); max-width: 90ch; }
.read-tools { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.read-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.rcode { overflow: auto; padding: 8px 0 40px; font: 13px/21px var(--f-py); background: var(--paper); border-right: 1px solid var(--rule); min-height: 0; }
.rl { display: grid; grid-template-columns: 50px minmax(0, 1fr); min-width: max-content; cursor: text; border-left: 3px solid transparent; }
.rl .ln { text-align: right; padding-right: 14px; color: var(--ink-3); font-size: 11.5px; user-select: none; font-variant-numeric: tabular-nums; }
.rl .pc { white-space: pre; padding-right: 16px; }
.rl.in-sec { border-left-color: var(--rule); }
.rl.in-sec.alt { border-left-color: var(--ink-3); }
.rl.focus { background: var(--link); border-left-color: var(--warn); }
.rl-sec { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; padding: 3px 0 3px 53px; font: 600 12px var(--f-ui); color: var(--ink-2); cursor: pointer; user-select: none; }
.rl-sec:hover { color: var(--accent); }
.rsum { overflow: auto; padding: 14px 18px 28px; min-height: 0; font-size: 13.5px; }
.rsum h3 { margin: 2px 0 6px; font-size: 18px; text-wrap: balance; }
.rsum h4 { margin: 16px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.sum-kind { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.sum-head { font-size: 15px; line-height: 1.5; margin: 0 0 8px; max-width: 70ch; }
.sum-tip { color: var(--ink-3); margin: 0 0 4px; }
.sum-facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; color: var(--ink-2); max-width: 75ch; }
.sum-warn { margin-top: 14px; padding: 10px 14px 12px; border-radius: 8px; background: var(--slot-bg); }
.sum-warn h4 { margin-top: 0; color: var(--slot-ink); }
.sum-warn ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.sum-steps { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--paper); font: 13px/1.6 var(--f-say); white-space: pre-wrap; overflow-wrap: anywhere; }
.sum-empty { color: var(--ink-2); }
.rsum code, .sum-warn code { background: var(--panel-2); padding: 0 4px; border-radius: 3px; }
.linklike { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Read mode: file tree */
.tree-dir { font: 11.5px var(--f-py); color: var(--ink-3); padding: 8px 10px 2px; }
.tree-item.file { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 5px 8px 5px 10px; }
.tree-item.file .ti-title { font-family: var(--f-py); font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.nested { padding-left: 20px; }
.tree-item.faint { opacity: .6; }
.tree-extra { font: 12px var(--f-py); color: var(--ink-3); padding: 2px 10px; }
.role { font: 700 9.5px/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; padding: 3px 5px; border-radius: 3px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.role.r-entry, .role.r-routes { background: var(--slot-bg); color: var(--slot-ink); }
.role.r-helpers, .role.r-models { background: var(--accent-soft); color: var(--accent); }
.role.r-tests { color: var(--good); }
.dim { color: var(--ink-3); }
.rd-links { color: var(--ink-2); }

/* Read mode: project overview */
.rd-project { flex: 1; min-height: 0; overflow: auto; }
.pj { padding: 16px 18px 32px; }
.pj-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 28px; margin-top: 6px; align-items: start; }
.pj-cols > section { min-width: 0; }
.pj-cols .sum-warn { margin-top: 18px; }
.pj h4 { margin: 18px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.pj-top { min-width: 0; }
.pj-lead { font-size: 15.5px; line-height: 1.6; margin: 0; max-width: 72ch; }
.pj-readme { margin: 14px 0 0; padding: 10px 14px; border-left: 3px solid var(--rule); background: var(--paper); border-radius: 0 6px 6px 0; color: var(--ink-2); max-width: 72ch; }
.pj-readme .ex-lbl { margin-bottom: 4px; }
.pj-map { max-width: 100%; overflow: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); max-height: 60vh; }
.pj-map svg { display: block; }
.pj-legend { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 0; }
.pj-edge { fill: none; stroke: var(--ink-3); stroke-width: 1.4; opacity: .55; }
.pj-edge.hot { stroke: var(--accent); stroke-width: 2.2; opacity: 1; }
.pj-arrowhead { fill: var(--ink-3); }
.pj-node { cursor: pointer; }
.pj-node rect { fill: var(--panel); stroke: var(--rule); stroke-width: 1.2; }
.pj-node:hover rect, .pj-node:focus rect { stroke: var(--accent); stroke-width: 2; }
.pj-node:focus { outline: none; }
.pj-node.dim { opacity: .35; }
.pj-node.r-entry rect { stroke: var(--slot-ink); stroke-width: 2; }
.pj-node.r-routes rect { fill: var(--slot-bg); }
.pj-node.r-helpers rect, .pj-node.r-models rect { fill: var(--accent-soft); }
.pj-name { font: 11px var(--f-py); fill: var(--ink-3); }
.pj-base { font-weight: 500; font-size: 12.5px; fill: var(--ink); }
.pj-role { font: 600 10px var(--f-ui); letter-spacing: .05em; text-transform: uppercase; fill: var(--ink-2); }
.pj-order { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.pj-order li { color: var(--ink-2); }
.pj-sum { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.pj code { background: var(--panel-2); padding: 0 4px; border-radius: 3px; }
.linklike code { background: none; padding: 0; }
.read-title p .linklike { font-weight: 500; }

/* Import dialog: project options */
.imp-big { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px; border: 2px dashed var(--rule); border-radius: 10px; }
.imp-drop { color: var(--ink-3); font-size: 12.5px; }
#impCard.dropping .imp-big { border-color: var(--accent); background: var(--accent-soft); }
.imp-or { margin: 14px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(12, 18, 28, .45); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(760px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 20px 22px 22px; display: flex; flex-direction: column; }
.modal-card.wide { width: min(1120px, 100%); height: min(760px, 100%); overflow: hidden; }
.modal-h { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.modal-h h2 { margin: 0; font-size: 20px; }
.modal-h p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }

/* Blueprints */
.bp-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; }
.bp-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 6px; border-right: 1px solid var(--rule); }
.bp-group { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 4px 8px; }
.bp-group:first-child { margin-top: 0; }
.bp-item { text-align: left; border: 0; background: none; border-radius: 6px; padding: 7px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: var(--ink); }
.bp-item:hover { background: var(--panel-2); }
.bp-item.on { background: var(--accent-soft); }
.bp-item.on b { color: var(--accent); }
.bp-item span { font-size: 12px; color: var(--ink-3); }
.bp-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bp-none { color: var(--ink-3); font-size: 12.5px; margin: 2px 10px; }
.bp-mk { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 10px 8px 4px; }
.bp-detail { overflow: auto; min-width: 0; padding-right: 4px; }
.bp-kind { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.bp-title { margin: 4px 0 12px; font-size: 22px; text-wrap: balance; }
.madlib { font: 20px/2.3 var(--f-ui); color: var(--ink); max-width: 64ch; }
.blank-wrap { display: inline-flex; flex-direction: column; align-items: center; vertical-align: top; line-height: 1.2; margin: 2px 2px 0; }
.blank-wrap small { font-size: 10.5px; letter-spacing: .04em; color: var(--ink-3); margin-top: 1px; }
.blank { font: 600 19px/1.3 var(--f-say); color: var(--slot-ink); background: var(--slot-bg); border: 0; border-bottom: 2px solid var(--slot-ink); border-radius: 4px 4px 0 0; padding: 2px 6px; text-align: center; min-width: 3ch; max-width: 100%; }
select.blank { text-align: left; cursor: pointer; }
.blank:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.blank-ref { color: var(--slot-ink); font-weight: 600; }
.bp-extra { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.bp-extra .ex-lbl { width: 100%; }
.bp-extra-f { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.bp-extra-f .blank { font-size: 15px; }
.bp-out { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 10px; }
.bp-out-h { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.bp-sec { margin-bottom: 10px; }
.bp-sec pre { margin: 4px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--paper); font: 13px/1.55 var(--f-say); white-space: pre; overflow-x: auto; }
.bp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.bp-note { color: var(--ink-3); font-size: 12.5px; margin: 8px 0 0; }
.bp-errors { color: var(--bad); font-size: 13px; display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.bp-edit { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.bp-edit textarea { flex: 1; min-height: 320px; font: 13.5px/1.55 var(--f-say); padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); resize: vertical; tab-size: 4; }
.bp-edit textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.bp-help { font-size: 13px; color: var(--ink-2); }
.bp-help summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.bp-help ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.bp-help code { background: var(--panel-2); padding: 0 4px; border-radius: 3px; }

/* Import */
.imp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.imp-row label { font-weight: 600; font-size: 13px; }
.imp-row input { flex: 1; max-width: 280px; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); font-family: var(--f-py); font-size: 13px; }
.imp-text { width: 100%; min-height: 170px; resize: vertical; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); font: 13px/1.5 var(--f-py); tab-size: 4; white-space: pre; }
.imp-text:focus, .imp-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.imp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.imp-note { flex: 1; min-width: 120px; color: var(--ink-3); font-size: 12.5px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ================================================================== */
/* The instrument: a charcoal chassis, rose-metal plates with engraved */
/* labels, dark glass wells, keycaps, and one green-phosphor CRT.      */
/* ================================================================== */

/* Keycaps */
.btn {
  border-radius: 4px; border: 0; background: var(--face); color: var(--face-ink);
  box-shadow: var(--raised);
}
.btn:hover { background: var(--face-hover); }
.btn:active, .btn[aria-expanded="true"], .btn[aria-pressed="true"] {
  background: var(--pressed); color: var(--face-ink); box-shadow: var(--sunken);
}
.btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--face-hover); box-shadow: var(--raised); color: var(--face-ink); }
.btn.ghost[aria-expanded="true"] { background: var(--pressed); box-shadow: var(--sunken); color: var(--face-ink); }
/* Run: the wine key whose label is lit, mint, like the terminal it starts. */
.btn.primary {
  position: relative; color: var(--phosphor); letter-spacing: .02em; background: var(--face);
  box-shadow: var(--raised), inset 0 0 0 1px rgba(127, 240, 178, .22), 0 0 14px rgba(80, 230, 150, .1);
  text-shadow: 0 0 6px rgba(127, 240, 178, .6);
}
.btn.primary svg { filter: drop-shadow(0 0 4px rgba(127, 240, 178, .7)); }
.btn.primary:hover { filter: none; color: #CBFFE0; background: var(--face-hover);
  box-shadow: var(--raised), inset 0 0 0 1px rgba(127, 240, 178, .38), 0 0 20px rgba(80, 230, 150, .18); }
.btn.primary:active { background: var(--pressed); box-shadow: var(--sunken), inset 0 0 0 1px rgba(127, 240, 178, .3); }
kbd { border: 0; border-radius: 3px; background: var(--face); color: var(--face-ink); box-shadow: var(--raised); }

/* The header: black, with a machined rose hairline beneath */
.bar { position: relative; z-index: 30; border-bottom: 0; background: linear-gradient(180deg, #0B0B0D, #070708); box-shadow: inset 0 -1px 0 #000; }
.bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, transparent, #A86B7D 12%, #F0C3CE 50%, #A86B7D 88%, transparent);
  box-shadow: 0 1px 0 #000, 0 4px 14px rgba(0, 0, 0, .7);
}
.logo { color: var(--rose); }
.logo-glass { fill: #04100A; }
.logo-glow { stroke: var(--phosphor); filter: drop-shadow(0 0 1.5px rgba(127, 240, 178, .8)); }
.brand-name {
  background: linear-gradient(180deg, #F8D7DF 0%, #E2AFBC 50%, #C08495 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: .015em;
}
/* the prompt from the icon */
.brand-name::after { content: ">"; margin-left: 1px; color: var(--phosphor); -webkit-text-fill-color: var(--phosphor); text-shadow: 0 0 7px rgba(127, 240, 178, .6); font-family: var(--f-py); font-weight: 500; }
.lang-chip { border-radius: 2px; background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined), 0 0 0 1px #000; }
.modes { border-radius: 5px; padding: 3px; background: #050506; box-shadow: var(--sunken); }
.modes button { border-radius: 3px; color: var(--ink-3); }
.modes button:hover { color: var(--ink); }
.modes button[aria-selected="true"] { background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined), 0 0 0 1px #000, 0 1px 3px rgba(0, 0, 0, .6); }
.modes button:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.folder-name { color: var(--ink-3); }
/* a pressed toggle (Tutor) shows a small amber lamp */
#btnTutor { position: relative; padding-left: 22px; }
#btnTutor::before { content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #3A2C22; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6); }
#btnTutor[aria-pressed="true"]::before { background: #FFD37A; box-shadow: 0 0 6px 1px rgba(242, 182, 64, .75), inset 0 -1px 1px rgba(160, 100, 0, .6); }

/* Menus */
.menu-list { border-radius: 5px; border: 0; padding: 4px; background: linear-gradient(180deg, #1C1D21, #16171A); box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow); }
.menu-list [role="menuitem"] { border-radius: 3px; color: var(--ink); }
.menu-list [role="menuitem"]:hover, .menu-list [role="menuitem"]:focus-visible { background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); }
.menu-list [role="menuitem"]:hover kbd, .menu-list [role="menuitem"]:focus-visible kbd { background: rgba(0, 0, 0, .3); color: var(--metal-ink); box-shadow: none; }
.menu-sep { margin: 4px 6px; background: #000; box-shadow: 0 1px 0 rgba(255, 255, 255, .05); }
.ac { border-radius: 5px; border: 0; background: linear-gradient(180deg, #1C1D21, #16171A); box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow); }
.ac-item { border-radius: 3px; }
.ac-foot { border-top-color: #000; box-shadow: 0 -1px 0 rgba(255, 255, 255, .04); }

/* Sidebar: charcoal, with a fine grille */
.side { border-right: 0; background: var(--texture), linear-gradient(180deg, #141518, #111214); box-shadow: inset -1px 0 0 #000, inset -2px 0 0 rgba(255, 255, 255, .03); }
.side-h { color: var(--rose); letter-spacing: .12em; }
.side-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(213, 155, 170, .45), transparent); }
.tree-item, .problems li button, .ol-item, .plan-step { border-radius: 3px; }
.tree-item:hover, .problems li button:hover, .ol-item:hover, .plan-step:hover { background: rgba(255, 255, 255, .045); }
.tree-item.active, .ol-item.on { background: linear-gradient(90deg, rgba(232, 170, 186, .16), rgba(232, 170, 186, .05)); box-shadow: inset 2px 0 0 var(--rose), inset 0 0 0 1px rgba(232, 170, 186, .12); }
.tree-item.active .ti-title, .tree-item.active .ti-icon { color: var(--rose-hi); }
.tree-item.active .ti-file { color: var(--ink-2); }
.tree-item:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.count, .chip, .role, .ti-badge { border-radius: 3px; }
.count { background: #000; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }
.count.bad, .ti-badge { background: #4A1622; color: #FFC2CC; box-shadow: inset 0 0 0 1px rgba(255, 132, 150, .4); }
.ti-badge.warn { background: #3D2C0C; color: #F7D58A; box-shadow: inset 0 0 0 1px rgba(242, 192, 96, .4); }
.chip, .role { background: #000; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }

/* Panes are modules: a rose-metal faceplate with an engraved title, and a dark glass well set into it */
.pane-h, .index-h { background: var(--metal); border-bottom: 0; box-shadow: var(--machined); }
.pane-h { padding: 7px 10px 7px 12px; align-items: center; }
.pane-h h2, .index-h h2 { color: var(--metal-ink); text-shadow: var(--engrave); letter-spacing: .01em; }
.pane-h h2 { font-size: 14px; }
.pane-h p, .index-h .eyebrow { color: var(--metal-ink-2); text-shadow: var(--engrave); }
.pane, .pane-py { background: var(--metal-flat); }
.pane-py { border-left: 0; box-shadow: inset 1px 0 0 rgba(0, 0, 0, .7), inset 2px 0 0 var(--metal-edge); }
/* readouts: the file name, like a small LCD */
.file-tag { background: #0B0C0E; color: var(--ink-2); border: 0; border-radius: 3px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 0 0 1px #000, 0 1px 0 var(--metal-edge); }
.pane-h .btn { box-shadow: var(--raised), 0 1px 0 var(--metal-edge); }
.editor, .pycode, .rcode {
  margin: 0 7px 7px; border: 0; border-radius: 3px;
  background: radial-gradient(130% 100% at 50% 0%, #121316 0%, var(--field) 70%);
  box-shadow: inset 0 0 0 1px #000, inset 0 3px 10px rgba(0, 0, 0, .75), 0 1px 0 var(--metal-edge), 0 -1px 0 rgba(94, 43, 58, .5);
}
.rcode { margin: 7px; }
.gutter { background: linear-gradient(90deg, #0D0E10, #111215); border-right: 1px solid #000; box-shadow: 1px 0 0 rgba(255, 255, 255, .03); }
.read { background: var(--metal-flat); }
.read-h { background: var(--metal); box-shadow: var(--machined); border-bottom: 0; }
.read-title h2 { color: var(--metal-ink); text-shadow: var(--engrave); }
.read-title p { color: var(--metal-ink-2); }
.read-title p .linklike { color: var(--metal-ink); }
.rsum { background: var(--panel); margin: 7px 7px 7px 0; border-radius: 3px; box-shadow: inset 0 0 0 1px #000, 0 1px 0 var(--metal-edge); }
.rd-project { background: var(--panel); }
.explain { border-top: 0; background: linear-gradient(180deg, #17181B, #141518); box-shadow: inset 0 1px 0 #000, inset 0 2px 0 rgba(255, 255, 255, .035); }
.ex-lbl, .sum-kind, .bp-kind { color: var(--rose); }
.ex-notes code, .problems code, .ix code, .rsum code, .sum-warn code, .pj code, .bp-help code { background: #000; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }

/* Fields: dark wells */
.imp-row input, .imp-text, .index-search input, .bp-edit textarea, .tip-in, #bldName, #newName {
  border-radius: 3px; border: 0; background: var(--field); color: var(--ink);
  box-shadow: inset 0 0 0 1px #000, inset 0 2px 5px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .05);
}
.imp-big { border-radius: 4px; border: 1px dashed #3A3D44; background: var(--texture), var(--field); }
.sum-warn { border-radius: 3px; border: 1px solid rgba(242, 192, 96, .3); }
.sum-steps, .bp-sec pre, .ix-how pre, .kit-src { border-radius: 3px; background: var(--field); box-shadow: var(--sunken); }
.pj-map { border-radius: 3px; border: 0; background: var(--field); box-shadow: var(--sunken); }

/* Dialogs: a charcoal case under a rose-metal title plate */
.modal { background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px) saturate(.8); }
.modal-card {
  position: relative; border-radius: 6px; border: 0; padding: 0 22px 20px;
  background: linear-gradient(180deg, #18191C, #141518);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, .04), var(--shadow);
}
.modal-h { display: block; }
.modal-h h2 {
  margin: 0 -22px 14px; padding: 9px 110px 9px 14px; font-size: 15px; border-radius: 6px 6px 0 0;
  background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined), 0 1px 0 #000;
}
.modal-h p { color: var(--ink-2); }
.modal-h > .btn { position: absolute; top: 6px; right: 7px; }
.bp-list { border-right: 0; box-shadow: inset -1px 0 0 #000, inset -2px 0 0 rgba(255, 255, 255, .035); }
.bp-item { border-radius: 3px; }
.bp-item:hover { background: rgba(255, 255, 255, .045); }
.bp-item.on { background: linear-gradient(90deg, rgba(232, 170, 186, .18), rgba(232, 170, 186, .05)); box-shadow: inset 2px 0 0 var(--rose); }
.bp-item.on b { color: var(--rose-hi); }
.bp-item.on span { color: var(--ink-2); }
.new-kind { border-radius: 5px; border: 0; background: var(--card); box-shadow: var(--card-raised); color: var(--ink); }
.new-kind:hover { background: linear-gradient(180deg, #2B2D33, #24262B); box-shadow: var(--card-raised), 0 0 0 1px rgba(232, 170, 186, .35); }
.new-kind[aria-checked="true"] { background: linear-gradient(180deg, #2A2228, #201B20); box-shadow: 0 0 0 1px var(--rose), inset 0 0 18px rgba(232, 170, 186, .12), var(--card-raised); }
.new-kind[aria-checked="true"] b { color: var(--rose-hi); }

/* Index drawer */
.index { border-left: 0; background: linear-gradient(180deg, #17181B, #141518); box-shadow: -1px 0 0 #000, inset 1px 0 0 rgba(255, 255, 255, .04), var(--shadow); }
.index-h { padding: 8px 10px 8px 14px; align-items: center; }
.index-h h2 { font-size: 16px; }
.ix-insert { border: 0; border-radius: 3px; background: var(--face); box-shadow: var(--raised); color: var(--accent); }
.ix-insert:hover { background: var(--face-hover); }

/* The terminal: a black, green-phosphor CRT in a dark bezel. A faint glow and faint scanlines, no more. */
.term { border-top: 0; background: #0B0C0D; box-shadow: inset 0 1px 0 #000, inset 0 2px 0 rgba(255, 255, 255, .04); }
.term-h { padding: 5px 8px 5px 12px; background: linear-gradient(180deg, #141518, #0E0F11); border-bottom: 0; box-shadow: inset 0 -1px 0 #000; }
.term-tab { color: var(--ink-3); border-radius: 3px; letter-spacing: .12em; }
.term-tab:hover { color: var(--ink); }
.term-tab[aria-selected="true"] { background: #000; color: var(--phosphor); text-shadow: 0 0 6px rgba(127, 240, 178, .45); box-shadow: inset 0 0 0 1px #1F3A2C, inset 0 1px 4px rgba(0, 0, 0, .8); }
.term-tab:focus-visible { outline: 1px solid var(--phosphor); }
.py-status { color: var(--ink-3); position: relative; padding-left: 12px; }
.py-status::before { content: ""; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #2B2F2C; }
.py-status.ready { color: var(--term-dim); }
.py-status.ready::before { background: #8FF7BE; box-shadow: 0 0 6px 1px rgba(127, 240, 178, .6); }
.py-status.bad { color: var(--term-bad); }
.py-status.bad::before { background: var(--term-bad); box-shadow: 0 0 6px rgba(255, 138, 152, .6); }
.term-btn { background: var(--face); color: var(--ink-2); border: 0; box-shadow: var(--raised); }
.term-btn:hover { background: var(--face-hover); color: var(--ink); }
#btnStop { color: var(--term-bad); }
#btnPick[aria-pressed="true"] { color: var(--phosphor); background: #000; box-shadow: var(--sunken); }
.term-body {
  margin: 0 7px 7px; border-radius: 6px;
  background:
    repeating-linear-gradient(to bottom, rgba(169, 243, 199, .022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 90% 120% at 50% 40%, #07120C 0%, #040805 55%, #020302 100%);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 40px rgba(0, 0, 0, .85), inset 0 0 90px rgba(20, 60, 38, .18), 0 1px 0 rgba(255, 255, 255, .05);
}
.term-log, .term-in, .term-prompt { text-shadow: 0 0 5px color-mix(in srgb, currentColor 32%, transparent), 0 0 1px color-mix(in srgb, currentColor 40%, transparent); }
.t-cmd::before { color: var(--term-dim); }
.term-in { caret-color: var(--phosphor); caret-shape: block; }
.term-in:placeholder-shown:not(:focus) {
  text-indent: 14px; background: linear-gradient(var(--phosphor), var(--phosphor)) no-repeat 0 50% / 8px 1.05em;
}
@media (prefers-reduced-motion: no-preference) {
  .term-in:placeholder-shown:not(:focus) { animation: ic-blink 1.1s steps(1) infinite; }
}
@keyframes ic-blink { 50% { background-size: 0 0; } }
.preview-wrap { margin: 0 7px 7px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000; }

/* Tutor: tip balloons beside the line, and its part of the explain strip */
.tip {
  position: absolute; z-index: 6; width: min(380px, calc(100% - 70px)); padding: 0 10px 10px;
  background: linear-gradient(180deg, #1D1E22, #17181B); color: var(--ink); border: 0; border-radius: 5px;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(232, 170, 186, .22), var(--shadow); font-size: 13px;
}
.tip::before, .tip::after { content: ""; position: absolute; left: 22px; border: 8px solid transparent; }
.tip::before { top: -17px; border-bottom-color: #000; }
.tip::after { top: -15px; border-bottom-color: #6A2436; }
.tip.up::before { top: auto; bottom: -17px; border-bottom-color: transparent; border-top-color: #000; }
.tip.up::after { top: auto; bottom: -15px; border-bottom-color: transparent; border-top-color: #17181B; }
.tip-h { display: flex; align-items: center; gap: 8px; margin: 0 -10px 8px; padding: 5px 6px 5px 10px; border-radius: 5px 5px 0 0; background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); font-weight: 700; box-shadow: var(--machined); }
.tip-h > span:nth-child(2) { flex: 1; }
.tip-h code { background: rgba(0, 0, 0, .25); color: var(--metal-ink); padding: 0 4px; border-radius: 2px; box-shadow: none; }
.tip-badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #1A0D11; color: var(--phosphor); font: 700 11px/1 var(--f-ui); text-shadow: 0 0 5px rgba(127, 240, 178, .5); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .7), 0 1px 0 var(--metal-edge); }
.tip-x { border: 0; background: var(--face); color: var(--ink); width: 20px; height: 18px; line-height: 16px; font-weight: 700; border-radius: 3px; cursor: pointer; box-shadow: var(--raised); padding: 0; text-shadow: none; }
.tip p { margin: 0 0 8px; }
.tip code, .ex-tutor code { background: #000; padding: 0 4px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--rule); }
.tip-more { color: var(--ink-2); }
.tip-say { font: 13.5px/1.4 var(--f-say); padding: 5px 8px; margin: 0 0 8px; background: var(--field); border-radius: 3px; box-shadow: var(--sunken); }
.tip-in { width: 100%; padding: 6px 8px; margin: 0 0 8px; font: 13.5px/1.4 var(--f-py); caret-color: var(--phosphor); }
.tip-in:focus { outline: 1px solid var(--accent); outline-offset: 1px; }
.tip-result { padding: 5px 8px; border-left: 2px solid var(--rule); background: rgba(255, 255, 255, .03); }
.tip-result.ok { border-left-color: var(--good); color: var(--good); font-weight: 600; }
.tip-result.no { border-left-color: var(--bad); color: var(--bad); }
.tip-code { font-family: var(--f-py); }
.tip-actions { display: flex; justify-content: flex-end; gap: 6px; }
.ex-tutor { margin-top: 10px; padding: 8px 12px; border: 0; border-radius: 3px; background: linear-gradient(90deg, rgba(242, 182, 64, .09), transparent 70%); box-shadow: inset 2px 0 0 var(--honey), inset 0 0 0 1px rgba(242, 182, 64, .14); }
.ex-tutor-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ex-tutor ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); max-width: 90ch; }
.ex-tutor li.known { color: var(--good); }
.tour-more { color: var(--ink-2); max-width: 70ch; }
#btnTutor[aria-pressed="true"] { color: var(--ink); }

/* Project builder and project map */
.depth { display: inline-block; font: 700 9.5px/1 var(--f-ui); letter-spacing: .07em; text-transform: uppercase; padding: 3px 6px; border-radius: 2px; vertical-align: 1px; white-space: nowrap; border: 1px solid; }
.depth.d-walk { background: rgba(143, 228, 185, .1); color: #A4ECC6; border-color: rgba(143, 228, 185, .45); }
.depth.d-hallway { background: rgba(242, 182, 64, .1); color: #F6CD74; border-color: rgba(242, 182, 64, .5); }
.depth.d-horizon { background: transparent; color: var(--rose-hi); border-color: rgba(232, 170, 186, .6); border-style: dashed; }
.bld-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 12px; padding: 5px 8px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); font-size: 13px; }
.bld-crumb { border: 0; background: none; padding: 2px 6px; border-radius: 2px; color: var(--accent); font: 600 13px var(--f-ui); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.bld-crumb[aria-current="step"] { color: var(--ink); text-decoration: none; }
.bld-sep { color: var(--ink-3); }
.bld-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.bld-ask { margin: 4px 0 12px; font-size: 18px; }
.bld-kit-h h3 { margin: 0 0 4px; font-size: 18px; }
.bld-kit-h p { margin: 0 0 8px; color: var(--ink-2); max-width: 90ch; }
.bld-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; }
.bld-steps { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); }
.bld-step { padding: 8px 10px; background: var(--card); border: 0; border-radius: 4px; box-shadow: var(--card-raised); }
.bld-step.on { background: linear-gradient(90deg, #2A2127, #1F1D22 40%); box-shadow: var(--card-raised), inset 2px 0 0 var(--rose); }
.bld-step label { display: grid; grid-template-columns: auto 22px minmax(0, 1fr); gap: 8px; align-items: start; cursor: pointer; }
.bld-step input { margin-top: 4px; accent-color: var(--rose); }
.bld-n { font: 700 13px/1.6 var(--f-py); color: var(--rose); text-align: right; }
.bld-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bld-sum { display: block; margin-top: 3px; color: var(--ink-2); font-size: 13px; max-width: 95ch; }
.bld-more { margin: 4px 0 0 52px; font-size: 12.5px; color: var(--ink-2); }
.bld-more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.bld-more p { margin: 4px 0 0; max-width: 95ch; }
.bld-actions { margin-top: 10px; }
.bld-actions .imp-row { margin: 0; }
.new-alt { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.plan-path { margin: 0; padding: 0 16px 4px; font-size: 11.5px; color: var(--ink-3); }
.plan { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.plan-step { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px; align-items: center; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 2px; cursor: pointer; color: var(--ink); font-size: 12.5px; }
.plan-step:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.plan-n { font: 700 12px var(--f-py); color: var(--rose); text-align: right; }
.plan-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -2px 0 8px; padding-bottom: 6px; border-bottom: 1px solid #000; box-shadow: 0 1px 0 rgba(255, 255, 255, .04); }
.ex-step .ex-lbl { margin: 0; }
.step-card { width: min(640px, 100%); }
.step-card h4 { margin: 14px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--rose); }
.step-card p { margin: 0; max-width: 72ch; }
.step-depth { color: var(--ink-2); }
.step-go { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.step-nav { justify-content: space-between; }
/* Full screen: one window fills the work area (the folders and the others step aside); Esc comes back */
.max-btn { padding: 4px 6px; }
.max-btn svg { width: 14px; height: 14px; }
.max-btn .max-out, .max-btn[aria-pressed="true"] .max-in { display: none; }
.max-btn[aria-pressed="true"] .max-out { display: block; }
.workspace.max-say, .workspace.max-code, .workspace.max-term, .workspace.max-unity { grid-template-columns: minmax(0, 1fr); }
.workspace.max-say .side, .workspace.max-code .side, .workspace.max-term .side, .workspace.max-unity .side { display: none; }
.max-say .work, .max-code .work, .max-term .work, .max-unity .work { grid-template-rows: minmax(0, 1fr); }
.max-unity .term, .max-unity .explain-wrap, .max-term #unityView { display: none !important; }
.max-say .pane-py, .max-say .explain-wrap, .max-say .term,
.max-code .pane-say, .max-code .explain-wrap, .max-code .term,
.max-term .panes, .max-term .explain-wrap, .max-term #readView { display: none !important; }
.max-say .panes, .max-code .panes { grid-template-columns: minmax(0, 1fr); }
.max-say .editor, .max-code .pycode { margin-bottom: 7px; }

/* Room to work: "Hide help" folds the help strip into a slim bar; the terminal folds to its header and
   its top edge drags to resize it */
.explain-wrap { position: relative; min-height: 0; }
.explain-wrap .explain { padding-right: 108px; }
.dock-btn {
  position: absolute; top: 5px; right: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 5px;
  border: 0; border-radius: 3px; padding: 3px 8px 3px 5px; background: transparent; cursor: pointer;
  font: 700 10.5px/1.3 var(--f-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.dock-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.dock-btn:focus-visible { outline: 1px solid var(--rose); outline-offset: 1px; }
.dock-btn svg, .dock-term svg { width: 13px; height: 13px; flex: none; }
.dock-term { padding: 4px 6px; }
.explain-wrap.shut .explain { display: none; }
.explain-wrap.shut .dock-btn {
  position: static; width: 100%; padding: 4px 12px; border-radius: 0; color: var(--rose);
  background: linear-gradient(180deg, #17181B, #141518); box-shadow: inset 0 1px 0 #000, inset 0 2px 0 rgba(255, 255, 255, .035);
}
.explain-wrap.shut .dock-btn:hover { color: var(--rose-hi); }
.explain-wrap.shut .dock-btn svg, .term-shut .dock-term svg { transform: rotate(180deg); }
.term { position: relative; }
.term-grip { position: absolute; left: 0; right: 0; top: -4px; height: 9px; z-index: 4; cursor: row-resize; touch-action: none; }
.term-grip::after { content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 3px; margin-left: -22px; border-radius: 2px; background: #2A2C31; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.term-grip:hover::after, .term-grip:focus-visible::after, .resizing .term-grip::after { background: var(--rose); box-shadow: 0 0 6px rgba(232, 170, 186, .45); }
.term-grip:focus-visible { outline: none; }
.resizing, .resizing * { cursor: row-resize !important; user-select: none; }
.resizing iframe { pointer-events: none; }
/* Drop down: taller lines, and under each value a small box, − ▾ +, joined to an outline round the value */
.editor.dd { --lh: 40px; }
.dd-btn { display: inline-flex; align-items: center; gap: 5px; }
.dd-btn svg { width: 14px; height: 14px; flex: none; }
.dd-btn[aria-pressed="true"] { background: #000; color: var(--phosphor); text-shadow: 0 0 6px rgba(127, 240, 178, .4); box-shadow: inset 0 0 0 1px #1F3A2C, inset 0 1px 4px rgba(0, 0, 0, .8), 0 1px 0 var(--metal-edge); }
.dd-layer { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.dd-val { position: absolute; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(232, 170, 186, .42); }
.dd-ctl {
  position: absolute; display: flex; align-items: stretch; height: 14px; pointer-events: auto; border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, #5E1E2F, #44141F); box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 255, 255, .09);
}
.dd-ctl button {
  width: 15px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
  color: var(--metal-ink); font: 700 12px/1 var(--f-py);
}
.dd-ctl button + button { box-shadow: inset 1px 0 0 rgba(0, 0, 0, .4); }
.dd-ctl button:hover:not(:disabled) { background: rgba(255, 255, 255, .13); color: #fff; }
.dd-ctl button:disabled { color: rgba(246, 211, 220, .3); cursor: default; }
.dd-ctl .dd-open { width: 16px; }
.dd-ctl .dd-open svg { width: 10px; height: 10px; }
.dd-ctl.open { background: linear-gradient(180deg, #7A2A3F, #5A1C2C); }
.dd-ctl.open .dd-open svg { transform: rotate(180deg); }
.dd-chip { width: 9px; margin: 3px 0 3px 4px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .2); }
.dd-menu {
  position: fixed; z-index: 60; width: 344px; max-height: min(430px, 72vh); overflow: auto; padding: 10px 12px 9px; border-radius: 5px;
  background: linear-gradient(180deg, #1C1D21, #151619); color: var(--ink); font-size: 13px; outline: none;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, .05), 0 0 0 2px rgba(110, 37, 57, .7), var(--shadow);
}
.dd-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dd-h b { color: var(--rose-hi); font-size: 13.5px; }
.dd-h code { font: 12.5px var(--f-py); color: var(--num); }
.dd-about { margin: 4px 0 8px; color: var(--ink-2); line-height: 1.45; }
.dd-about code { background: #000; padding: 0 4px; border-radius: 3px; color: var(--ink); }
.dd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.dd-list li { display: grid; grid-template-columns: minmax(56px, max-content) minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 5px 8px; border-radius: 3px; cursor: pointer; }
.dd-list li[aria-selected="true"] { background: rgba(232, 170, 186, .13); box-shadow: inset 2px 0 0 var(--rose); }
.dd-v { font: 13px var(--f-py); color: var(--num); white-space: nowrap; }
.dd-l { color: var(--ink-2); }
.dd-list li.now .dd-l::after { content: "  · what it is now"; color: var(--ink-3); font-size: 11.5px; }
.dd-sw { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.dd-swatch { aspect-ratio: 1; padding: 0; border: 0; border-radius: 3px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 0 0 1px #000; }
.dd-swatch[aria-selected="true"] { outline: 2px solid var(--rose-hi); outline-offset: 2px; }
.dd-swname { min-height: 1.4em; margin: 7px 0 0; color: var(--ink-2); font-size: 12.5px; }
.dd-any { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--ink-2); }
.dd-any input { width: 46px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.dd-foot { margin: 8px 0 0; color: var(--ink-3); font-size: 11.5px; }

/* Fill in: what goes in the ‹blank› the cursor is on, how to work it out, and an example on request */
.ex-fill { margin: 0 0 10px; padding: 8px 12px 9px; border-radius: 4px; max-width: 110ch; background: rgba(242, 196, 107, .055); box-shadow: inset 2px 0 0 var(--slot-ink), inset 0 0 0 1px rgba(242, 196, 107, .14); }
.ex-fill .ex-lbl { color: var(--slot-ink); }
.ex-fill .ex-slot { text-transform: none; letter-spacing: 0; font: 600 12.5px var(--f-say); background: var(--slot-bg); padding: 0 4px; border-radius: 3px; }
.ex-fill p { margin: 4px 0 0; color: var(--ink-2); line-height: 1.5; }
.ex-fill p b { color: var(--ink); font-weight: 600; }
.ex-fill code { background: #000; color: var(--ink); padding: 1px 5px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--rule); font: 12.5px var(--f-py); overflow-wrap: anywhere; }
.ex-fill-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ex-fill-tip { font-size: 12px; }

/* Images: the project's pictures, with thumbnails, in the side panel */
.img-list { list-style: none; margin: 0 0 4px; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.img-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 4px 2px 4px 6px; border-radius: 3px; }
.img-item:hover { background: rgba(255, 255, 255, .04); }
.img-thumb {
  width: 30px; height: 30px; border-radius: 3px; display: grid; place-items: center; overflow: hidden; color: var(--ink-3); font-size: 12px;
  background: repeating-conic-gradient(#1D1E22 0 25%, #131417 0 50%) 0 0 / 10px 10px; box-shadow: inset 0 0 0 1px #000;
}
.img-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px/1.3 var(--f-py); color: var(--ink); }
.img-name small { display: block; font: 11px/1.3 var(--f-ui); color: var(--ink-3); }
.img-use { padding: 2px 8px; }
.img-list .none { padding: 2px 8px 4px; font-size: 12px; color: var(--ink-3); }
.term-tab.unread::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 1px 6px; border-radius: 50%; vertical-align: middle; background: var(--phosphor); box-shadow: 0 0 6px rgba(127, 240, 178, .6); }

/* Two sides: the one you're working in has its lamp lit, and everything below follows it */
.pane-h h2::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 0; border-radius: 50%; vertical-align: middle;
  background: #2A0D16; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .7), 0 1px 0 var(--metal-edge); }
.pane.focused .pane-h h2::before { background: #9DFFC9; box-shadow: 0 0 6px 1px rgba(127, 240, 178, .75), inset 0 -1px 1px rgba(20, 90, 50, .5); }
.pl.picked { background: rgba(232, 170, 186, .1); box-shadow: inset 2px 0 0 var(--rose); }
.pl.picked .ln { color: var(--rose-hi); }
.pycode:focus { outline: none; }
.pycode:focus-visible { box-shadow: inset 0 0 0 1px var(--accent), inset 0 3px 10px rgba(0, 0, 0, .75), 0 1px 0 var(--metal-edge); }
.pl.masked .pc { color: transparent !important; text-shadow: none; position: relative; }
.pl.masked .pc * { color: transparent !important; }
.pl.masked .pc::after { content: "your turn: write it in the balloon"; position: absolute; left: 0; top: 0; color: var(--ink-3); font-style: italic; font-family: var(--f-ui); font-size: 12px;
  padding: 0 8px; border-radius: 3px; background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 6px, transparent 6px 12px); }
.band-mask { z-index: 3; background: repeating-linear-gradient(135deg, #15161A 0 6px, #111215 6px 12px); box-shadow: inset 0 0 0 1px rgba(232, 170, 186, .25); display: flex; align-items: center; }
.band-mask span { padding-left: 14px; color: var(--ink-3); font: italic 12px var(--f-ui); }
.tip { position: fixed; z-index: 45; }

/* The explain strip: the shape of a sentence, the parts of a line of code */
.ex-shape, .ex-parts, .ex-why-box { margin-top: 10px; }
.ex-shape-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.ex-shape-pat { font: 13.5px/1.5 var(--f-say); color: var(--ink); background: none; padding: 0; }
.ex-slot { color: var(--slot-ink); background: var(--slot-bg); border-radius: 3px; padding: 0 3px; }
.ex-shape-fill { color: var(--ink-2); font-size: 12.5px; }
.ex-shape-tip { margin: 3px 0 0; color: var(--ink-3); max-width: 90ch; }
.ex-roles { gap: 4px 18px; color: var(--ink-2); font-size: 12.5px; }
.ex-roles code { background: #000; padding: 0 4px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--rule); }
.ex-parts ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 18px; }
.ex-parts li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: baseline; color: var(--ink-2); font-size: 12.5px; }
.ex-term { border: 0; cursor: pointer; padding: 1px 6px; border-radius: 3px; font: 500 12px var(--f-py); color: var(--phosphor); background: #000; box-shadow: inset 0 0 0 1px #1F3A2C; }
.ex-term:hover, .ex-term:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(127, 240, 178, .55); text-shadow: 0 0 5px rgba(127, 240, 178, .45); }
.ex-name { font: 500 12px var(--f-py); padding: 1px 6px; border-radius: 3px; background: #000; color: var(--var); box-shadow: inset 0 0 0 1px var(--rule); }
.ex-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 10px 0 0; color: var(--ink-3); font-size: 12px; }
.ex-foot kbd { font-size: 10px; }
.ex-why { font-weight: 500; }
.ex-tutor-say { box-shadow: inset 2px 0 0 var(--rose), inset 0 0 0 1px rgba(232, 170, 186, .14); background: linear-gradient(90deg, rgba(232, 170, 186, .08), transparent 70%); }
.ex-tutor-seen { margin: 6px 0 0; color: var(--ink-3); font-size: 12.5px; }
.ex-tutor-seen .linklike { font-weight: 500; color: var(--ink-2); }
.tip-in-say { font-family: var(--f-say); }
.tip-code { font: 13px/1.5 var(--f-py); }

/* The glossary window (Ctrl+H) */
.gloss {
  position: fixed; z-index: 46; width: min(460px, calc(100vw - 16px)); max-height: min(72vh, 640px); display: flex; flex-direction: column;
  border-radius: 6px; background: linear-gradient(180deg, #1A1B1F, #141518); box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, .04), var(--shadow);
}
.gloss-h { display: flex; align-items: center; gap: 8px; padding: 6px 7px 6px 12px; border-radius: 6px 6px 0 0; background: var(--metal); box-shadow: var(--machined), 0 1px 0 #000; cursor: move; user-select: none; }
.gloss-h h2 { flex: 1; margin: 0; font-size: 14px; color: var(--metal-ink); text-shadow: var(--engrave); }
.gloss-key kbd { font-size: 10px; }
.gloss-search { padding: 8px 10px 6px; }
.gloss-search input { width: 100%; padding: 6px 9px; border: 0; border-radius: 3px; background: var(--field); color: var(--ink); font: 13px var(--f-ui); box-shadow: inset 0 0 0 1px #000, inset 0 2px 5px rgba(0, 0, 0, .7); }
.gloss-search input:focus { outline: 1px solid var(--accent); }
.gloss-body { overflow: auto; padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.gl-entry { padding: 9px 11px 10px; border-radius: 4px; background: var(--card); box-shadow: var(--card-raised); transition: box-shadow .3s; }
.gl-entry.flash { box-shadow: var(--card-raised), 0 0 0 1px var(--rose), 0 0 14px rgba(232, 170, 186, .25); }
.gl-entry h4 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.gl-entry h4 code { font: 600 13.5px var(--f-py); color: var(--phosphor); text-shadow: 0 0 5px rgba(127, 240, 178, .3); background: none; padding: 0; }
.gl-kind { font: 700 9.5px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.gl-entry p { margin: 0; color: var(--ink-2); font-size: 13px; }
.gl-eg { margin: 6px 0 0; padding: 6px 9px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); font: 12.5px/1.5 var(--f-py); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.gl-see { margin-top: 6px !important; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; }
.gl-chip { border: 0; cursor: pointer; padding: 1px 7px; border-radius: 10px; font: 500 11.5px var(--f-py); color: var(--rose-hi); background: rgba(232, 170, 186, .1); box-shadow: inset 0 0 0 1px rgba(232, 170, 186, .3); }
.gl-chip:hover, .gl-chip:focus-visible { outline: none; background: rgba(232, 170, 186, .2); }
.gl-none, .gl-lead { margin: 4px 2px; color: var(--ink-2); font-size: 13px; }
.gl-h { margin: 6px 2px 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--rose); }
.gl-shapes h4 { margin: 4px 2px 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--rose); }
.gl-shapes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.gl-shapes li { display: grid; gap: 2px; padding: 7px 10px; border-radius: 4px; background: var(--card); box-shadow: var(--card-raised); }
.gl-shapes li.here { box-shadow: var(--card-raised), inset 2px 0 0 var(--rose); }
.gl-pat { font: 13px/1.5 var(--f-say); color: var(--ink); background: none; padding: 0; }
.gl-py { font: 12px/1.45 var(--f-py); color: var(--ink-3); background: none; padding: 0; }
.gl-tip { color: var(--ink-3); font-size: 12px; }

/* Project Templates: shelves, kits beside blueprints */
.bp-shelf { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-right: 4px; }
.bp-shelf span { color: var(--rose); }
.bp-plan { border: 0; background: none; padding: 0; font: 600 11px var(--f-ui); letter-spacing: .02em; text-transform: none; color: var(--ink-3); cursor: pointer; }
.bp-plan:hover, .bp-plan:focus-visible { color: var(--rose-hi); outline: none; text-decoration: underline; text-underline-offset: 2px; }
.bp-tag { font: 700 9px/1 var(--f-ui); font-style: normal; letter-spacing: .1em; text-transform: uppercase; padding: 2px 4px 2px; margin-right: 6px; border-radius: 2px; vertical-align: 1px;
  background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined); }
.bp-filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 4px 6px; padding: 4px; border-radius: 4px; background: #050506; box-shadow: var(--sunken); position: sticky; top: 0; z-index: 1; }
.bp-filter { border: 0; cursor: pointer; padding: 3px 9px; border-radius: 3px; background: none; color: var(--ink-3); font: 600 12px var(--f-ui); }
.bp-filter:hover { color: var(--ink); }
.bp-filter.on { background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined), 0 0 0 1px #000; }
.bp-plat { font: 700 9px/1 var(--f-ui); font-style: normal; letter-spacing: .08em; text-transform: uppercase; padding: 2px 4px; margin-right: 5px; border-radius: 2px; vertical-align: 1px; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }
.bp-plat.plat-phone { color: var(--phosphor); box-shadow: inset 0 0 0 1px rgba(127, 240, 178, .35); }
.bp-plat.plat-web { color: var(--var); box-shadow: inset 0 0 0 1px rgba(143, 209, 227, .35); }
.bp-plat.plat-board { color: var(--num); box-shadow: inset 0 0 0 1px rgba(242, 196, 107, .35); }
.bp-lead { margin: -4px 0 10px; color: var(--ink-2); max-width: 72ch; font-size: 14px; }
.bp-kit-steps { list-style: none; margin: 12px 0 0; padding: 6px; display: flex; flex-direction: column; gap: 4px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); }
.bp-kit-steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 7px 10px; border-radius: 4px; background: var(--card); box-shadow: var(--card-raised); }
/* Planning: three stages, presets, previews, and "your plan" beside the steps */
.bld-stages { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 10px; padding: 0; counter-reset: none; }
.bld-stages li { display: flex; align-items: center; gap: 7px; padding: 4px 12px 4px 5px; border-radius: 14px; font: 600 12.5px var(--f-ui); color: var(--ink-3); background: #050506; box-shadow: var(--sunken); }
.bld-stages li + li::before { content: ""; width: 14px; height: 1px; margin-left: -14px; margin-right: 4px; background: var(--rule); }
.bld-stage-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 700 11px var(--f-ui); background: #18191C; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--rule); }
.bld-stages li.now { color: var(--metal-ink); background: var(--metal); box-shadow: var(--machined), 0 0 0 1px #000; text-shadow: var(--engrave); }
.bld-stages li.now .bld-stage-n { background: #1A0D11; color: var(--phosphor); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .7); text-shadow: 0 0 5px rgba(127, 240, 178, .5); }
.bld-stages li.done { color: var(--ink-2); }
.bld-stages li.done .bld-stage-n { color: var(--phosphor); }
.bld-alt { margin: 14px 2px 0; color: var(--ink-3); font-size: 13px; }
.bld-kit { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; }
.bld-kit-main { min-height: 0; display: flex; flex-direction: column; }
.bld-kit-h h3 { display: flex; align-items: center; gap: 8px; }
.bld-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12.5px; }
.bld-preset { border: 0; cursor: pointer; padding: 4px 10px; border-radius: 4px; font: 600 12px var(--f-ui); background: var(--face); color: var(--face-ink); box-shadow: var(--raised); }
.bld-preset:hover { background: var(--face-hover); }
.bld-step-tools { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 4px 0 0 52px; font-size: 12.5px; }
.bld-step-tools .bld-more { margin: 0; }
.bld-step-tools .linklike { font-weight: 600; }
.bld-preview { margin: 8px 0 2px 52px; display: flex; flex-direction: column; gap: 6px; }
.bld-preview pre { margin: 2px 0 0; padding: 7px 10px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); font: 12.5px/1.55 var(--f-say); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.bld-preview-none { margin: 0; }
.bld-plan { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 5px; background: linear-gradient(180deg, #1B1C20, #16171A); box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 255, 255, .05); }
.bld-plan h4 { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--rose); }
.bld-plan-list { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink); }
.bld-plan-list li { padding-left: 2px; }
.bld-plan-list li::marker { color: var(--rose); font: 700 12px var(--f-py); }
.bld-plan-list li span { margin-right: 6px; }
.bld-plan-sum { margin: 2px 0 0; font: 600 12.5px var(--f-ui); color: var(--ink-2); }
.bld-plan-key { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); }
.bld-name-l { font: 600 12px var(--f-ui); color: var(--ink-2); margin-top: 4px; }
#bldName { width: 100%; padding: 7px 9px; font: 13px var(--f-py); }
.bld-go { justify-content: center; padding: 9px 14px; font-size: 14px; }
.bld-change { align-self: flex-start; font-weight: 600; }

/* Changing kits and steps: forms */
.kit-group summary { cursor: pointer; list-style: none; }
.kit-group summary::-webkit-details-marker { display: none; }
.kit-group summary::before { content: "▸ "; color: var(--ink-3); }
.kit-group[open] summary::before { content: "▾ "; }
.kf { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.kf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.kf-grid label, .kf-sec { display: flex; flex-direction: column; gap: 4px; font: 600 12px var(--f-ui); color: var(--ink-2); }
.kf-wide { grid-column: 1 / -1; }
.kf input, .kf select, .kf textarea { padding: 6px 9px; border: 0; border-radius: 3px; background: var(--field); color: var(--ink); font: 13px var(--f-ui); box-shadow: inset 0 0 0 1px #000, inset 0 2px 5px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .05); }
.kf textarea { resize: vertical; line-height: 1.5; }
.kf-sec textarea { font: 13px/1.55 var(--f-say); tab-size: 4; white-space: pre; }
.kf input:focus, .kf select:focus, .kf textarea:focus { outline: 1px solid var(--accent); }
.kf-h { margin: 6px 0 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--rose); }
.kf-steps { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 4px; border-radius: 3px; background: var(--field); box-shadow: var(--sunken); }
.kf-steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px 12px; padding: 6px 8px; border-radius: 4px; background: var(--card); box-shadow: var(--card-raised); }
.kf-steps li.kf-empty { display: block; background: none; box-shadow: none; }
.kf-step-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.kf-id { font: 11px var(--f-py); }
.kf-tog { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.kf-tog input { accent-color: var(--rose); }
.kf-step-btns { display: flex; gap: 4px; }
.kf-add { display: flex; flex-wrap: wrap; gap: 6px; }
.kf-picker { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 4px; background: #111215; box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 255, 255, .04); }
.kf-pick-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.kf-pick-g { margin: 6px 2px 2px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rose); }
.kf-pick { text-align: left; border: 0; cursor: pointer; padding: 6px 9px; border-radius: 3px; background: var(--card); box-shadow: var(--card-raised); color: var(--ink); display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: center; }
.kf-pick span:last-child { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
.kf-pick:hover, .kf-pick:focus-visible { outline: none; box-shadow: var(--card-raised), 0 0 0 1px rgba(232, 170, 186, .45); }
.kf-pick-note { margin: 0; font-size: 12px; }
.kf-depth { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.kf-depth-b { text-align: left; border: 0; cursor: pointer; padding: 8px 10px; border-radius: 4px; background: var(--card); box-shadow: var(--card-raised); color: var(--ink-2); display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.kf-depth-b .depth { align-self: flex-start; }
.kf-depth-b.on { color: var(--ink); box-shadow: var(--card-raised), 0 0 0 1px var(--rose), inset 0 0 14px rgba(232, 170, 186, .1); }
.kf-check { padding: 8px 12px; border-radius: 4px; font-size: 13px; }
.kf-check.ok { color: var(--good); background: rgba(143, 228, 185, .07); box-shadow: inset 2px 0 0 var(--good); }
.kf-check.bad { color: var(--ink); background: rgba(255, 132, 150, .07); box-shadow: inset 2px 0 0 var(--bad); }
.kf-check ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }

/* Changing the builder's questions, kits and steps */
.bld-edit-lib { margin-left: auto; font-weight: 600; }
.kit-ed { min-height: 0; }
.kit-new { flex-direction: row; flex-wrap: wrap; margin: 0 8px 6px; }
.kit-src { margin: 8px 0 0; padding: 10px 12px; font: 13px/1.55 var(--f-say); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 52vh; overflow: auto; }
.bp-errors .kit-link { color: var(--warn); }

/* Scrollbars: a machined rail, a keycap thumb */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: repeating-conic-gradient(#121316 0 25%, #0D0E10 0 50%) 0 0 / 2px 2px; box-shadow: inset 1px 0 0 #000; }
::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #34363D, #2A2C32); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
::-webkit-scrollbar-thumb:hover { background: var(--metal-flat); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: #0D0E10; }
.term-body::-webkit-scrollbar-track { background: transparent; box-shadow: none; }
.term-body::-webkit-scrollbar-thumb { background: rgba(127, 240, 178, .16); background-clip: padding-box; box-shadow: none; }
.term-body::-webkit-scrollbar-thumb:hover { background: rgba(127, 240, 178, .3); background-clip: padding-box; }

/* ---------- Narrow screens ---------- */
/* ---------- The file tree: folders, a ⋯ per file, the start file ---------- */
.side-h::after { order: 1; }
.side-acts { order: 2; display: flex; gap: 4px; letter-spacing: 0; text-transform: none; }
.btn.tiny { padding: 2px 7px; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.tree-row { position: relative; padding-left: calc(var(--depth, 0) * 14px); }
.tree-row .tree-item { width: 100%; padding-right: 30px; }
.tree-row.folder { display: flex; align-items: center; min-height: 26px; }
.tree-folder { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 10px; font-family: var(--f-py); font-size: 12.5px; color: var(--ink-2); }
.tree-folder svg { width: 15px; height: 15px; color: var(--rose-lo); }
.ti-more { position: absolute; right: 4px; top: 6px; width: 24px; height: 22px; border: 0; border-radius: 3px; background: transparent; color: var(--ink-3); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; }
.tree-row:hover .ti-more, .ti-more:focus-visible, .tree-row:focus-within .ti-more { opacity: 1; }
.ti-more:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.ti-more:focus-visible { outline: 1px solid var(--accent); }
.tree-row.folder .ti-more { top: 2px; }
.ti-start { font-family: var(--f-ui); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--good); border: 1px solid rgba(143, 228, 185, .35); border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }
.modal-card.narrow { width: min(560px, 100%); }
.file-row label { min-width: 92px; }
.file-row input, .file-row select { flex: 1; max-width: none; }
.file-row select { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: 13px var(--f-ui); }
.file-how { margin: 4px 0 8px; font-size: 13px; color: var(--ink-2); min-height: 2.6em; }
.file-del { margin-right: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-del-ask { font-size: 12.5px; color: var(--bad); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.plan-empty { padding: 2px 8px 6px; font-size: 12px; color: var(--ink-3); }

/* ---------- The right-hand side for code, notes and data files ---------- */
.side-file { padding: 12px 16px 20px; font-family: var(--f-ui); font-size: 13.5px; line-height: 1.55; }
.md-page h1, .md-page h2, .md-page h3, .md-page h4 { margin: 14px 0 6px; line-height: 1.25; color: var(--rose-hi); }
.md-page h1 { font-size: 21px; } .md-page h2 { font-size: 17px; } .md-page h3 { font-size: 15px; }
.md-page p { margin: 6px 0; }
.md-page ul, .md-page ol { margin: 6px 0; padding-left: 22px; }
.md-page code { font-family: var(--f-py); font-size: 12.5px; background: rgba(255, 255, 255, .06); padding: 0 4px; border-radius: 3px; }
.md-page blockquote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid var(--rose-lo); color: var(--ink-2); }
.md-page hr { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }
.md-code { font-family: var(--f-py); font-size: 12.5px; background: rgba(0, 0, 0, .25); padding: 10px 12px; border-radius: 4px; overflow: auto; white-space: pre; }
.md-link { color: var(--rose-hi); text-decoration: underline dotted; cursor: help; }
.md-pic { color: var(--ink-3); font-style: italic; }
.md-tick { color: var(--good); }
.md-table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.md-table th, .md-table td { border: 1px solid var(--rule); padding: 3px 8px; text-align: left; vertical-align: top; }
.md-table th { background: rgba(255, 255, 255, .04); }
.side-sec { padding: 8px 10px; margin: 0 -10px; border-radius: 3px; cursor: pointer; }
.side-sec:hover { background: rgba(255, 255, 255, .045); }
.side-sec p { margin: 3px 0; }

/* Library: kinds of project and parts */
.lib-search { margin: -4px 0 12px; }
.lib-search input { width: 100%; padding: 8px 12px; border: 0; border-radius: 4px; background: var(--field); color: var(--ink); font: 14px var(--f-ui); box-shadow: var(--sunken); }
.lib-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lib-sec { margin-top: 18px; }
.lib-langs { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 4px; }
.lib-langs th, .lib-langs td { text-align: left; vertical-align: top; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule); }
.lib-langs th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.lib-langs td:first-child { white-space: nowrap; }
.lib-learn { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lib-learn li { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.lib-learn li > span:not(.dim) { color: var(--ink-2); }
.lib-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-url code { font: 12px var(--f-py); color: var(--ink-3); user-select: all; overflow-wrap: anywhere; }
.lib-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 6px; }
.lib-group > .dim { flex: 0 0 100%; font-size: 12px; }
.lib-chip { border: 0; cursor: pointer; padding: 4px 9px; border-radius: 3px; font: 600 12.5px var(--f-ui); color: var(--ink); background: var(--card); box-shadow: var(--card-raised); }
.lib-chip:hover, .lib-chip:focus-visible { color: var(--accent); outline: none; }
.lib-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 8px; padding: 4px; border-radius: 4px; background: #050506; box-shadow: var(--sunken); }
.lib-tab { border: 0; cursor: pointer; padding: 4px 10px; border-radius: 3px; background: none; color: var(--ink-3); font: 600 12.5px var(--f-ui); }
.lib-tab:hover { color: var(--ink); }
.lib-tab.on { background: var(--metal); color: var(--metal-ink); text-shadow: var(--engrave); box-shadow: var(--machined), 0 0 0 1px #000; }
.lib-tab.on .dim { color: var(--metal-ink-2); }
.lib-code-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lib-code { margin: 4px 0 0; padding: 10px 12px; border-radius: 6px; background: var(--paper); font: 13px/1.55 var(--f-say); white-space: pre; overflow: auto; max-height: 46vh; tab-size: 4; }
.lib-made { margin-top: 8px; font-size: 13px; }
.lib-made summary { cursor: pointer; color: var(--ink-2); }
.lib-made .lib-code { font-family: var(--f-py); }
.lib-where { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }

/* Unity mode: one pane of code; the parts said in sentences are dark green, translucent, with a faint glow */
.u-view { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.u-editor { flex: 1; }
.u-gutter { padding: 12px 0; font: 12px/var(--lh) var(--f-py); color: var(--ink-3); text-align: right; will-change: transform; }
.u-gutter .gl.u-in { color: #7FE0A6; }
.u-hl .ul { min-height: var(--lh); }
.u-region { margin: 0 -16px 0 -14px; padding: 0 16px 0 14px; border-radius: 4px; position: relative;
  background: rgba(14, 84, 46, .46); box-shadow: 0 0 9px rgba(72, 214, 134, .16), inset 0 0 0 1px rgba(110, 230, 160, .13); }
.u-region.changed { background: rgba(18, 98, 54, .55); box-shadow: 0 0 11px rgba(72, 214, 134, .24), inset 0 0 0 1px rgba(127, 240, 178, .22); }
.u-float { position: absolute; right: 18px; z-index: 3; border: 0; cursor: pointer; padding: 3px 10px; border-radius: 3px; font: 600 12px var(--f-ui);
  color: #D9FBE6; background: rgba(16, 92, 52, .92); box-shadow: 0 0 10px rgba(72, 214, 134, .35), inset 0 1px 0 rgba(160, 255, 200, .25), 0 0 0 1px #000; }
.u-float:hover { background: rgba(22, 116, 66, .95); }
.u-strip { flex: none; max-height: 7.5em; overflow: auto; margin: 0 7px 7px; padding: 8px 12px; border-radius: 3px; font-size: 13px; color: var(--ink-2); background: var(--field); box-shadow: var(--sunken); }
.u-code { margin: 4px 0 0; font: 12.5px/1.5 var(--f-py); white-space: pre; overflow-x: auto; }
.u-msg { margin-top: 4px; }
.u-msg.err { color: var(--bad); }
.u-msg.warn { color: var(--warn); }
.u-side { display: flex; flex-direction: column; gap: 6px; }
.u-side select { padding: 5px 8px; border-radius: 3px; border: 0; background: var(--field); color: var(--ink); font: 13px var(--f-ui); box-shadow: var(--sunken); }
.u-lang { font-size: 12px; color: var(--ink-3); }
.u-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.u-regions { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.u-regions li { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.u-reg { border: 0; background: none; color: #9FEFC2; cursor: pointer; padding: 4px 6px; font: 13px var(--f-ui); text-align: left; border-radius: 3px; }
.u-reg:hover { background: rgba(16, 92, 52, .35); }
.u-how { padding: 0 12px; }

/* Read mode: the language a file is read as */
.rd-as { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--metal-ink-2); }
.rd-as select, #impLang { padding: 3px 6px; border-radius: 3px; border: 0; background: var(--field); color: var(--ink); font: 12.5px var(--f-ui); box-shadow: var(--sunken); max-width: 180px; }
.role.r-code { color: var(--var); }

@media (max-width: 900px) {
  html, body { height: auto; }
  .app { height: auto; min-height: 100%; }
  .bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; flex-wrap: wrap; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--rule); overflow: visible; padding-bottom: 8px; }
  .tree { flex-direction: row; overflow-x: auto; }
  .tree-item { flex: none; }
  .problems { max-height: 140px; overflow: auto; }
  .work { grid-template-rows: auto auto 320px; }
  .panes { grid-template-columns: minmax(0, 1fr); }
  .pane-say .editor { height: 46vh; min-height: 280px; }
  .pane-py { border-left: 0; border-top: 1px solid var(--rule); }
  .pycode { height: 34vh; min-height: 200px; flex: none; }
  .explain { max-height: none; }
  .ex-map { grid-template-columns: minmax(0, 1fr); }
  .ex-arrow { display: none; }
  .index { position: fixed; top: 0; width: 100%; }
  .modes { margin-left: 0; }
  .brand { flex-wrap: wrap; }
  .work.reading { grid-template-rows: auto 320px; }
  .read-body { grid-template-columns: minmax(0, 1fr); }
  .rcode { height: 46vh; border-right: 0; border-bottom: 1px solid var(--rule); }
  .modal-card.wide { height: 100%; }
  .bp-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .bp-list { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
  .madlib { font-size: 17px; }
  .bld-kit { grid-template-columns: minmax(0, 1fr); }
  .kf-grid, .kf-depth { grid-template-columns: minmax(0, 1fr); }
  .kf-steps li { grid-template-columns: 22px minmax(0, 1fr); }
  .kf-step-btns, .kf-tog { grid-column: 2; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .tree-item, .tpl { transition: background-color .12s, border-color .12s; }
}
