/* Miglioria estetica stats-box */
.stats-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,123,255,0.08);
  padding: 1rem;
  transition: transform 0.18s, opacity 0.18s, border 0.18s, background 0.18s;
  will-change: transform, opacity;
}

.stats-box:hover {
  transform: translateY(-3px);
  opacity: 0.97;
  border-color: #007bff;
}
/* ======= MENU MOBILE MODERNO ======= */
@media (max-width: 768px) {
  .nav-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 34, 68, 0.55);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: opacity 0.22s;
  }
  .nav-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    background: #fff;
    width: 95vw;
    max-width: 500px;
    margin: 2.5rem auto 0 auto;
    border-radius: 18px;
    box-shadow: 0 8px 32px #007bff22;
    padding: 1.5rem 1rem;
    gap: 0.8rem;
    position: relative;
    animation: slideDownMenu 0.33s cubic-bezier(.4,1.6,.6,1);
  }
  .nav-buttons button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.8rem 0.4rem;
    font-size: 0.85em;
    border: none;
    background: #f8f9fa;
    color: #007bff;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.16s ease;
    border: 2px solid transparent;
    min-height: 70px;
    line-height: 1.2;
  }
  .nav-buttons button:hover {
    background: #e3f0ff;
    color: #0056b3;
    transform: translateY(-2px) scale(1.02);
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
  }
  .nav-buttons button:active {
    transform: translateY(0) scale(0.98);
    background: #007bff;
    color: white;
  }
  .nav-close-btn {
    position: absolute;
    top: 0.7rem;
    right: 1.1rem;
    background: none;
    border: none;
    font-size: 2.1em;
    color: #007bff;
    cursor: pointer;
    z-index: 10;
    transition: color 0.18s;
  }
  .nav-close-btn:hover {
    color: #0056b3;
  }
}

@keyframes slideDownMenu {
  from { transform: translateY(-40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* Miglioria estetica eventi calendario */
.calendar-event {
  background: #fff;
  border: 2px solid #b3d7ff;
  border-radius: 14px;
  box-shadow: 0 2px 10px #b3d7ff22; /* ombra fissa leggera */
  padding: 1.1rem 1.2rem 1rem 1.2rem;
  margin-bottom: 1.1rem;
  transition: transform 0.18s, border 0.18s, background 0.18s, opacity 0.18s;
  position: relative;
  will-change: transform, opacity;
}

/* Messaggio evento lasciato (utente ha lasciato l'evento) */
.event-left-message, .evento-lasciato-message {
  background: rgba(255,255,255,0.92);
  border: 2px solid #ffb3b3;
  color: #c62828;
  border-radius: 12px;
  box-shadow: 0 2px 12px #ffb3b355;
  padding: 1rem 1.2rem;
  margin: 1.1rem 0;
  font-size: 1.08em;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
  display: block;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInDown 0.5s;
}

@media (max-width: 600px) {
  .event-left-message, .evento-lasciato-message {
    font-size: 1em;
    padding: 0.8rem 0.5rem;
    max-width: 98vw;
  }
}

.calendar-event:hover {
  transform: translateY(-3px);
  opacity: 0.97; /* effetto leggero al posto dell’ombra animata */
  border-color: #007bff;
  background: linear-gradient(90deg,#f7fbff 80%,#e3f0ff 100%);
}
.calendar-event strong {
  color: #007bff;
  font-size: 1.08em;
}
.calendar-event button.btn-small {
  margin-top: 0.7em;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.35em 1.1em;
  font-size: 0.97em;
  font-weight: 600;
  box-shadow: 0 1px 4px #b3d7ff55;
  cursor: pointer;
  transition: background 0.18s;
}
.calendar-event button.btn-small:hover {
  background: #0056b3;
}
/* Migliorie home responsive e animazioni */
@media (max-width: 800px) {
  .home-cards-row {
    flex-direction: column !important;
    gap: 22px !important;
    align-items: center;
  }
  .home-card {
    max-width: 98vw !important;
    min-width: 0 !important;
    width: 95vw !important;
  }
}

.home-card {
  transition: transform 0.22s cubic-bezier(.4,1.6,.6,1), opacity 0.22s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  box-shadow: 0 2px 8px rgba(0,123,255,0.08); /* ombra leggera fissa */
}

.home-card:hover {
  transform: scale(1.035) translateY(-2px);
  opacity: 0.95; /* animazione fluida e leggera */
  z-index: 2;
}

.home-card .home-emoji {
  display: inline-block;
  animation: bounceHome 1.2s infinite alternate;
}

@keyframes bounceHome {
  0% { transform: translateY(0); }
  100% { transform: translateY(-7px) scale(1.08); }
}
.home-cta-btn {
  animation: fadeInUp 1.1s cubic-bezier(.4,1.6,.6,1);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.motivational-home {
  margin: 2.2rem auto 0.7rem auto;
  font-size: 1.13rem;
  color: #007BFF;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2px;
}
.how-it-works {
  margin: 2.5rem auto 0 auto;
  max-width: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,123,255,0.07);
  padding: 1.2rem 1rem 1.5rem 1rem;
  text-align: center;
}
.how-it-works-steps {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.how-step {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 180px;
  background: #f5faff;
  border-radius: 8px;
  padding: 0.7rem 0.5rem;
  margin: 0.2rem 0;
  box-shadow: 0 1px 4px rgba(0,123,255,0.04);
  font-size: 0.98rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.how-step-emoji {
  font-size: 1.7rem;
  margin-bottom: 0.3rem;
  animation: bounceHome 1.3s infinite alternate;
}
@media (max-width: 600px) {
  .how-it-works-steps {
    flex-direction: column;
    gap: 0.7rem;
  }
  .how-step {
    max-width: 100%;
  }
}

/* ========== Responsive Layout for Together Is Better ========== */

/* Global box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ======= MIGLIORAMENTI ACCESSIBILITÀ E UX ======= */

/* 1. Miglior feedback hover/focus per tabelle */
tr:hover {
  background: #e3f0ff !important;
  transition: background 0.2s ease;
}

/* 2. Focus visibile per accessibilità tastiera */
button:focus-visible,
.btn:focus-visible,
.nav-buttons button:focus-visible,
.tab-btn:focus-visible {
  outline: 3px solid #ffd700;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px #007bff;
}

/* 3. Gestione testi lunghi su mobile */
.card, .stats-box, .squadre-box, .gestione-squadre-box {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* 4. Miglior focus per input */
input:focus, select:focus, textarea:focus {
  outline: 3px solid #ffd700 !important;
  outline-offset: 2px !important;
  border: 2px solid #003d82 !important;
  box-shadow: 0 0 0 1px #007bff !important;
  background: #fff !important;
}

/* 5. Stile pulsanti disattivati */
button:disabled,
.btn:disabled,
input[type="submit"]:disabled {
  background: #ccc !important;
  color: #666 !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  transform: none !important;
  box-shadow: none !important;
}

button:disabled:hover,
.btn:disabled:hover,
input[type="submit"]:disabled:hover {
  background: #ccc !important;
  transform: none !important;
}

/* 6. Pulsante "torna su" */
.scroll-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #28a745 !important;
  color: white !important;
  border: none;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(40,167,69,0.3) !important;
  transition: all 0.3s ease;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: #218838 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(40,167,69,0.4) !important;
}

.scroll-to-top:focus-visible {
  outline: 3px solid #ffd700;
  outline-offset: 2px;
}

/* 7. Supporto per utenti con prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .home-emoji,
  .how-step-emoji {
    animation: none !important;
  }
  
  .scroll-to-top {
    transition: opacity 0.2s ease !important;
  }
}

/* Fluid Typography */
html {
  font-size: clamp(14px, 2.5vw, 18px);
}

/* Improved Container Queries Support */
@supports (container-type: inline-size) {
  .card {
    container-type: inline-size;
  }
  
  @container (max-width: 400px) {
    .btn {
      font-size: 0.9rem;
      padding: 0.4rem 0.6rem;
    }
  }
}

@media (max-width: 1024px) {
  .participants-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .main-logo {
    max-width: 240px;
  }
}

/* MOBILE: max 768px */
@media (max-width: 768px) {
  body {
    padding: 0;
    font-size: 0.95rem;
  }

  header {
    padding: 1rem;
  }

  .main-logo {
    width: 100%;
    height: auto;
    max-width: 280px;
  }

  .nav-buttons {
    flex-direction: column;
    gap: 0.2rem;
    background: #007BFF;
    width: 100%;
    padding: 0.5rem 0;
  }

  .nav-buttons button {
    width: 100%;
    text-align: left;
    padding-left: 1rem;
  }

  .nav-toggle {
    display: block;
  }

  .participants-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card, .stats-box, .squadre-box, .gestione-squadre-box, .chat-messages {
    padding: 1rem;
    font-size: 0.95rem;
  }

  .game-info p, .game-actions button, .game-participants, .chat-section {
    font-size: 0.95rem;
  }

  form input, form select, form button {
    font-size: 1rem;
  }

  table {
    font-size: 0.9rem;
  }

  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .game-header, .game-info, .game-actions {
    display: block;
    width: 100%;
  }
}

/* SMALL DEVICES */
@media (max-width: 480px) {
  .main-logo {
    max-width: 200px;
  }

  .chat-messages {
    max-height: 150px;
  }

  .nav-buttons button {
    font-size: 1rem;
  }

  .participants-grid {
    grid-template-columns: 1fr;
    gap: 1rem; /* Miglioramento gap verticale per leggibilità */
  }
}

/* ======= HOME LAYOUT ======= */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.home-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ======= MENU MOBILE COMPATTO ======= */
@media (max-width: 768px) {
  /* Il nuovo stile del menu mobile è sopra */
}

/* ======= PANNELLO MANUALE SQUADRE ======= */
#manual-squadre-form {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px #007bff22;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
#manual-squadre-form h5 {
  font-size: 1.13em;
  margin-bottom: 0.7rem;
}
#manual-squadre-form label {
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: block;
}
#manual-squadre-form select {
  margin-bottom: 0.5rem;
  border-radius: 8px;
  border: 1.5px solid #b3d7ff;
  background: #f7fbff;
  font-size: 1.04em;
  padding: 0.4em 0.5em;
  width: 100%;
  min-width: 140px;
  transition: border 0.18s, box-shadow 0.18s;
}
#manual-squadre-form select:focus {
  outline: 2px solid #007bff;
  border-color: #007bff;
  box-shadow: 0 0 0 2px #e3f0ff;
}
#manual-squadre-form .manual-btn {
  background: linear-gradient(90deg,#e3f0ff 60%,#f7fbff 100%);
  border: 1.5px solid #007bff;
  color: #1976d2;
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.2rem;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
#manual-squadre-form .manual-btn:hover {
  background: #007bff;
  color: #fff;
  box-shadow: 0 2px 8px #007bff33;
}
#manual-squadre-form .manual-btn:active {
  background: #0056b3;
  color: #fff;
}
#manual-squadre-form .badge-ruolo {
  display: inline-block;
  background: #e3f0ff;
  color: #1976d2;
  border-radius: 8px;
  padding: 0.1em 0.7em;
  font-size: 0.97em;
  margin-left: 0.4em;
}
@media (max-width: 700px) {
  #manual-squadre-form {
    padding: 0.7rem 0.3rem;
  }
  #manual-squadre-form select {
    min-width: 90px;
    font-size: 0.97em;
  }
}

/* Miglioria estetica stats-box */
.stats-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,123,255,0.08);
  padding: 1rem;
  transition: transform 0.18s, opacity 0.18s, border 0.18s, background 0.18s;
  will-change: transform, opacity;
}


.stats-box:hover {
  transform: translateY(-3px);
  opacity: 0.97;
  border-color: #007bff;
}
/* ======= MENU MOBILE MODERNO ======= */
@media (max-width: 768px) {
  .nav-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 34, 68, 0.55);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: opacity 0.22s;
  }
  .nav-buttons {
    display: none;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.3rem;
    background: #fff;
    width: 92vw;
    max-width: 400px;
    max-height: 80vw;
    overflow-y: auto;
    margin: 2.5rem auto 0 auto;
    border-radius: 18px;
    box-shadow: 0 8px 32px #007bff22;
    padding: 1.1rem 0.5rem 1.1rem 0.5rem;
    position: relative;
    justify-items: center;
    align-items: center;
  }
  .nav-buttons.open {
    display: grid;
    animation: slideDownMenu 0.33s cubic-bezier(.4,1.6,.6,1);
  }
  .nav-buttons button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 48px;
    max-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45em;
    border: none;
    background: #f7fbff;
    color: #007bff;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.16s ease;
    margin: 0;
    box-shadow: 0 1px 4px #007bff11;
    text-align: center;
    line-height: 1;
    vertical-align: middle;
    justify-items: center;
    align-content: center;
    padding: 0;
  }
  .nav-buttons button:hover {
    background: #e3f0ff;
    color: #0056b3;
    transform: scale(1.08);
  }
  .nav-buttons button[style*="display:none"] {
    display: none !important;
  }
  .nav-toggle {
    position: static;
    width: 100%;
    height: 36px;
    min-width: 0;
    min-height: 36px;
    max-width: 100%;
    max-height: 36px;
    z-index: 1100;
    font-size: 1.3em !important;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px #007bff22;
    border: none;
    color: #007bff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: font-size 0.18s, background 0.18s, color 0.18s;
    margin: 0.7rem 0 0.7rem 0;
    padding: 0;
  }
  .nav-toggle.menu-open {
    font-size: 1.4em !important;
    background: #e3f0ff;
    color: #0056b3;
  }
  .nav-close-btn {
    display: none;
  }
  .nav-close-btn {
    position: absolute;
    top: 0.7rem;
    right: 1.1rem;
    background: none;
    border: none;
    font-size: 2.1em;
    color: #007bff;
    cursor: pointer;
    z-index: 10;
    transition: color 0.18s;
  }
  .nav-close-btn:hover {
    color: #0056b3;
  }
}

@keyframes slideDownMenu {
  from { transform: translateY(-40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* Miglioria estetica eventi calendario */
.calendar-event {
  background: #fff;
  border: 2px solid #b3d7ff;
  border-radius: 14px;
  box-shadow: 0 2px 10px #b3d7ff22; /* ombra fissa leggera */
  padding: 1.1rem 1.2rem 1rem 1.2rem;
  margin-bottom: 1.1rem;
  transition: transform 0.18s, border 0.18s, background 0.18s, opacity 0.18s;
  position: relative;
  will-change: transform, opacity;
}

/* Messaggio evento lasciato (utente ha lasciato l'evento) */
.event-left-message, .evento-lasciato-message {
  background: rgba(255,255,255,0.92);
  border: 2px solid #ffb3b3;
  color: #c62828;
  border-radius: 12px;
  box-shadow: 0 2px 12px #ffb3b355;
  padding: 1rem 1.2rem;
  margin: 1.1rem 0;
  font-size: 1.08em;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
  display: block;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInDown 0.5s;
}

@media (max-width: 600px) {
  .event-left-message, .evento-lasciato-message {
    font-size: 1em;
    padding: 0.8rem 0.5rem;
    max-width: 98vw;
  }
}

.calendar-event:hover {
  transform: translateY(-3px);
  opacity: 0.97; /* effetto leggero al posto dell’ombra animata */
  border-color: #007bff;
  background: linear-gradient(90deg,#f7fbff 80%,#e3f0ff 100%);
}
.calendar-event strong {
  color: #007bff;
  font-size: 1.08em;
}
.calendar-event button.btn-small {
  margin-top: 0.7em;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.35em 1.1em;
  font-size: 0.97em;
  font-weight: 600;
  box-shadow: 0 1px 4px #b3d7ff55;
  cursor: pointer;
  transition: background 0.18s;
}
.calendar-event button.btn-small:hover {
  background: #0056b3;
}
/* Migliorie home responsive e animazioni */
@media (max-width: 800px) {
  .home-cards-row {
    flex-direction: column !important;
    gap: 22px !important;
    align-items: center;
  }
  .home-card {
    max-width: 98vw !important;
    min-width: 0 !important;
    width: 95vw !important;
  }
}

.home-card {
  transition: transform 0.22s cubic-bezier(.4,1.6,.6,1), opacity 0.22s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  box-shadow: 0 2px 8px rgba(0,123,255,0.08); /* ombra leggera fissa */
}

.home-card:hover {
  transform: scale(1.035) translateY(-2px);
  opacity: 0.95; /* animazione fluida e leggera */
  z-index: 2;
}

.home-card .home-emoji {
  display: inline-block;
  animation: bounceHome 1.2s infinite alternate;
}

@keyframes bounceHome {
  0% { transform: translateY(0); }
  100% { transform: translateY(-7px) scale(1.08); }
}
.home-cta-btn {
  animation: fadeInUp 1.1s cubic-bezier(.4,1.6,.6,1);
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.motivational-home {
  margin: 2.2rem auto 0.7rem auto;
  font-size: 1.13rem;
  color: #007BFF;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2px;
}
.how-it-works {
  margin: 2.5rem auto 0 auto;
  max-width: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,123,255,0.07);
  padding: 1.2rem 1rem 1.5rem 1rem;
  text-align: center;
}
.how-it-works-steps {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.how-step {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 180px;
  background: #f5faff;
  border-radius: 8px;
  padding: 0.7rem 0.5rem;
  margin: 0.2rem 0;
  box-shadow: 0 1px 4px rgba(0,123,255,0.04);
  font-size: 0.98rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.how-step-emoji {
  font-size: 1.7rem;
  margin-bottom: 0.3rem;
  animation: bounceHome 1.3s infinite alternate;
}
@media (max-width: 600px) {
  .how-it-works-steps {
    flex-direction: column;
    gap: 0.7rem;
  }
  .how-step {
    max-width: 100%;
  }
}

/* ========== Responsive Layout for Together Is Better ========== */

/* Global box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Fluid Typography */
html {
  font-size: clamp(14px, 2.5vw, 18px);
}

/* Improved Container Queries Support */
@supports (container-type: inline-size) {
  .card {
    container-type: inline-size;
  }
  
  @container (max-width: 400px) {
    .btn {
      font-size: 0.9rem;
      padding: 0.4rem 0.6rem;
    }
  }
}

@media (max-width: 1024px) {
  .participants-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .main-logo {
    max-width: 240px;
  }
}

/* MOBILE: max 768px */
@media (max-width: 768px) {
  body {
    padding: 0;
    font-size: 0.95rem;
  }

  header {
    padding: 1rem;
  }

  .main-logo {
    width: 100%;
    height: auto;
    max-width: 280px;
  }

  .nav-buttons {
    flex-direction: column;
    gap: 0.2rem;
    background: #007BFF;
    width: 100%;
    padding: 0.5rem 0;
  }

  .nav-buttons button {
    width: 100%;
    text-align: left;
    padding-left: 1rem;
  }

  .nav-toggle {
    display: block;
  }

  .participants-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card, .stats-box, .squadre-box, .gestione-squadre-box, .chat-messages {
    padding: 1rem;
    font-size: 0.95rem;
  }

  .game-info p, .game-actions button, .game-participants, .chat-section {
    font-size: 0.95rem;
  }

  form input, form select, form button {
    font-size: 1rem;
  }

  table {
    font-size: 0.9rem;
  }

  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .game-header, .game-info, .game-actions {
    display: block;
    width: 100%;
  }
}

/* SMALL DEVICES */
@media (max-width: 480px) {
  .main-logo {
    max-width: 200px;
  }

  .chat-messages {
    max-height: 150px;
  }

  .nav-buttons button {
    font-size: 1.18em;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 10px;
  }

  .participants-grid {
    grid-template-columns: 1fr;
  }
}

/* ======= HOME LAYOUT ======= */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.home-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ======= MENU MOBILE COMPATTO ======= */
@media (max-width: 768px) {
  /* Il nuovo stile del menu mobile è sopra */
}

/* ======= NOTIFICHE BADGE E MISSIONI ======= */
.reward-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 10000;
  animation: slideInRight 0.5s ease-out, fadeOut 0.5s ease-in 4.5s forwards;
  max-width: 350px;
  font-weight: 600;
}

.badge-notification {
  background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%) !important;
}

.xp-notification {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%) !important;
}

.levelup-notification {
  background: linear-gradient(135deg, #e17055 0%, #fdcb6e 100%) !important;
}

.achievement-notification {
  background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%) !important;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ======= CHALLENGE TAB BUTTONS ======= */
.challenge-tab-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.challenge-tab-button.active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ======= RESPONSIVE CHALLENGES ======= */
@media (max-width: 768px) {
  .challenge-tab-button {
    padding: 0.5rem 0.8rem !important;
    font-size: 0.85rem !important;
  }
  
  .reward-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* ======= TEAM CHAT ANIMATIONS ======= */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ======= TEAM CHAT STYLES ======= */
.team-chat-container {
  transition: all 0.3s ease;
}

.team-chat-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
}

/* Scrollbar personalizzata per chat */
.team-chat-container div[id*="team-chat-messages"]::-webkit-scrollbar {
  width: 6px;
}

.team-chat-container div[id*="team-chat-messages"]::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.team-chat-container div[id*="team-chat-messages"]::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.team-chat-container div[id*="team-chat-messages"]::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Responsive team chat */
@media (max-width: 768px) {
  .team-chat-container {
    margin: 0.5rem 0;
  }
  
  .team-chat-container div[id*="team-chat-messages"] {
    height: 200px !important;
    padding: 0.75rem !important;
  }
  
  .team-chat-container form {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  
  .team-chat-container input {
    border-radius: 8px !important;
  }
  
  .team-chat-container button {
    border-radius: 8px !important;
    align-self: stretch;
  }
}
