/* ---- /play chrome (5.7): the SNES look, from the sheets ---------------------
   A thin top strip (status numbers in the bitmap font, RCI bars, speed and
   window buttons as Various Icons cells), the tool board on the right (the
   16×16 tool icons, pressed = the sheet's yellow), panels on the sheet's
   lavender with its dark edge, Dr. Wright's one-row speech box. Everything
   sheet-fed sizes as calc(N * var(--px)); icons size by --ipx, which in
   the strip and the side panels is the finer --hud-px (pixel-scale.js) so
   the strip stays thin. The side panels run wholly at --hud-px.
   5.12: the strip, the tool board and the speech box run at half that
   (--chrome-px / --chrome-ipx from pixel-scale.js, floored at one CSS px
   per art pixel); the dialogs and the side panels keep their size. */

.play-page #scene canvas {
  image-rendering: pixelated;
  touch-action: none;
}

.play-page {
  --ipx: var(--px);
}

/* 12.1: the SNES band and the tool palette leave the 5.12 halving. The band
   (text, RCI, window icons) runs at --hud-px, so its 24 px icon cells match
   the palette's 16 px tool cells at --px on a 1280 px screen (48 CSS px). */
.play-page .play-hud {
  --px: var(--hud-px, 2px);
  --ipx: var(--hud-px, 2px);
}

.play-page .palette {
  --ipx: var(--px);
}

.play-page,
.play-page button,
.play-page a,
.play-page #scene canvas {
  cursor: var(--hand, auto);
}

/* 12.19: the finger on every clickable element of every page (the title
 * sets --hand through icons.js loadHandCursor, /play through applyIcons) */
button,
a[href],
summary,
select,
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  cursor: var(--hand, pointer);
}

.play-page .side-panels,
.play-page .msg-toast {
  --px: var(--hud-px, 2px);
  --ipx: var(--hud-px, 2px);
}

/* 12.1 the top band (simcity_ui_basic.jpg): dark olive, an olive rim; the
   date over the window icons on the left, funds over population and the
   RCI bar on the right. 12.9: one row of window icons, the numbers and the
   RCI pill; the glass stops after the pill (operator, 12.20). */
.hud.play-hud {
  /* the CRT's rounded mask blacks the corner (33 px on the diagonal at MID,
     64 at HIGH), so the band moves in by --crt-inset while the screen is on
     (operator, 2026-10-12); the palette below follows it */
  top: calc(6px + var(--crt-inset, 0px));
  left: calc(6px + var(--crt-inset, 0px));
  /* the glass ends after the RCI pill (operator): the band is as wide as
     its content, not the screen */
  right: auto;
  width: max-content;
  max-width: calc(100vw - 12px - 2 * var(--crt-inset, 0px));
  display: grid;
  grid-template-columns: max-content max-content auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: calc(8 * var(--px));
  row-gap: calc(2 * var(--px));
  padding: calc(4 * var(--px)) calc(6 * var(--px));
  /* the tool board's dark glass and rims (operator: one look for the band and
     the vertical board) */
  background: rgba(0, 0, 0, 0.55);
  background-clip: padding-box;
  color: #f8f8f8;
  border: 0 solid transparent;
  border-right: 10px solid rgb(46 46 46 / 0.84);
  border-bottom: 10px solid rgba(0, 0, 0, 0.8);
  font-size: max(5px, calc(5 * var(--px)));
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

.play-hud .hud-key {
  color: #b8c878;
  font-size: inherit;
}

/* the words "funds", "date"… are for screen readers; the numbers speak.
   12.16: so are the class and the map number: row 1 is only "1909 DEC" */
.play-hud .hud-row > .hud-key:first-child,
.play-hud .hud-key,
.play-hud .map-row,
.icons-ready .btn-label,
.font-ready .key-tag {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.status-bar {
  display: contents;
}

.band-top,
.hud-buttons,
.foldout {
  display: flex;
  align-items: center;
  gap: calc(3 * var(--px));
  min-width: 0;
}

.band-top {
  grid-column: 1 / 3;
  grid-row: 1;
  gap: calc(6 * var(--px));
}

.hud-buttons {
  grid-column: 1;
  grid-row: 2;
  gap: calc(2 * var(--px));
  flex-wrap: wrap;
}

/* 12.7 people over money right of the window icons: an avatar and a "$"
   drawn in CSS, the number in warm off-white bitmap digits, right aligned
   in seven dotted positions (play-view.js dotNumber). */
.hud-nums {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;  /* operator: left, after the window icons, the pill right after */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(2 * var(--px));
  color: #f8ecd0;
}

.play-hud .num-row {
  display: flex;
  gap: calc(3 * var(--px));
}

.num-row .px-text {
  margin-left: auto;
  color: inherit;
}

.num-icon {
  position: relative;
  flex: none;
  width: calc(7 * var(--px));
  height: calc(13 * var(--px));
}

.num-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--px);
  height: var(--px);
}

.pop-pic::before {
  top: var(--px);
}

.pop-pic::before {
  box-shadow:
    calc(2 * var(--px)) calc(0 * var(--px)),
    calc(3 * var(--px)) calc(0 * var(--px)),
    calc(4 * var(--px)) calc(0 * var(--px)),
    calc(2 * var(--px)) calc(1 * var(--px)),
    calc(3 * var(--px)) calc(1 * var(--px)),
    calc(4 * var(--px)) calc(1 * var(--px)),
    calc(2 * var(--px)) calc(2 * var(--px)),
    calc(3 * var(--px)) calc(2 * var(--px)),
    calc(4 * var(--px)) calc(2 * var(--px)),
    calc(3 * var(--px)) calc(3 * var(--px)),
    calc(1 * var(--px)) calc(4 * var(--px)),
    calc(2 * var(--px)) calc(4 * var(--px)),
    calc(3 * var(--px)) calc(4 * var(--px)),
    calc(4 * var(--px)) calc(4 * var(--px)),
    calc(5 * var(--px)) calc(4 * var(--px)),
    calc(0 * var(--px)) calc(5 * var(--px)),
    calc(2 * var(--px)) calc(5 * var(--px)),
    calc(3 * var(--px)) calc(5 * var(--px)),
    calc(4 * var(--px)) calc(5 * var(--px)),
    calc(6 * var(--px)) calc(5 * var(--px)),
    calc(0 * var(--px)) calc(6 * var(--px)),
    calc(2 * var(--px)) calc(6 * var(--px)),
    calc(3 * var(--px)) calc(6 * var(--px)),
    calc(4 * var(--px)) calc(6 * var(--px)),
    calc(6 * var(--px)) calc(6 * var(--px)),
    calc(2 * var(--px)) calc(7 * var(--px)),
    calc(4 * var(--px)) calc(7 * var(--px)),
    calc(2 * var(--px)) calc(8 * var(--px)),
    calc(4 * var(--px)) calc(8 * var(--px)),
    calc(2 * var(--px)) calc(9 * var(--px)),
    calc(4 * var(--px)) calc(9 * var(--px)),
    calc(1 * var(--px)) calc(10 * var(--px)),
    calc(2 * var(--px)) calc(10 * var(--px)),
    calc(4 * var(--px)) calc(10 * var(--px)),
    calc(5 * var(--px)) calc(10 * var(--px));
}

.dollar-pic::before {
  box-shadow:
    calc(3 * var(--px)) calc(0 * var(--px)),
    calc(1 * var(--px)) calc(1 * var(--px)),
    calc(2 * var(--px)) calc(1 * var(--px)),
    calc(3 * var(--px)) calc(1 * var(--px)),
    calc(4 * var(--px)) calc(1 * var(--px)),
    calc(5 * var(--px)) calc(1 * var(--px)),
    calc(0 * var(--px)) calc(2 * var(--px)),
    calc(1 * var(--px)) calc(2 * var(--px)),
    calc(3 * var(--px)) calc(2 * var(--px)),
    calc(5 * var(--px)) calc(2 * var(--px)),
    calc(6 * var(--px)) calc(2 * var(--px)),
    calc(0 * var(--px)) calc(3 * var(--px)),
    calc(1 * var(--px)) calc(3 * var(--px)),
    calc(3 * var(--px)) calc(3 * var(--px)),
    calc(5 * var(--px)) calc(3 * var(--px)),
    calc(6 * var(--px)) calc(3 * var(--px)),
    calc(0 * var(--px)) calc(4 * var(--px)),
    calc(1 * var(--px)) calc(4 * var(--px)),
    calc(3 * var(--px)) calc(4 * var(--px)),
    calc(0 * var(--px)) calc(5 * var(--px)),
    calc(1 * var(--px)) calc(5 * var(--px)),
    calc(3 * var(--px)) calc(5 * var(--px)),
    calc(1 * var(--px)) calc(6 * var(--px)),
    calc(2 * var(--px)) calc(6 * var(--px)),
    calc(3 * var(--px)) calc(6 * var(--px)),
    calc(4 * var(--px)) calc(6 * var(--px)),
    calc(5 * var(--px)) calc(6 * var(--px)),
    calc(3 * var(--px)) calc(7 * var(--px)),
    calc(5 * var(--px)) calc(7 * var(--px)),
    calc(6 * var(--px)) calc(7 * var(--px)),
    calc(3 * var(--px)) calc(8 * var(--px)),
    calc(5 * var(--px)) calc(8 * var(--px)),
    calc(6 * var(--px)) calc(8 * var(--px)),
    calc(0 * var(--px)) calc(9 * var(--px)),
    calc(1 * var(--px)) calc(9 * var(--px)),
    calc(3 * var(--px)) calc(9 * var(--px)),
    calc(5 * var(--px)) calc(9 * var(--px)),
    calc(6 * var(--px)) calc(9 * var(--px)),
    calc(0 * var(--px)) calc(10 * var(--px)),
    calc(1 * var(--px)) calc(10 * var(--px)),
    calc(3 * var(--px)) calc(10 * var(--px)),
    calc(5 * var(--px)) calc(10 * var(--px)),
    calc(6 * var(--px)) calc(10 * var(--px)),
    calc(1 * var(--px)) calc(11 * var(--px)),
    calc(2 * var(--px)) calc(11 * var(--px)),
    calc(3 * var(--px)) calc(11 * var(--px)),
    calc(4 * var(--px)) calc(11 * var(--px)),
    calc(5 * var(--px)) calc(11 * var(--px)),
    calc(3 * var(--px)) calc(12 * var(--px));
}


.play-hud .rci {
  grid-column: 3;
  grid-row: 1 / 3;
  justify-self: start;
  align-self: center;
  /* a size smaller than the band's unit, with room above and below
     (operator: the pill was too big and too tight) */
  --px: calc(0.75 * var(--hud-px, 2px));
  margin: calc(3 * var(--hud-px, 2px)) 0;
}

/* The green 16 px window cells carry their own bevel on the sheet, so the
   image is the whole button: an integer scale (--win-px, pixel-scale.js)
   that fills the band's 24 px row as nearly as it can, never a fractional
   background-size (operator: the icons did not fill their buttons). */
.icons-ready .hud-buttons .icon-btn.cell16 {
  width: calc(16 * var(--win-px, var(--ipx)));
  height: calc(16 * var(--win-px, var(--ipx)));
  background-size: 100% 100%;
}

/* 12.16: the helicopter is the sheet's green cell once the city has an
   airport; before that its dark cell, darkened further, and inert */
.icons-ready #heli-btn:not(.dim) {
  background-image: var(--icon-on);
}

.icons-ready .hud-buttons .icon-btn.dim {
  filter: brightness(0.6);
  cursor: default;
}

.play-hud .hud-row {
  display: inline-flex;
  align-items: center;
  gap: calc(2 * var(--px));
}

/* 12.9 the band's foldouts (play.js openFold): the five speeds under the
   runner, the windows the SNES band never had under "...". Fixed boxes in
   the band's olive, placed under their button, at the band's scale. */
.foldout {
  --px: var(--hud-px, 2px);
  --ipx: var(--hud-px, 2px);
  position: fixed;
  z-index: 30;
  zoom: var(--menu-scale, 1);
  gap: var(--px);
  padding: calc(2 * var(--px));
  background: #182008;
  border: var(--px) solid #0c1004;
  box-shadow: inset 0 0 0 var(--px) #687828;
}

.foldout[hidden] {
  display: none;
}

.hud-more {
  max-width: calc(100vw - 12px);
  flex-wrap: wrap;
}

.hud-more .hint-btn,
.hud-more .title-btn {
  height: calc(24 * var(--ipx));
  min-width: calc(16 * var(--ipx));
}

.title-btn:not(.icon-btn) {
  display: inline-flex;
  align-items: center;
}

/* "...": a band cell with three bitmap dots */
.more-btn {
  position: relative;
  flex: none;
}

.more-dots {
  display: none;
}

.icons-ready .more-btn {
  width: calc(24 * var(--ipx));
  height: calc(24 * var(--ipx));
  padding: 0;
  background: #00ba00;
  border: 0;
  box-shadow: inset 0 0 0 var(--ipx) #003021;
}

.icons-ready .more-dots {
  display: block;
  position: absolute;
  left: calc(5 * var(--ipx));
  top: calc(11 * var(--ipx));
  width: calc(2 * var(--ipx));
  height: calc(2 * var(--ipx));
  background: #f8f8f8;
  box-shadow: calc(6 * var(--ipx)) 0 #f8f8f8, calc(12 * var(--ipx)) 0 #f8f8f8;
}

.icons-ready .more-btn[aria-expanded="true"] {
  outline: var(--px) solid var(--sheet-on);
  outline-offset: 0;
}

/* "show FPS" (play/fps-counter.js): the frames drawn each second, top right,
   stepped in past the CRT mask like the band; the overlay lies over it */
.fps-box {
  position: fixed;
  top: calc(6px + var(--crt-inset, 0px));
  right: calc(6px + var(--crt-inset, 0px));
  z-index: 30;
  padding: calc(2 * var(--px)) calc(3 * var(--px));
  background: rgba(0, 0, 0, 0.6);
  color: #f8f8f8;
  pointer-events: none;
}
.fps-box[hidden] {
  display: none;
}
.fps-box .px-text {
  display: block;
}
