/* Number puzzles (games 9, 11, 13, 15 and later): the grid, the number pad and the tips. */
.sgrid {
  --cell: min(76px, calc((100vw - 84px) / var(--n)));
  display: grid; grid-template-columns: repeat(var(--n), var(--cell)); grid-auto-rows: var(--cell);
  width: max-content; margin: 10px auto; border: 3px solid var(--ink); background: #fff;
}
.scell {
  position: relative; display: grid; place-items: center; padding: 0; margin: 0; background: #fff; color: var(--accent);
  font: inherit; font-size: calc(var(--cell) * .5); font-weight: 700; line-height: 1; cursor: pointer;
  border: 1px dashed #c9c2b3;
}
.scell.rr { border-right: 3px solid #8a83a8; }
.scell.rb { border-bottom: 3px solid #8a83a8; }
.scell.bt { border-top: 3px solid var(--ink); }
.scell.br { border-right: 3px solid var(--ink); }
.scell.bb { border-bottom: 3px solid var(--ink); }
.scell.bl { border-left: 3px solid var(--ink); }
.scell.shade { background: #ece9f6; }
.scell.given { color: var(--ink); cursor: default; background: #f1ede4; }
.scell.given.shade { background: #ddd8ea; }
.scell .cage.dcage { font-size: calc(var(--cell) * .14); left: 3px; right: 3px; line-height: 1.05; text-align: left; }
.scell.hasd { place-items: end center; padding-bottom: 4%; font-size: calc(var(--cell) * .42); }
.scell.hasd .notes { bottom: 1px; }
.scell .cage.dcage b { font-size: calc(var(--cell) * .2); }
.scell.sel { background: #dbe8fb; box-shadow: inset 0 0 0 3px var(--accent); }
.scell.bad { background: #ffe1d6; }
.scell.hint { background: #fff3c4; }
.scell:focus-visible { outline: 4px solid #f2b705; outline-offset: -4px; }
.scell .cage { position: absolute; top: 2px; left: 5px; font-size: calc(var(--cell) * .22); font-weight: 600; font-style: italic; color: var(--ink); }
.scell .notes {
  position: absolute; left: 2px; right: 2px; bottom: 3px; text-align: center; letter-spacing: 1px;
  font-size: calc(var(--cell) * .2); font-weight: 600; color: var(--muted);
}
.tgrid { border-collapse: collapse; margin: 10px auto; background: #fff; }
.tgrid th { width: 52px; height: 48px; font-size: 1.15rem; color: var(--ink); background: #f1ede4; border: 2px solid var(--line); }
.tgrid td { width: 56px; height: 52px; padding: 2px; border: 2px solid var(--line); text-align: center; }
.tgrid td.cross { background: linear-gradient(to top right, #fff calc(50% - 2px), #9b9384 50%, #fff calc(50% + 2px)); }
.tgrid input { width: 100%; height: 44px; box-sizing: border-box; border: 2px solid #c9c2b3; border-radius: 8px; text-align: center; font: inherit; font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.tgrid input:focus { outline: 3px solid #f2b705; border-color: var(--accent); }
.tgrid input.bad { background: #ffe1d6; border-color: #d0643c; }
@media (max-width: 480px) { .tgrid th { width: 36px; height: 40px; } .tgrid td { width: 44px; height: 46px; } .tgrid input { height: 40px; font-size: 1.05rem; } }
.spad { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.spad .numbtn { width: 60px; height: 60px; }
.stools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 2px; }
.stools .btn { min-height: 48px; }
.stools .btn.on { background: #f2b705; color: var(--ink); border-color: #c98a00; }
.tip { font-size: 1.15rem; line-height: 2.3; margin: 6px 0; }
.tip .blank {
  display: inline-grid; place-items: center; min-width: 50px; height: 46px; margin: 0 3px; padding: 0 6px; vertical-align: middle;
  border: 3px dashed #9b9384; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}
.tip .blank.next { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 4px rgba(194,65,12,.2); }
.tiprule { margin: 4px auto 8px; padding: 10px 14px; max-width: 640px; background: var(--soft-warn); border: 2px solid var(--near); border-radius: 12px; font-size: 1rem; line-height: 1.5; }
.tipdone { list-style: none; padding: 0; margin: 4px auto 8px; text-align: left; display: inline-block; color: var(--muted); font-size: .95rem; }
.tipdone li::before { content: "✔ "; color: var(--good); }
.panel .numrow { gap: 8px; margin: 8px 0 4px; }
.panel .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
@media (max-width: 480px) { .spad .numbtn { width: 54px; height: 54px; } .tip { font-size: 1.05rem; } }
