/* ============================================================
   SUDOKU DU JOUR — style.css — v1.8.6
   v1.8.6 — 2026-07-12 — feedback popup styles (ported from 7
          Differences, on Sudoku's own tokens): .feedback-popup / box
          / title / inputs / textarea / send / msg. Type nudged up a
          touch for BIG TYPE; hover states wrapped in @media
          (hover:hover) per the iOS rule. Existing .feedback-link-btn
          untouched.
   v1.8.4 — 2026-07-11 — square cells + iOS fit:
          • CELLS NOW SQUARE: grid used repeat(9, 1fr), but plain
            1fr = minmax(AUTO,1fr) — the auto minimum let rows grow
            to fit the 52px digit, deforming the grid (cells ~72×77,
            grid taller than wide, bled off). Changed to
            repeat(9, minmax(0,1fr)) + min-width/height:0 on cells →
            every track exactly equal, grid + cells truly square at
            every size (verified 72/68/44px, all square).
          • BLEED FIX: height term 100vh→100svh. On iOS Safari
            100vh counts the area behind the toolbar, sizing the
            grid taller than what's visible. svh = visible
            (toolbar-showing) height, so the grid fits and the
            control column's feedback link lines up with the grid
            bottom. (Verify on-device — headless has no iOS toolbar.)
   v1.8.3 — 2026-07-11 — numpad tuning:
          • numpad −10% (pad-stack 0.55→0.495, digit 0.08→0.072 /
            46→41px); stays square; round buttons (eraser/undo/
            redo) untouched — they shift right on their own to stay
            snug against the smaller numpad's edge
          • numpad top drops to the grid's 2nd row (side-col
            padding-top = 69 + grid-size/9) for a shorter finger
            reach; scales with the grid
          • grid + weights unchanged
   v1.8.2 — 2026-07-11 — responsive rework + type/colour:
          • ROOT FIX: fixed 657px grid was taller than the iPad
            viewport (bled off the bottom) and squished non-square
            when the window narrowed / zoomed. Now --grid-size (on
            .game-area, shared) = min(657, available width,
            available height); grid uses it for BOTH width & height
            → always square, always fits, caps at 657 on desktop.
            Same fix covers browser zoom (zoom reflows like a
            narrow/short window → grid stays big and the page
            scrolls, never shrinks-to-nothing).
          • book-page shrink-wraps the grid (fit-content); side-col
            stretches to match (no more fixed 747/756).
          • stacks to one column ≤1200px (before the grid can
            distort) — grid on top, controls below, numpad stays
            3×3 (9-wide strip is phone-only ≤640).
          • numpad now scales off --grid-size (55% of grid, digits
            grid*0.08) so it's ALWAYS smaller than the grid and its
            digits never exceed the grid digits — fixes "numpad
            bigger than grid" at every width.
          • grid digits & candidates also scale off --grid-size so
            they never clip when the grid shrinks (cap 52 / 25.5px).
          • candidates 50% bigger (17→25.5px cap).
          • row/col highlight --peer-bg #F4F8FD→#E4EEFA (~10%
            darker) — was near-invisible, now clearly readable.
   v1.8.1 — 2026-07-11 — type sizes up + two layout fixes:
          • grid digits 2.4→3.25rem (~52px), candidates 0.8→
            1.0625rem (~17px), numpad 1.24→2.875rem (~46px)
          • play area vertically centred below the header (equal
            gap above/below, ~58px each) — game-area justify-center
            + equal 34px top/bottom padding; was bottom-heavy
          • left-handed: pad-cluster packs to the grid side
            (justify-start in row-reverse) so the numpad hugs the
            grid, right edge on the Subscribe edge, icons to its
            left — was floating 60px off the grid on the outer edge
   v1.8 — 2026-07-11 — iPad markup round 3, exact geometry (measured,
          not min()-capped, so render == spec):
          • page 747×756, grid 657×657, side pad 45, bottom 30,
            header line vertically centred in a fixed 69px top band
          • cell digit cap 1.9→2.4rem (cells now ~73px)
          • eraser mirrors with handedness: right-handed [eraser]
            [empty] over Undo (col 1); left-handed [empty][eraser]
            over Redo (col 2); undo/redo unchanged below
          • thin .pad-divider between numpad and NOTES/AUTO/CHECK
            row, ~24px clear each side
          • .signup-rule (line above Subscribe) removed
          • footer bottom aligned to grid bottom: .side-col pinned
            to 756px, footer docked (margin-top:auto) with 30px
            bottom pad to match the grid's 30px bottom
          • EASY/MEDIUM/HARD tabs right-justified over the numpad
            column (mirror to left in left-handed)
   v1.7.11 — 2026-07-11 — iPad markup round 2: pad-cluster's
          justify-content flipped (flex-start default, flex-end
          left-handed) so the numpad+icon group always hugs the
          grid-facing edge instead of the outer screen edge —
          icons stay snug against the numpad, any slack lands on
          the outer side; .pad-stack shrunk 300→240 (smaller
          number buttons); .num-btn font-size untouched (fixed
          rem, not coupled to button size) so digits stay big
   v1.7.10 — 2026-07-11 — iPad markup round 1: eraser moved to grid-
          column 2 (flush right, over Redo, not Undo); book-page/
          play-main/sudoku-grid enlarged (460→540 grid, 560→620
          card) so the grid grows to fill the column — bigger BIG
          TYPE digits; book-page top padding 28→34 + page-head
          margin trimmed 24→20 to balance the visual gap above
          "№" against the gap below the grid; play-row stretches
          side-col to the card's height; signup+feedback now dock
          to the bottom of side-col (margin-top:auto on
          .signup-section) and hug the edge nearest the grid —
          left in default/right-handed, right in .left-handed —
          instead of centering; phone (≤640px) stays centered/
          stacked, unaffected
   v1.7.9 — 2026-07-11 — tabs into the header; .pad-stack: numpad +
          tool row share 300px, keys grow to 88px, cluster right-
          aligned in a 418px column (icons flush right = subscribe
          edge); side-col padding-top aligns pad top ≈ grid top;
          Check dark beige no border + checkmark; Auto notes wraps;
          book-page padding equalized; blurb 1 line; feedback +2px;
          left-handed flips the pad-cluster too
   v1.7.8 — 2026-07-11 — .play-main gets a flex-basis (grid squish
          fix); every :hover wrapped in @media (hover:hover) so iOS
          taps stop sticking; tabs left over the page; numpad digits
          +3px; .btn-check beige at rest; notes pencil icon; settings
          gear img; signup blurb sans serif; feedback link UC bigger
   v1.7.7 — 2026-07-11 — one layout desktop+iPad: .play-row puts the
          control column (.side-col: 3×3 numpad + round erase/undo/
          redo icons, Notes+Auto, Check, Reveal, signup, feedback)
          to the RIGHT of the grid; body.left-handed mirrors it to
          the left; ≤640px stacks (pad strip below the grid, icons
          row under it); old .btn-row / .btn-undo / 10-col numpad
          removed with the ERASE text button
   Sibling of 7 Differences. Tokens copied verbatim from its
   style.css so both games share one visual language.
   Palette: #1B3659 | #0867CC | #1EBFF5 | #F40C0C
   v1.6 — 2026-07-09 — .page-timer readout (tabular digits)
   v1.5 — 2026-07-09 — auto notes grey vs hand notes blue; gear back
          to 30px circle with bigger glyph
   v1.4.1 — 2026-07-09 — peer-digit tint (same-digit highlight, one step
          stronger, visible on givens)
   v1.4 — 2026-07-09 — settings gear 2x; setting-sub indent removed
   v1.3 — 2026-07-08 — toggle switches, settings rows, mic button states,
          numpad 10 keys (backspace), page-foot removed
   v1.2 — 2026-07-07 — page head: level icon + live error count; tighter
          button padding (one row); Auto notes toggle state in pale grey
   v1.1 — 2026-07-07 — bigger digits/notes/gear, banner action link
   Tone: editorial / newspaper / elegant — the play area is
   styled as a page from the Great Sudoku Adventure books.
   ============================================================ */

/* ---------- RESET & BASE (verbatim from 7 Differences) ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy:   #1B3659;
  --blue:   #0867CC;
  --cyan:   #1EBFF5;
  --red:    #F40C0C;
  --ink:    #111111;
  --paper:  #F8F6F1;
  --mid:    #888880;
  --rule:   #D0CBC0;

  /* sudoku-page additions */
  --page:        #FFFFFF;   /* the book page itself */
  --given-bg:    #EFEDE7;   /* shaded given cells, like the printed grids */
  --select-bg:   #E7F2FD;   /* selected cell wash */
  --peer-bg:     #E4EEFA;   /* v1.8.2: ~10% darker (was #F4F8FD, near-invisible) — row/col wash now readable, still lighter than peer-digit */
  --peer-digit-bg: #D9E9FB; /* v1.4.1: same digit elsewhere — one step stronger */

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Sans 3', 'Helvetica Neue', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- HEADER (verbatim structure from 7 Differences) ---------- */
#site-header {
  border-bottom: 2px solid var(--ink);
  padding: 20px 32px 16px;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.header-rule {
  height: 48px;
  width: 3px;
  background: var(--red);
  flex-shrink: 0;
}

.header-titles {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 3px;
}

.brand-kicker {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.brand-byline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--mid);
  text-decoration: none;
}
@media (hover: hover) { .brand-byline:hover { color: var(--blue); } }  /* v1.7.8: no sticky tap-hover on touch */

.header-right { display: flex; align-items: center; }

.header-lang {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-howto {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--mid);
  background: transparent;
  color: var(--mid);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 8px;
  transition: color 0.15s, border-color 0.15s;
}
@media (hover: hover) { .btn-howto:hover { color: var(--ink); border-color: var(--ink); } }  /* v1.7.8: no sticky tap-hover on touch */

/* v1.5: settings gear — same 30px circle as the mic and "?" buttons,
   only the gear glyph itself is bigger inside it */
#btn-settings {
  padding: 0;
  line-height: 1;
}
/* v1.7.8: the new single-gear SVG replaces the ⚙ glyph */
#btn-settings img { width: 16px; height: 16px; display: block; margin: auto; }

/* v1.3: mic button — active = filled blue; unsupported = struck out */
.btn-mic svg { display: block; margin: auto; }
.btn-mic.mic-on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-mic.mic-unsupported { opacity: 0.35; cursor: default; }

/* v1.3: settings rows + sliding toggles */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 0.92rem; color: var(--ink); }

.toggle {
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  border: none;
  background: var(--rule);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: left 0.2s;
}
.toggle.on { background: var(--blue); }
.toggle.on::after { left: 22px; }

.lang-btn {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--mid);
  cursor: pointer;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.lang-btn.active { color: var(--ink); border-bottom-color: var(--red); }
.lang-sep { color: var(--rule); }

/* ---------- GAME AREA ---------- */
.game-area {
  /* v1.8.2: --grid-size lives here (a common ancestor) so BOTH the grid
     and the numpad scale off it — the numpad is always a fixed fraction of
     the grid, so it can never be bigger than the grid. Two-column default:
     reserve ~560px for the control column beside it; height-bounded so it
     never bleeds off the bottom; capped at 657.
     v1.8.4: 100svh not 100vh — on iOS Safari 100vh counts the area BEHIND
     the toolbar, sizing the grid taller than what's visible → it bled off
     the bottom. svh = the small (toolbar-showing) viewport, so the grid
     always fits the visible area. */
  --grid-size: min(657px, calc(100vw - 560px), calc(100svh - 300px));
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 34px 32px 34px;  /* v1.8.1: equal top/bottom (was 28/40) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;  /* v1.8.1: centre content vertically below the header — equal space above/below the play area */
  flex: 1;
}

/* Difficulty tabs — letterspaced small caps, active carries the red rule */
/* v1.7.9: tabs live in the header bar */
/* v1.8: shifted right to sit over the numpad column (right side), just
   left of the mic/gear/?/lang cluster — was centred in the header */
.difficulty-row {
  display: flex;
  gap: 28px;
  margin: 0 20px 0 24px;
  align-items: center;
  flex: 1;
  justify-content: flex-end;   /* v1.8: was center — group hugs the right, toward the numpad */
}
body.left-handed .difficulty-row { justify-content: flex-start; }  /* v1.8: left-handed numpad is on the left, so tabs follow it left */

.difficulty-tab {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  cursor: pointer;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
@media (hover: hover) { .difficulty-tab:hover { color: var(--ink); } }  /* v1.7.8: no sticky tap-hover on touch */
.difficulty-tab.active { color: var(--ink); border-bottom-color: var(--red); }
.difficulty-tab .tab-check { color: var(--cyan); margin-left: 4px; }

/* ---------- THE BOOK PAGE ---------- */
/* v1.8: exact geometry per Nathalie's iPad measurements — page 747×756,
   grid 657×657, side padding 45, bottom 30, top band 69 (header line
   vertically centred in it). Fixed px, not min()-caps, so what renders
   matches the spec exactly instead of being squeezed by leftover row width. */
.book-page {
  background: var(--page);
  border: 1px solid var(--rule);
  box-shadow: 0 2px 14px rgba(27, 54, 89, 0.07);
  padding: 0 45px 30px;  /* v1.8: L/R 45, bottom 30; top handled by .page-head height so the 69px band is exact */
  width: fit-content;    /* v1.8.2: shrink-wrap the grid (was fixed 747) — card follows the responsive grid so nothing bleeds */
  max-width: 100%;
  box-sizing: border-box;
}

.page-head {
  display: flex;
  align-items: center;       /* v1.2: icon needs vertical centering */
  justify-content: space-between;
  height: 69px;          /* v1.8: the top band — header line centred inside it (align-items:center) */
  margin-bottom: 0;      /* v1.8: band height owns the spacing now, no extra margin */
}

.page-no {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--mid);
  letter-spacing: 0.02em;
}

.page-date {          /* unused since v1.2 (date removed) — kept for reference */
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--mid);
}

.page-level {          /* v1.2: the book's gear icon + level number */
  display: flex;
  align-items: center;
  gap: 7px;
}
.level-icon { height: 26px; width: auto; display: block; }
.level-num {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.page-errors {         /* v1.2: live error count — red the moment one exists */
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--mid);
}
.page-errors.has-errors { color: var(--red); }

/* v1.6: optional timer — same voice as the error count, tabular digits
   so the readout doesn't jitter as it ticks */
.page-timer {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--mid);
  font-variant-numeric: tabular-nums;
}

/* Grid — heavy outer + box rules, hairline cells, like the printed page */
.sudoku-wrap { display: flex; justify-content: center; }

/* v1.8.2: grid size = the SMALLER of the 657 cap, the available width,
   or the available viewport height. This is the fix for three symptoms
   that were all "grid bigger than its space": bleeding off the bottom on
   iPad, squishing non-square when the window narrows, and breaking under
   browser zoom (zoom reflows like a narrow/short window). Height budget =
   100vh minus header (~101) + game-area pad (34+34) + page top band (69)
   + page bottom (30) + a little safety ≈ 300px. */
.sudoku-grid {
  /* v1.8.2: --grid-size inherited from .game-area, shared with the numpad.
     v1.8.4: minmax(0,1fr) not plain 1fr — plain 1fr = minmax(AUTO,1fr),
     whose auto minimum let rows grow to fit the big 52px digit, deforming
     the grid taller than wide (cells came out ~72×77). The 0 minimum
     forces every track exactly equal → truly square cells. */
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  width: var(--grid-size);
  height: var(--grid-size);
  border: 3px solid var(--ink);
  background: var(--page);
  touch-action: manipulation;
}

.cell {
  position: relative;
  min-width: 0;   /* v1.8.4: let the cell shrink to its track — no content-based min that would deform the grid */
  min-height: 0;
  border: none;  /* v1.0 fix: kill the button's default border first */
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--page);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(calc(var(--grid-size) / 9 * 0.72), 52px);   /* v1.8.2: scales with the actual grid (grid/9 = cell, ~72% of cell), so digits never clip when the grid shrinks to fit height; caps at 52px (full-size target) */
  cursor: pointer;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}
.cell:nth-child(9n)         { border-right: none; }
.cell:nth-child(3n)         { border-right: 2.5px solid var(--ink); }
.cell:nth-child(9n)         { border-right: none; }
.cell.box-bottom            { border-bottom: 2.5px solid var(--ink); }
.cell.grid-bottom           { border-bottom: none; }

.cell.given {
  background: var(--given-bg);
  font-weight: 600;
  color: var(--ink);
  cursor: default;
}

.cell.entry  { color: var(--blue); font-weight: 400; }
.cell.wrong  { color: var(--red); }
.cell.revealed { color: var(--mid); font-weight: 400; }

.cell.peer     { background: var(--peer-bg); }
.cell.given.peer { background: var(--given-bg); }
/* v1.4.1: same-digit peers — stronger tint, and it DOES show on givens
   (unlike the structural row/col/box wash, which givens keep suppressing) */
.cell.peer-digit, .cell.given.peer-digit { background: var(--peer-digit-bg); }
.cell.selected { background: var(--select-bg) !important; outline: 2px solid var(--blue); outline-offset: -2px; z-index: 1; }

/* pencil notes — 3×3 micro-grid, the "neat pencil marking" of the books */
.cell .notes {
  position: absolute;
  inset: 1px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}
.cell .notes span {
  font-size: min(calc(var(--grid-size) / 9 / 3 * 0.95), 25.5px);  /* v1.8.2: ~25.5px cap (50% bigger), scales with the grid (cell/3 sub-cell) so it never overflows when the grid shrinks */
  font-weight: 400;
  color: var(--blue);
  opacity: 0.75;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* v1.5: auto-generated notes are grey — hand notes stay blue, so the
   player's own pencil marks and the machine's candidates read differently */
.cell .notes span.auto { color: var(--mid); }

/* Page footer — gear difficulty marker + book wordmark, like print */
.page-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;  /* v1.2: brand alone since level moved up */
  margin-top: 18px;
}



.page-brand {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mid);
}
.page-brand b { color: var(--ink); font-weight: 700; }

/* Status banner — completion in cyan (the 7diff success colour), errors in red */
.status-banner {
  width: min(560px, 100%);
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  display: none;
}
.status-banner.win   { display: block; background: var(--cyan); color: #fff; }
.status-banner.error { display: block; background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.status-banner.info  { display: block; background: transparent; color: var(--mid); border: 1.5px solid var(--rule); }
.status-banner .banner-action {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  margin-left: 10px;
}

/* ---------- PLAY ROW (v1.7.7: grid + control column, one layout) ---------- */
.play-row {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;  /* v1.8.2: stretch — side-col matches play-main's (card) height, which is now responsive; footer docks to that dynamic bottom */
  gap: 48px;
}
.play-main {
  flex: 0 0 auto;  /* v1.8.2: shrink-wrap the card (was fixed 747 basis) — width follows the responsive grid */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.play-main .book-page, .play-main .status-banner { align-self: center; }
.side-col {
  width: 418px;  /* v1.7.9: pad-stack + gap + icons; v1.7.11: pad-stack shrunk to 240, so this column now has slack on its outer edge — intentional */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: calc(69px + var(--grid-size) / 9);  /* v1.8.3: numpad top drops to the grid's 2nd row (69 band + one grid row) — shorter finger reach; scales with the grid */
  padding-bottom: 30px;  /* v1.8: matches the grid's 30px bottom padding — the docked footer lands level with the grid's bottom edge */
  box-sizing: border-box;
}
/* v1.7.9: numpad + tool row share one width; icons hang off the side */
/* v1.8.2: numpad width = 55% of the grid, so it scales with the grid and
   is ALWAYS smaller than it — kills the "numpad bigger than grid" problem
   at every width. Was a fixed 240px. Clamped so it never gets absurdly
   small or larger than the old 240. */
.pad-stack { display: flex; flex-direction: column; gap: 14px; width: clamp(135px, calc(var(--grid-size) * 0.495), 234px); }  /* v1.8.3: −10% (was 0.55 / 150–260) — numpad a touch smaller, stays square */
/* v1.8: thin divider between numpad and tool row, with extra breathing room around it */
.pad-divider {
  height: 1px;
  background: var(--rule);
  width: 100%;
  margin: 10px 0;   /* on top of the stack's 14px gap → ~24px clear on each side */
}
.pad-cluster { justify-content: flex-start; }  /* v1.7.11: was flex-end — group hugs the inner/grid-facing edge (side-col's left edge in default mode), icons stay snug against the numpad, slack pushed to the outer edge */

/* Left Handed mode — mirror the whole row AND the pad cluster */
body.left-handed .play-row { flex-direction: row-reverse; }
body.left-handed .pad-cluster { flex-direction: row-reverse; justify-content: flex-start; }  /* v1.8.1: was flex-end — in row-reverse, flex-start packs to the RIGHT (grid side), so the whole cluster hugs the grid; numpad's right edge lands on the Subscribe edge, icons hang off to its left */

/* v1.8.2: below ~1200px the two full-size columns can't sit side by side
   (657 grid + 90 card pad + 48 gap + 418 col ≈ 1213). Rather than let the
   grid distort, stack: grid on top (still responsive + square), controls
   below. This same path catches browser zoom, which reflows like a narrow
   window — a low-vision player zooming in gets a big grid that stacks and
   scrolls, never a shrunk-to-fit one. Numpad stays 3×3 here (the 9-wide
   strip is phone-only, ≤640). */
@media (max-width: 1200px) {
  .play-row, body.left-handed .play-row { flex-direction: column; align-items: center; gap: 28px; }
  /* v1.8.2: stacked — control column is below, so the grid reclaims the
     width the side column used to reserve; still capped + height-bounded.
     Set on .game-area so the numpad scales off the same value. */
  .game-area { --grid-size: min(657px, calc(100vw - 120px), calc(100svh - 220px)); }  /* v1.8.4: svh not vh — same iOS fit fix */
  .side-col {
    width: auto;
    padding-top: 0;
    padding-bottom: 0;
    align-items: center;
  }
  /* footer no longer docks to a grid-height column — it just follows the controls */
  .signup-section { margin-top: 8px; }
  .pad-cluster, body.left-handed .pad-cluster { justify-content: center; }
  /* centre the signup/feedback in the stacked column instead of edge-hugging */
  .signup-inner, body.left-handed .signup-inner,
  .signup-group, body.left-handed .signup-group { align-items: center; }
  .signup-label, body.left-handed .signup-label,
  .feedback-section-inner, body.left-handed .feedback-section-inner { text-align: center; }
}

/* v1.7.7: iPad portrait (641–1024px) — same layout, tighter breathing
   room so grid + column fit; the grid shrinks below 460px if needed */
@media (max-width: 1024px) and (min-width: 641px) {
  .game-area { padding: 28px 20px 40px; }
  .play-row { gap: 24px; }
}

/* ---------- NUMPAD (v1.7.7: 3×3 pad + round icon cluster) ---------- */
.pad-cluster {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* v1.7.9: 3×~88px in the stack */
  gap: 12px;
}
.pad-icons {
  display: grid;
  grid-template-columns: repeat(2, 46px);
  gap: 10px;
  align-content: start;
}
.btn-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(8, 103, 204, 0.10);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
}
.btn-icon img { width: 20px; height: auto; display: block; }
@media (hover: hover) { .btn-icon:hover:not(:disabled) { background: rgba(8, 103, 204, 0.22); } }  /* v1.7.8: no sticky tap-hover on touch */
.btn-icon:disabled { opacity: 0.3; cursor: default; }
/* v1.8: eraser mirrors with handedness — right-handed [eraser][empty] (col 1, over Undo); left-handed [empty][eraser] (col 2, over Redo) */
#btn-pad-erase { grid-column: 1; }
body.left-handed #btn-pad-erase { grid-column: 2; }
#btn-undo { grid-row: 2; grid-column: 1; }
#btn-redo { grid-row: 2; grid-column: 2; }

.tool-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* v1.7.9: columns match the pad */
  gap: 12px;
}
.tool-row button { min-height: 62px; }
.btn-notes .notes-pencil { display: block; margin: 0 auto 4px; }
/* v1.7.9: Auto notes wraps to two lines */
#btn-autonotes { white-space: normal; line-height: 1.25; }
/* v1.7.9: Check — dark beige, no outline, checkmark over the label */
.btn-check {
  background: #DAD6CB;
  border: none;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, opacity 0.15s;
}
.btn-check .check-mark { display: block; margin: 0 auto 4px; }
.btn-block { width: 100%; }

.num-btn {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: min(calc(var(--grid-size) * 0.072), 41px);   /* v1.8.3: −10% (was 0.08 / 46px) — digit shrinks with the smaller numpad box */
  font-weight: 600;
  aspect-ratio: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
@media (hover: hover) { .num-btn:hover:not(:disabled) { background: var(--ink); color: #fff; } }  /* v1.7.8: no sticky tap-hover on touch */
.num-btn:disabled { opacity: 0.2; cursor: default; }
.num-btn.depleted { opacity: 0.25; }

/* ---------- CONTROL BUTTONS (verbatim style from 7 Differences) ---------- */
.btn-clear {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 11px;   /* v1.2: tighter, one-row layout */
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
@media (hover: hover) { .btn-clear:hover { background: var(--ink); color: #fff; } }  /* v1.7.8: no sticky tap-hover on touch */

/* v1.2: Auto notes toggle — inverted pale grey while active */
.btn-clear.pale-active {
  background: #E6E3DA;
  border-color: #E6E3DA;
  color: var(--ink);
}
@media (hover: hover) { .btn-clear.pale-active:hover { background: #DAD6CB; border-color: #DAD6CB; color: var(--ink); } }  /* v1.7.8: no sticky tap-hover on touch */
@media (hover: hover) { .btn-check:hover { background: #CEC9BA; } }  /* v1.7.9 */

/* Notes toggle — same family, shows active state in blue */
.btn-notes {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 11px;   /* v1.2 */
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
@media (hover: hover) { .btn-notes:hover { background: var(--ink); color: #fff; } }  /* v1.7.8: no sticky tap-hover on touch */
.btn-notes.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.btn-reveal {
  background: var(--ink);
  border: 1.5px solid var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 12px;   /* v1.2 */
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.15s;
}
.btn-reveal.all-found { background: var(--cyan); border-color: var(--cyan); color: #fff; }
@media (hover: hover) { .btn-reveal:hover:not(:disabled) { opacity: 0.85; } }  /* v1.7.8: no sticky tap-hover on touch */
.btn-reveal:disabled { opacity: 0.35; cursor: default; }

/* ---------- EMAIL SIGNUP (structure from 7 Differences) ----------
   v1.7.7: lives inside .side-col — the full-width strip styling goes,
   the rule above it stays as the visual separator */
.signup-section {
  padding: 6px 0 0;
  background: var(--paper);
  margin-top: auto;  /* v1.7.10: signup-section is the direct flex child of side-col — this consumes the leftover space above it, docking signup+feedback to the bottom, level with the grid */
}

.signup-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;  /* v1.7.10: was center — default (right-handed) hugs the edge nearest the grid, which is the left edge here */
  gap: 18px;
}

body.left-handed .signup-inner { align-items: flex-end; }  /* v1.7.10: left-handed mirrors — hugs the right edge, nearest the grid */

/* v1.8: .signup-rule removed (divider above Subscribe deleted per markup) */

.signup-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;  /* v1.7.10: was center — mirrors .signup-inner */
  gap: 16px;
  width: 100%;
}

body.left-handed .signup-group { align-items: flex-end; }

.signup-label {
  /* v1.7.8: sans serif per markup — was italic Playfair */
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.85rem;   /* v1.7.9: fits on one line in the 418px column */
  font-weight: 400;
  color: var(--ink);
  text-align: left;  /* v1.7.10: was center — mirrors .signup-inner */
  white-space: nowrap;
}

body.left-handed .signup-label { text-align: right; }
.signup-label .emoji { font-style: normal; }

.ci-form { width: 100%; max-width: 460px; }
.ci-form form { display: flex; gap: 0; }
.ci-form label { position: absolute; left: -9999px; }
.ci-form input[type="email"] {
  flex: 1;
  border: 1.5px solid var(--navy);
  border-right: none;
  background: #fff;
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
}
.ci-form input[type="submit"] {
  background: var(--navy);
  color: #fff;
  border: 1.5px solid var(--navy);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 22px;
  cursor: pointer;
  transition: opacity 0.15s;
}
@media (hover: hover) { .ci-form input[type="submit"]:hover:not(:disabled) { opacity: 0.88; } }  /* v1.7.8: no sticky tap-hover on touch */
.ci-form input[type="submit"]:disabled { opacity: 0.6; cursor: default; }

.nl-message { margin-top: 10px; font-size: 0.85rem; text-align: center; }
.nl-message.success { color: var(--blue); }
.nl-message.error   { color: var(--red); }

/* ---------- SETTINGS PANEL ADDITIONS (v1.7.7) ---------- */
.settings-rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 16px 0;
}
#settings-panel .btn-block { display: block; }

/* ---------- FEEDBACK + FOOTER ---------- */
.feedback-section { padding: 0; background: var(--paper); }
.feedback-section-inner { max-width: 760px; margin: 0 auto; text-align: left; }  /* v1.7.10: was center — hugs the edge nearest the grid, mirrors signup block */
body.left-handed .feedback-section-inner { text-align: right; }  /* v1.7.10 */
.feedback-link-btn {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 1.08rem;          /* v1.7.9: +2px per markup */
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;   /* v1.7.8: UC */
  color: var(--mid);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
@media (hover: hover) { .feedback-link-btn:hover { color: var(--ink); } }  /* v1.7.8: no sticky tap-hover on touch */

/* ---------- FEEDBACK POPUP (v1.8.6: ported from 7 Differences) ---------- */
.feedback-popup {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.55);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.feedback-box {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 32px 28px 24px;
  max-width: 480px;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feedback-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--mid);
}
@media (hover: hover) { .feedback-close:hover { color: var(--ink); } }
.feedback-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}
.feedback-label {
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
}
.feedback-input,
.feedback-textarea {
  width: 100%;
  border: 1.5px solid var(--rule);
  border-radius: 3px;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.feedback-textarea { resize: vertical; min-height: 110px; }
.feedback-input:focus,
.feedback-textarea:focus { border-color: var(--blue); }
.feedback-input::placeholder,
.feedback-textarea::placeholder { color: var(--mid); }
.feedback-required {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--mid);
  margin: -4px 0 0;
}
.feedback-msg {
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin: 0;
  min-height: 1.2em;
}
.feedback-msg--ok  { color: var(--blue); }
.feedback-msg--err { color: var(--red); }
.feedback-send {
  align-self: flex-end;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 11px 26px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
@media (hover: hover) { .feedback-send:hover { background: var(--blue); } }
.feedback-send:disabled { background: var(--mid); cursor: default; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 18px 32px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--mid);
}

/* ---------- HOW-TO OVERLAY (same pattern as 7 Differences) ---------- */
.howto-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.45);
  z-index: 200;
}
.howto-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 2px solid var(--ink);
  max-width: 480px;
  width: calc(100% - 48px);
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px 32px;
  z-index: 201;
}
.howto-panel h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 16px;
}
.howto-panel h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin: 16px 0 4px;
}
.howto-panel p { font-size: 0.92rem; line-height: 1.55; color: var(--ink); }
.howto-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--mid);
  cursor: pointer;
}
@media (hover: hover) { .howto-close:hover { color: var(--ink); } }  /* v1.7.8: no sticky tap-hover on touch */
.hidden { display: none !important; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  #site-header { padding: 14px 18px 12px; }
  .brand-title { font-size: 1.5rem; }
  .header-rule { height: 40px; }
  .game-area { padding: 20px 14px 32px; }
  .book-page { padding: 20px 16px 16px; }
  .difficulty-row { gap: 18px; }

  /* v1.7.7: phone keeps the stacked layout — column drops below the grid */
  .play-row, body.left-handed .play-row { flex-direction: column; align-items: center; gap: 16px; }
  .side-col { width: 100%; max-width: 460px; padding-top: 0; align-items: center; }
  .pad-cluster, body.left-handed .pad-cluster { flex-direction: column; align-items: center; width: 100%; justify-content: center; }
  .pad-stack { width: 100%; }
  .numpad {
    width: 100%;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
  }
  .tool-row { width: 100%; }
  .signup-label { white-space: normal; }
  .pad-icons { grid-template-columns: repeat(3, 46px); justify-content: center; }
  #btn-pad-erase, #btn-undo, #btn-redo { grid-row: auto; grid-column: auto; }
  .tool-row { justify-content: center; }
  .btn-block { max-width: 460px; }
  .signup-section, .feedback-section { width: 100%; margin-top: 0; }  /* v1.7.10: undo the desktop bottom-dock on the stacked phone layout */
  .signup-inner, body.left-handed .signup-inner,
  .signup-group, body.left-handed .signup-group { align-items: center; }  /* v1.7.10: back to centered on phone, flush-edge is a two-column trick */
  .signup-label, body.left-handed .signup-label,
  .feedback-section-inner, body.left-handed .feedback-section-inner { text-align: center; }  /* v1.7.10 */
}
