/* Game board: the square white sheet holding the canvas, and the game screen layout. */

.board-wrap {
  flex: 1 1 auto;
  min-height: 240px;
  display: grid;
  place-items: center;
  container-type: size;
}

.board-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  width: 100%;
  width: min(100cqw, 100cqh);
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.board-card canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Hint along the bottom edge, so it never covers the geometry. */
.board-hint {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  width: 86%;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-small);
  line-height: 1.35;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.board-hint.hidden {
  opacity: 0;
}

.game-caption {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-caption);
  line-height: 1.4;
}

/* Game screens: the board fills whatever height the other rows leave. */
.game-screen {
  display: flex;
  flex-direction: column;
}

.game-screen > * {
  flex: 0 0 auto;
}

.game-screen > .board-wrap {
  flex: 1 1 auto;
}

@media (max-height: 760px) {
  .board-wrap {
    min-height: 200px;
  }

  .game-caption {
    display: none;
  }
}
