/* ═══════════════════════════════════════════════════════════
   MONDIALI 2026 — Design System v2 "Broadcast Premium"
   Ispirazione: Bet365 / DraftKings / ESPN / FIFA app ufficiale
   Nero profondo, oro liquido, verde campo, glass, glow, motion.
   ═══════════════════════════════════════════════════════════ */

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

:root {
  /* Superfici */
  --bg:           #080B14;
  --bg-card:      #0C0F1A;
  --bg-elevated:  #10141F;
  --bg-input:     #0A0D16;
  --border:       rgba(255,255,255,0.09);
  --border-hover: rgba(255,255,255,0.18);

  /* Glass */
  --glass-bg:     rgba(255,255,255,0.05);
  --glass-bg-2:   rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.09);
  --glass-blur:   20px;

  /* Oro (accent primario) */
  --gold-1:       #F5A623;
  --gold-2:       #F7C948;
  --gold:         #F5AE2E;
  --gold-dim:     rgba(245,166,35,0.16);
  --gold-glow:    rgba(245,166,35,0.28);
  --grad-gold:    linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 100%);

  /* Verde campo (accent secondario) */
  --green-1:      #00C853;
  --green-2:      #00E676;
  --success:      #00D65C;
  --success-dim:  rgba(0,200,83,0.16);
  --success-glow: rgba(0,230,118,0.28);
  --grad-green:   linear-gradient(135deg, var(--green-1) 0%, var(--green-2) 100%);

  /* Semantici */
  --danger:       #FF4D6A;
  --danger-dim:   rgba(255,77,106,0.16);
  --info:         #3FA9FF;
  --info-dim:     rgba(63,169,255,0.16);

  /* Testo */
  --text:         #FFFFFF;
  --text-muted:   #8892A4;
  --text-dim:     #4E5567;

  /* Forme & moto */
  --radius-sm:    10px;
  --radius:       16px;
  --radius-lg:    24px;
  --shadow:       0 20px 50px rgba(0,0,0,0.55);
  --shadow-gold:  0 0 48px rgba(245,166,35,0.22);
  --shadow-green: 0 0 48px rgba(0,230,118,0.2);
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --transition:   300ms var(--ease);

  --font-heading: 'Bebas Neue', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  color-scheme: dark;
  accent-color: var(--gold);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 1000px 620px at 15% -8%, rgba(245,166,35,0.10), transparent 55%),
    radial-gradient(ellipse 900px 600px at 100% 10%, rgba(0,230,118,0.07), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-2); }

button, input, select, textarea { touch-action: manipulation; font-family: inherit; }

/* Scrollbar sottile in tema */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Pattern di sfondo: palloni da calcio sottili (opacity 0.03) ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-width='1.4'%3E%3Ccircle cx='60' cy='60' r='22'/%3E%3Cpath d='M60 40 L74 50 L69 67 L51 67 L46 50 Z'/%3E%3Cpath d='M60 40 L60 30 M74 50 L83 44 M69 67 L74 78 M51 67 L46 78 M46 50 L37 44'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 120px 120px;
}
body > * { position: relative; z-index: 1; }

/* Utility glass generica */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
}

/* ── Navbar ── */
.navbar {
  background: rgba(8,11,20,0.72);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 clamp(12px, 4vw, 24px);
}
.navbar::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-1), var(--green-2), var(--gold-2), var(--green-1), var(--gold-1));
  background-size: 300% 100%;
  animation: headerSheen 8s linear infinite;
  opacity: 0.55;
}
@keyframes headerSheen {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
.navbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.5vw, 6px);
  height: 66px;
  overflow-x: auto;
  scrollbar-width: none;
}
.navbar-inner::-webkit-scrollbar { display: none; }
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: clamp(17px, 4.5vw, 22px);
  letter-spacing: 0.02em;
  color: var(--text);
  margin-right: auto;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.navbar-logo .ball {
  font-size: clamp(17px, 4.5vw, 22px);
  filter: drop-shadow(0 0 10px rgba(245,166,35,0.55));
}
.navbar-logo span {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-link {
  position: relative;
  padding: 10px clamp(10px, 3vw, 16px);
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: clamp(13px, 3vw, 15px);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-link-regolamento { display: none; }
@media (min-width: 641px) {
  .nav-link-regolamento { display: inline-block; }
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-link:active { transform: scale(0.94); }
.nav-link.active { color: #10141F; background: var(--grad-gold); box-shadow: 0 4px 18px var(--gold-glow); }
.nav-link.admin-link { color: var(--gold); border: 1px solid rgba(245,166,35,0.35); }
.nav-link.admin-link:hover { background: var(--gold-dim); }
.nav-link.admin-link.active { color: #10141F; }
.nav-user {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.nav-user strong { color: var(--text); font-weight: 700; }
.btn-logout {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.btn-logout:active { transform: scale(0.94); }

/* ── Page layout ── */
.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 44px 24px 90px;
}
.page-sm {
  max-width: 460px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}
.app-shell { padding-bottom: 0; }

/* ── Page header ── */
.page-header { margin-bottom: 36px; }
.page-eyebrow {
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.page-title {
  font-family: var(--font-heading);
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: 0.01em;
  line-height: 1.02;
  color: var(--text);
  text-transform: uppercase;
}
.page-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
}

/* ── Cards (glass) ── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: rgba(245,166,35,0.35);
  transform: scale(1.02);
  box-shadow: 0 0 32px rgba(245,166,35,0.14);
}
.card-sm { padding: 16px 20px; }
/* I contenitori full-width (pannelli admin, card con tabelle) non fanno hover-zoom: solo le card "a riquadro" lo usano */
.admin-panel:hover,
.card:has(table):hover {
  transform: none;
  box-shadow: none;
  border-color: var(--glass-border);
}

/* ── Bottoni ── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--grad-gold);
  color: #14100A;
  box-shadow: 0 6px 22px var(--gold-glow);
}
.btn-primary:hover { box-shadow: 0 8px 30px var(--gold-glow); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0) scale(0.96); }
.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); background: var(--glass-bg-2); }
.btn-danger {
  background: var(--danger-dim);
  border: 1px solid rgba(255,77,106,0.35);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(255,77,106,0.24); }
.btn-success {
  background: var(--success-dim);
  border: 1px solid rgba(0,214,92,0.35);
  color: var(--success);
}
.btn-success:hover { background: rgba(0,214,92,0.24); box-shadow: 0 6px 22px var(--success-glow); }
.btn-sm { min-height: 38px; padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.nav-cta {
  padding: 9px clamp(11px, 3.5vw, 16px);
  font-size: clamp(12px, 3vw, 13px);
  flex-shrink: 0;
}

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  min-height: 48px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15.5px;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-dim);
}
.form-input::placeholder { color: var(--text-dim); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238892A4' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── Auth page ── */
.auth-shell {
  min-height: calc(100vh - 66px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  background: var(--glass-bg-2);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 42px;
  box-shadow: var(--shadow), var(--shadow-gold);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-1), var(--green-2), var(--gold-2));
  background-size: 200% 100%;
  animation: headerSheen 6s linear infinite;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .ball-big {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 24px rgba(245,166,35,0.45));
  animation: float 3s ease-in-out infinite;
}
.auth-logo h1 { font-family: var(--font-heading); font-size: 28px; letter-spacing: 0.01em; text-transform: uppercase; }
.auth-logo h1 span {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-muted); }
.auth-side-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.auth-side-badges .chip { background: var(--glass-bg); border: 1px solid var(--border); color: var(--text-muted); font-weight: 600; }

/* ── Alert ── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; animation: shake 0.4s var(--ease); }
.alert-error { background: var(--danger-dim); border: 1px solid rgba(255,77,106,0.35); color: var(--danger); }
.alert-success { background: var(--success-dim); border: 1px solid rgba(0,214,92,0.35); color: var(--success); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ── Fase label ── */
.fase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.fase-1 { background: rgba(136,146,164,0.16); color: #AEB6C6; border: 1px solid rgba(136,146,164,0.24); }
.fase-2 { background: var(--info-dim); color: var(--info); border: 1px solid rgba(63,169,255,0.26); }
.fase-3 { background: var(--success-dim); color: var(--success); border: 1px solid rgba(0,214,92,0.26); }
.fase-4 { background: rgba(251,146,60,0.16); color: #FB923C; border: 1px solid rgba(251,146,60,0.26); }
.fase-5 { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(245,166,35,0.36); }

/* ── Partita card ── */
.match-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.match-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
  z-index: 2;
}
.match-card:hover {
  border-color: rgba(245,166,35,0.35);
  transform: scale(1.02);
  box-shadow: 0 0 34px rgba(245,166,35,0.16);
}
.match-card:hover::before { background: var(--grad-gold); }
.match-header {
  padding: 14px 20px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.match-date { font-size: 12px; color: var(--text-muted); }
.match-body { padding: 22px 20px; }
.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.match-team { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.match-team:last-child { align-items: center; }
.team-flag { font-size: 32px; line-height: 1; }
.team-name {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.match-vs {
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  background: var(--glass-bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
}
.match-winner-badge {
  font-family: var(--font-heading);
  font-size: 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Team card cliccabile ── */
.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all var(--transition);
  user-select: none;
}
.team-card[onclick] { border-color: var(--border); background: rgba(255,255,255,0.02); cursor: pointer; }
.team-card[onclick]:hover { border-color: var(--gold); background: var(--gold-dim); transform: translateY(-2px) scale(1.03); }
.team-card[onclick]:active { transform: scale(0.97); }
.team-card.selected {
  border-color: var(--gold) !important;
  background: var(--gold-dim) !important;
  box-shadow: 0 0 24px var(--gold-glow);
  animation: pop 0.3s var(--ease);
}
.team-card.winner { border-color: var(--success); background: var(--success-dim); box-shadow: 0 0 24px var(--success-glow); }
@keyframes pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Bottoni voto */
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote-btn {
  min-height: 46px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 15px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.vote-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
.vote-btn:active:not(:disabled) { transform: scale(0.96); }
.vote-btn.selected { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); box-shadow: 0 0 18px var(--gold-glow); }
.vote-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.vote-status { text-align: center; font-size: 13px; font-weight: 600; padding: 10px; border-radius: var(--radius-sm); }
.vote-status.voted { background: var(--success-dim); color: var(--success); border: 1px solid rgba(0,214,92,0.24); }
.vote-status.closed { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.vote-status.correct { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(245,166,35,0.3); font-weight: 700; }
.vote-status.wrong { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,77,106,0.24); }

/* ── Classifica ── */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
}
.leaderboard-header {
  display: grid;
  grid-template-columns: 52px 1fr 130px 70px;
  gap: 8px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 52px 1fr 130px 70px;
  gap: 8px;
  padding: 15px 20px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: rgba(255,255,255,0.05); }
.rank-points-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.leaderboard-row.rank-1 { background: linear-gradient(90deg, rgba(245,166,35,0.16) 0%, transparent 75%); }
.leaderboard-row.rank-2 { background: linear-gradient(90deg, rgba(210,216,228,0.09) 0%, transparent 75%); }
.leaderboard-row.rank-3 { background: linear-gradient(90deg, rgba(217,148,97,0.09) 0%, transparent 75%); }
.rank-bar-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.rank-bar-fill {
  height: 100%;
  width: var(--fill, 0%);
  background: var(--grad-gold);
  transform: scaleX(0);
  transform-origin: left;
  animation: barGrow 1.1s var(--ease) forwards;
  animation-delay: 0.15s;
}
@keyframes barGrow { to { transform: scaleX(1); } }
.rank-num { font-family: var(--font-heading); font-size: 19px; color: var(--text-dim); text-align: center; }
.rank-1 .rank-num { color: var(--gold); }
.rank-2 .rank-num { color: #D2D8E4; }
.rank-3 .rank-num { color: #D99461; }
.rank-medal { font-size: 18px; }
.rank-username {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-points { font-family: var(--font-heading); font-size: 21px; color: var(--gold); text-align: center; }
.rank-stat { font-size: 14px; color: var(--text-muted); text-align: center; font-weight: 500; }
.rank-pct { font-size: 14px; font-weight: 700; text-align: center; }

/* Podio top 3 */
.podio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 32px; }
.podio-item {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 16px 24px;
  text-align: center;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
  cursor: pointer;
}
.podio-item:hover { box-shadow: 0 0 30px rgba(245,166,35,0.18); }
.podio-item::before {
  content: '';
  position: absolute;
  top: -40%; left: 50%;
  width: 140%; height: 100%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.16), transparent 70%);
  pointer-events: none;
}
.podio-item.pos-1 {
  border-color: rgba(245,166,35,0.45);
  box-shadow: var(--shadow-gold);
  transform: translateY(-12px) scale(1.03);
}
.podio-item.pos-1::before { background: radial-gradient(ellipse at 50% 0%, rgba(245,166,35,0.32), transparent 70%); }
.podio-item.pos-2 { border-color: rgba(210,216,228,0.3); }
.podio-item.pos-2::before { background: radial-gradient(ellipse at 50% 0%, rgba(210,216,228,0.18), transparent 70%); }
.podio-item.pos-3 { border-color: rgba(217,148,97,0.3); }
.podio-item.pos-3::before { background: radial-gradient(ellipse at 50% 0%, rgba(217,148,97,0.18), transparent 70%); }
.podio-crown { font-size: 32px; margin-bottom: 8px; animation: float 3.2s ease-in-out infinite; position: relative; z-index: 1; }
.podio-pos { font-family: var(--font-heading); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; position: relative; z-index: 1; }
.podio-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; position: relative; z-index: 1; }
.podio-pts { font-family: var(--font-heading); font-size: 32px; color: var(--gold); line-height: 1; position: relative; z-index: 1; }
.podio-pts-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; position: relative; z-index: 1; }

/* ── Fase section ── */
.fase-section { margin-bottom: 40px; }
.fase-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fase-title h2 { font-family: var(--font-heading); font-size: 22px; color: var(--text); text-transform: uppercase; letter-spacing: 0.01em; }
.fase-count { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.matches-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 14px; }

/* ── Pronostici tabella ── */
.pronostici-table { width: 100%; border-collapse: collapse; }
.pronostici-table th {
  text-align: left; padding: 12px 16px; font-family: var(--font-heading); font-size: 12px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-dim); background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.pronostici-table td { padding: 13px 16px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
.pronostici-table tr:last-child td { border-bottom: none; }
.pronostici-table tr:hover td { background: rgba(255,255,255,0.02); }
.pronostici-table tr.row-correct td { background: rgba(0,214,92,0.07); }
.pronostici-table tr.row-correct:hover td { background: rgba(0,214,92,0.12); }
.pronostici-table tr.row-wrong td { background: rgba(255,77,106,0.06); }
.pronostici-table tr.row-wrong:hover td { background: rgba(255,77,106,0.1); }

/* ── Home pubblica ── */
.hero { min-height: 84vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 24px; position: relative; overflow: hidden; }
.hero-orb {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
  width: 680px; height: 680px;
  background: radial-gradient(circle, rgba(245,166,35,0.14) 0%, rgba(0,230,118,0.05) 45%, transparent 68%);
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}
.hero-eyebrow { font-family: var(--font-heading); font-size: 14px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold); margin-bottom: 20px; }
.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(48px, 10vw, 100px);
  letter-spacing: 0.01em;
  line-height: 0.96;
  text-transform: uppercase;
  margin-bottom: 20px;
  color: var(--text);
}
.hero-title .gold {
  background: linear-gradient(120deg, var(--gold-1), var(--gold-2), var(--gold-1));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: headerSheen 5s linear infinite;
}
.hero-sub { font-size: 17px; color: var(--text-muted); max-width: 460px; margin: 0 auto 36px; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; width: 100%; max-width: 380px; }
.hero-cta .btn { flex: 1; min-width: 160px; }
.hero-ball {
  font-size: clamp(58px, 12vw, 96px);
  display: block;
  margin-bottom: 22px;
  filter: drop-shadow(0 0 34px rgba(245,166,35,0.4));
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ── Stats bar ── */
.stats-bar {
  display: flex; gap: 0; border: 1px solid var(--glass-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 32px;
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
}
.stat-item { flex: 1; padding: 22px; border-right: 1px solid var(--border); text-align: center; }
.stat-item:last-child { border-right: none; }
.stat-value { font-family: var(--font-heading); font-size: 34px; color: var(--gold); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ── Regolamento ── */
.rules-section {
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 28px; margin-bottom: 16px;
}
.rules-section h2 { font-family: var(--font-heading); font-size: 19px; color: var(--gold); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: 0.02em; }
.rules-section h2 .icon { font-size: 20px; }
.rules-section p, .rules-section li { font-size: 15px; color: var(--text-muted); line-height: 1.7; }
.rules-section ul, .rules-section ol { padding-left: 20px; }
.rules-section li { margin-bottom: 6px; }
.rules-section li strong { color: var(--text); }
.punti-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px; }
.punti-item { background: var(--glass-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; text-align: center; }
.punti-fase { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; }
.punti-val { font-family: var(--font-heading); font-size: 26px; color: var(--gold); }
.punti-max { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ── Toast notifica ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; left: 24px; z-index: 9999;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none;
}
.toast {
  background: var(--glass-bg-2);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toastIn 0.4s var(--ease);
  max-width: 340px;
  width: 100%;
}
.toast.toast-success { border-left: 3px solid var(--success); box-shadow: var(--shadow), 0 0 24px var(--success-glow); }
.toast.toast-error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(0.96); } to { opacity: 1; transform: translateX(0) scale(1); } }

/* ── Loading ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-muted); font-size: 14px; gap: 12px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty p { font-size: 15px; }

/* ── Deadline badge ── */
.deadline-badge {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-heading); font-size: 12px;
  letter-spacing: 0.02em; padding: 4px 12px; border-radius: 999px; text-transform: uppercase;
}
.deadline-open { background: var(--success-dim); color: var(--success); }
.deadline-closed { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.deadline-soon { background: rgba(251,146,60,0.16); color: #FB923C; }

/* ── Admin tab nav ── */
.admin-tabs {
  display: flex; gap: 4px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 999px;
  padding: 5px; margin-bottom: 28px; overflow-x: auto; scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  min-height: 40px; padding: 9px 22px; border-radius: 999px; font-family: var(--font-heading); font-size: 15px;
  letter-spacing: 0.02em; text-transform: uppercase; cursor: pointer; color: var(--text-muted); border: none;
  background: none; transition: all var(--transition); white-space: nowrap;
}
.admin-tab:hover { color: var(--text); }
.admin-tab:active { transform: scale(0.95); }
.admin-tab.active { background: var(--grad-gold); color: #14100A; box-shadow: 0 4px 16px var(--gold-glow); }

/* ── Admin table ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; padding: 12px 14px; font-family: var(--font-heading); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(3,4,9,0.86); z-index: 500;
  align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(10px);
}
.modal-overlay.open { display: flex; animation: overlayIn 0.25s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--glass-bg-2);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.3s var(--ease);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--grad-gold);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-title { font-family: var(--font-heading); font-size: 22px; margin-bottom: 20px; color: var(--text); text-transform: uppercase; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Tag / chips ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip-gold { background: var(--gold-dim); color: var(--gold); }
.chip-green { background: var(--success-dim); color: var(--success); }
.chip-red { background: var(--danger-dim); color: var(--danger); }
.chip-gray { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ── Live indicator ── */
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.live-dot::before {
  content: ''; width: 7px; height: 7px; background: var(--success); border-radius: 50%;
  animation: pulse 2s infinite; flex-shrink: 0; box-shadow: 0 0 10px var(--success);
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Bottom navigation (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(8,11,20,0.86);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
}
.bottom-nav .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  padding: 6px 2px;
  min-height: 52px;
  border-radius: 12px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.bottom-nav .nav-link svg { width: 22px; height: 22px; stroke: currentColor; }
.bottom-nav .nav-link.active {
  background: var(--gold-dim);
  color: var(--gold);
  box-shadow: none;
}
.bottom-nav .nav-link:active { transform: scale(0.92); }

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .app-shell { padding-bottom: 82px; }
  .app-shell .navbar-inner .nav-link:not(.admin-link) { display: none; }
}

/* ── Responsive ── */
@media (max-width: 1023px) {
  .page { padding: 32px 20px 72px; }
}

@media (max-width: 768px) {
  .navbar-inner { gap: 4px; }
  .nav-user { display: none; }
  .page { padding: 24px 16px 60px; }
  .page-sm { padding: 40px 16px 60px; }
  .podio { grid-template-columns: 1fr; gap: 10px; }
  .podio-item.pos-1 { transform: none; order: -1; }
  .leaderboard-header, .leaderboard-row { grid-template-columns: 40px 1fr 70px 70px; }
  .leaderboard-header :nth-child(5), .leaderboard-header :nth-child(6),
  .leaderboard-row :nth-child(5), .leaderboard-row :nth-child(6) { display: none; }
  .matches-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-item:last-child { border-bottom: none; }
  .punti-grid { grid-template-columns: repeat(3, 1fr); }
  .auth-card { padding: 30px 22px; }
  .admin-tabs { gap: 2px; }
  .hero { min-height: 74vh; padding: 48px 20px; }
  .hero-cta { flex-direction: column; }
  .card:hover, .match-card:hover { transform: none; box-shadow: none; }
}

@media (max-width: 480px) {
  .page-title { font-size: 26px; }
  .auth-card { padding: 26px 18px; }
  .punti-grid { grid-template-columns: repeat(2, 1fr); }
  .match-teams { gap: 8px; }
  .team-flag { font-size: 26px; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: 100%; }
  .leaderboard-header, .leaderboard-row { grid-template-columns: 28px 1fr 58px 44px; gap: 6px; }
  .leaderboard-header { padding: 12px 12px; }
  .leaderboard-row { padding: 12px 12px; }
  .rank-num { font-size: 15px; }
  .rank-points { font-size: 17px; }
  .rank-points-wrap .chip { padding: 3px 8px; font-size: 10.5px; }
  .rank-pct { font-size: 12px; }
}

@media (hover: none) {
  .card:hover, .match-card:hover, .team-card[onclick]:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, .hero-ball, .auth-logo .ball-big, .podio-crown, .hero-orb, .live-dot::before,
  .navbar::before, .auth-card::before, .hero-title .gold, .rank-bar-fill {
    animation: none !important;
    transition: none !important;
  }
  .rank-bar-fill { transform: scaleX(1) !important; }
}
