/* Pagine extra del portale (glossario, quiz, articolo, mappa del corso) e collegamenti iniettati da extra.js.
   Stesso linguaggio visivo del portale: token di tokens.css, card e pillole di portale.css. */
:root { --x-acc: var(--accent, #4f46e5); --x-acc2: var(--accent-bg, #eef2ff); }
.x-back { display: inline-flex !important; }
.x-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 16px; border-radius: 12px; background: var(--x-acc); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.x-btn .lucide { width: 17px; height: 17px; }
.x-btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.x-btn:hover { filter: brightness(1.05); } .x-btn.ghost:hover { border-color: var(--x-acc); color: var(--x-acc); }
.x-ic { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.x-ic .lucide { width: 18px; height: 18px; } .x-ic:hover { border-color: var(--x-acc); color: var(--x-acc); }

/* collegamenti aggiunti nelle pagine corso e lezione */
.x-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 2px; }
.x-row a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 7px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.x-row a .lucide { width: 16px; height: 16px; color: var(--x-acc); } .x-row a:hover { border-color: var(--x-acc); }
/* pagina lezione: pulsante Articolo nella barra e riga di pulsanti nella scheda Lezione */
.x-top-art { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font: 600 13.5px/1 var(--font, Inter, sans-serif); flex: 0 0 auto; }
.x-top-art .lucide { width: 16px; height: 16px; color: var(--x-acc); } .x-top-art:hover { border-color: var(--x-acc); }
.x-top-art.x-hide { display: none !important; }
html.pt-phone .x-top-art, html.pt-landscape .x-top-art { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; border-radius: 50%; gap: 0; }
html.pt-phone .x-top-art span, html.pt-landscape .x-top-art span { display: none; }
html.pt-phone .x-top-art .lucide, html.pt-landscape .x-top-art .lucide { width: 20px; height: 20px; }
.x-lesson-links { display: flex; flex-wrap: wrap; gap: 8px; }
.x-lesson-links a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 auto; min-height: 42px; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.x-lesson-links a .lucide { width: 16px; height: 16px; color: var(--x-acc); flex: 0 0 auto; } .x-lesson-links a:hover { border-color: var(--x-acc); }
html.pt-phone .x-lesson-links a { min-height: 46px; font-size: 14.5px; }

/* ricerca e filtri */
.x-tools { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.x-search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; min-height: 48px; }
.x-search:focus-within { border-color: var(--x-acc); box-shadow: 0 0 0 3px var(--x-acc2); }
.x-search .lucide { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.x-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; outline: none; min-height: 44px; }
.x-search input::-webkit-search-cancel-button { display: none; }
.x-clear { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; } .x-clear:hover { background: var(--bg); }
.x-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.x-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; min-height: 34px; cursor: pointer; text-transform: capitalize; }
.x-chip.on { background: var(--x-acc2); color: var(--x-acc); border-color: var(--x-acc); font-weight: 600; }

/* glossario */
.x-letters-wrap { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 8px; padding-bottom: 8px; }
.x-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.x-letters a { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 13px; }
.x-letters a:hover { background: var(--x-acc2); color: var(--x-acc); } .x-letters a.off { color: var(--line); pointer-events: none; }
.x-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding-bottom: 20px; }
.x-letter { grid-column: 1 / -1; margin: 18px 0 0; font-size: 22px; color: var(--x-acc); scroll-margin-top: 70px; }
.x-letter + .x-letter { display: none; }
button.x-voce { display: flex; gap: 12px; text-align: left; white-space: normal; align-items: flex-start; justify-content: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; color: inherit; font: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 72px; }
.x-voce:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(15, 23, 42, .10); border-color: var(--x-acc); }
.x-voce.hidden { display: none; }
.x-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: 0 0 64px; border: 1px solid var(--line); }
.x-voce-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.x-voce-t { font-weight: 700; font-size: 16px; } .x-voce-v { color: var(--muted); font-size: 12.5px; }
.x-cat { font-size: 11.5px; color: var(--x-acc); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.x-voce-d { color: var(--muted); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.x-none { margin: 10px 0 30px; }
/* scheda intera della voce: finestra su PC, foglio dal basso sul telefono */
.x-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 95; opacity: 0; transition: opacity .18s; }
.x-bg.on { opacity: 1; }
.x-sheet { position: fixed; z-index: 96; background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(15, 23, 42, .35); overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.98); width: min(720px, calc(100vw - 32px)); max-height: min(86vh, 900px); border-radius: 20px; padding: 22px 24px 26px; opacity: 0; transition: opacity .18s, transform .18s; }
.x-sheet.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.x-sheet .handle { display: none; }
.x-sheet-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.x-sheet-x .lucide { width: 18px; height: 18px; }
.x-sheet-top { display: flex; gap: 16px; align-items: flex-start; padding-right: 44px; }
.x-sheet-img { width: 112px; height: 112px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); flex: 0 0 112px; cursor: zoom-in; }
.x-sheet h2 { margin: 0 0 4px; font-size: 24px; line-height: 1.2; outline: none; } .x-sheet .x-cat { display: inline-block; margin-top: 4px; }
.x-sheet .x-var { color: var(--muted); font-size: 13.5px; margin: 2px 0 0; }
.x-sheet .x-def { font-size: 16px; line-height: 1.6; margin: 14px 0 0; }
.x-sheet h4 { margin: 18px 0 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.x-sheet p { margin: 0; line-height: 1.6; font-size: 15px; }
.x-credit { color: var(--muted); font-size: 12px; margin-top: 6px; } .x-credit a { color: inherit; }
.x-pairs { display: flex; flex-wrap: wrap; gap: 8px; }
.x-pair { display: inline-flex; flex-direction: column; align-items: flex-start; white-space: normal; gap: 2px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 8px 12px; color: var(--text); text-decoration: none; font: inherit; cursor: pointer; text-align: left; max-width: 100%; }
.x-pair b { font-size: 14px; } .x-pair small { color: var(--muted); font-size: 12.5px; }
.x-pair.link:hover { border-color: var(--x-acc); color: var(--x-acc); } .x-pair.plain { cursor: default; }
.x-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.x-tags a, .x-tags button { font: inherit; font-size: 13px; border-radius: 999px; padding: 6px 12px; min-height: 34px; background: var(--x-acc2); color: var(--x-acc); border: 0; text-decoration: none; cursor: pointer; font-weight: 600; }
.x-lez { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.x-lez a { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--x-acc); text-decoration: none; min-height: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 10px; }
.x-lez a .lucide { width: 15px; height: 15px; }

/* quiz */
.x-quiz { padding-top: 6px; padding-bottom: 14px; }
.x-qcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px 22px; max-width: 760px; }
.x-prog { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.x-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; } .x-bar i { display: block; height: 100%; background: var(--x-acc); border-radius: 3px; transition: width .3s; }
.x-qtext { font-size: 19px; line-height: 1.4; font-weight: 600; margin: 0 0 16px; }
.x-opts { display: flex; flex-direction: column; gap: 10px; }
button.x-opt { display: flex; align-items: flex-start; justify-content: flex-start; gap: 12px; width: 100%; text-align: left; white-space: normal; background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 52px; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.4; cursor: pointer; transition: border-color .15s, background .15s; }
.x-opt:hover:not(:disabled) { border-color: var(--x-acc); }
.x-opt .l { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--muted); margin-top: -2px; }
.x-opt:disabled { cursor: default; opacity: .92; }
.x-opt.ok { border-color: var(--ok, #16a34a); background: var(--ok-bg, #ecfdf5); } .x-opt.ok .l { background: var(--ok, #16a34a); color: #fff; border-color: transparent; }
.x-opt.ko { border-color: var(--err, #dc2626); background: var(--err-bg, #fef2f2); } .x-opt.ko .l { background: var(--err, #dc2626); color: #fff; border-color: transparent; }
.x-expl { margin-top: 16px; background: var(--x-acc2); border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.55; }
.x-expl b { display: block; margin-bottom: 4px; } .x-expl .ref { display: block; color: var(--muted); font-size: 13px; margin-top: 8px; }
.x-qnav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.x-meta { color: var(--muted); font-size: 12.5px; text-transform: capitalize; }
.x-score { text-align: center; padding: 10px 0 4px; }
.x-score .big { font-size: 46px; font-weight: 800; color: var(--x-acc); line-height: 1; } .x-score .big small { font-size: 20px; color: var(--muted); font-weight: 600; }
.x-score p { color: var(--muted); margin: 8px 0 0; }
.x-errs { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.x-err { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14.5px; line-height: 1.5; }
.x-err b { display: block; margin-bottom: 4px; } .x-err .wrong { color: var(--err, #dc2626); } .x-err .right { color: var(--ok, #16a34a); font-weight: 600; }
.x-start { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.x-start .x-best { color: var(--muted); font-size: 14px; }
.x-past-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding-bottom: 20px; }
button.x-past-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; white-space: normal; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font: inherit; color: inherit; cursor: pointer; }
.x-past-btn span { color: var(--muted); font-size: 13px; } .x-past-btn:hover { border-color: var(--x-acc); }

/* scorrimento: tokens.css mette overflow hidden sul body (il browser lo propaga alla finestra), giusto per l'app e per la
   pagina lezione ma non per le pagine che si leggono: qui si rimette lo scorrimento, anche col dito. */
html body.pt:not(.pt-shell):not(.full):not(.lesson-page) { height: auto !important; min-height: 100vh; overflow: visible !important; touch-action: auto; position: static; }

/* articolo: colonna di lettura centrata, come una rivista; solo caratteri di sistema */
.x-art, .x-art-body, .x-art h1, .x-sub, .x-quote { font-family: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.pt-page > article.x-art { width: 100%; max-width: 720px; margin: 0 auto; box-sizing: border-box; padding: 0 24px 40px; }
.x-art-head { text-align: center; padding: 40px 0 4px; }
.x-eyebrow { font: 600 12.5px/1.3 var(--font, Inter, sans-serif); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.x-art h1 { font-weight: 700; font-size: 40px; line-height: 1.15; letter-spacing: -.012em; margin: 14px 0 12px; color: var(--text); }
.x-sub { font-style: italic; font-size: 20px; line-height: 1.4; color: var(--text-2, var(--text)); margin: 0 0 14px; }
.x-art-meta { font: 400 13.5px/1.4 var(--font, Inter, sans-serif); color: var(--muted); margin: 0; }
.x-rule { width: 90px; height: 1px; border: 0; background: var(--line-2, var(--line)); margin: 18px auto; }
.x-links { font: 500 13.5px/1.5 var(--font, Inter, sans-serif); color: var(--muted); margin: 0; text-align: center; }
.x-links a { color: var(--x-acc); text-decoration: none; font-weight: 600; } .x-links a:hover { text-decoration: underline; }
.x-links.end { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.x-fig { margin: 0 0 1.5em; } .x-fig.open { margin: 26px 0 30px; }
.x-fig-btn { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; border-radius: 16px; overflow: hidden; }
.x-fig img { display: block; width: 100%; height: auto; border-radius: 16px; }
.x-fig figcaption { margin-top: 9px; text-align: center; font: 400 13px/1.45 var(--font, Inter, sans-serif); color: var(--muted); }
.x-fig figcaption small { display: block; font-size: 12px; color: var(--faint, var(--muted)); margin-top: 3px; } .x-fig figcaption a { color: inherit; }
.x-art-body { font-size: 18px; line-height: 1.65; color: var(--text-2, var(--text)); }
.x-lead { font-size: 19.5px; line-height: 1.55; color: var(--text); margin: 0 0 1.2em; }
.x-art-body p { margin: 0 0 1em; text-indent: 0; } .x-art-body p:last-child { margin-bottom: 0; }
.x-art-body h2 { font-size: 26px; line-height: 1.25; font-weight: 700; color: var(--text); margin: 1.5em 0 .5em; text-align: left; }
.x-art-body h3 { font-size: 20px; line-height: 1.3; font-weight: 700; color: var(--text); margin: 1.3em 0 .4em; }
.x-art-body ul { padding-left: 22px; margin: 0 0 1em; } .x-art-body li { margin: .25em 0; }
.x-quote { margin: 1.7em auto; padding: 18px 12px; max-width: 600px; border-top: 1px solid var(--line-2, var(--line)); border-bottom: 1px solid var(--line-2, var(--line)); text-align: center; font-style: italic; font-size: 20px; line-height: 1.5; color: var(--text); background: transparent; border-left: 0; border-radius: 0; }
.x-boxes { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 30px; font-family: var(--font, Inter, sans-serif); }
.x-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; }
.x-box h3 { margin: 0 0 8px; font: 700 12.5px/1.2 var(--font, Inter, sans-serif); letter-spacing: .06em; text-transform: uppercase; color: var(--x-acc); }
.x-box ul { margin: 0; padding-left: 20px; font-size: 15.5px; line-height: 1.55; color: var(--text); } .x-box li { margin: .3em 0; }
.x-box-2 { background: var(--x-acc2); border-color: transparent; }
@media (max-width: 900px) {
  .pt-page > article.x-art { max-width: none; padding: 0 20px 36px; }
  .x-art-head { padding-top: 22px; }
  .x-art h1 { font-size: 30px; } .x-sub { font-size: 18px; } .x-art-meta { font-size: 13px; }
  .x-art-body { font-size: 17px; } .x-lead { font-size: 18px; } .x-art-body h2 { font-size: 23px; } .x-quote { font-size: 18.5px; padding: 14px 6px; }
  .x-fig.open { margin: 18px 0 24px; }
}

/* mappa del corso */
body.pt.x-mappa .pt-page > .x-map { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: none; padding: 0; }
.x-map-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; z-index: 6; }
.x-map-head .x-back { color: var(--text); margin: 0; min-height: 40px; gap: 6px; }
.x-map-title { display: flex; align-items: baseline; gap: 10px; } .x-map-title h1 { font-size: 18px; margin: 0; }
.x-map-search { flex: 1 1 260px; min-height: 42px; border-radius: 12px; }
.x-map-tools { display: flex; gap: 6px; }
.x-results { position: absolute; left: 14px; right: 14px; top: calc(100% - 4px); max-height: min(60vh, 520px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); padding: 8px; z-index: 50; }
.x-results h5 { margin: 8px 8px 4px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
button.x-res { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; width: 100%; text-align: left; white-space: normal; background: transparent; border: 0; border-radius: 10px; padding: 9px 10px; font: inherit; color: var(--text); cursor: pointer; min-height: 44px; }
.x-res:hover, .x-res.sel { background: var(--x-acc2); } .x-res b { font-weight: 600; } .x-res mark { background: var(--mark, #fde68a); color: inherit; border-radius: 3px; padding: 0 2px; }
.x-res small { color: var(--muted); font-size: 12.5px; }
.x-res-none { padding: 12px; color: var(--muted); font-size: 14px; }
.x-map-body { flex: 1; min-height: 0; position: relative; background: var(--bg); background-image: radial-gradient(var(--grid-dot, #d7dbe3) 1px, transparent 1px); background-size: 22px 22px; }
.x-map-body svg { width: 100%; height: 100%; display: block; touch-action: none; }
.x-map-body svg .markmap-node > foreignObject, .x-map-body svg .markmap-node div { font-family: var(--font, Inter, sans-serif); color: var(--text); }
.x-map-body .ic { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; margin-right: 4px; color: currentColor; }
.x-res .ic { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; margin-right: 3px; }
.x-map-body svg .markmap-node.x-hit > foreignObject { animation: x-pulse 2.4s ease-out; }
@keyframes x-pulse { 0% { filter: drop-shadow(0 0 0 var(--x-acc)); } 20% { filter: drop-shadow(0 0 12px var(--x-acc)); } 100% { filter: none; } }
.x-map-legend { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--card); scrollbar-width: thin; }
.x-leg { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px 6px 6px; font: inherit; font-size: 13px; color: var(--text); white-space: nowrap; cursor: pointer; min-height: 36px; }
.x-leg i { width: 24px; height: 24px; border-radius: 50%; background: var(--x-acc); color: #fff; font-style: normal; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.x-leg:hover { border-color: var(--x-acc); }
html.lz-fs-on .x-map-body, .x-map-body:fullscreen { background: var(--bg); }

/* telefono */
@media (max-width: 900px) {
  .x-grid { grid-template-columns: 1fr; }
  .x-letters-wrap { top: 0; }
  .x-sheet { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 88vh; max-height: 88dvh; transform: translateY(12px); border-radius: 20px 20px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); }
  .x-sheet.on { transform: translateY(0); }
  .x-sheet.on { transform: translateY(0) scale(1); }
  .x-sheet .handle { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 12px; }
  .x-sheet-x { top: 10px; right: 10px; }
  .x-sheet-img { width: 88px; height: 88px; flex-basis: 88px; }
  .x-qcard { padding: 16px; border-radius: 16px; }
  .x-qtext { font-size: 18px; } .x-opt { min-height: 54px; font-size: 16px; }
  .x-map-head { padding: 8px 10px; gap: 8px; }
  .x-map-title { display: none; }
  .x-map-search { flex: 1 1 140px; min-height: 40px; }
  .x-results { left: 8px; right: 8px; }
  .x-leg span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
}
