/* Scacchi CGFA — "tavolino di marmo del caffè": scacchiera intarsiata, filetto d'ottone, piano espresso, scontrino del bar. */
@font-face { font-family: 'Bodoni Moda'; src: url(../fonts/bodoni.woff2) format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url(../fonts/bodoni-italic.woff2) format('woff2'); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Albert Sans'; src: url(../fonts/albert.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Spline Sans Mono'; src: url(../fonts/mono.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --espresso: #1d1611;
  --espresso-2: #271d17;
  --espresso-3: #33271f;
  --crema: #d9b48a;
  --ottone: #c9a35a;
  --ottone-chiaro: #ead19a;
  --ottone-scuro: #8a6a30;
  --carrara: #ecebe7;
  --carrara-2: #dedcd6;
  --vena: #b9b8b3;
  --inchiostro: #241c17;
  --inchiostro-2: #5b4f46;
  --verde: #1f3d31;
  --verde-2: #2b5243;
  --rosso: #c63f2c;
  --carta: #f7f6f1;
  --raggio: 10px;
  --ombra: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', serif;
  --testo: 'Albert Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Spline Sans Mono', ui-monospace, 'Cascadia Mono', monospace;
  --lato: min(calc(100vw - 52px), calc(100dvh - 300px), 640px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--testo); color: var(--carrara); background: var(--espresso);
  background-image:
    radial-gradient(120% 70% at 50% 0%, rgba(217, 180, 138, .10), transparent 60%),
    repeating-linear-gradient(92deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #221a14, #17110d);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--ottone); color: var(--espresso); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ottone-chiaro); outline-offset: 2px; border-radius: 6px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- testata ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.testata { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 10px; flex: none; }
.marchio { display: flex; align-items: baseline; gap: 6px; color: var(--carrara); text-decoration: none; }
.marchio-nome { font-family: var(--display); font-size: 25px; font-weight: 700; letter-spacing: .01em; }
.marchio-al { font-family: var(--display); font-style: italic; color: var(--ottone); font-size: 16px; }
.testata-stato { margin-left: auto; font-size: 13px; color: var(--crema); }
.tasto-icona { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--carrara); transition: background .15s; }
.tasto-icona:hover { background: rgba(255, 255, 255, .07); }
.tasto-icona.piccolo { width: 38px; height: 38px; }
.tasto-icona.piccolo svg { width: 18px; height: 18px; }

/* ---------- tavolo ---------- */
.tavolo { flex: 1; display: grid; grid-template-columns: 1fr; justify-items: center; align-content: start; gap: 6px; padding: 0 12px 10px; }
.giocatore { width: calc(var(--lato) + 28px); display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'chi orologio' 'prese orologio'; align-items: center; column-gap: 10px; min-height: 48px; padding: 0 2px; }
.g-chi { grid-area: chi; display: flex; align-items: center; gap: 8px; min-width: 0; }
.g-nome { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sotto { font-size: 12.5px; color: var(--crema); white-space: nowrap; }
.g-pallino { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px var(--ottone-scuro); }
.g-pallino[data-colore="w"] { background: #f3f1ea; }
.g-pallino[data-colore="b"] { background: #141110; }
.giocatore.al-tratto .g-nome { color: var(--ottone-chiaro); }
.giocatore.al-tratto .g-pallino { box-shadow: 0 0 0 2px var(--ottone-chiaro), 0 0 10px rgba(234, 209, 154, .6); }
.g-prese { grid-area: prese; display: flex; align-items: center; min-height: 20px; flex-wrap: wrap; }
.g-prese img { width: 17px; height: 17px; margin-right: -5px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.g-prese .vantaggio { margin-left: 10px; font-size: 12px; color: var(--crema); font-family: var(--mono); }

/* orologio: piattino d'ottone, acceso solo quando corre */
.orologio { grid-area: orologio; min-width: 98px; padding: 7px 14px; border-radius: 999px; text-align: center; background: var(--espresso-3); box-shadow: inset 0 0 0 1.5px var(--ottone-scuro), inset 0 2px 6px rgba(0, 0, 0, .5); transition: background .25s, color .25s, box-shadow .25s; }
.orologio-cifre { font-family: var(--mono); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: #a8998b; }
.orologio.corre { background: linear-gradient(180deg, var(--ottone-chiaro), var(--ottone) 55%, #b48d45); box-shadow: 0 0 0 1px #6d521f, 0 4px 18px rgba(201, 163, 90, .35), inset 0 1px 0 rgba(255, 255, 255, .5); }
.orologio.corre .orologio-cifre { color: var(--inchiostro); }
.orologio.corre.poco { background: linear-gradient(180deg, #e8735f, var(--rosso)); box-shadow: 0 0 0 1px #6e1e12, 0 4px 18px rgba(198, 63, 44, .45); animation: batte 1s steps(2) infinite; }
.orologio.corre.poco .orologio-cifre { color: #fff; }
@keyframes batte { 50% { box-shadow: 0 0 0 1px #6e1e12, 0 2px 8px rgba(198, 63, 44, .2); } }

/* ---------- cornice d'ottone e scacchiera ---------- */
.scacchiera-cornice {
  position: relative; padding: 14px; border-radius: 6px;
  background: linear-gradient(135deg, #e9cf92 0%, #b98f43 22%, #f1dca6 46%, #9c7533 70%, #d8b46a 100%);
  box-shadow: 0 2px 0 #5b4219, 0 18px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.scacchiera-cornice::before { content: ''; position: absolute; inset: 11px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(80, 56, 18, .7), inset 0 0 0 1px rgba(255, 240, 200, .35); pointer-events: none; }
.scacchiera { position: relative; width: var(--lato); height: var(--lato); touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: inset 0 0 0 1px rgba(60, 40, 10, .5); }
.marmo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.case { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.casa { position: relative; }
.casa.ultima { background: rgba(214, 170, 82, .38); }
.casa.selez { background: rgba(234, 209, 154, .5); box-shadow: inset 0 0 0 3px rgba(138, 106, 48, .9); }
.casa.bersaglio::after { content: ''; position: absolute; left: 50%; top: 50%; width: 26%; height: 26%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6e2ae, #b8913f 70%); box-shadow: 0 1px 2px rgba(0, 0, 0, .45); opacity: .92; }
.casa.bersaglio-presa::after { content: ''; position: absolute; inset: 5%; border-radius: 50%; border: 4px solid rgba(201, 163, 90, .9); box-shadow: 0 0 0 1px rgba(60, 40, 10, .35), inset 0 0 0 1px rgba(60, 40, 10, .35); }
.casa.scacco { background: radial-gradient(circle, rgba(232, 72, 46, .95) 0%, rgba(198, 63, 44, .55) 45%, transparent 75%); }
.casa.suggerita { box-shadow: inset 0 0 0 3px #4fae8a, inset 0 0 18px rgba(79, 174, 138, .55); }
.pezzi { position: absolute; inset: 0; pointer-events: none; }
.pezzo { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; will-change: transform; transition: transform .2s cubic-bezier(.2, .8, .25, 1), opacity .25s; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.pezzo.nuovo, .pezzo.via { opacity: 0; }
.pezzo.trascinato { transition: none; z-index: 5; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .5)); }
.coordinate { position: absolute; display: flex; font-family: var(--mono); font-size: 9.5px; font-weight: 600; color: #5d4316; text-shadow: 0 1px 0 rgba(255, 240, 200, .6); pointer-events: none; }
.coordinate-col { left: 14px; right: 14px; bottom: 0; height: 14px; }
.coordinate-col span { flex: 1; text-align: center; line-height: 14px; }
.coordinate-trav { top: 14px; bottom: 14px; left: 0; width: 14px; flex-direction: column; }
.coordinate-trav span { flex: 1; display: flex; align-items: center; justify-content: center; }
.senza-coord .coordinate { display: none; }
.vista-passata .scacchiera { filter: saturate(.75) brightness(.92); }
.avviso-tavolo { position: absolute; left: 50%; bottom: 26px; transform: translate(-50%, 10px); max-width: calc(100% - 40px); padding: 9px 16px; border-radius: 999px; background: rgba(29, 22, 17, .92); color: var(--carrara); font-size: 14px; font-weight: 550; text-align: center; box-shadow: var(--ombra); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .25, 1); }
.avviso-tavolo.visibile { opacity: 1; transform: translate(-50%, 0); }

/* ---------- colonna: scontrino + comandi ---------- */
.colonna { width: calc(var(--lato) + 28px); display: flex; flex-direction: column; gap: 8px; }
.scontrino { position: relative; background: var(--carta); color: var(--inchiostro); border-radius: 3px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); padding: 8px 10px 6px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'testa nav' 'mosse mosse'; align-items: center; column-gap: 8px; }
.scontrino::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; background: linear-gradient(-45deg, transparent 4px, var(--carta) 0) 0 0 / 8px 8px, linear-gradient(45deg, transparent 4px, var(--carta) 0) 0 0 / 8px 8px; }
.scontrino-testa { grid-area: testa; display: flex; gap: 8px; align-items: baseline; min-width: 0; font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.scontrino-titolo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scontrino-info { color: var(--inchiostro-2); white-space: nowrap; }
.scontrino-nav { grid-area: nav; display: flex; }
.scontrino-nav .tasto-icona { color: var(--inchiostro); }
.scontrino-nav .tasto-icona:hover { background: rgba(0, 0, 0, .06); }
.mosse { grid-area: mosse; list-style: none; margin: 4px 0 0; padding: 4px 0 2px; border-top: 1px dashed #b9b4a8; display: flex; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #c9c3b6 transparent; font-family: var(--mono); font-size: 14px; min-height: 36px; align-items: center; }
.mosse li { display: flex; align-items: center; flex: none; margin-right: 6px; }
.mosse li.vuoto { font-size: 12px; color: var(--inchiostro-2); font-family: var(--testo); }
.mosse .n { color: #8b8174; font-size: 12px; margin-right: 2px; font-variant-numeric: tabular-nums; }
.mosse .m { border: 0; background: none; padding: 4px 6px; border-radius: 4px; font-family: var(--mono); font-size: 14px; color: var(--inchiostro); white-space: nowrap; }
.mosse .m:hover { background: rgba(0, 0, 0, .06); }
.mosse .m.attuale { background: var(--inchiostro); color: var(--carta); }
.mosse .m i { font-style: normal; font-weight: 700; margin-left: 1px; }
.mosse .g-grave i, .mosse .g-errore i { color: var(--rosso); }
.mosse .g-imprecisione i { color: #b3801f; }
.mosse .m.attuale i { color: var(--ottone-chiaro); }
.comandi { display: flex; gap: 6px; }
.comando { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 7px; min-height: 56px; border: 0; border-radius: var(--raggio); background: var(--espresso-3); color: var(--carrara); font-size: 12px; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .3); transition: background .15s, transform .1s; }
.comando:hover:not(:disabled) { background: #3e3027; }
.comando:active:not(:disabled) { transform: translateY(1px); }
.comando:disabled { opacity: .38; cursor: default; }
.comando svg { color: var(--ottone); }
.comando.evidente { background: var(--ottone); color: var(--inchiostro); }
.comando.evidente svg { color: var(--inchiostro); }

/* ---------- fogli ---------- */
.velo { position: fixed; inset: 0; z-index: 20; background: rgba(12, 8, 6, .55); backdrop-filter: blur(2px); animation: appare .2s ease-out; }
.foglio {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; color: var(--inchiostro);
  background:
    linear-gradient(115deg, transparent 38%, rgba(160, 158, 152, .16) 39%, transparent 41.5%),
    linear-gradient(160deg, transparent 62%, rgba(160, 158, 152, .12) 63%, transparent 64.2%),
    radial-gradient(90% 60% at 20% 0%, #f7f6f3, transparent),
    var(--carrara);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .45), inset 0 1px 0 #fff;
  animation: sale .28s cubic-bezier(.2, .8, .25, 1);
}
.foglio::before { content: ''; position: sticky; display: block; top: -14px; margin: -12px auto 12px; width: 40px; height: 4px; border-radius: 2px; background: #c3c0b8; }
@keyframes sale { from { transform: translateY(40px); opacity: 0; } }
@keyframes appare { from { opacity: 0; } }
.foglio h1, .foglio h2 { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.1; margin: 4px 44px 6px 0; letter-spacing: -.005em; }
.foglio .titolo-grande { font-size: 40px; margin-right: 44px; }
.foglio .chiudi { position: absolute; right: 10px; top: 12px; color: var(--inchiostro); }
.foglio .chiudi:hover { background: rgba(0, 0, 0, .06); }
.sottotitolo { margin: 0 0 16px; color: var(--inchiostro-2); font-size: 15.5px; line-height: 1.45; max-width: 60ch; }
.sottotitolo.piccolo { font-size: 13px; }
.etichetta { margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--inchiostro-2); }
.nota { font-size: 13px; color: var(--inchiostro-2); line-height: 1.45; }
.credit { margin: 18px 0 0; font-size: 13px; color: var(--inchiostro-2); text-align: center; }
.credit a { color: var(--inchiostro); font-weight: 700; text-underline-offset: 3px; }
.link { border: 0; background: none; padding: 6px 2px; color: var(--verde-2); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* foglio iniziale: il tavolino */
.foglio-inizio { overflow-x: hidden; }
.tazzina { position: absolute; right: -46px; top: -40px; width: 190px; height: 190px; pointer-events: none; }
.tazzina circle { stroke: #8a5a34; stroke-opacity: .16; stroke-width: 3.5; stroke-dasharray: 160 6 40 9 120 4; }
.tazzina circle + circle { stroke-width: 1.5; stroke-opacity: .12; stroke-dasharray: 90 12 200 5; }
.voce-grande { display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 8px; padding: 14px 16px; border: 1px solid #cfccc4; border-radius: 12px; background: rgba(255, 255, 255, .55); color: var(--inchiostro); text-align: left; box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(60, 40, 20, .08); transition: background .15s, transform .12s, box-shadow .15s; }
.voce-grande:hover { background: #fff; box-shadow: 0 1px 0 #fff inset, 0 6px 16px rgba(60, 40, 20, .12); }
.voce-grande:active { transform: scale(.99); }
.voce-grande svg { width: 28px; height: 28px; color: var(--ottone-scuro); }
.voce-grande span { display: flex; flex-direction: column; gap: 2px; }
.voce-grande strong { font-size: 17px; }
.voce-grande small { font-size: 13.5px; color: var(--inchiostro-2); }
.voce-grande.principale { background: var(--verde); border-color: var(--verde); color: var(--carrara); box-shadow: 0 6px 16px rgba(31, 61, 49, .35); }
.voce-grande.principale:hover { background: var(--verde-2); }
.voce-grande.principale small { color: #b7cdbf; }
.voce-grande.principale svg { color: var(--ottone-chiaro); }
.riga-link { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 10px; }

/* scelte */
.livelli { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.livelli button, .cadenze button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 12px; border: 1px solid #cfccc4; border-radius: 10px; background: rgba(255, 255, 255, .55); text-align: left; transition: background .15s, border-color .15s; }
.livelli button:hover, .cadenze button:hover { background: #fff; }
.livelli button[aria-checked="true"], .cadenze button[aria-checked="true"] { background: var(--verde); border-color: var(--verde); color: var(--carrara); }
.livelli strong, .cadenze strong { font-size: 15.5px; }
.livelli small, .cadenze small { font-size: 12.5px; color: var(--inchiostro-2); line-height: 1.3; }
.livelli [aria-checked="true"] small, .cadenze [aria-checked="true"] small { color: #b7cdbf; }
.pedine { display: flex; gap: 3px; height: 9px; }
.pedine i { width: 9px; height: 9px; border-radius: 50%; background: var(--ottone); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.cadenze { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 14px; }
.cadenze button { align-items: center; padding: 10px 4px; text-align: center; }
.cadenze strong { font-family: var(--mono); font-size: 15px; white-space: nowrap; }
.segmenti { display: flex; padding: 3px; border-radius: 11px; background: var(--carrara-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); }
.segmenti button { flex: 1; min-height: 40px; padding: 8px 6px; border: 0; border-radius: 8px; background: none; font-weight: 600; font-size: 14px; color: var(--inchiostro-2); }
.segmenti button[aria-checked="true"], .segmenti button[aria-selected="true"] { background: #fff; color: var(--inchiostro); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.tasto { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border: 1px solid #c9c5bc; border-radius: 11px; background: #fff; color: var(--inchiostro); font-weight: 650; font-size: 15.5px; transition: background .15s, transform .1s; }
.tasto:hover { background: #f4f2ee; }
.tasto:active { transform: translateY(1px); }
.tasto svg { width: 19px; height: 19px; color: var(--ottone-scuro); }
.tasto.pieno { background: var(--verde); border-color: var(--verde); color: var(--carrara); box-shadow: 0 4px 12px rgba(31, 61, 49, .3); }
.tasto.pieno:hover { background: var(--verde-2); }
.tasto.pieno svg { color: var(--ottone-chiaro); }
.tasto.largo { width: 100%; margin-top: 18px; }
.riga-tasti { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.riga-tasti .tasto { flex: 1 1 140px; }
.colonna-tasti { flex-direction: column; }
.colonna-tasti .tasto { flex: none; width: 100%; }
.separatore { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; font-size: 13px; color: var(--inchiostro-2); }
.separatore::before, .separatore::after { content: ''; flex: 1; height: 1px; background: #cfccc4; }
.entra-codice { display: flex; gap: 8px; }
input:not([type=checkbox]) { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border: 1px solid #c9c5bc; border-radius: 11px; background: #fff; color: var(--inchiostro); font-size: 17px; caret-color: var(--verde); }
input::placeholder { color: #9b9389; }
input:focus { outline: none; border-color: var(--verde-2); box-shadow: 0 0 0 3px rgba(43, 82, 67, .2); }
#codice { font-family: var(--mono); letter-spacing: .3em; text-transform: uppercase; }
#formNome input { width: 100%; }
.spunta { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; font-size: 14px; line-height: 1.4; color: var(--inchiostro-2); }
.spunta input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--verde); flex: none; }
.spunta .link { padding: 0; }
.codice-grande { font-family: var(--mono); font-size: 44px; font-weight: 600; letter-spacing: .22em; text-align: center; padding: 18px 10px 18px 20px; border-radius: 12px; background: var(--carta); border: 1px dashed #b9b4a8; color: var(--inchiostro); user-select: all; }
.attesa-punti { text-align: center; font-weight: 650; margin: 18px 0 4px; }
.attesa-punti::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: puntini 1.4s steps(4) infinite; }
@keyframes puntini { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.ricerca { display: flex; justify-content: center; gap: 10px; margin: 10px 0 0; }
.ricerca span { width: 14px; height: 14px; border-radius: 50%; background: var(--ottone); animation: salta 1.1s ease-in-out infinite; }
.ricerca span:nth-child(2) { animation-delay: .15s; background: var(--verde); }
.ricerca span:nth-child(3) { animation-delay: .3s; }
@keyframes salta { 40% { transform: translateY(-12px); } }
#veloceAttesa { text-align: center; }

/* promozione */
.promozione { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.promozione button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid #cfccc4; border-radius: 12px; background: #fff; font-size: 13px; font-weight: 650; text-transform: capitalize; }
.promozione button:hover { border-color: var(--verde); background: #f4f8f5; }
.promozione img { width: 100%; max-width: 72px; aspect-ratio: 1; }

/* fine partita */
.fine-esito { margin: 0; font-family: var(--display); font-size: 64px; font-weight: 700; line-height: 1; color: var(--ottone-scuro); font-variant-numeric: lining-nums; }
.fine-elo { font-size: 17px; margin: 0 0 10px; }
.fine-elo strong { color: var(--verde-2); }
.fine-rebattle { font-size: 14px; color: var(--inchiostro-2); }

/* analisi */
.barra-avanzamento { height: 6px; border-radius: 3px; background: var(--carrara-2); overflow: hidden; margin: 0 0 14px; }
.barra-avanzamento span { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s; }
.grafico { width: 100%; height: 130px; border-radius: 8px; overflow: hidden; cursor: crosshair; box-shadow: inset 0 0 0 1px #c9c5bc; }
.grafico .g-fondo { fill: #2a2420; }
.grafico .g-bianco { fill: #f1efe9; }
.grafico .g-zero { stroke: var(--ottone); stroke-width: .6; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.grafico .g-linea { fill: none; stroke: var(--ottone-scuro); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.grafico .g-punto { stroke: #fff; stroke-width: .8; vector-effect: non-scaling-stroke; }
.grafico .g-grave { fill: var(--rosso); }
.grafico .g-errore { fill: #e0892a; }
.analisi-riepilogo { margin: 14px 0 6px; }
.riep { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 7px 0; border-bottom: 1px solid #d6d3cc; font-size: 14px; }
.riep strong { min-width: 80px; }
.valutazione-finale { font-size: 14px; color: var(--inchiostro-2); }
.analisi-lista { list-style: none; margin: 8px 0 0; padding: 0; }
.analisi-lista button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 6px; border: 0; border-bottom: 1px solid #dcd9d2; background: none; text-align: left; font-size: 14.5px; line-height: 1.35; }
.analisi-lista button:hover { background: rgba(255, 255, 255, .6); }
.analisi-lista .segno { width: 30px; flex: none; font-family: var(--mono); font-weight: 700; text-align: center; }
.analisi-lista .perdita { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--inchiostro-2); }
.analisi-lista .g-grave .segno, .analisi-lista .g-errore .segno { color: var(--rosso); }
.analisi-lista .g-imprecisione .segno { color: #9b6c14; }
.vuoto { color: var(--inchiostro-2); font-size: 14px; padding: 10px 0; list-style: none; }

/* problemi */
.griglia-problemi { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 7px; margin-top: 16px; }
.prob { aspect-ratio: 1; border: 1px solid #cfccc4; border-radius: 10px; background: rgba(255, 255, 255, .6); font-family: var(--mono); font-size: 16px; font-weight: 600; }
.prob:hover { background: #fff; border-color: var(--verde-2); }
.prob.risolto { background: var(--verde); border-color: var(--verde); color: var(--ottone-chiaro); }

/* classifica */
.classifica, .storico { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: c; }
.classifica li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #dcd9d2; font-size: 15px; }
.classifica li.sono-io { background: rgba(201, 163, 90, .18); border-radius: 6px; }
.classifica .pos { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ottone-scuro); text-align: center; }
.classifica li:nth-child(-n+3) .pos { color: var(--inchiostro); }
.classifica .nome { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classifica .rec { font-family: var(--mono); font-size: 12px; color: var(--inchiostro-2); }
.classifica .elo { font-family: var(--mono); font-weight: 600; font-size: 16px; }
.mio-profilo { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 12px 14px; border-radius: 12px; background: var(--verde); color: var(--carrara); font-size: 14px; }
.mio-profilo strong { font-size: 17px; width: 100%; }
.mio-profilo b { color: var(--ottone-chiaro); font-family: var(--mono); font-size: 16px; }
.storico li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid #dcd9d2; font-size: 14px; }
.storico li > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.storico small { color: var(--inchiostro-2); font-size: 12px; }
.storico .esito { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.storico .esito.v { background: var(--verde); color: var(--ottone-chiaro); }
.storico .esito.p { background: var(--carrara-2); }
.storico .esito.s { background: #e9c9c2; color: #7d2416; }
.storico .delta { margin-left: auto; font-family: var(--mono); }

/* testi lunghi */
.foglio-testo h3 { font-family: var(--display); font-size: 21px; margin: 22px 0 6px; }
.foglio-testo p, .foglio-testo li { font-size: 15px; line-height: 1.55; max-width: 68ch; }
.foglio-testo ul { padding-left: 20px; }
.foglio-testo li { margin-bottom: 6px; }
.foglio-testo a { color: var(--verde-2); font-weight: 600; }
.indice { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.indice a { padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .7); border: 1px solid #d3d0c8; font-size: 13px; color: var(--inchiostro); text-decoration: none; font-weight: 600; }
.funzioni { list-style: none; padding: 0; margin: 6px 0 0; }
.funzioni li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 't a' 'd a'; gap: 2px 12px; padding: 11px 0; border-bottom: 1px solid #d8d5ce; }
.funzioni strong { grid-area: t; font-size: 15.5px; }
.funzioni span { grid-area: d; font-size: 14px; color: var(--inchiostro-2); line-height: 1.45; }
.funzioni .link { grid-area: a; align-self: center; }

/* impostazioni */
.interruttore { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #d8d5ce; font-size: 16px; font-weight: 550; cursor: pointer; }
.interruttore input { order: 2; appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #c9c5bc; position: relative; transition: background .2s; cursor: pointer; flex: none; }
.interruttore input::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.2, .8, .25, 1); }
.interruttore input:checked { background: var(--verde-2); }
.interruttore input:checked::after { transform: translateX(18px); }

/* menu */
.foglio-menu .menu-marchio { font-family: var(--display); font-size: 26px; font-weight: 700; margin: 2px 0 12px; }
.foglio-menu .menu-marchio em { color: var(--ottone-scuro); font-weight: 500; }
.voce { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--inchiostro); font-size: 16px; font-weight: 550; text-align: left; }
.voce:hover { background: rgba(255, 255, 255, .7); }
.voce svg { color: var(--ottone-scuro); }
.foglio-menu hr { border: 0; border-top: 1px solid #d3d0c8; margin: 8px 0; }

/* guida */
.guida h2 { font-size: 34px; }
.guida p { font-size: 17px; line-height: 1.5; color: var(--inchiostro-2); }
.guida .guida-passo { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ottone-scuro); margin: 0; }

/* avviso */
.avviso { position: fixed; z-index: 50; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--inchiostro); color: var(--carrara); font-weight: 600; font-size: 14.5px; box-shadow: var(--ombra); animation: sale .25s cubic-bezier(.2, .8, .25, 1); }

/* ---------- PC e tablet orizzontale ---------- */
@media (min-width: 720px) {
  .foglio { left: 50%; right: auto; bottom: auto; top: 50%; width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 820px); transform: translate(-50%, -50%); border-radius: 18px; animation: entra .28s cubic-bezier(.2, .8, .25, 1); padding: 28px 28px 26px; }
  .foglio::before { display: none; }
  .foglio-largo { width: min(680px, calc(100vw - 32px)); }
  .foglio-menu { left: 12px; top: 12px; bottom: 12px; transform: none; width: 330px; max-height: none; animation: dalato .28s cubic-bezier(.2, .8, .25, 1); }
  @keyframes entra { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)); } }
  @keyframes dalato { from { opacity: 0; transform: translateX(-20px); } }
}
@media (min-width: 960px) {
  :root { --lato: min(calc(100dvh - 190px), calc(100vw - 470px), 760px); }
  .tavolo { grid-template-columns: auto 340px; grid-template-rows: auto auto auto 1fr; justify-content: center; align-items: start; column-gap: 28px; padding-top: 6px; }
  .giocatore-su { grid-column: 1; grid-row: 1; }
  .scacchiera-cornice { grid-column: 1; grid-row: 2; }
  .giocatore-giu { grid-column: 1; grid-row: 3; }
  .colonna { grid-column: 2; grid-row: 1 / 5; width: 340px; height: calc(var(--lato) + 28px + 110px); }
  .scontrino { flex: 1; min-height: 0; grid-template-rows: auto 1fr; padding: 14px 14px 10px; }
  .mosse { align-self: stretch; overflow-x: hidden; overflow-y: auto; display: block; }
  .mosse li { display: grid; grid-template-columns: 34px 1fr 1fr; margin: 0; padding: 1px 0; }
  .mosse li:nth-child(odd) { background: rgba(0, 0, 0, .025); }
  .mosse .m { text-align: left; }
  .comandi { flex-wrap: wrap; }
  .comando { flex: 1 1 45%; flex-direction: row; justify-content: center; min-height: 48px; font-size: 14px; gap: 8px; }
}
@media (max-width: 380px) {
  .orologio { min-width: 82px; padding: 6px 10px; }
  .orologio-cifre { font-size: 18px; }
  .cadenze { grid-template-columns: repeat(3, 1fr); }
  .foglio .titolo-grande { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
