@font-face{font-family:"Bricolage Grotesque";font-weight:700;font-style:normal;font-display:swap;src:url(../fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2")}
@font-face{font-family:"Bricolage Grotesque";font-weight:800;font-style:normal;font-display:swap;src:url(../fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2")}
@font-face{font-family:"Figtree";font-weight:400;font-style:normal;font-display:swap;src:url(../fonts/figtree-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"Figtree";font-weight:500;font-style:normal;font-display:swap;src:url(../fonts/figtree-latin-500-normal.woff2) format("woff2")}
@font-face{font-family:"Figtree";font-weight:600;font-style:normal;font-display:swap;src:url(../fonts/figtree-latin-600-normal.woff2) format("woff2")}
@font-face{font-family:"Figtree";font-weight:700;font-style:normal;font-display:swap;src:url(../fonts/figtree-latin-700-normal.woff2) format("woff2")}
/* What every Gridz game page shares: the palette, the one-screen column (header, rule line, stage,
   controls), toasts, bottom sheets (rules, result, hint, ad break) and buttons. Each game sets its own
   colour (--tile) and adds its own styles.css for its board. Always dark: one palette, on purpose. */
:root{
  --bg:#0F1422; --surface:#182033; --raised:#1F2940; --ink:#E6EAF4; --muted:#96A1B8; --line:#35415C;
  --tile:#5468FF; --tile-ink:#FFFFFF; --tile-edge:rgba(0,0,0,.28);
  --new:#B4E34B; --new-ink:#1C2A06;                 /* the Gridz highlight */
  --key:#29334A; --key-ink:#E6EAF4;
  --good:#45C486; --bad:#F2735F; --scrim:rgba(3,6,14,.66);
  --display:"Bricolage Grotesque","Arial Black",system-ui,sans-serif;
  --body:"Figtree",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --ad-h:0px;                          /* height of the ad banner, set by the app */
  --safe-top:0px; --safe-bottom:0px;   /* phone notch and gesture bar, set by the app's page */
  color-scheme:dark;
}
html,body{height:100%}
body{background:var(--bg);color:var(--ink);font-family:var(--body);font-size:15px;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer}
button:focus-visible{outline:2px solid var(--new);outline-offset:2px}

.app{box-sizing:border-box;height:100%;max-width:520px;margin:0 auto;padding-inline:16px;padding-block:calc(10px + var(--safe-top)) calc(12px + var(--safe-bottom) + var(--ad-h));display:flex;flex-direction:column;gap:10px}

/* header */
.top{display:flex;align-items:center;justify-content:space-between;gap:12px}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand h1{margin:0;font-family:var(--display);font-weight:800;font-size:28px;letter-spacing:-.03em;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.meta{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.meta .chip{display:inline-block;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--new-ink);background:var(--new);padding:2px 6px;border-radius:4px;margin-right:4px;vertical-align:1px}
.top-actions{display:flex;gap:8px;flex-shrink:0}
.ghost-btn{border:1.5px solid var(--line);background:transparent;border-radius:8px;padding:6px 10px;font-size:13px;font-weight:600}
.ghost-btn:hover{border-color:var(--muted)}
.round{width:34px;height:34px;padding:0;border-radius:50%;font-weight:700}

.rule{margin:0;font-size:14px;color:var(--muted);line-height:1.35}
.rule b{color:var(--ink);font-weight:600}

.stage{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;position:relative}

.toast{position:absolute;left:50%;top:0;transform:translate(-50%,-6px);background:var(--ink);color:var(--bg);font-weight:600;font-size:14px;padding:8px 14px;border-radius:8px;max-width:calc(100% - 20px);text-align:center;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s;z-index:5}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.good{background:var(--good);color:var(--bg)}

/* controls */
.controls{display:flex;gap:8px}
.controls .ghost-btn{flex:1;padding:11px 8px;font-size:14px}
.controls .ghost-btn[disabled]{opacity:.45;cursor:default}
.controls .primary{background:var(--tile);color:var(--tile-ink);border-color:var(--tile)}
.ad-tag{display:inline-block;font-size:9px;font-weight:800;letter-spacing:.08em;padding:1px 4px;border-radius:3px;background:var(--new);color:var(--new-ink);vertical-align:2px;margin-left:3px}

/* sheets */
.scrim[hidden]{display:none}
.scrim{position:fixed;inset:0 0 var(--ad-h) 0;background:var(--scrim);z-index:10;display:flex;align-items:flex-end;justify-content:center}
.sheet{box-sizing:border-box;width:100%;max-width:520px;max-height:calc(100% - 24px);overflow:auto;background:var(--surface);color:var(--ink);border-radius:14px 14px 0 0;padding-inline:20px;padding-block:18px calc(20px + var(--safe-bottom));animation:up .28s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(24px);opacity:.4}}
.sheet:focus{outline:none}
.sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.eyebrow{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:0 0 4px}
.sheet h2{margin:0;font-family:var(--display);font-weight:800;font-size:30px;letter-spacing:-.02em;line-height:1.05;text-wrap:balance}
.sheet p{line-height:1.45;margin:0}
.sheet section{margin-top:18px;display:flex;flex-direction:column;gap:8px}
.sheet h3{margin:0;font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.sheet-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
.sheet-actions button{flex:1 1 140px;border-radius:8px;padding:11px 12px;font-weight:700;border:1.5px solid var(--line);background:transparent}
.sheet-actions .primary{background:var(--tile);border-color:var(--tile);color:var(--tile-ink)}
.rules{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px;line-height:1.45}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.stats div{display:flex;flex-direction:column;align-items:center;gap:2px}
.stats b{font-family:var(--display);font-size:26px;font-weight:800;font-variant-numeric:tabular-nums}
.stats span{font-size:12px;color:var(--muted);text-align:center}
.score{font-size:16px}
.score b{font-family:var(--display);font-size:22px;font-variant-numeric:tabular-nums}
.next{margin:14px 0 0;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.copybox{width:100%;box-sizing:border-box;font:13px/1.4 ui-monospace,Menlo,monospace;border:1.5px solid var(--line);border-radius:8px;padding:8px;background:var(--bg);color:var(--ink);resize:none}
.sheet .x{flex-shrink:0}

/* the example in the rules */
.example-box{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px;margin:14px 0 4px;border-radius:12px;background:var(--bg)}
.example-box .row{display:flex;gap:8px;align-items:center;font-weight:700}
.example-box .chip-btn{display:inline-grid;place-items:center;min-width:44px;height:34px;padding:0 10px;border-radius:9px;background:var(--tile);color:var(--tile-ink);font-family:var(--display);font-weight:800;font-size:18px}

/* ad break (apps only) */
.adbreak{display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;padding-block:18px 6px}
.adbreak p:last-child{color:var(--muted);max-width:32ch}
.adbreak-mark{display:flex;gap:6px;margin-bottom:10px}
.adbreak-mark i{display:block;width:14px;height:14px;border-radius:4px;background:var(--tile);animation:breathe 1.2s ease-in-out infinite alternate}
.adbreak-mark i:nth-child(2){animation-delay:.2s}
.adbreak-mark i:nth-child(3){background:var(--new);animation-delay:.4s}
@keyframes breathe{to{opacity:.35}}


/* ---------- the grid games: the board (grid.js), the clock and the tools row (gridgame.js) ---------- */
.gbar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:22px}
.gbar .rule{flex:1;min-width:0}
.clock{flex-shrink:0;margin-left:auto;font-family:var(--display);font-weight:700;font-size:18px;letter-spacing:-.01em;font-variant-numeric:tabular-nums}
.clock.done{color:var(--good)}
#stage{align-items:center}
.board{position:relative;flex-shrink:0;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.cells{display:grid;grid-template-columns:repeat(var(--cols),var(--cell));grid-auto-rows:var(--cell);gap:var(--gap);padding:var(--gap);background:var(--line);border-radius:10px}
.cells.split .cell{width:var(--cell);height:var(--cell)}
.cells.split .cell.split-c{justify-self:end}
.cells.split .cell.split-r{align-self:end}
.cell{position:relative;display:grid;place-items:center;border-radius:calc(var(--cell) * .14);background:var(--surface);color:var(--ink);font-family:var(--display);font-weight:800;font-size:calc(var(--cell) * .54);line-height:1;transition:background-color .12s}
.cell.on{background:var(--tile)}
.cell.given{color:var(--muted)}
.cell.lit::before{content:"";position:absolute;inset:0;border-radius:inherit;background:var(--tile);opacity:.24}
.cell.bad{color:var(--bad);background:rgba(242,115,95,.16)}
.cell.sel{box-shadow:inset 0 0 0 2.5px var(--new)}
.cell.flash{animation:flash 1.3s ease-out}
@keyframes flash{0%,45%{box-shadow:inset 0 0 0 3px var(--new);transform:scale(1.06)}100%{box-shadow:inset 0 0 0 0 transparent}}
.cell .notes{position:absolute;inset:8%;display:grid;grid-template-columns:repeat(var(--nc,3),1fr);place-items:center;font-size:calc(var(--cell) * .24);font-weight:700;color:var(--muted)}
.cell .notes i{font-style:normal}
.board.won .cell{animation:wave .5s cubic-bezier(.3,1.5,.5,1) both;animation-delay:calc(var(--d) * 35ms)}
@keyframes wave{40%{transform:scale(.8)}}
.board-layer{position:absolute;left:0;top:0;pointer-events:none;overflow:visible}
.board-layer .box{stroke:var(--bg);stroke-width:4}
.board-layer .line{fill:none;stroke:var(--tile);stroke-linecap:round;stroke-linejoin:round}
.tools{display:flex;gap:8px}
.tools .ghost-btn{flex:1;min-width:0;padding:11px 6px;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tools .ghost-btn[disabled]{opacity:.45;cursor:default}
.tools .primary,.tools .on{background:var(--tile);border-color:var(--tile);color:var(--tile-ink)}
/* the hint's AD tag sits on the button's corner, so "Pista ANUNCIO" never squeezes the word out */
.tools #hintBtn{position:relative;overflow:visible}
.tools #hintBtn .ad-tag{position:absolute;top:-8px;right:-6px;margin:0;box-shadow:0 0 0 2px var(--bg)}
@media (max-width:340px){ .tools{gap:6px} .tools .ghost-btn{padding:11px 4px;font-size:13px} }
.pad[hidden]{display:none}
.key.on{background:var(--tile);color:var(--tile-ink)}
.key.done{opacity:.35}
.mini{align-self:flex-start;margin:6px 0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.result-time{font-family:var(--display);font-weight:800;font-size:44px;line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}

/* the example in a game's rules, and a note under it */
.example{align-self:flex-start;font-family:var(--display);font-weight:800;font-size:24px;line-height:1.35;letter-spacing:-.01em;white-space:pre-line;font-variant-numeric:tabular-nums;padding:14px 18px;border-radius:12px;background:var(--bg);box-shadow:inset 0 0 0 2px var(--tile)}
.note{margin:0;color:var(--muted);line-height:1.45}

/* the number keys (grid.js, digitPad: Sudoku) */
.kp{display:flex;flex-direction:column;gap:6px;user-select:none}
.kr{display:flex;gap:6px;justify-content:center}
.key{flex:1;height:48px;border:0;border-radius:8px;background:var(--key);color:var(--key-ink);font-family:var(--display);font-weight:800;font-size:20px;touch-action:manipulation;font-variant-numeric:tabular-nums}
.key.wide{flex:1.6;font-family:var(--body);font-size:15px;font-weight:700}
.key.primary{background:var(--tile);color:var(--tile-ink)}
.key:active:not(:disabled){filter:brightness(.88)}
.key:disabled{opacity:.4}
@media (max-height:680px){ .key{height:42px} }

@media (prefers-reduced-motion: reduce){
  .sheet,.adbreak-mark i,.board.won .cell,.cell.flash{animation:none}
  .toast{transition:none}
}
@media (max-height:640px){ .rule{display:none} }

/* Path: the line in the game's colour over the cells it has gone through, its end a small white dot; walls
   thick and white; the numbers dark discs that take the line's colour once it has passed them. All of it
   on the board's drawing layer, the numbers on top. */
.board-layer .head{fill:var(--ink)}
.board-layer .walls{fill:none;stroke:var(--ink);stroke-width:5;stroke-linecap:round}
.num circle{fill:#0F1422;stroke:var(--ink);stroke-width:2}
.num text{fill:var(--ink);font-family:var(--display);font-weight:800;text-anchor:middle;dominant-baseline:central}
.num.got circle{fill:var(--tile);stroke:var(--tile)}
.num.got text{fill:#fff}
.ex-path{display:block;margin:6px 0;align-self:flex-start}
.ex-bg{fill:var(--line)}
.ex-cell{fill:var(--surface)}
.ex-path .line{fill:none;stroke:var(--tile);stroke-linecap:round;stroke-linejoin:round}


/* ---------- on wordz.club ---------- */
/* The back arrow at the top left leads to the app's page on wordz.club (wordz.club/gridz/). */
.wz-back{flex-shrink:0;width:36px;height:36px;margin-left:-8px;border:0;border-radius:999px;background:transparent;color:var(--ink);display:grid;place-items:center;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
.wz-back:hover,.wz-back:active{background:var(--raised)}
.brand{gap:6px}
@media (max-width:380px){ .brand h1{font-size:24px} }
/* A friend's challenge (a shared link): a short note above the game, with a close button. */
.wz-note{flex-shrink:0;display:flex;align-items:center;gap:8px;padding:8px 6px 8px 12px;border-radius:12px;background:var(--raised);border:1px solid var(--line);border-left:4px solid var(--new);font-size:14px;line-height:1.35;color:var(--ink);animation:wz-note-in .35s ease-out both}
.wz-note p{margin:0;flex:1;min-width:0}
.wz-note b{color:var(--new);font-weight:700}
.wz-note-x{flex-shrink:0;width:30px;height:30px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:14px;cursor:pointer}
.wz-note-x:hover{background:var(--key)}
@keyframes wz-note-in{from{opacity:0;transform:translateY(-6px)}}
@media (prefers-reduced-motion:reduce){ .wz-note{animation:none} }
/* "Get the app": the bar at the top of the game, and the store buttons in its sheet. */
.getapp{flex-shrink:0;display:flex;align-items:center;gap:10px;background:var(--raised);border:1px solid var(--line);border-radius:10px;padding-block:6px;padding-inline:12px 6px;font-size:13px}
.getapp-text{flex:1;min-width:0;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.getapp-btn{flex-shrink:0;border:0;border-radius:7px;background:var(--new);color:var(--new-ink);font-weight:700;font-size:13px;padding:6px 10px;cursor:pointer}
.getapp-x{flex-shrink:0;border:0;background:transparent;color:var(--muted);width:28px;height:28px;border-radius:6px;font-size:13px;cursor:pointer}
.getapp-x:hover{background:var(--key)}
.stores{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.store-btn{flex:1 1 140px;display:flex;flex-direction:column;justify-content:center;gap:1px;padding:8px 14px;border-radius:9px;background:var(--ink);color:var(--bg);text-decoration:none;line-height:1.15}
.store-btn small{font-size:11px;opacity:.8}
.store-btn b{font-family:var(--display);font-size:17px;font-weight:700;letter-spacing:-.01em}
.store-btn.soon{background:transparent;color:var(--muted);border:1.5px dashed var(--line)}
.store-btn:focus-visible{outline:2px solid var(--new);outline-offset:2px}
