/* Corso di AI sul web (ondata 2, n.55). Un libro di corso tranquillo: una colonna di lettura, carta di giorno e notte
 * di sera, un solo accento (ottone). Il colore viene solo dai token qui sotto; verde e rosso solo per giusto e
 * sbagliato, sempre con un segno e una parola. Contrasti misurati: vedi tests/test_web_corso.py. */

@font-face {
  font-family: "Corso Geist";
  src: url("/static/corso-geist.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Corso Instrument Serif";
  src: url("/static/corso-instrument-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #F6F3EC;
  --surface: #FFFDF8;
  --sunk: #EFEBE2;
  --ink: #1C1B18;
  --muted: #6B665C;
  --line: #E2DCCF;
  --line-strong: #CFC7B6;
  --accent: #8A5A00;
  --on-accent: #FFFDF8;
  --accent-soft: #F3E8D0;
  --chip-b: #E8E3D8;
  --track: #E6E0D3;
  --ok: #2E6A3E;
  --ok-soft: #E3EFE4;
  --bad: #A3352A;
  --bad-soft: #F8E4E0;
  --focus: #8A5A00;
  --font-text: "Corso Geist", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-title: "Corso Instrument Serif", Georgia, "Times New Roman", serif;
  --radius: 14px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --t: 220ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0F13;
    --surface: #17181D;
    --sunk: #121318;
    --ink: #ECE8DF;
    --muted: #A09B90;
    --line: #2A2B31;
    --line-strong: #3A3B42;
    --accent: #E0B560;
    --on-accent: #0E0F13;
    --accent-soft: #2E2616;
    --chip-b: #25262C;
    --track: #2A2B31;
    --ok: #7FC79A;
    --ok-soft: #15261C;
    --bad: #F0907F;
    --bad-soft: #2F1A17;
    --focus: #E0B560;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0F13;
  --surface: #17181D;
  --sunk: #121318;
  --ink: #ECE8DF;
  --muted: #A09B90;
  --line: #2A2B31;
  --line-strong: #3A3B42;
  --accent: #E0B560;
  --on-accent: #0E0F13;
  --accent-soft: #2E2616;
  --chip-b: #25262C;
  --track: #2A2B31;
  --ok: #7FC79A;
  --ok-soft: #15261C;
  --bad: #F0907F;
  --bad-soft: #2F1A17;
  --focus: #E0B560;
}

/* ---- base ---- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (min-width: 900px) {
  body { font-size: 18px; }
}

h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[data-title]:focus-visible { outline: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.corso-noscript { max-width: 660px; margin: 48px auto; padding: 0 20px; }

/* ---- impaginazione ---- */

.corso-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: 100vh;
  min-height: 100dvh;
}

.corso-main.has-dock { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.corso-main.is-session { padding-top: 14px; }

@media (min-width: 900px) {
  .corso-main { padding-top: 56px; }
  .corso-main.is-session { padding-top: 28px; }
}

.corso-loading { color: var(--muted); padding: 40px 0; }

.view { display: flex; flex-direction: column; }
.view.is-entering > * { opacity: 0; transform: translateY(6px); }
.view > * { transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }

/* ---- testo ---- */

.kicker, .label {
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -.005em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

@media (min-width: 900px) {
  .display { font-size: 40px; }
}

.kicker + .display { margin-top: 8px; }

.lead { margin-top: 14px; color: var(--muted); max-width: 60ch; }
.lead + .lead { margin-top: 10px; }

.prose { margin-top: 16px; white-space: pre-line; overflow-wrap: break-word; }
.prose:first-child { margin-top: 0; }

/* ---- bottoni ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.button:hover { border-color: var(--accent); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: default; }

.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { filter: brightness(1.06); }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.quiet:hover { color: var(--ink); border-color: var(--line); }
.button.danger { color: var(--bad); border-color: var(--bad); }
.button.wide { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.link-button, .back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.link-button:hover, .back-button:hover { color: var(--ink); }
.back-button { margin-left: -8px; padding: 0 8px; font-weight: 600; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover { color: var(--ink); background: var(--sunk); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- superfici ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.note-icon { color: var(--accent); margin-top: 1px; }
.note.is-info { color: var(--muted); }

/* ---- avanzamento della sessione ---- */

.corso-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 3px;
  background: var(--track);
}

.corso-progress-fill {
  --p: 0;
  height: 100%;
  background: var(--accent);
  transform: scaleX(var(--p));
  transform-origin: left center;
  transition: transform 240ms var(--ease);
}

/* ---- fondo attaccato al bordo ---- */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
}

.dock-inner {
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dock-inner .button.quiet { min-height: 44px; }
.dock-hint { min-height: 52px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }
.dock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (min-width: 900px) {
  .dock { padding-top: 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ---- soglia ed errori ---- */

.threshold, .failure { padding-top: 12vh; }
.threshold-card { display: flex; gap: 14px; align-items: flex-start; margin-top: 28px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.threshold-icon { color: var(--accent); width: 24px; height: 24px; margin-top: 1px; }

/* ---- inizio ---- */

.home .display { font-size: 42px; }
@media (min-width: 900px) { .home .display { font-size: 52px; } }

.today { margin-top: 28px; }
.card-title {
  margin-top: 6px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.15;
  text-wrap: balance;
}
.card-meta { margin-top: 8px; color: var(--muted); font-size: 15.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.card-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.card-actions .button { flex: 1 1 200px; }

.section { margin-top: 40px; }
.section > .label { margin-bottom: 14px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-number { font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; }

.units { margin: 22px 0 14px; display: flex; flex-direction: column; }
.unit { padding: 10px 0; border-top: 1px solid var(--line); }
.unit:last-child { border-bottom: 1px solid var(--line); }
.unit-top { display: flex; align-items: baseline; gap: 12px; }
.unit-index { width: 20px; flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.unit-name { flex: 1; min-width: 0; font-size: 16px; line-height: 1.4; }
.unit-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.unit.is-soon .unit-name { color: var(--muted); }
.unit .meter { margin: 8px 0 2px 32px; }

.meter { display: block; height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.meter-fill {
  --p: 0;
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(var(--p));
  transform-origin: left center;
}

.foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.privacy { color: var(--muted); font-size: 14px; line-height: 1.55; }
.leave { margin-top: 12px; }
.leave-text { margin-top: 4px; font-size: 15px; }
.leave .actions { margin-top: 12px; }

/* ---- programma ---- */

.topbar { margin-bottom: 18px; }

.module { margin-top: 36px; }
.module-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.module-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 400; }
.module-index { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.module-name { font-family: var(--font-title); font-size: 26px; line-height: 1.15; text-wrap: balance; }
.module-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.module.is-soon .module-name { color: var(--muted); }

.lessons { display: flex; flex-direction: column; }
.lesson { border-bottom: 1px solid var(--line); }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 4px;
  border: 0;
  background: none;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
}
button.lesson-row { cursor: pointer; border-radius: 8px; }
button.lesson-row:hover { background: var(--sunk); }
.lesson-title { flex: 1; min-width: 0; }
.lesson-state { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.lesson-icon { color: var(--muted); }
.lesson.is-fatta .lesson-icon { color: var(--accent); }
.lesson.is-fatta .lesson-state { color: var(--accent); font-weight: 600; }
.lesson.is-corrente .lesson-icon { color: var(--accent); fill: var(--accent); }
.lesson.is-corrente .lesson-title { font-weight: 600; }
.lesson.is-corrente .lesson-state { color: var(--ink); }
.lesson.is-bloccata .lesson-title { color: var(--muted); }

/* ---- schermata di lezione ---- */

.screen-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.screen-title { margin-top: 10px; }
.view.step .screen-title { font-size: 32px; }
@media (min-width: 900px) { .view.step .screen-title { font-size: 36px; } }
.screen-body { margin-top: 18px; }

.reread .screen { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.reread .screen:first-of-type { margin-top: 28px; }
.reread .screen-title { font-family: var(--font-title); font-weight: 400; font-size: 28px; line-height: 1.15; text-wrap: balance; }
.reread .screen-title + .prose { margin-top: 14px; }

.sources { margin-top: 28px; }
.source-list { margin-top: 8px; }
.source-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-size: 15.5px;
  line-height: 1.4;
}
.source-icon { width: 16px; height: 16px; }

/* ---- barra della sessione ---- */

.session-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; min-height: 44px; }
.session-title { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---- domanda ---- */

.question {
  margin-top: 8px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 25px;
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: break-word;
}
@media (min-width: 900px) { .question { font-size: 30px; } }

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.choice {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: start;
  column-gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  font-size: 16.5px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.choice:hover:not(.is-locked) { border-color: var(--accent); }
.choice.is-locked { cursor: default; }
.choice-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: -2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.choice-text { min-width: 0; overflow-wrap: break-word; }
.choice-mark { grid-column: 2; display: none; align-items: center; gap: 6px; margin-top: 6px; font-size: 13.5px; font-weight: 600; }
.choice-mark .ico { width: 18px; height: 18px; }
.choice.is-right { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-right .choice-key { border-color: var(--ok); color: var(--ok); }
.choice.is-right .choice-mark { display: flex; color: var(--ok); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.is-wrong .choice-key { border-color: var(--bad); color: var(--bad); }
.choice.is-wrong .choice-mark { display: flex; color: var(--bad); }
.choice.is-muted { color: var(--muted); }

.feedback { margin-top: 18px; }
.verdict {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  animation: rise 220ms var(--ease);
}
.verdict.is-right { border-color: var(--ok); }
.verdict.is-wrong { border-color: var(--bad); }
.verdict-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.verdict.is-right .verdict-title { color: var(--ok); }
.verdict.is-wrong .verdict-title { color: var(--bad); }
.verdict-label { margin-top: 14px; }
.verdict-label:first-child { margin-top: 0; }
.verdict-why { margin-top: 4px; line-height: 1.55; }
.verdict-again { margin-top: 12px; color: var(--muted); font-size: 14.5px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---- riepilogo ---- */

.summary { align-items: center; text-align: center; padding-top: 10vh; }
.summary-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border: 1.5px solid var(--ok);
  border-radius: 50%;
  color: var(--ok);
}
.summary-mark .ico { width: 34px; height: 34px; }
.summary-score { margin-top: 12px; color: var(--muted); font-size: 18px; font-variant-numeric: tabular-nums; }
.summary-number { color: var(--ink); font-weight: 700; }
.summary-streak { margin-top: 10px; color: var(--accent); font-weight: 600; min-height: 1.6em; }
.summary-pending { margin-top: 16px; justify-content: center; }
.summary-actions { justify-content: center; width: 100%; max-width: 420px; flex-direction: column; }
.summary-actions .button { width: 100%; }

/* =================================================================================================================
 * Laboratori
 * ================================================================================================================= */

.lab {
  margin-top: 26px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 16px;
  line-height: 1.5;
}
@media (min-width: 900px) { .lab { padding: 22px 22px 18px; } }

.lab-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.lab-head { display: flex; align-items: center; gap: 10px; }
.lab-head-icon { color: var(--accent); }
.lab-invite { font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.lab-body { margin-top: 14px; display: flex; flex-direction: column; }
.lab-note { margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.lab-mono { font-variant-numeric: tabular-nums; font-size: 14px; }

.lab-controls { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.lab-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lab-wide:hover:not(:disabled) { border-color: var(--accent); }
.lab-wide:disabled { opacity: .55; cursor: default; }
.lab-wide .lab-icon { color: var(--accent); }

.lab-pill {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunk);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lab-pill:hover { border-color: var(--line-strong); }
.lab-pill.is-on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }

/* 1. prossima parola */

.lab-sentence {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunk);
  font-size: 19px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.lab-word-new {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0 3px;
  animation: rise 200ms var(--ease);
}
.lab-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  vertical-align: -0.2em;
  border-radius: 1px;
  background: var(--accent);
  animation: blink 900ms ease-in-out infinite alternate;
}
@keyframes blink { from { opacity: .25; } to { opacity: 1; } }

.lab-counter { margin-top: 6px; color: var(--muted); font-size: 13px; }
.lab-counter.is-done { color: var(--ok); font-weight: 600; }

.lab-temps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lab-temps-label { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

.lab-options { display: flex; flex-direction: column; gap: 2px; }
.lab-option {
  display: grid;
  grid-template-columns: minmax(0, 7.5em) 1fr 3.4em;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lab-option:hover { background: var(--sunk); }
.lab-option.is-lit { background: var(--accent-soft); border-color: var(--accent); }
.lab-option-word { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-option-pc { text-align: right; }
.lab-track { display: block; height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.lab-fill {
  --p: 0;
  display: block;
  height: 100%;
  width: calc(var(--p) * 100%);
  border-radius: 5px;
  background: var(--accent);
  transition: width 240ms var(--ease);
}

/* 2. token */

.lab-phrases { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 4px 3px; }
.lab-chip {
  min-height: 44px;
  min-width: 30px;
  padding: 8px 7px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  white-space: pre;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lab-chip.is-a { background: var(--accent-soft); }
.lab-chip.is-b { background: var(--chip-b); }
.lab-chip.is-on { border-color: var(--accent); }
.lab-count { margin-top: 12px; }
.lab-detail { min-height: 1.5em; margin-top: 6px; font-size: 14.5px; }
.lab-detail-label { color: var(--muted); }
.lab-detail-piece { color: var(--accent); font-weight: 700; font-size: 15.5px; white-space: pre; }

/* 3. finestra */

.lab-window-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lab-window-title { color: var(--muted); font-size: 14px; }
.lab-usage { font-weight: 600; }
.lab-usage.is-full { color: var(--bad); }

.lab-bar {
  position: relative;
  display: flex;
  height: 60px;
  margin-top: 6px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sunk);
  overflow: hidden;
}
.lab-bar-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.lab-seg {
  --w: 10%;
  flex: 0 1 var(--w);
  min-width: 0;
  margin: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.15;
  transition: flex-basis 240ms var(--ease), opacity 220ms var(--ease), transform 240ms var(--ease), margin 240ms var(--ease), padding 240ms var(--ease);
}
.lab-seg.is-a { background: var(--accent-soft); }
.lab-seg.is-b { background: var(--chip-b); }
.lab-seg.is-fixed { background: var(--accent-soft); border-color: var(--accent); }
.lab-seg.is-needed { box-shadow: inset 0 0 0 1.5px var(--ok); border-color: var(--ok); }
.lab-seg.is-entering { opacity: 0; transform: translateX(10px); }
.lab-seg.is-leaving { flex-basis: 0; margin: 2px 0; padding: 0; border-width: 0; opacity: 0; transform: translateX(-24px); }
.lab-seg-lock { width: 12px; height: 12px; stroke-width: 2; }
.lab-seg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-seg.is-narrow .lab-seg-name { display: none; }

.lab-ends { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: 12px; }
.lab-inside { min-height: 1.45em; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.lab-gone { min-height: 1.6em; margin-top: 4px; color: var(--bad); font-size: 14px; font-weight: 500; }

.lab-question { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; transition: border-color 200ms var(--ease), background-color 200ms var(--ease); }
.lab-question-text { font-size: 15px; }
.lab-question-status { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 600; font-size: 14.5px; }
.lab-question-icon { display: inline-flex; }
.lab-question.is-vede { border-color: var(--ok); background: var(--ok-soft); }
.lab-question.is-vede .lab-question-status { color: var(--ok); }
.lab-question.is-uscito { border-color: var(--bad); background: var(--bad-soft); }
.lab-question.is-uscito .lab-question-status { color: var(--bad); }
.lab-question.is-attesa .lab-question-status { color: var(--muted); }

/* 4. vero o inventato */

.lab-source { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); }
.lab-source-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lab-source-text { margin-top: 4px; font-size: 15.5px; line-height: 1.55; }
.lab-mark { background: var(--ok-soft); color: var(--ink); font-weight: 600; border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--ok); }

.lab-claims { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.lab-claim {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: none;
  text-align: left;
  font-size: 15px;
  line-height: 1.45;
  cursor: pointer;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lab-claim:hover { border-color: var(--line-strong); }
.lab-claim-icon { margin-top: 1px; color: var(--muted); }
.lab-claim-texts { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lab-claim-verdict { font-size: 13.5px; font-weight: 600; }
.lab-claim.is-found { border-color: var(--ok); }
.lab-claim.is-found .lab-claim-icon, .lab-claim.is-found .lab-claim-verdict { color: var(--ok); }
.lab-claim.is-made { border-color: var(--bad); }
.lab-claim.is-made .lab-claim-icon, .lab-claim.is-made .lab-claim-verdict { color: var(--bad); }
.lab-claim.is-found.is-active { background: var(--ok-soft); }
.lab-claim.is-made.is-active { background: var(--bad-soft); }
.lab-tally { margin-top: 8px; color: var(--muted); font-size: 13.5px; }

/* ---- movimento ridotto: tutto fermo ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .lab-cursor { opacity: 1; }
}
