body {
  font-family: sans-serif;
  text-align: center;
  background: #faf0f0;
  margin: 0;
  padding: 20px;
}

h1 {
  font-weight: bolder;
  font-size: 2rem;
  margin: 40px;
}

#game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
}

.row {
  display: flex;
}

.tile {
  width: 40px;
  height: 40px;
  border: 2px solid #999;
  margin: 2px;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 40px;
  text-transform: uppercase;
  background-color: #fff;
} 


.correct, .key[data-state="correct"], .correct-color { background-color: #ad7a99; }
.present, .key[data-state="present"], .present-color { background-color: #b2cede; }
.absent, .key[data-state="absent"], .absent-color { background-color: #5a716a; }

input {
  font-size: 1.2rem;
  padding: 5px;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.keyboard {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

#keyEnter, #keyBack {
  width: 84.5px;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 10px;
  background-color: #ddd;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.key {
  font-size: 0.8rem;
  font-weight: bold;
  padding: 10px;
  background-color: #ddd;
  border: none;
  border-radius: 4px;
  width: 30px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.key[data-state="correct"] {
  background-color: #ad7a99;
  color: white;
}

.key[data-state="present"] {
  background-color: #b2cede;
  color: white;
}

.key[data-state="absent"] {
  background-color: #5a716a;
  color: white;
}

.legend {
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 30px auto;
  max-width: 400px;
  gap: 8px;
  padding: 10px;
  background-color: #f7f7f7;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #333;
}
strong {
  font-weight: bold;
}
.correct-color {
  background-color: #ad7a99;
  border-color: #8e5c7c;
}

.present-color {
  background-color: #b2cede;
  border-color: #89aabc;
}

.absent-color {
  background-color: #5a716a;
  border-color: #3c4f48;
}

.replayButton {
  margin: 5px;
  padding: 10px;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid #8e5c7c42;
  border-radius: 4px;
}

.replayButton:hover {
  background-color: #8e5c7c42;
  transition: 1s ease-in-out;
}

@media only screen and (max-width: 767px) {
  .tile { width: 28px; font-size: 1rem; }
  .key { margin-top:20px; width:60px; height: 50px; padding: 6px; font-size: 0.95rem; }
  #game, .keyboard { max-width: 98vw; }
  .legend { font-size: 0.95rem; }
}