/* corsi: pensati prima per il telefono; niente animazioni */

:root {
    --sfondo: #f6f7f5;
    --carta: #ffffff;
    --testo: #1c2321;
    --spento: #66706c;
    --bordo: #d9ded9;
    --primario: #2b7a6f;
    --primario-testo: #ffffff;
    --primario-chiaro: #e3f2ef;
    --ok: #2f7d4f;
    --ok-sfondo: #e7f6ec;
    --ko: #b91c1c;
    --ko-sfondo: #fdecec;
    --sel: #2563eb;
    --der: #2563eb;
    --die: #dc2626;
    --das: #16a34a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --sfondo: #121614;
        --carta: #1b211e;
        --testo: #e7ece9;
        --spento: #98a39e;
        --bordo: #2f3833;
        --primario: #45a394;
        --primario-testo: #06201c;
        --primario-chiaro: #133430;
        --ok: #62b386;
        --ok-sfondo: #12301e;
        --ko: #f87171;
        --ko-sfondo: #3a1616;
        --sel: #60a5fa;
        --der: #60a5fa;
        --die: #f87171;
        --das: #62b386;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--sfondo);
    color: var(--testo);
    font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }

.tg-testata {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 640px;
    margin: 0 auto;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
}
.tg-logo { font-size: 1.25rem; color: var(--testo); text-decoration: none; letter-spacing: .5px; }
/* corsi: al posto del logo il nome del corso (talkgo.js mostraHome); se e' lungo si taglia con i puntini */
.tg-testata .tg-logo { flex: 1 1 auto; min-width: 0; margin-right: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-testata .tg-utente { flex: 0 0 auto; }
.tg-logo b { color: var(--primario); }
.tg-utente { font-size: .85rem; color: var(--spento); }
.tg-utente a { color: var(--spento); }

.tg-app {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.tg-attesa, .tg-errore { padding: 40px 0; text-align: center; color: var(--spento); }
.tg-errore { color: var(--ko); }

h1.tg-titolo { font-size: 1.6rem; margin: 6px 0 4px; line-height: 1.2; }
h2.tg-h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.tg-riga-titolo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tg-riga-titolo h2.tg-h2 { margin-bottom: 8px; }
.tg-sopratitolo { color: var(--spento); font-size: .85rem; margin-top: 8px; text-transform: uppercase; letter-spacing: .5px; }
.tg-obiettivo { color: var(--spento); margin: 0 0 12px; }
.tg-nota { color: var(--spento); font-size: .9rem; margin: 6px 0; }
.tg-piccola { font-size: .8rem; margin-top: 18px; }

/* pulsanti */

.tg-btn {
    display: block;
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--bordo);
    background: var(--carta);
    font-weight: 600;
    text-align: center;
}
.tg-btn + .tg-btn { margin-top: 10px; }
.tg-primario { background: var(--primario); color: var(--primario-testo); border-color: var(--primario); }
.tg-secondario { background: var(--carta); color: var(--testo); }
.tg-btn:disabled { opacity: .45; }
.tg-btn.tg-piccolo { width: auto; min-height: 36px; padding: 6px 12px; font-size: .85rem; font-weight: 500; margin: 0; }

.tg-x {
    border: 0;
    background: none;
    color: var(--spento);
    padding: 8px 0;
    font-size: .95rem;
}
.tg-x { font-size: 1.3rem; padding: 4px 10px 4px 0; }

.tg-cassa {
    border: 1px solid var(--bordo);
    background: var(--carta);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    font-size: 1.1rem;
    line-height: 1;
}

/* articoli colorati per genere (corso.json "generi"): m blu, f rosso, n verde */
.tg-art { font-weight: 700; }
.tg-gm { color: var(--der); }
.tg-gf { color: var(--die); }
.tg-gn { color: var(--das); }

/* home */

.tg-lingua { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--bordo); background: var(--carta); }

.tg-riassunto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 16px; }
.tg-riassunto div {
    background: var(--carta);
    border: 1px solid var(--bordo);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
}
.tg-riassunto b { display: block; font-size: 1.35rem; }
.tg-riassunto span { font-size: .8rem; color: var(--spento); }

.tg-azioni .tg-btn + .tg-btn { margin-top: 10px; }

.tg-percorso { display: flex; flex-direction: column; gap: 8px; }
.tg-unita {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--bordo);
    background: var(--carta);
    text-align: left;
}
.tg-unita-n {
    flex: 0 0 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    background: var(--sfondo);
    border: 1px solid var(--bordo);
}
.tg-unita-t { flex: 1; min-width: 0; }
.tg-unita-t b { display: block; font-weight: 600; }
.tg-unita-t small { display: block; color: var(--spento); font-size: .8rem; }
.tg-unita-s { flex: 0 0 auto; font-size: .85rem; color: var(--spento); white-space: nowrap; }
.tg-unita.tg-fatta .tg-unita-n { background: var(--ok-sfondo); border-color: var(--ok); color: var(--ok); }
.tg-unita.tg-fatta .tg-unita-s { color: var(--ok); font-weight: 600; }
.tg-unita.tg-aperta { border: 2px solid var(--primario); }
.tg-unita.tg-aperta .tg-unita-n { background: var(--primario); border-color: var(--primario); color: var(--primario-testo); }
.tg-unita.tg-aperta .tg-unita-s { color: var(--primario); font-weight: 600; }
.tg-unita.tg-prevista { opacity: .5; }
/* unita' chiusa: sbiaditi numero e titolo, il lucchetto resta verde pieno (come le icone dei corsi) */
.tg-unita.tg-chiusa > :not(.tg-unita-s) { opacity: .5; }
.tg-lucchetto { color: var(--primario); font-size: 1.1rem; }
.tg-prevista { border-style: dashed; }

.tg-imp-voce { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0 0; font-size: .9rem; }
.tg-imp-voce input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 18px; accent-color: var(--primario); }

/* impostazioni: avviso alla prima accensione del microfono (talkgo.js avvisoMicrofono) e link all'informativa */
.tg-avviso-mic { margin: 8px 0 4px 26px; padding: 12px; border-radius: 12px; border: 1px solid var(--bordo); background: var(--primario-chiaro); font-size: .85rem; }
.tg-avviso-mic p { margin: 6px 0 10px; }
.tg-avviso-mic a, .tg-imp-privacy a { color: var(--primario); }
.tg-avviso-mic .tg-btn { min-height: 42px; padding: 8px 12px; font-size: .9rem; }
.tg-imp-privacy { text-align: center; }

/* studio */

.tg-spiega { margin: 0 0 10px; }
.tg-tabella { width: 100%; border-collapse: collapse; margin: 12px 0; background: var(--carta); border-radius: 12px; overflow: hidden; }
.tg-tabella caption { text-align: left; font-weight: 600; padding: 4px 0 6px; }
.tg-tabella td { padding: 8px 12px; border-top: 1px solid var(--bordo); }
.tg-tabella tr:first-child td { border-top: 0; }
.tg-tabella .tg-td-de { font-weight: 600; }
.tg-tabella tr { cursor: pointer; }

.tg-voci { display: flex; flex-direction: column; gap: 6px; }
.tg-voce {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--carta);
    border: 1px solid var(--bordo);
    border-radius: 12px;
    cursor: pointer;
}
.tg-voce-testo { flex: 1; min-width: 0; }
.tg-voce-de { font-size: 1.15rem; font-weight: 600; }
.tg-voce-it { color: var(--spento); }
.tg-voce-nota { font-size: .85rem; color: var(--spento); margin-top: 2px; }
.tg-voce-cassa { flex: 0 0 auto; font-size: .95rem; }

/* altoparlante (talkgo.js iconaVoce): verde e piccolo, come il lucchetto e le icone dei corsi */
.tg-icona-voce { color: var(--primario); }
.tg-icona-auto { color: var(--primario); margin-right: .45em; font-style: normal; }
.tg-auto-titolo .tg-icona-auto { font-size: 1.15rem; vertical-align: -0.12em; }
.tg-auto-flag-testo b .tg-icona-auto { font-size: 1.2rem; vertical-align: -0.12em; }
.tg-auto-mic .tg-icona-auto { margin-right: .35em; }
.tg-auto-mic:not(.tg-attivo) .tg-icona-auto { color: inherit; }
.tg-btn .tg-icona-voce { margin-right: .4em; font-size: .95em; }
.tg-primario .tg-icona-voce { color: inherit; }
.tg-cassa .tg-icona-voce { font-size: 1.05rem; }

/* esercizi */

.tg-barra { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; }
.tg-prog { flex: 1; height: 10px; border-radius: 5px; background: var(--bordo); overflow: hidden; }
.tg-prog-i { height: 100%; background: var(--primario); }

.tg-consegna { color: var(--spento); font-size: .95rem; margin: 8px 0 10px; }
.tg-domanda { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tg-grande { font-size: 1.5rem; font-weight: 600; line-height: 1.25; }
.tg-domanda.tg-grande { display: block; }
.tg-sotto { color: var(--spento); margin: -10px 0 16px; }

.tg-ascolta { flex: 1; min-height: 60px; font-size: 1.1rem; }
.tg-domanda .tg-ascolta + .tg-ascolta { margin-top: 0; flex: 0 0 90px; }

.tg-opzioni { display: flex; flex-direction: column; gap: 10px; }
.tg-opz {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--bordo);
    background: var(--carta);
    text-align: left;
    font-size: 1.05rem;
}
.tg-n {
    flex: 0 0 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--bordo);
    font-size: .75rem;
    color: var(--spento);
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (pointer: coarse) { .tg-n { display: none; } }

.tg-ok { border-color: var(--ok) !important; background: var(--ok-sfondo) !important; }
.tg-ko { border-color: var(--ko) !important; background: var(--ko-sfondo) !important; }
.tg-sel { border-color: var(--sel) !important; box-shadow: inset 0 0 0 1px var(--sel); }
.tg-opz:disabled, .tg-chip:disabled { color: var(--testo); }

.tg-chip {
    border: 2px solid var(--bordo);
    background: var(--carta);
    border-radius: 10px;
    padding: 8px 12px;
    min-height: 44px;
    font-size: 1.05rem;
}
.tg-chip-usata { visibility: hidden; }

.tg-risposta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 64px;
    padding: 8px;
    border: 2px dashed var(--bordo);
    border-radius: 12px;
    margin-bottom: 16px;
    align-content: flex-start;
}
.tg-banca, .tg-lettere { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-lettere { margin-top: 10px; }
.tg-lettere .tg-chip { min-width: 48px; }

.tg-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1.15rem;
    border-radius: 12px;
    border: 2px solid var(--bordo);
    background: var(--carta);
}
.tg-input:focus { outline: none; border-color: var(--primario); }

.tg-abbina { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tg-col { display: flex; flex-direction: column; gap: 8px; }
.tg-abb { width: 100%; min-height: 54px; text-align: center; font-size: 1rem; }
.tg-abb:disabled { opacity: .55; }

.tg-mic { min-height: 64px; font-size: 1.1rem; }
.tg-msg { margin-top: 6px; color: var(--spento); }
.tg-msg-ko { color: var(--ko); }

/* piede con i pulsanti: resta in basso a portata di pollice */
.tg-piede {
    position: sticky;
    bottom: 0;
    margin-top: 20px;
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    background: var(--sfondo);
}

.tg-esito { border-radius: 14px; padding: 12px 14px; border: 2px solid; }
.tg-esito-ok { border-color: var(--ok); background: var(--ok-sfondo); }
.tg-esito-ko { border-color: var(--ko); background: var(--ko-sfondo); }
.tg-esito-t { font-weight: 700; }
.tg-esito-ok .tg-esito-t { color: var(--ok); }
.tg-esito-ko .tg-esito-t { color: var(--ko); }
.tg-esito-nota { font-size: .9rem; margin-top: 2px; }
.tg-sol { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.tg-sol-de { font-size: 1.2rem; font-weight: 600; }
.tg-sol-it { color: var(--spento); margin-bottom: 12px; }

/* fine */

.tg-punteggio {
    margin: 16px 0;
    padding: 18px;
    border-radius: 14px;
    background: var(--carta);
    border: 2px solid var(--bordo);
    text-align: center;
}
.tg-punteggio b { display: block; font-size: 2.6rem; line-height: 1.1; }
.tg-punteggio span { color: var(--spento); font-size: .9rem; }
.tg-punteggio-ok { border-color: var(--ok); }
.tg-punteggio-ok b { color: var(--ok); }
.tg-fine-righe p { margin: 4px 0; }

.tg-avviso {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--ko);
    background: var(--ko-sfondo);
    font-size: .9rem;
}
.tg-imp-info { padding-top: 10px; font-size: .8rem; color: var(--spento); }

/* torna al percorso: piccolo ma ben visibile, colore del pulsante principale */
.tg-torna {
    margin: 6px 0 4px;
    padding: 6px 14px;
    min-height: 36px;
    border: 0;
    border-radius: 18px;
    background: var(--primario);
    color: var(--primario-testo);
    font-size: .9rem;
    font-weight: 600;
}

/* rotellina delle impostazioni nella testata */
.tg-utente { display: flex; align-items: center; gap: 6px; }
.tg-rotella {
    border: 0;
    background: none;
    color: var(--spento);
    font-size: 1.15rem;
    line-height: 1;
    padding: 6px;
    margin: -6px 0;
}
.tg-rotella:hover { color: var(--primario); }

/* finestre (al posto di confirm del browser) */
.tg-finestra {
    border: 1px solid var(--bordo);
    border-radius: 16px;
    padding: 0;
    width: min(420px, calc(100vw - 32px));
    background: var(--carta);
    color: var(--testo);
}
.tg-finestra::backdrop { background: rgba(0, 0, 0, .55); }
.tg-fin-dentro { padding: 18px 18px 16px; }
.tg-fin-testa { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.tg-fin-titolo { font-size: 1.2rem; font-weight: 700; flex: 1; }
.tg-fin-x {
    flex: 0 0 auto; width: 36px; height: 36px; margin: -6px -6px 0 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--spento); font-size: 1.1rem; cursor: pointer;
}
.tg-fin-x:hover { background: var(--primario-chiaro); color: var(--testo); }
.tg-fin-testo { margin: 0 0 4px; color: var(--spento); }
.tg-fin-pulsanti { margin-top: 16px; }
.tg-imp-sotto { font-size: .85rem; color: var(--spento); }

/* lingua nelle impostazioni */
.tg-imp-lingua { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 16px; font-weight: 600; }
.tg-imp-lingua small { font-weight: 400; color: var(--spento); }

/* bandiere (SVG da corso.json) e scelta della lingua */
.tg-bandiera {
    width: 1.5em;
    height: 1em;
    vertical-align: -0.1em;
    margin-right: .4em;
    border-radius: 3px;
    box-shadow: 0 0 0 1px var(--bordo);
    flex: 0 0 auto;
}
.tg-lingue { display: flex; flex-direction: column; gap: 8px; }
.tg-lingua-btn {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid var(--bordo);
    background: var(--carta);
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
}
.tg-lingua-btn .tg-bandiera { width: 30px; height: 20px; margin-right: 12px; }
.tg-lingua-attiva { border-color: var(--primario); background: var(--primario-chiaro); }
.tg-lingua-btn:disabled { opacity: .45; }

/* domande sulle lezioni precedenti dentro una lezione */
.tg-etichetta {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--primario);
    background: var(--primario-chiaro);
}

/* teoria a pagine */
.tg-teoria-testa { display: flex; align-items: center; justify-content: space-between; }
.tg-pagine { color: var(--spento); font-size: .85rem; }
.tg-teoria-testa + .tg-prog { margin: 6px 0 4px; }
.tg-teoria { min-height: 45vh; }
.tg-scheda {
    margin-top: 18px;
    padding: 22px 18px 18px;
    border-radius: 16px;
    border: 1px solid var(--bordo);
    background: var(--carta);
    text-align: center;
}
.tg-scheda-de { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.tg-scheda-it { font-size: 1.15rem; color: var(--spento); margin-top: 6px; }
.tg-scheda-nota {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--bordo);
    text-align: left;
    font-size: 1rem;
}
.tg-scheda-audio { display: flex; gap: 10px; margin-top: 18px; }
.tg-scheda-audio .tg-btn { margin-top: 0; }
.tg-scheda-audio .tg-btn:last-child { flex: 0 0 90px; }
.tg-piede-riga { display: flex; gap: 10px; }
.tg-piede-riga .tg-btn + .tg-btn { margin-top: 0; }
.tg-piede-riga .tg-indietro-btn { flex: 0 0 34%; }

/* corsi non di lingua: icona al posto della bandiera, immagini, domande */
.tg-icona-corso { color: var(--primario); margin-right: .4em; }
.tg-lingua-btn .tg-icona-corso { width: 30px; margin-right: 12px; font-size: 20px; text-align: center; }
.tg-img { display: block; max-width: 100%; height: auto; margin: 0 auto 14px; border-radius: 10px; }
.tg-img-domanda { width: 100%; max-width: 420px; margin-bottom: 0; }

/* test "quale immagine mostra...?": le risposte sono immagini, due per riga */
.tg-opzioni-img { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tg-opzioni-img .tg-opz { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; min-height: 0; }
.tg-opzioni-img .tg-n { align-self: flex-start; }
.tg-img-opz { width: 100%; margin: 0; border-radius: 8px; }
.tg-domanda-testo { font-size: 1.2rem; font-weight: 600; line-height: 1.35; }
.tg-scheda-testo .tg-scheda-de { font-size: 1.55rem; }
.tg-scheda-domanda { font-size: 1.2rem; font-weight: 600; line-height: 1.35; }

/* corsi di ascolto: Riascolta, velocita', trascrizione dopo la risposta */
.tg-audio { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.tg-audio .tg-ascolta { min-height: 60px; font-size: 1.15rem; }
.tg-velocita { display: flex; gap: 6px; justify-content: center; }
.tg-vel {
    flex: 1;
    max-width: 90px;
    min-height: 40px;
    border-radius: 10px;
    border: 2px solid var(--bordo);
    background: var(--carta);
    font-weight: 600;
    font-size: .95rem;
}
.tg-vel-attiva { border-color: var(--primario); background: var(--primario-chiaro); color: var(--primario); }
.tg-trascr { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; text-align: left; }
.tg-trascr-de { font-size: 1.15rem; font-weight: 600; }
.tg-trascr-it { color: var(--spento); }
.tg-scheda-ascolto .tg-trascr-de { font-size: 1.5rem; }
.tg-scheda-ascolto .tg-trascr { margin-bottom: 4px; }
.tg-scheda-ascolto .tg-audio { margin: 16px 0 0; }
.tg-esito-azioni { display: flex; gap: 10px; margin-top: 12px; }
.tg-esito-azioni .tg-btn + .tg-btn { margin-top: 0; }
.tg-esito-azioni .tg-secondario { flex: 0 0 40%; }

/* cartelli (corsi con "cartello", es. giapponese): la scritta come su un'insegna */
.tg-cartello {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 10px;
    border: 3px solid #e2e8f0;
    background: #1e3a5f;
    color: #ffffff;
    font-family: "Yu Gothic UI", "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.2;
}
.tg-cartello-opz { font-size: 1.6rem; padding: 4px 14px; border-width: 2px; }
.tg-cartello-esito { font-size: 1.5rem; padding: 4px 14px; border-width: 2px; margin: 6px 0 2px; }
.tg-cartello-scheda { margin-bottom: 14px; }
.tg-cartello-mini { font-size: 1.1rem; padding: 2px 10px; border-width: 2px; flex: 0 0 auto; }
.tg-opz .tg-cartello-opz { margin: 2px 0; }

/* emoji di una voce (campo "emoji"): una sola e grande, nella teoria, sopra la frase da tradurre e nella soluzione */
.tg-emo { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-style: normal; font-weight: normal; }
.tg-emo-grande { display: block; flex: 0 0 100%; font-size: 64px; line-height: 1.1; text-align: center; margin: 0 0 10px; }
.tg-emo-esito { display: block; font-size: 36px; line-height: 1.2; margin: 2px 0 4px; }

/* quando appare la soluzione, la domanda sotto resta sfocata */
.tg-app:has(.tg-piede .tg-esito) .tg-es { filter: blur(3px); opacity: .7; pointer-events: none; user-select: none; transition: filter .15s; }

/* impostazioni: logout (o accesso per chi non ha un account) in fondo */
.tg-imp-fondo { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bordo); }
.tg-esci { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--testo); }

/* senza account: invito a registrarsi o entrare */
.tg-ospite { margin: 14px 0; padding: 14px; border-radius: 14px; border: 1px solid var(--bordo); background: var(--primario-chiaro); }
.tg-ospite p { margin: 0 0 10px; }
.tg-accesso { display: flex; gap: 10px; flex-wrap: wrap; }
.tg-accesso .tg-btn { flex: 1 1 140px; display: flex; align-items: center; justify-content: center; text-decoration: none; margin: 0; }
.tg-accesso .tg-secondario { color: var(--testo); }
.tg-piede .tg-accesso { margin-bottom: 10px; }

/* impostazioni: tre sezioni (Corso, Test, Account) */
.tg-imp-schede { display: flex; gap: 4px; padding: 4px; margin: 6px 0 14px; border-radius: 12px; background: var(--sfondo); border: 1px solid var(--bordo); }
.tg-imp-scheda {
    flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent;
    color: var(--spento); font-weight: 600; font-size: .9rem;
}
.tg-imp-scheda-attiva { background: var(--carta); color: var(--testo); box-shadow: 0 0 0 1px var(--bordo); }
.tg-imp-corpo { min-height: 180px; }
.tg-imp-dati { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; margin-bottom: 14px; }
.tg-imp-dati span { color: var(--spento); }
.tg-imp-dati b { overflow-wrap: anywhere; }
.tg-imp-azioni { display: flex; flex-direction: column; gap: 8px; }
.tg-imp-azioni .tg-btn + .tg-btn { margin-top: 0; }
.tg-imp-azioni > .tg-btn { min-height: 42px; padding: 8px 14px; font-weight: 500; text-align: left; }
.tg-imp-modulo { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--bordo); border-radius: 12px; background: var(--sfondo); }
.tg-imp-modulo .tg-input { min-height: 44px; font-size: .95rem; }
.tg-imp-modulo .tg-btn { min-height: 44px; margin: 0; }
.tg-imp-esito { font-size: .85rem; }
.tg-imp-esito:empty { display: none; }
.tg-ok-testo { color: var(--ok); }
.tg-ko-testo { color: var(--ko); }
.tg-pericolo { background: var(--ko); border-color: var(--ko); color: #fff; }
.tg-finestra { max-height: calc(100dvh - 32px); overflow-y: auto; }

/* modalita' auto (mani libere): poche scritte grandi, tre pulsanti grandi in basso */
.tg-auto-flag { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--bordo); border-radius: 14px; background: var(--carta); cursor: pointer; }
.tg-auto-flag input { width: 22px; height: 22px; margin-top: 1px; flex: 0 0 22px; accent-color: var(--primario); }
.tg-auto-flag-testo { display: flex; flex-direction: column; gap: 2px; }
.tg-auto-flag-testo small { color: var(--spento); font-size: .85rem; }
.tg-auto-flag:has(input:checked) { border-color: var(--primario); background: var(--primario-chiaro); }
.tg-auto { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 18px 0 120px; min-height: 60vh; }
.tg-auto-titolo { color: var(--spento); font-size: .85rem; text-transform: uppercase; letter-spacing: .6px; }
.tg-auto-sopra { color: var(--spento); font-size: 1rem; min-height: 1.4em; }
.tg-auto-grande { font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tg-auto-sotto { font-size: 1.4rem; color: var(--spento); min-height: 1.4em; }
.tg-auto-testo { max-width: 34rem; font-size: 1.05rem; line-height: 1.5; color: var(--testo); text-align: left; }
.tg-auto-testo p { margin: 0 0 8px; }
.tg-auto-testo:empty { display: none; }
.tg-auto-mic { margin-top: 10px; padding: 8px 16px; border-radius: 999px; font-size: .95rem; color: var(--spento); border: 1px solid var(--bordo); opacity: .35; transition: opacity .2s; }
.tg-auto-mic.tg-attivo { opacity: 1; color: var(--primario); border-color: var(--primario); background: var(--primario-chiaro); }
.tg-auto-barra {
    position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center;
    padding: 12px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--sfondo); border-top: 1px solid var(--bordo);
}
.tg-auto-barra .tg-btn { flex: 1; max-width: 200px; min-height: 64px; font-size: 1.15rem; margin: 0; }
