/* ==========================================================================
   1. Stili delle dispense originali (copiati dai file modulo-*.html; body ridefinito sotto)
   ========================================================================== */
  :root {
  --text-primary: #1a1a18;
  --text-secondary: #5f5e5a;
  --text-tertiary: #88877f;
  --bg-primary: #ffffff;
  --bg-secondary: #f6f5f0;
  --bg-tertiary: #eeedeb;
  --border: rgba(0,0,0,0.15);
  --border-hover: rgba(0,0,0,0.3);
}
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #e8e6de;
    --text-secondary: #b4b2a9;
    --text-tertiary: #888780;
    --bg-primary: #1a1a18;
    --bg-secondary: #2c2c2a;
    --bg-tertiary: #3d3d3a;
    --border: rgba(255,255,255,0.15);
    --border-hover: rgba(255,255,255,0.3);
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
.card {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 32px;
  max-width: 780px;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
h1 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}
svg { width: 100%; height: auto; }

/* === SVG Design System Classes === */

/* Text classes */
.t  { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; fill: var(--text-primary); }
.ts { font-family: system-ui, -apple-system, sans-serif; font-size: 12px; fill: var(--text-secondary); }
.th { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; fill: var(--text-primary); font-weight: 500; }

/* Neutral box */
.box { fill: var(--bg-secondary); stroke: var(--border); stroke-width: 0.5px; }

/* Arrow */
.arr { stroke: var(--text-secondary); stroke-width: 1.5px; fill: none; }

/* Leader line */
.leader { stroke: var(--text-tertiary); stroke-width: 0.5px; stroke-dasharray: 4 3; fill: none; }

/* Clickable node */
.node { cursor: pointer; transition: opacity 0.15s; }
.node:hover { opacity: 0.82; }

/* === Color Ramp Classes (light mode) === */
.c-purple > rect, .c-purple > circle, .c-purple > ellipse { fill: #EEEDFE; stroke: #534AB7; }
.c-purple > .th, .c-purple > text.th { fill: #3C3489; }
.c-purple > .ts, .c-purple > text.ts { fill: #534AB7; }
.c-purple > .t,  .c-purple > text.t  { fill: #3C3489; }

.c-teal > rect, .c-teal > circle, .c-teal > ellipse { fill: #E1F5EE; stroke: #0F6E56; }
.c-teal > .th, .c-teal > text.th { fill: #085041; }
.c-teal > .ts, .c-teal > text.ts { fill: #0F6E56; }
.c-teal > .t,  .c-teal > text.t  { fill: #085041; }

.c-coral > rect, .c-coral > circle, .c-coral > ellipse { fill: #FAECE7; stroke: #993C1D; }
.c-coral > .th, .c-coral > text.th { fill: #712B13; }
.c-coral > .ts, .c-coral > text.ts { fill: #993C1D; }
.c-coral > .t,  .c-coral > text.t  { fill: #712B13; }

.c-pink > rect, .c-pink > circle, .c-pink > ellipse { fill: #FBEAF0; stroke: #993556; }
.c-pink > .th, .c-pink > text.th { fill: #72243E; }
.c-pink > .ts, .c-pink > text.ts { fill: #993556; }
.c-pink > .t,  .c-pink > text.t  { fill: #72243E; }

.c-gray > rect, .c-gray > circle, .c-gray > ellipse { fill: #F1EFE8; stroke: #5F5E5A; }
.c-gray > .th, .c-gray > text.th { fill: #444441; }
.c-gray > .ts, .c-gray > text.ts { fill: #5F5E5A; }
.c-gray > .t,  .c-gray > text.t  { fill: #444441; }

.c-blue > rect, .c-blue > circle, .c-blue > ellipse { fill: #E6F1FB; stroke: #185FA5; }
.c-blue > .th, .c-blue > text.th { fill: #0C447C; }
.c-blue > .ts, .c-blue > text.ts { fill: #185FA5; }
.c-blue > .t,  .c-blue > text.t  { fill: #0C447C; }

.c-green > rect, .c-green > circle, .c-green > ellipse { fill: #EAF3DE; stroke: #3B6D11; }
.c-green > .th, .c-green > text.th { fill: #27500A; }
.c-green > .ts, .c-green > text.ts { fill: #3B6D11; }
.c-green > .t,  .c-green > text.t  { fill: #27500A; }

.c-amber > rect, .c-amber > circle, .c-amber > ellipse { fill: #FAEEDA; stroke: #854F0B; }
.c-amber > .th, .c-amber > text.th { fill: #633806; }
.c-amber > .ts, .c-amber > text.ts { fill: #854F0B; }
.c-amber > .t,  .c-amber > text.t  { fill: #633806; }

.c-red > rect, .c-red > circle, .c-red > ellipse { fill: #FCEBEB; stroke: #A32D2D; }
.c-red > .th, .c-red > text.th { fill: #791F1F; }
.c-red > .ts, .c-red > text.ts { fill: #A32D2D; }
.c-red > .t,  .c-red > text.t  { fill: #791F1F; }

/* === Dark mode overrides === */
@media (prefers-color-scheme: dark) {
  .c-purple > rect, .c-purple > circle, .c-purple > ellipse { fill: #3C3489; stroke: #AFA9EC; }
  .c-purple > .th, .c-purple > text.th { fill: #CECBF6; }
  .c-purple > .ts, .c-purple > text.ts { fill: #AFA9EC; }

  .c-teal > rect, .c-teal > circle, .c-teal > ellipse { fill: #085041; stroke: #5DCAA5; }
  .c-teal > .th, .c-teal > text.th { fill: #9FE1CB; }
  .c-teal > .ts, .c-teal > text.ts { fill: #5DCAA5; }

  .c-coral > rect, .c-coral > circle, .c-coral > ellipse { fill: #712B13; stroke: #F0997B; }
  .c-coral > .th, .c-coral > text.th { fill: #F5C4B3; }
  .c-coral > .ts, .c-coral > text.ts { fill: #F0997B; }

  .c-pink > rect, .c-pink > circle, .c-pink > ellipse { fill: #72243E; stroke: #ED93B1; }
  .c-pink > .th, .c-pink > text.th { fill: #F4C0D1; }
  .c-pink > .ts, .c-pink > text.ts { fill: #ED93B1; }

  .c-gray > rect, .c-gray > circle, .c-gray > ellipse { fill: #444441; stroke: #B4B2A9; }
  .c-gray > .th, .c-gray > text.th { fill: #D3D1C7; }
  .c-gray > .ts, .c-gray > text.ts { fill: #B4B2A9; }

  .c-blue > rect, .c-blue > circle, .c-blue > ellipse { fill: #0C447C; stroke: #85B7EB; }
  .c-blue > .th, .c-blue > text.th { fill: #B5D4F4; }
  .c-blue > .ts, .c-blue > text.ts { fill: #85B7EB; }

  .c-green > rect, .c-green > circle, .c-green > ellipse { fill: #27500A; stroke: #97C459; }
  .c-green > .th, .c-green > text.th { fill: #C0DD97; }
  .c-green > .ts, .c-green > text.ts { fill: #97C459; }

  .c-amber > rect, .c-amber > circle, .c-amber > ellipse { fill: #633806; stroke: #EF9F27; }
  .c-amber > .th, .c-amber > text.th { fill: #FAC775; }
  .c-amber > .ts, .c-amber > text.ts { fill: #EF9F27; }

  .c-red > rect, .c-red > circle, .c-red > ellipse { fill: #791F1F; stroke: #F09595; }
  .c-red > .th, .c-red > text.th { fill: #F7C1C1; }
  .c-red > .ts, .c-red > text.ts { fill: #F09595; }
}

.card { max-width: 860px; }
.card p, .card li, .card td, .card th, .card summary { font-size: 14px; line-height: 1.6; color: var(--text-primary); }
.card h2 { font-size: 16px; font-weight: 500; color: var(--text-primary); margin: 32px 0 10px; padding-top: 16px; border-top: 0.5px solid var(--border); }
.card h3 { font-size: 14px; font-weight: 500; color: var(--text-primary); margin: 18px 0 6px; }
.card p { margin: 6px 0 10px; }
.card ul, .card ol { margin: 6px 0 12px 22px; }
.card li { margin: 3px 0; }
.muted { color: var(--text-secondary) !important; }
.goal { background: var(--bg-secondary); border-radius: 8px; padding: 12px 16px; border: 0.5px solid var(--border); }
.formula { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 6px 0 10px; color: var(--text-primary); overflow-x: auto; }
.fig { margin: 14px 0 6px; }
.figcap { font-size: 12px; color: var(--text-tertiary); margin: 2px 0 14px; }
.tblwrap { overflow-x: auto; margin: 8px 0 14px; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 0.5px solid var(--border); padding: 6px 10px; text-align: left; }
thead th { background: var(--bg-secondary); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
details { background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 6px 0 12px; }
summary { cursor: pointer; font-weight: 500; color: var(--text-secondary) !important; }
details[open] summary { margin-bottom: 6px; }
.ex { margin: 10px 0 2px; }
.ex b { font-weight: 500; }
.timer { font-size: 12px; color: var(--text-tertiary); }
nav.mods a { color: var(--text-secondary); }
a { color: #185FA5; }
@media (prefers-color-scheme: dark) { a { color: #85B7EB; } }
/* Chart primitives */
.axis { stroke: var(--text-tertiary); stroke-width: 0.5px; fill: none; }
.grid { stroke: var(--border); stroke-width: 0.5px; stroke-dasharray: 3 4; fill: none; }
.line-teal { stroke: #0F6E56; stroke-width: 2px; fill: none; }
.line-purple { stroke: #534AB7; stroke-width: 2px; fill: none; }
.line-coral { stroke: #993C1D; stroke-width: 2px; fill: none; }
.dot-teal { fill: #0F6E56; } .dot-purple { fill: #534AB7; } .dot-coral { fill: #993C1D; }
@media (prefers-color-scheme: dark) {
  .line-teal { stroke: #5DCAA5; } .line-purple { stroke: #AFA9EC; } .line-coral { stroke: #F0997B; }
  .dot-teal { fill: #5DCAA5; } .dot-purple { fill: #AFA9EC; } .dot-coral { fill: #F0997B; }
}

.eqblock { background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: 8px; padding: 6px 18px; margin: 8px 0 14px; }
.eqrow { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 0.5px dashed var(--border); flex-wrap: wrap; }
.eqrow:last-child { border-bottom: none; }
.eqm { overflow-x: auto; max-width: 100%; }
.eqm math { font-size: 18px; margin: 0; color: var(--text-primary); }
.eqm math[display="block"] { text-align: left; }
.eqn { font-size: 12px; color: var(--text-secondary); text-align: right; max-width: 42%; line-height: 1.5; }
td .eqm math { font-size: 16px; }
@media (max-width: 600px) { .eqn { text-align: left; max-width: 100%; } }

/* ==========================================================================
   2. Componenti del sito
   ========================================================================== */
:root {
  --accent: #185FA5; --accent-ink: #ffffff; --accent-soft: #E6F1FB;
  --good-bg: #E1F5EE; --good-bd: #0F6E56; --good-ink: #085041;
  --bad-bg: #FCEBEB; --bad-bd: #A32D2D; --bad-ink: #791F1F;
  --warn-bg: #FAEEDA; --warn-bd: #854F0B; --warn-ink: #633806;
  --topbar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #85B7EB; --accent-ink: #0b2440; --accent-soft: #0C447C;
    --good-bg: #085041; --good-bd: #5DCAA5; --good-ink: #9FE1CB;
    --bad-bg: #791F1F; --bad-bd: #F09595; --bad-ink: #F7C1C1;
    --warn-bg: #633806; --warn-bd: #EF9F27; --warn-ink: #FAC775;
  }
}
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--topbar-h) + 12px); -webkit-text-size-adjust: 100%; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg-tertiary); color: var(--text-primary); min-height: 100vh; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--bg-primary); color: var(--text-primary); padding: 8px 12px; border-radius: 8px; }
a:focus-visible, .btn:focus-visible, .dot:focus-visible, .flashcard:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Barra superiore */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-primary);
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 0.5px solid var(--border);
}
.topbar-in { max-width: 1040px; margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; gap: 20px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-primary); font-weight: 600; font-size: 15px; flex-shrink: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.topnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--text-secondary); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.topnav a:hover { background: var(--bg-secondary); color: var(--text-primary); }
.topnav a[aria-current="page"] { color: var(--text-primary); background: var(--bg-secondary); font-weight: 500; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 72px; }
.card.doc, .card.app { margin: 0 auto; }
.card h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; margin-bottom: 12px; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary) !important; margin-bottom: 6px !important; font-weight: 500; }
.small { font-size: 13px !important; }

/* Home */
.hero { margin: 12px 0 8px; }
.hero h1 { font-size: clamp(30px, 5vw, 42px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; color: var(--text-primary); margin-bottom: 12px; }
.lead { font-size: 16.5px; color: var(--text-secondary); line-height: 1.5; max-width: 560px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 36px 0 12px; }
.mode-grid, .mod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-card, .mod-card, .formula-link {
  background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: 14px;
  transition: border-color .15s, transform .15s;
}
.mode-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 44px 20px 18px; text-decoration: none; color: inherit; }
.mode-card:hover, .mod-card:hover, .formula-link:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.mode-title { font-weight: 600; font-size: 16px; color: var(--text-primary); }
.mode-desc { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.mode-go { position: absolute; top: 17px; right: 18px; color: var(--accent); font-size: 16px; }
.mod-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; }
.mod-num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mod-card h3 { font-size: 16px; font-weight: 600; line-height: 1.3; margin-top: 4px; }
.mod-card h3 a { color: var(--text-primary); text-decoration: none; }
.mod-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.mod-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.mod-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-tertiary); margin-top: 8px; padding-top: 10px; border-top: 0.5px solid var(--border); }
.mod-meta a { position: relative; z-index: 1; color: var(--accent); text-decoration: none; font-weight: 500; }
.mod-meta a:hover { text-decoration: underline; }
.formula-link { display: flex; justify-content: space-between; align-items: center; gap: 4px 16px; flex-wrap: wrap; margin-top: 12px; padding: 16px 18px; text-decoration: none; color: var(--text-primary); font-weight: 600; }
.formula-link .muted { font-weight: 400; font-size: 13.5px; }

/* Pagine modulo */
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.jump a { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; background: var(--bg-secondary); border: 0.5px solid var(--border); color: var(--text-secondary); text-decoration: none; }
.jump a:hover { color: var(--text-primary); border-color: var(--border-hover); }
.doc-foot { margin-top: 36px; padding-top: 20px; border-top: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.doc-foot > .btn { align-self: flex-start; }
.pager { display: flex; justify-content: space-between; gap: 12px; }
.pager a { display: flex; flex-direction: column; gap: 2px; flex: 1; max-width: 50%; font-size: 14px; text-decoration: none; color: var(--text-primary); padding: 10px 14px; border: 0.5px solid var(--border); border-radius: 10px; }
.pager a:hover { border-color: var(--border-hover); }
.pager a .muted { font-size: 12px; }
.pager a.next { text-align: right; margin-left: auto; }
.formula-table td:nth-child(2) { min-width: 220px; }
/* Le formule MathML sporgono di qualche pixel: niente scrollbar verticale, solo orizzontale se serve. */
.eqm { overflow-y: hidden; padding: 3px 0; }

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
  min-height: 40px; padding: 9px 16px; border-radius: 10px;
  border: 0.5px solid var(--border-hover); background: var(--bg-primary); color: var(--text-primary);
  cursor: pointer; text-decoration: none; transition: background .12s, filter .12s;
}
.btn:hover { background: var(--bg-secondary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.good, .btn.mark-good[aria-pressed="true"] { background: var(--good-bg); border-color: var(--good-bd); color: var(--good-ink); }
.btn.bad, .btn.mark-bad[aria-pressed="true"] { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn.ghost:hover { color: var(--text-primary); background: var(--bg-secondary); }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 0.5px solid currentColor; opacity: .7; }
@media (hover: none) { kbd { display: none; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.actions.center { justify-content: center; }

/* Setup delle modalità */
.setup fieldset { border: 0.5px solid var(--border); border-radius: 12px; padding: 10px 14px 12px; margin: 16px 0; }
.setup legend { font-size: 13px; font-weight: 600; padding: 0 6px; color: var(--text-secondary); }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 14px; cursor: pointer; color: var(--text-primary); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }
.check .muted { margin-left: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.picker-tools { display: flex; gap: 14px; margin-top: 4px; }
.picker-tools button { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 2px 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.pill-radio { position: relative; }
.pill-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill-radio span { display: inline-block; padding: 7px 14px; border: 0.5px solid var(--border-hover); border-radius: 999px; font-size: 14px; cursor: pointer; color: var(--text-primary); background: var(--bg-primary); }
.pill-radio input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup-summary { font-size: 13.5px !important; color: var(--text-secondary) !important; }

/* Esecuzione */
.run-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; color: var(--text-secondary); }
.timer-pill { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; padding: 4px 12px; border-radius: 999px; border: 0.5px solid; min-width: 68px; text-align: center; }
.timer-pill.ok { background: var(--good-bg); border-color: var(--good-bd); color: var(--good-ink); }
.timer-pill.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-ink); }
.timer-pill.over, .timer-pill.danger { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-ink); }
.timer-pill.stopped { opacity: .7; }
.progress-bar { height: 4px; background: var(--bg-secondary); border-radius: 999px; overflow: hidden; margin: 12px 0 20px; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.card p.q { font-size: 16.5px; line-height: 1.6; margin: 4px 0 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.field input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 0.5px solid var(--border-hover); background: var(--bg-primary); color: var(--text-primary); width: 100%; }
.field input:disabled { background: var(--bg-secondary); color: var(--text-primary); -webkit-text-fill-color: var(--text-primary); opacity: 1; }
.field input::placeholder { color: var(--text-tertiary); }
.label { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 4px; }
.solution { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: var(--bg-secondary); border: 0.5px solid var(--border); }
.solution > p:last-child, .answer-cmp > p:last-child { margin-bottom: 0; }
.answer-cmp { margin-top: 12px; padding: 10px 16px; border-radius: 12px; border: 0.5px dashed var(--border-hover); }
.dataset { margin: 12px 0; }
.card .dataset td, .card .dataset th { font-size: 12.5px; padding: 4px 8px; white-space: nowrap; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink) !important; border: 0.5px solid var(--warn-bd); }

/* Simulazione */
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.dot { width: 32px; height: 32px; border-radius: 8px; border: 0.5px solid var(--border-hover); background: var(--bg-primary); color: var(--text-secondary); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.dot.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.review-item { padding: 20px 0 4px; border-top: 0.5px solid var(--border); }
.review-item:first-of-type { border-top: none; }
.review-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px -8px -8px; padding: 12px 8px; background: var(--bg-primary); border-top: 0.5px solid var(--border); font-size: 14px; color: var(--text-secondary); }

/* Risultati */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0 20px; }
.stat { background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-v { display: block; font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-primary); line-height: 1.2; }
.stat-l { font-size: 12.5px; color: var(--text-secondary); }
.tag { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; border: 0.5px solid; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag.good, .tag.ok { background: var(--good-bg); border-color: var(--good-bd); color: var(--good-ink); }
.tag.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-ink); }
.tag.bad, .tag.over { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-ink); }
.bars { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; color: var(--text-primary); }
.bar-row .muted { font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--bg-secondary); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--good-bd); }
.bar-fill.mid { background: var(--warn-bd); }
.bar-fill.low { background: var(--bad-bd); }

/* Flashcard */
.flashcard {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px;
  min-height: 280px; padding: 28px 20px; margin: 4px 0 8px;
  border-radius: 16px; border: 0.5px solid var(--border-hover); background: var(--bg-secondary);
  cursor: pointer; -webkit-user-select: none; user-select: none; transition: background .15s;
}
.flashcard.flipped { background: var(--bg-primary); cursor: default; }
.fc-kind { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); font-weight: 500; }
.fc-front { font-size: 24px; font-weight: 650; line-height: 1.3; color: var(--text-primary); }
.fc-back { width: 100%; max-width: 560px; padding-top: 16px; border-top: 0.5px dashed var(--border-hover); animation: fc-in .18s ease-out; }
.card .fc-back p { font-size: 16px; line-height: 1.6; text-align: left; }
.fc-back .eqm { display: flex; justify-content: center; }
.fc-back .eqm math { font-size: 24px; }
.fc-back .eqm math[display="block"] { text-align: center; }
.fc-hint { font-size: 12.5px; color: var(--text-tertiary); }
@keyframes fc-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .mode-grid, .mod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .wrap { padding: 16px 12px 56px; }
  .card { padding: 22px 16px; border-radius: 14px; }
  .topbar-in { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .topnav { margin-left: 0; -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); padding-right: 24px; }
  .mode-grid, .mod-grid { grid-template-columns: minmax(0, 1fr); }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .pager a.next { text-align: left; margin-left: 0; }
  .fc-front { font-size: 21px; }
  .flashcard { min-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
