/* Responsive grid for Stretchle */
body {
  overflow-x: hidden;
  box-sizing: border-box;
}

.grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 98vw;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.grid-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/* Each letter box */
.box {
  width: min(10vw, 48px);
  height: min(10vw, 48px);
  max-width: 48px;
  max-height: 48px;
  margin: 0.15em;
  font-size: 2rem;
  text-align: center;
  line-height: 1;
  box-sizing: border-box;
  border: 2px solid #888;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
  color: #fff;
  text-transform: uppercase;
  transition: background 0.2s, border 0.2s;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
  max-width: 98vw;
  box-sizing: border-box;
}

.keyboard {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.key {
  background: #d3d6da;      /* Match .box.empty background */
  color: #fff;
  border: 2px solid #888;   /* Match .box border */
  border-radius: 6px;
  font-size: 1.2em;
  padding: 0;
  flex: 1 1 0;
  min-width: 28px;
  max-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  transition: background 0.2s, border 0.2s;
  box-sizing: border-box;
}
.key:active {
  background: #565758;
}
.key.special {
  min-width: 70px;
  background: #565758;
  border-color: #888;
}
@media (max-width: 600px) {
  .grid { transform: scale(0.85); }
  .key { font-size: 1em; padding: 10px 6px; min-width: 28px; }
  .keyboard-row { gap: 0px; margin-bottom: 4px; }
}

/* Status classes must come after .box and be at least as specific */
.box.right {
  background: #6aaa64;
  border-color: #6aaa64;
  color: #fff;
}
.box.wrong {
  background: #c9b458;
  border-color: #c9b458;
  color: #fff;
}
.box.empty {
  background: #3a3a3c;
  border-color: #3a3a3c;
  color: #fff;
}

/* For grid boxes */
.grid .box.right { background: #6aaa64; border-color: #6aaa64; }
.grid .box.wrong { background: #c9b458; border-color: #c9b458; }
.grid .box.empty { background: #3a3a3c; border-color: #3a3a3c; }

/* For keyboard keys */
.key.right { background: #6aaa64; border-color: #6aaa64; }
.key.wrong { background: #c9b458; border-color: #c9b458; }
.key.empty { background: #3a3a3c; border-color: #3a3a3c; }

/* Highlight the currently selected box */
.select {
  outline: 2px solid #fff;
  z-index: 1;
}

@keyframes pop-in {
  0% {
    transform: scale(0.7);
    opacity: 0.5;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.box.animated {
  animation: pop-in 0.18s cubic-bezier(.4,2,.3,1) forwards;
}