* {
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #14532d 0%, #166534 25%, #4d7c0f 50%, #1a2e05 75%, #14532d 100%);
  background-size: 300% 300%;
  animation: gradientShift 14s ease infinite;
  position: relative;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#fireworks-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 24px 20px 32px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
}

.levels { display: flex; gap: 8px; margin-bottom: 20px; }

.lvl-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid #d9f99d;
  background: #f7fee7;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.lvl-btn.active {
  background: linear-gradient(135deg, #84cc16, #4d7c0f);
  border-color: #3f6212;
  color: #fff;
  font-weight: 700;
}

.stats { display: flex; gap: 10px; margin-bottom: 20px; }

.stat {
  flex: 1;
  background: #ecfccb;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.stat .label { font-size: 12px; color: #4d7c0f; font-weight: 700; }
.stat .value { font-size: 22px; font-weight: 800; color: #365314; margin-top: 2px; }

.question-box {
  background: #f7fee7;
  border: 1px solid #d9f99d;
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
}

#prompt {
  font-size: 15px;
  font-weight: 700;
  color: #365314;
  margin-bottom: 14px;
}

/* ---------- Board ---------- */
.sudoku-board {
  display: grid;
  gap: 1px;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 14px;
  padding: 3px;
  background: #365314;
  border-radius: 10px;
}

.sd-cell {
  min-width: 0;
  border: none;
  padding: 0;
  background: #fff;
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  color: #2563eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-cell.box-right { margin-right: 2px; }
.sd-cell.box-bottom { margin-bottom: 2px; }

.sd-cell.given { color: #1f2937; background: #f1f5f9; cursor: default; }
.sd-cell.peer { background: #ecfccb; }
.sd-cell.given.peer { background: #e2efc4; }
.sd-cell.same { background: #bef264; }
.sd-cell.selected { background: #fbbf24; }
.sd-cell.wrong { background: #fee2e2; color: #dc2626; }

.sudoku-board.size-6 .sd-cell { font-size: 22px; }
.sudoku-board.size-9 .sd-cell { font-size: 18px; }

/* ---------- Number pad ---------- */
.numpad {
  display: flex;
  gap: 6px;
  max-width: 360px;
  margin: 0 auto 12px;
}

.num-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(160deg, #84cc16, #4d7c0f);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.num-btn:hover:not(:disabled) { filter: brightness(1.1); }
.num-btn.done { background: #d4d4d8; color: #a1a1aa; cursor: default; }

#feedback {
  min-height: 20px;
  font-weight: 700;
  font-size: 14px;
}

.feedback-correct { color: #15803d; }
.feedback-wrong { color: #dc2626; }
.feedback-info { color: #4d7c0f; }

.actions { display: flex; gap: 8px; margin-top: 16px; }

.action-btn {
  flex: 1;
  padding: 12px 6px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.clear-btn { background: #e5e7eb; color: #374151; }
.clear-btn:hover { background: #d1d5db; }
.hint-btn { background: #fbbf24; color: #78350f; }
.hint-btn:hover { background: #f59e0b; }
.check-btn { background: #4d7c0f; color: #fff; }
.check-btn:hover { background: #3f6212; }