/* ============================================================
   ESL DASHBOARDS — OBS Viewport-Fit Design
   Tutto deve stare in 100vh senza scroll.
   Font: Inter · Sfondo: #f5f5f5 · Carte: bianche
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-page:            #f3f4f6;
  --bg-card:            #ffffff;
  --text-primary:       #111827;
  --text-secondary:     #374151;
  --text-muted:         #9ca3af;
  --text-label:         #6b7280;
  --border:             #e5e7eb;
  --border-row:         #f3f4f6;
  --qualify-bg:         #f0fdf4;
  --green:              #22c55e;
  --accent:             #f97316;
  --danger:             #ef4444;
  --badge-gold:         #f59e0b;
  --badge-silver:       #94a3b8;
  --badge-bronze:       #b45309;
  --badge-default:      #e5e7eb;
  --badge-default-text: #6b7280;
  --connector:          var(--sport-border, #d1d5db);
  --shadow:             0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-3d:          0 10px 30px -10px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-lg:          0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --sport-shadow:       var(--shadow-3d);
  --sport-shadow-hover: var(--shadow-lg);
}


/* ── Sport Monochromatic Gradient Themes ── */
body.sport-padel {
  --bg-page:            #f0f9ff;
  --bg-card:            linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  --sport-primary:      #0ea5e9;
  --sport-gradient:     linear-gradient(135deg, #0ea5e9, #0284c7);
  --sport-bg-cell:      linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  --sport-bg-score:     linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
  --sport-bg-winner:    linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --sport-text-primary: #0369a1;
  --sport-text-secondary:#0c4a6e;
  --sport-text-muted:   #38bdf8;
  --sport-accent-glow:  rgba(14, 165, 233, 0.12);
  --sport-time-bg:      #bae6fd;
  --sport-shadow:       0 10px 25px -8px rgba(14, 165, 233, 0.22), 0 2px 4px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --sport-shadow-hover: 0 20px 35px -8px rgba(14, 165, 233, 0.38), 0 6px 16px -3px rgba(14, 165, 233, 0.15);
}


body.sport-beach {
  --bg-page:            #fff7ed;
  --bg-card:            linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  --sport-primary:      #f97316;
  --sport-gradient:     linear-gradient(135deg, #f97316, #ea580c);
  --sport-bg-cell:      linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
  --sport-bg-score:     linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  --sport-bg-winner:    linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  --sport-text-primary: #9a3412;
  --sport-text-secondary:#7c2d12;
  --sport-text-muted:   #f97316;
  --sport-accent-glow:  rgba(249, 115, 22, 0.12);
  --sport-time-bg:      #fed7aa;
  --sport-shadow:       0 10px 25px -8px rgba(249, 115, 22, 0.22), 0 2px 4px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --sport-shadow-hover: 0 20px 35px -8px rgba(249, 115, 22, 0.38), 0 6px 16px -3px rgba(249, 115, 22, 0.15);
}


body.sport-basket {
  --bg-page:            #fef2f2;
  --bg-card:            linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  --sport-primary:      #ef4444;
  --sport-gradient:     linear-gradient(135deg, #ef4444, #dc2626);
  --sport-bg-cell:      linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
  --sport-bg-score:     linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  --sport-bg-winner:    linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  --sport-text-primary: #991b1b;
  --sport-text-secondary:#7f1d1d;
  --sport-text-muted:   #ef4444;
  --sport-accent-glow:  rgba(239, 68, 68, 0.12);
  --sport-time-bg:      #fecaca;
  --sport-shadow:       0 10px 25px -8px rgba(239, 68, 68, 0.22), 0 2px 4px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --sport-shadow-hover: 0 20px 35px -8px rgba(239, 68, 68, 0.38), 0 6px 16px -3px rgba(239, 68, 68, 0.15);
}




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

/* ── Viewport lock: niente scroll ─────────────────────────── */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  background-color: var(--bg-page);
  color: var(--sport-text-primary, var(--text-primary));
  -webkit-font-smoothing: antialiased;
}


/* ── Page wrapper: occupa esattamente il viewport ─────────── */
.page-wrapper {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.hidden { display: none !important; }

/* ── Loading & Errors ──────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--danger);
  border-radius: 10px;
  text-align: center;
  color: var(--danger);
  font-size: 12px;
  box-shadow: var(--shadow);
}

.info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--sport-bg-cell, var(--bg-card));
  border: 1px dashed var(--sport-primary, var(--border));
  border-radius: 12px;
  text-align: center;
  color: var(--sport-text-secondary, var(--text-primary));
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--sport-shadow, var(--shadow-3d));
  width: 100%;
  height: 100%;
  min-height: 100px;
  box-sizing: border-box;
}

.info-card p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--sport-text-secondary, var(--text-secondary));
}

.error-icon { font-size: 24px; }
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sport-primary, var(--text-muted));
  margin-bottom: 2px;
}


/* ── Sections: occupano tutto lo spazio disponibile ──────── */
section[id^="tab-content-"] {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================================
   TAB: CLASSIFICHE
   ============================================================ */

.groups-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

/* Ogni girone si espande in modo uguale */
.group-card {
  background: var(--sport-bg-card, var(--bg-card));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  box-shadow: var(--sport-shadow);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sport-shadow-hover);
}


.group-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--sport-gradient, transparent);
  border-radius: 10px 10px 0 0;
}



/* Header: "Girone A" + "4 squadre" */
.group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px 8px 14px;
  flex-shrink: 0;
}

.group-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--sport-text-primary, var(--text-primary));
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.group-subtitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--sport-text-secondary, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}



/* ── Standings Table ─────────────────────────────────────── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  flex: 1;
}

/* Thead */
.standings-table thead th {
  padding: 5px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-label);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table thead th:first-child { padding-left: 14px; }
.standings-table thead th.col-team   { text-align: left; padding-left: 6px; }
.standings-table thead th.col-stat   {
  text-align: center;
  width: 7%;
  min-width: 38px;
}
.standings-table thead th.col-pts    {
  text-align: center;
  width: 9%;
  min-width: 46px;
  padding-right: 14px;
  color: var(--text-primary);
  font-weight: 700;
}

/* Rows */
.standings-table tbody tr {
  border-bottom: none;
}

.standings-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.standings-table tbody tr:last-child { border-bottom: none; }
.standings-table tbody tr.qualified  { background: var(--sport-bg-cell, var(--qualify-bg)) !important; }

.standings-table tbody td {
  padding: 8px 7px;
  font-size: 15px;
  color: var(--sport-text-secondary, var(--text-secondary));
}

.standings-table tbody td:first-child { padding-left: 14px; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 800;
  background: var(--sport-bg-score, #f1f5f9);
  color: var(--sport-text-primary, #475569);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.rank-badge.gold   { background: #f2c12e; color: #583c07; box-shadow: 0 3px 6px rgba(242, 193, 46, 0.35); }
.rank-badge.silver { background: #cbd5e1; color: #334155; box-shadow: 0 3px 6px rgba(203, 213, 225, 0.35); }
.rank-badge.bronze { background: #db9a6a; color: #4b1f03; box-shadow: 0 3px 6px rgba(219, 154, 106, 0.35); }

/* Team name */
.standings-table tbody td.col-team {
  text-align: left;
  font-weight: 600;
  font-size: 17px;
  color: var(--sport-text-primary, var(--text-primary));
  padding-left: 6px;
}

.team-name-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot-orange {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--sport-primary, var(--accent));
  flex-shrink: 0;
}


/* Stat & points cells */
.standings-table tbody td.col-stat {
  text-align: center;
  color: var(--text-label);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.standings-table tbody td.col-pts {
  text-align: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  padding-right: 14px;
}

/* Vertical borders for score columns */
.standings-table tr.qualified td.col-stat,
.standings-table tr.qualified td.col-pts {
  border-left: 1px solid rgba(0, 0, 0, 0.03);
}

/* Semi-transparent alternating column shading with soft 3D vertical edge shadows */
.standings-table tr.qualified td:nth-child(2n+3) {
  background-color: rgba(0, 0, 0, 0.015);
  box-shadow: inset 4px 0 4px -3px rgba(0, 0, 0, 0.06), inset -4px 0 4px -3px rgba(0, 0, 0, 0.06);
}

/* Highlighted background and edge shadows for points column (PT) */
.standings-table tr.qualified td.col-pts {
  background-color: rgba(0, 0, 0, 0.035);
  box-shadow: inset 4px 0 4px -3px rgba(0, 0, 0, 0.08), inset -4px 0 4px -3px rgba(0, 0, 0, 0.08);
}

/* Footer Legenda Qualificazioni */
.group-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 11px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sport-text-secondary, var(--text-secondary));
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.015);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.dot-qualify {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--sport-primary, var(--green));
  box-shadow: 0 0 6px var(--sport-accent-glow, transparent);
  flex-shrink: 0;
}


/* ============================================================
   TAB: CALENDARIO
   ============================================================ */

/* Sezione "Ultimo match terminato" */
.schedule-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.schedule-section-label::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Header data con linea */
.schedule-date-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  margin-top: 14px;
  flex-shrink: 0;
}

.schedule-date-label {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.schedule-date-sep {
  flex: 1;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
}

.schedule-date-count {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

/* Due colonne affiancate */
.schedule-two-columns {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.schedule-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Header di colonna con linea */
.schedule-column-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  margin-top: 14px;
  flex-shrink: 0;
}

.schedule-column-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.schedule-column-sep {
  flex: 1;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
}

.matches-list-vertical {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

/* Layout espandibile */
#single-schedule-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#general-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.court-column .matches-list {
  flex: 1;
  min-height: 0;
}

/* Lista match */
.matches-list {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

/* ── Match Card ─────────────────────────────────────────── */
.match-card {
  background: var(--sport-bg-card, var(--bg-card));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  box-shadow: var(--sport-shadow);
  padding: 14px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.match-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--sport-gradient, transparent);
  border-radius: 12px 12px 0 0;
}

.match-card:hover {
  box-shadow: var(--sport-shadow-hover);
  transform: translateY(-3px) scale(1.005);
}


/* Header della card */
.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  min-height: 20px;
}


.match-time-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.match-time {
  font-size: 14px;
  font-weight: 800;
  color: var(--sport-text-primary, var(--text-primary));
  font-variant-numeric: tabular-nums;
}

.match-status-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--sport-time-bg, #e5e7eb);
  color: var(--sport-text-secondary, var(--text-secondary));
  letter-spacing: 0.03em;
}

.match-status-badge.live {
  background: var(--sport-bg-winner, var(--danger));
  color: #ffffff;
  animation: pulse-border 2s infinite alternate;
}

.match-status-badge.finished {
  background: rgba(0, 0, 0, 0.05);
  color: var(--sport-text-muted, var(--text-muted));
}

.match-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--sport-text-secondary, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}


/* Corpo della card (nomi + punteggi) */
.match-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  gap: 8px;
}

.match-body-row {
  flex: 1;
  display: flex;
  align-items: stretch;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sport-bg-cell, #ffffff);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.match-body-row:hover {
  transform: scale(1.005);
}

.match-body-row.winner {
  background: var(--sport-bg-cell, #ffffff);
}

.match-team-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding: 6px 12px;
}

.match-dot-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sport-primary, var(--accent));
  box-shadow: 0 0 4px var(--sport-accent-glow, transparent);
  flex-shrink: 0;
}

.match-team-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--sport-text-primary, var(--text-primary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-body-row.winner .match-team-name {
  font-weight: 800;
  color: var(--sport-text-secondary, var(--text-secondary));
}

.match-team-name.tbd {
  color: var(--sport-text-muted, var(--text-muted));
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
}

.match-team-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--sport-text-primary, var(--text-primary));
  font-variant-numeric: tabular-nums;
  width: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sport-bg-score, rgba(0, 0, 0, 0.04)); /* Sfondo specifico sport per staccare il punteggio */
  box-shadow: inset 1px 0 2px rgba(0, 0, 0, 0.03);
  text-align: center;
  flex-shrink: 0;
}


.match-body-row.winner .match-team-score {
  background: var(--sport-bg-winner) !important;
  color: #ffffff !important;
}



.match-team-score.pending {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 15px;
}

/* Basket court grid */
.court-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
  overflow: hidden;
}

.court-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.court-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   TAB: TABELLONE KO — Viewport-fill con linee connettori
   ============================================================ */

/* Il section del bracket occupa tutto lo spazio disponibile */
#tab-content-bracket {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Viewport principale del bracket: flex row, niente scroll */
.bracket-viewport {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
  gap: 0;
  min-height: 0;
}

/* ── Colonna round ────────────────────────────────────────── */
.bracket-round {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* No min/max width: distribuzione equa in layout speculare */
}

/* Colonna centrale Finale: stessa larghezza delle altre per massimizzare lo spazio */
.bracket-final-col {
  flex: 1;
}

/* Coppia di match: contenitore relativo, slot posizionati in assoluto */
.bracket-pair {
  flex: 1;
  min-height: 0;
  position: relative;
}

/*
  Ogni slot occupa esattamente il 50% della coppia.
  Con posizionamento assoluto la card è centrata in uno spazio NOTO,
  garantendo simmetria perfetta:
    slot1 centro = 25% del pair  → coincide con connettore top: 25%
    slot2 centro = 75% del pair  → coincide con connettore top+height: 75%
*/
.bracket-match-slot {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 0;
  box-sizing: border-box;
}

/* Primo slot: ancorato in alto */
.bracket-match-slot:first-child  { top: 0; }
/* Secondo slot: ancorato in basso */
.bracket-match-slot:nth-child(2) { bottom: 0; }
/* Match unico (es. Finale): riempie tutta la coppia */
.bracket-match-slot:only-child   { height: 100%; top: 0; }

/* Etichetta sopra il match (M 1.1, Semi 1, Final) */
.bracket-match-label-above {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  padding-left: 4px;
}

/* Card bianca del match */
.bracket-match-node {
  background: var(--sport-bg-card, var(--bg-card));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  box-shadow: var(--sport-shadow);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding-top: 4px;
}

.bracket-match-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--sport-gradient, #cbd5e1);
  border-radius: 12px 12px 0 0;
}

.bracket-match-node:hover {
  transform: translateY(-3px);
  box-shadow: var(--sport-shadow-hover);
}


/* Riga team dentro la card */
.bracket-team-row {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: none;
  gap: 10px;
  transition: all 0.2s ease;
  background: var(--sport-bg-cell, #ffffff);
}

.bracket-team-row:last-child {
  border-bottom: none;
}

/* Winner row: gradiente della sfumatura sportiva */
.bracket-team-row.winner {
  background: var(--sport-bg-cell, #ffffff) !important;
}



/* Loser row: opacità ridotta per far risaltare il vincitore */
.bracket-team-row.loser {
  opacity: 0.6;
}

/* Seed: #1, #8 */
.bracket-seed {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
  flex-shrink: 0;
}

/* Dot colorato davanti al nome */
.bracket-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

.bracket-team-row.winner .bracket-dot {
  background: var(--sport-primary, #cbd5e1);
}


/* Nome squadra */
.bracket-team-name {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-team-row.winner .bracket-team-name {
  font-weight: 800;
  color: var(--sport-text-secondary, var(--text-primary));
}


/* Score */
.bracket-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--sport-text-primary, var(--text-muted));
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.bracket-score.win  { color: var(--sport-text-primary); }
.bracket-score.lose { color: var(--sport-text-muted); opacity: 0.6; }


/* ── Colonne connettore (linee tra round) ──────────────────── */
.bracket-connector-col {
  width: 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/*
  Ogni segmento corrisponde a una coppia di match nel round precedente.
*/
.bracket-connector-segment {
  flex: 1;
  position: relative;
}

/* Bracket shape: top-horizontal + vertical + bottom-horizontal (EXIT → LEFT) */
.bracket-connector-segment::before {
  content: '';
  position: absolute;
  top: 25%;        /* centro del match superiore nella coppia */
  left: 0;
  width: 50%;
  height: 50%;     /* fino al centro del match inferiore */
  border-top: 3px solid var(--connector);
  border-right: 3px solid var(--connector);
  border-bottom: 3px solid var(--connector);
  box-sizing: border-box;
}

/* Linea di uscita dal centro verso destra (round successivo) */
.bracket-connector-segment::after {
  content: '';
  position: absolute;
  top: calc(50% - 1.5px);
  left: 50%;
  right: 0;
  height: 3px;
  background: var(--connector);
}

/* ── Connettore DESTRO (speculare): bracket a dx, uscita a sx ───── */
.bracket-connector-col.right .bracket-connector-segment::before {
  /* Bracket aperto verso DESTRA: border-left crea la barra verticale al centro */
  left: auto;
  right: 0;
  border-top: 3px solid var(--connector);
  border-left: 3px solid var(--connector);
  border-bottom: 3px solid var(--connector);
  border-right: none;
}

.bracket-connector-col.right .bracket-connector-segment::after {
  /* Linea di uscita verso SINISTRA (verso la Finale) */
  left: 0;
  right: 50%;
}

/* ── Connettore DIRETTO (1-to-1, nessun bracket) ──────────── */
.bracket-connector-col.direct .bracket-connector-segment::before,
.bracket-connector-col.right.direct .bracket-connector-segment::before {
  display: none;
}

/* Linea orizzontale che copre l'intera larghezza del connettore */
.bracket-connector-col.direct .bracket-connector-segment::after,
.bracket-connector-col.right.direct .bracket-connector-segment::after {
  left: 0;
  right: 0;
}

/* ============================================================
   CHAMPION HIGHLIGHT IN FINAL SLOT
   ============================================================ */
/* Champion team row: gradiente principale pieno dello sport */
.bracket-team-row.champion-team {
  background: var(--sport-bg-winner) !important;
  border-left: none !important;
}

.bracket-team-row.champion-team .bracket-team-name {
  color: #ffffff !important;
  font-weight: 800 !important;
}

.bracket-team-row.champion-team .bracket-score.win {
  color: #ffffff !important;
  font-weight: 800;
}


/* ============================================================
   RESPONSIVE MOBILE FALLBACK (width <= 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Abilita scorrimento verticale solo per tab partite */
  #tab-content-schedule,
  #single-schedule-layout,
  #general-matches {
    overflow-y: auto !important;
    height: auto !important;
    flex: none !important;
  }
  .matches-list {
    display: grid;
    grid-template-columns: 1fr !important; /* Forza una singola colonna */
    grid-template-rows: auto !important;     /* Consente al grid di allungarsi */
    overflow-y: visible !important;
    flex: none !important;
    gap: 8px !important;
  }
  .match-card {
    height: 120px !important; /* Altezza fissa ottimale leggibilità */
  }
}
