:root {
  --bg: #fbfaf7;
  --panel: #f2f0ea;
  --text: #1f2328;
  --muted: #5f646b;
  --line: #dedbd2;
  --accent: #2b5fd9;
  --accent-soft: #e4ebfb;
  --warn: #b83a08;
  --code-bg: #eeece5;
  --pt: #2b5fd9;
  --pt-alt: #c2410c;
  --band: rgba(43, 95, 217, 0.16);
  --axis: #8a8f96;
  --sidebar-w: clamp(272px, 17vw, 340px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #16181c;
  --panel: #1e2126;
  --text: #e6e6e3;
  --muted: #9ea3aa;
  --line: #2f333a;
  --accent: #7ba2ff;
  --accent-soft: #232b3f;
  --warn: #f08a5d;
  --code-bg: #23262c;
  --pt: #7ba2ff;
  --pt-alt: #f08a5d;
  --band: rgba(123, 162, 255, 0.2);
  --axis: #7a7f86;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181c;
    --panel: #1e2126;
    --text: #e6e6e3;
    --muted: #9ea3aa;
    --line: #2f333a;
    --accent: #7ba2ff;
    --accent-soft: #232b3f;
    --warn: #f08a5d;
    --code-bg: #23262c;
    --pt: #7ba2ff;
    --pt-alt: #f08a5d;
    --band: rgba(123, 162, 255, 0.2);
    --axis: #7a7f86;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: clamp(17px, 0.55vw + 11px, 21px) / 1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input { caret-color: var(--accent); }

/* Barra superiore */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); z-index: 20;
  font-size: 16px;
}
.brand { font-weight: 700; letter-spacing: .01em; color: inherit; text-decoration: none; }
.brand:hover { color: var(--accent); }
.titolo-nota { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: grid; place-items: center; background: none; border: 1px solid var(--line);
  color: var(--text); width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
#menu { display: none; }

.layout { display: flex; padding-top: 52px; min-height: 100vh; }

/* Indice laterale */
.sidebar {
  position: fixed; top: 52px; bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 14px 12px 28px; background: var(--panel);
  border-right: 1px solid var(--line); z-index: 10; font-size: 16px;
}
.sidebar input[type="search"] {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; margin-bottom: 14px;
}
.sidebar input[type="search"]:focus-visible { outline-offset: 0; }
.indietro {
  display: block; padding: 2px 8px 10px; font-size: .85rem; color: var(--muted); text-decoration: none;
}
.indietro:hover { color: var(--accent); }
.corso-link {
  display: block; padding: 6px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 1.05rem; line-height: 1.3; color: var(--text); text-decoration: none;
}
.corso-link:hover, .corso-link.attiva { color: var(--accent); }
.capitolo { margin: 2px 0; }
.capitolo > summary {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 8px; border-radius: 7px; cursor: pointer; list-style: none;
  font-weight: 600; line-height: 1.35;
}
.capitolo > summary::-webkit-details-marker { display: none; }
.capitolo > summary:hover { background: var(--accent-soft); }
.capitolo > summary .cap-tit { flex: 1; min-width: 0; }
.capitolo > summary::after {
  content: ""; width: 6px; height: 6px; flex: none; align-self: center;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.capitolo[open] > summary::after { transform: rotate(45deg); }
.capitolo > .nota { margin-left: 26px; }
.capitolo.lezioni > .nota { margin-left: 8px; }
.num {
  display: inline-grid; place-items: center; flex: none; min-width: 1.45em; height: 1.45em; padding: 0 .3em;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: .78em; font-weight: 700; font-variant-numeric: tabular-nums;
}
.conta { font-size: .78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.gruppo {
  margin: 10px 8px 3px 34px; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.risultati-corso .gruppo, .risultati-home .gruppo { margin-left: 8px; }
.risultati-conta { margin: 0 8px 6px; font-size: .8rem; color: var(--muted); }
.nota.risultato .dove { color: var(--accent); }
.nota {
  display: block; padding: 6px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--text); text-decoration: none; line-height: 1.35;
  transition: background .12s;
}
.nota:hover { background: var(--accent-soft); }
.nota.es { font-size: .95em; }
.nota.attiva { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nota small { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; font-weight: 400; line-height: 1.35; }
.vuoto, .risultati-vuoti { color: var(--muted); padding: 8px 10px; font-size: .9rem; }

/* Area di lettura: testo + indice della pagina */
.content {
  margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w));
  padding: 36px clamp(16px, 3vw, 48px) 72px;
  display: grid; grid-template-columns: minmax(0, 75ch) 15.5rem;
  justify-content: center; column-gap: clamp(32px, 3.5vw, 64px); align-items: start;
}
.content.senza-toc { grid-template-columns: minmax(0, 75ch); }
.content > article { animation: entra .5s var(--ease) both; }
@keyframes entra {
  from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

article h1 { font-size: clamp(2rem, 1.2rem + 1.8vw, 2.9rem); line-height: 1.15; margin: 0 0 .25em; text-wrap: balance; letter-spacing: -.015em; }
article h2 {
  font-size: 1.45rem; line-height: 1.3; margin: 2.1em 0 .5em; padding-bottom: .25em;
  border-bottom: 1px solid var(--line); text-wrap: balance; scroll-margin-top: 76px;
}
article h3 { font-size: 1.15rem; line-height: 1.35; margin: 1.7em 0 .4em; scroll-margin-top: 76px; }
article p, article ul, article ol { margin: .75em 0; text-wrap: pretty; }
article li { margin: .3em 0; }
article li::marker { color: var(--muted); }
article a { color: var(--accent); }
article a.wiki { text-decoration: none; border-bottom: 1px dashed var(--accent); }
article a.wiki.rotto { color: var(--warn); border-color: var(--warn); }
article code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
article pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
article pre code { background: none; padding: 0; }
article blockquote {
  margin: 1.2em 0; padding: .5em 1.1em; background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: 10px;
}
article hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 1.2em; }
.briciole {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin: 0 0 1em; font-size: .85rem; color: var(--muted); line-height: 1.4;
}
.briciole a { color: var(--muted); text-decoration: none; }
.briciole a:hover { color: var(--accent); }
.briciole span { opacity: .6; }

/* Collegamenti automatici in fondo alla nota */
.collegamenti {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 18px 28px;
  margin-top: 3.2em; padding-top: 1.4em; border-top: 1px solid var(--line);
}
article .collegamenti .coll-tit {
  margin: 0 0 .4em; padding: 0; border: 0; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.collegamenti ul { list-style: none; padding: 0; margin: 0; }
.collegamenti li { margin: .25em 0; line-height: 1.4; }
.collegamenti a { text-decoration: none; }
.collegamenti a:hover { text-decoration: underline; }

.tabella { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--line); border-radius: 10px; }
.tabella table { border-collapse: collapse; width: 100%; font-size: .95em; font-variant-numeric: tabular-nums; }
.tabella th, .tabella td { padding: 8px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.tabella tr:last-child td { border-bottom: 0; }
.tabella th { background: var(--panel); font-weight: 600; }

.katex { font-size: 1.12em; }
.katex-display { margin: 1.1em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* Codice */
:root {
  --hl-kw: #a1307a; --hl-str: #17692f; --hl-num: #a8470a; --hl-com: #5f6670;
  --hl-title: #2b5fd9; --hl-type: #0f766e; --hl-meta: #8a5a00;
}
:root[data-theme="dark"] {
  --hl-kw: #d68cf2; --hl-str: #8bd6a0; --hl-num: #f0a16b; --hl-com: #8d949e;
  --hl-title: #7ba2ff; --hl-type: #5fd3c8; --hl-meta: #e0b35c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hl-kw: #d68cf2; --hl-str: #8bd6a0; --hl-num: #f0a16b; --hl-com: #8d949e;
    --hl-title: #7ba2ff; --hl-type: #5fd3c8; --hl-meta: #e0b35c;
  }
}
figure.codice {
  margin: 1.3em 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--code-bg); overflow: hidden;
}
.codice-head {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  font-size: .8rem; line-height: 1.3; min-height: 36px;
}
.codice-nome { flex: 1; font: 600 .92em ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codice-nome a { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--muted); }
.codice-nome a:hover { color: var(--accent); border-color: var(--accent); }
.codice-lang { margin-left: auto; text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; font-weight: 600; color: var(--muted); }
.codice-lang + .copia { margin-left: 0; }
.copia {
  margin-left: auto;
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
  padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); min-width: 4.8em;
  transition: background .15s, border-color .15s, color .15s;
}
.copia:hover { background: var(--accent-soft); border-color: var(--accent); }
.copia.ok { color: var(--hl-str); border-color: var(--hl-str); }
.copia.ko { color: var(--warn); border-color: var(--warn); }
figure.codice pre {
  margin: 0; padding: 12px 14px; background: none; border-radius: 0; overflow-x: auto;
  font: .88em/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 4;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; /* niente legature: <= resta <= */
}
figure.codice pre code { background: none; padding: 0; font: inherit; color: var(--text); }
.hljs-keyword, .hljs-literal, .hljs-selector-tag { color: var(--hl-kw); }
.hljs-string, .hljs-regexp, .hljs-char { color: var(--hl-str); }
.hljs-number { color: var(--hl-num); }
.hljs-comment, .hljs-quote { color: var(--hl-com); font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--hl-title); }
.hljs-title.class_, .hljs-type, .hljs-built_in, .hljs-class .hljs-title { color: var(--hl-type); }
.hljs-meta, .hljs-doctag, .hljs-attr, .hljs-symbol { color: var(--hl-meta); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.codice-errore {
  margin: 1.3em 0; padding: 10px 14px; border: 1px dashed var(--warn); border-radius: 10px;
  color: var(--warn); font-size: .92rem;
}
.nota .lang { margin-left: 8px; }

/* Indice della pagina */
.toc {
  position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto;
  font-size: .84rem; line-height: 1.4; padding-top: 6px;
  animation: entra .5s var(--ease) .1s both;
}
.toc-titolo { font-weight: 700; margin: 0 0 6px 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.toc a {
  display: block; padding: 5px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--muted); text-decoration: none; transition: background .12s, color .12s;
}
.toc a.sub { padding-left: 22px; font-size: .95em; }
.toc a:hover { color: var(--text); background: var(--accent-soft); }
.toc a.attiva { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.toc .katex { font-size: 1em; }

/* Precedente / successiva */
.pagine { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 3.2em; }
.pagine a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--text); text-decoration: none; line-height: 1.35;
  transition: border-color .15s, background .15s;
}
.pagine a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pagine a.succ { text-align: right; grid-column: 2; }
.pagine span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.pagine strong { font-weight: 600; color: var(--accent); }

/* Grafici */
figure.grafico {
  margin: 1.6em 0; padding: 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel);
}
figure.grafico svg { width: 100%; height: auto; display: block; }
figure.grafico figcaption { font-size: .88rem; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.grafico .asse { stroke: var(--axis); stroke-width: 1.3; fill: none; }
.grafico .griglia { stroke: var(--line); stroke-width: 1; }
.grafico .tick { stroke: var(--axis); stroke-width: 1; }
.grafico text { fill: var(--text); font: 12px system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.grafico text.tenue { fill: var(--muted); }
.grafico .punto { fill: var(--pt); transition: fill .12s; }
.grafico .punto:hover { fill: var(--pt-alt); }
.grafico .punto.dentro { fill: var(--pt-alt); }
.grafico .estremo-pieno { fill: var(--pt); stroke: var(--pt); stroke-width: 2; }
.grafico .estremo-vuoto { fill: var(--panel); stroke: var(--pt); stroke-width: 2.4; }
.grafico .curva { stroke: var(--pt); stroke-width: 2; fill: none; }
.grafico .linea { stroke: var(--pt-alt); stroke-width: 1.6; }
.grafico .linea.tratt { stroke-dasharray: 6 5; }
.grafico .linea-et { fill: var(--pt-alt); font-weight: 600; }
.grafico .seg { stroke: var(--pt); stroke-width: 5; stroke-linecap: butt; }
.grafico .marker-pieno { fill: var(--pt-alt); stroke: var(--pt-alt); stroke-width: 2; }
.grafico .marker-vuoto { fill: var(--panel); stroke: var(--pt-alt); stroke-width: 2.4; }
.grafico .fascia { fill: var(--band); }
.grafico-controlli { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: .9rem; flex-wrap: wrap; }
.grafico-controlli label { font-weight: 700; font-size: 1.1rem; }
.grafico-controlli input[type="range"] { flex: 1 1 200px; min-width: 160px; accent-color: var(--accent); height: 28px; }
.grafico-controlli output { flex: 1 1 100%; font-variant-numeric: tabular-nums; color: var(--muted); line-height: 1.45; }
.grafico-errore { color: var(--warn); font-size: .9rem; padding: 8px 0; }
/* segnaposto visibile solo finché JavaScript non disegna il grafico (o se è disattivato) */
.grafico-attesa {
  margin: 1.6em 0; padding: 14px; border: 1px dashed var(--line); border-radius: 12px;
  background: var(--panel); color: var(--muted); font-size: .9rem;
}

/* Pagine senza barra laterale (home, 404) */
body.senza-sidebar .content { margin-left: 0; width: 100%; grid-template-columns: minmax(0, 46rem); padding-top: clamp(40px, 8vh, 96px); }
article .intro { color: var(--muted); font-size: 1.1rem; margin: .2em 0 1.4em; text-wrap: pretty; }

/* Home */
.home .hero h1 { font-size: clamp(2.3rem, 1.4rem + 2.6vw, 3.4rem); margin-bottom: .2em; }
.home .hero .intro { font-size: 1.15rem; max-width: 36rem; }
.cerca-home input {
  width: 100%; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-size: 1.05rem;
  transition: border-color .15s, background .15s;
}
.cerca-home input:focus { border-color: var(--accent); background: var(--bg); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.risultati-home { margin-top: 18px; }
.risultati-home .nota { padding: 10px 12px; }
article.home h2, .home article h2 {
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 0; margin: 2.6em 0 .6em; padding: 0;
}
.lista-corsi { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.lista-corsi li { margin: 0; border-bottom: 1px solid var(--line); }
.corso {
  display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: baseline;
  padding: 14px 8px; color: var(--text); text-decoration: none; border-radius: 8px;
  transition: background .15s;
}
a.corso:hover { background: var(--accent-soft); }
a.corso:hover .corso-nome { color: var(--accent); }
.corso-nome { font-weight: 650; font-size: 1.08rem; line-height: 1.3; }
.corso-info { grid-column: 1; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.corso-conti { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; text-align: right; }
.corso.in-arrivo { opacity: .55; }
.come dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 18px 26px; margin: 0; }
.come dt { font-weight: 650; margin-bottom: .2em; }
.come dd { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.piede { margin-top: 3.4em; padding-top: 1.2em; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* Pagina del corso */
.salti { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.4em 0 .4em; }
.salti a {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.salti a span { color: var(--muted); font-weight: 400; font-size: .85em; }
.salti a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pagina-corso .cap { margin: 1.6em 0 2em; scroll-margin-top: 76px; }
.pagina-corso .cap h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 .3em; font-size: 1.2rem; }
.cap-descr { color: var(--muted); font-size: .95rem; margin: 0 0 .7em; }
.voci { list-style: none; padding: 0; margin: 0; }
article .voci li { margin: 0; }
.voci a {
  display: block; padding: 7px 10px; margin: 0 -10px; border-radius: 8px;
  color: var(--text); text-decoration: none; line-height: 1.4; transition: background .12s;
}
.voci a:hover { background: var(--accent-soft); color: var(--accent); }
.cap-es { margin-top: .6em; padding-left: 14px; border-left: 2px solid var(--line); }
.cap-es .gruppo { margin: .3em 0 .2em; display: block; }
.voci.es a { font-size: .95em; }
.vuoto-grande { color: var(--muted); padding: 1.2em 0; }
.nota .lang {
  display: inline-block; padding: 0 6px; border: 1px solid var(--line);
  border-radius: 4px; font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); vertical-align: 1px;
}

@media (max-width: 1180px) {
  .toc { display: none; }
  .content, .content.senza-toc { grid-template-columns: minmax(0, 75ch); }
}
@media (max-width: 860px) {
  #menu { display: grid; }
  .brand { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease), box-shadow .25s; width: min(86vw, 330px); }
  body.menu-aperto .sidebar { transform: none; box-shadow: 6px 0 24px rgba(0,0,0,.22); }
  .content, .content.senza-toc, body.senza-sidebar .content { margin-left: 0; width: 100%; padding: 24px 16px 56px; }
  body.senza-sidebar .brand { display: inline; }
  .corso { grid-template-columns: 1fr; }
  .corso-conti { grid-column: 1; grid-row: auto; text-align: left; margin-top: 2px; }
  .pagine { grid-template-columns: 1fr; }
  .pagine a.succ { grid-column: 1; }
  figure.grafico { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .content > article, .toc { animation: none; }
  * { transition: none !important; }
}

/* Spiegazioni a comparsa su termini e simboli ([[Nota|testo|spiegazione]], {{termine|spiegazione}}) */
.glossa { position: relative; }
span.glossa { color: var(--accent); border-bottom: 1px dotted var(--accent); cursor: help; }
span.glossa:focus-visible { outline-offset: 3px; }
.spiega {
  position: absolute; left: 50%; bottom: 100%; z-index: 30;
  display: flex; flex-direction: column; align-items: center;
  width: max-content; max-width: min(22rem, 86vw); padding-bottom: 3px;
  transform: translate(-50%, 6px); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .16s ease, transform .22s var(--ease), visibility 0s linear .22s;
  font-weight: 400; font-style: normal; letter-spacing: normal; text-transform: none; text-align: left;
}
.glossa:hover > .spiega, .glossa:focus-visible > .spiega, .glossa.aperta > .spiega {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
  transition: opacity .16s ease .12s, transform .22s var(--ease) .12s, visibility 0s linear 0s;
}
.spiega-testo {
  display: block; transform: translateX(var(--dx, 0px));
  padding: 9px 13px; border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14);
  color: var(--text); font-size: .84rem; line-height: 1.5; white-space: normal;
}
.spiega-testo .katex { font-size: 1.05em; }
.spiega-vai { display: block; margin-top: 5px; font-size: .74rem; font-weight: 600; color: var(--accent); }
.graffa { display: none; }
/* Stile "graffa" (Analisi 1): parentesi graffa orizzontale sopra il termine, con la spiegazione dentro */
[data-glosse="graffa"] .graffa {
  display: flex; width: var(--gw, 3em); min-width: 32px; height: 12px; margin-top: 3px; color: var(--accent);
}
[data-glosse="graffa"] .spiega { padding-bottom: 1px; }
.graffa i { display: block; height: 12px; flex: none; background: currentColor; }
.graffa .g-l, .graffa .g-r { width: 8px; }
.graffa .g-punta { width: 16px; }
.graffa .g-linea { flex: 1 1 0; min-width: 0; background: linear-gradient(currentColor, currentColor) center / 100% 1.6px no-repeat; }
.graffa .g-l { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M0.8 12C0.8 8 3 6 8 6' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M0.8 12C0.8 8 3 6 8 6' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.graffa .g-r { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M0 6C5 6 7.2 8 7.2 12' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M0 6C5 6 7.2 8 7.2 12' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.graffa .g-punta { -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M0 6C5 6 8 4.6 8 0.8M16 6C11 6 8 4.6 8 0.8' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M0 6C5 6 8 4.6 8 0.8M16 6C11 6 8 4.6 8 0.8' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
/* se in alto non c'è spazio la spiegazione si apre sotto (la graffa si capovolge) */
.glossa.sotto > .spiega { bottom: auto; top: 100%; flex-direction: column-reverse; padding: 3px 0 0; transform: translate(-50%, -6px); }
.glossa.sotto:hover > .spiega, .glossa.sotto.aperta > .spiega, .glossa.sotto:focus-visible > .spiega { transform: translate(-50%, 0); }
.glossa.sotto .graffa { transform: scaleY(-1); margin: 0 0 3px; }
@media (prefers-reduced-motion: reduce) { .spiega { transition: none !important; } }
