:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f0f0f0;
  --text-secondary: rgba(240, 240, 240, 0.66);
  --text-muted: rgba(240, 240, 240, 0.46);
  --accent: #c6ff3d;
  --accent-dim: rgba(198, 255, 61, 0.14);
  --accent-ink: #0a0a0a;
  --loss: #ff6b6b;
  --loss-dim: rgba(255, 107, 107, 0.14);
  --font-display: "Clash Display", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 64px;
  --rail-w: 88px;
  --gutter: 20px;
}

* { box-sizing: border-box; margin: 0; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; touch-action: pan-y; overscroll-behavior: none; overflow-x: clip; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ═══ SHELL + NAV ═══ */
.shell { display: block; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch; justify-content: space-around;
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--border);
}
.brand { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 48px; font-size: 11px; letter-spacing: 0.04em; color: var(--text-muted);
  transition: color 150ms var(--ease);
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent); }
.tab:active { transform: scale(0.96); }

.main {
  padding: 0 var(--gutter) calc(var(--nav-h) + 36px + env(safe-area-inset-bottom));
  width: 100%; max-width: 1320px; margin: 0 auto; min-width: 0;
}

/* ═══ TIPOGRAFIA ═══ */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); font-weight: 500; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ═══ TOPBAR (titolo sezione + aggiorna) ═══ */
.topbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 calc(var(--gutter) * -1) 18px; padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--gutter) 14px; min-height: 56px;
  background: var(--bg-primary); box-shadow: 0 10px 20px -18px #000;
}
.back { font-size: 15px; color: var(--accent); min-height: 40px; padding-right: 10px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.upd { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong);
  display: grid; place-items: center; color: var(--text-secondary);
  transition: color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ LAYOUT PAGINA ═══ */
.charts { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.page { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
.hero { display: grid; gap: 6px; align-content: start; }
.hero h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); line-height: 1.04; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--text-secondary); font-size: 13.5px; max-width: 42ch; }
.stats { display: flex; gap: 24px; margin-top: 8px; flex-wrap: wrap; }
.stat b { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 1.25rem; }
.stat span { font-size: 12px; color: var(--text-muted); }
.col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); min-width: 0; }
.cards > * { min-width: 0; }

/* Tablet: barra a sinistra, hero in alto a tutta larghezza, card su 2+ colonne */
@media (min-width: 768px) {
  :root { --gutter: 32px; }
  /* Sidebar davvero fissa (position: fixed, non sticky): resta ferma mentre la pagina scorre */
  .shell { display: block; padding-left: var(--rail-w); }
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0; right: auto; inset: 0 auto 0 0;
    width: var(--rail-w); height: auto; padding: 28px 0;
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 6px;
    border-top: 0; border-right: 1px solid var(--border);
  }
  .brand { display: block; font-family: var(--font-display); font-weight: 700; text-align: center; margin-bottom: 22px; font-size: 1.05rem; }
  .brand span { color: var(--accent); }
  .tab { flex: 0 0 auto; padding: 14px 0; }
  .tab:hover { color: var(--text-primary); }
  .tab[aria-current="page"]:hover { color: var(--accent); }
  .main { padding: 0 var(--gutter) 80px; }
  .topbar { padding-top: 32px; }
  .page { gap: 32px; }
  .hero h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
  .hero p { font-size: 14.5px; }
  .stats { gap: 32px; }
}

/* Desktop: hero fisso a sinistra (asimmetrico), contenuto a destra */
@media (min-width: 1024px) {
  .page { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 64px; }
  .hero { position: sticky; top: 40px; align-self: start; }
  .hero h1 { font-size: clamp(2.6rem, 3.6vw, 3.4rem); }
  .charts { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts .wide { grid-column: 1 / -1; }
}

/* Schermi grandi */
@media (min-width: 1500px) {
  .main { max-width: 1440px; }
  .page { grid-template-columns: 380px minmax(0, 1fr); }
}

/* ═══ CARD PARTITA ═══ */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: grid; gap: 12px; align-content: start;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}
@media (hover: hover) { .card:hover { border-color: var(--border-strong); } }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.league { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.when { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); white-space: nowrap; }
.when.soon { color: var(--accent); }
.teams { overflow-wrap: anywhere; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.2; }
.teams i { font-style: normal; color: var(--text-muted); font-weight: 500; padding: 0 0.3em; }
.figures { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; }
.big { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 500; color: var(--accent); line-height: 1.1; }
.fig { font-size: 12.5px; color: var(--text-secondary); }
.fig b { font-family: var(--font-mono); font-weight: 500; color: var(--text-primary); }

/* barra probabilita': riempimento = modello, tacca = soglia, cerchio = mercato */
.pbar { position: relative; height: 6px; border-radius: 6px; background: var(--bg-tertiary); margin: 8px 0 4px; }
.pbar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--accent); }
.pbar .tick { position: absolute; top: -5px; width: 2px; height: 16px; background: var(--text-primary); border-radius: 2px; margin-left: -1px; }
.pbar .mkt { position: absolute; top: -1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; border: 2px solid var(--text-secondary); background: var(--bg-primary); }

/* legenda "come leggere" (una volta sola, non per ogni card) */
.legend { display: flex; gap: 8px 16px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; vertical-align: middle; margin-right: 6px; }
.legend .l-fill::before { width: 12px; height: 4px; background: var(--accent); border-radius: 2px; }
.legend .l-tick::before { width: 2px; height: 11px; background: var(--text-primary); }
.legend .l-mkt::before { width: 7px; height: 7px; border: 2px solid var(--text-secondary); border-radius: 50%; }
.legend .l-base::before { width: 14px; height: 0; border-top: 1px dashed var(--text-muted); }
.legend .l-hit::before { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.legend .l-miss::before { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: var(--accent-ink); width: 100%;
  transition: transform 150ms var(--ease), opacity 150ms var(--ease), background-color 150ms var(--ease);
}
@media (hover: hover) { .btn:not([disabled]):hover { background: #d6ff6b; } }
.btn:active { transform: scale(0.98); }
.btn[disabled] { background: var(--bg-tertiary); color: var(--text-secondary); cursor: default; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-family: var(--font-mono); white-space: nowrap;
}
.badge.win { background: var(--accent-dim); color: var(--accent); }
.badge.loss { background: var(--loss-dim); color: var(--loss); }
.badge.neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-size: 1.2rem; }

details.more > summary {
  list-style: none; cursor: pointer; min-height: 48px; padding: 14px 16px; border: 1px dashed var(--border-strong);
  border-radius: 16px; color: var(--text-secondary); font-size: 14px; display: flex; justify-content: space-between; align-items: center;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
details.more > summary:hover { border-color: var(--accent); color: var(--text-primary); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .chev { transition: transform 200ms var(--ease); }
details.more[open] > summary .chev { transform: rotate(180deg); }
details.more[open] > summary { margin-bottom: 14px; }

.empty { padding: 28px 18px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 16px; }

/* ═══ GRAFICI ═══ */
.chart { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 16px 16px 14px; display: grid; gap: 10px; min-width: 0; align-content: start; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.chart h3 { font-size: 1rem; }
.chart .note { font-size: 12.5px; color: var(--text-muted); }
.chart .plot { width: 100%; min-height: 40px; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-mono); fill: var(--text-secondary); font-size: 10.5px; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .base { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .bar { fill: var(--accent); }
.chart .bar.zero { fill: var(--bg-tertiary); }
.chart .val { fill: var(--text-primary); font-size: 11.5px; }
.tag { font-size: 11px; font-family: var(--font-mono); padding: 2px 8px; border-radius: 999px; background: var(--bg-tertiary); color: var(--text-secondary); white-space: nowrap; }
.tag.warn { color: #ffd166; background: rgba(255, 209, 102, 0.12); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 13.5px; color: var(--text-secondary); transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease); }
@media (hover: hover) { .chip:hover { border-color: var(--text-secondary); } }
.chip[aria-pressed="true"] { background: var(--accent-dim); color: var(--accent); border-color: transparent; }

/* ═══ STORICO (righe) ═══ */
.list { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 2px 16px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: center; }
.row:last-child { border-bottom: 0; }
.row .teams { font-size: 1rem; }
.row .sub { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); grid-column: 1; line-height: 1.5; }
.row .badge { grid-row: 1 / span 2; grid-column: 2; }
@media (min-width: 1024px) {
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 72px; align-items: center; }
  .row .sub { grid-column: 2; grid-row: 1; }
  .row .badge { grid-row: 1; grid-column: 3; justify-self: end; }
}

/* ═══ MOTION ═══ */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 520ms var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--bg-tertiary); border: 1px solid var(--border-strong); padding: 10px 18px; border-radius: 999px; font-size: 13.5px; z-index: 20; max-width: calc(100vw - 32px); text-align: center;
}
@media (min-width: 768px) { .toast { bottom: 28px; } }

.skeleton { height: 120px; border-radius: 16px; background: linear-gradient(100deg, var(--bg-secondary) 30%, var(--bg-tertiary) 50%, var(--bg-secondary) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .rise, .skeleton, .icon-btn.spin svg { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ═══ SERIE A: barra 1 X 2 ═══ */
.p3 { display: flex; gap: 3px; height: 40px; }
.p3 .seg {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px; min-width: 0;
  background: var(--bg-tertiary); color: var(--text-secondary); border-radius: 8px; font-family: var(--font-mono); font-size: 12px;
}
.p3 .seg:first-child { border-radius: 12px 6px 6px 12px; }
.p3 .seg:last-child { border-radius: 6px 12px 12px 6px; }
.p3 .seg b { font-weight: 500; color: var(--text-primary); }
.p3 .seg.fav { background: var(--accent); color: var(--accent-ink); }
.p3 .seg.fav b { color: var(--accent-ink); font-weight: 600; }

details.comment > summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); list-style: none; min-height: 32px; display: flex; align-items: center; }
details.comment > summary::-webkit-details-marker { display: none; }
details.comment > summary::before { content: "＋"; margin-right: 8px; color: var(--accent); }
details.comment[open] > summary::before { content: "－"; }
details.comment p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin: 8px 0 12px; }
.expected { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.expected div { background: var(--bg-tertiary); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.expected span { font-size: 11px; color: var(--text-muted); }
.expected b { font-family: var(--font-mono); font-weight: 500; font-size: 12.5px; }

.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-secondary); }
.verdict p { font-size: 13.5px; color: var(--text-secondary); }
.verdict .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.verdict.green .dot { background: var(--accent); }
.verdict.amber .dot { background: #ffd166; }
.verdict.red .dot { background: var(--loss); }

/* ═══ STATO SISTEMA ═══ */
.jobs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.job { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-secondary); }
.job .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.job .dot.ok { background: var(--accent); }
.job .dot.bad { background: var(--loss); }
.job-name { font-size: 13.5px; }
.job-sub { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* ═══ SIMULATORE + STATISTICHE ═══ */
.chart.sim { gap: 12px; }
.sim-ctl { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: var(--text-secondary); }
.sim-ctl b { color: var(--accent); font-size: 1.3rem; font-weight: 500; }
input[type="range"] { width: 100%; height: 44px; accent-color: var(--accent); background: transparent; cursor: pointer; }
.sim-out, .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.tile { background: var(--bg-tertiary); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; align-content: start; }
.tile b { font-family: var(--font-mono); font-weight: 500; font-size: 1.15rem; }
.tile b.pos { color: var(--accent); }
.tile b.neg { color: var(--loss); }
.tile span { font-size: 11.5px; color: var(--text-muted); }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(92px, 130px) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.hb-label { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { position: relative; height: 8px; border-radius: 6px; background: var(--bg-tertiary); }
.hb-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--accent); }
.hb-base { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px dashed var(--text-muted); }
.hb-val { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }

.cmp { display: grid; gap: 4px; }
.cmp-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto auto auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-label { color: var(--text-secondary); }
.cmp-arrow { color: var(--text-muted); }

/* ═══ DECISIONI, GIORNATE, NOTIFICHE ═══ */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-strong); }
@media (hover: hover) { .btn.ghost:not([disabled]):hover { background: var(--bg-tertiary); } }

.round-nav { display: grid; grid-template-columns: 40px 1fr 40px; gap: 10px; align-items: center; }
.round-nav .select { grid-column: 1 / -1; }
.round-label { display: grid; gap: 0; text-align: center; }
.round-label b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.icon-btn[disabled] { opacity: 0.3; pointer-events: none; }
.icon-btn { font-size: 20px; line-height: 1; }
.select { min-height: 44px; padding: 8px 14px; border-radius: 12px; background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-strong); font: inherit; }

details.match { border-bottom: 1px solid var(--border); padding: 4px 0; }
details.match:last-child { border-bottom: 0; }
details.match > summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.match > summary::-webkit-details-marker { display: none; }
details.match .teams { font-size: 0.98rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
details.match .score { color: var(--accent); }
.detail { display: grid; gap: 14px; padding: 6px 0 14px; }
.ev { font-size: 13px; padding: 3px 0; }
.stat-row { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; text-align: center; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.stat-row span { color: var(--text-muted); }

.rules { display: grid; gap: 8px; padding-left: 18px; font-size: 13.5px; color: var(--text-secondary); }
.dbar { grid-template-columns: minmax(110px, 1fr) auto auto; }

/* ═══ ORGANIZZAZIONE: segmenti, avvisi, meno rumore ═══ */
.seg-ctl { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--bg-tertiary); border-radius: 999px; justify-self: start; }
.seg-ctl button { min-height: 36px; padding: 6px 16px; border-radius: 999px; font-size: 13px; color: var(--text-secondary); transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.seg-ctl button[aria-selected="true"] { background: var(--bg-primary); color: var(--accent); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--loss-dim); border: 1px solid rgba(255, 107, 107, 0.35); }
.alert p { font-size: 13.5px; }
.alert .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--loss); }

details.more > .dz { padding-top: 4px; }
.tag { letter-spacing: 0; }
.tab span { font-size: 10.5px; }

/* ═══ DIRETTA ═══ */
/* Proposta del modello: sopra soglia, va riconosciuta a colpo d'occhio */
.card.hot { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-dim), transparent 140px), var(--bg-secondary); }
.card.hot .league { color: var(--accent); }

/* Interruttore notifiche di una singola partita */
.notify-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.notify-row .btn { white-space: nowrap; }

/* Riepilogo del mattino (testo pensato per Telegram, riletto qui) */
.digest p { font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); overflow-wrap: anywhere; }
.digest p b { color: var(--text-primary); }
.digest p.gap { height: 6px; }
.digest-sep { height: 1px; background: var(--border); margin: 6px 0; }

.live-card { cursor: pointer; }
@media (hover: hover) { .live-card:hover { border-color: var(--accent); } }
.live-pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.live-pill.on { color: #ff6b6b; font-weight: 600; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
.live-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.ls-team { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.15; overflow-wrap: anywhere; }
.ls-team.r { text-align: right; }
.ls-num { font-size: 1.9rem; color: var(--accent); }
.pick-line { font-size: 12.5px; padding: 8px 12px; border-radius: 10px; }
.pick-line.ok { background: var(--accent-dim); color: var(--accent); }
.pick-line.no { background: var(--loss-dim); color: var(--loss); }

.tl { display: grid; grid-template-columns: 44px 28px 1fr; gap: 8px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tl:last-child { border-bottom: 0; }
.tl-min { color: var(--text-muted); font-size: 12.5px; padding-top: 2px; }
.tl-what { font-size: 14px; }
.pstats { display: grid; gap: 14px; }
.pstat { display: grid; grid-template-columns: 52px 1fr 52px; gap: 4px 8px; align-items: center; font-size: 13px; }
.pstat span { text-align: center; color: var(--text-secondary); }
.pstat b:last-of-type { text-align: right; }

/* App installata su iPhone: la barra di sistema (orario, batteria) sta SOPRA la pagina —
   si lascia sempre almeno lo spazio di un iPhone con Dynamic Island, anche se il
   telefono non comunica l'area sicura. */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(max(env(safe-area-inset-top, 0px), 54px) + 18px); }
}
.page { gap: 26px; }
.hero { margin-top: 4px; }

/* ═══ DIRETTA: eventi a due lati, statistiche con colori delle squadre ═══ */
.team-key { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.team-key span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.sw.home { background: var(--accent); }
.sw.away { background: #7db4ff; }

.tl-wrap { display: grid; }
.tl2 { display: grid; grid-template-columns: 1fr 64px 1fr; gap: 8px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tl2:last-child { border-bottom: 0; }
.tl-m { display: grid; justify-items: center; gap: 2px; }
.tl-min { font-size: 12px; color: var(--text-muted); }
.tl-ic { font-size: 18px; line-height: 1; }
.tl-l { text-align: right; }
.tl-c .tl-what { font-size: 14px; }
.tl-c.home { border-right: 2px solid var(--accent); padding-right: 10px; }
.tl-c.away { border-left: 2px solid #7db4ff; padding-left: 10px; }

.pstat b.home { color: var(--accent); text-align: left; }
.pstat b.away { color: #7db4ff; text-align: right; }
.ps-bar i.home { background: var(--accent); }
.ps-bar i.away { background: #7db4ff; }
.hero h1 em, .clk { font-variant-numeric: tabular-nums; }

/* ═══ TOCCO: si deve capire cosa si apre ═══ */
.open-hint { display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 12px; color: var(--accent); }
.open-hint i { font-style: normal; font-size: 15px; line-height: 1; }
.card[role="link"] { cursor: pointer; }
.card[role="link"]:active { transform: scale(0.985); border-color: var(--accent); }

/* righe apribili (risultati Serie A) */
.row-open > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.row-open > summary::-webkit-details-marker { display: none; }
.row-open > summary > .row { flex: 1; min-width: 0; border-bottom: 0; }
.row-open { border-bottom: 1px solid var(--border); }
.row-open:last-of-type { border-bottom: 0; }
.row-open > summary .chev { color: var(--text-muted); font-size: 12px; transition: transform 150ms var(--ease); }
.row-open[open] > summary .chev { transform: rotate(180deg); }
.row-open > .detail, .row-open > .fig { padding: 0 0 14px; }

/* statistiche: barre che partono dal centro */
.ps-bar { display: flex; align-items: center; gap: 3px; grid-column: 1 / -1; }
.ps-half { flex: 1; display: flex; height: 6px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.ps-half.l { justify-content: flex-end; }
.ps-half i { display: block; height: 100%; border-radius: 4px; }

/* tira giù per aggiornare: pastiglia che segue il dito e dice cosa sta facendo */
.puller {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; z-index: 30;
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border-radius: 999px; white-space: nowrap;
  background: var(--bg-secondary); border: 1px solid var(--border-strong); color: var(--text-secondary);
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.01em;
  box-shadow: 0 10px 26px -14px #000;
  opacity: 0; transform: translate(-50%, 0) scale(0.85); pointer-events: none;
}
.puller.settle { transition: opacity 240ms var(--ease), transform 340ms var(--ease); }
.puller.ready { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.puller.loading { color: var(--accent); border-color: var(--accent); }
.puller svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.puller.loading svg { display: none; }
.puller .dots { display: none; align-items: center; gap: 3px; }
.puller.loading .dots { display: inline-flex; }
.puller .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot 1s ease-in-out infinite; }
.puller .dots i:nth-child(2) { animation-delay: 140ms; }
.puller .dots i:nth-child(3) { animation-delay: 280ms; }
@keyframes dot {
  0%, 75%, 100% { opacity: 0.3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.live-wrap:empty { display: none; }

/* ── Storico: tre numeri spiegati + lista divisa per giorno ── */
.sums { display: grid; gap: 10px; }
.sum { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; }
.sum-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sum-head span { font-size: 14px; color: var(--text-primary); }
.sum-head b { font-family: var(--font-mono); font-weight: 500; font-size: 15px; color: var(--accent); white-space: nowrap; }
.sum p { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.list .day { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 16px 0 2px; }
.row .fin { font-family: var(--font-mono); font-size: .9rem; color: var(--text-secondary); margin-left: 8px; white-space: nowrap; }

/* ── verdetto "il modello funziona?" ── */
.verdict { --vd: var(--text-muted); background: var(--bg-secondary); border: 1px solid var(--border); border-left: 4px solid var(--vd); border-radius: 16px; padding: 16px; display: grid; gap: 10px; color: inherit; text-decoration: none; }
.verdict.good { --vd: var(--accent); background: linear-gradient(135deg, var(--accent-dim), var(--bg-secondary) 60%); }
.verdict.bad { --vd: var(--loss); background: linear-gradient(135deg, var(--loss-dim), var(--bg-secondary) 60%); }
.vd-head { display: flex; align-items: center; gap: 8px; }
.vd-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--vd); box-shadow: 0 0 12px var(--vd); }
.vd-q { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.vd-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 7vw, 2.1rem); line-height: 1.05; color: var(--vd); }
.verdict.idle .vd-title { color: var(--text-primary); }
.vd-why { font-size: 13.5px; color: var(--text-secondary); line-height: 1.45; }
.vd-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--text-secondary); }
.vd-line > span:first-child { flex: 1 1 auto; }
.vd-line b { font-family: var(--font-mono); font-weight: 500; font-size: 15px; color: var(--text-primary); }
.vd-line b.pos { color: var(--accent); }
.vd-line b.neg { color: var(--loss); }
.vd-line small { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }
.vd-line.mine { border-top: 1px solid var(--border); padding-top: 10px; }
.meter { display: inline-flex; gap: 4px; }
.meter i { width: 18px; height: 6px; border-radius: 3px; background: var(--bg-tertiary); }
.meter i.on { background: var(--vd); }
.verdict.compact .row-open { justify-self: start; }
.verdict .note { font-size: 12px; color: var(--text-muted); }

/* ── controllo pre-partita sulla carta ── */
.prematch { display: grid; gap: 3px; font-size: 12.5px; color: var(--text-secondary); border-radius: 10px; padding: 9px 11px; background: var(--bg-tertiary); }
.prematch b { font-weight: 500; font-size: 13px; color: var(--text-primary); }
.prematch span { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.prematch.ok b { color: var(--accent); }
.prematch.warn { background: var(--loss-dim); }
.prematch.warn b { color: var(--loss); }
.prematch.wait { color: var(--text-muted); background: transparent; padding: 0; }

/* ── Controllo: conto del mese e prova della fonte gratuita ── */
.vd-foot { font-size: 12px; color: var(--text-muted); }
.settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; border-top: 1px solid var(--border); padding-top: 12px; }
.settings label { display: grid; gap: 4px; font-size: 11.5px; color: var(--text-muted); }
.settings input { width: 100%; min-width: 0; font: 500 16px var(--font-mono); color: var(--text-primary); background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.settings input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings .btn { grid-column: 1 / -1; }
.src-row { display: grid; gap: 5px; }
.src-row small { font-size: 11.5px; color: var(--text-muted); }
.src-bar { height: 5px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; }
.src-bar i { display: block; height: 100%; background: var(--vd); border-radius: 3px; }
.verdict.idle .src-bar i { background: var(--text-secondary); }

/* ── niente zoom e niente scorrimento laterale: l'app si muove solo in verticale.
   pan-y toglie pizzico e doppio tocco; 16px sui campi evita che l'iPhone
   ingrandisca da solo quando ne tocchi uno; clip taglia qualsiasi sbordo. ── */
body { touch-action: pan-y; overflow-x: clip; max-width: 100vw; }
input, select, textarea { font-size: 16px; }

/* ── accesso ── */
body.locked .nav { display: none; }
.login { min-height: 80dvh; max-width: 380px; margin: 0 auto; padding: 12vh 0 40px; display: grid; gap: 14px; align-content: start; }
.login .brand { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.login .brand span { color: var(--accent); }
.login h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
.login-form { display: grid; gap: 10px; }
.login-form input { font: 500 16px var(--font-body); color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.login-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-or { text-align: center; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.login-msg { min-height: 1.4em; font-size: 13px; color: var(--loss); }

/* ── scommessa vera sulla carta ── */
.bet { display: grid; gap: 8px; }
.bet-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-family: var(--font-mono); font-size: 14px; background: var(--bg-tertiary); border-radius: 10px; padding: 9px 11px; }
.bet-line b { font-weight: 500; }
.bet-line b.pos { color: var(--accent); }
.bet-line b.neg { color: var(--loss); }
.bet-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bet-form label { display: grid; gap: 4px; font-size: 11.5px; color: var(--text-muted); }
.bet-form input { width: 100%; min-width: 0; font: 500 16px var(--font-mono); color: var(--text-primary); background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.bet-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bet-form .actions { grid-column: 1 / -1; }
.bet-form[hidden] { display: none; }
.bet [hidden] { display: none !important; }
