/* ============================================================
   Conquizzone — Stile principale
   Palette: verde scuro / smeraldo / oro / rosso
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1e15;
  --bg-card:     #162a1e;
  --bg-modal:    #1d3527;
  --bordo:       #2a4a35;
  --testo:       #e6edf3;
  --testo-2:     #8b9e94;
  --primario:    #d4a940;
  --primario-hv: #b8922e;
  --oro:         #d4a940;
  --verde:       #2d7a4f;
  --rosso:       #c62828;
  --raggio:      12px;
  --ombra:       0 8px 32px rgba(0,0,0,.6);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--testo);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* ─── Schermate ─────────────────────────────────────────────── */
.schermata {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  z-index: 10;
}
.schermata.attiva {
  opacity: 1; pointer-events: auto;
}
#schermata-gioco {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 100%; /* Safari: flex: 1 dei figli richiede altezza esplicita */
  background: var(--bg);
}
/* iOS: niente dissolvenza sulla schermata di gioco. Il fade opacity 0→1
   intrappola il layer del canvas in WebKit e la mappa resta nera (dati e tap
   ok, ma non viene dipinta). Vedi MappaMondo.forzaRipitturaIOS(). */
html.ios #schermata-gioco { transition: none; }

/* ─── Caricamento ───────────────────────────────────────────── */
#schermata-caricamento {
  flex-direction: column; gap: 24px;
  background: var(--bg);
  z-index: 100;
}
.logo-caricamento {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.logo-caricamento img {
  max-width: 340px; width: 85vw; height: auto;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,.6));
  animation: logo-breathe 3s ease-in-out infinite;
}
@keyframes logo-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 4px 24px rgba(0,0,0,.6)); }
  50% { transform: scale(1.02); filter: drop-shadow(0 6px 32px rgba(212,169,64,.25)); }
}
.loading-bar-container {
  width: min(280px, 70vw); height: 4px;
  background: rgba(255,255,255,.08); border-radius: 2px;
  overflow: hidden; margin-top: 8px;
}
.loading-bar {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--oro), #e8c547);
  border-radius: 2px;
  transition: width .8s ease-out;
}
.testo-caricamento {
  color: var(--testo-2); font-size: .88rem;
  font-style: italic; opacity: 1;
  transition: opacity .2s ease;
  min-height: 1.3em; text-align: center;
}

/* ─── Registrazione ─────────────────────────────────────────── */
.card-registrazione {
  background: var(--bg-card);
  border: 1px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 32px 24px;
  max-width: 380px; width: 92%;
  box-shadow: var(--ombra);
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; text-align: center;
}
.logo-locale-grande {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-modal);
  border: 3px solid var(--bordo);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}
.logo-locale-grande img { width: 100%; height: 100%; object-fit: cover; }
.card-registrazione h2 { font-size: 1.5rem; }
.sottotitolo { color: var(--testo-2); font-size: .9rem; }
.istruzione   { color: var(--testo-2); font-size: .9rem; }
.input-username {
  width: 100%;
  background: var(--bg-modal);
  border: 1px solid var(--bordo);
  border-radius: 8px;
  color: var(--testo);
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color .2s;
}
.input-username:focus { border-color: var(--primario); }
.errore-reg { color: var(--rosso); font-size: .85rem; min-height: 20px; }

/* ─── Bottoni ───────────────────────────────────────────────── */
.btn-primario {
  width: 100%;
  background: var(--primario);
  color: #1a1a1a;
  border: none; border-radius: 8px;
  padding: 14px;
  font-size: 1rem; font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primario:hover  { background: var(--primario-hv); }
.btn-primario:active { transform: scale(.97); }
.btn-primario:disabled { background: var(--bordo); color: var(--testo-2); cursor: not-allowed; }

/* Pulsanti pannello impostazioni — stile premium */
.btn-imp {
  width: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.02) 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 13px 16px;
  color: #e8e0d0;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  text-align: left;
  transition: all .25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: .3px;
}
.btn-imp:hover { background: linear-gradient(135deg, rgba(255,215,0,.1) 0%, rgba(255,215,0,.03) 100%); border-color: rgba(255,215,0,.2); color: #ffd700; }
.btn-imp:active { transform: scale(.98); }

/* ─── Header gioco ──────────────────────────────────────────── */
.header-gioco {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--bordo);
  height: 56px;
  flex-shrink: 0; position: relative; z-index: 10;
  touch-action: auto;
}
.header-sx { display: flex; align-items: center; gap: 10px; }
.mini-logo {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-modal); border: 2px solid var(--bordo);
  overflow: visible; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.mini-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.header-info { display: flex; flex-direction: column; }
.nome-locale-hdr { font-weight: 700; font-size: .95rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(100vw - 230px); }
.username-hdr    { font-size: .78rem; color: var(--testo-2); }
.header-dx { display: flex; gap: 8px; }
/* Modalità spettatore */
.header-gioco.spettatore .header-sx { flex: 0 0 auto; min-width: 0; overflow: visible; position: relative; }
.header-gioco.spettatore .header-sx img {
  height: 90px; width: auto; max-width: none; display: block;
  position: absolute; top: -24px; left: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
  z-index: 5;
}
/* Spettatore: alza pulsanti zoom e replay sopra l'overlay spettatore */
.spettatore-attivo #overlay-mappa { bottom: 130px; }
.spettatore-attivo #replay-bar { bottom: 100px!important; position:fixed!important; z-index:20!important; left:50%!important; }
.btn-icona {
  background: none; border: 1px solid var(--bordo);
  border-radius: 8px; padding: 6px 10px;
  color: var(--testo); font-size: 1.1rem;
  cursor: pointer; transition: background .2s;
}
.btn-icona:hover { background: var(--bg-modal); }

/* ─── Contenitore mappa ─────────────────────────────────────── */
#contenitore-mappa {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
  width: 100%;
  min-height: 0; /* fix flex shrink su Safari */
}
#mappa-canvas {
  position: absolute; top: 0; left: 0;
  cursor: grab;
  touch-action: none;
}
#mappa-canvas:active { cursor: grabbing; }
#mappa-canvas.su-cella { cursor: pointer; }
#mappa-canvas.su-cella:active { cursor: pointer; }
#mappa-canvas.su-terra-neutra { cursor: default; }
#mappa-canvas.su-terra-neutra:active { cursor: default; }

/* Logo nel pannello basso (ancorato al fondo, sporge sopra la mappa) */
.pannello-logo {
  height: 80px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
#pannello-basso #stato-conquista {
  flex: 1; text-align: center; justify-content: center;
}

/* Controlli zoom */
#overlay-mappa {
  position: absolute; right: 12px; bottom: 70px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 5;
}
.btn-zoom {
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--bordo);
  border-radius: 8px;
  color: var(--testo); font-size: 1.2rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--ombra);
  transition: background .2s;
}
.btn-zoom:hover { background: var(--bg-modal); }
.btn-replay-evidenziato {
  background: var(--oro) !important;
  color: #000 !important;
  font-weight: 700;
  animation: pulse-replay 2s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(212,169,64,.4);
}
.btn-replay-evidenziato.usato {
  background: var(--bg-card) !important;
  color: var(--testo) !important;
  animation: none;
  box-shadow: var(--ombra);
}
@keyframes pulse-replay {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(212,169,64,.3); }
  50% { transform: scale(1.08); box-shadow: 0 0 16px rgba(212,169,64,.5); }
}

/* Tooltip hover cella */
.tooltip {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--bordo);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .8rem;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  box-shadow: var(--ombra);
  max-width: 200px;
  white-space: normal;
}

/* ─── Pannello basso ────────────────────────────────────────── */
#pannello-basso {
  min-height: 44px;
  background: var(--bg-card);
  border-top: 1px solid var(--bordo);
  display: flex; align-items: center;
  padding: 4px 12px 4px 104px;
  flex-shrink: 0;
  position: relative; z-index: 10;
  flex-wrap: wrap;
  touch-action: auto;
}
/* Logo assoluto a sinistra, testo centrato */
#pannello-basso .pannello-logo {
  position: absolute; left: 12px; bottom: 0;
}
#stato-conquista {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  overflow: hidden;
  max-width: calc(100vw - 130px);
}
#stato-conquista-testo { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stato-conquista-dots {
  display: inline-flex; gap: 4px; flex-shrink: 0;
}
.dot-tentativo {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--oro);
  transition: all .3s;
}
.dot-tentativo.usato { background: var(--oro); }
.dot-tentativo.dot-successo { border-color: var(--verde); background: var(--verde); box-shadow: 0 0 6px rgba(45,122,79,.5); }
.dot-tentativo.dot-fallito { border-color: var(--rosso); background: var(--rosso); box-shadow: 0 0 6px rgba(198,40,40,.5); }
.dot-tentativo.esaurito { border-color: var(--testo-2); background: var(--testo-2); opacity: .4; }

/* ─── Streak chip nell'header (stile Duolingo) ──────────────── */
.hdr-streak {
  display: inline-flex; align-items: center; gap: 1px;
  background: none; border: 1px solid var(--bordo);
  border-radius: 8px; padding: 5px 8px;
  font-size: 1rem; font-weight: 800; color: var(--oro);
  cursor: pointer; line-height: 1; transition: background .2s;
  -webkit-tap-highlight-color: rgba(255,215,0,.3); flex-shrink: 0;
}
.hdr-streak:hover { background: var(--bg-modal); }
.hdr-streak .hdr-streak-fuoco { font-size: 1.05rem; margin-right: 1px; }
.hdr-streak.spenta { color: var(--testo-2); }
.hdr-streak.spenta .hdr-streak-fuoco { filter: grayscale(1); opacity: .6; }
.hdr-streak-freeze { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; color: #7fd3ff; }
.hdr-streak-freeze .hdr-streak-ghiaccio { font-size: 1rem; }

/* ─── Bottone "Attacchi extra" (ruota) nel pannello basso ───── */
#ruota-extra-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: stretch;
  gap: 2px; min-width: 120px; margin-left: 4px;
}
#ruota-extra-timer {
  font-size: .64rem; font-weight: 700; color: var(--testo-2);
  text-align: center; letter-spacing: .2px;
}
#btn-video-extra {
  width: 100%; box-sizing: border-box;
  background: linear-gradient(135deg,#ffd700,#ff8c00); color: #000;
  border: none; border-radius: 10px; padding: 10px 14px;
  font-size: .95rem; font-weight: 800; cursor: pointer; white-space: nowrap;
  animation: pulse-glow 2s infinite; position: relative; z-index: 100;
  -webkit-tap-highlight-color: rgba(255,215,0,.3);
}
#btn-video-extra.in-cooldown {
  background: #3a3f45; color: #9aa1a8; cursor: default;
  animation: none; box-shadow: none;
  font-size: .82rem; letter-spacing: 0;
}

/* ─── Overlay spettatore ────────────────────────────────────── */
#overlay-spettatore {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 15;
  background: linear-gradient(135deg, rgba(15,30,21,.97), rgba(29,53,39,.97));
  border-top: 2px solid var(--bordo);
  padding: 12px 16px;
}
#overlay-spettatore-contenuto {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; max-width: 600px; margin: 0 auto;
  flex-wrap: wrap;
}
#overlay-spettatore-sx {
  display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0;
}
.overlay-spett-icona { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
#overlay-spettatore-sx strong { display: block; font-size: .88rem; color: var(--oro); }
#overlay-spettatore-sx p { font-size: .78rem; color: var(--testo-2); margin: 2px 0 0; line-height: 1.3; }
.btn-spett-reg {
  flex-shrink: 0; font-size: .82rem;
  padding: 8px 14px; white-space: nowrap;
}

/* ─── Form richiesta locale ──────────────────────────────────── */
.rl-form { display: flex; flex-direction: column; gap: 8px; margin-top: .5rem; }
.rl-input {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--bordo); border-radius: 8px;
  color: var(--testo); font-size: .88rem; outline: none;
  transition: border-color .2s;
}
.rl-input:focus { border-color: var(--primario); }
textarea.rl-input { resize: vertical; font-family: var(--font); }
.rl-privacy {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .78rem; color: var(--testo-2); cursor: pointer; line-height: 1.4;
}
.rl-privacy input[type=checkbox] { margin-top: 2px; flex-shrink: 0; }

/* ─── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  transition: opacity .25s;
}
.modal.nascosto { opacity: 0; pointer-events: none; }
.modal-contenuto {
  background: var(--bg-modal);
  border: 1px solid var(--bordo);
  border-radius: var(--raggio) var(--raggio) 0 0;
  padding: 24px 20px;
  width: 100%; max-width: 500px;
  max-height: 85vh; overflow-y: auto;
  position: relative;
  animation: slideUp .25s ease;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-grande { max-height: 90vh; }
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-chiudi {
  position: absolute; top: 16px; right: 16px;
  background: none; border: 1px solid var(--bordo);
  border-radius: 6px; padding: 4px 10px;
  color: var(--testo); cursor: pointer; font-size: .9rem;
}
.modal-contenuto h3 { font-size: 1.3rem; padding-right: 40px; }

/* ─── Modal cella ───────────────────────────────────────────── */
.cella-bandiera {
  width: 100%; border-radius: 10px;
  background: var(--bordo);
}
#modal-cella .modal-contenuto h3 { padding-right: 0; }
.proprietario-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border-radius: 8px; padding: 10px 14px;
  font-weight: 600;
}
.dot-colore { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; }
.dot-colore.dot-cliccabile { cursor: pointer; transition: transform .15s; }
.dot-colore.dot-cliccabile:hover { transform: scale(1.15); }
.porto-info {
  background: var(--bg-card);
  border-radius: 8px; padding: 10px 14px;
  font-size: .9rem; color: var(--testo-2);
}
.btn-conquista { margin-top: 8px; transition: background .2s, opacity .2s; }
.btn-conquista-attivo { background: linear-gradient(135deg, #2d7a4f, #1e5c3a) !important; color: #fff !important; animation: pulse-btn 1.5s infinite; }
.btn-conquista-bloccato { background: var(--bg-card) !important; color: var(--testo-2) !important; opacity: .7; }
.btn-conquista-propria { background: var(--bg-card) !important; color: var(--oro) !important; opacity: .8; }
@keyframes pulse-btn { 0%,100% { box-shadow: 0 0 0 0 rgba(45,122,79,.4); } 50% { box-shadow: 0 0 0 8px rgba(45,122,79,0); } }
.testo-secondario { color: var(--testo-2); font-size: .9rem; }

/* ─── Modal domande ─────────────────────────────────────────── */
.domanda-block { display: flex; flex-direction: column; gap: 14px; }
.domanda-numero { font-size: .8rem; color: var(--oro); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.domanda-testo  { font-size: 1.05rem; font-weight: 500; line-height: 1.5; }
.opzioni-domanda { display: flex; flex-direction: column; gap: 8px; }
.opzione-btn {
  background: var(--bg-card);
  border: 1px solid var(--bordo);
  border-radius: 8px; padding: 12px 16px;
  color: var(--testo); font-size: .95rem;
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
  display: flex; gap: 10px; align-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(212,169,64,.15);
}
.opzione-btn:hover  { border-color: var(--oro); background: rgba(212,169,64,.08); }
.opzione-btn.selezionata { border-color: var(--oro); background: rgba(212,169,64,.15); }
.opzione-lettera {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bordo);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.opzione-btn.selezionata .opzione-lettera { background: var(--oro); color: #1a1a1a; }
.opzione-btn.corretta { border-color: var(--verde); background: rgba(45,122,79,.2); pointer-events: none; box-shadow: 0 0 12px rgba(45,122,79,.3); }
.opzione-btn.corretta .opzione-lettera { background: var(--verde); }
.opzione-btn.sbagliata { border-color: var(--rosso); background: rgba(198,40,40,.2); pointer-events: none; box-shadow: 0 0 12px rgba(198,40,40,.3); }
.opzione-btn.sbagliata .opzione-lettera { background: var(--rosso); }

/* Spiegazione dopo risposta */

/* Timer domanda */
.domanda-timer-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.domanda-timer-bar {
  height: 100%;
  background: var(--oro);
  border-radius: 2px;
  width: 100%;
  transition: width linear, background-color .3s;
}
.domanda-timer-bar.urgente {
  background: var(--rosso);
}
.spiegazione-box {
  margin-top: 14px; padding: 16px 18px;
  background: linear-gradient(135deg, rgba(212,169,64,.12), rgba(255,215,0,.06));
  border: 1px solid rgba(212,169,64,.35);
  border-radius: 12px;
  font-size: 1rem; line-height: 1.6;
  color: #fff;
  text-align: center;
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 8px rgba(255,215,0,.3); } 50% { box-shadow: 0 0 16px rgba(255,215,0,.7); } }

#domande-footer { padding-top: 4px; }

/* Risultato conquista */
#risultato-conquista { text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
#risultato-icona { font-size: 4rem; }
#risultato-icona.animazione-citta { animation: citta-conquista 1s ease-out; }
@keyframes citta-conquista {
  0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  40% { transform: scale(1.4) rotate(5deg); opacity: 1; }
  60% { transform: scale(0.9) rotate(-2deg); }
  80% { transform: scale(1.1) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}
#risultato-stelle { display: flex; gap: 8px; justify-content: center; font-size: 2rem; }

/* ─── Classifica ────────────────────────────────────────────── */
.classifica-tab-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin: 6px 0 10px; border-bottom: 2px solid var(--bg-card); padding-bottom: 6px;
}
.ctab {
  background: none; border: none; color: var(--testo-2);
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
  font-size: .82rem; font-weight: 600; transition: background .15s, color .15s;
}
.ctab:hover { background: var(--bg-card); color: var(--testo); }
.ctab.attivo { background: var(--verde); color: #fff; }

.classifica-sort-bar {
  display: flex; gap: 4px; margin: 0 0 8px;
}
.csort {
  background: none; border: 1px solid var(--bg-card); color: var(--testo-2);
  padding: 4px 10px; border-radius: 20px; cursor: pointer;
  font-size: .78rem; font-weight: 600; transition: background .15s, color .15s, border-color .15s;
}
.csort:hover { background: var(--bg-card); color: var(--testo); }
.csort.attivo { background: var(--verde); color: #fff; border-color: var(--verde); }

/* Classifica: layout split 50/50 tra panel principale e settimanale.
   Il modal-contenuto del modal-classifica NON deve avere overflow interno
   (lasciamo scorrere i singoli contenitori interni). */
#modal-classifica .modal-contenuto {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: min(85vh, 720px);
}
#classifica-sezione-storica, #classifica-sezione-sett {
  background: var(--bg);
}
/* Due sezioni alternate (storica / settimanale), la visibile occupa tutto,
   figli allineati in top (non stretch dal fondo). */
#classifica-sezione-storica,
#classifica-sezione-sett {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
#classifica-sezione-storica.nascosto,
#classifica-sezione-sett.nascosto { display: none; }
/* Liste settimanali: parent è flex column, figli in top. Scroll se troppi. */
#classifica-sett-giocatori, #classifica-sett-locali, #classifica-sett-albo {
  flex: 0 1 auto;
  max-height: 100%;
  overflow-y: auto;
}

/* Pannelli classifica (il visibile occupa tutto lo spazio della sezione storica) */
.classifica-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 6px;
}
.classifica-panel.nascosto { display: none; }
#classifica-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; flex: 1 1 auto; overflow-y: auto; min-height: 100px; }
[id^="classifica-lista-"] {
  display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
  flex: 1 1 auto; overflow-y: auto; min-height: 100px;
}
.classifica-riga {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border-radius: 8px; padding: 10px 12px;
}
.classifica-pos { font-size: 1.1rem; font-weight: 700; min-width: 24px; text-align: center; }
.classifica-colore { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.classifica-nome { flex: 1; font-weight: 600; font-size: .95rem; }
.classifica-celle { font-size: .85rem; color: var(--testo-2); white-space: nowrap; }
.classifica-pop   { font-size: .75rem; color: var(--testo-2); white-space: nowrap; opacity: .8; }
.classifica-pos.oro    { color: #ffd700; }
.classifica-pos.argento { color: #c0c0c0; }
.classifica-pos.bronzo { color: #cd7f32; }
.classifica-riga-clic { cursor: pointer; transition: background .15s; }
.classifica-riga-clic:hover { background: var(--bg-modal); }
.classifica-vai { margin-left: auto; font-size: .85rem; opacity: .6; }
.classifica-badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle;
}

/* Weekly classifica tabs */
.ctab-sett {
  background: none; border: 1px solid var(--bg-card); color: var(--testo-2);
  padding: 4px 10px; border-radius: 20px; cursor: pointer;
  font-size: .78rem; font-weight: 600; transition: background .15s, color .15s, border-color .15s;
}
.ctab-sett:hover { background: var(--bg-card); color: var(--testo); }
.ctab-sett.attivo { background: var(--oro); color: #000; border-color: var(--oro); }
#classifica-sett-tabs {
  display: flex; gap: 4px; margin: 0 0 8px;
}
/* Albo d'oro navigazione settimane */
.albo-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.albo-nav button { background: none; border: 1px solid var(--bordo); color: var(--testo); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: .8rem; }
.albo-nav button:disabled { opacity: .3; cursor: not-allowed; }
.albo-nav span { font-size: .82rem; color: var(--oro); font-weight: 600; }
.albo-settimana { display: flex; flex-direction: column; gap: 8px; }
.albo-riga {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-card);
  border-radius: 10px; font-size: .9rem;
  border: 1px solid var(--bordo);
}
.albo-riga:hover { background: var(--bg-modal); }
.albo-tipo {
  font-size: .68rem; color: var(--oro); text-transform: uppercase;
  font-weight: 700; min-width: 68px; letter-spacing: .5px;
}
.albo-logo {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--bordo);
}
.albo-dot {
  width: 36px; height: 36px; border-radius: 8px;
  flex-shrink: 0; border: 2px solid var(--bordo);
}

/* Dropdown modalita mappa (header) */
.modo-vista-wrapper { position: relative; }
.modo-vista-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--bordo);
  border-radius: 10px;
  padding: 4px;
  min-width: 148px;
  box-shadow: var(--ombra);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modo-dropdown-item {
  background: none;
  border: none;
  color: var(--testo);
  padding: 9px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .9rem;
  text-align: left;
  width: 100%;
  transition: background .15s;
}
.modo-dropdown-item:hover  { background: var(--bg-card); }
.modo-dropdown-item.attivo { background: var(--verde); color: #fff; }

/* ─── Regole ────────────────────────────────────────────────── */
.regole-lista { list-style: none; display: flex; flex-direction: column; gap: 10px; padding-left: 4px; }
.regole-lista li { font-size: .95rem; line-height: 1.5; }

/* ─── Utility ───────────────────────────────────────────────── */
.nascosto { display: none !important; }

/* ─── Responsive: tablet/desktop ───────────────────────────── */
@media (min-width: 600px) {
  .modal-contenuto {
    border-radius: var(--raggio);
    margin-bottom: 24px;
  }
}

/* Desktop: pannelli centrati e più ampi */
@media (min-width: 1024px) {
  .modal { align-items: center; }
  .modal-contenuto { max-height: 90vh; border-radius: var(--raggio); }
  .modal-grande { max-height: 94vh; }
  /* Override per classifica: lasciamo flex-layout interno gestire lo split */
}

/* ─── Deep link landing (sessione 19 maggio 2026) ─────────────── */
#overlay-landing {
  position: fixed; inset: 0; z-index: 9000;
  background: #0a0f0d;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.landing-hero {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px 48px;
  min-height: 100vh;
}
.landing-card {
  max-width: 380px; width: 100%; text-align: center;
  background: rgba(0,0,0,.4); backdrop-filter: blur(8px);
  border-radius: 18px; padding: 28px 22px;
  border: 1px solid rgba(255,255,255,.1);
  color: #fff;
}
.landing-card h1 {
  font-size: 1.6rem; margin: 16px 0 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.landing-card .landing-sub {
  font-size: 0.95rem; color: rgba(255,255,255,.8); margin: 0 0 18px;
}
.landing-stats {
  display: flex; justify-content: center; gap: 24px; margin: 18px 0 22px;
}
.landing-stats > div {
  display: flex; flex-direction: column; align-items: center;
}
.landing-stats b {
  font-size: 1.6rem; color: #ffd700;
}
.landing-stats span {
  font-size: 0.72rem; color: rgba(255,255,255,.7); margin-top: 2px;
}
.btn-landing {
  width: 100%; padding: 14px; font-size: 1rem; font-weight: 700;
  margin: 8px 0; border-radius: 10px; cursor: pointer;
}
.landing-link {
  display: inline-block; margin-top: 12px;
  color: rgba(255,255,255,.6); font-size: 0.85rem;
  text-decoration: underline;
}
.landing-link:hover { color: rgba(255,255,255,.9); }

/* Landing città */
.landing-citta {
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.landing-hero-img {
  width: 100%; height: 200px;
  background-size: cover; background-position: center;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
@media (min-width: 600px) {
  .landing-hero-img { height: 280px; max-width: 600px; margin: 0 auto; border-radius: 0 0 22px 22px; }
}

/* Hero che si adatta all'immagine. Riquadro fisso, immagine centrata
   con object-fit:contain (vede tutto). Sfondo blurrato della stessa
   immagine riempie le bande laterali/verticali. */
.landing-hero-img-wrap {
  position: relative; width: 100%;
  min-height: 240px; max-height: 60vh; height: 50vh;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  background: #0a0f0d;
  display: flex; align-items: center; justify-content: center;
}
.landing-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(24px) brightness(.55);
  transform: scale(1.1);
}
.landing-hero-img-real {
  position: relative;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  display: block;
}
@media (min-width: 600px) {
  .landing-hero-img-wrap {
    max-width: 600px; margin: 0 auto;
    height: 45vh; max-height: 500px;
  }
}
.landing-citta-content {
  max-width: 540px; width: 100%; margin: 0 auto;
  padding: 24px 20px 48px;
  color: #fff;
}
.landing-citta-content h1 {
  font-size: 1.8rem; margin: 0 0 4px; color: #fff;
}
.landing-search {
  width: 100%; padding: 12px 14px;
  background: #1a1a2e; border: 1px solid #333; border-radius: 10px;
  color: #fff; font-size: 0.95rem; margin: 14px 0;
  box-sizing: border-box;
}
.landing-citta-clans {
  display: flex; flex-direction: column; gap: 8px; margin: 12px 0 18px;
}
.landing-clan-card {
  display: flex; align-items: center; gap: 14px;
  background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 12px;
  padding: 12px 14px; text-decoration: none; color: #fff;
  transition: transform .15s, border-color .15s;
}
.landing-clan-card:hover {
  transform: translateY(-1px); border-color: #ffd700;
}
.landing-clan-info { flex: 1; text-align: left; }
.landing-clan-nome { font-weight: 700; font-size: 0.95rem; }
.landing-clan-stats { font-size: 0.78rem; color: rgba(255,255,255,.6); margin-top: 2px; }
.landing-clan-arrow { font-size: 1.5rem; color: rgba(255,255,255,.4); }
.btn-altri-clan {
  width: 100%; padding: 12px; margin-top: 4px; margin-bottom: 12px;
  background: rgba(255,215,0,.08); border: 1px dashed rgba(255,215,0,.4);
  border-radius: 10px; color: #ffd700; font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: background .15s;
}
.btn-altri-clan:hover { background: rgba(255,215,0,.15); }
.landing-search {
  /* Stile più prominente per ricerca */
  font-weight: 500;
  border: 2px solid #ffd700;
}
.landing-search:focus { outline: 2px solid #ffd700; border-color: #ffd700; }

/* ─── CTA "Scarica l'app" — solo browser web ─── */
#cta-app-banner {
  /* Centrato orizzontalmente, sotto l'header del gioco (header ~50-60px) */
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 8px 8px 14px;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000; font-weight: 700; font-size: 0.82rem;
  border-radius: 999px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  animation: ctaSlideIn .4s ease-out;
}
#cta-app-banner:hover { transform: translateX(-50%) translateY(-1px); }
.cta-app-text { white-space: nowrap; }
.cta-app-x {
  background: rgba(0,0,0,.15); border: none; color: #000;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 0.85rem; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.cta-app-x:hover { background: rgba(0,0,0,.3); }
@keyframes ctaSlideIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@media (max-width: 500px) {
  #cta-app-banner { top: 56px; padding: 6px 8px 6px 12px; font-size: 0.75rem; }
  .cta-app-x { width: 20px; height: 20px; }
}

/* ============ Inline HSL color picker (3 sliders + swatch) ============ */
.cz-hsl-picker { display: flex; align-items: center; gap: 10px; }
.cz-hsl-picker__swatch {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2);
  flex-shrink: 0;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.4);
}
.cz-hsl-picker__sliders { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.cz-hsl-picker__sliders input[type="range"] {
  width: 100%; height: 12px; margin: 0; padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(to right, #444, #aaa);
  -webkit-appearance: none; appearance: none;
  outline: none; cursor: pointer;
}
.cz-hsl-picker__sliders input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  border: 2px solid #1a3a25;
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
  cursor: pointer;
}
.cz-hsl-picker__sliders input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  border: 2px solid #1a3a25;
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
  cursor: pointer;
}
.cz-hsl-picker__hue { background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%) !important; }
.cz-hsl-picker__hex { font-size: .72rem; color: rgba(255,255,255,.55); font-family: monospace; min-width: 60px; text-align: right; }
