* {
  box-sizing: border-box;
}

html {
  font-size: 62.5%; /* 1rem = 10px */
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(45deg, #ffd700, #ff6347, #1e90ff); /* Gold, Tomato, DodgerBlue */
  animation: Gradient 15s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 98vh;
  margin: 0;
  padding: 2rem;
  font-weight: 700;
  overflow-y: hidden;
}

@keyframes Gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.game-container {
  width: 100%;
  max-width: 50rem;
  min-height: 90vh;
  margin: 2rem auto;
  text-align: center;
  border: 0.2rem solid #ffd700; /* Gold */
  border-radius: 1rem; /* Increased border-radius for a softer look */
  background-color: #ffffff;
  box-shadow: 0px 0px 1rem rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.1em;
}

.word-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

#word-image {
  width: 100%;
  max-width: 30rem;
  height: auto;
  object-fit: contain;
  border: 0.5rem solid #ffd700; /* Gold border with increased width */
  border-radius: 1.5rem; /* Rounded corners for a softer look */
  box-shadow: 0px 0.5rem 2rem rgba(0, 0, 0, 0.1); /* Soft shadow */
  margin-right: 1.5rem; /* Increased spacing */
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.3s, box-shadow 0.3s; /* Transition for hover effects */
}

#word-image.fly-in {
  animation: flyIn 0.5s ease-in-out; /* Apply the fly-in animation */
}

@keyframes flyIn {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.progress-tracker {
  font-size: 1.5rem;
  margin-top: 1rem;
}
#show-instruction,
#speak {
  background-color: #ff7f50; /* Coral background for better contrast */
  border: none;
  padding: 1rem; /* Increased padding for larger icons */
  border-radius: 50%;
  cursor: pointer;
  font-size: 2.4rem; /* Increased font size */
  color: white; /* White color for icons */
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.3); /* Add subtle shadow for better visibility */
  transition: transform 0.3s;
}

#show-instruction i,
#speak i {
  font-size: 2.4rem; /* Ensure icons are large enough */
}

#show-instruction:hover,
#speak:hover {
  transform: scale(1.1);
}

/* Word Placeholder */
.word-placeholder {
  height: 8rem; /* Increased height */
  margin: 1rem 0 3rem 0;
  background-color: #1e90ff; /* DodgerBlue background */
  border-radius: 1rem; /* Rounded corners */
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 1rem 0; /* Increased padding */
  width: 100%;
  overflow: hidden;
  box-shadow: 0px 0.5rem 1.5rem rgba(0, 0, 0, 0.1); /* Soft shadow */
}

.letters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.letter {
  width: 5rem; /* Increased size */
  height: 5rem;
  line-height: 5rem;
  margin: 0 1rem; /* More spacing */
  border: 0.2rem solid #370bd5; /* Gold border */
  background-color: #ff6347; /* Tomato background */
  border-radius: 1.5rem; /* Rounded corners */
  cursor: pointer;
  font-size: 3.5rem; /* Larger font */
  font-weight: 500; /* Reduced font weight */
  transition: transform 0.3s, background-color 0.3s, box-shadow 0.3s;
  box-shadow: 0px 0.5rem 1.5rem rgba(0, 0, 0, 0.1); /* Soft shadow */
}

.dropped-letter {
  font-size: 3.5rem;
  cursor: pointer;
}

.letter:hover {
  transform: scale(1.1);
  background-color: LimeGreen;
}

.message {
  color: red;
  font-size: 1.8rem;
  margin: 2rem 0;
  transition: opacity 0.3s;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 2rem;
  background-color: #ffffff;
  box-shadow: 0 0 1rem rgba(0, 0, 0, 0.5);
  text-align: center;
  border-radius: 1rem;
}

.overlay-content h2 {
  color: #333;
  font-size: 2.1 rem;
  margin-bottom: 0.5rem;
}

.overlay-content p {
  font-size: 1.8rem;
  color: #555;
  margin-bottom: 1rem;
}

.overlay-content button {
  background-color: LimeGreen;
  border: none;
  padding: 1rem 2rem;
  cursor: pointer;
  margin: 0.5rem;
  font-size: 1.8rem;
  color: white;
  border-radius: 0.5rem;
  transition: background-color 0.3s;
}

.overlay-content button:hover {
  background-color: MediumSeaGreen;
}

.overlay-content button:active {
  background-color: Green;
}

.dropbox {
  width: calc(20% - 2rem);
  height: 25vw;
  max-height: 7rem;
  border: 0.2rem dotted DeepSkyBlue;
  margin: 0 1rem;
  display: inline-block;
  vertical-align: middle;
  background-color: #f8f8f8;
  transition: background-color 0.3s;
  text-align: center;
}

.game-container,
.overlay-content,
#word-image,
.letter {
  box-shadow: 0px 0.5rem 2.5rem rgba(0, 0, 0, 0.2);
}

.dropbox:hover {
  background-color: #fafad2; /* LightGoldenRodYellow */
  transition: background-color 0.3s;
}

button:hover {
  transform: translateY(-0.3rem);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.1);
}

button:active {
  transform: translateY(0.2rem);
}

.title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.instruction-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
}

.instruction-content {
  background: #fff;
  padding: 1rem;
  border-radius: 0.8rem;
  max-width: 90%;
  text-align: left;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
  font-weight: 400;
  font-size: 1.5rem;
}

.instruction-content strong {
  font-weight: 700; /* If you want to retain bold styling for any <strong> tags inside the content */
}

#close-btn, #close-instruction {
  margin: 1rem 0 2rem 0;
  font-size: 2rem;
  background-color: LimeGreen;
  color: #333;
  padding: 1rem;
  border: none;
  border-radius: 0.8rem;
  cursor: pointer;
}

.letter:hover {
  transform: translateY(-0.5rem); /* Lift effect on hover */
  background-color: #1e90ff; /* DodgerBlue on hover */
  box-shadow: 0px 0.7rem 2rem rgba(0, 0, 0, 0.2); /* Deeper shadow on hover */
}

/* Buttons */
button {
  padding: 1.5rem 2.5rem;
  font-size: 2rem;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd700, #ff6347);
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0px 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
  color: #fff;
}

button:hover {
  transform: translateY(-0.5rem); /* Lift effect on hover */
  box-shadow: 0px 0.7rem 2rem rgba(0, 0, 0, 0.2); /* Deeper shadow on hover */
}

button:active {
  transform: translateY(0.2rem); /* Pressed effect */
}

.progress-container {
  width: 100%;
  height: 2rem;
  background-color: #e0e0e0;
  border-radius: 1rem;
  overflow: hidden;
  margin: 2rem 0;
  box-shadow: inset 0 0 0.5rem rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  width: 0;
  background-color: LimeGreen;
  border-radius: 1rem 0 0 1rem;
  transition: width 0.5s ease-in-out;
}


@media (max-width: 768px) {
  .game-container {
    width: 90%;
  }

  #word-image {
    max-width: 90%;
  }

  #show-instruction,
  #speak {
    padding: 1.5rem; /* Reduced padding for smaller screens */
    font-size: 2rem; /* Adjusted font size for smaller screens */
  }

  .letter {
    width: 5rem;
    height: 5rem;
    line-height: 5rem;
    margin: 0 1rem; /* Adjusted spacing for smaller screens */
    font-size: 3.5rem;
  }
  .dropped-letter {
    font-size: 3.5rem;
    cursor: pointer;
  }
}

@media (max-width: 480px) {
  .controls {
    flex-direction: row;
    gap: 1rem;
  }

  .letter {
    width: 5rem;
    height: 5rem;
    line-height: 5rem;
    margin: 0 0.5rem; /* Adjusted spacing for smaller screens */
    font-size: 3rem;
  }

  .dropped-letter {
    font-size: 3rem;
  }

  button {
    padding: 1rem 2rem;
    font-size: 1.8rem;
  }

  #show-instruction i,
  #speak i {
    font-size: 1.5rem; /* Ensure icons are large enough */
  }
}
