:root {
  $black: #000;
  $white: #fff;
  $clear: transparent;
  $wordleBlack: #212121;
  $wordleBlack2: #272729;
  $wordleBlack3: #1a1a1b;
  $wordleBlack4: #121213;
  $wordleBlack5: #2f2f31;

  $calendarGray: #979797;
  --color-tone-1: #000;
  --color-tone-2: #787c7e;
  --color-tone-3: #878a8c;
  --color-tone-4: #d3d6da;
  --color-tone-5: #edeff1;
  --color-tone-6: #f6f7f8;
  --color-tone-7: #fff;
  --color-correct: #6aaa64;
  --color-present: #c9b458;
  --color-absent: #787c7e;
  --key-bg-correct: #538d4e;
  --key-bg-present: #b59f3b;
  --key-bg-absent: #787c7e;
  --key-evaluated-text-color: #ffffff;
  --key-evaluated-text-color-absent: #ffffff;
  --tile-text-color: #fff;
  --key-text-color: #000;
}
body {
  font-family: "Platypi", serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f0f0f0;
  margin-bottom: 40px;
}
.games-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}
.game {
  width: 800px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  margin: 0 auto;
  flex: 1;
}
@media (max-width: 1200px) {
  .game {
    flex: 1 1 100%;
    margin: 20px auto;
    max-width: 350px;
  }
}
.game > img {
  margin: 0 auto;
  text-align: center;
  display: block;
  cursor: pointer;
  transition: all 0.2s ease-in;
}
.game > img:hover {
  transform: rotate(25deg) scale(1.1);
}
.game h1 {
  text-align: center;
  font-weight: bold;
  margin-bottom: 12px;
  font-family: "Platypi", serif;
  font-optical-sizing: auto;
  font-style: normal;
}
.grid {
  display: grid;
  gap: 8px;
  width: calc(3 * 8px + 4 * 150px);
  bottom: 0;
  grid-template-columns: repeat(4, 1fr);
  min-height: 0;
  min-width: 0;
  height: auto;
  margin: 10px auto;
}
.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  grid-gap: 5px;
  padding: 10px;
  box-sizing: border-box;
  width: 300px;
  height: 360px;
  margin: 0 auto;
}
.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 5px;
}
.invalid {
  animation-name: Shake;
  animation-duration: 600ms;
}
.bounce {
  animation: Bounce 1s;
}
.tile {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  line-height: 1;
  font-weight: bold;
  vertical-align: middle;
  box-sizing: border-box;
  color: var(--tile-text-color);
  text-transform: uppercase;
}
/* Allow tiles to be smaller on small screens */
@media (max-height: 600px) {
  .tile {
    font-size: 1em;
  }
}
.tile[data-state="empty"] {
  border: 2px solid var(--color-tone-4);
}

.tile[data-state="tbd"] {
  background-color: var(--color-tone-7);
  border: 2px solid var(--color-tone-3);
  color: var(--color-tone-1);
}

.tile[data-state="correct"] {
  background-color: var(--color-correct);
  color: var(--key-evaluated-text-color);
}

.tile[data-state="present"] {
  background-color: var(--color-present);
  color: var(--key-evaluated-text-color);
}

.tile[data-state="absent"] {
  background-color: var(--color-absent);
  color: var(--key-evaluated-text-color-absent);
}

.tile[data-animation="pop"] {
  animation-name: PopIn;
  animation-duration: 100ms;
}

@keyframes PopIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.tile[data-animation="flip-in"] {
  animation-name: FlipIn;
  animation-duration: 250ms;
  animation-timing-function: ease-in;
}
@keyframes FlipIn {
  0% {
    transform: rotateX(0);
  }
  100% {
    transform: rotateX(-90deg);
  }
}

@keyframes FlipOut {
  0% {
    transform: rotateX(-90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

.tile[data-animation="flip-out"] {
  animation-name: FlipOut;
  animation-duration: 250ms;
  animation-timing-function: ease-out;
}

.message {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  color: white;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  font-size: 1.1em;
}

@keyframes Shake {
  10%,
  90% {
    transform: translateX(-1px);
  }

  20%,
  80% {
    transform: translateX(2px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }

  40%,
  60% {
    transform: translateX(4px);
  }
}

@keyframes Bounce {
  0%,
  20% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px);
  }
  50% {
    transform: translateY(5px);
  }
  60% {
    transform: translateY(-15px);
  }
  80% {
    transform: translateY(2px);
  }
  100% {
    transform: translateY(0);
  }
}

header {
  text-align: center;
  width: 80%;
  max-width: 800px;
  margin: 20px;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header img {
  width: 400px;
  height: auto;
}
@media (max-width: 1000px) {
  header img {
    width: 200px;
    height: auto;
  }
}

header h1 {
  font-size: 2em;
  margin-bottom: 10px;
}

header p {
  font-size: 1.2em;
  margin: 0;
}

.keyboard {
  display: flex;
  width: 60%;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}
@media (max-width: 1000px) {
  .keyboard {
    width: 90%;
  }

  .key {
    height: 30%;
    width: 80%;
  }
}

.keyboard-row {
  display: flex;
  width: 100%;
  margin: 0 auto 8px;
}
.key {
  font-size: 1.25em;
  font-weight: bold;
  background-color: #d3d6da;
  border: none;
  border-radius: 4px;
  margin: 0 6px 0 0;
  padding: 0;
  width: 100%;
  height: 58px;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  user-select: none;
  vertical-align: middle;
  box-sizing: border-box;
  cursor: pointer;
  text-transform: uppercase;
  color: var(--key-text-color);
  transition: background-color 0.1s ease, color 0.1s ease;
}
.key[data-state="correct"] {
  background-color: var(--key-bg-correct);
  color: var(--key-evaluated-text-color);
}

.key[data-state="present"] {
  background-color: var(--key-bg-present);
  color: var(--key-evaluated-text-color);
}

.key[data-state="absent"] {
  background-color: var(--key-bg-absent);
  color: var(--key-evaluated-text-color-absent);
}
.key.wide {
  flex: 1.5;
  font-size: 12px;
}
.hidden {
  display: none;
}

#congratulations,
#connectionCongratulations,
#wordleFail,
#connectionFail {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  z-index: 1000;
  animation: fadeIn 1s ease-in-out;
  width: 80%;
}

@media (max-width: 1000px) {
  #congratulations img,
  #connectionCongratulations img,
  #wordleFail img,
  #connectionFail img {
    width: 200px;
  }
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: white;
}
.close:hover {
  background: none;
  color: white;
}

#connectionCongratulations img,
#congratulations img {
  width: 300px;
  height: auto;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
.grid-item {
  font-size: 20px;
  overflow: hidden;
  min-width: 0;
  height: 80px;
  display: flex;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background-color: rgb(239, 239, 230);
  color: rgb(0, 0, 0);
  z-index: 0;
  transition: transform 0.5s ease-in-out;
}
.grid-item.selected,
.grid-item.matched {
  background-color: rgb(90, 89, 78);
  color: rgb(255, 255, 255);
  z-index: 1;
}
@media (max-width: 1000px) {
  .grid {
    width: calc(3 * 8px + 4 * 75px);
  }

  .grid-item {
    font-size: 11px;
    height: 40px;
  }
}

#matchedPart {
  width: calc(3 * 8px + 4 * 150px);
  margin: 0 auto;
}

@media (max-width: 1000px) {
  #matchedPart {
    width: calc(3 * 8px + 4 * 75px);
  }
}
.keyboard-row button {
  font-size: 1.25em;
  font-weight: bold;
  border: 0;
  padding: 0;
  margin: 0 6px 0 0;
  height: 58px;
  border-radius: 4px;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: #d3d6da;
  color: #000;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}
#connections button#submit {
  font-family: Arial;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  width: -moz-fit-content;
  width: fit-content;
  min-width: 5.5em;
  height: 3em;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 15px 0;
  max-width: 80vw;
  border-radius: 32px;
  line-height: 1.5em;
  cursor: pointer;
  border: 1px solid;
  margin: 0 auto;
}
#connections button#submit:hover {
  background-color: #fff;
}
#connections button#submit:disabled {
  background-color: rgb(255, 255, 255);
  color: rgb(127, 127, 127);
  border-color: rgb(127, 127, 127);
  pointer-events: none;
}
#connections button#submit:focus-visible {
  outline: 2px solid $outlineBlue;
}

.matched-group {
  display: block; /* Change this to block to span full width */
  padding: 25px;
  border-radius: 5px;
  font-size: 1em;
  font-weight: normal;
  box-sizing: border-box; /* Include padding and border in the element's total width and height */
  text-align: center;
  margin: 8px auto;
}

.matched-group h3 {
  font-family: Arial;
  margin: 0;
  font-weight: bold;
  font-size: 1.1em;
}

.matched-group p {
  font-family: Arial;
  margin: 5px 0 0 0;
  font-size: 1em;
}

@media (max-width: 1000px) {
  .matched-group {
    padding: 20px;
  }

  .matched-group h3 {
    font-size: 1em;
  }

  .matched-group p {
    font-size: 0.9em;
  }
}

.mistakes-wrapper {
  margin: 0 auto;
  text-align: center;
}
.mistakes-remaining {
  display: inline-flex;
  gap: 10px;
  margin-left: 10px;
  min-width: 120px;
}
.mistake-bubble {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background-color: rgb(90, 89, 78);
}
.bubbleMistakeAnimation {
  animation: pop ease-in 0.4s 1;
  animation-fill-mode: forwards;
}

@keyframes pop {
  25% {
    transform: scale(1.2);
  }
  75% {
    transform: scale(0.4);
  }
  100% {
    transform: scale(0);
  }
}

@keyframes zoomIn {
  25% {
    transform: scale(0.4);
  }
  75% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.zoom-in {
  animation: zoomIn 0.5s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    height: auto;
    margin: 8px 0;
  }
  to {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
  }
}

.fade-out {
  animation: fadeOut 0.25s ease-out;
}
