/* ==============================
   Sudoku Game Styles
   ============================== */

/* Base */
body {
  font-family: Orbitron;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  background: #f4f4f4;
  color: #222;
  transition: background 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark {
  background: #222;
  color: #f4f4f4;
}

/* Container */
.container {
  max-width: 500px;
  margin: 20px;
  padding: 20px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
body.dark .container {
  background: #333;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#toggle-dark {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* Difficulty + New Game row */
.difficulty-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin: 10px 0 20px 0;
}

.difficulty-row select,
.difficulty-row button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #666;
  font-size: 1rem;
  cursor: pointer;
  background: #eee;
}

body.dark .difficulty-row select,
body.dark .difficulty-row button {
  background: #555;
  color: #fff;
  border-color: #777;
}


/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1; /* keeps it square */
  margin: 20px auto;
  border: 2px solid #000;
}

/* Prefilled (fixed) cells */
.cell.prefilled {
  background: #ebebeb;   /* light gray background */
  font-weight: bold;     /* make numbers stand out */
  cursor: default;       /* no pointer cursor */
}
body.dark .cell.prefilled {
  background: #555;      /* darker gray for dark mode */
}


.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  cursor: pointer;
  border: 1px solid #bbb;
  background: #fff;
  position: relative;
}
body.dark .cell {
  background: #444;
  border-color: #666;
}

/* Thicker lines for 3x3 boxes */
.cell {
  border-right: 1px solid #bbb;
  border-bottom: 1px solid #bbb;
}
.cell:nth-child(9n) {
  border-right: 2px solid #000;
}
.cell:nth-child(-n+9) {
  border-top: 2px solid #000;
}
.cell:nth-child(9n+1) {
  border-left: 2px solid #000;
}
.cell:nth-child(n+73) {
  border-bottom: 2px solid #000;
}
.cell:nth-child(3n) {
  border-right: 2px solid #000;
}
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid #000;
}

/* Highlight */
.cell.selected {
  background: #add8e6; /* light blue for selected */
}
body.dark .cell.selected {
  background: #2a3f5f; /* muted blue for dark mode */
}


/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#number-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

#number-buttons button,
.extra-controls button,
.difficulty-control select {
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  background: #eee;
  transition: background 0.2s;
}
body.dark #number-buttons button,
body.dark .extra-controls button,
body.dark .difficulty-control select {
  background: #555;
  color: #fff;
}
#number-buttons button:hover,
.extra-controls button:hover {
  background: #ddd;
}
body.dark #number-buttons button:hover,
body.dark .extra-controls button:hover {
  background: #666;
}

/* Pencil Marks */
.pencil-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  font-size: 0.6rem;
  color: #666;
}
body.dark .pencil-container {
  color: #aaa;
}
.pencil {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile-friendly */
@media (max-width: 600px) {
  .board {
    max-width: 95vw;
  }

  .cell {
    font-size: clamp(1rem, 4vw, 1.2rem);
  }

  #number-buttons button,
  .extra-controls button,
  .difficulty-control select {
    padding: 12px;
    font-size: 1.1rem;
  }
}
