/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-dark: #2c1810;
  --primary-light: #5d4037;
  --accent: #8d6e63;
  --tile-bg: #d7ccc8;
  --tile-hover: #bcaaa4;
  --text: #3e2723;
  --text-light: #fff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s ease;
}

/* Typography */
body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1.6;
}

h1 {
  font-family: 'Playfair Display', serif;
  color: var(--primary-dark);
  margin-bottom: 1.5rem;
  font-size: 2.2rem;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Game Container */
.game-container {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  margin: 2rem;
  transition: var(--transition);
}

/* Game Board */
.game-board {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.SlidingPuzzle {
  background: var(--primary-dark);
  border-radius: 8px;
  padding: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 0.5rem;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.Tile {
  background: var(--tile-bg);
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.Tile:not(.empty):hover {
  background: var(--tile-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.Tile:not(.empty):active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game Controls */
.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.moves {
  font-size: 1.2rem;
  background: var(--primary-light);
  color: var(--text-light);
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#movesnum {
  font-weight: 700;
  color: #ffd54f;
  margin-left: 0.3rem;
}

.buttons {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.4);
}

/* Responsive Design */
@media (max-width: 600px) {
  .game-container {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .Tile {
    width: 70px;
    height: 70px;
    font-size: 1.5rem;
  }
  
  .buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 200px;
  }
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-container {
  animation: fadeIn 0.6s ease-out forwards;
}

.Tile {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Add delay to tile animations */
.Tile:nth-child(1) { animation-delay: 0.1s; }
.Tile:nth-child(2) { animation-delay: 0.15s; }
.Tile:nth-child(3) { animation-delay: 0.2s; }
.Tile:nth-child(4) { animation-delay: 0.25s; }
.Tile:nth-child(5) { animation-delay: 0.3s; }
.Tile:nth-child(6) { animation-delay: 0.35s; }
.Tile:nth-child(7) { animation-delay: 0.4s; }
.Tile:nth-child(8) { animation-delay: 0.45s; }