/* Global Styles */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background-color: #f5f5f5;
}

h1 {
  text-align: center;
}

/* Controls container */
#controls {
  text-align: center;
  margin-bottom: 10px;
}

ul.controls {
  list-style-type: none;
  padding: 0;
  margin: 0 auto;
  width: 220px;
}

ul.controls li {
  margin-bottom: 10px;
}

#controls input[type="range"] {
  vertical-align: middle;
  width: 90%;
  font-size: 1em;
  margin: 5px 0;
}

#controls button {
  margin: 5px;
  padding: 5px 10px;
  font-size: 1em;
}

/* Larger controls on mobile */
@media (max-width: 1000px) {
  ul.controls {
    width: 90%;
  }
  #controls input[type="range"],
  #controls button {
    width: 90%;
    height: 80px;      /* roughly the same height as a cell */
    font-size: 1.5em;
    padding: 10px;
    margin: 10px 0;
  }
}

/* Sudoku board container */
#sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 80px);
  grid-template-rows: repeat(9, 80px);
  gap: 0;
  width: 720px;
  margin: 0 auto;
  border: 3px solid black;
  background-color: white;
}

/* Each sudoku cell */
.cell {
  position: relative;
  width: 80px;
  height: 80px;
  box-sizing: border-box;
  border: 1px solid #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5em;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

.selected {
  background-color: #ffeb3b;
}

/* Highlight other cells with the same value when one filled cell is selected */
.cell.same-value {
  background-color: lightblue;
}

/* Thicker borders at block boundaries */
.block-left  { border-left: 3px solid black; }
.block-right { border-right: 3px solid black; }
.block-top   { border-top: 3px solid black; }
.block-bottom{ border-bottom: 3px solid black; }

/* Candidate grid inside an empty cell */
.candidates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  font-size: 0.4em;
  text-align: center;
  color: #0066CC;
  pointer-events: none;
}

.candidate {
  line-height: 26px;
}

/* Message styling */
#message, #errorCount {
  text-align: center;
  font-size: 1.5em;
  margin-top: 10px;
}

/* On-screen keyboard styling */
#onscreen-keyboard {
  text-align: center;
  margin: 20px auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

#onscreen-keyboard .key {
  width: 60px;
  height: 60px;
  font-size: 2em;
  border: 2px solid #333;
  border-radius: 5px;
  background-color: #fff;
  cursor: pointer;
}

/* Optional: Increase on-screen keyboard size on very small devices */
@media (max-width: 400px) {
  #onscreen-keyboard .key {
    width: 50px;
    height: 50px;
    font-size: 1.8em;
  }
}
