*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2.5vmin, 1.5rem);
  padding: clamp(0.75rem, 3vmin, 1.5rem);
  text-align: center;
  background-color: #011f3f;
  overflow-x: hidden;
}

#level-title {
  flex-shrink: 0;
  margin: 0;
  max-width: min(96vw, 36rem);
  font-family: "Press Start 2P", cursive;
  font-size: clamp(0.625rem, 2.4vmin + 0.35rem, 2rem);
  line-height: 1.6;
  color: #fef2bf;
}

.container {
  --board-gap: clamp(0.5rem, 2vmin, 1rem);
  --board-border: clamp(4px, 1vmin, 10px);

  display: flex;
  flex-direction: column;
  gap: var(--board-gap);
  width: min(92vw, calc(100dvh - 8rem), calc(100vh - 8rem), 32rem);
  aspect-ratio: 1;
  max-height: min(calc(100dvh - 8rem), calc(100vh - 8rem), 92vw, 32rem);
  margin: 0 auto;
}

.row {
  display: flex;
  flex: 1 1 0;
  gap: var(--board-gap);
  min-height: 0;
}

.btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: var(--board-border) solid black;
  border-radius: 20%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.game-over {
  background-color: red;
  opacity: 0.8;
}

.red {
  background-color: red;
}

.green {
  background-color: green;
}

.blue {
  background-color: blue;
}

.yellow {
  background-color: yellow;
}

.pressed {
  box-shadow: 0 0 20px white;
  background-color: grey;
}

@media (max-width: 480px) {
  body {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  #level-title {
    font-size: clamp(0.55rem, 3.2vw, 0.95rem);
    line-height: 1.7;
  }

  .container {
    width: min(94vw, calc(100dvh - 6.5rem), calc(100vh - 6.5rem));
    max-height: min(calc(100dvh - 6.5rem), calc(100vh - 6.5rem), 94vw);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  body {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    padding: 0.5rem 1rem;
  }

  #level-title {
    flex: 0 1 12rem;
    font-size: clamp(0.5rem, 2.2vh, 0.85rem);
    text-align: left;
  }

  .container {
    flex: 0 0 auto;
    width: min(52vh, calc(100dvh - 1rem), calc(100vh - 1rem));
    max-height: min(52vh, calc(100dvh - 1rem), calc(100vh - 1rem));
  }
}
