body {
  background-color: #0d0d0d;
  font-family: serif;
  display: flex;
  justify-content: center;
  height: 100vh;
  margin: 0;
  color: #d4af37;
  height: 100%;
}

.loom-frame {
  background: linear-gradient(145deg, #1a1a1a, #111);
  border: 2px solid #d4af37;
  border-radius: 14px;
  padding: 60px 40px;
  margin: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 450px;
}

.game-title {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 2px solid #d4af37;
  padding-bottom: 10px;
  width: 100%;
  text-align: center;
}

.warp-threads {
  display: flex;
  justify-content: space-between;
  width: 280px;
  min-height: 20px;
}

.thread {
  width: 1px;
  background: linear-gradient(to bottom, #d4af37cc, transparent);
  height: 100%;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  grid-template-rows: repeat(4, 64px);
  gap: 14px;
}

.cell {
  width: 64px;
  height: 64px;
  border: 1px solid #cfa638;
  border-radius: 4px;
  background-color: #1c1c1c;
  font-size: 1.4rem;
  font-weight: bold;
  color: #f5deb3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  user-select: none;
}

.cell:hover {
  background-color: #2b2b2b;
}

.banner-message {
  position: fixed;
  bottom: 48px;
  text-align: center;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 12px;
}

.word-input {
  width: 200px;
  padding: 11px;
  font-size: 1.2rem;
  border: 1px solid #d4af37;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  background-color: #d4af37;
  color: #000;
  font-weight: bold;
  margin-top: 12px;
  outline: none;
}

.cell.current-word {
  background-color: #d4af37;
  color: #000;
}

.cell.used:hover {
  background-color: #cfa638;
}

.cell.current {
  background-color: hsl(44, 60%, 50%);
}

.cell.previous-word {
  background-color: hsl(0, 0%, 34%);
}

.cell.possible-next {
  background-color: hsl(44, 60%, 20%);
}

.submit-button,
.clear-button {
  border: 2px solid #d4af37;
  background-color: transparent;
  color: #d4af37;
  padding: 10px 20px;
  font-size: 1.2rem;
  font-weight: bold;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
}

.clear-button {
  margin-left: 8px;
}

.current-input {
  color: #d4af37;
  border-bottom: 2px solid #cfa638;
  font-size: 1.4rem;
  font-weight: bold;
  margin: 12px 4px;
}

.letter-view {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  height: 64px;
  margin-top: 16px;
}

.letter-view span {
  width: 48px;
  height: 48px;
  border: 1px solid #cfa638;
  border-radius: 4px;
  background-color: #1c1c1c;
  font-size: 1.8rem;
  font-weight: bold;
  color: #f5deb3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.letter-view span:hover {
  background-color: #2b2b2b;
}

.divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 0%,
    #d4af37 30%,
    #d4af37 70%,
    transparent 100%
  );
}

.grid-wrapper {
  margin: 8px 0;
}

.flip-vertical {
  transform: scaleY(-1);
}

.button-container {
  margin-top: 12px;
}

.try-to-solve-message {
  margin: 12px;
  font-size: 20px;
  text-align: center;
}

@media (max-width: 768px) {
  .loom-frame {
    width: 90%;
    padding: 12px;
    margin: 12px;
  }

  .grid-container {
    grid-template-columns: repeat(4, 48px);
    grid-template-rows: repeat(4, 48px);
    gap: 10px;
  }

  .cell {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  .word-input {
    width: 160px;
    font-size: 1rem;
  }

  .submit-button,
  .clear-button {
    font-size: 1rem;
    padding: 8px 16px;
    margin-top: 4px;
  }

  .letter-view {
    margin-top: 4px;
  }

  .letter-view span {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }

  .button-container {
    margin-top: 4px;
  }

  .try-to-solve-message {
    font-size: 16px;
    margin: 8px;
  }
}

@media (max-width: 480px) {
  .loom-frame {
    width: 100%;
    padding: 8px;
    margin: 0;
  }

  .word-input {
    width: 120px;
    font-size: 0.9rem;
  }

  .submit-button,
  .clear-button {
    font-size: 0.9rem;
    padding: 6px 12px;
    margin-top: 2px;
  }

  .letter-view span {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}
