body {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #3e3c3c; /*Dark Gray*/
  margin: 0;
  user-select: none;
  padding: 10px;
  box-sizing: border-box;
}

.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90vw; /* Use 90% of the viewport width */
  max-width: 800px;
  padding: 2vw; 
  box-sizing: border-box;
}

.title {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 3vw; 
  font-weight: bold;
  color: #fffdfd;
  text-transform: uppercase;
  margin-bottom: 3vw; 
  text-align: center;
  transition: opacity 0.5s;
}

.title span {
  display: block;
}

.title .main {
  font-size: 3vw; 
}

.title .sub {
  font-size: 2.5vw; 
  margin-top: -1vw; 
}

.back-button{
  position: absolute;
  top: 1vw;
  left: 0.5vw;
  background-color: #5a594e;
  color: white;
  border: none;
  border-radius: 0.8vw;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  padding: 0.5vw 1vw;
  font-size: 1vw;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
  font-weight: bold;
}

.back-button:active {
  background-color: #4a473f; /* Slightly darker shade for active state */
  transform: scale(0.98);
}

.how-to-play-button {
  position: absolute;
  top: 1vw;
  right: 0.5vw;
  background-color: #5a594e;
  color: #ffffff;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 1vw; /* Adjust font size if necessary */
  font-weight: bold;
  text-transform: uppercase;
  border: none;
  border-radius: 0.8vw; /* Adjust border radius if necessary */
  padding: 0.5vw 1vw; /* Adjust padding if necessary */
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
  box-sizing: border-box;
}

.how-to-play-button:active {
  background-color: #4a473f; /* Slightly darker shade for active state */
  transform: scale(0.98);
}

.howToPlayTextBox {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 2vw;
  z-index: 1000;
  width: 90%; /* Responsive width */
  max-width: 35vw; /* Maximum width */
  box-sizing: border-box; /* Ensure padding is included in width */
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.overlay-text-box {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 100%; /* Responsive width */
  max-width: 49.5vw; /* Maximum width */
  box-sizing: border-box; /* Ensure padding is included in width */
}

.overlay-text-box ul {
  list-style-type: disc;
  margin-left: 20px;
}

.overlay-text-box li {
  margin-bottom: 10px;
}

.overlay-text-box strong {
  font-weight: bold;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr); 
  gap: 0.5vw; 
  width: 100%;
  max-width: 38.8vw;
  height: auto;
  padding: 0vw; 
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
}

.word-button {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  background-color: #efefe6;
  color: #333;
  font-size: 1.2vw; 
  font-weight: bold;
  text-transform: uppercase;
  border: none;
  border-radius: 0.8vw; 
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
  text-align: center;
  display: grid;
  justify-content: center;
  align-items: center;
  width: 12vw; 
  height: 12vh; 
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.word-button.clicked {
  color: #fff; 
  background-color: #5a594e; 
  border: 0.2vw solid #5a594e; 
}

.word-button:active {
  background-color: #c0c0c0;
  transform: scale(0.98);
}

.word-button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.grouped-button {
  background-color: #d0d0d0;
  color: #000;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 2vw; 
  font-weight: bold;
  border: 0.2vw solid #000; 
  border-radius: 0.8vw; 
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%; 
  position: relative;
  grid-column: span 4;
  padding: 1vw; 
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
}

.grouped-button .button-names {
  font-size: 1vw; 
  margin-top: 0.8vw; 
  color: #000;
}

.grouped-button.revealed {
  opacity: 1;
  transform: translateY(0);
}

.grouped-button.hidden {
  opacity: 0;
  transform: translateY(1vw); 
}

.options {
  display: flex;
  gap: 1.5vw; 
  margin-top: 2vw; 
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

.option-button {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  background-color: #fff;
  color: #000;
  font-size: 0.8vw; 
  font-weight: bold;
  text-transform: uppercase;
  border: 0.2vw solid #000; 
  border-radius: 5vw; 
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 5vw; 
  height: auto;
  padding: 2vh 1.2vw; 
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.option-button.deselect-all {
  line-height: 1.2; 
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

.option-button.deselect-all span {
  display: block; 
}

.option-button:active {
  background-color: #e0e0e0;
  transform: scale(0.98);
}

.option-button.disabled {
  background-color: #a8a7a7;
  color: #000000;
  border: 0.2vw solid #000000; 
  cursor: default;
}

.lives-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1vw; 
  margin-top: 2vw; 
}

.lives-container .life-icon {
  width: 3vw; 
  height: 3vw; 
  transition: opacity 1s, transform 1s;
}

.game-over-message {
  display: none;
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  color: white;
  padding: 1vh 2vw; 
  border-radius: 0.5vw; 
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 1vw; 
  font-weight: bold;
  z-index: 1000;
  text-align: center;
  box-sizing: border-box;
}

.grouped-button.complete {
  background-color: #b0b0b0;
  border-color: #333;
}

@keyframes heartFall {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(10vh); 
    opacity: 0;
  }
}

.heart-fall {
  animation: heartFall 1s forwards;
}

.good-job-message {
  display: none;
  position: fixed;
  top: 5vh; 
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  color: white;
  padding: 1vh 2vw; 
  border-radius: 0.5vw; 
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 1vw; 
  font-weight: bold;
  z-index: 1000;
  text-align: center;
  box-sizing: border-box;
}

.one-away-message {
  display: none;
  position: fixed;
  top: 5vh; 
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  color: white;
  padding: 1vh 2vw; 
  border-radius: 0.5vw; 
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: 1.5vw; 
  font-weight: bold;
  z-index: 1000;
  text-align: center;
  box-sizing: border-box;
}

/* Adjustments for smaller screens */
@media screen and (max-width: 768px) {
  .title {
    font-size: 4vw;
    margin-bottom: 4vw;
  }

  .word-button {
    width: 14vw;
    height: 14vh;
    font-size: 1.5vw;
  }

  .grouped-button {
    font-size: 2.5vw;
    padding: 2vw;
  }

  .options {
    gap: 2vw;
  }

  .option-button {
    font-size: 1vw;
    padding: 2.5vh 2vw;
    width: 10vw;
  }

  .lives-container .life-icon {
    width: 4vw;
    height: 4vw;
  }

  .game-over-message,
  .good-job-message,
  .one-away-message {
    font-size: 2vw;
    padding: 1.5vh 3vw;
  }
}

@media screen and (max-width: 480px) {
  .title {
    font-size: 5vw;
    margin-bottom: 5vw;
  }

  .word-button {
    width: 18vw;
    height: 18vh;
    font-size: 2vw;
  }

  .grouped-button {
    font-size: 3vw;
    padding: 2.5vw;
  }

  .options {
    gap: 3vw;
  }

  .option-button {
    font-size: 1.2vw;
    padding: 3vh 2.5vw;
    width: 15vw;
  }

  .lives-container .life-icon {
    width: 5vw;
    height: 5vw;
  }

  .game-over-message,
  .good-job-message,
  .one-away-message {
    font-size: 2.5vw;
    padding: 2vh 4vw;
  }
}

@media screen and (orientation: portrait) {
  .word-button {
    width: 22.0vw; 
    height: 7.5vh; 
    font-size: 3vw;
  }

  .option-button {
    width: 12.0vw; 
    height: 4.5vh; 
    font-size: 2vw;
    padding: 2vh 1.2vw; 
  }

  .option-button.deselect-all {
    width: 12.0vw; 
    height: 4.5vh; 
    font-size: 2vw;
    padding: 2vh 1.2vw; 
  }

  .lives-container .life-icon {
    width: 10.0vw; 
    height: 5vh; 
    font-size: 1.5vw;
  }

  .title .main {
    font-size: 11vw; 
  }

  .title .sub {
    font-size: 11vw; 
  }

  .grid-container {
    margin-bottom: 6vh; 
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5vw; 
    width: 100%;
    max-width: 38.8vw;
    height: auto;
    padding: 0vw;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
  }

  .grouped-button {
    width: 90vw; 
    height: 15vw; 
    font-size: 4.5vw; 
    grid-column: span 4; 
    margin: 0 auto; 
  }

  .grouped-button .button-names {
    font-size: 2vw; 
  }
}


@media (max-width: 600px) {
  .howToPlayTextBox, .overlay-text-box {
    width: 95%; /* More responsive width on small screens */
    padding: 15px; /* Reduce padding on small screens */
  }

  .overlay-text-box ul {
    margin-left: 15px; /* Less margin on small screens */
  }
}

@media screen and (orientation: portrait) {
  .how-to-play-button{
    font-size: 2.5vw;
    padding: 1vw 2vw;
  }

}

@media screen and (orientation: portrait){
  .overlay-text-box{
    max-width: 90vw;
  }
}
