/* ==========================================================================
   LEGA FIGA TRADERS — STYLESHEET PRINCIPALE
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABILI DI TEMA (CHIARO / SCURO)
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  --bg: #f4f4f4;
  --surface: #fff;
  --surface2: #f0f0f0;
  --surface3: #e8e8e8;
  --border: #ddd;
  --text: #1a1a1a;
  --text-muted: #555;
  --text-faint: #aaa;
  --accent: #1a6b3c;
  --accent-light: #e6f4ed;
  --gold: #c8a000;
  --silver: #7a8a99;
  --bronze: #b05c2a;
  --header-bg: #0f3d24;
  --nav-bg: #1a6b3c;
  --nav-hover: #0f3d24;
  --shadow: 0 2px 8px rgba(0, 0, 0, .10);
  --radius: 6px;
  --font-d: 'Barlow Condensed', sans-serif;
  --font-b: 'Barlow', sans-serif;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --surface3: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-faint: #484f58;
  --accent: #3fb571;
  --accent-light: #1a3a2a;
  --gold: #e3b341;
  --silver: #8b949e;
  --bronze: #d4925a;
  --header-bg: #0a1f12;
  --nav-bg: #1a3a2a;
  --nav-hover: #0a1f12;
  --shadow: 0 2px 12px rgba(0, 0, 0, .4);
}

/* --------------------------------------------------------------------------
   2. RESET E STRUTTURA BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

img, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* Gestione delle "Pagine" della Single Page App */
.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Contenitori Principali */
.pw {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 1rem;
}

.pw-large {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 2rem;
}

/* Griglia base a 2 colonne (Usata in Home e Statistiche) */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

/* --------------------------------------------------------------------------
   3. HEADER E NAVIGAZIONE
   -------------------------------------------------------------------------- */
.top-header {
    background: var(--header-bg);
    padding: 0 1rem;
    position: sticky !important;
    top: 0 !important;
    z-index: 99990 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    width: 100%;
}

.top-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  color: #fff;
}

.league-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.league-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  flex-shrink: 0;
}

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

.league-name {
  font-family: var(--font-d);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.1;
}

.league-sub {
  font-size: .7rem;
  color: rgba(255, 255, 255, .5);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btn-theme {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: .78rem;
  cursor: pointer;
}

.btn-theme:hover {
  background: rgba(255, 255, 255, .2);
}

nav {
  background: var(--nav-bg);
  border-bottom: 2px solid var(--accent);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar {
  display: none;
}

nav a {
  color: #fff;
  text-decoration: none;
  padding: 11px 16px;
  font-family: var(--font-d);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  display: block;
  cursor: pointer;
  transition: background .15s;
}

nav a:hover,
nav a.active {
  background: var(--nav-hover);
  border-bottom-color: #fff;
}

/* --------------------------------------------------------------------------
   4. COMPONENTI UI GENERICI (Box, Tabelle, Badge)
   -------------------------------------------------------------------------- */
/* Section Header (sh) e Section Body (sb) */
.sh {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 14px;
  font-family: var(--font-d);
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Property Container (pc) e Property Row (pr) - Usati per le liste stile "Scheda" */
.pc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.pc-h {
  background: var(--header-bg);
  padding: 11px 14px;
  color: #fff;
  font-family: var(--font-d);
  font-size: .88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--accent);
}

.pr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.pr:last-child { border-bottom: none; }
.pr .k { color: var(--text-muted); }
.pr .v { font-weight: 600; text-align: right; }

/* Stili Tabelle */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}

th {
  background: var(--surface3);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .5px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

.chart-wrap { 
    position: relative !important;
    padding: 10px !important; 
    height: 450px !important;
    width: 100% !important;
}
canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Posizioni, Medaglie e Link Squadre */
.pos {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
}
.p1 { color: var(--gold); }
.p2 { color: var(--silver); }
.p3 { color: var(--bronze); }

.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 700;
}
.m1 { background: var(--gold); color: #000; }
.m2 { background: var(--silver); color: #000; }
.m3 { background: var(--bronze); color: #fff; }

.team-link {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}
.team-link:hover {
  color: var(--gold);
  text-decoration: underline;
}

/* Badge (Amministratori, Vittorie) */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.b-sa { background: #2d1f6e; color: #a78bfa; }
.b-ad { background: #1a3060; color: #60a5fa; }
.b-w { background: var(--accent-light); color: var(--accent); }

/* Badge Ruoli Calciatori */
.r-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 0.9rem;
}
.r-p { background: #f59e0b; color: #fff; } /* Portieri: Giallo */
.r-d { background: #22c55e; color: #fff; } /* Difensori: Verde */
.r-c { background: #3b82f6; color: #fff; } /* Centrocampisti: Blu */
.r-a { background: #ef4444; color: #fff; } /* Attaccanti: Rosso */

/* --------------------------------------------------------------------------
   5. COMPONENTI DELLA HOME E DEL FOOTER
   -------------------------------------------------------------------------- */
.club-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.club-hero-banner {
  position: relative;
  height: 360px;
  background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.28)), url("assets/misc/home.jpg") center/cover;
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
}

.club-hero-emblem {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  flex-shrink: 0;
  margin-bottom: -42px;
  position: relative;
  z-index: 2;
  margin-left: 20px;
}

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

.club-hero-body {
  padding: 42px 20px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.club-hero-info h1 {
  font-family: var(--font-d);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.club-hero-info .sub {
  color: var(--text-muted);
  font-size: .8rem;
  margin-top: 4px;
}

.hero-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hs {
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 13px;
}

.hs .v {
  font-family: var(--font-d);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.hs .l {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

/* Box Dedica */
.dedica-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  margin-top: 24px;
  box-shadow: var(--shadow);
}
.dedica-container summary {
  list-style: none;
  outline: none;
}
.dedica-container summary::-webkit-details-marker {
  display: none;
}
.dedica-header {
  padding: 20px; 
  cursor: pointer; 
  font-family: var(--font-d);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dedica-text {
  padding: 0 20px 20px 20px; 
  cursor: auto; 
}
.dedica-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.dedica-text p:last-child { margin-bottom: 0; }

footer {
  background: var(--header-bg);
  color: rgba(255, 255, 255, .4);
  text-align: center;
  padding: 16px;
  font-size: .73rem;
  margin-top: 32px;
}
footer span {
  color: var(--accent);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   6. PAGINA STAGIONI ED ECOSISTEMA
   -------------------------------------------------------------------------- */
.season-ph {
  background: linear-gradient(135deg, #0a1f12, #1a6b3c);
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.season-ph h2 {
  font-family: var(--font-d);
  font-size: 1.8rem;
  font-weight: 800;
}
.season-ph p {
  font-size: .8rem;
  opacity: .7;
  margin-top: 3px;
}

.estimated {
  color: var(--text-faint);
  font-style: italic;
  font-size: .78rem;
}

.season-note {
  padding: 10px 14px;
  font-size: .79rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* Navigazione tra le stagioni (Tabs verticali/orizzontali principali) */
.stabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.stabs::-webkit-scrollbar { display: none; }

.stab {
  padding: 9px 14px;
  font-family: var(--font-d);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s;
}
.stab.active, .stab:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.spanel {
  display: none;
  padding: 0;
}
.spanel.active {
  display: block;
}

/* Navigazione interna alle stagioni (Classifica, Serie A, Coppa, Rose) */
.st-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.st-tabs::-webkit-scrollbar { display: none; }

.st-tab {
  background: var(--surface2);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-d);
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: 0.2s;
  white-space: nowrap;
}
.st-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.st-tab.disabled {
  opacity: 0.4;
  pointer-events: none;
  background: transparent;
  border-color: transparent;
}

.st-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}
.st-panel.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* UI Tornei e Partite (Ecosistema) */
.match-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.match-header {
  background: var(--surface3);
  padding: 6px 12px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.match-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--surface2);
  align-items: center;
}
.match-row:last-child { border-bottom: none; }

.match-score {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 800;
  background: var(--surface3);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text);
}

.coppa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Albero del Torneo ad Eliminazione */
.t-bracket { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 16px 0; margin-top: 12px; }
.b-round { display: flex; flex-direction: column; gap: 32px; }
.b-match { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; width: 320px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.15); max-width: 100%; }
.b-match-title { font-family: var(--font-d); font-size: 0.75rem; text-align: center; padding: 6px; background: var(--surface3); color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
.b-match.finale { border-color: var(--gold); box-shadow: 0 0 15px rgba(245, 158, 11, 0.25); }
.b-match.finale .b-match-title { background: var(--gold); color: #000; font-weight: 800; }

.b-team { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 0.85rem; border-top: 1px solid var(--border); cursor: pointer; transition: 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-team:hover { background: var(--surface3); }
.b-team.vincitore { font-weight: bold; }
.b-match.finale .b-team.vincitore { color: var(--gold); }

.b-scores-wrap { display: flex; align-items: center; gap: 4px; }
.b-score-small { font-family: var(--font-d); font-size: 0.7rem; padding: 2px 5px; background: var(--surface3); border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); }
.b-score { font-family: var(--font-d); font-weight: 800; background: var(--surface); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); }
.b-arrow { color: var(--text-muted); font-size: 1.5rem; }

/* --------------------------------------------------------------------------
   7. PAGINA ROSE E CONFRONTO
   -------------------------------------------------------------------------- */
.rose-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  align-items: center;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.conf-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.conf-selects { display: flex; gap: 8px; margin-bottom: 12px; }
.conf-selects select {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-b);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. PAGINA PRESIDENTI (Griglia Mega e Card)
   -------------------------------------------------------------------------- */
.pres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.pres-card {
  position: relative;
  height: 180px;
  background: #111111;
  border-radius: 16px;
  border: 1px solid #2a2a2a;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.pres-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 15px 30px rgba(0,0,0,0.6);
}

.pres-card::before {
  content: '';
  position: absolute;
  top: 0; left: -40px; bottom: 0; width: 180px;
  background: var(--pres-color);
  transform: skewX(-20deg);
  opacity: 0.35;
  z-index: 1;
  transition: opacity 0.3s, transform 0.3s ease;
}
.pres-card:hover::before { opacity: 0.35; } /* Fisso l'opacità come richiesto */

.pres-logo-box {
  position: absolute;
  top: 20px; left: 20px;
  width: 85px; height: 85px;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.pres-logo-box img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.8)); 
}
.pres-team-fallback { font-size: 2.5rem; }

.pres-avatar-box {
  position: absolute;
  bottom: 0; left: 130px;
  width: 170px; height: 175px;
  z-index: 3;
  display: flex; align-items: flex-end; justify-content: center;
}
.pres-avatar-box img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 0 12px rgba(0,0,0,0.6)); 
}

.pres-info-box {
  position: absolute;
  right: 24px; top: 50%;
  transform: translateY(-50%);
  text-align: right;
  z-index: 4;
  width: calc(100% - 310px);
}
.pres-team-name {
  font-family: var(--font-d);
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.5px;
}
.pres-manager-name {
  font-family: var(--font-b);
  font-size: 1.1rem;
  color: #a0a0a0;
  font-weight: 500;
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   9. PAGINA PROFILO SINGOLO PRESIDENTE
   -------------------------------------------------------------------------- */
.prof-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 16px;
  width: fit-content;
}
.prof-back:hover { text-decoration: underline; }

.prof-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.prof-banner {
  height: 110px;
  background: linear-gradient(135deg, #0a1f12, #1a6b3c, #2d9e5f);
  position: relative;
}

.prof-hero-images { 
  position: absolute; 
  bottom: -80px; left: 24px; 
  display: flex; align-items: center; gap: 16px; 
  z-index: 2; 
}
.prof-huge-avatar, .prof-dyn-logo { 
  width: 180px; height: 180px; 
  border-radius: 24px; 
  border: 4px solid var(--surface); 
  background: var(--surface3); 
  box-shadow: 0 10px 25px rgba(0,0,0,0.5); 
  display: flex; align-items: center; justify-content: center; 
  overflow: hidden; 
}
.prof-huge-avatar { 
  font-family: var(--font-d); 
  font-size: 3rem; 
  font-weight: 800; 
  color: var(--accent); 
}
.prof-huge-avatar img, .prof-dyn-logo img { width: 100%; height: 100%; object-fit: cover; }
.prof-dyn-logo img { padding: 8px; object-fit: contain; }

.prof-body {
  padding: 95px 24px 18px; /* Spazio per ospitare le immagini grosse */
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

.prof-info { flex: 1; min-width: 200px; }
.prof-info h2 { font-family: var(--font-d); font-size: 1.7rem; font-weight: 800; line-height: 1; }
.prof-info .prof-sub { color: var(--text-muted); font-size: .8rem; margin-top: 3px; }
.prof-info .prof-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }

.prof-kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.pkpi {
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
}
.pkpi .pv { font-family: var(--font-d); font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1; }
.pkpi .pl { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

.trophy-shelf { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px; }
.trophy-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; min-width: 170px;
}
.trophy-icon-big { font-size: 2.2rem; flex-shrink: 0; }
.ti-name { font-family: var(--font-d); font-weight: 700; font-size: .92rem; line-height: 1.2; }
.ti-sub { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.ti-count { font-family: var(--font-d); font-size: 1.35rem; font-weight: 800; color: var(--gold); }
.no-trophy { padding: 20px; text-align: center; color: var(--text-faint); font-style: italic; font-size: .83rem; }

/* --------------------------------------------------------------------------
   10. PAGINA STATISTICHE E REGOLAMENTO
   -------------------------------------------------------------------------- */
/*.chart-wrap { padding: 14px; } */

/* Layout Palmarès */
.pal-row { display: flex; border-bottom: 1px solid var(--border); padding: 10px 14px; gap: 12px; }
.pal-row:last-child { border-bottom: none; }
.pal-yr {
  font-family: var(--font-d); font-size: 1.35rem; font-weight: 800;
  color: var(--text-muted); width: 60px; flex-shrink: 0;
  display: flex; align-items: center;
}
.pal-col { flex: 1; }
.pal-lbl { font-size: .67rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); margin-bottom: 3px; }
.pal-place { display: flex; align-items: center; gap: 6px; font-size: .83rem; margin-bottom: 2px; white-space: nowrap !important; }

/* Stili specifici tabella Statistiche */
.t-alltime th:not(:nth-child(2)), 
.t-alltime td:not(:nth-child(2)) { text-align: center; }
.t-alltime th:nth-child(2) { width: 100%; text-align: left; }
.t-alltime th { white-space: nowrap; padding: 8px 6px; }

/* Stili Regolamento */
.reg-art { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.reg-art:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.reg-art h3 { font-family: var(--font-d); font-size: 1rem; font-weight: 700; color: var(--accent); margin-bottom: 5px; text-transform: uppercase; }
.reg-art li, .reg-art p { font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.reg-art ul { padding-left: 16px; margin-top: 3px; }

/* Stili Extra (Es. box citazioni) */
.chicca-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px; margin-top: 12px;
  font-size: .83rem; color: var(--text-muted); font-style: italic; line-height: 1.5;
}
.chicca-box::before { content: "💬 "; font-style: normal; }

/* =======================================
   FIX DEFINITIVO: LARGHEZZA TABELLA CONFRONTA
======================================= */
#conf-roster-sx table, 
#conf-roster-dx table {
    width: 100% !important; /* Si adatta perfettamente al contenitore */
    table-layout: auto;
}

/* Evita che le colonne si allargano troppo, tenendole vicine */
#conf-roster-sx table th:nth-child(2),
#conf-roster-dx table th:nth-child(2),
#conf-roster-sx table td:nth-child(2),
#conf-roster-dx table td:nth-child(2) {
    width: 70%; /* Dà lo spazio giusto al nome del calciatore */
}

#conf-roster-sx table th:nth-child(n+3),
#conf-roster-dx table th:nth-child(n+3),
#conf-roster-sx table td:nth-child(n+3),
#conf-roster-dx table td:nth-child(n+3) {
    text-align: left !important;
    width: 15%; /* Compatta le colonne Squadra e Crediti */
}

/* =======================================
   FIX DEFINITIVO: TENDINE CONFRONTA
======================================= */
.conf-selects {
    display: flex;
    flex-wrap: wrap; /* Se non entrano, vanno a capo ordinatamente */
    gap: 6px;
    width: 100%;
}

.conf-selects select {
    flex: 1 1 100% !important; /* Le tendine occupano tutta la larghezza del box nero */
    width: 100% !important;
    max-width: 100% !important;
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE) E COMPORTAMENTI DINAMICI
   ========================================================================== */

/* Breakpoint 900px: Collasso griglia principale */
@media(max-width:900px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* Breakpoint 901px: Ottimizzazione griglia Statistiche (Colonna Destra compatta) */
@media(min-width: 901px) {
  .grid-stats-custom { grid-template-columns: 1fr max-content !important; gap: 40px !important; }
}

/* =======================================
   FIX PC: MENU ORIZZONTALE PERFETTO
======================================= */
.nav-inner {
    width: 100% !important;
    display: flex !important;
    background-color: transparent; /* O il colore di sfondo che usi su PC */
    position: relative !important; /* Assicura che su PC stia al suo posto in alto */
}

nav {
    display: flex !important;
    flex-direction: row !important; /* FORZA L'ORIZZONTALE: l'antidoto al menu in verticale */
    width: 100%;
    align-items: center;
    justify-content: flex-start; /* Allinea i tasti a sinistra, mettilo 'center' se li vuoi centrati */
    gap: 20px !important; /* Spazio largo tra un tasto e l'altro su monitor grande */
    padding: 10px 20px;
}

nav a {
    display: flex !important;
    flex-direction: row !important; /* Icona a sinistra, scritta a destra */
    align-items: center;
    justify-content: center;
    gap: 8px !important; /* Spazio tra icona e testo */
    width: auto !important; /* Impedisce che un tasto occupi tutto lo schermo */
}

.nav-icon {
    font-size: 1.2rem;
    filter: grayscale(0%) !important; /* Su PC le icone restano sempre colorate */
}

.nav-label {
    font-size: 1rem !important;
}

/* --------------------------------------------------------------------------
   Breakpoint 768px: Mobile View
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .top-header {
      position: sticky !important;
      top: 0 !important; /* Lo incolla al soffitto dello schermo */
      z-index: 99990 !important; /* Lo tiene sopra a tutto il resto del sito che scorre sotto */
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important; /* Aggiunge un'ombra per staccarlo dai contenuti */
      width: 100%;
  }
  .top-header-inner { 
      height: auto !important; 
      min-height: 64px !important; /* Dà lo spazio verticale necessario */
      padding: 6px 4px !important; 
      display: flex !important;
      justify-content: space-between !important;
      align-items: center !important;
      flex-wrap: nowrap !important; /* Impedisce categoricamente di andare a capo */
  }
  .league-brand { gap: 8px; }
  .league-logo { width: 30px; height: 30px; }
  .league-name { font-size: 1rem; }
  .league-sub { font-size: .58rem; }
  .btn-theme { padding: 4px 8px; font-size: .7rem; }

  #countdown-container .big-numbers,
    #countdown-container .countdown-value {
        font-size: 2.8rem !important;
        line-height: 1 !important;
    }
    #countdown-container .big-labels,
    #countdown-container .countdown-label {
        font-size: 0.75rem !important;
    }

    #countdown-container,
    .hero-video-container {
        position: relative;
        width: 100% !important;
        height: 450px !important;
        max-height: 450px !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        margin-bottom: 15px !important;
    }

    #bg-video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: fill !important;
        z-index: 0;
    }

    #countdown-container .content {
        z-index: 1;
        position: relative;
    }
  

/* =======================================
   BOTTOM NAV BAR - STILE APP NATIVA (SOLO VERDE, ZERO SPESSORE)
======================================= */
body {
    padding-bottom: 60px !important; /* Ridotto per compensare la barra più snella */
}

.top-header-inner {
    padding-bottom: 10px; 
}

/* Il contenitore della barra fissa in basso */
.nav-inner { 
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    /* AZZERRATO IL NERO: Ora il contenitore è invisibile e lascia comandare il tuo verde */
    background-color: transparent !important; 
    border: none !important; 
    z-index: 9999 !important; 
    overflow: hidden !important; 
    /* ELIMINATO LO SPESSORE INUTILE */
    padding: 0 !important; 
    margin: 0 !important;
}

nav {
    display: flex !important;
    width: 100% !important;
    justify-content: space-around !important; 
    align-items: center;
    /* Questo è l'unico spessore vitale (6px sopra e 12px sotto) per poter premere le icone con l'iPhone */
    padding: 6px 0 12px 0 !important; 
    margin: 0 !important;
}

/* I singoli bottoni: Icona sopra, testo sotto */
nav a { 
    display: flex !important;
    flex-direction: column !important; 
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important; /* Icona e testo più vicini */
    flex: 1; 
    text-decoration: none !important;
    border: none !important;
    padding: 4px 0 !important;
    opacity: 0.6; /* Un po' più visibili da "spenti" */
    transition: all 0.2s ease;
}

/* Quando un bottone è selezionato (Attivo) */
nav a.active {
    opacity: 1; 
    color: #ffffff !important; /* Messo BIANCO, così "spicca" benissimo sul tuo verde */
}

/* Grandezza dell'icona (emoji) */
.nav-icon {
    font-size: 1.25rem; /* Leggermente ridotte per snellire la barra */
    display: block;
    filter: grayscale(100%); 
}

/* Animazione e colore per l'icona attiva */
nav a.active .nav-icon {
    filter: grayscale(0%); 
    transform: scale(1.1); /* Zoom leggermente più morbido */
}

/* Stile del testo piccolo sotto l'icona */
.nav-label {
    font-size: 0.55rem !important; /* Testo compatto */
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

  .pw { padding: 8px 8px; }

  .club-hero { margin-bottom: 12px; overflow: hidden; }
  .club-hero-banner {
    height: auto !important; 
    aspect-ratio: 2.5 / 1 !important; 
    background-size: contain !important;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #0b0f0e;
  }
  .club-hero-emblem { width: 64px; height: 64px; margin-bottom: -30px; border-width: 2px; }
  .club-hero-body { padding: 34px 10px 12px; gap: 8px; }
  .club-hero-info h1 { font-size: 1.18rem; line-height: 1.05; }
  .club-hero-info .sub { font-size: .7rem; line-height: 1.25; }

  .hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .hs { padding: 7px 8px; }
  .hs .v { font-size: 1.05rem; }
  .hs .l { font-size: .55rem; }

  .grid2 { gap: 12px; }
  .grid2 > * { min-width: 0; } 

  .sh { padding: 8px 10px; font-size: .78rem; }
  
  table { 
      display: block !important;
      width: 100% !important;
      overflow-x: auto !important;
      -webkit-overflow-scrolling: touch;
      white-space: nowrap;
      font-size: .72rem; 
  }
  th, td { padding: 5px 7px; white-space: nowrap; }

  .pc, .sb { margin-bottom: 12px; }
  
  .pal-row { padding: 8px; gap: 8px; flex-wrap: wrap; }
  .pal-yr { width: 48px; font-size: 1rem; }
  .pal-lbl { font-size: .58rem; }
  .pal-place { font-size: .7rem; }

  .pres-grid { grid-template-columns: 1fr; }
  .pres-card { height: 140px; min-height: auto; }
  .pres-logo-box { width: 60px; height: 60px; top: 12px; left: 12px; }
  .pres-avatar-box { left: 80px; width: 130px; height: 135px; }
  .pres-info-box { right: 12px; width: calc(100% - 190px); }
  .pres-team-name { font-size: 1.3rem; }
  .pres-manager-name { font-size: 0.9rem; }

  /*.chart-wrap {
        position: relative;
        height: 380px !important;
        width: 100%;
  }
  */

  .prof-body { padding: 70px 16px 16px; gap: 12px; }
  .prof-info h2 { font-size: 1.4rem; }
  .prof-kpis { flex-direction: row; flex-wrap: wrap; }
  .pkpi { padding: 7px 10px; flex: 1; min-width: 80px; }
  .pkpi .pv { font-size: 1.3rem; }
  .trophy-shelf { gap: 8px; padding: 10px; }
  .trophy-item { min-width: 0; width: 100%; }
  .season-ph { padding: 12px 14px; margin-bottom: 14px; }
  .season-ph h2 { font-size: 1.3rem; }

  .coppa-grid { grid-template-columns: 1fr; }
  .conf-container { grid-template-columns: 1fr; gap: 12px; }

  .t-bracket { flex-direction: column; gap: 16px; }
  .b-arrow { transform: rotate(90deg); }
  .b-round { gap: 16px; }
  .b-match { width: 100%; }

  /* FIX DEFINITIVO: MENU STAGIONI MOBILE A GRIGLIA */
  .st-tabs {
      flex-wrap: wrap !important; 
      gap: 6px !important;
  }
  .st-tab {
      flex: 1 1 calc(50% - 6px) !important; 
      text-align: center;
      padding: 8px 4px !important;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint 480px: Mobile Small
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  #header-countdown {
      display: none !important;
  }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .stabs { overflow-x: auto; scrollbar-width: none; }
  .stabs::-webkit-scrollbar { display: none; }
  .stab { padding: 8px 12px; font-size: .78rem; }
  .prof-hero-images { bottom: -60px; left: 16px; gap: 10px; }
  .prof-huge-avatar, .prof-dyn-logo { width: 115px; height: 115px; border-radius: 16px; border-width: 3px; }
  .prof-huge-avatar { font-size: 2rem; }
  .prof-body { padding: 75px 16px 16px; }
}

/* Comportamenti dinamici iniettati via JS */
.is-mobile .grid2 { grid-template-columns: 1fr; }
.is-mobile .grid2 > * { min-width: 0; }
.is-mobile .pres-grid { grid-template-columns: 1fr; }

/* ==========================================================================
   LOADING SCREEN
   ========================================================================== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-logo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px rgba(63, 181, 113, 0.4);
  animation: pulseLogo 1.5s infinite ease-in-out;
}

.loader-title {
  font-family: var(--font-d);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
}

@keyframes pulseLogo {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(63, 181, 113, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(63, 181, 113, 0.7);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(63, 181, 113, 0.3);
  }
}