/* ===========================
   FONTE BASE E RESET
=========================== */
* {
  box-sizing: border-box;
  font-family: "Inter", Arial, sans-serif;
  margin: 0;
  padding: 0;
}

body {
  background: #f2f2f2;
  color: #333;
  display: flex;
  justify-content: center;
  padding: 15px;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
  background: #121212;
  color: #eee;
}

/* ===========================
   CONTAINER GERAL
=========================== */
.container {
  max-width: 480px; /* perfeito para mobile estilo app */
  width: 100%;
  text-align: center;
}

/* ===========================
   LOGO E CABEÇALHO
=========================== */
.logo {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.top-header {
  margin-bottom: 15px;
}

.top-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.top-controls button,
.top-controls select {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  background: #007bff;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease;
}

.top-controls button:hover {
  background: #005fcc;
}

.top-controls select {
  background: #e4e4e4;
  color: #333;
}

body.dark .top-controls select {
  background: #222;
  color: #eee;
}

/* ===========================
   THEME TOGGLE BUTTON
=========================== */
#theme-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #007bff;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 30;
}

/* ===========================
   INFO BAR
=========================== */
#game-info {
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 500;
}

/* ===========================
   SUDOKU GRID
=========================== */
#sudoku-grid {
  width: 95%;
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid #000;
  background: white;
}

body.dark #sudoku-grid {
  background: #1a1a1a;
  border-color: #eee;
}

.cell {
  width: 100%;
  padding-top: 100%; /* mantém quadrado perfeito */
  position: relative;
  border: 1px solid #999;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

.cell > span {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cell.given {
  background: #e9e9e9;
  color: #000;
}

body.dark .cell.given {
  background: #333;
  color: #fff;
}

/* BLOCO 3x3 */
.cell:nth-child(3n) {
  border-right: 3px solid #000;
}
#sudoku-grid .cell:nth-child(n+19):nth-child(-n+27),
#sudoku-grid .cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 3px solid #000;
}

/* ===========================
   NUMBER PAD
=========================== */
#number-pad {
  margin: 15px auto;
  display: grid;
  width: 95%;
  max-width: 460px;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

#number-pad button {
  padding: 15px 0;
  font-size: 1.6rem;
  border-radius: 12px;
  background: #eee;
  border: 1px solid #ccc;
  cursor: pointer;
}

#number-pad button:disabled {
  background: #ccc;
}

body.dark #number-pad button {
  background: #222;
  border-color: #444;
  color: white;
}

/* ===========================
   ACTION BAR — BOTÕES CIRCULARES
=========================== */
#action-bar {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.circle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #007bff;
  color: white;
  font-size: 1.7rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.circle-btn:hover {
  background: #005fcc;
  transform: scale(1.1);
}

.circle-btn:disabled {
  background: #888;
  opacity: 0.5;
}

/* ===========================
   FOOTER
=========================== */
.footer {
  margin-top: 25px;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* ===========================
   PAUSE MODAL
=========================== */
#pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.pause-box {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  width: 80%;
  max-width: 300px;
}

body.dark .pause-box {
  background: #222;
  color: #eee;
}

#resume-btn {
  margin-top: 15px;
  padding: 12px 20px;
  background: #007bff;
  border: none;
  color: white;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ===========================
   WIN MODAL
=========================== */
#win-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 60;
}

.win-box {
  background: white;
  padding: 30px;
  border-radius: 15px;
  width: 80%;
  max-width: 300px;
  text-align: center;
}

body.dark .win-box {
  background: #222;
  color: #eee;
}

#play-again {
  margin-top: 15px;
  padding: 12px 20px;
  background: #007bff;
  border: none;
  color: white;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
}

/* ===========================
   RESPONSIVIDADE EXTRA
=========================== */
@media (min-width: 600px) {
  #sudoku-grid {
    max-width: 500px;
  }

  #number-pad {
    max-width: 500px;
  }

  .circle-btn {
    width: 70px;
    height: 70px;
    font-size: 1.9rem;
  }
}
