@media screen and (max-width: 500px) {
  :root {
    --tiles-per-row: 4;
    --tile-size: 22vw;
    --tile-margin: 2vw;
    --tile-font-size: calc(var(--tile-size) / 2);
    --board-size: calc(var(--tile-margin) + var(--tiles-per-row) * (var(--tile-margin) + var(--tile-size)));
    --font-size: 20px;
  }
}

@media screen and (min-width: 501px) {
  :root {
    --tiles-per-row: 4;
    --tile-size: 100px;
    --tile-margin: 10px;
    --tile-font-size: calc(var(--tile-size) / 2);
    --board-size: calc(var(--tile-margin) + var(--tiles-per-row) * (var(--tile-margin) + var(--tile-size)));
    --font-size: large;
  }
}

html {
  overscroll-behavior: none;
}

body {
  font-family: "Open Sans", Roboto, Arial, sans-serif;
  font-size: font-size;
  overscroll-behavior: none;
}

h1 {
  position: absolute;
  top: 0;
  margin: 0;
  font-size: 50px;
}

#full-window {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  flex-direction: column;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#game-over {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  flex-direction: column;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: white;
}

#game-over * {
  position: relative;
  margin: 10px;
}

.links * {
  color: white;
  text-decoration: none;
}

.links *:hover {
  text-decoration: underline;
  cursor: pointer;
}

#stats {
  position: relative;
  width: var(--board-size);
  margin: 5px;
  font-weight: bold;
}

#score {
  float: left;
  margin-left: 5px;
}

#high-score {
  float: right;
  margin-right: 5px;
}

#board-container {
  position: relative;
}

#board {
  width: var(--board-size);
  height: var(--board-size);
  border-radius: 10px;
  user-select: none;
}

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  line-height: var(--tile-size);
  text-align: center;
  font-size: var(--tile-font-size);
  position: absolute;
  border-radius: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
  opacity: 1;
}

.fade-out {
  animation: fadeOut 0.2s ease-in-out;
  opacity: 0;
}

.animated-move {
  position: absolute;
  transition:
    left 0.3s ease-in-out,
    top 0.3s ease-in-out;
}
