/* Modernized rebuild of 6x6sudoku.com's inline styles.
   Same palette/identity as the original: blue header banner, gray navbar,
   blue bold form cells, double-border box grouping. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #EEEEFF;
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  border: 4px solid #000;
}

.topper {
  color: #FFFFFF;
  background-color: #6666FF;
  text-align: center;
  padding: 0.5rem;
}

.topper h1 {
  margin: 0;
  font-size: 1.5rem;
}

.layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.navbar {
  background-color: #CCCCCC;
  width: 185px;
  flex-shrink: 0;
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.navbar ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.board-area {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sudoku grid: CSS Grid replaces the old nested <table> box structure.
   --grid-size / --box-rows / --box-cols are set inline by sudoku-engine.js
   so the same stylesheet works for other grid sizes (e.g. a future 12x12). */
.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size), 40px);
  grid-template-rows: repeat(var(--grid-size), 40px);
  border: 3px solid #000;
  border-style: double;
}

.sudoku-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #000;
  font-weight: bolder;
  font-size: 1.1rem;
}

.sudoku-cell.box-top {
  border-top-style: double;
  border-top-width: 3px;
}
.sudoku-cell.box-bottom {
  border-bottom-style: double;
  border-bottom-width: 3px;
}
.sudoku-cell.box-left {
  border-left-style: double;
  border-left-width: 3px;
}
.sudoku-cell.box-right {
  border-right-style: double;
  border-right-width: 3px;
}

.sudoku-given {
  color: #000;
}

/* Empty cells are buttons (not text inputs) that open the number-picker
   popover below, rather than triggering the OS on-screen keyboard. */
.sudoku-cell-btn {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  text-align: center;
  background-color: transparent;
  font-family: inherit;
  font-weight: bolder;
  color: blue;
  font-size: 1.1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sudoku-cell-btn:hover {
  background-color: rgba(102, 102, 255, 0.1);
}

.sudoku-cell-btn:focus-visible {
  outline: 2px solid #6666FF;
  outline-offset: -2px;
}

.sudoku-cell.active-cell {
  background-color: rgba(102, 102, 255, 0.18);
}

/* Check-answer feedback: a cell sharing a value with another cell in the
   same row/column/box gets flagged after clicking Check. */
.sudoku-cell.conflict {
  background-color: #FFE0E0;
  box-shadow: inset 0 0 0 2px #C0392B;
}

.sudoku-cell.conflict.sudoku-given,
.sudoku-cell.conflict .sudoku-cell-btn {
  color: #C0392B;
}

.check-status {
  min-height: 1.2em;
  margin: 0.5rem 0 0;
  font-weight: bold;
}

.check-status.check-ok {
  color: #1A7F37;
}

.check-status.check-bad {
  color: #C0392B;
}

/* Number-picker popover: pops up over the tapped cell with the valid
   digits for this grid size, so mobile users never see the OS keyboard. */
.number-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
}

.number-picker {
  position: fixed;
  z-index: 1000;
  background-color: #fff;
  border: 2px solid #6666FF;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  padding: 8px;
}

.number-picker[hidden] {
  display: none;
}

.number-picker-grid {
  display: grid;
  grid-template-columns: repeat(var(--picker-cols), 44px);
  gap: 6px;
}

.number-picker-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #B4D0DC;
  border-radius: 6px;
  background-color: #ECF8FF;
  color: #000;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.number-picker-btn:hover,
.number-picker-btn:focus-visible {
  background-color: #DCF0FF;
  outline: none;
}

.number-picker-clear {
  margin-top: 6px;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #f4f4f4;
  color: #000;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.number-picker-clear:hover,
.number-picker-clear:focus-visible {
  background-color: #e8e8e8;
  outline: none;
}

.controls {
  margin-top: 1rem;
  text-align: center;
}

.puzzle-label {
  margin: 0 0 0.5rem;
  font-weight: bold;
}

.controls button {
  font-size: 1rem;
  padding: 0.3rem 0.8rem;
  margin: 0 0.25rem;
  cursor: pointer;
}

.ad-slot {
  margin-top: 1rem;
  width: 100%;
  max-width: 468px;
  min-height: 60px;
}

@media (max-width: 600px) {
  .layout {
    flex-direction: column;
  }
  .navbar {
    width: 100%;
    order: 2;
  }
  .board-area {
    order: 1;
  }

  /* Bigger touch targets: 40px cells / ~32px buttons are below the ~44px
     minimum comfortable tap size. Grid still fits down to 320px-wide
     screens (6 * 48px + borders + board-area padding < 320). */
  .sudoku-grid {
    grid-template-columns: repeat(var(--grid-size), 48px);
    grid-template-rows: repeat(var(--grid-size), 48px);
  }
  .sudoku-cell {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
  }
  .sudoku-cell-btn {
    font-size: 1.3rem;
  }
  .number-picker-grid {
    grid-template-columns: repeat(var(--picker-cols), 50px);
  }
  .number-picker-btn {
    width: 50px;
    height: 50px;
  }
  .controls button {
    min-height: 44px;
    padding: 0.6rem 1.2rem;
    font-size: 1.05rem;
  }
}
