:root {
  --game-bg: #f4f4f0;
  --game-ink: #171817;
  --game-muted: #5f635d;
  --game-line: #d6d7d1;
  --game-mono: "IBM Plex Mono", ui-monospace, monospace;
  --game-sans: "Space Grotesk", system-ui, sans-serif;
}

.page-offline {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--game-bg);
  color: var(--game-ink);
  font-family: var(--game-sans);
}

.page-offline button,
.page-offline a {
  color: inherit;
}

.page-offline :focus-visible {
  outline: 2px solid var(--game-ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 4rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--game-line);
  font: 500 .68rem var(--game-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.game-topbar > p {
  margin: 0;
}

.game-topbar__actions {
  justify-self: end;
}

.game-back,
.game-icon-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2.75rem;
  padding: .5rem .7rem;
  border: 0;
  background: transparent;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.game-icon-button span {
  font-size: .9rem;
}

.game-icon-button b {
  font: inherit;
}

.escape-main {
  width: min(68rem, calc(100% - 2rem));
  min-height: calc(100svh - 4rem);
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 5rem) 0;
}

.escape-console {
  width: 100%;
}

.game-frame {
  position: relative;
  min-height: 20rem;
  display: grid;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--game-line);
  background: #fff;
}

.trex-game {
  position: relative;
  width: 100%;
  padding: 0 clamp(.5rem, 3vw, 2rem);
}

.runner-container {
  width: 100% !important;
  outline-offset: 5px;
}

.runner-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  image-rendering: pixelated;
  filter: grayscale(1) contrast(1.05);
}

.game-prompt {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  margin: 0;
  color: var(--game-muted);
  font: 500 .62rem var(--game-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: .5rem;
  padding-top: .75rem;
}

.game-controls button {
  min-width: 7rem;
  min-height: 2.75rem;
  border: 1px solid var(--game-line);
  border-radius: .25rem;
  background: transparent;
  color: var(--game-muted);
  font: 500 .65rem var(--game-mono);
  text-transform: uppercase;
  cursor: pointer;
}

.game-controls button:hover,
.game-controls button:focus-visible {
  border-color: var(--game-ink);
  color: var(--game-ink);
}

.game-controls__jump {
  border-color: var(--game-ink) !important;
  background: var(--game-ink) !important;
  color: var(--game-bg) !important;
}

.game-noscript {
  width: min(42rem, calc(100% - 2rem));
  margin: 2rem auto;
  padding: 1rem;
  border: 1px solid var(--game-line);
}

@media (max-width: 640px) {
  .game-topbar {
    grid-template-columns: 1fr auto;
    min-height: 3.5rem;
    padding: 0 .5rem;
  }

  .game-topbar > p {
    display: none;
  }

  .game-icon-button b {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
  }

  .escape-main {
    width: 100%;
    min-height: calc(100svh - 3.5rem);
    padding: 1rem 0;
  }

  .game-frame {
    min-height: 17rem;
    border-right: 0;
    border-left: 0;
  }

  .trex-game {
    padding: 0 .25rem;
  }

  .game-prompt {
    bottom: 1rem;
    font-size: .56rem;
  }

  .game-controls {
    padding: .65rem .5rem 0;
  }

  .game-controls button {
    min-width: 0;
    min-height: 3rem;
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .runner-canvas {
    filter: grayscale(1);
  }
}

@media (forced-colors: active) {
  .game-frame,
  .game-controls button {
    border: 1px solid CanvasText;
  }

  .game-controls__jump {
    forced-color-adjust: none;
    background: Highlight !important;
    color: HighlightText !important;
  }
}
