/* ============================================================
   adgent EDU — stili (brand ADGENT, dark-first, responsive)
   Token da ADGENT-brand-kit/source/design-tokens.json
   ============================================================ */

:root {
  --edu: #13B8B1;
  --edu-strong: #7DD8D4;
  --edu-tint-light: #E7F8F7;
  --edu-tint-dark: #0A363B;
  --grad-a: #4C3DFF;
  --grad-b: #E6007E;
  --ink: #0A0E1A;
  --ink-2: #101728;
  --ink-3: #182236;
  --paper: #F8F9FB;
  --white: #FFFFFF;
  --muted: #A2A8B5;
  --muted-dark: #5B6472;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #EDF1F7;
  --text-dim: #B9C1CE;
  --bg: var(--ink);
  --bg-card: rgba(255, 255, 255, 0.04);
  --ok: #20B65A;
  --warn: #F2B600;
  --bad: #FF5470;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px;
  --t-fast: 150ms; --t-norm: 220ms; --t-slow: 320ms;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: var(--paper);
    --bg-card: rgba(10, 14, 26, 0.03);
    --line: rgba(10, 14, 26, 0.09);
    --line-strong: rgba(10, 14, 26, 0.16);
    --text: #131A2A;
    --text-dim: #455062;
    --muted: #5B6472;
    --shadow: 0 18px 40px rgba(19, 26, 42, 0.12);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--edu); color: #fff; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.02em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-lockup img.wm { height: 17px; display: block; }
.pill-edu {
  font-family: var(--font-head); font-weight: 700; font-size: 13px;
  color: #fff; background: linear-gradient(120deg, var(--edu), #0d8f89);
  padding: 3px 11px; border-radius: 999px; letter-spacing: 0.04em;
}
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav-links a { text-decoration: none; color: var(--text-dim); font-size: 14.5px; transition: color var(--t-fast); }
.nav-links a:hover { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: 999px; text-decoration: none;
  font-family: var(--font-head); font-weight: 700; letter-spacing: 0.01em;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, filter var(--t-fast);
  user-select: none;
}
.btn-primary {
  background: linear-gradient(120deg, var(--edu) 0%, #0FA39D 100%);
  color: #fff; padding: 14px 28px; font-size: 16px;
  box-shadow: 0 10px 30px rgba(19, 184, 177, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(19, 184, 177, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; color: var(--text); padding: 13px 24px; font-size: 15px;
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { border-color: var(--edu); color: var(--edu); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 60px; }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--edu-strong);
  background: color-mix(in srgb, var(--edu-tint-dark) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--edu) 35%, transparent);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--edu); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.hero h1 { font-size: clamp(38px, 5.4vw, 62px); font-weight: 700; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--edu-strong), var(--edu));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.sub { margin-top: 18px; font-size: 18px; color: var(--text-dim); max-width: 34em; }
.hero-cta { display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 20px; margin-top: 26px; flex-wrap: wrap; }
.hero-meta span { font-size: 13.5px; color: var(--muted); display: inline-flex; gap: 7px; align-items: center; }
.hero-meta b { color: var(--text-dim); font-weight: 600; }

.hero-orb-wrap { position: relative; display: grid; place-items: center; min-height: 380px; }
.hero-orb-wrap canvas { filter: drop-shadow(0 24px 60px rgba(19, 184, 177, 0.25)); }
.float-chip {
  position: absolute; font-size: 13px; font-weight: 600; color: var(--text);
  background: color-mix(in srgb, var(--ink-2) 82%, transparent);
  border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 9px 14px; box-shadow: var(--shadow);
  animation: floaty 5s ease-in-out infinite;
}
.float-chip small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.fc-1 { top: 8%; left: 2%; animation-delay: 0s; }
.fc-2 { bottom: 16%; right: 0%; animation-delay: 1.4s; }
.fc-3 { top: 46%; left: -4%; animation-delay: 2.6s; }
@keyframes floaty { 50% { transform: translateY(-9px); } }

/* ---------- sezioni ---------- */
section.block { padding: 72px 0; }
.sec-head { max-width: 640px; margin-bottom: 44px; }
.sec-head .kicker {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--edu);
}
.sec-head h2 { font-size: clamp(28px, 3.6vw, 40px); margin-top: 10px; }
.sec-head p { margin-top: 12px; color: var(--text-dim); font-size: 16.5px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step {
  position: relative; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px 24px 24px;
  transition: transform var(--t-norm), border-color var(--t-norm);
}
.step:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--edu) 45%, var(--line)); }
.step .n {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--edu), #0d8f89); margin-bottom: 16px;
}
.step h3 { font-size: 19px; margin-bottom: 8px; }
.step p { color: var(--text-dim); font-size: 14.5px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feat {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; transition: transform var(--t-norm), border-color var(--t-norm);
}
.feat:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--edu) 45%, var(--line)); }
.feat .ico {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--edu-tint-dark) 75%, transparent);
  color: var(--edu-strong); margin-bottom: 14px;
}
.feat .ico svg { width: 22px; height: 22px; }
.feat h3 { font-size: 17px; margin-bottom: 7px; }
.feat p { color: var(--text-dim); font-size: 14px; }

.levels-strip {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
}
.level-chip {
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 9px 18px;
  transition: all var(--t-fast);
}
.level-chip:hover { color: var(--edu-strong); border-color: var(--edu); transform: translateY(-2px); }

.cta-band {
  margin: 30px 0 80px; border-radius: var(--r-xl); padding: 56px 40px; text-align: center;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(19, 184, 177, 0.18), transparent),
    radial-gradient(500px 260px at 85% 100%, rgba(76, 61, 255, 0.14), transparent),
    var(--ink-2);
  border: 1px solid var(--line);
}
.cta-band h2 { font-size: clamp(26px, 3.4vw, 38px); }
.cta-band p { color: var(--text-dim); margin: 12px auto 28px; max-width: 36em; }

footer.site { border-top: 1px solid var(--line); padding: 34px 0 44px; }
.foot-in { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.foot-in .fam { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }
.foot-in a { color: var(--muted); text-decoration: none; font-size: 13.5px; }
.foot-in a:hover { color: var(--edu-strong); }
.foot-note { margin-top: 14px; font-size: 12.5px; color: var(--muted-dark); }

/* reveal on scroll — enhancement: il contenuto è SEMPRE visibile, l'animazione
   parte solo se il JS aggiunge html.js-anim (così nessun fallback nasconde la pagina) */
.reveal { opacity: 1; transform: none; }
html.js-anim .reveal { opacity: 0; transform: translateY(18px); transition: opacity var(--t-slow) ease, transform var(--t-slow) ease; }
html.js-anim .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js-anim .reveal { opacity: 1; transform: none; transition: none; }
  .float-chip { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   APP /app
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
/* v0.9.9: colonna — le scorciatoie home stanno SOPRA il wizard (prima era
   flex row e i due blocchi finivano affiancati) */
.app-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 40px 20px 60px; }

.wizard { width: 100%; max-width: 720px; }
.wiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.wiz-top .back { background: none; border: none; color: var(--text-dim); font-size: 14px; display: inline-flex; gap: 6px; align-items: center; padding: 8px; border-radius: 8px; }
.wiz-top .back:hover { color: var(--text); background: var(--bg-card); }
.progress { flex: 1; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 33%; border-radius: 99px; background: linear-gradient(90deg, var(--edu), var(--edu-strong)); transition: width var(--t-slow) ease; }
.wiz-step-label { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.panel { display: none; animation: panelIn var(--t-slow) ease; }
.panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

.q-title { font-size: 24px; margin-bottom: 6px; }
.q-sub { color: var(--text-dim); font-size: 14.5px; margin-bottom: 22px; }

.group-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.gtab {
  border: 1px solid var(--line-strong); background: transparent; color: var(--text-dim);
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  transition: all var(--t-fast);
}
.gtab:hover { color: var(--text); border-color: var(--edu); }
.gtab.on { background: var(--edu); border-color: var(--edu); color: #fff; }

.class-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.cchip {
  min-width: 64px; border: 1px solid var(--line-strong); background: var(--bg-card);
  color: var(--text); border-radius: var(--r-md); padding: 14px 10px; text-align: center;
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  transition: all var(--t-fast);
}
.cchip small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11px; color: var(--muted); margin-top: 3px; }
.cchip:hover { border-color: var(--edu); }
.cchip.on { background: color-mix(in srgb, var(--edu) 16%, transparent); border-color: var(--edu); color: var(--edu-strong); box-shadow: 0 0 0 1px var(--edu) inset; }

.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-dim); margin: 20px 0 8px; }
.field input[type="text"], .field input[type="password"] {
  width: 100%; background: var(--bg-card); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: var(--r-md); padding: 14px 16px; font-size: 15px;
  font-family: inherit; outline: none; transition: border-color var(--t-fast);
}
.field input:focus { border-color: var(--edu); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 26px 20px; text-align: center; color: var(--text-dim); cursor: pointer;
  transition: all var(--t-fast); background: var(--bg-card);
}
.dropzone:hover, .dropzone.drag { border-color: var(--edu); color: var(--edu-strong); background: color-mix(in srgb, var(--edu) 7%, transparent); }
.dropzone svg { width: 30px; height: 30px; margin-bottom: 8px; color: var(--edu); }
.dropzone b { color: var(--text); font-size: 14.5px; }
.dropzone small { display: block; margin-top: 4px; font-size: 12.5px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.thumb { position: relative; width: 86px; height: 86px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 12px; line-height: 1;
  display: grid; place-items: center;
}

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card {
  position: relative; text-align: left; background: var(--bg-card);
  border: 2px solid var(--line); border-radius: var(--r-lg); padding: 22px;
  color: var(--text); transition: all var(--t-fast);
}
.mode-card:hover { border-color: color-mix(in srgb, var(--edu) 60%, var(--line)); transform: translateY(-2px); }
.mode-card.on { border-color: var(--edu); background: color-mix(in srgb, var(--edu) 10%, transparent); }
.mode-card .big { font-size: 30px; margin-bottom: 10px; }
.mode-card h3 { font-size: 18px; margin-bottom: 6px; }
.mode-card p { color: var(--text-dim); font-size: 13.5px; }

.voice-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.vcard {
  flex: 1; min-width: 130px; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 14px; text-align: left; color: var(--text);
  transition: all var(--t-fast);
}
.vcard:hover { border-color: var(--edu); }
.vcard.on { border-color: var(--edu); background: color-mix(in srgb, var(--edu) 12%, transparent); }
.vcard b { font-family: var(--font-head); font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.vcard b i { width: 8px; height: 8px; border-radius: 50%; background: var(--edu); }
.vcard small { color: var(--muted); font-size: 12px; }

.wiz-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; gap: 14px; }
.summary-line { font-size: 13px; color: var(--muted); }
.err-msg {
  display: none; margin-top: 14px; background: rgba(255, 84, 112, 0.1);
  border: 1px solid rgba(255, 84, 112, 0.4); color: #ffb3c0;
  padding: 12px 16px; border-radius: var(--r-md); font-size: 14px;
}
.err-msg.show { display: block; }

/* ---------- sessione live ---------- */
.live { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column;
        background: radial-gradient(900px 500px at 50% -10%, rgba(19, 184, 177, 0.10), transparent), var(--ink); }
.live.on { display: flex; }
.live.light-bg { background: radial-gradient(900px 500px at 50% -10%, rgba(19, 184, 177, 0.08), transparent), var(--paper); }

.live-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.prof-id { display: flex; align-items: center; gap: 11px; }
.prof-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 17px;
}
.prof-id b { font-family: var(--font-head); font-size: 15.5px; display: block; }
.state-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); background: var(--bg-card); border: 1px solid var(--line);
  padding: 4px 12px; border-radius: 999px; margin-top: 2px;
}
.state-pill .sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); transition: background var(--t-fast); }
.state-pill[data-state="listening"] .sdot { background: var(--ok); animation: blink 1.4s infinite; }
.state-pill[data-state="thinking"] .sdot { background: var(--warn); animation: blink 0.8s infinite; }
.state-pill[data-state="speaking"] .sdot { background: var(--edu-strong); animation: blink 0.6s infinite; }
.live-actions { margin-left: auto; display: flex; gap: 9px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--bg-card); color: var(--text); display: grid; place-items: center;
  transition: all var(--t-fast); position: relative;
}
.icon-btn:hover { border-color: var(--edu); color: var(--edu-strong); }
.icon-btn.off { color: var(--bad); border-color: rgba(255, 84, 112, 0.5); }
.icon-btn.danger { color: #fff; background: rgba(255, 84, 112, 0.16); border-color: rgba(255, 84, 112, 0.5); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--edu); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* #3 mobile: overflow-y:auto — se il contenuto (es. scelte CAA) supera il viewport
   deve SCROLLARE invece di uscire dallo schermo. Centraggio quando il contenuto è
   corto: pseudo-elementi con margin auto (robusto anche con figli display:none
   come #qCount, dove il trick margin:auto sul last-child reale non funzionerebbe). */
.live-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 12px 20px; min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.live-center::before, .live-center::after { content: ''; flex: 0 0 auto; }
.live-center::before { margin-top: auto; }
.live-center::after { margin-bottom: auto; }
.orb-stage { position: relative; display: grid; place-items: center; }
.caption-live {
  max-width: 760px; text-align: center; font-size: clamp(17px, 2.4vw, 23px);
  font-weight: 500; color: var(--text); min-height: 2.6em; margin-top: 26px;
  text-wrap: balance; transition: opacity var(--t-norm);
}
.caption-user {
  max-width: 700px; text-align: center; font-size: 15px; color: var(--muted);
  min-height: 1.5em; margin-top: 10px; font-style: italic;
}
.qcount {
  margin-top: 18px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--edu-strong); text-transform: uppercase; display: none;
}
.qcount.show { display: block; }

.drawer {
  position: fixed; z-index: 110; background: color-mix(in srgb, var(--ink-2) 96%, transparent);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transform: translateX(105%); transition: transform var(--t-slow) ease;
  display: flex; flex-direction: column; border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.drawer.open { transform: none; }
.drawer.transcript { top: 74px; right: 0; bottom: 0; width: min(400px, 92vw); }
.drawer.photos { top: 74px; right: 0; bottom: 0; width: min(360px, 92vw); }
.drawer header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.drawer header button { margin-left: auto; }
.tlist { overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tmsg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; }
.tmsg.user { align-self: flex-end; background: color-mix(in srgb, var(--edu) 18%, transparent); border: 1px solid color-mix(in srgb, var(--edu) 35%, transparent); border-bottom-right-radius: 4px; }
.tmsg.bot { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.photo-add { padding: 12px 16px; border-top: 1px solid var(--line); }
.phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 14px 16px; overflow-y: auto; }
.phgrid .thumb { width: 100%; height: 96px; }

/* card voto */
.vote-overlay {
  position: fixed; inset: 0; z-index: 200; display: none; place-items: center;
  background: rgba(5, 8, 16, 0.72); backdrop-filter: blur(8px); padding: 20px;
}
.vote-overlay.on { display: grid; }
.vote-card {
  width: min(480px, 94vw); background: var(--ink-2); border: 1px solid var(--line-strong);
  border-radius: var(--r-xl); padding: 34px 30px; text-align: center; box-shadow: var(--shadow);
  animation: voteIn var(--t-slow) cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes voteIn { from { opacity: 0; transform: translateY(26px) scale(0.92); } to { opacity: 1; } }
.vote-card .vlabel { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.vote-num {
  font-family: var(--font-head); font-weight: 700; font-size: 84px; line-height: 1;
  margin: 10px 0 4px;
  background: linear-gradient(120deg, var(--edu-strong), var(--edu));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.vote-num.bad { background: linear-gradient(120deg, #ff8fa3, var(--bad)); -webkit-background-clip: text; background-clip: text; }
.vote-num.good { background: linear-gradient(120deg, #7CF2B4, var(--ok)); -webkit-background-clip: text; background-clip: text; }
.vote-mot { color: var(--text-dim); font-size: 15px; margin: 8px 0 20px; }
.vote-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin-bottom: 24px; }
.vote-col { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; }
.vote-col h4 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.vote-col.plus h4 { color: var(--ok); }
.vote-col.minus h4 { color: var(--warn); }
.vote-col ul { list-style: none; }
.vote-col li { font-size: 13px; color: var(--text-dim); padding: 3px 0 3px 16px; position: relative; }
.vote-col li::before { content: '›'; position: absolute; left: 2px; color: var(--muted); }
.vote-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink-3); color: var(--text); border: 1px solid var(--line-strong);
  padding: 12px 20px; border-radius: 999px; font-size: 14px; z-index: 300;
  opacity: 0; transition: all var(--t-slow); pointer-events: none; box-shadow: var(--shadow);
  max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ============================================================
   MODALITÀ CAA — pittogrammi ARASAAC sincronizzati alla voce
   ============================================================ */

/* ---- toggle nel wizard (step 3) ---- */
.caa-toggle {
  display: flex; width: 100%; gap: 14px; align-items: flex-start; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px; color: var(--text); transition: all var(--t-fast); margin-top: 18px;
}
.caa-toggle:hover { border-color: var(--edu); }
.caa-toggle.on { border-color: var(--edu); background: color-mix(in srgb, var(--edu) 10%, transparent); }
.caa-toggle-ico {
  width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: color-mix(in srgb, var(--edu) 14%, transparent); color: var(--edu-strong); flex: 0 0 auto;
}
.caa-toggle-ico svg { width: 22px; height: 22px; }
.caa-toggle-txt b { font-family: var(--font-head); font-size: 15px; display: block; }
.caa-toggle-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.45; display: block; margin-top: 3px; }
.caa-toggle .switch {
  margin-left: auto; flex: 0 0 auto; width: 40px; height: 22px; border-radius: 99px;
  background: var(--line-strong); position: relative; transition: background var(--t-fast);
}
.caa-toggle .switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform var(--t-fast);
}
.caa-toggle.on .switch { background: var(--edu); }
.caa-toggle.on .switch::after { transform: translateX(18px); }
.caa-credit { display: block; margin-top: 8px; font-size: 11.5px; color: var(--muted); }

/* ---- bottone preferenze in live (solo con CAA attiva) ---- */
.live .caa-btn { display: none; }
.live.caa-on .caa-btn { display: grid; }

/* orb ridotto per lasciare spazio ai simboli */
.live.caa-on .orb-stage { transform: scale(0.78); transition: transform var(--t-slow) ease; }

/* ---- box pittogrammi ---- */
.caa-box {
  display: none; width: min(720px, 94vw); margin-top: 14px;
  background: var(--bg-card); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  padding: 12px;
  /* v0.9.3: ancora per la pallina cursore (assoluta dentro .caa-box, che non
     scorre: il box interno #caaRows è quello che scrolla) */
  position: relative;
}
.caa-box.on { display: block; }
/* #3+#14: full-bleed in live — la striscia di lettura occupa quasi tutto lo schermo */
.live.caa-on .caa-box { width: min(calc(100vw - 32px), 1500px); }
.caa-rows {
  overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start;
  align-items: center; gap: 6px 7px;
  max-height: clamp(220px, 52vh, 640px); padding-right: 4px; scrollbar-width: thin;
}
/* #14: le frasi scorrono come testo (riga piena, a capo solo per larghezza
   o cambio sezione); lo scorrimento e il karaoke si agganciano ai tile */
.caa-row { display: contents; }
.caa-sep { flex: 0 0 var(--caa-sep-w, 58px); height: 2px; }
.caa-box { --caa-sep-w: 58px; }
.caa-box[data-size="s"] { --caa-sep-w: 48px; }
.caa-box[data-size="l"] { --caa-sep-w: 76px; }
/* #2/#14 karaoke: riga display:contents → l'accento passa ai tile.
   Frase corrente alzata con ombra più decisa, parola corrente con anello edu;
   le frasi già dette si attenuano poco (0.78), mai il «troppo scuro». */
.caa-row.is-spoken .caa-tile { opacity: 0.78; }
.caa-row.cur .caa-tile {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}
.caa-row.cur .caa-tile.cur {
  border-color: var(--edu);
  background: color-mix(in srgb, var(--edu) 16%, var(--white));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--edu) 45%, transparent);
  transform: translateY(-2px) scale(1.06);
}
.caa-row .caa-wait { width: 46px; height: 20px; border-radius: 99px; background: var(--line); }
/* #14: divisore di sezione a tutta riga (forza il a capo) con titolo + pittogrammi */
.caa-sec {
  flex: 0 0 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 4px 4px; min-height: 0;
}
.caa-sec::before, .caa-sec::after {
  content: ""; flex: 1 1 24px; height: 1px; background: var(--line-strong);
}
.caa-sec-title {
  font-family: var(--font-head); font-weight: 800; font-size: 14px;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink);
  white-space: nowrap;
}
.caa-sec-pictos { display: flex; gap: 5px; align-items: center; }
.caa-sec-pictos .caa-tile {
  min-width: 0; padding: 4px 7px; flex-direction: row; gap: 5px;
}
.caa-sec-pictos .caa-tile img { width: 26px; height: 26px; }
.caa-sec-pictos .caa-tile b { font-size: 11px; max-width: none; white-space: nowrap; }
.caa-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: var(--white); border: 1px solid rgba(10, 14, 26, 0.12);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  border-radius: var(--r-sm); padding: 7px 10px; min-width: 64px;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
}
.caa-tile img { width: 46px; height: 46px; object-fit: contain; }
.caa-tile b {
  font-size: 12px; font-weight: 700; color: var(--ink-2); max-width: 104px;
  text-transform: uppercase; letter-spacing: 0.03em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.caa-tile.txt { justify-content: center; min-width: 0; padding: 5px 8px; }
.caa-tile.txt b {
  font-size: 12px; max-width: none; white-space: normal; overflow: visible; text-overflow: clip;
  letter-spacing: 0.02em;
}
.caa-tile.cur {
  border-color: var(--edu); background: color-mix(in srgb, var(--edu) 16%, var(--white));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--edu) 45%, transparent);
  transform: scale(1.06);
}
body.caa-calm .caa-tile.cur { transform: none; }
body.caa-calm .caa-row.cur .caa-tile,
body.caa-calm .caa-row.cur .caa-tile.cur { transform: none; }
.caa-tile.cur b { color: var(--ink); }
.caa-box[data-size="s"] .caa-tile { min-width: 52px; }
.caa-box[data-size="s"] .caa-tile img { width: 34px; height: 34px; }
.caa-box[data-size="l"] .caa-tile { min-width: 80px; }
.caa-box[data-size="l"] .caa-tile img { width: 60px; height: 60px; }
/* v0.9.3: pallina cursore karaoke — sta SOPRA la figura della parola corrente.
   Fuori dal flusso (#caaRows scrolla, lei resta ancorata a .caa-box) e fuori
   dai click; il rimbalzo attira lo sguardo, il viaggio tra i tile è smooth. */
.caa-cursor {
  position: absolute; left: 0; top: 0;
  width: 34px; height: 34px;
  opacity: 0; pointer-events: none; z-index: 6;
  /* NIENTE transizione su transform: quando #caaRows scorre le tile salgono
     all'istante, e una pallina "smooth" con 0.22s di ritardo resta sotto la
     figura coprendola. Deve SALTARE in sincrono, sempre appena sopra. */
  transition: opacity var(--t-fast, 0.15s) ease;
}
.caa-cursor.on { opacity: 1; }
.caa-cursor::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--edu);
  border: 3px solid var(--white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
  animation: caa-bounce 0.9s ease-in-out infinite;
}
@keyframes caa-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* ---- scelte cliccabili (risposta a simboli) ---- */
.caa-choices { display: none; gap: 10px; margin-top: 12px; }
.caa-choices.on { display: flex; flex-wrap: wrap; justify-content: center; }
.caa-choice {
  flex: 1 1 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  background: var(--white); border: 2px solid var(--edu);
  border-radius: var(--r-md); padding: 12px 10px; color: var(--ink-2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); transition: all var(--t-fast);
}
.caa-choice:hover { border-color: var(--edu-strong); transform: translateY(-2px); }
.caa-choice.sel { background: color-mix(in srgb, var(--edu) 14%, var(--white)); }
.caa-choice .caa-ch-pictos { display: flex; gap: 6px; }
.caa-choice img { width: 42px; height: 42px; object-fit: contain; }
.caa-choice .caa-ch-txt {
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
}

/* ---- drawer preferenze CAA ---- */
.drawer.caa { top: 74px; right: 0; bottom: 0; width: min(360px, 92vw); }
.caa-prefs { display: flex; flex-direction: column; gap: 18px; padding: 18px 16px; overflow-y: auto; }
.pref-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-dim); }
.pref-row label small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 10px; color: var(--text-dim); font-size: 13px; font-weight: 600; transition: all var(--t-fast);
}
.seg button.on { border-color: var(--edu); color: var(--text); background: color-mix(in srgb, var(--edu) 12%, transparent); }
.pref-row input[type="range"] { width: 100%; accent-color: var(--edu); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row label { margin: 0; flex: 1; }
.switch-input {
  appearance: none; width: 44px; height: 24px; border-radius: 99px; background: var(--line-strong);
  position: relative; transition: background var(--t-fast); cursor: pointer; flex: 0 0 auto;
}
.switch-input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform var(--t-fast);
}
.switch-input:checked { background: var(--edu); }
.switch-input:checked::after { transform: translateX(20px); }
.caa-note {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
}
.caa-attrib { font-size: 11.5px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 12px; }
.caa-attrib a { color: var(--edu-strong); }

/* ---- modalità calma: niente animazioni, tutto prevedibile ---- */
body.caa-calm .state-pill .sdot { animation: none; }
body.caa-calm .caa-tile, body.caa-calm .caa-row, body.caa-calm .caa-choice,
body.caa-calm .caa-toggle, body.caa-calm .seg button { transition: none; }
body.caa-calm .orb-stage { transform: scale(0.78); }

/* ---- #5 bottone «Rileggi» (testa del box CAA, touch ≥ 48px) ---- */
.caa-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.caa-repeat {
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid var(--edu); background: color-mix(in srgb, var(--edu) 14%, transparent);
  color: var(--edu-strong); font-family: var(--font-head); font-weight: 700;
  font-size: 14px; letter-spacing: 0.05em;
  display: inline-flex; align-items: center; gap: 8px; transition: all var(--t-fast);
}
.caa-repeat:hover:not([disabled]) { background: color-mix(in srgb, var(--edu) 28%, transparent); transform: translateY(-1px); }
.caa-repeat:active:not([disabled]) { transform: none; }
.caa-repeat[disabled] { opacity: 0.45; cursor: default; }
body.caa-calm .caa-repeat { transition: none; }
body.caa-calm .caa-repeat:hover:not([disabled]) { transform: none; }

/* ---- #6 nota «microfono spento» in modalità CAA ---- */
.caa-mic-note {
  display: block; margin-top: 10px; max-width: 700px; text-align: center;
  font-size: 13px; line-height: 1.45; color: var(--text-dim);
  background: color-mix(in srgb, var(--edu) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--edu) 30%, transparent);
  border-radius: var(--r-md); padding: 9px 14px;
}
/* il display:block autoriale batte la regola UA [hidden]: serve l'override esplicito */
.caa-mic-note[hidden] { display: none; }

@media (max-width: 960px) {
  .drawer.caa {
    top: auto; height: 62vh; width: 100vw; left: 0; right: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(105%);
  }
  .drawer.caa.open { transform: none; }
}
@media (max-width: 620px) {
  .live.caa-on .orb-stage { transform: scale(0.62); }
  .caption-live { margin-top: 12px; }
  .caa-tile { min-width: 54px; padding: 5px 6px; }
  .caa-tile img { width: 40px; height: 40px; }
  .caa-box[data-size="l"] .caa-tile img { width: 52px; height: 52px; }
  /* #3: scelte sempre comode da toccare anche a 5 opzioni su 375px */
  .caa-choices { gap: 12px; }
  .caa-choice { min-width: 132px; }
  .caa-repeat { padding: 0 18px; font-size: 13px; }
  .caa-mic-note { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .caa-tile, .caa-row, .caa-choice, .caa-toggle, .seg button { transition: none; }
  .caa-cursor { transition: none; }
  .caa-cursor::before { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-orb-wrap { min-height: 320px; order: -1; }
  .steps, .features { grid-template-columns: 1fr 1fr; }
  .drawer.transcript, .drawer.photos { top: auto; height: 62vh; width: 100vw; left: 0; right: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(105%); }
  .drawer.open { transform: none; }
}
@media (max-width: 620px) {
  .nav-links a.hide-m { display: none; }
  .hero { padding: 40px 0 30px; }
  .steps, .features { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .vote-cols { grid-template-columns: 1fr; }
  .btn-primary { width: 100%; }
  .wiz-actions { flex-direction: column-reverse; }
  .wiz-actions .btn { width: 100%; }
  .caption-live { font-size: 16.5px; }
  .live-top { padding: 10px 12px; }
  .prof-avatar { width: 36px; height: 36px; font-size: 15px; }
}

/* ============================================================
   V0.3.0 — SSO, fine lezione, riepilogo CAA, storia
   ============================================================ */
body.auth-checking .app-main,
body.auth-checking .nav { visibility: hidden; }

/* ---- nav ---- */
.nav-link {
  background: none; border: 1px solid transparent; color: var(--text-dim);
  font-size: 14.5px; font-family: inherit; padding: 7px 12px; border-radius: 999px;
  cursor: pointer; transition: all var(--t-fast);
}
.nav-link:hover { color: var(--edu-strong); border-color: var(--line-strong); }

/* ---- gate login SSO ---- */
.login-gate {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(19, 184, 177, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, rgba(230, 0, 126, 0.12), transparent 55%),
    var(--bg);
  padding: 20px;
}
/* `display:grid` sopra batta la regola UA `[hidden]{display:none}`: senza
   questo il gate resta visibile anche da loggato (bug 29/08 «torna a ADGENT»). */
.login-gate[hidden] { display: none !important; }
.login-card {
  width: min(420px, 94vw); text-align: center; background: var(--ink-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  padding: 40px 32px; box-shadow: var(--shadow);
}
.login-card .wm { height: 40px; margin-bottom: 18px; }
.login-card h1 { font-family: var(--font-head); font-size: 24px; margin: 0 0 10px; }
.login-card p { color: var(--text-dim); font-size: 14.5px; line-height: 1.55; margin: 0 0 24px; }
.login-card .btn { width: 100%; }
.login-help {
  display: inline-block; margin-top: 18px; color: var(--muted); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px;
}
.login-help:hover { color: var(--edu-strong); }

/* ---- pulsante FINE LEZIONE (live) ---- */
.end-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid rgba(255, 84, 112, 0.55);
  background: linear-gradient(120deg, rgba(255, 84, 112, 0.28), rgba(255, 84, 112, 0.14));
  color: #fff; font-weight: 700; font-size: 13.5px; letter-spacing: 0.04em;
  font-family: var(--font-head); cursor: pointer; transition: all var(--t-fast);
}
.end-btn svg { width: 16px; height: 16px; }
.end-btn:hover {
  transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255, 84, 112, 0.35);
  border-color: var(--bad);
}

/* ---- storia ---- */
.storia { width: 100%; max-width: 720px; }
.storia-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.storia-head .btn { align-self: flex-start; margin-bottom: 6px; }
.storia-list { display: flex; flex-direction: column; gap: 12px; }
.storia-item {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px;
}
.storia-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.storia-topic { font-size: 16px; }
.storia-voto { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--edu-strong); }
.storia-top-right { display: flex; align-items: center; gap: 8px; }
.storia-full { font-size: 12px; font-weight: 700; color: var(--edu-strong); background: rgba(19, 184, 177, 0.14); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.storia-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.storia-pending { color: var(--warn); font-style: italic; }
.storia-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.storia-actions .btn { padding: 8px 14px; font-size: 13px; }
.storia-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.storia-empty .big { font-size: 52px; margin-bottom: 12px; }
.storia-empty p { line-height: 1.6; margin-bottom: 20px; }

/* ---- pannello fine lezione ---- */
.end-overlay {
  position: fixed; inset: 0; z-index: 260; display: grid; place-items: center;
  background: rgba(5, 8, 16, 0.74); backdrop-filter: blur(8px); padding: 20px;
}
/* `display:grid` sopra batta la regola UA `[hidden]{display:none}`: senza
   questo il pannello NON si può chiudere (stesso bug del .login-gate). */
.end-overlay[hidden] { display: none !important; }
.end-card {
  width: min(560px, 96vw); background: var(--ink-2); border: 1px solid var(--line-strong);
  border-radius: var(--r-xl); padding: 34px 30px 28px; position: relative;
  box-shadow: var(--shadow); animation: voteIn var(--t-slow) cubic-bezier(0.2, 0.9, 0.3, 1.2);
  max-height: 92vh; overflow-y: auto;
}
.end-close {
  position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--bg-card); color: var(--muted);
  font-size: 15px; cursor: pointer; transition: all var(--t-fast);
}
.end-close:hover { color: var(--bad); border-color: var(--bad); }
.end-check {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--ok), #149347);
  box-shadow: 0 10px 26px rgba(32, 182, 90, 0.4);
}
.end-title { text-align: center; font-family: var(--font-head); font-size: 24px; margin: 0 0 4px; }
.end-topic { text-align: center; color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }
.end-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.end-meta div { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 12px; }
.end-meta b { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.end-meta span { font-size: 14px; }
.end-status {
  display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--text-dim);
  font-size: 14px; padding: 14px 0 2px; min-height: 44px;
}
.spinner {
  width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line-strong);
  border-top-color: var(--edu); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.end-body h3 {
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 18px 0 10px;
}
.end-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.end-tile {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 6px; text-align: center;
}
.end-tile img { width: 40px; height: 40px; object-fit: contain; margin-bottom: 4px; }
.end-tile b { display: block; font-size: 11.5px; line-height: 1.2; }
.end-summary-tiles { display: flex; flex-direction: column; gap: 14px; }
.end-sent { display: flex; flex-direction: column; gap: 5px; }
.end-sent .end-tiles { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.end-sent .end-tile { padding: 7px 4px; }
.end-sent .end-tile img { width: 34px; height: 34px; }
.end-sent .end-tile b { font-size: 10.5px; }
.end-sent-txt {
  font-size: 12.5px; color: var(--text-dim); text-align: center; padding: 0 4px;
}
.end-summary {
  font-size: 15px; line-height: 1.6; color: var(--text-dim); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
  white-space: pre-line;
}
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.end-actions .btn { width: 100%; padding: 12px 8px; font-size: 13.5px; }
@media (max-width: 460px) {
  .end-meta { grid-template-columns: 1fr; }
  .end-actions { grid-template-columns: 1fr; }
}

/* ================= #11 Materiali: compiti assegnati + lancio materiale ==== */
.assign-strip { margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.assign-strip[hidden] { display: none; }
.assign-strip .assign-head {
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 6px 0 2px;
}
.assign-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid rgba(19, 184, 177, 0.35);
  border-radius: var(--r-md); padding: 12px 16px;
}
.assign-card b { font-family: var(--font-display); }
.assign-card .assign-mode { font-size: 12.5px; color: var(--text-dim); }
.assign-card .btn { margin-left: auto; }

.material-launch { max-width: 720px; margin: 0 auto; }
.material-launch .ml-card {
  background: var(--bg-card); border: 1px solid var(--line-accent, var(--line));
  border-radius: var(--r-lg, 20px); padding: 30px 26px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.btn-mlaunch { font-size: 18px; padding: 16px 42px; margin-top: 8px; }

/* ---- landing: dimostrazione a simboli (#12) ---- */
.picto-demo {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 0 auto 14px; max-width: 840px; padding: 18px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(19, 184, 177, 0.06), rgba(19, 184, 177, 0.02));
}
.picto-demo .caa-tile { min-width: 74px; }
.picto-demo .caa-tile img { width: 54px; height: 54px; }
.picto-demo .caa-tile.txt { min-width: 0; padding: 5px 12px; }
.picto-demo .caa-tile.cur { animation: picto-pulse 2.8s ease-in-out infinite; }
@keyframes picto-pulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--edu) 45%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--edu) 26%, transparent); }
}
.picto-caption {
  text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6;
  max-width: 42em; margin: 0 auto 34px;
}
@media (prefers-reduced-motion: reduce) {
  .picto-demo .caa-tile.cur { animation: none; }
}

/* ============================================================
   V0.9.5 — Impostazioni + Account + menu mobile + admin LLM
   ============================================================ */
/* ---- nav: hamburger, tagline, avatar ---- */
.nav-menu-btn { display: none; }
.nav-tag { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.nav-avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, color-mix(in srgb, var(--edu) 35%, transparent), color-mix(in srgb, var(--edu-strong) 18%, transparent));
  color: var(--edu-strong); font-family: var(--font-head); font-weight: 700; font-size: 16px;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.nav-avatar:hover { border-color: var(--edu); transform: translateY(-1px); }
/* display:grid (sopra) sovrascrive la regola UA [hidden]; guardia esplicita */
.nav-avatar[hidden] { display: none; }
/* v0.9.6: tutto in «La tua area» → barra solo logo + avatar a destra */
body.app-shell .nav-tag { margin-right: auto; }

/* ---- menu mobile: pannello sotto la barra (SOLO nell'app) ---- */
@media (max-width: 760px) {
  body.app-shell .nav-menu-btn { display: inline-flex; margin-left: auto; }
  body.app-shell .nav-menu-btn[hidden] { display: none; }
  body.app-shell .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: color-mix(in srgb, var(--bg-2) 96%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
    padding: 10px 14px 14px; display: none; z-index: 60;
  }
  body.app-shell .nav-links.open { display: flex; }
  body.app-shell .nav-tag { display: none; }
  body.app-shell .nav-links a.nav-link, body.app-shell .nav-links button.nav-link {
    text-align: left; padding: 12px 14px; font-size: 15px; width: 100%;
  }
  body.app-shell .nav-avatar { margin-left: auto; width: 44px; height: 44px; font-size: 18px; }
}
@media (min-width: 761px) {
  .nav-menu-btn { display: none !important; }
}

/* ---- La tua area (v0.9.7): pagina utente a schermo intero ---- */
/* v0.9.8 FIX LEGGIBILITÀ (#16): tutte le superfici SCURE fisse (drawer, card
   voto, pannello fine lezione, picker) restano scure anche con tema di sistema
   light. Prima: prefers-color-scheme:light scuriva --text mentre lo sfondo
   restava var(--ink-2) scuro → testo scuro su scuro (la «pagina illeggibile»).
   Le variabili light vengono ri-schiarite dentro ogni superficie dark. */
.drawer, .vote-card, .end-card, .login-card, .mp-panel {
  --bg: var(--ink);
  --bg-card: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #EDF1F7;
  --text-dim: #B9C1CE;
  --muted: #A2A8B5;
  --muted-dark: #5B6472;
  /* Necessario: color eredita come valore calcolato dal body (che col tema
     light di sistema è scuro) — i figli senza color proprio NON ri-risolvono
     var(--text) dallo scope qui sopra. Ridichiarandolo qui, tutta la discendenza
     erede la versione chiara. */
  color: var(--text);
}
.drawer.settings {
  top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;
  border-radius: 0; border-left: none; background: var(--ink-2);
  /* v0.9.7: non scivolare da destra (sembrava un menu laterale): il foglio si
     apre come una pagina, con un fade pulito */
  transform: none; opacity: 0; visibility: hidden;
  transition: opacity var(--t-norm) ease, visibility 0s linear var(--t-norm);
}
.drawer.settings.open { opacity: 1; visibility: visible; transition: opacity var(--t-norm) ease; }
.ss-top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink-3) 55%, var(--ink-2));
  position: sticky; top: 0; z-index: 5;
}
.drawer.settings header.ss-top button { margin-left: 0; }
.ss-back { flex: none; }
.ss-title { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ss-title b { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.ss-title small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-body {
  overflow-y: auto; padding: 10px 22px 34px; flex: 1;
  max-width: 720px; width: 100%; margin: 0 auto;
}
.set-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.set-effective {
  margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--edu) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--edu) 28%, transparent);
  color: var(--edu-strong); font-size: 12.5px; line-height: 1.5;
}

/* ---- Hub «La tua area» (v0.9.8): profilo in testa + card grandi ---- */
.hub-profile {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 4px 22px; margin-bottom: 6px;
}
.hub-avatar {
  width: 58px; height: 58px; flex: none; font-size: 24px; border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--edu) 38%, transparent), color-mix(in srgb, var(--edu-strong) 20%, transparent));
  color: var(--edu-strong); display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700;
}
.hub-profile-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.hub-profile-txt b { font-family: var(--font-head); font-size: 21px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-profile-txt small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-logout {
  flex: none; border: none; background: none; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 999px;
  transition: color var(--t-fast), background var(--t-fast);
}
.hub-logout:hover { color: #e5484d; background: color-mix(in srgb, #e5484d 10%, transparent); }

.hub-eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin: 22px 4px 12px;
}

/* card grandi: le destinazioni sono oggetti, non righe di lista */
.user-menu.hub-grid, .hub-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 560px) { .user-menu.hub-grid, .hub-grid { grid-template-columns: 1fr; } }
.um-row.hub-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px; cursor: pointer; position: relative;
  text-align: left; color: var(--text); font-family: inherit;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.um-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.um-row.hub-card:hover {
  border-color: color-mix(in srgb, var(--edu) 45%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--edu) 45%, transparent);
}
.um-row.hub-card .um-ico {
  width: 44px; height: 44px; font-size: 21px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--edu) 22%, transparent), color-mix(in srgb, var(--edu-strong) 10%, transparent));
}
.um-txt b { font-size: 15.5px; }
.hub-badge {
  align-self: flex-start; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 12px; font-weight: 700;
  color: var(--edu-strong); background: color-mix(in srgb, var(--edu) 14%, transparent);
  border-radius: 999px; padding: 4px 11px;
}
.hub-badge:empty { display: none; }
.hub-admin[hidden] { display: none; }
.hub-card-admin .um-ico {
  background: color-mix(in srgb, var(--text-dim) 10%, transparent);
}
.hub-card-admin:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px -14px rgba(0, 0, 0, 0.5);
}

/* ---- Scorciatoie home (v0.9.9): Storia e Materiali tornano in pagina ---- */
/* v0.9.9: .app-main è flex column con align-items:center — questi blocchi
   altrimenti si stringerebbero al contenuto invece di prendere la larghezza */
.assign-strip, .material-launch { width: 100%; }
.home-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  width: 100%; max-width: 720px; margin-bottom: 22px;
}
.home-links[hidden] { display: none; }
.home-link {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 15px 18px; color: var(--text);
  font-family: inherit; cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.home-link:hover {
  border-color: color-mix(in srgb, var(--edu) 45%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--edu) 45%, transparent);
}
.home-link .h-ico {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  font-size: 20px; border-radius: 13px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--edu) 22%, transparent), color-mix(in srgb, var(--edu-strong) 10%, transparent));
}
.home-link .h-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-link .h-txt b { font-size: 15.5px; }
.home-link .h-txt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 620px) {
  .home-links { grid-template-columns: 1fr; }
}

/* picker modello (v0.9.8: la card nel grid apre il foglio a schermo intero) */
.model-picker { position: relative; display: flex; flex-direction: column; }
.mp-panel {
  /* v0.9.7: foglio a schermo intero OPACO (prima il pannello assoluto usava
     --bg-card al 3-4% di alpha → trasparente, sovrapposto al resto, illeggibile) */
  position: fixed; inset: 0; z-index: 200;
  background: var(--ink-2); border: none;
  display: flex; flex-direction: column;
  animation: mpIn var(--t-fast) ease;
}
.mp-panel[hidden] { display: none; }
@keyframes mpIn { from { opacity: 0; } to { opacity: 1; } }
.mp-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink-3) 55%, var(--ink-2));
}
.mp-head-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mp-head-t b { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.mp-head-t small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-tools { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
#mpSearch {
  width: 100%; background: var(--ink-3); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: var(--r-md); padding: 10px 12px; font-size: 14px;
  font-family: inherit; outline: none; transition: border-color var(--t-fast);
}
#mpSearch:focus { border-color: var(--edu); }
.mp-filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mp-chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.mp-chk input { accent-color: var(--edu); width: 15px; height: 15px; }
#mpSort {
  background: var(--ink-3); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: var(--r-sm); padding: 7px 9px; font-size: 12.5px; font-family: inherit; outline: none;
}
.mp-list { flex: 1; overflow-y: auto; padding: 8px 10px 26px; max-height: none; }
.mp-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 9px 10px; cursor: pointer; text-align: left; color: var(--text); font-family: inherit;
}
.mp-row:hover { background: color-mix(in srgb, var(--edu) 8%, transparent); }
.mp-row.sel { background: color-mix(in srgb, var(--edu) 12%, transparent); border-color: color-mix(in srgb, var(--edu) 35%, transparent); }
.mp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-row-id { font-size: 13.5px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mp-row-id small { font-size: 11.5px; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.mp-row-meta { flex: none; display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 45%; }
.mp-chip { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.mp-chip-price { background: color-mix(in srgb, var(--edu-strong) 14%, transparent); color: var(--edu-strong); }
.mp-chip-ctx { background: color-mix(in srgb, var(--text-dim) 12%, transparent); color: var(--text-dim); }
.mp-chip-img { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #f59e0b; }
.mp-check { flex: none; color: var(--edu-strong); font-size: 15px; font-weight: 700; }
