/* Shared look for every game page. */
:root{
  --paper:#ECEEE7; --panel:#F7F8F3; --ink:#2A2530; --ink-soft:#5E5866; --line:rgba(42,37,48,.22);
  /* colours that change in Dark Mode (below): the favourite star and gold words, red words, the hover and the card's backdrop */
  --star:#A87A20; --gold-text:#7A5400; --gold-ink:#5C3F00; --bad-text:#B23A28; --hover:#fff; --hover-tint:rgba(42,37,48,.06); --scrim:rgba(236,238,231,.85);
  --ts:1;   /* text size: the phone's own text size setting, set by textSize in games.js */
  --ts-big:min(var(--ts),1.3);   /* titles grow less (Apple: prioritize the content when text gets bigger) */
  --pacific-blue:#73A7AE; --sage-green:#6AA673; --fuchsia-plum:#B94588;
  --periwinkle:#7885BA; --spring-blue:#4E577D; --lavender:#8D78AD;
  --gradient:linear-gradient(90deg,#BD5538,#E16A4A,#73A7AE,#ECA818,#B3B94B,#6AA673,#B94588);
  --board:min(94vw,560px);
  --font:"Baloo 2",ui-rounded,"Segoe UI",system-ui,sans-serif;
}
/* Dark Mode, when the phone or computer is set to it: the page, panels, menus and cards go dark. Boards (and the
   walkthrough drawn over them) keep the light colours, like a real board on a dark table, since each game draws its
   own board in colours chosen against them. */
:root{color-scheme:light dark}
@media (prefers-color-scheme:dark){
  :root{--paper:#1F1C24; --panel:#2A2630; --ink:#ECEEE7; --ink-soft:#B4AEBB; --line:rgba(236,238,231,.24);
    --star:#ECA818; --gold-text:#ECA818; --gold-ink:#FBE3A6; --bad-text:#F08A78; --hover:#37323E; --hover-tint:rgba(236,238,231,.08); --scrim:rgba(31,28,36,.88)}
  .board,.wrap,.stage,.spot{--paper:#ECEEE7; --panel:#F7F8F3; --ink:#2A2530; --ink-soft:#5E5866; --line:rgba(42,37,48,.22);
    --star:#A87A20; --gold-text:#7A5400; --gold-ink:#5C3F00; --bad-text:#B23A28; --hover:#fff; --hover-tint:rgba(42,37,48,.06); color:var(--ink)}
  /* ...except the cards (which some pages keep inside the board's box) and a part of the board drawn in lines on the page
     itself, with nothing behind it (Toe Beans' paw: .darkOk) */
  /* Apple's Dark Mode guidance: soften white backgrounds. A board keeps its light colours, a shade dimmer than by day. */
  .board,.wrap,.stage{--paper:#DFE1D9; --panel:#E9EAE4}
  .overlay,.darkOk{--paper:#1F1C24; --panel:#2A2630; --ink:#ECEEE7; --ink-soft:#B4AEBB; --line:rgba(236,238,231,.24);
    --star:#ECA818; --gold-text:#ECA818; --gold-ink:#FBE3A6; --bad-text:#F08A78; --hover:#37323E; --hover-tint:rgba(236,238,231,.08); color:var(--ink)}
}
/* Increase Contrast (the system setting): the soft grey words go to full ink and the faint lines get stronger, in light
   and dark alike. */
@media (prefers-contrast:more){
  :root,.board,.wrap,.stage,.spot,.overlay,.darkOk{--ink-soft:var(--ink); --line:color-mix(in srgb,var(--ink) 60%,transparent)}
  .tool:disabled,button:disabled{opacity:.55}
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
/* Nothing may stick out past the screen's sides: on an iPhone, anything that does (even something invisible) makes
   Safari zoom the whole page out, leaving the game small on one side (seen in Wind Up at the larger text sizes).
   clip cuts it off without making a scroll box. And Safari's own text enlargement stays off: --ts does that job. */
html,body{overflow-x:clip}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{background:var(--paper);color:var(--ink);font-family:var(--font);font-size:calc(17px*var(--ts));line-height:1.4;
  padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px);-webkit-tap-highlight-color:transparent}
main{max-width:600px;margin:0 auto;padding:12px 3vw 40px;display:flex;flex-direction:column;align-items:center;gap:14px}
header{display:flex;flex-direction:column;align-items:center}
/* a game's title: the name (and its cat), stripe and tagline centred, with Games and the game's star standing at the
   far right and an empty column as wide on the left, so the title stays in the middle */
header.withTools{display:grid;grid-template-columns:74px minmax(0,1fr) 74px;align-items:start;width:var(--board)}
header.withTools > *{grid-column:2;justify-self:center}
/* a title (and its cat) never runs under Games: it stays in its column, the name wrapping onto two lines if need be */
header.withTools > .title{max-width:100%;min-width:0} header.withTools .title h1{min-width:0;text-align:center}
header.withTools > .headTools{grid-column:3;grid-row:1 / span 2;justify-self:end;align-self:center;display:flex;flex-direction:row;align-items:center}
header .headTools > button.tool{min-width:42px;padding:2px 3px;font-size:calc(12px*var(--ts))}
.headTools .gamesBtn[aria-expanded="true"]{background:color-mix(in srgb,var(--sage-green) 20%,transparent);color:var(--ink)}
header .headTools > button.headStar{min-width:30px;font-size:calc(28px*var(--ts-big));line-height:1;padding:2px}
/* the narrowest titles (a small phone, or the column beside the board on a phone held sideways): Games is its icon alone */
@media (max-width:380px),(orientation:landscape) and (max-height:500px){
  header.withTools{grid-template-columns:62px minmax(0,1fr) 62px}
  header .headTools > button.gamesBtn{min-width:32px}
  header .headTools > button.gamesBtn .lbl{display:none}
}
.headTools .headStar .st{color:var(--ink-soft)}
header .headTools > button.headStar[aria-pressed="true"]{background:none} header .headTools > button.headStar[aria-pressed="true"] .st{color:var(--star)}
h1{margin:0;font-size:calc(44px*var(--ts-big));font-weight:800;letter-spacing:-.5px;line-height:1}
.stripe{height:7px;width:150px;border-radius:4px;background:var(--gradient);margin-top:6px}
.tagline{margin:6px 0 0;font-size:calc(15px*var(--ts));color:var(--ink-soft);text-align:center}

/* Short screens (an iPhone SE, a phone held sideways): a smaller title and no tagline, so more of the board fits.
   --tall is the most height a board may take: always a strip of page left to swipe, so the page can scroll. */
:root{--tall:calc(100vh - 120px)}
@supports (height:100svh){:root{--tall:calc(100svh - 120px)}}
@media (max-height:760px){
  main{gap:9px;padding-top:6px}
  h1{font-size:calc(32px*var(--ts-big))}
  .stripe{height:5px;width:110px;margin-top:4px}
  .tagline{display:none}
  .games{margin-top:0}
}
/* A phone held sideways: the board's box (.stage, a child of main) takes the left of the screen at its full height
   and stays put, and everything else is a column beside it that scrolls. --board is the board's width there (at most
   the screen's height over --aspect, the box's height for each pixel of width, so a tall box still fits), and 100% in
   the column. Its margin takes back its height, so the rows are only as tall as the column's own things, and it sits
   above the column, so a card opened inside it covers the column too. A page with its own full screen keeps that
   layout under body.full. */
@media (orientation:landscape) and (max-height:500px){
  body:not(.full) main:has(> .stage){--high:calc(100vh - 12px);display:grid;grid-template-columns:auto minmax(0,1fr);
    align-items:start;gap:0 16px;max-width:none;
    padding:6px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left))}
  @supports (height:100svh){body:not(.full) main:has(> .stage){--high:calc(100svh - 12px)}}
  body:not(.full) main:has(> .stage) > *{grid-column:2;justify-self:center;--board:100%;margin-bottom:8px}
  /* ...but not the card's backdrop: it's fixed to the whole screen, and centring it would shrink it to the card */
  body:not(.full) main:has(> .stage) > .overlay{justify-self:stretch;align-self:stretch;margin:0}
  body:not(.full) main:has(> .stage) .bar label{max-width:100%}
  body:not(.full) main:has(> .stage) .bar select{max-width:100%}
  body:not(.full) main:has(> .stage) .bar .opt{min-width:0;max-width:100%}
  body:not(.full) main:has(> .stage) .bar .opt label{flex-wrap:wrap}
  body:not(.full) main > .stage{grid-column:1;grid-row:1 / span 20;align-self:start;position:sticky;top:6px;z-index:4;margin:0 0 -100vh;
    --board:min(58vw,calc(var(--high) / var(--aspect,1)));--tall:var(--high)}
  /* A board much wider than tall (.stage.wide) keeps the whole width instead: the title and menu share a slim row
     above it, then the status line, and the board is as wide as fits the height left (less --below, for a tray under
     it that should show too). */
  body:not(.full) main:has(> .stage.wide) > *{grid-column:1 / -1;--board:min(100%,760px)}
  body:not(.full) main:has(> .stage.wide) > header{grid-template-columns:74px minmax(0,1fr) 74px}
  body:not(.full) main:has(> .stage.wide) > header h1{font-size:calc(26px*var(--ts))}
  body:not(.full) main:has(> .stage.wide) > header .stripe{height:4px;margin-top:3px}

  body:not(.full) main > .stage.wide{grid-column:1 / -1;grid-row:auto;position:relative;top:auto;z-index:auto;margin:0 0 8px;
    --board:min(100%,760px,calc((var(--high) - 104px - var(--below,0px)) / var(--aspect,1)));--tall:calc(var(--high) - 104px - var(--below,0px))}
}

.games{display:flex;flex-direction:column;align-items:center;gap:10px;width:var(--board);margin-top:-4px}
.gamesBtn{display:inline-flex;align-items:center;gap:7px;font:inherit;font-weight:600;font-size:calc(15px*var(--ts));color:var(--ink);background:var(--panel);border:2px solid var(--ink);border-radius:999px;padding:3px 14px;cursor:pointer}
.gamesBtn svg{width:15px;height:15px;fill:currentColor}
.gamesBtn .caret{font-size:calc(12px*var(--ts));transition:transform .2s}
.gamesBtn[aria-expanded="true"] .caret{transform:rotate(180deg)}
/* the menu: the front page, a search box, the games played lately, then every game on its shelf */
.gamesPanel{position:relative;z-index:20;display:flex;flex-direction:column;gap:10px;width:100%}
.gamesPanel[hidden],.gamesPanel [hidden]{display:none}
.gamesGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.gamesGroup h3{margin:2px 0 6px;font-size:calc(15px*var(--ts));font-weight:800;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.06em}
.gamesSearch{font:inherit;font-size:calc(16px*var(--ts));width:100%;padding:7px 12px;border:2px solid var(--ink);border-radius:999px;background:var(--panel);color:var(--ink)}
.gamesNone{margin:0;color:var(--ink-soft);text-align:center}
/* Favorites: a star beside each game's tile (and beside the menu button on a game's page) */
.gamesRow{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}
.favWrap{position:relative;display:grid}
.favWrap[hidden]{display:none}
.favStar{font:inherit;line-height:1;cursor:pointer;color:var(--ink-soft);background:none;border:none;padding:4px 6px;font-size:calc(20px*var(--ts))}
button.favStar[aria-pressed="true"]{color:var(--star);background:none}
.favWrap > .favStar{position:absolute;top:2px;right:2px}
.favStar.labelled{display:inline-flex;align-items:center;gap:5px;font-size:calc(15px*var(--ts));font-weight:600;color:var(--ink);background:var(--panel);border:2px solid var(--ink);border-radius:999px;padding:3px 12px}
button.favStar.labelled[aria-pressed="true"]{color:var(--ink);border-color:#E0A526;background:color-mix(in srgb,#ECA818 18%,var(--panel))}
.favStar.labelled .st{color:var(--ink-soft)}
.favStar[aria-pressed="true"] .st{color:var(--star)}
.title{display:flex;align-items:flex-end;gap:8px}
.gameTile{display:flex;flex-direction:column;gap:1px;padding:8px 10px 8px 14px;border-radius:12px;background:color-mix(in srgb,var(--tile) 9%,var(--panel));border:2px solid var(--line);text-decoration:none;color:var(--ink);position:relative;overflow:hidden;line-height:1.2}
.gameTile::before{content:"";position:absolute;left:0;top:0;bottom:0;width:6px;background:var(--tile)}
.gameTile b{font-size:calc(16px*var(--ts))}
/* a game mastered (a gold paw at its top level): a small gold label; its tile keeps its shelf's colour */
.masterPill{display:inline-block;align-self:center;font-size:calc(12px*var(--ts));font-weight:800;line-height:1.5;padding:0 8px;border-radius:999px;
  color:var(--gold-ink);background:color-mix(in srgb,#ECA818 45%,var(--panel));border:1.5px solid #E0A526}
/* gold: today's challenge once it's solved */
.gameTile.gold{border-color:#E0A526;background:linear-gradient(135deg,color-mix(in srgb,#ECA818 34%,var(--panel)),color-mix(in srgb,#ECA818 14%,var(--panel)))}
/* today's challenge, once solved, is gold all over */
.gamesGroup .gameTile.gold.done::before{background:#E0A526}
.gameTile small{font-size:calc(13px*var(--ts));color:var(--ink-soft)}
.gameTile.home{--tile:var(--gradient);background:var(--panel)}
.gamesGroup h3[style]::before{content:"";display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--dot);margin-right:7px;vertical-align:1px}
/* on/off switches */
.toggle{display:flex;align-items:center;gap:8px;cursor:pointer;font-weight:600;user-select:none;white-space:nowrap}
.toggle input{position:absolute;opacity:0;width:1px;height:1px}
.sw{flex:none;width:42px;height:24px;border-radius:12px;background:var(--line);position:relative;transition:background .15s}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .15s}
.toggle input:checked + .sw{background:var(--sage-green)}
.toggle input:checked + .sw::after{left:21px}
.toggle input:focus-visible + .sw{outline:3px solid var(--pacific-blue);outline-offset:2px}
.gameTile:hover{border-color:var(--tile)}
.gameTile[aria-current="page"]{border-color:var(--ink)}
.gameTile[aria-current="page"] small{color:var(--ink);font-weight:600}

.bar{width:var(--board);display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.bar label{max-width:100%} .bar label select{max-width:100%}   /* a long level name fits a small phone */
.bar.toggles .opt{min-width:0;max-width:100%} .bar.toggles .toggle{white-space:normal}   /* and so does a switch's name */
/* the Level picker: a step icon, then the menu, which shrinks only if the row is too narrow for it */
.bar label.picker{display:inline-flex;align-items:center;gap:6px;min-width:0}
.bar label.picker select{min-width:0}
@media (max-width:430px){.bar label.picker select{font-size:calc(15px*var(--ts));padding:4px 6px}}   /* longer level names fit a phone */
.picker .ic{display:block;width:26px;height:26px;flex:none;fill:none;stroke:var(--ink-soft);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
select,button{font:inherit;color:var(--ink)}
select{background:var(--panel);border:2px solid var(--ink);border-radius:10px;padding:4px 10px;font-weight:600}
button{background:var(--panel);border:2px solid var(--ink);border-radius:10px;padding:6px 16px;font-weight:600;cursor:pointer}
button:hover{background:var(--hover)}
button:active{transform:translateY(1px)}
button:disabled{opacity:.4;cursor:default}
button.primary{background:var(--ink);color:var(--paper)}
button[aria-pressed="true"]{background:var(--ink);color:var(--paper)}
:focus-visible{outline:3px solid var(--pacific-blue);outline-offset:2px}

.status{width:var(--board);min-height:30px;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:2px 12px;font-weight:600}
.msg{flex:1 1 150px;text-align:right;color:var(--ink-soft);line-height:1.25}
/* under the board: the goal at the left, the time at the right, a note on its own line under them */
.status.below{margin-top:6px;padding-right:0!important}   /* no room kept for a cat peeking over the board (Patches, Twirl): it isn't beside it now */
.status.below > .timer{margin-left:auto}
.status.below > .msg{flex:1 1 100%;order:3;text-align:center}
.status.below > .msg:empty{display:none}
.wrap{position:relative;width:var(--board);height:var(--board)}
.board{width:100%;height:100%;display:grid;border:3px solid var(--ink);border-radius:6px;overflow:hidden;
  touch-action:none;user-select:none;-webkit-user-select:none}
.actions{width:var(--board);display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
/* Action buttons as tools (G's toolify): an icon with its word small underneath, as in Toydoku; on (aria-pressed)
   tinted green, the main one (Catdoku's Complete) in ink with a green icon */
.actions.tools{gap:2px 2px}
/* the buttons not used in play, small, in a row of their own under the title (games.js, pageTools) */
.pageTools{width:var(--board);display:flex;justify-content:center;flex-wrap:wrap;gap:0 2px;margin:-4px 0 2px}
.pageTools > button.tool{min-width:50px;padding:2px 6px;font-size:calc(12px*var(--ts))}
.pageTools > button.tool .ic{width:22px;height:22px}
/* a hint's words, just above the play tools */
.hintLine{width:var(--board);margin:0;text-align:center;font-weight:700;color:var(--ink);line-height:1.3;
  background:color-mix(in srgb,#ECA818 18%,transparent);border-radius:10px;padding:6px 10px;box-sizing:border-box}
.hintLine:empty{display:none}
/* the Keys card (press ?) */
.card .keysList{list-style:none;margin:0 0 14px;padding:0;text-align:left;color:var(--ink);line-height:1.35}
.card .keysList li{padding:4px 0;border-bottom:1px solid var(--line)}
.tools > button.tool,.headTools > button.tool,.bar > button.tool.moved{display:inline-flex;flex-direction:column;align-items:center;gap:1px;min-width:58px;padding:4px 6px;
  background:none;border:none;border-radius:12px;color:var(--ink-soft);font-size:calc(13px*var(--ts));font-weight:600;line-height:1.15;box-shadow:none}
.tools > button.tool[hidden],.bar > button.tool[hidden],.headTools > button.tool[hidden]{display:none}
.tools > button.tool:hover,.headTools > button.tool:hover,.bar > button.tool.moved:hover{background:var(--hover-tint)}
.tools > button.tool[aria-pressed="true"],.headTools > button.tool[aria-pressed="true"]{background:color-mix(in srgb,var(--sage-green) 20%,transparent);color:var(--ink)}
.tools > button.tool.primary,.headTools > button.tool.primary{background:none;color:var(--ink)}
.tools > button.tool.primary .ic,.headTools > button.tool.primary .ic{stroke:var(--sage-green);stroke-width:2.6}
.tool .ic{display:block;margin-inline:auto;width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tool .ic circle[r="1.3"]{fill:currentColor}
.tool .lbl{white-space:nowrap}
/* Guess armed: the board is ringed in violet until the next thing put on it (G.guesser) */
.guessing{box-shadow:0 0 0 3px #8A5CC7;border-radius:12px}
/* a guess: violet until it's undone. The SVG box drawn over a square lets taps through to the square under it;
   Fair Play's squares carry .guess themselves (styled in its page) and must stay tappable, so this is for rects only */
rect.guess{fill:rgba(138,92,199,.14);stroke:#8A5CC7;stroke-width:5;pointer-events:none}
.guessed{box-shadow:inset 0 0 0 4px #8A5CC7!important;background-image:linear-gradient(rgba(138,92,199,.14),rgba(138,92,199,.14))!important}
.tool{position:relative}
.tool .ic .white{fill:#fff} .tool .ic .green{fill:var(--sage-green)} .tool:disabled .ic .green{fill:none}
/* a helper's uses left: a badge on the icon's top right corner, clear of the icon */
.tool .count{position:absolute;top:-3px;left:calc(50% + 12px);min-width:18px;padding:0 5px;border-radius:999px;background:var(--ink);color:var(--paper);
  font-size:calc(11px*var(--ts));font-weight:800;line-height:16px;text-align:center}
.actions.helpers.tools{display:flex;flex-wrap:wrap;justify-content:center}
/* A one-use helper goes (hidden, not greyed) once it's used up, the others share the row, and a row with none left goes too */
.actions.helpers{grid-template-columns:none!important;grid-auto-flow:column;grid-auto-columns:1fr}
.actions.helpers [hidden]{display:none!important}
.actions.helpers:not(:has(> :not([hidden]))){display:none}
/* a line of tools left with nothing in it (all moved to the menu or beside New) takes no room */
.actions:not(:has(> :not([hidden]))){display:none}
/* New and Go keep their own look with an icon before the word */
button.lead{display:inline-flex;align-items:center;justify-content:center;gap:6px}
summary.lead{display:flex;align-items:center;justify-content:center;gap:6px}
.lead .lbl,.bar > .tool .lbl{white-space:normal;min-width:0}
.lead .ic{display:block;width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2.8;stroke-linecap:round;stroke-linejoin:round}
.tools > .tool.fsBtn svg,.bar > .tool.fsBtn svg{width:28px;height:28px;stroke-width:2}
.bar > button.tool{display:inline-flex;flex-direction:column;align-items:center;gap:1px;padding:4px 6px;background:none;border:none;
  border-radius:12px;color:var(--ink-soft);font-size:calc(13px*var(--ts));font-weight:600;line-height:1.15}
.help{width:var(--board);color:var(--ink-soft);font-size:calc(15px*var(--ts));margin:4px 0 0}
.help p{margin:0 0 4px}

.overlay{position:fixed;inset:0;z-index:10;display:none;align-items:flex-start;justify-content:center;background:var(--scrim);padding:20px;overflow:auto}
.overlay.show{display:flex}
.card{margin:auto 0;background:var(--panel);border:3px solid var(--ink);border-radius:14px;padding:22px 26px;text-align:center;max-width:360px}
.card h2{margin:0 0 6px;font-size:calc(30px*var(--ts-big));line-height:1.1}
.card p{margin:0 0 16px;color:var(--ink-soft)}
.card .stripe{margin:0 auto 14px}
.card .btns{display:flex;flex-direction:column;align-items:stretch;gap:10px}
.card .pick{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px;margin:14px 0 0;font-size:calc(15px*var(--ts));color:var(--ink-soft)}
/* the card's level picker: the chosen level as text that wraps, under a see-through select (G.otherSize) */
.pickbox{position:relative;display:inline-flex;align-items:center;gap:6px;max-width:100%;background:var(--panel);border:2px solid var(--ink);border-radius:10px;padding:4px 10px;font-weight:600;color:var(--ink);text-align:center;line-height:1.3}
.pickbox::after{content:"";flex:none;width:7px;height:7px;border:solid currentColor;border-width:0 2px 2px 0;transform:translateY(-2px) rotate(45deg);margin-left:2px}
.pickshown{min-width:0;overflow-wrap:anywhere}
.pickbox select{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;border:0;padding:0;font-size:calc(16px*var(--ts))}
.pickbox:has(select:focus-visible){outline:3px solid var(--pacific-blue);outline-offset:2px}
.card .catname{font-size:calc(24px*var(--ts));font-weight:800;color:var(--ink);line-height:1.2;margin:0 0 16px}
.catpic{display:block;width:100%;max-height:190px;object-fit:cover;border-radius:10px;border:2px solid var(--ink);margin:0 0 14px;background:var(--line);aspect-ratio:4/3}
/* the toy picker */
.toypick{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin:0 0 12px}
.toypick button{padding:2px;border:2px solid var(--line);border-radius:10px;background:#fff;width:46px;height:46px}
.toypick button img{display:block;width:100%;height:100%;transition:opacity .15s,filter .15s}
.toypick button[aria-pressed="false"]{border-style:dashed;background:none;color:inherit}
.toypick button[aria-pressed="false"] img{opacity:.22;filter:grayscale(1)}
.toypick button[aria-pressed="true"]{background:#fff;color:inherit}
.card .tip{font-size:calc(14px*var(--ts));margin:0 0 14px}
/* the feedback card (feedbackCard in games.js): what kind, a box to write in, how to reach you, and what's sent with it */
.card .feedback{text-align:left;margin:0 0 14px}
.card .fbKinds{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:0 0 14px}
.card .fbKinds button{min-height:44px;padding:6px 12px;border-radius:999px;font-size:calc(15px*var(--ts))}
.card .fbField{display:block;margin:0 0 12px;font-weight:700;color:var(--ink);font-size:calc(15px*var(--ts))}
.card .fbField span{display:block;margin:0 0 4px}
.card .fbField textarea,.card .fbField input{display:block;width:100%;box-sizing:border-box;margin:0;padding:8px 10px;border:2px solid var(--ink);border-radius:10px;
  background:var(--paper);color:var(--ink);font:inherit;font-weight:400;font-size:calc(16px*var(--ts));resize:vertical}
.card .fbField small{display:block;margin:4px 0 0;font-weight:400;color:var(--ink-soft);font-size:calc(13px*var(--ts))}
.card .fbSent{margin:0;font-size:calc(13px*var(--ts))}
/* a beta game's Beta label is a button that opens the feedback card, with room round it for a finger */
button.betaBtn{position:relative;background:none;font-family:inherit;line-height:inherit;cursor:pointer}
button.betaBtn::before{content:"";position:absolute;inset:-12px -4px}
button.betaBtn:hover{background:var(--hover-tint)}
.card .pickNote{font-size:calc(14px*var(--ts));margin:0 0 14px;font-weight:600}
.card .pickNote.bad{color:var(--bad-text)}
/* A win card on a phone held sideways: the picture on the left, the words and buttons beside it, two buttons to a
   row, so it fits on the screen rather than running off the bottom. */
@media (orientation:landscape) and (max-height:500px){
  .overlay:has(.winmedia){padding:10px}
  .card:has(> .winmedia){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);column-gap:20px;align-items:start;max-width:min(720px,100%);padding:14px 18px}
  .card:has(> .winmedia) > *,.card .winmedia > *{grid-column:2}
  .card > .winmedia{display:contents}
  .card .winpic{grid-column:1;grid-row:1 / span 20;align-self:center}
  .card .winpic img{max-height:calc(100vh - 100px);width:auto;max-width:100%;margin:0 auto 8px}
  .card .winpic .catpic{width:100%}
  .card .winpic .catname{margin:0;font-size:calc(20px*var(--ts))}
  .card:has(> .winmedia) h2{font-size:calc(24px*var(--ts-big))}
  .card:has(> .winmedia) .stripe{margin-bottom:8px}
  .card:has(> .winmedia) p{margin-bottom:8px}
  .card:has(> .winmedia) .goldpaw{width:40px;height:40px;margin-bottom:2px}
  .card:has(> .winmedia) .btns{display:grid;grid-template-columns:1fr 1fr;gap:6px}
  .card:has(> .winmedia) .btns .primary,.card:has(> .winmedia) .btns button:last-child:nth-child(even){grid-column:1 / -1}
  .card:has(> .winmedia) .btns button{padding:4px 8px;font-size:calc(15px*var(--ts));line-height:1.2}
  .card:has(> .winmedia) .pick{margin-top:8px}
}
/* Full screen (G.fullScreen): the page fills the window, with the title and menu put away; each game lays out the rest. */
.fsBtn svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.fsBtn .leave,body.full .fsBtn .enter{display:none}
body.full .fsBtn .leave{display:block}
body.full{overflow:hidden}
body.full main{position:fixed;inset:0;z-index:5;max-width:none;gap:6px;
  padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
body.full main > header,body.full .blurb,body.full .games{display:none}
/* Lives (G.lives): hearts, hollow once lost */
.hearts{font-size:20px;letter-spacing:1px;color:var(--fuchsia-plum)}
.hearts .lost{color:var(--line)}
/* Zoom and full screen (G.zoom): round buttons on a line under the board's right-hand corner (.below), with
   anything for the middle of that line (Twirl's Hint) centred on it; or in the board's bottom-right corner */
.zoombox{position:absolute;right:8px;bottom:8px;z-index:2}
.zoombox .zend{display:flex;flex-direction:column;gap:6px}
.zoombox.below{position:static;width:var(--board);max-width:100%;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;margin:6px auto 0}
.zoombox.below .zend{grid-column:3;flex-direction:row;justify-self:end}
.zoombox.below .zmid{grid-column:2;display:flex;justify-content:center}
.zoombox button.zb{position:relative;width:40px;height:40px;padding:0;border-radius:50%;display:grid;place-items:center;font-size:24px;line-height:1;font-weight:800;
  background:color-mix(in srgb,var(--panel) 92%,transparent)}
.zoombox button.zb.word{font-size:calc(14px*var(--ts))}
.zoombox .zb svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
@media (max-width:600px),(max-height:500px){.zoombox .zend{gap:4px}.zoombox button.zb{width:34px;height:34px;font-size:21px}}
.zoombox button.zb::after{content:"";position:absolute;left:50%;top:50%;width:44px;height:44px;transform:translate(-50%,-50%)}   /* a 44-point touch target */
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
/* Hints: a gold box (red when it points at a mistake) that stays put, pulsing on top when motion is allowed.
   .hintsq is for SVG boards, .hintcell for boards made of squares. */
.hintsq{fill:rgba(236,168,24,.3);stroke:#ECA818;stroke-width:4px;vector-effect:non-scaling-stroke;pointer-events:none;animation:hintsq .6s ease-in-out 6 alternate}
.hintsq.bad{fill:rgba(200,57,43,.18);stroke:#C8392B}
@keyframes hintsq{to{stroke-width:8px}}
/* The keyboard cursor (G.gridKeys): .kbcursor on boards made of squares, .kbring on SVG boards. */
.kbring{fill:none;stroke:#73A7AE;stroke-width:4px;vector-effect:non-scaling-stroke;pointer-events:none}
.kbcursor{outline:3px solid #73A7AE;outline-offset:-3px}
/* Fridge Magnets' alphabet magnets (Junk Drawer has them too): chunky capitals with a soft shadow, no outline */
.fmag{font-weight:800;font-family:var(--font);text-transform:uppercase;filter:drop-shadow(1.5px 2.5px 0 rgba(42,37,48,.3))}
.hintcell{position:relative;z-index:2;box-shadow:inset 0 0 0 100vmax rgba(236,168,24,.55)!important;animation:hintcell .6s ease-in-out 6 alternate}
.hintcell.bad{box-shadow:inset 0 0 0 100vmax rgba(200,57,43,.45)!important;animation-name:hintbad}
@keyframes hintcell{to{box-shadow:inset 0 0 0 100vmax rgba(236,168,24,.3)}}
@keyframes hintbad{to{box-shadow:inset 0 0 0 100vmax rgba(200,57,43,.22)}}
.hintline{fill:none;stroke:#ECA818;stroke-width:10px;stroke-linecap:round;vector-effect:non-scaling-stroke;opacity:.85;pointer-events:none;animation:hintsq .6s ease-in-out 6 alternate}
.hintline.bad{stroke:#C8392B}
/* settings with a short line under each saying what it does */
.toggles{display:flex;gap:12px;flex-wrap:nowrap;align-items:flex-start}
.opt{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:2px}
.opt .hint{font-size:calc(14px*var(--ts));line-height:1.25;color:var(--ink-soft)}
.dailyBadge{font-size:calc(13px*var(--ts));font-weight:600;color:var(--ink-soft);background:var(--panel);border:2px dashed var(--line);border-radius:999px;padding:1px 12px}
.dailyBadge.done{color:var(--ink);border-style:solid;border-color:#ECA818;background:color-mix(in srgb,#ECA818 18%,var(--panel))}
.card .dailyline{color:var(--ink);font-weight:700;margin:-6px 0 14px}
/* Touch targets: every control is at least 44 × 44 points to a finger (Apple's Human Interface Guidelines). Small
   ones that look right as they are (the stars, the timer, a summary line) get an invisible 44-point square round
   them; buttons and pickers in the settings row and on cards are simply that tall. */
.favStar::after,.timer::after,summary.lead::after,.headTools > .gamesBtn::after,.hit44::after{content:"";position:absolute;left:50%;top:50%;
  width:max(100%,44px);height:max(100%,44px);transform:translate(-50%,-50%)}
.timer,summary.lead,.hit44{position:relative}
select,.pickbox,.gamesSearch,.bar button,.card .btns button,button.lead{min-height:44px}
/* the game's star stands at the far right of the title, so its square reaches right rather than over Games */
.headTools > .headStar::after{left:0;transform:translateY(-50%)}
/* The larger accessibility text sizes (games.js sets .bigText from 1.6 times up): Apple asks for layouts that change
   rather than squeeze, and icons that grow with their words. */
.tool .ic{width:calc(28px*var(--ts-big));height:calc(28px*var(--ts-big))}
.bigText header .headTools > button.gamesBtn .lbl{display:none}
/* at these sizes Games and the ☆ go on a row of their own above the title, which then has the whole width */
.bigText header.withTools{grid-template-columns:minmax(0,1fr)}
.bigText header.withTools > *{grid-column:1}
.bigText header.withTools > .headTools{grid-column:1;grid-row:1;justify-self:end}
.bigText .toggles{flex-wrap:wrap}
.bigText .toggles .opt{flex:1 1 100%}
.bigText .bar{justify-content:center}

/* New with the levels in it (levelMenu in games.js): the menu opens upward from New */
.newpick{position:relative;display:inline-flex}
.levelmenu{position:absolute;z-index:40;bottom:calc(100% + 6px);left:0;width:max-content;
  max-width:min(340px,calc(100vw - 24px));max-height:min(62vh,440px);overflow:auto;display:flex;flex-direction:column;gap:2px;
  padding:6px;background:var(--panel);border:2px solid var(--ink);border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.2)}
.levelmenu[hidden],.bar label.picker[hidden]{display:none}
.levelmenu .menutip{margin:2px 8px 4px;font-size:calc(13px*var(--ts));color:var(--ink-soft);font-weight:600}
.levelmenu button{border:0;border-radius:8px;background:none;text-align:left;padding:8px 10px 8px 30px;position:relative;font-size:calc(15px*var(--ts));line-height:1.25}
.levelmenu button:hover,.levelmenu button:focus-visible{background:var(--hover-tint)}
.levelmenu button[aria-checked="true"]{font-weight:800}
.levelmenu button[aria-checked="true"]::before{content:"✓";position:absolute;left:10px;color:var(--sage-green)}

/* A game's title row (gameMenu in games.js): ☰ Menu at the left, the name in the middle, the win streak's flame at
   the right and the rainbow stripe under them, pinned at the top while the page scrolls under it (its paper runs out
   to the screen's sides). The game's cat and line come under it, in .blurb, and scroll. */
header.withMenu{position:sticky;top:env(safe-area-inset-top,0px);z-index:30;display:grid;grid-template-columns:62px minmax(0,1fr) 62px;
  align-items:center;width:var(--board);padding:4px 0 0;background:var(--paper)}
header.withMenu::before{content:"";position:absolute;inset:-60px -100vmax 0;background:var(--paper);z-index:-1}
@media (orientation:landscape) and (max-height:500px){header.withMenu::before{inset:-60px -8px 0}}
/* ...but not over an open card: pinned above the card's backdrop, it hid the card's title ("Gold paw!") on a phone,
   and the game's name isn't needed then, so it goes while a card is up */
body:has(.overlay.show) header.withMenu{visibility:hidden}
header.withMenu > *{grid-column:2;grid-row:1;justify-self:center}
header.withMenu > .title{min-width:0;max-width:100%} header.withMenu .title h1{min-width:0;text-align:center}
header.withMenu > .menuBtn{grid-column:1;justify-self:start;display:inline-flex;flex-direction:column;align-items:center;gap:1px;min-width:44px;min-height:44px;padding:2px 4px;
  background:none;border:none;border-radius:12px;color:var(--ink-soft);font-size:calc(12px*var(--ts));font-weight:600;line-height:1.15}
header.withMenu > .menuBtn:hover{background:var(--hover-tint)}
header.withMenu > .menuBtn[aria-expanded="true"]{background:color-mix(in srgb,var(--sage-green) 20%,transparent);color:var(--ink)}
header.withMenu > .streak{grid-column:3;justify-self:end}
header.withMenu > .stripe{grid-column:1 / -1;grid-row:2;justify-self:stretch;width:auto;height:5px;margin:6px 0 0}
.games,.blurb{scroll-margin-top:calc(80px*var(--ts-big))}
.blurb{display:flex;align-items:center;justify-content:center;gap:10px;width:var(--board);margin-top:-4px}
.blurbPics{display:flex;align-items:flex-end;gap:4px;flex:none}
.blurb .tagline{margin:0;text-align:left}
.blurb:not(:has(.blurbPics)) .tagline{text-align:center}
/* the win streak: a flame with the count in it, and "Streak" under it */
.streak{display:flex;flex-direction:column;align-items:center;line-height:1;color:var(--ink-soft);background:none;border:none;padding:0;cursor:pointer;font:inherit;position:relative}
.streak[hidden]{display:none}
.streak::after{content:"";position:absolute;left:50%;top:50%;width:max(100%,44px);height:max(100%,44px);transform:translate(-50%,-50%)}
.streak .flame{position:relative;display:block;width:calc(30px*var(--ts-big));height:calc(36px*var(--ts-big))}
.streak .flame svg{display:block;width:100%;height:100%}
.streak .flame b{position:absolute;left:0;right:0;bottom:11%;text-align:center;font-size:calc(14px*var(--ts-big));font-weight:800;color:#fff;text-shadow:0 1px 1px rgba(120,40,0,.45)}
.streak small{margin-top:2px;font-size:calc(11px*var(--ts));font-weight:600}
/* the menu itself: a list that drops down from ☰ under the title, scrolling if it's taller than the screen */
.gameMenu{grid-column:1 / -1 !important;grid-row:auto !important;justify-self:start !important;position:absolute;z-index:40;top:calc(100% + 6px);left:0;
  width:min(320px,calc(100vw - 24px));max-height:calc(100vh - 90px);overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:2px;
  padding:6px;background:var(--panel);border:2px solid var(--ink);border-radius:14px;box-shadow:0 10px 30px rgba(0,0,0,.22);text-align:left}
@supports (height:100svh){.gameMenu{max-height:calc(100svh - 90px)}}
.gameMenu[hidden],.gameMenu [hidden]{display:none}
.menuItem{display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 10px;border:0;border-radius:10px;background:none;color:var(--ink);
  font:inherit;font-size:calc(16px*var(--ts));font-weight:600;text-decoration:none;text-align:left;line-height:1.2;cursor:pointer}
.menuItem:hover,.menuItem:focus-visible{background:var(--hover-tint)}
.menuItem:disabled{opacity:.45;cursor:default}
.menuItem .ic{flex:none;width:calc(24px*var(--ts-big));height:calc(24px*var(--ts-big));fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;color:var(--ink-soft)}
.menuItem .ic.on{fill:var(--star);stroke:var(--star)}
.menuItem .mtext{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}
.menuItem small{font-size:calc(13px*var(--ts));font-weight:600;color:var(--ink-soft)}
.menuItem small:empty{display:none}
.menuItem.done small{color:var(--gold-text)}
.menuItem.more::after{content:"›";font-size:calc(20px*var(--ts));color:var(--ink-soft);transition:transform .15s}
.menuItem.more[aria-expanded="true"]::after{transform:rotate(90deg)}
.menuHead{margin:8px 10px 2px;padding-top:8px;border-top:1px solid var(--line);font-size:calc(13px*var(--ts));font-weight:800;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.06em}
/* the game's switches and pickers, one under another */
.menuSettings{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:8px 10px 8px 14px;border-bottom:1px solid var(--line)}
#menuPanel .menuItem.more{border-top:1px solid var(--line)}   /* a line between Keyboard Shortcuts and Settings */
.hint.quiet{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}   /* a switch's line, read out but not shown */
.menuSettings .opt{flex:none;max-width:100%}
.menuSettings .toggle{white-space:normal}
.menuSettings .toggle + .hint{padding-left:50px}   /* a switch's line, under its name */
.menuSettings label:not(.toggle){display:flex;flex-direction:column;align-items:flex-start;gap:4px;font-weight:600}
.menuSettings select{max-width:100%}
.bigText header.withMenu{grid-template-columns:52px minmax(0,1fr) 52px}
.bigText header.withMenu > .menuBtn .lbl{display:none}

/* Tools that cost the gold paw (arrange in games.js, from PAW): grouped after the free ones, in a dark brick red (not
   the red that marks a mistake on a board), with a small crossed-out paw on the icon's corner, so the colour isn't
   the only sign. Restart sits beside New (and Give up after it), below the board. */
:root{--paw-red:#8E3326}
@media (prefers-color-scheme:dark){:root{--paw-red:#E39A84}}
.tool.costsPaw,.tools > button.costsPaw,.sb.costsPaw{color:var(--paw-red)!important;position:relative}
.tool.costsPaw .ic,.sb.costsPaw .ic{stroke:var(--paw-red)}
.tools > button.costsPaw svg{stroke:var(--paw-red)}   /* Toydoku's own tools */
.opt.costsPaw .swName{color:var(--paw-red)}
.opt.costsPaw .swName .pawMark{display:inline-block;vertical-align:-.05em;margin-left:.3em;width:.8em;height:.8em;position:static;top:auto;left:auto}
.tool.costsPaw::before,.tools > button.costsPaw::before,.sb.costsPaw::before,.opt.costsPaw .pawMark{content:"";position:absolute;top:2px;left:calc(50% - 22px);width:13px;height:13px;background:var(--paw-red);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cellipse cx='8' cy='10.5' rx='3.2' ry='2.7'/%3E%3Ccircle cx='3.6' cy='6.6' r='1.5'/%3E%3Ccircle cx='6.3' cy='4' r='1.5'/%3E%3Ccircle cx='9.7' cy='4' r='1.5'/%3E%3Ccircle cx='12.4' cy='6.6' r='1.5'/%3E%3Cpath d='M1.5 14.5L14.5 1.5' stroke='%23000' stroke-width='1.8'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cellipse cx='8' cy='10.5' rx='3.2' ry='2.7'/%3E%3Ccircle cx='3.6' cy='6.6' r='1.5'/%3E%3Ccircle cx='6.3' cy='4' r='1.5'/%3E%3Ccircle cx='9.7' cy='4' r='1.5'/%3E%3Ccircle cx='12.4' cy='6.6' r='1.5'/%3E%3Cpath d='M1.5 14.5L14.5 1.5' stroke='%23000' stroke-width='1.8'/%3E%3C/svg%3E") center/contain no-repeat}
.bar:has(> #newBtn, > .newpick){justify-content:center;column-gap:18px;margin-top:10px}   /* Restart · New [Noun] (Give up after): centred, the last line, set apart */

/* Pieces (G.pieces in games.js): the plain tap and the marking tool, side by side under the board, one lit at a time. */
.actions.pieces{gap:6px;margin-bottom:2px}
/* What's new (whatsNew in games.js), shown once to returning visitors */
.card ul.news{text-align:left;margin:2px 0 10px;padding-left:20px;line-height:1.4}
.card ul.news li{margin:4px 0}
/* G.pad: the digits go dashed while Notes is on */
.digitPad.noting button:not(.erase){border-style:dashed;color:#3C8681}
.pad .erase .ic,.digitPad .erase .ic{display:block;margin:auto;width:1.1em;height:1.1em;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.digitPad button.sticky{background:#F6DFA6;box-shadow:inset 0 0 0 3px #ECA818;color:#2A2530}   /* held down: it goes in every square tapped */
.gamesClose{display:block;margin:0 0 8px auto;padding:6px 14px;border-radius:999px;border:1px solid var(--line);background:var(--panel);color:var(--ink);font:inherit;font-weight:700;cursor:pointer}
.menutip.warn{color:var(--paw-red);font-weight:700}
.tally{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}   /* G.tally: a goal as a fraction with its icon */
.tally .tic{display:inline-block;width:1em;height:1em;line-height:1;flex:none}
/* The win card (winCard) and lose card (loseCard): big buttons, then small icon buttons in a row, and the other sizes as a small link */
.card .smallbtns{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 4px;margin-top:10px}
.card .smallbtns button.tool{display:inline-flex;flex-direction:column;align-items:center;gap:1px;min-width:64px;max-width:110px;min-height:44px;padding:4px 6px;
  background:none;border:none;border-radius:10px;color:var(--ink);font:inherit;font-size:calc(12px*var(--ts));font-weight:700;line-height:1.15;cursor:pointer}
.card .smallbtns button.tool:hover{background:var(--hover-tint)}
.card .smallbtns .ic{width:26px;height:26px}
.card .smallbtns .lbl{white-space:normal}
.card:has(> .smallbtns) .pick{gap:2px 6px;font-size:calc(14px*var(--ts))}
.card:has(> .smallbtns) .pickbox{background:none;border:none;padding:2px 2px;min-height:44px;color:var(--ink);text-decoration:underline;text-underline-offset:3px}
/* a dark emoji (🐾) on the dark page gets a small light backing (G.emoText) */
@media (prefers-color-scheme:dark){.darkemo{background:#EDE6D8;border-radius:999px;padding:0 .14em;margin:0 .04em}}
/* G.radios: a few choices as a row of radio pills (the Settings page's too) */
.seg{display:flex;flex-wrap:wrap;gap:6px;border:0;margin:0;padding:0;min-width:0}
.seg .segName{float:left;width:100%;padding:0;margin:0 0 4px;font-weight:600}
fieldset.seg > label{position:relative;display:inline-flex;align-items:center;min-height:44px;padding:4px 14px;line-height:1.2;text-align:left;margin:0;border:2px solid var(--ink);border-radius:999px;font-weight:600;cursor:pointer;background:var(--paper)}
.seg input{position:absolute;opacity:0;width:1px;height:1px}
fieldset.seg > label:has(input:checked){background:var(--ink);color:var(--paper)}
.seg label:has(input:focus-visible){outline:3px solid var(--pacific-blue);outline-offset:2px}
