@font-face {
  font-family: "Silkscreen";
  src: url("/games/Silkscreen-Regular.ttf") format("truetype");
  font-display: block;
}

:root {
  --u: 2px; /* one internal pixel; set to the integer game scale by game.js */
  --K: #020a14;
  --n1: #04142a;
  --n3: #0b2e55;
  --c2: #19c3ef;
  --c3: #7fe8ff;
  --c4: #d4f8ff;
  --W: #f4fbff;
  --g1: #a9bccb;
  --g2: #6c8296;
  --y1: #ffe14d;
  --gr1: #4fe36a;
  --r1: #ff3d4f;
  --m2: #43e0c1;
  --n4: #12406e;
  --n5: #1b5a8c;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--K);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--K);
  font-family: "Silkscreen", monospace;
  color: var(--W);
  font-size: calc(var(--u) * 8);
  line-height: calc(var(--u) * 8);
}

#loading[hidden] {
  display: none;
}

.stage {
  position: relative;
  width: calc(var(--u) * 320);
  height: calc(var(--u) * 180);
  overflow: hidden;
  background: url("sky.png") 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}

.stage p {
  margin: 0;
}

.kicker,
.headline {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
}

.kicker {
  top: calc(var(--u) * 14);
  color: var(--c3);
}

.headline {
  top: calc(var(--u) * 28);
  font-size: calc(var(--u) * 16);
  line-height: calc(var(--u) * 16);
  text-shadow: 0 calc(var(--u) * 2) 0 var(--K);
}

.runner {
  position: absolute;
  left: calc(var(--u) * 136);
  top: calc(var(--u) * 58);
  width: calc(var(--u) * 48);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monkey {
  width: calc(var(--u) * 24);
  height: calc(var(--u) * 24);
  overflow: hidden;
}

.strip {
  width: calc(var(--u) * 144);
  height: calc(var(--u) * 24);
  background: url("run.png") 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
  animation: run 0.42s steps(6) infinite;
}

@keyframes run {
  to {
    transform: translateX(calc(var(--u) * -144));
  }
}

/* Three rack-top tiles: rack_top_l, _m, _r are the first 48 px of the tileset. */
.racks {
  width: calc(var(--u) * 48);
  height: calc(var(--u) * 12);
  background: url("tileset.png") 0 0 / calc(var(--u) * 160) calc(var(--u) * 16) no-repeat;
  image-rendering: pixelated;
}

.bar {
  position: absolute;
  left: calc(var(--u) * 60);
  top: calc(var(--u) * 104);
  width: calc(var(--u) * 200);
  height: calc(var(--u) * 10);
  box-sizing: border-box;
  border: var(--u) solid var(--c3);
  background: var(--K);
  padding: var(--u);
  display: flex;
  gap: var(--u);
}

.bar span {
  flex: 1;
  background: var(--n3);
}

.bar span.on {
  background: var(--c2);
}

.bar span.head {
  background: var(--c4);
}

.status,
.log > div {
  position: absolute;
  left: calc(var(--u) * 60);
  width: calc(var(--u) * 200);
  display: flex;
  justify-content: space-between;
}

.status {
  top: calc(var(--u) * 118);
  color: var(--g1);
}

#pct {
  color: var(--W);
}

.log > div:nth-child(1) {
  top: calc(var(--u) * 136);
}

.log > div:nth-child(2) {
  top: calc(var(--u) * 146);
}

.log > div:nth-child(3) {
  top: calc(var(--u) * 156);
}

.dim {
  color: var(--g2);
}

.ok {
  color: var(--gr1);
}

.pending {
  color: var(--y1);
}

.failed {
  color: var(--r1);
}

/* Incident report shown when a boot stage fails (same grammar as the game-over
   report, DESIGN.md §9): panel (40, 18) 240x144, W border, r1 band. */
.report {
  position: absolute;
  left: calc(var(--u) * 40);
  top: calc(var(--u) * 18);
  width: calc(var(--u) * 240);
  height: calc(var(--u) * 144);
  box-sizing: border-box;
  border: var(--u) solid var(--W);
  background: var(--n1);
}

.report[hidden],
#progress[hidden] {
  display: none;
}

.report p {
  position: absolute;
  left: calc(var(--u) * 6);
  width: calc(var(--u) * 226);
  margin: 0;
  overflow: hidden;
}

.band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: calc(var(--u) * 13);
  padding: 0 calc(var(--u) * 3) 0 calc(var(--u) * 5);
  background: var(--r1);
  color: var(--K);
}

.sev {
  background: var(--K);
  color: var(--r1);
  padding: 0 calc(var(--u) * 3);
  line-height: calc(var(--u) * 9);
}

.label {
  color: var(--g2);
}

.r-cause {
  top: calc(var(--u) * 19);
}

.cause {
  top: calc(var(--u) * 29);
  color: var(--r1);
}

.r-action {
  top: calc(var(--u) * 45);
}

.action {
  top: calc(var(--u) * 55);
  color: var(--m2);
}

.detail {
  top: calc(var(--u) * 71);
  height: calc(var(--u) * 32);
  color: var(--g1);
  word-break: break-word;
}

.rule {
  position: absolute;
  left: calc(var(--u) * 6);
  top: calc(var(--u) * 108);
  width: calc(var(--u) * 226);
  height: var(--u);
  background: var(--n4);
}

.btn {
  position: absolute;
  top: calc(var(--u) * 116);
  height: calc(var(--u) * 18);
  box-sizing: border-box;
  border: var(--u) solid var(--n5);
  border-radius: 0;
  background: var(--n1);
  color: var(--W);
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.btn.primary {
  left: calc(var(--u) * 6);
  width: calc(var(--u) * 64);
  border-color: var(--y1);
  background: var(--y1);
  color: var(--K);
}

#leave {
  left: calc(var(--u) * 76);
  width: calc(var(--u) * 100);
}

.btn:focus-visible {
  outline: var(--u) solid var(--c3);
  outline-offset: var(--u);
}

.cursor {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .strip,
  .cursor {
    animation: none;
  }
}

.noscript {
  color: var(--W);
  font-family: monospace;
  padding: 16px;
}

/* The hidden field that opens a phone's keyboard for the initials (game.js).
   Not display:none or visibility:hidden, which cannot take focus; 16 px text so
   iOS does not zoom in when it does. */
.kbd { position: fixed; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.kbd input { font-size: 16px; width: 1px; height: 1px; padding: 0; border: 0; }
