/* EwrekaGames — Sudoku board (assets/js/solo/sudoku.js). Shell styles: assets/css/solo.css. */
.sd-wrap {
  --sd-chrome: 330px;             /* header, toolbar and the number pad below the board */
  --sd-size: min(100%, 540px, max(300px, calc(100vh - var(--sd-chrome))));
  --sd-size: min(100%, 540px, max(300px, calc(100svh - var(--sd-chrome))));
  width: var(--sd-size);
  margin: 0 auto;
}
/* first visit with a different browser language: the suggestion strip above the page takes ~50px, so the board
   gives that room back and the Undo / Erase / Notes row stays above the fold on a 1366×768 laptop */
body:has(.langhint) .sd-wrap { --sd-chrome: 392px; }
:root { --sd-frame: #4b566b; --sd-frame-2: #343c4c; }
:root[data-theme="dark"] { --sd-frame: #3a4558; --sd-frame-2: #0a0d13; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sd-frame: #3a4558; --sd-frame-2: #0a0d13; } }
.sd-grid {
  --sd-gap: 4px;
  --sd-cell-sel: color-mix(in srgb, var(--blue) 30%, var(--surface));
  --sd-cell-peer: color-mix(in srgb, var(--blue) 8%, var(--surface));
  --sd-cell-same: color-mix(in srgb, var(--blue) 19%, var(--surface));
  --sd-cell-flash: color-mix(in srgb, var(--brand) 16%, var(--surface));
  --sd-bad-soft: color-mix(in srgb, var(--bad) 14%, var(--surface));
  --sd-cell-hover: color-mix(in srgb, var(--blue) 14%, var(--surface));
  position: relative; width: 100%; aspect-ratio: 1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: var(--sd-gap);
  padding: var(--sd-gap); border-radius: 16px;
  background: var(--sd-frame);
  box-shadow: 0 4px 0 var(--sd-frame-2);
  container-type: inline-size;
  outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sd-grid:focus-visible { box-shadow: 0 4px 0 var(--sd-frame-2), 0 0 0 3px color-mix(in srgb, var(--blue) 45%, transparent); }
.sd-box {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 1px;
  background: var(--line-2); border-radius: 9px; overflow: hidden; min-width: 0; min-height: 0;
}
.sd-cell {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 0;
  background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 22px; font-size: 6.1cqw; font-weight: 500; line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background-color .14s ease, color .14s ease;
}
.sd-cell .sd-v { display: block; pointer-events: none; }
.sd-cell.given { color: var(--ink); font-weight: 700; }
.sd-cell.entry { color: var(--blue); font-weight: 600; }
.sd-cell.hinted { color: var(--brand); font-weight: 600; }
.sd-cell.peer { background: var(--sd-cell-peer); }
.sd-cell.flash { background: var(--sd-cell-flash); }
.sd-cell.same { background: var(--sd-cell-same); }
.sd-cell.sel { background: var(--sd-cell-sel); box-shadow: inset 0 0 0 2px var(--blue); z-index: 1; }
.sd-cell.wrong { color: var(--bad); background: var(--sd-bad-soft); }
.sd-cell.wrong.sel { box-shadow: inset 0 0 0 2px var(--bad); }
.sd-cell.wrong .sd-v { text-decoration: underline 2px; text-underline-offset: 3px; }
@media (hover: hover) { .sd-grid:not(.solved) .sd-cell:not(.sel):hover { background: var(--sd-cell-hover); } }
/* dark surfaces need stronger tints for the row/column/box and same-digit highlights to read */
@supports (color: color-mix(in srgb, red 50%, blue)) {
:root[data-theme="dark"] .sd-grid {
  --sd-cell-sel: color-mix(in srgb, var(--blue) 38%, var(--surface));
  --sd-cell-peer: color-mix(in srgb, var(--blue) 15%, var(--surface));
  --sd-cell-same: color-mix(in srgb, var(--blue) 28%, var(--surface));
  --sd-cell-hover: color-mix(in srgb, var(--blue) 22%, var(--surface));
  --sd-bad-soft: color-mix(in srgb, var(--bad) 20%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sd-grid {
    --sd-cell-sel: color-mix(in srgb, var(--blue) 38%, var(--surface));
    --sd-cell-peer: color-mix(in srgb, var(--blue) 15%, var(--surface));
    --sd-cell-same: color-mix(in srgb, var(--blue) 28%, var(--surface));
    --sd-cell-hover: color-mix(in srgb, var(--blue) 22%, var(--surface));
    --sd-bad-soft: color-mix(in srgb, var(--bad) 20%, var(--surface));
  }
}
}
/* browsers without color-mix() (Safari < 16.2): translucent tints layered over the cell surface */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .sd-grid {
    --sd-cell-sel: linear-gradient(rgba(61, 123, 247, .32), rgba(61, 123, 247, .32)) var(--surface);
    --sd-cell-peer: linear-gradient(rgba(61, 123, 247, .12), rgba(61, 123, 247, .12)) var(--surface);
    --sd-cell-same: linear-gradient(rgba(61, 123, 247, .24), rgba(61, 123, 247, .24)) var(--surface);
    --sd-cell-flash: linear-gradient(rgba(255, 107, 74, .18), rgba(255, 107, 74, .18)) var(--surface);
    --sd-cell-hover: linear-gradient(rgba(61, 123, 247, .16), rgba(61, 123, 247, .16)) var(--surface);
    --sd-bad-soft: linear-gradient(rgba(229, 72, 77, .18), rgba(229, 72, 77, .18)) var(--surface);
  }
}

/* pencil marks */
.sd-notes { position: absolute; inset: 5%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.sd-notes span { display: grid; place-items: center; font-size: 9px; font-size: 2.35cqw; font-weight: 600; color: var(--ink-3); line-height: 1; border-radius: 4px; }
.sd-notes span.hl { color: var(--on-brand); background: var(--blue); }

/* animations (each runs once per action; restarted from JS) */
.sd-cell.sweep { animation: sd-sweep .55s var(--ease) var(--d, 0ms) both; }
.sd-cell.wave { animation: sd-wave .7s var(--ease) var(--d, 0ms) both; }
.sd-cell.hint { animation: sd-hint .9s var(--ease) both; }
@keyframes sd-sweep {
  0% { background: var(--surface); }
  35% { background: color-mix(in srgb, var(--good) 34%, var(--surface)); transform: scale(.92); }
  100% { transform: none; }
}
@keyframes sd-wave {
  0% { transform: none; }
  40% { transform: scale(.82); background: color-mix(in srgb, var(--brand) 30%, var(--surface)); color: var(--brand); }
  100% { transform: none; }
}
@keyframes sd-hint {
  0% { box-shadow: inset 0 0 0 0 var(--brand); }
  30% { box-shadow: inset 0 0 0 4px var(--brand); background: var(--brand-soft); }
  100% { box-shadow: inset 0 0 0 2px var(--blue); }
}
.sd-grid.solved .sd-cell { cursor: default; }
.sd-grid.solved .sd-cell.entry, .sd-grid.solved .sd-cell.hinted { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .sd-cell { transition: none; }
  .sd-cell.sweep, .sd-cell.wave, .sd-cell.hint { animation: none; }
}
@media (max-width: 640px) {
  .sd-wrap { --sd-size: 100%; }
  .sd-grid { --sd-gap: 3px; border-radius: 12px; }
  .sd-box { border-radius: 7px; }
  .sd-notes { inset: 2%; }
  .sd-notes span { font-size: 2.6cqw; }
}
/* CLS: the "loading" placeholder takes exactly the room of the board (same size rule as .sd-wrap) plus the gap and the
   number pad under it (106 px on desktop, 96 px on phones), so nothing below moves when the puzzle is drawn. */
body.solo-page #soloBoard > .loading-box {
  --sd-chrome: 330px;
  width: min(100%, 540px, max(300px, calc(100vh - var(--sd-chrome))));
  width: min(100%, 540px, max(300px, calc(100svh - var(--sd-chrome))));
  aspect-ratio: 1; min-height: 0; padding: 0; margin-bottom: 116px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
body.solo-page:has(.langhint) #soloBoard > .loading-box { --sd-chrome: 392px; }
@media (max-width: 640px) {
  body.solo-page #soloBoard > .loading-box { width: 100%; margin-bottom: 106px; }
}
