/* sudoku.css — every selector starts with .g-sudoku (the game root). */

.g-sudoku [hidden] { display: none !important; }

/* ---------- difficulty picker + puzzle title ---------- */
.g-sudoku .gsk-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; }
.g-sudoku .gsk-diff { flex-direction: column; gap: 1px; padding: 5px 2px; min-height: 46px; min-width: 0; border-radius: 12px; font-size: .86rem; line-height: 1.15; }
.g-sudoku .gsk-diff small { font-size: .66rem; font-weight: 700; opacity: .8; white-space: nowrap; }

.g-sudoku .gsk-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 10px; }
.g-sudoku .gsk-title { font-size: 1.1rem; font-weight: 900; text-align: center; min-width: 8ch; }
.g-sudoku .gsk-nav { min-width: 44px; min-height: 40px; padding: 4px 10px; font-size: 1.3rem; line-height: 1; }
.g-sudoku .gsk-nav.is-locked { opacity: .45; }

/* ---------- play column: HUD, grid, tools, number pad ----------
   Capped by the window height so the pad stays near the grid on short screens.
   It is a size container: the digits and the pad layout follow its width. */
.g-sudoku .gsk-play { width: 100%; max-width: min(100%, max(280px, 100vh - 300px)); margin: 0 auto; container-type: inline-size; }
.g-sudoku .pz-hud { gap: 6px; margin: 0 0 10px; align-items: center; }
.g-sudoku .gsk-pause { min-height: 40px; padding: 4px 14px; }

.g-sudoku .gsk-stage { position: relative; }
.g-sudoku .gsk-board {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2px; padding: 2px; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 10px;
  background: color-mix(in srgb, var(--text) 78%, var(--surface));   /* the thick 3×3 box lines */
  font-size: clamp(15px, 5.4vw, 30px);                               /* fallback */
  font-size: clamp(13px, 6.2cqw, 34px);                              /* digits scale with the grid itself */
}
.g-sudoku .gsk-board.is-veiled { visibility: hidden; }
.g-sudoku .gsk-box {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1px; min-width: 0; min-height: 0;
  background: color-mix(in srgb, var(--text) 26%, var(--surface));   /* the thin cell lines */
}

/* ---------- cells ---------- */
.g-sudoku .gsk-cell {
  --gsk-base: var(--surface);
  appearance: none; -webkit-appearance: none; position: relative; display: grid; place-items: center;
  margin: 0; padding: 0; border: 0; border-radius: 0; min-width: 0; min-height: 0; overflow: hidden; cursor: pointer;
  background: var(--gsk-bg, var(--gsk-base));
  color: color-mix(in srgb, var(--accent) 78%, var(--text));        /* your entries */
  font: inherit; font-size: 1em; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.g-sudoku .gsk-cell:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 0; z-index: 1; }
/* givens: heavier and on a shaded square, so they differ from entries by more than colour */
.g-sudoku .gsk-cell.is-given { --gsk-base: var(--surface-2); color: var(--text); font-weight: 900; }
.g-sudoku .gsk-cell.is-hint { color: var(--good); font-weight: 800; }
.g-sudoku .gsk-cell.is-hint .gsk-v { text-decoration: underline dotted; text-underline-offset: .14em; text-decoration-thickness: 2px; }
/* highlights, weakest first: row/column/box, same digit, wrong entry, selected cell */
.g-sudoku .gsk-cell.is-peer { --gsk-bg: color-mix(in srgb, var(--accent) 10%, var(--gsk-base)); }
.g-sudoku .gsk-cell.is-same { --gsk-bg: color-mix(in srgb, var(--accent) 27%, var(--gsk-base)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, var(--gsk-base)); }
.g-sudoku .gsk-cell.is-bad { --gsk-bg: color-mix(in srgb, var(--bad) 16%, var(--gsk-base)); color: var(--bad); }
.g-sudoku .gsk-cell.is-bad .gsk-v { text-decoration: underline wavy; text-underline-offset: .12em; text-decoration-thickness: 1.5px; }
.g-sudoku .gsk-cell.is-bad::after { content: '×'; position: absolute; top: 1px; right: 3px; font-size: .5em; font-weight: 900; line-height: 1; }
.g-sudoku .gsk-cell.is-sel { --gsk-bg: color-mix(in srgb, var(--accent) 34%, var(--gsk-base)); box-shadow: inset 0 0 0 2px var(--accent); }
.g-sudoku .gsk-cell.is-sel.is-bad { --gsk-bg: color-mix(in srgb, var(--bad) 24%, var(--gsk-base)); box-shadow: inset 0 0 0 2px var(--bad); }

/* pencil marks: a tiny 3×3 inside the cell */
.g-sudoku .gsk-n {
  position: absolute; inset: 1px; display: grid; pointer-events: none;
  grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  color: var(--muted); font-size: .45em; font-weight: 700; line-height: 1;
}
.g-sudoku .gsk-n i { display: grid; place-items: center; font-style: normal; }
.g-sudoku .gsk-n i.is-hi { color: var(--text); font-weight: 900; text-decoration: underline; }

/* paused / building cover sits where the grid was */
.g-sudoku .gsk-cover {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 16px;
  text-align: center; border-radius: 10px; background: var(--surface-2); border: 1.5px dashed var(--border);
}
.g-sudoku .gsk-cover-msg { margin: 0; font-size: 1.15rem; font-weight: 900; }

/* ---------- tools + number pad ---------- */
.g-sudoku .gsk-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0 8px; }
.g-sudoku .gsk-tool { flex-direction: column; gap: 1px; padding: 5px 2px; min-height: 46px; min-width: 0; border-radius: 12px; font-size: .88rem; line-height: 1.15; }
.g-sudoku .gsk-tool small { font-size: .64rem; font-weight: 700; opacity: .85; white-space: nowrap; }
.g-sudoku .gsk-tool small:empty { display: none; }

/* two rows of five big keys by default; one row of ten once the column is wide enough */
.g-sudoku .gsk-pad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.g-sudoku .gsk-key { flex-direction: column; gap: 2px; padding: 5px 0; min-height: 50px; min-width: 0; border-radius: 12px; font-size: 1.35rem; line-height: 1; font-variant-numeric: tabular-nums; }
.g-sudoku .gsk-key small { font-size: .64rem; font-weight: 700; color: var(--muted); line-height: 1.1; min-height: 1.1em; }
.g-sudoku .gsk-key.is-out { opacity: .38; }                          /* all nine of this digit are placed */
.g-sudoku .gsk-key.is-out span { text-decoration: line-through; }
.g-sudoku .gsk-erase { color: var(--muted); }
@container (min-width: 440px) {
  .g-sudoku .gsk-pad { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .g-sudoku .pz-pill { padding: 5px 9px; font-size: .86rem; }
  .g-sudoku .pz-pill small { font-size: .68rem; }
  .g-sudoku .gsk-pause { padding: 4px 10px; }
  .g-sudoku .gsk-diff { font-size: .8rem; }
  .g-sudoku .gsk-tool { font-size: .82rem; }
}
