:root {
  --bg: #f4f4f4;
  --panel: #ffffff;
  --fg: #111111;
  --muted: #5c5c5c;
  --line: #e0e0e0;
  --brand: #0a0a0a;          /* nero del logo */
  --brand-2: #0a0a0a;        /* nero: leggibile su bianco */
  --lime: #c6ff00;           /* lime del logo */
  --accent: #c6ff00;
  --ok: #0a0a0a;
  --bad: #b91c1c;
  --value: #0a0a0a;
  --bar: #e5e5e5;
  --bar-strong: #0a0a0a;
  --top-bg: #0a0a0a;
  --top-fg: #c6ff00;
  --on-brand: #ffffff;
  --radius: 12px;
  --tabbar-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --panel: #151515;
    --fg: #f2f2f2;
    --muted: #a3a3a3;
    --line: #2a2a2a;
    --brand: #000000;
    --brand-2: #c6ff00;
    --ok: #c6ff00;
    --bad: #f87171;
    --value: #c6ff00;
    --bar: #262626;
    --bar-strong: #c6ff00;
    --top-bg: #c6ff00;
    --top-fg: #0a0a0a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* barra superiore */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  /* su schermi larghi il contenuto della barra si allinea alla colonna centrale dell'app */
  padding: calc(10px + env(safe-area-inset-top)) max(16px, calc((100vw - 720px) / 2 + 16px)) 10px;
  background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-style: italic; letter-spacing: -.3px; text-transform: uppercase; }
.brand b { color: var(--lime); font-weight: 900; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.lang {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600;
}
.lang option { color: #14201b; background: #fff; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--lime); color: #0a0a0a; }
.demo { background: #fef3c7; color: #78350f; font-size: 13px; padding: 6px 16px; text-align: center; }

.view { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }
h1 { font-size: 22px; margin: 6px 0 2px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* barra delle schede in basso */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; font-size: 11px; color: var(--muted);
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--brand-2); font-weight: 600; }

/* schede e liste */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.card.link { display: block; text-decoration: none; }
.card.link:active { transform: scale(.995); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 6px; }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  text-decoration: none; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--lime); }

.league { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 2px 4px; }
.match-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.teams { font-weight: 650; font-size: 16px; margin: 4px 0 8px; }
.teams .score { float: inline-end; font-variant-numeric: tabular-nums; }

.x3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.x3 > div { border-radius: 8px; background: var(--bg); padding: 6px 4px; text-align: center; font-variant-numeric: tabular-nums; }
.x3 > div b { display: block; font-size: 16px; }
.x3 > div span { font-size: 11px; color: var(--muted); }
.x3 > div.top { background: var(--top-bg); color: var(--top-fg); }
.x3 > div.top span { color: inherit; opacity: .85; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); font-variant-numeric: tabular-nums; }
.tag.value { background: var(--lime); color: #0a0a0a; font-weight: 600; }
.tag.win { background: var(--lime); color: #0a0a0a; font-weight: 600; }
.tag.lose { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-weight: 600; }
.lock { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

/* scheda partita */
/* schede dei mercati: vanno a capo, così sono tutte visibili (corner, cartellini, giocatori…) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 8px; }
.seg::-webkit-scrollbar { display: none; }
.market { padding: 10px 0; border-top: 1px solid var(--line); }
.market:first-child { border-top: 0; }
.market .lbl { font-weight: 550; }
.market .sub { font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--bar); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--bar-strong); border-radius: 3px; }
.nums { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nums b { font-size: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; font-size: 14px; }

/* numeri grandi */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* moduli */
label.field { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
input[type=range] { accent-color: var(--brand-2); padding: 0 !important; border: 0 !important; background: none !important; }
label.field input, label.field select, label.field textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); font-size: 16px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--lime); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--lime); border-color: var(--lime); color: #0a0a0a; } .chip.on { background: var(--lime); border-color: var(--lime); color: #0a0a0a; } }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.msg.err { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.warn { border-inline-start: 3px solid var(--accent); padding: 8px 12px; background: var(--panel); border-start-end-radius: 10px; border-end-end-radius: 10px; font-size: 13px; }

.stars { display: flex; gap: 6px; margin: 6px 0 2px; }
.stars label { cursor: pointer; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars span { font-size: 34px; line-height: 1; color: var(--line); transition: color .1s; }
.stars:has(input:checked) span { color: var(--accent); }
.stars label:has(input:checked) ~ label span { color: var(--line); }
.stars input:focus-visible + span { outline: 2px solid var(--brand-2); border-radius: 4px; }
.newsline { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--muted); }
.newsline span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
svg.ni { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.srclink { text-decoration: underline; cursor: pointer; }
.ctxnote { border-inline-start: 3px solid var(--accent); padding-block: 2px; padding-inline: 10px 0; margin: 8px 0; }
.ctxnote p { margin: 2px 0; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.spinner { width: 28px; height: 28px; margin: 40px auto; border: 3px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { font-size: 12px; color: var(--muted); text-align: center; margin: 24px 0 8px; }

/* finestra maggiore età */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { background: var(--panel); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-card .btn { width: 100%; }

/* arabo: da destra a sinistra; numeri, quote e risultati restano leggibili da sinistra a destra */
[dir="rtl"] body { font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
[dir="rtl"] .nums b, [dir="rtl"] .x3 b, [dir="rtl"] .score, [dir="rtl"] .stat b { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .teams, [dir="rtl"] .lbl { unicode-bidi: plaintext; }
/* 1 · X · 2 nello stesso ordine dei nomi delle squadre (casa a sinistra) */
[dir="rtl"] .x3 { direction: ltr; }

/* strumenti della giornata: ricerca e filtro */
.tools { display: grid; grid-template-columns: 1fr minmax(0, 46%); gap: 8px; margin: 10px 0 4px; }
.tools input, .tools select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); font-size: 15px; }
@media (max-width: 420px) { .tools { grid-template-columns: 1fr; } }

/* preferiti */
.star { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; margin: -6px 0;
  border: 0; background: none; cursor: pointer; color: var(--muted); vertical-align: middle; flex: none; }
.star svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.star.on { color: #ca8a04; }
.star.on svg { fill: #facc15; stroke: #ca8a04; }
.league .star { margin-inline-start: 2px; }
.favmark { color: #ca8a04; }
h3.row { justify-content: space-between; }

/* in evidenza */
.hl-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.card.link.hl-card { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; padding: 10px 12px; border-top: 3px solid var(--lime); }
.hl-card b.small { line-height: 1.25; }
.hl-pick { font-size: 13px; color: var(--muted); }
.hl-pick b { color: var(--fg); }
@media (max-width: 560px) {
  /* sul telefono le tre schede scorrono in orizzontale e occupano poco spazio */
  .hl-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 2px; }
  .hl-row::-webkit-scrollbar { display: none; }
  .card.link.hl-card { flex: 0 0 72%; scroll-snap-align: start; margin: 4px 0; }
}

/* movimento del mercato */
.tag.move { background: color-mix(in srgb, var(--brand-2) 14%, transparent); color: var(--brand-2); font-weight: 600; }
.up { color: var(--ok); margin-inline-start: 6px; }
.down { color: var(--bad); margin-inline-start: 6px; }

/* tabella dello storico */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 6px; border-bottom: 1px dashed var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

#share { margin-top: 4px; }
.card.push { margin-top: 14px; }

/* perché questo pronostico */
.why .kv.head { border-bottom: 1px solid var(--line); font-size: 13px; }
.why .kv.final { border-top: 1px solid var(--line); border-bottom: 0; margin-top: 4px; padding-top: 8px; }
.why .kv b { text-align: end; }
.why .kv b { white-space: nowrap; }

/* risultati in diretta */
.lv { display: inline-flex; align-items: center; gap: 6px; }
.lv.on { color: var(--bad); font-weight: 700; }
.lv .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: lvpulse 1.4s ease-in-out infinite; }
@keyframes lvpulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .lv .dot { animation: none; } }
.livebox.on { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.livescore { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 8px 0 4px; }
.livescore span { font-weight: 600; }
.livescore span:last-child { text-align: end; }
.livescore b { font-size: 30px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.evs { margin: 10px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
.ev { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-size: 14px; }
.ev.a { flex-direction: row-reverse; text-align: end; }
.evm { min-width: 38px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev.a .evm { text-align: end; }
.redcard { display: inline-block; width: 10px; height: 14px; border-radius: 2px; background: #dc2626; transform: translateY(2px); }

/* multipla */
.market .row > div:first-child { flex: 1; min-width: 0; }
.addslip, .rmslip {
  flex: 0 0 auto; width: 34px; height: 34px; align-self: center;
  border-radius: 50%; border: 1.5px solid var(--line); background: var(--panel); color: var(--fg);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.addslip.on { background: var(--lime); border-color: var(--lime); color: #0a0a0a; font-weight: 700; }
.addslip:focus-visible, .rmslip:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.rmslip { font-size: 14px; color: var(--muted); }
.slipbar {
  position: fixed; z-index: 11; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  width: min(688px, calc(100vw - 32px)); display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px; background: #0a0a0a; color: #fff; text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); border: 1px solid #262626;
}
.slipbar b { color: var(--lime); font-variant-numeric: tabular-nums; }
body:has(.slipbar:not([hidden])) .view { padding-bottom: 84px; }
.slip-tot input { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 72px);
  max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 10px; background: #262626; color: #fff; font-size: 14px;
}
.tgcard { border-color: #2b6f8f; }
.tgcard .btn svg { vertical-align: -3px; }
.foot a { color: inherit; }

/* guida */
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.guide-toc a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; text-decoration: none; background: var(--panel); }
.guide h2 { margin-top: 0; font-size: 17px; }
.guide p { margin: 8px 0; }
.guide { scroll-margin-top: 70px; }
