/* Scacchi a distanza — si appoggia a ../stile.css (colori, barra in alto, bottoni) */
:root {
  --chiara: #ecebd6;
  --scura: #7a9e68;
  --ultima: rgba(255, 214, 64, .45);
  --sel: rgba(43, 111, 214, .45);
}
[hidden] { display: none !important; }
.sc section.vista { padding: 0; }
.gioco > *, .colonne > *, .benvenuto > * { min-width: 0; }
.sc { padding-top: 36px; padding-bottom: 48px; min-height: 70vh; }
.sc h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 14px; }
.sc .eyebrow { margin: 0 0 8px; }
.h { font-size: 1.05rem; letter-spacing: -.01em; margin: 28px 0 12px; font-weight: 750; }
.box .h { margin-top: 0; }
.piccolo, small { color: var(--muted); font-size: .86rem; }
.vuoto { color: var(--muted); font-size: .95rem; margin: 6px 0; }
.errore { color: #c0392b; background: rgba(192, 57, 43, .08); border-radius: 12px; padding: 10px 14px; margin: 4px 0 12px; font-size: .93rem; }
.rosso { color: #d0453a; font-weight: 650; }
.btn { border: 0; cursor: pointer; font: inherit; font-weight: 650; }
.btn.piccolo { padding: 8px 15px; font-size: .86rem; }
.btn.ghost { margin-left: 0; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
button.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font: inherit; font-size: .93rem; cursor: pointer; display: block; text-align: left; }
button.link:disabled { color: var(--muted); cursor: default; }
.bottoni { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

input, select {
  font: inherit; font-size: 1rem; width: 100%; padding: 11px 14px; margin: 6px 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label { display: block; font-size: .9rem; font-weight: 600; }
label.spunta { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 4px 0 14px; cursor: pointer; }
label.spunta input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
label.spunta b { font-weight: 600; }

/* ---------- accesso ---------- */
.benvenuto { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: start; padding: 24px 0; }
.punti { padding: 0; list-style: none; margin: 0; }
.punti li { padding: 8px 0 8px 30px; position: relative; color: var(--muted); }
.punti li::before { content: "♙"; position: absolute; left: 0; color: var(--accent); }
.punti b { color: var(--text); }
.pannello, .box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.schede { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.schede button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.schede button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nota { font-size: .85rem; color: var(--muted); margin: 0 0 14px; }
#f-accesso .btn { width: 100%; justify-content: center; }

/* ---------- lobby ---------- */
.colonne { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
.colonne aside { display: grid; gap: 18px; }
.lista { display: grid; gap: 10px; }
.riga {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; color: var(--text);
  transition: transform .15s var(--ease), box-shadow .15s;
}
a.riga:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.riga > div:not(.mini) { flex: 1; min-width: 0; line-height: 1.35; }
.riga small { display: block; margin-top: 2px; }
.riga .ico { font-size: 1.4rem; width: 32px; text-align: center; flex: none; }
.riga .bottoni { margin: 0; flex: none; }
.riga.invito { border-color: var(--accent); background: var(--accent-soft); }
.riga .tag { font-size: .8rem; font-weight: 650; color: var(--muted); white-space: nowrap; }
.riga.tocca { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.riga.tocca .tag { color: #fff; background: var(--accent); padding: 4px 11px; border-radius: 999px; }
.riga.finita { padding: 9px 16px; }
.riga em { font-style: normal; color: var(--accent); font-weight: 600; }
.mini { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: 72px; height: 72px; flex: none; border-radius: 6px; overflow: hidden; }
.mini i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 8.5px; line-height: 1; }
.mini i.chiara { background: var(--chiara); }
.mini i.scura { background: var(--scura); }
.mini .p.pb { text-shadow: 0 0 1px #000, 0 0 1px #000; }
.giocatori { display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.gioc { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.gioc b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gioc small { font-size: .78rem; }
.gioc > span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.gioc > span.online { background: var(--accent); }
.box details { margin: 6px 0; color: var(--text); }
.box summary { cursor: pointer; color: var(--accent); font-size: .93rem; padding: 6px 0; }
.box details input { margin: 4px 0 8px; }

/* ---------- partita ---------- */
.indietro { display: inline-block; margin-bottom: 14px; font-weight: 600; }
.gioco { display: grid; grid-template-columns: minmax(0, 600px) minmax(280px, 1fr); gap: 32px; align-items: start; }
.zona-scacchiera { position: relative; }
.giocatore { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 2px; flex-wrap: wrap; }
.giocatore b { font-weight: 650; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.dot.w { background: #fff; }
.dot.b { background: #222; }
.presi { display: inline-flex; align-items: center; gap: 0; color: var(--muted); font-size: 1.05rem; line-height: 1; }
.presi i { font-style: normal; margin-right: -3px; }
.presi small { margin-left: 8px; }
.muove { margin-left: auto; color: var(--accent); font-size: .85rem; font-weight: 650; }

.scacchiera {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1; width: 100%;
  max-width: min(600px, calc(100svh - 230px)); min-width: 260px;
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-hover); container-type: inline-size;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.c { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; }
.c.chiara { background: var(--chiara); }
.c.scura { background: var(--scura); }
.c.ultima { background-image: linear-gradient(var(--ultima), var(--ultima)); }
.c.sel { background-image: linear-gradient(var(--sel), var(--sel)); }
.c.scacco { background-image: radial-gradient(circle, rgba(230, 40, 30, .9) 0, rgba(230, 40, 30, .5) 40%, transparent 72%); }
.scacchiera.attiva .c.mobile, .scacchiera.attiva .c.meta { cursor: pointer; }
.c.meta::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 30, 20, .28); pointer-events: none; }
.c.meta.presa::after { width: 86%; height: 86%; background: none; border: 6px solid rgba(20, 30, 20, .28); box-sizing: border-box; }
.crd { position: absolute; font-size: max(9px, 2.2cqw); font-weight: 700; line-height: 1; pointer-events: none; }
.crd.rk { top: 4%; left: 5%; }
.crd.fl { bottom: 4%; right: 6%; }
.c.chiara .crd { color: var(--scura); }
.c.scura .crd { color: var(--chiara); }
.p {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", "DejaVu Sans", "Apple Symbols", "Arial Unicode MS", serif;
  font-size: 10cqw; line-height: 1; position: relative; z-index: 1; pointer-events: none; font-variant-emoji: text;
}
.p.pb { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 0 0 2px #000, 1px 1px 0 #222, -1px -1px 0 #222, 1px -1px 0 #222, -1px 1px 0 #222; }
.p.pn { color: #1a1a1a; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
.presi .p, .promo .p, .mini .p { font-size: inherit; }

.conferma {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 12px 16px;
  background: var(--surface); border: 2px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow-hover);
}
.conferma span { flex: 1; min-width: 150px; }

.lato { display: grid; gap: 14px; }
.stato, .avviso { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; line-height: 1.4; }
.stato b { font-size: 1.15rem; }
.stato b.tuo { color: var(--accent); }
.stato small { display: block; margin-top: 4px; }
.stato .storico { color: var(--accent-2); }
.avviso { border-color: var(--accent-2); }
.nav-mosse { display: flex; gap: 6px; }
.nav-mosse button {
  flex: 1; padding: 8px 0; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; font-size: 1rem; cursor: pointer;
}
.nav-mosse button:hover { border-color: var(--muted); }
.mosse {
  margin: 0; padding: 8px 8px 8px 44px; max-height: 240px; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; font-variant-numeric: tabular-nums; counter-reset: none;
}
.mosse li { padding: 2px 0; color: var(--muted); font-size: .92rem; }
.mosse li::marker { color: var(--muted); }
.mosse a { display: inline-block; min-width: 76px; padding: 1px 8px; border-radius: 6px; color: var(--text); }
.mosse a:hover { background: var(--accent-soft); text-decoration: none; }
.mosse a.on { background: var(--accent); color: #fff; }
.mosse .vuoto { margin-left: -36px; }
.azioni { display: flex; gap: 8px; flex-wrap: wrap; }
.azioni[hidden] { display: none; }
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.chat h3 { margin: 0 0 8px; font-size: 1rem; }
.chat-lista { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.msg { align-self: flex-start; max-width: 85%; background: var(--bg); border-radius: 14px 14px 14px 4px; padding: 7px 12px; }
.msg.mio { align-self: flex-end; background: var(--accent-soft); border-radius: 14px 14px 4px 14px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg small { font-size: .74rem; }
#f-chat { display: flex; gap: 8px; align-items: center; }
#f-chat input { margin: 0; }
#f-chat .btn, .bottoni .btn, .conferma .btn, .gioc .btn { white-space: nowrap; flex: none; }
#f-chat[hidden] { display: none; }

.promo { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.promo[hidden] { display: none; }
.promo-box { background: var(--surface); border-radius: 20px; padding: 18px 22px; box-shadow: var(--shadow-hover); text-align: center; }
.promo-box p { margin: 0 0 10px; font-weight: 650; }
.promo-box button { width: 72px; height: 72px; margin: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--chiara); font-size: 48px; cursor: pointer; }
.promo-box button:hover { background: var(--scura); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 520px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 14px; box-shadow: var(--shadow-hover);
  font-size: .95rem; transition: opacity .4s, transform .4s;
}
.toast.err { background: #c0392b; color: #fff; }
.toast.ok { background: var(--accent); color: #fff; }
.toast.via { opacity: 0; transform: translate(-50%, 10px); }

@media (max-width: 900px) {
  .benvenuto, .colonne, .gioco { grid-template-columns: 1fr; gap: 24px; }
  .scacchiera { max-width: 100%; }
  .mosse { max-height: 160px; }
}
@media (max-width: 600px) {
  .sc { padding-top: 16px; }
  .sc.wrap { padding-left: 10px; padding-right: 10px; }
  .pannello, .box { padding: 18px; }
  .riga { padding: 10px 12px; gap: 10px; }
  .riga .tag { display: none; }
  .mini { width: 60px; height: 60px; }
  .mini i { font-size: 7px; }
  .scacchiera { border-radius: 6px; min-width: 0; }
  .c.meta.presa::after { border-width: 4px; }
}

/* ---------- lingua ---------- */
#lingua {
  width: auto; margin: 0 0 0 6px; padding: 6px 8px; font-size: .85rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer; align-self: center;
}
.vai-guida { margin-top: 18px; font-weight: 600; }

/* ---------- come funziona ---------- */
.guida { max-width: 980px; }
.guida .lead { max-width: 44em; }
.passi { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 32px 0 36px; }
.passi article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); }
.passi .num {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: 10px;
}
.passi h3 { margin: 0 0 6px; font-size: 1.08rem; letter-spacing: -.01em; }
.passi p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.55; }

/* ---------- arabo (da destra a sinistra): scacchiera, mosse e frecce restano da sinistra a destra ---------- */
.scacchiera, .mosse, .nav-mosse, .mini, .presi { direction: ltr; }
[dir="rtl"] .mosse { padding: 8px 8px 8px 44px; text-align: left; }
[dir="rtl"] .muove { margin-left: 0; margin-right: auto; }
[dir="rtl"] .punti li { padding: 8px 30px 8px 0; }
[dir="rtl"] .punti li::before { left: auto; right: 0; }
[dir="rtl"] .msg { border-radius: 14px 14px 4px 14px; }
[dir="rtl"] .msg.mio { border-radius: 14px 14px 14px 4px; }
[dir="rtl"] button.link { text-align: right; }
[dir="rtl"] #lingua { margin: 0 6px 0 0; }
@media (max-width: 600px) { #lingua { padding: 5px 4px; font-size: .8rem; } }

/* ---------- privacy ed eliminazione account ---------- */
.privacy { max-width: 46em; }
.privacy h3 { margin: 26px 0 6px; font-size: 1.08rem; }
.privacy p { margin: 0; color: var(--muted); line-height: 1.6; }
.privacy .piccolo { margin-top: 26px; }
.box details.elimina summary { color: #c0392b; }
.btn.rosso-btn { background: #c0392b; color: #fff; }
footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* guida sotto l'accesso */
.guida-home { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--line); }
.guida-home h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 12px; letter-spacing: -.02em; }
.guida-home .passi { margin-bottom: 0; }
