/* ==========================================
 * COMUNDIALITO â€“ FOGLIO DI STILE COMPLETO
 * ========================================== */

/* ==========================================
 * 1. VARIABILI E RESET
 * ========================================== */
:root {
    --clr-bg-main: #050810;
    --clr-bg-card: rgba(10, 15, 30, 0.7);
    --clr-bg-card-solid: #0a0f1e;
    --clr-theme-light: #fef08a;
    --clr-theme-main: #d4af37;
    --clr-theme-dark: #9a7b26;
    --clr-text-main: #f8fafc;
    --clr-text-muted: #94a3b8;
    --clr-success: #22c55e;
    --clr-danger: #ef4444;
    --clr-pending: #475569;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Montserrat', sans-serif;
}

/* ==========================================
 * AD BANNER
 * ========================================== */
.ad-banner {
  width: min(92vw, 430px);
  height: 70px;
  margin: 1rem auto;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  position: relative;
  z-index: 100;
}
.ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--clr-bg-main);
    color: var(--clr-text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 50% -20%, rgba(30, 50, 90, 0.4) 0%, transparent 70%),
        radial-gradient(ellipse at 50% 120%, rgba(212, 175, 55, 0.08) 0%, transparent 60%);
}

/* ==========================================
 * 2. VIEW SWITCHING
 * ========================================== */
.view {
    display: none;
    min-height: 100vh;
}
.view.active {
    display: block;
}
.focus-mode .container { padding: 0.5rem 1rem; }
.focus-mode .wide-container { padding: 0.5rem 1rem; }

/* ==========================================
 * 3. CONTAINERS
 * ========================================== */
.container {
    max-width: 1200px;
    width: 95vw;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wide-container {
    max-width: 1800px;
    padding: 1.5rem 2rem 3rem;
}

/* ==========================================
 * 4. INTRO SCREEN
 * ========================================== */
.intro-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #0a0f1e 0%, #03050a 100%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.intro-screen::before {
    content: '';
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(circle at 30% 40%, rgba(212,175,55,0.06) 0%, transparent 40%),
        radial-gradient(circle at 70% 60%, rgba(30,50,90,0.12) 0%, transparent 40%);
    animation: floatingLights 12s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes floatingLights {
    0% { transform: scale(0.8) translate(0, 0); opacity: 0.6; }
    100% { transform: scale(1.1) translate(-50px, 30px); opacity: 1; }
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Flow dall'alto verso il basso */
    height: 100vh;
    padding: 4vh 0;
    position: relative;
    z-index: 10;
    width: 100%;
    gap: 2vh; /* Spaziatura costante tra elementi */
}

.intro-logo {
    width: clamp(200px, 35vw, 400px);
    cursor: pointer;
    transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 0 30px rgba(212,175,55,0.3));
    margin-top: 10vh;
}

.intro-logo.active-scale {
    width: clamp(120px, 15vw, 180px); /* Logo watermark piÃ¹ piccolo */
    margin-top: 0;
    filter: drop-shadow(0 0 20px rgba(212,175,55,0.4));
    cursor: default;
}

.intro-message {
    margin-top: 2rem;
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: var(--clr-theme-main);
    text-transform: uppercase;
    animation: pulseAlpha 2s infinite alternate;
}

.intro-message.hidden {
    display: none !important;
}

.intro-btn-group {
    margin-top: 2.5rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    position: absolute;
    bottom: 3rem;
}

.btn-skip {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--clr-text-muted);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem 2.5rem;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}
.btn-skip:hover {
    border-color: var(--clr-theme-main);
    color: var(--clr-theme-main);
}

.intro-teams-display {
    width: 100%;
    flex-grow: 1;
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    gap: 1.5rem;
    text-align: center; 
    z-index: 10;
}

.intro-subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: var(--clr-theme-light);
    text-transform: uppercase; letter-spacing: 6px;
    opacity: 0; transition: opacity 1s ease;
}
.intro-subtitle.visible { opacity: 1; }

.intro-team-logo {
    width: clamp(200px, 32vw, 360px); /* Range ottimale 350-380px max */
    height: clamp(200px, 32vw, 360px);
    object-fit: contain;
    opacity: 0; 
    transform: translateY(20px) scale(0.9);
    filter: blur(10px) drop-shadow(0 20px 40px rgba(0,0,0,0.8));
    transition: all 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.intro-team-logo.fade-in {
    opacity: 1; transform: translateY(0) scale(1);
    filter: blur(0) drop-shadow(0 20px 40px rgba(0,0,0,0.8));
}

.intro-team-name {
    font-family: var(--font-heading); font-weight: 900;
    font-size: clamp(1.5rem, 4.5vw, 3.5rem);
    color: transparent; text-transform: uppercase; letter-spacing: 2px;
    opacity: 0; transform: translateY(10px);
    filter: blur(10px); transition: all 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
    word-break: break-word; line-height: 1.1; padding: 0 1rem;
}
.intro-team-name.fade-in {
    opacity: 1; transform: translateY(0) scale(1); filter: blur(0);
    color: #fff; text-shadow: 0 0 60px rgba(212,175,55,0.4), 0 5px 15px rgba(0,0,0,0.8);
}

/* Flash */
.intro-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 99999; }
.intro-flash.trigger { animation: cinematicFlash 1.2s ease-out forwards; }
@keyframes cinematicFlash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* ==========================================
 * 5. HEADER E LOGO
 * ========================================== */
.header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex; flex-direction: column; align-items: center;
    animation: fadeInDown 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.header-compact { margin-bottom: 1.5rem; }

.tournament-logo {
    width: clamp(180px, 30vw, 300px);
    height: auto; object-fit: contain;
    filter: drop-shadow(0 15px 20px rgba(0, 0, 0, 0.9));
}
.tournament-logo-sm {
    width: clamp(80px, 12vw, 140px);
    height: auto; object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.9));
}

.badge-title-wrapper {
    width: clamp(300px, 60vw, 850px);
    display: flex; justify-content: center; align-items: center;
}
.badge-title-wrapper-sm {
    width: clamp(220px, 45vw, 600px);
    display: flex; justify-content: center;
}

.title-badge-svg {
    width: 100%; height: auto; overflow: visible;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.9));
}

.badge-text {
    font-family: var(--font-heading); font-weight: 900;
    font-size: 72px; fill: #f5e6c8;
    stroke: #0f2a1f; stroke-width: 15px;
    stroke-linejoin: round; paint-order: stroke fill;
    letter-spacing: 4px; text-transform: uppercase;
}
.badge-text-sm { font-size: 50px; stroke-width: 10px; }

.subtitle {
    font-size: clamp(0.85rem, 2vw, 1.2rem);
    font-weight: 700; color: var(--clr-theme-main);
    letter-spacing: 3px; text-transform: uppercase;
    margin-top: 0.5rem;
}

/* ==========================================
 * 6. NAVIGAZIONE APP
 * ========================================== */
.app-nav {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--clr-theme-main);
    letter-spacing: 2px;
    flex-shrink: 0;
}
.nav-logo { width: 50px; height: 50px; object-fit: contain; }

.nav-links {
    display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end;
}

.nav-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--clr-text-muted);
    font-family: var(--font-body);
    font-size: 0.95rem; font-weight: 700;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    cursor: pointer; text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}
.nav-btn:hover {
    border-color: var(--clr-theme-main);
    color: var(--clr-theme-main);
}
.nav-btn.active {
    background: var(--clr-theme-main);
    border-color: var(--clr-theme-main);
    color: #050810;
}
.nav-reset {
    border-color: rgba(239,68,68,0.3);
    color: rgba(239,68,68,0.7);
}
.nav-reset:hover {
    border-color: var(--clr-danger);
    color: var(--clr-danger);
}

/* ==========================================
 * 7. PANEL INFO
 * ========================================== */
.nav-bar {
    display: flex; justify-content: center; gap: 0.8rem; margin-bottom: 0.8rem;
    background: rgba(10,15,30,0.9); padding: 0.4rem 1.5rem; border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px);
}
.focus-mode .nav-bar { margin-bottom: 0.3rem; padding: 0.3rem 1rem; font-size: 0.9rem; }

.info-panel {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}
.info-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    display: flex; gap: 0.5rem; align-items: baseline;
}
.info-label { font-size: 0.65rem; color: var(--clr-text-muted); text-transform: uppercase; letter-spacing: 1px; }
.info-value { font-size: 0.9rem; font-weight: 800; color: var(--clr-theme-main); }

/* ==========================================
 * 8. SETUP SQUADRE
 * ========================================== */
.setup-box {
    background: var(--clr-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px; padding: 3rem;
    width: 100%; max-width: 900px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    animation: fadeInDown 0.6s ease-out;
}
.setup-box h2 {
    font-size: 1.8rem; color: var(--clr-theme-main);
    text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.5rem;
}
.setup-caption { color: var(--clr-text-muted); margin-bottom: 2.5rem; font-size: 1rem; }
.inputs-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem; margin-bottom: 2.5rem;
}
.team-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px; padding: 0.9rem 1rem;
    color: #fff; font-family: var(--font-body);
    font-size: 0.9rem; font-weight: 600;
    text-align: center; transition: all 0.3s;
    text-transform: uppercase;
}
.team-input:focus {
    outline: none; border-color: var(--clr-theme-main);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}
.error-text {
    color: #ef4444; background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444; padding: 1rem;
    border-radius: 4px; margin-bottom: 1.5rem; font-weight: 700;
}

/* ==========================================
 * 9. BOTTONI PRINCIPALI
 * ========================================== */
.epic-btn {
    background: linear-gradient(180deg, var(--clr-theme-light) 0%, var(--clr-theme-main) 40%, var(--clr-theme-dark) 100%);
    color: var(--clr-bg-main);
    font-family: var(--font-heading); font-size: 1.4rem;
    font-weight: 900; padding: 1.2rem 4rem;
    border: none; border-radius: 4px; cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 15px 35px rgba(212,175,55,0.25), inset 0 2px 4px rgba(255,255,255,0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 3px;
}
.epic-btn:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 45px rgba(212,175,55,0.4), inset 0 2px 4px rgba(255,255,255,1);
}
.epic-btn:disabled {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #475569; cursor: not-allowed; transform: none;
}

/* ==========================================
 * 10. LAYOUT SORTEGGIO
 * ========================================== */
.draw-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 3rem;
    width: 100%;
    align-items: start;
    transition: all 0.7s ease;
}

.draw-layout.focus-mode {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: calc(100vh - 120px);
    overflow: hidden;
    padding: 0;
    gap: 1.5rem;
}
.draw-layout.focus-mode .sidebar-teams {
    display: block;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
}
.draw-layout.focus-mode .main-stage {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    align-items: center;
    overflow: hidden;
}

.sidebar-teams {
    position: sticky; top: 2rem;
    transition: opacity 0.5s ease;
}
.sidebar-title {
    font-size: 0.85rem; font-weight: 700;
    color: var(--clr-theme-dark); text-transform: uppercase;
    letter-spacing: 4px; margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(212,175,55,0.2);
    padding-bottom: 1rem;
}

.teams-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem; justify-items: center;
}

.team-card {
    background: var(--clr-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 8px; padding: 1rem;
    width: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.8rem; text-align: center;
    font-weight: 700; font-size: 0.75rem;
    letter-spacing: 0.5px; text-transform: uppercase;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.team-card span { word-break: break-word; line-height: 1.2; width: 100%; }
.focus-mode .team-card { padding: 0.3rem; gap: 0.3rem; font-size: 0.65rem; }
.focus-mode .team-logo { width: 35px; height: 35px; }
.team-card.drawn { opacity: 0.25; filter: grayscale(100%); transform: scale(0.94); }

/* ==========================================
 * 11. PALCO SORTEGGIO
 * ========================================== */
.main-stage {
    width: 100%;
}

.action-section {
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 2rem; margin-bottom: 2rem;
}
.focus-mode .action-section {
    width: 100%;
    flex: 0 0 auto;
    height: 20vh;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.reset-actions { display: flex; gap: 1.5rem; }

.stage-podium {
    background: radial-gradient(circle at 50% 0%, rgba(212,175,55,0.2) 0%, rgba(10,18,36,1) 70%);
    border: 2px solid var(--clr-theme-main);
    border-radius: 16px; padding: 3rem;
    width: 100%; text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.9), inset 0 0 80px rgba(212,175,55,0.15);
    position: relative; overflow: hidden;
    animation: fadeInDown 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.focus-mode .stage-podium {
    height: 25vh;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 2.5rem;
}
.stage-podium::after {
    content: 'LIVE DRAW';
    position: absolute; top: 15px; right: 20px;
    background: #e11d48; color: #fff; padding: 4px 12px;
    font-size: 0.6rem; font-weight: 900; border-radius: 4px;
    letter-spacing: 2px; animation: pulse 2s infinite;
}
.stage-podium::before {
    content: ''; position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, transparent, var(--clr-theme-light), transparent);
}

.focus-mode .draw-status-text { margin-bottom: 0; font-size: 0.9rem; letter-spacing: 2px; }
.focus-mode .stage-team-container { 
    flex-direction: row; 
    gap: 1.5rem; 
    min-height: auto; 
    align-items: center;
}
.stage-team-logo { 
    max-width: 150px;
    max-height: 15vh; 
    width: auto; height: auto;
    object-fit: contain; 
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.9)); 
}
.stage-team-name {
    font-family: var(--font-heading); font-size: clamp(1.2rem, 3vw, 2.2rem);
    color: #fff; font-weight: 900; text-transform: uppercase;
    letter-spacing: 1px; text-shadow: 0 0 15px rgba(255,255,255,0.4);
    word-break: break-word; line-height: 1;
}

/* ==========================================
 * 12. ESTRAZIONE LIVE (MATCH CARD)
 * ========================================== */
.draw-section { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}
.focus-mode .draw-section {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 5px 20px rgba(0,0,0,1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.matches-container { 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    gap: 1rem; 
}
.focus-mode .matches-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem;
    height: calc(100vh - 25vh - 200px);
    width: 100%;
}

/* Scrollbar Style */
.focus-mode .matches-container::-webkit-scrollbar { width: 6px; }
.focus-mode .matches-container::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.focus-mode .matches-container::-webkit-scrollbar-thumb { background: var(--clr-theme-dark); border-radius: 10px; }

.match-row {
    background: linear-gradient(90deg, rgba(10,15,30,0.8) 0%, rgba(20,30,50,0.8) 50%, rgba(10,15,30,0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(10px); border-radius: 6px;
    display: flex; justify-content: center; align-items: center;
    padding: 0.4rem 0.8rem; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    transition: all 0.4s ease;
}
.match-row.pending {
    opacity: 0.3;
    border: 1px dashed rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.2);
}
.match-row.building {
    opacity: 1;
    border: 2px solid var(--clr-theme-main);
    box-shadow: 0 0 25px rgba(212,175,55,0.5);
    background: rgba(212,175,55,0.1);
    transform: scale(1.05);
    z-index: 10;
}
.match-row.confirmed { 
    opacity: 1;
    animation: confirmMatch 0.8s ease-out forwards; 
}
.match-row.compact {
    transform: scale(0.85); opacity: 0.6; margin-bottom: -10px;
    filter: grayscale(40%);
}
@keyframes confirmMatch {
    0% { opacity: 1; border-color: rgba(255,255,255,0.1); }
    50% { border-color: var(--clr-theme-light); box-shadow: 0 0 30px rgba(212,175,55,0.4); transform: scale(1.02); }
    100% { opacity: 1; border-left: 4px solid var(--clr-theme-main); border-right: 4px solid var(--clr-theme-main); transform: scale(1); }
}

.match-team {
    flex: 1; font-size: 0.85rem; font-weight: 800;
    opacity: 0; transition: opacity 0.5s ease, transform 0.5s ease;
    text-transform: uppercase; letter-spacing: 0.5px; word-break: break-word;
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem; text-align: center;
}
.match-team-logo { width: 45px; height: 45px; object-fit: contain; }
.focus-mode .match-vs { font-size: 0.9rem; margin: 0 0.5rem; }
.match-team.visible { opacity: 1; transform: scale(1.05); }
.match-team.settled { transform: scale(1); }
.match-vs { font-family: var(--font-heading); font-size: 1.3rem; color: var(--clr-text-muted); font-weight: 300; margin: 0 2rem; opacity: 0; }
.match-vs.visible { animation: fadeIn 0.8s forwards; }

/* Animazioni roulette */
.roulette-highlight {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.4) !important;
    transform: scale(1.02) !important; transition: none !important;
}
.pulse-flash { animation: flashGlow 0.6s ease-in-out infinite alternate !important; }
@keyframes flashGlow {
    0% { transform: scale(1); box-shadow: 0 0 15px rgba(254,240,138,0.4); border-color: rgba(254,240,138,0.5); }
    100% { transform: scale(1.1); box-shadow: 0 0 40px rgba(254,240,138,0.9); border-color: var(--clr-theme-light); background: rgba(254,240,138,0.1); }
}

/* ==========================================
 * 13. CALENDAR VIEW
 * ========================================== */
.view-title {
    font-family: var(--font-heading); font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--clr-theme-main); text-transform: uppercase; letter-spacing: 4px;
    margin-bottom: 2rem; text-align: center;
    text-shadow: 0 5px 20px rgba(212,175,55,0.3);
    animation: fadeInDown 0.6s ease-out;
    width: 100%;
}

.calendar-container {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.cal-round-block { width: 100%; }

.cal-round-title {
    font-family: var(--font-heading); font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--clr-theme-main); text-transform: uppercase; letter-spacing: 4px;
    margin-bottom: 1.2rem; font-weight: 800;
    display: flex; align-items: center; gap: 1rem;
}
.cal-round-title::before, .cal-round-title::after {
    content: ''; display: block; height: 2px; flex: 1;
    background: linear-gradient(90deg, rgba(212,175,55,0.5), transparent);
}
.cal-round-title::after { background: linear-gradient(270deg, rgba(212,175,55,0.5), transparent); }

.cal-matches-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.cal-match-card {
    background: var(--clr-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 1.2rem 0.8rem;
    display: flex; flex-direction: column;
    align-items: center; gap: 0.8rem;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    position: relative; overflow: hidden;
    height: 100%;
}
.cal-match-card:hover { border-color: rgba(212,175,55,0.3); }

.cal-match-card.played {
    border-left: 3px solid var(--clr-success);
    background: linear-gradient(135deg, rgba(34,197,94,0.05), var(--clr-bg-card));
}

.cal-team-row {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: 0.5rem;
}
.logo-badge {
    width: 320px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}
.focus-mode .logo-badge { width: 220px; }
.cal-team { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex: 1; text-align: center; }
.cal-team-logo { width: 60px; height: 60px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6)); }
.cal-team-name { font-size: clamp(0.65rem, 1.2vw, 0.85rem); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; word-break: break-word; line-height: 1.2; }
.cal-vs-col { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.cal-vs { font-family: var(--font-heading); font-weight: 900; color: var(--clr-text-muted); font-size: 1rem; letter-spacing: 2px; }

.cal-score {
    font-family: var(--font-heading); font-weight: 900;
    font-size: 2rem; color: var(--clr-theme-light);
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(212,175,55,0.5);
}

.cal-status-badge {
    position: absolute; top: 0.5rem; right: 0.5rem;
    font-size: 0.65rem; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; padding: 0.2rem 0.5rem;
    border-radius: 3px;
}
.badge-played { background: rgba(34,197,94,0.15); color: var(--clr-success); border: 1px solid rgba(34,197,94,0.3); }
.badge-pending { background: rgba(71,85,105,0.15); color: var(--clr-pending); border: 1px solid rgba(71,85,105,0.3); }

/* ==========================================
 * 14. RESULTS VIEW
 * ========================================== */
.results-filters {
    display: flex; gap: 0.75rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.filter-btn {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    color: var(--clr-text-muted); font-family: var(--font-body);
    font-size: 0.9rem; font-weight: 700; padding: 0.5rem 1.5rem;
    border-radius: 6px; cursor: pointer; text-transform: uppercase;
    letter-spacing: 1px; transition: all 0.2s ease;
}
.filter-btn:hover { border-color: var(--clr-theme-main); color: var(--clr-theme-main); }
.filter-btn.active { background: rgba(212,175,55,0.15); border-color: var(--clr-theme-main); color: var(--clr-theme-main); }

.results-container { width: 100%; display: flex; flex-direction: column; gap: 2.5rem; }

.result-round-block { width: 100%; }
.result-round-title {
    font-family: var(--font-heading); font-size: 1.3rem;
    color: var(--clr-theme-main); text-transform: uppercase; letter-spacing: 3px;
    margin-bottom: 1rem; font-weight: 800;
    border-bottom: 1px solid rgba(212,175,55,0.2); padding-bottom: 0.5rem;
}

.result-matches-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
}

.result-match-card {
    background: var(--clr-bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    transition: all 0.3s;
}
.result-match-card.played { border-left: 4px solid var(--clr-success); }
.result-match-card.pending { border-left: 4px solid var(--clr-pending); }

.result-team-block { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }
.result-team-logo { width: 60px; height: 60px; object-fit: contain; }
.result-team-name { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; word-break: break-word; }

.result-score-block {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    flex-shrink: 0;
}
.score-inputs {
    display: flex; align-items: center; gap: 0.5rem;
}
.score-input {
    width: 60px; height: 60px;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 8px; color: #fff;
    font-family: var(--font-heading); font-size: 2rem; font-weight: 900;
    text-align: center; appearance: textfield;
    transition: all 0.3s ease;
}
.score-input:focus { outline: none; border-color: var(--clr-theme-main); box-shadow: 0 0 15px rgba(212,175,55,0.3); }
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.score-sep { color: var(--clr-text-muted); font-size: 1.5rem; font-weight: 700; }

.save-btn {
    background: var(--clr-success); color: #fff;
    font-family: var(--font-body); font-size: 0.8rem; font-weight: 800;
    padding: 0.5rem 1.2rem; border: none; border-radius: 6px;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    transition: all 0.2s ease; margin-top: 0.3rem;
}
.save-btn:hover { background: #16a34a; transform: scale(1.04); }

.result-status {
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
    padding: 0.2rem 0.6rem; border-radius: 3px;
}
.status-played { background: rgba(34,197,94,0.15); color: var(--clr-success); border: 1px solid rgba(34,197,94,0.3); }
.status-pending { background: rgba(71,85,105,0.15); color: var(--clr-pending); border: 1px solid rgba(71,85,105,0.3); }

.result-match-card.hidden-by-filter { display: none; }

/* ==========================================
 * 15. STANDINGS VIEW
 * ========================================== */
.standings-container { width: 100%; overflow-x: auto; }

.standings-table {
    width: 100%; border-collapse: collapse;
    font-family: var(--font-heading);
    table-layout: fixed;
}

.standings-table th {
    background: rgba(212,175,55,0.1);
    color: var(--clr-theme-main); font-size: 0.85rem;
    font-weight: 800; text-transform: uppercase; letter-spacing: 2px;
    padding: 1rem 0.8rem; text-align: center;
    border-bottom: 2px solid rgba(212,175,55,0.4);
}
.standings-table th.col-team { text-align: left; padding-left: 1.5rem; }

.standings-table td {
    padding: 1.2rem 0.8rem; text-align: center;
    font-size: 1.1rem; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}
.standings-table td.col-team { text-align: left; padding-left: 1.5rem; }

.standings-table tbody tr:hover td { background: rgba(255,255,255,0.04); }

.standings-table tbody tr:nth-child(1) td { color: #ffd700; }
.standings-table tbody tr:nth-child(2) td { color: #c0c0c0; }
.standings-table tbody tr:nth-child(3) td { color: #cd7f32; }

.team-cell {
    display: flex; align-items: center; gap: 1rem;
}
.standings-logo { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.standings-name { font-size: clamp(0.85rem, 1.5vw, 1.1rem); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

.col-pts {
    font-size: 1.6rem !important; font-weight: 900 !important;
    color: var(--clr-theme-light) !important;
}

.rank-cell {
    font-size: 1.8rem; font-weight: 900;
    color: var(--clr-text-muted); text-align: center;
}

.standings-empty {
    text-align: center; color: var(--clr-text-muted);
    padding: 4rem; font-size: 1.2rem; font-weight: 600;
    letter-spacing: 2px; text-transform: uppercase;
}

/* ==========================================
 * 16. CALENDAR TITLE (nel sorteggio live)
 * ========================================== */
.calendar-title {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--clr-theme-main); text-transform: uppercase; letter-spacing: 4px;
    margin-bottom: 2rem; text-align: center;
    text-shadow: 0 0 20px rgba(212,175,55,0.3);
    border-bottom: 1px solid rgba(212,175,55,0.2); padding-bottom: 1rem;
    width: 100%;
}

/* ==========================================
 * 17. UTILITY
 * ========================================== */
.hidden { display: none !important; }
.w-100 { width: 100%; }

/* ==========================================
 * 18. ANIMAZIONI
 * ========================================== */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulseAlpha {
    0% { opacity: 0.4; }
    100% { opacity: 1; text-shadow: 0 0 15px rgba(212,175,55,0.6); }
}

/* ==========================================
 * 19. RESPONSIVE
 * ========================================== */
@media (max-width: 1200px) {
    .draw-layout { grid-template-columns: 300px 1fr; gap: 2rem; }
    .cal-matches-grid { grid-template-columns: repeat(2, 1fr); }
    .result-matches-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .draw-layout { grid-template-columns: 1fr; }
    .sidebar-teams { position: static; }
    .teams-grid { grid-template-columns: repeat(4, 1fr); }
    .cal-matches-grid { grid-template-columns: repeat(2, 1fr); }
    .result-matches-grid { grid-template-columns: 1fr; }
    .score-input { width: 50px; height: 50px; font-size: 1.6rem; }
    .nav-links { gap: 0.5rem; }
    .nav-btn { font-size: 0.8rem; padding: 0.5rem 0.8rem; }
}

@media (max-width: 600px) {
    .wide-container, .container { padding: 1rem; width: 100vw; }
    .cal-matches-grid { grid-template-columns: 1fr; }
    .teams-grid { grid-template-columns: repeat(2, 1fr); }
    .result-match-card { flex-direction: column; }
    .app-nav { flex-direction: column; gap: 0.75rem; }
    .nav-links { justify-content: center; }
}

/* ==========================================
 * 20. FASE FINALE (V2)
 * ========================================== */
.final-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.qual-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin-bottom: 2rem;
}

.qual-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}
.qual-box h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: var(--clr-text-muted);
}
.qual-box.gold { border-color: var(--clr-theme-main); background: rgba(212,175,55,0.05); }
.qual-box.gold h3 { color: var(--clr-theme-main); }
.qual-box.silver { border-color: #94a3b8; }
.qual-box.danger { border-color: var(--clr-danger); background: rgba(239,68,68,0.05); }

.qual-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.qual-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    font-size: 1rem;
}
.qual-item img { width: 35px; height: 35px; object-fit: contain; }

.final-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.final-match-card {
    background: var(--clr-bg-card-solid);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    transition: all 0.3s;
}
.final-match-card.played { border-color: var(--clr-theme-main); }

.final-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.8rem;
}
.final-match-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--clr-theme-main);
}

.final-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.final-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-align: center;
}
.final-team img { width: 80px; height: 80px; object-fit: contain; }
.final-team span { font-size: 0.9rem; font-weight: 800; text-transform: uppercase; }
.final-team.winner span { color: var(--clr-theme-main); text-shadow: 0 0 10px rgba(212,175,55,0.5); }

.final-score-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.penalty-box {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}
.penalty-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--clr-theme-light);
}
.penalty-btns {
    display: flex;
    gap: 0.5rem;
}
.penalty-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--clr-text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.penalty-btn.active {
    background: var(--clr-theme-main);
    color: var(--clr-bg-main);
    border-color: var(--clr-theme-main);
}

.final-empty-match {
    background: rgba(0,0,0,0.2);
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    color: var(--clr-text-muted);
    font-style: italic;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* ==========================================
 * 21. SCREENSHOT TOOL
 * ========================================== */
.screenshot-tool {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 10000;
}

.screenshot-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-theme-light) 0%, var(--clr-theme-main) 50%, var(--clr-theme-dark) 100%);
    border: 2px solid rgba(255,255,255,0.3);
    color: var(--clr-bg-main);
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 15px rgba(212,175,55,0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.screenshot-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 15px 40px rgba(0,0,0,0.8), 0 0 25px rgba(212,175,55,0.6);
}

.screenshot-btn:active {
    transform: scale(0.95);
}

@media (max-width: 600px) {
    .screenshot-btn { width: 50px; height: 50px; font-size: 1.4rem; }
    .screenshot-tool { bottom: 15px; left: 15px; }
}

/* ==========================================
 * 22. SOCIAL MEDIA EXPORT SUITE (NEW)
 * ========================================== */
.social-toolbar {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: rgba(5, 8, 16, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.3);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.2rem;
    border-radius: 12px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    animation: fadeInUp 0.5s ease;
}

.toolbar-label {
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--clr-theme-main);
    text-transform: uppercase;
}

.toolbar-btns {
    display: flex;
    gap: 0.6rem;
}

.t-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.t-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--clr-theme-main); }
.t-btn-all { background: var(--clr-theme-main); color: var(--clr-bg-main); border: none; }
.t-btn-all:hover { background: var(--clr-theme-light); transform: scale(1.05); }

/* TOAST */
.toast-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--clr-theme-main);
    color: var(--clr-bg-main);
    padding: 1.5rem 3rem;
    border-radius: 50px;
    font-weight: 900;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 20000;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 30px rgba(212,175,55,0.5);
    animation: pulseAlpha 1s infinite alternate;
}

/* SOCIAL EXPORT MODE MAGIC */
body.social-export-mode {
    background: #050810 !important;
}

body.social-export-mode .app-nav,
body.social-export-mode .screenshot-tool,
body.social-export-mode .social-toolbar,
body.social-export-mode .save-btn,
body.social-export-mode .results-filters,
body.social-export-mode .nav-reset,
body.social-export-mode .penalty-box,
body.social-export-mode .final-empty-match {
    display: none !important;
}

body.social-export-mode .view {
    display: block !important;
    opacity: 1 !important;
    padding-top: 5rem !important;
    padding-bottom: 5rem !important;
}

body.social-export-mode .container {
    max-width: 1000px !important;
    margin: 0 auto !important;
    box-shadow: none !important;
}

body.social-export-mode .view-title {
    font-size: 3rem !important;
    margin-bottom: 4rem !important;
    text-shadow: 0 0 30px rgba(212,175,55,0.5) !important;
}

body.social-export-mode .cal-round-title {
    font-size: 2rem !important;
    background: rgba(212,175,55,0.1) !important;
    padding: 1rem !important;
    border-radius: 8px !important;
}

@media (max-width: 900px) {
    .social-toolbar {
        bottom: 0; right: 0; left: 0;
        border-radius: 0; border-top: 1px solid var(--clr-theme-main);
        padding: 0.5rem;
    }
    .toolbar-btns { overflow-x: auto; padding-bottom: 0.5rem; }
}

/* ==========================================
 * 23. DOWNLOAD MODAL (THE FIX)
 * ========================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50000; /* Sopra tutto */
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(135deg, #111 0%, #050810 100%);
    border: 2px solid var(--clr-theme-main);
    padding: 2.5rem;
    border-radius: 24px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 60px rgba(0,0,0,0.9), 0 0 30px rgba(212,175,55,0.2);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-title {
    color: var(--clr-theme-main);
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    letter-spacing: 2px;
}

.modal-preview {
    width: 100%;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    margin-bottom: 2rem;
    background: #000;
    display: flex;
    justify-content: center;
}

.modal-preview img {
    max-width: 100%;
    height: auto;
    display: block;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 900;
    font-size: 0.9rem;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.download-btn {
    background: var(--clr-theme-main);
    color: var(--clr-bg-main);
    border: none;
    box-shadow: 0 5px 15px rgba(212,175,55,0.4);
}

.download-btn:hover {
    background: var(--clr-theme-light);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212,175,55,0.6);
}

.close-btn {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.close-btn:hover {
    background: rgba(255,255,255,0.1);
}

.modal-hint {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--clr-text-muted);
    font-style: italic;
    opacity: 0.7;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.final-match-card.grand-final {
    grid-column: 1 / -1; /* Occupa tutta la larghezza */
    max-width: 850px;
    margin: 2rem auto;
    border: 3px solid var(--clr-theme-main);
    box-shadow: 0 0 50px rgba(212,175,55,0.4);
    transform: scale(1.05);
    background: radial-gradient(circle at center, rgba(30,45,80,0.9) 0%, var(--clr-bg-card-solid) 100%);
    padding: 3rem 2rem;
}
.final-match-card.grand-final .final-match-title {
    font-size: 1.4rem;
    color: var(--clr-theme-light) !important;
    text-shadow: 0 0 20px rgba(212,175,55,0.8);
}
.final-match-card.grand-final .final-team img { width: 120px; height: 120px; }
.final-match-card.grand-final .final-team span { font-size: 1.2rem; }

.final-match-card.small-final {
    max-width: 600px;
    margin: 1rem auto 0;
    opacity: 0.9;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(10, 15, 30, 0.4);
}
.final-match-card.small-final .final-match-title {
    color: #94a3b8 !important;
    font-size: 0.9rem;
}

/* Badge Speciale per la Grand Final */
.grand-final::before {
    content: 'ðŸ† MATCH TITOLO';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, var(--clr-theme-light), var(--clr-theme-dark));
    color: var(--clr-bg-main);
    padding: 6px 20px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 950;
    letter-spacing: 3px;
    box-shadow: 0 5px 20px rgba(212,175,55,0.5);
    z-index: 10;
}

/* ==========================================
 * MINI GAMES LINKS
 * ========================================== */
.dribble-game-link {
    position: fixed;
    right: 24px;
    bottom: 86px;
    z-index: 99999;
    background: linear-gradient(135deg, #050505, #1a1a1a);
    color: #FFC928;
    border: 3px solid #FFC928;
    box-shadow: 0 0 20px rgba(255,201,40,0.6), 6px 6px 0 #000;
    padding: 14px 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 13px;
    text-decoration: none;
    text-transform: uppercase;
    border-radius: 12px;
    transition: 0.3s;
}

.dribble-game-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255,201,40,0.9), 8px 8px 0 #000;
}

.retro-game-link {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99990;
    background: linear-gradient(135deg, #050505, #1a1a1a);
    color: #FFC928;
    border: 3px solid #FFC928;
    box-shadow: 0 0 20px rgba(255,201,40,0.6), 6px 6px 0 #000;
    padding: 14px 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 13px;
    text-decoration: none;
    text-transform: uppercase;
    border-radius: 12px;
    transition: 0.3s;
}

.retro-game-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255,201,40,0.9), 8px 8px 0 #000;
}

/* ==========================================
 * PATCH SICURA 2026-05-09: BANNER + ROTAZIONE
 * ========================================== */
.ad-banner {
    width: min(100%, 1100px);
    min-height: 92px;
    margin: 2rem auto 0;
    border: 1px dashed rgba(212,175,55,0.45);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(212,175,55,0.10), rgba(255,255,255,0.03));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 14px 35px rgba(0,0,0,0.35);
}

.ad-banner img {
    width: 100%;
    height: 100%;
    max-height: 150px;
    object-fit: contain;
    display: block;
}

.ad-banner-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: rgba(254,240,138,0.85);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-size: clamp(0.8rem, 2vw, 1.2rem);
}

.ad-banner-empty .ad-banner-placeholder { display: flex; }
.ad-banner-intro {
    position: absolute;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%);
    width: min(92vw, 980px);
    margin: 0;
    min-height: 78px;
    z-index: 20;
}

.ad-banner-calendar,
.ad-banner-standings,
.ad-banner-final {
    grid-column: 1 / -1;
}

.cal-match-card.played {
    border-color: rgba(34,197,94,0.42);
    background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(10,15,30,0.86));
}

.cal-score {
    font-size: clamp(1.2rem, 2.6vw, 2rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 18px rgba(212,175,55,0.35);
}

.cal-winner-badge {
    display: block;
    margin-top: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(34,197,94,0.18);
    border: 1px solid rgba(34,197,94,0.42);
    color: #bbf7d0;
    font-size: 0.68rem;
    line-height: 1.15;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Nasconde definitivamente i vecchi strumenti anche se restano in cache o in versioni precedenti */
.social-toolbar,
.screenshot-tool,
.dribble-game-link,
.retro-game-link,
#download-modal {
    display: none !important;
}

@media (max-width: 768px) {
    .ad-banner { min-height: 70px; margin-top: 1.2rem; }
    .ad-banner-intro { bottom: 0.8rem; min-height: 62px; }
    .cal-winner-badge { font-size: 0.58rem; }
}

/* ==========================================
 * 24. CAPOCANNONIERI (EDIT E RANK)
 * ========================================== */

.scorers-edit-box {
    background: rgba(10, 15, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.scorers-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.scorer-input {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #fff;
    padding: 0.8rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    flex: 1;
    min-width: 150px;
}

.scorer-input.small-input {
    flex: 0 0 80px;
    min-width: 80px;
    text-align: center;
}

.scorer-input:focus {
    outline: none;
    border-color: var(--clr-theme-main);
}

.scorers-table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.scorers-edit-table th, .scorers-edit-table td {
    padding: 1rem;
    font-size: 0.9rem;
}

/* TRIBUTO SCORERS RANK */
.scorers-tribute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    padding-top: 2rem;
}

.scorer-card {
    background: linear-gradient(135deg, rgba(20,25,40,0.9) 0%, rgba(5,8,16,0.9) 100%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.scorer-card:hover {
    transform: translateY(-5px);
}

.scorer-rank {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 40px;
    height: 40px;
    background: var(--clr-theme-dark);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.scorer-card.first-place {
    grid-column: 1 / -1;
    background: radial-gradient(circle at 50% 0%, rgba(212,175,55,0.2) 0%, rgba(10,18,36,1) 80%);
    border: 2px solid var(--clr-theme-main);
    box-shadow: 0 20px 50px rgba(212,175,55,0.3);
    transform: scale(1.05);
    margin-bottom: 2rem;
}
.scorer-card.first-place:hover { transform: scale(1.08); }

.scorer-card.first-place .scorer-rank {
    background: linear-gradient(135deg, #ffd700, #d4af37);
    color: #000;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    top: -20px;
    left: -20px;
}

.scorer-team-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.5));
}
.scorer-card.first-place .scorer-team-logo {
    width: 120px;
    height: 120px;
}

.scorer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.scorer-name {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    letter-spacing: 1px;
}
.scorer-card.first-place .scorer-name {
    font-size: 2.2rem;
    color: var(--clr-theme-light);
    text-shadow: 0 0 15px rgba(212,175,55,0.5);
}

.scorer-team-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scorer-goals {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(212,175,55,0.2);
}
.scorer-card.first-place .scorer-goals {
    background: rgba(212,175,55,0.1);
    border-color: var(--clr-theme-main);
    padding: 1.5rem;
}

.goals-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--clr-theme-main);
    line-height: 1;
}
.scorer-card.first-place .goals-number {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(212,175,55,0.8);
}

.goals-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--clr-text-muted);
    letter-spacing: 2px;
}
/* ==========================================
 * FIX BANNER PUBBLICITA (OVERRIDE)
 * ========================================== */
.ad-banner, .ad-banner-intro {
    width: 100% !important;
    max-width: 800px !important;
    height: 120px !important; /* 15% larger and more professional for desktop */
    margin: auto auto 2rem auto !important; /* Pushes to bottom of flex container */
    order: 999 !important; /* Forces banner to be the last element visually */
    border-radius: 8px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    position: relative !important;
    z-index: 100 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.ad-banner img, .ad-banner img.rotating-banner,
.ad-banner-intro img, .ad-banner-intro img.rotating-banner {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Preserves proportion, no crop/stretch */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transition: opacity 0.5s ease-in-out !important;
}

@media (max-width: 768px) {
    .ad-banner, .ad-banner-intro {
        height: 90px !important; /* Legible on mobile without covering too much */
        margin-bottom: 1rem !important;
    }
}
