/* Retro, clean, minimal */
:root {
  --bg: #0b0f14;
  --ink: #e9f0ff;
  --muted: #a7b3c9;
  --panel: #0f1622;
  --border: #2b3951;
  --accent: #7cf7c2;
  --danger: #ff4d6d;

  --game-w: min(760px, 92vw);
  --game-h: 240px;
  --ground-h: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(900px 500px at 50% 10%, #142036 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: "Press Start 2P", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  display: grid;
  place-items: center;
  padding: 24px;
}

#wrap {
  width: var(--game-w);
  display: grid;
  gap: 14px;
}

.title h1 {
  font-size: 22px;
  letter-spacing: 1px;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 3px 6px;
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  background: #0a111b;
}

#game {
  position: relative;
  width: 100%;
  height: var(--game-h);
  border: 4px solid var(--border);
  /* sky, water, sand */
  background: linear-gradient(
    to bottom,
    #87ceeb 0%,
    #87ceeb 60%,
    #0077be 60%,
    #0077be 80%,
    #f2d2a9 80%,
    #f2d2a9 100%
  );
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

/* subtle scanlines */
#game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.06) 1px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0) 6px
  );
  pointer-events: none;
  opacity: 0.22;
}

#hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  z-index: 5;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}

#hud span {
  color: var(--ink);
}

.speed-up {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #c21531;
  border: 2px solid #c21531;
  font-size: 10px;
  letter-spacing: 1px;
  text-shadow: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
  z-index: 150;
}

.speed-up.hidden {
  display: none;
}

#ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ground-h);
  border-top: 4px solid #e0b98a;
  background: linear-gradient(180deg, #f2d2a9 0%, #e6b985 50%, #d49c5d 100%);
}

#character {
  position: absolute;
  left: 60px;
  bottom: calc(var(--ground-h) + 22px);
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  z-index: 100;
}

#character.jump {
  animation: jump 580ms cubic-bezier(0.18, 0.8, 0.2, 1.05);
}

@keyframes jump {
  0% {
    transform: translateY(0);
  }
  42% {
    transform: translateY(-78px);
  }
  58% {
    transform: translateY(-78px);
  }
  100% {
    transform: translateY(0);
  }
}

#block {
  position: absolute;
  bottom: var(--ground-h);
  left: calc(100% + 40px);
  width: 40px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  line-height: 1;
  z-index: 100;
  /* constant obstacle speed */
  animation: cactusMove 1.8s infinite linear;
}

#ship {
  position: absolute;
  top: 65%;
  left: 100%;
  font-size: 50px;
  z-index: 5;
  display: block !important;
  animation: sail 20s linear infinite;
}

@keyframes sail {
  0% {
    left: 100%;
  }
  100% {
    left: -100px;
  }
}

@keyframes cactusMove {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-1 * (var(--game-w) + 140px)));
  }
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
  background: rgba(11, 15, 20, 0.62);
  backdrop-filter: blur(3px);
}

#overlay.hidden {
  display: none;
}

.panel {
  width: min(420px, 90%);
  background: var(--panel);
  border: 4px solid var(--border);
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.35);
}

.gameover {
  color: var(--danger);
  font-size: 16px;
  letter-spacing: 1px;
}

.final {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

button {
  margin-top: 14px;
  font-family: inherit;
  font-size: 12px;
  padding: 10px 12px;
  color: #09111b;
  background: var(--accent);
  border: 0;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.tiny {
  margin-top: 10px;
  font-size: 9px;
  color: var(--muted);
}

.footer {
  color: var(--muted);
  font-size: 10px;
  display: flex;
  justify-content: center;
}

/* Sun & clouds */
#sun {
  position: absolute;
  top: 18px;
  left: 16px;
  font-size: 32px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
  z-index: 1;
}

.cloud {
  position: absolute;
  font-size: 32px;
  color: #f8fbff;
  opacity: 0.9;
  z-index: 1;
  animation-name: cloudDrift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.cloud-1 {
  top: 26px;
  left: 70%;
  animation-duration: 22s;
}

.cloud-2 {
  top: 46px;
  left: 20%;
  animation-duration: 28s;
  animation-delay: -8s;
}

.cloud-3 {
  top: 34px;
  left: 45%;
  animation-duration: 32s;
  animation-delay: -16s;
}

@keyframes cloudDrift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-140%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #block {
    animation: none;
  }
  #character.jump {
    animation: none;
    transform: translateY(-78px);
  }
}

