* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 520px;
  width: 100%;
}

h1 {
  color: #1e3c72;
  margin-bottom: 16px;
  font-size: 1.8rem;
}

.toolbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar button,
.toolbar select {
  padding: 8px 14px;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #e8eef7;
  color: #1e3c72;
  font-weight: 600;
  transition: background 0.2s;
}

.toolbar button:hover,
.toolbar select:hover {
  background: #d4deee;
}

.toolbar #new-game {
  background: #2a5298;
  color: #fff;
}

.toolbar #new-game:hover {
  background: #1e3c72;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  width: min(100%, 432px);
  margin: 0 auto 16px;
  border: 3px solid #1e3c72;
  background: #1e3c72;
  grid-gap: 1px;
}

.cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  background: #fff;
  color: #1e3c72;
  cursor: pointer;
  user-select: none;
  border: none;
}

.cell.given {
  color: #333;
  background: #f0f4fa;
}

.cell.selected {
  background: #ffe08a;
}

.cell.same-num {
  background: #ffeeba;
}

.cell.error {
  background: #ffb3b3;
  color: #c0392b;
}

.cell.hint-cell {
  background: #b8e994;
  color: #1e7d32;
}

.cell:nth-child(3n + 3) {
  border-right: 2px solid #1e3c72;
}

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

.numpad {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.num-btn {
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #e8eef7;
  color: #1e3c72;
  transition: background 0.2s, transform 0.1s;
}

.num-btn:hover {
  background: #d4deee;
}

.num-btn:active {
  transform: scale(0.92);
}

.num-btn.done {
  background: #b8e994;
}

.status {
  min-height: 24px;
  font-size: 1rem;
  color: #555;
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal h2 {
  color: #1e3c72;
  margin-bottom: 8px;
}

.modal p {
  color: #555;
  margin-bottom: 20px;
}

.modal button {
  padding: 10px 28px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #2a5298;
  color: #fff;
  font-weight: 600;
}

.modal button:hover {
  background: #1e3c72;
}
