/* ═══════════════════════════════════════
   WORKBENCH PAGES — the shared list layout (WorkbenchLibraryPage.js)
   ═══════════════════════════════════════ */

/* ── Page header ── */
.wb-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 16px;
}

.wb-page-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* A record wears its kind glyph in its title, as a kind does everywhere else. */
.wb-page-head h1 .wb-k {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 11px;
}

.wb-page-head h1 .wb-inuse {
  margin-left: 0;
}

.wb-page-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.wb-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* The release sits under the row, not in it. */
.wb-page-release {
  display: flex;
  flex-basis: 100%;
  justify-content: flex-end;
}

.wb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Table card ── */
.wb-card {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.wb-table {
  width: 100%;
  border-collapse: collapse;
}

.wb-table th {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.wb-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.wb-table tr:last-child td {
  border-bottom: none;
}

.wb-table .wb-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.wb-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── List thumbnail (a library with `thumb`) ── */
.wb-thumb {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.wb-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.wb-uid {
  font: 11.5px var(--font-mono);
  color: var(--text-muted);
}

.wb-dim {
  color: var(--text-muted);
}

.wb-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.wb-pill.ok {
  background: var(--green-dim);
  color: var(--green);
}

.wb-pill.mute {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.wb-page-msg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--red);
}

/* ── Record count on a tree row, once its list has loaded ── */
.wb-count {
  margin-left: auto;
  font: 11px var(--font-mono);
  color: var(--text-muted);
}

/* ── A list row that opens its record ── */
.wb-table tr.wb-link {
  cursor: pointer;
}

.wb-table tr.wb-link:hover td {
  background: var(--bg-hover);
}

/* ── A name inside a cell or card that opens its record (data-wb-open) ── */
.wb-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.wb-open:hover {
  color: var(--accent);
  text-decoration: underline;
}

.wb-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--wb-on-accent);
}

.wb-btn.danger {
  border-color: var(--red-dim);
  color: var(--red);
}

.wb-btn.danger:hover:not(:disabled) {
  background: var(--red-dim);
}

.wb-pill.warn {
  background: var(--amber-dim);
  color: var(--amber);
}

/* ── Record page (WorkbenchRecordPage.js) ── */

.wb-rec-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
}

.wb-uid-chip {
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  font: 11.5px var(--font-mono);
  color: var(--text-secondary);
}

.wb-rev {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.wb-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.wb-subtab {
  margin-bottom: -1px;
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  font: 13px var(--font-sans);
  cursor: pointer;
}

.wb-subtab:hover {
  color: var(--text-primary);
}

.wb-subtab.on {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}

.wb-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.wb-pad {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}

/* ── Surface sub-tab (WorkbenchSurfaces.js) ──
   A map or a chat fills what is left of the editor area and follows the
   bottom panel as it is resized — it never takes a height of its own. */
.wb-editor:has(> .wb-surface) {
  display: flex;
  flex-direction: column;
}

.wb-editor:has(> .wb-surface) > :not(.wb-surface) {
  flex: none;
}

.wb-editor > .wb-surface {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 320px;
}

/* ── Map area (a surface's drawing) ──
   The SVG keeps its viewBox and is scaled to fill the area, so it follows the
   area as the editor or the bottom panel resizes — no redraw, no measuring. */
.wb-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.wb-map > svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Conversation block (WorkbenchChat.js) ── */
.wb-chat {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.wb-chat-log {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
}

.wb-turn {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
}

.wb-turn.mine {
  align-self: flex-end;
  background: var(--wb-selected);
}

.wb-turn.pending {
  color: var(--text-muted);
}

.wb-turn-who {
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.wb-turn-body {
  line-height: 1.45;
  white-space: pre-wrap;
}

.wb-turn-receipt {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.wb-turn-receipt .wb-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.wb-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Jobs tab of the bottom panel (WorkbenchJobs.js) ── */
.wb-jobs li {
  padding: 6px 0;
}

.wb-job-label {
  font-weight: 600;
}

/* A job's buttons in the Queue tab (WorkbenchGenQueueTemplates.js). */
.wb-job-acts {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.wb-fgroup-h {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wb-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.wb-f.wide {
  grid-column: 1 / -1;
}

.wb-f label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.wb-v {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  overflow-wrap: anywhere;
}

.wb-v.none {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Image view area (a field with `image: true`) — checkerboard shows alpha ── */
.wb-img {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: repeating-conic-gradient(
      var(--bg-hover) 0 25%,
      var(--bg-tertiary) 0 50%
    )
    0 0 / 20px 20px;
}

.wb-img img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.wb-img.none {
  color: var(--text-muted);
  font-style: italic;
}

.wb-list {
  list-style: none;
}

.wb-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.wb-list li:last-child {
  border-bottom: none;
}

.wb-list li > .wb-dim:last-child {
  margin-left: auto;
  font-size: 12px;
}

/* A problem's severity dot, at the start of a list row (the Lobby's problems,
   a sketch plan's). */
.wb-sev {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
}

.wb-sev.error {
  background: var(--red);
}

.wb-sev.warning {
  background: var(--amber);
}

.wb-sev.info {
  background: var(--text-muted);
}

/* A toggle chip: a filter or a layer switch, lit while it is on. */
.wb-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: 12px var(--font-sans);
  cursor: pointer;
}

.wb-chip.on {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.wb-sidecards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wb-sidecard {
  padding: 12px 14px;
}

.wb-sidecard h2 {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wb-sidecard p {
  font-size: 12.5px;
}

@media (max-width: 1100px) {
  .wb-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .wb-fields {
    grid-template-columns: 1fr;
  }
}

/* ── Editable fields (WorkbenchFields.js, WorkbenchRecordPage.js) ── */

.wb-in {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: 13px var(--font-sans);
  color-scheme: dark;
}

.wb-in:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.wb-in {
  resize: vertical;
}

select.wb-in {
  cursor: pointer;
}

.wb-range {
  margin-left: 6px;
  font: 10.5px var(--font-mono);
  color: var(--text-muted);
}

/* A changed field is marked until it saves; a field that can't save, in red. */
.wb-f.changed .wb-in {
  border-color: var(--amber);
}

.wb-f.changed > label::after {
  content: " •";
  color: var(--amber);
}

.wb-f.invalid .wb-in {
  border-color: var(--red);
}

.wb-problem {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--red);
}

.wb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--text-secondary);
  cursor: pointer;
}

.wb-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* A list action's card, above the list (WorkbenchListCard.js). */
[data-wb-list-card] > .wb-card {
  margin-bottom: 12px;
}

.wb-unsaved {
  align-self: center;
  font-size: 12px;
  color: var(--amber);
}

.wb-unsaved[hidden] {
  display: none;
}

/* The unsaved dot on a tab (WorkbenchTabs.js). */
.wb-dirty {
  font-size: 9px;
  color: var(--amber);
}

/* ── Pick-from-a-library lists: abilities, loot, shop (WorkbenchListPicker.js) ── */
.wb-ab-name {
  flex: 1;
}

.wb-ab-lvl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.wb-ab-lvl .wb-in {
  width: 72px;
}

.wb-ab-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.wb-ab-add .wb-in {
  flex: 1;
}

/* ── Explanations (WorkbenchHelpTip.js) — a dotted title explains itself ── */
.wb-root [data-help] {
  cursor: help;
}

.wb-root label[data-help] .wb-lt,
.wb-root .wb-fgroup-h[data-help],
.wb-root span[data-help] {
  text-decoration: underline dotted;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 3px;
}

.wb-tip {
  position: fixed;
  z-index: 1000;
  max-width: 340px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: 12px/1.45 var(--font-sans);
  text-transform: none;
  letter-spacing: normal;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* ── In use and compile marks (list rows, record header) ── */
/* A multi-choice field (a fighting style's classes, a class's skills): one
   box per option, wrapping. */
.wb-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

/* A feature list (origins, subclasses) and a rows field (a venue's stations,
   WorkbenchRowsField.js): one card per feature or row. The row card is
   `.wb-rowcard`, never `.wb-row` — that is the shell's tree row
   (workbench.css), and styling it here boxed every item in the tree. */
.wb-feats,
.wb-rows {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 12px;
}
.wb-feat,
.wb-rowcard {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.wb-feat-head,
.wb-rowcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.wb-rowcard-acts {
  display: flex;
  gap: 6px;
}
/* A row's read-only cell is wrapped so typing can refresh it in place; the
   wrapper takes no grid cell of its own. */
.wb-rows-ro {
  display: contents;
}

/* The list thumbnail carries the shared .usage-dot (components.css); the
   record header's is inline beside the name. */
.wb-inuse {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 10px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

/* Not compiled yet: a hollow grey ring. Compile will add a green check, an
   amber warning and a red X — red only ever for an error that blocks a Send. */
.wb-compile {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  opacity: 0.6;
}

.wb-pill.err {
  background: var(--red-dim);
  color: var(--red);
}

/* ── List bar: find box + group chips (WorkbenchListBar.js) ── */
.wb-list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.wb-list-bar .wb-find {
  width: 260px;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 10px;
}

.wb-list-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wb-chip:hover {
  color: var(--text-primary);
}

.wb-chip-n {
  font: 11px var(--font-mono);
  color: var(--text-muted);
}

.wb-chip.on .wb-chip-n {
  color: var(--text-secondary);
}

.wb-list-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--border);
}

/* ── Sortable column heading ── */
.wb-table th.wb-sort button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.wb-table th.wb-sort button:hover,
.wb-table th.wb-sort.on button {
  color: var(--text-primary);
}

.wb-sort-dir {
  font-size: 9px;
}

/* ── A group's fold row in a grouped list ── */
.wb-table tr.wb-group-row td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.wb-fold {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font: 600 12px var(--font-sans);
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.wb-fold:hover {
  color: var(--text-primary);
}

.wb-fold:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.wb-caret {
  display: inline-block;
  width: 16px;
  color: var(--text-muted);
}

.wb-group-n {
  margin-left: 8px;
  font: 11px var(--font-mono);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   GENERATOR STEPS — shared by every generator library's steps (sprite packs,
   icon packs): the Generate step (WorkbenchGenerateStep.js), the step column,
   the Next button and the Calibrate wrapper.
   ═══════════════════════════════════════ */

/* A picture you can open the editor on. */
.wbsp-editable {
  cursor: pointer;
}

.wbsp-editable:hover {
  border-color: var(--accent);
}

/* ── Generate: controls | light table ── */
.wbsp-gen {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.wbsp-ctl {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.wbsp-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  overflow: auto;
}

.wbsp-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wbsp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wbsp-note {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Prompt frames, at the far end of the row it shares with Write prompt
   (WorkbenchFramesLink.js). A button, so the keyboard reaches it; the link
   look is .wb-open's, with the button's own chrome taken off. */
.wbsp-frames {
  margin-left: auto;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

.wbsp-go {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.wbsp-go .wbsp-note {
  flex: 1;
  min-width: 0;
}

/* ── Source picker: the four ways a front arrives ── */
.wbsp-seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.wbsp-seg button {
  height: 30px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font: 12px var(--font-sans);
  cursor: pointer;
}

.wbsp-seg button:last-child {
  border-right: none;
}

.wbsp-seg button.on {
  background: var(--wb-selected);
  color: var(--text-primary);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ── Anchor: pick a promoted master to steer the new front ── */
.wbsp-masters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  max-height: 210px;
  padding: 2px;
  overflow: auto;
}

.wbsp-master {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.wbsp-master img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wbsp-master.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.wbsp-master .wbsp-cap-l {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1px 4px;
  overflow: hidden;
  background: rgba(11, 13, 18, 0.78);
  color: var(--text-secondary);
  font-size: 9.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wbsp-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  font-size: 12px;
}

.wbsp-pick img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: contain;
}

.wbsp-drop {
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 18px 12px;
  border: 1px dashed var(--wb-grey);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.wbsp-drop:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.wbsp-drop input {
  display: none;
}

/* ── The light table: front and the portrait cut from it ── */
.wbsp-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.wbsp-table {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 260px;
  padding: 20px;
  overflow: auto;
  place-items: center;
  background: var(--bg-card);
}

/* The shared field row does the splitting; this only caps how wide it runs. */
.wbsp-duo {
  width: min(1000px, 100%);
}

.wbsp-none {
  display: grid;
  gap: 6px;
  place-items: center;
  width: min(360px, 100%);
  aspect-ratio: 1;
  padding: 20px;
  border: 1px dashed var(--wb-grey);
  border-radius: 10px;
  color: var(--text-muted);
  text-align: center;
}

.wbsp-busy {
  position: absolute;
  inset: auto 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
}

/* A pack-wide fix running: eight sheets are re-rendered on the server, so the
   card says what is happening rather than sitting still until it is over. */
.wbsp-working {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.wbsp-working .wbsp-bar {
  flex: none;
  width: 70px;
}

.wbsp-bar {
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg-hover);
}

.wbsp-bar i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  animation: wbsp-slide 1.4s ease-in-out infinite;
}

@keyframes wbsp-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

.wbsp-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
}

.wbsp-foot .wbsp-sp {
  flex: 1;
}

@media (max-width: 1100px) {
  .wbsp-gen {
    grid-template-columns: 1fr;
  }

  .wbsp-ctl {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wbsp-bar i {
    animation: none;
    width: 100%;
  }
}

/* A surface slot is a flex ROW, so a step with more than one block stacks its
   own column — otherwise the second card lands beside the first. */
.wbsp-stack {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  /* The column is what scrolls: the stage above keeps its height, and the
     card under it stays reachable however tall the picture is. */
  overflow-y: auto;
}

.wbsp-stack > * {
  flex: none;
}

/* The way on to the next step: under the card it belongs to, centred, and the
   same button as the one that made the picture. */
.wbsp-next {
  display: flex;
  justify-content: center;
  padding-bottom: 4px;
}

.wbsp-next .wb-btn {
  height: 34px;
  padding: 0 18px;
  font-size: 13px;
}

/* ── Terrain block: a terrain pack's step after Generate ── */

/* No scaling on either box: a screen pixel is a pixel of the block, so the
   author sees the grain the game draws. The size is set inline from the served
   canvas; a block wider than the card scrolls rather than shrinks. */
.wbtt-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.wbtt-box {
  position: relative;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* The checkerboard under a picture that may be transparent. */
.wbtt-box,
.wbtr-thumb,
.wbtr-route-cell {
  background: repeating-conic-gradient(
      var(--bg-hover) 0 25%,
      var(--bg-tertiary) 0 50%
    )
    0 0 / 20px 20px;
}

.wbtt-box img {
  display: block;
  width: 100%;
  height: 100%;
}

.wbtt-box.none {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

/* The map-tile lattice; its step is set inline from the served canvas. */
.wbtt-lattice {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.7;
  box-shadow: inset -1px -1px 0 var(--accent);
  background-image:
    linear-gradient(to right, var(--accent) 0 1px, transparent 1px),
    linear-gradient(to bottom, var(--accent) 0 1px, transparent 1px);
}

/* ── Tile Generate: the master's flip and grid switches ── */

/* Hugs the picture, so the grid layer (a .wbtt-lattice whose step is set
   inline as a share of the picture) lies exactly over the art. */
.wbtg-art {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.wbtg-art img {
  display: block;
}

.wbtg-tools {
  margin-top: 8px;
}

/* ── Road steps: a road pack's footprint, pieces and full view ── */

/* The footprint's 1:1 box is the terrain step's (.wbtt-box). */

.wbtr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.wbtr-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wbtr-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.wbtr-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wbtr-thumb.locked {
  cursor: not-allowed;
  opacity: 0.45;
}

.wbtr-cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.wbtr-name {
  min-height: 2.5em;
  font-size: 11px;
  line-height: 1.25;
}

.wbtr-chips,
.wbtr-acts {
  display: flex;
  gap: 4px;
}

.wbtr-chips .wbtr-chip {
  flex: 1;
  justify-content: center;
}

/* Green: this outline has art — the done pill's answer, per outline. */
.wbtr-chips .wbtr-chip.has {
  border-color: var(--green);
  color: var(--green);
}

/* The outline shown: an accent ring, keeping the green text when it has art. */
.wbtr-chips .wbtr-chip.on {
  border-color: var(--accent);
}

.wbtr-chips .wbtr-chip:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.wbtr-acts .wb-btn {
  flex: 1;
  justify-content: center;
}

.wbtr-scale {
  width: auto;
}

/* The route is wider than the card at any fixed scale; the box scrolls. */
.wbtr-route-box {
  margin-top: 10px;
  overflow: auto;
}

/* gap 0 is the point: the pieces have to touch, or the join being judged is
   one this view invented. Width and columns are set inline. */
.wbtr-route {
  display: grid;
  gap: 0;
}

.wbtr-route-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.wbtr-route-cell img {
  display: block;
  width: 100%;
  height: 100%;
}

.wbtr-route-cell.gap,
.wbtr-route-cell.none {
  outline: 1px dashed var(--border);
  outline-offset: -1px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

/* Cut at another size: it butts at the wrong scale, and a release leaves it
   out. Amber, as the re-seed pill — on a layer above the art, which would
   cover an inset shadow. */
.wbtr-route-cell.stale::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--amber);
}

/* ── Calibrate: the calibration views, on this one pack ── */

.wbsp-cal .sc-body {
  min-width: 0;
}

/* The calibration views keep their classic markup (sc-* classes, classic
   buttons), so inside a workbench Calibrate step their controls take the
   workbench's look here: buttons read as .wb-btn,
   inputs as .wb-in, and the readouts use the workbench tokens. A sound
   binding hosted on a workbench page (.wb-sbe, WorkbenchSoundBinding.js) is
   classic markup too, and takes the same look. */
.wbsp-cal .btn-secondary,
.wb-sbe .btn-secondary {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font: 500 12px var(--font-sans);
  cursor: pointer;
}

.wbsp-cal .btn-secondary:hover:not(:disabled),
.wb-sbe .btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.wbsp-cal .btn-secondary.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--wb-on-accent);
}

.wbsp-cal .btn-secondary:disabled,
.wb-sbe .btn-secondary:disabled {
  opacity: 0.5;
  cursor: default;
}

.wbsp-cal .form-input,
.wbsp-cal select,
.wbsp-cal input[type="number"],
.wbsp-cal input[type="text"],
.wb-sbe .form-input {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: 13px var(--font-sans);
  color-scheme: dark;
}

.wbsp-cal .form-input:focus,
.wbsp-cal select:focus,
.wbsp-cal input[type="number"]:focus,
.wb-sbe .form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.wbsp-cal .form-label,
.wbsp-cal .sc-slider-row > span,
.wbsp-cal .sc-cmp-field > span {
  color: var(--text-secondary);
  font-size: 12px;
}

.wbsp-cal input[type="range"],
.wb-sbe input[type="range"] {
  accent-color: var(--accent);
}

/* ── A sound binding on a workbench page (WorkbenchSoundBinding.js) ──
   Its chips take the workbench tokens, and a chip's name — the Sound
   Library's glyph and a link to the sound — sits in a row. */
.wb-sbe .sbe-chip {
  border-color: var(--border);
  background: var(--bg-tertiary);
}

.wb-sbe .sbe-chip-playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.wb-sbe .sbe-chip-missing {
  border-color: var(--red);
  background: var(--red-dim);
}

/* A missing chip explains itself on hover, but it is not a title to
   underline. */
.wb-sbe span.sbe-chip[data-help] {
  text-decoration: none;
}

.wb-sbe .sbe-chip-play {
  color: var(--accent);
}

.wb-sbe .sbe-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
}

.wb-sbe .sbe-cap-hint {
  color: var(--amber);
}

.wb-sbe .sbe-gain-caption {
  color: var(--text-secondary);
  opacity: 1;
}

.wb-sbe .sbe-gain-val {
  font-family: var(--font-mono);
}

.wbsp-cal .sc-slider-row {
  /* label · slider · number · unit (the item ruler's "px"; empty otherwise) */
  grid-template-columns: auto 1fr 90px auto;
  gap: 12px;
}

/* The page already names the pack, so the ruler says only the size, under the
   number box (the info box beside the canvas is gone, #240). */
.wbsp-cal .sc-size-note {
  grid-column: 3;
  margin-top: -6px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}

.wbsp-cal .sc-hint,
.wbsp-cal .sc-empty,
.wbsp-cal .sc-ruler-empty,
.wbsp-cal .sc-timing-empty {
  color: var(--text-muted);
}

.wbsp-cal .sc-gallery-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.wbsp-cal .sc-gallery-card:hover {
  border-color: var(--accent);
}

.wbsp-cal .sc-save-status {
  color: var(--green);
}

.wbsp-cal .sc-save-status.sc-status-error {
  color: var(--red);
}

.wbsp-cal .sc-save-status.sc-status-dirty {
  color: var(--amber);
}

/* Map view: the drawing canvas and the test surface side by side, so a line
   drawn on the left is tried on the right without scrolling. The long hints
   go — the test surface's is its title's hover help here. */
.wbsp-cal .sc-map-panes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}

.wbsp-cal .sc-map-edit,
.wbsp-cal .sc-map-test {
  min-width: 0;
}

/* Both panes open on a head row of one height (the drawing side's holds its
   save line), so the two canvases — the same size — and the settings under
   them line up. The test surface's title is not shown. */
.wbsp-cal .sc-map-panes .sc-timing-head {
  min-height: 20px;
  margin: 0 0 6px;
}

.wbsp-cal .sc-map-test-title {
  visibility: hidden;
}

/* Its settings go under its canvas, as the drawing side's do. */
.wbsp-cal .sc-map-test {
  display: flex;
  flex-direction: column;
}

.wbsp-cal .sc-map-test-controls {
  order: 1;
  margin: 10px 0 0;
}

/* The page already names the pack; the views' own title over the canvas
   goes (their save line beside it stays). */
.wbsp-cal .sc-pack-title {
  display: none;
}

.wbsp-cal .sc-map-hint {
  display: none;
}

/* Ground Skirt and the size ruler: the long explanation reads after the
   canvas and the controls it explains, so those sit at the top of the view. */
.wbsp-cal .sc-body {
  display: flex;
  flex-direction: column;
}

.wbsp-cal .sc-shadow-hint,
.wbsp-cal .sc-ruler-hint {
  order: 1;
  margin-top: 16px;
}

/* ── Calibration views in the workbench look: Map, Boxes, Ground Skirt,
   Compare ── */

/* A view's primary buttons read as .wb-btn.primary: Compare's Add, and
   Scale's snap buttons and Reset (Bo's call, 2026-09-30). */
.wbsp-cal .btn-primary {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--wb-on-accent);
  font: 500 12px var(--font-sans);
  cursor: pointer;
}

/* Tools you switch between (Map's paint / collision / anchor tools, Boxes'
   Hit area / Collision box) are toggles, so they read as .wb-chip; the one
   in use as .wb-chip.on. Their own text colour stays: it is the legend. */
.wbsp-cal .btn-secondary.ac-map-tool,
.wbsp-cal .btn-secondary[id^="acBoxesEdit"] {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
}

.wbsp-cal .btn-secondary.ac-map-tool.active,
.wbsp-cal .btn-secondary[id^="acBoxesEdit"].active {
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

/* Row captions ("Paint:", "Show:"), toggles and readouts. */
.wbsp-cal .sc-boxes-controls,
.wbsp-cal .sc-boxes-readout {
  color: var(--text-secondary);
  font-size: 12px;
}

.wbsp-cal .sc-boxes-readout {
  font-family: var(--font-mono);
}

.wbsp-cal input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Ground Skirt */
.wbsp-cal .sc-skirt-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  opacity: 1;
}

.wbsp-cal .sc-skirt-label,
.wbsp-cal .sc-skirt-bg {
  color: var(--text-secondary);
  opacity: 1;
}

.wbsp-cal .sc-skirt-check strong {
  color: var(--text-primary);
  font-weight: 500;
}

.wbsp-cal .sc-skirt-value {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.wbsp-cal .sc-skirt-swatch {
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

/* Compare */
.wbsp-cal .sc-compare-picker,
.wbsp-cal .sc-compare-wrapper,
.wbsp-cal .sc-compare-side {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
}

.wbsp-cal .sc-compare-picker .sc-cmp-field,
.wbsp-cal .sc-cmp-toggle {
  color: var(--text-secondary);
}

.wbsp-cal .sc-cmp-row {
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.wbsp-cal .sc-cmp-row-name {
  color: var(--text-primary);
}

.wbsp-cal .sc-cmp-row-type,
.wbsp-cal .sc-cmp-row .sc-cmp-field,
.wbsp-cal .sc-cmp-row .sc-cmp-field > span {
  color: var(--text-muted);
}

.wbsp-cal .sc-cmp-row .sc-cmp-field > span {
  font-family: var(--font-mono);
}

.wbsp-cal .sc-cmp-remove {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
}

.wbsp-cal .sc-cmp-remove:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Map sliders read like the ruler's: they take the room the row has, their
   caption in the workbench text colour and their value in mono. */
.wbsp-cal .sc-map-range {
  flex: 1 1 220px;
  gap: 10px;
  opacity: 1;
}

.wbsp-cal .sc-map-slider {
  flex: 1;
  width: auto;
  min-width: 120px;
}

.wbsp-cal .sc-map-value {
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: right;
}

/* ── Cleanup sub-tab (WorkbenchCleanup.js) — shared by the Database and
   Storage pages, and the Local pull form borrows its confirm row ── */
.wbcl-groups {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wbcl-confirm {
  max-width: 260px;
}

.wbcl-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* A refusal is by design (production), not a fault — so not red. */
.wbcl-off {
  color: var(--text-secondary);
}

/* ── Pose viewport (WorkbenchPoseViewport.js) ──
   A three.js view that fills its host; the host page gives the host its size
   (a surface's area, or a flex child). The canvas has a transparent clear, so
   the backdrop below is the gradient seen behind the figure. The bar and the
   picked joint's name float over the canvas, inside the host. */
.wb-posevp {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(
      ellipse 70% 60% at 50% 42%,
      var(--bg-hover),
      transparent 72%
    ),
    linear-gradient(to bottom, var(--bg-tertiary), var(--bg-primary));
}

.wb-posevp-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.wb-posevp-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  /* Only the chip groups take the pointer; the gaps orbit the view. */
  pointer-events: none;
}

.wb-posevp-grp {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.wb-posevp-grp .wb-chip {
  height: 22px;
  border-color: transparent;
}

.wb-posevp-grp .wb-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wb-posevp-picked {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  color: var(--text-primary);
  font: 12px var(--font-mono);
}

.wb-posevp > .wb-page-msg {
  position: absolute;
  inset: 0;
  justify-content: center;
  text-align: center;
}

/* A 3D view beside its side card — a pack's Poses step, the pose library's
   Pose sub-tab. The 3D view sizes itself to its box. */
.wb-poseedit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.wb-poseedit-view {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wb-poseedit-side {
  display: flex;
  flex-direction: column;
  align-self: start;
  gap: 10px;
}

@media (max-width: 1100px) {
  .wb-poseedit {
    grid-template-columns: 1fr;
  }
}
