/* Clarity pass (play-testers, Nov 6, 2026). Loaded last, so these win:
   - crossword squares whose states differ by fill, not only by letter colour;
   - a smaller crossword keyboard with Check on the keys, an Across/Down
     button in the clue bar, and Check's result shown in the clue bar until
     the next move;
   - the game header Michael picked: the game's name, Hint, the level ring
     (difficulty.js) and a round menu button, joined to the cream bar. */

/* Crossword squares. Where you are is gold, the word you're in is pale gold,
   a finished word is green, and a wrong letter is rose with a red outline. */
body[data-view=cross]:not(.puzzle-finished) .cross-cell.active-word:not(.selected):not(.solved):not(.wrong) { background:#fdeec0 !important; box-shadow:none !important; }
body[data-view=cross]:not(.puzzle-finished) .cross-cell.solved:not(.selected) { background:#d4e9cc !important; box-shadow:inset 0 -3px 0 #2c6b45 !important; }
body[data-view=cross]:not(.puzzle-finished) .cross-cell.solved:not(.selected) input { color:#1d5233 !important; }
body[data-view=cross]:not(.puzzle-finished) .cross-cell.wrong:not(.selected) { background:#fbdcd5 !important; box-shadow:inset 0 0 0 2px #b3261e !important; }
body[data-view=cross]:not(.puzzle-finished) .cross-cell.wrong input { color:#a3201a !important; text-decoration:none !important; }
body[data-view=cross]:not(.puzzle-finished) .cross-cell.selected.wrong { box-shadow:inset 0 0 0 3px #b3261e,0 0 0 2px #fff2c2 !important; }

/* The clue bar is a button: tapping it, or the Across/Down button at its end,
   switches direction (Michael, Nov 6). The button names the direction you're
   going (data-dir, set in syncCross). */
body[data-view=cross]:not(.puzzle-finished) #current-clue { cursor:pointer; position:relative; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) #current-clue { padding-right:112px !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) #current-clue::after { content:attr(data-dir) "\00a0\21C5"; position:absolute; right:8px; top:50%; transform:translateY(-50%); display:flex; align-items:center; justify-content:center; height:40px; padding:0 13px; box-sizing:border-box; border-radius:999px; background:#234b3d; color:#fff; font-size:15px; font-weight:800; line-height:1; white-space:nowrap; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) #current-clue.cross-notice { background:#e3efd6 !important; box-shadow:inset 0 0 0 1.5px #2c6b45 !important; color:#173f26 !important; border-left-color:#2c6b45 !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) #current-clue.cross-notice.error { background:#fbdcd5 !important; box-shadow:inset 0 0 0 1.5px #b3261e !important; color:#6e1f14 !important; border-left-color:#b3261e !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) #current-clue.cross-notice::after { content:'✕'; width:30px; height:30px; padding:0; border-radius:50%; background:#fffdf7; box-shadow:inset 0 0 0 1.5px currentColor; color:inherit; font-size:14px; }

/* Phones and tablets with the puzzle keys: board, clue bar, then the keys.
   Check and Next clue live on the keys, so the old Direction/Check row is
   hidden (its buttons stay for computers). Check's result and the other crossword messages
   show in the clue bar (status() in app.js), so their line under the game stays for screen readers only and
   the board never moves. */
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .board-wrap>.cross-visible-tools { display:none !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .board-wrap>:is(.cross-board-viewport,.cross-pan-note) { order:0 !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .board-wrap>.current-clue { order:1 !important; margin:6px 0 0 !important; min-height:52px !important; display:flex !important; align-items:center; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .board-wrap>.cross-keyboard { order:2 !important; margin-top:6px !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .board-wrap>:is(.cross-entry,.all-clues) { order:3 !important; }
/* The tip line under the game stays while Check's result is in the clue bar, so nothing moves. */
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) main:has(>.status.check-note)>.play-instruction { display:block !important; }
@media (max-height:820px) { body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) main:has(>.status.check-note)>.play-instruction { display:none !important; } }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) main>.status.check-note { position:absolute !important; width:1px !important; height:1px !important; min-height:0 !important; margin:-1px !important; padding:0 !important; overflow:hidden !important; clip:rect(0 0 0 0) !important; white-space:nowrap !important; border:0 !important; }

/* Keys: 40px on short phones, never taller than 46px, so the board gets the
   room (it used to grow the keys to 60px on tall phones). */
@media (max-width:759px) {
  body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard { gap:5px !important; }
  body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard>div { gap:4px !important; }
  body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard button { min-height:clamp(40px,calc((100dvh - min(100vw - 33px, 360px) - 300px) / 3),46px) !important; height:auto; }
}
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard [data-key=check] { flex:1.8 1 0 !important; max-width:72px !important; font-size:15px !important; font-weight:800 !important; letter-spacing:0; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard [data-key=back] { flex:1.35 1 0 !important; max-width:56px !important; }
body[data-view=cross].cross-touch-keyboard:not(.puzzle-finished) .cross-keyboard [data-key=next] { flex:1 1 0 !important; max-width:44px !important; }

/* Game header (Michael, Nov 6): the game's name, Hint, the level ring and a
   round menu button on one line, joined to the cream bar above it (no light
   strip between them). */
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) main { padding-top:0 !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .masthead { border-bottom-color:transparent !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading { display:flex !important; flex-wrap:nowrap !important; align-items:center !important; gap:8px !important; margin-top:0 !important; padding-inline:0 !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading h1 { display:block !important; flex:1 1 auto !important; min-width:0 !important; margin:0 !important; white-space:normal !important; overflow-wrap:normal; }
/* Hint: a bulb and "Hint" on the gold button, with what's left in a cream
   bubble on its corner. */
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip { flex:none !important; position:relative; overflow:visible !important; display:inline-flex !important; flex-direction:row !important; align-items:center !important; justify-content:center; gap:6px !important; height:46px !important; min-height:46px !important; min-width:0 !important; margin:0 4px 0 0 !important; padding:0 18px 0 13px !important; border:0 !important; border-radius:999px !important; color:var(--g-ink) !important; background-color:var(--g-gold) !important; background-image:none !important; box-shadow:0 2px 0 #0c2219 !important; line-height:1 !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost .hint-bulb { display:block !important; flex:none; width:20px !important; height:20px !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost .boost-chip-label { display:inline !important; font-size:18px !important; font-weight:800 !important; line-height:1 !important; color:inherit !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost .hint-count { position:absolute; top:-6px; right:-7px; min-width:24px; height:24px; padding:0 6px; box-sizing:border-box; border-radius:12px; background:#f6f1df; color:#1d3d2f; font-size:14px; font-weight:800; line-height:24px; text-align:center; box-shadow:0 0 0 2.5px var(--g-band); }
/* A wider count (12, 99+) gets more room, so its bubble never covers the word. */
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip:has(.hint-count[data-len="2"]) { padding-right:25px !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip:has(.hint-count[data-len="3"]) { padding-right:34px !important; }
/* Its one-time shine runs in the button's own background, so the bubble can
   sit over the edge. */
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-glimmer::after { display:none !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip.boost-glimmer { background-image:linear-gradient(105deg,transparent 42%,rgba(255,255,255,.6) 50%,transparent 58%) !important; background-repeat:no-repeat !important; background-size:250% 100% !important; animation:sa-hint-shine 1.6s ease-out .8s 1 both; }
@keyframes sa-hint-shine { from { background-position:100% 0; } to { background-position:0% 0; } }
@media (prefers-reduced-motion:reduce) { body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip.boost-glimmer { animation:none; background-image:none !important; } }
/* The menu: a round button with three dots, in place of "Actions". */
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading .play-tools { flex:none; margin:0 !important; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading .play-tools>summary { display:grid !important; place-items:center; width:46px !important; min-width:46px !important; height:46px !important; min-height:46px !important; padding:0 !important; box-sizing:border-box; border-radius:50% !important; background:transparent !important; border:2px solid #b9c9ad !important; box-shadow:none !important; color:var(--g-on-band) !important; }
.play-tools>summary .play-tools-dots { display:block; width:24px; height:24px; fill:currentColor; }
/* Phones: the name shrinks a little with the screen, so "Common Ground" and
   "Word scramble" fit beside the buttons; small phones also get slimmer
   buttons. On short phones the band is thinner, so the bubble sits lower. */
@media (max-width:759px) { body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading h1 { font-size:clamp(19px,5.6vw,23px) !important; } body[data-view=groups]:not(.puzzle-finished) .game-heading h1 { font-size:clamp(17px,5vw,23px) !important; } }
@media (max-width:380px) {
  body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading { gap:6px !important; }
  body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip { padding:0 17px 0 10px !important; }
  body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading :is(.sa-level-dial,.play-tools>summary) { width:44px !important; min-width:44px !important; height:44px !important; min-height:44px !important; }
  body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading .sa-level-dial svg { width:42px; height:42px; }
}
/* A name that doesn't fit wraps onto a second line (tablets, sideways
   phones, the smallest phones) rather than being cut short. On the smallest
   phones (320px) the two lines still fit inside the buttons' height, and Hint
   keeps a little more room so its bubble clears the "t". */
@media (max-width:340px) { body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading h1 { font-size:17px !important; line-height:1.05 !important; } body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost.boost-chip { padding-right:18px !important; } }
@media (max-width:759px) and (max-height:700px) { body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading #use-boost .hint-count { top:-2px; } }

/* Difficulty (difficulty.js): a ring, filled a quarter more for each level:
   first in the game's menu (Nov 12), or after Hint where a game has no menu. One colour per level, the same on the path, the ring and the
   sheet; brighter on the dark band. */
:is(.sa-level-dial,.sa-level-item,.sa-level-option)[data-pace=Gentle] { --level:#2c6b45; --level-bright:#86d39a; }
:is(.sa-level-dial,.sa-level-item,.sa-level-option)[data-pace=Steady] { --level:#9a6a00; --level-bright:#f5c95a; }
:is(.sa-level-dial,.sa-level-item,.sa-level-option)[data-pace=Stretch] { --level:#b4532a; --level-bright:#f39265; }
:is(.sa-level-dial,.sa-level-item,.sa-level-option)[data-pace=Expert] { --level:#8a1d4a; --level-bright:#ee7fae; }
.game-heading .sa-level-dial { --ring-track:#d5dccb; --ring-fill:var(--level); --ring-dot:#fffdf7; --ring-dot-edge:var(--level); flex:none; display:grid !important; place-items:center; width:46px !important; height:46px !important; min-width:46px !important; min-height:46px !important; padding:0 !important; margin:0 !important; border:0 !important; border-radius:50% !important; background:transparent !important; box-shadow:none !important; cursor:pointer; }
.game-heading .sa-level-dial svg { display:block; width:44px; height:44px; }
.play-tools .sa-level-item { --ring-track:#d5dccb; --ring-fill:var(--level); --ring-dot:#fffdf7; --ring-dot-edge:var(--level); display:flex; align-items:center; justify-content:flex-start; gap:10px; }
.play-tools .sa-level-item svg { display:block; flex:none; width:30px; height:30px; margin:-4px 0; }
:is(.sa-level-dial,.sa-level-item) .sa-ring-track { stroke:var(--ring-track); }
:is(.sa-level-dial,.sa-level-item) .sa-ring-fill { stroke:var(--ring-fill); }
:is(.sa-level-dial,.sa-level-item) .sa-ring-dot { fill:var(--ring-dot); stroke:var(--ring-dot-edge); stroke-width:2; }
body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading .sa-level-dial { --ring-track:rgba(246,241,223,.24); --ring-fill:var(--level-bright); --ring-dot:#f6f1df; --ring-dot-edge:none; }
@media (hover:hover) { body:is([data-view=search],[data-view=sudoku],[data-view=cross],[data-view=scramble],[data-view=groups],[data-view=maze],[data-view=unveil],[data-view=stones]):not(.puzzle-finished) .game-heading .sa-level-dial:hover { background:rgba(246,241,223,.1) !important; } }

/* The difficulty sheet. */
.sa-level-dialog p { font-size:17px; line-height:1.45; margin:14px 0 0; }
.sa-level-options { display:grid; gap:10px; margin:16px 0 6px; }
.sa-level-option { display:grid; gap:3px; width:100%; min-height:60px; padding:11px 14px 11px 16px; text-align:left; border-radius:14px; border:1.5px solid #c9d3bf; border-left:8px solid var(--level,#c9d3bf); background:#fffdf7; color:#1b3326; font:inherit; cursor:pointer; }
.sa-level-option strong { display:flex; align-items:center; gap:8px; font-size:19px; }
.sa-level-option small { font-size:15px; line-height:1.35; color:#3f5446; }
.sa-level-option.is-current { background:#eef6ea; border-color:var(--level); border-left-color:var(--level); }
.sa-level-option:focus-visible { outline:3px solid #234f37; outline-offset:2px; }
.sa-level-now { font-size:12px; font-weight:800; padding:3px 8px; border-radius:999px; background:var(--level); color:#fff; }
.sa-level-note { font-size:15px !important; color:#3f5446; }
.sa-level-easier { display:flex; justify-content:center; width:100%; margin:16px 0 10px; box-sizing:border-box; text-decoration:none; }
.sa-level-dialog .keep-playing { margin-top:12px; }
