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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a2a1a 0%, #2a4a2a 50%, #1a2a1a 100%);
  min-height: 100vh;
  color: #fff;
}

#app { max-width: 1400px; margin: 0 auto; padding: 15px; }
.schermata { display: none; }
.schermata.attiva { display: block; }

/* Auth */
#auth { text-align: center; padding-top: 40px; }
#auth h1 {
  font-size: 3.5em; margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  color: #d4af37;
}
#auth .sottotitolo { color: #8bc48b; margin-bottom: 30px; }
.auth-form { max-width: 320px; margin: 0 auto; }
.auth-form h2 { color: #d4af37; margin-bottom: 20px; }
.auth-form .form-gruppo { margin: 12px auto; }
.auth-form .form-gruppo input { width: 100%; }
.auth-form .btn-primario { width: 100%; margin-top: 10px; }
.auth-switch { margin-top: 15px; font-size: 0.9em; color: #8bc48b; }
.auth-switch a { color: #d4af37; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.nascosto { display: none !important; }
.auth-info { color: #ffc107; font-size: 0.9em; margin-bottom: 15px; }
#messaggioAuth { margin-top: 15px; display: none; }

/* User bar */
.user-bar {
  display: flex; align-items: center; justify-content: center; gap: 15px;
  background: rgba(255,255,255,0.08); border-radius: 10px;
  padding: 12px 20px; margin-bottom: 20px; max-width: 500px; margin-left: auto; margin-right: auto;
}
.user-bar #userNome { font-weight: bold; color: #d4af37; font-size: 1.1em; }
.user-stats { font-size: 0.85em; color: #8bc48b; }
.btn-logout {
  background: rgba(220, 53, 69, 0.6); border: none; color: #fff;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85em;
}
.btn-logout:hover { background: rgba(220, 53, 69, 0.8); }

/* Admin */
.btn-admin {
  background: rgba(138, 43, 226, 0.6); border: none; color: #fff;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85em;
}
.btn-admin:hover { background: rgba(138, 43, 226, 0.8); }
.pannello-admin {
  max-width: 600px; margin: 0 auto 20px; padding: 20px;
  background: rgba(138, 43, 226, 0.1); border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: 12px; text-align: left;
}
.pannello-admin h3 { color: #bb86fc; text-align: center; margin-bottom: 15px; }
.btn-refresh-admin { display: block; margin: 0 auto 15px; padding: 6px 16px; font-size: 0.85em; }
.admin-sezione { margin-bottom: 15px; }
.admin-sezione h4 { color: #bb86fc; margin-bottom: 8px; font-size: 0.95em; }
.admin-lista { font-size: 0.9em; }
.admin-utente {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; background: rgba(255,255,255,0.05); border-radius: 6px; margin-bottom: 4px;
}
.admin-utente .nome { color: #e0e0e0; }
.admin-utente .stato { font-size: 0.8em; color: #8bc48b; }
.admin-utente .stato.in-stanza { color: #d4af37; }
.admin-stanza {
  background: rgba(255,255,255,0.05); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
}
.admin-stanza-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.admin-stanza-codice { font-family: monospace; font-weight: bold; color: #d4af37; letter-spacing: 1px; }
.admin-stanza-stato { font-size: 0.8em; padding: 2px 8px; border-radius: 4px; }
.admin-stanza-stato.attesa { background: rgba(255,193,7,0.3); color: #ffc107; }
.admin-stanza-stato.inCorso { background: rgba(76,175,80,0.3); color: #4caf50; }
.admin-stanza-stato.fineRound { background: rgba(33,150,243,0.3); color: #2196f3; }
.admin-stanza-stato.finePartita { background: rgba(156,39,176,0.3); color: #ce93d8; }
.admin-stanza-giocatori { font-size: 0.85em; color: #ccc; }
.admin-stanza-giocatori .disconnesso { color: #ef5350; text-decoration: line-through; }
.admin-stanza-info { font-size: 0.8em; color: #8bc48b; margin-top: 4px; }
.admin-email { font-size: 0.8em; color: #888; flex: 1; }
.admin-ip { font-size: 0.75em; color: #666; font-family: monospace; }
.btn-reset-pwd {
  padding: 3px 10px; font-size: 0.75em; border: none; border-radius: 4px;
  background: rgba(255,193,7,0.3); color: #ffc107; cursor: pointer;
}
.btn-reset-pwd:hover { background: rgba(255,193,7,0.5); }
.btn-cancella-utente {
  padding: 3px 10px; font-size: 0.75em; border: none; border-radius: 4px;
  background: rgba(220,53,69,0.3); color: #ef5350; cursor: pointer;
}
.btn-cancella-utente:hover { background: rgba(220,53,69,0.5); }
.admin-lista-vuota { color: #888; font-style: italic; padding: 8px; }

/* Lobby */
#lobby { text-align: center; padding-top: 20px; }
#lobby h1 {
  font-size: 2.5em; margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  color: #d4af37;
}

.form-gruppo { margin: 15px auto; max-width: 300px; }
.form-gruppo label { display: block; margin-bottom: 8px; font-weight: bold; }
.form-gruppo input, .form-gruppo select {
  width: 100%; padding: 12px; border: none;
  border-radius: 8px; font-size: 16px; text-align: center;
}
.form-gruppo select { background: #fff; color: #333; cursor: pointer; }
#codiceStanza { text-transform: uppercase; }

.input-stanza-container { display: flex; gap: 0; max-width: 300px; margin: 0 auto; }
.input-stanza-container input { border-radius: 8px 0 0 8px; flex: 1; }
.btn-unisciti-codice {
  border-radius: 0 8px 8px 0; padding: 12px 15px; margin: 0;
  white-space: nowrap; font-size: 14px;
}
.btn-mostra-stanze { margin-top: 10px; font-size: 14px; padding: 10px 20px; }

.lista-stanze {
  max-width: 450px; margin: 15px auto 0; max-height: 400px; overflow-y: auto;
  display: none;
}
.stanza-item {
  background: rgba(255,255,255,0.08); border-radius: 10px; padding: 14px 18px;
  margin-bottom: 10px; color: #e0e0e0;
}
.stanza-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.stanza-codice {
  font-weight: bold; font-family: monospace; font-size: 1.2em;
  color: #d4af37; letter-spacing: 2px;
}
.stanza-desc { font-size: 0.85em; color: #8bc48b; }
.stanza-squadre { display: flex; flex-direction: column; gap: 8px; }
.stanza-sq {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.2); border-radius: 6px; padding: 8px 12px;
}
.stanza-sq-label { font-weight: bold; color: #d4af37; min-width: 20px; }
.stanza-sq-nomi { flex: 1; font-size: 0.9em; color: #ccc; }
.btn-entra-sq {
  padding: 6px 14px; font-size: 0.8em; border: none; border-radius: 6px;
  cursor: pointer; font-weight: bold; white-space: nowrap;
  background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%);
  color: #1a2a1a; transition: transform 0.2s, opacity 0.2s;
}
.btn-entra-sq:hover:not(:disabled) { transform: translateY(-1px); }
.btn-entra-sq:disabled {
  background: rgba(255,255,255,0.1); color: #666; cursor: not-allowed;
}
.lista-stanze .nessuna-stanza {
  padding: 20px; text-align: center; color: #8bc48b;
  background: rgba(255,255,255,0.05); border-radius: 10px;
}

.bottoni-lobby { margin-top: 25px; }

.btn-primario, .btn-secondario {
  padding: 12px 30px; font-size: 16px; border: none;
  border-radius: 8px; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s; margin: 5px;
}
.btn-primario {
  background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%);
  color: #1a2a1a; font-weight: bold;
}
.btn-primario:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}
.btn-secondario { background: rgba(255,255,255,0.2); color: #fff; }
.btn-secondario:hover { background: rgba(255,255,255,0.3); }

.divisore {
  margin: 20px 0; color: #8bc48b; font-size: 1.1em;
  display: flex; align-items: center; justify-content: center; gap: 15px;
}
.divisore::before, .divisore::after {
  content: ''; flex: 1; max-width: 100px; height: 1px;
  background: linear-gradient(to right, transparent, #8bc48b, transparent);
}

.messaggio {
  margin-top: 15px; padding: 10px 20px; border-radius: 8px; display: inline-block;
}
.messaggio.errore { background: rgba(220, 53, 69, 0.8); }
.messaggio.successo { background: rgba(40, 167, 69, 0.8); }
.messaggio.info { background: rgba(212, 175, 55, 0.3); color: #d4af37; }

#messaggioGioco {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%); z-index: 1000;
  font-size: 1.3em; padding: 15px 30px; pointer-events: none;
}

/* Regole */
.sezione-regole {
  margin-top: 30px; padding: 20px; background: rgba(0,0,0,0.3);
  border-radius: 12px; text-align: left; max-width: 600px;
  margin-left: auto; margin-right: auto;
}
.sezione-regole h3 { text-align: center; color: #d4af37; margin-bottom: 15px; cursor: pointer; }
.sezione-regole h3::after { content: ' \25BC'; font-size: 0.7em; }
.sezione-regole.chiusa h3::after { content: ' \25B6'; }
.sezione-regole.chiusa .regole-contenuto { display: none; }
.regole-contenuto { font-size: 0.9em; line-height: 1.6; }
.regole-contenuto h4 { color: #8bc48b; margin-top: 15px; margin-bottom: 8px; }
.regole-contenuto ul { margin-left: 20px; margin-bottom: 10px; }
.regole-contenuto li { margin-bottom: 5px; }

/* Torneo */
.btn-torneo {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
  color: #fff; font-weight: bold; padding: 12px 30px; font-size: 16px;
  border: none; border-radius: 8px; cursor: pointer; margin: 5px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-torneo:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(233,30,99,0.4); }
.btn-piccolo { padding: 8px 16px; font-size: 13px; }

.torneo-header {
  display: flex; align-items: center; gap: 15px; margin-bottom: 20px;
}
.torneo-header h2 { color: #d4af37; flex: 1; text-align: center; margin-right: 80px; }

#torneoScreen, #tabelloneScreen { padding: 20px; }

/* Iscrizioni torneo */
.torneo-info { text-align: center; margin-bottom: 20px; }
.torneo-info h3 { color: #d4af37; font-size: 1.5em; margin-bottom: 5px; }
.torneo-info p { color: #8bc48b; }
.torneo-progress { margin: 15px auto; max-width: 400px; }
.torneo-progress-bar {
  background: rgba(255,255,255,0.1); border-radius: 8px; height: 24px; overflow: hidden;
}
.torneo-progress-fill {
  background: linear-gradient(135deg, #e91e63, #d4af37); height: 100%;
  transition: width 0.3s; border-radius: 8px;
}
.torneo-progress-text { text-align: center; margin-top: 5px; font-size: 0.9em; color: #ccc; }
.torneo-squadre-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; max-width: 800px; margin: 20px auto;
}
.torneo-squadra-card {
  background: rgba(255,255,255,0.08); border-radius: 8px; padding: 12px;
}
.torneo-squadra-card h4 { color: #d4af37; font-size: 0.9em; margin-bottom: 6px; }
.torneo-squadra-card p { font-size: 0.85em; color: #ccc; padding: 2px 0; }
.torneo-squadra-card .slot-vuoto { color: #666; font-style: italic; }
.torneo-giocatore-row { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.torneo-giocatore-row p { margin: 0; }
.torneo-sposta-select, .torneo-assegna-select {
  padding: 3px 5px; font-size: 0.75em; border: none; border-radius: 4px;
  background: rgba(255,255,255,0.15); color: #ccc; cursor: pointer; max-width: 100px;
}
.torneo-assegna-select { width: 100%; max-width: none; padding: 5px; font-size: 0.8em; }
.btn-unisciti-squadra {
  width: 100%; margin-top: 6px; padding: 6px; font-size: 0.8em; border: none;
  border-radius: 5px; cursor: pointer; font-weight: bold;
  background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%); color: #1a2a1a;
}
.btn-unisciti-squadra:hover { opacity: 0.85; }
.torneo-btns { text-align: center; margin-top: 20px; }
.torneo-nessuno { text-align: center; color: #888; padding: 60px 20px; font-size: 1.1em; }

/* Tabellone */
.tabellone-wrapper { overflow-x: auto; padding: 10px 0; }
.tabellone {
  display: flex; gap: 30px; min-width: max-content; align-items: center;
  padding: 20px;
}
.tabellone-round { display: flex; flex-direction: column; gap: 0; justify-content: center; }
.tabellone-round-title {
  text-align: center; color: #d4af37; font-weight: bold; font-size: 0.85em;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px;
}
.tabellone-match {
  background: rgba(255,255,255,0.06); border-radius: 8px; padding: 8px 12px;
  min-width: 180px; border-left: 3px solid transparent;
}
.tabellone-match.in-corso { border-left-color: #4caf50; }
.tabellone-match.completata { border-left-color: #d4af37; }
.tabellone-match.attesa { border-left-color: #666; }
.tabellone-team {
  display: flex; justify-content: space-between; padding: 4px 0;
  font-size: 0.85em; color: #ccc;
}
.tabellone-team.vincitore { color: #d4af37; font-weight: bold; }
.tabellone-team.tbd { color: #555; font-style: italic; }
.tabellone-score { min-width: 30px; text-align: right; }
.tabellone-connector {
  width: 30px; display: flex; flex-direction: column; justify-content: center;
}
.tabellone-line {
  border-right: 2px solid rgba(255,255,255,0.15);
  border-top: 2px solid rgba(255,255,255,0.15);
  border-bottom: 2px solid rgba(255,255,255,0.15);
}
.tabellone-vai-btn {
  display: block; margin-top: 5px; padding: 4px 8px; font-size: 0.75em;
  background: #4caf50; color: #fff; border: none; border-radius: 4px;
  cursor: pointer; text-align: center;
}
.tabellone-vai-btn:hover { background: #388e3c; }

/* Admin torneo */
.admin-torneo-form { display: flex; flex-direction: column; gap: 8px; }
.admin-torneo-row { display: flex; gap: 8px; }
.admin-torneo-row input, .admin-torneo-row select {
  flex: 1; padding: 8px; border-radius: 6px; border: none; font-size: 0.85em;
}
.admin-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 0.85em; color: #ccc; cursor: pointer;
}
.admin-toggle input { cursor: pointer; }
.admin-torneo-attivo { margin-top: 8px; font-size: 0.85em; }
.admin-torneo-attivo .admin-torneo-info { color: #8bc48b; margin-bottom: 5px; }

.btn-tabellone-ingame {
  padding: 4px 12px; font-size: 0.75em; border: none; border-radius: 5px;
  background: linear-gradient(135deg, #e91e63, #c2185b); color: #fff;
  cursor: pointer; margin-top: 4px;
}
.btn-tabellone-ingame:hover { opacity: 0.85; }

/* Classifica */
.sezione-classifica {
  margin-top: 25px; padding: 20px; background: rgba(0,0,0,0.3);
  border-radius: 12px; max-width: 500px; margin-left: auto; margin-right: auto;
}
.sezione-classifica h3 {
  text-align: center; color: #d4af37; margin-bottom: 15px; cursor: pointer;
}
.sezione-classifica h3::after { content: ' \25BC'; font-size: 0.7em; }
.sezione-classifica.chiusa h3::after { content: ' \25B6'; }
.sezione-classifica.chiusa .classifica-contenuto { display: none; }
#tabellaClassifica {
  width: 100%; border-collapse: collapse; font-size: 0.9em;
}
#tabellaClassifica th {
  color: #d4af37; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.2);
  text-align: center; font-size: 0.85em;
}
#tabellaClassifica td {
  padding: 7px 6px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05);
}
#tabellaClassifica tr.utente-corrente td { color: #d4af37; font-weight: bold; }
#tabellaClassifica .pos { color: #8bc48b; font-weight: bold; }
#tabellaClassifica .nome-col { text-align: left; }
.classifica-vuota { text-align: center; color: #8bc48b; padding: 15px; }

/* Attesa */
#attesa { text-align: center; padding-top: 60px; }
.codice-stanza {
  background: rgba(255,255,255,0.1); padding: 20px 40px;
  border-radius: 12px; display: inline-block; margin: 20px 0;
}
.codice-stanza strong { font-size: 2.5em; letter-spacing: 5px; color: #d4af37; }

.squadre-attesa { display: flex; justify-content: center; gap: 40px; margin: 20px 0; }
.squadra-attesa {
  background: rgba(255,255,255,0.08); padding: 20px; border-radius: 12px; min-width: 180px;
}
.squadra-attesa h4 { color: #d4af37; margin-bottom: 10px; }
.lista-giocatori-attesa p { padding: 5px 0; color: #8bc48b; }

.loader {
  width: 50px; height: 50px;
  border: 4px solid rgba(255,255,255,0.3); border-top-color: #d4af37;
  border-radius: 50%; margin: 20px auto; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Gioco */
#gioco { display: none; }
#gioco.attiva { display: block; }

.info-partita {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,0.4); padding: 12px 20px;
  border-radius: 12px; margin-bottom: 15px; flex-wrap: wrap; gap: 10px;
}
.info-squadra {
  display: flex; flex-direction: column; gap: 3px;
  padding: 6px 12px; border-radius: 8px;
}
.info-squadra.noi { background: rgba(212, 175, 55, 0.12); border-left: 3px solid #d4af37; }
.info-squadra.loro { background: rgba(238, 136, 136, 0.12); border-left: 3px solid #e88; }
.info-squadra .nome-squadra { font-weight: bold; font-size: 0.9em; }
.info-squadra.noi .nome-squadra { color: #d4af37; }
.info-squadra.loro .nome-squadra { color: #e88; }
.info-squadra .punti { font-size: 0.85em; }
.burrachi-info { font-size: 0.75em; color: #8bc48b; }
.info-centro { text-align: center; display: flex; flex-direction: column; gap: 5px; }
.extra-info { font-size: 0.8em; color: #8bc48b; }

#turnoIndicatore {
  font-weight: bold; padding: 8px 16px; border-radius: 20px;
  background: rgba(255,255,255,0.1);
}
#turnoIndicatore.mio-turno { background: #d4af37; color: #1a2a1a; }

/* Altri giocatori */
.altri-giocatori {
  display: flex; justify-content: center; gap: 20px;
  flex-wrap: wrap; margin: 10px 0;
}
.gruppo-giocatori {
  background: rgba(0,0,0,0.25); border-radius: 10px;
  padding: 8px 14px; min-width: 180px;
}
.gruppo-giocatori.compagni { border: 2px solid rgba(212, 175, 55, 0.4); }
.gruppo-giocatori.avversari { border: 2px solid rgba(238, 136, 136, 0.4); }
.gruppo-label {
  font-size: 0.7em; font-weight: bold; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 6px; text-align: center;
}
.gruppo-giocatori.compagni .gruppo-label { color: #d4af37; }
.gruppo-giocatori.avversari .gruppo-label { color: #e88; }
.gruppo-lista { display: flex; gap: 10px; justify-content: center; }
.altro-giocatore {
  text-align: center; padding: 6px 10px;
  background: rgba(255,255,255,0.06); border-radius: 6px;
}
.altro-giocatore.compagno { border-bottom: 2px solid #d4af37; }
.altro-giocatore.avversario { border-bottom: 2px solid #e88; }
.altro-giocatore .nome-altro { font-size: 0.8em; margin-bottom: 3px; font-weight: bold; }
.altro-giocatore.compagno .nome-altro { color: #d4af37; }
.altro-giocatore.avversario .nome-altro { color: #e88; }
.altro-giocatore .carte-count { font-size: 0.75em; color: #8bc48b; }

/* Zona centrale */
.zona-centrale {
  display: flex; align-items: center; justify-content: center;
  gap: 30px; margin: 15px 0;
}

.mazzo-container, .scarto-container, .pozzetti-container {
  text-align: center;
}
.mazzo-container .label, .scarto-container .label, .pozzetto .label {
  display: block; font-size: 0.75em; color: #8bc48b; margin-top: 5px;
}

.carta-dorso {
  width: 70px; height: 100px;
  background: linear-gradient(135deg, #1a3a6a 0%, #0a2040 100%);
  border-radius: 6px; border: 2px solid #4a7abd;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.carta-dorso::before {
  content: ''; position: absolute;
  top: 6px; left: 6px; right: 6px; bottom: 6px;
  border: 1.5px solid #6a9add; border-radius: 3px;
}

.mazzo-carte { cursor: pointer; }
.mazzo-carte:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.4); }
.mazzo-count {
  font-size: 1.2em; font-weight: bold; color: #fff; z-index: 1;
}

.scarto-container {
  max-width: 300px; position: relative;
}
.scarto-slot {
  min-width: 80px; min-height: 105px; position: relative;
  border: 2px dashed rgba(255,255,255,0.3); border-radius: 8px;
  cursor: pointer; display: flex; align-items: flex-end;
  background: rgba(255,255,255,0.05); padding: 4px;
  overflow-x: auto; overflow-y: hidden;
}
.scarto-slot:hover { border-color: #d4af37; }
.scarto-slot .carta {
  width: 60px; height: 86px; flex-shrink: 0;
  margin-left: -42px; transition: margin 0.2s;
}
.scarto-slot .carta:first-child { margin-left: 0; }
.scarto-slot:hover .carta { margin-left: -30px; }
.scarto-slot:hover .carta:first-child { margin-left: 0; }

.pozzetti-container { display: flex; gap: 15px; }
.pozzetto { text-align: center; }
.pozzetto-carte { width: 55px; height: 80px; }
.pozzetto-carte::before { top: 5px; left: 5px; right: 5px; bottom: 5px; }
.pozzetto.preso .pozzetto-carte {
  opacity: 0.3; border-style: dashed; background: transparent;
}
.pozzetto.preso .pozzetto-carte::before { display: none; }

/* Carte */
.carta {
  width: 75px; height: 107px; border-radius: 6px;
  overflow: hidden; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  background: #fff; flex-shrink: 0;
}
.carta img { width: 100%; height: 100%; object-fit: contain; }
.carta:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.5); }
.carta.selezionata {
  transform: translateY(-15px);
  box-shadow: 0 12px 25px rgba(212, 175, 55, 0.6);
  outline: 3px solid #d4af37;
}
.carta.wild { outline: 2px solid #e88; }

/* Combinazioni */
.combinazioni-area {
  display: flex; gap: 20px; margin: 15px 0;
}
.combinazioni-squadra {
  flex: 1; background: rgba(0,0,0,0.2); padding: 12px;
  border-radius: 10px; min-height: 120px;
}
.combinazioni-squadra h4 { color: #8bc48b; font-size: 0.85em; margin-bottom: 8px; }
.combinazioni-squadra.avversari h4 { color: #e88; }

.combinazioni-lista { display: flex; flex-direction: column; gap: 8px; }

.combinazione {
  display: flex; align-items: center; gap: 4px;
  padding: 6px; border-radius: 6px;
  background: rgba(255,255,255,0.05);
  cursor: pointer; position: relative;
}
.combinazione:hover { background: rgba(255,255,255,0.1); }
.combinazione .carta {
  width: 45px; height: 64px; margin-left: -20px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.combinazione .carta:first-child { margin-left: 0; }

.combinazione.burraco-puro {
  border: 2px solid #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}
.combinazione.burraco-semipulito {
  border: 2px solid #c0c0c0;
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
}
.combinazione.burraco-sporco {
  border: 2px solid #a87032;
  box-shadow: 0 0 10px rgba(168, 112, 50, 0.2);
}
.badge-burraco {
  position: absolute; top: -8px; right: 5px;
  font-size: 0.65em; font-weight: bold; padding: 2px 8px;
  border-radius: 10px;
}
.badge-burraco.puro { background: #d4af37; color: #1a2a1a; }
.badge-burraco.semipulito { background: #c0c0c0; color: #1a2a1a; }
.badge-burraco.sporco { background: #a87032; color: #fff; }

/* Combinazioni interattive */
.combinazione { cursor: pointer; transition: outline 0.2s, background 0.2s; }

/* Mano giocatore */
.area-giocatore { margin: 15px 0; text-align: center; }
.area-giocatore h3 { color: #8bc48b; margin-bottom: 8px; font-size: 0.95em; }

.mano-carte {
  display: flex; justify-content: center; gap: 4px;
  flex-wrap: wrap; min-height: 110px; padding: 10px;
}

/* Azioni */
.azioni-mossa {
  display: flex; justify-content: center; gap: 10px;
  margin: 10px 0; flex-wrap: wrap;
}
.btn-azione {
  padding: 10px 20px; font-size: 14px; border: none;
  border-radius: 8px; cursor: pointer; font-weight: bold;
  transition: transform 0.2s;
}
.btn-azione:hover { transform: translateY(-2px); }
.btn-azione.pesca { background: #4a9; color: #fff; }
.btn-azione.gioca { background: #d4af37; color: #1a2a1a; }
.btn-azione.scarta { background: #e88; color: #fff; }
.btn-azione.annulla { background: rgba(255,255,255,0.2); color: #fff; }

/* Fine Round */
#fineRound { text-align: center; padding-top: 30px; }
#fineRound h2 { color: #d4af37; margin-bottom: 20px; }

.riepilogo-burraco {
  display: flex; justify-content: center; gap: 30px;
  margin: 25px 0; flex-wrap: wrap;
}
.colonna-punti {
  background: rgba(255,255,255,0.08); padding: 25px 30px;
  border-radius: 12px; min-width: 250px;
}
.colonna-punti h3 { margin-bottom: 15px; color: #d4af37; }

.tabella-punti { width: 100%; border-collapse: collapse; margin-bottom: 15px; }
.tabella-punti td {
  padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tabella-punti td:first-child { text-align: left; }
.tabella-punti td:last-child { text-align: right; font-weight: bold; }
.tabella-punti .riga-totale {
  border-top: 2px solid #d4af37;
  background: rgba(212, 175, 55, 0.15);
}
.tabella-punti .riga-totale td { padding: 10px; font-weight: bold; color: #d4af37; }
.punti-totali { margin-top: 10px; font-size: 1.2em; }

/* Drag & drop */
.carta.dragging { opacity: 0.5; }
.combinazione.drop-hover, .scarto-container.drop-hover {
  outline: 3px dashed #d4af37 !important;
  background: rgba(212, 175, 55, 0.15) !important;
}
.nascosto { display: none !important; }

/* === ANIMATIONS === */

@keyframes cardDraw {
  0% { transform: translateY(-30px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes cardPlay {
  0% { transform: translateY(30px) scale(1.1); opacity: 0.5; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes cardDiscard {
  0% { transform: scale(1.2); opacity: 0.5; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulseGlow {
  0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.5); }
  50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.9); }
  100% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.5); }
}
@keyframes goldFlash {
  0% { background: rgba(212, 175, 55, 0); }
  30% { background: rgba(212, 175, 55, 0.4); }
  100% { background: rgba(212, 175, 55, 0); }
}
@keyframes silverFlash {
  0% { background: rgba(192, 192, 192, 0); }
  30% { background: rgba(192, 192, 192, 0.4); }
  100% { background: rgba(192, 192, 192, 0); }
}
@keyframes slideIn {
  0% { transform: translateX(100px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.anim-pesca .carta { animation: cardDraw 0.4s ease-out; }
.anim-combinazione .combinazione:last-child { animation: cardPlay 0.4s ease-out; }
.anim-scarto .scarto-slot .carta:last-child { animation: cardDiscard 0.5s ease-out; }

.carta.pulse-glow { animation: pulseGlow 1s ease-in-out 2; }
.combinazione.burraco-flash-puro { animation: goldFlash 1s ease-out; }
.combinazione.burraco-flash-sporco { animation: silverFlash 1s ease-out; }

/* Notifica azione avversario */
.notifica-azione {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85); color: #d4af37;
  padding: 15px 30px; border-radius: 12px;
  font-size: 1.2em; font-weight: bold; z-index: 1001;
  pointer-events: none; border: 2px solid #d4af37;
  animation: fadeInOut 2s ease-in-out forwards;
}

/* Attaccabile highlight */
.combinazione.attaccabile {
  outline: 3px solid #4a9 !important;
  background: rgba(74, 153, 74, 0.15) !important;
}

/* Hand drag reorder */
.carta.drag-over-left { border-left: 3px solid #d4af37; }
.carta.drag-over-right { border-right: 3px solid #d4af37; }
.mano-carte .carta.drag-placeholder { opacity: 0.3; }

/* === LOG MOSSE (in basso, compatto) === */
.pannello-log {
  background: rgba(0,0,0,0.35); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  max-height: 130px; display: flex; flex-direction: column;
  margin-top: 10px;
}
.log-header {
  padding: 5px 12px; font-weight: bold; font-size: 0.75em; color: #8bc48b;
  border-bottom: 1px solid rgba(255,255,255,0.08); cursor: pointer;
}
.log-header::after { content: ' \25BC'; font-size: 0.7em; }
.pannello-log.chiuso .log-mosse { display: none; }
.pannello-log.chiuso .log-header::after { content: ' \25B6'; }
.log-mosse {
  overflow-y: auto; padding: 4px 10px; font-size: 0.7em;
  display: flex; flex-direction: column; gap: 1px; flex: 1;
}
.log-entry {
  padding: 2px 0; color: #aaa; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.log-entry .log-nome { font-weight: bold; color: #8bc48b; }
.log-entry.burraco { color: #d4af37; font-weight: bold; }
.log-entry.chiusura { color: #e88; font-weight: bold; }

/* Responsive */
@media (max-width: 768px) {
  .carta { width: 55px; height: 79px; }
  .combinazione .carta { width: 35px; height: 50px; margin-left: -15px; }
  .combinazioni-area { flex-direction: column; }
  .zona-centrale { flex-wrap: wrap; gap: 15px; }
  .info-partita { flex-direction: column; gap: 8px; }
  .riepilogo-burraco { flex-direction: column; gap: 15px; }
  .colonna-punti { min-width: auto; }
  .altri-giocatori { gap: 8px; }
}
