.tile-wrapper {
  max-width: 90vmin;
  margin: 0 auto;
  text-align: center;
  font-family: 'Roboto', sans-serif;
}

.tile-wrapper {
  width: 100%;
  max-width: 90vmin; /* mobile/tablet */
}

@media (min-width: 1024px) {
  .tile-wrapper {
    max-width: 600px; /* tighter on large desktops */
  }
}


.tile-header {
  margin-bottom: 20px;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 1.2rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}
.tile-grid {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #ccc;
}
.tile {
  width: calc(100% / 3);
  aspect-ratio: 1;
  background-size: 300% 300%;
  background-repeat: no-repeat;
  box-sizing: border-box;
  outline: 1px solid #999;
  cursor: pointer;
}

.tile {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.tile:hover {
  cursor: pointer;
  transform: scale(1.03);
}


.tile.highlight {
  box-shadow: 0 0 0 3px #f00 inset;
}
.moves {
  text-align: right;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.playagain {
  display: inline-block;
  margin: 10px auto 20px auto;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}
.gameinfo {
  background: #86C1B7;
  border-radius: 20px;
  color: white;
  padding: 15px;
  margin: 20px auto;
  text-align: center;
  font-size: 1rem;
}
.gameinfo.win {
  display: none;
}
canvas#my-canvas {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}


.shuffle-btn {
  display: inline-block;
  margin: 20px auto 0 auto;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: bold;
  color: white;
  background-color: #007444;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.shuffle-btn:hover {
  background-color: #005f36;
  transform: scale(1.03);
}

.shuffle-btn:active {
  transform: scale(0.97);
}



.tile.highlight {
  transform: scale(1.08);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  z-index: 2;
}



.tile.bounce {
  animation: bounceTile 1.5s ease-in-out forwards;
}

@keyframes bounceTile {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  50%  { transform: scale(0.95); }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); } 
}


.tile.flip {
  animation: flipTile 0.6s ease forwards;
  transform-style: preserve-3d;
}

@keyframes flipTile {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(180deg); }
  100% { transform: rotateY(0deg); }
}