/* style.css */

html, body {
  height: 100%;
  width: 100%;
}

body {
  align-items: center;
  background: transparent;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  padding: 12px;
}

.tetris-app {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  max-height: 100%;
  max-width: 100%;
}

.tetris-hud {
  align-items: stretch;
  background: #fff;
  border: 2px solid #17232b;
  border-radius: 10px;
  color: #17232b;
  display: grid;
  flex: 0 0 68px;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(82px, 1.25fr);
  height: 68px;
  overflow: hidden;
  padding: 5px;
}

.tetris-stat,
.tetris-next {
  align-items: center;
  background: #f7f7f5;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.tetris-stat span,
.tetris-next span {
  font-family: "Trebuchet MS", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.tetris-stat strong {
  font-family: "Trebuchet MS", sans-serif;
  font-size: 20px;
  line-height: 1.25;
}

.tetris-next {
  display: grid;
  grid-template-columns: auto 1fr;
  padding: 2px 4px;
}

#nextPieceCanvas {
  background: #fff;
  border: 0;
  height: 44px;
  max-width: 100%;
  width: 76px;
}

.tetris-board {
  background: #fff;
  flex: 0 0 auto;
  line-height: 0;
  max-height: 100%;
  max-width: 100%;
}

.tetris-board > canvas {
  background: #fff;
  border: 2px solid #17232b;
  border-radius: 8px;
  display: block;
  flex: 0 0 auto;
  touch-action: none;
}

/* Mobile controls */
.mobile-controls {
  display: none;
  gap: 12px;
  grid-template-columns: repeat(5, 56px);
  justify-content: center;
}

.mobile-controls button {
  align-items: center;
  background: #071820;
  border: 2px solid #fff;
  border-radius: 9px;
  color: #fff;
  display: inline-flex;
  font-size: 1.35rem;
  font-weight: 700;
  height: 54px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
  width: 56px;
}

.mobile-controls button:active {
  background: #344c57;
}

@media (max-width: 700px), (pointer: coarse) {
  body {
    justify-content: center;
    min-height: 100svh;
  }

  .mobile-controls {
    display: grid;
  }
}

@media (max-width: 340px) {
  .mobile-controls {
    gap: 9px;
    grid-template-columns: repeat(5, 50px);
  }

  .mobile-controls button {
    height: 52px;
    width: 50px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  body {
    flex-direction: row;
    gap: 12px;
    padding: 8px;
  }

  .tetris-hud {
    flex-basis: 52px;
    height: 52px;
  }

  .tetris-stat span,
  .tetris-next span {
    font-size: 8px;
  }

  .tetris-stat strong {
    font-size: 16px;
  }

  #nextPieceCanvas {
    height: 32px;
  }

  .mobile-controls {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 58px);
  }

  .mobile-controls button {
    height: 54px;
    width: 58px;
  }
}
