/* ---------- the table view (src/areas.js) ----------
   An open place takes the whole table: the desk objects slide off past the edges, the felt grows until only a wooden
   border is left, and the place's object travels to the middle and opens there. A place with its own pixel-art scene
   (.area) turns the panel into a world-frame layer like the desk: --a is one art pixel (two world pixels), and every
   piece sits at art-pixel coordinates of the 320×180 frame (.at with --x, --y, --w, --h). */
#stage.table-view #leftdock { opacity: 0; pointer-events: none; }
/* a row's items that did not fit go whole (areas.js fitRow), and so do the extra parts of text that still runs long at
   its least print (fitText) */
:is(.fit-item, .fit-rest, .fit-extra)[hidden] { display: none !important; }
.desklayer.cleared .dobj, .desklayer.cleared .till-chip, .desklayer.cleared .mat-ui > * { pointer-events: none; }

/* In a run the felt is already the whole table: the run's own pieces slide off past their nearest edge while a place is
   open, and slide back once it has gone (the cash pill and the toolbar stay, to switch places). areas.js moves them
   between where they stand and these spots on the clock of the change, with everything else and at the run's pace
   (TableView.shiftCss, PACE), so no css transition times them. */
#stage[data-mode="run"].table-view :is(#charms, #dayBox, #tray, #leftdock, #packRail) { pointer-events: none; }
#stage[data-mode="run"].table-view #dayBox { translate: 0 calc(-100% - var(--u) * 12); }
#stage[data-mode="run"].table-view #tray { translate: calc(100% + var(--u) * 12) 0; }
#stage[data-mode="run"].table-view :is(#leftdock, #charms) { translate: calc(-100% - var(--u) * 12) 0; opacity: 1; }
#stage[data-mode="run"].table-view #packRail { translate: 0 calc(100% + var(--u) * 12); }
#stage[data-mode="run"].table-view #hint { opacity: 0; animation: none; }
/* a run's scene dialog (the night market, the summary) holds the whole screen: the cash pill and the toolbar leave too,
   off the top, and the scene carries what it needs of them (the night's header has the toolbar's plaques, its till the
   cash). A place keeps them, to switch places. */
#stage[data-mode="run"].table-view.dlg-scene #topbar { translate: 0 calc(-100% - var(--u) * 12); }
#stage[data-mode="run"].table-view.dlg-scene #topbar > * { pointer-events: none; }
/* A place that carries its own HUD (src/scenes/hud.js) sends the HUD's pills and bars off the top too, at home and in a
   run, and draws what it needs of them in its own art (.hudb below). Gus's tablet keeps them, in its status bar. */
#stage.table-view.own-hud :is(#topbar, #sysbar) { translate: 0 calc(-100% - var(--u) * 12); }
#stage.table-view.own-hud :is(#topbar, #sysbar), #stage.table-view.own-hud :is(#topbar, #sysbar) * { pointer-events: none; }
#stage.own-hud :is(.focus-x, .focus-bar) { display: none !important; }

/* the object's flying copy, laid out once and moved by its transform (areas.js); places without art (yet) fly a paper
   card */
.desk-hero { position: absolute; z-index: 25; image-rendering: pixelated; pointer-events: none; transform-origin: 50% 50%; will-change: transform, opacity; }
.desk-hero :is(img, canvas) { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.desk-hero.plain { background: var(--paper); border: calc(var(--g) * 2) solid var(--ink); border-radius: calc(var(--g) * 3); box-shadow: 0 calc(var(--g) * 3) 0 rgba(35, 32, 28, 0.38); }
/* a copy that turns in the air (areas.js AREAS turn) flies standing, as its closed art; its desk sprite turns back the
   other way about the copy's centre (--turn), with the sides swapped, so it lies as it did on the desk */
.desk-hero.turned { container-type: size; }
.desk-hero.turned .h-desk { inset: auto; left: 50%; top: 50%; width: 100cqh; height: 100cqw; translate: -50% -50%; rotate: var(--turn); }

/* the panel waits, drawn but unseen (areas.js holds it at opacity 0), while its object is in the air, and takes no
   clicks; a framed panel then scales up out of it (areas.js, on the change's clock, in place of css's own entrance) */
#panel:is(.arriving, .opening, .opened, .closing) { animation: none; }
#panel.arriving, #panel.arriving * { pointer-events: none !important; }
/* a place drawn ahead while it is closed (ui.prerender): laid out under the desk, unseen and out of reach */
#panel.standby { visibility: hidden; }
/* A page whose pictures are still arriving stays unseen as one layer, including its HUD and labels. */
#panel.art-wait, #modal.art-wait { opacity: 0 !important; }
#panel img.img-wait, #modal img.img-wait { opacity: 0; } /* a redraw's picture not decoded yet (UI.redrawArt) */
#panel.art-wait, #panel.art-wait *, #modal.art-wait, #modal.art-wait * { pointer-events: none !important; }
.panel-ghost.closing { pointer-events: none; }
#panel:focus, #modal:focus { outline: none; } /* the open place or dialog holds the keyboard focus (ui.focusPlace, openModal); its controls show their own */

/* ---------- a place drawn as its own scene ---------- */
#panel.area { left: var(--ox); top: var(--oy); right: auto; bottom: auto; width: calc(var(--g) * 640); height: calc(var(--g) * 360); padding: 0; display: block;
  border-radius: 0; box-shadow: none; background: none; overflow: visible; animation: none; pointer-events: none; text-shadow: none;
  --a: calc(var(--g) * 2); --u: var(--g); --fu: calc(var(--g) * var(--fs)); --outline: none; }
#panel.area .at { position: absolute; left: calc(var(--a) * var(--x)); top: calc(var(--a) * var(--y)); width: calc(var(--a) * var(--w)); height: calc(var(--a) * var(--h)); }
#panel.area img.art { display: block; image-rendering: pixelated; -webkit-user-drag: none; user-select: none; }
/* the felt between pieces lets clicks through (a click on the bare table closes the place); the pieces themselves catch them */
#panel.area .solid, #panel.area button, #panel.area input, #panel.area select, #panel.area label, #panel.area [data-act], #panel.area [data-tip] { pointer-events: auto; }
#panel.area > .x { left: auto; right: auto; top: calc(var(--a) * 19); left: calc(var(--a) * 296); width: calc(var(--a) * 11); height: calc(var(--a) * 11); padding: 0; display: grid; place-items: center;
  font-family: var(--font-px); font-size: calc(var(--g) * 9); color: var(--ink); background: var(--brass-lt); border: calc(var(--g) * 1.5) solid var(--ink); border-radius: 50%;
  box-shadow: inset 0 var(--g) 0 #fff2b0, inset 0 calc(var(--g) * -1) 0 var(--brass), 0 calc(var(--g) * 2) 0 rgba(35, 32, 28, 0.45); pointer-events: auto; z-index: 30; }
#panel.area > .x:hover { background: #fff2b0; }
#panel.area.arriving > .x, #panel.area.opening > .x, #panel.area.closing > .x { opacity: 0; }
#panel.area.opened > .x { animation: areaFade 0.2s ease both; }
@keyframes areaFade { from { opacity: 0; } }

/* the UI of a place cascades in once its object has opened */
#panel.area .ui-in { transition: opacity 0.22s ease, translate 0.22s ease; }
#panel.area.arriving .ui-in, #panel.area.opening .ui-in { opacity: 0; translate: 0 calc(var(--a) * 3); }
#panel.area.opened .ui-in { transition-delay: calc(var(--i, 0) * 30ms); }
body.calm #panel.area .ui-in { transition: none; }

/* while a place arrives, opens or closes, nothing in it takes clicks; its UI fades out as it closes */
#panel.area:is(.arriving, .opening, .closing) * { pointer-events: none !important; }
#panel.area.closing .ui-in { opacity: 0; transition: opacity 0.12s ease; }

/* ---------- books (the binder, the rulebook): areas.js swing() ----------
   .bk slides while the cover leaf turns about the spine (--hx); .bk-flat is everything that lies open, clipped to the
   right of the spine while the cover still covers it (.folded). The leaf's back face holds a copy of .bk-flat, shifted
   so the left half of the open book shows on it. */
#panel.area .bk { position: absolute; inset: 0; perspective: calc(var(--a) * 1100); perspective-origin: calc(var(--a) * var(--hx)) calc(var(--a) * 94); }
#panel.area .bk-flat { position: absolute; inset: 0; }
#panel.area .bk.folded > .bk-flat { clip-path: inset(0 0 0 calc(var(--a) * var(--hx))); }
#panel.area .bk-leaf { z-index: 8; transform-origin: 0 50%; transform-style: preserve-3d; }
#panel.area .bk-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: no-repeat 0 0 / 100% 100%; image-rendering: pixelated; }
#panel.area .bk-face.back { transform: rotateY(180deg); overflow: hidden; }
/* the shade a face takes as it turns edge-on (areas.js animates its opacity); both faces are opaque art */
#panel.area .bk-face::after { content: ""; position: absolute; inset: 0; z-index: 9; background: #1d1830; opacity: 0; pointer-events: none; }
#panel.area .flip-layer { perspective: calc(var(--a) * 1100); } /* a page turning over in a scene: the same depth as the cover */
#panel.area .flip-layer > .flip-leaf { z-index: 2; } /* over the resting page, which keeps the pages' z-index 1 */
#panel.area .bk-copy { position: absolute; left: calc(var(--a) * var(--ix) * -1); top: calc(var(--a) * var(--iy) * -1); width: calc(var(--a) * 320); height: calc(var(--a) * 180); }

/* ---------- the binder (ui.binderScene; art/areas/binder/layout.json) ---------- */
#panel.area .bk-pages { position: absolute; inset: 0; }
/* each pocket page carries its own piece of the spread, so a turning page shows its plastic and backing */
#panel.area .bpage { display: block; padding: 0; gap: 0; border: 0; border-radius: 0; box-shadow: none; z-index: 1; image-rendering: pixelated;
  background: url(../art/areas/binder/spread.png) no-repeat calc(var(--a) * var(--bx)) calc(var(--a) * var(--by)) / calc(var(--a) * 254) calc(var(--a) * 153); }
#panel.area .bpage:has(.f-pop) { z-index: 5; } /* the find menu opens over the pockets, above the sheen and the tabs */
#panel.area .bk-sheen { z-index: 2; }
#panel.area .pk-at { z-index: 1; }
#panel.area .pocket { position: absolute; inset: 0; padding: 0; border: 0; border-radius: 0; background: none; overflow: visible; transition: translate 0.1s ease; }
#panel.area .pocket::after { content: none; }
#panel.area .pocket:hover, #panel.area .pocket:focus-visible { transform: none; translate: 0 calc(var(--a) * -1); outline: var(--g) solid #f3ead2; outline-offset: 0; z-index: 2; }
#panel.area .pocket .cardpic { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; overflow: visible; }
#panel.area .pocket .cardpic .card-img { width: 100%; height: 100%; }
/* an empty window shows the page's dark backing and the creature's number */
#panel.area .pocket.empty { display: block; background: none; border: 0; }
#panel.area .pocket.empty:hover { translate: none; outline-color: rgba(243, 234, 210, 0.35); }
#panel.area .pocket .pk-num { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-family: var(--font-px); font-size: calc(var(--fu) * 9); line-height: 1; color: #e8e2d0; opacity: 0.5; }
#panel.area .pocket.waiting { border: 0; }
#panel.area .pocket .pk-wait { top: 40%; padding: var(--g) 0; font-size: calc(var(--fu) * 5.5); line-height: 1.15; }
#panel.area .pocket .pk-pips { bottom: calc(var(--g) * 3); }
#panel.area .pocket .pk-owned { bottom: calc(var(--g) * 3); font-size: calc(var(--fu) * 6.5); }
#panel.area .pocket .bestg { top: calc(var(--g) * 3); right: calc(var(--g) * 3); font-size: calc(var(--fu) * 6.5); }
#panel.area .bp-empty { display: grid; place-items: center; z-index: 2; text-align: center; color: #e8e2d0; font-size: calc(var(--fu) * 8); line-height: 1.35; }
#panel.area .bp-empty .mini { margin-top: calc(var(--g) * 4); }

/* the curled page corners: shown only when there is a page that way (the art's flat corner shows otherwise) */
#panel.area .bk-corner { padding: 0; border: 0; background: none; z-index: 3; cursor: pointer; transition: translate 0.1s ease; }
#panel.area .bk-corner img { width: 100%; height: 100%; }
#panel.area .bk-corner:hover { translate: 0 calc(var(--g) * -1); filter: brightness(1.12); }

/* the label strips: cream paper under the plastic, ink text */
#panel.area .bk-strip { z-index: 3; display: flex; align-items: center; color: var(--ink); text-shadow: none; font-family: var(--font-ui); line-height: 1; white-space: nowrap;
  font-size: calc(var(--g) * 8 * min(var(--fs), 1.15)); }
#panel.area .bk-stats { justify-content: space-between; padding: 0 calc(var(--a) * 2.5); font-weight: 700; }
#panel.area .bk-stats > span { display: inline-flex; align-items: center; gap: calc(var(--g) * 2); }
#panel.area .bk-stats small { font-size: 1em; font-weight: 400; opacity: 0.72; }
#panel.area .bk-stats .vc i { width: calc(var(--g) * 5); height: calc(var(--g) * 5); border-width: var(--g); }
#panel.area .bk-stats .st-fx i { width: calc(var(--g) * 5); height: calc(var(--g) * 5); rotate: 45deg; border: var(--g) solid var(--ink); background: conic-gradient(#ff7a7a, #ffd66b, #9be36b, #6fd3ff, #c58bff, #ff7a7a); }
#panel.area .bk-find .finder { width: 100%; height: 100%; gap: calc(var(--g) * 2); font-size: inherit; text-shadow: none; }
#panel.area .bk-find .f-search { flex: 1; min-width: 0; height: 100%; padding: 0 calc(var(--g) * 2); gap: calc(var(--g) * 2); background: none; border: 0; border-radius: 0; box-shadow: none; }
#panel.area .bk-find .f-search:focus-within { box-shadow: inset 0 calc(var(--g) * -1) 0 var(--ink); }
#panel.area .bk-find .f-search input { width: 100%; font-size: inherit; color: var(--ink); }
#panel.area .bk-find .f-search input::placeholder { color: #8a8170; }
#panel.area .bk-find .f-mag { width: calc(var(--g) * 5); height: calc(var(--g) * 5); border-width: var(--g); }
#panel.area .bk-find .f-btn { height: calc(100% - var(--g) * 4); padding: 0 calc(var(--g) * 3); gap: calc(var(--g) * 2); font-size: inherit; color: var(--ink); text-shadow: none;
  background: rgba(35, 32, 28, 0.1); border-radius: var(--g); }
#panel.area .bk-find .f-btn:hover, #panel.area .bk-find .f-btn.open { background: rgba(35, 32, 28, 0.22); }
#panel.area .bk-find .f-btn.on { background: #7a2a26; color: #f3ead2; }
#panel.area .bk-find .f-btn b { font-size: 0.9em; }
#panel.area .bk-find .f-count { padding-right: calc(var(--g) * 2); font-size: inherit; font-weight: 700; color: var(--ink); opacity: 0.8; }
#panel.area .bk-find .f-count.on { color: #7a2a26; opacity: 1; }
#panel.area .bk-find .f-pop { top: auto; bottom: calc(100% + var(--g) * 4); }

/* the index tabs come out from under the right page once it has opened; the open spread's tab sticks out further */
#panel.area .bk-tabs { position: absolute; inset: 0; z-index: 2; clip-path: inset(0 0 0 calc(var(--a) * var(--tx))); }
#panel.area .bk-tab { padding: 0; border: 0; background: none; cursor: pointer; transition: translate 0.14s ease; }
#panel.area .bk-tab .tab-in { position: absolute; inset: 0; display: block; background: url(../art/areas/binder/tab.png) no-repeat 0 0 / 100% 100%; image-rendering: pixelated;
  transition: translate 0.3s cubic-bezier(.2,.8,.25,1) calc(var(--i) * 30ms); }
/* layout.layers.tab: the colour strip [2,1,9,3] takes the section colour; the number sits in [2,4,9,9] */
#panel.area .bk-tab .tab-in::before { content: ""; position: absolute; left: calc(var(--a) * 2); top: var(--a); width: calc(var(--a) * 9); height: calc(var(--a) * 3); background: var(--tc); mix-blend-mode: multiply; }
#panel.area .bk-tab span { position: absolute; left: calc(var(--a) * 2); top: calc(var(--a) * 4); width: calc(var(--a) * 9); height: calc(var(--a) * 9); display: grid; place-items: center; white-space: nowrap;
  font-family: var(--font-px); font-weight: 700; font-size: calc(var(--g) * 6.5 * var(--fit, 1)); line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
#panel.area .bk-tab:hover { translate: var(--g) 0; }
#panel.area .bk-tab.on { translate: calc(var(--a) * 2) 0; }
#panel.area:is(.arriving, .opening) .bk-tab .tab-in { translate: calc(var(--a) * -13) 0; transition: none; }
#panel.area.closing .bk-tab .tab-in { translate: calc(var(--a) * -13) 0; transition: translate 0.16s ease-in; }

/* the title on a brass plate in the top band, and Fill binder beside it */
#panel.area .bk-title { display: flex; align-items: center; justify-content: center; z-index: 4; }
#panel.area .bk-plate { display: inline-flex; align-items: center; gap: calc(var(--g) * 4); height: 100%; box-sizing: border-box; padding: 0 calc(var(--g) * 6); white-space: nowrap; pointer-events: auto;
  font-family: var(--font-px); font-weight: 700; font-size: calc(var(--g) * 8 * min(var(--fs), 1.15)); color: var(--ink); letter-spacing: 0.04em;
  background: var(--brass); border: calc(var(--g) * 1.5) solid var(--ink); border-radius: calc(var(--g) * 1.5);
  box-shadow: inset 0 var(--g) 0 var(--brass-lt), inset 0 calc(var(--g) * -1) 0 var(--brass-dk), 0 calc(var(--g) * 1.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .bk-plate b { font-family: var(--font-ui); color: var(--wine); letter-spacing: 0; }
#panel.area .bk-fill { display: flex; align-items: center; justify-content: center; gap: calc(var(--g) * 3); padding: 0; z-index: 4; white-space: nowrap; cursor: pointer;
  font-family: var(--font-px); font-weight: 700; font-size: calc(var(--g) * 7 * min(var(--fs), 1.15)); color: var(--ink); text-shadow: none;
  background: #9be36b; border: calc(var(--g) * 1.5) solid var(--ink); border-radius: calc(var(--g) * 1.5);
  box-shadow: inset 0 var(--g) 0 #d4ffb5, inset 0 calc(var(--g) * -1) 0 #5aa83a, 0 calc(var(--g) * 1.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .bk-fill b { font-family: var(--font-ui); background: var(--ink); color: #c9ffad; padding: 0 calc(var(--g) * 2); border-radius: var(--g); }
#panel.area .bk-fill:hover { filter: brightness(1.07); }
#panel.area .bk-fill:active { translate: 0 var(--g); box-shadow: inset 0 var(--g) 0 #d4ffb5, inset 0 calc(var(--g) * -1) 0 #5aa83a, 0 calc(var(--g) * 0.5) 0 rgba(35, 32, 28, 0.45); }

/* ---------- the rulebook (help.rulebookScene; art/areas/rulebook/layout.json) ----------
   Each paper page carries its own piece of the spread (so a turning page shows its paper), a page of rules in its
   text block, and its page number between the printed ornaments. The text steps down a little where a page runs
   long (areas.fitText sets --fit). */
#panel.area .rb-page { display: block; padding: 0; border: 0; overflow: visible; z-index: 1; color: #23201c; text-shadow: none; image-rendering: pixelated;
  background: url(../art/areas/rulebook/spread.png) no-repeat calc(var(--a) * var(--bx)) calc(var(--a) * var(--by)) / calc(var(--a) * 254) calc(var(--a) * 153); }
#panel.area .rb-body { overflow: hidden; font-family: var(--font-ui); font-size: calc(var(--g) * 7.5 * min(var(--fs), 1.15) * var(--fit, 1)); line-height: 1.34; image-rendering: auto; }
#panel.area .rb-body h3 { margin: 0 0 calc(var(--g) * 4) !important; padding: 0 0 calc(var(--g) * 2); font-family: var(--font-px); font-weight: 700; letter-spacing: 0.03em; color: #4a2f63;
  font-size: calc(var(--g) * 9.5 * min(var(--fs), 1.15) * var(--fit, 1)) !important; border-bottom: var(--g) solid rgba(74, 47, 99, 0.35); }
#panel.area .rb-body .note { margin: calc(var(--g) * 3) 0; }
#panel.area .rb-body b { color: #3a2348; }
#panel.area .rb-body table.odds th { color: #6b3f8a; }
#panel.area .rb-body .obar i { background: #4a8a84; }
#panel.area .rb-folio { display: grid; place-items: center; z-index: 2; font-family: var(--font-px); font-weight: 700; font-size: calc(var(--g) * 8); line-height: 1; color: #4a2f63; }
/* the title and the spread dots on a brass plate in the top band; the page corners and the arrow keys turn the pages */
#panel.area .rb-pager { display: flex; align-items: center; justify-content: center; z-index: 4; }
#panel.area .rb-pager .bk-plate { gap: calc(var(--g) * 6); }
#panel.area .rb-pager .pager { min-height: 0; gap: 0; }
#panel.area .rb-pager .pg-btn { display: none; }
#panel.area .rb-pager .pg-dots { gap: calc(var(--g) * 2.5); }
#panel.area .rb-pager .pg-dots i { width: calc(var(--g) * 4.5); height: calc(var(--g) * 4.5); background: var(--brass-dk); border: var(--g) solid var(--ink); transition: background 0.12s ease; }
#panel.area .rb-pager .pg-dots i:hover { background: #fff2b0; }
#panel.area .rb-pager .pg-dots i.on { background: var(--wine); }

/* ---------- a place in focus (areas.js TableView.focus) ----------
   Once a place has opened, the camera moves in until it fills the screen: the panel layer gets its own --g, --ox and
   --oy (inline), so everything in it is laid out again at the larger size. While a place is in focus, on its way or
   leaving it, the HUD stays over it at the screen's edges in a compact shape (the rank pill steps aside at home; areas.js
   fits the place clear of what is left) with a close button of its own, since the place's own ✕ would grow with it.
   A scene dialog (#modal.area) comes into focus the same way, keeping its own close. A layer moving in or out takes
   no clicks. Sprites drawn inside a layer in focus (fx.js) take its art pixel. */
#stage.scene-focus #hud { z-index: 22; } /* over the panel (20) and a closing ghost (21), under a flying object (25) */
#stage.scene-focus #hint { opacity: 0; pointer-events: none; }
#stage.scene-focus[data-mode="home"] #rankPill { display: none; }
#stage.scene-focus #panel.area > .x { display: none; }
[data-focus] { --fxa: var(--a); }
:is(#panel, #modal)[data-focus="moving"] *, [data-focus="out"] * { pointer-events: none !important; }
.focus-x, .focus-bar { display: none; }
#stage.scene-focus:not(.focus-own-close) .focus-x { display: block; }
#stage.scene-focus:not(.focus-own-close) .focus-bar { display: flex; }
/* the close button: a pill beside the bank at home (in the rank pill's place), or a bar like the corner bar (desk.css
   #sysbar) in a run's top right corner */
.focus-bar { position: absolute; right: calc(var(--u) * 8); top: calc(var(--u) * 5); gap: calc(var(--u) * 5); padding: calc(var(--u) * 1) calc(var(--u) * 6); }
.focus-x { position: relative; margin: 0; padding: calc(var(--u) * 2); background: none; border: 0; border-radius: calc(var(--u) * 6); cursor: pointer; }
#hud #topbar > .focus-x { padding: calc(var(--u) * 2) calc(var(--u) * 7); border-radius: calc(var(--u) * 6); }
#stage.scene-focus:not(.focus-own-close) #topbar > .focus-x { display: grid; place-items: center; }
.focus-x b { display: grid; place-items: center; width: calc(var(--u) * 22); height: calc(var(--u) * 20); font: 400 calc(var(--u) * 15) / 1 var(--font-px); color: #f3ead2; text-shadow: var(--outline); }
.focus-x:hover b { animation: icoHop 0.45s steps(4, end); color: #fff2b0; }

/* ---------- a place's own HUD (src/scenes/hud.js) ----------
   The HUD's buttons drawn in the place's material, with the HUD's own icons at one art pixel a pixel: a book's index
   tabs on its top edge (the binder's laminated card, its strip tinted by multiply as its side tabs are), Your Run's
   poker chips, and brass plates beside the other places' title plates (.bk-plate's brass). */
#panel.area .hudb { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; pointer-events: auto; z-index: 6; }
#panel.area .hudb .ico { background-size: 100% 100%; }
#panel.area .hudb:hover .ico { animation: icoHop 0.45s steps(4, end); }
#panel.area .hudb:active .ico { translate: 0 calc(var(--a) * 0.5); animation: none; }
#panel.area .hudb:focus-visible { outline: calc(var(--a) * 0.5) solid #ffd75a; outline-offset: 0; }
body.calm #panel.area .hudb .ico { animation: none; }
#panel.area .hudb-tab { background: url(../art/areas/hud/tab.png) no-repeat 0 0 / 100% 100%; image-rendering: pixelated; transition: translate 0.14s ease; }
#panel.area .hudb-tab.on { background-image: url(../art/areas/hud/tab_on.png); }
#panel.area .hudb-tab::before { content: ""; position: absolute; left: calc(var(--a) * 2); top: var(--a); width: calc(var(--a) * 14); height: calc(var(--a) * 2); background: var(--tc); mix-blend-mode: multiply; }
#panel.area .hudb-tab:not(.on):hover { translate: 0 calc(var(--a) * -1); }
#panel.area .hudb-chip { background: url(../art/areas/hud/chip.png) no-repeat 0 0 / 100% 100%; image-rendering: pixelated; transition: translate 0.14s ease; }
#panel.area .hudb-chip.on { background-image: url(../art/areas/hud/chip_on.png); }
#panel.area .hudb-chip.hudb-x { background-image: url(../art/areas/hud/chip_x.png); }
#panel.area .hudb-chip:not(.on):hover { translate: 0 calc(var(--a) * -1); }
#panel.area .hudb-brass { background: var(--brass); border-radius: calc(var(--g) * 1.5);
  box-shadow: inset 0 0 0 calc(var(--g) * 1.5) var(--ink), inset 0 calc(var(--g) * 2.5) 0 var(--brass-lt), inset 0 calc(var(--g) * -2.5) 0 var(--brass-dk), 0 calc(var(--g) * 1.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .hudb-brass:hover { filter: brightness(1.1); }
#panel.area .hudb-brass.on { background: var(--brass-dk); box-shadow: inset 0 0 0 calc(var(--g) * 1.5) var(--ink), inset 0 calc(var(--g) * 2.5) 0 rgba(35, 32, 28, 0.35), 0 calc(var(--g) * 0.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .hudb-brass.hudb-x { background: #b8433c; box-shadow: inset 0 0 0 calc(var(--g) * 1.5) var(--ink), inset 0 calc(var(--g) * 2.5) 0 #e0706a, inset 0 calc(var(--g) * -2.5) 0 #7a2420, 0 calc(var(--g) * 1.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .hudb-brass:active { translate: 0 calc(var(--a) * 0.5); }
/* the bank on a brass plate in a place that spends it; Your Run's cash on a paper band in zen */
#panel.area .hudb-plate { display: flex; align-items: center; justify-content: flex-start; }
#panel.area .hudb-plate .bk-plate { width: 100%; justify-content: center; gap: calc(var(--g) * 3); padding: 0 calc(var(--g) * 4); }
#panel.area .hudb-plate .bk-plate b { font-family: var(--font-px); color: #24502f; }
#panel.area .hudb-plate:hover .bk-plate { filter: brightness(1.1); }
#panel.area .hudb-cash { display: flex; align-items: center; justify-content: center; gap: calc(var(--g) * 2); white-space: nowrap; pointer-events: auto;
  font-family: var(--font-px); font-weight: 700; font-size: calc(var(--g) * 8 * min(var(--fs), 1.15)); color: var(--ink); background: #f3e6c4;
  border: calc(var(--g) * 1.5) solid var(--ink); border-radius: calc(var(--g) * 1.5); box-shadow: 0 calc(var(--g) * 1.5) 0 rgba(35, 32, 28, 0.45); }
#panel.area .hudb-cash b { color: #24502f; }

/* ---------- scene dialogs (ui.openModal with scene; areas.js DIALOG_SCENES) ----------
   A run screen drawn as a scene turns #modal into the same world-frame layer as a place's panel: no backdrop (the table
   is its backdrop), the felt between its pieces lets clicks through, and it arrives, opens and closes through the table
   view with the same states (.arriving, .opening, .opened, and .closing on its still copy). While its object is in the
   air it waits drawn but unseen, as a place's panel does (areas.js holds it at opacity 0). */
#modal.area { inset: auto; left: var(--ox); top: var(--oy); width: calc(var(--g) * 640); height: calc(var(--g) * 360); padding: 0; display: block;
  background: none; overflow: visible; pointer-events: none; text-shadow: none;
  --a: calc(var(--g) * 2); --u: var(--g); --fu: calc(var(--g) * var(--fs)); --outline: none; }
#modal.area .at { position: absolute; left: calc(var(--a) * var(--x)); top: calc(var(--a) * var(--y)); width: calc(var(--a) * var(--w)); height: calc(var(--a) * var(--h)); }
#modal.area img.art { display: block; image-rendering: pixelated; -webkit-user-drag: none; user-select: none; }
#modal.area .solid, #modal.area button, #modal.area input, #modal.area select, #modal.area label, #modal.area [data-act], #modal.area [data-tip] { pointer-events: auto; }
#modal.area:is(.arriving, .opening, .closing) * { pointer-events: none !important; }
#modal.area .ui-in { transition: opacity 0.22s ease, translate 0.22s ease; }
#modal.area:is(.arriving, .opening) .ui-in { opacity: 0; translate: 0 calc(var(--a) * 3); }
#modal.area.opened .ui-in { transition-delay: calc(var(--i, 0) * 30ms); }
#modal.area.closing .ui-in { opacity: 0; transition: opacity 0.12s ease; }
body.calm #modal.area .ui-in { transition: none; }
/* the close button of a dialog that may be closed (dismiss), where every place has it */
#modal.area > .x { position: absolute; top: calc(var(--a) * 19); left: calc(var(--a) * 296); width: calc(var(--a) * 11); height: calc(var(--a) * 11); padding: 0; display: grid; place-items: center;
  font-family: var(--font-px); font-size: calc(var(--g) * 9); color: var(--ink); background: var(--brass-lt); border: calc(var(--g) * 1.5) solid var(--ink); border-radius: 50%;
  box-shadow: inset 0 var(--g) 0 #fff2b0, inset 0 calc(var(--g) * -1) 0 var(--brass), 0 calc(var(--g) * 2) 0 rgba(35, 32, 28, 0.45); pointer-events: auto; z-index: 30; }
#modal.area > .x:hover { background: #fff2b0; }
#modal.area:is(.arriving, .opening, .closing) > .x { opacity: 0; }
#modal.area.opened > .x { animation: areaFade 0.2s ease both; }

/* a question over a scene dialog (ui.openNote): a paper note pinned over the scene, which dims a little beneath it; it
   floats over the table, so it is sized in UI Size's unit (--u, css/scenes.css) */
#modal.area > .modal-note { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: auto; background: rgba(20, 16, 12, 0.3); animation: areaFade 0.14s ease both; }
#modal.area > .modal-note > .modal-box { position: relative; max-width: calc(var(--u) * 320); max-height: none; overflow: visible; padding: calc(var(--u) * 12) calc(var(--u) * 14) calc(var(--u) * 8);
  color: var(--ink); text-shadow: none; background: #f3ead2; border: calc(var(--u) * 1.5) solid var(--ink); border-radius: var(--u); rotate: -1deg;
  box-shadow: inset 0 calc(var(--u) * -2) 0 #ddd0b0, calc(var(--u) * 3) calc(var(--u) * 4) 0 rgba(35, 32, 28, 0.38); animation: noteIn 0.2s cubic-bezier(.2,.8,.25,1.2) both; }
/* a strip of tape holds it down */
#modal.area > .modal-note > .modal-box::before { content: ""; position: absolute; left: 50%; top: calc(var(--u) * -6); width: calc(var(--u) * 48); height: calc(var(--u) * 12); translate: -50% 0; rotate: 2deg;
  background: rgba(236, 226, 190, 0.82); border: var(--u) solid rgba(35, 32, 28, 0.25); }
#modal.area > .modal-note .dim { color: #5b5246; opacity: 1; }
#modal.area > .modal-note b { color: #7a2a26; }
@keyframes noteIn { from { opacity: 0; transform: translateY(calc(var(--u) * -10)) rotate(-4deg); } }
body.calm #modal.area > .modal-note, body.calm #modal.area > .modal-note > .modal-box { animation: none; }
