* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: "Vazirmatn", sans-serif;
  background: linear-gradient(135deg, #2c3e50, #3498db);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  perspective: 1000px;
  overflow: hidden;
  transition: background 0.5s ease;
}

body.correct-bg {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

body.wrong-bg {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(52, 152, 219, 0.1),
    transparent 70%
  );
  opacity: 0.5;
  z-index: -1;
}

.game-container {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 40px;
  width: 100%;
  max-width: 600px;
  text-align: center;
  position: relative;
  z-index: 10;
  transform: rotateX(10deg);
  transform-style: preserve-3d;
  opacity: 0;
  animation: fadeIn 0.6s forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: rotateX(10deg) translateY(50px);
  }
  to {
    opacity: 1;
    transform: rotateX(10deg) translateY(0);
  }
}

.level-indicator {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 1.2rem;
  color: #3498db;
  font-weight: bold;
  background: rgba(52, 152, 219, 0.1);
  padding: 10px 15px;
  border-radius: 20px;
}

h1 {
  font-size: 2.5rem;
  color: #2980b9;
  margin-bottom: 25px;
  font-weight: 600;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#scrambled-word {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 30px 0;
  position: relative;
  perspective: 1000px;
}

.letter-circle {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 300px;
  height: 300px;
  border: 4px solid #3498db;
  border-radius: 50%;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7)
  );
  transform-style: preserve-3d;
}

.scrambled-letter {
  position: absolute;
  font-family: "Roboto Mono", monospace;
  font-size: 2rem;
  color: #2980b9;
  user-select: none;
  transition: all 0.4s ease;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  transform: translateZ(50px);
  border: 2px solid #3498db;
}

.scrambled-letter:hover {
  transform: translateZ(80px) scale(1.1);
  background: #3498db;
  color: white;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#hint {
  font-size: 1rem;
  color: #7f8c8d;
  margin-bottom: 15px;
  font-style: italic;
}

#guess-input {
  width: 100%;
  padding: 15px;
  margin: 20px 0;
  border: 2px solid #3498db;
  border-radius: 15px;
  font-size: 1.2rem;
  text-align: center;
  font-family: "Vazirmatn", sans-serif;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#guess-input:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

.btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 30px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: "Vazirmatn", sans-serif;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  background: #2980b9;
  transform: translateY(-3px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
}

#message {
  margin-top: 20px;
  font-weight: 500;
  min-height: 40px;
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s, transform 0.4s;
}

#message.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: white;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  transform: scale(0.7);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
  transform: scale(1);
  opacity: 1;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 30px;
  cursor: pointer;
  color: #aaa;
  transition: color 0.3s;
}

.close-btn:hover {
  color: #3498db;
}

.confetti {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1001;
}

@keyframes confettiAnimation {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(360deg);
  }
}
.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;
}
/* Mobile Responsive Styles - Only Applied on Mobile Screens */
@media screen and (max-width: 768px) {
  .game-container {
    padding: 25px 15px;
    border-radius: 20px;
    max-width: 95%;
    margin: 0 10px;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
  }

  .level-indicator {
    top: 10px;
    left: 10px;
    font-size: 0.9rem;
    padding: 5px 10px;
  }

  .letter-circle {
    width: 240px;
    height: 240px;
    border-width: 3px;
  }

  .scrambled-letter {
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    padding: 5px;
  }

  #guess-input {
    padding: 12px;
    font-size: 1rem;
  }

  .btn {
    padding: 12px 25px;
    font-size: 1rem;
  }

  #message {
    font-size: 0.9rem;
    min-height: 30px;
  }

  .modal-content {
    padding: 25px 15px;
  }

  /* Home button repositioned to top of webpage for mobile */
  .home-button {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    font-size: 16px;
    z-index: 1000;
    width: auto;
    display: inline-block;
  }

  .home-button:hover {
    transform: translateX(-50%);
    animation: none;
  }
}

/* Small Mobile Screens */
@media screen and (max-width: 480px) {
  .letter-circle {
    width: 200px;
    height: 200px;
  }

  .scrambled-letter {
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    transform: translateZ(30px);
  }

  .scrambled-letter:hover {
    transform: translateZ(50px) scale(1.1);
  }

  h1 {
    font-size: 1.5rem;
    margin-top: 40px; /* Add space for the home button */
  }

  #hint {
    font-size: 0.9rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  /* Even smaller home button for very small screens */
  .home-button {
    padding: 6px 12px;
    font-size: 14px;
  }
}

/* For very small screens */
@media screen and (max-width: 360px) {
  .letter-circle {
    width: 180px;
    height: 180px;
  }

  .scrambled-letter {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  h1 {
    margin-top: 35px;
  }

  /* Even smaller home button for tiny screens */
  .home-button {
    padding: 5px 10px;
    font-size: 12px;
  }
}
