Skip to content
Verticopolis components

Design system

The UI speaks one language, Windows 3.1 / SimTower chrome: gray faces, two-pixel bevels, navy title bars, press-only feedback. This document is the contract for anyone (human or agent) touching src/styles.css or UI markup. It moved here from Verticopolis/web on 2026-11-20 with the stylesheet; how the web game builds its windows in code is in its docs/ui/.

The stylesheet (src/styles.css) is organized as one generation of CSS in five layers: tokens → base → components → layout/surfaces → media. It is a list of imports: the shared chrome under src/styles/, then the game’s own parts under src/styles/game/ (base, components, one file per screen region, the media blocks), in cascade order. The build inlines them into one sheet, so a rule’s place in that list is its place in the cascade. Put a new rule in the part for its region, and keep a media rule in its media part. There is no “skin layer” that overrides earlier rules; if you find yourself out-specifying an existing rule instead of editing it, you are recreating the archaeology this system replaced.

Everything derives from :root custom properties. Swap these to re-theme.

Token Role
--r-face chrome face (system gray)
--r-hi / --r-light / --r-shadow / --r-dark bevel ramp
--r-title / --r-title-fg title-bar navy / white
--r-ink, --muted body / secondary text
--r-desktop the teal desktop behind full pages (the help site) and a restored window
--r-workspace the game’s own background, the face of a maximized window (an alias of --r-face)
--good / --bad / --bad-ink / --money semantic states (bad-ink is the AA-safe danger text on gray)
--bevel-out / --bevel-in the signature two-pixel bevels (raised / sunken)
--win-shadow the one hard drop shadow floating windows cast
--r-font the UI face (MS Sans Serif stack)

Rule: never hard-code a color that has a token. Quote colors from here. The full token list is in src/styles/retro-tokens.css, and the color schemes in src/styles/schemes/. The schemes’ ids and names, and the html[data-scheme] attribute that switches them, are windows/schemes; the Appearance dialog that picks one is windows/appearance.

Skin lives on classes, never on IDs. IDs may appear in the layout layer for positioning/sizing only.

Gray face, bevel out; :active = bevel in. No hover state on purpose: period chrome gives press feedback only (list rows like .pal-item may hover; buttons may not).

  • .btn.primary: the classic default button, an extra dark ring (0 0 0 1px var(--r-dark)) + bold label. One primary per dialog. Its DOM position encodes default focus: first when the primary should own focus (the emergency’s Pay), last when the safe action must be reached first (destructive confirms). Don’t reorder for looks.
  • .btn.danger: red bold label (--bad-ink) on the same chrome. Destructive actions only (Sell/Bulldoze, slot delete).
  • :disabled: classic GrayText (--r-shadow) on the same raised chrome, default cursor. Never hide a disabled button; show why it can’t be pressed.
  • .btn.xs: title-bar sized, for the ✕ in window title bars and the coach’s Skip button. It NEVER grows on touch. A 36px ✕ inflates every navy bar and a wider one stretches into a pill (both shipped bugs, since fixed). Instead, coarse pointers get an invisible tap halo (::after { inset: -8px }) for a ~34px effective target with zero visual change. A game builds each ✕ in one place and reuses it, so the markup stays the same everywhere.

Gray face + --bevel-out + --win-shadow. Applied to: the modal box, the editor card, the inspector card, the hint strip, the onboarding coach card. .win.docked (the Tools palette) keeps the face/bevel but drops the floating drop shadow.

Navy, white, bold, 13px, 3px 8px padding, flex with the ✕ (.btn.xs) pinned right via margin-left: auto. Every dismissible window wears one; the modal’s is sticky and full-bleed (negative margins derived from the --pad-y/--pad-x tokens on .modal-box; never hand-write those offsets).

Closable windows (the Map, Tower Info, the Bulletin, the room card, the hover card and the dialogs) add .win-closable and wear the compact bar the Map window introduced: 11px, 1px 2px 1px 6px padding, set 2px inside the window’s frame, with a 20 by 18 ✕. The docked Tools palette keeps the full-size bar.

.win-title.sm is the explicit mini variant (11px, uppercase, 2px 6px) for section strips inside a window. The statistics dialog’s Overview/Tenancy/Milestones headers use it. The palette’s “Tools” strip is a full-size .win-title.

--r-hi + --bevel-in. The File Manager idiom: the Bulletin log, the saves slot list, dialog textareas all sit on wells. (The Schedule dialog’s floors grid is NOT a well: it scrolls on the chrome face with its own .es-grid treatment, a deliberate departure so its sticky header reads as chrome.)

A well you type into (same recipe + font: inherit).

Two columns (1fr auto), muted keys, right-aligned tabular values. Used by the editor stats, the Tower Info window’s stats, and statistics-dialog columns (milestone columns override to left-aligned descriptions).

The Windows 95 menu bar (#menubar, src/styles/game/menubar.css) sits on the chrome face above the top bar: 12px titles that press in (--bevel-style inset) while their menu is open, menus as floating .win-style boxes (--bevel-out + --win-shadow) with a navy highlight row, a ✓ for a checked item, gray for a disabled one, and etched separators. Behavior follows the WAI-ARIA menubar pattern (src/ui/menuBar.ts), and the bar draws itself from a model with lit-html (src/ui/menuBarTemplate.ts). The status bar (#statusbar) is a row of sunken cells (inset shadow pair) on the face; an empty cell hides itself. Its cells, and the Information bar’s meters and buttons above the tower (#topbar, src/styles/game/topbar.css), are drawn with lit-html by src/ui/bars/statusBar.ts and src/ui/bars/topBar.ts. On a phone the menu bar grows to 14px with finger-sized rows and keeps a navy logo badge at its left, and the status bar is left out.

Toast = small gray alert, left edge colored by kind (good/bad/money). Evalbar = the original-style sunken satisfaction gauge.

Every dismissible floating surface is a window: .win frame + .win-title bar + .btn.xs ✕. The shared modal is ModalShell (src/ui/uiModal.ts): a caller hands it a title and a body as lit templates, and it draws the rest of the grammar around them (the box, the title bar, the ✕ and a notice line under the title). The modal ✕ routes through the dialog’s cancel path (same as Esc), and keyboard focus lands on the primary action when a dialog opens, because the ✕ is drawn only after the dialog is shown.

A closable window moves by a drag on its title bar (src/ui/movableWindow.ts): it stays whole inside the tower view (a dialog, inside the browser window), a double-click on the bar puts it back, and the bar shows the move cursor and a “Drag to move” tooltip. The Map remembers its spot per layout class; the room card (docked or anchored) stays where it is dropped until it closes; a dialog opens centered again. A press on a control in the bar (the ✕) never starts a move.

The first-run splash is box art, not UI: it keeps its dusk palette and cream/amber buttons (.splash-btn), and the amber primary never leaves the splash. It shares interaction grammar only: bevel press states and a visible (amber) focus ring. Do not “unify” it into the gray chrome.

  • pointer: coarse → dialog/editor buttons get min-height: 36px.
  • Focus is always visible: navy :focus-visible ring globally, amber on the splash (navy vanishes on the night sky).
  • Reduced motion (OS preference or the in-game toggle) disables all decorative CSS animation; the canvas scene freezes its own ambience separately.
  • The traffic cue carries its level in how many bars are filled, so color is never its only cue.
  1. No skin on IDs. Surface-specific classes may tune skin using the tokens; IDs never paint chrome. Two annotated one-offs are grandfathered: #topbar’s raised strip and #stage’s sunken viewport.
  2. Edit, don’t override. One generation of CSS: change the rule that owns the property; never add a later rule to win by specificity.
  3. New surface? Compose it from .win/.win-title/.btn/.well before inventing anything.
  4. One primary per dialog. Its DOM position is a focus decision, not a style one (see .btn.primary). Danger is a label color, not a new button shape.
  5. Press-only feedback on buttons. No :hover chrome.
  6. Three responsive tiers, not scattered queries: a phone block (max-width: 767px, or a short landscape screen max-width: 1023px and max-height: 599px), a tablet block (768–1023px wide and min-height: 600px, docked layout), and desktop (≥1024px). Add responsive tweaks to the matching block. A game that reads the phone tier in script mirrors the phone query; keep the two in sync. A landscape block after the phone block covers a phone held sideways (the short half of the phone query plus orientation: landscape). It docks the tools as a column on the left instead of the bottom strip and stays inside the phone tier; under 340px tall, or under 540px wide where the top bar wraps further, a further block puts the category tabs back on one row. The desk on a touchscreen has its own file, styles/game/desk-pocket.css, keyed on the game’s classes rather than the tiers: body.desk-touch (44 px taskbar, menu rows and title-bar touch areas) and body.desk-pocket (the full-screen tower window whose .desk-pocket-body grid holds Info, Tools and the tower, arranged by orientation and width, with the Map floating over the tower at its phone size).