* {
  box-sizing: border-box;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-family: "Open Sans", sans-serif;
  font-style: normal;
  font-size: 20px;
  line-height: 150%;
  background-color: #dff6f6;
  background-image: url("../img/bg.png");
  background-size: 800px;
  background-repeat: repeat;
  color: #305050;
}

.logo {
  width: 70%;
  max-width: 484px;
}

h1 {
  width: 100%;
  padding-top: 1em;
  margin: 0;
  font-family: "Unlock", sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 44px;
  text-align: center;
}

.container {
  background: radial-gradient(50% 50% at 50% 50%,
    rgba(167, 237, 237, 0.3) 0%,
    rgba(156, 226, 226, 0) 100%);
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  width: 90%;
}

.hide {
  display: none;
}

.highlight {
  padding: 0.25em;
  background: #ffe2d6;
  font-size: 1em;
}

.underline {
  border-bottom: 2px solid #fff;
  padding-bottom: 3px;
}

/* --- Game Specific Styles --- */
.word-in-progress {
  letter-spacing: 15px;
  color: #28bdbd;
  font-size: 30px;
  min-height: 1.5em; /* Add min-height to prevent layout shifts */
}

/* Style for newly revealed letters */
.word-in-progress .newly-revealed {
    background-color: #ff8d5c; /* Use an accent color */
    padding: 0 2px; /* Add slight padding */
    border-radius: 3px;
    animation: pulse-highlight 0.5s ease-out; /* Animation for highlight */
}

@keyframes pulse-highlight {
    0% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}


.guessed-letters {
  padding: 0;
  list-style: none;
  min-height: 1.5em; /* Add min-height */
}

.guessed-letters li {
  display: inline-block;
  padding: 0 0.5em;
}

.message {
  text-align: center;
  min-height: 2em; /* Add min-height to prevent layout shifts */
}

/* Style for the loss message */
.message.lose {
    color: #ff0000; /* Red color for loss */
    font-weight: bold;
    animation: shake 0.5s ease-in-out; /* Reuse shake animation */
}


.guess-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.guess-form label {
  width: 100%;
  font-weight: normal;
  font-size: 14px;
  text-align: center;
}

input {
  width: 2.25em;
  text-align: center;
  font-size: 1.5em;
  margin-top: 0.5em;
  padding: 0.5em;
  border: 3px solid #28bdbd;
  transition: border-color 0.3s ease; /* Smooth transition for border */
}

input:active,
input:focus {
  outline: 0;
  border: 4px solid #28bdbd;
}

/* Animation for incorrect input */
input.shake {
    animation: shake 0.5s ease-in-out;
    border-color: #ff0000; /* Red border on shake */
}

@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}


.guess,
.play-again {
  padding: 1em 3em;
  border-radius: 50px;
  margin-top: 1em;
  color: #fff;
  background: #ff8d5c;
  font-size: 1em;
  align-self: center;
  outline: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease; /* Add transition */
}

.guess:active,
.play-again:active,
.guess:focus,
.play-again:focus,
.guess:hover,
.play-again:hover {
  outline: 0;
  transform: scale(0.98);
  filter: brightness(0.9);
  color: white; /* Ensure text color remains white on hover/focus/active */
}

/* animatied background */
.win {
  padding: 0 1em;
  background: linear-gradient(-45deg, #ff9d64, #f5620c);
  background-size: 400% 400%;
  animation: gradient 2s ease infinite;
  display: inline-block; /* Add display inline-block for background effect */
}

@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}
