body {
  margin: 0;
  overflow: hidden;
  background: #0b1020;
  font-family: 'DotGothic16', monospace;
  touch-action: none;
}

.screen {
  position: relative;
  width: 100vw;
  height: 100svh;
  overflow: hidden;

  background:
    linear-gradient(
      to bottom,
      #071022 0%,
      #102142 55%,
      #172a44 100%
    );
}

.hidden {
  display: none !important;
}

/* TITLE */

#titleScreen {
  display: flex;
  flex-direction: column;
  align-items: center;

  padding-top: 34px;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 8vh);

  box-sizing: border-box;
}

.title-image {
  width: min(92vw, 720px);

  max-height: 52svh;

  object-fit: contain;

  image-rendering: pixelated;
}

.title-desc {
  margin-top: 18px;

  color: #ffffff;

  text-align: center;

  font-size: clamp(18px, 4vw, 24px);

  line-height: 1.8;

  text-shadow: 2px 2px #000;
}

.start-text {
  margin-top: auto;

  color: #ffe071;

  font-size: clamp(20px, 5vw, 32px);

  text-align: center;

  animation: blink 1s steps(2, start) infinite;

  text-shadow: 2px 2px #000;

  cursor: pointer;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* GAME */

#gameScreen {
  background: #071022;
}

/* ROAD */

#road {
  position: absolute;
  inset: 0;

  height: 200%;

  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 72px,
      rgba(255, 255, 255, 0.05) 72px,
      rgba(255, 255, 255, 0.05) 76px,
      transparent 76px,
      transparent 144px
    ),

    linear-gradient(
      to right,
      #071022 0%,
      #071022 20%,
      #9a9a96 20%,
      #9a9a96 80%,
      #071022 80%,
      #071022 100%
    );

  animation: roadScroll 0.38s linear infinite;
}

#road::after {
  content: "";

  position: absolute;

  left: 20%;
  right: 20%;
  top: 0;
  bottom: 0;

  border-left: 4px solid rgba(255,255,255,0.18);
  border-right: 4px solid rgba(255,255,255,0.18);

  pointer-events: none;
}

@keyframes roadScroll {
  from {
    transform: translateY(-144px);
  }

  to {
    transform: translateY(0);
  }
}

/* BACK BUTTON */

#backButton {
  position: absolute;

  top: calc(env(safe-area-inset-top) + 10px);
  right: 10px;

  z-index: 50;

  padding: 8px 14px;

  border: none;
  border-radius: 10px;

  background: rgba(255,255,255,0.92);

  color: #0b1020;

  font-family: inherit;

  font-size: 14px;

  cursor: pointer;
}

/* PLAYER */

#player {
  position: absolute;

  bottom: calc(env(safe-area-inset-bottom) + 86px);
  left: 50%;

  width: 108px;

  transform: translateX(-50%);

  image-rendering: pixelated;

  z-index: 20;
}

/* OBJECT */

.object {
  position: absolute;

  image-rendering: pixelated;

  z-index: 15;

  transform: translateX(-50%);
}

.float-text {
  position: absolute;

  z-index: 40;

  color: #9dd9ff;

  font-size: 24px;

  text-shadow: 2px 2px #000;

  pointer-events: none;

  animation: floatUp 0.8s ease-out forwards;
}

.damage-text {
  color: #ff7777;
}

@keyframes floatUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-34px);
  }
}

/* UI */

.bottom-ui {
  position: absolute;

  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 10px);

  z-index: 35;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 8px;

  padding: 8px 10px;

  box-sizing: border-box;

  background: rgba(0,0,0,0.52);

  border: 3px solid rgba(255,255,255,0.32);

  border-radius: 10px;

  color: #ffffff;

  font-size: clamp(15px, 4vw, 20px);

  text-shadow: 2px 2px #000;
}

#distance {
  color: #ffe071;
}

/* RESULT */

#resultScreen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  padding: 20px;

  box-sizing: border-box;

  text-align: center;
}

#resultCharacter {
  width: 180px;

  image-rendering: pixelated;
}

#resultTitle {
  margin-top: 10px;

  color: #ffe071;

  font-size: clamp(40px, 9vw, 58px);

  text-shadow: 3px 3px #000;
}

#resultText {
  margin-top: 16px;

  color: #ffffff;

  font-size: clamp(24px, 5vw, 32px);

  text-shadow: 2px 2px #000;
}

#resultStats {
  margin-top: 18px;

  color: #ffffff;

  font-size: clamp(20px, 4.8vw, 28px);

  line-height: 1.9;

  text-shadow: 2px 2px #000;
}

.result-buttons {
  display: flex;
  flex-direction: column;

  gap: 12px;

  width: min(82vw, 320px);

  margin-top: 28px;
}

.result-buttons button {
  padding: 14px;

  border: none;
  border-radius: 12px;

  background: #ffffff;

  color: #0b1020;

  font-family: inherit;

  font-size: 20px;

  cursor: pointer;
}

/* SMALL */

@media (max-height: 720px) {

  .title-image {
    max-height: 46svh;
  }

  .title-desc {
    line-height: 1.6;
  }

  #player {
    width: 98px;
  }

  #resultCharacter {
    width: 150px;
  }

  #resultStats {
    line-height: 1.6;
  }

}