:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #d8f2ff;
  color: #173047;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 214, 105, 0.55), transparent 18rem),
    linear-gradient(180deg, #b7e9ff 0%, #d8f2ff 48%, #f6d18c 100%);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-shell {
  width: min(100vw, 1040px);
  padding: 16px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
  gap: 10px;
  margin-bottom: 10px;
}

.hud div,
.hud button,
.touch button {
  border: 1px solid rgba(23, 48, 71, 0.14);
  background: rgba(255, 252, 235, 0.88);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(23, 48, 71, 0.08);
}

.hud div {
  min-height: 48px;
  padding: 7px 12px;
}

.hud span {
  display: block;
  color: #58728a;
  font-size: 0.72rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.2;
}

button {
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

#restart {
  min-height: 48px;
  font-size: 1.35rem;
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100dvh - 190px);
  border: 1px solid rgba(23, 48, 71, 0.16);
  border-radius: 8px;
  background: #9ddfff;
  box-shadow: 0 24px 80px rgba(23, 48, 71, 0.18);
  touch-action: none;
}

.touch {
  display: none;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  margin-top: 10px;
  padding-bottom: var(--safe-bottom);
}

.touch button {
  min-height: 64px;
  font-size: 1.35rem;
  touch-action: none;
}

.touch-move {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.jump-button {
  background: #173047;
  color: #fffceb;
}

@media (max-width: 760px) {
  body {
    place-items: start center;
  }

  .game-shell {
    padding: 10px;
    display: grid;
    grid-template-rows: auto minmax(0, auto) auto;
    min-height: 100dvh;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
    gap: 6px;
  }

  .hud div {
    min-height: 44px;
    padding: 6px 8px;
  }

  .hud span {
    font-size: 0.62rem;
  }

  .hud strong {
    font-size: 1rem;
  }

  .touch {
    display: grid;
  }
}

@media (max-width: 520px) {
  .game-shell {
    padding: 8px;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 42px;
  }

  #restart {
    min-height: 42px;
    font-size: 1rem;
  }

  #game {
    max-height: calc(100dvh - 168px);
  }

  .touch {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
  }

  .touch-move {
    gap: 8px;
  }

  .touch button {
    min-height: 58px;
  }
}

@media (pointer: coarse) and (min-width: 761px) {
  .touch {
    display: grid;
  }
}
