/* Fill the iframe/page */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: transparent;
  overflow: hidden;
}

/* Stage covers the whole viewport/iframe */
#stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  line-height: 0;
}

/* Canvas stretches to stage; JS sets backing pixel buffer */
#game {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  outline: none;
}

/* HUD sits over the stage */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Desktop hint */
#startMsg {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: system-ui, sans-serif;
  font-size: 18px;
  color: #7d1717;
  background: transparent;
  padding: 8px 14px;
  border-radius: 6px;
}

/* Runner GIF overlay */
#runnerGif {
  position: absolute;
  left: 0; top: 0;
  height: 100px;   /* matches TrexConfig.HEIGHT */
  width: auto;
  pointer-events: none;
  image-rendering: auto;
  transform: translate(0,0);
}

/* Game over UI */
#gameOver {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 20px;
  justify-items: center;
  pointer-events: auto;
}
#gameOverImg { max-width: 30%; height: auto; }
#restartBtn  { width: 45px; height: 45px; cursor: pointer; }

.hidden { display: none !important; }

/* Hide spacebar hint on narrow screens */
@media (max-width: 768px) { #startMsg { display: none; } }

/* Mobile Start/Jump button — in the bottom band we reserve for UI */
#mobile-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); /* sits in reserved bottom space */
  z-index: 10;

  pointer-events: auto;
  border: 0;
  border-radius: 14px;
  padding: 14px 22px;
  font: 700 18px/1 system-ui, sans-serif;
  background: #7d1717;
  color: #fff;
  box-shadow: 0 6px 22px rgba(0,0,0,.18);
}

/* Only show on touch devices; JS still controls visibility with .hidden */
@media (hover:none) and (pointer:coarse){
  #mobile-btn { display: inline-block; }
}
