:root {
  --cell: 40px;
  --w: 1040px;
  --h: 560px;
  --margin: 65px;
}

.section.tetris {
  position: absolute;
  padding: 0;
  margin: 0 auto;
  bottom: 0;
  z-index: var(--z-overlay);
}

.hidden {
  display: none;
}

.frame {
  width: fit-content;
  height: fit-content;
  margin: 0 auto;
  position: relative;
  bottom: 0;
  border: outset 4px var(--color-border);
  overflow: hidden;
  background: var(--color-bg-light);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* image-rendering: pixelated; */
}

.hud {
  margin: 20px auto 0;
  display: flex;
  gap: 20px;
  justify-content: space-around;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
  max-width: calc(var(--w));
}

.hud .stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
}

.pill {
  background: var(--color-bg-light);
  padding: 8px 12px;
  min-width: 80px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  font-family: var(--font-sans);
}

.pill.btn {
  cursor: pointer;
  user-select: none;
  line-height: initial;
  height: initial;
  width: 90px;
}

.pill.btn:hover {
  background: var(--color-text);
}

kbd {
  background: var(--color-text);
  border: 1px solid var(--color-dark);
  color: var(--color-white);
  border-radius: 6px;
  padding: 2px 6px;
}

.legend {
  opacity: 0.85;
}

/* Mobile HUD */

#mobile-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 20px;
}

#mobile-controls button {
  font-size: 1rem;
  height: 50px;
  max-width: 100px;
  border: none;
  border-radius: 8px;
  background: var(--color-dark);
  color: #fff;
  margin: 0;
}

#mobile-controls button:hover {
  background: var(--color-text);
}

@media (min-width: 841px) {
  #mobile-controls {
    display: none;
  }
}

@media (max-width: 840px) {
  .hud .pill {
    flex: 1;
    border-radius: 8px;
    padding: 8px 0;
  }

  .legend {
    display: none;
  }
}

@media (max-width: 600px) {
  .hud .stats {
    flex-wrap: wrap;
    margin: auto 20px;
  }
}

/* Tetris Icon */

.tetris-block {
  position: absolute;
  bottom: var(--footer-height);
  width: 60px;
  height: 60px;
}

.tetris-block a {
  font-size: 36px;
  letter-spacing: -17px;
  line-height: initial;
  height: 100%;
  width: 100%;
  padding: 0;
}

.tetris-block a div {
  margin-left: -17px;
}
