/* ==========================================================================
   DaiGioca — stili dei giochi originali.
   Caricato solo dalle pagine /gioco/. Tutto dentro .stage-mount.
   ========================================================================== */

.stage-mount {
  display: grid; place-items: center;
  padding: 10px; overflow: auto;
  color: #E8ECF4;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
.stage-mount > * { max-width: 100%; }
.stage-mount button { font-family: inherit; }
.stage-mount canvas { border-radius: 0; }

/* Utilità comuni */
.is-shake { animation: dg-shake .38s ease; }
@keyframes dg-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
@media (prefers-reduced-motion: reduce) { .is-shake { animation: none; } }

.sc-msg { text-align: center; font-size: .86rem; color: #9FB0C8; margin: 2px 0 8px; min-height: 1.2em; }
.sc-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #7E8EA8; }
.sc-empty { color: #6C7A93; font-size: .86rem; font-style: italic; }
.sc-pile { font-size: .78rem; color: #9FB0C8; }

/* ---------------------------------------------------------------- SUDOKU */
.sk { display: grid; gap: 10px; justify-items: center; width: 100%; }
.sk-grid {
  display: grid; grid-template-columns: repeat(9, 1fr);
  width: min(100%, 62vh, 460px); aspect-ratio: 1;
  background: #46567A; gap: 1px; padding: 2px; border-radius: 6px;
}
.sk-cell {
  border: 0; background: #131A28; color: #CBD6EA;
  font-size: clamp(14px, 3.6vw, 22px); font-weight: 600;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  position: relative;
}
/* separatori dei riquadri 3x3: il fondo della griglia traspare dal margine */
.sk-cell:nth-child(3n):not(:nth-child(9n)) { margin-right: 3px; }
.sk-grid > .sk-cell:nth-child(n+19):nth-child(-n+27),
.sk-grid > .sk-cell:nth-child(n+46):nth-child(-n+54) { margin-bottom: 3px; }
.sk-cell.is-peer { background: #192233; }
.sk-cell.is-given { color: #fff; background: #1D2739; }
.sk-cell.is-sel { background: #2F5BFF; color: #fff; }
.sk-cell.is-same:not(.is-sel) { background: #223055; color: #9FBBFF; }
.sk-cell.is-bad { color: #FF7183; background: #2B1620; }
.sk-notes { display: grid; grid-template-columns: repeat(3,1fr); width: 100%; height: 100%; font-size: .32em; color: #7E8EA8; }
.sk-notes i { display: grid; place-items: center; font-style: normal; }

.sk-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 460px); }
.sk-key {
  border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5;
  border-radius: 8px; padding: 10px 0; font-size: 1.05rem; font-weight: 700; cursor: pointer;
  min-height: 44px;
}
.sk-key:hover { background: #24324A; }
.sk-del { color: #9FB0C8; }
.sk-tools { display: flex; gap: 8px; }
.sk-tool {
  border: 1px solid #2C3A55; background: #1B2436; color: #C4D0E4;
  border-radius: 8px; padding: 8px 14px; font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 40px;
}
.sk-tool[aria-pressed="true"] { background: #2F5BFF; border-color: #2F5BFF; color: #fff; }

/* ---------------------------------------------------------- CAMPO MINATO */
.ms { display: grid; gap: 8px; justify-items: center; }
.ms-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ms-tool { border: 1px solid #2C3A55; background: #1B2436; color: #C4D0E4; border-radius: 8px; padding: 8px 14px; font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.ms-tool[aria-pressed="true"] { background: #E8394F; border-color: #E8394F; color: #fff; }
.ms-hint { font-size: .74rem; color: #7E8EA8; }
.ms-board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 1px; background: #2A3448; padding: 2px; border-radius: 5px; max-width: 96vw; }
.ms-board[data-size="lg"] { width: min(100%, 58vh, 420px); }
.ms-board[data-size="md"] { width: min(100%, 62vh, 540px); }
.ms-board[data-size="sm"] { width: min(100%, 64vh, 660px); }
.ms-cell {
  aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  background: #3B4A66; color: #fff;
  font-weight: 700; font-size: clamp(9px, 2.1vw, 15px);
  display: grid; place-items: center;
}
.ms-cell:hover:not(.is-open) { background: #47587A; }
.ms-cell.is-open { background: #151C2B; }
.ms-cell.is-flag { background: #3B4A66; color: #FFB4BE; }
.ms-cell.is-mine { background: #C8102E; color: #fff; }
.ms-cell.n1{color:#7FA7FF}.ms-cell.n2{color:#5BD6A8}.ms-cell.n3{color:#FF8A9B}
.ms-cell.n4{color:#C39BFF}.ms-cell.n5{color:#FFB865}.ms-cell.n6{color:#67DCE8}
.ms-cell.n7{color:#E3E9F5}.ms-cell.n8{color:#9FB0C8}

/* ------------------------------------------------------ PUZZLE SCORREVOLE */
.sl-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 6px; width: min(100%, 60vh, 420px); aspect-ratio: 1; }
.sl-tile {
  border: 0; border-radius: 10px; cursor: pointer;
  background: #2F5BFF; color: #fff;
  font-size: clamp(16px, 5vw, 30px); font-weight: 700;
  display: grid; place-items: center;
}
.sl-tile.is-home { background: #17B58F; }
.sl-tile.is-blank { background: rgba(255,255,255,.05); cursor: default; }
.sl-tile:not(.is-blank):hover { filter: brightness(1.12); }

/* ----------------------------------------------------------------- HANOI */
.hn-row { display: flex; gap: 10px; width: min(100%, 620px); align-items: flex-end; }
.hn-peg {
  flex: 1; position: relative; border: 0; background: transparent; cursor: pointer;
  height: min(46vh, 300px); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0;
}
.hn-rod { position: absolute; bottom: 10px; width: 8px; height: 88%; background: #33405A; border-radius: 4px; }
.hn-base { width: 100%; height: 10px; background: #33405A; border-radius: 5px; }
.hn-stack { display: flex; flex-direction: column-reverse; align-items: center; width: 100%; gap: 3px; position: relative; z-index: 1; }
.hn-disc { height: clamp(16px, 4vh, 26px); background: #2F5BFF; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 700; }
.hn-peg.is-sel .hn-stack .hn-disc:last-child { outline: 3px solid #F0B429; outline-offset: 2px; }
.hn-peg:hover .hn-rod { background: #3D4D6B; }

/* ----------------------------------------------------------- LUCI SPENTE */
.lo-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; width: min(100%, 58vh, 400px); aspect-ratio: 1; }
.lo-cell { border: 2px solid #2C3A55; border-radius: 12px; background: #151C2B; cursor: pointer; transition: background .12s, border-color .12s; }
.lo-cell.is-on { background: #F0B429; border-color: #FFD166; box-shadow: 0 0 18px rgba(240,180,41,.4); }
.lo-cell:hover { border-color: #4A5C7E; }

/* -------------------------------------------------------- CODICE SEGRETO */
.cs { display: grid; gap: 10px; justify-items: center; width: 100%; }
.cs-board { display: grid; gap: 3px; }
.cs-row { display: flex; align-items: center; gap: 8px; }
.cs-num { width: 18px; text-align: right; font-size: .7rem; color: #6C7A93; }
.cs-pegs { display: flex; gap: 5px; }
.cs-peg { width: clamp(22px, 5.4vw, 30px); aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.07); border: 1px solid #2C3A55; display: block; }
.cs-slot { cursor: pointer; padding: 0; }
.cs-slot.is-sel { outline: 2px solid #F0B429; outline-offset: 2px; }
.cs-marks { display: grid; grid-template-columns: repeat(2, 9px); gap: 3px; }
.cs-mark { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.1); }
.cs-mark.is-exact { background: #17B58F; }
.cs-mark.is-part { background: #F0B429; }
.cs-active { display: flex; align-items: center; gap: 10px; }
.cs-go { border: 0; background: #2F5BFF; color: #fff; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; min-height: 40px; }
.cs-go:disabled { opacity: .4; cursor: default; }
.cs-pad { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.cs-chip { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); cursor: pointer; }

/* ------------------------------------------------------------ NONOGRAMMA */
.ng { display: grid; gap: 8px; justify-items: center; width: 100%; }
.ng-tools { display: flex; gap: 8px; }
.ng-tool { border: 1px solid #2C3A55; background: #1B2436; color: #C4D0E4; border-radius: 8px; padding: 8px 14px; font-size: .84rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.ng-tool[aria-pressed="true"] { background: #2F5BFF; border-color: #2F5BFF; color: #fff; }
.ng-table { font-size: clamp(8px, 1.7vw, 12px); }
.ng-colhead { display: grid; grid-template-columns: 46px repeat(var(--n), 1fr); }
.ng-line { display: grid; grid-template-columns: 46px repeat(var(--n), 1fr); }
.ng-clue { color: #9FBBFF; display: grid; place-items: center; padding: 2px; }
.ng-clue-col { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: -.1em; min-height: 46px; align-items: end; }
.ng-clue-row { justify-content: end; padding-right: 6px; letter-spacing: .08em; }
.ng-corner { width: 46px; }
.ng-cell { aspect-ratio: 1; border: 1px solid #263149; background: #131A28; cursor: pointer; padding: 0; color: #64748B; font-size: .8em; }
.ng-cell.is-fill { background: #2F5BFF; }
.ng-cell.is-x { color: #7E8EA8; }
.ng-table { width: min(100%, 62vh, 520px); }

/* --------------------------------------------------------------- BINARIO */
.bn-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; width: min(100%, 60vh, 440px); aspect-ratio: 1; }
.bn-cell { border: 1px solid #2C3A55; border-radius: 6px; background: #131A28; color: #C4D0E4; font-size: clamp(13px, 3.4vw, 20px); font-weight: 700; cursor: pointer; }
.bn-cell.is-given { background: #1D2739; color: #fff; cursor: default; }
.bn-cell.is-one { color: #7FA7FF; }
.bn-cell.is-zero { color: #5BD6A8; }

/* ---------------------------------------------------------------- KAKURO */
.kk { display: grid; gap: 10px; justify-items: center; width: 100%; }
.kk-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1px; background: #2A3448; padding: 1px; width: min(100%, 60vh, 480px); aspect-ratio: 1; }
.kk-cell { position: relative; border: 0; padding: 0; font-size: clamp(11px, 2.8vw, 18px); font-weight: 700; display: grid; place-items: center; }
.kk-open { background: #131A28; color: #CBD6EA; cursor: pointer; }
.kk-open.is-sel { background: #2F5BFF; color: #fff; }
.kk-block { background: #29344A; cursor: default; }
.kk-block.has-clue { background: linear-gradient(to bottom right, #29344A 49.4%, #4A5C7E 49.4%, #4A5C7E 50.6%, #29344A 50.6%); }
.kk-h, .kk-v { position: absolute; font-size: .52em; color: #A9BBDA; font-weight: 700; }
.kk-h { top: 6%; right: 8%; }
.kk-v { bottom: 6%; left: 8%; }
.kk-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 420px); }
.kk-key { border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5; border-radius: 8px; padding: 10px 0; font-weight: 700; cursor: pointer; min-height: 44px; }

/* ----------------------------------------------------------- SPINGI CASSE */
.sb { display: grid; gap: 10px; justify-items: center; }
.sb-bar { display: flex; gap: 8px; }
.sb-btn { border: 1px solid #2C3A55; background: #1B2436; color: #C4D0E4; border-radius: 8px; padding: 8px 14px; font-size: .84rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.sb-board { display: grid; grid-template-columns: repeat(var(--w), 1fr); gap: 2px; width: min(100%, calc(56vh * var(--w) / var(--h)), 520px); }
.sb-t { aspect-ratio: 1; border-radius: 4px; display: block; }
.sb-t.is-wall { background: #3B4A66; }
.sb-t.is-floor { background: #151C2B; }
.sb-t.is-goal { background: #151C2B; box-shadow: inset 0 0 0 3px #17B58F; border-radius: 50%; }
.sb-t.is-box { background: #B45309; box-shadow: inset 0 0 0 3px #D97706; }
.sb-t.is-box.is-set { background: #17B58F; box-shadow: inset 0 0 0 3px #34D399; }
.sb-t.is-man { background: #2F5BFF; border-radius: 50%; }
.sb-t.is-man.is-ongoal { background: #5B84FF; box-shadow: 0 0 0 2px #17B58F; }

/* ------------------------------------------------------- CARTE FRANCESI */
.pc {
  width: clamp(38px, 9vw, 58px); aspect-ratio: 5 / 7;
  background: #fff; border-radius: 5px; position: relative;
  display: block; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  font-weight: 700; flex: 0 0 auto;
}
.pc.is-red { color: #D01C36; }
.pc.is-black { color: #16202E; }
.pc-tl, .pc-br { position: absolute; font-size: clamp(9px, 2.2vw, 13px); line-height: 1; }
.pc-tl { top: 3px; left: 4px; }
.pc-br { bottom: 3px; right: 4px; transform: rotate(180deg); }
.pc-mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(15px, 4vw, 24px); }
.pc-down { background: repeating-linear-gradient(45deg, #2F5BFF 0 5px, #24489E 5px 10px); }
.pc-empty { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); display: grid; place-items: center; color: rgba(255,255,255,.45); font-size: 1.1rem; }
.pc.is-sel { outline: 3px solid #F0B429; outline-offset: 1px; z-index: 5; }

.kl, .fc, .sp, .py { display: grid; gap: 10px; justify-items: center; width: 100%; }
.kl-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.kl-btn { border: 1px solid #2C3A55; background: #1B2436; color: #C4D0E4; border-radius: 8px; padding: 7px 13px; font-size: .82rem; font-weight: 600; cursor: pointer; min-height: 38px; }
.kl-btn-go { background: #2F5BFF; border-color: #2F5BFF; color: #fff; }
.kl-btn:disabled { opacity: .4; cursor: default; }
.kl-note { font-size: .78rem; color: #9FB0C8; }
.kl-top { display: flex; gap: clamp(3px, 1vw, 8px); align-items: flex-start; flex-wrap: nowrap; }
.kl-gap { width: clamp(6px, 3vw, 34px); }
.kl-slot { border: 0; background: transparent; padding: 0; cursor: pointer; position: relative; display: flex; }
.kl-waste { min-width: clamp(38px, 9vw, 58px); }
.kl-waste .is-stacked { margin-right: calc(clamp(38px, 9vw, 58px) * -0.72); }
.kl-cols { display: flex; gap: clamp(3px, 1vw, 8px); align-items: flex-start; }
.kl-col { display: flex; flex-direction: column; min-height: 80px; }
.kl-col .kl-card + .kl-card { margin-top: calc(clamp(38px, 9vw, 58px) * -1.16); }
.kl-col .pc { position: relative; }
.kl-drop { cursor: pointer; border: 0; }
.sp-cols .kl-col .kl-card + .kl-card { margin-top: calc(clamp(30px, 7vw, 48px) * -1.16); }
.sp-cols .pc { width: clamp(30px, 7vw, 48px); }

.py-pyr { display: grid; gap: calc(clamp(34px, 8vw, 52px) * -0.28); justify-items: center; }
.py-line { display: flex; gap: 4px; }
.py-pyr .pc { width: clamp(34px, 8vw, 52px); }
.py-card.is-locked { filter: brightness(.62); }
.py-gone { width: clamp(34px, 8vw, 52px); aspect-ratio: 5/7; background: transparent; box-shadow: none; }
.py-row { display: flex; gap: 10px; align-items: center; }
.py-hint { font-size: .78rem; color: #9FB0C8; }

/* ---------------------------------------------------- CARTE NAPOLETANE */
.nc {
  width: clamp(42px, 10vw, 62px); aspect-ratio: 5 / 7;
  border-radius: 6px; position: relative; flex: 0 0 auto;
  background: #FAF6EC; color: #2A2018;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  display: grid; place-items: center;
}
.nc-v { position: absolute; top: 3px; left: 5px; font-size: clamp(10px, 2.4vw, 14px); font-weight: 800; }
.nc-s { font-size: clamp(17px, 4.4vw, 26px); }
.nc-den { color: #B8860B; }
.nc-cop { color: #C8102E; }
.nc-spa { color: #1E4D8C; }
.nc-bas { color: #2E7D32; }
.nc-down { background: repeating-linear-gradient(45deg, #8B2635 0 5px, #6B1D28 5px 10px); }
.nc-empty { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); }
.nc.is-mine { cursor: pointer; transition: transform .12s; }
.nc.is-mine:hover { transform: translateY(-6px); }
.nc.is-trump { box-shadow: 0 0 0 2px #F0B429, 0 1px 3px rgba(0,0,0,.35); }
.nc.is-pick { cursor: pointer; outline: 3px solid #17B58F; outline-offset: 2px; }
.nc.is-small { width: clamp(30px, 7vw, 42px); }

.sc, .br, .rb { display: grid; gap: 10px; justify-items: center; width: 100%; }
.sc-opp, .sc-hand, .sc-table, .br-opp, .br-hand, .do-opp, .do-hand {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; min-height: 40px;
}
.sc-table { padding: 10px; background: rgba(255,255,255,.04); border-radius: 10px; min-height: 76px; width: 100%; }
.rb-pile { display: flex; align-items: center; gap: 5px; margin-left: 10px; }
.br-mid { display: flex; gap: clamp(10px, 5vw, 40px); align-items: center; justify-content: center; }
.br-deck { display: flex; align-items: center; gap: 4px; position: relative; }
.br-trump { margin-left: -28px; transform: rotate(90deg); }
.br-count { font-size: .74rem; color: #7E8EA8; margin-left: 22px; }
.br-trick { display: flex; gap: 8px; }
.br-slot { display: grid; place-items: center; }

/* ------------------------------------------------------------------ TRIS */
.tt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 52vh, 340px); aspect-ratio: 1; }
.tt-cell {
  border: 0; border-radius: 12px; background: #1B2436; cursor: pointer;
  font-size: clamp(30px, 11vw, 62px); font-weight: 800; color: #E8ECF4;
  display: grid; place-items: center;
}
.tt-cell:hover:not(:disabled) { background: #24324A; }
.tt-cell.is-x { color: #5B84FF; }
.tt-cell.is-o { color: #FF8A9B; }
.tt-cell.is-win { background: #17B58F; color: #fff; }
.tt-cell:disabled { cursor: default; }

/* --------------------------------------------------------------- FORZA 4 */
.c4-board { display: grid; grid-template-columns: repeat(var(--w), 1fr); gap: 5px; width: min(100%, 56vh, 440px); background: #24489E; padding: 8px; border-radius: 12px; }
.c4-cell { aspect-ratio: 1; border: 0; border-radius: 50%; background: #0E1117; cursor: pointer; padding: 0; }
.c4-cell:hover { filter: brightness(1.4); }
.c4-cell.is-r { background: #E8394F; }
.c4-cell.is-g { background: #F0B429; }
.c4-cell.is-win { box-shadow: 0 0 0 3px #fff; }

/* ------------------------------------------------------------------ DAMA */
.dm-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 58vh, 440px); aspect-ratio: 1; border: 3px solid #3B2B1A; border-radius: 6px; overflow: hidden; }
.dm-sq { border: 0; padding: 0; display: grid; place-items: center; cursor: default; }
.dm-sq.is-light { background: #E8D9BE; }
.dm-sq.is-dark { background: #7A5638; cursor: pointer; }
.dm-sq.is-movable { box-shadow: inset 0 0 0 3px rgba(240,180,41,.65); }
.dm-sq.is-sel { box-shadow: inset 0 0 0 4px #F0B429; }
.dm-sq.is-target { box-shadow: inset 0 0 0 4px #17B58F; }
.dm-p { width: 72%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; }
.dm-p.is-white { background: #F4F1EA; color: #8A6A2F; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.dm-p.is-black { background: #22262E; color: #E8C46A; box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); }

/* --------------------------------------------------------------- REVERSI */
.rv-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: min(100%, 58vh, 440px); aspect-ratio: 1; background: #0B3D2E; padding: 4px; border-radius: 8px; }
.rv-sq { border: 0; background: #14614A; padding: 0; display: grid; place-items: center; cursor: pointer; border-radius: 3px; }
.rv-sq.is-legal { box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.rv-sq.is-legal::after { content: ''; width: 24%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.3); }
.rv-p { width: 80%; aspect-ratio: 1; border-radius: 50%; display: block; }
.rv-sq.is-black .rv-p { background: #14181F; box-shadow: inset 0 -3px 0 rgba(0,0,0,.4); }
.rv-sq.is-white .rv-p { background: #F4F6FA; box-shadow: inset 0 -3px 0 rgba(0,0,0,.14); }

/* ------------------------------------------------------- BATTAGLIA NAVALE */
.bn2 { display: grid; gap: 10px; justify-items: center; width: 100%; }
.bn2-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bn2-grids { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.bn2-side { display: grid; gap: 6px; justify-items: center; }
.bn2-h { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #9FB0C8; margin: 0; font-weight: 700; }
.bn2-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 1px; width: min(100%, 42vh, 300px); aspect-ratio: 1; background: #1B3550; padding: 2px; border-radius: 5px; }
.bn2-c { border: 0; padding: 0; background: #0E2439; cursor: default; }
.bn2-grid.is-enemy .bn2-c { cursor: crosshair; }
.bn2-grid.is-enemy .bn2-c:hover { background: #16334E; }
.bn2-c.is-ship { background: #4A5C7E; }
.bn2-c.is-miss { background: #0E2439; box-shadow: inset 0 0 0 4px rgba(255,255,255,.14); border-radius: 50%; }
.bn2-c.is-hit { background: #F0A22E; }
.bn2-c.is-sunk { background: #C8102E; }
.bn2-c.is-preview { background: #17B58F; }
.bn2-c.is-bad { background: #C8102E; }

/* ---------------------------------------------------------------- DOMINO */
.do { display: grid; gap: 10px; justify-items: center; width: 100%; }
.do-chain { display: flex; gap: 3px; overflow-x: auto; padding: 10px; background: rgba(255,255,255,.04); border-radius: 10px; width: 100%; min-height: 62px; align-items: center; }
.do-t { display: flex; background: #FAF6EC; border-radius: 5px; padding: 3px; gap: 2px; flex: 0 0 auto; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.do-h { width: clamp(20px, 5vw, 28px); aspect-ratio: 1; display: grid; place-items: center; font-weight: 800; color: #2A2018; font-size: clamp(11px, 2.8vw, 16px); background: #F2ECDC; border-radius: 3px; }
.do-t.is-down { background: repeating-linear-gradient(45deg, #2F5BFF 0 5px, #24489E 5px 10px); width: clamp(46px, 11vw, 64px); aspect-ratio: 2/1; }
.do-t.is-double { outline: 2px solid #F0B429; }
.do-t.is-ok { cursor: pointer; }
.do-t.is-no { opacity: .42; }
.do-t.is-sel { outline: 3px solid #17B58F; }
.do-ends { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.do-ask { font-size: .82rem; color: #9FB0C8; }

/* -------------------------------------------------------- CINQUE IN FILA */
.gm-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1px; width: min(100%, 62vh, 520px); aspect-ratio: 1; background: #8A6A42; padding: 2px; border-radius: 4px; }
.gm-sq { border: 0; padding: 0; background: #C8A26A; cursor: pointer; display: grid; place-items: center; }
.gm-sq:hover:not(:disabled) { background: #D4B180; }
.gm-sq.is-x::after, .gm-sq.is-o::after { content: ''; width: 86%; aspect-ratio: 1; border-radius: 50%; }
.gm-sq.is-x::after { background: #14181F; }
.gm-sq.is-o::after { background: #F6F8FB; }
.gm-sq.is-last { box-shadow: inset 0 0 0 2px #2F5BFF; }
.gm-sq.is-win { background: #17B58F; }

/* ------------------------------------------------------ ULTIMO FIAMMIFERO */
.nm { display: grid; gap: 14px; justify-items: center; width: 100%; }
.nm-rows { display: grid; gap: 12px; }
.nm-row { display: flex; gap: 8px; justify-content: center; min-height: 44px; align-items: center; }
.nm-m { width: 14px; height: 52px; border: 0; padding: 0; cursor: pointer; background: linear-gradient(to bottom, #C8102E 0 12px, #D9A066 12px 100%); border-radius: 7px 7px 2px 2px; }
.nm-m.is-picked { opacity: .32; transform: rotate(18deg); }
.nm-empty { font-size: .78rem; color: #6C7A93; font-style: italic; }
.nm-bar { display: flex; gap: 8px; }

/* -------------------------------------------------- PAROLA DEL GIORNO */
.wd { display: grid; gap: 10px; justify-items: center; width: 100%; }
.wd-note { font-size: .82rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.wd-grid { display: grid; gap: 5px; }
.wd-row { display: grid; grid-template-columns: repeat(var(--len), 1fr); gap: 5px; }
.wd-c {
  width: clamp(40px, 11vw, 54px); aspect-ratio: 1; border-radius: 6px;
  display: grid; place-items: center; font-size: clamp(18px, 5vw, 26px); font-weight: 800;
  background: #131A28; box-shadow: inset 0 0 0 2px #2C3A55; color: #E8ECF4;
}
.wd-c.is-typed { box-shadow: inset 0 0 0 2px #5B84FF; }
.wd-c.is-ok { background: #17B58F; box-shadow: none; color: #fff; }
.wd-c.is-mid { background: #E0A32E; box-shadow: none; color: #fff; }
.wd-c.is-no { background: #39435A; box-shadow: none; color: #C4D0E4; }
.wd-kb { display: grid; gap: 5px; width: 100%; max-width: 500px; }
.wd-kbrow { display: flex; gap: 4px; justify-content: center; }
.wd-k {
  flex: 1 1 0; min-width: 0; max-width: 46px; min-height: 46px;
  border: 0; border-radius: 6px; background: #39435A; color: #E8ECF4;
  font-weight: 700; font-size: .92rem; cursor: pointer;
}
.wd-k-wide { flex: 1.6 1 0; max-width: 72px; font-size: .78rem; }
.wd-k.is-ok { background: #17B58F; }
.wd-k.is-mid { background: #E0A32E; }
.wd-k.is-no { background: #222A3B; color: #6C7A93; }

/* ------------------------------------------------------------- IMPICCATO */
.hg { display: grid; gap: 10px; justify-items: center; width: 100%; }
.hg-svg { width: min(100%, 190px); height: auto; }
.hg-scene { --line: #39435A; --ink-3: #7E8EA8; --err: #FF7183; }
.hg-word { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.hg-l { width: clamp(22px, 6vw, 32px); height: clamp(30px, 8vw, 42px); border-bottom: 3px solid #4A5C7E; display: grid; place-items: center; font-size: clamp(16px, 4.4vw, 24px); font-weight: 800; }
.hg-l.is-on { color: #17B58F; }
.hg-hint { font-size: .82rem; color: #9FB0C8; }
.hg-kb { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 480px; }
.hg-k { width: 38px; height: 42px; border: 0; border-radius: 6px; background: #39435A; color: #E8ECF4; font-weight: 700; cursor: pointer; }
.hg-k.is-right { background: #17B58F; }
.hg-k.is-wrong { background: #222A3B; color: #6C7A93; }
.hg-k:disabled { cursor: default; }

/* ------------------------------------------------------------ ANAGRAMMI */
.ag { display: grid; gap: 12px; justify-items: center; width: 100%; }
.ag-note { font-size: .84rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.ag-slots, .ag-pool { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ag-slot { width: clamp(38px, 10vw, 50px); aspect-ratio: 1; border-radius: 8px; background: #131A28; box-shadow: inset 0 0 0 2px #2C3A55; display: grid; place-items: center; font-size: clamp(17px, 4.6vw, 24px); font-weight: 800; }
.ag-slot.is-filled { background: #2F5BFF; box-shadow: none; color: #fff; }
.ag-tile { width: clamp(38px, 10vw, 50px); aspect-ratio: 1; border: 0; border-radius: 8px; background: #F4F6FA; color: #16202E; font-size: clamp(17px, 4.6vw, 24px); font-weight: 800; cursor: pointer; }
.ag-tile.is-used { opacity: .22; cursor: default; }
.ag-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ------------------------------------------------------ PAROLE INTRECCIATE */
.pi { display: grid; gap: 10px; justify-items: center; width: 100%; }
.pi-head { font-size: .84rem; color: #9FBBFF; font-weight: 700; }
.pi-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1px; width: min(100%, 56vh, 460px); aspect-ratio: 1; -webkit-user-select: none; user-select: none; touch-action: none; }
.pi-c { display: grid; place-items: center; background: #131A28; font-size: clamp(10px, 2.4vw, 16px); font-weight: 700; color: #C4D0E4; border-radius: 3px; }
.pi-c.is-sel { background: #2F5BFF; color: #fff; }
.pi-c.is-found { background: #17B58F; color: #fff; }
.pi-list { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pi-w { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: #1B2436; color: #C4D0E4; }
.pi-w.is-done { background: #17B58F; color: #fff; text-decoration: line-through; opacity: .75; }

/* ----------------------------------------------------- GRIGLIA DI PAROLE */
.gp { display: grid; gap: 10px; justify-items: center; width: 100%; }
.gp-cur { font-size: 1.25rem; font-weight: 800; letter-spacing: .12em; min-height: 1.4em; color: #9FBBFF; }
.gp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; width: min(100%, 48vh, 330px); aspect-ratio: 1; -webkit-user-select: none; user-select: none; touch-action: none; }
.gp-c { display: grid; place-items: center; background: #F4F6FA; color: #16202E; border-radius: 10px; font-size: clamp(20px, 6vw, 32px); font-weight: 800; }
.gp-c.is-sel { background: #2F5BFF; color: #fff; }
.gp-note { font-size: .82rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.gp-list { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-height: 90px; overflow-y: auto; }
.gp-w { font-size: .74rem; padding: 2px 8px; border-radius: 999px; background: #1B2436; color: #9FBBFF; }

/* ----------------------------------------------------------------- COPPIE */
.mm-board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 7px; width: min(100%, 58vh, 470px); }
.mm-card {
  aspect-ratio: 3 / 4; border: 0; border-radius: 9px; cursor: pointer; padding: 6px;
  background: repeating-linear-gradient(45deg, #2F5BFF 0 6px, #24489E 6px 12px);
  display: grid; place-items: center;
}
.mm-card.is-up { background: #F4F6FA; }
.mm-card.is-done { background: #D6F5EA; }
.mm-sym { width: 76%; height: 76%; }

/* -------------------------------------------------------- SEQUENZA LUMINOSA */
.sq { display: grid; gap: 10px; justify-items: center; }
.sq-note { font-size: .86rem; color: #9FB0C8; min-height: 1.2em; }
.sq-disc { position: relative; width: min(100%, 52vh, 330px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #0F1420; }
.sq-pad { position: absolute; width: 50%; height: 50%; border: 0; cursor: pointer; background: var(--pad); opacity: .58; transition: opacity .1s; }
.sq-pad:hover { opacity: .75; }
.sq-pad.is-lit { opacity: 1; box-shadow: 0 0 40px var(--pad); }
.sq-p0 { top: 0; left: 0; border-radius: 100% 0 0 0; }
.sq-p1 { top: 0; right: 0; border-radius: 0 100% 0 0; }
.sq-p2 { bottom: 0; right: 0; border-radius: 0 0 100% 0; }
.sq-p3 { bottom: 0; left: 0; border-radius: 0 0 0 100%; }
.sq-center {
  position: absolute; inset: 32%; border-radius: 50%; background: #0F1420;
  display: grid; place-items: center; color: #fff; font-size: 1.7rem; font-weight: 800;
  box-shadow: 0 0 0 4px #1B2436;
}

/* -------------------------------------------------------- RICORDA I NUMERI */
.rn { display: grid; gap: 12px; justify-items: center; width: 100%; }
.rn-note { font-size: .86rem; color: #9FB0C8; min-height: 1.2em; }
.rn-display {
  font-family: var(--font-num); font-size: clamp(26px, 8vw, 52px); font-weight: 800;
  letter-spacing: .14em; color: #9FB0C8; min-height: 1.4em;
  background: rgba(255,255,255,.05); border-radius: 12px; padding: 12px 22px; min-width: 60%;
  text-align: center;
}
.rn-display.is-show { color: #fff; }
.rn-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 400px); }
.rn-k { border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5; border-radius: 8px; padding: 12px 0; font-weight: 700; font-size: 1.05rem; cursor: pointer; min-height: 46px; }
.rn-k:disabled { opacity: .35; }

/* ---------------------------------------------------------- MEMORIA VISIVA */
.mv { display: grid; gap: 12px; justify-items: center; width: 100%; }
.mv-note { font-size: .86rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.mv-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 7px; width: min(100%, 52vh, 380px); aspect-ratio: 1; }
.mv-c { border: 0; border-radius: 10px; background: #1B2436; cursor: pointer; }
.mv-c.is-lit { background: #FF8A2B; }
.mv-c.is-ok { background: #17B58F; }
.mv-c.is-bad { background: #C8102E; }

/* ------------------------------------------------------ TROVA LE DIFFERENZE */
.td { display: grid; gap: 10px; justify-items: center; width: 100%; }
.td-note { font-size: .84rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.td-pair { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.td-box { --surface: #131A28; width: min(calc(50% - 6px), 38vh, 260px); min-width: 130px; border-radius: 10px; overflow: hidden; }
.td-svg { width: 100%; height: auto; display: block; cursor: crosshair; }
.td-o { cursor: crosshair; }
.td-ring { fill: none; stroke: #17B58F; stroke-width: 4; }

/* -------------------------------------------------------- UNISCI I NUMERI */
.un { display: grid; gap: 10px; justify-items: center; width: 100%; }
.un-bar { display: flex; gap: 8px; }
.un-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 7px; width: min(100%, 56vh, 420px); aspect-ratio: 1; background: #1B2436; padding: 7px; border-radius: 10px; touch-action: none; }
.un-t { border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: clamp(16px, 5vw, 30px); color: #16202E; background: #263149; }
.un-t.is-empty { background: rgba(255,255,255,.05); }
.un-t.is-small { font-size: clamp(13px, 4vw, 24px); }
.un-t.is-tiny { font-size: clamp(11px, 3.2vw, 19px); }
.un-t.v2{background:#EEE4DA}.un-t.v4{background:#EDE0C8}
.un-t.v8{background:#F2B179;color:#fff}.un-t.v16{background:#F59563;color:#fff}
.un-t.v32{background:#F67C5F;color:#fff}.un-t.v64{background:#F65E3B;color:#fff}
.un-t.v128{background:#EDCF72;color:#fff}.un-t.v256{background:#EDCC61;color:#fff}
.un-t.v512{background:#EDC850;color:#fff}.un-t.v1024{background:#EDC53F;color:#fff}
.un-t.v2048{background:#2F5BFF;color:#fff}.un-t.v4096{background:#7B2FF7;color:#fff}

/* ------------------------------------------------------- TEST DI REAZIONE */
.tr { display: grid; gap: 12px; justify-items: center; width: 100%; }
.tr-pad {
  width: min(100%, 520px); min-height: min(38vh, 230px);
  border: 0; border-radius: 16px; cursor: pointer;
  font-size: clamp(17px, 4.4vw, 28px); font-weight: 800; color: #fff;
  background: #39435A; display: grid; place-items: center; padding: 20px; text-align: center;
}
.tr-pad.is-idle { background: #2F5BFF; }
.tr-pad.is-wait { background: #C8102E; }
.tr-pad.is-go { background: #17B58F; }
.tr-pad.is-bad { background: #7A2030; }
.tr-pad.is-rest, .tr-pad.is-done { background: #39435A; }
.tr-list { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tr-chip { font-size: .78rem; padding: 4px 11px; border-radius: 999px; background: #1B2436; color: #6C7A93; font-family: var(--font-num); }
.tr-chip.is-set { background: #2F5BFF; color: #fff; }

/* ---------------------------------------------------------- CALCOLO RAPIDO */
.cr { display: grid; gap: 10px; justify-items: center; width: 100%; }
.cr-ops { display: flex; gap: 6px; }
.cr-op { width: 42px; height: 38px; border: 1px solid #2C3A55; background: #1B2436; color: #9FB0C8; border-radius: 8px; font-size: 1.05rem; font-weight: 700; cursor: pointer; }
.cr-op[aria-pressed="true"] { background: #2F5BFF; border-color: #2F5BFF; color: #fff; }
.cr-q { font-size: clamp(26px, 8vw, 46px); font-weight: 800; color: #fff; }
.cr-a {
  font-family: var(--font-num); font-size: clamp(24px, 7vw, 40px); font-weight: 800;
  min-height: 1.4em; min-width: 140px; text-align: center; color: #9FBBFF;
  background: rgba(255,255,255,.05); border-radius: 10px; padding: 6px 18px;
}
.cr-a.is-ok { background: #17B58F; color: #fff; }
.cr-a.is-bad { background: #C8102E; color: #fff; }
.cr-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: min(100%, 440px); }
.cr-k { border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5; border-radius: 8px; padding: 12px 0; font-weight: 700; font-size: 1.02rem; cursor: pointer; min-height: 46px; }
.cr-go { background: #17B58F; border-color: #17B58F; color: #fff; }

/* ------------------------------------------------------------ GIOCO DEL 24 */
.g24 { display: grid; gap: 12px; justify-items: center; width: 100%; }
.g24-note { font-size: .86rem; color: #9FB0C8; min-height: 2.4em; text-align: center; max-width: 46ch; }
.g24-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.g24-n { min-width: clamp(52px, 14vw, 74px); aspect-ratio: 4/5; border: 0; border-radius: 10px; background: #F4F6FA; color: #16202E; font-size: clamp(19px, 5.4vw, 30px); font-weight: 800; cursor: pointer; padding: 4px; }
.g24-n.is-sel { background: #2F5BFF; color: #fff; }
.g24-n:disabled { opacity: .5; cursor: default; }
.g24-ops { display: flex; gap: 8px; }
.g24-op { width: 50px; height: 50px; border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5; border-radius: 10px; font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.g24-op.is-sel { background: #F0B429; border-color: #F0B429; color: #16202E; }
.g24-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ------------------------------------------------------- SEQUENZA NUMERICA */
.sn { display: grid; gap: 12px; justify-items: center; width: 100%; }
.sn-seq { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.sn-n { min-width: clamp(46px, 12vw, 66px); padding: 10px 6px; border-radius: 9px; background: #1B2436; color: #DDE6F5; font-family: var(--font-num); font-size: clamp(16px, 4.4vw, 24px); font-weight: 700; text-align: center; }
.sn-n.is-q { background: #2F5BFF; color: #fff; }
.sn-n.is-q.is-rev { background: #17B58F; }
.sn-note { font-size: .86rem; color: #9FB0C8; min-height: 2.4em; text-align: center; max-width: 48ch; }
.sn-pad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: min(100%, 440px); }
.sn-k { border: 1px solid #2C3A55; background: #1B2436; color: #DDE6F5; border-radius: 8px; padding: 11px 0; font-weight: 700; cursor: pointer; min-height: 44px; }
.sn-go { background: #17B58F; border-color: #17B58F; color: #fff; }
.sn-k:disabled { opacity: .35; }

/* ------------------------------------------------------ ACCHIAPPA LA TALPA */
.tl { display: grid; gap: 12px; justify-items: center; width: 100%; }
.tl-note { font-size: .84rem; color: #9FB0C8; min-height: 1.2em; text-align: center; }
.tl-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 54vh, 400px); }
.tl-h { position: relative; aspect-ratio: 1; border: 0; background: transparent; cursor: pointer; padding: 0; overflow: hidden; }
.tl-dirt { position: absolute; bottom: 0; left: 5%; width: 90%; height: 42%; background: #4A3620; border-radius: 50% 50% 14px 14px / 70% 70% 14px 14px; }
.tl-mole {
  position: absolute; bottom: 8%; left: 22%; width: 56%; aspect-ratio: 1;
  background: #8A6142; border-radius: 50% 50% 40% 40%;
  transform: translateY(120%); transition: transform .12s ease-out;
  box-shadow: inset -6px -8px 0 rgba(0,0,0,.14);
}
.tl-h.is-up .tl-mole { transform: translateY(0); }
.tl-h.is-gold .tl-mole { background: #F0B429; box-shadow: inset -6px -8px 0 rgba(0,0,0,.18), 0 0 20px rgba(240,180,41,.55); }
@media (prefers-reduced-motion: reduce) { .tl-mole { transition: none; } }

/* ---------------------------------------------------------- RESPONSIVE */
@media (max-width: 520px) {
  .stage-mount { padding: 6px; }
  .kl-top, .kl-cols { gap: 3px; }
  .bn2-grids { gap: 10px; }
}

/* I solitari con molte colonne (FreeCell ne ha 8, Spider 10) non entrano in
   360px alla dimensione minima normale delle carte: qui si rimpiccioliscono. */
@media (max-width: 480px) {
  .fc .pc { width: clamp(28px, 7.8vw, 44px); }
  .sp .pc, .sp-cols .pc { width: clamp(24px, 6.6vw, 40px); }
  .sp-cols .kl-col .kl-card + .kl-card { margin-top: calc(clamp(24px, 6.6vw, 40px) * -1.16); }
  .fc .kl-col .kl-card + .kl-card { margin-top: calc(clamp(28px, 7.8vw, 44px) * -1.16); }
  .kl-gap { width: 4px; }
}

/* Rete di sicurezza: se una fila di carte resta comunque più larga dello
   spazio disponibile, scorre da sola invece di sfondare la pagina. */
.kl-top, .kl-cols { max-width: 100%; overflow-x: auto; overflow-y: visible; }
