diff --git a/README.md b/README.md
index 179aae3..34eb88f 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n
## What it does
- Parts: NAND, input switch, output pin, lamp, push button, clock, constant 1, ground, hex display, pixel, cable bundle and split, input panel, note.
-- Layout like Figma: a slim top bar (menu, project, circuit, clock, undo, share), a floating bar at the bottom of the canvas with one button per kind of part (Logic, Inputs, Outputs, Wiring, Notes, Connectors, Components) that opens its parts on pointing, and on the left your pinned parts (NAND, AND, OR, NOT, XOR, input, output, lamp, clock to start with; pin and unpin from the bottom bar, kept per browser, components by name) above the circuits list.
+- Layout like Figma: two floating rounded bars and one side panel. The top bar, across the whole width: menu (pause menu) with the project name, "Main" and the way into the open component (each name leads back; every other circuit is a component and opens with a double-click, or the pencil in the Components list), Challenges (campaign, puzzle of the week, puzzles, challenges in a drop-down), the clock, search, undo, sound, settings, help, share and account. The bottom bar: your pinned parts first (NAND, AND, OR, NOT, XOR, input, output, lamp, clock to start with; pin from the lists, right-click to unpin, kept per browser, components by name), then one button per kind of part (Logic, Inputs, Outputs, Wiring, Notes, Connectors, Components) that opens its parts on pointing, and a search that opens quick add. The side panel sits on the left.
- Lamps and output pins pass their signal on: the pin on their right carries the same value, so a lamp can sit in the middle of a wire.
- Gates with more inputs: a placed AND, OR, XOR, NAND or NOR (built in, from the examples, or your own) has an "Inputs" setting from 2 to 16. The wide version is a component built as a balanced tree of the two-input gate (NAND and NOR as the plain gate plus a final inverted one), made once per gate and width in "Wide gates" and reused; transistors count honestly and changes to the two-input gate carry through. Which gates qualify is read off their truth table ([app/lib/logic/wide.ts](app/lib/logic/wide.ts)).
- Campaign (Projects → New campaign): you start with NAND, inputs, outputs, lamps and notes, and no examples. Each challenge opens once the ones it builds on are solved (NOT → AND, OR, SR Latch → …), and your own solution becomes a part you can place. Other basic parts unlock on the way: constants with NOT, the input panel with AND, hex display and pixel with the decoder, cables with Adder 2, the button with the SR latch, the clock with the D latch. Rules in [app/lib/logic/progress.ts](app/lib/logic/progress.ts). Sandbox projects keep everything open.
@@ -21,13 +21,13 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n
- Automatic names: copies continue a series (D0 copied gives D1, D2; A gives B), and so does placing a new input or output after a numbered one. A switch, button, lamp or output pin without a name of its own (or with an automatic one) takes the name of the component pin it gets wired to, made unique (Cin, Cin2); a name typed by hand is kept. On the canvas, a switch, button, clock, lamp or output pin without a name typed by hand shows the name of the component pin it is wired to, dimmed and in italics (or its automatic name, also dimmed); the name follows the wiring as it changes.
- Every circuit is a component. Its input and output nodes become its pins, ordered top to bottom. Double-click a component to open it.
- Lamps and hex displays inside a component show on its box, with their labels, lit by that instance's state. They are laid out in rows the way they sit inside. A checkbox in the inspector turns this off per component.
-- The right panel has four tabs. **Selection**: settings of what you clicked (switches to it when you select something on an idle panel). **Circuit**: name, symbol, group, statistics, and where the transistors are (each kind of part with its count; click a line to select those parts). **Pins**: every input and output of the circuit in pin order, one line each, with its live value (click it to flip a switch, hold it for a button; panel rows are framed under their panel); rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. **Test**: the challenge or puzzle check and the truth table (opens by itself for a challenge). Display and sound preferences are in Settings (gear in the top bar). Both side panels fold away to a strip of icons (the panel icon in their tab row, or [ and ]).
+- The side panel (left) has four tabs. **Selection**: settings of what you clicked (switches to it when you select something on an idle panel). **Circuit**: name, symbol, group, statistics, and where the transistors are (each kind of part with its count; click a line to select those parts). **Pins**: every input and output of the circuit in pin order, one line each, with its live value (click it to flip a switch, hold it for a button; panel rows are framed under their panel); rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. **Test**: the challenge or puzzle check and the truth table (opens by itself for a challenge). Display and sound preferences are in Settings (gear in the top bar). It folds away to a strip of icons (the panel icon in its tab row, or [).
- Box selection: a box that touches no parts selects every wire and cable it crosses (drag across the wires between parts to bundle them). Dragged right to left (green box) it selects everything it touches, parts and wires. Left to right over parts it takes those parts and only the wires lying fully inside, so Delete never catches unrelated wires passing through.
- Wiring many at once: select several parts and drag one wire from one of them to a pin of another part; the others follow onto that part's next pins, in position order (or use "Wire them all to" in the panel).
- Zooming out goes at least far enough to see the whole circuit, further for bigger circuits.
- Several selected parts are edited together: chips to narrow the selection by type, swap them all for another part, rename all top to bottom from a pattern, set every switch to 0 or 1 or flip each, one colour, one clock frequency or note size for all, line them up or spread them evenly, plus make component, connect one by one, unlink, duplicate, delete.
- Transistors: every part shows its count (4 for a NAND, 0 for switches, lamps and cables, the whole inside for a component; the NAND in the palette shows 4T). The count is 4 per CMOS NAND gate the simulator builds, at every depth; a test checks this against the flattened circuit for every example and every wide gate.
-- Clicking anything opens its settings on the right. Parts can be swapped in place (wires stay on the pins in the same position): NAND and components with each other, switch/button/clock/constants with each other, output/lamp/display with each other. Clocks have their own frequency or follow the top bar. Switches and buttons can get a keyboard key. Lamps and displays have colours, notes have sizes, components a name on the canvas. Components can be unpacked into their parts or given their own copy of the definition; any part can have all its wires unlinked.
+- Clicking anything opens its settings in the side panel. Parts can be swapped in place (wires stay on the pins in the same position): NAND and components with each other, switch/button/clock/constants with each other, output/lamp/display with each other. Clocks have their own frequency or follow the top bar. Switches and buttons can get a keyboard key. Lamps and displays have colours, notes have sizes, components a name on the canvas. Components can be unpacked into their parts or given their own copy of the definition; any part can have all its wires unlinked.
- Select parts and press "Make component" to turn them into a new component; wires crossing the selection become pins.
- Gate symbols in IEC 60617 (DIN, default) or ANSI. A component with one output can be drawn as a gate symbol.
- Wires of different signals never share a line: auto-routed wires pick a free column or a detour, and anything still clashing (hand-placed bends) is drawn on its own lane. Crossings are drawn as a bow, triangle, bridge, gap or plain crossing (Settings, the gear in the top bar). Clicking a junction dot selects its whole signal.
diff --git a/app/assets/css/main.css b/app/assets/css/main.css
index af1522a..18f711d 100644
--- a/app/assets/css/main.css
+++ b/app/assets/css/main.css
@@ -57,33 +57,27 @@ kbd {
/* ── Layout ─────────────────────────────────────────────────────── */
.app {
display: grid;
- grid-template-rows: 44px 1fr;
+ grid-template-rows: auto 1fr;
height: 100dvh;
}
.workspace {
- --left: 232px;
- --right: 272px;
+ --left: 272px;
display: grid;
- grid-template-columns: var(--left) 1fr var(--right);
+ grid-template-columns: var(--left) 1fr;
min-height: 0;
}
-.workspace.no-left {
+.workspace.no-panel {
--left: 36px !important;
}
-.workspace.no-right {
- --right: 36px !important;
-}
-
.stage {
position: relative;
min-width: 0;
overflow: hidden;
}
-.palette,
.inspector {
background: var(--panel);
min-height: 0;
@@ -91,12 +85,8 @@ kbd {
flex-direction: column;
}
-.palette {
- border-right: 1px solid var(--border);
-}
-
.inspector {
- border-left: 1px solid var(--border);
+ border-right: 1px solid var(--border);
}
.scroll {
@@ -109,8 +99,7 @@ kbd {
@media (max-width: 1100px) {
.workspace {
- --left: 210px;
- --right: 260px;
+ --left: 252px;
}
}
@@ -119,11 +108,10 @@ kbd {
grid-template-columns: 1fr;
grid-template-rows: 1fr 40%;
}
- .palette {
- display: none;
- }
- .inspector {
- border-left: 0;
+ .workspace > .inspector,
+ .workspace > .rail {
+ order: 2;
+ border-right: 0;
border-top: 1px solid var(--border);
}
}
@@ -328,7 +316,7 @@ kbd {
color: var(--muted);
}
-.palette h3,
+.challenges-panel h3,
.inspector h3 {
font-size: 11px;
font-weight: 700;
@@ -337,8 +325,8 @@ kbd {
color: var(--muted);
}
-.palette h3 {
- padding: 14px 12px 6px;
+.challenges-panel h3 {
+ padding: 14px 6px 6px;
}
.items {
@@ -380,7 +368,7 @@ kbd {
color: var(--accent);
}
-/* Transistor count next to a component in the palette. */
+/* Transistor count next to a component in a parts list. */
.tcount {
font-family: var(--font-mono);
font-size: 10px;
@@ -2198,7 +2186,7 @@ kbd {
color: var(--on);
}
-/* ── Campaign and puzzles (palette) ─────────────────────────────── */
+/* ── Campaign and puzzles (challenges) ─────────────────────────────── */
.campaign,
.weekly {
margin: 12px 12px 4px;
@@ -2657,14 +2645,10 @@ kbd {
min-height: 0;
}
-.rail.left {
+.rail {
border-right: 1px solid var(--border);
}
-.rail.right {
- border-left: 1px solid var(--border);
-}
-
.rail-btn {
display: grid;
place-items: center;
@@ -4224,16 +4208,26 @@ table.board {
/* ── Bottom bar: parts by kind, like Figma's toolbar ────────────── */
.bottom-dock {
position: absolute;
- left: 50%;
+ left: 12px;
+ right: 12px;
bottom: 14px;
z-index: 20;
- transform: translateX(-50%);
+ display: flex;
+ justify-content: center;
+ pointer-events: none;
+}
+
+.bottom-dock > * {
+ pointer-events: auto;
}
.bottom-bar {
display: flex;
align-items: center;
gap: 2px;
+ max-width: 100%;
+ overflow-x: auto;
+ scrollbar-width: none;
padding: 5px;
background: rgb(26 33 43 / 0.96);
border: 1px solid var(--border);
@@ -4246,6 +4240,7 @@ table.board {
.bar-btn {
display: flex;
+ flex-shrink: 0;
align-items: center;
gap: 6px;
height: 34px;
@@ -4472,6 +4467,143 @@ table.board {
color: var(--text);
}
-.palette .tabs button {
- white-space: nowrap;
+/* ── Top bar: floating like the parts bar, across the whole width ─ */
+.top-dock {
+ position: relative;
+ z-index: 30;
+ padding: 8px 8px 6px;
+ background: var(--bg);
+ border-bottom: 1px solid var(--border);
+}
+
+.top-bar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ min-width: 0;
+ padding: 4px;
+ background: rgb(26 33 43 / 0.96);
+ border: 1px solid var(--border);
+ border-radius: 12px;
+ box-shadow:
+ 0 6px 20px rgb(0 0 0 / 0.35),
+ 0 1px 0 rgb(255 255 255 / 0.03) inset;
+}
+
+.tb-group {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+
+.top-bar .bar-btn {
+ height: 32px;
+ padding: 0 9px;
+}
+
+.top-bar .bar-btn:disabled {
+ opacity: 0.35;
+ cursor: not-allowed;
+ background: none;
+}
+
+.top-bar .bar-btn.here:disabled {
+ opacity: 1;
+ color: var(--text);
+ cursor: default;
+}
+
+.top-bar .tb-select {
+ height: 30px;
+ font-size: 12px;
+ border-radius: 8px;
+}
+
+.brand-btn {
+ color: var(--on) !important;
+ max-width: 260px;
+}
+
+.project-name {
+ color: var(--text);
+ font-size: 13px;
+ font-weight: 700;
+}
+
+.crumbs {
+ display: flex;
+ align-items: center;
+ gap: 1px;
+ min-width: 0;
+ overflow: hidden;
+}
+
+.crumb {
+ min-width: 0;
+ max-width: 180px;
+}
+
+.crumb-sep {
+ flex-shrink: 0;
+ color: var(--muted);
+ opacity: 0.6;
+}
+
+.bar-count {
+ font-family: var(--font-mono);
+ font-size: 11px;
+ color: var(--muted);
+}
+
+.top-pop {
+ position: absolute;
+ top: calc(100% + 10px);
+ left: 50%;
+ width: 340px;
+ max-height: min(72vh, 640px);
+ overflow-y: auto;
+ padding: 10px;
+ transform: translateX(-50%);
+ background: rgb(26 33 43 / 0.98);
+ border: 1px solid var(--border);
+ border-radius: 12px;
+ box-shadow: 0 18px 50px rgb(0 0 0 / 0.5);
+ scrollbar-width: thin;
+ scrollbar-color: var(--border) transparent;
+}
+
+.drop-enter-active,
+.drop-leave-active {
+ transition:
+ opacity 0.12s,
+ translate 0.12s;
+}
+
+.drop-enter-from,
+.drop-leave-to {
+ opacity: 0;
+ translate: 0 -4px;
+}
+
+@media (max-width: 1100px) {
+ .top-bar .status {
+ display: none;
+ }
+}
+
+/* Pinned parts at the start of the parts bar. */
+.bar-btn.pinned-part {
+ padding: 0 8px;
+ color: var(--text);
+}
+
+.bar-btn.blocked {
+ opacity: 0.4;
+}
+
+@media (max-width: 1600px) {
+ .bottom-bar:has(.pinned-part) .bar-label {
+ display: none;
+ }
}
diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue
index c6361e5..dfad982 100644
--- a/app/components/editor/App.vue
+++ b/app/components/editor/App.vue
@@ -36,15 +36,13 @@ watch(
Every part you solve becomes yours to use. New parts and challenges open as you go.
+ Build each part from NAND and the parts you already made. Start a challenge, wire it up, then press
+ Check in the side panel.
+ A new logic puzzle every Monday, the same for everyone. Fewest transistors wins.
+ {{ p.inputs.join(', ') }} → {{ p.outputs.join(', ') }}
+ · best {{ best[p.id]!.toLocaleString() }} transistors
+ {{ needsText(c.id) }} {{ c.goal }}
+ {{ c.inputs.join(', ') }} → {{ c.outputs.join(', ') }}
+
+ · best {{ best[c.id]!.toLocaleString() }} transistors
+
+ Puzzles
+
+
+
+
+ Challenges
+
+
+