/* ScoreTV: pagine di accesso e scelta gara (classi stv-*) */

.stv {
    --stv-ink: oklch(0.2 0.035 278);
    --stv-ink-line: oklch(0.32 0.04 278);
    --stv-on-ink: oklch(0.97 0.008 278);
    --stv-on-ink-muted: oklch(0.8 0.03 278);
    --stv-signal: oklch(0.91 0.18 112);
    --stv-live: oklch(0.64 0.23 27);
    --stv-paper: oklch(0.975 0.005 278);
    --stv-surface: oklch(0.995 0.003 278);
    --stv-text: oklch(0.24 0.025 278);
    --stv-muted: oklch(0.47 0.025 278);
    --stv-line: oklch(0.88 0.012 278);
    --stv-accent: oklch(0.47 0.2 279);
    --stv-accent-hover: oklch(0.41 0.2 279);
    --stv-accent-soft: oklch(0.94 0.035 279);
    --stv-danger: oklch(0.5 0.19 27);
    --stv-danger-soft: oklch(0.96 0.025 27);
    --stv-radius: 10px;
    --stv-ease: cubic-bezier(0.22, 1, 0.36, 1);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--stv-text);
    background: var(--stv-paper);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Struttura: presentazione + form ---------- */

.stv-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    background: var(--stv-paper);
}

.stv-brand {
    background: var(--stv-ink);
    color: var(--stv-on-ink);
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 4.5vw, 4.5rem);
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vh, 3rem);
}

.stv-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem) 1.25rem;
}

.stv-panel {
    width: min(100%, 25rem);
}

/* ---------- Presentazione ---------- */

.stv-wordmark {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: inherit;
}

.stv-wordmark-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1;
}

.stv-wordmark-by {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--stv-on-ink-muted);
    margin-top: .25rem;
}

.stv-live {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .25rem .5rem;
    border-radius: 4px;
    background: var(--stv-live);
    color: oklch(0.99 0.005 27);
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .1em;
    line-height: 1;
}

    .stv-live::before {
        content: "";
        width: .4rem;
        height: .4rem;
        border-radius: 50%;
        background: currentColor;
        animation: stv-pulse 1.6s var(--stv-ease) infinite;
    }

@keyframes stv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

.stv-headline {
    font-size: clamp(1.875rem, 1.2rem + 2.2vw, 3rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.025em;
    margin: 0 0 1rem;
    max-width: 18ch;
}

    .stv-headline em {
        font-style: normal;
        color: var(--stv-signal);
    }

.stv-intro {
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--stv-on-ink-muted);
    max-width: 44ch;
    margin: 0;
}

.stv-shot {
    margin: 0;
}

    .stv-shot img {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 12px;
        box-shadow: 0 0 0 1px var(--stv-ink-line), 0 24px 48px -16px oklch(0.1 0.03 278 / .7);
    }

    .stv-shot figcaption {
        font-size: .8125rem;
        color: var(--stv-on-ink-muted);
        margin-top: .625rem;
    }

.stv-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
    counter-reset: stv-step;
}

    .stv-steps li {
        display: grid;
        grid-template-columns: 2rem 1fr;
        gap: .875rem;
        align-items: baseline;
        line-height: 1.45;
        counter-increment: stv-step;
    }

        .stv-steps li::before {
            content: counter(stv-step);
            font-size: 1.375rem;
            font-weight: 800;
            font-variant-numeric: tabular-nums;
            color: var(--stv-signal);
            text-align: right;
        }

        .stv-steps li strong {
            display: block;
            color: var(--stv-on-ink);
            font-weight: 650;
        }

        .stv-steps li span {
            color: var(--stv-on-ink-muted);
            font-size: .9375rem;
        }

.stv-contact {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--stv-ink-line);
    font-size: .875rem;
    color: var(--stv-on-ink-muted);
}

    .stv-contact a {
        color: var(--stv-on-ink);
        font-weight: 600;
        text-underline-offset: 3px;
    }

/* ---------- Form ---------- */

.stv-eyebrow {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--stv-accent);
    margin: 0 0 .5rem;
}

.stv-title {
    font-size: 1.75rem;
    font-weight: 750;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin: 0 0 .5rem;
}

.stv-lead {
    color: var(--stv-muted);
    line-height: 1.55;
    margin: 0 0 1.75rem;
}

.stv-field {
    margin-bottom: 1.125rem;
}

.stv .form-label {
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .375rem;
    color: var(--stv-text);
}

.stv .form-control,
.stv .form-select {
    min-height: 3rem;
    padding: .625rem .875rem;
    font-size: 1rem;
    color: var(--stv-text);
    background-color: var(--stv-surface);
    border: 1px solid var(--stv-line);
    border-radius: var(--stv-radius);
    transition: border-color .2s var(--stv-ease), box-shadow .2s var(--stv-ease);
}

    .stv .form-control:hover,
    .stv .form-select:hover {
        border-color: oklch(0.78 0.02 278);
    }

    .stv .form-control:focus,
    .stv .form-select:focus {
        border-color: var(--stv-accent);
        box-shadow: 0 0 0 4px var(--stv-accent-soft);
        outline: none;
    }

.stv .form-text {
    font-size: .8125rem;
    color: var(--stv-muted);
    margin-top: .375rem;
}

.stv-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    padding: .625rem 1.25rem;
    border: 0;
    border-radius: var(--stv-radius);
    background: var(--stv-accent);
    color: oklch(0.99 0.005 279);
    font-size: 1rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s var(--stv-ease), transform .2s var(--stv-ease);
}

    .stv-btn:hover {
        background: var(--stv-accent-hover);
        color: oklch(0.99 0.005 279);
    }

    .stv-btn:active {
        transform: translateY(1px);
    }

    .stv-btn:disabled {
        opacity: .6;
        cursor: progress;
    }

.stv-btn-outline {
    background: transparent;
    color: var(--stv-danger);
    box-shadow: inset 0 0 0 1px currentColor;
}

    .stv-btn-outline:hover {
        background: var(--stv-danger-soft);
        color: var(--stv-danger);
    }

.stv a:not(.stv-btn):not(.stv-wordmark) {
    color: var(--stv-accent);
    text-underline-offset: 3px;
}

    .stv a:not(.stv-btn):not(.stv-wordmark):hover {
        color: var(--stv-accent-hover);
    }

.stv-brand a:not(.stv-wordmark) {
    color: var(--stv-on-ink) !important;
}

.stv :focus-visible {
    outline: 3px solid var(--stv-accent);
    outline-offset: 2px;
}

.stv-brand :focus-visible {
    outline-color: var(--stv-signal);
}

.stv-links {
    display: grid;
    gap: .625rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--stv-line);
    font-size: .9375rem;
}

.stv-alert {
    background: var(--stv-danger-soft);
    color: var(--stv-danger);
    border: 1px solid oklch(0.86 0.06 27);
    border-radius: var(--stv-radius);
    padding: .75rem 1rem;
    font-size: .9375rem;
    margin-bottom: 1.25rem;
}

    .stv-alert ul {
        margin: 0;
        padding-left: 1.125rem;
    }

    .stv-alert li + li {
        margin-top: .25rem;
    }

.stv-note {
    background: var(--stv-accent-soft);
    border-radius: var(--stv-radius);
    padding: .875rem 1rem;
    font-size: .9375rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

/* ---------- Scelta gara: selettore a due opzioni ---------- */

.stv-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem;
    padding: .25rem;
    margin-bottom: 1.5rem;
    background: oklch(0.93 0.01 278);
    border-radius: calc(var(--stv-radius) + 2px);
}

    .stv-switch input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .stv-switch label {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 2.5rem;
        padding: .375rem .5rem;
        border-radius: 8px;
        font-size: .9375rem;
        font-weight: 600;
        color: var(--stv-muted);
        text-align: center;
        cursor: pointer;
        transition: background-color .2s var(--stv-ease), color .2s var(--stv-ease);
    }

    .stv-switch input:checked + label {
        background: var(--stv-surface);
        color: var(--stv-text);
        box-shadow: 0 1px 2px oklch(0.2 0.03 278 / .12), 0 0 0 1px oklch(0.2 0.03 278 / .06);
    }

    .stv-switch input:focus-visible + label {
        outline: 3px solid var(--stv-accent);
        outline-offset: 1px;
    }

.stv-example {
    font-size: .8125rem;
    color: var(--stv-muted);
    margin-top: .375rem;
}

/* Il selettore a due opzioni usato come campo (Regionale / Territoriale) */
.stv-switch-campo {
    margin-bottom: 0;
}

/* ---------- Email in due parti: la @ è fissa (in OBS non si riesce a scrivere) ---------- */

.stv-email {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .375rem;
}

.stv-email-at {
    font-size: 1.125rem;
    font-weight: 650;
    color: var(--stv-muted);
    user-select: none;
}

/* ---------- Comitato: ricerca + lista, al posto del menu a tendina (in OBS non si apre) ---------- */

.stv-lista {
    display: grid;
    gap: 2px;
    max-height: 15rem;
    overflow-y: auto;
    margin-top: .375rem;
    padding: .25rem;
    background: var(--stv-surface);
    border: 1px solid var(--stv-line);
    border-radius: var(--stv-radius);
}

    .stv-lista button {
        display: block;
        width: 100%;
        min-height: 2.5rem;
        padding: .5rem .75rem;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--stv-text);
        font-size: .9375rem;
        text-align: left;
        cursor: pointer;
        transition: background-color .15s var(--stv-ease);
    }

        .stv-lista button:hover {
            background: oklch(0.95 0.01 278);
        }

        .stv-lista button[aria-selected="true"] {
            background: var(--stv-accent);
            color: oklch(0.99 0.005 279);
            font-weight: 650;
        }

            .stv-lista button[aria-selected="true"]::before {
                content: "\2713\00a0";
            }

.stv-scelto {
    font-size: .875rem;
    color: var(--stv-muted);
    margin-top: .5rem;
}

    .stv-scelto strong {
        color: var(--stv-text);
    }

.stv-lista-vuota {
    padding: .625rem .75rem;
    font-size: .875rem;
    color: var(--stv-muted);
}

.stv-user {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--stv-line);
    font-size: .875rem;
    color: var(--stv-muted);
}

    .stv-user strong {
        color: var(--stv-text);
        font-weight: 600;
        word-break: break-all;
    }

/* Modale di scelta gara a tutto schermo sopra l'overlay */
.stv-modal .modal-content {
    border: 0;
    border-radius: 0;
    background: var(--stv-paper);
}

.stv-modal .modal-body {
    padding: 0;
}

/* ---------- Telefono e tablet: prima il form, poi la presentazione ---------- */

@media (max-width: 991.98px) {
    .stv-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "top" "main" "body";
    }

    .stv-brand {
        display: contents;
    }

    .stv-brand-top {
        grid-area: top;
        background: var(--stv-ink);
        color: var(--stv-on-ink);
        padding: 1.125rem 1.25rem;
    }

    .stv-brand-body {
        grid-area: body;
        background: var(--stv-ink);
        color: var(--stv-on-ink);
        padding: 2.5rem 1.25rem 2rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .stv-main {
        grid-area: main;
        align-items: flex-start;
        padding: 2rem 1.25rem 2.75rem;
    }

    .stv-headline {
        font-size: 1.75rem;
    }
}

@media (min-width: 992px) {
    /* La presentazione deve stare in uno schermo (es. 1920x1080) senza scroll verticale */
    .stv-brand {
        padding-top: clamp(1.5rem, 3.5vh, 3rem);
        padding-bottom: clamp(1.5rem, 3.5vh, 3rem);
        gap: clamp(1.25rem, 3vh, 2.5rem);
    }

    .stv-brand-body {
        display: flex;
        flex-direction: column;
        gap: clamp(1.25rem, 2.8vh, 2.25rem);
        flex: 1;
    }

    .stv-headline {
        max-width: 30ch;
    }

    .stv-shot img {
        width: auto;
        max-width: 100%;
        max-height: 32vh;
    }
}

@media (min-width: 1200px) {
    .stv-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.5rem;
    }

        .stv-steps li {
            grid-template-columns: 1.5rem 1fr;
            gap: .625rem;
        }
}

@media (prefers-reduced-motion: reduce) {
    .stv *, .stv *::before {
        animation: none !important;
        transition: none !important;
    }
}
