:root {
  --backpack-gap: 6px;
  /* The line along the bottom while the lands near are fetched and laid (src/land-pointers.js onProgress). */
  --loading-color: #29e0ff;
  --loading-height: 2px;
  --loading-ease: 0.4s;
  --loading-boot-width: 22vw;
  --loading-boot-time: 1.1s;
  /* The appearance editor (src/avatar/editor.js): a solid panel beside the avatar, its tiles in a grid. */
  --appearance-width: 380px;
  --appearance-top: 72px;
  --appearance-tile: 76px;
  --appearance-swatch: 26px;
  --appearance-worn: #4fc3f7;
  --appearance-off: 0.4;
  /* The emotes' panel (src/avatar/emotes.js), a menu. */
  --emotes-width: 220px;
  /* The Profile (src/progress/profile.js), a front modal, and its colours. */
  --profile-width: 560px;
  --profile-height: 640px;
  --profile-radius: 16px;
  --profile-badge: 46px;
  --profile-bg: linear-gradient(160deg, rgb(28 22 58 / 0.97), rgb(10 18 36 / 0.97));
  --profile-head-bg: linear-gradient(120deg, rgb(124 77 255 / 0.22), rgb(0 191 165 / 0.12));
  --profile-edge: rgb(179 136 255 / 0.35);
  --profile-shadow: 0 24px 64px rgb(0 0 0 / 0.55);
  --profile-backdrop: rgb(4 6 14 / 0.55);
  --profile-gold: #ffd54f;
  --profile-violet: #b388ff;
  --profile-green: #69f0ae;
  --profile-blue: #4fc3f7;
  --profile-red: #ff6e6e;
  --profile-ink: #1a1030;
  --profile-track: rgb(255 255 255 / 0.1);
  --profile-tile: rgb(255 255 255 / 0.06);
  --profile-xp: linear-gradient(90deg, #7c4dff, #00e5ff);
  --profile-badge-bg: radial-gradient(circle at 35% 30%, #fff3b0, #ffb300 70%);
  --profile-coin-bg: linear-gradient(135deg, #ffe082, #ffb300);
  /* The Quality panel (src/quality.js), a menu. */
  --quality-width: 240px;
  /* The places' panel (src/places.js), left of the bar's buttons, and a public place's image in it. */
  --places-width: 340px;
  --places-top: 72px;
  /* The menus (Places, the Inventory, Quality, Emotes): each opens from the same place up and is never taller than the window.
     --menu-right is the edge left of the bar's column of buttons: every panel of the editor along the right keeps to it too. */
  --menu-bottom: calc(var(--gap) * 2 + var(--map-button));
  --menu-right: calc(var(--gap) * 2 + var(--map-button));
  --menu-max-height: calc(100vh - var(--places-top) - var(--menu-bottom));
  --places-image: 96px;
  /* A place's picture where it has no image of its own, drawn: its parcel from above. */
  --places-own-image: 64px;
  /* A package's picture where it has none of its own: its category's icon (src/inventory.js). */
  --place-icon: 28px;
  /* A land of the index seen from above (src/land-preview.js): its ground low to high, the sea, plants, builds. */
  --land-preview-size: 48px;
  --land-preview-ground-0: #3d4a33;
  --land-preview-ground-1: #4c5b3c;
  --land-preview-ground-2: #5b6c45;
  --land-preview-ground-3: #6b7c4f;
  --land-preview-ground-4: #7d8c5c;
  --land-preview-ground-5: #919c6b;
  --land-preview-ground-6: #a6ad7f;
  --land-preview-ground-7: #bcbf96;
  --land-preview-water: #3b6c8f;
  --land-preview-plant: #2f6b2a;
  --land-preview-built: #d9cdb8;
  --places-invited-width: 340px;
  --places-people-width: 360px;
  --panel-bg: rgb(8 12 20 / 0.62);
  --panel-border: rgb(255 255 255 / 0.08);
  --text: #e6ecf5;
  --text-dim: #8b97a8;
  --accent: #4fc3f7;
  --danger: #ff6b6b;
  --gap: 12px;
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Multiplayer: solid panels, no blur — what is drawn over the planet every frame costs the GPU. */
  --solid-bg: rgb(8 12 20 / 0.86);
  --name-bg: rgb(8 12 20 / 0.55);
  --field-bg: rgb(255 255 255 / 0.05);
  --backdrop: rgb(0 0 0 / 0.35);
  --control-radius: 6px;
  --map-button: 40px;
  /* The card over a user's dot on the map (src/map-avatars.js), as the previous OVGrid's map had it. */
  --map-card-width: 220px;
  --map-card-radius: 12px;
  --map-card-bg: linear-gradient(165deg, rgb(18 19 27 / 0.97), rgb(10 10 15 / 0.98));
  --map-card-border: rgb(255 255 255 / 0.12);
  --map-card-you: #4ff3ff;
  --map-card-other: #ff9a3c;
  /* The index's lands on the map (src/map-avatars.js): the name over a land that stands alone. */
  --map-card-land: #59e673;
  --map-land-gap: 6px;
  /* Its box at its widest, read by src/map-avatars.js too: lands whose names would overlap are one dot. */
  --map-land-width: 120px;
  --map-land-height: 22px;
  /* The map's search of its lands (src/places.js), at the top while the map is open. */
  --map-search-width: 380px;
  /* A parcel's sky (src/parcel-sky.js): its keeper's dialog. */
  --parcel-sky-width: 300px;
  /* What shows behind a page on a face where it has no background of its own (src/build/page-face.js). */
  --page-paper: #fff;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font: 13px/1.4 var(--font);
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* The lands near, fetched and laid: a line along the bottom growing to the right, gone once they are. */
#loading {
  position: fixed;
  inset: auto 0 0;
  height: var(--loading-height);
  background: var(--loading-color);
  transform: scaleX(var(--loading-progress, 0));
  transform-origin: left;
  transition: transform var(--loading-ease) ease-out, opacity var(--loading-ease) ease-out;
  pointer-events: none;
  z-index: 1;
}
#loading[data-done] { opacity: 0; }
/* While the world opens — the page's code, the GPU, the first frame — there is nothing to measure: a stretch of it
   slides along, from the page's first paint (src/main.js takes `data-boot` away with the first frame drawn). */
#loading[data-boot] {
  right: auto;
  width: var(--loading-boot-width);
  transform: none;
  animation: loading-boot var(--loading-boot-time) ease-in-out infinite alternate;
}
@keyframes loading-boot {
  from { translate: 0; }
  to { translate: calc(100vw - 100%); }
}

/* The map: a globe to drag round. */
#view.map { cursor: grab; }
#view.map:active { cursor: grabbing; }

/* A page on a face (src/build/page-face.js): its own document in a shadow root, laid out at the size its
   face's shape gives it and drawn into the face's texture — a child of the view where HTML-in-Canvas draws
   it, else held out of sight for its clicks; never painted by the page, never hit by the pointer, and never
   in the page's selection — a drag across the view, a Cmd+A —, which HTML-in-Canvas would draw onto the face:
   its fields keep their own, as one types in them. */
.page-face {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--page-width);
  height: var(--page-height);
  overflow: hidden;
  contain: strict;
  container-type: size;
  background: var(--page-paper);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Out of sight, yet laid out and shown to the browser, so that a field of a page there takes the keyboard. */
.page-faces {
  position: fixed;
  top: 0;
  left: -100000px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* The card over a user's dot on the map (src/map-avatars.js): a child of the view, drawn into the map
   by the GPU (HTML-in-Canvas) — laid out, styled and hit as any element, never painted by the page. */
.map-card {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--map-card-width);
  padding: 10px 14px;
  border: 1px solid var(--map-card-border);
  border-radius: var(--map-card-radius);
  background: var(--map-card-bg);
  color: var(--text);
  font: 13px/1.35 var(--font);
  cursor: default;
}

.map-card p { margin: 0; }

.map-card-name {
  padding-right: 18px;
  color: var(--map-card-other);
  font-weight: 600;
}

.map-card[data-kind="you"] .map-card-name { color: var(--map-card-you); }


.map-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 6px;
  border-radius: 6px;
  object-fit: cover;
}

.map-card-who {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

.map-card-where {
  margin-top: 4px;
  font-size: 12px;
}

.map-card-close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: 16px/1 var(--font);
  cursor: pointer;
}

.map-card-close:hover { color: var(--text); }

/* Clicked, a card's actions (src/places.js): someone else's invites them to where you are; a place's
   are the places panel's — Go, Save, Invite. */
.map-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.map-card-actions button {
  padding: 4px 10px;
  border: 1px solid var(--map-card-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.map-card-actions button:hover:not(:disabled) { border-color: var(--accent); }

.map-card-actions button:disabled {
  color: var(--text-dim);
  cursor: default;
}

.hud,
.help {
  position: fixed;
  padding: var(--gap);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.hud {
  top: var(--gap);
  left: var(--gap);
}

.hud[hidden],
.help[hidden] { display: none; }

.hud dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px var(--gap);
  margin: 0;
}

.hud dt { color: var(--text-dim); }

.hud dd {
  margin: 0;
  font-family: var(--mono);
  text-align: right;
}

.help {
  bottom: var(--gap);
  left: var(--gap);
}

.help h2 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.help ul {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 4px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  text-align: center;
}

.error {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  max-width: min(640px, 90vw);
  margin: 0;
  padding: var(--gap);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--panel-bg);
  color: var(--danger);
  font-family: var(--mono);
  white-space: pre-wrap;
}

/* ---- Multiplayer (src/multiplayer.js) ------------------------------------------------------- */

/* Names over the other users' avatars, placed by --x / --y (the point above the head). */
.names {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.name {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--name-bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 100%));
  will-change: transform;
}

.name-who {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}

/* Its level and title, as its hello says them (src/progress/). */
.name-rank {
  color: var(--accent);
  font-size: 10px;
}

.name-rank:empty,
.name.far .name-rank { display: none; }

/* Unsigned: a name anyone could take. */
.name:not(.verified) .name-text { font-style: italic; }

.name.far {
  padding: 1px 6px;
  font-size: 10px;
  opacity: 0.75;
}

.name.far .name-who { display: none; }

/* The map: the planet from outside, its parcels drawn on it (src/parcel-map.js). Solid, no blur. */
.map-toggle {
  position: fixed;
  right: var(--gap);
  bottom: var(--gap);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.map-toggle svg {
  width: 22px;
  height: 22px;
}

.map-toggle:hover,
.map-toggle:focus-visible { border-color: var(--accent); }

.map-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* The parcel you are in, beside the map's button: face, x, y and region. */
.parcel-here {
  position: fixed;
  right: calc(var(--gap) * 2 + var(--map-button));
  bottom: var(--gap);
  display: flex;
  align-items: center;
  height: var(--map-button);
  margin: 0;
  padding: 0 var(--gap);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 12px var(--mono);
  pointer-events: none;
}

.parcel-here:empty { display: none; }

/* What E or a click does where you aim, by the aim (src/main.js), and the Stand up button while seated. */
.aim {
  --aim-x: 50%;
  --aim-y: 50%;
  --aim-offset: 18px;
  position: fixed;
  left: var(--aim-x);
  top: var(--aim-y);
  transform: translate(var(--aim-offset), var(--aim-offset));
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--panel-bg);
  color: var(--text);
  font: 13px/1.5 var(--font);
  white-space: nowrap;
  pointer-events: none;
}

.stand {
  --stand-bottom: 64px;
  position: fixed;
  left: 50%;
  bottom: var(--stand-bottom);
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  cursor: pointer;
}

.stand:hover,
.stand:focus-visible { border-color: var(--accent); }

/* Recording a route as one drives (src/build/recorder.js): over the stand button, red while it records. */
.record {
  --record-above: 44px;
  --record-on: #e5484d;
  bottom: calc(var(--stand-bottom) + var(--record-above));
}

.record.recording {
  border-color: var(--record-on);
  color: var(--record-on);
}

/* While a field of a page on a face has the keyboard: where what is typed goes (src/main.js). */
.page-typing {
  --page-typing-bottom: 112px;
  --page-typing-width: 560px;
  position: fixed;
  left: 50%;
  bottom: var(--page-typing-bottom);
  transform: translateX(-50%);
  max-width: min(var(--page-typing-width), calc(100vw - 2 * var(--gap)));
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.5 var(--font);
  text-align: center;
  pointer-events: none;
}

/* A second line in the hint: what O does at the helm of a ship of one's own (its autopilot). */
.aim-pilot:not([hidden]) {
  --aim-pilot-gap: 2px;
  display: block;
  margin-top: var(--aim-pilot-gap);
}

/* A package's box's options by the aim (src/aim-menu.js), as Second Life shows them. */
.aim-menu {
  --aim-x: 50%;
  --aim-y: 50%;
  --aim-offset: 18px;
  --aim-menu-width: 200px;
  position: fixed;
  left: var(--aim-x);
  top: var(--aim-y);
  transform: translate(var(--aim-offset), var(--aim-offset));
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: var(--aim-menu-width);
  padding: 6px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.5 var(--font);
}

.aim-menu-title {
  margin: 0 6px 4px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aim-menu-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aim-menu-options button {
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.aim-menu-options .aim-menu-marked {
  border-color: var(--accent);
  background: var(--field-bg);
}

.aim-menu-said {
  margin: 0 6px;
  font-size: 12px;
}

.aim[hidden],
.aim-menu[hidden],
.aim-menu-said[hidden],
.stand[hidden] { display: none; }

/* A parcel's sky (src/parcel-sky.js): its keeper's dialog, from the right button on its ground. */
.parcel-sky {
  width: min(var(--parcel-sky-width), calc(100vw - 2 * var(--gap)));
  padding: calc(var(--gap) * 1.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.parcel-sky::backdrop { background: var(--backdrop); }

.parcel-sky-form {
  display: grid;
  gap: 8px;
}

.parcel-sky h2 {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.parcel-sky-where,
.parcel-sky-status {
  margin: 0;
  color: var(--text-dim);
}

.parcel-sky-status:empty { display: none; }

.parcel-sky label {
  display: grid;
  gap: 2px;
  color: var(--text-dim);
}

.parcel-sky output { color: var(--text); }

.parcel-sky select {
  padding: 6px 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}

.parcel-sky select:focus {
  border-color: var(--accent);
  outline: none;
}

.parcel-sky input { accent-color: var(--accent); }

.parcel-sky-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.parcel-sky button {
  padding: 4px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.parcel-sky button:hover,
.parcel-sky button:focus-visible { border-color: var(--accent); }

.parcel-sky button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

.parcel-sky button.ghost { background: none; }

/* You, as the others see you: opens the identity door. */
.presence {
  position: fixed;
  top: var(--gap);
  right: var(--gap);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px var(--gap);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.presence:hover,
.presence:focus-visible { border-color: var(--accent); }

.presence-who {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

.identity {
  width: min(440px, calc(100vw - 2 * var(--gap)));
  padding: calc(var(--gap) * 1.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
}

.identity::backdrop { background: var(--backdrop); }

.identity h2 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.identity-hint {
  margin: 0 0 var(--gap);
  color: var(--text-dim);
}

.identity-name {
  display: grid;
  gap: 4px;
  margin-bottom: var(--gap);
  color: var(--text-dim);
}

.identity input,
.identity textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.identity input:focus,
.identity textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* Grows with the phrase: a whole 24-word phrase checked without scrolling. */
.identity textarea {
  min-height: calc(3lh + 18px);
  padding-right: 36px;
  font-family: var(--mono);
  field-sizing: content;
  resize: none;
}

.identity-phrase {
  position: relative;
  margin-bottom: var(--gap);
}

.identity-phrase .icon {
  position: absolute;
  top: 6px;
  right: 6px;
}

.identity-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px var(--gap);
  margin: 0 0 var(--gap);
}

.identity-facts dt { color: var(--text-dim); }

.identity-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.identity-facts code {
  font-family: var(--mono);
  font-size: 12px;
}

.identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.identity button {
  padding: 6px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.identity button:hover,
.identity button:focus-visible { border-color: var(--accent); }

.identity button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

.identity button.ghost { background: none; }

.identity button.icon {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-dim);
  line-height: 0;
}

.identity .icon svg {
  width: 16px;
  height: 16px;
}

.identity-warning {
  margin: var(--gap) 0 0;
  color: var(--danger);
}

/* The backpack (src/backpack.js): one's own kept in a Gist of one's own — its token, and how it stands. */
.identity-backpack,
.identity-backpack label {
  display: grid;
  gap: var(--backpack-gap);
}
.identity-backpack-status:empty { display: none; }

.identity-status {
  min-height: 1lh;
  margin: 8px 0 0;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  .help { display: none; }
}

/* ---- Sample garden (src/garden-labels.js) --------------------------------------------------- */

/* The species' names over the plants, placed by --x / --y (the point over each top). */
.garden-labels {
  --label-bg: rgb(8 12 20 / 0.5);
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.garden-label {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 1px 6px;
  border-radius: var(--radius);
  background: var(--label-bg);
  color: var(--text);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 100%));
  will-change: transform;
}

.garden-label.far {
  font-size: 10px;
  opacity: 0.7;
}

/* ---- Build mode (src/build/edit/editor.js) --------------------------------------------------- */

/* Spare: a bar of modes at the bottom, a palette of shapes above it, a card beside the selected
   prim; the rulers' figures and the measures over the view. */
.build-ui,
.build-labels {
  --build-glass: rgb(10 14 22 / 0.74);
  --build-line: rgb(255 255 255 / 0.1);
  --build-hover: rgb(255 255 255 / 0.1);
  --build-pressed: rgb(79 195 247 / 0.22);
  --build-field: rgb(0 0 0 / 0.3);
  --build-danger: #ff8a80;
  --build-disabled: 0.35;  /* opacity of a control that does nothing: someone else's, or locked */
  --build-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  --build-card-width: 288px;  /* room for its four tabs */
  --build-card-room: 112px;   /* what a card leaves of the screen's height — a tree's, a prim's with its Motion open —: 16 px over it, 96 px under it for the bar */
  --build-ink: #04121a;
  --build-beside-gap: 16px;   /* from what a measure stands beside to its near end */
}

.build-ui[hidden],
.build-palette[hidden],
.build-card[hidden] { display: none; }

.build-bar,
.build-palette,
.build-card {
  border: 1px solid var(--build-line);
  background: var(--build-glass);
  box-shadow: var(--build-shadow);
  backdrop-filter: blur(10px);
}

/* Centred along the bottom, never wider than the window leaves it between the HUD's columns of round buttons
   (--menu-right on each side, as every panel along the right keeps clear of them): what does not fit scrolls along it —
   a trackpad's swipe, its thin scrollbar, the wheel (src/build/edit/editor.js) —, never cut off at the window's edges. */
.build-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 2 * var(--menu-right));
  padding: 6px;
  border-radius: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  transform: translateX(-50%);
}

.build-bar > * { flex-shrink: 0; }

.build-sep {
  align-self: stretch;
  width: 1px;
  margin: 4px;
  background: var(--build-line);
}

.build-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.build-icon svg,
.build-shape svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.build-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.build-icon:hover,
.build-shape:hover { background: var(--build-hover); }

.build-icon[aria-pressed="true"],
.build-icon[aria-expanded="true"] {
  background: var(--build-pressed);
  color: var(--accent);
}

.build-grid,
.build-hole {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.build-stats {
  padding: 0 8px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.build-palette {
  position: fixed;
  left: 50%;
  bottom: 76px;
  display: grid;
  grid-template-columns: repeat(7, 74px);
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  transform: translateX(-50%);
}

.build-shape {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.build-shape svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

.build-shape[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--build-pressed);
  color: var(--accent);
}

/* FFORMS: a tab for each style, its pieces under it — 300 in all, the grid scrolling where they are many. */
.build-fforms {
  --fforms-columns: 8;
  --fforms-cell: 64px;
  grid-template-columns: 1fr;
  max-height: var(--fforms-height, min(58vh, 520px));
  overflow-y: auto;
}

.build-fforms-tabs {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -10px -10px 4px;
  padding: 10px 10px 6px;
  background: var(--build-glass);
}

.build-fforms-tab {
  padding: 4px 10px;
  border: 1px solid var(--build-line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.build-fforms-tab:hover { background: var(--build-hover); }

.build-fforms-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--build-pressed);
  color: var(--accent);
}

.build-fforms-grid {
  display: grid;
  grid-template-columns: repeat(var(--fforms-columns), var(--fforms-cell));
  gap: 4px;
}

.build-fforms .build-shape svg {
  width: 40px;
  height: 40px;
  stroke-width: 1;
}

/* What the pointer does now, above the bar; out of the way while the palette is open. */
.build-hint {
  position: fixed;
  left: 50%;
  bottom: 74px;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--build-glass);
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.build-palette:not([hidden]) ~ .build-hint { display: none; }

/* Beside the selected prim, placed by --x / --y; gone while dragging. */
.build-card {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: var(--build-card-width);
  padding: 12px;
  border-radius: 14px;
  font-size: 12px;
  transform: translate(var(--x, 0px), var(--y, 0px));
  transition: opacity 0.15s;
}

.build-card.build-away {
  opacity: 0;
  pointer-events: none;
}

/* Panels moved by their heads (src/build/edit/editor.js, movable): grabbed by the title or a bare
   part, never by their buttons; a double-click gives them back their own place. */
.build-card-head,
.build-materials-head,
.build-particle-head {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.build-dragging .build-card-head,
.build-dragging .build-materials-head,
.build-dragging .build-particle-head { cursor: grabbing; }

.build-card-head button,
.build-materials-head button,
.build-particle-head button { cursor: pointer; }

.build-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.build-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

/* More icons than the head has room for beside its title go on in a row under them, never squeezed. */
.build-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.build-card-actions .build-icon {
  flex: none;
  width: 30px;
  height: 30px;
}

.build-card-actions .build-icon svg {
  width: 17px;
  height: 17px;
}

.build-card .build-danger:hover { color: var(--build-danger); }

/* Locked, or someone else's: its icons grey, the padlock alone live on one's own. */
.build-card .build-icon:disabled {
  opacity: var(--build-disabled);
  background: transparent;
  cursor: default;
}

.build-size {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  align-items: center;
  gap: 6px;
}

/* Where a seat sits one, adjusted: its hips in its prim's frame (m), its turn (°), and its pose. */
.build-seat {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto 1fr auto;
  align-items: center;
  gap: 6px;
}

.build-seat select { grid-column: 1 / -1; }

.build-size label,
.build-seat label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
}

.build-size input,
.build-seat input {
  width: 100%;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

.build-unit { color: var(--text-dim); }

/* A solid's bodies on its Shape tab: adding one, choosing one, its numbers. */
.build-solid-add,
.build-solid-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 6px;
}

.build-solid-numbers { grid-template-columns: var(--build-solid-label, 34px) repeat(3, 1fr) auto; }

.build-solid-last { grid-template-columns: 1fr auto; }

.build-solid-label { color: var(--text-dim); }

.build-solid-numbers input {
  width: 100%;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

.build-solid-bodies {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.build-solid-body,
.build-solid-button {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.build-solid-body[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.build-solid-button:disabled { opacity: 0.5; cursor: default; }

.build-colors {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

.build-swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 50%;
  background: var(--swatch, var(--text-dim));
  cursor: pointer;
}

.build-swatch[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The card's tabs, under its colours: one panel at a time — the material, the shape, the motion, the script. */
.build-card-tabs {
  display: flex;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--build-line);
}

.build-card-tab {
  padding: 5px 7px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.build-card-tab:hover { background: var(--build-hover); }

.build-card-tab[aria-selected="true"] {
  background: var(--build-pressed);
  color: var(--text);
}

.build-shaping[hidden],
.build-surface[hidden],
.build-motion[hidden],
.build-colours[hidden] { display: none; }

/* A card with its Motion open is never taller than the screen leaves it over the bar, as a tree's card is: what a route
   says — its speed, its stops, its points, where it calls, how long its round takes, what it runs on — is many rows, and
   what does not fit of them scrolls within it, its head and its tabs staying where they are. */
.build-card:has(> .build-motion:not([hidden])) { max-height: calc(100vh - var(--build-card-room)); }
.build-motion {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* An object's own tabs — a vehicle's Colours and Motion —, on its card where a part's tabs are not. */
.build-card.build-group .build-object-tabs:not([hidden]) { display: flex; }

/* A vehicle's colours (src/build/edit/colours.js): a row of swatches for each of its slots, a colour of one's own,
   Random. A material's swatch, its average colour, ringed dashed. */
.build-colours { gap: 8px; }

.build-looks-row {
  display: grid;
  grid-template-columns: var(--looks-label, 48px) 1fr auto;
  align-items: center;
  gap: 6px;
}

.build-looks-label {
  color: var(--text-dim);
  font-size: 11px;
}

.build-looks-swatches {
  display: grid;
  grid-template-columns: repeat(var(--looks-columns, 9), 1fr);
  gap: 4px;
}

.build-swatch-material { border-style: dashed; }

.build-looks-own {
  width: var(--looks-own, 22px);
  height: var(--looks-own, 22px);
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.build-looks-random {
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.build-looks-random:hover { background: var(--build-hover); }
.build-looks-random:disabled { opacity: 0.5; cursor: default; }

/* A paint's finish: gloss, satin, matte. */
.build-looks-finishes { display: flex; gap: 4px; }
.build-finish {
  padding: 4px 9px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.build-finish:hover { background: var(--build-hover); }
.build-finish[aria-pressed="true"] { border-color: var(--text); background: var(--build-hover); }
.build-finish:disabled { opacity: 0.5; cursor: default; }

.build-params {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.build-param {
  display: grid;
  grid-template-columns: 88px 1fr 40px;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
}

.build-param input {
  width: 100%;
  accent-color: var(--accent);
}

.build-param output {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

/* The rulers' figures, their hint and the measures, over the view by --x / --y. */
.build-labels {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.build-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgb(8 12 20 / 0.55);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 50%));
}

.build-label.build-hint-label {
  color: var(--text-dim);
  font-family: var(--font);
}

.build-label.build-measure {
  padding: 2px 7px;
  background: var(--accent);
  color: var(--build-ink);
  font-weight: 600;
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 160%));
}

/* A measure beside what it measures, not over it: a route's point's height, its arrow left clear. */
.build-label.build-measure.build-beside {
  transform: translate(calc(var(--x, 0px) + var(--build-beside-gap)), calc(var(--y, 0px) - 50%));
}

body.building #view { cursor: default; }
body.build-placing #view { cursor: crosshair; }

/* Building leaves room for the bar and the card: the controls' list is in the hint. */
body.building .help { display: none; }

/* Where builds go: shared with the planet, or kept here until signed in. */
.build-sharing {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--build-line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.build-sharing.build-shared {
  border-color: var(--accent);
  color: var(--accent);
  cursor: default;
}

.build-card.build-readonly .build-shaping,
.build-card.build-readonly .build-card-tab[data-tab="shape"] { display: none; }

/* Several things selected — an object, a clone, a few prims: the card gives what they share, not a prim's size, colour or shape. */
.build-card.build-group .build-size,
.build-card.build-group .build-colors,
.build-card.build-group .build-card-tabs,
.build-card.build-group .build-shaping { display: none; }

.build-card-actions .build-icon[hidden] { display: none; }

/* The rectangle Shift drags out on the ground, placed by --x / --y, sized by --w / --h. */
.build-marquee {
  --build-marquee-fill: rgb(79 195 247 / 0.12);
  position: fixed;
  top: 0;
  left: 0;
  width: var(--w, 0px);
  height: var(--h, 0px);
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--build-marquee-fill);
  pointer-events: none;
  transform: translate(var(--x, 0px), var(--y, 0px));
}

.build-marquee[hidden] { display: none; }

/* The texture bank, on the right: its materials by category and subcategory, each tile its preview lit through its relief.
   Also the frame of every panel of the editor along the right — the vegetation, the rocks, Land, Exchange, the bridge and
   road tools —, which all stand at the menus' edge, left of the bar's column of round buttons (--menu-right): none over it,
   and switching from one to another does not move a panel's right edge. */
.build-materials {
  --build-materials-width: 300px;
  --build-materials-clear: 84px;  /* clear of the bar */
  --build-materials-top: 76px;    /* clear of the name, top right (.presence) */
  --build-materials-moved-height: min(640px, calc(100vh - 32px));
  --build-tile: 76px;
  position: fixed;
  top: var(--build-materials-top);
  right: var(--menu-right);
  bottom: var(--build-materials-clear);
  display: flex;
  flex-direction: column;
  width: min(var(--build-materials-width), calc(100vw - 3 * var(--gap) - var(--map-button)));
  border: 1px solid var(--build-line);
  border-radius: 14px;
  background: var(--build-glass);
  box-shadow: var(--build-shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* Moved, a window of its own where it was left, no longer along the right. */
.build-materials.build-moved {
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  height: var(--build-materials-moved-height);
  transform: translate(var(--x, 0px), var(--y, 0px));
}

.build-materials[hidden],
.build-shelf[hidden],
.build-shelf-row[hidden],
.build-material[hidden] { display: none; }

.build-materials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 6px 14px;
}

.build-materials-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.build-materials-search {
  margin: 0 12px 8px;
  padding: 7px 10px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.build-materials-list {
  flex: 1;
  min-height: 0;
  padding: 0 12px 12px;
  overflow-y: auto;
}

.build-shelf h3 {
  margin: 12px 0 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.build-shelf h4 {
  margin: 8px 0 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
}

.build-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--build-tile), 1fr));
  gap: 6px;
}

.build-material {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 10px;
  text-align: center;
  cursor: pointer;
}

.build-material img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
}

.build-material span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-material:hover {
  background: var(--build-hover);
  color: var(--text);
}

.build-material[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--build-pressed);
  color: var(--text);
}

/* Where from: the bank's materials, or GIPHY's GIFs and stickers (src/build/edit/giphy-panel.js). */
.build-materials-tabs {
  margin: 0 12px 8px;
  padding-top: 0;
  border-top: 0;
}

.build-materials-bank,
.build-materials-giphy,
.build-materials-page,
.build-materials-pattern {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.build-materials-bank[hidden],
.build-materials-giphy[hidden],
.build-materials-page[hidden],
.build-materials-pattern[hidden],
.build-pattern-tuning[hidden],
.build-pattern-own[hidden],
.build-giphy-said[hidden],
.build-giphy-key[hidden],
.build-giphy-more[hidden] { display: none; }

.build-giphy-kinds {
  display: flex;
  gap: 2px;
  margin: 0 12px 8px;
}

.build-giphy-kinds .build-card-tab[aria-checked="true"] {
  background: var(--build-pressed);
  color: var(--text);
}

.build-giphy-list {
  flex: 1;
  min-height: 0;
  padding: 0 12px 8px;
  overflow-y: auto;
}

.build-giphy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--build-tile), 1fr));
  gap: 6px;
}

.build-giphy-item img {
  background: var(--build-field);
  object-fit: contain;
}

.build-giphy-said {
  margin: 0 12px 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.build-giphy-key {
  display: flex;
  gap: 6px;
  margin: 0 12px 8px;
}

.build-giphy-key input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.build-giphy-key button,
.build-giphy-more,
.build-giphy-off,
.build-page-foot button {
  padding: 6px 10px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.build-giphy-more {
  width: 100%;
  margin-top: 8px;
}

.build-giphy-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--build-line);
}

.build-giphy-credit {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

/* A page of the face's own (src/build/edit/page-panel.js): its HTML written in, as a script is. */
.build-page-about {
  margin: 0 12px 8px;
  color: var(--text-dim);
  font-size: 12px;
}

.build-materials-page .build-page-code {
  flex: 1;
  width: auto;
  min-height: 160px;
  margin: 0 12px;
  resize: none;
}

.build-page-note {
  margin: 8px 12px 0;
  color: var(--build-danger);
  font-size: 12px;
}

.build-page-note[hidden] { display: none; }

.build-page-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 10px;
}

.build-page-foot button:disabled { opacity: 0.5; cursor: default; }

.build-page-count {
  margin-left: auto;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}

/* The effect a page's face is drawn through (src/build/edit/page-panel.js): its name, then how strong, fast and large, and its colour. */
.build-page-effect {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 8px;
  font-size: 12px;
}

.build-page-effect[hidden],
.build-page-effect [hidden] { display: none; }

.build-page-tuning { flex-wrap: wrap; }

.build-page-slider {
  flex: 1;
  min-width: 60px;
  accent-color: var(--accent);
}

.build-page-colour {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: none;
}

/* A pattern worked out on a face (src/build/edit/pattern-panel.js): its kind, its sliders, each with its value, its colours. */
.build-materials-pattern {
  --pattern-gap: 8px;
  gap: var(--pattern-gap);
  padding: 10px 12px;
  font-size: 12px;
}

.build-pattern-about {
  margin: 0;
  color: var(--text-dim);
}

.build-pattern-tuning {
  display: flex;
  flex-direction: column;
  gap: var(--pattern-gap);
}

/* A pattern's own sliders, below those every pattern has (src/build/edit/pattern-panel.js). */
.build-pattern-own {
  display: flex;
  flex-direction: column;
  gap: var(--pattern-gap);
  padding-top: var(--pattern-gap);
  border-top: 1px solid var(--build-line);
}

.build-pattern-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-pattern-label {
  flex: 0 0 72px;
  color: var(--text-dim);
}

.build-pattern-name {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

.build-pattern-slider {
  flex: 1;
  min-width: 60px;
  accent-color: var(--accent);
}

.build-pattern-value {
  flex: 0 0 48px;
  color: var(--text);
  font-family: var(--mono);
  text-align: right;
}

.build-pattern-colour {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: none;
}

.build-pattern-multi {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--text-dim);
}

/* Who writes on its actions, and what of them stays (src/build/edit/page-panel.js): its owner's to say. */
.build-page-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 40%;
  overflow: auto;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--build-line);
  font-size: 12px;
}

.build-page-rules[hidden],
.build-page-rules [hidden] { display: none; }

.build-page-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-page-label {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
}

.build-page-who,
.build-page-address {
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

.build-page-address { flex: 1; font-family: var(--mono); }

.build-page-rules button {
  padding: 4px 8px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.build-page-rules button:disabled,
.build-page-rules select:disabled { opacity: 0.5; cursor: default; }

.build-page-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.build-page-person {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--build-line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
}

.build-page-person button { padding: 0 6px; border: 0; }

.build-page-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-page-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.build-page-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-left: 8px;
}

.build-page-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-page-by {
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
}

/* The selected prim's surface: its material, how it lies, and how much of it lets the world through.
   One column no wider than the card: a long material name is cut short, never widening every row. */
.build-surface,
.build-surface-lay { grid-template-columns: minmax(0, 1fr); }

.build-surface {
  display: grid;
  gap: 6px;
}

.build-surface-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* The material shown, its swatch and name: a button that opens the materials at it. */
.build-surface-pick {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.build-surface-pick:hover { background: var(--build-hover); }

.build-surface-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.build-surface-swatch[hidden],
.build-surface-row[hidden] { display: none; }

/* Up to two lines beside the swatch, so that a long name still shows whole. */
.build-surface-name {
  display: -webkit-box;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.build-face {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--build-line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
}

.build-face[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.build-surface-head .build-icon {
  width: 26px;
  height: 26px;
}

.build-surface-head .build-icon svg {
  width: 15px;
  height: 15px;
}

.build-surface-lay {
  display: grid;
  gap: 4px;
}

.build-surface-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 11px;
}

.build-surface-row > span:first-child { width: 72px; }

.build-surface-row input[type="number"] {
  width: 58px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

/* The light's switch takes what is left of its row, beside how far it reaches; so do the particles' presets. */
.build-light,
.build-particles {
  flex: 1;
  min-width: 0;
  padding: 3px 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

/* The particles' colour: a small swatch at the end of their row. */
.build-tint {
  flex: none;
  width: var(--build-swatch, 28px);
  height: var(--build-swatch, 28px);
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
}

/* The slider takes what is left of the row, and no more: its own width would push its value out of the card. */
.build-surface-row input[type="range"] {
  flex: 1;
  width: 0;
  min-width: 0;
}

.build-surface-row output {
  flex: none;
  width: 34px;
  color: var(--text);
  font-family: var(--mono);
  text-align: right;
}

.build-card.build-group .build-surface { display: none; }

/* A small icon at the end of a card's row: the particles' window. */
.build-row-icon {
  flex: none;
  width: var(--build-swatch, 28px);
  height: var(--build-swatch, 28px);
  border-radius: 6px;
}

.build-row-icon svg {
  width: 16px;
  height: 16px;
}

/* The particles window (src/build/edit/particle-window.js): along the right, as the materials are — at the
   menus' edge, left of the bar's column of buttons —, or where it was moved to; a few plain rows, their
   values beside them. */
.build-particle-window {
  --build-particle-width: 300px;
  --build-particle-top: 76px;    /* clear of the name, top right (.presence) */
  --build-particle-clear: 84px;  /* clear of the bar */
  position: fixed;
  top: var(--build-particle-top);
  right: var(--menu-right);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(var(--build-particle-width), calc(100vw - 3 * var(--gap) - var(--map-button)));
  max-height: calc(100vh - var(--build-particle-top) - var(--build-particle-clear));
  padding: 0 12px 12px;
  border: 1px solid var(--build-line);
  border-radius: 14px;
  background: var(--build-glass);
  box-shadow: var(--build-shadow);
  backdrop-filter: blur(10px);
  font-size: 12px;
  overflow-y: auto;
}

.build-particle-window.build-moved {
  top: 0;
  right: auto;
  left: 0;
  transform: translate(var(--x, 0px), var(--y, 0px));
}

.build-particle-window[hidden],
.build-particle-body[hidden],
.build-particle-empty[hidden] { display: none; }

.build-particle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
}

.build-particle-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.build-particle-body {
  display: grid;
  gap: 6px;
}

.build-particle-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
}

/* Its values are longer than the card's percentages: centimetres, metres a second. */
.build-particle-window .build-surface-row output { width: 52px; }

/* ---- Vegetation (src/build/edit/vegetation.js) ------------------------------------------------- */

/* The species in a panel along the right, as the materials are (one of the two at a time): plant
   one, or paint a forest with a brush; the selected tree's card. */
.build-vegetation {
  --build-tile: 72px;
  --build-species-sky: radial-gradient(circle at 50% 35%, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0.02) 70%);
}

.build-vegetation-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 12px 8px;
  padding: 3px;
  border: 1px solid var(--build-line);
  border-radius: 10px;
  background: var(--build-field);
}

.build-vegetation-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.build-vegetation-mode svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.build-vegetation-mode:hover { color: var(--text); }

.build-vegetation-mode[aria-checked="true"] {
  background: var(--build-pressed);
  color: var(--accent);
}

.build-vegetation-brush {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 6px;
}

.build-vegetation-brush[hidden] { display: none; }

.build-vegetation-brush .build-params {
  flex: 1;
  margin: 0;
}

.build-vegetation-brush .build-param { grid-template-columns: 56px 1fr 64px; }

/* The land tools (src/build/edit/terraform.js), along the right as the materials are: Second Life's Land
   panel — its seven tools, the bulldozer's size and strength, Apply over the land selected. Short, like the
   bridge and road tools' panels (.build-tool, below): as tall as what it holds, not the bank's full height. */
.build-land,
.build-tool { bottom: auto; }

.build-land.build-moved,
.build-tool.build-moved { height: auto; }

.build-land-tools { grid-template-columns: 1fr 1fr; }

.build-land-tools .build-vegetation-mode {
  justify-content: flex-start;
  padding: 0 10px;
}

.build-land-dozer { margin: 0 12px 8px; }
.build-land-dozer .build-param { grid-template-columns: 64px 1fr 56px; }

.build-land-rock {
  margin-top: 6px;
  padding: 5px 14px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
}

.build-land-rock:hover { background: var(--build-hover); }

.build-land-rock[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--build-pressed);
  color: var(--text);
}

.build-land-title {
  margin: 0 0 2px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.build-land-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 12px;
}

.build-land-apply {
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--build-pressed);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.build-land-apply:hover { background: var(--build-hover); }

.build-land-apply:disabled {
  border-color: var(--build-line);
  background: var(--build-field);
  opacity: 0.45;
  cursor: default;
}

.build-land-selected {
  color: var(--text-dim);
  font-size: 11px;
}

.build-species img {
  background: var(--build-species-sky);
  object-fit: contain;
}

/* ---- The bridge and road tools' panels (src/build/edit/bridge.js, road.js) ---------------------------
   The editor's own panels — a head to drag them by, a body padded as the others' and scrolled within —, kept
   short (above) and, as every .build-materials panel is, left of the bar's column of round buttons at any
   width of the window (--menu-right, the menus' edge): the column hid the text of a panel that stood under it.
   Their tiles are a picture over a name — the bridge's styles drawn in the text colour, the road's surfaces the
   bank's own previews —; their choices rows of a label and a control, every control as wide; their help smaller
   and dimmer, under a divider. */
.build-tool {
  --build-tool-label: 80px;   /* the rows' labels */
  /* Where it stands and moved alike (a moved one took the bank's moved height, 640 px: taller than where it stood). */
  max-height: calc(100vh - var(--build-materials-top) - var(--build-materials-clear));
}

.build-style-picture {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 2;
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
}

.build-style-picture svg {
  width: 78%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.build-style-picture path { vector-effect: non-scaling-stroke; }

/* The road's tiles are what it is, a real surface: the bank's own preview of the material it lays, as the bank's tiles show
   theirs, in the frame of the bridge's drawings — every tile of the two panels one shape. */
.build-tool .build-material img {
  aspect-ratio: 3 / 2;
  background: var(--build-field);
}

.build-tool-row {
  display: grid;
  grid-template-columns: var(--build-tool-label) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--text);
  font-size: 12px;
}

/* The first row under the tiles stands 12 px below them, whichever row it is (the road's Look shows only for a kind with more
   than one): 4 px under the shelf, which no margin collapses into, and the row's own 8. */
.build-tool .build-shelf { padding-bottom: 4px; }

.build-tool-row .build-hole {
  width: 100%;
  min-width: 0;
}

.build-tool-row :disabled { opacity: var(--build-disabled); }

.build-tool-note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--build-line);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.45;
}

/* ---- Animals (src/build/edit/animals.js) ----------------------------------------------------------
   A tool's panel as the bridge's and the road's are: the species a designer puts, each drawn from its side in its own
   colours over the field's tone; how many the next herd is; and the herd taken — whose it is, its number, Take away. */
.build-animals {
  --build-animals-gap: 8px;   /* between the herd taken's rows */
}

.build-animal-picture { object-fit: contain; }

.build-animals-herd {
  display: grid;
  gap: var(--build-animals-gap);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--build-line);
}

.build-animals-herd[hidden] { display: none; }

.build-animals-herd h3 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.build-animals-herd .build-tool-note,
.build-animals-herd .build-tool-row {
  margin: 0;
  padding: 0;
  border: 0;
}

.build-animals-actions {
  display: flex;
  gap: var(--build-animals-gap);
}

/* ---- Families (src/build/edit/families.js): a kind's presets — the rocks' — in a panel as the
   vegetation's, a family armed as a species is; More like this on the card. This planet's families
   first, each of one's own with its button to take it off the shelf; Save as a family on the card. */
.build-families {
  --build-forget-size: 22px;
  --build-forget-inset: 5px;
}

.build-families-tip {
  margin: 0 12px 8px;
  color: var(--text-dim);
  font-size: 11px;
}

.build-like {
  align-self: flex-start;
  margin-top: 2px;
}

.build-own {
  position: relative;
  min-width: 0;
}

.build-own > .build-material { width: 100%; }

.build-own-forget.build-icon {
  position: absolute;
  top: var(--build-forget-inset);
  right: var(--build-forget-inset);
  width: var(--build-forget-size);
  height: var(--build-forget-size);
  border-radius: 6px;
  background: var(--build-glass);
  opacity: 0;
}

.build-own-forget.build-icon svg {
  width: 14px;
  height: 14px;
}

.build-own:hover .build-own-forget,
.build-own:focus-within .build-own-forget { opacity: 1; }

.build-own-forget.build-icon:hover { color: var(--build-danger); }

.build-family-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-family-name.build-materials-search {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.build-family { margin-top: 2px; }

.build-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-tree-row select {
  flex: 1;
  min-width: 0;
}

/* The selected tree's card: a card as the prims' is, a class of its own (the editor's is one card).
   Never taller than the screen leaves it over the bar (its place keeps 16 px over it and 96 px under
   it): with its trunk's controls, what does not fit scrolls within it. */
.build-tree-card {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: var(--build-card-width);
  max-height: calc(100vh - var(--build-card-room));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid var(--build-line);
  border-radius: 14px;
  background: var(--build-glass);
  box-shadow: var(--build-shadow);
  backdrop-filter: blur(10px);
  font-size: 12px;
  transform: translate(var(--x, 0px), var(--y, 0px));
  transition: opacity 0.15s;
}

.build-tree-card[hidden] { display: none; }

.build-tree-card.build-away {
  opacity: 0;
  pointer-events: none;
}

.build-tree-card .build-danger:hover { color: var(--build-danger); }

.build-tree-card .build-params { margin-top: 0; }

.build-tree-card.build-group .build-params { display: none; }

/* The bar as wide as what it holds (it starts half way across): one more button, no wrapping — scrolled along where the
   window is narrower than that (.build-bar, above). */
.build-bar { width: max-content; }

/* Shaping the selected tree, on tabs as a part's card has them: its Shape — species, crown, main
   parameters, kept as a species — and its Material: its colours and glow. */
.build-tree-shape,
.build-tree-look {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.build-tree-shape[hidden],
.build-tree-shape [hidden],
.build-tree-look[hidden],
.build-tree-look [hidden],
.build-tree-card .build-card-tabs[hidden] { display: none; }

.build-tree-shape .build-params,
.build-tree-look .build-params { margin-bottom: 2px; }

.build-tree-colour {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
}

.build-tree-colour input {
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

.build-tree-name.build-materials-search {
  flex: 1;
  min-width: 0;
  margin: 0;
}

/* A kind's parameters in the card, drawn from its list: a choice across the row, a seed and its dice. */
.build-shaping > .build-params:first-child { margin: 0 0 8px; }

.build-shaping > .build-params:empty { display: none; }

.build-param select {
  grid-column: 2 / -1;
  min-width: 0;
  height: 26px;
}

.build-param input[type="number"] {
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
}

.build-param .build-icon {
  width: 32px;
  height: 26px;
  justify-self: end;
}

/* A route's points: how many, how far, how long — then edit and clear. */
.build-route { grid-template-columns: 88px 1fr 32px 32px; }
.build-route output { text-align: left; }

/* The height of its point taken last: a number, and what it is in. */
.build-height { grid-template-columns: 88px 1fr 56px; }

/* A light's zone and a light switch's zones: a name, or names between commas, in what is left of the row. */
.build-zones { grid-template-columns: 88px 1fr; }
.build-light-zone,
.build-zones input {
  flex: 1;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--build-line);
  border-radius: 6px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

/* The card's script (src/build/edit/script-panel.js, src/scripts/): its source, Run and Stop, how it
   runs here and what it printed or why it stopped — a part's card, or a plant's, wider while it is shown. */
.build-card.build-scripting,
.build-tree-card.build-scripting {
  --build-script-width: 440px;
  width: min(var(--build-script-width), calc(100vw - 16px));
}

.build-script {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.build-script[hidden],
.build-card.build-group .build-script { display: none; }

.build-script-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-script-examples {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--build-line);
  border-radius: var(--control-radius);
  background: var(--build-field);
  color: var(--text);
  font: inherit;
}

.build-script-state {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}

.build-script-state[data-state="running"] { color: var(--accent); }
.build-script-state[data-state="error"] { color: var(--build-danger); }

.build-script-run,
.build-script-stop {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--build-line);
  border-radius: var(--control-radius);
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.build-script-run {
  border-color: var(--accent);
  color: var(--accent);
}

.build-script-run:hover,
.build-script-stop:hover { background: var(--build-hover); }

.build-script-run:disabled,
.build-script-stop:disabled {
  opacity: 0.4;
  cursor: default;
}

.build-script-code {
  --build-script-lines: 14;
  box-sizing: border-box;
  width: 100%;
  min-height: calc(var(--build-script-lines) * 1.45em);
  padding: 6px 8px;
  border: 1px solid var(--build-line);
  border-radius: var(--control-radius);
  background: var(--build-field);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre;
  tab-size: 2;
  overflow: auto;
  resize: vertical;
}

.build-script-code:focus { outline: 1px solid var(--accent); }
.build-script-code[readonly] { color: var(--text-dim); }

.build-script-size {
  align-self: flex-end;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
}

.build-script-size.build-script-over { color: var(--build-danger); }

.build-script-log {
  max-height: 120px;
  margin: 0;
  padding: 6px 8px;
  overflow: auto;
  border-radius: var(--control-radius);
  background: var(--build-field);
  font-family: var(--mono);
  font-size: 11px;
  list-style: none;
}

.build-script-log[hidden] { display: none; }

.build-script-log li {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.build-script-log li[title] { cursor: pointer; }
.build-script-error { color: var(--build-danger); }

/* Builds as JSON (src/build/edit/exchange.js): one pasted or dropped in from anyone's AI, or what is
   selected written out — the materials' column, its text the most of it. */
.build-exchange {
  --build-exchange-gap: 10px;
  --build-exchange-text-min: 140px;
  --build-exchange-land-report-min: 56px;
  gap: var(--build-exchange-gap);
  padding-bottom: 12px;
  /* Never taller than its place: the box gives way first, then the land's report, and in a short window it scrolls. */
  overflow-y: auto;
}

.build-exchange > * { flex-shrink: 0; }
.build-exchange > .build-exchange-text,
.build-exchange > .build-exchange-land { flex-shrink: 1; }

.build-exchange.build-exchange-over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.build-exchange-intro {
  margin: 0 14px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

.build-exchange-intro a,
.build-exchange-link { color: var(--accent); }

.build-exchange-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.build-exchange-text {
  flex: 1;
  min-height: var(--build-exchange-text-min);
  margin: 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: 11px/1.4 var(--mono);
  white-space: pre;
  resize: none;
}

.build-exchange-report {
  max-height: 30%;
  margin: 0 14px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.4;
}

.build-exchange-report p { margin: 2px 0; }
.build-exchange-totals { color: var(--text); }
.build-exchange-note { color: var(--text-dim); }
.build-exchange-error { color: var(--build-danger); }

.build-exchange-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 12px;
}

.build-exchange-button {
  padding: 6px 10px;
  border: 1px solid var(--build-line);
  border-radius: 8px;
  background: var(--build-field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

/* The lands' section: after a line, its title naming the parcel looked at, its buttons, then its own report — which scrolls, so the buttons stay in sight. */
.build-exchange-land {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: var(--build-exchange-gap);
  margin: 0 12px;
  padding-top: var(--build-exchange-gap);
  border-top: 1px solid var(--build-line);
}

.build-exchange-land > * { flex-shrink: 0; margin-inline: 0; }

.build-exchange-land-title {
  margin: 0 2px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.build-exchange-land-report {
  flex: 0 1 auto;
  min-height: var(--build-exchange-land-report-min);
  max-height: none;
  margin-inline: 2px;
}
.build-exchange-land-report:empty { display: none; }

.build-exchange-address {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-exchange-address a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.build-exchange-dialog {
  max-width: var(--build-dialog-width, 28em);
  padding: 16px;
  border: 1px solid var(--build-line);
  border-radius: 12px;
  background: var(--solid-bg);
  color: var(--text);
}
.build-exchange-dialog::backdrop { background: var(--build-dialog-backdrop, rgba(0, 0, 0, 0.45)); }
.build-exchange-dialog-title {
  margin: 0 0 8px;
  font-size: 15px;
}
.build-exchange-dialog-text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}
.build-exchange-token {
  width: var(--build-token-width, 14em);
  margin-inline-end: 0.4em;
  font: inherit;
}
.build-exchange-button:hover { background: var(--build-hover); }

.build-exchange-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.build-exchange-primary {
  border-color: var(--accent);
  background: var(--build-pressed);
}

.build-exchange-map img {
  display: block;
  width: 100%;
  margin-top: 6px;
  border-radius: 6px;
}

/* ---- Appearance (src/avatar/editor.js) ------------------------------------------------------ */

/* Its button, above the map's. */
.appearance-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 2 + var(--map-button));
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.appearance-toggle svg {
  width: 22px;
  height: 22px;
}

.appearance-toggle:hover,
.appearance-toggle:focus-visible,
.appearance-toggle[aria-pressed="true"] { border-color: var(--accent); }

.appearance-toggle[aria-pressed="true"] { color: var(--accent); }

/* The panel: solid, no blur, scrolled within. */
.appearance {
  position: fixed;
  top: var(--appearance-top);
  right: var(--gap);
  bottom: calc(var(--gap) * 5 + var(--map-button) * 4);
  display: flex;
  flex-direction: column;
  width: min(var(--appearance-width), calc(100vw - 2 * var(--gap)));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
}

.appearance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap) var(--gap) 0;
}

.appearance h2 {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.appearance h3 {
  margin: var(--gap) 0 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.appearance button {
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.appearance button:hover,
.appearance button:focus-visible { border-color: var(--accent); }

.appearance-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
}

.appearance-close svg {
  width: 16px;
  height: 16px;
}

.appearance-tabs {
  display: flex;
  gap: 4px;
  padding: var(--gap) var(--gap) 0;
}

.appearance-tabs button {
  flex: 1;
  padding: 6px 0;
}

.appearance-tabs button[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.appearance-tabs button:disabled {
  opacity: var(--appearance-off);
  cursor: default;
}

.appearance-note {
  margin: var(--gap) 0 6px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

.appearance-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--gap) var(--gap);
}

.appearance-bodies {
  display: flex;
  gap: 6px;
  margin-top: var(--gap);
}

.appearance-bodies button {
  flex: 1;
  padding: 6px 0;
}

.appearance-bodies button[aria-checked="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.appearance-colours {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.appearance-colours .swatch {
  width: var(--appearance-swatch);
  height: var(--appearance-swatch);
  padding: 0;
  border-radius: 50%;
  background: var(--swatch);
}

.appearance-colours .swatch[aria-pressed="true"] { outline: 2px solid var(--appearance-worn); outline-offset: 1px; }

.appearance-colours input[type="color"] {
  width: var(--appearance-swatch);
  height: var(--appearance-swatch);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.appearance-categories {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: var(--gap) 0 6px;
  background: var(--solid-bg);
}

.appearance-categories button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 2px;
}

.appearance-categories img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.appearance-categories button[aria-selected="true"] { border-color: var(--accent); }

.appearance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--appearance-tile), 1fr));
  gap: 6px;
}

.appearance-grid button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 4px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.appearance-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.appearance-grid button[aria-pressed="true"] {
  border-color: var(--appearance-worn);
  box-shadow: inset 0 0 0 1px var(--appearance-worn);
}

.appearance-grid .none { color: var(--text-dim); }

.appearance-robot-colours {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--appearance-tile), 1fr));
  gap: 6px;
  margin-top: var(--gap);
}

.appearance-robot-colours[hidden] { display: none; }

.robot-swatch {
  display: grid;
  gap: 4px;
  padding: 4px;
  font-size: 11px;
}

.robot-swatch::before {
  content: "";
  height: var(--appearance-swatch);
  border-radius: 4px;
  background: linear-gradient(90deg, var(--robot-body) 0 50%, var(--robot-trim) 50% 85%, var(--robot-eyes) 85%);
}

.robot-swatch[aria-pressed="true"] {
  border-color: var(--appearance-worn);
  box-shadow: inset 0 0 0 1px var(--appearance-worn);
}

.appearance-status {
  min-height: 1.4em;
  margin: 0;
  padding: 0 var(--gap);
  color: var(--text-dim);
  font-size: 12px;
}

.appearance-actions {
  display: flex;
  gap: 6px;
  padding: var(--gap);
  border-top: 1px solid var(--panel-border);
}

.appearance-actions button {
  flex: 1;
  padding: 6px 0;
}

.appearance-actions button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

/* The AO's sets, and a row a state or an emote slot: its name, its choice, a try. */
.appearance-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appearance-sets button {
  padding: 6px 10px;
}

.appearance-sets button[aria-pressed="true"] {
  border-color: var(--appearance-worn);
  color: var(--appearance-worn);
}

.appearance-rows {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
}

.appearance-rows label {
  color: var(--text-dim);
  font-size: 12px;
}

.appearance-rows select {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}

.appearance-rows button {
  padding: 5px 8px;
}

/* While the avatar is turned by a drag, the pointer says so. */
#view.appearance-turning { cursor: grab; }

/* ---- Profile (src/progress/profile.js) ------------------------------------------------------- */

/* Its button, the column's eighth: above the build's. */
.profile-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 8 + var(--map-button) * 7);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.profile-toggle svg {
  width: 22px;
  height: 22px;
}

.profile-toggle:hover,
.profile-toggle:focus-visible,
.profile-toggle[aria-pressed="true"] { border-color: var(--accent); }

.profile-toggle[aria-pressed="true"] { color: var(--accent); }

/* The one front modal among the HUD's menus (docs/decisions.md, «The Profile, a front modal»): a <dialog> in the
   window's middle, its head spare and fixed — level, who, title, coins, XP — and its tabs scrolling under it. */
.profile {
  width: min(var(--profile-width), calc(100vw - 2 * var(--gap)));
  max-height: min(var(--profile-height), calc(100vh - 2 * var(--gap)));
  padding: 0;
  border: 1px solid var(--profile-edge);
  border-radius: var(--profile-radius);
  background: var(--profile-bg);
  color: var(--text);
  box-shadow: var(--profile-shadow);
  overflow: hidden;
}

.profile[open] { display: flex; }

.profile::backdrop {
  background: var(--profile-backdrop);
  backdrop-filter: blur(3px);
}

.profile-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

/* The head: the medal, who and the title, coins and the close button on one row; the XP bar under them. */
.profile-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px 14px;
  padding: 18px 18px 14px;
  background: var(--profile-head-bg);
}

.profile-badge {
  display: grid;
  place-items: center;
  align-content: center;
  width: var(--profile-badge);
  height: var(--profile-badge);
  border-radius: 50%;
  background: var(--profile-badge-bg);
  color: var(--profile-ink);
  line-height: 1;
}

.profile-badge small { font-size: 8px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.profile-badge b { font-size: 20px; }

.profile-who { display: grid; gap: 2px; min-width: 0; }

.profile-name {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The titles earned, a badge each: the one worn lit, another worn with a click. */
.profile-titles { display: flex; flex-wrap: wrap; gap: 4px; }

.profile-titles button {
  padding: 1px 8px;
  border: 1px solid var(--profile-edge);
  border-radius: 999px;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.profile-titles button:hover,
.profile-titles button:focus-visible { border-color: var(--profile-violet); color: var(--text); outline: none; }
.profile-titles button[aria-pressed="true"] { border-color: transparent; background: var(--profile-violet); color: var(--profile-ink); }

.profile-coins {
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--profile-coin-bg);
  color: var(--profile-ink);
  font-weight: 800;
  white-space: nowrap;
}

.profile-xp {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.profile-bar {
  flex: 1;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--profile-track);
  overflow: hidden;
  appearance: none;
}

.profile-bar::-webkit-progress-bar { background: var(--profile-track); }
.profile-bar::-webkit-progress-value { border-radius: 3px; background: var(--profile-xp); }
.profile-bar::-moz-progress-bar { border-radius: 3px; background: var(--profile-xp); }

.profile-note { margin: 0; color: var(--text-dim); }
.profile-head .profile-note { grid-column: 1 / -1; font-size: 12px; }
.profile-note:empty { display: none; }

/* Its tabs: words underlined when open, the place one stands at marked with a dot. */
.profile-tabs {
  display: flex;
  gap: 18px;
  padding: 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--profile-edge);
}

.profile-tab {
  flex: none;
  padding: 10px 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.profile-tab[data-here]::before { content: "● "; color: var(--profile-green); }
.profile-tab:hover,
.profile-tab:focus-visible { color: var(--text); outline: none; }
.profile-tab[aria-selected="true"] { border-bottom-color: var(--profile-violet); color: var(--text); }

.profile-panels { min-height: 0; padding: 14px 18px 18px; overflow-y: auto; }
.profile-body { display: grid; gap: 10px; }
.profile-body[hidden] { display: none; }

/* Figures in a row, small. */
.profile-stats { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; }
.profile-stat { display: flex; align-items: baseline; gap: 6px; }
.profile-stat dt { color: var(--text-dim); font-size: 12px; }
.profile-stat dd { margin: 0; color: var(--profile-gold); font-size: 16px; font-weight: 700; }
.profile-stat.profile-tone-done dd { color: var(--profile-green); }
.profile-stat.profile-tone-loss dd { color: var(--profile-red); }

.profile-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-list li { padding: 5px 0; border-bottom: 1px solid var(--profile-tile); }
.profile-list .profile-tone-empty { border: 0; color: var(--text-dim); }

/* Cards: a species, a plant, a ride, an unlock — their names coloured by what they are. */
.profile-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-card {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--profile-tile);
}

.profile-card strong { color: var(--profile-tone, var(--text)); font-weight: 600; }
.profile-card span { color: var(--text-dim); font-size: 12px; }
.profile-unknown { opacity: 0.4; }
.profile-unknown strong { color: var(--text-dim); }

.profile-share { width: 100%; height: 4px; accent-color: var(--profile-green); }

.profile-tone-common { --profile-tone: var(--profile-blue); }
.profile-tone-uncommon { --profile-tone: var(--profile-green); }
.profile-tone-rare,
.profile-tone-epic { --profile-tone: var(--profile-violet); }
.profile-tone-legendary { --profile-tone: var(--profile-gold); }
.profile-tone-junk { --profile-tone: var(--text-dim); }
.profile-tone-done { --profile-tone: var(--profile-green); }

.profile-buy { grid-template-columns: 1fr auto; align-items: center; }

.profile-buy button,
.profile-action {
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--profile-coin-bg);
  color: var(--profile-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.profile-action { justify-self: start; }
.profile-buy button:disabled,
.profile-action:disabled { opacity: 0.4; cursor: default; }

/* ---- Emotes (src/avatar/emotes.js) ----------------------------------------------------------- */

/* Its button, above the appearance's. */
.emotes-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 3 + var(--map-button) * 2);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.emotes-toggle svg {
  width: 22px;
  height: 22px;
}

.emotes-toggle:hover,
.emotes-toggle:focus-visible,
.emotes-toggle[aria-pressed="true"] { border-color: var(--accent); }

.emotes-toggle[aria-pressed="true"] { color: var(--accent); }

/* The menus' head, as Places' has it — a title and a close button —, worn by the emotes' and Quality's. */
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.menu-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  cursor: pointer;
}

.menu-close:hover,
.menu-close:focus-visible { border-color: var(--accent); }

.menu-close svg {
  width: 16px;
  height: 16px;
}

/* Its slots, a menu: left of the bar's buttons, from where Places' opens up, never taller than the window. */
.emotes {
  position: fixed;
  right: var(--menu-right);
  bottom: var(--menu-bottom);
  max-height: var(--menu-max-height);
  overflow-y: auto;
  width: min(var(--emotes-width), calc(100vw - 3 * var(--gap) - var(--map-button)));
  padding: var(--gap);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
}

.emotes h2 {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.emotes-slots {
  display: grid;
  gap: 4px;
}

.emotes-slots button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.emotes-slots button:hover:not(:disabled),
.emotes-slots button:focus-visible { border-color: var(--accent); }

.emotes-slots button:disabled {
  color: var(--text-dim);
  cursor: default;
}

.emotes-slots kbd {
  min-width: 2.2em;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
}
#view.appearance-turning:active { cursor: grabbing; }

/* ---- Quality (src/quality.js) -------------------------------------------------------------- */

.build-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 7 + var(--map-button) * 6);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}
.build-toggle[hidden] { display: none; }
.build-toggle svg {
  width: 22px;
  height: 22px;
}
.build-toggle:hover,
.build-toggle:focus-visible,
.build-toggle[aria-pressed="true"] { border-color: var(--accent); }
.build-toggle[aria-pressed="true"] { color: var(--accent); }

/* Its button, above the inventory's. */
.quality-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 6 + var(--map-button) * 5);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.quality-toggle svg {
  width: 22px;
  height: 22px;
}

.quality-toggle:hover,
.quality-toggle:focus-visible,
.quality-toggle[aria-pressed="true"] { border-color: var(--accent); }

.quality-toggle[aria-pressed="true"] { color: var(--accent); }

/* Its panel, a menu: left of the bar's buttons, from where Places' opens up, never taller than the window. */
.quality {
  position: fixed;
  right: var(--menu-right);
  bottom: var(--menu-bottom);
  max-height: var(--menu-max-height);
  overflow-y: auto;
  width: min(var(--quality-width), calc(100vw - 3 * var(--gap) - var(--map-button)));
  padding: var(--gap);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
}

.quality h2 {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quality-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
  font-size: 13px;
}

.quality-row + .quality-row {
  margin-top: var(--gap);
}

.quality-row output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.quality-row input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
}

.quality-note {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

/* ---- Places (src/places.js) ---------------------------------------------------------------- */

/* Its button, above the emotes'. */
/* The inventory's button, above Places' (src/inventory.js); its panel is the places' own, where theirs goes. */
.inventory-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 5 + var(--map-button) * 4);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.inventory-toggle svg {
  width: 22px;
  height: 22px;
}

.inventory-toggle:hover,
.inventory-toggle:focus-visible,
.inventory-toggle[aria-pressed="true"] { border-color: var(--accent); }

.inventory-toggle[aria-pressed="true"] { color: var(--accent); }
/* One's package offered in one's lands (src/inventory.js Offer): its button lit. */
.inventory .place-actions button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.inventory-item { cursor: grab; }

/* The inventory's tabs — one's own, the land's, the public catalog's —, as the appearance editor's: the one shown lit,
   the land's dim where its owner offers nothing (a button off, as any of the panel's). */
.inventory-tabs {
  display: flex;
  gap: 4px;
}

.inventory .inventory-tabs button {
  flex: 1;
  padding: 6px 0;
}

.inventory .inventory-tabs button[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* A tab's page: what it holds a line apart, as the panel's own are. */
.inventory .places-section {
  display: grid;
  gap: 8px;
}

.places-toggle {
  position: fixed;
  right: var(--gap);
  bottom: calc(var(--gap) * 4 + var(--map-button) * 3);
  display: grid;
  place-items: center;
  width: var(--map-button);
  height: var(--map-button);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--solid-bg);
  color: var(--text);
  cursor: pointer;
}

.places-toggle svg {
  width: 22px;
  height: 22px;
}

.places-toggle:hover,
.places-toggle:focus-visible,
.places-toggle[aria-pressed="true"] { border-color: var(--accent); }

.places-toggle[aria-pressed="true"] { color: var(--accent); }

/* The panel: left of the bar's buttons, over the parcel you are in, as tall as what it holds and scrolled
   past the screen's top; solid, no blur. */
.places {
  position: fixed;
  right: var(--menu-right);
  bottom: var(--menu-bottom);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: var(--menu-max-height);
  overflow-y: auto;
  width: min(var(--places-width), calc(100vw - 3 * var(--gap) - var(--map-button)));
  padding: var(--gap);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.places-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.places h2,
.places-people h2 {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.places h3 {
  margin: 4px 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.places button,
.places-people button,
.places-invited button {
  padding: 4px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.places button:hover:not(:disabled),
.places button:focus-visible,
.places-people button:hover,
.places-people button:focus-visible,
.places-invited button:hover,
.places-invited button:focus-visible { border-color: var(--accent); }

.places button:disabled {
  color: var(--text-dim);
  cursor: default;
}

.places button.primary,
.places-people button.primary,
.places-invited button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

.places button.ghost,
.places-people button.ghost,
.places-invited button.ghost { background: none; }

.places .places-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
}

.places-close svg {
  width: 16px;
  height: 16px;
}

.places input,
.places select,
.places textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}

.places input:focus,
.places select:focus,
.places textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.places textarea { resize: vertical; }

.places-bar,
.places-form-actions,
.place-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.places-form {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
}

.places-form label {
  display: grid;
  gap: 2px;
  color: var(--text-dim);
}

.places .places-check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.places .places-check input { width: auto; }

.places-form-actions { justify-content: flex-end; }


.places-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.place {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  padding: 6px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--field-bg);
}

.place-image {
  grid-row: span 2;
  width: var(--places-image);
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  object-fit: cover;
}

.place-text {
  display: grid;
  min-width: 0;
}

.place-text span {
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

/* A place's picture where it has no image of its own: its parcel seen from above (src/land-preview.js), a pixel a cell;
   until it is drawn, its room. */
.place-land {
  width: var(--places-own-image);
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.place-pending { background: var(--field-bg); }

/* A package with no picture of its own: its category's icon in a picture's room, drawn as the bar's icons are. */
.place-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}

.place-icon svg {
  width: var(--place-icon);
  height: var(--place-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A package's sketch, drawn from its recipe (src/package-sketch.js): whole in a picture's room, on the fields' ground. */
.place-sketch {
  object-fit: contain;
  border: 1px solid var(--panel-border);
  background: var(--field-bg);
}

/* Without an image, the text and the buttons take the whole row. */
.place:not(:has(.place-image)) > * { grid-column: 1 / -1; }

.places-where,
.places-empty,
.places-status {
  margin: 0;
  color: var(--text-dim);
}

.places-status:empty { display: none; }

/* Who to invite: everyone on the planet, by name. */
.places-people {
  width: min(var(--places-people-width), calc(100vw - 2 * var(--gap)));
  padding: calc(var(--gap) * 1.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.places-people::backdrop { background: var(--backdrop); }

.places-people-list {
  display: grid;
  gap: 4px;
  max-height: 50vh;
  margin: var(--gap) 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.places-people-list button {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  width: 100%;
  text-align: left;
}

.places-person-who {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

/* An invitation that came: at the top, over the planet, never in the way of playing. */
.places-invited {
  position: fixed;
  inset: var(--gap) 0 auto;
  width: min(var(--places-invited-width), calc(100vw - 2 * var(--gap)));
  margin: 0 auto;
  padding: var(--gap);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.places-invited h2 {
  margin: 0;
  font-size: 14px;
}

.places-invited-who {
  margin: 2px 0 var(--gap);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

/* The map's search of its places (src/places.js): at the top while the map is open, what it finds
   under it with the places panel's actions. */
.map-search {
  position: fixed;
  top: var(--gap);
  left: 50%;
  display: grid;
  gap: 6px;
  width: min(var(--map-search-width), calc(100vw - 2 * var(--gap)));
  transform: translateX(-50%);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

.map-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--solid-bg);
  color: var(--text);
  font: inherit;
}

.map-search-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* A land alone on the map (src/map-avatars.js): its name over its dot, centred, placed each frame by its two
   properties alone. The name is the button that goes there. */
.map-lands {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.map-land {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  max-width: var(--map-land-width);
  height: var(--map-land-height);
  padding: 0 8px;
  border: 1px solid var(--map-card-border);
  border-radius: var(--control-radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 600 11px/1 var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(calc(var(--map-land-x, 0) - 50%), calc(var(--map-land-y, 0) - 100%));
}

.map-land:hover,
.map-land:focus-visible { border-color: var(--map-card-land); }

/* The parcel a click on the map's ground was on (src/main.js): named over where it was clicked, until the map moves —
   a button that stands one on that spot. */
.map-parcel {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--map-card-border);
  border-radius: var(--control-radius);
  background: var(--solid-bg);
  color: var(--text);
  font: 12px/1.3 var(--mono);
  white-space: nowrap;
  cursor: pointer;
  transform: translate(calc(var(--map-parcel-x, 0) - 50%), calc(var(--map-parcel-y, 0) - 100% - var(--map-land-gap) * 2));
}

.map-parcel:hover,
.map-parcel:focus-visible { border-color: var(--accent); }

.map-search .places-status {
  padding: 0 4px;
}

/* An invitation stays over the map's search. */
.places-invited { z-index: 1; }

/* Live modules near (src/build/live-rooms.js): «on air» while one sends; their options are the aim's. */
:root {
  --live-on-air: #ff4d4f;
}
.live-on-air {
  position: fixed;
  top: var(--gap);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--live-on-air);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.live-on-air::before { content: '● '; }

/* A match being played (src/progress/play.js): its clock and what is next, over the aim. */
:root { --match-hud-top: 72px; }
.match-hud {
  position: fixed;
  top: var(--match-hud-top);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--panel-bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 20;
}
.match-hud[hidden] { display: none; }

/* Fishing (src/fishing/fishing.js): what one is doing, and while a fish fights the line's tension as a needle on an arc —
   the fish's sweet band bright on it —, how much of the catch is in under it. */
:root {
  --fishing-top: 96px;
  --fishing-width: 240px;
  --fishing-arc-height: 120px;
  --fishing-arc-ring: 18px;
  --fishing-track: rgba(255, 255, 255, 0.16);
  --fishing-band-color: #7fe3b0;
  --fishing-band-off: #e3c27f;
  --fishing-needle-color: #ffffff;
  --fishing-strain: #ff6b5b;
  --fishing-progress-color: #4fc3f7;
  --fishing-bite: #ffd54f;
}
.fishing {
  --fishing-tension: 0;
  --fishing-band: 0.5;
  --fishing-band-width: 0.3;
  --fishing-progress: 0;
  position: fixed;
  top: var(--fishing-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--fishing-width);
  padding: 10px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--control-radius);
  background: var(--panel-bg);
  color: var(--text);
  text-align: center;
  user-select: none;
}
.fishing[hidden] { display: none; }
.fishing-arc, .fishing-progress { display: none; }
.fishing[data-phase="fight"] .fishing-arc, .fishing[data-phase="fight"] .fishing-progress { display: block; }
.fishing-arc {
  position: relative;
  height: var(--fishing-arc-height);
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--fishing-arc-height) var(--fishing-arc-height) 0 0;
  background: conic-gradient(from -90deg at 50% 100%,
    var(--fishing-track) 0deg calc((var(--fishing-band) - var(--fishing-band-width) / 2) * 180deg),
    var(--fishing-band-off) 0deg calc((var(--fishing-band) + var(--fishing-band-width) / 2) * 180deg),
    var(--fishing-track) 0deg 180deg, transparent 0deg);
  mask: radial-gradient(circle at 50% 100%, transparent calc(var(--fishing-arc-height) - var(--fishing-arc-ring)), #000 calc(var(--fishing-arc-height) - var(--fishing-arc-ring) + 1px));
}
.fishing[data-in-band="true"] .fishing-arc {
  background: conic-gradient(from -90deg at 50% 100%,
    var(--fishing-track) 0deg calc((var(--fishing-band) - var(--fishing-band-width) / 2) * 180deg),
    var(--fishing-band-color) 0deg calc((var(--fishing-band) + var(--fishing-band-width) / 2) * 180deg),
    var(--fishing-track) 0deg 180deg, transparent 0deg);
}
.fishing-needle {
  position: absolute;
  left: calc(50% - 2px);
  bottom: 0;
  width: 4px;
  height: var(--fishing-arc-height);
  border-radius: 2px;
  background: var(--fishing-needle-color);
  transform-origin: 50% 100%;
  transform: rotate(calc(-90deg + var(--fishing-tension) * 180deg));
}
.fishing[data-strain="true"] .fishing-needle { background: var(--fishing-strain); }
.fishing-progress {
  height: 6px;
  margin-top: 8px;
  border-radius: 3px;
  background: var(--fishing-track);
  overflow: hidden;
}
.fishing-progress span {
  display: block;
  height: 100%;
  width: calc(var(--fishing-progress) * 100%);
  background: var(--fishing-progress-color);
}
.fishing-words { margin: 6px 0 0; font-weight: 600; }
.fishing[data-phase="bite"] .fishing-words { color: var(--fishing-bite); }
.fishing-about { display: none; margin: 4px 0 0; font-size: 0.85em; opacity: 0.8; }
.fishing[data-phase="show"] .fishing-about { display: block; }

/* ---- Settlement (src/build/edit/settlement.js) ------------------------------------------------------
   A tool's panel as the bridge's and the road's are, with a map at its top: the parcels round the one looked at, a tile
   each — its ground seen from above (the lands' own previews) —, those the settlement takes lit and framed, the one
   looked at ringed, one that holds a seed of this tool's dotted. */
.build-settlement {
  --build-parcel-gap: 3px;      /* between two tiles of its map */
  --build-parcel-dim: 0.5;      /* a parcel it does not take */
  --build-parcel-dot: 7px;      /* the dot of one sown */
}

.build-parcels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--build-parcel-gap);
  padding-bottom: 4px;
}

.build-parcel {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--build-field);
  overflow: hidden;
  cursor: pointer;
}

.build-parcel img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: var(--build-parcel-dim);
}

.build-parcel[aria-pressed="true"] { border-color: var(--accent); }
.build-parcel[aria-pressed="true"] img { opacity: 1; }
.build-parcel[data-here] { outline: 1px solid var(--text-dim); outline-offset: 1px; }

.build-parcel[data-sown]::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: var(--build-parcel-dot);
  height: var(--build-parcel-dot);
  border-radius: 50%;
  background: var(--accent);
}

/* What each land is: a field a land, as its map has them. */
.build-lands {
  display: grid;
  grid-template-columns: repeat(var(--build-lands-side, 2), minmax(0, 1fr));
  gap: var(--build-parcel-gap);
}

.build-settlement-go { font-weight: 600; }
.build-tool-row .build-settlement-auto { width: auto; justify-self: start; }
