.anagram-wrap {
  display: grid;
  gap: 16px;
}

.anagram-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(145deg, #ffffff 0%, #f3faff 100%);
}

.anagram-topbar h1 {
  margin: 0;
}

.anagram-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.board-shell {
  display: grid;
  gap: 14px;
}

.board-shell.single-mode {
  grid-template-columns: minmax(0, 780px);
  justify-content: center;
}

.board-shell.two-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.anagram-board {
  display: grid;
  gap: 14px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fbff 70%, #edf6ff 100%);
}

.board-head {
  display: grid;
  gap: 10px;
}

.player-title {
  margin: 0;
  font-size: 1.1rem;
}

.anagram-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.subject-chip {
  display: inline-block;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #cfe0f4;
  background: #f0f8ff;
  color: #27517b;
  font-weight: 700;
}

.letters {
  min-height: 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: #fff;
}

.letter-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #ddebff, #96cbff);
  color: #050505;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.4px;
  font-size: 1.08rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 111, 255, 0.28);
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}

.letter-btn:hover,
.letter-btn:focus-visible {
  transform: translateY(-1px);
  filter: brightness(0.98);
  outline: none;
}

.guess-form {
  display: grid;
  gap: 6px;
}

.guess-input {
  font-size: 1.05rem;
}

.guess-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-msg {
  min-height: 22px;
  margin: 0;
}

.status-msg.ok {
  color: #11703f;
  font-weight: 700;
}

.status-msg.bad {
  color: #b42318;
  font-weight: 700;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 24, 40, 0.7), rgba(5, 14, 28, 0.76));
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 80;
}

.modal-overlay.hidden {
  display: none !important;
}

.winner-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 18, 34, 0.7);
  z-index: 90;
  overflow: hidden;
}

.winner-modal[hidden] {
  display: none !important;
}

.winner-card {
  width: min(540px, calc(100% - 32px));
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #cfe0f4;
  box-shadow: 0 16px 36px rgba(7, 24, 48, 0.35);
  padding: 18px;
  text-align: center;
}

.winner-confetti {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 16px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
  }
}

.modal-card {
  width: min(620px, 100%);
  background: linear-gradient(155deg, #ffffff 0%, #f6fbff 100%);
}

.player-count-select {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.player-count-select label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .board-shell.two-mode {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .anagram-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .anagram-stats {
    grid-template-columns: 1fr;
  }

  .letter-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1rem;
  }
}
