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

body {
  font-family: 'Nunito', sans-serif;
  background: #f0f4f8;
  color: #333;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #ff6b35, #e85d2a);
  color: #fff; font-family: 'Nunito', sans-serif;
}
.btn-back {
  color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem;
  padding: 0.3rem 0.7rem; border-radius: 8px; background: rgba(255,255,255,0.15);
}
.btn-back:hover { background: rgba(255,255,255,0.3); }
.game-title { font-size: 1.25rem; font-weight: 800; }
.stats { font-weight: 700; }

.game-container {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 0.8rem; gap: 0.8rem;
  max-width: 500px; margin: 0 auto; width: 100%;
}

.controls-bar {
  display: flex; gap: 0.8rem; align-items: center;
}
.select-diff {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.9rem;
  padding: 0.4rem 0.8rem; border-radius: 8px; border: 2px solid #ddd;
  background: #fff; cursor: pointer;
}
.btn-sm {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.9rem;
  padding: 0.4rem 1rem; border-radius: 8px; border: none;
  background: #ff6b35; color: #fff; cursor: pointer;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(400px, 95vw);
  aspect-ratio: 1;
  background: #333;
  gap: 1px;
  border: 3px solid #333;
  border-radius: 4px;
}

.cell {
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(0.9rem, 4vw, 1.4rem);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  aspect-ratio: 1;
}

.cell.given { color: #333; font-weight: 800; }
.cell.user { color: #2196f3; }
.cell.selected { background: #bbdefb; }
.cell.same-num { background: #e3f2fd; }
.cell.conflict { color: #f44336; background: #ffebee; }
.cell.highlight-row,
.cell.highlight-col,
.cell.highlight-box { background: #f5f5f5; }

/* 3x3 box borders */
.cell.border-right { border-right: 2px solid #333; }
.cell.border-bottom { border-bottom: 2px solid #333; }

.numpad {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  max-width: 400px;
}
.num-btn {
  width: clamp(36px, 9vw, 48px); height: clamp(36px, 9vw, 48px);
  border: 2px solid #ddd; border-radius: 10px; background: #fff;
  font-family: 'Nunito', sans-serif; font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.3rem); cursor: pointer;
  color: #333; transition: background 0.15s, transform 0.1s;
}
.num-btn:active { transform: scale(0.93); }
.num-btn:hover { background: #e3f2fd; }
.erase-btn { color: #f44336; font-weight: 800; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 2rem;
  text-align: center; max-width: 360px; width: 100%;
}
.modal h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.modal p { font-size: 1rem; margin-bottom: 1rem; color: #666; }
.btn-orange {
  background: linear-gradient(135deg, #ff6b35, #e85d2a); color: #fff;
  padding: 0.7rem 2rem; font-size: 1rem; border-radius: 10px; border: none;
  cursor: pointer; font-family: 'Nunito', sans-serif; font-weight: 700;
}

/* ===== RESPONSIVIDADE MOBILE ===== */
@media (max-width: 480px) {
  .game-container { padding: 0.4rem; gap: 0.5rem; }
  .controls-bar { gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
  .select-diff { font-size: 0.8rem; padding: 0.3rem 0.6rem; }
  .btn-sm { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
  .board { width: min(340px, 98vw); border-width: 2px; }
  .cell.border-right { border-right-width: 1.5px; }
  .cell.border-bottom { border-bottom-width: 1.5px; }
  .numpad { gap: 4px; max-width: 340px; }
  .num-btn {
    width: clamp(30px, 8.5vw, 40px);
    height: clamp(30px, 8.5vw, 40px);
    font-size: clamp(0.85rem, 3.5vw, 1.1rem);
    border-radius: 8px;
  }
}

/* ===== SEO GAME INFO SECTION ===== */
.game-info {
  max-width: 780px;
  margin: 1rem auto;
  padding: 1rem 1.2rem;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  line-height: 1.6;
}
.game-info h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.5rem; }
.game-info h3 { font-size: 0.95rem; font-weight: 700; margin: 0.8rem 0 0.3rem; }
.game-info ul { padding-left: 1.2rem; }
.game-info li { margin-bottom: 0.2rem; }
