/* =========================
   Sudoku page
   ========================= */

.sudoku-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  color: #1a1a1a;
}

.game-page__title {
  margin: 0.25rem 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.game-copy {
  margin-top: 2rem;
  padding: 0 0.15rem 0.5rem;
  font-size: 0.95rem;
  line-height: 1.55;
}

.game-copy__lead {
  margin: 0 0 0.75rem;
  color: #1a1a1a;
  font-size: 1rem;
  line-height: 1.5;
}

.game-copy h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1a1a1a;
}

.game-copy p {
  margin: 0 0 0.75rem;
  color: #555;
}

.game-copy__links {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: #555;
}

.game-copy__links li {
  margin-bottom: 0.4rem;
}

.game-copy a {
  color: #1a1a1a;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.game-copy a:hover {
  color: #333;
}

.game-copy__faq {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.game-copy__faq-item {
  padding: 0.75rem 0.9rem;
  background: #f7f7f5;
  border: 1px solid #e2e2de;
  border-radius: 10px;
}

.game-copy__faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: #1a1a1a;
  font-size: 0.95rem;
}

.game-copy__faq-item p {
  margin: 0.55rem 0 0.1rem;
  color: #555;
  font-size: 0.9rem;
}

@media (min-width: 640px) {
  .game-page__title {
    font-size: 1.5rem;
  }
}

.sudoku-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}

.sudoku-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: #444;
}

.sudoku-difficulty select {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  cursor: pointer;
}

.sudoku-btn {
  border: 0;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: #2e7d32;
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.sudoku-btn:hover {
  background: #256428;
}

.sudoku-btn-secondary {
  background: #f0f0ee;
  color: #333;
  border: 1px solid #ddd;
}

.sudoku-btn-secondary:hover {
  background: #e6e6e2;
}

.sudoku-status {
  min-height: 1.4em;
  margin: 0.25rem 0 0.85rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
}

.sudoku-status.is-error {
  color: #c62828;
}

.sudoku-status.is-success {
  color: #2e7d32;
  font-weight: 700;
  font-size: 1.15rem;
}

.sudoku-board-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.sudoku-board {
  --cell: clamp(2rem, 9.5vw, 3.35rem);
  display: grid;
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(9, var(--cell));
  width: calc(var(--cell) * 9);
  border: 2px solid #1a1a1a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
}

.sudoku-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell);
  height: var(--cell);
  box-sizing: border-box;
  border-right: 1px solid #cfcfcf;
  border-bottom: 1px solid #cfcfcf;
  font-size: clamp(1rem, 4.2vw, 1.45rem);
  font-weight: 500;
  color: #1a1a1a;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.sudoku-cell:nth-child(9n) {
  border-right: none;
}

.sudoku-cell:nth-child(n + 73) {
  border-bottom: none;
}

.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid #1a1a1a;
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 2px solid #1a1a1a;
}

.sudoku-cell.given {
  font-weight: 700;
  color: #111;
  cursor: default;
}

.sudoku-cell.user {
  color: #1565c0;
  font-weight: 600;
}

.sudoku-cell.peer {
  background: #f3f6fb;
}

.sudoku-cell.selected {
  background: rgba(0, 106, 255, 0.22);
}

.sudoku-cell.error {
  background: #ffebee;
  color: #c62828;
}

.sudoku-cell.selected.error {
  background: #ffcdd2;
}

.sudoku-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: calc(clamp(2rem, 9.5vw, 3.35rem) * 9);
  margin: 0 auto;
}

.pad-btn {
  border: 1px solid #d5d5d0;
  border-radius: 10px;
  background: #f7f7f5;
  color: #1a1a1a;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.7rem 0;
  cursor: pointer;
  min-height: 2.75rem;
}

.pad-btn:hover {
  background: #ecece8;
}

.pad-btn:active {
  background: #e0e0da;
}

.pad-btn-clear {
  grid-column: span 1;
  font-size: 0.85rem;
  font-weight: 500;
}

@media (max-width: 420px) {
  .sudoku-pad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .pad-btn-clear {
    font-size: 0.75rem;
    padding: 0.55rem 0.15rem;
  }
}
