:root {
  --wl-cell: clamp(52px, 14vw, 72px);
  --wl-line: #b8ff2e;
  --wl-line-glow: rgba(184, 255, 46, 0.45);
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.wl-current {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 2rem;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.wl-current__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.wl-current__word {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  min-width: 3ch;
}

.wl-current__word.is-empty {
  color: var(--text-muted);
}

.wl-current__word.is-shake {
  animation: wl-shake 0.35s ease;
  color: var(--pink);
}

.wl-board-shell {
  position: relative;
  width: calc(var(--wl-cell) * 5);
  height: calc(var(--wl-cell) * 5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.wl-board {
  display: grid;
  grid-template-columns: repeat(5, var(--wl-cell));
  grid-template-rows: repeat(5, var(--wl-cell));
  width: 100%;
  height: 100%;
  background: var(--bg-card);
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wl-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.2vw, 1.65rem);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.12s;
}

.wl-cell--active {
  background: rgba(184, 255, 46, 0.18);
  color: var(--green);
  outline: 2px solid var(--green);
  outline-offset: -2px;
  z-index: 1;
}

.wl-cell--used {
  background: rgba(184, 255, 46, 0.08);
  color: var(--green-dim);
}

.wl-cell--required-hit {
  box-shadow: inset 0 0 0 2px rgba(255, 159, 26, 0.55);
}

.wl-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.wl-path line {
  stroke: var(--wl-line);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--wl-line-glow));
}

.wl-path circle {
  fill: var(--wl-line);
  filter: drop-shadow(0 0 4px var(--wl-line-glow));
}

.wl-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.wl-actions .btn {
  min-width: 120px;
}

.wl-finish-btn {
  margin-top: 10px;
}

.board-status {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.board-status.is-error {
  color: var(--pink);
}

.board-status.is-ok {
  color: var(--green);
}

.wl-progress {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.wl-words {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.wl-words__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.92rem;
}

.wl-words__word {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wl-words__word--rare {
  color: var(--orange);
}

.wl-words__score {
  color: var(--green);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.wl-words__empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 4px 0;
}

.wl-required {
  width: min(100%, calc(var(--wl-cell) * 5));
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.wl-required__title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.wl-required__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wl-required__chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wl-required__chip--done {
  border-color: var(--green);
  background: rgba(184, 255, 46, 0.12);
  color: var(--green);
  text-decoration: line-through;
}

.levels-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.levels-list__btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
}

.levels-list__btn:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.levels-list__btn--active {
  border-color: var(--green);
  background: rgba(184, 255, 46, 0.08);
}

.levels-list__btn--locked {
  opacity: 0.55;
}

.levels-list__stars {
  color: var(--orange);
  font-weight: 700;
  white-space: nowrap;
}

.scores__total {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.scores__total-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 500;
}

.scores__breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scores__breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.scores__breakdown strong {
  color: var(--text);
}

.scores__meta {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.leaderboard-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leaderboard-scope__btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.leaderboard-scope__btn--active {
  color: #0a0f14;
  background: linear-gradient(135deg, var(--green), var(--green-dim));
  border-color: transparent;
}

.modal__dialog--generating {
  width: min(280px, 100%);
  padding: 22px;
}

.modal__text--generating {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

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

@media (max-width: 900px) {
  :root {
    --wl-cell: clamp(56px, 16vw, 70px);
  }

  .wl-words {
    max-height: 200px;
  }

  .levels-list {
    max-height: 180px;
  }
}

@media (max-width: 560px) {
  .wl-actions .btn {
    flex: 1 1 calc(50% - 10px);
    min-height: 44px;
  }

  .wl-current__word {
    font-size: 1.1rem;
  }
}
