/* Fifteen Puzzle — builds on /css/style.css and the shared page chrome in /algo-games/algo-games.css. */

.pz-stage { display: flex; justify-content: center; }
.pz-board {
  --size: 4;
  position: relative;
  width: min(100%, 400px, 52vh);
  aspect-ratio: 1;
  background: var(--paper-dark);
  border: 2.5px dashed var(--ink);
  border-radius: 14px;
  touch-action: manipulation;
}
.pz-tile {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / var(--size));
  height: calc(100% / var(--size));
  padding: 4px;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.14s ease;
}
/* The inner span is the visible tile, so the button's padding forms the gaps between tiles. */
.pz-tile span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #fff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  font: 800 clamp(1rem, calc(22vw / var(--size)), 2.2rem) "Baloo 2", system-ui, sans-serif;
  user-select: none;
}
.pz-tile:active span { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.pz-tile.is-home span { background: #d8f3ee; border-color: var(--teal-dark); }
.pz-tile:focus-visible { outline: none; }
.pz-tile:focus-visible span { outline: 3px solid var(--yellow); outline-offset: 2px; }
.pz-board.is-solved .pz-tile span { background: var(--teal); color: #fff; }
.pz-board.no-motion .pz-tile { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .pz-tile { transition: none; }
}
