@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

* {
  font-family: "Press Start 2P", system-ui;
  font-weight: 400;
  font-style: normal;
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3vmin;
  padding: 2vmin;
}

.title {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  text-align: center;
}

.container {
  padding: 2vmin;
  background-color: rgb(174, 174, 174);
  border: 0.5vmin solid;
  border-color: #ededed gray gray #ededed;
  width: min(90vw, 90vh);
  max-width: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2vmin;
}

#level {
  padding: 1vmin 1.2vmin;
  border-radius: 0.8vmin;
  font-size: clamp(0.5em, 1.5vw, 0.6em);
}

.game-status {
  display: flex;
  gap: 2vmin;
}

.game-status > div {
  display: flex;
  align-items: center;
  gap: 0.5vmin;
  font-size: clamp(0.7em, 1.8vw, 0.9em);
}

.board {
  border: 0.5vmin solid;
  border-color: gray #ededed #ededed gray;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.easy {
  --grid-size: 9;
}

.medium {
  --grid-size: 16;
}

.hard {
  --grid-size: 30;
  aspect-ratio: 30 / 16;
}

.easy .bomb,
.easy .active,
.medium .bomb,
.medium .active,
.hard .bomb,
.hard .active {
  position: relative;
  width: calc(100% / var(--grid-size));
  height: calc(100% / var(--grid-size));
  border: 0.4vmin solid;
  font-size: clamp(0.5em, 1.5vw, 0.7em);
  background-color: rgb(174, 174, 174);
  border-color: #ededed gray gray #ededed;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.hard .bomb,
.hard .active {
  height: calc(100% / 16);
}

.easy .open,
.medium .open,
.hard .open {
  border: 0.1vmin solid gray;
}

.easy .blow-up,
.medium .blow-up,
.hard .blow-up {
  background-color: red;
}

.wrong-flag::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0.2vmin;
  background-color: black;
  transform: translateY(-50%) rotate(45deg);
}

.wrong-flag::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0.2vmin;
  background-color: black;
  transform: translateY(-50%) rotate(-45deg);
}

.game-results {
  visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 10vmin;
  width: 100%;
  text-align: center;
}

.game-results.visible {
  visibility: visible;
}

.game-results-title,
.game-results-message {
  margin: 0;
  font-size: clamp(0.7em, 1.8vw, 0.9em);
}

.game-results-title {
  font-size: clamp(0.9em, 2.5vw, 1.2em);
}

.game-reset-button {
  padding: 1vmin 1.2vmin;
  border-radius: 0.8vmin;
  cursor: pointer;
  font-size: clamp(0.6em, 1.5vw, 0.8em);
}

@media screen and (max-width: 600px) {
  body {
    gap: 2vmin;
    padding: 1vmin;
  }

  .container {
    padding: 1.5vmin;
  }

  .title {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
  }

  .game-results {
    height: 12vmin;
  }
}