/* =========================================================
   TABELLONE - RIPRISTINO DESKTOP v52
   ========================================================= */

/* Le strutture "mobile" esistono nel PHP ma devono essere invisibili
   sul desktop. Il contenuto desktop resta quello originale. */
.team-mobile-names {
    display: none !important;
}

.team-desktop-name {
    display: inline !important;
}

:root {
    --bg-main: #0a0a0f;
    --bg-card: #121218;
    --bg-card-hover: #1a1a24;
    
    /* Colore principale per accenti generali (Fucsia LED) */
    --accent: #ff007f;
    --accent-glow: 0 0 18px rgba(255, 0, 127, 0.5), inset 0 0 15px rgba(255, 0, 127, 0.15);
    --card-border: rgba(255, 0, 127, 0.3);

    /* Colori fissi e sempre attivi per i 3 box principali */
    --col-calendario: #00f0ff; /* Azzurro LED */
    --col-classifiche: #00ff66; /* Verde Fluò LED */
    --col-giocatori: #ffe600;  /* Giallo LED */

    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border-color: #262636;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Titillium Web', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --- UTILITIES & ALIGNMENTS --- */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Header flessibile */
header {
    background-color: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

/* Logo BVS con sottotitolo affiancato su mobile */
.logo-area {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-family: 'Rajdhani', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 3px;
    line-height: 1;
    text-shadow: 0 0 12px rgba(255, 0, 127, 0.6);
}

.logo-sub {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .logo-area {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
        width: 100%;
        justify-content: flex-start;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 8px;
    }
    .logo-sub {
        margin-top: 0;
        font-size: 10px;
    }
}

/* Navigazione centrale */
.nav-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

@media (max-width: 768px) {
    .nav-container {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    background-color: rgba(255, 0, 127, 0.1);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

/* Contenuto Principale */
.main-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px 10px !important;
    }
}

.page-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: 15px;
}

/* Blocchi Principali con LED sempre attivo (Home) */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: block;
    position: relative;
    overflow: hidden;
}

.card.c-calendario { 
    border: 1px solid var(--col-calendario); 
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.35), inset 0 0 10px rgba(0, 240, 255, 0.08); 
}
.card.c-classifiche { 
    border: 1px solid var(--col-classifiche); 
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.35), inset 0 0 10px rgba(0, 255, 102, 0.08); 
}
.card.c-giocatori { 
    border: 1px solid var(--col-giocatori); 
    box-shadow: 0 0 15px rgba(255, 230, 0, 0.35), inset 0 0 10px rgba(255, 230, 0, 0.08); 
}

.card.c-calendario h3 { color: var(--col-calendario); text-shadow: 0 0 8px rgba(0, 240, 255, 0.4); }
.card.c-classifiche h3 { color: var(--col-classifiche); text-shadow: 0 0 8px rgba(0, 255, 102, 0.4); }
.card.c-giocatori h3 { color: var(--col-giocatori); text-shadow: 0 0 8px rgba(255, 230, 0, 0.4); }

.card.c-calendario:hover {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.7), inset 0 0 15px rgba(0, 240, 255, 0.2);
    background-color: var(--bg-card-hover);
    transform: translateY(-4px);
}
.card.c-classifiche:hover {
    box-shadow: 0 0 25px rgba(0, 255, 102, 0.7), inset 0 0 15px rgba(0, 255, 102, 0.2);
    background-color: var(--bg-card-hover);
    transform: translateY(-4px);
}
.card.c-giocatori:hover {
    box-shadow: 0 0 25px rgba(255, 230, 0, 0.7), inset 0 0 15px rgba(255, 230, 0, 0.2);
    background-color: var(--bg-card-hover);
    transform: translateY(-4px);
}

.card h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.card p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

/* Sezione Contenitori Secondari */
.section-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .section-grid { grid-template-columns: 1fr; }
}

.box-container {
    background-color: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    box-sizing: border-box;
    width: 100%;
}

.box-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

.winners-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .winners-grid { grid-template-columns: 1fr; }
}

.winner-card {
    background: var(--bg-card-hover);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    box-shadow: inset 0 0 10px rgba(255, 0, 127, 0.05);
}

.winner-card span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.winner-card strong {
    font-size: 15px;
    color: var(--text-main);
}

/* Griglia Classifiche (3 Colonne Desktop, 1 Colonna Mobile) */
.rankings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .rankings-grid {
        grid-template-columns: 1fr;
    }
}

/* Tabelle Generali */
.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.ranking-table th, .ranking-table td {
    padding: 10px;
    text-align: left;
    font-size: 14px;
}

.ranking-table th {
    color: var(--text-muted);
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.ranking-table tr:not(:last-child) td {
    border-bottom: 1px solid rgba(38, 38, 54, 0.4);
}

.ranking-table tr:hover td {
    background-color: var(--bg-card-hover);
    color: var(--accent);
}

/* Gestione spaziatura e larghezza colonna Azioni per bottoni affiancati */
.ranking-table th:last-child, 
.ranking-table td:last-child {
    width: 170px;
    text-align: right;
}

.badge-pos {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 6px rgba(255, 0, 127, 0.4);
}

/* --- MODULO ADMIN & FORM --- */
.admin-controls {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-group label {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.form-group input, .form-group select {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    outline: none;
}

.btn-action {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action:hover {
    box-shadow: 0 0 10px var(--accent);
    opacity: 0.9;
}

/* --- STILI SPECIFICI PAGINA GIOCATORI & CLASSIFICHE HOME --- */
.players-table .badge-pos {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
}

.player-name {
    text-transform: uppercase;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@media (min-width: 769px) {
    .players-table .badge-pos {
        font-size: 1rem;
        color: var(--accent);
        text-shadow: 0 0 6px rgba(255, 0, 127, 0.4);
    }
    .player-name {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .player-name {
        font-size: 14px;
    }
    .players-table .badge-pos {
        font-size: 14px;
    }
}

.actions-group {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
}

.table-legend {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-edit, .btn-danger {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: 'Titillium Web', sans-serif;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 0, 127, 0.05);
}

.btn-danger {
    background: rgba(255, 51, 51, 0.08);
    border: 1px solid rgba(255, 51, 51, 0.3);
    color: #ff6666;
}

.btn-danger:hover {
    background: rgba(255, 51, 51, 0.2);
    border-color: #ff3333;
    color: #ff3333;
}

.edit-form-inline {
    display: none;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    margin-top: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    width: 100%;
}

/* --- COLONNE PRESENZE / PUNTI --- */
.col-presenze {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.col-presenze.highlight {
    color: var(--text-main);
}

@media (min-width: 769px) {
    .ranking-table .col-presenze {
        font-size: 1rem;
        font-weight: 700;
        color: var(--accent);
        text-shadow: 0 0 6px rgba(255, 0, 127, 0.4);
    }
    .ranking-table .col-presenze.highlight {
        color: var(--accent);
    }
}

/* --- GESTIONE GIORNATA & TABELLA PARTITE --- */

/* Contenitore responsive comune alle tabelle */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabellone */
.table-partite {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    table-layout: fixed !important;
}

.table-partite td,
.table-partite th {
    padding: 8px 10px !important;
    font-size: 14px !important;
    vertical-align: middle;
    white-space: nowrap;
}

/* Colonne desktop:
   Campo | Squadra 1 | Punteggi | Squadra 2 */
.table-partite th:nth-child(1),
.table-partite td:nth-child(1) {
    width: 14% !important;
}

.table-partite th:nth-child(2),
.table-partite td:nth-child(2) {
    width: 28% !important;
    text-align: right !important;
    padding-right: 4px !important;
}

.table-partite th:nth-child(3),
.table-partite td:nth-child(3) {
    width: 20% !important;
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    white-space: normal;
}

.table-partite th:nth-child(4),
.table-partite td:nth-child(4) {
    width: 38% !important;
    text-align: left !important;
    padding-left: 4px !important;
}

/* Campo */
.table-partite td:nth-child(1) select,
.table-partite td:nth-child(1) span {
    font-size: 15px !important;
    font-weight: 600 !important;
}

/* Nomi */
.table-partite td:nth-child(2),
.table-partite td:nth-child(4) {
    font-size: 14px !important;
    font-weight: 700 !important;
}

/* Punteggi del girone */
.score-box {
    width: 42px !important;
    min-width: 42px !important;
    height: 36px !important;
    min-height: 36px !important;
    text-align: center;
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px !important;
    box-sizing: border-box;
}

.score-box-sm {
    width: 42px !important;
    min-width: 42px !important;
    height: 36px !important;
    min-height: 36px !important;
    font-size: 16px !important;
}

/* Finali: S1 e S2 affiancati, S3 sotto */
.finale-sets-wrapper {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    width: 180px !important;
    max-width: 180px !important;
    margin: 0 auto !important;
    justify-items: center;
    align-items: start;
    column-gap: 6px;
    row-gap: 4px;
}

.finale-set-box {
    width: auto !important;
    text-align: center;
}

.finale-set-box:nth-child(3) {
    grid-column: 1 / -1;
}

.finale-set-label {
    display: block;
    font-size: 9px !important;
    line-height: 11px !important;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-align: center;
}

.finale-set-inputs {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    white-space: nowrap !important;
}

/* Inner-card del tabellone */
.tabellone-inner-card {
    width: 97%;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg-main, #0a0a0f);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
}

.tabellone-inner-card:last-child {
    margin-bottom: 0;
}

/* Titoli finali */
.finale-34-title {
    color: #c0c0c0 !important;
    text-shadow: 0 0 7px rgba(192, 192, 192, 0.40) !important;
}

.finale-12-title {
    color: #ffd700 !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.45) !important;
}

/* Campi numerici: niente frecce */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Mobile */
@media (max-width: 768px) {

    .table-partite {
        min-width: 760px;
        table-layout: fixed !important;
    }

    .table-partite td,
    .table-partite th {
        font-size: 12px !important;
        padding: 6px 8px !important;
    }

    .table-partite td:nth-child(2) {
        padding-right: 6px !important;
    }

    .table-partite td:nth-child(4) {
        padding-left: 6px !important;
    }

    .table-partite td:nth-child(2),
    .table-partite td:nth-child(4) {
        font-size: 12px !important;
    }

    .table-partite td:nth-child(1) select,
    .table-partite td:nth-child(1) span {
        font-size: 12px !important;
    }

    .score-box,
    .score-box-sm {
        width: 42px !important;
        min-width: 42px !important;
        height: 38px !important;
        min-height: 38px !important;
        font-size: 16px !important;
    }

    .finale-sets-wrapper {
        width: 184px !important;
        max-width: 184px !important;
    }

    .tabellone-inner-card {
        width: 100%;
    }
}


/* =========================================================
   GIORNATA - FORMAZIONE SQUADRE MOBILE
   ========================================================= */

/* Tre giocatori sempre affiancati: soluzione compatibile anche con Safari */
.giocatori-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.giocatori-row > div {
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
}

.giocatori-row select {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {

    .giocatori-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .giocatori-row > div {
        flex: 0 0 calc((100% - 12px) / 3) !important;
        width: calc((100% - 12px) / 3) !important;
        max-width: calc((100% - 12px) / 3) !important;
        min-width: 0 !important;
    }

    .giocatori-row select {
        width: 100% !important;
        min-width: 0 !important;
        padding: 7px 4px !important;
        font-size: 11px !important;
    }
}

/* =========================================================
   GIORNATA - CLASSIFICA MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .giornata-classifica-table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        font-family: 'Rajdhani', sans-serif !important;
    }

    .giornata-classifica-table th,
    .giornata-classifica-table td {
        box-sizing: border-box !important;
        padding: 7px 1px !important;
        font-size: 12.5px !important;
        line-height: 1.12 !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
    }

    /* PTI */
    .giornata-classifica-table th:nth-child(1),
    .giornata-classifica-table td:nth-child(1) {
        width: 8% !important;
        text-align: center !important;
    }

    .giornata-classifica-table td:nth-child(1) {
        color: #ffd700 !important;
        font-weight: 700 !important;
        font-size: 14px !important;
    }

    /* POS */
    .giornata-classifica-table th:nth-child(2),
    .giornata-classifica-table td:nth-child(2) {
        width: 8% !important;
        text-align: center !important;
        padding: 0 !important;
    }

    /* SQUADRA */
    .giornata-classifica-table th:nth-child(3),
    .giornata-classifica-table td:nth-child(3) {
        width: 27% !important;
        text-align: left !important;
        padding-left: 0 !important;
        padding-right: 1px !important;
    }

    .giornata-classifica-table .classifica-giocatore {
        display: block !important;
        white-space: nowrap !important;
        font-size: 13px !important;
        line-height: 1.08 !important;
    }

    .giornata-classifica-table .classifica-separatore {
        display: none !important;
    }

    /* G / V / P */
    .giornata-classifica-table th:nth-child(4),
    .giornata-classifica-table td:nth-child(4),
    .giornata-classifica-table th:nth-child(5),
    .giornata-classifica-table td:nth-child(5),
    .giornata-classifica-table th:nth-child(6),
    .giornata-classifica-table td:nth-child(6) {
        width: 5% !important;
        text-align: center !important;
    }

    /* SET V/P */
    .giornata-classifica-table th:nth-child(7),
    .giornata-classifica-table td:nth-child(7) {
        width: 10% !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    /* PF / PS */
    .giornata-classifica-table th:nth-child(8),
    .giornata-classifica-table td:nth-child(8),
    .giornata-classifica-table th:nth-child(9),
    .giornata-classifica-table td:nth-child(9) {
        width: 10% !important;
        text-align: center !important;
    }

    /* DIFF */
    .giornata-classifica-table th:nth-child(10),
    .giornata-classifica-table td:nth-child(10) {
        width: 10% !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    /* Numeri */
    .giornata-classifica-table td:nth-child(4),
    .giornata-classifica-table td:nth-child(5),
    .giornata-classifica-table td:nth-child(6),
    .giornata-classifica-table td:nth-child(7),
    .giornata-classifica-table td:nth-child(8),
    .giornata-classifica-table td:nth-child(9),
    .giornata-classifica-table td:nth-child(10) {
        font-size: 13px !important;
        font-weight: 600 !important;
    }
}

/* =========================================================
   NAVBAR DEFINITIVA - DESKTOP / MOBILE
   ========================================================= */

/* DESKTOP: una sola riga, come la versione originale approvata */
@media (min-width: 769px) {

    header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }

    .logo-row {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: auto !important;
        flex: 0 0 auto !important;
    }

    .admin-header-link {
        display: none !important;
    }

    .nav-container {
        flex: 1 1 auto !important;
        width: auto !important;
        margin: 0 !important;
    }

    .nav-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
    }

    .nav-links .nav-admin {
        display: list-item !important;
    }
}

/* MOBILE: logo + Admin sopra, menu sotto */
@media (max-width: 768px) {

    header {
        display: block !important;
        padding: 12px 10px 8px !important;
    }

    .logo-row {
        display: flex !important;
        align-items: baseline !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .admin-header-link {
        display: block !important;
        font-family: 'Rajdhani', sans-serif !important;
        font-weight: 700 !important;
        font-size: 15px !important;
        text-transform: uppercase !important;
        text-decoration: none !important;
        color: #999999 !important;
        white-space: nowrap !important;
    }

    .nav-container {
        width: 100% !important;
        margin-top: 8px !important;
        overflow: hidden !important;
    }

    .nav-links {
        width: 100% !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 0 !important;
    }

    .nav-links .nav-admin {
        display: none !important;
    }

    .nav-links a {
        white-space: nowrap !important;
    }
}

/* =========================================================
   GIORNATA - TABELLONE MOBILE v49
   ========================================================= */

@media (max-width: 768px) {

    .table-responsive {
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Su mobile nessuna cornice interna */
    .tabellone-inner-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 10px 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .table-partite {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
    }

    .table-partite tbody {
        display: block !important;
        width: 100% !important;
    }

    /*
     * Partita girone:
     * [CAMPO] [SQUADRA 1] [PUNTEGGIO] [SQUADRA 2]
     */
    .table-partite tbody tr {
        display: grid !important;
        grid-template-columns: 12% 31% 26% 31% !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border-bottom: 1px solid var(--border-color);
    }

    /* Titoli SET / FINALI */
    .table-partite tbody tr td[colspan="4"] {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 8px 7px !important;
        display: block !important;
        text-align: left !important;
        font-size: 13px !important;
        color: var(--accent) !important;
        font-weight: 700 !important;
        text-shadow: 0 0 8px rgba(255, 0, 127, 0.35) !important;
        letter-spacing: 1px;
    }

    /* CAMPO */
    .table-partite tbody tr td:nth-child(1) {
        grid-column: 1 !important;
        grid-row: 1 !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 3px 1px !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .table-partite tbody tr td:nth-child(1) select,
    .table-partite tbody tr td:nth-child(1) span {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 6px 0 !important;
        font-size: 11px !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    /* SQUADRA 1 */
    .table-partite tbody tr td:nth-child(2) {
        grid-column: 2 !important;
        grid-row: 1 !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 5px 3px !important;
        text-align: right !important;
        box-sizing: border-box !important;
        white-space: normal !important;
    }

    /* PUNTEGGIO */
    .table-partite tbody tr td:nth-child(3) {
        grid-column: 3 !important;
        grid-row: 1 !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 4px 2px !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    /* SQUADRA 2 */
    .table-partite tbody tr td:nth-child(4) {
        grid-column: 4 !important;
        grid-row: 1 !important;
        align-self: center !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 5px 3px !important;
        text-align: left !important;
        box-sizing: border-box !important;
        white-space: normal !important;
    }

    /* Nomi verticali, verso il punteggio */
    .table-partite .team-desktop-name {
        display: none !important;
    }

    .table-partite .team-mobile-names {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        white-space: nowrap !important;
        line-height: 1.05 !important;
    }

    .table-partite .team-mobile-names span {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 12px !important;
        font-weight: 700 !important;
    }

    .table-partite .team-left .team-mobile-names {
        align-items: flex-end !important;
        text-align: right !important;
    }

    .table-partite .team-right .team-mobile-names {
        align-items: flex-start !important;
        text-align: left !important;
    }

    /* Girone: i due punteggi affiancati e centrati */
    .table-partite tbody tr td:nth-child(3) > div[style*="display:flex"] {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 3px !important;
    }

    .table-partite .score-box,
    .table-partite .score-box-sm {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        font-size: 16px !important;
        padding: 0 !important;
    }

    /* =====================================================
       FINALI
       ===================================================== */

    /*
     * Nelle finali, volutamente mostriamo i nomi tutti sulla
     * stessa riga e lasciamo il punteggio sotto, come richiesto.
     */
    .table-partite tbody tr:has(.finale-sets-wrapper) {
        display: grid !important;
        grid-template-columns: 12% 44% 44% !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) td:nth-child(1) {
        grid-column: 1 !important;
        grid-row: 1 / span 2 !important;
        align-self: center !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) td:nth-child(2) {
        grid-column: 2 !important;
        grid-row: 1 !important;
        text-align: center !important;
        padding: 8px 3px 3px !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) td:nth-child(4) {
        grid-column: 3 !important;
        grid-row: 1 !important;
        text-align: center !important;
        padding: 8px 3px 3px !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-desktop-name {
        display: inline !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-mobile-names {
        display: none !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) td:nth-child(3) {
        grid-column: 2 / 4 !important;
        grid-row: 2 !important;
        padding: 3px 2px 8px !important;
    }

    .table-partite .finale-sets-wrapper {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        max-width: 230px !important;
        margin: 0 auto !important;
        gap: 4px !important;
    }

    .table-partite .finale-set-box {
        width: 100% !important;
        min-width: 0 !important;
    }

    .table-partite .finale-set-box:nth-child(3) {
        grid-column: 1 / -1 !important;
    }

    .table-partite .finale-set-inputs {
        width: 100% !important;
        justify-content: center !important;
        gap: 3px !important;
    }

    .table-partite .finale-set-label {
        font-size: 9px !important;
        margin-bottom: 2px !important;
    }
}

/* =========================================================
   GIORNATA - TABELLONE MOBILE v50
   ========================================================= */

@media (max-width: 768px) {

    .table-responsive {
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .tabellone-inner-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 10px 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .table-partite,
    .table-partite tbody {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* GIRONE: CAMPO | SQUADRA 1 | PUNTEGGIO | SQUADRA 2 */
    .table-partite tbody tr {
        display: grid !important;
        grid-template-columns: 12% 31% 26% 31% !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        align-items: center !important;
    }

    .table-partite tr.match-section-title,
    .table-partite tr td.match-section-title,
    .table-partite .match-section-title {
        grid-column: 1 / -1 !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 8px 7px !important;
        color: #ff007f !important;
        font-family: 'Rajdhani', sans-serif !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        letter-spacing: 1px !important;
        text-align: left !important;
    }

    .table-partite .match-team-left {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 4px 3px !important;
        text-align: right !important;
        box-sizing: border-box !important;
    }

    .table-partite .match-score {
        grid-column: 3 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 4px 1px !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .table-partite .match-team-right {
        grid-column: 4 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 4px 3px !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }

    .table-partite tbody tr > td:first-child {
        grid-column: 1 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 4px 1px !important;
        text-align: center !important;
    }

    .table-partite tbody tr > td:first-child select,
    .table-partite tbody tr > td:first-child span {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 6px 0 !important;
        font-size: 10px !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    /* Nomi girone: tre righe, verso il punteggio */
    .table-partite .team-desktop-name {
        display: none !important;
    }

    .table-partite .team-mobile-names {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        width: 100% !important;
        white-space: nowrap !important;
        line-height: 1.05 !important;
    }

    .table-partite .team-mobile-names span {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1.05 !important;
    }

    .table-partite .team-left .team-mobile-names {
        align-items: flex-end !important;
        text-align: right !important;
    }

    .table-partite .team-right .team-mobile-names {
        align-items: flex-start !important;
        text-align: left !important;
    }

    /* Punteggio girone */
    .table-partite .match-score > div[style*="display:flex"] {
        display: flex !important;
        width: 100% !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important;
    }

    .table-partite .score-box,
    .table-partite .score-box-sm {
        width: 37px !important;
        min-width: 37px !important;
        height: 37px !important;
        min-height: 37px !important;
        padding: 0 !important;
        font-size: 16px !important;
    }

    /* =====================================================
       FINALI
       ===================================================== */

    .table-partite tbody tr:has(.finale-sets-wrapper) {
        display: grid !important;
        grid-template-columns: 12% 44% 44% !important;
        width: 100% !important;
        align-items: start !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .match-team-left,
    .table-partite tbody tr:has(.finale-sets-wrapper) .match-team-right {
        grid-row: 1 !important;
        padding: 7px 3px 2px !important;
        text-align: center !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-desktop-name {
        display: inline !important;
        font-size: 12px !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-mobile-names {
        display: none !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .match-score {
        grid-column: 2 / 4 !important;
        grid-row: 2 !important;
        padding: 3px 2px 8px !important;
    }

    .table-partite .finale-sets-wrapper {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        max-width: 230px !important;
        margin: 0 auto !important;
        gap: 4px !important;
    }

    .table-partite .finale-set-box:nth-child(3) {
        grid-column: 1 / -1 !important;
    }

    .table-partite .finale-set-inputs {
        width: 100% !important;
        justify-content: center !important;
        gap: 3px !important;
    }

    .table-partite .finale-set-label {
        font-size: 9px !important;
        margin-bottom: 2px !important;
    }
}

/* =========================================================
   GIORNATA - TABELLONE MOBILE v51
   Dettagli finali
   ========================================================= */

@media (max-width: 768px) {

    /* Campo leggermente più leggibile */
    .table-partite tbody tr > td:first-child select,
    .table-partite tbody tr > td:first-child span {
        font-size: 11px !important;
    }

    /* Nomi finali uguali ai nomi del girone */
    .table-partite tbody tr:has(.finale-sets-wrapper) .team-desktop-name {
        font-size: 12px !important;
        font-weight: 700 !important;
    }
}


/* =========================================================
   TABELLONE - NOME SQUADRE v53
   ========================================================= */

/*
 * Regola definitiva:
 * - Girone: nomi dei 3 giocatori uno sotto l'altro, anche desktop.
 * - Finali: nomi della squadra affiancati su una sola riga.
 */

/* GIRONE: desktop e mobile */
.table-partite .team-desktop-name {
    display: none !important;
}

.table-partite .team-mobile-names {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    line-height: 1.05 !important;
}

/* FINALi: solo qui nomi affiancati */
.table-partite tbody tr:has(.finale-sets-wrapper) .team-desktop-name {
    display: inline !important;
}

.table-partite tbody tr:has(.finale-sets-wrapper) .team-mobile-names {
    display: none !important;
}


/* MOBILE - mantiene il comportamento già approvato */
@media (max-width: 768px) {

    .table-partite .team-mobile-names {
        display: flex !important;
        flex-direction: column !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-desktop-name {
        display: inline !important;
    }

    .table-partite tbody tr:has(.finale-sets-wrapper) .team-mobile-names {
        display: none !important;
    }
}

/* =========================================================
   GIORNATA - FORMAZIONE SQUADRE MOBILE v54
   ========================================================= */

@media (max-width: 768px) {

    /* Titoli Squadra 1 / 2 / 3 / 4 come intestazioni SET */
    .squadre-grid > div > div:first-child {
        font-size: 13px !important;
        color: var(--accent) !important;
        text-shadow: 0 0 8px rgba(255, 0, 127, 0.35) !important;
        letter-spacing: 1px !important;
        text-transform: uppercase !important;
        margin-bottom: 8px !important;
        padding-bottom: 7px !important;
    }

    /* Nomi nei select: stessa presenza visiva dei nomi del tabellone */
    .squadre-grid .giocatori-row select {
        font-family: 'Rajdhani', sans-serif !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
    }
}


/* =========================================================
   CALENDARIO - CAMPO DATA MOBILE
   Correzione larghezza input date
   ========================================================= */

@media (max-width: 768px) {

    .admin-controls .form-row {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .admin-controls .form-group {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100% !important;
        box-sizing: border-box !important;
    }

    .admin-controls .form-group input[type="date"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
}

/* =====================================================
   INDICATORE LIVE
   ===================================================== */

.tabellone-title-live {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.tabellone-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #ff4d4d;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    text-transform: uppercase;
}

.tabellone-live-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3333;
    box-shadow:
        0 0 5px rgba(255, 51, 51, 0.9),
        0 0 10px rgba(255, 51, 51, 0.6);
    animation: bvsLivePulse 1.2s infinite;
}

@keyframes bvsLivePulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow:
            0 0 5px rgba(255, 51, 51, 0.9),
            0 0 10px rgba(255, 51, 51, 0.6);
    }

    50% {
        opacity: 0.35;
        transform: scale(0.82);
        box-shadow:
            0 0 2px rgba(255, 51, 51, 0.5);
    }
}

@media (max-width: 600px) {

    .tabellone-live-indicator {
        font-size: 11px;
        gap: 5px;
    }

    .tabellone-live-led {
        width: 7px;
        height: 7px;
    }
}
