/* ---- Title page boards (12.5): wood, at the title's whole scale --tk ---- */
.map-select,
.naming,
.scenario-cards {
  --bk: min(var(--tk, 2px), calc(100vw / 260), calc((100vh - 2.5rem) / 226));
}

.map-select,
.scenario-bonus {
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(13 * var(--bk)), rgba(0, 0, 0, 0.16) calc(13 * var(--bk)) calc(14 * var(--bk)), transparent calc(14 * var(--bk)) calc(37 * var(--bk))),
    repeating-linear-gradient(0deg, #5a2a12 0 calc(3 * var(--bk)), #6c3618 calc(3 * var(--bk)) calc(8 * var(--bk)), #4a200c calc(8 * var(--bk)) calc(10 * var(--bk)), #643016 calc(10 * var(--bk)) calc(15 * var(--bk)));
}

.title-word {
  position: fixed;
  top: 0.5rem;
  left: 0;
  right: 0;
  z-index: 9;
  text-align: center;
  pointer-events: none;
}

body[data-title="sheet"] .title-word {
  display: none;
}

/* MAP SELECT (12.5 fix): the sheet's own screen, misc-creating-new-city.png,
 * drawn 256×224 on .ms-board by map-board.js at the board scale --bk; every
 * control is laid over its picture at the measured board rectangle (set
 * inline by map-board.js), transparent, so the sheet shows through. */
#title.map-select {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: calc(256 * var(--bk));
  height: calc(224 * var(--bk));
  padding: 0;
  pointer-events: auto;
  text-align: left;
  border: 0;
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: bold;
  color: #202020;
}

body[data-title] #title.map-select {
  border: 0;
}

.ms-board {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Read aloud, never shown: the words the sheet already draws. */
.ms-sr,
.ms-mode input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ms-crt,
.ms-wait {
  position: absolute;
  display: block;
  z-index: 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}

.ms-wait { z-index: 2; }
.ms-wait[hidden] { display: none; }

/* Group boxes sit at the board's origin so their children use board coordinates. */
.ms-counter,
.ms-mode {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

#title.map-select .ms-key,
#title.map-select .ms-tri {
  position: absolute;
  z-index: 3;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 1px;
  color: transparent;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  transition: none;
  outline: none;
  cursor: var(--hand, pointer);
  pointer-events: auto;
}

.ms-mode .ms-key span { display: none; }

/* A pressed key sinks, as on the naming board; focus is a thin blue ring. */
#title.map-select .ms-key:active,
#title.map-select .ms-tri:active {
  background: rgba(48, 48, 32, 0.28);
  box-shadow: inset 0 calc(2 * var(--bk)) 0 rgba(48, 48, 32, 0.45);
}

#title.map-select .ms-key:focus-visible,
#title.map-select .ms-tri:focus-visible,
#title.map-select .ms-mode .ms-key:has(input:focus-visible),
#title.map-select #map-no:focus-visible {
  outline: calc(1 * var(--bk)) solid #2848b8;
  outline-offset: calc(1 * var(--bk));
}

/* The odometer: a strip of the sheet's digits behind each black window. */
.ms-reel {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  background: #000;
}

.ms-reel canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  will-change: transform;
}

/* The number field lies over the windows: it takes typing, the reels show it. */
#title.map-select #map-no {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font: bold calc(8 * var(--bk)) / 1 monospace;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  pointer-events: auto;
}

/* Without the sheet: plain keys and a visible number on the wood. */
#title.map-select.no-sheet .ms-key,
#title.map-select.no-sheet .ms-tri {
  font: bold calc(5 * var(--bk)) / 1 monospace;
  color: #282828;
  background: #c8c8a8;
  border: calc(1 * var(--bk)) solid #484828;
}

#title.map-select.no-sheet .ms-mode .ms-key span { display: inline; }
#title.map-select.no-sheet .ms-mode .ms-key:has(input:checked) { color: #f8f8f8; background: #989878; }

#title.map-select.no-sheet #map-no {
  color: #f8f8f8;
  caret-color: #f8f8f8;
  background: #101010;
}

.ms-extra {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding-top: 0.25rem;
  font: 0.7rem/1.3 system-ui, sans-serif;
  color: #f0e0c8;
  pointer-events: auto;
}

.ms-extra .hint {
  margin: 0;
}

/* 13.0: RULES: SNES / 1989, a plain line in the title's extras row. */
.ms-rules {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.ms-rules legend {
  float: left;
  padding: 0;
  font-weight: 600;
}
.ms-rules label {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  cursor: var(--hand, pointer);
}

/* SELECT SCENARIO: simcity_ui_scenarios.png. The board is the sheet's own;
   each postcard link carries the green frame when chosen. */
#scenario-cards.scenario-cards {
  inset: 0;
  align-items: center;
  align-content: center;
  gap: calc(4 * var(--bk));
  max-height: none;
  background: rgba(0, 0, 0, 0.35);
}

.scenario-board {
  position: relative;
  width: calc(256 * var(--bk));
  height: calc(222 * var(--bk));
}

.scenario-board canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.scenario-board .scenario-card {
  position: absolute;
  display: block;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: calc(1 * var(--bk)) solid transparent;
}

.scenario-card:focus,
.scenario-card:hover {
  outline: none;
  border-color: #48e048;
  box-shadow: 0 0 0 calc(1 * var(--bk)) #188818;
}

.scenario-board .scenario-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.scenario-bonus {
  display: flex;
  flex-direction: column;
  gap: calc(10 * var(--bk));
  padding: calc(10 * var(--bk)) calc(8 * var(--bk));
}

.scenario-bonus:empty {
  display: none;
}

.scenario-card.postcard {
  position: relative;
  width: calc(64 * var(--bk));
  height: calc(72 * var(--bk));
  min-width: 0;
  box-sizing: border-box;
  padding: calc(39 * var(--bk)) calc(2 * var(--bk)) calc(2 * var(--bk));
  justify-content: space-between;
  gap: 0;
  color: #707068;
  background: #e8e8c8;
  border: calc(1 * var(--bk)) solid #909088;
  box-shadow: calc(1 * var(--bk)) calc(1 * var(--bk)) 0 #381008;
}

.scenario-card.postcard::before {
  content: "";
  position: absolute;
  top: calc(-3 * var(--bk));
  left: 50%;
  width: calc(4 * var(--bk));
  height: calc(4 * var(--bk));
  transform: translateX(-50%);
  border-radius: 50%;
  background: #e0d020;
}

/* 13.13: Las Vegas and Freeland before six scenario wins. */
.scenario-card.postcard.locked {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.6;
}

.scenario-card.postcard + .postcard::before {
  background: #e04040;
}

/* The bonus postcard's picture: the start city drawn small over the whole
   64×72 paper (title-screen.js postcardLayout); the captions sit under it,
   name then year, where the sheet's postcards print theirs. */
.scenario-card.postcard .postcard-pic {
  position: absolute;
  top: calc(-1 * var(--bk));
  left: calc(-1 * var(--bk));
  width: calc(64 * var(--bk));
  height: calc(72 * var(--bk));
  image-rendering: pixelated;
}

.postcard-name {
  position: relative;
  order: -1;
  font: bold calc(6 * var(--bk)) / 1.1 "Courier New", ui-monospace, monospace;
  text-align: center;
  color: #707068;
}

/* The chosen scenario's scroll card (sheet card or lettered blank scroll). */
.scenario-scroll {
  order: 2;
  width: calc(256 * var(--bk));
  height: calc(222 * var(--bk));
  image-rendering: pixelated;
}

.scenario-scroll[hidden] {
  display: none;
}

.postcard-year {
  position: relative;
  font: italic bold calc(9 * var(--bk)) / 1 Georgia, "Times New Roman", serif;
  color: #707068;
}

#scenario-back {
  order: 3;
  align-self: center;
}

/* style.css styles #title, #start-btn and #map-no by id; the board's own
   look needs the id too (12.5, seen in the shot). */
body[data-title] #title.map-select {
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(13 * var(--bk)), rgba(0, 0, 0, 0.16) calc(13 * var(--bk)) calc(14 * var(--bk)), transparent calc(14 * var(--bk)) calc(37 * var(--bk))),
    repeating-linear-gradient(0deg, #5a2a12 0 calc(3 * var(--bk)), #6c3618 calc(3 * var(--bk)) calc(8 * var(--bk)), #4a200c calc(8 * var(--bk)) calc(10 * var(--bk)), #643016 calc(10 * var(--bk)) calc(15 * var(--bk)));
  box-shadow: none;
  border-radius: 0;
}

/* ---- Creating a new city (12.13): the keyboard computer, one SNES screen
 * from misc-creating-new-city.png at the MAP SELECT scale --bk, over it. */
.naming {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  width: calc(256 * var(--bk));
  height: calc(224 * var(--bk));
}
.naming[hidden] { display: none; }
/* the phone keyboard's field over the LCD (naming.js): touch.css shows it on
   a coarse pointer only; a mouse and a keyboard use the board */
.naming .naming-input { display: none; }
.naming canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.naming .nk,
.naming .nl,
.naming .nc {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 1px;
  cursor: var(--hand, pointer);
  outline: none;
}
.naming .nl[hidden],
.naming .nc[hidden] { display: none; }
/* A held key sinks: its face darkens and the top edge shadows over. */
.naming .nk.down {
  background: rgba(48, 48, 32, 0.28);
  box-shadow: inset 0 calc(2 * var(--bk)) 0 rgba(48, 48, 32, 0.45);
}
/* The LCD's words as text: read aloud always, shown only without the font. */
.naming .naming-lcd {
  position: absolute;
  left: calc(59 * var(--bk));
  top: calc(40 * var(--bk));
  width: calc(138 * var(--bk));
  height: calc(46 * var(--bk));
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  color: #0000d8;
  font: bold calc(6 * var(--bk)) / 1.2 monospace;
}
.naming.no-font .naming-lcd {
  clip-path: none;
  background: #a8a8a8;
  padding: calc(2 * var(--bk));
  box-sizing: border-box;
}
