/**
 * Sudoku Daily Stylesheet - Popyca Games
 *
 * Warm cream, slate, and terracotta visual aesthetic.
 * 9x9 responsive grid, draft candidate notes, number pad, and highlight states.
 */

:root {
  --sudoku-board-bg: #ece5d8;
  --sudoku-cell-bg: #ffffff;
  --sudoku-border-thick: 2.5px solid #5a4b3d;
  --sudoku-border-thin: 1px solid #d5cbbd;

  --sudoku-highlight-selected: #ffe8cc;
  --sudoku-highlight-peer: #f7f1e6;
  --sudoku-highlight-same: #edd5bd;
  --sudoku-highlight-error: #fed7d7;
  --sudoku-text-error: #e53e3e;

  --sudoku-text-initial: #2c251e;
  --sudoku-text-user: #2563eb;

  --sudoku-board-size: min(92vw, 420px);
}

@media (min-width: 600px) {
  :root {
    --sudoku-board-size: 420px;
  }
}

/* Sudoku Top Meta: Difficulty Selector, Timer, Mistakes */
.sudoku-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--sudoku-board-size);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-slate);
}

.difficulty-tabs {
  display: flex;
  gap: 4px;
  background: #e2dbcd;
  padding: 3px;
  border-radius: 8px;
}

.diff-tab-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-slate);
  cursor: pointer;
  transition: all 0.15s ease;
}

.diff-tab-btn.active {
  background: #ffffff;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sudoku-status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sudoku 9x9 Board Container */
.sudoku-board-wrapper {
  width: var(--sudoku-board-size);
  height: var(--sudoku-board-size);
  background: var(--sudoku-board-bg);
  border: 3px solid #5a4b3d;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

/* Sudoku Cells */
.sudoku-cell {
  position: relative;
  background: var(--sudoku-cell-bg);
  border-right: var(--sudoku-border-thin);
  border-bottom: var(--sudoku-border-thin);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--sudoku-board-size) / 20);
  font-weight: 700;
  color: var(--sudoku-text-user);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

/* 3x3 Box Boundaries */
.sudoku-cell:nth-child(3n) {
  border-right: var(--sudoku-border-thick);
}

.sudoku-cell:nth-child(9n) {
  border-right: none;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: var(--sudoku-border-thick);
}

.sudoku-cell:nth-child(n+73):nth-child(-n+81) {
  border-bottom: none;
}

/* Cell Visual States */
.sudoku-cell.cell-initial {
  color: var(--sudoku-text-initial);
  font-weight: 800;
}

.sudoku-cell.cell-peer {
  background: var(--sudoku-highlight-peer);
}

.sudoku-cell.cell-same-val {
  background: var(--sudoku-highlight-same);
}

.sudoku-cell.cell-selected {
  background: var(--sudoku-highlight-selected) !important;
  box-shadow: inset 0 0 0 2px var(--color-primary);
}

.sudoku-cell.cell-error {
  background: var(--sudoku-highlight-error) !important;
  color: var(--sudoku-text-error) !important;
}

/* 3x3 Mini Notes / Pencil Marks Grid Inside Cell */
.cell-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
}

.note-digit {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--sudoku-board-size) / 46);
  font-weight: 600;
  color: #718096;
  line-height: 1;
}

/* Action Toolbar Below Board: Undo, Erase, Notes, Hint */
.sudoku-action-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: var(--sudoku-board-size);
  margin-top: 14px;
}

.sudoku-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-slate);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.sudoku-tool-btn:hover {
  background: #e2dbcd;
  color: var(--color-charcoal);
}

.sudoku-tool-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

.sudoku-tool-btn svg {
  stroke-width: 2.2;
}

/* Number Pad 1-9 */
.sudoku-keypad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: 100%;
  max-width: var(--sudoku-board-size);
  margin-top: 14px;
}

.keypad-btn {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-charcoal);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.12s ease;
  user-select: none;
}

.keypad-btn:active {
  transform: translateY(2px);
  background: #f7f3eb;
}

.keypad-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
