/* Sudoku screens (Nov 11 2026, task free-merlin_task_sudoku_2a2_screens.md): puzzle page, game
   screen, grid, number pad, hint panel and win screen. Layout follows rule 13; Piko top-right on
   the win screen (rule 15). Squares and pad buttons are at least 44 px on a tablet.
   Laptop fix (Nov 12 2026, task free-merlin_task_sudoku_2a3_layout.md): on wide screens (>= 1000 px)
   the board is two columns (grid left; number pad, Erase/Start over and the Hint panel right) and
   the grid follows the window height (40-56 px squares) so the whole game fits without scrolling.
   The Hint panel always keeps its space (invisible when empty) so nothing jumps. */

/* ---- puzzle page: 30 tiles ---- */
.sd-levels h1 { margin-bottom: 18px; }
.sd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; max-width: 720px; }
.sd-tile { font: inherit; font-weight: 900; font-size: 1.5rem; min-width: 44px; min-height: 64px; border: 3px solid var(--border); border-radius: 16px; background: white; color: var(--ink); }
.sd-tile:hover { border-color: var(--blue-action); background: var(--sky); }
/* Tile states (task 2b-2, Brandie's decision 3): finished = the game's grey (#eceae2, same as the
   given squares) with dark readable text and a clear border; started-but-unfinished = the palette's
   soft green (--lime, the hint-highlight color) with dark readable text. Both stay clearly buttons
   (same size, border radius, hover) and both are still clickable. */
.sd-tile.sd-tile-done { background: #eceae2; color: var(--ink); border-color: var(--muted); }
.sd-tile.sd-tile-done:hover { background: #eceae2; border-color: var(--blue-action); }
.sd-tile.sd-tile-progress { background: var(--lime); color: var(--ink); border-color: var(--green-dark); }
.sd-tile.sd-tile-progress:hover { background: var(--lime); border-color: var(--blue-action); }

/* ---- game screen ---- */
.sd-screen h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin: 0 0 10px; }
.sd-instr-row { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.sd-piko { width: 58px; height: auto; flex: none; }
.sd-instr { margin: 0; flex: 1; color: var(--ink); font-weight: 700; }
.sd-timer { flex: none; min-height: 44px; padding: 6px 12px; display: inline-flex; align-items: center; font-size: 1.3rem; font-weight: 900; color: var(--ink); background: white; border: 2px solid var(--border); border-radius: 12px; }
.sd-hint-btn { min-width: 110px; min-height: 54px; font-size: 1.15rem; }

/* ---- the 9x9 grid ---- */
.sd-board { display: grid; grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }
.sd-grid { grid-column: 1; grid-row: 1; position: relative; display: grid; grid-template-columns: repeat(9, minmax(44px, 1fr)); border: 3px solid var(--ink); border-radius: 6px; overflow: hidden; background: white; }
.sd-cell { position: relative; aspect-ratio: 1; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: white; color: var(--ink); font: inherit; font-weight: 800; font-size: clamp(1.05rem, 2.2vw, 1.5rem); display: grid; place-items: center; }
.sd-cell:nth-child(9n) { border-right: 0; }
.sd-cell:nth-child(n+73) { border-bottom: 0; }
.sd-cell.sd-vline { border-right: 3px solid var(--ink); }
.sd-cell.sd-hline { border-bottom: 3px solid var(--ink); }
.sd-cell.sd-given { background: #eceae2; font-weight: 900; }
.sd-cell.sd-same { background: var(--sky); }
.sd-cell.sd-same.sd-given { background: #e4e7dc; }
.sd-cell.sd-hint-cell { background: var(--lime); }
.sd-cell.sd-hint-cell.sd-given { background: #ddeec2; }
.sd-cell.sd-conflict { color: #b8362a; }
.sd-cell.sd-conflict:not(.sd-sel) { background: #ffe3dd; }
.sd-cell.sd-sel { background: var(--yellow); box-shadow: inset 0 0 0 3px var(--ink); }
.sd-cell:focus-visible { outline: 4px solid var(--ink); outline-offset: 2px; z-index: 1; }

/* ---- number pad, Erase/Start over, hint message and panel (single column) ---- */
.sd-pad { grid-column: 1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 0; }
.sd-pad button { font: inherit; font-weight: 900; font-size: 1.25rem; min-width: 52px; min-height: 48px; padding: 4px 10px; border: 3px solid var(--border); border-radius: 14px; background: white; color: var(--ink); }
.sd-pad button:hover { border-color: var(--blue-action); background: var(--sky); }
/* Greyed-out number pad button (task 2a-4): that number is already in all nine squares.
   Only a signal — the button still works. Its own look: grey text on a light-grey button
   (readable, ~5:1 contrast), not the hover/selected look. Applies at every screen size. */
.sd-pad button.sd-done { background: #eceae2; color: #5a655f; border-color: var(--border); }
.sd-pad button.sd-done:hover { background: #eceae2; color: #5a655f; border-color: var(--border); }
.sd-under { grid-column: 1; grid-row: 5; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.sd-under .sd-erase { font: inherit; font-weight: 900; font-size: 1.25rem; min-width: 52px; min-height: 48px; padding: 4px 10px; border: 3px solid var(--border); border-radius: 14px; background: white; color: #b8362a; }
.sd-under .sd-erase:hover { border-color: var(--blue-action); background: var(--sky); }
.sd-msg { grid-column: 1; grid-row: 4; min-height: 1.4em; margin: 10px 0 0; text-align: center; color: var(--muted); font-weight: 700; }
.sd-hint-panel { grid-column: 1; grid-row: 3; margin: 10px 0 0; padding: 12px 16px; border: 3px solid var(--green-dark); border-radius: 16px; background: #f2f8e8; color: var(--ink); font-weight: 700; text-align: center; min-height: 80px; display: grid; place-content: center; }
/* Space for the Hint panel is always reserved: with no hint it is invisible but keeps its
   footprint, so the grid and the buttons do not jump when a hint appears or disappears. */
.sd-hint-panel[hidden] { display: grid; visibility: hidden; }

/* ---- wide screens (>= 1000 px): two columns, grid sized to the window height ---- */
@media (min-width: 1000px) {
  .sd-screen h1 { font-size: 1.9rem; margin: 0 0 8px; }
  .sd-instr-row { gap: 10px; margin: 0 0 12px; }
  .sd-piko { width: 44px; }
  .sd-hint-btn { min-height: 50px; }
  /* 410px (was 380) since "Show outlines" (task sudoku_outlines, Nov 16 2026): on Easy the row with
     Erase + Start over + the toggle is ~400px and must stay ONE line, or the wrapped second line
     pushes the Hint panel out of a 1280x800 / 1366x768 window (vertical scroll). */
  .sd-board { grid-template-columns: max-content minmax(240px, 410px); column-gap: 28px; align-items: start; max-width: 100%; }
  /* The 9 squares follow the available height so the whole game fits on a laptop screen:
     never smaller than 40 px, never bigger than 56 px. */
  .sd-grid { grid-column: 1; grid-row: 1 / span 4; grid-template-columns: repeat(9, clamp(40px, calc((100vh - 400px) / 9), 56px)); }
  .sd-cell { min-width: 40px; min-height: 40px; }
  .sd-pad { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(3, 70px); width: max-content; margin: 0; }
  .sd-under { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .sd-hint-panel { grid-column: 2; grid-row: 3; }
  .sd-msg { grid-column: 2; grid-row: 4; }
}

/* ---- win screen (task 2b-2, Brandie's decision 6): the completed board on the LEFT; on the RIGHT,
   grouped as before, Piko, "Well done!", Time, Hints used, Date completed and the two buttons. ONE
   shared layout for the fresh finish AND the saved page a grey tile opens. Under ~600 px wide the
   board stacks ABOVE the text. Must fit 1280x800 and 820x1180 with no sideways scroll. ---- */
.sd-win { position: relative; text-align: center; min-height: 420px; display: grid; place-content: center; gap: 8px; }
.sd-win-layout { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 32px); width: 100%; }
.sd-win-board { flex: none; }
.sd-win-grid { grid-template-columns: repeat(9, 1fr); width: min(342px, 40vw); }
.sd-win-grid .sd-cell { min-width: 0; min-height: 0; font-size: clamp(0.75rem, 1.6vw, 1.1rem); cursor: default; }
.sd-win-text { display: grid; gap: 8px; justify-items: center; align-content: center; }
.sd-win-piko { width: 96px; height: auto; }
.sd-win h1 { color: var(--green-dark); margin: 0; }
.sd-win-line { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.sd-win .button-row { justify-content: center; margin-top: 14px; }
@media (max-width: 600px) {
  .sd-win-layout { flex-direction: column; }
  .sd-win-grid { width: min(342px, 86vw); }
}

/* ---- How to play page (task 3a, Nov 12 2026; rule 18): Piko top-right (rule 15), no speaker
   (rule 18.4 — Grade 4 and up). The six step pictures are inline SVG from public/sudoku-help.mjs;
   the Hint button picture in the description reuses the shared cchelp-hintpic classes. ---- */
.sd-help { position: relative; }
.sd-help-piko { position: absolute; top: 12px; right: 16px; width: 92px; height: auto; }
.sd-help h1 { margin-top: 2px; }
.sd-help-text { font-size: 1.3rem; font-weight: 700; line-height: 1.5; max-width: 660px; }
.sd-help-steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 18px; }
.sd-help-step { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sd-help-svg { flex: none; max-width: 100%; height: auto; }
.sd-help-cap { margin: 0; font-size: 1.1rem; font-weight: 800; }
.sd-help-num { color: var(--blue-action); font-weight: 900; font-size: 1.2rem; margin-right: 2px; }

/* ---- Task 3b (Nov 12 2026): the "Show me" demo practice board (rule 18.3) ---- */
/* A small real-looking Sudoku board (puzzle easy-01) with its own pad and the yellow Hint button
   picture, inside the shared .cchelp-demo box (the hand, caption, steps and ripple styles come from
   canada-capitals.css, loaded globally). It is cosmetic only — it never touches the real game. The
   board is smaller than the real grid so the whole demo fits the box; the pad numbers are spans (not
   buttons) given the pad-button look. The hand (public/help-page.mjs) moves over these elements. */
.sd-demo-stage { display: flex; align-items: flex-start; gap: 20px; }
.sd-demo-grid { grid-template-columns: repeat(9, 28px); grid-template-rows: repeat(9, 28px); border-width: 2px; border-radius: 4px; }
.sd-demo-cell { min-width: 0; min-height: 0; aspect-ratio: 1; font-size: 0.9rem; }
/* The side column gets a definite width (the pad's 3 x 48px + 2 x 7px gap = 158px) so the long hint
   text wraps at that width instead of widening the column and pushing it below the board. */
.sd-demo-side { flex: none; width: 158px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.sd-demo-pad { display: grid; grid-template-columns: repeat(3, 48px); gap: 7px; margin: 0; }
.sd-demo-num { display: grid; place-items: center; width: 48px; height: 42px; font: inherit; font-weight: 900; font-size: 1.1rem; color: var(--ink); background: white; border: 3px solid var(--border); border-radius: 12px; }
.sd-demo-hintrow { display: flex; justify-content: center; }
.sd-demo-hint { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.sd-demo-hint-panel { grid-column: auto; grid-row: auto; min-height: 64px; margin: 0; padding: 10px 12px; font-size: 1rem; width: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; }
/* The Pencil example (task merlin_task_pencil_step3_demo.md, Nov 18 2026): the demo's own
   non-clickable Pencil button picture, in the real pad button's look family (white OFF, blue
   #1f6fd1 ON — the .sd-pencil / .sd-pencil-on colors) so the child sees the same button. */
.sd-demo-pencilrow { display: flex; justify-content: center; }
.sd-demo-pencil { display: inline-flex; align-items: center; justify-content: center; cursor: default; user-select: none; font: inherit; font-weight: 900; font-size: 1.1rem; min-width: 52px; min-height: 42px; padding: 4px 14px; border: 3px solid var(--border); border-radius: 14px; background: white; color: var(--ink); }
.sd-demo-pencil.sd-pencil-on { background: #1f6fd1; border-color: #14509c; color: white; }
/* The demo note is the game's own .sd-notes markup; at the demo cell's smaller font the note
   digits get a little bigger so the BLUE note is clearly visible on the 28px practice squares. */
.sd-demo-cell .sd-notes b { font-size: 0.65em; }
/* Phone fit for the demo (task merlin_task_pencil_step3_demo.md, Nov 18 2026): the fixed 28px
   demo board (252px) plus the 158px side column never fitted a 390/320px phone. ONLY at <= 600px
   the side column wraps under the board and the board scales to the card (cells keep
   aspect-ratio 1), so the How to play page with the demo has no sideways scroll. Tablet and
   laptop keep the exact two-column layout above. */
@media (max-width: 600px) {
  .sd-demo-stage { flex-wrap: wrap; justify-content: center; gap: 14px; }
  .sd-demo-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: none; width: 100%; max-width: 252px; }
  .sd-demo-side { width: 100%; max-width: 252px; }
  .sd-demo-pad { justify-content: center; }
}

/* ---- "Show outlines" (task sudoku_outlines, Nov 16 2026; EASY puzzles only, Brandie's decisions
   Nov 16 2026). The toggle sits under the number pad with Erase and Start over, in the same look
   family (3px border, 14px radius, white, hover sky) and big enough for a young child to tap.
   The three outlines: row strip BLUE, column strip PINK, 3x3 block GREEN drawn 4px inset so all
   three stay visible where they overlap. Pure CSS: absolutely positioned inside the grid
   (.sd-grid is position:relative), pointer-events none so squares still click, z-index above the
   squares. They shift no layout and never hide the selected-square yellow, the repeat red or the
   thick 3x3 lines. The colors are stronger versions of the How-to-play step-1 tints (row blue
   #dcecff, column rose #ffc8dc, box green #cde977) so they read as the same three colors. ---- */
.sd-ol { position: absolute; box-sizing: border-box; border: 4px solid; pointer-events: none; z-index: 2; }
.sd-ol-row { left: 0; width: 100%; border-color: #1f6fd1; }
.sd-ol-col { top: 0; height: 100%; border-color: #d6336c; }
.sd-ol-box { border-color: #1e8f4e; }
.sd-outlines-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 14px; border: 3px solid var(--border); border-radius: 14px; background: white; color: var(--ink); font-weight: 900; font-size: 1.25rem; cursor: pointer; user-select: none; }
.sd-outlines-toggle:hover { border-color: var(--blue-action); background: var(--sky); }
.sd-outlines-toggle input { width: 26px; height: 26px; margin: 0; accent-color: var(--blue-action); cursor: pointer; }
.sd-outlines-toggle input:focus-visible { outline: 4px solid var(--ink); outline-offset: 2px; }

/* ---- Phone fit (task sudoku_phone_fit, Nov 16 2026): at <= 600px the 9x9 game grid SHRINKS TO
   FIT the card. The base rules keep a 44px-per-square minimum (9 x 44 = 396px > the ~295-335px a
   phone card offers), so columns 7-9 were clipped. Inside this block ONLY, the track minimum and
   the cell min-width/min-height drop to 0 and aspect-ratio:1 keeps the squares square: about
   36px at 390px wide, about 29px at 320px. The game card gives the grid a little more room with
   10px side padding. Scoped to .sd-screen so the saved-win grid (.sd-win-grid, already fits) and
   the How-to-play demo board (.sd-demo-grid, fixed 28px columns) are untouched, and everything
   >= 601px wide (tablet/desktop) keeps today's exact layout. Cell font stays at its clamp minimum
   1.05rem (~16.8px), readable in a ~29-36px square; the number pad keeps its big tap targets
   (min 52x48) and just wraps. The percent-based outline overlays scale with the grid, so the
   blue/pink/green strips land on the same squares at the new size. ---- */
@media (max-width: 600px) {
  .sd-screen { padding-left: 10px; padding-right: 10px; }
  .sd-screen .sd-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .sd-screen .sd-cell { min-width: 0; min-height: 0; }
}

/* ---- Pencil notes (task merlin_task_sudoku_pencil_lastplayed.md, Brandie Nov 11/17 2026) ----
   Small BLUE digits in the corners of empty squares: a 3x3 mini grid inside the square
   (1 top-left ... 9 bottom-right), drawn with grid-area per digit. The blue (#0b3ad6) is a dark,
   strongly saturated blue so the notes stand out on the white squares, the yellow selected
   square, the sky same-row/column tint, the green/pink highlight tints and next to the blue/
   pink/green outlines, and stay readable at phone width (~29px squares at 320px: the 0.5em
   note digits scale with the cell font and land ~8px). pointer-events:none so the square still
   selects; the cell's aria-label carries the notes for screen readers. Notes are decorative
   reminders, never entries (no conflict red, no finishing, no pad greying).
   The Pencil toggle is the 10th button of the number pad (same look family, >= 44px tap
   target): OFF = white like the pad numbers, ON = strong blue fill with white text and
   aria-pressed="true", so the state is obvious at a glance. On narrow screens it flows inline
   after the nine numbers (wrapping with them); at >= 1000px it is a tall 4th column so the
   laptop one-screen fit is unchanged. */
.sd-notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; z-index: 1; }
.sd-notes b { display: grid; place-items: center; font-weight: 800; font-size: 0.5em; line-height: 1; color: #0b3ad6; }
.sd-pad .sd-pencil { font: inherit; font-weight: 900; font-size: 1.1rem; min-width: 52px; min-height: 48px; padding: 4px 14px; border: 3px solid var(--border); border-radius: 14px; background: white; color: var(--ink); }
.sd-pad .sd-pencil:hover { border-color: var(--blue-action); background: var(--sky); }
.sd-pad .sd-pencil.sd-pencil-on { background: #1f6fd1; border-color: #14509c; color: white; }
.sd-pad .sd-pencil.sd-pencil-on:hover { background: #1a63bc; border-color: #14509c; color: white; }
.sd-pad .sd-pencil:focus-visible { outline: 4px solid var(--ink); outline-offset: 2px; }
/* Wide screens: the Pencil toggle is a tall 4th pad COLUMN (rows 1-3) beside the nine numbers —
   it adds NO height, so the laptop one-screen fit (grid sized to the window height, Hint panel
   reserved space) stays exactly as it was. The pad grows from 226px to ~340px, still inside the
   410px board column. */
@media (min-width: 1000px) {
  .sd-pad { grid-template-columns: repeat(3, 70px) max-content; }
  .sd-pad .sd-pencil { grid-column: 4; grid-row: 1 / span 3; min-height: 0; }
}
/* Tablet widths (600-999px): the ten pad buttons (9 x 52px + Pencil ~111px + gaps ≈ 651px) do not
   fit the 560px board, and a wrapped second pad row pushes Erase/Start over out of an 820x1180
   window. So ONLY here the board widens to 680px for the pad's sake while the grid, the Hint
   panel, the message line and the Erase/Start over row keep their exact 560px centered look —
   the only visible change is the (centered) pad row being wide enough for the Pencil button. */
@media (min-width: 600px) and (max-width: 999.98px) {
  .sd-screen .sd-board { max-width: 680px; }
  .sd-screen .sd-grid, .sd-screen .sd-hint-panel, .sd-screen .sd-msg, .sd-screen .sd-under { max-width: 560px; width: 100%; justify-self: center; }
}
