/* SimplyTheBet — foglio di stile unico, senza build. Mobile first. */

:root {
  --bg: #eaf2ed;
  --surface: #ffffff;
  --surface-2: #f8fbf9;
  --text: #16241c;
  --muted: #5f6f66;
  --border: #dfe8e2;
  --primary: #0f7a4f;
  --primary-strong: #0a6340;
  --primary-soft: #e2f4ea;
  --on-primary: #ffffff;
  --accent: #f2b705;
  --accent-soft: #fff5d6;
  --success: #0f766e;
  --success-soft: #e0f3f1;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --warning: #b45309;
  --warning-soft: #fff3e0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 36, 28, .06), 0 4px 16px rgba(22, 36, 28, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
  --font-display: "Bricolage Grotesque", var(--font);
  /* Vetro: schede traslucide sopra lo sfondo colorato */
  --glass: rgba(255, 255, 255, .62);
  --glass-soft: rgba(255, 255, 255, .42);
  --glass-border: rgba(255, 255, 255, .8);
  --glass-edge: rgba(22, 36, 28, .08);
  --blur: 18px;
  --glow-1: #9fe0bd;
  --glow-2: #ffe08a;
  --glow-3: #a7e3e0;
  --glow-4: #d9f0a3;
  color-scheme: light;
}

/* Tema scuro: automatico (preferenza del sistema) oppure scelto nel piè di pagina. */
:root[data-theme="dark"] {
    --bg: #0a110d;
    --surface: #16201a;
    --surface-2: #1b2720;
    --text: #e6efe9;
    --muted: #9db0a5;
    --border: #263a2f;
    --primary: #3ecf8e;
    --primary-strong: #6ee0ad;
    --primary-soft: #15301f;
    --on-primary: #0b1a12;
    --accent: #ffc933;
    --accent-soft: #3a2e10;
    --success: #2dd4bf;
    --success-soft: #10302d;
    --danger: #f87171;
    --danger-soft: #3a1a1d;
    --warning: #fbbf24;
    --warning-soft: #3a2c10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
    --glass: rgba(24, 36, 29, .58);
    --glass-soft: rgba(24, 36, 29, .4);
    --glass-border: rgba(255, 255, 255, .08);
    --glass-edge: rgba(0, 0, 0, .3);
    --glow-1: #0f5a3b;
    --glow-2: #5a4a0f;
    --glow-3: #0c4a47;
    --glow-4: #2c4a12;
  }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a110d;
    --surface: #16201a;
    --surface-2: #1b2720;
    --text: #e6efe9;
    --muted: #9db0a5;
    --border: #263a2f;
    --primary: #3ecf8e;
    --primary-strong: #6ee0ad;
    --primary-soft: #15301f;
    --on-primary: #0b1a12;
    --accent: #ffc933;
    --accent-soft: #3a2e10;
    --success: #2dd4bf;
    --success-soft: #10302d;
    --danger: #f87171;
    --danger-soft: #3a1a1d;
    --warning: #fbbf24;
    --warning-soft: #3a2c10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
    --glass: rgba(24, 36, 29, .58);
    --glass-soft: rgba(24, 36, 29, .4);
    --glass-border: rgba(255, 255, 255, .08);
    --glass-edge: rgba(0, 0, 0, .3);
    --glow-1: #0f5a3b;
    --glow-2: #5a4a0f;
    --glow-3: #0c4a47;
    --glow-4: #2c4a12;
  }
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url("../fonts/bricolage-grotesque.woff2") format("woff2-variations"), url("../fonts/bricolage-grotesque.woff2") format("woff2");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---- Struttura ---- */
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; flex: 1; }
.container.wide { max-width: 1100px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ---- Barra superiore ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); letter-spacing: -.02em; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.brand span b { color: var(--primary); }
.zone-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; padding: 4px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong); font-weight: 600;
  max-width: 48vw; overflow: hidden; white-space: nowrap;
}
.zone-chip-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Selettore di zona e menu a tendina (details/summary, senza JS obbligatorio) */
.zone-switch, .member-actions { position: relative; min-width: 0; }
.zone-switch > summary, .member-actions > summary { list-style: none; cursor: pointer; }
.zone-switch > summary::-webkit-details-marker, .member-actions > summary::-webkit-details-marker { display: none; }
.zone-switch > summary .chev { width: 14px; height: 14px; flex: none; }
.zone-switch[open] > summary .chev { transform: rotate(180deg); }
.zone-switch > summary .icon { flex: none; }
.count-dot {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #3a2800; font-size: .72rem; font-weight: 800; flex: none;
}
.zone-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 240px; max-width: min(92vw, 340px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column;
}
/* Su telefono il selettore sta a destra del logo: il menu si apre verso sinistra e resta nello schermo. */
.zone-switch .zone-menu { left: auto; right: 0; }
@media (min-width: 820px) { .zone-switch .zone-menu { left: 0; right: auto; } }
.member-actions .zone-menu { left: auto; right: 0; min-width: 200px; }
.zone-menu a, .zone-menu button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text);
  font: inherit; font-size: .92rem; background: none; border: 0; text-align: left; width: 100%; cursor: pointer;
}
.zone-menu a:hover, .zone-menu button:hover { background: var(--surface-2); text-decoration: none; }
.zone-menu a.current { background: var(--primary-soft); color: var(--primary-strong); font-weight: 650; }
.zone-menu a span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.zone-menu small { color: var(--muted); font-size: .75rem; font-weight: 500; }
.zone-menu button.danger { color: var(--danger); }
.zone-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.zone-menu .icon { flex: none; }

/* Liste delle zone: membri, inviti, link, registro */
.zone-list, .member-list, .link-list, .event-list { list-style: none; padding: 0; margin: 0; }
.zone-list li, .member-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.zone-list li:last-child, .member-list li:last-child { border-bottom: 0; }
.member-main { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
.member-main .badge { margin-left: 4px; vertical-align: 1px; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.link-list li:last-child { border-bottom: 0; }
.link-list .input { flex: 1 1 200px; min-width: 0; min-height: 38px; padding: 6px 10px; }
.event-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.event-list li:last-child { border-bottom: 0; }
.input.input-narrow { width: 96px; min-height: 38px; padding: 6px 10px; }
.card .lead { font-size: 1.15rem; margin: 4px 0 12px; overflow-wrap: anywhere; }
.empty .icon-lg { width: 42px; height: 42px; color: var(--primary); margin-bottom: 8px; }
.mod-box { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.topnav { display: none; margin-left: auto; gap: 4px; align-items: center; }
.topnav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.topnav a:hover, .topnav a.active { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar .spacer { margin-left: auto; }
.topnav a.btn-primary, .topnav a.btn-primary:hover { color: var(--on-primary); background: var(--primary); margin-left: 8px; }
.topnav a.btn-primary:hover { background: var(--primary-strong); }

@media (min-width: 820px) {
  .topnav { display: flex; }
  body.has-tabbar { padding-bottom: 0; }
  .tabbar { display: none !important; }
  h1 { font-size: 1.75rem; }
}

/* ---- Tab bar mobile ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .7rem; font-weight: 600;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--primary); }
.tabbar .icon { width: 24px; height: 24px; }
.tabbar .fab {
  width: 52px; height: 52px; margin: -18px auto 0; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 45%, transparent);
}
.tabbar .fab .icon { width: 28px; height: 28px; }

/* ---- Card ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 12px; }

/* ---- Pulsanti ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.inline-form { display: inline; }

/* ---- Moduli ---- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 650; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
textarea.input { min-height: 96px; resize: vertical; }
/* Safari/iOS dà ai campi data una larghezza minima propria che sfora la card */
input.input[type="datetime-local"], input.input[type="date"], input.input[type="time"] {
  display: block; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; text-align: left;
}
input.input::-webkit-date-and-time-value { text-align: left; }
input.input::-webkit-datetime-edit { padding: 0; }
input.input::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid { border-color: var(--danger); }
.error { color: var(--danger); font-size: .88rem; margin-top: 6px; }
.code-input { font-size: 1.8rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding-left: .5em; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 600; }
.check .hint { font-weight: 400; margin-top: 2px; display: inline-block; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
details.advanced { border: 1px dashed var(--border); border-radius: 12px; padding: 4px 14px; margin-bottom: 16px; }
details.advanced[open] { padding-bottom: 12px; }
details.advanced summary { cursor: pointer; font-weight: 650; padding: 10px 0; color: var(--muted); list-style: none; }
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before { content: "＋ "; }
details.advanced[open] summary::before { content: "－ "; }

/* Scelta del tipo di pronostico */
.type-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .type-picker { grid-template-columns: repeat(4, 1fr); } }
.type-picker label {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center;
  cursor: pointer; font-weight: 650; font-size: .9rem; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.type-picker label .icon { width: 26px; height: 26px; color: var(--muted); }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.type-picker input:checked + label .icon { color: var(--primary); }
.type-picker input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.option-list .option-row { display: flex; gap: 8px; margin-bottom: 8px; }
[data-show-for] { display: none; }
.pform:has(#type-yesno:checked) [data-show-for~="yesno"],
.pform:has(#type-choice:checked) [data-show-for~="choice"],
.pform:has(#type-number:checked) [data-show-for~="number"],
.pform:has(#type-date:checked) [data-show-for~="date"] { display: block; }
[data-show-for] [data-mode] { display: none; }
.pform:has(#dm-date:checked) [data-mode="date"],
.pform:has(#dm-time:checked) [data-mode="time"],
.pform:has(#dm-datetime:checked) [data-mode="datetime"] { display: grid; }
.pform:has(#dm-date:checked) p[data-mode="date"],
.pform:has(#dm-time:checked) p[data-mode="time"],
.pform:has(#dm-datetime:checked) p[data-mode="datetime"] { display: block; }
.pill-choice { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-choice input { position: absolute; opacity: 0; pointer-events: none; }
.pill-choice label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; font-size: .92rem; cursor: pointer;
}
.pill-choice label .icon { width: 18px; height: 18px; color: var(--muted); }
.pill-choice input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.pill-choice input:checked + label .icon { color: var(--primary); }
.pill-choice input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Opzioni di voto */
.vote-options { display: grid; gap: 10px; }
.vote-option { position: relative; }
.vote-option input { position: absolute; opacity: 0; pointer-events: none; }
.vote-option label {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; background: var(--surface);
}
.vote-option label::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex: none;
}
.vote-option input:checked + label { border-color: var(--primary); background: var(--primary-soft); }
.vote-option input:checked + label::before { border-color: var(--primary); background: radial-gradient(var(--primary) 45%, transparent 50%); }
.vote-option input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---- Avvisi ---- */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 550; display: flex; gap: 10px; align-items: flex-start; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--primary-soft); color: var(--primary-strong); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }

/* ---- Badge e chip ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-open { background: var(--success-soft); color: var(--success); }
.badge-awaiting { background: var(--warning-soft); color: var(--warning); }
.badge-resolved { background: var(--primary-soft); color: var(--primary-strong); }
.badge-cancelled, .badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--warning); }

/* ---- Segmenti / filtri ---- */
.segmented { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 2px 16px; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--muted); font-weight: 650; font-size: .9rem; background: var(--surface);
}
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.segmented .count { opacity: .7; margin-left: 4px; }

/* ---- Lista pronostici ---- */
.plist { display: grid; gap: 12px; }
.pcard { display: block; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pcard:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.pcard-title { font-weight: 700; font-size: 1.05rem; margin: 8px 0 10px; overflow-wrap: anywhere; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .85rem; }
.pcard-meta span { display: inline-flex; align-items: center; gap: 4px; }
.voted { color: var(--success); font-weight: 650; }

/* ---- Risultati ---- */
.results { display: grid; gap: 12px; }
.result-row .row { gap: 8px; font-size: .95rem; }
.result-row .pct { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .6s ease; }
.result-row.winner .bar > i { background: var(--accent); }
.result-row.mine .label-text::after { content: " •"; color: var(--primary); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; font-weight: 600; }

/* ---- Classifica ---- */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.board li:last-child { border-bottom: 0; }
.board .rank { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--surface-2); flex: none; font-variant-numeric: tabular-nums; }
.board .rank-1 { background: var(--accent); color: #3a2800; }
.board .rank-2 { background: #d9dbe4; color: #2d3040; }
.board .rank-3 { background: #e8b88a; color: #3d2410; }
.board .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.board .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.board .sub { color: var(--muted); font-size: .8rem; font-weight: 500; }
.board li.me { background: var(--primary-soft); border-radius: 12px; border-bottom-color: transparent; padding-left: 8px; padding-right: 8px; }

/* ---- Home ---- */
.hero { text-align: center; padding: 32px 0 8px; }
.hero h1 { font-size: 2rem; letter-spacing: -.03em; margin-bottom: 12px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 520px; margin: 0 auto 24px; }
.hero-examples { display: grid; gap: 10px; max-width: 460px; margin: 28px auto 0; text-align: left; }
.hero-examples .pcard { transform: rotate(-1deg); }
.hero-examples .pcard:nth-child(2) { transform: rotate(1deg); }
.features { display: grid; gap: 12px; margin-top: 32px; }
@media (min-width: 700px) { .features { grid-template-columns: repeat(3, 1fr); } .hero h1 { font-size: 2.6rem; } }
.features > .card + .card { margin-top: 0; } /* nella griglia le schede restano allineate */
.feature .icon { width: 28px; height: 28px; color: var(--primary); margin-bottom: 6px; }
.feature h3 { margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---- Pagine di testo ---- */
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.template-note { border-left: 4px solid var(--warning); }

/* ---- Auth ---- */
.auth-wrap { max-width: 420px; margin: 24px auto; }
.auth-wrap .card { padding: 24px; }

/* ---- Footer ---- */
.footer { color: var(--muted); font-size: .85rem; text-align: center; padding: 24px 16px 32px; }
.footer a { color: var(--muted); }
.footer nav { display: flex; gap: 6px 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* ---- Tabelle (admin) ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; }
.admin-nav a { flex: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 650; }
.admin-nav a.active { background: var(--primary-soft); color: var(--primary-strong); }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: 244px; height: 244px; margin: 0 auto; display: block; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.secret { font-size: 1rem; word-break: break-all; background: var(--surface-2); padding: 8px 12px; border-radius: 8px; display: block; text-align: center; }

/* ---- Paginazione ---- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

/* ---- Vari ---- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; margin-bottom: 8px; color: var(--border); }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.description { white-space: pre-line; overflow-wrap: anywhere; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 12px; }
.fieldset-plain { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.card + .card, .stats-grid + .card { margin-top: 16px; }
.vote-option.multi label::before { border-radius: 6px; }
.vote-option.multi input:checked + label::before { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.tabbar a { min-width: 0; padding: 0 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .68rem; }
.tabbar a:has(.fab) { overflow: visible; }
.template-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 6px -16px 0; padding: 2px 16px 6px; }
.template-strip::-webkit-scrollbar { display: none; }
.template-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .88rem; }
.template-chip:hover { text-decoration: none; border-color: var(--primary); }
.template-chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.template-chip .icon { width: 1.05em; height: 1.05em; color: var(--primary); }
.clause-box { border-left: 4px solid var(--warning); background: var(--warning-soft); color: var(--text); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.clause-box ul { margin: 6px 0 0; padding-left: 1.1em; }
.mode-choice { display: grid; gap: 8px; margin-bottom: 14px; }
.people { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.people li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.people li.win { background: var(--success-soft); border-color: transparent; color: var(--success); font-weight: 650; }
.people li.out { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.excluded-list { margin: 6px 0 0; padding-left: 1.1em; font-size: .9rem; }
.candidate-list { list-style: none; margin: 0; padding: 0; }
.candidate-list li { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: var(--surface); }
.candidate-list li.out { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: var(--danger-soft); }

/* =========================================================================
   2.1 — Aspetto: sfondo "aurora", schede di vetro, titoli con carattere
   ========================================================================= */

/* Sfondo colorato tenue, fermo sotto la pagina: si intravede attraverso le schede. */
body::before {
  content: ""; position: fixed; inset: -12vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 32vmax at 12% 18%, var(--glow-1), transparent 70%),
    radial-gradient(34vmax 30vmax at 88% 12%, var(--glow-2), transparent 70%),
    radial-gradient(40vmax 34vmax at 78% 82%, var(--glow-3), transparent 70%),
    radial-gradient(30vmax 28vmax at 18% 88%, var(--glow-4), transparent 70%);
  opacity: .75;
  animation: aurora 38s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-3vmax, 2vmax, 0) scale(1.06); }
  100% { transform: translate3d(2vmax, -2vmax, 0) scale(1.02); }
}

/* Titoli e numeri: Bricolage Grotesque, un po' stretto, deciso */
h1, h2, .brand, .stat b, .board .pts, .board .rank, .pcard-title, .card-title, .lh-title, .lh-step b {
  font-family: var(--font-display);
}
h1 { font-weight: 750; font-stretch: 88%; letter-spacing: -.02em; }
h2 { font-weight: 700; font-stretch: 92%; letter-spacing: -.01em; }
.brand { font-weight: 800; font-stretch: 90%; font-size: 1.2rem; }
.stat b { font-weight: 750; font-size: 1.55rem; font-stretch: 85%; }
.pcard-title { font-weight: 650; font-size: 1.12rem; letter-spacing: -.005em; }
.card-title { font-weight: 650; font-size: 1.02rem; }

/* Vetro: dove il browser lo supporta. Menu e campi restano pieni, per leggerli bene. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .pcard, .stat, .table-wrap, .segmented a, .template-chip, .type-picker label, .vote-option label {
    background: var(--glass);
    border-color: var(--glass-border);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
    backdrop-filter: blur(var(--blur)) saturate(1.5);
    box-shadow: 0 1px 0 var(--glass-border) inset, 0 10px 30px -12px var(--glass-edge);
  }
  .card.soft { background: var(--glass-soft); }
  .stat, .vote-option label, .type-picker label, .segmented a, .template-chip { box-shadow: none; }
  .segmented a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
  .type-picker input:checked + label, .vote-option input:checked + label, .template-chip.active {
    background: color-mix(in srgb, var(--primary-soft) 80%, transparent); border-color: var(--primary);
  }
  .topbar { background: color-mix(in srgb, var(--surface) 55%, transparent); border-bottom-color: var(--glass-border); }
  .tabbar {
    background: color-mix(in srgb, var(--surface) 60%, transparent); border-top-color: var(--glass-border);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5); backdrop-filter: blur(var(--blur)) saturate(1.5);
  }
}

/* Liste senza pallini (anche "Le mie zone") */
.plist { list-style: none; padding: 0; margin: 0; }

/* Vittoria: un solo riflesso dorato quando scopri di aver indovinato */
.flash-success.win-shine { position: relative; overflow: hidden; }
.flash-success.win-shine::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 55%, transparent) 50%, transparent 70%);
  animation: shine 1.4s .3s ease-out 1 forwards;
}
@keyframes shine { to { transform: translateX(120%); } }

/* ---- Selettore del tema (piè di pagina) ---- */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid var(--border); background: var(--glass-soft); }
.theme-switch a { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; border-radius: 999px; color: var(--muted); }
.theme-switch a:hover { color: var(--text); text-decoration: none; }
.theme-switch a.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px var(--glass-edge); }
.theme-switch .icon { width: 16px; height: 16px; vertical-align: 0; }
.footer nav { align-items: center; }

/* =========================================================================
   Home
   ========================================================================= */
.container.landing { max-width: 1120px; }

.lh-hero { display: grid; gap: 36px; align-items: center; padding: 28px 0 12px; }
.lh-title {
  font-size: clamp(2.6rem, 9vw, 5.2rem); line-height: .95; font-weight: 800; font-stretch: 78%;
  letter-spacing: -.035em; margin: 0 0 18px; color: var(--text);
}
.lh-title span { display: block; }
.lh-lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; margin-bottom: 26px; }
.lh-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.lh-cta .btn-primary { min-height: 52px; padding: 12px 22px; font-size: 1.05rem; border-radius: 14px;
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--primary) 70%, transparent); }
.lh-note { color: var(--muted); font-size: .9rem; margin: 0; }

/* La schedina di prova */
.slip {
  position: relative; padding: 22px 22px 18px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: 0 1px 0 var(--glass-border) inset, 0 30px 60px -28px var(--glass-edge);
  transform: rotate(-1deg);
}
/* bordo "strappato" della schedina */
.slip::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: 58px; height: 0;
  border-top: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
}
.slip-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .85rem; color: var(--muted); height: 36px; margin-bottom: 18px; }
.slip-head b { color: var(--text); font-family: var(--font-display); font-weight: 700; font-stretch: 85%; font-size: 1rem; }
.slip-q { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.15; font-weight: 700; font-stretch: 88%; margin: 0 0 16px; }
.slip-options { display: grid; gap: 10px; }
.slip-opt {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: 1rem; text-align: left; cursor: pointer;
}
.slip-opt:hover { border-color: var(--primary); }
.slip-opt .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--primary-soft); transition: width .9s cubic-bezier(.2, .8, .2, 1); z-index: 0; }
.slip-opt > span { position: relative; z-index: 1; }
.slip-opt .pct { font-family: var(--font-display); font-weight: 750; font-stretch: 85%; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .3s .5s; }
.slip.is-voted .slip-opt { cursor: default; }
.slip.is-voted .slip-opt .pct { opacity: 1; }
.slip-opt[aria-pressed="true"] { border-color: var(--primary); }
.slip-opt[aria-pressed="true"] .fill { background: color-mix(in srgb, var(--primary) 26%, var(--primary-soft)); }
.slip-foot [data-slip-reset] { white-space: nowrap; }
.slip-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: .85rem; color: var(--muted); min-height: 30px; }
.slip-result { font-weight: 600; color: var(--text); }
/* Il timbro dorato: il momento "wow" della pagina */
.slip-stamp {
  position: absolute; right: 4px; top: -44px; display: grid; place-items: center; text-align: center;
  width: 100px; height: 100px; border-radius: 50%; padding: 10px;
  background: var(--accent); color: #3a2800; font-family: var(--font-display); font-weight: 800; font-stretch: 80%;
  line-height: 1.02; font-size: .82rem; box-shadow: 0 14px 30px -10px rgba(120, 90, 0, .55), 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: rotate(14deg) scale(0); opacity: 0;
}
.slip-stamp b { display: block; font-size: 1.7rem; letter-spacing: -.02em; }
.slip.is-voted .slip-stamp { animation: stamp .55s .75s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.slip-head > span { transition: opacity .25s .7s; }
.slip.is-voted .slip-head > span { opacity: 0; }
@keyframes stamp { to { transform: rotate(14deg) scale(1); opacity: 1; } }
.slip-hint { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 14px; }

/* Ingresso della pagina: il titolo sale riga per riga, una volta sola */
.lh-title span, .lh-lead, .lh-cta, .slip-wrap { animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
.lh-title span:nth-child(2) { animation-delay: .08s; }
.lh-title span:nth-child(3) { animation-delay: .16s; }
.lh-lead { animation-delay: .24s; }
.lh-cta { animation-delay: .32s; }
.slip-wrap { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Come funziona: tre passi davvero in sequenza */
.lh-section { margin-top: 64px; }
.lh-section > h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-stretch: 82%; margin-bottom: 20px; }
.lh-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: step; }
.lh-step { position: relative; padding: 20px 20px 20px 84px; min-height: 96px; }
.lh-step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 20px; top: 12px; font-family: var(--font-display); font-weight: 800; font-stretch: 75%;
  font-size: 3.6rem; line-height: 1; color: var(--primary);
}
.lh-step b { display: block; font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.lh-step p { margin: 0; color: var(--muted); }

/* Classifica di esempio + invito finale */
.lh-crew { display: grid; gap: 24px; align-items: center; padding: 26px; }
.lh-crew h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-stretch: 82%; }
.lh-crew p { color: var(--muted); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; max-width: 360px; margin: 0 auto; }
.podium div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium .who { font-weight: 650; font-size: .9rem; }
.podium .step {
  width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 1.6rem; color: #3a2800;
}
.podium .p1 .step { height: 120px; background: var(--accent); }
.podium .p2 .step { height: 86px; background: #d9dbe4; color: #2d3040; }
.podium .p3 .step { height: 64px; background: #e8b88a; color: #3d2410; }
.podium .pts { font-size: .8rem; color: var(--muted); }

/* Dentro le griglie le schede partono tutte alla stessa altezza */
.lh-steps > .card + .card { margin-top: 0; }

@media (min-width: 860px) {
  .slip-stamp { right: -22px; top: -34px; width: 118px; height: 118px; padding: 12px; font-size: .95rem; }
  .slip-stamp b { font-size: 2rem; }
  .lh-hero { grid-template-columns: 1.1fr .9fr; gap: 56px; padding-top: 56px; }
  .lh-steps { grid-template-columns: repeat(3, 1fr); }
  .lh-crew { grid-template-columns: 1fr 1fr; padding: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .lh-title span, .lh-lead, .lh-cta, .slip-wrap, .flash-success.win-shine::after { animation: none !important; }
  .slip.is-voted .slip-stamp { animation: none; transform: rotate(14deg) scale(1); opacity: 1; }
  .slip-opt .fill, .slip-opt .pct, .bar > i { transition: none; }
}

/* =========================================================================
   Regolamento punti
   ========================================================================= */
.rl-hero { padding: 28px 0 4px; }
.rl-title { font-size: clamp(2.4rem, 8vw, 4.4rem); line-height: .95; font-weight: 800; font-stretch: 78%; letter-spacing: -.035em; margin: 0 0 16px; }
.rl-stamps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 14px; }
.rs { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.rs b {
  display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 3rem; letter-spacing: -.03em;
  box-shadow: 0 14px 30px -14px var(--glass-edge);
  animation: thump .5s cubic-bezier(.3, 1.6, .5, 1) both;
}
.rs span { font-weight: 650; max-width: 12em; line-height: 1.25; }
.rs-correct b { background: var(--primary); color: var(--on-primary); transform: rotate(-6deg); animation-delay: .15s; }
.rs-exact b { background: var(--accent); color: #3a2800; transform: rotate(5deg); animation-delay: .3s; }
.rs-bonus b { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 60%, var(--text)); border: 3px dashed var(--accent); transform: rotate(-3deg); animation-delay: .45s; }
.rs-zero b { background: var(--glass); color: var(--muted); border: 1px solid var(--glass-border); transform: rotate(8deg); animation-delay: .6s; }
.rs-correct b { --r: -6deg; } .rs-exact b { --r: 5deg; } .rs-bonus b { --r: -3deg; } .rs-zero b { --r: 8deg; }
@keyframes thump { from { transform: rotate(var(--r, 0deg)) scale(1.6); opacity: 0; } to { transform: rotate(var(--r, 0deg)) scale(1); opacity: 1; } }
.rl-max { text-align: center; color: var(--muted); margin: 28px auto 0; max-width: 34em; }

/* Calcolatore */
.rl-lab { padding: 0; overflow: hidden; }
.rl-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; border-bottom: 1px solid var(--glass-border); }
.rl-tabs button {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font: inherit; font-weight: 650;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
}
.rl-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.rl-body { display: grid; gap: 24px; padding: 20px; }
.rl-q { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin: 0 0 16px; }
.rl-range { display: block; margin-bottom: 16px; }
.rl-range > span { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; margin-bottom: 6px; }
.rl-range output { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--primary); }
.rl-range input { width: 100%; accent-color: var(--primary); height: 28px; cursor: pointer; }
.rl-you { border: 0; padding: 0; margin: 4px 0 18px; }
.rl-you legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.rl-you label { display: inline-block; margin: 0 6px 8px 0; cursor: pointer; }
.rl-you input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rl-you span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--glass-soft); font-weight: 600; font-size: .92rem; }
.rl-you input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.rl-you input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.crowd { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 20px; }
.crowd i { width: 16px; height: 16px; border-radius: 50%; background: var(--border); transition: background .2s; }
.crowd i.w { background: var(--accent); }
.crowd i.me { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.crowd i.aside { margin-left: 14px; background: transparent; border: 2px dashed var(--muted); }
.crowd-cap { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }

.rl-out { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rule-stamp {
  display: grid; place-items: center; align-content: center; width: 150px; height: 150px; border-radius: 50%;
  background: var(--accent); color: #3a2800; transform: rotate(10deg);
  box-shadow: 0 18px 36px -14px rgba(120, 90, 0, .55), 0 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent);
  font-family: var(--font-display); font-stretch: 80%; font-weight: 800; transition: background .25s, color .25s, box-shadow .25s;
}
.rule-stamp b { font-size: 3.6rem; line-height: .9; letter-spacing: -.03em; }
.rule-stamp span { font-size: 1rem; }
.rule-stamp.is-zero { background: var(--surface-2); color: var(--muted); box-shadow: 0 0 0 6px var(--border); }
.rule-stamp.pop { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: rotate(10deg) scale(.82); } to { transform: rotate(10deg) scale(1); } }
.rl-why { list-style: none; padding: 0; margin: 0; width: 100%; }
.rl-why li { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--glass-soft); border-radius: 0 10px 10px 0; margin-bottom: 8px; font-size: .95rem; }
.rl-why li:first-child { font-weight: 650; border-left-color: var(--primary); }

/* Linea dei numeri */
.nline { position: relative; padding: 138px 0 0; margin: 0 22px 6px; }
.nline-track { position: relative; height: 8px; border-radius: 999px; background: var(--border); }
.nl-result { position: absolute; top: -10px; bottom: -10px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); }
.nl-result b { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-family: var(--font-display); font-weight: 800; color: color-mix(in srgb, var(--accent) 40%, var(--text)); }
.nl-mark { position: absolute; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: left .12s; --stem: 8px; z-index: 1; }
.nl-mark.lane-1 { --stem: 46px; }
.nl-mark.lane-2 { --stem: 84px; z-index: 0; }
.nl-mark i { position: relative; z-index: 1; font-style: normal; font-weight: 650; font-size: .78rem; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.nl-mark small { color: var(--muted); font-size: .72rem; }
.nl-mark small { position: relative; z-index: 1; }
.nl-mark::after { content: ""; width: 2px; height: var(--stem); background: var(--muted); opacity: .5; }
.nl-you::after { background: var(--primary); opacity: 1; }
.nl-mark.win i { background: var(--accent); border-color: var(--accent); color: #3a2800; }
.nl-you i { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.nl-you.win i { box-shadow: 0 0 0 3px var(--accent); }
.nline-scale { display: flex; justify-content: space-between; margin-top: 30px; color: var(--muted); font-size: .75rem; }
.nl-res-label { font-weight: 650; margin: 8px 0 16px; }

/* Casi */
.rl-cases { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.rl-cases > .card + .card { margin-top: 0; }
.rl-case header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rl-case header .icon { color: var(--primary); flex: none; }
.rl-case h3 { font-size: 1.05rem; margin: 0; }
.rl-case p { color: var(--muted); margin: 0; }
.rl-pill { margin-left: auto; white-space: nowrap; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 40%, var(--text)); }

/* Classifica */
.rl-board { display: grid; gap: 24px; align-items: start; }
.rl-board h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-stretch: 82%; margin-bottom: 16px; }
.rl-list { list-style: none; padding: 0; margin: 0; }
.rl-list li { display: flex; gap: 10px; margin-bottom: 10px; }
.rl-list .icon { color: var(--primary); flex: none; margin-top: 3px; }
.rl-example { margin: 0; }
.rl-example ol { list-style: none; padding: 0; margin: 0 0 12px; }
.rl-example li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.rl-example li + li { border-top: 1px solid var(--border); }
.rl-example li.me { background: var(--primary-soft); border-top-color: transparent; }
.rl-example li.me + li { border-top-color: transparent; }
.rl-example .rk { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); font-weight: 800; font-family: var(--font-display); }
.rl-example .rk-1 { background: var(--accent); color: #3a2800; }
.rl-example small { color: var(--muted); }
.rl-example em { font-style: normal; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; min-width: 3ch; text-align: right; }
.rl-example figcaption { color: var(--muted); font-size: .88rem; }

.rl-end { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 32px 20px; }
.rl-end h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); font-stretch: 82%; }

/* Pulsanti verso il regolamento */
.lh-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.lh-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-stretch: 82%; margin: 0; }
.page-head-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; }

@media (min-width: 720px) {
  .rl-stamps { grid-template-columns: repeat(4, 1fr); }
  .rl-body { grid-template-columns: 1.5fr 1fr; gap: 36px; padding: 28px; }
  .rl-board { grid-template-columns: 1.1fr .9fr; gap: 40px; }
  .rl-cases { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .rs b, .rule-stamp.pop { animation: none !important; }
  .nl-mark, .crowd i { transition: none; }
}

/* =========================================================================
   2.3 · Esito con prova, storico e contestazioni
   ========================================================================= */
.card-title .badge { margin-left: 4px; }
.proof { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--glass-soft); border: 1px solid var(--glass-border); }
.proof-label { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.note-text { white-space: pre-line; overflow-wrap: anywhere; margin: 0 0 8px; }
.proof .note-text:last-child { margin-bottom: 0; }
.proof-thumb { display: block; max-width: 100%; max-height: 340px; width: auto; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.proof-thumb.small { max-height: 160px; margin-top: 6px; }
.result-history-box { margin-top: 14px; }
.result-history li { padding: 10px 0; border-top: 1px solid var(--border); }
.result-history li:first-child { border-top: 0; }
.result-history li > b { display: block; }
.dispute-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); }
.dispute-list li:first-child { border-top: 0; padding-top: 0; }
.dispute-list .note-text { margin: 0; color: var(--muted); }
.correct-box > summary { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.input-file { display: block; width: 100%; font: inherit; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--glass-soft); color: var(--muted); }
.proof-preview { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.proof-preview img { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--border); }

/* =========================================================================
   Novità (changelog): una linea del tempo, la versione più recente in oro
   ========================================================================= */
.cl-head { margin-bottom: 24px; }
.cl-head h1 { font-size: clamp(2rem, 6vw, 3rem); font-stretch: 80%; letter-spacing: -.02em; margin-bottom: 6px; }
.cl-list { list-style: none; padding: 0 0 0 26px; margin: 0; position: relative; }
.cl-list::before { content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px; width: 2px; background: var(--border); border-radius: 2px; }
.cl-item { position: relative; margin-bottom: 26px; }
.cl-item::before {
  content: ""; position: absolute; left: -26px; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--primary);
}
.cl-item.is-latest::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.cl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.cl-version { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: 1.5rem; line-height: 1; }
.cl-meta time { color: var(--muted); font-size: .9rem; }
.cl-card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.cl-card ul { margin: 0; padding-left: 20px; }
.cl-card li { margin-bottom: 6px; color: var(--text); }
.cl-card li::marker { color: var(--primary); }
.cl-card li:last-child { margin-bottom: 0; }
.footer-version { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-variant-numeric: tabular-nums; }

/* Novità e termini aggiornati (al primo accesso dopo un aggiornamento dei termini) */
.terms-update .tu-h { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 20px 0 10px; }
.terms-update .tu-h .icon { color: var(--primary); }
.tu-news { list-style: none; padding: 0; margin: 0 0 8px; }
.tu-news li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.tu-news li:first-child { border-top: 0; }
.tu-news .cl-version { font-size: 1.15rem; padding-top: 1px; }
.proof-delete { margin-top: 6px; }
.proof-delete .link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); }

/* =========================================================================
   2.5 · Pagina del risultato: prima l'esito, poi il perché
   ========================================================================= */
.badge-gold { background: var(--accent); color: #3a2800; }
.result-card .flash { margin-bottom: 14px; }
.results-final .result-row { padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; }
.results-final .result-row + .result-row { margin-top: 6px; }
.results-final .result-row.winner { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.results-final .result-row.winner .label-text { font-weight: 750; }
.results-final .result-row.mine .label-text::after { content: none; }
.result-number { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: 14px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.rn-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.rn-value { font-family: var(--font-display); font-stretch: 80%; font-size: 2.4rem; line-height: 1; letter-spacing: -.02em; }
.rn-mine { font-size: .9rem; color: var(--muted); }
.stats-grid.compact .stat { padding: 8px 10px; }
.stats-grid.compact .stat b { font-size: 1.05rem; }
.points-summary { margin: 0 0 12px; }
.points-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border); }
.points-list li:first-child { border-top: 0; }
.points-list li.me { background: var(--primary-soft); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; }
.points-list .pl-who { font-weight: 650; overflow-wrap: anywhere; }
.points-list .pl-who small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.points-list .pl-why { color: var(--muted); font-size: .85rem; }
.points-list .pl-total { font-family: var(--font-display); font-size: 1.15rem; color: var(--primary); min-width: 3ch; text-align: right; }
@media (max-width: 480px) {
  .points-list li { grid-template-columns: 1fr auto; }
  .points-list .pl-why { grid-column: 1; grid-row: 2; }
  .points-list .pl-total { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}

/* =========================================================================
   2.5 · Home: "Guarda come funziona" (telefono animato allo scorrimento)
   ========================================================================= */
.demo-lead { margin: 6px 0 0; max-width: 36em; }
.demo-grid { display: block; }
.demo-steps { list-style: none; padding: 0; margin: 0; }
.demo-step { display: grid; gap: 18px; justify-items: center; padding: 26px 0; }
.demo-step + .demo-step { border-top: 1px dashed var(--border); }
.demo-text { max-width: 30em; justify-self: start; }
.demo-n {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-family: var(--font-display); font-weight: 800; margin-bottom: 8px;
}
.demo-text h3 { font-size: clamp(1.3rem, 3.4vw, 1.7rem); font-stretch: 85%; margin: 0 0 6px; }
.demo-text p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.demo-stage { display: none; }

/* Il telefono */
.phone {
  --ph-w: 290px; --ph-frame: #0e1a14; position: relative; width: var(--ph-w); height: calc(var(--ph-w) * 1.72);
  border-radius: 38px; padding: 10px; background: var(--ph-frame);
  box-shadow: 0 30px 60px -24px rgba(10, 30, 20, .55), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}
:root[data-theme="dark"] .phone { --ph-frame: #2a3d32; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .14) inset; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .phone { --ph-frame: #2a3d32; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .14) inset; }
}
.phone::before { content: ""; position: absolute; z-index: 3; top: 16px; left: 50%; width: 76px; height: 18px; margin-left: -38px; border-radius: 12px; background: var(--ph-frame); }
.ph-screen {
  position: absolute; inset: 10px; border-radius: 29px; overflow: hidden; background: var(--bg);
  display: flex; flex-direction: column; font-size: 13.5px; color: var(--text);
}
.demo-sticky .ph-screen { opacity: 0; transition: opacity .35s; }
.demo-sticky .ph-screen.is-active { opacity: 1; }
.ph-bar { display: flex; align-items: center; gap: 6px; padding: 38px 14px 10px; background: var(--surface); border-bottom: 1px solid var(--border); font-family: var(--font-display); }
.ph-bar img { width: 18px; height: 18px; }
.ph-bar span { margin-left: auto; font-family: var(--font); font-size: 10px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 3px 7px; border-radius: 999px; }
.ph-body { position: relative; flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ph-body h4 { margin: 0; font-family: var(--font-display); font-size: 17px; font-stretch: 85%; display: flex; align-items: baseline; gap: 6px; }
.ph-body h4 small { font-family: var(--font); font-size: 10px; color: var(--muted); font-weight: 600; }
.ph-field > span, .ph-sub { display: block; font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.ph-input { min-height: 34px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); line-height: 1.35; }
.ph-caret { display: inline-block; width: 2px; height: 14px; margin-left: 1px; vertical-align: -2px; background: var(--primary); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ph-chips { display: flex; gap: 5px; }
.ph-chips b { flex: 1; text-align: center; padding: 7px 4px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-size: 11px; }
.ph-btn { margin-top: auto; text-align: center; padding: 10px; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-weight: 700; }
.ph-toast {
  position: absolute; left: 14px; right: 14px; top: 10px; z-index: 5; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); padding: 9px 11px; border-radius: 11px;
  background: var(--text); color: var(--bg); font-weight: 650; font-size: 12px; opacity: 0; transform: translateY(-10px);
}
.ph-link { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 11px; }
.ph-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-copy { position: relative; margin-left: auto; padding: 5px 10px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 11px; min-width: 64px; text-align: center; }
.ph-copy em { font-style: normal; }
.ph-copy em + em { position: absolute; inset: 5px 0; opacity: 0; }
.ph-members { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ph-members li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.js-on .ph-members li { opacity: 0; }
.ph-members i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #3a2800; font-style: normal; font-weight: 800; font-size: 11px; }
.ph-card { padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.ph-q { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.2; }
.ph-meta { color: var(--muted); font-size: 11px; margin: 6px 0 4px; }
.ph-meta b { color: var(--text); }
.ph-line { position: relative; height: 110px; margin: 0 10px 14px; }
.ph-track { position: absolute; left: 0; right: 0; bottom: 8px; height: 5px; border-radius: 3px; background: var(--border); }
.ph-pin { position: absolute; left: var(--x); bottom: 13px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; z-index: 1; }
.ph-pin i { font-style: normal; font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.ph-pin small { font-size: 9px; color: var(--muted); }
.ph-pin::after { content: ""; width: 2px; height: var(--stem, 6px); background: var(--muted); opacity: .5; }
.ph-pin.lane-1 { --stem: 30px; }
.ph-pin.lane-2 { --stem: 54px; z-index: 0; }
.ph-pin.you i { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ph-pin.you::after { background: var(--primary); opacity: 1; }
.ph-mark { position: absolute; left: var(--x); bottom: -4px; width: 3px; height: 22px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); z-index: 2; transform-origin: bottom; }
.ph-mark b { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; font-size: 10px; color: color-mix(in srgb, var(--accent) 40%, var(--text)); }
.ph-answer em { font-style: normal; color: var(--muted); margin-left: 6px; }
.s3 .ph-btn { margin-top: 0; }
.js-on .ph-result { opacity: 0; }
.ph-result .ph-line { height: 92px; margin-bottom: 24px; }
.ph-win { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--primary); }
.ph-stamp {
  position: absolute; right: 12px; top: 104px; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: var(--accent); color: #3a2800; font-family: var(--font-display); font-weight: 800; font-stretch: 80%; line-height: 1;
  box-shadow: 0 10px 24px -8px rgba(120, 90, 0, .6), 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: rotate(12deg); z-index: 4;
}
.js-on .ph-stamp { transform: rotate(12deg) scale(0); opacity: 0; }
.ph-stamp b { font-size: 26px; }
.ph-stamp span { font-size: 11px; }
.ph-board { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ph-board li { position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; height: 44px; padding: 0 12px 0 8px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.ph-board i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-style: normal; font-weight: 800; font-size: 11px; }
.ph-board li:first-child i { background: var(--accent); color: #3a2800; }
.ph-board em { font-style: normal; font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.ph-board .you { background: var(--primary-soft); border-color: var(--primary); z-index: 1; }

/* Animazioni: partono quando la schermata riceve .play (scorrendo) */
.play .ph-chips .pick { animation: pick .3s 2.3s both; }
@keyframes pick { to { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); } }
.play .press { animation: press .35s both; }
.s0.play .press { animation-delay: 3s; }
.s3.play .press { animation-delay: 1s; }
@keyframes press { 50% { transform: scale(.94); filter: brightness(1.15); } 100% { transform: none; } }
.play .ph-toast { animation: toast .4s both; }
.s0.play .ph-toast { animation-delay: 3.4s; }
.s4.play .ph-toast { animation-delay: 2.4s; }
@keyframes toast { to { opacity: 1; transform: none; } }
.s1.play .ph-copy em:first-child { animation: fadeout .2s .9s both; }
.s1.play .ph-copy em + em { animation: fadein .2s .9s both; }
@keyframes fadeout { to { opacity: 0; } }
@keyframes fadein { to { opacity: 1; } }
.s1.play .ph-members li { animation: popin .4s calc(1.3s + var(--d) * .45s) cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes popin { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.js-on .s2 .ph-pin { opacity: 0; }
.s2.play .ph-pin { animation: drop .45s calc(.4s + var(--d) * .45s) cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -26px); } to { opacity: 1; transform: translate(-50%, 0); } }
.s3.play .ph-result { animation: fadein .4s 1.4s both; }
.s3.play .ph-mark { animation: grow .4s 1.7s both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.s3.play .ph-pin.win i { animation: goldify .3s 2.1s both; }
@keyframes goldify { to { background: var(--accent); border-color: var(--accent); color: #3a2800; } }
.s3.play .ph-stamp { animation: stampin .5s 2.4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stampin { from { transform: rotate(12deg) scale(0); opacity: 0; } to { transform: rotate(12deg) scale(1); opacity: 1; } }
.s4.play .ph-board .up { animation: rowup .6s 1.7s cubic-bezier(.5, 0, .2, 1) both; }
.s4.play .ph-board .down { animation: rowdown .6s 1.7s cubic-bezier(.5, 0, .2, 1) both; }
@keyframes rowup { to { transform: translateY(calc(-100% - 6px)); } }
@keyframes rowdown { to { transform: translateY(calc(100% + 6px)); } }

@media (min-width: 900px) {
  .demo-grid { display: grid; grid-template-columns: 1fr 340px; gap: 48px; align-items: start; }
  .demo-step { min-height: 72vh; align-content: center; justify-items: start; padding: 0; }
  .demo-step + .demo-step { border-top: 0; }
  .demo-step .demo-text { opacity: .35; transition: opacity .3s; }
  .demo-step.is-active .demo-text { opacity: 1; }
  .demo-inline { display: none; }
  .demo-stage { display: block; position: sticky; top: max(84px, calc(50vh - 290px)); }
  .demo-sticky { --ph-w: 300px; margin-left: auto; }
}

/* Perché è divertente */
.why { display: grid; gap: 28px; align-items: center; }
.why h2, .simple h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-stretch: 82%; margin-bottom: 14px; }
.why-list { list-style: none; padding: 0; margin: 0; }
.why-list li { position: relative; padding: 10px 0 10px 30px; font-size: 1.08rem; border-top: 1px solid var(--border); }
.why-list li:first-child { border-top: 0; }
.why-list li::before { content: ""; position: absolute; left: 4px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.chat { display: flex; flex-direction: column; gap: 8px; max-width: 360px; justify-self: center; width: 100%; }
.msg { margin: 0; max-width: 85%; padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--glass); border: 1px solid var(--glass-border); box-shadow: 0 6px 18px -12px var(--glass-edge); }
.msg b { display: block; font-size: .75rem; color: var(--primary); margin-bottom: 1px; }
.msg.me { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.msg.me b { color: inherit; }

/* Semplice davvero */
.simple-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.simple-list li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start; padding: 14px 0; border-top: 2px solid var(--primary); }
.simple-list .icon { grid-row: span 2; color: var(--primary); width: 22px; height: 22px; margin-top: 2px; }
.simple-list b { font-size: 1.05rem; }
.simple-list span { color: var(--muted); }
@media (min-width: 860px) { .why { grid-template-columns: 1.1fr .9fr; gap: 48px; } }

@media (prefers-reduced-motion: reduce) {
  .ph-screen *, .ph-screen *::before, .ph-screen *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
  .ph-caret { animation: none !important; }
}

/* =========================================================================
   2.5.1 · Link per chi arriva in alto, demo più piena su desktop
   ========================================================================= */
.guestnav {
  margin-left: auto; display: flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.guestnav a {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: 999px;
  color: var(--primary-strong); font-weight: 650; font-size: .9rem; white-space: nowrap;
}
.guestnav a:hover, .guestnav a.active { background: var(--surface); color: var(--text); text-decoration: none; box-shadow: 0 1px 3px rgba(10, 30, 20, .12); }
.guestnav .icon { width: 15px; height: 15px; vertical-align: 0; }
.guestnav + .btn { margin-left: 4px; }
@media (max-width: 719px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .guestnav + .btn { margin-left: auto; }
  .guestnav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .guestnav a { flex: 1 1 auto; justify-content: center; padding: 6px 8px; font-size: .85rem; }
}

/* Etichetta con il dato concreto di ogni passaggio */
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 5px 11px 5px 9px;
  border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: .88rem; font-weight: 650;
}
.demo-chip .icon { width: 16px; height: 16px; vertical-align: 0; color: var(--primary); }

@media (min-width: 900px) {
  .demo-grid { grid-template-columns: minmax(0, 1fr) minmax(380px, .85fr); gap: 40px; }
  /* Binario dei passaggi: grigio, si riempie di verde mentre scorri */
  .demo-steps { position: relative; }
  .demo-steps::before, .demo-steps::after {
    content: ""; position: absolute; z-index: 0; left: 22px; top: 24vh; bottom: 24vh; width: 3px; border-radius: 3px; background: var(--border);
  }
  .demo-steps::after { background: var(--primary); transform-origin: top; transform: scaleY(var(--demo-p, 0)); transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
  .demo-step { min-height: 48vh; padding-left: 72px; }
  .demo-text {
    position: relative; z-index: 1; max-width: 34em; padding: 22px 26px; border-radius: 22px; border: 1px solid transparent;
    transition: opacity .3s, background-color .3s, box-shadow .3s, border-color .3s;
  }
  /* Sbiadisce il testo, non il pallino: così la linea non si vede attraverso */
  .demo-step .demo-text { opacity: 1; }
  .demo-text > :not(.demo-n) { transition: opacity .3s; }
  .demo-step:not(.is-active) .demo-text > :not(.demo-n) { opacity: .45; }
  .demo-step.is-active .demo-text {
    opacity: 1; background: var(--glass); border-color: var(--glass-border);
    box-shadow: 0 24px 48px -30px var(--glass-edge), 0 2px 6px -2px var(--glass-edge);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .demo-n {
    position: absolute; z-index: 1; left: -72px; top: 50%; width: 48px; height: 48px; margin: -24px 0 0;
    font-size: 1.15rem; background: var(--surface); color: var(--muted); box-shadow: 0 0 0 3px var(--border) inset;
    transition: background-color .3s, color .3s, box-shadow .3s;
  }
  .demo-step.is-past .demo-n, .demo-step.is-active .demo-n { background: var(--primary); color: var(--on-primary); box-shadow: none; }
  .demo-step.is-active .demo-n { box-shadow: 0 0 0 7px var(--primary-soft); }
  .demo-text h3 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); margin-bottom: 8px; }
  .demo-text p { font-size: 1.1rem; line-height: 1.55; }
  /* Il telefono su un "palco": un alone caldo che riempie la colonna */
  .demo-stage { display: grid; place-items: center; padding: 20px 0; }
  .demo-stage::before {
    content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 680px; aspect-ratio: 1; transform: translate(-50%, -50%);
    border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 50%, transparent) 0%, color-mix(in srgb, var(--accent) 22%, transparent) 38%, color-mix(in srgb, var(--primary) 10%, transparent) 55%, transparent 70%);
  }
  .demo-sticky { margin: 0 auto; }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .demo-steps::after, .demo-text, .demo-n, .demo-text > * { transition: none; }
}

/* =========================================================================
   2.6 · Pulsante "invio in corso" (codice di accesso)
   ========================================================================= */
.btn.is-busy { cursor: progress; opacity: .85; pointer-events: none; }
.spinner {
  display: inline-block; width: 1em; height: 1em; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* =========================================================================
   2.7 · Passkey
   ========================================================================= */
.pk-count { margin-left: auto; font-size: .82rem; font-weight: 600; color: var(--muted); }
.pk-list { list-style: none; margin: 0 0 12px; padding: 0; }
.pk-item {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 6px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.pk-item:first-child { border-top: 0; }
.pk-main { min-width: 0; }
.pk-main b { overflow-wrap: anywhere; }
.pk-main .badge { margin-left: 6px; background: var(--primary-soft); color: var(--primary-strong); vertical-align: 1px; }
.pk-main small { display: block; color: var(--muted); }
.pk-rename > summary {
  list-style: none; cursor: pointer; display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; color: var(--muted);
}
.pk-rename > summary::-webkit-details-marker { display: none; }
.pk-rename > summary:hover, .pk-rename[open] > summary { background: var(--surface-2); color: var(--text); }
.pk-rename[open] { grid-column: 1 / -1; grid-row: 2; }
.pk-rename[open] > summary { display: none; }
.pk-rename-form { display: flex; gap: 8px; }
.pk-rename-form .input { flex: 1; min-width: 0; }
.pk-add { display: grid; gap: 8px; justify-items: start; }
.pk-add [data-passkey-msg]:empty, .pk-offer [data-passkey-msg]:empty, .pk-login-msg:empty { display: none; }

.or-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: .85rem; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pk-login-msg { margin-top: 8px; color: var(--danger, #b42318); }

.pk-offer { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.pk-offer[hidden] { display: none; }
.pk-offer-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
}
.pk-offer-icon .icon { width: 24px; height: 24px; }
.pk-offer-body { display: grid; gap: 8px; min-width: 0; }
.pk-offer h2 { margin: 0; font-size: 1.15rem; }
.pk-offer p { margin: 0; }

/* Profilo: "Accesso e sicurezza" in un'unica scheda, menu del profilo nella barra in alto */
.sec-part + .sec-part { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1rem; }
.sec-title .icon { width: 18px; height: 18px; color: var(--muted); }

.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); padding: 8px 10px 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu > summary.active, .user-menu[open] > summary { color: var(--text); background: var(--surface-2); }
.user-menu > summary .chev { width: 14px; height: 14px; transition: transform .2s; }
.user-menu[open] > summary .chev { transform: rotate(180deg); }
.user-menu .zone-menu { left: auto; right: 0; min-width: 230px; }
.user-menu .zone-menu a, .user-menu .zone-menu button { color: var(--text); padding: 9px 10px; font-weight: 500; font-size: .92rem; }
.user-menu .zone-menu a:hover, .user-menu .zone-menu button:hover { background: var(--surface-2); color: var(--text); }
.user-menu .zone-menu form { margin: 0; }
.user-menu-who { display: flex; flex-direction: column; padding: 8px 10px 6px; min-width: 0; }
.user-menu-who b { overflow-wrap: anywhere; }
.user-menu-who small { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
#security, #passkeys { scroll-margin-top: 84px; }

/* =========================================================================
   2.8 · Limiti dei numeri, pronostici per data, modulo di segnalazione
   ========================================================================= */
.limits-grid { display: grid; gap: 12px; margin-top: 12px; }
.limits-grid label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
@media (min-width: 560px) { .limits-grid { grid-template-columns: 1fr 1fr 1.2fr; } .limits-grid.two { grid-template-columns: 1fr 1fr; } }
.mt-0 { margin-top: 0; }
/* Calendario nativo: su telefono apre quello del sistema, su computer quello del browser.
   Qui solo il campo: stessa altezza degli altri, icona del calendario nei colori del tema. */
.input-date { min-height: 44px; font-variant-numeric: tabular-nums; }
.input-date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; padding: 4px; border-radius: 6px; }
.input-date::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--surface-2); }
.contact-wrap { max-width: 680px; margin: 0 auto; }
.cform .field { margin-bottom: 16px; }
.cat-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .cat-picker { grid-template-columns: repeat(3, 1fr); } }
.cat-picker input { position: absolute; opacity: 0; pointer-events: none; }
.cat-picker label {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .92rem; line-height: 1.25;
}
.cat-picker label .icon { color: var(--muted); }
.cat-picker input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.cat-picker input:checked + label .icon { color: var(--primary); }
.cat-picker input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.cat-note { display: none; margin: 10px 0 0; }
.cform:has(#cat-security:checked) .cat-note[data-for="security"],
.cform:has(#cat-conduct:checked) .cat-note[data-for="conduct"] { display: flex; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* 2.8.1: risultato fuori dai limiti */
.out-of-limits { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: var(--warning-soft); }
.out-of-limits .card-title .icon { color: var(--warning); }

/* 2.8.1: linea dei pronostici dopo l'esito */
.tl { display: none; margin: 4px 0 14px; }
.tl.ready { display: block; }
.tl figcaption { margin-bottom: 4px; }
.tl-track { position: relative; height: calc(40px + var(--lanes, 1) * 13px); }
.tl-track.lanes-2 { --lanes: 2; } .tl-track.lanes-3 { --lanes: 3; } .tl-track.lanes-4 { --lanes: 4; }
.tl-track.lanes-5 { --lanes: 5; } .tl-track.lanes-6 { --lanes: 6; } .tl-track.lanes-7 { --lanes: 7; } .tl-track.lanes-8 { --lanes: 8; }
.tl-axis { position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; border-radius: 2px; background: var(--border); }
.tl-mark { position: absolute; left: var(--x, 50%); top: 0; bottom: 0; width: 0; border-left: 2px solid var(--accent); }
.tl-mark b {
  position: absolute; top: 0; left: 0; transform: translateX(-50%); white-space: nowrap;
  font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #1b1300;
}
.tl-mark.edge-l b { transform: translateX(-2px); }
.tl-mark.edge-r b { transform: translateX(calc(-100% + 2px)); }
.tl-track .tl-dot { position: absolute; left: var(--x, 50%); bottom: calc(12px + var(--lane, 0) * 13px); transform: translateX(-50%); }
.tl-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 55%, var(--surface)); border: 2px solid var(--surface);
}
.tl-dot.win { background: var(--accent); }
.tl-dot.me { background: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.tl-dot.lane-1 { --lane: 1; } .tl-dot.lane-2 { --lane: 2; } .tl-dot.lane-3 { --lane: 3; } .tl-dot.lane-4 { --lane: 4; }
.tl-dot.lane-5 { --lane: 5; } .tl-dot.lane-6 { --lane: 6; } .tl-dot.lane-7 { --lane: 7; }
.tl-ends { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* 2.8.1: dove puntano i voti, prima dell'esito */
.dist { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.dist-head { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 6px; }
.dist-head .icon { width: 18px; height: 18px; color: var(--muted); }
.dist-row { display: grid; grid-template-columns: minmax(0, 9.5em) 1fr 2.2em; align-items: center; gap: 10px; padding: 3px 0; }
.dist-row .bar { margin-top: 0; }
.dist-l { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dist-n { text-align: right; font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.dist-row.is-empty .dist-l, .dist-row.is-empty .dist-n { color: var(--muted); opacity: .7; }
.dist-row.top .dist-l { font-weight: 700; }
.dist-row.mine .bar > i { background: var(--accent); }
@media (min-width: 560px) { .dist-row { grid-template-columns: minmax(0, 12em) 1fr 2.4em; } }
.stats-grid.is-date .stat b { font-size: 1.12rem; line-height: 1.25; }
