/* frontend/static/css/board.css */

.board-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px color-mix(in oklch, var(--text) 10%, transparent);

  flex: 1 1 auto;

  height: 100%;    /* don't exceed viewport */
  max-height: 100%;
  width: 100%;

  padding: 12px;
  box-sizing: border-box;

  display: flex;
  justify-content: center;
  align-items: center; /* center board */
  overflow: hidden;    /* prevent inner scroll */
  flex-direction: row;   /* add this */
}

.board {
  display: grid;

  /* Fills available height */
  height: 100%;
  aspect-ratio: 1 / 1;

  /* Prevent overflow */
  max-height: 100%;
  max-width: 100%;

  /* Ensure board stays a square AND fits */
  width: auto;     /* Let height determine width */
  margin: auto;

  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);

  background: var(--border-muted);
  padding: var(--gap);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

/* Single cell */
.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--bg-light);
  border: var(--thin) solid color-mix(in oklch, var(--border) 70%, transparent);
}

/* Thicker borders between 3x3 boxes (top & left) */
.cell[data-row="0"],
.cell[data-row="3"],
.cell[data-row="6"] {
  border-top-width: var(--thick);
  border-top-color: var(--border);
}
.cell[data-col="0"],
.cell[data-col="3"],
.cell[data-col="6"] {
  border-left-width: var(--thick);
  border-left-color: var(--border);
}

/* Outer edges (bottom & right) also thick */
.cell[data-row="8"] {
  border-bottom-width: var(--thick);
  border-bottom-color: var(--border);
}
.cell[data-col="8"] {
  border-right-width: var(--thick);
  border-right-color: var(--border);
}

/* Inputs */
.cell input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font: 700 20px/1 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  color: var(--text);
  caret-color: var(--primary);
}

.cell input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.cell input:focus-visible {
  background: transparent; /* no flood fill */
  outline: none;
  box-shadow: inset 0 0 0 2px color-mix(in oklch, var(--highlight) 65%, transparent);
  border-radius: 6px;
  caret-color: transparent; /* hides the cursor */
}

/* Prefilled (given) numbers */
.cell[data-given="true"] input {
  font-weight: 800;
  color: var(--primary);
  pointer-events: none; /* lock */
}

/* Small hover affordance for empty cells */
.cell:not([data-given="true"]):hover {
  background: color-mix(in oklch, var(--highlight) 8%, var(--bg-light));
}

/* Simple keyboard nav hint for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Action column on the right of the board */
.board-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;

  margin-left: 16px;
  padding: 8px;

  width: 120px;             /* adjust as needed */
  flex-shrink: 0;

  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px color-mix(in oklch, var(--text) 8%, transparent);
}

/* Simple button styling */
.board-actions button {
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.board-actions button:hover {
  background: color-mix(in oklch, var(--highlight) 20%, var(--bg));
}

/* Fits inside the 120px actions column */
.difficulty-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;            /* was 240px */
  color: var(--text);
  font-size: 12px;        /* slightly smaller to fit */
}

/* label tighter */
.difficulty-slider label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.difficulty-marks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;   /* smaller for 120px column */
  opacity: 0.75;
  margin-top: -2px;
}


/* --- RANGE BASE --- */
#difficulty-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #333; /* overwritten by JS gradient */
  outline: none;
}

/* thumb */
#difficulty-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in oklch, var(--text) 30%, transparent);
}
#difficulty-range::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.difficulty-modal.hidden {
  display: none;
}

.cell.hint,
.cell.hint:hover {
  background: yellow !important;
  transition: background 0.15s ease, outline 0.15s ease;
}

/* Error highlighting */
.cell.error {
    background: rgba(255, 0, 0, 0.15) !important;
    transition: background 0.15s ease;
}