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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f1f5f9;
  color: #0f172a;
  padding: 16px 8px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

/* Header Verde Identico all'immagine inserita */
.header-verde {
  background-color: #0b6637; /* Verde Gispi */
  color: #ffffff;
  text-align: center;
  padding: 24px 16px;
  border-radius: 12px 12px 0 0;
}

.header-verde img {
  max-height: 70px;
  width: auto;
  margin-bottom: 12px;
}

.header-verde h1 {
  font-size: 24px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.header-verde p {
  font-size: 13.5px;
  font-style: italic;
  color: #e2e8f0;
  max-width: 750px;
  margin: 0 auto;
  line-height: 1.4;
}

/* Pulsanti Navigazione Responsive */
.nav-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 14px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.btn-nav {
  background-color: #15803d;
  color: white;
  padding: 9px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  text-align: center;
}

.btn-nav:hover {
  background-color: #166534;
  transform: translateY(-1px);
}

.btn-nav.active {
  background-color: #0f172a;
}

/* Status Bar Live */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 10px 16px;
  font-size: 12.5px;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #16a34a;
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
}

/* Griglia Squadre: 3 righe x 4 colonne su PC */
.squadre-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 0 20px 20px;
}

.card-squadra {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, border-color 0.2s;
}

.card-squadra:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

.card-squadra img {
  max-height: 50px;
  max-width: 100%;
  object-fit: contain;
  margin-bottom: 8px;
}

/* Tabelle e Contenuti Responsive */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  min-width: 580px; /* Garantisce la leggibilità delle colonne su display stretti */
}

th {
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  text-transform: uppercase;
}

td {
  padding: 10px 8px;
  font-size: 13.5px;
  border-bottom: 1px solid #f1f5f9;
}

.score-box {
  display: inline-block;
  background: #0f172a;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 800;
}

.score-empty {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
}

/* Badge Campi */
.badge-campo {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
}

.campo-coiano { background-color: #15803d; }
.campo-iolo { background-color: #1e3a8a; }
.campo-default { background-color: #64748b; }

/* REGOLE RESPONSIVE PER SMARTPHONE E TABLET */
@media (max-width: 768px) {
  .squadre-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 colonne su Tablet e Schermi Medi */
    gap: 10px;
    padding: 0 12px 16px;
  }
  
  .header-verde h1 { font-size: 20px; }
  .header-verde p { font-size: 12px; }
  
  .nav-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 pulsanti affiancati su Mobile */
  }
}

@media (max-width: 480px) {
  body { padding: 8px 4px; }
  .squadre-grid {
    grid-template-columns: repeat(2, 1fr); /* Mantiene 2 per riga compatte anche su smartphone */
  }
  .card-squadra {
    padding: 10px 6px;
    min-height: 100px;
    font-size: 11.5px;
  }
  .card-squadra img {
    max-height: 40px;
  }
  .nav-buttons {
    grid-template-columns: 1fr; /* Pulsanti a larghezza intera su schermi molto stretti */
  }
}