/* start global rules */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  overflow: hidden;
}
body {
  font-family: "Work Sans", sans-serif;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px;
}
a {
  text-decoration: none;
  color: #333;
}
h2,
h3 {
  text-align: center;
}
/*---------------------------------------*/
.game-box {
  position: relative;
  width: 100%;
  max-width: 450px;
  border: 8px solid blueviolet;
  border-radius: 10px;
  margin: auto;
  background-color: rgb(0 0 0/0.3);
  padding: 15px;
}
.header h2 {
  padding: 10px;
  background-color: #fff;
  border-radius: 6px;
}
.word-boxes {
  background-color: #eee;
  padding: 15px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-radius: 6px;
}
.letters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}
.letters div {
  position: relative;
  margin-left: 20px;
  font-weight: bold;
  min-width: 50px;
}
.letters.active div {
  color: orangered;
}
.letters.active div:before {
  position: absolute;
  content: "";
  border: 8px solid;
  border-color: transparent transparent transparent orangered;
  left: -10px;
}
.letters.active div:after {
  position: absolute;
  content: "";
  background-color: orangered;
  width: 15px;
  height: 5px;
  left: -20px;
  top: 6px;
}
input {
  flex: 1;
  width: 30px;
  max-width: 40px;
  aspect-ratio: 1;
  text-align: center;
  font-weight: bold;
  border-radius: 4px;
  border: 1px solid #ccc;
  outline: none;
}
/* --------------notes------------ */
.notes {
  margin: 10px 0;
  padding: 10px;
  background-color: #fafafa;
  border-radius: 6px;
}
.notes p {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  padding-top: 10px;
}
.notes p::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.notes .orange {
  color: orange;
}
.notes .green {
  color: green;
}
.notes .red {
  color: red;
}
.notes .orange:before {
  background-color: orange;
}
.notes .green:before {
  background-color: green;
}
.notes .red:before {
  background-color: red;
}
.check {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}
.check button {
  padding: 10px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.check .check-btn {
  background-color: orangered;
  flex: 1;
}
.check .hint-btn {
  background-color: green;
  padding: 10px 20px;
}
.check button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ---------------Footer------------- */
.footer {
  background-color: #606060;
  color: #fff;
  text-align: center;
  padding: 10px;
  border-radius: 6px;
  text-transform: capitalize;
}
/* ---------------------OverLay Message-------------------------- */
.overlay-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.message-form {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  text-align: center;
  min-width: 250px;
}

.message-form span {
  color: blueviolet;
}
.message-form button {
  margin-top: 15px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.message-form .btn-lose {
  background-color: red;
}
.message-form .btn-win {
  background-color: orange;
}

/* ---------- Responsive ---------- */
@media (max-width: 460px) {
  .letters {
    gap: 15px 8px;
  }
  .letters input {
    min-width: 25px;
    max-width: 35px;
  }
  .check button {
    font-size: 14px;
    padding: 8px;
  }
}
@media (max-width: 390px) {
  .letters div {
    margin: 0;
  }
  .letters div:first-child {
    min-width: fit-content;
  }
  .letters div::before,
  .letters div::after {
    display: none;
  }
}

/* ---------- Animations ---------- */
@keyframes fadeColor {
  0% {
    background-color: transparent;
    color: black;
  }
  100% {
    opacity: 1;
  }
}

@keyframes shakeRow {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-5px);
  }
  100% {
    transform: translateX(0);
  }
}

/* Fade-in color for letters */
.letters input.correct,
.letters input.present,
.letters input.wrong {
  animation: fadeColor 0.5s ease forwards;
}

/* Shake animation for wrong guess */
.letters.shake {
  animation: shakeRow 0.5s ease;
}

/* Hint fade-in */
.letters input.hint {
  animation: fadeColor 0.5s ease forwards;
}
