body {
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  margin: 0;
  background-color: #f7f7f7;
  color: #333;
}

h1 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.top-banner {
  height: 25px; /* Adjust the height as needed */
  background-color: #4e79a5; /*#77b7b2; /*#333; /* Choose your desired background color */
  position: fixed; /* Ensures the banner stays at the top of the viewport */
  top: 0;
  left: 0;
  width: 100%; /* Ensures the banner spans the full width of the viewport */
  z-index: 1000; /* Ensures the banner is on top of other elements */
}

.main-container {
    width: 100%;
    max-width: 600px; /* Adjust this value to match the desired width */
    margin: 0 auto; /* Center the container */
    padding: 0 20px; /* Add some padding to prevent elements from touching the edges */
    box-sizing: border-box; /* Include padding in the width calculation */
}

.grid {
  display: grid;
  grid-template-rows: repeat(3, auto);
  gap: 0.8rem;
  margin-top: 1rem;
  margin-bottom: 2rem;

  position: relative; /* Needed for absolute positioning of children */
}


.row {
  display: flex;
  justify-content: center;
  gap: 0.2rem;
  margin: 0 0;
  user-select: none;
}

.letter-block {
  width: 3rem;
  height: 3rem;
  font-size: 1.8rem;
  border: 2px solid #666;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  background-color: #bab0ac;
  position: relative;
}

.letter-block.active::after {
  content: "•";
  color: #333;
  font-size: 2rem;
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.green {
  border: 2px solid #000;
  background-color: #5aa155 !important;
}

.block-marker {
  border: 2px solid #4e79a5;
  background-color: #77b7b2 !important;
}

#guess-word {
  position: relative;
  z-index: 10; /* Ensure this is higher than the z-index of the upper and lower rows */
}

#before-word, #after-word {
  position: relative;
  z-index: 5; /* Ensure this is lower than the z-index of the guess row */
}

#guess-word::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  white-space: nowrap;
  visibility: hidden;
}

#before-word .letter-block {
  border: 2px solid #4e79a5;
  background-color: #77b7b2;
}

#after-word .letter-block {
  border: 2px solid #4e79a5;
  background-color: #77b7b2;
}

#message {
  margin-top: 1rem;
  font-weight: bold;
  text-align: center;
}

@media (max-width: 500px) {
  .letter-block {
    width: 3rem;
    height: 3rem;
    font-size: 1.8rem;
  }
}


#attempts-container {
    display: flex;
/*    justify-content: space-between; */
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 10px;
    margin-top: 1rem;

    box-sizing: border-box; /* Include padding in the width calculation */
}

.circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #000; /* Svart fyllning från början */
    border: 1px solid #000;
}

.circle-row {
    display: flex;
    justify-content: center;
    gap: 10px; /* Adjust the gap between circles as needed */
    margin-top: 0.5rem; /* Adjust the margin between rows as needed */
    margin-bottom: 10px; /* Adjust the margin between rows as needed */
}


#gap-length {
    font-family: monospace;
    position: absolute;
    left: 50%; /* Start from the center */
    bottom: -1.8rem; /* Position it below the lowest letter-block */
    transform: translateX(-50%); /* Adjust to align with the leftmost letter-block */
    font-size: 1.0rem; /* Small text */
    margin-left: calc( - 3.8rem); /* Adjust to align with the leftmost letter-block */
}


.shake {
  animation: shake 0.4s ease-in-out, wrongfadeColors 0.8s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  55% {
    transform: translateX(2px);
  }
}

@keyframes wrongfadeColors {
  0%, 100% {
    background-color: #bab0ac;
    border-color: #666;
  }
  5%,50% {
    background-color: #e0585b;
    border-color: #d52a2d;
  }
}


.green-transition {
  transition: background-color 1s, border-color 1s;
}

.translate-up {
  transform: translateY(-4.05rem);
  transition: transform 0.6s;
}

.translate-down {
  transform: translateY(4.05rem);
  transition: transform 0.6s;
}
