/* Keep original CSS unchanged */
body {
  font-family: Arial, sans-serif;
  background-color: #f4f4f4;
  margin: 0;
  padding: 20px;
  height: 100vh;
  background: radial-gradient(circle, #f0d9b5, #6495ed);
  animation: gradientMove 2.5s infinite alternate; /* Reduced from 5s to 2.5s - moderately faster */
  background-size: 300% 300%; /* Slightly increased for more visible movement */
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
@keyframes moveGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
.chess-puzzle {
  display: flex;
}
.chessboard {
  display: inline-grid;
  grid-template-columns: repeat(8, 85px);
  grid-template-rows: repeat(8, 85px);
  border: 2px solid #333;
  margin: 20px 0 0 200px;
}
.chess-background {
  margin: 20px 0 0 120px;
}
.chess-background-img {
  height: 600px;
  width: 850px;
}

.square {
  width: 85px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.square.light {
  background-color: #f0d9b5;
}

.square.dark {
  background-color: #00007a;
}

.hidden {
  display: none;
}
.chess_peaces {
  height: 75px;
  width: 75px;
}
.pawn {
  height: 80px;
  width: 80px;
}
.king {
  height: 110px;
  width: 140px;
}
.rook {
  height: 80px;
  width: 80px;
}
.bishop {
  height: 110px;
  width: 110px;
}

/* ---- Moves ----- */
/* ---- rook h8 move ----- */
.white-rook-move-dark,
.white-rook-move-light {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-rook-h8 {
  transition: 0.5s;
}
.white-rook-h8:hover {
  transform: scale(1.15);
}
.white-rook-h8:active {
  transform: scale(0.95);
}
/* ---- queen move ---- */
.white-queen-move-dark,
.white-queen-move-light {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-queen-move {
  transition: 0.5s;
}
.white-queen-move:hover {
  transform: scale(1.15);
}
.white-queen-move:active {
  transform: scale(0.95);
}
/* ---- pawn f7 move ---- */
.white-pawn-move-dark,
.white-pawn-move-light {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-pawn-move-g7 {
  transition: 0.5s;
}
.white-pawn-move-g7:hover {
  transform: scale(1.15);
}
.white-pawn-move-g7:active {
  transform: scale(0.95);
}
/* ---- knight move a5 ---- */
.white-knight-move-dark,
.white-knight-move-light {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-knight-move-a5 {
  transition: 0.5s;
}
.white-knight-move-a5:hover {
  transform: scale(1.15);
}
.white-knight-move-a5:active {
  transform: scale(0.95);
}
/* ---- white king move ---- */
.white-king-move-dark,
.white-king-move-light {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-king-move-a4 {
  transition: 0.5s;
}
.white-king-move-a4:hover {
  transform: scale(1.15);
}
.white-king-move-a4:active {
  transform: scale(0.95);
}
/* knight move b4 */
.white-knight-move-dark-b4,
.white-knight-move-light-b4 {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-knight-move-b4 {
  transition: 0.5s;
}
.white-knight-move-b4:hover {
  transform: scale(1.15);
}
.white-knight-move-b4:active {
  transform: scale(0.95);
}
/* ---- rook move c2 ----- */
.white-rook-move-dark-c2,
.white-rook-move-light-c2 {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-rook-move-c2 {
  transition: 0.5s;
}
.white-rook-move-c2:hover {
  transform: scale(1.15);
}
.white-rook-move-c2:active {
  transform: scale(0.95);
}
/* ----- bishop move e2 */
.white-bishop-move-dark-e2,
.white-bishop-move-light-e2 {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-bishop-move-e2 {
  transition: 0.5s;
}
.white-bishop-move-e2:hover {
  transform: scale(1.15);
}
.white-bishop-move-e2:active {
  transform: scale(0.95);
}
/* ---- bishop move f2 */
.white-bishop-move-dark-f2,
.white-bishop-move-light-f2 {
  transition: background-color 0.5s ease-in-out; /* Smooth transition */
}
.white-bishop-move-f2 {
  transition: 0.5s;
}
.white-bishop-move-f2:hover {
  transform: scale(1.15);
}
.white-bishop-move-f2:active {
  transform: scale(0.95);
}
/* ----------- heading ----------- */
.card {
  position: relative;
  width: fit-content;
  height: auto;
  background-color: #00007a;
  justify-content: center;
  align-items: center;
  padding: 15px 30px;
  border-radius: 10px;
  cursor: pointer;
  margin: 0 auto 20px auto; /* Center horizontally and add bottom margin */
  box-sizing: border-box;
}

.card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 15px;
  background: linear-gradient(-45deg, #f0d9b5 0%, #6495ed 100%);
  z-index: -10;
  pointer-events: none;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card::after {
  content: "";
  z-index: -1;
  position: absolute;
  inset: 0;
  background: linear-gradient(-45deg, #f0d9b5 0%, #6495ed 100%);
  transform: translate3d(0, 0, 0) scale(0.95);
  filter: blur(20px);
}

.heading {
  font-size: 32px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 3px;
  color: white;
  margin: 0;
  text-align: center;
  white-space: nowrap;
}

.card:hover::after {
  filter: blur(30px);
}

.card:hover::before {
  transform: rotate(180deg);
}
.heading2 {
  font-size: 24px;
  font-weight: 100;
}
.home-button {
  position: absolute;
  top: 20px;
  left: 20px;
  display: inline-block;
  padding: 15px 30px;
  background: linear-gradient(135deg, #722afe, #2b86c5);
  color: white;
  font-size: 24px;
  text-decoration: none;
  border-radius: 50px;
  font-weight: bold;
  text-align: center;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 5px 15px rgba(43, 134, 197, 0.4);
  transition: all 0.3s ease;
}

.home-button:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2b86c5, #722afe);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  border-radius: 50px;
}

.home-button:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(114, 42, 254, 0.6);
}

.home-button:hover:before {
  opacity: 1;
}

.home-button:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(43, 134, 197, 0.4);
}

.home-button .icon {
  display: inline-block;
  margin-right: 10px;
  transition: transform 0.3s ease;
}

.home-button:hover .icon {
  transform: rotate(10deg);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(114, 42, 254, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(114, 42, 254, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(114, 42, 254, 0);
  }
}

.home-button:hover {
  animation: pulse 1.5s infinite;
}

/* Add mobile responsiveness via media queries */
@media only screen and (max-width: 768px) {
  body {
    padding: 10px;
    height: auto;
    min-height: 100vh;
  }

  /* Change flex direction to column for mobile */
  .chess-puzzle {
    flex-direction: column;
    align-items: center;
  }

  /* Center and resize chessboard */
  .chessboard {
    margin: 20px auto;
    grid-template-columns: repeat(8, minmax(30px, 40px));
    grid-template-rows: repeat(8, minmax(30px, 40px));
    width: max-content;
  }

  /* Adjust square size */
  .square {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  /* Scale down chess pieces */
  .chess_peaces {
    height: 35px;
    width: 35px;
  }

  .pawn {
    height: 35px;
    width: 35px;
  }

  .king {
    height: 50px;
    width: 60px;
  }

  .rook {
    height: 35px;
    width: 35px;
  }

  .bishop {
    height: 50px;
    width: 50px;
  }

  /* Adjust chess background */
  .chess-background {
    margin: 20px auto;
  }

  .chess-background-img {
    height: auto;
    width: 100%;
    max-width: 100%;
  }

  /* Adjust heading for mobile */
  .card {
    padding: 10px 20px;
    max-width: 90%;
  }

  .heading {
    font-size: 24px;
    letter-spacing: 2px;
    white-space: normal;
  }

  .heading2 {
    font-size: 18px;
  }

  /* Adjust home button */
  .home-button {
    position: relative;
    top: auto;
    left: auto;
    margin: 10px auto;
    padding: 10px 20px;
    font-size: 18px;
    display: block;
  }
}

/* Even smaller screens */
@media only screen and (max-width: 480px) {
  .chessboard {
    grid-template-columns: repeat(8, minmax(25px, 35px));
    grid-template-rows: repeat(8, minmax(25px, 35px));
  }

  .square {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }

  .chess_peaces,
  .pawn,
  .rook {
    height: 30px;
    width: 30px;
  }

  .king {
    height: 40px;
    width: 50px;
  }

  .bishop {
    height: 40px;
    width: 40px;
  }

  .heading {
    font-size: 20px;
  }

  .heading2 {
    font-size: 16px;
  }
}
