/* ---- src/ui/ui.css */
/* Pepecat Dungeon — HUD, pause, settings and overlay styles.
   One pixel language. --px is one UI art pixel in CSS px, always a whole number of device pixels
   ( round( world scale × UI size ), hud.js layout ), so the kit ( art/ui/, --ui-<name> url()s set by
   hud.js ) and the bitmap fonts ( .txt elements painted by src/ui/bitfont.js ) stay crisp and even.
   Sizes below are kit sizes in art px ( src/ui/kit.js ). --u is one logical playfield pixel ( world
   positions: damage numbers ). All copy uses the bitmap woodcut faces. */

/* Gate 2 screens ( src/ui/screens.js ): inventory, stash, tooltips and comparison, talents, map,
   death, boss card, level-up, save indicator, storage error, floor-loot plates. Imported by ui.css.
   Inside .ui-screens one art px is --spx ( hud.js layout: the largest whole device-px size at which
   the 960 × 540 design still fits, ≤ the HUD's --px ); tooltips and loot plates use --tpx, never
   under 2 device px, so their 5 × 7 bitmap text stays legible at 720p. */

.ui-screens { position: absolute; inset: 0; --px: var( --spx, 2px ); pointer-events: none; }
.ui-screens [hidden] { display: none !important; }
.ui-screens .spr, .front .spr, #hud > .ui-hints .spr { display: block; flex: none; image-rendering: pixelated; background-repeat: no-repeat; background-size: 100% 100%; }
/* Status glyphs ( mark-*, mouse-*, hint-tick ): a 1 px void plate behind the art ( umbra would vanish on
   the umbra panels ), the rim outside the box so no layout moves ( the sprite() helpers in screens.js and front.js add .plate ). */
.spr.plate { background-color: var( --void ); box-shadow: 0 0 0 var( --px ) var( --void ); }
body.ui-screen-open #pause { display: none !important; }

.ui-backdrop { position: absolute; inset: 0; pointer-events: auto; background: linear-gradient( 90deg, rgba( 5, 4, 15, 0.55 ), rgba( 5, 4, 15, 0.35 ) 50%, rgba( 5, 4, 15, 0.55 ) ); }

/* Panels: the big kit frame ( slice 20 ), title in gothic, kit divider. */
.ui-panel { position: absolute; pointer-events: auto; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: calc( 4 * var( --px ) );
  border: calc( 20 * var( --px ) ) solid transparent; border-image: var( --ui-frame ) 20 fill / calc( 20 * var( --px ) ) stretch; image-rendering: pixelated;
  padding: calc( 2 * var( --px ) ) calc( 6 * var( --px ) ) calc( 4 * var( --px ) ); filter: drop-shadow( 0 calc( 3 * var( --px ) ) 0 rgba( 0, 0, 0, 0.6 ) ); }
.ui-title { line-height: 0; margin-top: calc( -2 * var( --px ) ); }
.ui-rule { width: calc( 121 * var( --px ) ); height: calc( 7 * var( --px ) ); background: var( --ui-divider ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; flex: none; }
.ui-hint { display: flex; justify-content: center; line-height: 0; }
.ui-inv { right: calc( 10 * var( --px ) ); top: max( calc( 14 * var( --px ) ), calc( 30 * var( --hpx, 0px ) ) ); } /* below the icon row ( 27 HUD px ), which slides over it */
.ui-stash { left: calc( 10 * var( --px ) ); top: calc( 14 * var( --px ) ); }

/* Inventory: doll + hero summary over the 10 × 4 pack. */
.ui-inv-top { display: flex; gap: calc( 8 * var( --px ) ); align-items: flex-start; }
.ui-doll { position: relative; width: calc( 192 * var( --px ) ); height: calc( 174 * var( --px ) ); flex: none; }
.ui-socket { position: absolute; border-width: calc( 6 * var( --px ) ); border-image: var( --ui-socket ) 6 fill / calc( 6 * var( --px ) ) stretch; }
.ui-socket.target { border-image-source: var( --ui-socket-hot ); }
.ui-socket.target.bad { border-image-source: var( --ui-socket-bad ); }
.ui-socket-field { position: relative; }
.ui-socket .ui-ghost { position: absolute; inset: 0; width: 100% !important; height: 100% !important; opacity: 0.55; }
.ui-socket-label { position: absolute; left: round( 50%, var( --dpx, 1px ) ); bottom: calc( -9 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; opacity: 0; transition: opacity 0.12s; }
.ui-socket.empty .ui-socket-label, .ui-socket:hover .ui-socket-label { opacity: 1; }
.ui-socket[data-slot='charm'] .ui-socket-label { bottom: auto; top: calc( 100% + 2 * var( --px ) ); }

.ui-hero { width: calc( 92 * var( --px ) ); display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); padding-top: calc( 2 * var( --px ) ); }
.ui-level { display: flex; align-items: flex-end; justify-content: space-between; line-height: 0; }
.ui-xp { position: relative; height: calc( 5 * var( --px ) ); background: var( --void ); box-shadow: 0 0 0 var( --px ) var( --iron0 ); }
.ui-xp::after { content: ''; position: absolute; inset: 0; right: auto; width: calc( var( --xp ) * 100% ); background: linear-gradient( var( --core ), var( --flame2 ) 40%, var( --flame0 ) ); }
.ui-xp-text { line-height: 0; display: flex; justify-content: flex-end; }
.ui-stat { display: flex; justify-content: space-between; align-items: center; line-height: 0; padding: var( --px ) 0; border-bottom: var( --px ) solid rgba( 91, 101, 124, 0.25 ); }

.ui-grid { border-width: calc( 6 * var( --px ) ); border-image: var( --ui-socket ) 6 fill / calc( 6 * var( --px ) ) stretch; flex: none; }
.ui-grid-field { position: relative; background: var( --ui-cell ) 0 0 / calc( 24 * var( --px ) ) calc( 24 * var( --px ) ) repeat; image-rendering: pixelated; --mk: var( --px ); }
/* Its items' verdict chips, every one of them a layer of this one box ( screens.js markLayers, placeItems: --marks ): better or worse
   than what is worn ( item-verdict.js: the floor's score ), the floor's arrows in its tier colours on a void chip in the cell's
   bottom corners, on every item the ups bottom left and one blood ▼ bottom right ( the corner says it as the colour does ). A cell
   shows no level pips: those are the plates' and the cards'. The chip in the cell's own art px with a mouse ( --mk; the pack's
   lettering there: a larger chip would bury a one-cell charm ), the tooltips' on a phone ( touch.css: its cells are a third larger
   and read at arm's length ). Never a target: the cell under it takes the press. No box an item: a full pack's chips as elements
   cost a phone half its layout again. */
.ui-grid-field::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var( --marks, none ); }
/* A gap between the gold, the hint and the menu: from five digits of gold the row sets the desktop panel's width, and they met edge to edge. */
.ui-inv-foot { position: relative; align-self: stretch; display: flex; justify-content: space-between; align-items: center; column-gap: calc( 6 * var( --px ) ); padding: 0 calc( 2 * var( --px ) ); }
/* More pack below ( screens.js scrollCue ): a gilt chevron on a void plaque over the pinned foot, bobbing ( .chev, below; it was a
   ▼: on this screen an arrow is better or worse and nothing else ). */
.ui-scroll-cue > .chev { margin: calc( 3 * var( --px ) ) calc( 5 * var( --px ) ) calc( 5 * var( --px ) ) var( --px ); }
.ui-scroll-cue { display: none; position: absolute; right: calc( 1 * var( --px ) ); bottom: calc( 100% + 2 * var( --px ) ); line-height: 0; pointer-events: none;
  padding: var( --px ) calc( 3 * var( --px ) ); background: rgba( 21, 15, 38, 0.85 ); box-shadow: 0 0 0 var( --px ) #ffc845, 0 0 calc( 3 * var( --px ) ) rgba( 255, 200, 69, 0.35 ); animation: ui-scroll-bob 1.2s ease-in-out infinite; }
.ui-inv.more .ui-scroll-cue { display: block; }
@keyframes ui-scroll-bob { 50% { translate: 0 var( --px ); } }
/* and a thin ember scrollbar on the panel's edge: it only exists while the pack overflows ( touch.css hides panel bars ) */
#hud:not( .touch ) .ui-panel.ui-inv, #hud.touch .ui-panel.ui-inv { scrollbar-width: thin; scrollbar-color: #b8401c rgba( 21, 15, 38, 0.6 ); }
.ui-gold { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }

/* Items: rarity tint behind, the icon, rarity corner brackets on top. Rare / Unique glow. */
.ui-item { position: absolute; left: 0; top: 0; cursor: pointer; }
.ui-item-bg { position: absolute; inset: var( --px ); background: rgba( 5, 4, 15, 0.35 ); }
.ui-item.r-magic .ui-item-bg { background: linear-gradient( rgba( 188, 202, 223, 0.07 ), rgba( 188, 202, 223, 0.07 ) ), rgba( 5, 4, 15, 0.35 ); }
.ui-item.r-rare .ui-item-bg { background: linear-gradient( rgba( 255, 200, 69, 0.09 ), rgba( 255, 200, 69, 0.09 ) ), rgba( 5, 4, 15, 0.35 ); }
.ui-item.r-unique .ui-item-bg { background: radial-gradient( closest-side, rgba( 232, 128, 30, 0.22 ), rgba( 232, 128, 30, 0.07 ) ), rgba( 5, 4, 15, 0.35 ); }
.ui-item-icon { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.ui-item-frame { position: absolute; inset: 0; border-width: calc( 5 * var( --px ) ); border-image: var( --ui-rarity-common ) 5 / calc( 5 * var( --px ) ) stretch; opacity: 0.55; }
.ui-item.r-magic .ui-item-frame { border-image-source: var( --ui-rarity-magic ); opacity: 0.8; }
.ui-item.r-rare .ui-item-frame { border-image-source: var( --ui-rarity-rare ); opacity: 1; }
.ui-item.r-unique .ui-item-frame { border-image-source: var( --ui-rarity-unique ); opacity: 1; }
.ui-item.r-rare .ui-item-icon { filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 255, 200, 69, 0.35 ) ); }
.ui-item.r-unique .ui-item-icon { animation: unique-glow 2.4s ease-in-out infinite; }
@keyframes unique-glow { 0%, 100% { filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 232, 128, 30, 0.45 ) ); } 50% { filter: drop-shadow( 0 0 calc( 4 * var( --px ) ) rgba( 255, 200, 69, 0.7 ) ); } }
.ui-screens.calm .ui-item.r-unique .ui-item-icon { animation: none; filter: drop-shadow( 0 0 calc( 3 * var( --px ) ) rgba( 232, 128, 30, 0.55 ) ); }
.ui-item:hover .ui-item-bg { background: rgba( 240, 230, 198, 0.12 ); }
.ui-item.lifted { opacity: 0.35; }
/* the gold three breathe on the card's title, as on the floor's plate ( one at a time ); a pack's chips hold still: a bag of
   upgrades would pulse thirty filters a frame */
.ui-tip-verdict .ui-verdict-mark.t3 { animation: gain-pulse 1.2s steps( 4 ) infinite; }
.ui-screens.calm .ui-verdict-mark.t3 { animation: none; filter: drop-shadow( 0 0 var( --px ) rgba( 255, 200, 69, 0.6 ) ); }
/* An item's level against the hero's on floor loot plates ( item-verdict.js levelStep ): inventory cells show only the ▲ / ▼ verdict arrows. */
.ui-screens { --lvGrey: #7f7774; --lvGreen: #58e340; --lvAbove: #e8801e; --lvHigh: #dc2f30; }
.lv-pip.lvGrey { --lv: var( --lvGrey ); }
.lv-pip.lvGreen { --lv: var( --lvGreen ); }
.lv-pip.lvAbove { --lv: var( --lvAbove ); }
.lv-pip.lvHigh { --lv: var( --lvHigh ); }
.lv-pip { flex: none; width: calc( 3 * var( --px ) ); height: calc( 3 * var( --px ) ); background: var( --lv ); box-shadow: 0 0 0 var( --px ) #150f26; }
.lv-pip:is( .lvGrey, .lvHigh ) { margin-right: calc( 5 * var( --px ) ); box-shadow: calc( 5 * var( --px ) ) 0 0 0 var( --lv ), 0 0 0 var( --px ) #150f26, calc( 5 * var( --px ) ) 0 0 var( --px ) #150f26; }
.lv-pip.lvEven { display: none; }
.ui-tip-level { align-items: center; gap: calc( 4 * var( --px ) ); }
.ui-place { position: absolute; pointer-events: none; }
.ui-place.ok { background: rgba( 255, 200, 69, 0.2 ); box-shadow: inset 0 0 0 var( --px ) rgba( 255, 200, 69, 0.75 ); } /* gilt: green is Pepecat's */
.ui-place.bad { background: rgba( 138, 26, 43, 0.35 ); box-shadow: inset 0 0 0 var( --px ) rgba( 138, 26, 43, 0.9 ); } /* blood2: the reds are Pepecat's */
.ui-held { position: absolute; left: 0; top: 0; pointer-events: none; filter: drop-shadow( 0 calc( 3 * var( --px ) ) 0 rgba( 0, 0, 0, 0.6 ) ); }
.ui-held .ui-item { position: relative; }

/* Tooltips: --tpx art px; void card with iron frame, gilt corners for Rare / Unique. */
.ui-tips { position: absolute; left: 0; top: 0; display: flex; gap: calc( 3 * var( --tpx ) ); align-items: flex-start; pointer-events: none; --px: var( --tpx, 2px ); z-index: 5; }
.ui-tipcard { border-width: calc( 6 * var( --px ) ); border-image: var( --ui-tip ) 6 fill / calc( 6 * var( --px ) ) stretch; padding: calc( 1 * var( --px ) ) calc( 2 * var( --px ) );
  display: flex; flex-direction: column; align-items: center; gap: calc( 1 * var( --px ) ); min-width: calc( 120 * var( --px ) ); max-width: calc( 184 * var( --px ) ); filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 rgba( 0, 0, 0, 0.7 ) ); }
.ui-tipcard.r-rare, .ui-tipcard.r-unique { border-image-source: var( --ui-tip-gilt ); }
.ui-tipcard.equipped { filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 rgba( 0, 0, 0, 0.7 ) ) brightness( 0.82 ); }
.ui-tip-name, .ui-tip-line, .ui-tip-tag { line-height: 0; display: flex; justify-content: center; }
.ui-tip-tag { padding: var( --px ) calc( 4 * var( --px ) ); background: var( --iron0 ); margin-bottom: var( --px ); }
/* the card's verdict over its name: the cell's arrows and "Better overall" / "Worse overall" ( screens.js card ), never the headline's one stat */
.ui-tip-verdict { gap: calc( 3 * var( --px ) ); align-items: center; background: #05040f; box-shadow: 0 0 0 var( --px ) #150f26; }
.ui-tip-verdict.down { box-shadow: 0 0 0 var( --px ) #8a1a2b; }
/* the worn item, small, under the card in hand ( touch: screens.js wornCard ): the card's width, the small face throughout */
.ui-tipcard.worn { box-sizing: border-box; width: calc( 184 * var( --px ) ); max-width: none; } /* the card's outer width ( 168 of text, its frame and padding ) */
.ui-worn-head { display: flex; flex-direction: column; align-items: center; gap: var( --px ); }
.ui-worn-rows { align-self: stretch; display: grid; grid-template-columns: minmax( 0, 1fr ) minmax( 0, 1fr ); column-gap: calc( 4 * var( --px ) ); row-gap: var( --px ); margin-top: calc( 2 * var( --px ) ); }
.ui-worn-row { display: flex; justify-content: space-between; gap: calc( 6 * var( --px ) ); line-height: 0; padding: 0 calc( 2 * var( --px ) ); }
.ui-worn-row > * { flex: none; }
.ui-worn-row.wide { grid-column: 1 / -1; }
/* what it gives up where the card in hand needs the room ( screens.js wornFit ): its rows, then its second line */
.ui-tipcard.worn.slim .ui-worn-rows { display: none; }
.ui-tipcard.worn.line .ui-worn-head { flex-direction: row; gap: calc( 4 * var( --px ) ); }
.ui-tipcard.worn.line .ui-tip-tag { margin-bottom: 0; }
.ui-tip-rule { align-self: stretch; height: var( --px ); margin: calc( 2 * var( --px ) ) calc( 6 * var( --px ) ); background: linear-gradient( 90deg, transparent, var( --iron1 ) 20%, var( --iron1 ) 80%, transparent ); }
.ui-tipcard.talent { align-items: center; }

/* The headline delta: arrow, big signed figures, stat name and the equipped value. */
.ui-headline { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); margin: calc( 3 * var( --px ) ) 0 calc( 1 * var( --px ) ); padding: calc( 2 * var( --px ) ) calc( 5 * var( --px ) ); line-height: 0; }
.ui-headline.up { background: linear-gradient( 90deg, rgba( 188, 202, 223, 0 ), rgba( 188, 202, 223, 0.2 ) 30%, rgba( 188, 202, 223, 0.2 ) 70%, rgba( 188, 202, 223, 0 ) ); } /* cold steel, as the up style: gilt stays with rarity */
.ui-headline.down { background: linear-gradient( 90deg, rgba( 58, 13, 22, 0 ), rgba( 58, 13, 22, 0.78 ) 25%, rgba( 58, 13, 22, 0.78 ) 75%, rgba( 58, 13, 22, 0 ) ); } /* blood0 chip under red2 down glyphs ( >= 6.8:1 WCAG AA ) */
.ui-headline-sub { display: flex; flex-direction: column; gap: calc( 2 * var( --px ) ); line-height: 0; }
.ui-arrow.big { width: calc( 14 * var( --px ) ) !important; height: calc( 16 * var( --px ) ) !important; }
.ui-delta { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; align-self: flex-start; margin-left: calc( 8 * var( --px ) ); }
/* a phone's card in hand ( screens.js card .compact ): the changes under the headline, two to a row where both fit their half
   ( pairRows: a long one a row of its own, a short one taking the first free half ), ten px a row: the face's 7 and its air */
.ui-deltas { align-self: stretch; display: grid; grid-template-columns: minmax( 0, 1fr ) minmax( 0, 1fr ); grid-auto-flow: dense; column-gap: calc( 4 * var( --px ) ); }
.ui-deltas > .ui-delta { margin: calc( -1 * var( --px ) ) 0; align-self: auto; }
.ui-deltas > .ui-delta > * { flex: none; }
.ui-deltas > .ui-delta.wide { grid-column: 1 / -1; }
.ui-tipcard.compact .ui-headline { margin-top: var( --px ); padding-block: var( --px ); }
/* "More" and a chevron of five pixels ( screens.js moreCue: a phone's sheet and its scrolling pack; never an arrow ) */
.ui-more { display: none; position: absolute; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; pointer-events: none; padding: var( --px ) calc( 3 * var( --px ) ); z-index: 3;
  background: rgba( 21, 15, 38, 0.92 ); box-shadow: 0 0 0 var( --px ) #ffc845, 0 0 calc( 3 * var( --px ) ) rgba( 255, 200, 69, 0.35 ); }
.ui-more > .chev, .ui-scroll-cue > .chev { flex: none; width: var( --px ); height: var( --px ); background: #ffc845;
  box-shadow: calc( 4 * var( --px ) ) 0 #ffc845, var( --px ) var( --px ) #ffc845, calc( 3 * var( --px ) ) var( --px ) #ffc845, calc( 2 * var( --px ) ) calc( 2 * var( --px ) ) #ffc845; }
.ui-more > .chev { margin: 0 calc( 4 * var( --px ) ) calc( 2 * var( --px ) ) 0; }
.ui-more.up > .chev { margin: calc( 2 * var( --px ) ) calc( 4 * var( --px ) ) 0 0;
  box-shadow: calc( 4 * var( --px ) ) 0 #ffc845, var( --px ) calc( -1 * var( --px ) ) #ffc845, calc( 3 * var( --px ) ) calc( -1 * var( --px ) ) #ffc845, calc( 2 * var( --px ) ) calc( -2 * var( --px ) ) #ffc845; }

/* Talents: three branch columns of 132 art px. */
.ui-talents { left: round( 50%, var( --dpx, 1px ) ); top: calc( 12 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; }
.ui-talent-head { align-self: stretch; display: flex; justify-content: space-between; align-items: center; line-height: 0; padding: 0 calc( 4 * var( --px ) ); }
.ui-points { display: flex; align-items: flex-end; gap: calc( 3 * var( --px ) ); padding: calc( 2 * var( --px ) ) calc( 5 * var( --px ) ); }
.ui-points.has { background: linear-gradient( 90deg, rgba( 94, 20, 32, 0 ), rgba( 94, 20, 32, 0.6 ) 25%, rgba( 94, 20, 32, 0.6 ) ); animation: points-glow 1.6s ease-in-out infinite; }
@keyframes points-glow { 50% { filter: brightness( 1.3 ); } }
.ui-screens.calm .ui-points.has { animation: none; }
.ui-branches { display: flex; gap: calc( 10 * var( --px ) ); }
.ui-branch { width: calc( 132 * var( --px ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); padding: calc( 4 * var( --px ) ) 0; background: linear-gradient( rgba( 38, 43, 56, 0.55 ), rgba( 38, 43, 56, 0 ) ); }
.ui-branch-name, .ui-branch-pts, .ui-branch-cap { line-height: 0; display: flex; justify-content: center; }
.ui-identity { display: flex; flex-direction: column; gap: var( --px ); min-height: calc( 17 * var( --px ) ); }
.ui-tree { position: relative; width: calc( 132 * var( --px ) ); height: calc( 226 * var( --px ) ); margin-top: calc( 4 * var( --px ) ); }
/* The Reckoning ( screens.js RECKON_AT ): three rows, the keystone half a row below the last; every blurb three lines tall so the trees and notes line up */
.ui-talents.reckoning .ui-tree { height: calc( 200 * var( --px ) ); }
.ui-talents.reckoning .ui-identity { min-height: calc( 35 * var( --px ) ); } /* three 11 px small-font lines and their two 1 px gaps */
.ui-link { position: absolute; background: var( --iron0 ); box-shadow: 0 0 0 var( --px ) var( --void ); }
.ui-link.lit { background: var( --flame1 ); }
.ui-node { position: absolute; pointer-events: auto; cursor: pointer; background-image: var( --frame ); background-repeat: no-repeat; background-size: 100% 100%; image-rendering: pixelated; }
.ui-node .ui-node-icon { position: absolute; }
.ui-node.locked { cursor: default; }
.ui-node.can { animation: node-can 1.4s ease-in-out infinite; }
@keyframes node-can { 0%, 100% { filter: drop-shadow( 0 0 0 transparent ); } 50% { filter: drop-shadow( 0 0 calc( 3 * var( --px ) ) rgba( 255, 200, 69, 0.8 ) ); } }
.ui-screens.calm .ui-node.can { animation: none; filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 255, 200, 69, 0.6 ) ); }
/* hover and locked are generated in-palette variants ( art/ui/tools/icon-tier.mjs ): the frame's -hot, the icon's -off */
.ui-node:hover { background-image: var( --frame-hot ); }
.ui-ranks { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: calc( 100% + 2 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; display: flex; gap: var( --px ); }
.ui-node.capstone .ui-ranks { top: calc( 100% - 1 * var( --px ) ); }
.ui-node-selected { position: absolute; right: calc( -6 * var( --px ) ); top: calc( -5 * var( --px ) ); line-height: 0; padding: var( --px ) calc( 2 * var( --px ) ); background: var( --blood1 ); box-shadow: 0 0 0 var( --px ) var( --void ); }
.ui-talent-foot { align-self: stretch; display: flex; justify-content: space-between; align-items: center; padding: calc( 2 * var( --px ) ) calc( 4 * var( --px ) ) 0; border-top: var( --px ) solid var( --iron0 ); }
.ui-foot-row { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }
/* The page tabs ( screens.js pageTabs ): the page on show pressed in, a locked one dark with its gate under its name;
   letter placeholders for icons still to draw, and Hellcharge's rank table. */
.ui-talent-pages { display: flex; align-items: flex-start; gap: calc( 3 * var( --px ) ); }
.ui-talent-page { display: flex; flex-direction: column; justify-content: center; gap: var( --px ); line-height: 0; background: none; cursor: pointer; padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) );
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-talent-page:not( :disabled ):hover, .ui-talent-page:not( :disabled ):active { border-image-source: var( --ui-button-hot ); }
.ui-talent-page.on, .ui-talent-page.on:hover { border-image-source: var( --ui-button-down ); cursor: default; }
.ui-talent-page.locked { border-image-source: var( --ui-button-off ); cursor: default; }
.ui-talent-page-name { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); }
.ui-lines { display: flex; flex-direction: column; gap: var( --px ); line-height: 0; } /* a label wrapped to its column ( bitfont wrap ) */
.ui-node .ui-node-letter { width: calc( 17 * var( --px ) ); height: calc( 17 * var( --px ) ); display: flex; align-items: center; justify-content: center; line-height: 0; }
.ui-hc-table { display: flex; flex-direction: column; gap: var( --px ); margin: calc( 2 * var( --px ) ) 0; }
.ui-hc-head, .ui-hc-rank { display: grid; grid-template-columns: repeat( 5, auto ); justify-content: space-between; align-items: center; line-height: 0; }
.ui-hc-rank.next { background: rgba( 38, 43, 56, 0.7 ); }
.ui-respec { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; background: none; padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) ); cursor: default;
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-respec.ok { cursor: pointer; }
.ui-respec.ok:hover, .ui-respec.ok:active { border-image-source: var( --ui-button-hot ); }
/* The pack upgrade ( screens.js packEl ): a full-width band over the foot, the gothic button face. Ready: hot
   gilt edge and a slow ember pulse; blocked: flat, the reason in its line ( short of points or gold: blood ). */
.ui-pack-up { align-self: stretch; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: calc( 6 * var( --px ) ); line-height: 0; background: none; cursor: default;
  margin: calc( 2 * var( --px ) ) 0 calc( 1 * var( --px ) ); padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) );
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-pack-up.ok { cursor: pointer; border-image-source: var( --ui-button-hot ); animation: ui-pack-ready 1.6s ease-in-out infinite; }
.ui-pack-up.ok:hover { filter: brightness( 1.12 ); }
.ui-pack-up.ok:active, .ui-pack-up.ok.pressed { translate: 0 var( --px ); border-image-source: var( --ui-button-down ); animation: none; }
.ui-pack-up.level, .ui-pack-up.maxed { opacity: 0.85; }
@keyframes ui-pack-ready { 50% { box-shadow: 0 0 calc( 4 * var( --px ) ) rgba( 232, 128, 30, 0.45 ); } }
.ui-pack-id, .ui-pack-row, .ui-pack-cost, .ui-pack-state { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }
.ui-pack-row { justify-content: center; gap: calc( 8 * var( --px ) ); }
.ui-pack-state { justify-content: flex-end; }
.ui-pack-icon { flex: none; }
.ui-pack-up:not( .ok, .maxed ) .ui-pack-icon { filter: grayscale( 0.8 ) brightness( 0.75 ); }
.ui-pack-up .ui-pack-pips { position: static; translate: none; gap: calc( 2 * var( --px ) ); }
/* the next row, opened but not bought: an empty pip in a hard 1-art-px gilt ring that blinks ( steps, no blur: crisp ) */
.ui-pip-next { box-shadow: 0 0 0 var( --px ) #ffc845; animation: ui-pip-next 1s steps( 1 ) infinite; }
.ui-screens.calm .ui-pip-next { animation: none; }
@keyframes ui-pip-next { 50% { box-shadow: 0 0 0 var( --px ) #e8801e, 0 0 0 calc( 2 * var( --px ) ) rgba( 232, 128, 30, 0.45 ); } }
/* The inventory's pointer to it: an opened, unbought row; and the first-time notice of a locker with items in it ( screens.js renderInventory ).
   Each line no wider than the panel's own content ( the doll and the hero's numbers, 292 art px ): a notice never widens the panel. */
.ui-pack-notes { display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); }
.ui-pack-note { display: flex; justify-content: center; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }
.ui-pack-note-text { display: flex; flex-direction: column; align-items: flex-start; gap: calc( 2 * var( --px ) ); line-height: 0; }
/* The inventory's Menu button ( screens.js menuEl ): the gothic button face, as Respec. */
.ui-menu-open { display: flex; align-items: center; line-height: 0; background: none; padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) ); cursor: pointer;
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-menu-open:hover { border-image-source: var( --ui-button-hot ); }

/* Map. */
.ui-map { left: round( 50%, var( --dpx, 1px ) ); top: calc( 20 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; }
.ui-map-area { line-height: 0; }
.ui-map-corpse { display: flex; align-items: center; gap: calc( 2 * var( --px ) ); line-height: 0; margin-top: calc( 2 * var( --px ) ); } /* the corpse in another zone */
.ui-map-view { position: relative; margin: calc( 4 * var( --px ) ) calc( 8 * var( --px ) ); }
.ui-map-canvas { display: block; image-rendering: pixelated; }
.ui-map-mark { position: absolute; filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); }
.ui-legend { display: flex; gap: calc( 8 * var( --px ) ); }
.ui-legend-item { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }

/* Map zones ( two or more explored ): a row of tabs under the title. */
.ui-map-zones { display: flex; gap: calc( 3 * var( --px ) ); }
.ui-map-zone { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; background: none; cursor: pointer; padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) );
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-map-zone:hover, .ui-map-zone:focus-visible { border-image-source: var( --ui-button-hot ); outline: none; }
.ui-map-zone.on { border-image-source: var( --ui-button-hot ); cursor: default; }
/* pressed: the gothic buttons' one-pixel push ( .menu-btn:active ), and the lit frame for a held touch */
.ui-wp.ok:not( .here ):active, .ui-wp.ok:not( .here ).pressed, .ui-respec.ok:active, .ui-respec.ok.pressed, .ui-menu-open:active, .ui-menu-open.pressed, .ui-map-zone:not( .on ):active { translate: 0 var( --px ); border-image-source: var( --ui-button-down ); }
.ui-map-none { display: flex; align-items: center; justify-content: center; line-height: 0; min-width: calc( 200 * var( --px ) ); min-height: calc( 90 * var( --px ) ); }

/* Waypoint travel: one row per lit waypoint, the current one marked; unlit rows in cold iron. One line a row ( the name,
   no area level: the user, 2026-11-06 ), so eleven fit at 720p; a window too short for them all ( a phone ) scrolls the list
   alone under its title, on a thin ember bar like the pack's, the respec and the foot kept in view. */
.ui-travel { left: round( 50%, var( --dpx, 1px ) ); top: calc( 40 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; min-width: calc( 220 * var( --px ) );
  max-height: calc( 100% - 48 * var( --px ) ); }
.ui-travel > :not( .ui-wp-list ) { flex-shrink: 0; }
.ui-wp-list { display: flex; flex-direction: column; align-self: stretch; gap: calc( 2 * var( --px ) ); min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #b8401c rgba( 21, 15, 38, 0.6 ); --wp-fade: calc( 26 * var( --px ) ); }
/* more rows past an edge: that edge fades out ( screens.js wpEdges ) */
.ui-wp-list.down { mask-image: linear-gradient( to bottom, #000 calc( 100% - var( --wp-fade ) ), transparent ); }
.ui-wp-list.up { mask-image: linear-gradient( to top, #000 calc( 100% - var( --wp-fade ) ), transparent ); }
.ui-wp-list.up.down { mask-image: linear-gradient( to bottom, transparent, #000 var( --wp-fade ) calc( 100% - var( --wp-fade ) ), transparent ); }
.ui-wp-zone { line-height: 0; padding: calc( 2 * var( --px ) ) 0 0 calc( 2 * var( --px ) ); }
.ui-wp { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: calc( 6 * var( --px ) ); line-height: 0; background: none; text-align: left; cursor: default; flex-shrink: 0;
  padding: calc( 1 * var( --px ) ) calc( 5 * var( --px ) ); border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-wp-mark { width: calc( 18 * var( --px ) ) !important; height: calc( 18 * var( --px ) ) !important; image-rendering: pixelated; }
.ui-wp-text { display: flex; flex-direction: column; gap: calc( 2 * var( --px ) ); }
.ui-wp.ok { cursor: pointer; }
.ui-wp.ok:hover, .ui-wp.ok:focus-visible { border-image-source: var( --ui-button-hot ); outline: none; }
.ui-wp.ok:hover .ui-wp-mark, .ui-wp.ok:focus-visible .ui-wp-mark { filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 255, 200, 69, 0.7 ) ); }
.ui-wp.here { border-image-source: var( --ui-button-hot ); }
/* unlit: the disabled text ramp alone ( fading the row too left it unreadable at 1x ) */
.ui-travel .ui-respec { margin-top: calc( -1 * var( --px ) ); }
/* Stray's Rest's row ( screens.js restEl ): a travel row pinned under the list, the whole panel's width, its count badge on the corner */
.ui-travel .ui-rest { position: relative; align-self: stretch; }
.ui-travel .ui-rest > .ui-chip-badge { top: calc( -5 * var( --px ) ); right: calc( -4 * var( --px ) ); } /* on the frame's corner, clear of the status under it */

/* Costumes ( screens.js renderCostume ): the pin on a doll socket whose look a costume changes ( 5 art px in the frame's top right corner, over the frame and never an item's arrows,
   which sit in the cell's bottom corners ), the icon that opens the panel ( the pack's top right corner with a mouse, the doll's empty pocket on a phone: touch.css ) and the panel,
   docked clear of him ( .low: at the foot ). Every control is .ui-cos-btn: the kit's button face as Respec's, lit by a press, a hover and a focus ( a ring too, for the keyboard and the pad ). */
.ui-pin { position: absolute; right: calc( -6 * var( --px ) ); top: calc( -6 * var( --px ) ); width: calc( 5 * var( --px ) ); height: calc( 5 * var( --px ) ); box-sizing: border-box; border: var( --px ) solid var( --void ); background: #ffc845; pointer-events: none; }
.ui-cos-btn { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; background: none; cursor: pointer; text-align: left; padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) );
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-cos-btn:not( :disabled ):hover, .ui-cos-btn:focus-visible { border-image-source: var( --ui-button-hot ); }
.ui-cos-btn:focus-visible { outline: var( --px ) solid #ffc845; outline-offset: var( --px ); }
.ui-cos-btn:disabled { border-image-source: var( --ui-button-off ); cursor: default; }
.ui-cos-btn:not( :disabled ):active, .ui-cos-btn:not( :disabled ).pressed { translate: 0 var( --px ); border-image-source: var( --ui-button-down ); }
.ui-cos-open { position: absolute; right: 0; top: calc( -2 * var( --px ) ); justify-content: center; padding: var( --px ); } /* ( the pack's corner beside its title: the panel's padding box ) */
.ui-cos-mask { width: calc( 24 * var( --px ) ); height: calc( 20 * var( --px ) ); } /* the two masks ( screens.js MASKS_W, MASKS_H ) */
.ui-cos-mask.badge { width: calc( 34 * var( --px ) ); height: calc( 34 * var( --px ) ); } /* a phone's round badge ( BADGE ) */
.ui-cos-tab { justify-content: center; }
.ui-costume { left: round( 50%, var( --dpx, 1px ) ); top: calc( 24 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; width: calc( 421 * var( --px ) ); } /* 369 of rows and the frame */
.ui-costume.low { top: auto; bottom: calc( 14 * var( --px ) ); } /* where he stands under it */
.ui-cos-head { align-self: stretch; display: flex; align-items: center; gap: calc( 6 * var( --px ) ); line-height: 0; }
.ui-cos-tabs, .ui-cos-acts { display: flex; justify-content: center; gap: calc( 3 * var( --px ) ); }
.ui-cos-acts { margin-left: auto; }
.ui-cos-tab.on { border-image-source: var( --ui-button-down ); cursor: default; }
.ui-cos-name { display: flex; align-items: center; justify-content: center; gap: calc( 6 * var( --px ) ); line-height: 0; }
.ui-cos-rows { display: grid; grid-template-columns: repeat( 4, calc( 90 * var( --px ) ) ); gap: calc( 3 * var( --px ) ); } /* the four slots in a row: 76 art px of name ( screens.js ROW_TEXT ) and the button's 14 */
.ui-cos-row { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: var( --px ); padding: calc( 2 * var( --px ) ) calc( 1 * var( --px ) ) calc( 2 * var( --px ) ) calc( 3 * var( --px ) ); }
.ui-cos-picks { width: calc( 337 * var( --px ) ); display: flex; flex-wrap: wrap; justify-content: center; gap: calc( 3 * var( --px ) ); } /* four tiles a row ( 4 x 82 and three gaps ) */
.ui-cos-pick { flex-direction: column; justify-content: space-between; width: calc( 82 * var( --px ) ); /* PICK_TEXT ( screens.js ) + 14: the 5 px frames, the padding and a px to spare */ box-sizing: border-box; gap: var( --px ); padding: calc( 2 * var( --px ) ) calc( 1 * var( --px ) ); }
.ui-cos-pick.on { border-image-source: var( --ui-button-hot ); }
.ui-cos-pick .ui-lines { align-items: center; }
.ui-cos-icon { flex: none; min-width: calc( 24 * var( --px ) ); min-height: calc( 24 * var( --px ) ); } /* ( the names stand at the tile's foot: a tile with no icon is an empty box over its name ) */
.ui-confirm[data-costume] { background: none; } /* the costume's question: no veil over the hero ( he is the preview ), the card over the panel, which is docked clear of him ( screens.js askReplace ) */
.ui-confirm[data-costume] > .ui-confirm-card { position: absolute; left: round( var( --ask-x ), var( --dpx, 1px ) ); top: round( var( --ask-y ), var( --dpx, 1px ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); }
.ui-cos-asked { display: flex; align-items: flex-start; flex: none; } /* the question's name and its "?": one piece of the line, so the mark is never left on a line of its own */
.ui-cos-asked > .txt + .txt { margin-left: calc( -3 * var( --px ) ); } /* ( the mark at the font's own letter gap, 1 px of ink to ink: each text piece carries 2 px of clear edge, bitfont.js rasterGrid ) */
.ui-backdrop.clear { background: none; } /* the costume panel: the paused world as it is ( he is the preview ), the backdrop still taking the taps beside the panel */

/* The prompt over an active waypoint while Pepecat stands at it. */
.ui-wp-prompt { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; background: none;
  padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) ); border-width: calc( 5 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 5 * var( --px ) ) stretch; --px: var( --tpx, 2px );
  filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); animation: wp-in 0.3s steps( 3 ) both; }
.ui-wp-prompt:hover, .ui-wp-prompt:focus-visible { border-image-source: var( --ui-button-hot ); outline: none; }
/* the world takes its click ( screens.js updateWaypointPrompt ): held Shift fires through it, and an enemy at the cursor is attacked */
.ui-wp-prompt.shift, .ui-wp-prompt.foe { pointer-events: none; }
.ui-wp-prompt .ui-wp-mark { width: calc( 9 * var( --px ) ) !important; height: calc( 9 * var( --px ) ) !important; }
@keyframes wp-in { from { opacity: 0; translate: 0 calc( 3 * var( --px ) ); } }
/* the merchant's ( screens.js updateTradePrompt ): the same plaque over his stall, a coin for the waypoint's mark */
.ui-trade-prompt .ui-trade-coin { flex: none; }

/* The merchant's shop ( screens.js renderShop ): six lots on gilt cards, three by two, each its item on a 2 × 4 socket
   and a 112 art px column ( LOT_W ): name, type, the change against what is worn, price and Buy. Buy pins to the card's foot so the
   row lines up; disabled, it says why in its own face ( blood: short of gold or room ). A sold lot's item and name dim. */
.ui-shop { left: round( 50%, var( --dpx, 1px ) ); top: calc( 24 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; }
.ui-shop-foot { gap: calc( 4 * var( --px ) ); } /* the restock line, and while gold is short its quiet note on where gold comes from */
.ui-shop-sub { display: flex; gap: calc( 4 * var( --px ) ); line-height: 0; } /* the vendor's title, and its line after it */
.ui-shop-head { align-self: stretch; display: flex; justify-content: space-between; align-items: center; line-height: 0; padding: 0 calc( 3 * var( --px ) ); }
.ui-lots { display: grid; grid-template-columns: repeat( 3, auto ); gap: calc( 4 * var( --px ) ); }
.ui-lot { display: flex; gap: calc( 4 * var( --px ) ); padding: var( --px ) calc( 2 * var( --px ) ) var( --px ) var( --px ); cursor: default;
  border-width: calc( 6 * var( --px ) ); border-image: var( --ui-tip ) 6 fill / calc( 6 * var( --px ) ) stretch; }
.ui-lot.r-rare, .ui-lot.r-unique { border-image-source: var( --ui-tip-gilt ); }
.ui-lot-socket { position: relative; flex: none; }
.ui-lot-text { width: calc( 112 * var( --px ) ); display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); padding-top: calc( 2 * var( --px ) ); }
.ui-lot-name { display: flex; flex-direction: column; gap: var( --px ); min-height: calc( 15 * var( --px ) ); line-height: 0; } /* two lines' room: the rows align */
.ui-lot-line, .ui-lot-price { line-height: 0; }
.ui-lot .ui-lot-change { margin-left: 0; }
.ui-lot.sold :is( .ui-lot-socket .ui-item, .ui-lot-name ) { opacity: 0.4; }
.ui-lot-buy { margin-top: auto; display: flex; align-items: center; justify-content: center; line-height: 0; background: none; cursor: pointer; min-height: calc( 31 * var( --px ) ); /* the gothic Buy's own height: every face one size */
  padding: var( --px ) calc( 4 * var( --px ) ); border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; }
.ui-lot-buy .txt { display: block; } /* the rest and hot faces one box: the button never changes height under the pointer */
.ui-lot-buy .hot, .ui-lot-buy:not( :disabled ):is( :hover, :focus-visible ) .rest { display: none; }
.ui-lot-buy:not( :disabled ):is( :hover, :focus-visible ) .hot { display: block; }
.ui-lot-buy:not( :disabled ):is( :hover, :focus-visible ) { border-image-source: var( --ui-button-hot ); outline: none; }
.ui-lot-buy:not( :disabled ):is( :active, .pressed ) { translate: 0 var( --px ); border-image-source: var( --ui-button-down ); }
.ui-lot-buy:disabled { cursor: default; border-image-source: var( --ui-button-off ); }

/* Zone title card ( zone_entered ): huge gothic name, a rule, its line and the area level; about 2.5 s. */
.ui-zonecard { position: absolute; left: 0; right: 0; top: round( 22%, var( --dpx, 1px ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 var( --void ) ); opacity: 0; pointer-events: none; }
.ui-zonecard.show { animation: zone-in 3.2s steps( 32 ) both; }
@keyframes zone-in { 0% { opacity: 0; translate: 0 calc( 4 * var( --px ) ); } 12% { opacity: 1; translate: 0 0; } 78% { opacity: 1; } 100% { opacity: 0; } }
.ui-zonecard.hold { animation: none; opacity: 1; }
/* a screen opened on arrival ( I, T ) stands over the card, never under it: the card is mounted after the
   panels, so it stands down while one is open ( as it does under the ascend screen below ) */
body.ui-screen-open .ui-zonecard { visibility: hidden; }
.ui-zonecard-name { margin-bottom: calc( -1 * var( --px ) ); }

/* Death: blood vignette, huge gothic, one card of facts, one action. */
.ui-death { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc( 5 * var( --px ) );
  background: radial-gradient( ellipse at 50% 45%, rgba( 58, 13, 22, 0.55 ), rgba( 5, 4, 15, 0.92 ) 75% ); animation: death-in 1.2s ease-out both; }
@keyframes death-in { from { opacity: 0; } }
.ui-death-title { line-height: 0; filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 var( --void ) ); animation: death-title 1.6s steps( 8 ) both; }
@keyframes death-title { from { opacity: 0; translate: 0 calc( -6 * var( --px ) ); } }
.ui-rule.wide { width: calc( 242 * var( --px ) ); background-size: 100% 100%; }
.ui-death-card { border-width: calc( 6 * var( --px ) ); border-image: var( --ui-tip ) 6 fill / calc( 6 * var( --px ) ) stretch; padding: calc( 3 * var( --px ) ) calc( 8 * var( --px ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); --px: var( --tpx, 2px ); }
.ui-death-items { display: grid; grid-template-columns: auto auto auto auto; gap: calc( 2 * var( --px ) ) calc( 6 * var( --px ) ); align-items: center; line-height: 0; }
.ui-death-item { display: contents; }
.ui-death-groups, .ui-death-group { display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); }
/* short screens ( phones in landscape ): the groups side by side, no rarity column ( the name's colour says it ) */
@media ( max-height: 520px ) {
  .ui-death { gap: calc( 2 * var( --px ) ); }
  .ui-death-groups { flex-direction: row; align-items: flex-start; gap: calc( 10 * var( --px ) ); }
  .ui-death-items { grid-template-columns: auto auto auto; }
  .ui-death-items > .ui-death-item > :nth-child( 4 ) { display: none; }
}
.ui-death-pack { display: grid; grid-template-columns: auto auto auto auto; gap: calc( 1 * var( --px ) ) calc( 4 * var( --px ) ); align-items: center; line-height: 0; }
/* corpse items: the icon fitted to a small square, tinted and outlined in its rarity colour */
.ui-death-icon { position: relative; justify-self: center; cursor: default; outline: var( --px ) solid rgba( 240, 230, 198, 0.25 ); }
.ui-death-icon:not( .ui-item ) { outline: none; width: calc( 12 * var( --px ) ); height: calc( 1 * var( --px ) ); }
.ui-death-icon.r-magic { outline-color: rgba( 188, 202, 223, 0.8 ); }
.ui-death-icon.r-rare { outline-color: rgba( 255, 200, 69, 0.9 ); }
.ui-death-icon.r-unique { outline-color: rgba( 232, 128, 30, 0.95 ); }
.ui-death-icon:hover .ui-item-bg { background: rgba( 5, 4, 15, 0.35 ); }
.ui-death-where, .ui-death-recall { display: flex; align-items: center; gap: calc( 4 * var( --px ) ); line-height: 0; }
.ui-rise { pointer-events: auto; }

/* Boss intro title card. */
.ui-card { position: absolute; left: 0; right: 0; top: 30%; display: flex; flex-direction: column; align-items: center; gap: calc( 4 * var( --px ) ); filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 var( --void ) ); opacity: 0; }
.ui-card.show { animation: card-in 1.8s steps( 12 ) both; } /* screens.js BOSS_CARD; a shorter intro shortens it inline */
@keyframes card-in { 0% { opacity: 0; translate: 0 calc( 4 * var( --px ) ); } 12% { opacity: 1; translate: 0 0; } 80% { opacity: 1; } 100% { opacity: 0; } }
.ui-card.hold { animation: none; opacity: 1; }
.ui-card-epithet { margin-top: calc( -1 * var( --px ) ); --px: max( 2px, var( --spx, 1px ) ); }

/* Level-up toast. */
.ui-levelup { position: absolute; left: 0; right: 0; top: 16%; display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 var( --void ) ); opacity: 0; }
.ui-levelup.show { animation: level-in 3s ease-out both; }
@keyframes level-in { 0% { opacity: 0; translate: 0 calc( 6 * var( --px ) ); } 10% { opacity: 1; translate: 0 0; } 75% { opacity: 1; } 100% { opacity: 0; } }
.ui-levelup.hold { animation: none; opacity: 1; }
.ui-level-sub { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; }
/* Under Hellcharge's held aim: how to cancel it ( screens.js updateAimHint ). */
.ui-aim-hint { position: absolute; left: 0; top: 0; transform: translateX( round( -50%, var( --dpx, 1px ) ) ); pointer-events: none; line-height: 0; --px: var( --tpx, 2px ); filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); }
.ui-aim-hint.above { transform: translate( round( -50%, var( --dpx, 1px ) ), -100% ); } /* touch: its bottom edge sits on the Ability button's top */
/* The Ascendancy reveal ( once ): below the level-up toast, as long as the card holds ( 5 s ). */
.ui-ascend { position: absolute; left: 0; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); pointer-events: none; filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 var( --void ) ); opacity: 0; }
.ui-ascend.show { opacity: 1; animation: ascend-in 5s ease-out both; }
@keyframes ascend-in { 0% { opacity: 0; translate: 0 calc( 6 * var( --px ) ); } 8% { opacity: 1; translate: 0 0; } 85% { opacity: 1; } 100% { opacity: 0; } }
.ui-screens.calm .ui-ascend.show { animation: none; }
/* The world dims behind it ( the death vignette at half strength, 0.3 s in and out ), and the other
   overlays stand down while it is up: First Steps, the pickup and screen toasts, the level-up and zone cards
   ( the reload prompt stays: it is play ). */
.ui-ascend-dim { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s ease-out;
  background: radial-gradient( ellipse at 50% 45%, rgba( 58, 13, 22, 0.3 ), rgba( 5, 4, 15, 0.6 ) 75% ); }
.ui-ascend-dim.show { opacity: 1; }
.ui-screens.calm .ui-ascend-dim { transition: none; }
#hud:has( .ui-ascend:not( [hidden] ) ) :is( .ui-hints, .hud-msg, .ui-storage, .ui-levelup, .ui-zonecard ) { visibility: hidden; }
.ui-ascend-trees { display: flex; gap: calc( 10 * var( --px ) ); line-height: 0; }

/* Save indicator ( top right ) and the storage-error toast ( top centre, blood banner ). */
.ui-save { --px: max( 2px, var( --spx, 1px ) ); position: absolute; right: calc( 6 * var( --px ) ); top: calc( 6 * var( --px ) ); display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); }
#hud:not( .touch ) .ui-save { top: auto; bottom: calc( 6 * var( --px ) ); }
.ui-save.busy .spr { animation: seal-pulse 0.9s steps( 3 ) infinite; }
@keyframes seal-pulse { 50% { filter: brightness( 1.5 ); } }
.ui-screens.calm .ui-save.busy .spr { animation: none; }
.ui-storage { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: calc( 10 * var( --px ) ); transform: translateX( round( -50%, var( --dpx, 1px ) ) ); --px: var( --tpx, 2px ); }
.ui-storage.error { height: auto; padding: calc( 5 * var( --px ) ) calc( 6 * var( --px ) ) calc( 9 * var( --px ) ); }
.ui-storage-text { display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); line-height: 0; }

/* Floor-loot plates: hidden until Alt ( or hover / fresh Rare+ ); world-positioned by screens.js. */
.ui-loot { position: absolute; inset: 0; --px: var( --tpx, 2px ); }
.ui-plate { position: absolute; left: 0; top: 0; pointer-events: none; cursor: pointer; line-height: 0; padding: var( --px ) calc( 2 * var( --px ) );
  border-width: calc( 3 * var( --px ) ); border-image: var( --ui-plate ) 3 fill / calc( 3 * var( --px ) ) stretch; opacity: 0; transition: opacity 0.07s; } /* the hovered plate's fade-in ( was 0.1 s; the user, 2026-11-02: faster ) */
.ui-plate.show { opacity: 0.92; pointer-events: auto; }
.ui-plate.hot { opacity: 1; border-image-source: var( --ui-plate-hot ); }
/* an enemy under or near the cursor wins the click ( screens.js updateLoot ): the press reaches the world and attacks */
.ui-loot.foe .ui-plate { pointer-events: none; }
/* desktop: Alt / Shift plates fade in over 150 ms, and every plate hides at once ( a shot clears them ) */
body:not( [data-input='touch'] ) .ui-loot.alt .ui-plate.show { transition: opacity 0.15s ease-out; }
body:not( [data-input='touch'] ) .ui-plate:not( .show ) { transition: none; }
.ui-plate { display: flex; gap: calc( 3 * var( --px ) ); align-items: center; }
.ui-plate .ui-plate-rarity { display: none; }
/* the hero's corpse: its own plate, "Your corpse" after the map's skull mark, lit under the cursor as an item's is ( screens.js updateLoot ) */
.ui-plate-corpse { border-image-source: var( --ui-plate-hot ); }
.ui-plate-corpse.show { opacity: 1; }
/* "+N more": the plates the screen had no clear place for ( screens.js moreSlot ), never a click target */
.ui-plate-more { box-sizing: border-box; justify-content: center; }
.ui-plate-more.on { opacity: 0.92; }
/* the item level: on the Shift reveal ( held, not firing, 2 s: screens.js .ilvl ) */
.ui-plate .ui-plate-il { display: none; }
/* idle ( shift-labels.js idlePlate: touch, no upgrade, out of reach ): the gem and the item's marks alone, dimmed, so the room shows */
.ui-plate.compact .ui-plate-name, .ui-plate.compact .ui-plate-rarity, .ui-plate.compact .ui-plate-il { display: none; }
.ui-plate.compact.show { opacity: 0.7; }
.ui-loot.ilvl .ui-plate .ui-plate-il { display: inline-block; }
/* the rarity gem: the name's colour is the level gap, so rarity reads from here ( and the Rare / Unique glow ) */
/* after the gem, the item's marks ( screens.js marksEl, item-verdict.js itemMarks: the pack's cells wear the same ): the verdict's
   arrows, then the level's pips ( .lv-pip ) */
.ui-plate-marks { flex: none; display: flex; align-items: center; gap: calc( 3 * var( --px ) ); }
.ui-plate-marks.none { display: none; }
.ui-plate-gap { flex: none; margin-left: calc( -1 * var( --px ) ); }
/* an upgrade's arrows ( green, teal, gold by tier; a worse item's one blood arrow ); the gold three breathe a warm glow, stepped like the
   pack band's pulse, still under reduced motion */
.ui-plate-gap.t3 { animation: gain-pulse 1.2s steps( 4 ) infinite; }
@keyframes gain-pulse { 50% { filter: brightness( 1.25 ) drop-shadow( 0 0 var( --px ) rgba( 255, 200, 69, 0.8 ) ); } }
.ui-screens.calm .ui-plate-gap.t3 { animation: none; filter: drop-shadow( 0 0 var( --px ) rgba( 255, 200, 69, 0.6 ) ); }
.ui-plate-gem { flex: none; width: calc( 4 * var( --px ) ); height: calc( 4 * var( --px ) ); rotate: 45deg; background: #cfbc96; box-shadow: 0 0 0 var( --px ) #150f26; }
.ui-plate.r-magic .ui-plate-gem { background: #6e8fd8; }
.ui-plate.r-rare .ui-plate-gem { background: #ffc845; }
.ui-plate.r-unique .ui-plate-gem { background: #e8801e; box-shadow: 0 0 0 var( --px ) #150f26, 0 0 calc( 2 * var( --px ) ) #e8801e; }
.ui-plate.hot .ui-plate-rarity, .ui-loot.alt .ui-plate.r-unique .ui-plate-rarity, .ui-loot.alt .ui-plate.r-rare .ui-plate-rarity { display: inline-block; }
/* ( no rarity glow on the plate itself: the gem alone carries rarity, clear of the level-gap orange and red ) */

/* Trash slot ( layer.trash, at the pack panel's foot, outside it: screens.js placeTrash ): an iron grate over embers; drop
   an item on it to sell it to the fire. Four times the art ( the user ): its own art px is 4 × --spx, a whole multiple, so
   the 22 px grate stays crisp at 88, the box ( the hit area ) the art's own; where the room beside the panel is short,
   placeTrash sets a smaller --px, still whole device px. Only while an item is in hand ( screens.js carrying:
   .ui-screens.carry ), rising in from below in steps; it sits beside the panel, so nothing reflows mid-drag. Lit under a
   held item, with what it pays on a plate over the item ( hotBin: right-aligned on .ui-held, kept on screen: keepPlate ).
   Rare and Unique ask first ( .ui-confirm, Keep focused ); "+N gold" rises from the grate. */
.ui-trash { --px: calc( 4 * var( --spx, 2px ) ); position: absolute; width: calc( 22 * var( --px ) ); height: calc( 22 * var( --px ) ); pointer-events: auto; filter: var( --hard-drop ); visibility: hidden; }
.ui-trash[hidden] { display: none; }
.ui-screens.carry .ui-trash { visibility: visible; animation: trash-rise 0.16s steps( 3 ) both; }
.ui-screens.calm.carry .ui-trash { animation: none; }
@keyframes trash-rise { 0% { translate: 0 calc( 4 * var( --spx, 2px ) ); opacity: 0; } }
.ui-trash .spr { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: round( 50%, var( --dpx, 1px ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); }
.ui-trash .hot, .ui-trash.on .rest { display: none; }
.ui-trash.on .hot { display: block; }
.ui-trash.on { box-shadow: 0 0 calc( 2 * var( --px ) ) rgba( 255, 140, 40, 0.45 ); } /* the embers' glow past the held item over it */
/* The gold plate: what the grate pays, over the held item, and the same plate rising from the grate once it is paid. */
.ui-trash-gold, .ui-gold-float { display: flex; gap: calc( 2 * var( --px ) ); align-items: center; line-height: 0; white-space: nowrap;
  padding: var( --px ) calc( 2 * var( --px ) ); border-width: calc( 3 * var( --px ) ); border-image: var( --ui-plate-hot ) 3 fill / calc( 3 * var( --px ) ) stretch; }
.ui-trash-gold { position: absolute; right: 0; bottom: calc( 100% + 2 * var( --px ) ); }
.ui-confirm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba( 5, 4, 15, 0.6 ); pointer-events: auto; z-index: 8; --px: var( --tpx, 2px ); }
.ui-confirm[hidden] { display: none; }
.ui-confirm-card { display: flex; flex-direction: column; align-items: center; gap: calc( 6 * var( --px ) ); padding: calc( 6 * var( --px ) ) calc( 10 * var( --px ) );
  border-width: calc( 7 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; }
.ui-confirm-line { display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: center; max-width: calc( 300 * var( --px ) ); }
.ui-confirm-acts { display: flex; gap: calc( 6 * var( --px ) ); }
/* Paid: the gold plate stands on the grate's top edge ( screens.js goldFloat: centred on it, held inside the screen ), then
   rises 6 art px in 6 steps, one art px a step ( 12 px at 2× ), fading over the last half; the timer removes it at 1.2 s. */
.ui-gold-float { position: absolute; translate: round( -50%, var( --dpx, 1px ) ) calc( -100% - 2 * var( --px ) ); pointer-events: none; z-index: 7; animation: gold-rise 1.1s steps( 6 ) both; }
@keyframes gold-rise { 0% { translate: round( -50%, var( --dpx, 1px ) ) calc( -100% - 2 * var( --px ) ); opacity: 1; } 50% { opacity: 1; }
  100% { translate: round( -50%, var( --dpx, 1px ) ) calc( -100% - 8 * var( --px ) ); opacity: 0; } }
.ui-screens.calm .ui-gold-float { animation-timing-function: steps( 2 ); }

/* The death panel owns the screen: the automap's corner map and chip step aside while it is up. */
#hud:has( .ui-death:not( [hidden] ) ) > .automap-corner, #hud:has( .ui-death:not( [hidden] ) ) > .automap-chip { display: none; }

.ui-loot.quiet .ui-plate { opacity: 0; pointer-events: none; } /* a boss or zone card is playing */
.ui-loot .ui-plate.show.veil { opacity: 0; pointer-events: none; } /* over a boss's live tell or his body through one ( tell-veil.js ): back as it ends */
/* a screen is open: the world's labels would only crowd its frame ( they take no input meanwhile ) */
body.ui-screen-open .ui-loot, body.ui-screen-open .ui-wp-prompt { visibility: hidden; }

/* Front door ( src/ui/front.js ): title, loading veil, slice-complete card, first-time hints.
   --fpx is one front art px: the largest whole device px at which the 640 × 360 front grid fits
   ( 3 at 1080p, 2 at 720p ). The backdrop and the particle canvas cover the window at a whole
   multiple of it; the logotype and title buttons are sized in it. Settings / Controls keep the
   pause menu's --px. */

body.ui-front-open #pause { display: none !important; }
/* The HUD is not styled while the front covers it: the boot veil ( ui-boot ) and the title. Hidden
   ( not visibility ), its ~100 nodes skip every style pass of the boot, about 130 ms at CPU ×4 on a
   phone; they are styled once, when the front closes. The end card shows the HUD beneath it. */
body.ui-boot #hud, body.ui-front-open:not( .front-slice ) #hud { display: none; }
/* The boss bar goes with the card over it ( body.front-slice: the way on's and the slice's ): it peeked out behind the slice card's crest ( QA 2026-11-01 ). */
body.front-slice .hud-target { visibility: hidden; }
/* and the pack bar beside it ( threats.js .hud-swarm, the same top offset ): it peeked out there too ( QA 2026-11-01 ) */
body.front-slice .hud-swarm { visibility: hidden; }
/* and the autosave's corner tag ( screens.js .ui-save ): a "Saved" seal over a dimmed playfield read like debug UI ( the arctic critique ); the slice card says it in its own words ( .front-saved ) */
body.front-slice .ui-save { visibility: hidden; }

.front { position: fixed; inset: 0; z-index: 20; overflow: hidden; cursor: default; color: var( --bone2 ); }
.front[hidden], .front [hidden] { display: none !important; }
.front.scenic { background: var( --void ); }
.front-bg { position: absolute; left: 50%; top: 50%; translate: -50% -50%; background: var( --ui-front-backdrop ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.front-fx { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
/* the sunny title ( front.js setScene ): its backdrop comes with the gilt sheet ( front-sunny.js installGilt ) */
.front[data-scene="sunny"] { --ui-front-backdrop: var( --ui-sunny-backdrop, none ); }
/* Its hold, on the first frame: never a black one while the chunk, the backdrop and the life sheet come in. Each art
   row's commonest colour in art/ui/sunny/front-backdrop.png ( a lone row of another colour, a leaf tip in the sky,
   joins the band above it ), so the sky's dither stands as alternate rows, then the horizon, the treeline and the
   meadow, on the backdrop's own grid. Once the art is decoded ( .is-sunny-ready ) it steps off over it. */
.front[data-scene="sunny"] .front-bg::before { content: ''; position: absolute; inset: 0; transition: opacity 0.4s steps( 5 );
  background: linear-gradient( #3c6c94 0 4.444%, #78acd0 4.444% 4.722%, #3c6c94 4.722% 5%, #78acd0 5% 5.278%, #3c6c94 5.278% 5.556%, #78acd0 5.556% 5.833%,
    #3c6c94 5.833% 6.111%, #78acd0 6.111% 6.389%, #3c6c94 6.389% 6.667%, #78acd0 6.667% 6.944%, #3c6c94 6.944% 7.222%, #78acd0 7.222% 7.5%, #3c6c94 7.5% 7.778%,
    #78acd0 7.778% 42.222%, #b4e0ec 42.222% 42.5%, #78acd0 42.5% 42.778%, #b4e0ec 42.778% 43.056%, #78acd0 43.056% 43.333%, #b4e0ec 43.333% 43.611%,
    #78acd0 43.611% 43.889%, #b4e0ec 43.889% 44.167%, #78acd0 44.167% 44.444%, #b4e0ec 44.444% 44.722%, #78acd0 44.722% 45%, #b4e0ec 45% 45.278%,
    #78acd0 45.278% 45.556%, #b4e0ec 45.556% 45.833%, #78acd0 45.833% 46.111%, #b4e0ec 46.111% 46.389%, #78acd0 46.389% 46.667%, #b4e0ec 46.667% 54.444%,
    #78acd0 54.444% 63.056%, #4e7c70 63.056% 64.167%, #24504c 64.167% 68.611%, #86a63a 68.611% 69.444%, #d8dc6a 69.444% 69.722%, #86a63a 69.722% 70%,
    #d8dc6a 70% 70.278%, #86a63a 70.278% 75.556%, #4e7c70 75.556% 76.389%, #86a63a 76.389% 98.333%, #4e7c70 98.333% 100% ); }
.front[data-scene="sunny"].is-sunny-ready .front-bg::before { opacity: 0; }
/* the shangri-la title ( level 80+ Han Imperial Cloud-Sea Shrine, front.js setScene ): celestial sapphire sky, cloud sea, celadon jade & Mingtang sanctum */
.front[data-scene="shangrila"] { --ui-front-backdrop: var( --ui-shangrila-backdrop, none ); }
.front[data-scene="shangrila"] .front-bg::before { content: ''; position: absolute; inset: 0; transition: opacity 0.4s steps( 5 );
  background: linear-gradient( #150f26 0 11%, #3c6c94 11% 28%, #78acd0 28% 46%, #b4e0ec 46% 62%, #173230 62% 76%, #1a8494 76% 86%, #262b38 86% 100% ); }
.front[data-scene="shangrila"].is-shangrila-ready .front-bg::before { opacity: 0; }
/* on a phone the foot line would sit on the koi arch ( the scene's liveliest water ): it moves to the plain wall right of the falls */
@media ( pointer: coarse ), ( max-height: 480px ) { .front[data-scene="shangrila"] .front-foot { justify-content: flex-end; padding-right: calc( 12 * var( --px ) ); } }
:is( .calm, .front.calm ) .front-bg::before { transition: none; }
:root[data-ui-theme="whitegold"] .front-logo { filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 #150f26 ) drop-shadow( 0 0 calc( 6 * var( --px ) ) rgba( 23, 50, 48, 0.8 ) ); }
:root[data-ui-theme="whitegold"] .front-btn { box-shadow: 0 calc( 1 * var( --px ) ) calc( 5 * var( --px ) ) rgba( 21, 15, 38, 0.72 ); }
:root[data-ui-theme="whitegold"] .front-btn.is-focus { box-shadow: 0 0 calc( 6 * var( --px ) ) rgba( 106, 196, 186, 0.45 ), 0 0 calc( 2 * var( --px ) ) rgba( 238, 246, 255, 0.4 ); }

.front-stage { --px: var( --fpx ); position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding-top: calc( 22 * var( --px ) ); gap: calc( 10 * var( --px ) ); box-sizing: border-box; }
.front-logo { display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); filter: drop-shadow( 0 calc( 2 * var( --px ) ) 0 rgba( 5, 4, 15, 0.7 ) ); }
.front-logo-sub { margin-top: calc( 1 * var( --px ) ); }

/* the primaries two of the gothic row's cells wide ( .front-menu-row ), so the row below reads as their base */
.front-menu { display: flex; flex-direction: column; align-items: center; gap: calc( 4 * var( --px ) ); margin-top: calc( 8 * var( --px ) ); }
.front-menu > .front-btn { width: calc( ( 2 * ( var( --row-cell-gothic ) + 10 + 2 * var( --row-pad-gothic ) ) + 4 ) * var( --px ) ); box-sizing: border-box; }
.front-btn { flex-direction: column; gap: calc( 1 * var( --px ) ); min-width: calc( 132 * var( --px ) ); }
.front-btn-label { display: flex; }
.front-btn-label.alt, .front.is-tight .front-menu-row .front-btn-label:not( .alt ) { display: none; }
.front.is-tight .front-menu-row .front-btn-label.alt { display: flex; }
/* Load game | Settings | Controls ( the user, 2026-11-07: Load game smaller, before them ): three equal secondaries on one row. Each cell
   holds the widest label ( --row-cell-<face>, in px units ) plus the frame ( .menu-btn's 5 a side ) and --row-pad a side, --row-gap between,
   all set by front.js ( ROW ). The gothic row is wider than the primaries, centred directly under them at width --row. The first one's fleur on
   its left, the last one's on its right, turned to face it; the middle one's would land on a neighbour: its hot frame alone.
   .front.is-tight ( front.js layout: where the gothic row would reach the brazier pillars, the desktop's 1280 × 720 and 1920 × 1080 ): the
   small face, a tighter frame, no fleurs ( past the ends they would reach the pillars' caps ); its hot frame and label mark the focus. */
.front-menu-row { --cell: var( --row-cell-gothic ); --pad: var( --row-pad-gothic ); --gap: var( --row-gap-gothic );
  --row: calc( ( 3 * ( var( --cell ) + 10 + 2 * var( --pad ) ) + 2 * var( --gap ) ) * var( --px ) ); width: var( --row ); max-width: calc( 100vw - 16px ); display: flex; gap: calc( var( --gap ) * var( --px ) ); contain: inline-size; }
.front.is-tight .front-menu-row { --cell: var( --row-cell-small ); --pad: var( --row-pad-small ); --gap: var( --row-gap-small ); }
.front-menu-row .front-btn { flex: 1 1 0; min-width: 0; padding-inline: calc( var( --pad ) * var( --px ) ); }
.front-menu-row .front-btn:last-child::before { left: auto; right: calc( -14 * var( --px ) ); scale: -1 1; }
.front-menu-row .front-btn:not( :first-child, :last-child )::before, .front.is-tight .front-menu-row .front-btn::before { content: none; }
.front-btn.is-focus .rest { display: none; }
.front-btn.is-focus .hot { display: inline-block; }
.front-btn.is-focus { border-image-source: var( --ui-button-hot ); }
.front-btn.is-focus::before { content: ''; position: absolute; left: calc( -14 * var( --px ) ); top: 50%; width: calc( 7 * var( --px ) ); height: calc( 7 * var( --px ) ); translate: 0 -50%;
  background: var( --ui-fleur ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; animation: fleur 1.2s steps( 2 ) infinite; }
.front-btn:disabled { cursor: default; border-image-source: var( --ui-button-off ); }
.front-btn:disabled:hover .rest { display: inline-block; }
.front-btn:disabled:hover .hot, .front-btn:disabled .hot { display: none; }
.front-btn:disabled:active { translate: none; }
/* A thumb's target on a phone: at least 44 CSS px tall ( the 9-slice stretches ). */
@media ( pointer: coarse ) { .front-btn { min-height: 44px; } }
/* Continue's save summary ( front.js button(): .front-subs ) is a caption under the menu, centred ( showTitle moves it out of the button:
   beside it, it lay over the right brazier pillar; narrower than the row, it clears both at every size ), out of its flow: the idle title
   shows more of its art and nothing moves when it appears. It shows on Continue's hover, or once an arrow / Tab ( the front's data-nav )
   has put the selection on the button; never from the default highlight when the title opens, never on touch. */
.front-menu { position: relative; }
.front-subs { position: absolute; left: 50%; top: calc( 100% + 6 * var( --px ) ); translate: -50% 0; display: none; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) );
  padding: calc( 1 * var( --px ) ) calc( 4 * var( --px ) ); border-width: calc( 5 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 5 * var( --px ) ) stretch; /* the waypoint prompt's compact panel ( screens.css .ui-wp-prompt ) */
  filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); opacity: 0; pointer-events: none; transition: opacity 0.18s ease-out; }
.front-menu:has( > [data-go="continue"]:hover ) > .front-subs, .front[data-nav="key"] .front-menu:has( > [data-go="continue"].is-focus ) > .front-subs { display: flex; opacity: 1; }
:is( .calm, .front.calm ) .front-subs { transition: none; }
:is( .calm, .front.calm ) :is( .front-btn.is-focus::before, .front-bar-fill ) { animation: none; }
@media ( pointer: coarse ) { .front-subs { display: none !important; } }
body[data-input="touch"] .front-subs { display: none !important; }
.front-foot { position: absolute; bottom: calc( 8 * var( --px ) ); left: 0; right: 0; display: flex; justify-content: center; }
.front-btn-label.alt .txt, .front-foot .txt, .front-loading .txt { --px: max( 2px, var( --fpx ) ); }

/* New Game confirmation: the pause panel's frame, at the front's pixel size. */
.front-confirm { margin-top: calc( 4 * var( --px ) ); min-width: calc( 220 * var( --px ) ); gap: calc( 4 * var( --px ) ); }
.front-confirm-btns { display: flex; flex-wrap: wrap; justify-content: center; max-width: 100%; gap: calc( 8 * var( --px ) ); margin-top: calc( 4 * var( --px ) ); }
.front-confirm-btns .front-btn { min-width: calc( 96 * var( --px ) ); }

/* Loading: the logotype, a line of flavour and a forged bar; determinate from main.js's --load-progress, else a sweep. */
.front-loading { display: flex; flex-direction: column; align-items: center; gap: calc( 4 * var( --px ) ); margin-top: calc( 40 * var( --px ) ); }
.front-bar { position: relative; width: calc( 160 * var( --px ) ); height: calc( 11 * var( --px ) ); border-width: calc( 4 * var( --px ) ) calc( 5 * var( --px ) ); border-image: var( --ui-bar-frame ) 4 5 fill / calc( 4 * var( --px ) ) calc( 5 * var( --px ) ) stretch; overflow: hidden; }
.front-bar-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 28%; background: var( --ui-load-fill ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; animation: front-load 1.6s steps( 24 ) infinite; }
.front-loading.known .front-bar-fill { animation: none; width: calc( var( --load-progress, 0 ) * 100% ); transition: width 0.2s steps( 8 ); }
@keyframes front-load { from { translate: -100% 0; } to { translate: 360% 0; } }

/* Slice complete: a dimmed playfield and a framed card. */
.front-card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba( 8, 5, 14, 0.72 ); --px: var( --fpx ); }
/* The panel is as wide as its widest row ( the way on's two buttons: "End the descent" is the longest ), up to the window less a margin: .menu-panel's 62vw cap
   left the row spilling past the frame at 1280 and 1920. A window too narrow even for that wraps the buttons ( below ) instead of overflowing. */
.front-card-panel { min-width: calc( 230 * var( --px ) ); gap: calc( 4 * var( --px ) ); padding-top: calc( 10 * var( --px ) ); }
.front-card .front-card-panel { max-width: calc( 100vw - 16 * var( --px ) ); } /* ( the extra class: ui.css's .menu-panel comes later at the same weight ) */
/* The way on ( front.js showExit ): the same card on a lighter dim, the zone still in view around it; no seal. */
.front-card.front-exit { background: rgba( 8, 5, 14, 0.45 ); cursor: pointer; }
.front-card.front-exit .front-card-panel { cursor: default; padding-top: calc( 6 * var( --px ) ); }
.front-exit-foot { margin-top: calc( 2 * var( --px ) ); }
/* The slice card's save line: its place held from the first frame, lit when the save lands ( front.js, the engine's 'saved' after slice_complete ), so the card does not shift */
.front-saved { opacity: 0; }
.front-saved.on { opacity: 1; }
.front-seal { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: calc( -36 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; filter: drop-shadow( 0 0 calc( 3 * var( --px ) ) rgba( 232, 128, 30, 0.55 ) ); }
/* A card too tall for the window ( its zone rows and its find's height: front.js fitCard steps data-fit
   up until the seal and the frame are on screen ). 1: a tighter panel set lower, centred with the seal
   over it; 2: the rows close up and the panel's gaps halve, the copy all kept; 3: the find goes unlabelled
   and the save line goes ( as before ); 4: the find goes. The closing line always stays ( the coordinator, 2026-11-06:
   a whole campaign's card must keep "the south still burns"; past six zones the rows run in two tables, front.js zoneTable ). */
.front-card[data-fit] { padding-top: calc( 16 * var( --px ) ); }
.front-card[data-fit] .front-card-panel { gap: calc( 2 * var( --px ) ); padding-top: 0; }
.front-card[data-fit] .front-zones { row-gap: calc( 1 * var( --px ) ); }
.front-card[data-fit] .front-stats { margin: 0; }
.front-card:is( [data-fit="2"], [data-fit="3"], [data-fit="4"] ) .front-card-panel { gap: calc( 1 * var( --px ) ); }
.front-card:is( [data-fit="2"], [data-fit="3"], [data-fit="4"] ) .front-zones { row-gap: 0; }
.front-card:is( [data-fit="3"], [data-fit="4"] ) :is( .front-best > :first-child, .front-saved ) { display: none; }
.front-card[data-fit="4"] .front-best { display: none; }
.front-stats { display: grid; grid-template-columns: repeat( 3, auto ); gap: 0 calc( 14 * var( --px ) ); margin: calc( 2 * var( --px ) ) 0; }
.front-stat { display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); }
/* After the ogre: a row per zone ( name, time, kills ), above the totals. */
.front-zones { display: grid; grid-template-columns: auto auto auto; gap: calc( 2 * var( --px ) ) calc( 12 * var( --px ) ); align-items: center; line-height: 0; margin-top: calc( 1 * var( --px ) ); }
.front-zone-cell.num { justify-self: end; }
/* Past six zones ( front.js zoneTable ): two tables side by side, tops level, a column's gap and a half between them */
.front-zone-pair { display: flex; align-items: flex-start; gap: calc( 18 * var( --px ) ); }
.front-best { display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); }
.front-find { display: flex; align-items: center; gap: calc( 6 * var( --px ) ); }
.front-find-icon { position: relative; flex: none; cursor: default; }
.front-find-text { display: flex; flex-direction: column; gap: calc( 2 * var( --px ) ); }

/* The Load game list ( front.js showSlots ): the pause panel's frame over the dimmed backdrop, at the front's pixel size, a row
   per save slot: the slot's button ( its hero in two lines under the name ) and Delete beside it, both a thumb's height on a phone. */
.front-slots { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba( 8, 5, 14, 0.55 ); --px: var( --fpx ); }
.front-slots .front-slots-panel { gap: calc( 3 * var( --px ) ); max-width: calc( 100vw - 16 * var( --px ) ); max-height: calc( 100vh - 8 * var( --px ) ); }
.front-slot-list { display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); }
.front-slot-row { display: flex; align-items: stretch; gap: calc( 4 * var( --px ) ); }
.front-slot { flex: 1 1 auto; min-width: calc( 200 * var( --px ) ); align-items: flex-start; padding-block: calc( 1 * var( --px ) ); }
.front-slot-lines { display: flex; flex-direction: column; align-items: flex-start; gap: calc( 1 * var( --px ) ); }
.front-slot-del { min-width: calc( 56 * var( --px ) ); }
.front-slot-del:disabled { visibility: hidden; } /* an empty slot has nothing to delete: its column kept, the rows aligned */
/* the fleur points at the row's slot button from the left; on Delete it sits on its right, clear of the slot beside it */
.front-slot-del.is-focus::before { left: auto; right: calc( -14 * var( --px ) ); scale: -1 1; }
.front-slots .front-confirm-btns { margin-top: calc( 1 * var( --px ) ); }

/* Settings / Controls from the title: the pause menu's panel over the backdrop. */
.front-pages { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba( 8, 5, 14, 0.55 ); font-size: max( 15px, calc( 8 * var( --px ) ) ); }

/* First-time controls hints: bottom-centre of the playfield, above the skill tray ( 58 HUD px tall:
   the bottom clears it in --hpx, since the HUD px outgrows --tpx on wide 1440p windows ). */
#hud > .ui-hints { --px: var( --tpx, 2px ); left: round( 50%, var( --dpx, 1px ) ); bottom: max( calc( 60 * var( --px ) ), calc( 62 * var( --hpx, 0px ) ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); padding: calc( 4 * var( --px ) ) calc( 8 * var( --px ) );
  border-width: calc( 7 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; filter: var( --hard-drop ); }
#hud > .ui-hints.gone { opacity: 0; transition: opacity 1.2s steps( 4 ) 0.3s; }
/* timed out after 8 s on screen ( front.js stepHints ): a smooth 0.6 s fade that takes no input */
#hud > .ui-hints.timeout { opacity: 0; transition: opacity 0.6s ease-out; pointer-events: none; }
.ui-hints-title { align-self: center; margin-bottom: calc( 1 * var( --px ) ); }
.ui-hint-row { display: grid; grid-template-columns: calc( 44 * var( --px ) ) auto calc( 9 * var( --px ) ); align-items: center; gap: calc( 5 * var( --px ) ); }
.ui-hint-keys { display: flex; align-items: center; justify-content: flex-end; gap: calc( 2 * var( --px ) ); }
.ui-hint-pending { width: calc( 5 * var( --px ) ); height: calc( 5 * var( --px ) ); justify-self: center; background: var( --umbra ); box-shadow: 0 0 0 var( --px ) var( --void ); }
body.ui-screen-open #hud > .ui-hints, #hud > .ui-hints[hidden], #hud:has( .ui-death:not( [hidden] ) ) > .ui-hints { display: none; }
/* a zone or boss title card is playing ( screens.js quietPlates, as the floor plates ): the panel would cross it */
#hud:has( .ui-loot.quiet ) > .ui-hints { visibility: hidden; }
/* the pause menu is up: on a phone its panel would cross the card */
body:has( > #pause:not( [hidden] ) ) #hud.touch > .ui-hints { visibility: hidden; }

/* Touch controls ( src/ui/touch.js ): only for body[data-input=touch]. --cpx is one control art px
   ( a whole number of device px ); controls are placed by translate() from their centre, so each
   box is pulled back by half its size. --hit is a control's hit box ( at least 44 CSS px ). At rest
   the controls sit at --alpha; a pressed control is opaque and swaps to its soul-fire frame. */

/* :root --touch-shown ( touch.js: 0 / 1 as the controls go and come, one frame after a screen opens or shuts ) is read by no rule:
   the automap alone follows it, by the root's style attribute. Kept from inheriting, its change restyles the root and nothing
   under it ( inherited, it restyled and laid out the whole document, an open pack with it, for nothing ). A browser without
   @property inherits it as before. */
@property --touch-shown { syntax: '<number>'; inherits: false; initial-value: 1; }

.touch-layer { position: fixed; inset: 0; pointer-events: none; --cpx: 2px; --px: var( --cpx ); --alpha: 0.75; touch-action: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.touch-layer[hidden], body:not( [data-input="touch"] ) .touch-layer { display: none; }
.touch-layer .spr, .touch-turn .spr { display: block; flex: none; image-rendering: pixelated; background-repeat: no-repeat; background-size: 100% 100%; }
.touch-layer .hot { display: none; }
.touch-layer .on > .hot, .touch-layer .on > .touch-knob > .hot, .touch-stick.on > .touch-ring.hot { display: block; }
.touch-layer .on > .rest, .touch-layer .on > .touch-knob > .rest, .touch-stick.on > .touch-ring:not( .hot ) { display: none; }

.touch-zone { position: absolute; pointer-events: auto; touch-action: none; }

/* Sticks: the iron ring with its bone knob; the move stick rests as a faint ghost until a thumb lands. */
.touch-stick { position: absolute; left: 0; top: 0; width: calc( 56 * var( --cpx ) ); height: calc( 56 * var( --cpx ) ); margin: calc( -28 * var( --cpx ) ) 0 0 calc( -28 * var( --cpx ) );
  opacity: var( --alpha ); filter: drop-shadow( 0 var( --cpx ) 0 var( --void ) ); }
.touch-stick > .touch-ring { position: absolute; left: 0; top: 0; }
.touch-knob { position: absolute; left: calc( 15 * var( --cpx ) ); top: calc( 15 * var( --cpx ) ); width: calc( 26 * var( --cpx ) ); height: calc( 26 * var( --cpx ) ); }
.touch-stick.move { pointer-events: none; opacity: calc( var( --alpha ) * 0.55 ); }
.touch-stick.on { opacity: 1; }
/* Fire: the big button in the corner ( about 112 CSS px, twice an arc button: each button carries its own --cpx, touch.js ); held, its soul-fire rim flickers; dragged, it aims by hand. */
.touch-btn.fire.on .hot { animation: touch-fire 0.24s steps( 2 ) infinite; }
.touch-btn.fire .touch-icon { width: calc( 23 * var( --cpx ) ) !important; height: calc( 23 * var( --cpx ) ) !important; }
.touch-btn.aiming .touch-icon { scale: 0.85; }
@keyframes touch-fire { 50% { filter: brightness( 1.25 ); } }
/* The soft lock on the auto-target ( a tapped lock stays lit; at rest it is a dim, still mark on who Fire would pick ), and the drag-to-aim line from Pepecat. */
.touch-reticle { position: absolute; left: 0; top: 0; pointer-events: none; opacity: 0.8; animation: touch-lock 0.9s steps( 3 ) infinite; }
.touch-reticle.tapped { opacity: 1; animation: none; }
.touch-reticle.idle { opacity: 0.4; animation: none; }
.touch-reticle[hidden], .touch-aim-line[hidden] { display: none; }
@keyframes touch-lock { 50% { scale: 1.12; } }
.touch-aim-line { position: absolute; height: calc( 3 * var( --cpx ) ); margin-top: calc( -1.5 * var( --cpx ) ); transform-origin: 0 50%; pointer-events: none; opacity: 0.85;
  background: var( --ui-touch-aim-dot ) 0 0 / calc( 6 * var( --cpx ) ) 100% repeat-x; image-rendering: pixelated;
  mask-image: linear-gradient( 90deg, transparent calc( 10 * var( --cpx ) ), #000 calc( 14 * var( --cpx ) ), #000 70%, transparent ); }
/* Flask: low health pulses it while a charge is left. */
.touch-btn.low { opacity: 1; animation: touch-low 0.8s steps( 2 ) infinite; }
.touch-btn.low .hot { display: block; }
.touch-btn.low .rest { display: none; }
@keyframes touch-low { 50% { scale: 1.08; } }

/* Thumb buttons: round iron frames ( Fire the big one, Dodge the larger of the arc's ), the pictogram centred, a cooldown sweep. */
.touch-btn { position: absolute; left: 0; top: 0; width: var( --hit ); height: var( --hit ); margin: calc( var( --hit ) / -2 ) 0 0 calc( var( --hit ) / -2 ); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; pointer-events: auto; touch-action: none; opacity: var( --alpha ); filter: drop-shadow( 0 var( --cpx ) 0 var( --void ) ); --cd: 0; }
.touch-btn[hidden] { display: none; }
.touch-btn > .spr { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: round( 50%, var( --dpx, 1px ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); }
.touch-btn.on { opacity: 1; scale: 0.94; }
.touch-cd { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: round( 50%, var( --dpx, 1px ) ); width: calc( 26 * var( --cpx ) ); height: calc( 26 * var( --cpx ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); border-radius: 50%;
  background: conic-gradient( transparent 0 calc( ( 1 - var( --cd ) ) * 360deg ), rgba( 5, 4, 15, 0.8 ) 0 ); pointer-events: none; }
.touch-btn.lg .touch-cd { width: calc( 28 * var( --cpx ) ); height: calc( 28 * var( --cpx ) ); }
.touch-btn.sm .touch-cd { width: calc( 12 * var( --cpx ) ); height: calc( 12 * var( --cpx ) ); }
.touch-btn.cooling .touch-icon, .touch-btn.empty .touch-icon { filter: brightness( 0.6 ); }
.touch-count { position: absolute; right: calc( 50% - 14 * var( --cpx ) ); bottom: calc( 50% - 14 * var( --cpx ) ); }
.touch-btn[data-ctl="interact"] .touch-icon { animation: touch-beckon 1.2s steps( 2 ) infinite; }
@keyframes touch-beckon { 50% { translate: -50% calc( -50% - var( --cpx ) ); } }

/* Portrait: "Turn your device", over everything, on touch ( or any coarse pointer before a first touch ). */
.touch-turn { display: none; position: fixed; inset: 0; z-index: 40; align-items: center; justify-content: center; background: rgba( 5, 4, 15, 0.94 ); --px: var( --cpx, 2px ); touch-action: none; }
body[data-orientation="portrait"][data-input="touch"] .touch-turn { display: flex; }
@media ( pointer: coarse ) { body[data-orientation="portrait"] .touch-turn { display: flex; } }
.touch-turn-card { display: flex; flex-direction: column; align-items: center; gap: calc( 8 * var( --px ) ); max-width: calc( 100vw - 24px );
  padding: calc( 10 * var( --px ) ) calc( 14 * var( --px ) ); border-width: calc( 7 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; }
.touch-turn-art { display: flex; align-items: center; gap: calc( 6 * var( --px ) ); }
.touch-turn-from { animation: touch-turn 2.4s steps( 1 ) infinite; }
.touch-turn-arrow { animation: touch-spin 2.4s steps( 8 ) infinite; }
.touch-turn-to { animation: touch-turn 2.4s steps( 1 ) infinite reverse; }
@keyframes touch-turn { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.25; } }
@keyframes touch-spin { 0%, 40% { rotate: 0deg; } 60%, 100% { rotate: 90deg; } }
.touch-turn-face { position: relative; width: calc( 60 * var( --px ) ); height: calc( 60 * var( --px ) ); background: var( --umbra ); filter: var( --hard-drop ); }
.touch-turn-face::after { content: ''; position: absolute; inset: 0; background: var( --ui-portrait-frame ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.calm :is( .touch-turn .spr, .touch-layer .touch-icon, .touch-btn.fire.on .hot, .touch-reticle, .touch-btn.low ) { animation: none !important; }

/* ---- the HUD and the screens under touch ( #hud.touch, set by hud.js layout ) -------------------- */

/* The thumb controls own the bottom corners: the orb moves to the top-left with the powerups under
   it, the magazine along the top edge beside the orb ( out of the floor's lower middle ); the slots ( now thumb buttons ), portrait and plinth go. */
#hud.touch .hud-plinth, #hud.touch .hud-skills, #hud.touch .hud-portrait, #hud.touch .hud-weapon { display: none; }
/* the health orb in the screen's top-left corner ( the user's call; not the letterboxed playfield's ),
   clear of the safe area; its powerup timers under it. The minimap and icon row take the top edge's
   right end ( touch.js publishes them ). */
#hud.touch .hud-left { position: fixed; top: calc( var( --safe-top, 0px ) + 2 * var( --px ) ); bottom: auto; left: calc( var( --safe-left, 0px ) + 2 * var( --px ) ); }
#hud.touch .hud-center { position: fixed; left: calc( var( --safe-left, 0px ) + 4 * var( --px ) ); top: calc( var( --safe-top, 0px ) + 106 * var( --px ) ); bottom: auto; transform: none; align-items: flex-start; }
#hud.touch .hud-right { position: fixed; right: auto; left: calc( var( --safe-left, 0px ) + 101 * var( --px ) ); top: max( 4px, calc( var( --safe-top, 0px ) + 4 * var( --px ) ) ); bottom: auto; flex-direction: row; align-items: center; justify-content: center; gap: calc( 3 * var( --px ) ); }
/* Reload has no button: a tap on the magazine count tops up early ( touch.js adds .tap while the controls are up ); the hit box reaches 4 px past the count ( no further than the screen's top edge ), at least 44x44 px. */
#hud.touch .hud-right.tap { pointer-events: auto; touch-action: none; min-width: 36px; min-height: 36px; }
#hud.touch .hud-right.tap::after { content: ''; position: absolute; inset: -4px; }
/* A tap on the health orb drinks a flask ( touch.js; the orb's box, 97 × 104 art px, is some 129 × 139 px at 844 × 390 ):
   it sinks an art px for the press, and greys a moment when no charge is left ( the engine says so beside it ). */
#hud.touch .hud-orb.tap { pointer-events: auto; touch-action: none; cursor: pointer; }
#hud.touch .hud-orb.pressed { translate: 0 var( --px ); }
#hud.touch .hud-orb.pressed .hud-orb-glass { filter: brightness( 1.2 ); }
#hud.touch .hud-orb.dry .hud-orb-glass { filter: grayscale( 0.7 ) brightness( 0.8 ); }

/* Panels scroll inside the frame; items, nodes and sockets take the finger themselves. */
#hud.touch .ui-panel { max-height: calc( 100% - 8px ); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; }
#hud.touch .ui-item, #hud.touch .ui-node, #hud.touch .ui-socket, #hud.touch .ui-grid-field, #hud.touch .ui-plate { touch-action: none; }
#hud.touch .ui-inv, #hud.touch .ui-talents, #hud.touch .ui-map { top: 4px; }
#hud.touch .ui-travel { top: 4px; }
#hud.touch .ui-wp, #hud.touch .ui-map-zone, #hud.touch .ui-wp-prompt { min-height: 44px; }
#hud.touch .ui-inv { left: round( 50%, var( --dpx, 1px ) ); right: auto; translate: round( -50%, var( --dpx, 1px ) ) 0; }
#hud.touch .with-stash .ui-inv, #hud.touch .with-stash .ui-stash { left: round( 50%, var( --dpx, 1px ) ); right: auto; translate: round( -50%, var( --dpx, 1px ) ) 0; top: calc( 4px + var( --tab-h, 52px ) ); max-height: calc( 100% - 8px - var( --tab-h, 52px ) ); }
#hud.touch .ui-screens[data-tab="pack"] .ui-stash, #hud.touch .ui-screens[data-tab="stash"] .ui-inv { display: none; }
/* A phone too narrow for the centred pack and the grate both: the pack moves to the left edge, and the strip right
   of it holds the grate, never over a cell ( screens.js placeTrash sets .aside ). The stash and the tabs share that
   left edge, on both tabs, so the tabs and the edge stay put between them ( the stash is the narrower panel: a shared
   middle would move both its edges ). */
#hud.touch .ui-screens.aside :is( .ui-inv, .ui-stash, .ui-tabs ) { left: 4px; translate: none; }
#hud.touch .ui-map { --px: calc( var( --spx ) * 1.5 ); }
#hud.touch .ui-map-view { max-width: 100%; max-height: calc( 100vh - 120px ); overflow: hidden; touch-action: none; }
/* The map view takes what the title, the zone tabs and the legend leave ( it pans by drag ), so the
   zone tabs never squeeze it to a sliver; short phones set the map's text a little smaller. */
#hud.touch .ui-map { overflow: hidden; max-width: calc( 100% - 2 * 60px ); } /* clear of the close X ( 48 px, 4 px in ) on both sides: it stays centred */
#hud.touch .ui-map > * { flex-shrink: 0; }
#hud.touch .ui-map > .ui-map-view { flex: 1 1 auto; min-height: 96px; max-height: none; }
@media ( max-height: 520px ) {
  #hud.touch .ui-map { --px: calc( var( --spx ) * 1.15 ); gap: calc( 2 * var( --px ) ); }
}
.ui-item.selected { outline: calc( 1 * var( --px ) ) solid var( --flame2 ); outline-offset: calc( -1 * var( --px ) ); }

/* The close X: large, in the frame's top-right corner, inside the insets. */
.ui-close { position: absolute; right: 4px; top: 4px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; pointer-events: auto; touch-action: none; z-index: 6;
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; box-sizing: border-box; --px: var( --tpx, 2px ); }
.ui-close[hidden] { display: none; }
.ui-close .spr { width: 30px !important; height: 30px !important; }

/* Pack / Stash tabs, top-centre, only when the stash is open. */
.ui-tabs { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: 4px; translate: round( -50%, var( --dpx, 1px ) ) 0; display: flex; gap: 6px; pointer-events: auto; z-index: 6; --px: var( --tpx, 2px ); }
.ui-tabs[hidden] { display: none; }
.ui-tab { min-width: 96px; min-height: 44px; display: flex; align-items: center; justify-content: center; touch-action: none;
  border-width: calc( 5 * var( --px ) ); border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; opacity: 0.7; }
.ui-tab.on { border-image-source: var( --ui-button-hot ); opacity: 1; }

/* The sheet: the tapped item's or node's cards with explicit actions, fixed at the frame's side. */
.ui-sheet { position: absolute; right: 4px; top: 56px; bottom: 4px; max-width: 46%; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; z-index: 6;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; --px: var( --tpx, 2px ); padding: 4px; background: rgba( 5, 4, 15, 0.86 ); }
.ui-sheet[hidden] { display: none; }
.ui-sheet-cards { display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); }
.ui-sheet-acts { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.ui-sheet .ui-act { min-height: 44px; min-width: 88px; }
/* Hellcharge's card ( M2b ): held to the sheet's height, the rank table on top, the text scrolling under it. */
.ui-sheet:has( .ui-tipcard.hc ) { overflow: hidden; }
.ui-sheet:has( .ui-tipcard.hc ) .ui-sheet-cards { flex: 1 1 auto; min-height: 0; }
.ui-tipcard.hc { min-height: 0; flex: 0 1 auto; }
.ui-tipcard.hc .ui-hc-table { flex: none; }
.ui-tip-scroll { min-height: 0; flex: 0 1 auto; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; display: flex; flex-direction: column; align-items: center; gap: calc( 1 * var( --px ) ); }

/* Front door and pause menu: thumb-sized buttons; the panel still scrolls if a page outgrows the screen. */
body[data-input="touch"] .menu-btn, body[data-input="touch"] .menu-ctl, body[data-input="touch"] .front-btn { min-height: 44px; }
body[data-input="touch"] .menu-ctl { min-width: 44px; }
body[data-input="touch"] :is( .menu-group, .menu-touch ) { display: flex; flex-direction: column; gap: 4px; min-width: 0; } /* never two row targets closer than 4 px */
body[data-input="touch"] .menu-panel { max-height: calc( 100vh - var( --safe-top, 0px ) - var( --safe-bottom, 0px ) - 8px ); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
/* The crest and the seal stand above the frame, so those frames never clip: the pause and title menu pages scroll inside
   theirs instead, with Back pinned at the bottom and a stepped fade above it while rows remain below ( menu.js .more ). */
body[data-input="touch"] :is( #pause .menu-panel, .front-pages .menu-panel, .front-card-panel ) { overflow: visible; }
body[data-input="touch"] :is( #pause, .front-pages ) .menu-page:not( .menu-main ) { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; }
body[data-input="touch"] :is( #pause, .front-pages ) .menu-page:not( .menu-main ) > :is( .menu-cols, .menu-controls ) { padding-bottom: 8px; }
body[data-input="touch"] :is( #pause, .front-pages ) .menu-page:not( .menu-main ) > .menu-footer { position: sticky; bottom: 0; z-index: 2; margin-top: 0; padding-top: max( 4px, calc( 2 * var( --px ) ) ); background: var( --umbra ); }
/* while more rows lie below ( .more, menu.js ): a 3-step fade into the panel fill above Back */
body[data-input="touch"] :is( #pause, .front-pages ) .menu-page:not( .menu-main ) > .menu-footer::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: max( 18px, calc( 6 * var( --px ) ) ); pointer-events: none; visibility: hidden;
  background: linear-gradient( to top, var( --umbra ) 0 34%, rgb( 43 37 64 / 0.66 ) 34% 67%, rgb( 43 37 64 / 0.33 ) 67% 100% ); }
body[data-input="touch"] :is( #pause, .front-pages ) .menu-page.more:not( .menu-main ) > .menu-footer::before { visibility: visible; }
body[data-input="touch"] :is( #pause, .front-pages ) .menu-panel { max-height: calc( 100vh - var( --safe-top, 0px ) - var( --safe-bottom, 0px ) - 8px - 38 * var( --px ) ); margin-top: calc( 38 * var( --px ) ); } /* room above for the crest ( 38 art px over the frame ), held by the margin so centring keeps it on screen */
body[data-input="touch"] .menu-hint { display: none; }
/* A short desktop window ( at most 500 px tall, a mouse ): the same as touch, the frame unclipped with room
   for the crest and the page scrolling inside it, Back pinned with the fade above it ( menu.js .more ). */
@media ( max-height: 500px ) {
  body:not( [data-input="touch"] ) :is( #pause, .front-pages ) .menu-panel { overflow: visible; max-height: calc( 100vh - 8px - 38 * var( --px ) ); margin-top: calc( 38 * var( --px ) ); max-width: calc( 100vw - 16px ); } /* the width the two Settings columns need */
  /* the screens' panels ( inventory, stash, compare, map ... ) scroll inside the frame, their foot pinned */
  #hud:not( .touch ) .ui-panel { max-height: calc( 100% - 8px ); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  #hud:not( .touch ) :is( .ui-inv, .ui-map ) { top: 4px; }
  #hud .ui-panel > :is( .ui-inv-foot, .ui-hint:last-child ) { position: sticky; bottom: 0; z-index: 1; background: var( --umbra ); }
  body:not( [data-input="touch"] ) :is( #pause, .front-pages ) .menu-page:not( .menu-main ) { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
  body:not( [data-input="touch"] ) :is( #pause, .front-pages ) .menu-page:not( .menu-main ) > .menu-footer { position: sticky; bottom: 0; z-index: 2; margin-top: 0; padding-top: max( 4px, calc( 2 * var( --px ) ) ); background: var( --umbra ); }
  body:not( [data-input="touch"] ) :is( #pause, .front-pages ) .menu-page:not( .menu-main ) > .menu-footer::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: max( 18px, calc( 6 * var( --px ) ) ); pointer-events: none; visibility: hidden;
    background: linear-gradient( to top, var( --umbra ) 0 34%, rgb( 43 37 64 / 0.66 ) 34% 67%, rgb( 43 37 64 / 0.33 ) 67% 100% ); }
  body:not( [data-input="touch"] ) :is( #pause, .front-pages ) .menu-page.more:not( .menu-main ) > .menu-footer::before { visibility: visible; }
}
/* Settings on touch: two balanced columns ( grid-template-columns: repeat( 2, minmax( 0, 1fr ) ) on landscape >= 700px,
   1fr on narrow/portrait ) so .menu-footer ( Back ) stays below the grid and never lands mid-column over text. */
@media ( pointer: coarse ) {
  .menu-panel:has( > [data-page="settings"]:not( [hidden] ) ) { width: min( calc( 100vw - 8px ), 960px ); max-width: calc( 100vw - 8px ); min-width: 0; padding-inline: calc( 2 * var( --px ) ); }
  :is( #pause, .front-pages ):has( .menu-page[data-page="settings"]:not( [hidden] ) ) { padding: 0 4px; }
  .menu-page[data-page="settings"] .menu-cols { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 0 8px; align-items: start; }
  .menu-page[data-page="settings"] :is( .menu-group, .menu-touch ) { min-width: 0; }
  .menu-page[data-page="settings"] .menu-row { margin-bottom: 0; margin-left: 0; padding: 0; gap: 2px; min-width: 0; }
  .menu-page[data-page="settings"] .menu-row > label.menu-ctl { flex: 1; min-width: 0; justify-content: flex-end; }
  .menu-page[data-page="settings"] .menu-choice { gap: 1px; }
  .menu-page[data-page="settings"] .menu-choice::before, .menu-page[data-page="settings"] .menu-choice::after { margin-right: 0; }
  .menu-page[data-page="settings"] .menu-range { flex: 1; width: auto; min-width: 24px; }
  .menu-page[data-page="settings"] .menu-note { margin-left: 0; }
}
@media ( pointer: coarse ) and ( max-width: 699px ) {
  :is( #pause, .front-pages ) { padding: 0 6px; }
  :is( #pause, .front-pages ) .menu-panel { width: calc( 100vw - 12px ); max-width: calc( 100vw - 12px ); min-width: 0; padding-inline: calc( 2 * var( --px ) ); border-width: calc( 10 * var( --px ) ); border-image-width: calc( 10 * var( --px ) ); }
  .menu-page[data-page="settings"] .menu-cols { grid-template-columns: minmax( 0, 1fr ); }
  :is( #pause, .front-pages ) .menu-controls { grid-template-columns: minmax( 0, 1fr ); gap: 2px; margin: 0; }
  :is( #pause, .front-pages ) .menu-controls dt { justify-self: start; margin-top: 4px; }
}
@media ( pointer: coarse ) and ( max-height: 500px ) {
  :is( #pause, .front-pages ) .menu-panel:has( > .menu-page:not( .menu-main ):not( [hidden] ) ) { margin-top: 0; gap: 2px; padding-top: 0; padding-inline: calc( 2 * var( --px ) ); border-width: calc( 10 * var( --px ) ); border-image-width: calc( 10 * var( --px ) ); max-height: calc( 100vh - var( --safe-top, 0px ) - var( --safe-bottom, 0px ) - 8px ); overflow: visible; }
  :is( #pause, .front-pages ) .menu-panel:has( > .menu-page:not( .menu-main ):not( [hidden] ) ) > :is( .menu-crest, .menu-divider ) { display: none; }
  :is( #pause, .front-pages ) .menu-panel:has( > [data-page="settings"]:not( [hidden] ) ) > .menu-title { display: none; }
  body[data-input="touch"] .menu-page[data-page="settings"] :is( .menu-group, .menu-touch ) { gap: 2px; }
  .menu-page[data-page="settings"] .menu-group h2 { margin: 0 0 1px; line-height: 1; }
  .menu-page[data-page="settings"] .menu-row { min-height: 32px; margin-left: 0; }
  body[data-input="touch"] .menu-page[data-page="settings"] .menu-ctl { min-height: 32px; }
}
body:not( [data-input="touch"] ) .menu-touch { display: none; }
/* Controls page: the rows for the input mode in use ( src/ui/menu.js CONTROLS ) */
body:not( [data-input="touch"] ) .menu-controls-touch, body[data-input="touch"] .menu-controls-kbm { display: none; }
#hud.touch .ui-trash { touch-action: none; } /* the grate itself is the catch: 88 art px ( screens.css ) */
#hud.touch .ui-confirm .ui-act { min-height: 44px; min-width: 88px; }
/* First steps: on touch the card would cover Pepecat at the centre; it sits at the top, between the
   orb and the minimap's block ( the chips beside the minimap, above the Fire cluster ). On a short
   phone that block starts a third of the way down: the card drops its title row to stay above it. */
/* under the top band ( the icon row runs along the top edge, touch.js ), and the saved seal below the minimap */
#hud.touch > .ui-hints { top: calc( var( --touch-map-top, 4px ) + var( --touch-chip-hit, 44px ) + 6px ); bottom: auto; }
/* at Wren's stall the top centre is the stall's and its Trade plaque's ( the hero stands below it ): the card steps aside
   until the hero walks on, as it does for a quiet loot burst */
#hud.touch:has( .ui-trade-prompt:not( [hidden] ) ) > .ui-hints { visibility: hidden; }
/* the level-up toast on touch: one slim row at the bottom centre, above the magazine, placed by screens.js placeLevel ( never over the hero, the boss bar or the first-steps panel ) */
#hud.touch .ui-levelup.band { position: fixed; right: auto; width: max-content; flex-direction: row; align-items: center; gap: 8px; }
#hud.touch .ui-levelup.band.stack { flex-direction: column; gap: 2px; }
#hud.touch .ui-save { position: fixed; top: calc( var( --touch-map-top, 4px ) + var( --touch-map-height, 80px ) + 6px ); right: calc( var( --safe-right, 0px ) + 6px ); }
/* Talents on a short screen, touch or mouse ( screens.js compactTalents: at most 500 px tall ): the packed tree;
   on touch the art px sized to the height ( below; screens.js fitTalents then fits it to the safe area left of the
   rail ), its labels smaller; no title, divider, branch blurb, capstone line or right-mouse row. */
#hud .ui-talents.compact { top: 4px; gap: calc( 2 * var( --px ) ); } /* --px: below, with the head */
#hud .ui-talents.compact > .ui-title, #hud .ui-talents.compact > .ui-rule, #hud .ui-talents.compact .ui-identity,
#hud .ui-talents.compact .ui-branch-cap, #hud .ui-talents.compact .ui-foot-row { display: none; }
#hud .ui-talents.compact .ui-tree { height: calc( 164 * var( --px ) ); margin-top: 0; } /* the deep tier's row included ( screens.js DEEP_AT_COMPACT ) */
#hud .ui-talents.compact.reckoning .ui-tree { height: calc( 150 * var( --px ) ); } /* three rows and the dropped keystone ( screens.js RECKON_AT_COMPACT ) */
#hud .ui-talents.compact .ui-branch { padding: calc( 2 * var( --px ) ) 0; }
/* No foot: the level, the points, the page tabs and Respec stand in a column left of the trees ( screens.js renderTalents ),
   every button a full thumb target; the Reckoning's gates in a line above the pack band ( RECKON_GATES ). */
#hud .ui-talents.compact .ui-talent-body { display: flex; align-items: flex-start; gap: calc( 6 * var( --px ) ); }
#hud .ui-talents.compact .ui-talent-side { width: calc( 104 * var( --px ) ); display: flex; flex-direction: column; align-items: stretch; gap: calc( 3 * var( --px ) ); }
#hud .ui-talents.compact .ui-talent-main { display: flex; flex-direction: column; align-items: center; gap: calc( 2 * var( --px ) ); }
#hud .ui-talents.compact .ui-talent-head { flex-direction: column; align-items: flex-start; gap: calc( 2 * var( --px ) ); padding: 0 0 calc( 2 * var( --px ) ); }
#hud .ui-talents.compact .ui-talent-pages { flex-direction: column; align-items: stretch; }
#hud .ui-talents.compact .ui-talent-page, #hud .ui-talents.compact .ui-respec { min-height: 44px; }
#hud .ui-talents.compact .ui-reckon-gates { line-height: 0; }
/* the bands under the trees take the trees' width, never set it; the pack's pips stay ( they say the rows bought ) */
#hud .ui-talents.compact .ui-talent-main > :not( .ui-branches ) { width: 0; min-width: 100%; box-sizing: border-box; }
/* the side column widens the panel: on touch it stands centred in the screens' box ( the safe area ) left of the rail
   ( .ui-rail: 4 px in, 48 px wide: RAIL_CLEAR ), not under it; screens.js fitTalents sizes it to that room */
#hud.touch .ui-talents.compact { left: 4px; right: 58px; margin-inline: auto; width: fit-content; translate: none; }
#hud.touch .ui-talents :is( .ui-respec, .ui-pack-up ) { min-height: 44px; } /* packed or the full trees ( a tablet ); the health band shares the class */
/* At the cap both bands stand under the packed trees ( the pack's fully bought, the health's to buy ): the pack's, a
   label with nothing to tap, drops to its own face, and the main column's gap alone parts them, so the panel fits 844x390
   whole with the art px at its floor ( 2026-11-06: 16 px over before ). The health band keeps its 44 px target. */
#hud.touch .ui-talents .ui-pack-up.maxed { min-height: 0; }
#hud.touch .ui-talents.compact .ui-pack-up { margin: 0; }
#hud.touch .ui-talent-page { min-height: 44px; }
/* Hellcharge's aim armed to cancel: the finger is back on Ability ( src/ui/touch.js aimCancelArmed ) */
.touch-btn.cancel .touch-icon { filter: grayscale( 1 ) brightness( 0.45 ); }
/* On a phone the art px is sized so the packed page fits the height ( 286 art px tall with the frame: a first guess,
   screens.js fitTalents measures ), never under 44 / 36 CSS px: the closest node centres, 36 art px apart, stay 44 CSS
   px apart, so every node's 44 px hit square ( below ) is its own. A mouse keeps the whole art px. */
#hud.touch .ui-talents.compact { --px: max( calc( 44px / 36 ), min( var( --spx ), calc( ( 100vh - 8px ) / 286 ) ) ); }
#hud.touch .ui-talents .ui-node::after { content: ''; position: absolute; left: 50%; top: 50%; width: max( 100%, 44px ); height: max( 100%, 44px ); translate: -50% -50%; }
#hud.touch .ui-talents .ui-tree { pointer-events: none; } /* the next tree's box overhangs this one's right column: the squares, not the boxes, take the taps */
/* Its labels ( the user: "shrink the text size of talent labels on phones" ): one CSS px per font px, in whole device
   px ( --lpx: 1 CSS px at DPR 2 and 3, 8 / 7 at 2.625 ), so the 5 × 7 caps stand 7 CSS px tall and the bitmap font stays
   crisp at its integer scale; the frames, nodes and gaps keep the art px. The side column takes its labels' width. */
#hud.touch .ui-talents.compact { --lpx: round( 1px, var( --dpx, 1px ) ); }
#hud.touch .ui-talents.compact .txt { --px: var( --lpx ); }
#hud.touch .ui-talents.compact .ui-talent-side { width: max-content; flex: none; }
/* Packed: the columns 14 art px narrower each ( the tree overhangs its empty margins ) so the side column and the right tree clear Menu. */
#hud .ui-talents.compact .ui-branches { gap: calc( 6 * var( --px ) ); }
#hud .ui-talents.compact .ui-branch { width: calc( 118 * var( --px ) ); }
#hud .ui-talents.compact .ui-tree { margin: 0 calc( -7 * var( --px ) ); }
#hud.touch .ui-ascend { top: 40%; } /* below the first-steps hints ( front.js ) */
/* The rail under the close X, on every screen ( screens.js layer.rail ): Pack, Talents and Map, then Menu ( the pause
   route ) set 6 px further apart. The HUD's chips at the controls' art size, each a full thumb target, the screen on
   show lit in the hot frame. A 48 px column 4 px in: every panel keeps RAIL_CLEAR ( 58 px ) off the right edge. */
.ui-rail { position: absolute; right: 4px; top: 58px; width: 48px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 6;
  pointer-events: none; --px: var( --touch-cpx, 2px ); --chip: var( --touch-chip-hit, 44px ); filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); }
.ui-rail[hidden] { display: none; }
.ui-rail > .ui-chip.here > .hot { visibility: visible; }
.ui-rail > .ui-chip.here { cursor: default; }
.ui-rail > .ui-rail-menu { margin-top: 6px; }
/* The HUD's top-right on touch: the minimap and one satchel ( iconrow.js ). Talents and Map are a tap away on the rail;
   while points wait the tome stands left of the satchel ( the row is right-anchored to the map: it grows leftward ), with
   its points diamond and glow, and goes once they are spent. */
#hud.touch > .ui-iconrow > .ui-chip:not( [data-chip="inventory"], [data-chip="talents"].has-points ) { display: none; }
/* The magazine on touch is its count: the pips said the same thing again. Low, dry and reloading stay in the count's
   colours ( hud.js ammoStyle ); a reload draws one slim bar under it, filling in 12 steps ( hud.js --reload ). */
.hud-reload-bar { display: none; }
#hud.touch .hud-tray { display: none; }
#hud.touch .hud-mag-count { position: relative; min-width: 28px; justify-content: center; padding-right: 0; }
#hud.touch .hud-right.reloading .hud-reload-bar { display: block; position: absolute; left: calc( 1 * var( --px ) ); right: calc( 1 * var( --px ) ); top: calc( 100% + 2 * var( --px ) );
  height: calc( 3 * var( --px ) ); background: var( --iron0 ); box-shadow: 0 0 0 var( --px ) var( --void ); }
#hud.touch .hud-right.reloading .hud-reload-bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc( var( --reload, 0 ) * 100% ); background: var( --bone2 ); }
/* Packed talents on a touch screen with height to spare ( a tablet, screens.js packWide ): centred in the room left of the
   rail, with their title back. */
@media ( min-height: 501px ) {
  #hud.touch .ui-talents.compact { left: 4px; right: 58px; top: 4px; bottom: 4px; margin: auto; width: fit-content; height: fit-content; translate: none; }
  #hud.touch .ui-talents.compact > .ui-title, #hud.touch .ui-talents.compact > .ui-rule { display: block; }
}
@media ( max-height: 400px ) { #hud.touch > .ui-hints > .ui-hints-title { display: none; } }
/* The merchant's shop on touch ( screens.js fitShop ): centred in the room left of the rail, at the whole device px that
   fits it there; Buy a thumb's height ( a card's text column has the room under its socket ). A short screen gives the
   subtitle's line to the lots, and the stock line and the gold go up either side of the name ( the title's row ): at
   2.625 dpr the floor's 3 device px left the foot 13 px past the box. */
#hud.touch .ui-shop { left: 4px; right: 58px; top: 4px; margin-inline: auto; width: fit-content; translate: none; }
/* every screen's sheet stands left of the rail ( RAIL_CLEAR ): at the frame's edge the rail's chips covered its Close */
.ui-screens:has( > .ui-rail:not( [hidden] ) ) > .ui-sheet { right: 58px; }
#hud.touch .ui-lot-buy { min-height: max( 44px, calc( 31 * var( --px ) ) ); }
#hud.touch .ui-lot { touch-action: pan-y; }
/* The costume panel on touch ( screens.js renderCostume, fitPanel ): centred in the room left of the rail, as the shop, at the whole device px that fits it, docked at the top or at
   the foot, wherever he is not ( .low ); every button a thumb's height ( the icon too: its pocket of the doll holds it at the doll's art size ). */
#hud.touch .ui-costume { left: 4px; right: 58px; top: 4px; margin-inline: auto; width: calc( 387 * var( --px ) ); translate: none; gap: calc( 3 * var( --px ) ); /* 369 of rows and the small frame */
  border-width: calc( 7 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; padding: 0 calc( 2 * var( --px ) ) var( --px ); } /* the small frame, as the pack's: the big one's 20 art px a side cost a short phone a row */
#hud.touch .ui-costume.low { top: auto; bottom: 4px; }
#hud.touch .ui-costume > .ui-rule, #hud.touch .ui-costume:not( .picking ) > .ui-title { display: none; }
#hud.touch .ui-cos-btn { min-height: 44px; min-width: 44px; }
/* the icon: a round badge with no frame ( a framed square in the doll's pocket was taken for a slot ), 44 px to the touch, 8 px above the boots' socket ( DOLL: boots at 114 art px down ) */
#hud.touch .ui-cos-open { right: auto; left: calc( 140 * var( --px ) ); top: calc( 114 * var( --px ) - 52px ); border: 0; border-image: none; padding: 0; background: none; }
#hud.touch .ui-costume:not( [hidden] ) ~ .ui-save { visibility: hidden; } /* the autosave's seal stands cut by the rail beside this narrower panel ( the pack's covers it ): a write is told by its sound and its row, so the seal keeps out of sight while the panel is up */
@media ( max-height: 520px ) {
  #hud.touch .ui-shop { gap: calc( 2 * var( --px ) ); }
  #hud.touch .ui-shop > :is( .ui-shop-sub, .ui-rule ) { display: none; }
  #hud.touch .ui-shop > .ui-shop-head { position: absolute; top: calc( 5 * var( --px ) ); left: calc( 6 * var( --px ) ); right: calc( 6 * var( --px ) ); }
  #hud.touch .ui-lot-text { gap: calc( 2 * var( --px ) ); } /* a long affixed name's lines and the 44 px Buy within the socket's height */
}

/* The pack on a phone ( the user, 2026-11-11: the whole inventory on one screen; screens.js renderInventory sets .side, fitPack the
   two art sizes ): the doll with the hero's numbers and the gold under it on the left, the whole pack on the right, in the small
   kit frame ( the close X's: the big frame's 20 art px a side would cost two rows of the pack ). No title, no rule, no hint: the
   rail's satchel is lit, and the room is the pack's. --lpx: the left column's art px; --bpx: the pack's ( whole device px ).
   The frame and the foot padding, 7 + 7 + 1 art px of height: screens.js PACK_FRAME ( change the two together ). */
#hud.touch .ui-inv.side { left: 4px; right: auto; translate: none; max-height: none; overflow: visible; display: grid; grid-template: "top grid" auto "note grid" 1fr "foot grid" auto / auto auto;
  column-gap: calc( 4 * var( --px ) ); row-gap: calc( 2 * var( --px ) ); align-items: start; justify-items: center;
  border: calc( 7 * var( --px ) ) solid transparent; border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; padding: 0 calc( 2 * var( --px ) ) var( --px ); }
#hud.touch .with-stash .ui-inv.side { top: calc( 4px + var( --tab-h, 52px ) ); }
/* ( fitPack .tight: every row shows with 2 px margins where 4 would cut the last by a hair ) */
#hud.touch .ui-inv.side.tight { top: 2px; }
#hud.touch .with-stash .ui-inv.side.tight { top: calc( 2px + var( --tab-h, 52px ) ); }
/* ( fitPack .cramped: a short phone under the stash's tabs, where not even the smallest doll's column fits: the panel scrolls, as it always has ) */
#hud.touch .ui-inv.side.cramped { max-height: calc( 100% - 8px ); overflow-y: auto; }
#hud.touch .with-stash .ui-inv.side.cramped { max-height: calc( 100% - 8px - var( --tab-h, 52px ) ); }
#hud.touch .ui-inv.side > :is( .ui-title, .ui-rule ), #hud.touch .ui-inv.side :is( .ui-scroll-cue, .ui-hint ) { display: none; }
#hud.touch .ui-inv.side > .ui-inv-top { grid-area: top; --px: var( --lpx, var( --spx ) ); }
/* .beside ( fitPack: the width has room ): the hero's numbers beside the doll, as the pack has always had them. Else under the doll, its
   width: Health and DPS a row each ( the long ones ), the other four two a row */
#hud.touch .ui-inv.side:not( .beside ) > .ui-inv-top { flex-direction: column; gap: calc( 3 * var( --px ) ); }
#hud.touch .ui-inv.side:not( .beside ) .ui-hero { width: calc( 192 * var( --px ) ); padding-top: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: calc( 6 * var( --px ) ); row-gap: 0; }
#hud.touch .ui-inv.side:not( .beside ) .ui-hero > :is( :nth-child( -n + 4 ), :nth-child( 6 ) ) { grid-column: 1 / -1; } /* Level, the bar, its XP, Health; DPS */
#hud.touch .ui-inv.side:not( .beside ) .ui-hero > :is( :nth-child( 5 ), :nth-child( n + 7 ) ) { order: 1; } /* Armor, Critical, Move speed, Reduction after them */
#hud.touch .ui-inv.side:not( .beside ) .ui-hero > .ui-xp { margin: var( --px ) 0; }
#hud.touch .ui-inv.side > .ui-grid-inventory { grid-area: grid; --px: var( --bpx, var( --spx ) ); box-sizing: border-box; }
/* a phone too short for every row at the smallest cell ( fitPack ): the pack alone scrolls, the doll stays; a finger on the pack
   pans it ( an item is still moved by its card's Move, or dragged sideways off its row ) */
#hud.touch .ui-inv.side > .ui-grid-inventory.scrolls { max-height: var( --bag-h ); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b8401c rgba( 21, 15, 38, 0.6 ); }
#hud.touch .ui-inv.side > .ui-grid-inventory.scrolls :is( .ui-grid-field, .ui-item ) { touch-action: pan-y; }
/* over the gold, on its edge, at the column's own art px: a line each, the smallest doll's width holds ( screens.js: its phone wording ), so
   the column is never wider than the doll ( fitPack measures the height the lines take: a 360 px phone has none to spare ) */
#hud.touch .ui-inv.side > .ui-pack-notes { grid-area: note; --px: var( --lpx, var( --spx ) ); align-self: end; justify-self: start; align-items: flex-start; }
#hud.touch .ui-inv.side > .ui-pack-notes > .ui-pack-note { justify-content: flex-start; padding: 0 calc( 2 * var( --px ) ); }
#hud.touch .ui-inv.side > .ui-inv-foot { grid-area: foot; position: static; align-self: end; justify-self: stretch; background: none; }
/* The Locker on a phone ( screens.js fitStash ): the pack's small frame around the grid alone, at the pack's own rule for its art px ( --bpx,
   whole device px ), on the left edge the pack's tab keeps. No title and no rule: the tab says what it is. The hint stands under the grid
   only where the height has room for it ( .noted ). A phone where the frame is all that keeps the eight rows from showing ( 667 x 375 ): no
   frame ( .bare ), the grid's own border is the panel. Too short for all eight rows at the smallest cell: the grid alone scrolls, "More" on its edge. */
#hud.touch .ui-stash.side { left: 4px; right: auto; translate: none; max-height: none; overflow: visible; gap: calc( 2 * var( --px ) );
  border: calc( 7 * var( --px ) ) solid transparent; border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; padding: 0 calc( 2 * var( --px ) ) var( --px ); }
#hud.touch .ui-stash.side > :is( .ui-title, .ui-rule ), #hud.touch .ui-stash.side:not( .noted ) > .ui-hint { display: none; }
#hud.touch .ui-stash.side.bare { border: 0; border-image: none; padding: 0; }
#hud.touch .ui-stash.side > .ui-grid-stash { --px: var( --bpx, var( --spx ) ); box-sizing: border-box; }
#hud.touch .ui-stash.side > .ui-grid-stash.scrolls { max-height: var( --bag-h ); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b8401c rgba( 21, 15, 38, 0.6 ); }
#hud.touch .ui-stash.side > .ui-grid-stash.scrolls :is( .ui-grid-field, .ui-item ) { touch-action: pan-y; }
/* its "More" ( screens.js bagCue ), as the pack's below: on the grid's lower edge while rows lie under it, on the upper once scrolled */
#hud.touch .ui-stash.side > .ui-bag-cue { left: 50%; translate: -50% 0; --px: var( --tpx, 2px ); }
#hud.touch .ui-stash.side > .ui-bag-cue.down { bottom: calc( 3 * var( --px ) ); }
#hud.touch .ui-stash.side > .ui-bag-cue.up { top: calc( 3 * var( --px ) ); }
#hud.touch .ui-stash.side.bag-down > .ui-bag-cue.down, #hud.touch .ui-stash.side.bag-up > .ui-bag-cue.up { display: flex; }
#hud.touch .ui-grid-field { --mk: var( --tpx, 2px ); } /* the better / worse chip ( screens.css .ui-grid-field::after ) at the tooltips' size: legible 5 x 7 glyphs on a phone's cell */
/* an item in hand: the grate stands under the doll, 24 px clear of its sockets and of the pack's cells ( screens.js placeTrash,
   grateSpot ): over the hero's numbers where they are under the doll, and over the gold where it has to reach the panel's foot
   ( .grate-low ); what it covers is hidden for the while */
/* ( and under the sheet on their side, whose edge would cut through them; beside a sheet at the rail they stay: the grate waits for Move ) */
#hud.touch .ui-screens.carry:not( :has( > .ui-sheet.side.right:not( [hidden] ) ) ) .ui-inv.side:not( .beside ) .ui-hero,
#hud.touch .ui-screens.carry:not( :has( > .ui-sheet.side.right:not( [hidden] ) ) ) .ui-inv.side.grate-low > :is( .ui-pack-notes, .ui-inv-foot ) { visibility: hidden; }

/* A tapped item's sheet in that layout ( screens.js sideSheet ): over the half the item is not in, the frame's height; its acts
   two rows of three ( Equip, Move, Close; Drop, Trash ), the card in hand scrolling between them and the worn item's small card,
   which keeps the sheet's foot. */
#hud.touch .ui-sheet.side { left: 4px; right: auto; top: 4px; max-width: none; width: fit-content; overflow: hidden; }
#hud.touch .ui-sheet.side.right { left: auto; right: 58px; }
#hud.touch .with-stash .ui-sheet.side { top: calc( 4px + var( --tab-h, 52px ) ); }
#hud.touch .ui-sheet.side .ui-sheet-acts { position: static; display: grid; grid-template-columns: repeat( 3, auto ); }
/* .narrow ( sideSheet: a 667 or 740 px phone, where the three-across sheet at either edge would lie over a mid-pack item ): the
   sheet as wide as its card and no wider, flush to it; its acts wrap in that width, each row filling it ( Equip, Move, Close;
   Drop, Trash ), their side padding the frame's alone. Every act still 44 px tall and 80 px or more wide. */
#hud.touch .ui-sheet.side.narrow { width: min-content; padding-inline: 0; border-inline-width: 0; }
#hud.touch .ui-sheet.side.narrow .ui-sheet-acts { display: flex; flex-wrap: wrap; }
#hud.touch .ui-sheet.side.narrow .ui-act { flex: 1 1 auto; min-width: 0; padding-inline: calc( 2 * var( --px ) ); }
#hud.touch .ui-sheet.side .ui-sheet-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; align-items: center; }
#hud.touch .ui-sheet.side .ui-sheet-cards > .ui-tipcard { flex: none; }
/* a wide phone's sheet is its three acts' width: the cards take it, and every change has room beside another ( screens.js pairRows ) */
#hud.touch .ui-sheet.side:not( .narrow ) .ui-sheet-cards > .ui-tipcard { align-self: stretch; width: auto; max-width: none; }
#hud.touch .ui-sheet.side .ui-sheet-cards > .ui-tipcard.worn { position: sticky; bottom: 0; z-index: 1; margin-top: auto; }
/* more of the card in hand below ( screens.js sheetCue ): "More" and its chevron ( screens.css .ui-more ) on the edge the card runs
   under, at its right end, where the changes' rows ( left-set ) leave room; over a worn card it hangs on that card's frame, clear of
   its corner, so it takes the least from the line above */
#hud.touch .ui-sheet.side.more > .ui-sheet-cue { display: flex; right: calc( 12 * var( --px ) ); margin-bottom: calc( 2 * var( --px ) ); }
#hud.touch .ui-sheet.side.more:has( .ui-tipcard.worn ) > .ui-sheet-cue { margin-bottom: calc( -5 * var( --px ) ); }
/* and of a scrolling pack ( screens.js bagCue ): on its lower edge while rows lie under it, on its upper edge once scrolled */
#hud.touch .ui-inv.side > .ui-bag-cue { grid-area: grid; left: 50%; translate: -50% 0; --px: var( --tpx, 2px ); }
#hud.touch .ui-inv.side > .ui-bag-cue.down { bottom: calc( 3 * var( --px ) ); }
#hud.touch .ui-inv.side > .ui-bag-cue.up { top: calc( 3 * var( --px ) ); }
#hud.touch .ui-inv.side.bag-down > .ui-bag-cue.down, #hud.touch .ui-inv.side.bag-up > .ui-bag-cue.up { display: flex; }

/* Automap ( src/ui/automap.js ): the corner minimap, the full-screen overlay and the touch chip.
   Art px are --px, like the HUD; the canvases are drawn in art px and shown pixelated. */

:root { --automap-css: 1; }

/* Overlay: over the world, under every HUD cluster ( inserted right after the vignette ). */
#hud > .automap-overlay { position: absolute; inset: 0; pointer-events: none; }
#hud > .automap-overlay[hidden], #hud > .automap-corner[hidden], #hud > .automap-chip[hidden] { display: none; }
.automap-overlay-canvas { display: block; image-rendering: pixelated; }

/* Corner: 160 × 110 art px in the kit's iron panel 9-slice ( 7 px ), top-right. A tap toggles. */
#hud > .automap-corner {
  position: absolute; right: calc( 4 * var( --px ) ); top: calc( 4 * var( --px ) );
  width: calc( 160 * var( --px ) ); height: calc( 110 * var( --px ) ); min-width: 44px; min-height: 44px;
  border-width: calc( 7 * var( --px ) ); border-image: var( --ui-panel ) 7 / calc( 7 * var( --px ) ) stretch;
  background: rgba( 21, 15, 38, 0.86 ); background-clip: padding-box;
  filter: var( --hard-drop ); pointer-events: auto; touch-action: none; cursor: pointer;
}
/* Sunlit ( automap.js SUNLIT: the gilt UI in a sunny zone ): the paper is sand, nearly opaque, so its markers measure */
#hud > .automap-corner.sunlit { background: rgba( 200, 168, 112, 0.94 ); background-clip: padding-box; }
.automap-corner-canvas { display: block; width: calc( 146 * var( --px ) ); height: calc( 96 * var( --px ) ); image-rendering: pixelated; }
/* Short screens with a mouse ( automap.js dock, SMALL ): half size, 80 × 55; its canvas is sized inline. */
#hud > .automap-corner.small { width: calc( 80 * var( --px ) ); height: calc( 55 * var( --px ) ); }
/* Desktop: top-left and 30% larger ( 208 × 143 art px outer, 194 × 129 canvas ); keep SMALL on tiny viewports. */
#hud:not( .touch ) > .automap-corner:not( .docked ) { left: calc( 4 * var( --px ) ); right: auto; width: calc( 208 * var( --px ) ); height: calc( 143 * var( --px ) ); }
#hud:not( .touch ) > .automap-corner:not( .docked ):not( .small ) > .automap-corner-canvas { width: calc( 194 * var( --px ) ); height: calc( 129 * var( --px ) ); }
#hud:not( .touch ) > .automap-corner.small { width: calc( 80 * var( --px ) ); height: calc( 55 * var( --px ) ); }
#hud:not( .touch ) > .automap-chip:not( .docked ) { left: calc( 4 * var( --px ) ); right: auto; }
/* Touch, docked ( automap.js dock ): fixed in the block above the Fire cluster that the touch
   controls publish; its box and canvas size are set inline ( viewport px ). */
#hud > .automap-corner.docked, #hud > .automap-chip.docked { position: fixed; right: auto; }
#hud > .automap-corner.docked { min-width: 0; min-height: 0; }

/* Touch, overlay mode: a map chip where the corner sits, to bring it back. */
#hud > .automap-chip {
  position: absolute; right: calc( 4 * var( --px ) ); top: calc( 4 * var( --px ) );
  width: max( 44px, calc( 23 * var( --px ) ) ); height: max( 44px, calc( 23 * var( --px ) ) );
  display: flex; align-items: center; justify-content: center;
  background: var( --ui-touch-chip ) center / 100% 100% no-repeat; image-rendering: pixelated;
  filter: var( --hard-drop ); pointer-events: auto; touch-action: none; cursor: pointer;
}
.automap-chip-glyph { width: calc( 9 * var( --px ) * 2 ); height: calc( 9 * var( --px ) * 2 ); image-rendering: pixelated; }


:root {
  --void: #05040f; --umbra: #2b2540; --iron0: #262b38; --iron1: #5b657c; --iron2: #bccadf;
  --bone0: #7f7774; --bone1: #a8987c; --bone2: #cfbc96; --bone3: #f0e6c6;
  --flame0: #b8401c; --flame1: #e8801e; --flame2: #ffc845; --core: #fff4c2;
  --blood0: #3a0d16; --blood1: #5e1420; --blood2: #8a1a2b; --red2: #ff7d66;
  --px: 2px;
  --hard-drop: drop-shadow( 0 var( --px ) 0 var( --void ) ); /* every cluster: one hard 1-art-px drop */
}
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
body { font-family: monospace; color: var( --bone2 ); user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }

.px { image-rendering: pixelated; background-repeat: no-repeat; background-size: 100% 100%; }
.txt { display: inline-block; flex: none; image-rendering: pixelated; background-repeat: no-repeat; background-size: 100% 100%; vertical-align: bottom; }
.nine { border-style: solid; border-color: transparent; image-rendering: pixelated; box-sizing: border-box; }

/* ---- HUD ------------------------------------------------------------------------------- */

#hud { position: fixed; pointer-events: none; --u: 1px; overflow: hidden; }
#hud > div { position: absolute; }
/* The damage vignette: hit feedback, so 0.55 and 0.85 everywhere. On the snow ( body[data-arena], main.js onArena ) it is under 40 % of that ( 0.21, 0.33 ): every blow
   sets it full ( hud.hurt ) and a boss fight lands one every beat, so red over a white-blue floor sat on the whole screen as magenta ( the QA's phase-3 still ). A
   zone with a snow floor adds its id to the second selector. */
.hud-vignette { inset: 0; opacity: 0; background: radial-gradient( ellipse at center, transparent 45%, rgba( 120, 10, 20, 0.55 ) 80%, rgba( 70, 0, 10, 0.85 ) 100% ); }
body[data-arena="arctic"] .hud-vignette { background: radial-gradient( ellipse at center, transparent 45%, rgba( 120, 10, 20, 0.21 ) 80%, rgba( 70, 0, 10, 0.33 ) 100% ); }
/* Plinth: a banded void strip that seats the bottom clusters on busy floors. */
.hud-plinth { left: 0; right: 0; bottom: 0; height: calc( 32 * var( --px ) );
  background: linear-gradient( to top, rgba( 5, 4, 15, 0.58 ) 0 calc( 8 * var( --px ) ), rgba( 5, 4, 15, 0.42 ) 0 calc( 16 * var( --px ) ), rgba( 5, 4, 15, 0.26 ) 0 calc( 24 * var( --px ) ), rgba( 5, 4, 15, 0.12 ) 0 ); }

/* Key cap: kit 9-slice ( 2 / 2 / 3 / 2 ) around a small-caps label. Floor: --px >= 2px so 5x7 small caps stay >= 14 CSS px at 720p. */
.hud-key { display: inline-flex; border-width: calc( 2 * var( --px ) ) calc( 2 * var( --px ) ) calc( 3 * var( --px ) ); border-image: var( --ui-keycap ) 2 2 3 fill / calc( 2 * var( --px ) ) calc( 2 * var( --px ) ) calc( 3 * var( --px ) ) stretch; }
.hud-key .txt { --px: max( 2px, var( --hpx, 2px ) ); margin: calc( -1 * var( --px ) ) 0; }
.hud-weapon-name, .hud-weapon > .txt, .hud-hp-max, .hud-mag-size, .hud-slot-time .txt, .hud-slot-count .txt, .hud-power-time .txt, .hud-target-epithet, .hud-toast .txt, .hud-swarm > .txt { --px: round( max( 2px, var( --hpx, 2px ) ), var( --dpx, 1px ) ); }
.hud-hp, .hud-ammo { --px: round( down, max( 2px, calc( 1.5 * var( --hpx, 2px ) ) ), var( --dpx, 1px ) ); }

/* Health orb, bottom-left: socket 97×104 with the 63 px glass at ( 17, 21 ). */
.hud-left { left: calc( 4 * var( --px ) ); bottom: calc( 2 * var( --px ) ); display: flex; align-items: flex-end; }
.hud-orb { position: relative; width: calc( 97 * var( --px ) ); height: calc( 104 * var( --px ) ); filter: var( --hard-drop ); }
.hud-orb-glass { position: absolute; left: calc( 17 * var( --px ) ); top: calc( 21 * var( --px ) ); width: calc( 63 * var( --px ) ); height: calc( 63 * var( --px ) ); background-image: var( --ui-orb-glass ); clip-path: circle( 50% ); }
.hud-orb-liquid { position: absolute; inset: 0; background-image: var( --ui-orb-liquid ); clip-path: inset( calc( var( --drain, 0 ) * var( --px ) ) 0 0 0 ); transition: clip-path 0.22s steps( 6 ); }
.hud-orb-surface { position: absolute; left: 0; width: 100%; height: calc( 2 * var( --px ) ); top: calc( var( --drain, 0 ) * var( --px ) ); background-image: var( --ui-orb-surface ); transition: top 0.22s steps( 6 ); }
.hud-orb-surface[hidden] { display: none; }
.hud-orb-gloss { position: absolute; inset: 0; background-image: var( --ui-orb-gloss ); }
.hud-orb-socket { position: absolute; inset: 0; background-image: var( --ui-orb ); }
/* The orb's and the slots' numbers sit inside drop-shadow filters, where Chrome does not snap a half
   pixel left by flex centring: they are centred on the glass / window by a translate rounded to whole
   device px ( 1/3 px at DPR 3 lands a 1/64 LayoutUnit off ). */
.hud-orb-text { position: absolute; left: round( calc( 48.5 * var( --px ) ), var( --dpx, 1px ) ); top: round( calc( 52.5 * var( --px ) ), var( --dpx, 1px ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); display: flex; flex-direction: column; align-items: center; }
.hud-hp-max[hidden], .hud-mag-size[hidden] { display: none; }
/* The one-shot keyframes below ( orb-hit, liquid-hit, orb-phoenix, glass-phoenix, orb-phoenix-calm, slot-ready, slot-refund, slot-refund-calm, pip-pop, pip-pop-calm ) are played by hud.js restart()
   with the Web Animations API, timings and calm rules there; no class carries them. */
@keyframes orb-hit {
  0% { translate: 0 0; } 15% { translate: calc( 2 * var( --shake, 1 ) * var( --px ) ) calc( -1 * var( --shake, 1 ) * var( --px ) ); }
  30% { translate: calc( -2 * var( --shake, 1 ) * var( --px ) ) 0; } 45% { translate: calc( 1 * var( --shake, 1 ) * var( --px ) ) var( --px ); }
  60% { translate: calc( -1 * var( --shake, 1 ) * var( --px ) ) 0; } 100% { translate: 0 0; }
}
@keyframes liquid-hit { 0%, 40% { filter: brightness( 1.6 ); } 100% { filter: none; } }
/* Heartbeat below 30 %: double-beat glow; gentler and without the bright pulse under reduced flash. */
.hud-orb.low .hud-orb-liquid { animation: heartbeat 1s ease-out infinite; }
.hud-orb.low { animation: heart-glow 1s ease-out infinite; }
@keyframes heartbeat { 0%, 30%, 100% { filter: none; } 10%, 40% { filter: brightness( 1.45 ) saturate( 1.2 ); } }
@keyframes heart-glow { 0%, 30%, 100% { filter: var( --hard-drop ); } 10%, 40% { filter: var( --hard-drop ) drop-shadow( 0 0 calc( 5 * var( --px ) ) rgba( 220, 47, 48, 0.75 ) ); } }
.hud-orb.low.calm .hud-orb-liquid { animation: heartbeat-calm 1.6s ease-in-out infinite; }
.hud-orb.low.calm { animation: none; }
@keyframes heartbeat-calm { 50% { filter: brightness( 1.15 ); } }
/* Phoenix Ash's strike ( hud.js RESTARTS.phoenix, as the bird lands ): the socket flares ember gold and cools to fire, the
   glass warms with it; calm keeps a soft fire halo on the socket, no spike and no glass */
@keyframes orb-phoenix { 0% { filter: drop-shadow( 0 0 calc( 4 * var( --px ) ) rgba( 255, 200, 69, 0.95 ) ); } 40% { filter: drop-shadow( 0 0 calc( 3 * var( --px ) ) rgba( 232, 128, 30, 0.8 ) ); } 100% { filter: drop-shadow( 0 0 0 rgba( 232, 128, 30, 0 ) ); } }
@keyframes glass-phoenix { 0% { filter: brightness( 1.45 ) saturate( 1.2 ) hue-rotate( 14deg ); } 100% { filter: brightness( 1 ) saturate( 1 ) hue-rotate( 0deg ); } }
@keyframes orb-phoenix-calm { 0% { filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 232, 128, 30, 0.7 ) ); } 100% { filter: drop-shadow( 0 0 0 rgba( 232, 128, 30, 0 ) ); } }

/* Portrait: the 48×48 expression strip ( art/ui/portrait/ ) in a 60×60 steel medallion. The strip is as wide as it has cells ( auto ): --face picks one.
   Not tiled ( no-repeat ): one cell is all that is ever shown. */
.hud-portrait, .menu-portrait { position: relative; width: calc( 60 * var( --px ) ); height: calc( 60 * var( --px ) ); background: var( --umbra ); filter: var( --hard-drop ); flex: none; }
.hud-portrait { margin: 0 0 calc( 4 * var( --px ) ) calc( -6 * var( --px ) ); }
.hud-portrait[hidden] { display: none; }
.hud-face { position: absolute; left: calc( 6 * var( --px ) ); top: calc( 6 * var( --px ) ); width: calc( 48 * var( --px ) ); height: calc( 48 * var( --px ) );
  background-image: var( --ui-portrait ); background-repeat: no-repeat; background-size: auto calc( 48 * var( --px ) ); background-position: calc( var( --face, 0 ) * -48 * var( --px ) ) 0; }
.hud-portrait::after, .menu-portrait::after { content: ''; position: absolute; inset: 0; background: var( --ui-portrait-frame ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.menu-portrait, .touch-turn-face, #hud.paused .hud-portrait { pointer-events: auto; cursor: pointer; touch-action: manipulation; }
@keyframes portrait-poke { 0% { translate: 0 0; } 35% { translate: 0 calc( 2 * var( --px ) ); } 70% { translate: 0 calc( -1 * var( --px ) ); } 100% { translate: 0 0; } }

/* Centre column: powerup timers above the dodge / ability / flask slots ( 41×48, window 31 at 5, 12 ). */
.hud-center { left: round( 50%, var( --dpx, 1px ) ); bottom: calc( 3 * var( --px ) ); transform: translateX( round( -50%, var( --dpx, 1px ) ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); }
/* Short screens ( #hud.short, automap.js dock ): the column leaves the middle of the floor for the bottom
   edge, just right of the portrait. */
#hud.short .hud-center { left: calc( 160 * var( --px ) ); bottom: 0; transform: none; align-items: flex-start; }
.hud-skills { display: flex; gap: calc( 5 * var( --px ) ); filter: var( --hard-drop ); }
.hud-slot { position: relative; width: calc( 41 * var( --px ) ); height: calc( 52 * var( --px ) ); --cd: 0; }
.hud-slot-frame { position: absolute; left: 0; top: 0; width: calc( 41 * var( --px ) ); height: calc( 48 * var( --px ) ); background-image: var( --ui-slot ); }
.hud-slot.ready .hud-slot-frame { background-image: var( --ui-slot-ready ); }
.hud-slot-icon { position: absolute; left: calc( 8 * var( --px ) ); top: calc( 15 * var( --px ) ); width: calc( 25 * var( --px ) ); height: calc( 25 * var( --px ) ); }
.hud-slot-sweep { position: absolute; left: calc( 5 * var( --px ) ); top: calc( 12 * var( --px ) ); width: calc( 31 * var( --px ) ); height: calc( 31 * var( --px ) );
  background: conic-gradient( transparent 0 calc( ( 1 - var( --cd ) ) * 360deg ), rgba( 5, 4, 15, 0.8 ) 0 ); }
.hud-slot-time { position: absolute; left: round( calc( 20.5 * var( --px ) ), 1px ); top: round( calc( 27.5 * var( --px ) ), 1px ); translate: round( -50%, 1px ) round( -50%, 1px ); display: flex; }
.hud-slot-count { position: absolute; left: calc( 5 * var( --px ) ); top: calc( 30 * var( --px ) ); }
.hud-slot .hud-key { position: absolute; right: calc( -3 * var( --px ) ); top: calc( 39 * var( --px ) ); }
.hud-slot-lock { position: absolute; left: calc( 15 * var( --px ) ); top: calc( 21 * var( --px ) ); width: calc( 11 * var( --px ) ); height: calc( 13 * var( --px ) ); background-image: var( --ui-icon-lock ); }
.hud-slot-lock[hidden] { display: none; }
.hud-slot.locked .hud-slot-icon { filter: grayscale( 1 ) brightness( 0.45 ); }
.hud-slot.cooling .hud-slot-icon { filter: brightness( 0.7 ); }
@keyframes slot-ready { 0% { filter: brightness( 1.9 ); } 100% { filter: none; } }
/* Night Terror's refund ( hud.js RESTARTS.refund ): the ring brightens in the Nightstalker's violet; calm keeps the halo, not the spike */
@keyframes slot-refund { 0% { filter: brightness( 1.6 ) drop-shadow( 0 0 calc( 3 * var( --px ) ) rgba( 168, 88, 192, 0.95 ) ); } 100% { filter: brightness( 1 ) drop-shadow( 0 0 0 rgba( 168, 88, 192, 0 ) ); } }
@keyframes slot-refund-calm { 0% { filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 168, 88, 192, 0.7 ) ); } 100% { filter: drop-shadow( 0 0 0 rgba( 168, 88, 192, 0 ) ); } }
.hud-slot.glow .hud-slot-icon { animation: flask-glow 1.8s ease-in-out infinite; }
@keyframes flask-glow { 0%, 100% { filter: drop-shadow( 0 0 calc( 1 * var( --px ) ) rgba( 255, 125, 102, 0.5 ) ); } 50% { filter: drop-shadow( 0 0 calc( 4 * var( --px ) ) rgba( 255, 200, 69, 0.85 ) ); } }
.hud-slot.glow.calm .hud-slot-icon { animation: none; filter: drop-shadow( 0 0 calc( 2 * var( --px ) ) rgba( 255, 200, 69, 0.6 ) ); }
.hud-slot.empty .hud-slot-icon { filter: brightness( 0.6 ); }

/* Powerups: only active timers show; the coloured ring drains clockwise from twelve o'clock. The talent states ( .hud-buffs, hud.js: Reload Momentum,
   Unbroken, Pyre Pact, Overwatch Burst's volley, Holy Arsenal's family bonus ) wear the same glyph in a row of their own above it, so one coming and going never moves a powerup; the ring of a state with no
   timer stays full, and the icon is the talent's own 17 px tile, a px in on each side of the ring's 15 px slot. */
.hud-powerups, .hud-buffs { display: flex; gap: calc( 4 * var( --px ) ); filter: var( --hard-drop ); }
.hud-power.buff .hud-power-icon { left: calc( 6 * var( --px ) ); top: calc( 6 * var( --px ) ); width: calc( 17 * var( --px ) ); height: calc( 17 * var( --px ) ); }
.hud-power { position: relative; width: calc( 29 * var( --px ) ); height: calc( 38 * var( --px ) ); --left: 1; }
.hud-power[hidden] { display: none; }
.hud-power-ring, .hud-power-fill { position: absolute; left: 0; top: 0; width: calc( 29 * var( --px ) ); height: calc( 29 * var( --px ) ); }
.hud-power-ring { background-image: var( --ui-ring ); }
.hud-power-fill { -webkit-mask: conic-gradient( #000 0 calc( var( --left ) * 360deg ), transparent 0 ); mask: conic-gradient( #000 0 calc( var( --left ) * 360deg ), transparent 0 ); }
.hud-power-icon { position: absolute; left: calc( 7 * var( --px ) ); top: calc( 7 * var( --px ) ); width: calc( 15 * var( --px ) ); height: calc( 15 * var( --px ) ); }
.hud-power-time { position: absolute; left: 0; right: 0; top: calc( 27 * var( --px ) ); display: flex; justify-content: center; }
.hud-power.ending .hud-power-fill, .hud-power.ending .hud-power-icon { animation: power-end 0.33s steps( 1 ) infinite; }
@keyframes power-end { 50% { opacity: 0.2; } }
.hud-power.ending.calm .hud-power-fill, .hud-power.ending.calm .hud-power-icon { animation: power-end-calm 1s ease-in-out infinite; }
@keyframes power-end-calm { 50% { opacity: 0.55; } }

/* Magazine: desktop top-right ( the weapon's name, pip tray, bullet count below, the reload key ); touch overrides to top-left row.
   When magazine > 50, .compact-mag reduces the magazine tray display size by 50 %. */
.hud-right { right: calc( 5 * var( --px ) ); bottom: calc( 3 * var( --px ) ); display: flex; flex-direction: column; align-items: flex-end; gap: calc( 1 * var( --px ) ); filter: var( --hard-drop ); }
#hud:not( .touch ) .hud-right { top: calc( 4 * var( --px ) ); bottom: auto; }
.hud-right.compact-mag .hud-tray { --px: calc( 0.5 * var( --hpx, 2px ) ); }
.hud-mag-count { display: flex; align-items: flex-end; padding-right: calc( 2 * var( --px ) ); }
.hud-tray { border-width: calc( 5 * var( --px ) ); border-image: var( --ui-panel ) 7 fill / calc( 7 * var( --px ) ) stretch; }
.hud-pips { display: flex; flex-direction: column; gap: calc( 2 * var( --px ) ); }
.hud-pip-row { display: flex; gap: calc( 1 * var( --px ) ); }
.hud-pip-row i { width: calc( 5 * var( --px ) ); height: calc( 11 * var( --px ) ); background: var( --ui-pip-full ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.hud-pip-row i:nth-child( 5n + 1 ):not( :first-child ) { margin-left: calc( 1 * var( --px ) ); }
.hud-pip-row i.spent { background-image: var( --ui-pip-spent ); }
.hud-pip-row i.empty { background-image: var( --ui-pip-empty ); }
.hud-pip-row i.hot { background-image: var( --ui-pip-hot ); }
.hud-pip-row i.dry { background-image: var( --ui-pip-dry ); }
.hud-pip-row i.load { background-image: var( --ui-pip-load ); }
.hud-right.unarmed .hud-mag-count, .hud-right.unarmed .hud-tray { display: none; } /* no magazine yet: never show '/0' */
.hud-pip-row i.blink { animation: pip-blink 0.5s steps( 1 ) infinite; }
@keyframes pip-blink { 50% { background-image: var( --ui-pip-hot ); } }
.calm .hud-pip-row i.blink { animation: none; background-image: var( --ui-pip-hot ); }
@keyframes pip-pop { 0% { translate: 0 calc( -3 * var( --px ) ); filter: brightness( 1.8 ); } 100% { translate: 0 0; filter: none; } }
@keyframes pip-pop-calm { 0% { translate: 0 calc( -3 * var( --px ) ); } 100% { translate: 0 0; } }
.hud-right.dry .hud-tray { animation: tray-dry 0.6s steps( 1 ) infinite; }
@keyframes tray-dry { 50% { filter: brightness( 1.35 ) saturate( 1.3 ); } }
.calm .hud-right.dry .hud-tray { animation: none; }
.hud-weapon { display: flex; align-items: flex-end; /* not centre: a half pixel inside .hud-right's filter */ gap: calc( 3 * var( --px ) ); padding-right: calc( 1 * var( --px ) ); }
.hud-weapon > .txt[hidden], .hud-weapon-name[hidden], .hud-weapon-name.near-swarm, .hud-weapon-name.near-boss, #hud.touch .hud-weapon-name { display: none; } /* a gun worn: no sidearm name on the plaque; none worn: no name line, and no gap in the column; the phone's HUD has no name line ( touch.css hides .hud-weapon the same way ); the near forms show only under the swarm row or a boss bar */
#hud:not( .touch ):has( > .hud-swarm:not( [hidden], .below-boss ) ) .hud-weapon-name:not( .near-swarm ) { display: none; } /* the swarm row stands at top centre ( under a boss bar it hangs below it: not here ): the form that leaves it its room ( hud.js fits all three, name-fit.js nameRooms ) */
#hud:not( .touch ):has( > .hud-swarm:not( [hidden], .below-boss ) ) .hud-weapon-name.near-swarm:not( [hidden] ) { display: inline-block; }
#hud:not( .touch ):has( > .hud-target:not( [hidden] ) ) .hud-weapon-name:not( .near-boss ) { display: none; } /* a boss bar is up: the form that leaves it its gap; these two stand after the swarm's, so the bar wins */
#hud:not( .touch ):has( > .hud-target:not( [hidden] ) ) .hud-weapon-name.near-boss:not( [hidden] ) { display: inline-block; }
#hud:not( .touch ):has( > .ui-screens > :is( .ui-panel:not( .ui-inv, .ui-stash ), .ui-preview, .ui-storage.show ):not( [hidden] ) ) .hud-weapon-name { visibility: hidden; transition: none; } /* a layer stands over the name's x range and its band: a centred panel ( every .ui-panel but the pack and the locker, which stand at the sides and below the name: T, M, a waypoint, a stall, the wardrobe ), the wardrobe's preview bar ( top centre ), a toast ( .ui-storage: top centre, 20 css px down at 1366; 1.8 s, a failed save's 6 s ). The screens' art px is capped by the window, the HUD's is not, so a layer's frame reaches the name at 1366 x 768 and 1280 x 720 but not at 1920 x 1080 ( a panel's top is 12 to 24 css px, the name's bottom 32, the waypoint's top 40 and, at the Large interface size, the name's bottom 48 ): the line goes by visibility, keeps its row, and nothing moves; it goes at once ( transition: none ) and comes back when the toast's own fade has run ( below ) */
#hud:not( .touch ):has( > .ui-screens > .ui-panel:not( .ui-inv, .ui-stash ):not( [hidden] ) ) > .ui-iconrow { visibility: hidden; } /* a centred panel is up ( the name's panels: the pack and the locker stand at the sides and cover nothing of the row ): the row goes by visibility too, its place kept, nothing moves. With the row one name row down the map's frame reaches it at 1920 x 1080 and would leave stubs of the chips above its top edge; every chip stands under the backdrop while a screen is open, none is usable */
.hud-weapon-name { max-height: calc( 12 * var( --px ) ); margin-right: calc( -1 * var( --px ) ); background-size: 100% auto; background-position: right center; transition: visibility 0s linear 0.12s; } /* the column's top line, one art px over the tray ( the column's gap ), its ink ending on the tray frame's outer right edge ( the bitmap's last column is blank at every rarity: the margin takes it ): a name wider than the tray runs on to the left over the icon row's x range, and the row stands one name row down ( below ), so no name moves the tray or the row. One row at every rarity: a Unique's rim makes its image 14 font px tall ( the others' 12 ), the blank first and last rows of it are cut, so the tray below never moves with a swap. It comes back from visibility: hidden 0.12 s late, the length of a toast's fade ( .hud-toast ), so a toast that is going does not stand over it */
#hud { --name-row: calc( 12 * round( max( 2px, var( --hpx, 2px ) ), var( --dpx, 1px ) ) + var( --hpx, 2px ) ); } /* the name's row: 12 font px at the text px ( the small face's floor, line 45 ) and the column's gap, 1 art px: what a worn gun puts above the tray */

/* Toasts: kit blood-cloth banner ( 23 art px tall, 14 px tails ) around small-caps text. */
.hud-toast { min-height: calc( 23 * var( --px ) ); border-width: 0 calc( 14 * var( --px ) ); border-image: var( --ui-banner ) 0 14 fill / 0 calc( 14 * var( --px ) ) stretch;
  display: flex; align-items: center; justify-content: center; padding: 0 calc( 3 * var( --px ) ) calc( 3 * var( --px ) );
  opacity: 0; translate: 0 calc( 3 * var( --px ) ); transition: opacity 0.12s, translate 0.12s steps( 3 ); filter: var( --hard-drop ); }
.hud-toast.show { opacity: 1; translate: 0 0; }
.hud-msg { left: round( 50%, var( --dpx, 1px ) ); top: 36%; transform: translateX( round( -50%, var( --dpx, 1px ) ) ); }
.hud-reload { position: absolute; right: 0; bottom: calc( 100% + 2 * var( --px ) ); }
#hud:not( .touch ) .hud-reload { top: calc( 100% + 2 * var( --px ) ); bottom: auto; }

/* Big centre banner ( 'Wave 2', 'You died' ): gothic caps between ornamental rules. */
.hud-banner { left: 0; right: 0; top: 22%; display: flex; flex-direction: column; align-items: center; gap: calc( 3 * var( --px ) ); opacity: 0; transition: opacity 0.3s; filter: var( --hard-drop ); }
.hud-banner.show { opacity: 1; }
.hud-banner .rule, .menu-divider { display: block; width: calc( 121 * var( --px ) ); height: calc( 7 * var( --px ) ); background: var( --ui-divider ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }

/* Boss bar, top centre: gothic name, horned kit rail ( 9-slice 33 × 15 ), blood fill over a gilt
   trail that lags behind each hit, phase ticks, epithet. */
.hud-target { left: round( 50%, var( --dpx, 1px ) ); top: calc( 6 * var( --px ) ); transform: translateX( round( -50%, var( --dpx, 1px ) ) ); width: calc( 236 * var( --px ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 1 * var( --px ) ); filter: var( --hard-drop ); }
.hud-target[hidden] { display: none; }
.hud-target.gone { opacity: 0; transition: opacity 0.4s ease-out; } /* a dead boss's empty bar, once the gilt trail has drained ( systems/zone.js BOSS_BAR_HOLD ); the transition sits here so a bar coming back is not faded in */
.hud-target-bar { position: relative; align-self: stretch; height: calc( 15 * var( --px ) ); border-width: calc( 5 * var( --px ) ) calc( 12 * var( --px ) ); border-image: var( --ui-boss-bar ) 5 12 fill / calc( 5 * var( --px ) ) calc( 12 * var( --px ) ) stretch; }
.hud-target-fill, .hud-target-trail { position: absolute; left: 0; right: 0; top: 0; height: calc( 5 * var( --px ) ); background: var( --ui-boss-fill ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; transition: clip-path 0.12s; }
.hud-target-trail { background-image: var( --ui-boss-trail ); transition: clip-path 0.6s ease-in; } /* no delay: a delay restarts at every hit, so under steady fire the trail never moved ( a long fight's bar read full ) */
.hud-target-ticks { position: absolute; inset: 0; }
/* STAGGERED ( hud.js, boss_stagger ): 2 Hz, half on and half off; steady under unified .calm ( reduced flash or OS reduced motion ). */
.hud-target-epithet.stagger { animation: stagger-blink 0.5s steps( 1 ) infinite; }
.calm .hud-target-epithet.stagger { animation: none; }
@keyframes stagger-blink { 50% { opacity: 0; } }
.hud-target-ticks i { position: absolute; top: calc( -1 * var( --px ) ); bottom: calc( -1 * var( --px ) ); width: var( --px ); background: var( --bone3 ); box-shadow: var( --px ) 0 0 var( --void ); }
/* Ju-jak's Rekindling ( hud.js, ju-jak.js rkBar ): the heal still to come, a ghost past the fill ( ember hatching, not the gilt trail's art, so it reads as neither health nor a hit just taken );
   a pip a coal at the subtitle's end, lit by the coal's life left ( --life ), a snuffed one hollow; the notch where her maximum stood before the coals grew it, white-hot, taller than a phase tick */
.hud-target-pending { position: absolute; left: 0; right: 0; top: 0; height: calc( 5 * var( --px ) ); background: repeating-linear-gradient( 135deg, var( --flame2 ) 0 var( --px ), var( --flame0 ) var( --px ) calc( 2 * var( --px ) ) ); opacity: 0.8; transition: clip-path 0.12s; }
.hud-target-pips { position: absolute; right: calc( 12 * var( --px ) ); bottom: 0; display: flex; gap: calc( 3 * var( --px ) ); }
.hud-target-pips i { width: calc( 6 * var( --px ) ); height: calc( 6 * var( --px ) ); background: var( --flame2 ); opacity: calc( 0.35 + 0.65 * var( --life, 1 ) ); box-shadow: 0 0 0 var( --px ) var( --void ); }
.hud-target-pips i.out { background: none; opacity: 1; box-shadow: inset 0 0 0 var( --px ) var( --bone1 ), 0 0 0 var( --px ) var( --void ); }
.hud-target-pips i.home { background: var( --flame0 ); opacity: 1; }
.hud-target-ticks i.base { top: calc( -3 * var( --px ) ); bottom: calc( -3 * var( --px ) ); width: calc( 2 * var( --px ) ); background: var( --core ); box-shadow: 0 0 0 var( --px ) var( --void ); }
/* the Mend's quench filling along the bar ( rk.quench, 0..1 of its width ): the lower three rows of the fill's strip, a K keyline over the band's own sky C then sky D */
.hud-target-quench { position: absolute; left: 0; right: 0; top: calc( 2 * var( --px ) ); height: calc( 3 * var( --px ) ); background: linear-gradient( 180deg, var( --void ) 0 33.4%, #78acd0 33.4% 66.7%, #b4e0ec 66.7% 100% ); clip-path: inset( 0 100% 0 0 ); transition: clip-path 0.12s; }
/* the stoke's 20 s ( rk.stoked, 1..0 of the bar's width, round 8 ): a 1 px flame-orange line under the bar's frame, draining as she burns; nothing while she is not stoked */
.hud-target-stoke { position: absolute; left: calc( -12 * var( --px ) ); right: calc( -12 * var( --px ) ); top: calc( 100% + 5 * var( --px ) ); height: var( --px ); background: var( --flame1 ); clip-path: inset( 0 100% 0 0 ); transition: clip-path 0.12s; pointer-events: none; }
.calm .hud-target-stoke { transition: none; }
/* the bar yields to her head ( ui/rekindle-aid.js ): at the Mend's touchdown on a small screen her head lies under the bar and its label. Round 7 ( the fight critic: the whole bar at 25 % made the label, the heal and the quench
   fill unreadable for the whole Mend ): the frame alone yields, drawn again as a pseudo-element at 25 % over the bar's own border box ( the bar's frame image dropped meanwhile ); the name, the label, the fills and the pips stay whole */
.hud-target.yield .hud-target-bar { border-image-source: none; }
.hud-target.yield .hud-target-bar::before { content: ''; position: absolute; inset: calc( -5 * var( --px ) ) calc( -12 * var( --px ) ); box-sizing: border-box; border-style: solid; border-color: transparent; border-width: calc( 5 * var( --px ) ) calc( 12 * var( --px ) );
  border-image: var( --ui-boss-bar ) 5 12 fill / calc( 5 * var( --px ) ) calc( 12 * var( --px ) ) stretch; image-rendering: pixelated; opacity: 0.25; pointer-events: none; animation: bar-yield 0.15s ease-out; }
.calm .hud-target.yield .hud-target-bar::before { animation: none; }
@keyframes bar-yield { from { opacity: 1; } }
/* a pointer to a lit coal off screen ( ui/rekindle-aid.js ): the exit pointer's cell, in the coal's flame colours, its alpha the coal's life left ( --a ) */
.hud-coal-ptr { position: absolute; left: 0; top: 0; width: calc( 42 * var( --px ) ); height: calc( 42 * var( --px ) ); pointer-events: none; opacity: 0; transition: opacity 0.2s ease-out; }
.hud-coal-ptr.on { opacity: var( --a, 1 ); }
.hud-coal-ptr canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.calm .hud-coal-ptr { transition: none; }

.hud-numbers { left: 0; top: 0; } /* the origin of the numbers canvas ( hud.js drawNumbers ), which sizes and places itself */
.hud-perf { left: calc( 3 * var( --px ) ); top: calc( 3 * var( --px ) ); font: max( 10px, calc( 9 * var( --u ) ) ) / 1.35 Consolas, 'Courier New', monospace; color: #b8f0a0; background: rgba( 0, 0, 0, 0.6 ); padding: calc( 4 * var( --u ) ) calc( 6 * var( --u ) ); white-space: pre; }
.hud-perf[hidden] { display: none; }

/* ---- overlays: pause / settings / controls, error ----------------------------------------- */

.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba( 8, 5, 14, 0.7 ); color: var( --bone3 ); }
.overlay[hidden] { display: none; }
/* The panel sits right of centre: Pepecat stands left of centre in the arena framing. */
#pause { cursor: default; align-items: flex-end; padding: 0 round( max( 4vw, calc( 24 * var( --px ) ) ), var( --dpx, 1px ) ); box-sizing: border-box;
  background: linear-gradient( 90deg, rgba( 8, 5, 14, 0.35 ), rgba( 8, 5, 14, 0.82 ) 70% ); }
#error { font-size: 18px; letter-spacing: 0.05em; white-space: pre-wrap; text-align: center; color: var( --red2 ); }
#error button { font: inherit; letter-spacing: 0.1em; color: var( --bone3 ); background: none; cursor: pointer; padding: 4px 18px; border: 10px solid transparent; border-image: var( --ui-button ) 5 fill / 10px stretch; image-rendering: pixelated; }

.menu-panel {
  --mpx: var( --px );
  position: relative; min-width: calc( 200 * var( --px ) ); max-width: min( 92vw, 1120px ); box-sizing: border-box;
  border-style: solid; border-color: transparent; border-width: calc( 20 * var( --px ) ); border-image: var( --ui-frame ) 20 fill / calc( 20 * var( --px ) ) stretch;
  padding: calc( 2 * var( --px ) ) calc( 8 * var( --px ) ) calc( 4 * var( --px ) ); display: flex; flex-direction: column; align-items: center; gap: calc( 4 * var( --px ) );
  filter: drop-shadow( 0 calc( 3 * var( --px ) ) 0 rgba( 0, 0, 0, 0.6 ) );
}
.menu-panel :is( .menu-title, .menu-btn, .menu-group h2, .menu-label, .menu-choice, .menu-ctl output, .menu-note, .menu-controls, .menu-hint ) .txt {
  --px: max( 2px, var( --fpx, var( --mpx, 2px ) ) );
}
.menu-crest { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: calc( -38 * var( --px ) ); width: calc( 41 * var( --px ) ); height: calc( 27 * var( --px ) ); translate: round( -50%, var( --dpx, 1px ) ) 0; background: var( --ui-crest ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.menu-title { margin: calc( 6 * var( --px ) ) 0 0; line-height: 0; }
.menu-page { display: flex; flex-direction: column; align-items: stretch; gap: calc( 3 * var( --px ) ); width: 100%; }
.menu-page[hidden] { display: none; }
.menu-main { flex-direction: row; align-items: center; justify-content: center; gap: calc( 10 * var( --px ) ); padding: calc( 2 * var( --px ) ) 0; }
.menu-buttons { display: flex; flex-direction: column; gap: calc( 3 * var( --px ) ); }
.menu-hint { margin: 0; display: flex; justify-content: center; line-height: 0; }

.menu-btn {
  position: relative; display: flex; justify-content: center; align-items: center; min-width: calc( 96 * var( --px ) ); background: none; cursor: pointer; outline: none;
  padding: calc( 2 * var( --px ) ) calc( 8 * var( --px ) ); border: calc( 5 * var( --px ) ) solid transparent; border-image: var( --ui-button ) 5 fill / calc( 5 * var( --px ) ) stretch; image-rendering: pixelated;
}
.menu-btn.small { min-width: 0; align-self: center; }
/* hover, focus and press light only a live button: a greyed one ( disabled, or aria-disabled ) stays dark under the pointer */
.menu-btn .hot, .menu-btn:not( :disabled, [aria-disabled="true"] ):is( :focus, :hover ) .rest { display: none; }
.menu-btn:not( :disabled, [aria-disabled="true"] ):is( :focus, :hover ) .hot { display: inline-block; }
.menu-btn:not( :disabled, [aria-disabled="true"] ):is( :focus, :hover ) { border-image-source: var( --ui-button-hot ); }
.menu-btn:not( :disabled, [aria-disabled="true"] ):active { translate: 0 var( --px ); border-image-source: var( --ui-button-down ); }
.menu-btn:focus::before, .menu-row:focus-within::before {
  content: ''; position: absolute; left: calc( -14 * var( --px ) ); top: 50%; width: calc( 7 * var( --px ) ); height: calc( 7 * var( --px ) ); translate: 0 -50%;
  background: var( --ui-fleur ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; animation: fleur 1.2s steps( 2 ) infinite;
}
.calm .menu-btn:focus::before, .calm .menu-row:focus-within::before { animation: none; }
@keyframes fleur { 50% { translate: calc( 1 * var( --px ) ) -50%; } }

.menu-cols { display: grid; grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 0 calc( 12 * var( --px ) ); width: 100%; }
.menu-group { display: flex; flex-direction: column; gap: calc( 2 * var( --px ) ); min-width: 0; }
.menu-group h2 { margin: calc( 3 * var( --px ) ) 0 calc( 1 * var( --px ) ); padding-bottom: var( --px ); font-weight: normal; line-height: 0; display: flex; align-items: center; border-bottom: var( --px ) solid var( --iron0 ); }
.menu-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: calc( 3 * var( --px ) ); min-height: max( 26px, calc( 13 * var( --px ) ) ); padding: 0 calc( 2 * var( --px ) ); margin-left: calc( 10 * var( --px ) ); min-width: 0; }
.menu-row:focus-within, .menu-row:hover { background: linear-gradient( 90deg, rgba( 94, 20, 32, 0.55 ), rgba( 94, 20, 32, 0 ) ); }
.menu-row::before { left: calc( -11 * var( --px ) ) !important; }
.menu-row.off { opacity: 0.45; }
.menu-label { display: inline-flex; align-items: center; line-height: 0; white-space: nowrap; }
.menu-label .hot, .menu-row:is( :focus-within, :hover ) .menu-label .rest { display: none; }
.menu-row:is( :focus-within, :hover ) .menu-label .hot { display: inline-block; }
.menu-ctl { display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; outline: none; background: none; border: 0; cursor: pointer; padding: 0; }
.menu-ctl output { min-width: calc( 26 * max( 2px, var( --fpx, var( --mpx, 2px ) ) ) ); display: inline-flex; justify-content: flex-end; line-height: 0; }
.menu-toggle { width: calc( 11 * var( --px ) ); height: calc( 11 * var( --px ) ); background: var( --ui-check-off ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
[aria-checked='true'] > .menu-toggle { background-image: var( --ui-check-on ); }
.menu-choice { display: inline-flex; align-items: center; gap: calc( 2 * var( --px ) ); line-height: 0; }
.menu-choice::before, .menu-choice::after { content: ''; flex: none; width: var( --px ); height: var( --px ); background: transparent; margin: 0 calc( 2 * var( --px ) ) calc( 4 * var( --px ) ) 0; }
.menu-choice::before { box-shadow: calc( 2 * var( --px ) ) 0 var( --flame1 ), var( --px ) var( --px ) var( --flame1 ), 0 calc( 2 * var( --px ) ) var( --flame1 ), var( --px ) calc( 3 * var( --px ) ) var( --flame1 ), calc( 2 * var( --px ) ) calc( 4 * var( --px ) ) var( --flame1 ); }
.menu-choice::after { box-shadow: 0 0 var( --flame1 ), var( --px ) var( --px ) var( --flame1 ), calc( 2 * var( --px ) ) calc( 2 * var( --px ) ) var( --flame1 ), var( --px ) calc( 3 * var( --px ) ) var( --flame1 ), 0 calc( 4 * var( --px ) ) var( --flame1 ); }
.menu-range { -webkit-appearance: none; appearance: none; width: calc( 64 * var( --px ) ); height: calc( 13 * var( --px ) ); background: transparent; margin: 0; cursor: pointer; outline: none; }
.menu-range::-webkit-slider-runnable-track { height: calc( 7 * var( --px ) ); border: calc( 3 * var( --px ) ) solid transparent; border-image: var( --ui-track ) 3 fill / calc( 3 * var( --px ) ) stretch; image-rendering: pixelated; box-sizing: border-box;
  background: linear-gradient( 90deg, var( --flame0 ) var( --fill, 0% ), transparent 0 ) content-box; }
.menu-range::-webkit-slider-thumb { -webkit-appearance: none; width: calc( 7 * var( --px ) ); height: calc( 13 * var( --px ) ); margin-top: calc( -6 * var( --px ) + 0.5px ); background: var( --ui-thumb ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; border: 0; }
.menu-range::-moz-range-track { height: calc( 7 * var( --px ) ); border: calc( 3 * var( --px ) ) solid transparent; border-image: var( --ui-track ) 3 fill / calc( 3 * var( --px ) ) stretch; box-sizing: border-box; }
.menu-range::-moz-range-thumb { width: calc( 7 * var( --px ) ); height: calc( 13 * var( --px ) ); background: var( --ui-thumb ) 0 0 / 100% 100% no-repeat; image-rendering: pixelated; border: 0; border-radius: 0; }
.menu-note { margin: 0 0 0 calc( 10 * var( --px ) ); line-height: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var( --px ); }

.menu-controls { display: grid; grid-template-columns: auto 1fr; gap: calc( 3 * var( --px ) ) calc( 8 * var( --px ) ); align-items: center; margin: 0 calc( 4 * var( --px ) ); }
.menu-controls dt { justify-self: end; display: flex; gap: calc( 2 * var( --px ) ); align-items: center; line-height: 0; }
.menu-controls dd { margin: 0; line-height: 0; display: flex; flex-wrap: wrap; gap: var( --px ) calc( 3 * var( --px ) ); align-items: center; }
.menu-footer { display: flex; gap: calc( 6 * var( --px ) ); justify-content: center; margin-top: calc( 2 * var( --px ) ); }

/* Threat readability ( threats.js ): ember rings where lobs land, the imp's hand flare, swarm pips. */
.hud-threats { position: absolute; inset: 0; pointer-events: none; }
.hud-lob-ring { position: absolute; left: 0; top: 0; opacity: 0.85; }
.hud-lob-ring canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.hud-lob-ring.boulder { opacity: 0.7; }
/* The exit pointer ( src/ui/exit-pointer.js ): a 21 px cell at 2 × --px at the edge, toward the zone's exit. It
   fades in and out ( .on ); open it pulses in two steps, 0.4 s each ( full, then dimmer and nudged toward the exit:
   --nx, --ny, its direction ), barred it holds steady, as under unified .calm ( reduced flash or OS reduced motion ). */
.hud-exit { position: absolute; left: 0; top: 0; width: calc( 42 * var( --px ) ); height: calc( 42 * var( --px ) ); pointer-events: none; opacity: 0; transition: opacity 0.3s ease-out; }
.hud-exit.on { opacity: 1; }
/* the glyph steps toward the exit and back; its glow ( the canvas behind ) pulses with it, the glyph stays full */
.hud-exit canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; animation: exit-nudge 0.8s steps( 1, end ) infinite; }
.hud-exit canvas.glow { animation-name: exit-glow; }
.hud-exit.barred canvas, .calm .hud-exit canvas, .hud-exit.barred canvas.glow, .calm .hud-exit canvas.glow { animation: none; }
.calm .hud-exit { transition: none; }
@keyframes exit-nudge { 0% { translate: 0 0; } 50% { translate: calc( var( --nx, 0 ) * 2 * var( --px ) ) calc( var( --ny, 0 ) * 2 * var( --px ) ); } }
@keyframes exit-glow { 0% { opacity: 1; translate: 0 0; } 50% { opacity: 0.2; translate: calc( var( --nx, 0 ) * 2 * var( --px ) ) calc( var( --ny, 0 ) * 2 * var( --px ) ); } }
/* The off-screen boss marker ( src/ui/boss-edge.js ): the 13 × 25 art px cell at 2 × --px, placed by translate, fading in
   and out ( .on ); a gentler pulse than the exit's, 0.6 s a step ( the glyph up one art px, its crimson glow dimmer ),
   steady under unified .calm ( reduced flash or OS reduced motion ). */
.hud-boss-edge { position: absolute; left: 0; top: 0; width: calc( 26 * var( --px ) ); height: calc( 50 * var( --px ) ); pointer-events: none; opacity: 0; transition: opacity 0.25s ease-out; }
.hud-boss-edge.on { opacity: 1; }
.hud-boss-edge canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; animation: boss-edge-nudge 1.2s steps( 1, end ) infinite; }
.hud-boss-edge canvas.glow { animation-name: boss-edge-glow; }
.calm .hud-boss-edge canvas, .calm .hud-boss-edge canvas.glow { animation: none; }
.calm .hud-boss-edge { transition: none; }
/* slid aside of her sprite box: the 5 × 7 caret beside the cell, at the chevron's middle, pointing back at her; steady */
.hud-boss-edge canvas.tick { display: none; inset: auto; top: calc( 10 * var( --px ) ); width: calc( 10 * var( --px ) ); height: calc( 14 * var( --px ) ); animation: none; }
.hud-boss-edge.aside-l canvas.tick { display: block; left: 100%; }
.hud-boss-edge.aside-r canvas.tick { display: block; right: 100%; scale: -1 1; }
@keyframes boss-edge-nudge { 0% { translate: 0 0; } 50% { translate: 0 calc( -2 * var( --px ) ); } }
@keyframes boss-edge-glow { 0% { opacity: 1; translate: 0 0; } 50% { opacity: 0.35; translate: 0 calc( -2 * var( --px ) ); } }
/* Pepecat's barks ( src/ui/barks.js ): the kit's tip card ( gilt for a boss ) at the tooltips' art px, its size and
   place written by barks.js ( whole art px, whole device px ), a tail down to his head ( flipped up when the card sits
   under him: .below ) at --tx art px. It pops in ( up 3 art px and in, 3 steps ), holds and fades in 4 steps: 2.2 s
   ( BARK_FEEL.life ); .b swaps in the same keyframes under another name, so a bark replacing one plays from the top.
   A boss's line ( .gilt ) runs 2.7 s ( BARK_FEEL.bossLife ), its hold 0.4 s longer. Under .calm it only fades. */
.hud-bark { left: 0; top: 0; --px: var( --tpx, 2px ); pointer-events: none; display: none; filter: var( --hard-drop ); }
.hud-bark.on { display: block; }
.hud-bark-in { position: relative; animation: bark-in 2.2s both; }
.hud-bark.b .hud-bark-in { animation-name: bark-in-b; }
.hud-bark-body { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; padding: 0 calc( 2 * var( --px ) );
  border: calc( 6 * var( --px ) ) solid transparent; border-image: var( --ui-tip ) 6 fill / calc( 6 * var( --px ) ) stretch; image-rendering: pixelated; }
.hud-bark.gilt .hud-bark-body { border-image-source: var( --ui-tip-gilt ); }
.hud-bark.gilt .hud-bark-in { animation-duration: 2.7s; }
.hud-bark-body > .txt + .txt { margin-top: calc( -1 * var( --px ) ); }
.hud-bark-tail { position: absolute; left: calc( var( --tx, 6 ) * var( --px ) ); top: calc( 100% - 2 * var( --px ) ); width: calc( 11 * var( --px ) ); height: calc( 7 * var( --px ) ); image-rendering: pixelated; }
.hud-bark.below .hud-bark-tail { top: auto; bottom: calc( 100% - 2 * var( --px ) ); }
@keyframes bark-in { 0% { opacity: 0; translate: 0 calc( 3 * var( --px ) ); animation-timing-function: steps( 3, end ); } 7% { opacity: 1; translate: 0 0; animation-timing-function: linear; } 84% { opacity: 1; animation-timing-function: steps( 4, end ); } 100% { opacity: 0; translate: 0 0; } }
@keyframes bark-in-b { 0% { opacity: 0; translate: 0 calc( 3 * var( --px ) ); animation-timing-function: steps( 3, end ); } 7% { opacity: 1; translate: 0 0; animation-timing-function: linear; } 84% { opacity: 1; animation-timing-function: steps( 4, end ); } 100% { opacity: 0; translate: 0 0; } }
@keyframes bark-still { 0%, 84% { opacity: 1; animation-timing-function: steps( 4, end ); } 100% { opacity: 0; } }
@keyframes bark-still-b { 0%, 84% { opacity: 1; animation-timing-function: steps( 4, end ); } 100% { opacity: 0; } }
.calm .hud-bark-in { animation-name: bark-still; }
.calm .hud-bark.b .hud-bark-in { animation-name: bark-still-b; }
/* A kill line that stays whole ( .solid, barks.js SOLID_BARKS: Croakjaw's, over his corpse ): pops in the same way, then holds at full opacity to its last frame, where barks.js takes it down at once. */
@keyframes bark-solid { 0% { opacity: 0; translate: 0 calc( 3 * var( --px ) ); animation-timing-function: steps( 3, end ); } 7%, 100% { opacity: 1; translate: 0 0; } }
@keyframes bark-solid-b { 0% { opacity: 0; translate: 0 calc( 3 * var( --px ) ); animation-timing-function: steps( 3, end ); } 7%, 100% { opacity: 1; translate: 0 0; } }
@keyframes bark-solid-still { 0%, 100% { opacity: 1; } }
.hud-bark.solid .hud-bark-in { animation-name: bark-solid; }
.hud-bark.solid.b .hud-bark-in { animation-name: bark-solid-b; }
.calm .hud-bark.solid .hud-bark-in, .calm .hud-bark.solid.b .hud-bark-in { animation-name: bark-solid-still; }
/* one art frame of flame: a 5 × 5 star in logical px ( --u ), core, arms and tips */
.hud-lob-flare { position: absolute; left: 0; top: 0; width: var( --u ); height: var( --u ); background: #fff4c2;
  box-shadow: var( --u ) 0 0 #ffc845, calc( -1 * var( --u ) ) 0 0 #ffc845, 0 var( --u ) 0 #ffc845, 0 calc( -1 * var( --u ) ) 0 #ffc845,
    calc( 2 * var( --u ) ) 0 0 #e8801e, calc( -2 * var( --u ) ) 0 0 #e8801e, 0 calc( 2 * var( --u ) ) 0 #e8801e, 0 calc( -2 * var( --u ) ) 0 #e8801e,
    var( --u ) var( --u ) 0 #b8401c, calc( -1 * var( --u ) ) var( --u ) 0 #b8401c, var( --u ) calc( -1 * var( --u ) ) 0 #b8401c, calc( -1 * var( --u ) ) calc( -1 * var( --u ) ) 0 #b8401c; }
.hud-swarm { left: round( 50%, var( --dpx, 1px ) ); top: calc( 8 * var( --px ) ); transform: translateX( round( -50%, var( --dpx, 1px ) ) ); display: flex; align-items: center; gap: calc( 3 * var( --px ) ); line-height: 0; filter: var( --hard-drop ); }
.hud-swarm[hidden] { display: none; }
.hud-swarm.below-boss { top: calc( 60 * var( --px ) ); }
.hud-swarm-pips { display: flex; gap: var( --px ); }
.hud-swarm-pip { width: calc( 4 * var( --px ) ); height: calc( 4 * var( --px ) ); background: #e8801e; box-shadow: inset 0 0 0 var( --px ) #b8401c; }
.hud-swarm-pip.out { background: #262b38; box-shadow: inset 0 0 0 var( --px ) #5b657c; }
.hud-swarm-more[hidden] { display: none; }

/* The HUD's art px, kept for layers that run on their own --px ( screens, hints ) but must clear HUD parts. */
#hud { --hpx: var( --px ); }

/* Icon row ( iconrow.js ): on desktop, immediately left of the top-right magazine cluster (--hud-right-w);
   on touch, docked beside the minimap block. Hover lights a chip and shows its key under it; a press sinks it one art px. */
#hud > .ui-iconrow { --chip: calc( 23 * var( --px ) ); position: absolute; top: calc( 4 * var( --px ) ); right: calc( 168 * var( --px ) ); display: flex; gap: calc( 2 * var( --px ) ); pointer-events: none; filter: var( --hard-drop ); }
#hud:not( .touch ) > .ui-iconrow:not( .docked ) { right: calc( var( --hud-right-w, 120px ) + 9 * var( --px ) ); }
#hud:not( .touch ):has( > .hud-right.unarmed ) > .ui-iconrow:not( .docked ) { right: calc( var( --hud-right-w, 0px ) + 9 * var( --px ) ); }
#hud:not( .touch ):has( > .hud-right > .hud-weapon-name:not( [hidden] ) ) > .ui-iconrow:not( .docked ) { top: calc( 4 * var( --px ) + var( --name-row ) ); } /* a gun is worn: the row stands beside the tray, one name row down ( none worn: where it always stood, at the top ) */
#hud:not( .touch ):has( > .hud-right > .hud-weapon-name:not( [hidden] ) ) > .ui-iconrow:not( .docked ) .ui-chip-badge { top: round( max( 2px, var( --hpx, 2px ) ), var( --dpx, 1px ) ); } /* a gun is worn: a chip's badge ( the talents' points ) stands one text px ( the name's: 2 css px at every window size ) inside its chip's top edge, not two art px over it: its ink then stands 2 css px or more under the ink of every name, a Unique's plate and the line's hard drop shadow included ( those reach the row of the chip's top edge, or 1 below it at 1280 x 720 ); none worn: as it was */
@media ( min-height: 501px ) { #hud:not( .touch ) .ui-inv { margin-top: var( --name-row ); } } /* the open pack ( screens.css: below the icon row ) stands as far down as the row does with a gun worn, and stays there when the only gun is taken off with the pack open: its top never moves while it is open ( none worn the row stands higher, as in deploy 64, and the pack keeps its place ); a short window ( touch.css, at most 500 px: top 4 px ) covers the row as it did */
#hud.touch:has( > .automap-corner[hidden] ) > .ui-iconrow:not( .docked ) { right: calc( 4 * var( --px ) ); }
#hud:not( .touch ):has( > .automap-corner:not( [hidden] ) ) .hud-perf { top: calc( 151 * var( --px ) ); }
#hud:not( .touch ):has( > .automap-corner.small:not( [hidden] ) ) .hud-perf { top: calc( 63 * var( --px ) ); }
#hud > .ui-iconrow[hidden] { display: none; }
.ui-chip { position: relative; width: var( --chip ); height: var( --chip ); pointer-events: auto; touch-action: none; cursor: pointer; }
.ui-chip .spr { display: block; background-repeat: no-repeat; background-size: 100% 100%; image-rendering: pixelated; }
.ui-chip > .spr { position: absolute; left: round( 50%, var( --dpx, 1px ) ); top: round( 50%, var( --dpx, 1px ) ); translate: round( -50%, var( --dpx, 1px ) ) round( -50%, var( --dpx, 1px ) ); }
.ui-chip > .hot { visibility: hidden; }
.ui-chip:hover > .hot, .ui-chip.on > .hot { visibility: visible; }
.ui-chip > .down { visibility: hidden; }
.ui-chip.on > .down { visibility: visible; } /* pressed ( .on, iconrow.js pointerdown ): the hot frame a step darker */
.ui-chip.on > .ui-chip-icon { translate: round( -50%, var( --dpx, 1px ) ) calc( round( -50%, var( --dpx, 1px ) ) + var( --px ) ); }
/* disabled ( nothing disables a chip yet ): the inventory chip's dulled icon, no hover or press */
.ui-chip.off { pointer-events: none; }
.ui-chip.off > .ui-chip-icon[ style*='icon-bag' ] { background-image: var( --ui-icon-bag-off ) !important; }
.ui-chip-tip { --px: var( --tpx ); position: absolute; top: calc( 100% + 2 * var( --px ) ); right: 0; padding: calc( 2 * var( --px ) ) calc( 3 * var( --px ) ); line-height: 0; white-space: nowrap;
  border-width: calc( 3 * var( --px ) ); border-style: solid; border-image: var( --ui-panel ) 7 fill / calc( 3 * var( --px ) ) stretch; visibility: hidden; pointer-events: none; z-index: 1; }
.ui-chip:hover > .ui-chip-tip { visibility: visible; }
.ui-chip-badge { position: absolute; right: calc( -2 * var( --px ) ); top: calc( -2 * var( --px ) ); width: calc( 11 * var( --px ) ); height: calc( 11 * var( --px ) ); display: flex; align-items: center; justify-content: center; }
.ui-chip-badge > .spr { position: absolute; inset: 0; }
.ui-chip-badge > .txt { position: relative; }
/* 10+ points: the 19 px lozenge, grown leftward over the chip ( right-anchored: clear of the next chip ) */
.ui-chip-badge.wide { width: calc( 19 * var( --px ) ); }
.ui-chip-badge.wide > .one, .ui-chip-badge:not( .wide ) > .two { display: none; }
/* the pack-full burst in the inventory chip's top-right corner */
.ui-chip > .ui-chip-full { left: auto; top: 0; right: 0; translate: none; }
.ui-chip-badge[hidden], .ui-chip > .ui-chip-full[hidden] { display: none; }
/* Unspent talent points: the tome's chip glows, a soft flame2 ember pulse at 1 Hz behind the icon
   ( opacity only: the compositor runs it, no JS per frame ). Reduced flashing ( #hud.calm ) or
   reduced motion: a steady glow. Off the moment the points are spent ( .has-points, iconrow.js ). */
.ui-chip.has-points::before { content: ''; position: absolute; inset: calc( -3 * var( --px ) ); border-radius: 50%; pointer-events: none;
  background: radial-gradient( closest-side, rgba( 255, 200, 69, 0.75 ), rgba( 232, 128, 30, 0.35 ) 55%, rgba( 232, 128, 30, 0 ) );
  animation: chip-points 0.5s ease-in-out infinite alternate; }
@keyframes chip-points { from { opacity: 0.25; } to { opacity: 1; } }
:is( .calm, #hud.calm ) .ui-chip.has-points::before { animation: none; opacity: 0.7; }
/* Touch: docked beside the minimap's block above the Fire cluster ( touch.js publishes it on :root ),
   at the controls' art size, every chip a 44 CSS px target, no hover tooltips. */
#hud > .ui-iconrow.docked { --px: var( --touch-cpx, 2px ); --chip: var( --touch-chip-hit, 44px ); position: fixed; top: var( --touch-map-top ); left: var( --touch-chips-left, auto ); right: var( --touch-chips-right, auto ); gap: 4px; filter: drop-shadow( 0 var( --px ) 0 var( --void ) ); }
#hud > .ui-iconrow.docked > .ui-chip { opacity: var( --touch-alpha, 0.75 ); }
#hud > .ui-iconrow.docked > .ui-chip.on, #hud > .ui-iconrow.docked > .ui-chip.has-points { opacity: 1; }
#hud.touch .ui-chip-tip { display: none; }

/* ---- src/boot.css */
/* Boot and flow fallbacks ( main.js ): shown until the UI's own screens take over ( engine.ui ). */
#loading { background: #08050e; font: 18px Georgia, serif; letter-spacing: 0.08em; color: #cbbfa6; }
#loading .bar { width: min( 320px, 60vw ); height: 6px; background: #1d1424; border: 1px solid #4a3a4c; }
#loading .bar i { display: block; height: 100%; width: 0; background: #b2482c; transition: width 0.2s; }
#loading small { font-size: 13px; opacity: 0.7; }
/* A load being retried ( src/load-errors.js sets body[data-load-retry] ): this veil says so under its stage line, as the front's does ( ui/front.js LOAD_RETRY_LINE ). */
body[data-load-retry] #loading::after { content: 'Slow connection. Trying again...'; font-size: 13px; opacity: 0.7; }
/* Its rats ( src/boot-rats.js ): behind the text and bar, out of the flex flow, never in the way of a tap. */
#loading .rats { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; image-rendering: pixelated; }
/* Hidden, it fades out over what takes its place ( the UI's front, z-index 20 ) rather than cutting to it, its rats
   still walking under the fade ( boot-rats.js leave ); a tap goes through at once. Shown again, it is back at once. */
#loading[hidden] { display: flex; z-index: 30; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.24s ease-in, visibility 0s 0.24s; }
@media ( prefers-reduced-motion: reduce ) { #loading[hidden] { transition: none; } }
.flow { font: 20px Georgia, serif; letter-spacing: 0.06em; color: #cbbfa6; background: rgba( 8, 5, 14, 0.86 ); }
.flow h1 { margin: 0 0 12px; font-weight: normal; font-size: 34px; letter-spacing: 0.12em; color: #e3c27a; }
.flow button { font: inherit; font-variant: small-caps; letter-spacing: 0.1em; color: #e8dcc0; background: #1d1424; border: 1px solid #6a5260; padding: 6px 28px; min-width: 220px; cursor: pointer; }
.flow button:hover:not( :disabled ) { border-color: #e3c27a; }
.flow button:disabled { opacity: 0.4; cursor: default; }
.flow small { font-size: 14px; opacity: 0.75; }
/* Touch devices ( CONTRACT.md "Mobile" ): no page scroll, rubber-band bounce, pinch or double-tap
   zoom, long-press callout or selection ( #view is touch-action: none; UI lists may still pan ). The safe-area probe's padding is read by main.js into
   the letterbox and the --safe-top / --safe-right / --safe-bottom / --safe-left vars. */
html, body { overscroll-behavior: none; touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
#safe-probe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding: env( safe-area-inset-top, 0px ) env( safe-area-inset-right, 0px ) env( safe-area-inset-bottom, 0px ) env( safe-area-inset-left, 0px ); }
/* A newer deploy replaced this build ( main.js staleBuild ): a quiet prompt, play goes on until the tap. */
#update { position: fixed; left: 50%; bottom: calc( 16px + env( safe-area-inset-bottom, 0px ) ); transform: translateX( -50% ); z-index: 60; }
#update button { font: 15px Georgia, serif; letter-spacing: 0.06em; color: #e8dcc0; background: rgba( 8, 5, 14, 0.88 ); border: 1px solid #6a5260; padding: 8px 20px; cursor: pointer; }
#update button:hover { border-color: #e3c27a; }
/* Over everything, the UI's front ( z-index 20 ) included: a failed boot never stalls behind the title backdrop. */
#error { z-index: 80; }
