:root {
    --blu: #1c314e;
    --blu-scuro: #12233a;
    --blu-chiaro: #4f8fc7;
    --bordeaux: #8a0f27;
    --arancio: #e8792a;
    --arancio-scuro: #c9631c;
    --oro: #d9a441;
    --grigio-sfondo: #f5f7fa;
    --bordo: #e1e6ec;
    --verde: #2e7d32;
    --rosso: #c62828;
    --testo: #1f2a37;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--testo);
    background: var(--grigio-sfondo);
}

/* ---------- HEADER ---------- */
.pub-header {
    background: linear-gradient(120deg, var(--blu-scuro) 0%, var(--blu) 55%, var(--blu-chiaro) 130%);
    color: #fff;
    padding: 1.5rem 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
}
.pub-header::after {
    content: "🏐";
    position: absolute;
    left: -0.3rem;
    bottom: -1.6rem;
    font-size: 5.5rem;
    opacity: 0.32;
    pointer-events: none;
    z-index: 0;
}

.pub-header-brand { display: flex; align-items: center; gap: 0.9rem; position: relative; z-index: 1; }
.pub-header-crest {
    height: 100px;
    width: auto;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
    flex-shrink: 0;
}
.pub-header-testo { position: relative; z-index: 1; }
.pub-header h1 { margin: 0 0 0.25rem; font-size: 1.4rem; letter-spacing: -0.01em; }
.pub-header .sottotitolo { color: #cfe4f2; font-size: 0.88rem; }

.pub-header-loghi {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.pub-header-loghi img {
    height: 46px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 5px 7px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.pub-nav {
    background: var(--blu-scuro);
    padding: 0.55rem 1.5rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.pub-nav a {
    color: #dceefc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    transition: background 0.15s, color 0.15s;
}
.pub-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.pub-nav a.attivo { background: var(--bordeaux); color: #fff; font-weight: 600; }
.pub-nav-area-riservata {
    margin-left: auto;
    border: 1px solid rgba(255,255,255,0.35) !important;
    font-size: 0.85rem !important;
}

/* ---------- LAYOUT ---------- */
.pub-main {
    max-width: 1000px;
    margin: 1.8rem auto;
    padding: 0 1.5rem 2rem;
}

.selettori { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.selettori select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--bordo);
    border-radius: 6px;
    font-size: 0.92rem;
    background: #fff;
}

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.tabs a {
    padding: 0.45rem 1rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--bordo);
    color: var(--blu);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.15s;
}
.tabs a:hover { border-color: var(--bordeaux); }
.tabs a.attivo { background: var(--bordeaux); color: #fff; border-color: var(--bordeaux); font-weight: 600; }

h2.giornata-titolo {
    font-size: 1.05rem;
    color: var(--blu);
    border-bottom: 3px solid var(--bordeaux);
    padding-bottom: 0.4rem;
    margin-top: 2.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pub-main h3 {
    font-size: 0.95rem;
    color: var(--blu);
    margin-top: 1.6rem;
}

/* ---------- TABELLE ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin: 0.6rem 0 1.6rem;
    font-size: 0.92rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(20,57,92,0.08);
}
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--bordo); }
th {
    background: var(--blu);
    color: #fff;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

tr.podio-1 td:first-child { border-left: 4px solid var(--oro); }
tr.podio-2 td:first-child { border-left: 4px solid var(--blu-chiaro); }

.risultato { font-weight: 700; color: var(--blu); }
.stato-programmata { color: #999; font-style: italic; }
.stato-rinviata, .stato-sospesa { color: var(--rosso); font-weight: 600; }

.muted { color: #55606e; font-size: 0.85rem; }
.badge-fase {
    display: inline-block; background: rgba(232,121,42,0.12);
    border-radius: 12px; padding: 0.15rem 0.65rem; font-size: 0.76rem;
    color: var(--arancio-scuro); margin-left: 0.5rem; font-weight: 600;
}

/* ---------- CARD STAGIONI ---------- */
.card-stagione {
    background: #fff;
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 1.1rem 1.3rem;
    margin-bottom: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    box-shadow: 0 1px 4px rgba(20,57,92,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    border-left: 4px solid var(--bordeaux);
}
.card-stagione:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,57,92,0.14); }
.card-stagione a { color: var(--blu); font-weight: 700; text-decoration: none; font-size: 1.02rem; }
.card-stagione a:hover { color: var(--arancio); }
.card-stagione .card-stagione-link-secondaria { font-weight: 500; font-size: 0.9rem; }

/* ---------- FASCIA LOGHI ---------- */
.loghi-fascia {
    background: #fff;
    border-top: 1px solid var(--bordo);
    border-bottom: 1px solid var(--bordo);
    padding: 1.6rem 1.5rem;
    text-align: center;
}
.loghi-fascia .loghi-titolo {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #55606e;
    margin-bottom: 1rem;
}
.loghi-riga {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.4rem;
    flex-wrap: wrap;
}
.loghi-riga img {
    height: 56px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    opacity: 0.92;
    transition: opacity 0.15s, transform 0.15s;
}
.loghi-riga img:hover { opacity: 1; transform: scale(1.05); }
.loghi-riga img.logo-patrocinio { height: 46px; }

/* ---------- FOOTER ---------- */
.pub-footer {
    text-align: center;
    padding: 1.5rem 1.5rem 6rem;
    color: #55606e;
    font-size: 0.82rem;
}
.pub-footer a { color: var(--blu); text-decoration: none; }
.pub-footer a:hover { text-decoration: underline; }
.link-footer {
    background: none; border: none; padding: 0; margin: 0;
    color: var(--blu); text-decoration: none; font-size: 0.82rem; cursor: pointer;
}
.link-footer:hover { text-decoration: underline; }

/* ---------- HOMEPAGE / TESTO PRESENTAZIONE ---------- */
.hero-tagline {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blu);
    line-height: 1.35;
    margin-bottom: 0.9rem;
    border-left: 4px solid var(--arancio);
    padding-left: 0.9rem;
}
.pub-main p { line-height: 1.6; }
.box-scadenze {
    background: #fdf3e4;
    border-left: 4px solid var(--oro);
    border-radius: 4px;
    padding: 0.9rem 1.1rem;
    margin: 1.1rem 0 0;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--testo);
}
.btn-cta {
    display: inline-block;
    background: var(--bordeaux);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(138,15,39,0.35);
    transition: background 0.15s, transform 0.15s;
}
.btn-cta:hover { background: #6b0b1d; transform: translateY(-1px); }
.lista-regole { padding-left: 1.2rem; }
.lista-regole li { margin-bottom: 0.85rem; line-height: 1.55; }

/* ---------- FORM CONTATTI ---------- */
.form-contatti {
    max-width: 560px;
    background: #fff;
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 1.4rem 1.6rem;
    box-shadow: 0 1px 4px rgba(20,57,92,0.08);
    position: relative;
}
.form-contatti label { font-size: 0.9rem; }
.campo-input {
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--bordo);
    border-radius: 6px;
    font-size: 0.92rem;
    margin-top: 0.25rem;
    font-family: inherit;
}
.campo-tipo-label { font-weight: 700; color: var(--blu); margin-bottom: 0.5rem; }
.tipo-selettore {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.tipo-opzione {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--bordo);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.15s, background 0.15s;
}
.tipo-opzione:has(input:checked) {
    border-color: var(--arancio);
    background: rgba(232,121,42,0.06);
    font-weight: 600;
}
.campi-gruppo, .campi-associazione {
    background: var(--grigio-sfondo);
    border-radius: 8px;
    padding: 0.9rem 1rem 0.2rem;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .pub-header::after { display: none; }
    .pub-header-crest { height: 68px; }
    .pub-header-loghi img { height: 34px; max-width: 76px; padding: 4px 6px; }
    .loghi-riga { gap: 1.6rem; }
    .loghi-riga img { height: 52px; }
    .loghi-riga img.logo-patrocinio { height: 44px; }
}
