/* The building windows (build.js; arcana docs/building.md): Map, What's
   here, Room editor, As players see it, Zone grid, and building's marks in
   the game window. Ink ground, gilt for what can be acted on, verdigris for
   structure and good news, ember for problems; every colour from the theme. */

.bw {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  background: var(--ink-high);
  border: 1px solid var(--gilt);
  box-shadow: var(--shadow);
  overflow: hidden;
  resize: both;
  font-family: var(--chrome-font);
  font-size: var(--chrome-size);
  color: var(--parchment);
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  min-width: 200px;
  min-height: 120px;
}
.bw[hidden] { display: none; }
.bw.front { z-index: 7; }
.bw:focus { outline: none; }
.bw > header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 2px 10px;
  color: var(--gilt);
  border-bottom: 1px solid var(--rule);
  cursor: move;
  touch-action: none;
  user-select: none;
  min-height: 26px;
}
.bw > header .bw-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bw > header .bw-sp { flex: 1; }
.bw-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.bw-vn, .bw-mono { font-family: var(--font); font-size: 12px; color: var(--muted); }
.bw-mono { color: var(--parchment); font-size: 13px; }
.bw-muted { color: var(--muted); }
.bw-lbl {
  font-family: "Marcellus", serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin: 0 0 3px;
}
.bw-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bw-row > .bw-grow { flex: 1; min-width: 0; }
.bw-fld, .bw select, .bw textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 4px 8px;
  color: var(--parchment);
  font-family: "Spectral", Georgia, serif;
  font-size: 14px;
}
.bw textarea { resize: vertical; line-height: 1.5; min-height: 6em; font-family: var(--font); font-size: 13px; }
.bw-fld:focus, .bw select:focus, .bw textarea:focus { outline: 1px solid var(--gilt); border-color: var(--gilt); }
.bw-fld:disabled, .bw select:disabled, .bw textarea:disabled { opacity: 0.7; }
.bw-fld.name { font-family: "Marcellus", serif; font-size: 16px; color: var(--gilt); }
.bw-btn {
  font: inherit;
  border: 1px solid var(--rule);
  color: var(--parchment);
  background: transparent;
  border-radius: 2px;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.bw-btn:hover:not(:disabled), .bw-btn:focus-visible { border-color: var(--gilt); color: var(--gilt-bright); outline: none; }
.bw-btn.pri { background: var(--gilt); border-color: var(--gilt); color: var(--on-accent); }
.bw-btn.pri:hover:not(:disabled) { background: var(--gilt-bright); color: var(--on-accent); }
.bw-btn.on, .bw-btn[aria-pressed="true"] { border-color: var(--gilt); color: var(--gilt-bright); background: var(--ink-raised); }
.bw-btn:disabled { opacity: 0.45; cursor: default; }
.bw-btn.pri:disabled { background: transparent; border-color: var(--rule); color: var(--muted); opacity: 0.7; }
.bw-btn.small { padding: 0 7px; font-size: 12px; }
.bw-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.bw-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--rule); border-radius: 2px; padding: 0 7px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.bw-chip input { margin: 0; accent-color: var(--gilt); }
.bw-chip.on { border-color: var(--gilt); color: var(--gilt-bright); }
.bw-chip.mixed { border-style: dashed; color: var(--parchment); }
.bw-status { font-size: 12px; color: var(--muted); }
.bw-status.bad { color: var(--ember); }
.bw-status.ok { color: var(--verdigris); }
.bw-note { border: 1px solid var(--rule); border-radius: 2px; padding: 6px 10px; background: var(--ink); font-size: 13px; }
.bw-note.warn { border-color: var(--warn); }
.bw-note.bad { border-color: var(--ember); }
.bw table { border-collapse: collapse; width: 100%; font-size: 13px; }
.bw th, .bw td { border-bottom: 1px solid var(--rule); padding: 4px 6px; text-align: left; vertical-align: top; font-weight: 400; }
.bw th { font-family: "Marcellus", serif; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bw-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.bw-issues li { display: flex; gap: 6px; align-items: flex-start; }
.bw-issues .mark { width: 12px; flex: none; text-align: center; }
.bw-issues .error .mark { color: var(--ember); }
.bw-issues .note .mark { color: var(--warn); }
.bw-issues .fine .mark { color: var(--verdigris); }
.bw h3 { font-family: "Marcellus", serif; font-weight: 400; color: var(--verdigris); font-size: 14px; margin: 4px 0 0; }
.bw details > summary { cursor: pointer; color: var(--muted); }
.bw .typo { text-decoration: underline wavy var(--ember); text-underline-offset: 3px; }

/* The exits in the Room editor (mockup A2): one line each, a cartouche for
   the direction, the door and rare marks as line glyphs (glyphs.js), the way
   back last; the exit's editor opens under its line. Colour ranks, shape
   names: muted for the usual, the text colour for doors, gilt for secret,
   hidden and behaviour openers, the warning colour for one-way, sides that
   differ and level gates. Below 330 px the door's and zone's names go into
   the tooltips. */
.bw-exits-sec { container-type: inline-size; display: flex; flex-direction: column; gap: 4px; }
.bw-lbl-n { text-transform: none; letter-spacing: 0; font-family: var(--chrome-font); }
.bw-exits { display: flex; flex-direction: column; }
.bw-x { position: relative; display: flex; align-items: center; gap: 5px; min-height: 25px; padding: 1px 2px; border-bottom: 1px solid var(--rule); }
.bw-x:hover, .bw-x:focus-within { background: var(--ink-raised); }
.bw-x.open { background: var(--ink-raised); box-shadow: inset 2px 0 0 var(--gilt); }
.bw-cart { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 16px; padding: 0 3px; box-sizing: border-box; border: 1px solid var(--gilt); border-radius: 3px; font-family: "Marcellus", serif; font-size: 10px; line-height: 1; letter-spacing: 0.04em; color: var(--gilt); }
.bw-cart.v { background: var(--gilt); color: var(--on-accent); }
.bw-x-to { flex: none; width: 3.4em; font-family: var(--font); font-size: 12px; color: var(--parchment); }
.bw-x-name { flex: 1 1 auto; min-width: 28px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; background: transparent; border: 0; padding: 0; font: inherit; color: var(--parchment); cursor: pointer; }
.bw-x-name:hover, .bw-x-name:focus-visible { color: var(--gilt-bright); outline: none; text-decoration: underline; }
.bw-x-marks { flex: none; display: inline-flex; align-items: center; gap: 3px; }
.bw-x-door { display: inline-flex; align-items: center; gap: 2px; padding: 0 3px; height: 19px; border: 1px solid var(--rule); border-radius: 2px; }
.bw-xm { position: relative; flex: none; display: inline-flex; align-items: center; gap: 2px; height: 18px; color: var(--parchment); }
.bw-xm .glyph { width: 14px; height: 14px; stroke-width: 1.4; }
.bw-xm .t { font-size: 12px; white-space: nowrap; }
.bw-x-door .bw-xm:nth-child(2) .t { font-family: var(--font); font-size: 11px; }
.bw-xm.gilt { color: var(--gilt-bright); }
.bw-xm.warn { color: var(--warn); }
.bw-xm.muted { color: var(--muted); }
.bw-xm.back { width: 16px; justify-content: center; }
.bw-xm.warn .t { font-family: var(--font); font-size: 11px; }
.bw-x-del { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 2px; color: var(--muted); cursor: pointer; visibility: hidden; }
.bw-x:hover .bw-x-del, .bw-x:focus-within .bw-x-del, .bw-x.open .bw-x-del { visibility: visible; }
.bw-x-del:hover:not(:disabled), .bw-x-del:focus-visible { border-color: var(--ember); color: var(--ember); outline: none; }
.bw-x-del:disabled { opacity: 0.4; cursor: default; }
.bw-x-del .glyph { width: 10px; height: 10px; stroke-width: 1.8; }
.bw-x [data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; right: 0; top: calc(100% + 3px); z-index: 30; width: 230px;
  background: var(--ink-high); color: var(--parchment); border: 1px solid var(--gilt); box-shadow: var(--shadow-small);
  padding: 6px 8px; font-family: var(--chrome-font); font-size: 12px; line-height: 1.4; letter-spacing: 0; text-transform: none; white-space: normal; text-align: left; pointer-events: none;
}
.bw-x .bw-cart[data-tip]:hover::after, .bw-x .bw-x-door [data-tip]:hover::after { left: 0; right: auto; }
@container (max-width: 330px) {
  .bw-x-door .bw-xm:first-child .t, .bw-xm.muted .t { display: none; }
  .bw-x-to { width: 3em; }
}
.bw-x-det { display: flex; flex-direction: column; gap: 5px; padding: 6px 8px 8px 10px; margin: 0 0 3px; background: var(--ink); border: 1px solid var(--rule); border-top: 0; }
.bw-x-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bw-x-row > .k { flex: none; width: 62px; font-size: 12px; color: var(--muted); }
.bw-x-row > .bw-fld { width: auto; flex: 1 1 8em; min-width: 0; }
.bw-x-row > .bw-fld.m { font-family: var(--font); flex: 0 1 7em; }
.bw-x-row textarea.bw-fld { flex: 1 1 12em; }
.bw-x-row.end { margin-top: 2px; }
.bw-x-row .bw-sp, .bw-x-row.end .bw-sp { flex: 1; }
.bw-x-det .res { font-size: 12px; color: var(--muted); font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bw-seg { display: inline-flex; }
.bw-seg button { border: 1px solid var(--rule); background: transparent; color: var(--parchment); font: inherit; font-size: 12px; padding: 0 8px; min-height: 22px; cursor: pointer; }
.bw-seg button + button { border-left: 0; }
.bw-seg button:first-child { border-radius: 2px 0 0 2px; }
.bw-seg button:last-child { border-radius: 0 2px 2px 0; }
.bw-seg button.on { background: var(--gilt); border-color: var(--gilt); color: var(--on-accent); }
.bw-seg button:focus-visible { outline: 2px solid var(--gilt-bright); outline-offset: 1px; }
.bw-seg button:disabled { opacity: 0.5; cursor: default; }
.bw-ck { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.bw-ck input { margin: 0; accent-color: var(--gilt); }
.bw-x-more { font-size: 12px; padding-left: 68px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.bw-x-more[open] { display: block; }
.bw-x-more[open] .bw-ck { margin: 3px 12px 0 0; }
.bw-x-note { margin: 0 0 0 68px; font-size: 12px; color: var(--muted); }
.bw-x-fix { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; padding: 2px 0 2px 8px; border-left: 2px solid var(--warn); }
.bw-x-fix.gilt { border-left-color: var(--gilt); }
.bw-x-fix > .glyph { width: 13px; height: 13px; stroke-width: 1.4; color: var(--warn); }
.bw-x-fix.gilt > .glyph { color: var(--gilt-bright); }
.bw-x-fix > span:first-of-type { flex: 1 1 12em; }
.bw-x-fix .res { font-size: 12px; color: var(--muted); font-style: italic; }
.bw-quick-exit-box { position: relative; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.bw-row.nowrap { flex-wrap: nowrap; }
.bw-quick-p { flex: none; font-family: var(--font); font-size: 12px; color: var(--gilt); }
.bw-quick-exit { flex: 1; min-width: 0; font-family: var(--font); }
.bw-quick-pv { font-size: 12px; color: var(--muted); min-height: 1.4em; }
.bw-quick-pv.ok { color: var(--parchment); }
.bw-quick-pv.bad { color: var(--warn); }
.bw-quick-sugg { position: absolute; z-index: 25; left: 44px; right: 0; top: 28px; background: var(--ink-high); border: 1px solid var(--gilt); box-shadow: var(--shadow-small); padding: 2px 0; font-size: 12px; }
.bw-quick-sugg[hidden] { display: none; }
.bw-quick-sugg [role="option"] { padding: 2px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bw-quick-sugg [role="option"].on { background: var(--ink-raised); outline: 1px solid var(--gilt-bright); outline-offset: -1px; }

/* The preview: the room as the game shows it. */
.bw-preview { background: var(--ink); }
.bw-preview .pv-title { font-family: "Marcellus", serif; font-size: 17px; color: var(--gilt); }
.bw-preview .pv-desc { font-family: var(--font); font-size: 13px; line-height: 1.5; }
.bw-preview .pv-desc p { margin: 0 0 0.5em; }
.bw-preview .pv-desc pre { margin: 0; white-space: pre; overflow-x: auto; font: inherit; }
.bw-preview .pv-exits { font-family: var(--font); font-size: 13px; color: var(--i14); }
.bw-preview .pv-thing { font-family: var(--font); font-size: 13px; color: var(--i2); }
.bw-preview .pv-creature { font-family: var(--font); font-size: 13px; color: var(--i11); }
.bw-preview .pv-text { font-family: var(--font); font-size: 13px; }
.bw-preview .pv-note { color: var(--muted); font-size: 12px; }
.bw-preview .pv-label { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-family: "Marcellus", serif; }
.bw-preview .pv-rich { font-family: "Spectral", Georgia, serif; font-size: 14px; line-height: 1.55; }
.bw-preview .pv-rich p { margin: 0 0 0.6em; }
.bw-preview .pv-rich pre { font-family: var(--font); font-size: 13px; white-space: pre; overflow-x: auto; margin: 0 0 0.6em; }
.bw-preview .pv-telnet summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.bw-preview .pv-telnet pre { white-space: pre-wrap; margin: 4px 0 0; }

/* The map. */
.bw-map-body { padding: 0; gap: 0; }
.map-tools { flex: none; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
.map-save { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
.map-save:empty { display: none; }
.map-save > .bw-row { flex-wrap: wrap; align-items: flex-start; }
/* M12: the layers row (build-rooms.js) under the Room editor, the sheets and the Map */
.lay-row .bw-row { flex-wrap: wrap; align-items: flex-start; }
.lay-archives summary { cursor: pointer; font-size: 12px; color: var(--muted, inherit); }
.lay-archives .bw-issues li { align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.lay-inplace { font-size: 12px; }
.m3-chip.quiet { opacity: .75; }
.lay-chip { font-size: 12px; }
.lay-chip.ok { border-color: var(--verdigris); color: var(--verdigris); }
.map-stage { position: relative; flex: 1; min-height: 120px; overflow: auto; background: var(--ink); touch-action: none; }
.map-stage svg { display: block; }
.map-room rect { fill: var(--ink-raised); stroke-width: 1.2; }
.map-room text { font-family: var(--font); font-size: 10px; fill: var(--parchment); pointer-events: none; }
.map-room text.n { fill: var(--muted); }
.map-room.here rect { fill: var(--gilt); }
.map-room.here text { fill: var(--on-accent); }
.map-room.sel rect { stroke: var(--gilt-bright) !important; stroke-width: 2.4; }
.map-room.focus rect { stroke-dasharray: 3 2; }
.map-room.bad rect { stroke: var(--ember) !important; }
.map-room.pending rect { fill: var(--ink-high); stroke-dasharray: 5 2; }
.map-room { cursor: pointer; }
.map-link { stroke: var(--muted); stroke-width: 1; }
.map-link.door { stroke: var(--gilt); stroke-width: 3; }
.map-link.oneway { stroke-dasharray: 4 3; }
.map-link.out { stroke: var(--i8); }
.map-handle { fill: var(--gilt); opacity: 0.85; cursor: crosshair; }
.map-handle:hover { opacity: 1; }
.map-ghost rect { fill: none; stroke: var(--gilt-bright); stroke-dasharray: 4 3; }
.map-ghost text { font-family: var(--font); font-size: 10px; fill: var(--gilt-bright); }
.map-lasso { fill: rgba(199, 162, 75, 0.08); stroke: var(--gilt); stroke-dasharray: 3 3; }
.map-legend { flex: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 8px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.map-key { display: inline-block; width: 10px; height: 10px; border: 1px solid; vertical-align: -1px; margin-right: 3px; }
.map-list { max-height: 40%; overflow: auto; border-top: 1px solid var(--rule); padding: 6px 8px; font-size: 13px; }
.map-list ul { list-style: none; margin: 0; padding: 0; }
.map-list li { padding: 1px 0; }
.map-list button { font: inherit; color: var(--parchment); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.map-list button:hover, .map-list button:focus-visible { color: var(--gilt-bright); outline: none; }

/* The zone grid and mass editing. */
.grid-wrap { flex: 1 1 180px; min-height: 140px; overflow: auto; border: 1px solid var(--rule); }
.grid-wrap table { font-size: 13px; }
.grid-wrap thead th { position: sticky; top: 0; background: var(--ink-high); z-index: 1; }
.grid-wrap td { padding: 2px 4px; }
.grid-wrap tr.sel td { background: var(--ink-raised); }
.grid-wrap td.changed { background: rgba(199, 162, 75, 0.12); }
.grid-wrap td.changed .was { display: block; font-size: 11px; color: var(--muted); }
.grid-wrap td.out { color: var(--muted); }
.grid-wrap input.cell { min-width: 6em; }
.grid-wrap input.cell, .grid-wrap select.cell { width: 100%; box-sizing: border-box; background: transparent; border: 1px solid transparent; color: var(--parchment); font: inherit; padding: 1px 4px; }
.grid-wrap input.cell:focus, .grid-wrap select.cell:focus { border-color: var(--gilt); outline: none; background: var(--ink); }
.grid-wrap .desc-cell { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); cursor: pointer; }
.grid-bar { flex: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-filter, .quick-in { font-family: var(--font); font-size: 13px; }
.grid-filter::placeholder, .quick-in::placeholder { color: var(--muted); font-style: italic; opacity: 1; }

/* The bar under the grid: the selection, the tools, what is staged. */
.grid-acts { gap: 6px; row-gap: 6px; }
.grid-acts .bw-btn.small { display: inline-flex; align-items: center; gap: 5px; height: 22px; box-sizing: border-box; padding: 0 8px; }
.glyph { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.grid-sel { display: inline-flex; align-items: center; gap: 4px; height: 22px; box-sizing: border-box; padding: 0 9px; border: 1px solid var(--rule); border-radius: 11px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.grid-sel.on { border-color: var(--gilt); color: var(--gilt-bright); background: var(--ink-raised); padding-right: 3px; }
.grid-clear { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
.grid-clear .glyph { width: 10px; height: 10px; stroke-width: 1.8; }
.grid-clear:hover, .grid-clear:focus-visible { background: var(--gilt); color: var(--on-accent); outline: none; }
.grid-clear[hidden] { display: none; }
.grid-shown { font-size: 12px; color: var(--muted); white-space: nowrap; }
.grid-sep { width: 1px; height: 16px; background: var(--rule); margin: 0 2px; }
.grid-sp { flex: 1; }
.grid-none { font-size: 12px; color: var(--muted); white-space: nowrap; }
.grid-pending { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.grid-pending[hidden], .grid-none[hidden] { display: none; }
.grid-badge { font-size: 12px; color: var(--parchment); }
.grid-badge b { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; box-sizing: border-box; padding: 0 5px; margin-right: 1px; border-radius: 9px; background: var(--gilt); color: var(--on-accent); font-family: "Spectral", Georgia, serif; font-weight: 600; font-size: 12px; vertical-align: 1px; }

/* The quick line: a slim command field with a prompt. */
.quick { position: relative; flex: none; display: flex; align-items: center; height: 26px; box-sizing: border-box; border: 1px solid var(--rule); border-radius: 2px; background: var(--ink); }
.quick:focus-within { border-color: var(--gilt); }
.quick-prompt { font-family: var(--font); font-size: 13px; color: var(--gilt); padding: 0 6px 0 8px; user-select: none; }
.quick-in { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: none; color: var(--parchment); outline: none; }
.quick-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 2px; background: none; color: var(--muted); cursor: pointer; }
.quick-btn:last-of-type { margin-right: 2px; }
.quick-btn:hover, .quick-btn:focus-visible, .quick-btn[aria-expanded="true"] { color: var(--gilt-bright); outline: none; }
.quick-btn:focus-visible { box-shadow: inset 0 0 0 1px var(--gilt); }
.quick-ac { position: absolute; left: 22px; bottom: calc(100% + 2px); z-index: 5; margin: 0; padding: 3px 0; list-style: none; min-width: 240px; max-width: calc(100% - 30px); background: var(--ink-high); border: 1px solid var(--gilt); box-shadow: var(--shadow-small); }
.quick-ac[hidden] { display: none; }
.quick-ac li { display: flex; gap: 10px; align-items: baseline; padding: 2px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.quick-ac li[aria-selected="true"], .quick-ac li:hover { background: var(--ink-raised); color: var(--gilt-bright); }
.quick-ac kbd { font-family: var(--font); font-size: 12px; flex: none; }
.quick-ac span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* What came of it: the latest line, and the whole log under History. */
.quick-last { flex: none; min-height: 16px; margin-top: -4px; font-size: 12px; color: var(--muted); }
.quick-last[hidden], .quick-log[hidden] { display: none; }
.quick-last .entry { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-hint { font-family: "Spectral", Georgia, serif; font-style: italic; font-size: 13px; }
.quick-log { flex: none; margin-top: -4px; max-height: 9.5em; overflow: auto; font-size: 12px; color: var(--muted); border-left: 1px solid var(--rule); padding: 2px 0 2px 8px; display: flex; flex-direction: column; gap: 2px; }
.quick-log:focus-visible { outline: 1px solid var(--gilt); }
.quick-log .entry { overflow-wrap: anywhere; }
.entry kbd { font-family: var(--font); font-size: 12px; color: var(--muted); margin-right: 8px; }
.entry .msg { color: var(--parchment); }
.entry.err .msg { color: var(--ember); }
.quick-help { display: grid; grid-template-columns: fit-content(45%) 1fr; column-gap: 12px; row-gap: 1px; margin: 3px 0 2px; }
.quick-help dt { font-family: var(--font); font-size: 12px; color: var(--parchment); }
.quick-help dd { margin: 0; color: var(--muted); }
#bw-grid .bw-body { overflow-x: hidden; gap: 8px; }
#bw-grid .grid-bar { min-width: 0; }
.diff { display: flex; flex-direction: column; gap: 6px; flex: none; max-height: 45%; overflow: auto; }
.diff:empty { display: none; }
.diff .diff { max-height: none; overflow: visible; }
.diff .rec { border: 1px solid var(--rule); padding: 4px 8px; }
.diff del { color: var(--ember); text-decoration: line-through; }
.diff ins { color: var(--verdigris); text-decoration: underline; }
.diff .f { font-size: 12px; color: var(--muted); }
.matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.matches mark { background: none; color: var(--gilt-bright); text-decoration: underline; }

/* Building, in the game window. */
#lines > .rows > div.build-hover, #tail-lines > .rows > div.build-hover { outline: 1px dashed var(--gilt-deep); outline-offset: 1px; cursor: pointer; background: rgba(199, 162, 75, 0.06); }
#build-edit-chip { font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; background: none; border: 1px solid var(--rule); color: var(--muted); border-radius: 2px; padding: 0 8px; margin-left: 8px; cursor: pointer; }
#build-edit-chip[aria-pressed="true"] { border-color: var(--gilt); color: var(--on-accent); background: var(--gilt); }
.build-menu { position: fixed; z-index: 20; background: var(--ink-high); border: 1px solid var(--gilt); box-shadow: var(--shadow-small); display: flex; flex-direction: column; min-width: 200px; padding: 4px 0; font-family: var(--chrome-font); font-size: var(--chrome-size); }
.build-menu button { font: inherit; text-align: left; background: none; border: 0; color: var(--parchment); padding: 5px 14px; cursor: pointer; }
.build-menu button:hover, .build-menu button:focus-visible { background: var(--ink-raised); color: var(--gilt-bright); outline: none; }
.build-dig { position: fixed; z-index: 21; width: min(460px, calc(100vw - 32px)); background: var(--ink-high); border: 1px solid var(--gilt); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-family: var(--chrome-font); font-size: var(--chrome-size); color: var(--parchment); }
.build-dig[hidden] { display: none; }
.build-dig h2 { margin: 0; font-family: "Marcellus", serif; font-weight: 400; font-size: 16px; color: var(--gilt); }

/* Room flags, grouped (mockup D1), each with what it does on hover and focus. */
.bw-flaggroups { columns: 8.5em; column-gap: 16px; }
.bw-flaggroup { break-inside: avoid; border: 0; border-top: 1px solid var(--rule); margin: 0 0 8px; padding: 4px 0 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bw-flaggroup legend { font-family: "Marcellus", serif; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--verdigris); padding: 0 4px 0 0; }
.bw-flag { position: relative; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--parchment); cursor: pointer; padding: 1px 2px; border-radius: 2px; }
.bw-flag input { margin: 0; accent-color: var(--gilt); }
.bw-flag.on { color: var(--gilt-bright); }
.bw-flag:hover, .bw-flag:focus-within { background: var(--ink-raised); }
.bw-flag[data-tip]:hover::after, .bw-flag[data-tip]:focus-within::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: 100%; z-index: 30; width: max(220px, 100%); max-width: 300px;
  background: var(--ink-high); color: var(--parchment); border: 1px solid var(--gilt); box-shadow: var(--shadow-small);
  padding: 6px 8px; font-size: 12px; line-height: 1.4; white-space: normal; pointer-events: none;
}
.bw-flaggroup .bw-muted { font-size: 11px; text-transform: none; letter-spacing: 0; }

/* The Room editor's description: shown as players see it (the Room
   window's .room-desc rules, room.css), with Edit opening the rich
   editor's window (#bw-descedit; the editor's own rules, richedit.css). */
.bw-desc-head { margin-bottom: 3px; }
.bw-desc-head .bw-lbl { margin: 0; }
.bw-desc-view {
  margin-top: 0;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--ink);
  max-height: 16em;
  overflow: auto;
}
.bw-desc-view:focus-visible { outline: 1px solid var(--gilt); }
.bw-desc-view > :last-child { margin-bottom: 0; }
.bw-desc-view pre { overflow-x: auto; }
.bw-extra .bw-desc-view { margin-top: 6px; max-height: 10em; }

/* a dialog: above the windows, phone-width sheets (z-index 9) included */
#bw-descedit { z-index: 10; width: min(720px, calc(100vw - 32px)); height: min(520px, calc(100vh - 80px)); }
#bw-descedit > .bw-body { padding: 0; gap: 0; overflow: hidden; }
#bw-descedit #richedit-desc { flex: 1; min-height: 0; }
#bw-descedit .re select.re-select { display: inline-block; width: auto; }
#bw-descedit .bw-note { margin: 8px 10px 0; }
#bw-descedit .bw-note .bw-btn { margin-top: 4px; }
#bw-descedit .bw-desc-plain {
  flex: 1;
  min-height: 6em;
  margin: 8px 10px 0;
  width: auto;
  resize: none;
  font-family: var(--font);
  font-size: 13px;
  white-space: pre;
}
#bw-descedit .bw-desc-plain[hidden] { display: none; }
#bw-descedit .bw-desc-foot { flex: none; padding: 8px 10px; border-top: 1px solid var(--rule); }
@media (max-width: 520px) {
  #bw-descedit { width: calc(100vw - 16px); }
}

/* Building M3: the creature and object sheets (build-mobobj.js), shown in
   the Room editor's window; canvas O1's sections, O2's type section, O3's
   preview, O4's dressing view (Restage), B's grid tabs. Every colour from
   the theme, so Arcane and Daylight both hold. */
.m3-top { gap: 6px; }
.m3-top .m3-open { width: 9em; font-family: var(--font); font-size: 12px; padding: 2px 6px; }
.m3-top .m3-kindsel { width: auto; font-size: 12px; padding: 2px 4px; }
.m3-chip.ok { border-color: var(--verdigris); color: var(--verdigris); }
.m3-chip.bad { border-color: var(--ember); color: var(--ember); }
.m3-chip.warn { border-color: var(--warn); color: var(--warn); }
.m3-state { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--rule); border-radius: 2px; padding: 6px 10px; background: var(--ink); }
.m3-state-line { margin: 0; font-size: 13px; }
.m3-state-line b { font-weight: 600; color: var(--parchment); }
.m3-state-line.ok b { color: var(--verdigris); }
.m3-state-line.bad b { color: var(--ember); }
.m3-state-line.muted { color: var(--muted); font-size: 12px; }
.m3-acts { gap: 10px; align-items: flex-start; }
.m3-act { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.m3-cmd { font-family: var(--font); font-size: 11px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.m3-small { font-size: 12px; margin: 0; }
.m3-sec { border-top: 1px solid var(--rule); padding-top: 4px; }
.m3-sec > summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; font-family: "Marcellus", serif; font-size: 14px; color: var(--verdigris); }
.m3-sec > summary::-webkit-details-marker { display: none; }
.m3-sec > summary::before { content: "▸"; font-size: 11px; color: var(--muted); width: 10px; }
.m3-sec[open] > summary::before { content: "▾"; }
.m3-sec > summary:focus-visible { outline: 1px solid var(--gilt); }
.m3-sec-n { font-family: "Spectral", Georgia, serif; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.m3-sec[open] > summary .m3-sec-n { visibility: hidden; }
.m3-sec-b { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 4px; }
.m3-g { display: grid; gap: 8px 10px; }
.m3-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m3-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m3-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m3-g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.m3-f { display: block; min-width: 0; }
.m3-f.wide, .m3-g > .m3-tw:has(.wide) { grid-column: 1 / -1; }
.bw .m3-in { padding: 2px 6px; font-size: 13.5px; min-height: 26px; }
.bw .m3-in.name { font-size: 15px; }
.m3-g4 .bw-lbl, .m3-g6 .bw-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m3-in.mono, .bw-fld.mono { font-family: var(--font); font-size: 13px; }
.m3-in[readonly], .bw-fld[readonly] { border-style: dashed; color: var(--parchment); }
.m3-num { width: 5.5em; }
.m3-dice { display: flex; align-items: center; gap: 4px; }
.m3-dice .bw-fld { width: 3.4em; }
.m3-worn { font-size: 13px; padding-top: 2px; }
/* a field's tooltip: hover and keyboard focus, with the command under it */
.m3-tw { position: relative; display: block; min-width: 0; }
.m3-tw.block { display: block; }
.bw-flaggroup .m3-tw, .m3-deadlist .m3-tw, .m3-vary .m3-tw, .bw-chips .m3-tw, .m3-sent .m3-tw, .m3-bhead .m3-tw { display: inline-block; }
.bw-tip { display: none; position: absolute; left: 8px; top: 100%; z-index: 30; width: max-content; max-width: min(300px, 80vw); background: var(--ink-high); color: var(--parchment); border: 1px solid var(--gilt); box-shadow: var(--shadow-small); padding: 6px 9px; font-family: "Spectral", Georgia, serif; font-size: 12.5px; line-height: 1.45; text-transform: none; letter-spacing: 0; white-space: normal; pointer-events: none; }
.bw-tip:empty { display: none !important; }
.bw-tip .k { display: block; margin-top: 3px; font-family: var(--font); font-size: 11.5px; color: var(--gilt); }
.m3-tw:hover > .bw-tip, .m3-tw:focus-within > .bw-tip { display: block; }
.m3-g > .m3-tw:nth-child(4n) > .bw-tip, .m3-g > .m3-tw:nth-child(4n + 3) > .bw-tip { left: auto; right: 0; }
.m3-flag { display: inline-flex; }
.m3-flag.dead span { color: var(--muted); text-decoration: line-through; }
.m3-flag.on.dead span { color: var(--warn); }
.m3-flag input[aria-disabled="true"] { opacity: 0.6; }
.m3-flags { columns: 9.5em; column-gap: 16px; }
.m3-flags .bw-flaggroup { display: block; }
.m3-flags .bw-flaggroup .m3-tw { display: block; }
.m3-deadflags { break-inside: avoid; font-size: 12px; }
.m3-deadflags > summary { color: var(--muted); }
.m3-deadlist { display: flex; flex-wrap: wrap; gap: 2px 12px; padding-top: 3px; }
.m3-vary { gap: 10px; align-items: flex-end; }
.m3-vary .m3-tw { width: 7.5em; }
.m3-affects { align-items: center; }
.bw .m3-addsel, .bw .m3-kindsel { width: auto; font-size: 12px; padding: 1px 4px; }
.m3-more > summary { font-size: 12px; }
.m3-extras { display: flex; flex-direction: column; gap: 6px; }
.m3-grants, .m3-behavs, .m3-skills, .m3-factions { display: flex; flex-direction: column; gap: 6px; }
.m3-grant { border-bottom: 1px solid var(--rule); padding-bottom: 3px; }
.m3-grant .bw-fld { width: 5em; }
.m3-addgrant .bw-fld, .m3-addbehav .bw-fld:first-child { width: auto; }
.m3-addbehav .bw-fld:nth-child(2) { flex: 1; min-width: 8em; }
.m3-behav { border: 1px solid var(--rule); border-radius: 2px; padding: 6px 8px; background: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.m3-bhead { gap: 6px; }
.m3-bn { font-family: var(--font); font-size: 12px; color: var(--muted); }
.m3-bname { font-family: "Marcellus", serif; font-weight: 400; color: var(--gilt); }
.m3-bname.dead { color: var(--muted); text-decoration: line-through; }
.m3-bline, .m3-msg, .m3-script { font-family: var(--font); font-size: 13px; min-height: 2.6em; }
.m3-form { display: flex; flex-direction: column; gap: 6px; }
.m3-code { margin: 0; max-height: 9em; overflow: auto; padding: 5px 8px; border: 1px solid var(--rule); background: var(--ink-high); font-family: var(--font); font-size: 12.5px; white-space: pre-wrap; }
.m3-left { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.m3-grantnote p { margin: 0 0 6px; }
.m3-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--rule); padding-top: 8px; }
.m3-footrow { align-items: flex-start; }
.m3-save p, .m3-copy p { margin: 0 0 6px; }
.m3-save .bw-fld, .m3-copy .bw-fld { width: auto; }
/* As players see it */
.m3-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.m3-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-family: "Marcellus", serif; font-size: 13px; padding: 5px 9px 4px; cursor: pointer; white-space: nowrap; }
.m3-tab[aria-selected="true"] { color: var(--gilt-bright); border-bottom-color: var(--gilt); }
.m3-tab:focus-visible { outline: 1px solid var(--gilt); }
.m3-tabn { font-family: "Spectral", Georgia, serif; font-size: 11px; color: var(--muted); }
.m3-viewer { gap: 6px; font-size: 12px; }
.m3-pv { display: flex; flex-direction: column; gap: 4px; font-family: var(--font); font-size: 13px; line-height: 1.5; }
.m3-pvline { white-space: pre-wrap; text-align: left; }
.m3-pvline.ed { font: inherit; color: var(--parchment); background: none; border: 0; outline: 1px dashed var(--gilt); outline-offset: 1px; padding: 1px 3px; cursor: text; }
.m3-pvline.ed:hover, .m3-pvline.ed:focus-visible { outline: 2px solid var(--gilt-bright); background: var(--ink-raised); }
.m3-pvline.game { color: var(--parchment); padding: 1px 3px; }
.m3-why { color: var(--muted); font-size: 11.5px; font-family: "Spectral", Georgia, serif; font-style: italic; }
/* Carries and lives in */
.m3-lives { display: flex; flex-direction: column; gap: 8px; }
.m3-zone p { margin: 0 0 4px; font-size: 13px; }
.m3-zoneedit { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.m3-place { display: flex; flex-direction: column; gap: 4px; }
.m3-sent { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; }
.m3-sent.under { padding-left: 14px; color: var(--parchment); }
.m3-sent-t:focus-visible { outline: 1px solid var(--gilt); }
.m3-limit { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.m3-limit .bw-fld, .m3-limitrow .bw-fld { width: 4.5em; }
.bw-chip.warn { border-color: var(--warn); color: var(--warn); }
/* Restage: the dressing view */
#bw-restage { z-index: 10; width: min(760px, calc(100vw - 32px)); height: min(640px, calc(100vh - 80px)); }
#bw-script { z-index: 11; width: min(640px, calc(100vw - 32px)); height: min(420px, calc(100vh - 80px)); }
#bw-script .m3-script { flex: 1; resize: none; }
.m3-steps { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; counter-reset: st; flex-wrap: wrap; }
.m3-steps li { counter-increment: st; font-size: 12px; color: var(--muted); border: 1px solid var(--rule); border-radius: 11px; padding: 0 9px; }
.m3-steps li::before { content: counter(st) ". "; }
.m3-steps li.on { color: var(--on-accent); background: var(--gilt); border-color: var(--gilt); }
.m3-steps li.done { color: var(--verdigris); border-color: var(--verdigris); }
.m3-removes, .m3-loses { font-size: 13px; }
.m3-confirms { display: flex; flex-direction: column; gap: 3px; }
.m3-flag.warn span { color: var(--warn); }
.m3-arrange { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; min-height: 0; }
.m3-dressing { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.m3-dress { border: 1px solid var(--rule); border-radius: 2px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.m3-slotgrp { display: flex; flex-direction: column; }
.m3-slotgrp > summary { font-size: 12px; color: var(--muted); }
.m3-slot { display: grid; grid-template-columns: 9.5em minmax(0, 1fr) auto; gap: 6px; align-items: center; min-height: 24px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.m3-slot.tgt { background: var(--ink-raised); }
.m3-sl { font-family: var(--font); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m3-item { color: var(--parchment); }
.m3-drop { font: inherit; font-size: 12px; text-align: left; border: 1px dashed var(--rule); border-radius: 2px; background: none; color: var(--muted); padding: 0 8px; min-height: 20px; cursor: pointer; }
.m3-drop:hover, .m3-drop:focus-visible, .m3-drop.tgt { border-color: var(--gilt-bright); color: var(--gilt-bright); outline: none; background: var(--ink-raised); }
.m3-carry { display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.m3-shelfbox { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m3-shelf { display: flex; flex-direction: column; max-height: 22em; overflow: auto; border: 1px solid var(--rule); }
.m3-shelf-it { display: flex; gap: 6px; align-items: center; min-height: 24px; padding: 0 6px; border-bottom: 1px solid var(--rule); font-size: 13px; cursor: grab; }
.m3-shelf-it:hover, .m3-shelf-it:focus-visible { background: var(--ink-raised); outline: 1px solid var(--gilt); outline-offset: -1px; }
.m3-next { display: flex; flex-direction: column; gap: 4px; border-color: var(--gilt); }
.m3-next p { margin: 0; }
.m3-cmds { display: flex; flex-direction: column; gap: 1px; }
.m3-cmds code, .m3-lines code { font-family: var(--font); font-size: 12px; color: var(--gilt); }
.m3-lines { margin: 0; padding-left: 1.2em; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
/* the Zone grid's Creatures and Objects */
.grid-tabs { flex: none; }
.m3-rowname { font: inherit; background: none; border: 0; padding: 0; color: var(--parchment); cursor: pointer; text-align: left; }
.m3-rowname:hover, .m3-rowname:focus-visible { color: var(--gilt-bright); text-decoration: underline; outline: none; }
.grid-wrap tr.ro td { color: var(--muted); }
.grid-wrap tr.ro .m3-rowname { color: var(--muted); }
.grid-wrap td.n { font-family: var(--font); font-size: 12.5px; text-align: right; white-space: nowrap; }
.grid-wrap td.m3-wide { font-size: 12px; min-width: 8em; }
.grid-wrap td.m3-outlier { color: var(--warn); }
.m3-omark { color: var(--warn); font-size: 10px; }
.m3-gpreview { border: 1px solid var(--gilt); border-radius: 2px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; max-height: 18em; overflow: auto; }
.m3-gpreview h3 { margin: 0; }
.m3-pvlist, .m3-notes { margin: 0; padding-left: 1.1em; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.m3-notes { color: var(--muted); font-size: 12px; }
.m3-qlast { font-size: 12px; color: var(--muted); }

/* narrow: the pinned column (420 px) and a phone */
@container (max-width: 330px) {
  .m3-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m3-g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m3-g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#bw-roomedit > .bw-body { container-type: inline-size; }
@media (max-width: 560px) {
  .m3-arrange { grid-template-columns: minmax(0, 1fr); }
  .m3-slot { grid-template-columns: 7.5em minmax(0, 1fr) auto; }
  #bw-restage { width: calc(100vw - 16px); height: calc(100vh - 60px); }
}
.m3-extras .bw-row { flex-wrap: nowrap; }
.m3-extras .bw-row .bw-fld { flex: 1; width: auto; min-width: 5em; }
.bw .m3-glyphbtn, .m3-lookl { display: inline-flex; align-items: center; gap: 5px; }
.m3-glyphbtn .glyph, .m3-lookl .glyph, .m3-shelf-it .glyph, .grid-acts .tool .glyph { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.m3-odd { color: var(--warn); }

/* AI assistant's changes (build-changes.js, CS5) */
.bw-claude { width: 460px; height: 420px; min-width: 280px; min-height: 180px; }
.bw-claude-cmd { font-family: var(--font); font-size: 12px; color: var(--muted); }
.bw-claude-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bw-claude-row { all: unset; cursor: pointer; display: block; padding: 3px 6px; border: 1px solid transparent; }
.bw-claude-item { display: flex; align-items: center; gap: 6px; }
.bw-claude-item .bw-claude-row { flex: 1; }
.bw-claude-row:hover, .bw-claude-row:focus-visible { border-color: var(--gilt); }
