/* ===================================================
   I TOCCHI - Stili CSS Mobile-First
   =================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colori principali */
  --primary: #e8a838;
  --primary-dark: #c48820;
  --primary-light: #ffd06b;
  --secondary: #2d5a3d;
  --secondary-dark: #1e3d29;
  --secondary-light: #3d7a52;
  --accent: #d44040;
  --accent-light: #ff6b6b;
  
  /* Sfondo */
  --bg-dark: #1a1a2e;
  --bg-medium: #16213e;
  --bg-light: #0f3460;
  --bg-card: #1e2a4a;
  --bg-overlay: rgba(0, 0, 0, 0.7);
  
  /* Testo */
  --text-primary: #ffffff;
  --text-secondary: #b8c5d6;
  --text-muted: #6b7b8d;
  --text-gold: #ffd700;
  
  /* Dimensioni */
  --header-height: 50px;
  --controls-height: 200px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-round: 50%;
  
  /* Ombre */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(232, 168, 56, 0.3);
  
  /* Font */
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;

  /* Animazioni */
  --speed-mult: 1;
}

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

#app {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* --- Schermate --- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  display: flex;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-medium);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.screen-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  flex: 1;
}

/* --- HOME SCREEN --- */
.home-bg {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-light) 100%);
  position: relative;
  overflow: hidden;
}

.floating-coins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.float-coin {
  position: absolute;
  font-size: 2rem;
  left: var(--x);
  animation: floatCoin 4s ease-in-out infinite;
  animation-delay: var(--delay);
  opacity: 0.2;
}

@keyframes floatCoin {
  0%, 100% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.2; }
  90% { opacity: 0.2; }
  50% { transform: translateY(-10vh) rotate(360deg); }
}

.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
  gap: 40px;
}

.logo-container {
  text-align: center;
  animation: logoAppear 0.8s ease-out;
}

@keyframes logoAppear {
  from { transform: scale(0.8) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.game-title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-gold);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.4), 0 4px 8px rgba(0,0,0,0.5);
  letter-spacing: 4px;
  line-height: 1;
}

.game-subtitle {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 2px;
}

.game-motto {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: #fbbf24;
  margin-top: 6px;
  background: rgba(251, 191, 36, 0.1);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  display: inline-block;
}

/* Hero Artwork Card nella Home Screen */
.home-hero-card {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(232, 168, 56, 0.3);
  border: 2px solid rgba(232, 168, 56, 0.4);
  transition: transform 0.3s ease;
  animation: heroCardFloat 4s ease-in-out infinite;
}

@keyframes heroCardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9), 0 0 35px rgba(232, 168, 56, 0.5); }
}

.hero-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  overflow: hidden;
}

.hero-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-tag-badge {
  position: absolute;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  z-index: 2;
}

.hero-tag-badge.top-left {
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: 1px solid #6ee7b7;
}

.hero-tag-badge.bottom-center {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: 1px solid #fca5a5;
  white-space: nowrap;
}

.hero-glow-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.5) 0%, transparent 60%);
  pointer-events: none;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

/* --- Pulsanti --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 14px 24px;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg), 0 0 30px rgba(232, 168, 56, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid rgba(255,255,255,0.2);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-large {
  padding: 16px 28px;
  font-size: 1.1rem;
}

.btn-icon {
  font-size: 1.3rem;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 4px 8px;
}

.btn-round {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-round);
  border: 2px solid var(--primary);
  background: rgba(232, 168, 56, 0.1);
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-round:active {
  background: var(--primary);
  color: #fff;
  transform: scale(0.9);
}

.btn-confirm {
  width: 100%;
  max-width: 300px;
  margin: 8px auto 0;
}

.btn-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* --- SETUP SCREEN --- */
.setup-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 100px;
}

.setup-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.setup-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-gold);
  margin-bottom: 12px;
  display: block;
}

/* Selettore numero giocatori */
.player-count-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.count-display {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 60px;
  text-align: center;
}

.player-count-range {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Selettore difficoltà */
.difficulty-selector {
  display: flex;
  gap: 8px;
}

.diff-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.diff-btn.active {
  border-color: var(--primary);
  background: rgba(232, 168, 56, 0.15);
  color: var(--primary);
}

/* Lista giocatori */
.players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.player-item.is-human-featured {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: linear-gradient(135deg, rgba(232, 168, 56, 0.12) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 0 15px rgba(232, 168, 56, 0.25);
  gap: 12px;
}

.human-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.human-profile-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.human-profile-body {
  display: flex;
  align-items: center;
  gap: 14px;
}

.human-main-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 2.5px solid #ffd700 !important;
  background: rgba(0,0,0,0.6) !important;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.5);
  flex-shrink: 0;
}

.human-profile-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.human-name-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffd700;
}

.human-input {
  font-family: var(--font-display) !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  border-bottom: 2px solid var(--primary) !important;
  padding: 2px 4px !important;
}

.human-category-picker {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.quick-cat-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  color: #e2e8f0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-cat-btn:hover {
  background: rgba(232, 168, 56, 0.2);
  border-color: var(--primary);
}

.quick-cat-btn.active {
  background: linear-gradient(135deg, #e8a838 0%, #c9881e 100%);
  border-color: #ffd700;
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(232, 168, 56, 0.6);
}

.player-avatar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed rgba(232, 168, 56, 0.5);
  border-radius: var(--radius);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.player-avatar-btn:hover {
  background: rgba(232, 168, 56, 0.2);
  border-color: var(--primary);
  transform: scale(1.05);
}

.player-avatar-btn:active {
  transform: scale(0.95);
}

.avatar-edit-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius-round);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar {
  font-size: 1.8rem;
  width: 36px;
  text-align: center;
  line-height: 1;
}

.player-name-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.player-name-input:focus {
  border-bottom-color: var(--primary);
}

.player-type-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.player-type-badge.human {
  background: rgba(232, 168, 56, 0.2);
  color: var(--primary);
}

.player-type-badge.bot {
  background: rgba(100, 120, 150, 0.3);
  color: var(--text-secondary);
}

/* Selettore tema (Griglia 2x2 elegante) */
.theme-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(8px);
}

.theme-btn:hover {
  background: rgba(232, 168, 56, 0.1);
  border-color: rgba(232, 168, 56, 0.5);
  transform: translateY(-2px);
}

.theme-btn.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(232, 168, 56, 0.25) 0%, rgba(20, 30, 50, 0.6) 100%);
  color: var(--primary-light);
  box-shadow: 0 0 16px rgba(232, 168, 56, 0.3);
  transform: translateY(-2px);
}

.theme-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.theme-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.btn-start {
  margin-top: 8px;
}

/* --- GAME SCREEN --- */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  height: var(--header-height);
  flex-shrink: 0;
  z-index: 10;
  gap: 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.game-header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.game-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-header-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-round);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-header-icon:hover {
  background: rgba(232, 168, 56, 0.2);
  border-color: var(--primary);
  transform: rotate(30deg);
}

.round-badge {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 4px 12px;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.phase-display {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.players-remaining {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 3px 8px;
  border-radius: 99px;
}

/* ==================== LIVE PROVISIONAL BANNER ==================== */
.live-provisional-banner {
  width: 100%;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(10, 15, 30, 0.9) 100%);
  border-bottom: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  padding: 6px 14px;
  z-index: 9;
  flex-shrink: 0;
  animation: slideDownBanner 0.3s ease-out;
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.provisional-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

/* Finale Track (1v1 First to 3) */
.provisional-content.finale-track {
  gap: 12px;
}

.prov-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.prov-player.p2 {
  justify-content: flex-end;
}

.prov-pname {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prov-stars {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 1.1rem;
}

.prov-star.active {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.9));
  animation: starPulse 1.8s infinite;
}

.prov-star.empty {
  opacity: 0.3;
  font-size: 0.75rem;
}

@keyframes starPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.prov-num {
  font-size: 0.85rem;
  color: var(--primary);
  margin-left: 2px;
}

.prov-center-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 10px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 99px;
  flex-shrink: 0;
}

.prov-first-speaker-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #000;
  background: linear-gradient(135deg, #ffd700, #f59e0b);
  padding: 1px 6px;
  border-radius: 99px;
  margin-top: 2px;
  white-space: nowrap;
}

/* Badge 1° A Parlare posizionato sotto al nome per non coprire avatar e fumetti */
.first-speaker-badge {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffd700, #f59e0b);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 99px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 2px 6px rgba(0,0,0,0.6);
  white-space: nowrap;
  z-index: 25;
  border: 1.5px solid #fff;
  animation: firstSpeakerPulse 1.8s infinite;
}

@keyframes firstSpeakerPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); box-shadow: 0 0 18px rgba(255, 215, 0, 1); }
}

.prov-tag-vs {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.prov-sub-target {
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
}

/* Multi-Player Track (Elimination) */
.provisional-content.multi-track {
  gap: 8px;
  font-size: 0.8rem;
}

.prov-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}

.prov-group.active-group {
  justify-content: flex-end;
}

.prov-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.prov-pill.safe {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.prov-pill.active {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.prov-list {
  color: #e2e8f0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
}

@media (max-width: 500px) {
  .live-provisional-banner {
    padding: 4px 8px;
  }
  .prov-pname {
    max-width: 75px;
    font-size: 0.8rem;
  }
  .prov-stars {
    font-size: 0.95rem;
  }
}

.player-score-tag {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700, #ff9f1c);
  color: #1a1a2e;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  vertical-align: middle;
}

/* --- GAME SCREEN LAYOUT 100% VISIBLE --- */
#screen-game {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-height: 100vh;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-sizing: border-box;
}

#screen-game.active {
  display: flex !important;
}

/* Area tavolo scenografica */
.game-table-area {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Sfondo panoramico fotografico con dissolvenza */
.table-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.6) saturate(1.15);
  transition: background-image 0.6s ease-in-out, filter 0.6s;
  z-index: 0;
}

.table-backdrop::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.2) 0%, rgba(10,15,30,0.7) 100%);
  pointer-events: none;
}

.table-container {
  position: relative;
  width: 92vw;
  max-width: 580px;
  height: 92vw;
  max-height: calc(100vh - 48px - 138px);
  aspect-ratio: 1.32 / 1;
  margin: auto;
  z-index: 1;
}

/* Tavolo da gioco centrale Ovale con texture e bordo dorato */
.table-surface {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  height: 62%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s ease;
  z-index: 1;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 0 5px #78350f, 0 0 0 8px #ffd700, inset 0 0 35px rgba(0,0,0,0.65);
}

.table-center {
  text-align: center;
}

.table-total {
  display: none;
}

/* Cerchio Compatto e Luminoso con il Totale al Centro del Tavolo */
.table-center-total-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1e293b 0%, #0a0f1d 100%);
  border: 3px solid #ffd700;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.95), inset 0 2px 8px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.table-center-total-circle.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate(-50%, -50%) scale(0.2) !important;
}

.table-center-total-circle.visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%, -50%) scale(1) !important;
  animation: centerCirclePop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes centerCirclePop {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.center-circle-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: -3px;
  line-height: 1;
}

.table-total-number {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 215, 0, 1), 0 2px 6px rgba(0,0,0,0.9);
}

.coin-mini {
  font-size: 0.9rem;
  line-height: 1;
  margin-top: -2px;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.8));
}

/* Scritta Illuminata "VINCE" sopra al cerchio del vincitore */
.badge-vince-glow {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 99px;
  border: 2px solid #ffd700;
  white-space: nowrap;
  z-index: 30;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.9), 0 0 25px rgba(255, 215, 0, 0.8), 0 6px 14px rgba(0,0,0,0.7);
  animation: vinceGlowPulse 0.8s ease-in-out infinite alternate;
}

@keyframes vinceGlowPulse {
  0% {
    transform: translateX(-50%) scale(0.96);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.8), 0 0 20px rgba(255, 215, 0, 0.7);
  }
  100% {
    transform: translateX(-50%) scale(1.08);
    box-shadow: 0 0 24px rgba(34, 197, 94, 1), 0 0 35px rgba(255, 215, 0, 1), 0 8px 18px rgba(0,0,0,0.9);
  }
}

.verdict-winner {
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.7);
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 99px;
  display: inline-block;
}

.verdict-nowinner {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 99px;
  display: inline-block;
}

/* Giocatori attorno al tavolo */
.table-players {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.table-player {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
  pointer-events: auto;
}

.table-player.current-turn {
  z-index: 10;
}

.table-player.eliminated {
  opacity: 0.35;
  filter: grayscale(0.85);
  transform: translate(-50%, -50%) scale(0.85);
}

/* Card e Avatar 3D ad alta definizione */
.player-character {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.table-player.current-turn .player-character {
  transform: scale(1.22);
  z-index: 15;
}

.player-dynamic-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dyn-character-wrap {
  animation: charBreathe 3.2s ease-in-out infinite;
  transform-origin: 50% 90%;
}

@keyframes charBreathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-3px) scaleY(1.02); }
}

.avatar-3d-frame {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-round);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.75), 0 0 0 3.5px #ffd700, inset 0 2px 6px rgba(255, 255, 255, 0.5);
  background: #0f172a;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-3d-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.table-player.current-turn .avatar-3d-frame {
  box-shadow: 0 0 32px rgba(255, 215, 0, 0.95), 0 0 0 4px #ffd700, 0 14px 32px rgba(0,0,0,0.85);
  animation: goldPulse 1.6s ease-in-out infinite;
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.8), 0 0 0 4px #ffd700; }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 0 5px #fff; }
}

.table-player.player-ready .avatar-3d-frame {
  box-shadow: 0 0 24px rgba(76, 175, 80, 0.95), 0 0 0 3.5px #4caf50;
}

.player-glow-ring {
  display: none;
}

.player-name-tag {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 900;
  color: #ffffff;
  background: rgba(8, 14, 30, 0.96);
  backdrop-filter: blur(10px);
  border: 2px solid #ffd700;
  padding: 3px 12px;
  border-radius: 99px;
  margin-top: -10px;
  max-width: 100px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.85), 0 0 12px rgba(255, 215, 0, 0.4);
  z-index: 5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 1);
  letter-spacing: 0.3px;
}

.table-player.current-turn .player-name-tag {
  border-color: #ffffff;
  color: #ffd700;
  background: linear-gradient(135deg, rgba(30, 20, 10, 0.98) 0%, rgba(60, 40, 10, 0.98) 100%);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 6px 16px rgba(0,0,0,0.85);
}

.table-player.winner-glow {
  z-index: 25;
}

.table-player.winner-glow .avatar-3d-frame {
  box-shadow: 0 0 28px rgba(255, 215, 0, 1), 0 0 0 4px #ffd700, 0 10px 24px rgba(0,0,0,0.85);
  transform: scale(1.15);
  animation: winnerGoldPulse 1.2s infinite alternate;
}

.table-player.winner-glow .player-name-tag {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  color: #fff;
  border: 2px solid #ffd700;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.8);
  transform: scale(1.1);
  max-width: 130px;
}

@keyframes winnerGoldPulse {
  0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 0 3px #ffd700; }
  100% { box-shadow: 0 0 35px rgba(255, 215, 0, 1), 0 0 0 5px #fff; }
}

/* Fumetto dichiarazione grande e ben visibile */
.player-declaration {
  background: linear-gradient(135deg, rgba(20, 30, 55, 0.95) 0%, rgba(10, 15, 30, 0.95) 100%);
  border: 2px solid var(--primary);
  border-radius: 99px;
  padding: 3px 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-gold);
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 6px 16px rgba(0,0,0,0.6), 0 0 14px rgba(232, 168, 56, 0.4);
}

.player-declaration.visible {
  opacity: 1;
  transform: scale(1);
}

.player-declaration.ready-status {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-color: #4caf50;
  color: #a5d6a7;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.player-declaration.correct {
  border-color: #4caf50;
  color: #fff;
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
}

.player-declaration.wrong {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, #c62828 0%, #8e0000 100%);
  box-shadow: 0 0 14px rgba(212, 64, 64, 0.5);
}

/* Pugno e Mano 3D Fotorealistici sul Tavolo - Proporzionati senza accavallamenti */
.tabletop-hand-wrapper {
  position: absolute;
  width: 68px;
  height: 68px;
  margin-top: -34px;
  margin-left: -34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transform: rotate(var(--hand-angle, 0deg)) scale(0.3);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.tabletop-hand-wrapper.on-table {
  opacity: 1;
  transform: rotate(var(--hand-angle, 0deg)) scale(1);
}

.tabletop-hand {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.real-3d-hand-frame {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.9), 0 0 0 2.5px rgba(255, 215, 0, 0.7), inset 0 2px 6px rgba(255, 255, 255, 0.4);
  background: #0a0f1d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.real-3d-hand-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  display: block;
}

.hand-depth-shadow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.tabletop-hand.open {
  animation: handOpenCenter 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes handOpenCenter {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1.02); }
}

/* Badge e Monete nel Palmo - Compatte e Nitide */
.palm-coins-overlay {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.palm-coin-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.palm-coin-item {
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
  margin: 0 -2px;
  animation: coinPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.palm-coins-overlay.count-1 .palm-coin-item {
  font-size: 1.35rem;
}

.palm-coins-overlay.count-2 .palm-coin-item {
  font-size: 1.1rem;
}

.palm-coins-overlay.count-3 .palm-coin-item {
  font-size: 0.95rem;
  margin: 0 -3px;
}

.palm-coins-badge-mini {
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 30, 0.96);
  border: 1.5px solid #ffd700;
  color: #fbbf24;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.72rem;
  padding: 0 5px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.dyn-char-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Monete rivelate posizionate davanti alle dita verso il centro del tavolo */
.tabletop-coins {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  font-size: 1.4rem;
  opacity: 0;
  transition: all 0.35s ease;
  filter: drop-shadow(0 2px 12px rgba(255, 215, 0, 1));
  z-index: 20;
}

.tabletop-coins.visible {
  opacity: 1;
  animation: coinsPopOnTable 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes coinsPopOnTable {
  0% { transform: translateX(-50%) scale(0.3); opacity: 0; }
  70% { transform: translateX(-50%) scale(1.3); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Area log/dichiarazioni e banner dinamici nascosti per layout 100% fisso */
.live-provisional-banner,
.game-log-area {
  display: none !important;
}

/* --- Controlli giocatore (Barra footer rialzata, compatta e 100% visibile) --- */
.game-controls {
  flex-shrink: 0;
  height: 125px;
  min-height: 125px;
  max-height: 125px;
  background: linear-gradient(180deg, rgba(12, 18, 36, 0.98) 0%, rgba(6, 10, 22, 0.99) 100%);
  backdrop-filter: blur(16px);
  border-top: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.9);
  padding: 4px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 50;
  position: relative;
}

.control-panel {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.control-panel.hidden {
  display: none !important;
}

.control-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.hiding-main-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.decl-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.decl-range-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.decl-excluded-badge {
  font-size: 0.78rem;
  color: #ff6b6b;
}

.decl-main-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.roundend-main-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.round-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid rgba(255, 215, 0, 0.55);
  padding: 8px 14px;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.35);
  max-width: 96vw;
}

.round-result-card.winner {
  border-color: #22c55e;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 25px rgba(34, 197, 94, 0.55);
}

.round-result-card.no-winner {
  border-color: #f59e0b;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 158, 11, 0.4);
}

.round-result-main-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.round-detail-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}

.round-p-badge {
  font-size: 0.76rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.round-p-badge.winner-p {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  color: #86efac;
  font-weight: 800;
}

.round-result-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(255, 215, 0, 0.45);
  padding: 4px 12px;
  border-radius: 99px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.round-result-pill.winner {
  border-color: #22c55e;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
}

.round-result-pill.no-winner {
  border-color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}

.pill-badge {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pill-badge.winner {
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  color: #fff;
}

.pill-badge.no-winner {
  background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%);
  color: #fff;
}

.pill-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
}

.pill-countdown {
  font-size: 0.76rem;
  font-weight: 800;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.btn-round-next {
  background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%) !important;
  color: #000000 !important;
  font-family: var(--font-display) !important;
  font-size: 0.92rem !important;
  font-weight: 900 !important;
  padding: 6px 24px !important;
  border-radius: 99px !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.8) !important;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin: 0 !important;
}

.btn-round-next:hover, .btn-round-next:active {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.95), 0 4px 10px rgba(0, 0, 0, 0.9) !important;
}

/* Selettore monete */
.coin-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.coin-btn {
  width: 54px;
  height: 44px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  padding: 2px 4px;
}

.coin-btn.selected {
  border-color: var(--primary);
  background: rgba(232, 168, 56, 0.25);
  color: var(--primary);
  transform: scale(1.06);
  box-shadow: var(--shadow-glow);
}

.coin-btn:active {
  transform: scale(0.95);
}

.coin-count {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.coin-label {
  font-size: 0.55rem;
  line-height: 1;
}

.coin-emoji {
  font-size: 0.68rem;
  line-height: 1;
}

.declaration-input-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-decl {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  border-radius: 50%;
}

.declaration-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-gold);
  min-width: 44px;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.6);
}

.btn-confirm {
  padding: 8px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 99px;
}

/* Waiting indicator */
.waiting-indicator {
  text-align: center;
  padding: 16px;
}

.waiting-dots {
  font-size: 2rem;
  color: var(--primary);
}

.waiting-dots span {
  animation: dotBlink 1.4s infinite;
  display: inline-block;
}

.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBlink {
  0%, 20% { opacity: 0; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-8px); }
  100% { opacity: 0; transform: translateY(0); }
}

#waiting-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Round result */
.round-result {
  text-align: center;
  padding: 8px 16px;
}

.round-result-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.round-result-title.winner {
  color: #4caf50;
}

.round-result-title.no-winner {
  color: var(--accent-light);
}

.round-result-detail {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- RESULT SCREEN --- */
.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  gap: 24px;
}

.result-emoji {
  font-size: 5rem;
  animation: resultBounce 0.6s ease;
}

@keyframes resultBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.result-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
}

.result-title.somaro {
  color: var(--accent);
  animation: somaroShake 0.5s ease infinite;
}

@keyframes somaroShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.result-title.victory {
  color: var(--text-gold);
}

.result-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.result-ranking {
  width: 100%;
  max-width: 300px;
}

.result-ranking h3 {
  font-family: var(--font-display);
  margin-bottom: 12px;
  color: var(--text-gold);
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.ranking-position {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-gold);
  min-width: 30px;
}

.ranking-avatar {
  font-size: 1.3rem;
}

.ranking-name {
  flex: 1;
  text-align: left;
}

.ranking-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.ranking-badge.safe {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
}

.ranking-badge.somaro {
  background: rgba(212, 64, 64, 0.2);
  color: var(--accent);
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

/* Finale banner */
.finale-banner {
  background: linear-gradient(135deg, rgba(212, 64, 64, 0.2), rgba(232, 168, 56, 0.2));
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  text-align: center;
  animation: finalePulse 2s ease-in-out infinite;
}

@keyframes finalePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(232, 168, 56, 0.2); }
  50% { box-shadow: 0 0 30px rgba(232, 168, 56, 0.5); }
}

.finale-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-gold);
  font-weight: 700;
}

.finale-score {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-top: 4px;
}

.finale-round-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Modali --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.rules-body h3 {
  font-family: var(--font-display);
  color: var(--text-gold);
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.rules-body h3:first-child {
  margin-top: 0;
}

.rules-body p, .rules-body li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 4px;
}

.rules-body ol, .rules-body ul {
  padding-left: 20px;
}

.rules-body .rule-section {
  margin-bottom: 16px;
}

/* --- Settings --- */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.setting-item label:first-child {
  font-size: 0.95rem;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 28px;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background: var(--primary);
}

input:checked + .slider::before {
  transform: translateX(22px);
}

/* Volume slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

/* Select */
select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

/* --- Effetti / Overlay --- */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
}

.confetti-container.hidden {
  display: none;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall var(--fall-duration, 3s) ease-in forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotateZ(0deg) rotateX(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotateZ(720deg) rotateX(360deg); opacity: 0; }
}

.somaro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(185, 28, 28, 0.92) 0%, rgba(69, 10, 10, 0.98) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: somaroAppear 0.5s ease;
}

.somaro-overlay.hidden {
  display: none;
}

@keyframes somaroAppear {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.somaro-content {
  text-align: center;
  padding: 20px;
}

.pollo-crying-anim {
  position: relative;
  display: inline-block;
  font-size: 8.5rem;
  line-height: 1;
  animation: polloWobble 0.9s ease-in-out infinite;
}

.pollo-big-emoji {
  display: inline-block;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.6));
}

.pollo-tears-emoji {
  position: absolute;
  bottom: -15px;
  right: -25px;
  font-size: 4.5rem;
  animation: tearsFountain 1s infinite;
}

.pollo-subtitle {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #ffd700;
  font-weight: 700;
  margin-top: 12px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

@keyframes polloWobble {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.08) rotate(-7deg); }
  75% { transform: scale(1.08) rotate(7deg); }
}

@keyframes tearsFountain {
  0% { transform: translateY(0) scale(0.7); opacity: 0; }
  50% { transform: translateY(14px) scale(1.15); opacity: 1; }
  100% { transform: translateY(30px) scale(1); opacity: 0; }
}

.pollo-grand-modal {
  position: relative;
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 440px;
  margin: 0 auto;
}

.pollo-art-frame {
  position: relative;
  width: 210px;
  height: 210px;
  border-radius: 24px;
  overflow: hidden;
  border: 4px solid #f59e0b;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.85), 0 10px 30px rgba(0,0,0,0.9);
  margin-bottom: 16px;
  background: #000;
}

.pollo-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pollo-broken-crown {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
  animation: crownWiggle 1.5s infinite;
}

@keyframes crownWiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(15deg) scale(1.1); }
}

.pollo-floating-feathers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.feather {
  position: absolute;
  font-size: 1.8rem;
  animation: featherFall 3s linear infinite;
}

.feather.f1 { top: 10%; left: 15%; animation-delay: 0s; }
.feather.f2 { top: 20%; right: 10%; animation-delay: 0.8s; }
.feather.f3 { top: 55%; left: 8%; animation-delay: 1.6s; }
.feather.f4 { top: 60%; right: 15%; animation-delay: 2.3s; }

@keyframes featherFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 0.9; }
  100% { transform: translateY(120px) rotate(180deg); opacity: 0; }
}

/* Grande Schermata Risultato Finale: IL POLLO */
.grand-pollo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  max-width: 460px;
  margin: 0 auto;
  animation: fadeInScale 0.5s ease-out;
}

.grand-pollo-art-box {
  position: relative;
  width: 230px;
  height: 230px;
  border-radius: 28px;
  overflow: hidden;
  border: 4px solid #ef4444;
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.85), 0 14px 35px rgba(0, 0, 0, 0.95);
  margin: 10px auto 16px auto;
  background: #000;
}

.grand-pollo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grand-pollo-name {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9), 0 0 25px rgba(239, 68, 68, 0.85);
  margin: 4px 0 6px 0;
  letter-spacing: 1.5px;
  animation: somaroShake 0.4s ease-in-out infinite;
}

.grand-pollo-subtitle {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #fca5a5;
  font-weight: 700;
  margin-bottom: 16px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  max-width: 380px;
}

/* Classifica Finale Partita Card */
.final-scoreboard-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 18px;
  padding: 14px 16px;
  margin: 12px auto 18px auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  text-align: left;
}

.scoreboard-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  color: #ffd700;
  text-align: center;
  margin: 0 0 12px 0;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scoreboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.scoreboard-row.safe-row {
  border-left: 4px solid #22c55e;
}

.scoreboard-row.pollo-row {
  background: rgba(239, 68, 68, 0.15);
  border-left: 4px solid #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.score-medal {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  color: #e2e8f0;
  min-width: 95px;
}

.score-pinfo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  margin: 0 8px;
}

.score-pname {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}

.score-pname.pollo-name-tag {
  color: #fca5a5;
}

.score-status {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
}

.score-status.safe-tag {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.score-status.pollo-tag {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  animation: pulse 1s infinite;
}

.champion-avatar-box {
  margin: 6px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.champion-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 14px rgba(255, 215, 0, 0.8);
  margin: 2px 0 0 0;
}

.champion-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Badge conto alla rovescia automatico per prossimo round */
.auto-next-countdown-badge {
  background: rgba(232, 168, 56, 0.15);
  border: 1px solid rgba(232, 168, 56, 0.4);
  color: #fde047;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
  margin-top: 10px;
  display: inline-block;
  animation: pulse 1.2s infinite;
}

/* --- Responsive - Tablet e su --- */
@media (min-width: 768px) {
  .home-content {
    gap: 60px;
  }
  
  .game-title {
    font-size: 5rem;
  }
  
  .game-subtitle {
    font-size: 1.4rem;
  }
  
  .table-container {
    max-width: 500px;
  }
  
  .player-avatar-circle {
    width: 64px;
    height: 64px;
    font-size: 2.6rem;
  }
  
  .player-name-tag {
    font-size: 0.8rem;
    max-width: 85px;
  }
}

/* --- Animazioni Utili --- */
.animate-bounce-in {
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.animate-shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- Avatar Grid Modal --- */
/* Setup Character Previews */
.setup-char-preview {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-char-preview .avatar-3d-frame {
  width: 44px;
  height: 44px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6), 0 0 0 2px #ffd700;
}

/* --- Avatar Grid Modal con Personaggi Dinamici --- */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 290px;
  overflow-y: auto;
  padding: 6px;
}

.avatar-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-svg-thumb {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-svg-thumb .avatar-3d-frame {
  width: 54px;
  height: 54px;
}

.avatar-model-name {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.avatar-type-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.avatar-type-pill.man { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
.avatar-type-pill.woman { background: rgba(236, 72, 153, 0.25); color: #f472b6; }
.avatar-type-pill.animal { background: rgba(245, 158, 11, 0.25); color: #fde047; }

.avatar-3d-emoji-char {
  font-size: 2.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.7));
  user-select: none;
}

.avatar-category-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 4px;
}

.avatar-tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.avatar-tab-btn:hover {
  background: rgba(232, 168, 56, 0.15);
  color: #fff;
  border-color: var(--primary);
}

.avatar-tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #000;
  border-color: var(--primary-light);
  box-shadow: 0 0 12px rgba(232, 168, 56, 0.4);
}

.avatar-grid-item:hover {
  background: rgba(232, 168, 56, 0.15);
  border-color: var(--primary-light);
  transform: scale(1.08);
}

.avatar-grid-item.selected {
  border-color: var(--primary);
  background: rgba(232, 168, 56, 0.25);
  box-shadow: 0 0 14px rgba(232, 168, 56, 0.5);
  transform: scale(1.05);
}

/* ===================================================
   4 AMBIENTAZIONI SCENOGRAFICHE AD ALTA DEFINIZIONE
   =================================================== */

/* 1. 🏖️ COTTAGE AL MARE (Terrazza fronte oceano al tramonto) */
.theme-beach .table-backdrop {
  background-image: url('img/beach_cottage_bg.jpg');
  filter: brightness(0.7) saturate(1.2);
}

.theme-beach .table-surface {
  background: 
    radial-gradient(ellipse at center, #8a5a36 0%, #633f22 55%, #3d2310 100%);
  border: 5px solid #a47148;
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(255, 170, 70, 0.25),
    inset 0 2px 14px rgba(255, 220, 140, 0.3);
}

.theme-beach .arm-sleeve {
  background: linear-gradient(180deg, #ff9e00 0%, #e85d04 100%);
}

/* 2. 🏔️ CHALET IN MONTAGNA (Baita accogliente con camino e vette) */
.theme-mountain .table-backdrop {
  background-image: url('img/mountain_chalet_bg.jpg');
  filter: brightness(0.65) saturate(1.1);
}

.theme-mountain .table-surface {
  background: 
    radial-gradient(ellipse at center, #52341d 0%, #38210f 60%, #1e1006 100%);
  border: 5px solid #7c4d29;
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.8),
    0 0 28px rgba(255, 140, 40, 0.3),
    inset 0 2px 16px rgba(255, 180, 80, 0.25);
}

.theme-mountain .arm-sleeve {
  background: linear-gradient(180deg, #b02a37 0%, #58151c 100%);
}

/* 3. 🌆 ROOFTOP METROPOLI (Attico panoramico notturno e skyline neon) */
.theme-metropolis .table-backdrop {
  background-image: url('img/metropolis_rooftop_bg.jpg');
  filter: brightness(0.65) saturate(1.25);
}

.theme-metropolis .table-surface {
  background: 
    radial-gradient(ellipse at center, #1e293b 0%, #0f172a 65%, #020617 100%);
  border: 4px solid #38bdf8;
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.9),
    0 0 30px rgba(56, 189, 248, 0.4),
    inset 0 0 18px rgba(129, 140, 248, 0.35);
}

.theme-metropolis .arm-sleeve {
  background: linear-gradient(180deg, #38bdf8 0%, #818cf8 100%);
}

/* 4. 🏠 SALOTTO DI CASA (Ambiente casalingo caldo e accogliente con camino e legno massello) */
.theme-casino .table-backdrop,
.theme-home .table-backdrop {
  background-image: url('img/cozy_home_bg.jpg');
  filter: brightness(0.68) saturate(1.15);
}

.theme-casino .table-surface,
.theme-home .table-surface {
  background: 
    radial-gradient(ellipse at center, #9a3412 0%, #7c2d12 45%, #431407 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 8px);
  border: 6px solid #b45309;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.85),
    0 0 25px rgba(234, 88, 12, 0.35),
    0 0 0 3px #fde047,
    inset 0 0 25px rgba(0, 0, 0, 0.7);
}

.theme-casino .arm-sleeve,
.theme-home .arm-sleeve {
  background: linear-gradient(180deg, #ea580c 0%, #7c2d12 100%);
}

/* ===================================================
   STILI MULTIPLAYER ONLINE & STANZA D'ATTESA
   =================================================== */

.btn-online {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%) !important;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4), 0 0 0 2px rgba(255,255,255,0.2) !important;
  color: #fff !important;
}

.btn-online:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.6), 0 0 16px rgba(168, 85, 247, 0.5) !important;
}

/* Tabs */
.online-tabs {
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: var(--radius-round);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-round);
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 168, 56, 0.4);
}

/* Profilo Online */
.online-profile-box {
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.online-profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.online-avatar-preview {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.online-avatar-preview:hover {
  transform: scale(1.08);
}

.online-avatar-preview .avatar-3d-frame {
  width: 58px;
  height: 58px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6), 0 0 0 2.5px var(--primary);
}

.edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--primary);
  border-radius: 50%;
  font-size: 0.75rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.online-input-name {
  flex: 1;
  background: rgba(30, 41, 59, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.online-input-name:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(232, 168, 56, 0.3);
}

.room-code-input-wrap {
  display: flex;
  justify-content: center;
}

.input-room-code {
  width: 100%;
  max-width: 240px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 6px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  padding: 12px;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-gold);
  outline: none;
  box-shadow: 0 0 16px rgba(232, 168, 56, 0.25);
}

/* Card Codice Stanza */
.room-code-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.15);
  margin-bottom: 18px;
}

.room-code-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.room-code-display {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--text-gold);
  letter-spacing: 6px;
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.6);
  margin: 4px 0 12px;
}

.btn-copy {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

.waiting-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.waiting-player-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: all 0.3s ease;
}

.waiting-player-card.is-host {
  border-color: var(--primary);
  background: rgba(232, 168, 56, 0.12);
}

.waiting-player-card .avatar-3d-frame {
  width: 52px;
  height: 52px;
}

.waiting-player-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waiting-player-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.waiting-player-badge.host {
  background: var(--primary);
  color: #000;
}

.waiting-player-badge.bot {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.guest-waiting-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 10px;
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Quick Reaction Bar */
/* Quick Reaction Bar - Posizionata in alto a destra sotto l'header per non coprire mai i comandi */
.quick-reactions-bar {
  position: absolute;
  top: 56px;
  right: 12px;
  display: flex;
  gap: 5px;
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(10px);
  padding: 4px 8px;
  border-radius: 99px;
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.btn-reaction {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 3px;
  border-radius: 50%;
  transition: transform 0.15s ease;
  line-height: 1;
}

.btn-reaction:hover, .btn-reaction:active {
  transform: scale(1.35);
}

@media (max-width: 600px) {
  .quick-reactions-bar {
    top: 52px;
    right: 8px;
    padding: 3px 6px;
    gap: 3px;
  }
  .btn-reaction {
    font-size: 1.1rem;
    padding: 2px;
  }
}

/* Floating Emoji Animation */
.floating-emoji {
  position: absolute;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 30;
  animation: floatUpFade 2.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-20px) scale(1.2);
  }
  80% {
    opacity: 0.9;
    transform: translateY(-60px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-90px) scale(0.8);
  }
}

/* ==================== LIVE CHAT DRAWER & BUBBLES ==================== */
.btn-chat-trigger {
  position: relative;
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #0f172a;
  animation: pulse 1.5s infinite;
}

.modal-chat .chat-drawer-content {
  max-width: 420px;
  height: 85vh;
  max-height: 580px;
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 36, 0.97);
  border: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 215, 0, 0.2);
  padding: 0;
  overflow: hidden;
}

.chat-header {
  padding: 12px 16px;
  background: rgba(10, 15, 30, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-title h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--primary);
  margin: 0;
}

.chat-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-system-msg {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 99px;
  margin: 4px auto;
  max-width: 85%;
}

.chat-msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: slideUpFade 0.25s ease-out;
}

.chat-msg-row.is-me {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--primary);
  flex-shrink: 0;
}

.chat-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-msg-content {
  max-width: 75%;
  display: flex;
  flex-direction: column;
}

.chat-msg-row.is-me .chat-msg-content {
  align-items: flex-end;
}

.chat-msg-author {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 2px;
  display: flex;
  gap: 4px;
}

.chat-msg-bubble {
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  padding: 6px 12px;
  border-radius: 14px;
  border-top-left-radius: 2px;
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.chat-msg-row.is-me .chat-msg-bubble {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-radius: 14px;
  border-top-right-radius: 2px;
  color: #fff;
}

.chat-msg-time {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

/* Quick Presets & Emote Bar */
.chat-quick-presets {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(10, 15, 30, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}
.chat-quick-presets::-webkit-scrollbar { display: none; }

.chat-preset-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-preset-btn:hover, .chat-preset-btn:active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.chat-emotes-bar {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(10, 15, 30, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}
.chat-emotes-bar::-webkit-scrollbar { display: none; }

.chat-emote-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: transform 0.15s ease;
}
.chat-emote-btn:hover, .chat-emote-btn:active {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.1);
}

.chat-input-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: rgba(10, 15, 30, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-input-field {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  padding: 8px 14px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}
.chat-input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(232, 168, 56, 0.4);
}

.btn-send-chat {
  background: var(--primary);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.btn-send-chat:hover, .btn-send-chat:active {
  transform: scale(1.15);
}

/* Floating Chat Bubble Over Table Character */
.table-chat-bubble {
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 30, 0.95);
  color: #fff;
  border: 1.5px solid var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0,0,0,0.8), 0 0 15px rgba(255,215,0,0.4);
  z-index: 30;
  pointer-events: none;
  animation: tableChatPop 2.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes tableChatPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.6); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.05); }
  20% { transform: translateX(-50%) translateY(0) scale(1); }
  80% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-15px) scale(0.85); }
}

/* ==================== FINALE GRAND VICTORY CARD ==================== */
.finale-victory-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 16px auto;
  max-width: 440px;
  width: 100%;
}

.f-card-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 12px 8px;
  border-radius: var(--radius);
  transition: transform 0.3s ease;
}

.f-card-player.winner-side {
  background: rgba(234, 179, 8, 0.15);
  border: 1.5px solid rgba(234, 179, 8, 0.4);
  transform: scale(1.05);
}

.f-card-player.loser-side {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  opacity: 0.85;
}

.f-badge {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.f-badge.winner {
  background: #eab308;
  color: #000;
}

.f-badge.loser {
  background: #ef4444;
  color: #fff;
}

.f-avatar {
  font-size: 2.8rem;
  line-height: 1;
}

.f-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
}

.f-score-big {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.f-vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.f-vs-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.f-score-ratio {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
}

.pulse-btn {
  animation: pulseBtnGlow 2s infinite;
}

@keyframes pulseBtnGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(232, 168, 56, 0.4); transform: scale(1); }
  50% { box-shadow: 0 8px 30px rgba(232, 168, 56, 0.85); transform: scale(1.03); }
}

/* ===================================================
   MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS (≤ 600px)
   =================================================== */

@media (max-width: 600px) {
  /* Header di gioco - compatto e no-wrap */
  .game-header {
    height: 42px;
    padding: 3px 6px;
    gap: 4px;
  }
  
  .game-header-left {
    flex-shrink: 0;
  }

  .round-badge {
    font-size: 0.72rem;
    padding: 2px 7px;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.2;
    min-width: max-content;
  }
  
  .phase-display {
    font-size: 0.76rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    padding: 0 2px;
  }
  
  .game-header-right {
    gap: 3px;
    flex-shrink: 0;
  }

  .players-remaining {
    font-size: 0.7rem;
    padding: 2px 5px;
  }

  .btn-header-icon {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  /* Barra reazioni rapide in alto a destra */
  .quick-reactions-bar {
    top: 46px;
    right: 6px;
    padding: 2px 5px;
    gap: 2px;
  }

  .btn-reaction {
    font-size: 0.95rem;
    padding: 1px;
  }

  /* Tavolo di gioco Ovale Mobile */
  .game-table-area {
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .table-container {
    width: 90vw;
    max-width: 350px;
    height: 90vw;
    max-height: calc(100vh - 44px - 126px - 12px);
    aspect-ratio: 1.15 / 1;
    margin: auto;
  }

  .table-surface {
    width: 76%;
    height: 64%;
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.85), 0 0 0 4px #78350f, 0 0 0 6px #ffd700, inset 0 0 25px rgba(0,0,0,0.65);
  }

  .avatar-3d-frame {
    width: 56px;
    height: 56px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75), 0 0 0 2.5px #ffd700;
  }

  .player-name-tag {
    font-size: 0.76rem;
    font-weight: 900;
    padding: 2px 8px;
    max-width: 78px;
    margin-top: -6px;
    border: 2px solid #ffd700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
  }

  .first-speaker-badge {
    font-size: 0.58rem;
    font-weight: 900;
    padding: 2px 6px;
    white-space: nowrap;
    border: 1.5px solid #fff;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  }

  .tabletop-hand {
    width: 44px;
    height: 44px;
  }

  /* Footer e controlli giocatore */
  .game-controls {
    height: 118px;
    min-height: 118px;
    max-height: 118px;
    padding: 3px 6px 6px;
  }

  .control-title {
    font-size: 0.78rem;
    margin-bottom: 0;
  }

  .hiding-main-row {
    gap: 6px;
  }

  .coin-selector {
    gap: 4px;
  }

  .coin-btn {
    width: 44px;
    height: 38px;
    padding: 1px;
    border-radius: 8px;
  }

  .coin-count {
    font-size: 0.88rem;
  }

  .coin-label {
    font-size: 0.46rem;
  }

  .coin-emoji {
    font-size: 0.56rem;
  }

  .decl-header-row {
    gap: 4px;
  }

  .decl-range-badge {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  .decl-excluded-badge {
    font-size: 0.66rem;
  }

  .decl-main-row {
    gap: 8px;
  }

  .declaration-input-area {
    gap: 6px;
  }

  .btn-decl {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }

  .declaration-value {
    font-size: 1.6rem;
    min-width: 32px;
  }

  .btn-confirm {
    padding: 6px 14px;
    font-size: 0.84rem;
  }

  .round-result-pill {
    padding: 3px 6px;
    gap: 4px;
  }

  .pill-badge {
    font-size: 0.66rem;
    padding: 1px 5px;
  }

  .pill-text {
    font-size: 0.74rem;
  }

  .pill-countdown {
    font-size: 0.68rem;
    padding: 1px 5px;
  }

  .pill-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
  }

  .pill-text {
    font-size: 0.78rem;
  }

  .pill-countdown {
    font-size: 0.72rem;
    padding: 1px 6px;
  }

  /* Home Screen su Mobile */
  .home-content {
    padding: 14px;
    gap: 10px;
  }

  .game-title {
    font-size: 2.3rem;
  }

  .game-subtitle {
    font-size: 0.95rem;
  }

  .hero-main-img {
    max-height: 180px;
  }

  .home-buttons .btn {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  /* Schermata Risultato Finale / Grand Pollo su Mobile */
  .grand-pollo-container {
    padding: 16px 12px;
  }

  .grand-pollo-art-box {
    width: 140px;
    height: 140px;
  }

  .grand-pollo-name {
    font-size: 1.6rem;
  }

  .grand-pollo-subtitle {
    font-size: 1rem;
  }
}


