/* ---- 12.11 header fold-outs (speed.png, option.png, disasters.png,
   information.png, load.save.png) -------------------------------------------
   A dark brown frame hanging under its band button, a black title plate with
   the title in blue-white pixel letters at twice the band's scale, then rows
   of tiles: the sheet's lavender / grey-green cells with picture and blue
   caption, text tiles in the same colours. The hovered tile turns the sheet's
   yellow (the icon's .on cell); a toggle (data-keep) keeps its on/off colour
   and gets a yellow rim instead. */
.foldout {
  flex-direction: column;
  align-items: center;
  gap: calc(3 * var(--px));
  padding: calc(4 * var(--px)) calc(6 * var(--px)) calc(6 * var(--px));
  background: #4a3418;
  border: var(--px) solid #1c1008;
  box-shadow: inset 0 0 0 var(--px) #7a5830, inset calc(-2 * var(--px)) calc(-2 * var(--px)) 0 #2c1c0c, calc(2 * var(--px)) calc(2 * var(--px)) 0 rgba(0, 0, 0, 0.45);
}

.fold-title {
  --px: calc(2 * var(--hud-px, 2px));
  display: flex;
  justify-content: center;
  align-self: stretch;
  padding: var(--hud-px, 2px) calc(4 * var(--hud-px, 2px));
  color: #c8d0f8;
  background: #000;
  border-bottom: var(--hud-px, 2px) solid #d8d8f0;
  font-size: max(10px, calc(5 * var(--hud-px, 2px)));
  font-weight: bold;
  letter-spacing: 0.1em;
}

.fold-title .px-text {
  filter: drop-shadow(0 var(--hud-px, 2px) 0 #4858b8);
}

.fold-tiles {
  display: flex;
  justify-content: center;
  gap: 0;
}

.fold-tiles.grid3 {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-items: center;
}

.foldout .text-tile {
  min-width: calc(24 * var(--ipx));
  height: calc(24 * var(--ipx));
  padding: 0 calc(3 * var(--ipx));
  color: #000098;
  background: #a8a8d0;
  border: 0;
  box-shadow: inset 0 0 0 var(--ipx) #505078;
  font: bold max(9px, calc(5 * var(--ipx))) / 1 monospace;
}

.foldout .text-tile[aria-pressed="true"],
.foldout .text-tile:hover:not(:disabled) {
  background: #f8d070;
}

.foldout .text-tile:disabled {
  opacity: 0.5;
}

.icons-ready .foldout .icon-btn:hover:not(:disabled):not([data-keep]) {
  background: var(--icon-on) 0 0 / 100% 100% no-repeat;
}

.icons-ready .foldout .icon-btn[data-keep]:hover {
  outline: var(--ipx) solid #f8d070;
  outline-offset: calc(-1 * var(--ipx));
}

/* the PRESENT tiles show their "?" until earned: not faded, just inert */
.icons-ready .foldout [data-present]:disabled {
  opacity: 1;
}

.icons-ready .foldout [data-present].earned {
  outline: var(--ipx) solid #f8d070;
  outline-offset: calc(-1 * var(--ipx));
}

/* the magnifier and helicopter (12.12) are on the band but do nothing yet */
.icons-ready .hud-buttons [aria-disabled="true"] {
  cursor: default;
}

/* Dr. Wright's advice (will wright.png): the message window's lavender frame
   round the sky-and-meadow canvas, the pager under it. */
.advice-window {
  cursor: default;
}

.advice-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: calc(3 * var(--px));
  margin-top: calc(2 * var(--px));
  color: #181840;
  font-size: max(10px, calc(5 * var(--px)));
}

/* 12.14 the manual window: the map window's frame round an iframe of
   /manual.html, as large as the play area allows. */
.manual-window {
  width: min(46rem, calc(100vw - 12px));
  height: min(40rem, calc(100vh - 24px));
}

.manual-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: var(--px) solid #383868;
  background: #f8f0d8;
}

/* 12.14: without the bitmap font the title's MANUAL line is page text. */
.menu-line.plain {
  color: #f8f8c8;
  font-size: calc(10 * var(--tk, 2px));
  text-align: left;
  padding-left: calc(16 * var(--tk, 2px));
}

/* 12.12 palette tiles (operator): the board lavender is a CSS background
   behind a keyed icon (icons.js BOARD_CLEAR), one native pixel round it; the
   selected tool's tile is a solid yellow square, not a recoloured sprite. */
.icons-ready .palette .tool.icon-btn {
  width: calc(18 * var(--ipx));
  height: calc(18 * var(--ipx));
  /* the 14×15 picture sits at (1, 1) of the 18×18 tile, where the sheet's own cell put it */
  background: var(--icon) var(--ipx) var(--ipx) / calc(var(--iw) * var(--ipx)) calc(var(--ih) * var(--ipx)) no-repeat, #adaad6;
}

.icons-ready .palette .tool.icon-btn[aria-pressed="true"] {
  background: var(--icon-on) var(--ipx) var(--ipx) / calc(var(--iw) * var(--ipx)) calc(var(--ih) * var(--ipx)) no-repeat, var(--sheet-on);
}

/* the "?": grey until a present is earned, yellow while one waits */
.palette .gift-tile {
  width: calc(18 * var(--ipx));
  height: calc(18 * var(--ipx));
  padding: 0;
  border: 0;
  background: #707090;
  color: #a8a8c8;
  font: bold calc(14 * var(--ipx)) / 1 monospace;
}

.palette .gift-tile.pending {
  background: #f8f800;
  color: #000;
}

.palette .gift-tile[aria-pressed="true"] {
  background: var(--sheet-on);
  color: #000;
}

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

.magnifier {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.magnifier[hidden],
.heli-arrow[hidden],
.heli-card[hidden],
.gift-fold[hidden] {
  display: none;
}

.heli-arrow {
  position: fixed;
  z-index: 8;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #f8d8c8;
  background: #b05040;
  border: 3px solid #401010;
  font-size: 22px;
  line-height: 1;
}

.heli-arrow[data-heli="up"] { left: 50%; top: calc(var(--strip-h, 28px) + 24px); transform: translateX(-50%); }
.heli-arrow[data-heli="down"] { left: 50%; bottom: 24px; transform: translateX(-50%); }
.heli-arrow[data-heli="left"] { left: 30%; top: 50%; transform: translateY(-50%); }
.heli-arrow[data-heli="right"] { right: 24px; top: 50%; transform: translateY(-50%); }

.heli-card {
  position: fixed;
  z-index: 9;
  right: 12px;
  top: calc(var(--strip-h, 28px) + 18px);
  padding: 4px 6px 6px;
  color: #181840;
  background: #c8c8e8;
  border: 3px solid #484878;
  font: bold 14px monospace;
}

.heli-mini {
  display: block;
  width: 144px;
  height: auto;
  margin-top: 4px;
  image-rendering: pixelated;
  border: 2px solid #6868a0;
}

.gift-fold {
  --px: var(--hud-px, 2px);
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
  padding: calc(2 * var(--px));
  background: #4a3418;
  border: var(--px) solid #0c1004;
}

.gift-cards {
  display: flex;
  flex-wrap: wrap;
  gap: calc(3 * var(--px));
  padding-top: calc(2 * var(--px));
}

.play-page .gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(2 * var(--px));
  padding: calc(3 * var(--px));
  color: #1838c8;
  background: #f8f8f8;
  border: calc(2 * var(--px)) solid #c8a858;
  font-weight: bold;
}

.gift-card canvas {
  width: calc(48 * var(--px));
  height: auto;
  image-rendering: pixelated;
}

/* 13.11: the HISTORY window (history-panel.js), newest event first */
.history-rows { margin: 0; padding: 0 0 0 4px; list-style: none; max-height: 60vh; overflow-y: auto; }
.history-row, .history-empty { padding: 2px 0; }
.history-when { font-weight: bold; margin-right: 6px; }

/* 13.15: the LOAD/SAVE window (slots-panel.js), two named slots and the autosave */
.slots-rows { margin: 0; padding: 0 0 0 4px; list-style: none; }
.slot-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.slot-no { font-weight: bold; width: 1.2em; }
.slot-name { width: 9ch; font: inherit; text-transform: uppercase; }
.slot-card { flex: 1; white-space: nowrap; }
