body {
  font-family: Inter, sans-serif;
}

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

/* Score pills */
.score-pill {
  background: #1f2937;
  border-radius: 8px;
  padding: 5px 10px;
  text-align: center;
  min-width: 52px;
}
.score-pill .label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9ca3af;
  text-transform: uppercase;
}
.score-pill .value {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

/* Difficulty pills */
.diff-btn {
  border: 1px solid #e5e7eb;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.diff-btn:hover {
  border-color: #6ee7b7;
  color: #065f46;
  background: #f0fdf4;
}
.diff-btn.active {
  border-color: #059669;
  color: #065f46;
  background: #ecfdf5;
}

/* ── Sudoku Board ── */
#sudoku-wrap {
  display: flex;
  justify-content: center;
}

#sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid #1f2937;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
  max-width: 360px;
  touch-action: manipulation;
}

.cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, 3.5vw, 18px);
  font-weight: 700;
  border: 1px solid #d1d5db;
  cursor: pointer;
  position: relative;
  background: #fff;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Thick box borders — right of cols 3,6 */
.cell:nth-child(9n + 3),
.cell:nth-child(9n + 6) {
  border-right: 2px solid #6b7280;
}
/* Thick box borders — bottom of rows 3,6 */
.cell[data-row="2"],
.cell[data-row="5"] {
  border-bottom: 2px solid #6b7280;
}

/* States */
.cell.given {
  background: #f9fafb;
  color: #111827;
}
.cell.selected {
  background: #d1fae5 !important;
}
.cell.highlight {
  background: #f0fdf4;
}
.cell.error {
  color: #dc2626 !important;
  background: #fef2f2 !important;
}
.cell.correct {
  color: #059669;
}

/* Notes grid inside cell */
.cell-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 1px;
}
.note-digit {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(5px, 1.2vw, 8px);
  font-weight: 600;
  color: #6b7280;
  line-height: 1;
}
.note-digit.active {
  color: #059669;
}

/* Number pad */
#numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  max-width: 360px;
  margin: 0 auto;
}
.num-btn {
  aspect-ratio: 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 700;
  color: #1f2937;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.num-btn:hover {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.num-btn.active {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.num-btn.erase {
  font-size: 16px;
}

/* Action buttons row */
.action-btn {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
  white-space: nowrap;
}
.action-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.action-btn.notes-on {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

/* Win overlay */
#win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#win-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.win-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.75rem 2rem;
  text-align: center;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: winSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes winSlide {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
.win-stat {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
}
.win-stat .wlabel {
  font-size: 9px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.win-stat .wvalue {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  z-index: 999;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* Related games */
.related-game-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
.related-game-card:hover {
  border-color: #6ee7b7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}
.related-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

@keyframes timerPulse {
  0%,
  100% {
    color: #ef4444;
  }
  50% {
    color: #fca5a5;
  }
}
.timer-warn {
  animation: timerPulse 0.8s ease-in-out infinite;
}

/* Shake on error */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
.shake {
  animation: shake 0.25s ease-in-out;
}
