/* Scacchi: tema. Cambia queste variabili per adattare i colori al tuo sito. */
.sc-app, .sc-regole-pagina {
  --sc-light: #e7ebf3;          /* case chiare */
  --sc-dark: #7d8fb8;           /* case scure */
  --sc-accent: #f3a935;         /* evidenziazioni sulla scacchiera e turno */
  --sc-accent-ink: #2a1c05;
  --sc-primary: #13806a;        /* pulsante principale (Nuova partita, Inizia) e scelte attive */
  --sc-primary-ink: #ffffff;
  --sc-ink: #1d2130;            /* testo */
  --sc-muted: #6a7187;
  --sc-surface: #ffffff;        /* sfondo dei pannelli */
  --sc-surface-2: #f3f5f9;
  --sc-line: #e1e5ee;
  --sc-danger: #e5484d;
  --sc-good: #2fa36b;
  --sc-strong: #1d2130;         /* pulsante Regole, stato di fine partita */
  --sc-strong-ink: #ffffff;
  --sc-warn-ink: #a3242a;
  --sc-shadow: rgba(20, 24, 40, .18);
  --sc-frame: #2f3650;          /* cornice con lettere e numeri */
  --sc-frame-ink: #c9cfe0;
  --sc-radius: 18px;
  --sc-w-body: #fbf8f1; --sc-w-line: #262833; --sc-w-detail: #262833;
  --sc-b-body: #2c2f3b; --sc-b-line: #14161c; --sc-b-detail: #d9d5cb;
  color: var(--sc-ink);
  color-scheme: light;
  font: inherit;
  line-height: 1.45;
  box-sizing: border-box;
}
.sc-app *, .sc-app *::before, .sc-app *::after,
.sc-regole-pagina *, .sc-regole-pagina *::before, .sc-regole-pagina *::after { box-sizing: border-box; }

/* ---------- modalità scura ----------
   Si attiva da sola se il dispositivo è in modalità scura, oppure con il pulsante luna/sole.
   Il JS imposta data-tema-attivo="scuro" | "chiaro". */
.sc-app[data-tema-attivo="scuro"], .sc-regole-pagina[data-tema-attivo="scuro"] {
  --sc-light: #aab3c6;
  --sc-dark: #536188;
  --sc-accent: #f0a63a;
  --sc-primary: #2bb594;
  --sc-primary-ink: #04201a;
  --sc-ink: #e6e8ef;
  --sc-muted: #99a0b4;
  --sc-surface: #1a1d26;
  --sc-surface-2: #242834;
  --sc-line: #313645;
  --sc-danger: #ff6b70;
  --sc-good: #3cc082;
  --sc-strong: #353c55;
  --sc-strong-ink: #ffffff;
  --sc-warn-ink: #ffb3b5;
  --sc-shadow: rgba(0, 0, 0, .55);
  --sc-frame: #11131a;
  --sc-frame-ink: #8f97ad;
  --sc-caps-b-line: #b9c0d0;     /* pezzi neri catturati leggibili sul fondo scuro */
  --sc-caps-w-line: #0d0f14;
  color-scheme: dark;
}
.sc-regole-pagina[data-tema-attivo="scuro"] { background: var(--sc-surface); border-radius: var(--sc-radius); padding: 18px; }
.sc-app[data-tema-attivo="scuro"] .sc-board-outer { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
.sc-app[data-tema-attivo="scuro"] .sc-dot::after { background: rgba(10, 12, 20, .42); }
.sc-app[data-tema-attivo="scuro"] .sc-cap::after { border-color: rgba(10, 12, 20, .42); }
.sc-app[data-tema-attivo="scuro"] .sc-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.sc-app[data-tema-attivo="scuro"] .sc-av-w { box-shadow: none; background: #d9d5cb; }

/* ---------- pezzi ---------- */
.sc-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sc-svg.sc-w .b { fill: var(--sc-w-body); stroke: var(--sc-w-line); }
.sc-svg.sc-w .d { fill: none; stroke: var(--sc-w-detail); }
.sc-svg.sc-w .e { fill: var(--sc-w-detail); stroke: none; }
.sc-svg.sc-b .b { fill: var(--sc-b-body); stroke: var(--sc-b-line); }
.sc-svg.sc-b .d { fill: none; stroke: var(--sc-b-detail); }
.sc-svg.sc-b .e { fill: var(--sc-b-detail); stroke: none; }

/* ---------- impaginazione ---------- */
.sc-app { container-type: inline-size; margin: 1.5em 0; }
.sc-shell {
  display: grid; gap: 16px;
  background: var(--sc-surface);
  border: 1px solid var(--sc-line);
  border-radius: calc(var(--sc-radius) + 6px);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 12px 32px -12px var(--sc-shadow);
  transition: background .25s, border-color .25s;
}
.sc-main { display: grid; gap: 10px; min-width: 0; }
.sc-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
@container (min-width: 760px) {
  .sc-shell { grid-template-columns: minmax(0, 1fr) 270px; padding: 20px; gap: 22px; }
  .sc-side { grid-template-rows: auto auto 1fr; }
  .sc-history { max-height: none; }
}

/* ---------- scacchiera ---------- */
.sc-board-frame { position: relative; width: 100%; max-width: 620px; margin: 0 auto; }
/* cornice con le coordinate (lettere sopra e sotto, numeri ai lati) */
.sc-board-outer {
  --sc-cf: clamp(16px, 3.6cqi, 24px);
  display: grid; position: relative;
  grid-template-columns: var(--sc-cf) minmax(0, 1fr) var(--sc-cf);
  grid-template-rows: var(--sc-cf) auto var(--sc-cf);
  grid-template-areas: ". top ." "left board right" ". bottom .";
  background: var(--sc-frame); border-radius: 14px;
  box-shadow: 0 10px 24px -14px var(--sc-shadow);
}
.sc-cf { display: grid; color: var(--sc-frame-ink); font-size: clamp(9px, 2cqi, 13px); font-weight: 650;
  line-height: 1; user-select: none; -webkit-user-select: none; }
.sc-cf span { display: grid; place-items: center; }
.sc-cf-top { grid-area: top; grid-template-columns: repeat(8, 1fr); }
.sc-cf-bottom { grid-area: bottom; grid-template-columns: repeat(8, 1fr); }
.sc-cf-left { grid-area: left; grid-template-rows: repeat(8, 1fr); }
.sc-cf-right { grid-area: right; grid-template-rows: repeat(8, 1fr); }
.sc-board-outer.sc-coords-off { grid-template-columns: 0 minmax(0, 1fr) 0; grid-template-rows: 0 auto 0; background: transparent; box-shadow: none; }
.sc-coords-off .sc-cf { visibility: hidden; overflow: hidden; }
.sc-board-inner {
  grid-area: board;
  position: relative; width: 100%; aspect-ratio: 1;
  border-radius: 3px; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.sc-coords-off .sc-board-inner { border-radius: 12px; box-shadow: 0 0 0 1px rgba(20, 24, 40, .08); }
.sc-board-inner.sc-active { touch-action: none; cursor: crosshair; } /* il mirino ha il punto attivo al centro */
.sc-squares { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.sc-sq, .sc-msq { position: relative; }
.sc-l { background: var(--sc-light); }
.sc-d { background: var(--sc-dark); }
.sc-rank, .sc-file {
  position: absolute; font-size: clamp(8px, 1.6cqi, 12px); font-weight: 650; line-height: 1;
  pointer-events: none; opacity: .9;
}
.sc-rank { top: 4px; left: 4px; }
.sc-file { bottom: 4px; right: 5px; }
.sc-l .sc-rank, .sc-l .sc-file { color: var(--sc-dark); }
.sc-d .sc-rank, .sc-d .sc-file { color: var(--sc-light); }

.sc-sq::before, .sc-msq::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sc-last::before { background: color-mix(in srgb, var(--sc-accent) 42%, transparent); }
.sc-sel::before { background: color-mix(in srgb, var(--sc-accent) 70%, transparent); }
.sc-hint::before { background: color-mix(in srgb, var(--sc-good) 45%, transparent); box-shadow: inset 0 0 0 3px var(--sc-good); }
/* riquadro della casa sotto il mouse e della casa dove stai posando il pezzo */
.sc-hover::before, .sc-over::before { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .95), inset 0 0 0 4px rgba(20, 24, 40, .45); }
.sc-over::before { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .95), inset 0 0 0 6px rgba(20, 24, 40, .45); }
.sc-check::before { background: radial-gradient(circle, rgba(229, 72, 77, .95) 0%, rgba(229, 72, 77, .55) 45%, transparent 75%); }
.sc-dot::after, .sc-cap::after { content: ""; position: absolute; pointer-events: none; z-index: 3; }
.sc-dot::after { inset: 36%; border-radius: 50%; background: rgba(20, 24, 40, .28); }
.sc-cap::after { inset: 5%; border-radius: 50%; border: 5px solid rgba(20, 24, 40, .28); }
.sc-mini .sc-cap::after { border-width: 3px; border-color: rgba(229, 72, 77, .75); }
.sc-mini .sc-dot::after { background: rgba(20, 24, 40, .35); }

.sc-pieces { position: absolute; inset: 0; pointer-events: none; }
.sc-piece {
  position: absolute; top: 0; left: 0; width: 12.5%; height: 12.5%;
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), opacity .2s;
  filter: drop-shadow(0 2px 1.5px rgba(10, 14, 30, .28));
  will-change: transform; z-index: 2;
}
.sc-piece > .sc-svg { width: 88%; height: 88%; margin: 6%; }
.sc-piece.sc-noanim { transition: none; }
.sc-piece.sc-dragging { z-index: 10; transform-origin: center; scale: 1.12; filter: drop-shadow(0 8px 8px rgba(10, 14, 30, .35)); }
.sc-piece.sc-gone { opacity: 0; }
.sc-piece.sc-born { opacity: 0; }

/* promozione */
.sc-promo { position: absolute; inset: 0; z-index: 20; background: rgba(20, 24, 40, .35); backdrop-filter: blur(2px); }
.sc-promo-box {
  position: absolute; top: 0; width: 25%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px;
  margin-top: 30%; background: var(--sc-surface); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.sc-promo-box button { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--sc-surface-2); padding: 8%; cursor: pointer; }
.sc-promo-box button:hover, .sc-promo-box button:focus-visible { background: color-mix(in srgb, var(--sc-accent) 35%, var(--sc-surface)); outline: none; }
.sc-promo-box .sc-promo-x { grid-column: 1 / -1; aspect-ratio: auto; padding: 4px; font-size: 13px; color: var(--sc-muted); }

/* fine partita */
.sc-result { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center; padding: 8%;
  background: rgba(20, 24, 40, .38); backdrop-filter: blur(3px); border-radius: 14px; animation: sc-fade .25s ease; }
.sc-result[hidden] { display: none; }
.sc-result-card { background: var(--sc-surface); border-radius: var(--sc-radius); padding: 22px 22px 18px; text-align: center;
  max-width: 340px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); animation: sc-pop .3s cubic-bezier(.2, .9, .3, 1.3); }
.sc-result-t { font-size: 1.3em; font-weight: 750; letter-spacing: -.01em; }
.sc-win .sc-result-t { color: var(--sc-good); }
.sc-result-s { color: var(--sc-muted); margin: 6px 0 16px; font-size: .95em; }
.sc-result-b { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- giocatori ---------- */
.sc-player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px;
  max-width: 620px; width: 100%; margin: 0 auto; transition: background .2s, box-shadow .2s; }
.sc-player { position: relative; }
.sc-player.sc-turn {
  background: var(--sc-surface-2);
  box-shadow: inset 3px 0 0 var(--sc-accent);
  animation: sc-turn-pulse 2s ease-in-out infinite; /* il bordino respira piano per indicare il turno */
}
.sc-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.sc-avatar svg { width: 21px; height: 21px; }
.sc-av-w { background: var(--sc-w-body); color: var(--sc-w-line); box-shadow: inset 0 0 0 1.5px var(--sc-line); }
.sc-av-b { background: var(--sc-b-body); color: var(--sc-b-detail); }
.sc-pinfo { min-width: 0; flex: 1; }
.sc-logo-link { margin-left: auto; flex: none; display: block; border-radius: 50%; }
.sc-logo { display: block; width: 54px; height: 54px; margin-left: auto; flex: none; object-fit: contain;
  border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 1px 4px rgba(20, 24, 40, .15); }
.sc-logo-link .sc-logo { margin-left: 0; transition: transform .15s; }
.sc-logo-link:hover .sc-logo { transform: scale(1.06); }
.sc-pname { font-weight: 700; font-size: .98em; display: flex; align-items: center; gap: 8px; }
.sc-ptag { font-weight: 600; font-size: .72em; text-transform: uppercase; letter-spacing: .06em; color: var(--sc-muted);
  background: var(--sc-surface-2); padding: 2px 7px; border-radius: 99px; }
.sc-turn .sc-ptag { background: var(--sc-surface); }
.sc-caps { display: flex; align-items: center; flex-wrap: wrap; min-height: 18px; margin-top: 2px; }
.sc-caps .sc-svg { width: 20px; height: 20px; margin-right: -3px; stroke-width: 6; }
.sc-seg .sc-svg { stroke-width: 4.5; }
/* bordo dei pezzi neri catturati: scuro in modalità chiara, chiaro in modalità scura */
.sc-caps .sc-svg.sc-b .b, .sc-seg .sc-svg.sc-b .b { stroke: var(--sc-caps-b-line, var(--sc-b-line)); }
.sc-caps .sc-svg.sc-w .b { stroke: var(--sc-caps-w-line, var(--sc-w-line)); }
.sc-adv { margin-left: 10px; font-size: .8em; font-weight: 700; color: var(--sc-muted); }

/* ---------- pannello laterale ---------- */
.sc-status { font-weight: 650; padding: 12px 14px; border-radius: 14px; background: var(--sc-surface-2); min-height: 46px;
  display: flex; align-items: center; gap: 8px; }
.sc-status[data-tone="you"] { background: color-mix(in srgb, var(--sc-accent) 16%, var(--sc-surface)); }
.sc-status[data-tone="warn"] { background: color-mix(in srgb, var(--sc-danger) 14%, var(--sc-surface)); color: var(--sc-warn-ink); }
.sc-status[data-tone="end"] { background: var(--sc-strong); color: var(--sc-strong-ink); }
.sc-dots { display: inline-flex; gap: 3px; }
.sc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sc-muted); animation: sc-bounce 1s infinite; }
.sc-dots i:nth-child(2) { animation-delay: .15s; } .sc-dots i:nth-child(3) { animation-delay: .3s; }

.sc-actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sc-actions .sc-btn { grid-column: span 2; }
.sc-actions .sc-primary, .sc-actions .sc-rules-btn { grid-column: 1 / -1; }
.sc-actions .sc-opt { grid-column: span 3; }
.sc-btn {
  appearance: none; border: 1px solid var(--sc-line); background: var(--sc-surface); color: var(--sc-ink);
  font: inherit; font-size: .9em; font-weight: 650; border-radius: 12px; padding: 10px 12px; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s, opacity .15s; line-height: 1.1;
}
.sc-btn svg { width: 18px; height: 18px; flex: none; }
.sc-btn:hover { background: var(--sc-surface-2); }
.sc-btn:active { transform: scale(.97); }
.sc-btn:focus-visible, .sc-seg button:focus-visible, .sc-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--sc-accent) 60%, transparent); outline-offset: 2px; }
.sc-btn:disabled { opacity: .45; cursor: default; transform: none; }
.sc-primary { background: var(--sc-primary); border-color: transparent; color: var(--sc-primary-ink); }
.sc-primary:hover { background: color-mix(in srgb, var(--sc-primary) 86%, black); }
.sc-rules-btn { background: var(--sc-strong); color: var(--sc-strong-ink); border-color: transparent; }
.sc-rules-btn:hover { background: color-mix(in srgb, var(--sc-strong) 85%, var(--sc-strong-ink)); }
.sc-actions .sc-btn:not(.sc-primary):not(.sc-rules-btn):not(.sc-opt) { flex-direction: column; font-size: .75em; gap: 4px; padding: 8px 4px; }
.sc-opt { font-size: .82em; }
.sc-opt[aria-pressed="true"] { border-color: color-mix(in srgb, var(--sc-primary) 60%, var(--sc-line)); background: color-mix(in srgb, var(--sc-primary) 12%, var(--sc-surface)); }
.sc-wide { width: 100%; }

.sc-label { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sc-muted); margin-bottom: 6px; }
.sc-history-wrap { min-height: 0; display: flex; flex-direction: column; }
.sc-history { list-style: none; margin: 0; padding: 4px; border-radius: 14px; background: var(--sc-surface-2);
  max-height: 180px; overflow-y: auto; font-variant-numeric: tabular-nums; font-size: .92em; flex: 1; }
.sc-history li { display: grid; grid-template-columns: 2.4em 1fr 1fr; padding: 4px 8px; border-radius: 8px; margin: 0; }
.sc-history li:nth-child(odd) { background: var(--sc-surface); }
.sc-history .sc-n { color: var(--sc-muted); }
.sc-history .sc-empty { display: block; color: var(--sc-muted); background: none; font-size: .95em; padding: 8px; }

/* ---------- finestre ---------- */
.sc-dialog {
  border: 0; padding: 0; border-radius: calc(var(--sc-radius) + 4px); background: var(--sc-surface); color: var(--sc-ink);
  width: min(560px, calc(100vw - 24px)); max-height: min(88vh, 900px); box-shadow: 0 30px 80px rgba(10, 14, 30, .35);
  overflow: hidden; font: inherit;
}
.sc-dialog[open] { display: flex; flex-direction: column; animation: sc-pop .25s cubic-bezier(.2, .9, .3, 1.15); }
.sc-dialog::backdrop { background: rgba(15, 18, 30, .5); backdrop-filter: blur(3px); }
.sc-dialog-regole { width: min(760px, calc(100vw - 24px)); }
.sc-form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.sc-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--sc-line); }
.sc-dialog-head h2 { margin: 0; font-size: 1.2em; letter-spacing: -.01em; }
.sc-close { border: 0; background: var(--sc-surface-2); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 15px; color: var(--sc-ink); flex: none; }
.sc-dialog-body { padding: 16px 18px; overflow-y: auto; }
.sc-dialog-foot { padding: 12px 18px 18px; }
.sc-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-bottom: 16px; }
.sc-seg button { border: 1.5px solid var(--sc-line); background: var(--sc-surface); border-radius: 12px; padding: 10px 6px; cursor: pointer;
  font: inherit; font-weight: 650; font-size: .88em; color: var(--sc-ink); display: grid; justify-items: center; gap: 4px; }
.sc-seg button .sc-svg { width: 34px; height: 34px; }
.sc-seg button[aria-pressed="true"] { border-color: var(--sc-primary); background: color-mix(in srgb, var(--sc-primary) 14%, var(--sc-surface)); }
.sc-half { display: flex; }
.sc-half .sc-svg { width: 34px; height: 34px; }
.sc-half .sc-svg + .sc-svg { margin-left: -16px; }
.sc-seg-text button { padding: 12px 4px; font-size: .82em; }
.sc-note { color: var(--sc-muted); font-size: .88em; margin: 0; }

/* ---------- regole ---------- */
.sc-regole { font-size: .98em; }
.sc-regole h3 { font-size: 1.12em; margin: 1.6em 0 .5em; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.sc-regole h3:first-child { margin-top: .2em; }
.sc-regole h4 { margin: 1.2em 0 .3em; font-size: 1em; display: flex; align-items: center; gap: 6px; }
.sc-regole p, .sc-regole ul, .sc-regole ol { margin: .4em 0 .8em; }
.sc-regole li { margin: .25em 0; }
.sc-regole .sc-toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.sc-regole .sc-toc a { display: inline-block; padding: 5px 11px; border-radius: 99px; background: var(--sc-surface-2); color: var(--sc-ink);
  text-decoration: none; font-size: .85em; font-weight: 600; }
.sc-regole .sc-toc a:hover { background: color-mix(in srgb, var(--sc-accent) 25%, var(--sc-surface)); }
.sc-regole .sc-box { background: var(--sc-surface-2); border-radius: 14px; padding: 12px 14px; margin: .8em 0; }
.sc-regole .sc-tip { border-left: 4px solid var(--sc-accent); }
.sc-ico { display: inline-block; width: 1.6em; height: 1.6em; vertical-align: -.4em; flex: none; }
.sc-fig { display: grid; grid-template-columns: minmax(0, 190px) 1fr; gap: 14px; align-items: start; margin: .5em 0 1em; }
.sc-fig p { margin-top: 0; }
.sc-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: .6em 0 1em; }
.sc-figs figure { margin: 0; }
.sc-figs figcaption { font-size: .82em; color: var(--sc-muted); text-align: center; margin-top: 4px; }
.sc-mini { display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); aspect-ratio: 1; width: 100%; border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(20, 24, 40, .08); container-type: inline-size; }
.sc-mini .sc-msq .sc-svg { position: relative; z-index: 2; width: 88%; height: 88%; margin: 6%; }
.sc-mini .sc-rank, .sc-mini .sc-file { font-size: clamp(6px, 4cqi, 9px); top: 2px; left: 2px; }
.sc-mini .sc-file { top: auto; left: auto; bottom: 1px; right: 2px; }
.sc-regole table { border-collapse: collapse; width: 100%; margin: .5em 0 1em; font-size: .95em; }
.sc-regole td, .sc-regole th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--sc-line); }
.sc-regole th { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--sc-muted); }
.sc-regole kbd { font: inherit; font-weight: 700; background: var(--sc-surface-2); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 520px) { .sc-fig { grid-template-columns: 1fr; } .sc-fig .sc-mini { max-width: 240px; } }
.sc-regole-pagina .sc-regole { max-width: 780px; }

@keyframes sc-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sc-turn-pulse {
  0%, 100% { box-shadow: inset 3px 0 0 var(--sc-accent); }
  50% { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--sc-accent) 35%, transparent); }
}
@keyframes sc-fade { from { opacity: 0; } }
@keyframes sc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sc-app *, .sc-app *::before { animation: none !important; transition: none !important; } }

/* ---------- schermata d'apertura ---------- */
.sc-splash {
  position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; overflow: hidden;
  background: #0b0f1c; color: #fff; cursor: pointer; outline: none; text-align: center;
  font: inherit; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  animation: sc-sp-in .5s ease both;
}
.sc-splash.sc-out { animation: sc-sp-out .55s cubic-bezier(.6, 0, .4, 1) forwards; pointer-events: none; }
.sc-splash-bg { position: absolute; inset: 0; pointer-events: none; }
.sc-splash-bg span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.sc-b1 { width: 55vmax; height: 55vmax; left: -15vmax; top: -18vmax; background: #148a73; animation: sc-sp-drift 14s ease-in-out infinite alternate; }
.sc-b2 { width: 50vmax; height: 50vmax; right: -18vmax; bottom: -20vmax; background: #2f3a8f; animation: sc-sp-drift 17s ease-in-out infinite alternate-reverse; }
.sc-b3 { width: 22vmax; height: 22vmax; right: 12vw; top: 8vh; background: #f3a935; opacity: .22 !important; animation: sc-sp-drift 11s ease-in-out infinite alternate; }
.sc-splash-grid {
  position: absolute; left: -50%; right: -50%; bottom: -10%; height: 70%;
  background-image: conic-gradient(rgba(255, 255, 255, .06) 25%, transparent 0 50%, rgba(255, 255, 255, .06) 0 75%, transparent 0);
  background-size: 90px 90px;
  transform: perspective(500px) rotateX(62deg); transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, #000 10%, transparent 85%); -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  animation: sc-sp-grid 6s linear infinite;
}
.sc-splash-in { position: relative; display: grid; justify-items: center; gap: 10px; padding: 24px; max-width: 92vw; }
.sc-splash-icon { width: clamp(96px, 22vmin, 150px); aspect-ratio: 1; margin-bottom: 14px;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .55)) drop-shadow(0 0 30px rgba(43, 181, 148, .35));
  animation: sc-sp-pop .8s cubic-bezier(.2, .9, .3, 1.35) .1s both, sc-sp-float 4s ease-in-out 1s infinite; }
.sc-splash-icon svg { width: 100%; height: 100%; display: block; }
.sc-splash-pre { margin: 0; font-size: clamp(13px, 2.4vmin, 17px); font-weight: 600; letter-spacing: .32em; text-transform: uppercase;
  color: rgba(255, 255, 255, .78); animation: sc-sp-up .7s ease .45s both; }
.sc-splash-pre em { font-style: normal; color: #f3a935; }
.sc-splash-title { margin: 0; display: grid; line-height: .92; font-weight: 850; letter-spacing: -.02em; text-transform: uppercase;
  font-size: clamp(40px, 11vmin, 104px); }
.sc-splash-title span {
  background: linear-gradient(100deg, #ffffff 0%, #ffffff 35%, #7fe3c9 50%, #ffffff 65%, #ffffff 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sc-sp-up .8s cubic-bezier(.2, .8, .2, 1) both, sc-sp-shine 4.5s ease-in-out 1.6s infinite;
}
.sc-splash-title span:nth-child(1) { animation-delay: .65s, 1.6s; }
.sc-splash-title span:nth-child(2) { animation-delay: .85s, 1.9s; }
.sc-splash-go {
  margin-top: 34px; display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  font: inherit; font-size: clamp(14px, 2.4vmin, 17px); font-weight: 650; letter-spacing: .04em; color: #fff;
  padding: 14px 26px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: sc-sp-up .7s ease 1.25s both, sc-sp-pulse 2s ease-in-out 2s infinite;
}
.sc-splash-go i { width: 10px; height: 10px; border-radius: 50%; background: #2bb594; box-shadow: 0 0 0 0 rgba(43, 181, 148, .7);
  animation: sc-sp-ring 2s ease-out 2s infinite; }
@keyframes sc-sp-in { from { opacity: 0; } }
@keyframes sc-sp-out { to { opacity: 0; transform: scale(1.04); filter: blur(6px); } }
@keyframes sc-sp-pop { from { opacity: 0; transform: scale(.6) rotate(-8deg); } }
@keyframes sc-sp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sc-sp-up { from { opacity: 0; transform: translateY(18px); } }
@keyframes sc-sp-shine { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
@keyframes sc-sp-pulse { 0%, 100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); border-color: rgba(43, 181, 148, .8); } }
@keyframes sc-sp-ring { 0% { box-shadow: 0 0 0 0 rgba(43, 181, 148, .7); } 100% { box-shadow: 0 0 0 14px rgba(43, 181, 148, 0); } }
@keyframes sc-sp-drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }
@keyframes sc-sp-grid { to { background-position: 0 90px; } }
@media (prefers-reduced-motion: reduce) {
  .sc-splash, .sc-splash *, .sc-splash *::before { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}


html.sc-lock-splash, html.sc-lock-splash body { overflow: hidden !important; }

/* ---------- pagina dedicata (tuosito.it/scacchi/) ---------- */
body.sc-pagina {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: #eef1f6; color: #1d2130;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; transition: background .25s, color .25s;
}
body.sc-pagina:has(.sc-app[data-tema-attivo="scuro"]) { background: #0f1117; color: #e6e8ef; }
.sc-pbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  background: rgba(238, 241, 246, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(20, 24, 40, .08);
}
body.sc-pagina:has(.sc-app[data-tema-attivo="scuro"]) .sc-pbar { background: rgba(15, 17, 23, .86); border-bottom-color: rgba(255, 255, 255, .07); }
.sc-pback {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; font-weight: 650; font-size: .9em;
  padding: 8px 14px 8px 10px; border-radius: 999px; background: rgba(20, 24, 40, .06); border: 1px solid rgba(20, 24, 40, .1);
  transition: background .15s, transform .1s; white-space: nowrap;
}
.sc-pback svg { width: 18px; height: 18px; }
.sc-pback:hover { background: rgba(20, 24, 40, .11); }
.sc-pback:active { transform: scale(.97); }
.sc-pback:focus-visible { outline: 3px solid rgba(243, 169, 53, .6); outline-offset: 2px; }
body.sc-pagina:has(.sc-app[data-tema-attivo="scuro"]) .sc-pback { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); }
body.sc-pagina:has(.sc-app[data-tema-attivo="scuro"]) .sc-pback:hover { background: rgba(255, 255, 255, .13); }
.sc-pbrand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; min-width: 0; }
.sc-pbrand img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.sc-pbrand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-pmain { max-width: 1120px; margin: 0 auto; padding: 0 max(12px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.sc-pagina .sc-app { margin: 12px 0 0; }
@media (max-width: 360px) { .sc-pbrand span { display: none; } }
