/* CRUCIGO · CRUDOKU (c/g-crudoku.js) — zone colorate, filo spesso dove cambia zona, il TIMBRO Crucigo (la casella nera con
   la c, più piccola della cella: si vede il colore della zona intorno; owner 28 nov), la X «qui no», la X ROSSA dove si è
   sbagliato, tre cuori; in alto una casellina per zona e le tre regole col disegnino (come Meowdoku, video owner 28 nov).
   Telefono prima di tutto: la griglia è larga quanto lo schermo (fino a 460 px) e a 375×615 ci stanno testata, livelli,
   cuori, regole, griglia e tasti senza scorrere.
   Colore del gioco: --c-crudoku (28 nov 2026, scelto da me: un verde acqua che nessun altro gioco usa; da far scegliere). */
body.g[data-gioco="crudoku"] {
  --g: var(--c-crudoku, #D45AB8);
  --cd-ink: #151311; --cd-filo: rgba(21, 19, 17, .22); --cd-rosso: #E5484D; --cd-x: rgba(21, 19, 17, .5);
  --z0: #FFCF9F; --z1: #C9E8A8; --z2: #B8DCFF; --z3: #DCC4FF; --z4: #FFF0A0;
  --z5: #FFC2D6; --z6: #A8EEDD; --z7: #E3D9C6; --z8: #F7B3A1; --z9: #CFEFF7;
}
html[data-tema="notte"] body.g[data-gioco="crudoku"] {
  --cd-ink: #0C0B0A; --cd-filo: rgba(0, 0, 0, .35); --cd-rosso: #FF6B6E; --cd-x: rgba(0, 0, 0, .6);
  --z0: #C9925C; --z1: #8DB06B; --z2: #6F9CC9; --z3: #9C82C9; --z4: #C9B85A;
  --z5: #C97E98; --z6: #5EB3A0; --z7: #A89D88; --z8: #C47A66; --z9: #7FB3BF;
}
body.g[data-gioco="crudoku"] .z0 { --z: var(--z0); }
body.g[data-gioco="crudoku"] .z1 { --z: var(--z1); }
body.g[data-gioco="crudoku"] .z2 { --z: var(--z2); }
body.g[data-gioco="crudoku"] .z3 { --z: var(--z3); }
body.g[data-gioco="crudoku"] .z4 { --z: var(--z4); }
body.g[data-gioco="crudoku"] .z5 { --z: var(--z5); }
body.g[data-gioco="crudoku"] .z6 { --z: var(--z6); }
body.g[data-gioco="crudoku"] .z7 { --z: var(--z7); }
body.g[data-gioco="crudoku"] .z8 { --z: var(--z8); }
body.g[data-gioco="crudoku"] .z9 { --z: var(--z9); }

.cd { position: relative; display: grid; gap: 10px; justify-items: center; width: 100%; }
.cd-tav { position: relative; width: min(100%, 460px); display: grid; justify-items: center; }
.cd-gr { --n: 8; container-type: inline-size; width: 100%; aspect-ratio: 1; box-sizing: border-box; display: grid;
  grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: 1px; background: var(--cd-filo);
  border: 3px solid var(--cd-ink); border-radius: 6px; box-shadow: 0 4px 0 var(--cd-ink); overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cd-c { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; cursor: pointer; background: var(--z);
  -webkit-tap-highlight-color: transparent; transition: filter .2s; }
/* il confine fra due zone: lo disegna la casella sotto (zt) o a destra (zl), sopra il filo sottile */
.cd-c::before { content: ""; position: absolute; inset: -1px; pointer-events: none; border: 0 solid var(--cd-ink); z-index: 1; }
.cd-c.zt::before { border-top-width: 3px; }
.cd-c.zl::before { border-left-width: 3px; }
/* la X «qui no» (tua: piena; delle «X da sole»: più chiara); la X ROSSA dove hai sbagliato (fissa) */
.cd-c.x::after, .cd-c.xr::after { content: ""; width: 46%; aspect-ratio: 1; color: var(--cd-x);
  background: linear-gradient(45deg, transparent 41%, currentColor 41%, currentColor 59%, transparent 59%),
              linear-gradient(-45deg, transparent 41%, currentColor 41%, currentColor 59%, transparent 59%); }
.cd-c.x.auto::after { opacity: .38; }
.cd-c.xr::after { color: var(--cd-rosso); width: 54%; }
/* il TIMBRO: la casella nera con la c, al centro della casella, il colore della zona tutto intorno */
.cd-c.nera::after { content: "c"; width: 64%; aspect-ratio: 1; display: grid; place-items: center; box-sizing: border-box; color: #fff;
  background: var(--cd-ink); border-radius: 3px; font: 800 calc(100cqi / var(--n) * .44)/1 var(--stampa, Georgia, serif);
  padding-bottom: .12em; box-shadow: 0 2px 0 rgba(21, 19, 17, .25); }
/* insieme: il timbro messo da un altro ha l'anello del suo colore */
.cd-c.nera[style*="--chi"]::after { box-shadow: 0 0 0 3px var(--chi); }
/* sbagliato: la casella diventa rossa col cuore spezzato, poi resta la X rossa; il timbro che toccava si accende */
.cd-c.sbaglio { animation: cd-sbaglio .8s ease-out; z-index: 2; }
@keyframes cd-sbaglio { 0%, 55% { background-color: var(--cd-rosso); } 100% { background-color: var(--z); } }
.cd-c.sbaglio::after { content: ""; width: 62%; aspect-ratio: 1; color: transparent; animation: cd-spezza .8s ease-out both;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M11 7.2 9.4 10.6l2.3 2.2-1.6 3.9.8.4 2-4.6-2.2-2.2 1.3-2.7C10.9 6 9.2 5 7.3 5 4.9 5 3 6.9 3 9.4c0 3.6 3.1 6.7 8.6 10.8l.4-.9C7 15.4 4.4 12.6 4.4 9.6Z M13.4 7.6l-1.1 2.6 2.2 2.2-1.9 4.5-.7 1.5.1.1c5-3.8 8-6.9 8-10.1C20 7 18.3 5.4 16.4 5.4c-1.2 0-2.3.8-3 2.2Z'/%3E%3C/svg%3E"); }
@keyframes cd-spezza { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.15); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: 0; } }
.cd-c.conf { z-index: 3; }
.cd-c.conf::after { animation: cd-conf 1.1s ease-out; }
@keyframes cd-conf { 0%, 70% { box-shadow: 0 0 0 3px var(--cd-rosso), 0 0 14px 4px color-mix(in oklab, var(--cd-rosso) 60%, transparent); } 100% { box-shadow: 0 2px 0 rgba(21, 19, 17, .25); } }
/* finita: la griglia si pulisce (via le X), i timbri prendono l'anello del colore del gioco */
.cd-gr.fatta .cd-c.x::after { content: none; }
.cd-gr.fatta .cd-c.nera::after { box-shadow: 0 0 0 3px var(--g); }
.cd-gr.fatta, .cd-gr.ferma { cursor: default; }

.cd-c.nuova { z-index: 4; }
/* LA TIMBRATA: il timbro arriva grande e alto (più della casella, come il gatto del video), batte al 30% (150 ms: lì
   partono le schegge, c/g-crudoku.js → scoppio), rimbalza e si posa; la casella sotto si schiaccia un attimo */
.cd-c.nera.nuova { animation: cd-colpo .52s ease-out var(--r, 0ms); }
.cd-c.nera.nuova::after { animation: cd-timbra .52s cubic-bezier(.3, .9, .3, 1) var(--r, 0ms) both; }
@keyframes cd-timbra {
  0% { transform: translateY(-34%) scale(1.75) rotate(-12deg); opacity: 0; box-shadow: 0 14px 18px rgba(21, 19, 17, .28); }
  14% { opacity: 1; }
  30% { transform: translateY(0) scale(.84) rotate(2deg); box-shadow: 0 0 0 rgba(21, 19, 17, .25); }
  52% { transform: scale(1.1) rotate(-1deg); }
  72% { transform: scale(.97); }
  100% { transform: none; box-shadow: 0 2px 0 rgba(21, 19, 17, .25); } }
@keyframes cd-colpo { 0%, 26% { transform: none; filter: none; } 34% { transform: scale(.93); filter: brightness(1.18); } 60% { transform: scale(1.02); } 100% { transform: none; filter: none; } }
.cd-c.nuova::after { animation: cd-scatto .2s ease-out var(--r, 0ms) both; }
/* IL TIMBRO È VIVO: ogni tanto uno si alza e ritimbra (nel video i gatti sbattono gli occhi) */
.cd-c.nera.vivo::after { animation: cd-vivo .9s ease-in-out; }
@keyframes cd-vivo { 0%, 100% { transform: none; } 28% { transform: translateY(-16%) scale(1.07) rotate(-6deg); box-shadow: 0 8px 8px rgba(21, 19, 17, .2); }
  48% { transform: translateY(0) scale(.94) rotate(1deg); box-shadow: 0 1px 0 rgba(21, 19, 17, .25); } 66% { transform: scale(1.03); } }
/* le schegge della timbrata: foglie del colore della zona (più scure), scintille, l'onda del colpo */
.cd-sc { position: absolute; width: 0; height: 0; z-index: 6; pointer-events: none; }
.cd-sc i { position: absolute; left: 0; top: 0; display: block; }
.cd-sc__fo { width: calc(var(--w) * var(--sz)); height: calc(var(--w) * var(--sz) * .72); border-radius: 62% 38% 58% 42%;
  background: color-mix(in oklab, var(--zz) 82%, #151311 18%); filter: saturate(2.2); animation: cd-vola .95s cubic-bezier(.15, .75, .3, 1) var(--rit) both; }
.cd-sc__sc { width: calc(var(--w) * var(--sz)); aspect-ratio: 1; background: var(--col); box-shadow: 0 0 6px var(--col), 0 0 0 1px rgba(21, 19, 17, .15);
  animation: cd-vola 1.1s cubic-bezier(.15, .75, .3, 1) var(--rit) both; }
@keyframes cd-vola { 0% { transform: translate(-50%, -50%) scale(.2) rotate(0); opacity: 1; } 65% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rt)); opacity: 0; } }
.cd-sc__onda { width: var(--w); height: var(--w); box-sizing: border-box; border-radius: 50%; border: 3px solid color-mix(in oklab, var(--zz) 45%, #151311 55%);
  animation: cd-onda-c .5s ease-out both; }
@keyframes cd-onda-c { 0% { transform: translate(-50%, -50%) scale(.35); opacity: .85; } 100% { transform: translate(-50%, -50%) scale(1.55); opacity: 0; } }
@keyframes cd-scatto { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
.cd-c.onda { animation: cd-onda .46s ease-out var(--r, 0ms) both; z-index: 2; }
@keyframes cd-onda { 0% { transform: scale(1); } 35% { transform: scale(1.1); filter: brightness(1.12); } 100% { transform: scale(1); } }
.cd-c.scossa { animation: cd-scossa .34s ease-in-out; z-index: 2; }
.cd-c.sbaglio.scossa { animation: cd-sbaglio .8s ease-out, cd-scossa .34s ease-in-out; }
@keyframes cd-scossa { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-3px); } 88% { transform: translateX(2px); } }

/* in alto, come Meowdoku: una casellina per zona nel suo colore (prende il timbro quando la zona è fatta) e i tre cuori */
.cd-testa { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(100%, 460px); }
.cd-zone, .cd-vite { display: flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 9px; box-sizing: border-box;
  border: 1.5px solid var(--bordo, var(--inchiostro, #151311)); border-radius: 999px; background: var(--foglio, #fff); }
.cd-zone { flex: 1 1 auto; min-width: 0; justify-content: space-between; max-width: 290px; }
.cd-zt { display: grid; place-items: center; width: 18px; height: 18px; flex: none; box-sizing: border-box; border-radius: 4px; background: var(--z);
  box-shadow: inset 0 0 0 1.5px rgba(21, 19, 17, .18); font: 800 13px/1 var(--stampa, Georgia, serif); font-style: normal; color: #fff; }
.cd-zt.ok { background: var(--cd-ink); box-shadow: 0 0 0 2.5px var(--z); padding-bottom: 2px; }
.cd-zt.ok::after { content: "c"; }
.cd-zt.nuova { animation: cd-timbra .35s cubic-bezier(.2, 1.3, .4, 1); }
.cd-vite { flex: none; gap: 2px; }
.cd-cuore { display: block; width: 21px; height: 21px; }
.cd-cuore svg { display: block; width: 100%; height: 100%; fill: var(--rosso, #E5484D); stroke: var(--inchiostro, #151311); stroke-width: 2; stroke-linejoin: round; transition: fill .25s; }
.cd-cuore.via svg { fill: transparent; stroke: color-mix(in oklab, var(--inchiostro, #151311) 38%, transparent); }
.cd-cuore.via { animation: cd-persa .45s ease-out; }
@keyframes cd-persa { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-10deg); } 100% { transform: none; } }
.cd-oltre { font: 700 13px/1 var(--testo, system-ui); color: var(--rosso, #E5484D); white-space: nowrap; }
.cd-tb { display: inline-grid; place-items: center; width: 22px; height: 22px; padding-bottom: 2px; box-sizing: border-box; border-radius: 4px;
  background: var(--cd-ink); color: #fff; font: 800 16px/1 var(--stampa, Georgia, serif); font-style: normal; }
/* le tre regole, col disegnino 3×3; lampeggia rossa quella che rompi */
.cd-regole { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 6px; width: min(100%, 460px); }
.cd-regole span { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 6px; box-sizing: border-box;
  border: 1.5px solid var(--bordo, var(--inchiostro, #151311)); border-radius: 8px; background: var(--foglio, #fff); }
.cd-regole svg { width: 22px; height: 22px; flex: none; }
.cd-regole b { font: 600 11.5px/1.1 var(--testo, system-ui); color: var(--inchiostro, #151311); }
.cd-regole .mx { fill: #A78B6F; } .cd-regole .mv { fill: #E6DCCF; } .cd-regole .mt { fill: var(--cd-ink); }
.cd-regole .mxx { stroke: #fff; stroke-width: 1.1; stroke-linecap: round; fill: none; }
.cd-regole .mtc { stroke: #fff; stroke-width: 1; fill: none; }
.cd-regole .chiama { animation: cd-chiama 1.2s ease-out; }
@keyframes cd-chiama { 0%, 60% { background: var(--cd-rosso); border-color: var(--cd-rosso); } 100% { background: var(--foglio, #fff); } }
.cd-regole .chiama b { animation: cd-chiama-t 1.2s ease-out; }
@keyframes cd-chiama-t { 0%, 60% { color: #fff; } }

/* i due aiuti: come quelli del sudoku (icona sopra, nome sotto) */
.cd-az { --k: 2; display: grid; grid-template-columns: repeat(var(--k), minmax(0, 1fr)); gap: 8px; width: min(100%, 460px); }
.cd-b { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; min-width: 0; margin: 0; padding: 4px 2px 3px;
  border: 2px solid var(--bordo, var(--inchiostro, #151311)); border-radius: 12px; background: var(--foglio, #fff); color: var(--inchiostro, #151311);
  font: 700 12px/1 var(--testo, system-ui); cursor: pointer; box-shadow: 0 3px 0 var(--ombra, var(--inchiostro, #151311)); -webkit-tap-highlight-color: transparent;
  transition: transform .08s, box-shadow .08s; }
.cd-b svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cd-b:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ombra, var(--inchiostro, #151311)); }
.cd-b:disabled { opacity: .45; cursor: default; }

/* la LAMPADINA (come Meowdoku): tutto si spegne tranne le caselle che contano; il perché in alto, «Applica» in basso */
.cd.guida .cd-c:not(.luce) { filter: brightness(.42) saturate(.6); }
/* le righe fra le caselle spente: il filo della griglia è trasparente e fra due caselle scure si vedeva chiaro (owner 28 nov:
   «ci sono delle parti trasparenti dove ci sono le linee»); la casella spenta copre anche la sua metà di filo, scura */
.cd.guida .cd-c:not(.luce), .cd--lez .cd-c.spento { box-shadow: 0 0 0 1px #2E2B28; }
.cd.guida .cd-testa, .cd.guida .cd-regole, .cd.guida .cd-az, .cd.guida .g-scelte { opacity: .25; pointer-events: none; }
.cd-c.sug::after { content: ""; width: 46%; aspect-ratio: 1; color: #fff; filter: drop-shadow(0 1px 0 rgba(21, 19, 17, .5));
  background: linear-gradient(45deg, transparent 41%, currentColor 41%, currentColor 59%, transparent 59%),
              linear-gradient(-45deg, transparent 41%, currentColor 41%, currentColor 59%, transparent 59%);
  animation: cd-pulsa-x 1.1s ease-in-out infinite; }
.cd-c.sugt::after { content: "c"; width: 64%; aspect-ratio: 1; display: grid; place-items: center; box-sizing: border-box; color: #fff; background: rgba(21, 19, 17, .55);
  border-radius: 3px; font: 800 calc(100cqi / var(--n) * .44)/1 var(--stampa, Georgia, serif); padding-bottom: .12em; filter: none; }
@keyframes cd-pulsa-x { 50% { opacity: .45; } }
.cd-guida { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.cd-guida[hidden] { display: none; }
.cd-guida__t { position: absolute; left: 0; right: 0; pointer-events: auto; margin: 0 auto; max-width: 460px; padding: 10px 13px; box-sizing: border-box;
  border: 2px solid var(--bordo, var(--inchiostro, #151311)); border-radius: 12px; background: var(--foglio, #fff); box-shadow: 0 3px 0 var(--ombra, var(--inchiostro, #151311));
  font: 500 14px/1.35 var(--testo, system-ui); color: var(--inchiostro, #151311); }
.cd-guida__b { position: absolute; left: 0; right: 0; margin: 0 auto; max-width: 460px; pointer-events: auto; display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

/* «Hai perso»: lo stesso pannello del nonogramma, sopra tutto il gioco (cuori, regole, griglia, tasti: sul telefono basso
   la griglia sola è più bassa del pannello) */
.cd-stop { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; border-radius: 8px;
  background: color-mix(in oklab, var(--carta, #FBF9F4) 86%, transparent); animation: cd-velo .25s ease-out; }
.cd-stop[hidden] { display: none; }
@keyframes cd-velo { 0% { opacity: 0; } 100% { opacity: 1; } }
.cd-stop__c { display: grid; gap: 10px; width: 100%; max-width: 300px; padding: 18px 16px 16px; border: 2px solid var(--bordo, var(--inchiostro, #151311)); border-radius: 14px;
  background: var(--foglio, #fff); box-shadow: 0 4px 0 var(--ombra, var(--inchiostro, #151311)); text-align: center; }
.cd-stop__cuori { display: flex; justify-content: center; gap: 4px; }
.cd-stop__cuori svg { width: 26px; height: 26px; fill: transparent; stroke: color-mix(in oklab, var(--inchiostro, #151311) 45%, transparent); stroke-width: 2; stroke-linejoin: round; }
.cd-stop__c h2 { margin: 0; font: 700 26px/1.1 var(--stampa, Georgia, serif); letter-spacing: -.01em; }
.cd-stop__c p { margin: 0 0 4px; font: 400 15px/1.4 var(--testo, system-ui); color: var(--grafite, #5E5A54); }

/* nella lezione: la griglia 4×4 più piccola; si accende solo la parte che serve (come il tutorial di Meowdoku) */
.cd--lez .cd-gr { width: min(100%, 230px); }
.cd--lez .cd-c.spento { filter: brightness(.42) saturate(.6); cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .cd-c.nuova::after, .cd-c.nera.nuova, .cd-c.nera.nuova::after, .cd-c.nera.vivo::after, .cd-c.onda, .cd-c.scossa, .cd-c.sbaglio, .cd-c.sbaglio::after, .cd-c.conf::after, .cd-cuore.via, .cd-regole .chiama, .cd-regole .chiama b,
  .cd-zt.nuova, .cd-c.sug::after { animation: none; }
}

/* telefono basso (375×615): la griglia lascia posto a cuori, regole e tasti */
@media (max-height: 680px) and (max-width: 520px) {
  .cd { gap: 7px; }
  .cd-tav { width: min(100%, calc(100dvh - 280px)); }   /* era 345: sotto restavano 80 px vuoti; col 10×10 le caselle erano 25 px (MISURATO 28/11 notte) */
  .cd-regole span { min-height: 30px; gap: 4px; padding: 3px 5px; }
  .cd-regole svg { width: 18px; height: 18px; }
  .cd-regole b { font-size: 10.5px; }
  .cd-zt { width: 16px; height: 16px; font-size: 12px; }
  .cd-b { min-height: 46px; }
}

/* ===== LA METEORA (owner 28 nov: «fa scuotere un po' tutto con onda d'urto come se fosse una meteora»): al colpo la griglia
   trema e ogni casella viene spinta via dal punto colpito (--ux --uy, più forte vicino), in ritardo secondo la distanza
   (--ud), poi torna: l'onda si vede correre sulla griglia (c/g-crudoku.js → urto) ===== */
.cd-c.urto { animation: cd-urto .48s cubic-bezier(.25, .8, .35, 1) var(--ud, 0ms); }
@keyframes cd-urto { 0% { transform: none; } 28% { transform: translate(var(--ux), var(--uy)) scale(var(--ub)); filter: brightness(1.08); } 62% { transform: translate(calc(var(--ux) * -.35), calc(var(--uy) * -.35)); } 100% { transform: none; filter: none; } }
.cd-gr.trema { animation: cd-trema .4s linear; }
@keyframes cd-trema { 0%, 100% { transform: none; } 12% { transform: translate(-3px, 2px) rotate(-.4deg); } 26% { transform: translate(3px, -2px) rotate(.35deg); }
  42% { transform: translate(-2px, -1px); } 60% { transform: translate(2px, 1px); } 80% { transform: translate(-1px, 0); } }
.cd-sc__onda { border-width: 4px; animation-duration: .6s; }
@keyframes cd-onda-c { 0% { transform: translate(-50%, -50%) scale(.35); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cd-c.urto, .cd-gr.trema { animation: none; } }

/* ===== IL PEZZO IN PROVA: ?pezzo=casella | occhi | matita | lettera (senza: il timbro). Tavola per l'owner, 28 nov ===== */
/* CASELLA: la casella di Crucigo che si CHIUDE: arriva aperta (manca il lato destro), il quarto lato si disegna e si riempie
   del colore del gioco: «stampato da noi, finito da te» (brief §1), chiusa = fatto */
.cd[data-pezzo="casella"] .cd-c.nera::after { color: var(--cd-ink); background: linear-gradient(var(--g), var(--g)) 0 0 / 100% 100% no-repeat;
  border: max(2px, calc(100cqi / var(--n) * .075)) solid var(--cd-ink); border-radius: 1px; padding-bottom: .06em; }
.cd[data-pezzo="casella"] .cd-c.nera.nuova::after { animation: cd-chiude .7s cubic-bezier(.3, .9, .3, 1) var(--r, 0ms) both; }
@keyframes cd-chiude {
  0% { transform: translateY(-34%) scale(1.7) rotate(-10deg); opacity: 0; border-right-color: transparent; background-size: 0% 100%; }
  12% { opacity: 1; }
  24% { transform: scale(.86) rotate(2deg); border-right-color: transparent; background-size: 0% 100%; }
  44% { transform: scale(1.06); border-right-color: transparent; background-size: 0% 100%; }
  60% { border-right-color: var(--cd-ink); background-size: 55% 100%; }
  80% { transform: none; background-size: 100% 100%; }
  100% { transform: none; border-right-color: var(--cd-ink); background-size: 100% 100%; } }
.cd[data-pezzo="casella"] .cd-c.nera.vivo::after { animation: cd-vivo-c .9s ease-in-out; }
@keyframes cd-vivo-c { 0%, 100% { transform: none; } 30% { transform: translateY(-12%) scale(1.06) rotate(-4deg); } 55% { transform: scale(.96); } }
.cd[data-pezzo="casella"] .cd-zt.ok { background: var(--g); color: var(--cd-ink); box-shadow: inset 0 0 0 2px var(--cd-ink), 0 0 0 2px var(--z); }
.cd[data-pezzo="casella"] .cd-gr.fatta .cd-c.nera::after { box-shadow: 0 2px 0 rgba(21, 19, 17, .25); }

/* OCCHI: la casellina nera con due occhi che si guardano intorno e sbattono le palpebre (come i gatti del video: vivi) */
.cd[data-pezzo="occhi"] .cd-c.nera::after, .cd[data-pezzo="occhi"] .cd-zt.ok::after { content: ""; border-radius: 30%;
  background:
    radial-gradient(closest-side, var(--cd-ink) 92%, transparent) 33% 50% / 15% 18% no-repeat,
    radial-gradient(closest-side, var(--cd-ink) 92%, transparent) 67% 50% / 15% 18% no-repeat,
    radial-gradient(closest-side, #fff 94%, transparent) 27% 42% / 32% 38% no-repeat,
    radial-gradient(closest-side, #fff 94%, transparent) 73% 42% / 32% 38% no-repeat,
    var(--cd-ink); }
.cd[data-pezzo="occhi"] .cd-zt.ok::after { width: 100%; height: 100%; }
.cd[data-pezzo="occhi"] .cd-c.nera.vivo::after { animation: cd-occhi 1.4s ease-in-out; }
@keyframes cd-occhi {
  0%, 100% { background-position: 33% 50%, 67% 50%, 27% 42%, 73% 42%; background-size: 15% 18%, 15% 18%, 32% 38%, 32% 38%; }
  18%, 38% { background-position: 22% 50%, 56% 50%, 27% 42%, 73% 42%; }
  48%, 62% { background-position: 44% 50%, 78% 50%, 27% 42%, 73% 42%; background-size: 15% 18%, 15% 18%, 32% 38%, 32% 38%; }
  70% { background-position: 33% 50%, 67% 50%, 27% 42%, 73% 42%; background-size: 15% 2%, 15% 2%, 32% 3%, 32% 3%; }
  78% { background-size: 15% 18%, 15% 18%, 32% 38%, 32% 38%; } }

/* MATITA: un cerchietto tirato a matita attorno alla casella, come si fa sul giornale quando la soluzione è giusta, con la c
   in corsivo dentro. Il cerchio si DISEGNA (maschera che gira, --a) */
@property --a { syntax: '<angle>'; inherits: false; initial-value: 360deg; }
.cd[data-pezzo="matita"] .cd-c.nera::after { width: 80%; background: transparent; box-shadow: inset 1px 1px 0 rgba(63, 60, 56, .45);
  border: max(2px, calc(100cqi / var(--n) * .06)) solid #3F3C38; border-radius: 52% 46% 55% 43% / 47% 55% 44% 53%; transform: rotate(-8deg);
  color: #3F3C38; font: italic 700 calc(100cqi / var(--n) * .5)/1 var(--stampa, Georgia, serif); padding-bottom: .08em;
  -webkit-mask: conic-gradient(from -40deg, #000 var(--a), transparent 0); mask: conic-gradient(from -40deg, #000 var(--a), transparent 0); }
.cd[data-pezzo="matita"] .cd-c.nera.nuova::after { animation: cd-disegna .55s ease-out var(--r, 0ms) both; }
@keyframes cd-disegna { 0% { --a: 0deg; } 100% { --a: 360deg; } }
.cd[data-pezzo="matita"] .cd-c.nera.vivo::after { animation: cd-vivo-m .9s ease-in-out; }
@keyframes cd-vivo-m { 0%, 100% { transform: rotate(-8deg); } 40% { transform: rotate(6deg) scale(1.06); } }
.cd[data-pezzo="matita"] .cd-zt.ok { background: var(--z); color: #3F3C38; font-style: italic; box-shadow: inset 0 0 0 2px #3F3C38; border-radius: 50%; }

/* LETTERA: la c di Crucigo, grande, nera, sola (niente casella): la lettera è il pezzo */
.cd[data-pezzo="lettera"] .cd-c.nera::after { width: auto; aspect-ratio: auto; background: none; box-shadow: none; border-radius: 0; color: var(--cd-ink);
  font: 900 calc(100cqi / var(--n) * .86)/1 var(--stampa, Georgia, serif); padding-bottom: .16em; text-shadow: 0 2px 0 rgba(21, 19, 17, .18); }
.cd[data-pezzo="lettera"] .cd-zt.ok { background: var(--z); color: var(--cd-ink); font-size: 17px; }
.cd[data-pezzo="lettera"] .cd-gr.fatta .cd-c.nera::after { box-shadow: none; color: var(--cd-ink); text-shadow: 0 0 0 transparent, 0 0 6px var(--g); }

/* ===== DALMATA (owner 28 nov sera: «la mascotte è un dalmata con al posto dei puntini caselle pixellate nere») =====
   ?pezzo=dalmata (A: testa morbida, orecchie che pendono, una casella nera intorno all'occhio) · ?pezzo=cucciolo (C: testa
   quadrata come una casella). Le macchie sono QUADRATI: le caselle nere del cruciverba. Generato da lab/crudoku/dalmata_css.py.
   Vivo = gira la testa e strizza l'occhio (come i gatti del video). */
.cd[data-pezzo="dalmata"] { --cd-cane: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M11 8.5C4.5 8.5 1.8 16 3 24.5c.6 4 4.6 4.6 6.6 1.8L13.4 13Z' fill='%23151311'/><path d='M29 8.5c6.5 0 9.2 7.5 8 16-.6 4-4.6 4.6-6.6 1.8L26.6 13Z' fill='%23151311'/><path d='M20 6c8 0 11.5 6.5 11.5 14.5S27.5 35 20 35 8.5 28.5 8.5 20.5 12 6 20 6Z' fill='%23fff' stroke='%23151311' stroke-width='2'/><rect x='20.4' y='16.4' width='8' height='8' fill='%23151311'/><rect x='13' y='9.5' width='4' height='4' fill='%23151311'/><rect x='11.2' y='26' width='3' height='3' fill='%23151311'/><rect x='25.5' y='10' width='2.5' height='2.5' fill='%23151311'/><circle cx='15.7' cy='20.6' r='2.3' fill='%23151311'/><circle cx='16.5' cy='19.8' r='.8' fill='%23fff'/><circle cx='24.3' cy='20.6' r='2.3' fill='%23fff'/><circle cx='24.3' cy='20.6' r='1.6' fill='%23151311'/><circle cx='25' cy='19.9' r='.6' fill='%23fff'/><path d='M17 25.6h6c0 1.9-1.4 3-3 3s-3-1.1-3-3Z' fill='%23151311'/><path d='M20 28.4v1.6M17.4 30.6c1.2 1 4 1 5.2 0' fill='none' stroke='%23151311' stroke-width='1.4' stroke-linecap='round'/></svg>"); --cd-cane-z: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M11 8.5C4.5 8.5 1.8 16 3 24.5c.6 4 4.6 4.6 6.6 1.8L13.4 13Z' fill='%23151311'/><path d='M29 8.5c6.5 0 9.2 7.5 8 16-.6 4-4.6 4.6-6.6 1.8L26.6 13Z' fill='%23151311'/><path d='M20 6c8 0 11.5 6.5 11.5 14.5S27.5 35 20 35 8.5 28.5 8.5 20.5 12 6 20 6Z' fill='%23fff' stroke='%23151311' stroke-width='2'/><rect x='20.4' y='16.4' width='8' height='8' fill='%23151311'/><rect x='13' y='9.5' width='4' height='4' fill='%23151311'/><rect x='11.2' y='26' width='3' height='3' fill='%23151311'/><rect x='25.5' y='10' width='2.5' height='2.5' fill='%23151311'/><path d='M13.6 20.8h4.2' stroke='%23151311' stroke-width='1.8' stroke-linecap='round'/><path d='M22.2 20.8h4.2' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/><path d='M17 25.6h6c0 1.9-1.4 3-3 3s-3-1.1-3-3Z' fill='%23151311'/><path d='M20 28.4v1.6M17.4 30.6c1.2 1 4 1 5.2 0' fill='none' stroke='%23151311' stroke-width='1.4' stroke-linecap='round'/></svg>"); }
.cd[data-pezzo="cucciolo"] { --cd-cane: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><rect x='7' y='8' width='26' height='26' rx='7' fill='%23fff' stroke='%23151311' stroke-width='2'/><path d='M7.5 12c-4 0-5.5 5-4.5 11 .4 2.6 3.6 3 5 1Z' fill='%23151311'/><path d='M32.5 12c4 0 5.5 5 4.5 11-.4 2.6-3.6 3-5 1Z' fill='%23151311'/><rect x='21' y='9' width='6' height='6' fill='%23151311'/><rect x='9' y='26' width='4' height='4' fill='%23151311'/><rect x='28' y='24' width='3' height='3' fill='%23151311'/><circle cx='15' cy='19.5' r='2.2' fill='%23151311'/><circle cx='25' cy='19.5' r='2.2' fill='%23151311'/><circle cx='15.7' cy='18.8' r='.7' fill='%23fff'/><circle cx='25.7' cy='18.8' r='.7' fill='%23fff'/><rect x='17.2' y='24' width='5.6' height='4' rx='1.6' fill='%23151311'/><path d='M20 28v1.8M17.6 30.4c1.2 1 3.6 1 4.8 0' fill='none' stroke='%23151311' stroke-width='1.4' stroke-linecap='round'/></svg>"); --cd-cane-z: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><rect x='7' y='8' width='26' height='26' rx='7' fill='%23fff' stroke='%23151311' stroke-width='2'/><path d='M7.5 12c-4 0-5.5 5-4.5 11 .4 2.6 3.6 3 5 1Z' fill='%23151311'/><path d='M32.5 12c4 0 5.5 5 4.5 11-.4 2.6-3.6 3-5 1Z' fill='%23151311'/><rect x='21' y='9' width='6' height='6' fill='%23151311'/><rect x='9' y='26' width='4' height='4' fill='%23151311'/><rect x='28' y='24' width='3' height='3' fill='%23151311'/><path d='M13 19.8q2 1.8 4 0M23 19.8q2 1.8 4 0' fill='none' stroke='%23151311' stroke-width='1.6' stroke-linecap='round'/><rect x='17.2' y='24' width='5.6' height='4' rx='1.6' fill='%23151311'/><path d='M20 28v1.8M17.6 30.4c1.2 1 3.6 1 4.8 0' fill='none' stroke='%23151311' stroke-width='1.4' stroke-linecap='round'/></svg>"); }
.cd[data-pezzo="dalmata"] .cd-c.nera::after, .cd[data-pezzo="cucciolo"] .cd-c.nera::after,
.cd[data-pezzo="dalmata"] .cd-zt.ok, .cd[data-pezzo="cucciolo"] .cd-zt.ok {
  content: ""; color: transparent; background: var(--cd-cane) center / contain no-repeat; box-shadow: none; border-radius: 0; }
.cd[data-pezzo="dalmata"] .cd-c.nera::after, .cd[data-pezzo="cucciolo"] .cd-c.nera::after { width: 88%; padding: 0;
  filter: drop-shadow(0 2px 0 rgba(21, 19, 17, .22)); }
.cd[data-pezzo="dalmata"] .cd-zt.ok, .cd[data-pezzo="cucciolo"] .cd-zt.ok { background: var(--cd-cane) center / 108% no-repeat, var(--z); width: 22px; height: 22px; }
.cd[data-pezzo="dalmata"] .cd-c.nera.vivo::after, .cd[data-pezzo="cucciolo"] .cd-c.nera.vivo::after { animation: cd-cane 1.5s ease-in-out; }
@keyframes cd-cane {
  0%, 100% { transform: none; background-image: var(--cd-cane); }
  22%, 40% { transform: rotate(-11deg) translateY(-4%); }
  46% { background-image: var(--cd-cane); }
  48%, 60% { background-image: var(--cd-cane-z); transform: rotate(8deg) translateY(-4%); }
  62% { background-image: var(--cd-cane); }
  80% { transform: rotate(0) scale(1.05); } }
/* arriva: cade dall'alto girato, batte (al 30% partono schegge e onda, come il timbro), rimbalza; niente ombra quadrata */
.cd[data-pezzo="dalmata"] .cd-c.nera.nuova::after, .cd[data-pezzo="cucciolo"] .cd-c.nera.nuova::after { animation: cd-cane-giu .6s cubic-bezier(.3, .9, .3, 1) var(--r, 0ms) both; }
@keyframes cd-cane-giu {
  0% { transform: translateY(-40%) scale(1.8) rotate(-16deg); opacity: 0; background-image: var(--cd-cane-z); }
  14% { opacity: 1; }
  30% { transform: translateY(0) scale(.8, .7) rotate(3deg); background-image: var(--cd-cane-z); }
  50% { transform: translateY(-8%) scale(1.08, 1.14) rotate(-2deg); background-image: var(--cd-cane); }
  72% { transform: scale(.97); }
  100% { transform: none; background-image: var(--cd-cane); } }
/* finita: niente anello, il cane salta di gioia uno dopo l'altro */
.cd[data-pezzo="dalmata"] .cd-gr.fatta .cd-c.nera::after, .cd[data-pezzo="cucciolo"] .cd-gr.fatta .cd-c.nera::after {
  box-shadow: none; filter: drop-shadow(0 0 4px var(--g)) drop-shadow(0 2px 0 rgba(21, 19, 17, .22)); }

/* (classi cd-cruci / cd-p-<pezzo> e non [data-pezzo]: la copia della griglia nella vittoria, c/g-vittoria.js, tiene
   solo le CLASSI dei contenitori) */
/* ===== CRUCI 3D (owner 28 nov sera: «si chiama Cruci», «fallo molto meglio, 3D», «guarda i video di Meowdoku») =====
   ?pezzo=cruci (testa morbida) · ?pezzo=cruci-casella (testa a casella). Immagini fatte in Blender da
   lab/crudoku/cruci3d/cruci.py → c/cruci/*.webp. Come i gatti del video: la testa ESCE dalla casella (più grande), cade e
   si posa; schizzano CUBETTI 3D del colore della zona; da fermo sbatte gli occhi e si guarda intorno; sulla regola rotta
   si arrabbia; a fine partita è felice. */
.cd.cd-p-cruci { --cc-n: url(cruci/cruci-morbida-normale.webp); --cc-c: url(cruci/cruci-morbida-chiusi.webp);
  --cc-a: url(cruci/cruci-morbida-arrabbiato.webp); --cc-f: url(cruci/cruci-morbida-felice.webp); --cc-t: url(cruci/cruci-morbida-triste.webp);
  --cc-s: url(cruci/cruci-morbida-guardasx.webp); --cc-d: url(cruci/cruci-morbida-guardadx.webp); }
.cd.cd-p-cruci-casella { --cc-n: url(cruci/cruci-casella-normale.webp); --cc-c: url(cruci/cruci-casella-chiusi.webp);
  --cc-a: url(cruci/cruci-casella-arrabbiato.webp); --cc-f: url(cruci/cruci-casella-felice.webp); --cc-t: url(cruci/cruci-casella-triste.webp);
  --cc-s: url(cruci/cruci-casella-guardasx.webp); --cc-d: url(cruci/cruci-casella-guardadx.webp); }
.cd.cd-cruci .cd-c.nera::after, .cd.cd-cruci .cd-zt.ok {
  content: ""; color: transparent; background: var(--cc-n) center / contain no-repeat; box-shadow: none; border-radius: 0; }
.cd.cd-cruci .cd-c.nera { overflow: visible; z-index: 3; }
/* z-index 2: SOPRA i bordi di zona della sua casella (::before, z 1): prima la riga nera passava sopra la testa (owner 28/11) */
/* GRANDEZZA (owner 28/11 notte: «non è troppo più grosso delle celle?» + video del gioco vero a 10×10: il gatto sta DENTRO
   la casella, ~85%, solo le orecchie arrivano al bordo — MISURATO sui fotogrammi). Prima era 146%. */
.cd.cd-cruci .cd-c.nera::after { z-index: 2; width: 100%; max-width: none; max-height: none; padding: 0; position: relative; top: -2%;
  filter: drop-shadow(0 3px 2px rgba(21, 19, 17, .28)); }
.cd.cd-cruci .cd-zt.ok { background: var(--cc-n) center / 150% no-repeat, var(--z); overflow: visible; }
/* vivo: sbatte gli occhi, si guarda intorno */
.cd.cd-cruci .cd-c.nera.vivo::after { animation: cc-vivo 2.2s steps(1, end); }
@keyframes cc-vivo { 0% { background-image: var(--cc-c); } 6% { background-image: var(--cc-n); }
  18% { background-image: var(--cc-s); } 44% { background-image: var(--cc-d); } 70% { background-image: var(--cc-n); }
  84% { background-image: var(--cc-c); } 90%, 100% { background-image: var(--cc-n); } }
/* arriva: cade grande dall'alto con gli occhi chiusi, si schiaccia, rimbalza, apre gli occhi */
.cd.cd-cruci .cd-c.nera.nuova::after { animation: cc-giu .62s cubic-bezier(.3, .9, .3, 1) var(--r, 0ms) both; }
@keyframes cc-giu {
  0% { transform: translateY(-55%) scale(1.9) rotate(-10deg); opacity: 0; background-image: var(--cc-c); }
  14% { opacity: 1; }
  30% { transform: translateY(4%) scale(1.08, .78) rotate(2deg); background-image: var(--cc-c); }
  48% { transform: translateY(-10%) scale(.94, 1.1) rotate(-2deg); background-image: var(--cc-f); }
  70% { transform: scale(1.03, .98); background-image: var(--cc-f); }
  100% { transform: none; background-image: var(--cc-n); } }
/* sbagliato: chi toccava si arrabbia (si gonfia, trema) */
.cd.cd-cruci .cd-c.conf::after { animation: cc-arrabbiato 1.1s ease-out; }
@keyframes cc-arrabbiato { 0%, 80% { background-image: var(--cc-a); filter: drop-shadow(0 0 6px rgba(230, 57, 70, .85)); }
  8% { transform: scale(1.15) rotate(-5deg); } 16% { transform: scale(1.12) rotate(5deg); } 24% { transform: scale(1.12) rotate(-4deg); }
  34% { transform: scale(1.08) rotate(0); } 100% { background-image: var(--cc-n); transform: none; } }
/* finita: tutti felici */
.cd.cd-cruci .cd-gr.fatta .cd-c.nera::after { background-image: var(--cc-f); box-shadow: none;
  filter: drop-shadow(0 0 5px var(--g)) drop-shadow(0 3px 2px rgba(21, 19, 17, .28)); }
/* lo scoppio: CUBETTI 3D del colore della zona (nel video: cubetti azzurri) al posto delle foglie */
.cd.cd-cruci .cd-sc__fo { height: calc(var(--w) * var(--sz) * .9); width: calc(var(--w) * var(--sz) * .9); border-radius: 22%;
  background: linear-gradient(150deg, color-mix(in oklab, var(--zz) 55%, #fff) 0 30%, color-mix(in oklab, var(--zz) 80%, #151311 20%) 70%);
  box-shadow: inset -2px -3px 0 color-mix(in oklab, var(--zz) 55%, #151311), inset 2px 2px 0 rgba(255, 255, 255, .55), 0 2px 3px rgba(21, 19, 17, .25);
  filter: saturate(1.6); }
/* la testa esce dalla casella anche sul bordo della griglia (come i gatti del video): la griglia non taglia */
.cd.cd-cruci .cd-gr { overflow: visible; }
.cd.cd-cruci .cd-gr > .cd-c:first-child { border-top-left-radius: 3px; }
/* il tasto d'aiuto «Cruci»: la testa al posto della c */
.cd.cd-cruci .cd-tb--b { color: transparent; background: var(--cc-n) center / 135% no-repeat; box-shadow: none; border-radius: 0; }
/* LA PAROLA di chi ha creato lo schema (Crea, 28 nov 2026): a schema finito il timbro di ogni riga si gira e diventa la sua
   lettera, una riga dopo l'altra dall'alto (--k = la riga): dall'alto in basso si legge la parola. Prima non si vede niente. */
.cd-l { display: none; }
.cd-gr.fatta .cd-c[data-l]::after { opacity: 0; }
.cd-gr.fatta .cd-l { display: grid; position: absolute; left: 18%; top: 18%; width: 64%; height: 64%; place-items: center; box-sizing: border-box;
  background: var(--cd-ink, #151311); color: #fff; border-radius: 3px; font: 800 calc(100cqi / var(--n) * .46)/1 var(--stampa, Georgia, serif);
  box-shadow: 0 0 0 3px var(--g), 0 2px 0 rgba(21, 19, 17, .25); z-index: 2;
  animation: cd-lettera .5s cubic-bezier(.3, .9, .3, 1) calc(var(--k, 0) * 140ms + 250ms) both; }
@keyframes cd-lettera { from { transform: rotateY(90deg) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cd-gr.fatta .cd-l { animation: none; } }

/* il messaggio nascosto dei crudoku creati (pagina Crea, 28 nov): una riga sotto lo schema, poi la parola a schema finito */
.cd-msg { margin: 10px auto 0; max-width: 22rem; padding: 7px 12px; border-radius: 10px; text-align: center; font: 400 14px/1.35 var(--testo, system-ui);
  color: var(--grafite, #5E5A54); border: 1.5px dashed color-mix(in oklab, var(--inchiostro, #151311) 25%, transparent); }
.cd-msg.letto { color: var(--inchiostro, #151311); border-style: solid; background: var(--foglio, #fff); font-size: 15px; }
.cd-msg.letto b { letter-spacing: .12em; font-size: 17px; }

/* ===== COME IL GIOCO VERO (owner 28/11 notte: «guarda come funziona il gioco vero», video Meowdoku 10×10) =====
   «FATTA!»: riga/colonna/zona tutta decisa → onda sulle sue caselle (dal Cruci in fuori) e la scritta sopra (è il loro
   «Clear!»). LA SCIA: dal Cruci giusto una cometa dorata vola alla casellina della zona in alto. */
.cd-c.pulita { animation: cd-pulita .42s ease-out var(--r, 0ms) both; }
@keyframes cd-pulita { 0% { transform: none; filter: none; } 35% { transform: scale(.86); filter: brightness(1.35) saturate(1.2); }
  100% { transform: none; filter: none; } }
.cd-fatta { position: absolute; z-index: 7; pointer-events: none; transform: translate(-50%, -60%); white-space: nowrap;
  font: 900 clamp(15px, 4.6vw, 21px)/1 var(--testo, system-ui); letter-spacing: .01em; color: #FFD84D;
  -webkit-text-stroke: 1.5px #8A4B08; paint-order: stroke fill; text-shadow: 0 2px 0 #8A4B08, 0 3px 6px rgba(21, 19, 17, .3);
  animation: cd-fatta 1.25s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes cd-fatta { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.4); } 18% { opacity: 1; transform: translate(-50%, -70%) scale(1.15); }
  30% { transform: translate(-50%, -70%) scale(1); } 75% { opacity: 1; transform: translate(-50%, -95%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -125%) scale(.9); } }
.cd-scia { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; width: 34px; height: 8px; margin: -4px 0 0 -30px;
  border-radius: 8px; transform-origin: 30px 50%;
  background: linear-gradient(90deg, rgba(255, 216, 77, 0), rgba(255, 216, 77, .8) 60%, #FFF6C8 88%, #fff);
  box-shadow: 0 0 10px 2px rgba(255, 196, 46, .7); }
@media (prefers-reduced-motion: reduce) { .cd-c.pulita, .cd-fatta { animation: none; } }

/* ===== MATTONELLE (owner 28/11 notte: «tutto correttamente» = mattonelle staccate come Meowdoku + X bianche) =====
   Nel video: caselle separate e arrotondate, colori PIENI, le zone si riconoscono dal colore (niente filo nero), X
   bianche grosse. Qui solo col pezzo Cruci (è quello di base); gli altri pezzi restano «carta». Dieci colori scelti
   lontani fra loro (tinta) perché senza filo è il colore che dice la zona. */
.cd.cd-cruci { --z0: #F59E4C; --z1: #86C25A; --z2: #5B9BF0; --z3: #A274E3; --z4: #F2C640;
  --z5: #EE6FA9; --z6: #2DBFAE; --z7: #A58C7A; --z8: #E5574E; --z9: #78CDEE; --cd-x: #fff; }
html[data-tema="notte"] .cd.cd-cruci { --z0: #C97E3A; --z1: #6A9E45; --z2: #4A7FC6; --z3: #8560BC; --z4: #C9A332;
  --z5: #C65A8B; --z6: #259E90; --z7: #87725F; --z8: #BE473F; --z9: #5FA9C6; }
.cd.cd-cruci .cd-gr { gap: clamp(2px, calc(28px / var(--n)), 5px); padding: clamp(3px, calc(32px / var(--n)), 6px); background: #FFFDF8;   /* px: il cqi qui misura un contenitore più su (11 px su desktop, MISURATO) */
  border-radius: 12px; }
html[data-tema="notte"] .cd.cd-cruci .cd-gr { background: #23201C; }
.cd.cd-cruci .cd-c { border-radius: 22%; box-shadow: inset 0 -3px 0 rgba(21, 19, 17, .16), inset 0 2px 0 rgba(255, 255, 255, .28); }
.cd.cd-cruci .cd-c::before { display: none; }   /* niente filo di zona: la zona è il colore */
.cd.cd-cruci .cd-gr > .cd-c:first-child { border-top-left-radius: 22%; }
/* la X bianca, grossa, con le punte tonde e un'ombra leggera (si legge su tutti i colori) */
.cd.cd-cruci .cd-c.x::after, .cd.cd-cruci .cd-c.xr::after { width: 58%; background: center / contain no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14M19 5 5 19' stroke='%23fff' stroke-width='4.2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  filter: drop-shadow(0 1.5px 0 rgba(21, 19, 17, .22)); }
.cd.cd-cruci .cd-c.x.auto::after { opacity: .55; }
/* la X rossa dove hai sbagliato: rossa scura con l'alone bianco (sul rosso della zona 8 si vede lo stesso) */
.cd.cd-cruci .cd-c.xr::after { width: 62%; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14M19 5 5 19' stroke='%23fff' stroke-width='7' stroke-linecap='round' fill='none'/%3E%3Cpath d='M5 5l14 14M19 5 5 19' stroke='%23B3261E' stroke-width='4' stroke-linecap='round' fill='none'/%3E%3C/svg%3E"); }
/* la X che arriva: si disegna (scala + giro), come il tratto nel video */
.cd.cd-cruci .cd-c.x.nuova::after { animation: cd-xsegno .22s cubic-bezier(.3, 1.5, .5, 1) var(--r, 0ms) both; }
@keyframes cd-xsegno { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
/* i suggerimenti della lampadina e la luce: restano leggibili sulle mattonelle */
.cd.cd-cruci .cd-c.luce { filter: brightness(1.12) saturate(1.1); }
/* «+punti» sopra il Cruci (nel video «+1440» esce SUL gatto) */
.cd-piu { position: absolute; z-index: 8; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap;
  font: 900 clamp(14px, 4.2vw, 19px)/1 var(--testo, system-ui); color: #fff; -webkit-text-stroke: 1.5px #B4471B; paint-order: stroke fill;
  text-shadow: 0 2px 0 #B4471B; animation: cd-piu 1s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes cd-piu { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.5); } 20% { opacity: 1; transform: translate(-50%, -95%) scale(1.15); }
  35% { transform: translate(-50%, -100%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -170%) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .cd-piu, .cd.cd-cruci .cd-c.x.nuova::after { animation: none; } }

/* ===== CRUCI v2: ANIMAZIONI VERE A FOTOGRAMMI (owner 28/11 notte: «la mascotte si può fare meglio, ha animazioni?») =====
   Strisce fatte in Blender (lab/crudoku/cruci3d/cruci.py --anim, pubblica2.py): ogni striscia = N fotogrammi da 200 px.
   Immagine e misura della striscia stanno DENTRO i keyframes: a fine animazione torna da sola la faccia ferma.
   Un keyframe per fotogramma + steps(1, end): con un solo «from→to» e steps(n, jump-none) nel video registrato la testa
   SCIVOLAVA tra due fotogrammi (due mezze teste, MISURATO 28/11 notte). */
.cd.cd-p-cruci-casella { --cc-at: url(cruci/cruci-casella-anim-atterra.webp); --cc-fe: url(cruci/cruci-casella-anim-felice.webp);
  --cc-ar: url(cruci/cruci-casella-anim-arrabbiato.webp); }
@keyframes cc-at {
  0.000% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 0.0000% 0; }
  12.500% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 14.2857% 0; }
  25.000% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 28.5714% 0; }
  37.500% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 42.8571% 0; }
  50.000% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 57.1429% 0; }
  62.500% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 71.4286% 0; }
  75.000% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 85.7143% 0; }
  87.500% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 100.0000% 0; }
  100% { background-image: var(--cc-at); background-size: 800% 100%; background-position: 100% 0; } }
@keyframes cc-fe {
  0.000% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 0.0000% 0; }
  16.667% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 20.0000% 0; }
  33.333% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 40.0000% 0; }
  50.000% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 60.0000% 0; }
  66.667% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 80.0000% 0; }
  83.333% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 100.0000% 0; }
  100% { background-image: var(--cc-fe); background-size: 600% 100%; background-position: 100% 0; } }
@keyframes cc-ar {
  0.000% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 0.0000% 0; }
  16.667% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 20.0000% 0; }
  33.333% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 40.0000% 0; }
  50.000% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 60.0000% 0; }
  66.667% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 80.0000% 0; }
  83.333% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 100.0000% 0; }
  100% { background-image: var(--cc-ar); background-size: 600% 100%; background-position: 100% 0; } }
@keyframes cc-cade { from { transform: translateY(-80%) scale(1.35); opacity: 0; } 35% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes cc-rosso { 0%, 75% { filter: drop-shadow(0 0 5px rgba(230, 57, 70, .95)) drop-shadow(0 0 2px rgba(230, 57, 70, .9)); } 100% { filter: none; } }
/* arriva: cade (0,18 s, sul primo fotogramma: allungato, occhi chiusi), poi tocca e i fotogrammi fanno il resto */
.cd.cd-p-cruci-casella .cd-c.nera.nuova::after {
  animation: cc-cade .18s cubic-bezier(.55, 0, .9, .45) var(--r, 0ms) both, cc-at .5s steps(1, end) calc(var(--r, 0ms) + .18s) both; }
/* qualcuno gli sta addosso: si arrabbia e scuote la testa (due volte), alone rosso */
.cd.cd-p-cruci-casella .cd-c.conf::after { animation: cc-ar .42s steps(1, end) 0s 2 backwards, cc-rosso 1.1s ease-out; }
/* fine partita: salti di gioia, uno dopo l'altro (--r = ritardo per riga dato dall'onda), poi resta felice */
.cd.cd-p-cruci-casella .cd-gr.fatta .cd-c.nera::after { animation: cc-fe .6s steps(1, end) calc(var(--k, 0) * 90ms + 250ms) 3 backwards; }
@media (prefers-reduced-motion: reduce) {
  .cd.cd-p-cruci-casella .cd-c.nera.nuova::after, .cd.cd-p-cruci-casella .cd-c.conf::after,
  .cd.cd-p-cruci-casella .cd-gr.fatta .cd-c.nera::after { animation: none; } }

/* IN STANZA: dove sono gli altri (28 nov 2026 notte, come .sdk-c.qui del sudoku): un riquadro nel colore di chi ha toccato */
.cd-c.qui { box-shadow: inset 0 0 0 3px var(--qui, #5E5A54); }
