@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Syne:wght@400;700;800&display=swap');

:root {
  --bg:       #0a0e1a;
  --surface:  #111827;
  --surface2: #1a2235;
  --border:   #1e2d45;
  --accent:   #00d4ff;
  --accent2:  #ff6b35;
  --green:    #00e676;
  --yellow:   #ffd740;
  --red:      #ff5252;
  --purple:   #c084fc;
  --fuchsia:  #e879f9;
  --text:     #e2e8f0;
  --muted:    #8899aa;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Syne', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
  height: 100vh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
}

/* ── Footer ── */
footer#app-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 20px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  flex-shrink: 0; z-index: 5;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px;
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.modal-logo-img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.modal-title { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.modal-sub { font-size: 13px; color: var(--muted); }
.modal-input {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-family: var(--sans); font-size: 15px;
  outline: none; text-align: center; transition: border-color .2s;
}
.modal-input:focus { border-color: var(--accent); }
.modal-btn {
  width: 100%; padding: 12px; border-radius: 8px; border: none;
  background: var(--accent); color: var(--bg);
  font-family: var(--sans); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: filter .15s;
}
.modal-btn:hover { filter: brightness(1.1); }

/* ── Header ── */
header {
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-img {
  width: 36px; height: 36px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}
.logo h1 { font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.logo sub { font-family: var(--mono); font-size: 10px; color: var(--muted); display:block; }
.hdr-stats { display:flex; gap:28px; align-items: center; }
.hdr-stat b { font-family:var(--mono); font-size:16px; color:var(--accent); display:block; }
.hdr-stat span { font-size:10px; color:var(--muted); }

/* ── Layout ── */
main { display: grid; grid-template-columns: 280px 1fr; grid-template-rows: 1fr; overflow: hidden; height: 100%; }

/* ── Left ── */
.left {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0; overflow-y: auto; padding: 20px;
}
.field-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.field-block { margin-bottom: 16px; }
input[type=text], input[type=number] {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-family: var(--mono);
  font-size: 12px; outline: none; width: 100%; transition: border-color .2s;
}
input:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn {
  padding: 11px 14px; border-radius: 8px; border: none; cursor: pointer;
  font-family: var(--sans); font-weight: 700; font-size: 13px;
  letter-spacing: .3px; transition: all .18s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-bottom: 8px;
}
.btn-go   { background: var(--accent); color: var(--bg); }
.btn-go:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-go:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-demo { background: var(--surface2); color: var(--text); }
.btn-demo:hover { border: 1px solid var(--accent); }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.info-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 11px; color: var(--muted); line-height: 1.6;
}
.info-box b { color: var(--text); }

/* ── Right ── */
.right { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

.hdr-mobile-nav { display: none; }
.hdr-nav-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 700;
  padding: 5px 10px; cursor: pointer; transition: all .15s;
}
.hdr-nav-btn:hover { color: var(--accent); border-color: var(--accent); }
.hdr-nav-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(0,212,255,.08); }

.tabs {
  display: flex; align-items: center; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.tab {
  padding: 13px 18px; cursor: pointer; font-size: 11px; font-weight: 700;
  color: var(--muted); border-bottom: 2px solid transparent; transition: all .15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-badge {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  background: rgba(0,212,255,.12); color: var(--accent);
  padding: 1px 6px; border-radius: 10px; margin-left: 6px;
}

.tab-content { display: none; flex: 1; overflow: hidden; flex-direction: column; min-height: 0; }
.tab-content.active { display: flex; }

/* ── Matches table ── */
.tbar {
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px; flex-shrink: 0; font-size: 12px;
}
.tbar-stat b { font-family: var(--mono); font-size: 15px; }
.tbar-stat b.green { color: var(--green); }
.tbar-stat b.blue  { color: var(--accent); }
.tbar-stat span    { color: var(--muted); font-size: 11px; }
.tbar-right { margin-left: auto; }
.tbar-right input { width: 180px; padding: 5px 10px; }

.scroll { flex: 1; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead tr { position: sticky; top: 0; z-index: 2; background: var(--surface2); }
th {
  padding: 9px 13px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
th[onclick]:hover { color: var(--text); }
th[onclick] { transition: color .12s; }
td { padding: 9px 13px; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,.02); }

.badge { padding: 2px 8px; border-radius: 4px; font-size: 10px; font-family: var(--mono); font-weight: 600; }
.bl { background: rgba(0,212,255,.08); color: var(--accent); }
.bo { background: rgba(255,107,53,.08); color: var(--accent2); }

.q1c { font-family: var(--mono); font-weight: 600; color: #60a5fa; }
.qxc { font-family: var(--mono); font-weight: 600; color: #a78bfa; }
.q2c { font-family: var(--mono); font-weight: 600; color: #34d399; }

/* pick selector */
.pick-group { display: flex; gap: 4px; }
.pick-btn {
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
  border-radius: 5px; padding: 4px 9px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; font-weight: 700; transition: all .12s;
}
.rm-btn {
  border: none; background: transparent; color: var(--muted);
  font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity .15s, color .15s;
  line-height: 1;
}
tr:hover .rm-btn { opacity: 1; }
.rm-btn:hover { color: var(--red); }
.pick-btn:hover { border-color: var(--accent); color: var(--accent); }
.pick-btn.sel-1    { border-color:var(--green); background:rgba(0,255,135,.10); color:var(--green); }
.pick-btn.sel-X    { border-color:var(--green); background:rgba(0,255,135,.10); color:var(--green); }
.pick-btn.sel-2    { border-color:var(--green); background:rgba(0,255,135,.10); color:var(--green); }
.pick-btn.sel-over   { border-color:var(--accent2); background:rgba(255,107,53,.12); color:var(--accent2); }
.pick-btn.sel-forced { border-color:var(--fuchsia); background:rgba(232,121,249,.22); color:var(--fuchsia); font-weight:800; box-shadow:0 0 12px rgba(232,121,249,.6); }
.pick-btn.disabled { opacity:.3; cursor:default; pointer-events:none; }

/* ── Combos ── */
.cbar {
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; flex-shrink: 0;
}
.cbar-stat b { font-family: var(--mono); font-size: 15px; }
.cbar-right { margin-left: auto; display: flex; gap: 5px; }
.sz-btn {
  padding: 4px 10px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; color: var(--muted); font-family: var(--mono);
  font-size: 11px; cursor: pointer; transition: all .12s;
}
.sz-btn.on { border-color: var(--purple); color: var(--purple); background: rgba(192,132,252,.08); }

.combo-scroll { flex: 1; overflow: auto; padding: 14px 16px; }

.grp-head {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); padding: 2px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.grp-head .cnt {
  font-family: var(--mono); font-size: 11px; color: var(--text);
  background: var(--surface2); border-radius: 4px; padding: 1px 6px;
}
.grp-cards { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; display: grid; grid-template-columns: 34px 1fr auto;
  gap: 12px; align-items: center; transition: border-color .15s;
}
.card:hover  { border-color: rgba(0,212,255,.25); }
.card.top    { border-color: rgba(0,230,118,.35); background: rgba(0,230,118,.025); }
.card.forced    { border-color: var(--fuchsia); background: rgba(232,121,249,.07); box-shadow: 0 0 16px rgba(232,121,249,.25); }
.card.forced .card-n { color: var(--fuchsia); border-color: var(--fuchsia); background: rgba(232,121,249,.15); }
.card.selection { border-color: rgba(251,191,36,.7); background: rgba(251,191,36,.04); box-shadow: 0 0 14px rgba(251,191,36,.18); }
.card.selection .card-n { border-color: rgba(251,191,36,.5); color: #fbbf24; }
.bettino-sel-badge { font-size:10px; font-weight:700; color:#fbbf24; letter-spacing:.5px; text-transform:uppercase; margin-bottom:5px; }

.card-n {
  width: 34px; height: 34px; border-radius: 8px; background: var(--surface2);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--purple);
}
.card-events { display: flex; flex-direction: column; gap: 3px; }
.card-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.card-name { font-weight: 600; color: var(--text); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-o {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 3px;
}
.o1b { background:rgba(96,165,250,.12); color:#60a5fa; }
.oXb { background:rgba(167,139,250,.12); color:#a78bfa; }
.o2b { background:rgba(52,211,153,.12); color:#34d399; }
.card-odds-small { font-family:var(--mono); font-size:11px; color:var(--yellow); }

.card-right { text-align: right; min-width: 90px; }
.card-total { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--green); }
.card-total.y { color: var(--yellow); }
.card-total.o { color: var(--accent2); }
.card-win  { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-win b { color: var(--text); }
.card-profit { font-family: var(--mono); font-size: 11px; }

/* ── Play button ── */
.play-btn {
  margin-top: 6px; padding: 5px 10px; border-radius: 6px; border: none;
  cursor: pointer; font-family: var(--sans); font-size: 11px; font-weight: 700;
  transition: all .15s; white-space: nowrap;
  background: rgba(0,212,255,.1); color: var(--accent); border: 1px solid rgba(0,212,255,.25);
}
.play-btn:hover { background: rgba(0,212,255,.2); }
.play-btn.saved { background: rgba(0,230,118,.1); color: var(--green); border-color: rgba(0,230,118,.3); cursor: default; }

/* ── Saved counter chip ── */
.saved-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11px;
  background: rgba(0,230,118,.1); color: var(--green);
  border: 1px solid rgba(0,230,118,.25); border-radius: 20px;
  padding: 3px 10px; cursor: pointer; transition: background .15s;
}
.saved-chip:hover { background: rgba(0,230,118,.18); }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); gap: 10px; font-size: 13px; text-align: center;
}
.empty-i { font-size: 40px; opacity: .4; }

.spinner {
  width: 13px; height: 13px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Tab visibility ── */
.tab-mobile-only  { display: none; }
.tab-desktop-only { display: flex; align-items: center; }

/* ── Sub-tabs (Statistiche / Mie combo) ── */
.sub-tabs { display: flex; gap: 5px; padding: 7px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sub-tab {
  padding: 3px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 11px; font-family: var(--mono); transition: all .15s;
}
.sub-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(0,212,255,.08); }
.sub-tab:hover:not(.active) { border-color: var(--text); color: var(--text); }
.stats-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.stats-meta {
  font-size: 10px; font-family: var(--mono); color: var(--muted);
  padding: 4px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.stats-scroll {
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
}
.stats-section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.stats-sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); padding: 8px 12px 4px;
}
.stats-hint { font-size: 10px; color: var(--muted); padding: 0 12px 7px; line-height: 1.5; opacity: .8; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono); }
.stats-table th {
  padding: 4px 8px; text-align: right; color: var(--muted); font-weight: 400;
  border-bottom: 1px solid var(--border); font-size: 9px; letter-spacing: .5px; text-transform: uppercase;
}
.stats-table th:first-child { text-align: left; }
.stats-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.03); text-align: right; font-size: 11px; }
.stats-table td:first-child { text-align: left; font-weight: 500; color: var(--text); }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table tr:hover td { background: rgba(255,255,255,.025); }

/* ── Match insight (H2H + Forma) ── */
.match-insight-cell { cursor: pointer; }
.match-insight-cell:hover b { color: var(--accent); }
.insight-chip { font-size: 10px; margin-left: 5px; opacity: .5; vertical-align: middle; }
.match-insight-cell:hover .insight-chip { opacity: 1; }

.insight-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 14px;
  width: min(480px, 96vw); max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.insight-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  font-family: var(--mono);
}
.insight-subtitle { font-size: 10px; color: var(--muted); margin-top: 3px; font-family: var(--mono); font-weight: 400; }
.insight-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.insight-close:hover { color: var(--text); background: var(--surface); }

.insight-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.insight-tab {
  background: none; border: none; color: var(--muted); font-family: var(--mono);
  font-size: 11px; font-weight: 600; padding: 9px 10px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.insight-tab:hover { color: var(--text); }
.insight-tab.on { color: var(--accent); border-bottom-color: var(--accent); }

.insight-body { overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 14px; }
.insight-tabpanel { display: none; flex-direction: column; gap: 14px; }
.insight-tabpanel.on { display: flex; }
.insight-loading { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 0; font-family: var(--mono); line-height: 1.8; }
.insight-section { display: flex; flex-direction: column; gap: 8px; }
.insight-sec-title { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.insight-summary {
  display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 6px 10px; background: var(--surface); border-radius: 7px;
}
.insight-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono); }
.insight-table td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.04); }
.insight-table tr:last-child td { border-bottom: none; }
.insight-form-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; background: var(--surface); border-radius: 7px;
  font-size: 12px; gap: 10px;
}
.insight-team-name { color: var(--muted); font-size: 11px; font-family: var(--mono); flex: 1; }

/* 1X2 boxes */
.insight-1x2 { display: flex; gap: 8px; }
.insight-1x2-box {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 6px; text-align: center;
}
.insight-1x2-box .lbl { font-size: 10px; color: var(--muted); font-family: var(--mono); margin-bottom: 4px; }
.insight-1x2-box .pct { font-size: 20px; font-weight: 800; font-family: var(--mono); }
.insight-pick-badge {
  text-align: center; font-size: 11px; font-weight: 700; font-family: var(--mono);
  border-radius: 8px; padding: 7px; letter-spacing: .2px;
}

/* Mercati gol: GG/NG, gol casa/fuori */
.insight-goals { display: flex; gap: 8px; flex-wrap: wrap; }
.insight-goals-box {
  flex: 1 1 calc(25% - 6px); min-width: 68px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 6px; text-align: center;
}
.insight-goals-box .lbl { font-size: 9px; color: var(--muted); font-family: var(--mono); margin-bottom: 4px; }
.insight-goals-box .pct { font-size: 16px; font-weight: 800; font-family: var(--mono); }

/* Forma: pallini W/D/L */
.insight-form-circles { display: flex; gap: 5px; flex-wrap: wrap; }
.insight-form-circle {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; font-family: var(--mono); color: #0a0e1a; cursor: default;
}
.insight-form-circle.w { background: var(--green); }
.insight-form-circle.d { background: var(--yellow); }
.insight-form-circle.l { background: var(--red); }

/* H2H stat boxes */
.insight-h2h-stats { display: flex; gap: 8px; }
.insight-h2h-stats .box {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 6px; text-align: center;
}
.insight-h2h-stats .box b { display: block; font-size: 18px; font-family: var(--mono); }
.insight-h2h-stats .box span { font-size: 10px; color: var(--muted); }

/* ── Tracking tab ── */
.trk-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.trk-btn {
  padding: 6px 12px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-family: var(--sans);
  font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.trk-btn-green { border-color: rgba(0,230,118,.3); color: var(--green); background: rgba(0,230,118,.06); }
.trk-btn-green:hover { background: rgba(0,230,118,.18); }
.trk-btn-green:disabled { opacity: .4; cursor: not-allowed; }
.trk-btn:hover { border-color: var(--accent); color: var(--accent); }

.trk-filter { display: flex; gap: 5px; padding: 8px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.trk-fbtn {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-family: var(--sans);
  font-size: 11px; font-weight: 700; cursor: pointer; transition: all .12s;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1;
}
.trk-fbtn.on { border-color: var(--accent); color: var(--accent); background: rgba(0,212,255,.08); }

.lg-chip {
  padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-family: var(--mono);
  font-size: 10px; font-weight: 600; cursor: pointer; transition: all .12s;
  white-space: nowrap;
}
.lg-chip.on { border-color: var(--accent); color: var(--accent); background: rgba(0,212,255,.08); }

.league-select {
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: var(--mono);
  font-size: 11px; cursor: pointer; outline: none;
  min-width: 200px; max-width: 280px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238899aa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color .15s;
}
.league-select:focus,
.league-select:hover { border-color: var(--accent); }
.league-select option { background: var(--surface2); color: var(--text); }

.trk-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }

/* History: tabella combo */
.history-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; flex-shrink: 0; }
.history-table thead th {
  text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); font-weight: 700;
  position: sticky; top: 0; background: var(--bg);
}
.history-table thead th:nth-child(3),
.history-table thead th:nth-child(5),
.history-table thead th:nth-child(6) { text-align: right; }
.trk-row { cursor: pointer; }
.trk-row:hover td { background: rgba(255,255,255,.025); }
.trk-row td { padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; white-space: nowrap; }
.trk-row td:nth-child(3),
.trk-row td:nth-child(5),
.trk-row td:nth-child(6) { text-align: right; }
.trk-badge { display: inline-block; padding: 2px 9px; border-radius: 5px; font-weight: 700; font-size: 10px; border: 1px solid; }
.trk-badge-w { color: var(--green); border-color: rgba(0,230,118,.4); background: rgba(0,230,118,.1); }
.trk-badge-l { color: var(--red); border-color: rgba(255,82,82,.4); background: rgba(255,82,82,.1); }
.trk-badge-p { color: var(--yellow); border-color: rgba(255,215,64,.4); background: rgba(255,215,64,.1); }
.trk-pos { color: var(--green); }
.trk-neg { color: var(--red); }
.trk-pending { color: var(--muted); }
.trk-legs-row td { padding: 0; border-bottom: none; }
.trk-legs { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.trk-legs.open { max-height: 320px; }
.trk-leg {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 11px;
}
.trk-leg:last-child { border-bottom: none; }
.trk-leg-esito {
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  width: 18px; text-align: center; color: var(--accent);
}
.trk-leg-match { flex: 1; color: var(--text); white-space: normal; }
.trk-leg-odds { font-family: var(--mono); font-size: 10px; }
.trk-rb {
  padding: 4px 8px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface2); font-size: 10px; font-weight: 700; cursor: pointer; transition: all .12s;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; margin-left: 4px;
}
.trk-rb-w { color: var(--green); border-color: rgba(0,230,118,.3); }
.trk-rb-w:hover { background: rgba(0,230,118,.15); }
.trk-rb-l { color: var(--red); border-color: rgba(255,82,82,.3); }
.trk-rb-l:hover { background: rgba(255,82,82,.15); }
.trk-rb-del { color: var(--muted); padding: 4px 7px; }
.trk-rb-del:hover { color: var(--red); }

/* History: KPI + fascia di quota */
.history-sec-title { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); padding: 16px 0 8px; }
.history-kpis { display: flex; gap: 8px; padding: 14px 0 0; flex-shrink: 0; }
.history-kpi-box { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 8px; text-align: center; }
.history-kpi-box .lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-family: var(--mono); margin-bottom: 5px; }
.history-kpi-box .val { font-size: 19px; font-weight: 800; font-family: var(--mono); }
.fascia-section { flex-shrink: 0; padding-bottom: 4px; }
.fascia-body { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.fascia-donut { width: 76px; height: 76px; flex-shrink: 0; }
.fascia-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.fascia-legend-item { display: flex; align-items: center; gap: 8px; font-size: 11px; font-family: var(--mono); }
.fascia-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fascia-range { flex: 1; color: var(--text); }
.fascia-wr { font-weight: 700; }

/* ── Toast ── */
#trk-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 20px; font-size: 12px; font-family: var(--mono);
  box-shadow: 0 8px 32px rgba(0,0,0,.5); z-index: 200;
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
#trk-toast.show { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 768px) {
  body {
    height: 100dvh;
    display: flex; flex-direction: column;
    overflow: hidden;
  }

  header { padding: 10px 14px; flex-shrink: 0; }
  footer#app-footer { padding: 8px 14px 20px; font-size: 10px; }
  .logo-icon { width: 30px; height: 30px; font-size: 15px; }
  .logo h1 { font-size: 15px; }
  #hdr-sub { display: none; }
  .hdr-stats { gap: 10px; }
  .hdr-stat b { font-size: 14px; }
  .hdr-hide-sm { display: none; }

  main {
    flex: 1; min-height: 0;
    grid-template-columns: 1fr;
    display: flex; flex-direction: column;
    overflow: hidden;
  }

  /* order: tabs bar (.right) always on top, setup panel (.left) below */
  .right { order: 1; }
  .left  { order: 2; }

  /* Left: hidden by default on mobile */
  .left {
    border-right: none; border-bottom: none;
    padding: 16px 20px;
    display: none; flex-direction: column; overflow-y: auto;
  }

  /* Default: .right fills all available space */
  body:not(.setup-active) .right { flex: 1; min-height: 0; overflow: hidden; }

  /* Setup active: tabs bar stays, tab-content hidden, left panel expands below */
  body.setup-active .right { flex-shrink: 0; }
  body.setup-active .right .tab-content { display: none !important; }
  body.setup-active .left { display: flex; flex: 1; min-height: 0; }

  /* Header nav buttons: History + Stats */
  .hdr-mobile-nav { display: flex; gap: 6px; align-items: center; }

  /* Setup tab visible on mobile, Partite kept too */
  .tab-mobile-only  { display: flex; }
  .tab-desktop-only { display: none; }

  /* Hide History and Stats from tab bar on mobile */
  .tab[data-tab="history"],
  .tab[data-tab="tracking"] { display: none; }

  /* 3 remaining tabs share the bar equally */
  .tab { flex: 1; text-align: center; padding: 10px 4px; }

  .tbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .tbar-right { width: 100%; }
  .tbar-right input { width: 100%; }
  .league-select { min-width: unset; max-width: unset; width: 100%; }

  #mtable th:nth-child(2), #mtable td:nth-child(2) { display: none; }
  #mtable th:nth-child(4), #mtable td:nth-child(4) { display: none; }
  .rm-btn { opacity: 1; }
  .insight-chip { display: none; }
  .match-teams { display: flex; flex-direction: column; gap: 2px; }
  .vs-sep { display: none; }
  .team-home, .team-away { display: block; font-size: 11px; }
  #mtable thead th { font-size: 13px; }
  #mtable th:nth-child(4), #mtable th:nth-child(5), #mtable th:nth-child(6) { text-align: center; }
  #mtable td:nth-child(4), #mtable td:nth-child(5), #mtable td:nth-child(6) { text-align: center; }
  table { font-size: 11px; }
  td { padding: 8px 10px; }
  th { padding: 7px 10px; }

  /* Combo cards — compact table-row style on mobile */
  .combo-scroll { padding: 0; }
  .grp-cards { gap: 0; margin-bottom: 0; }
  .grp-head {
    padding: 6px 12px; margin: 0; border-radius: 0;
    position: sticky; top: 0; z-index: 1;
    background: var(--surface2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .card {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    padding: 8px 12px;
    gap: 5px 8px;
    grid-template-columns: 22px 1fr;
    grid-template-rows: auto auto;
  }
  .card.top { background: rgba(0,230,118,.03); }
  .card:hover { border-bottom-color: rgba(255,255,255,.06); }
  .card-n {
    grid-row: 1; grid-column: 1;
    width: 22px; height: 22px; font-size: 11px; border-radius: 4px;
    align-self: start; margin-top: 1px;
  }
  .card-events { grid-row: 1; grid-column: 2; }
  .card-row { font-size: 10px; }
  .card-name { max-width: calc(100vw - 110px); }
  .card-leg-date { display: none; }
  .card-right {
    grid-row: 2; grid-column: 1 / -1;
    min-width: unset; text-align: left;
    display: flex; align-items: center; gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 6px; margin-top: 2px;
  }
  .card-total { font-size: 14px; }
  .card-win { font-size: 10px; margin-top: 0; }
  .card-profit { display: none; }
  .play-btn { margin-top: 0; margin-left: auto; padding: 4px 10px; font-size: 10px; }

  .trk-fbtn { padding: 6px 10px; font-size: 11px; }
  .history-table th:nth-child(2), .trk-row td:nth-child(2) { display: none; } /* nasconde colonna Data */
  .trk-row td { padding: 7px 6px; }
  .trk-leg { padding: 5px 10px; }
  .trk-filter { padding: 6px 12px; gap: 4px; }
  .trk-fbtn { padding: 3px 10px; font-size: 11px; }
  .trk-scroll { padding: 10px 12px; }
  .history-kpi-box .val { font-size: 16px; }
}

@media (max-width: 400px) {
  .tab { padding: 10px 5px; font-size: 11px; text-align: center; }
}

/* ── Setup recap ─────────────────────────────────────────────────────────────── */
.setup-recap {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  line-height: 1.9;
}
.setup-recap b { color: var(--cyan); font-weight: 700; }

/* ── Come funziona ───────────────────────────────────────────────────────────── */
.howto-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.howto-hero {
  text-align: center;
  margin-bottom: 28px;
}
.howto-logo {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
}
.howto-hero h2 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan);
  margin: 0 0 10px;
}
.howto-hero p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.howto-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}
.howto-step {
  display: flex;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.howto-step-n {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--bg);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.howto-step-body { flex: 1; }
.howto-step-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.howto-step-body p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 6px;
}
.howto-step-body p:last-child { margin-bottom: 0; }
.howto-disclaimer {
  background: rgba(248, 87, 87, .06);
  border: 1px solid rgba(248, 87, 87, .3);
  border-radius: 10px;
  padding: 16px 18px;
}
.howto-disclaimer-title {
  font-weight: 700;
  font-size: 13px;
  color: #f85757;
  margin-bottom: 10px;
  letter-spacing: .3px;
}
.howto-disclaimer p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 8px;
}
.howto-disclaimer p:last-child { margin-bottom: 0; }

/* ── Investment Simulator Kelly ─────────────────────────────────────────────── */
.kelly-sim {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 16px;
}
.kelly-sim-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding: 12px 16px 0;
  text-transform: uppercase;
}
.kelly-infobox {
  margin: 12px 16px 0;
  padding: 10px 14px;
  background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 8px;
}
.kelly-infobox-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.kelly-infobox-body {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  font-family: var(--mono);
}
.kelly-infobox-body b {
  color: var(--text);
}
.kelly-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 12px;
}
.kelly-kpi {
  background: var(--card-bg);
  padding: 14px 12px;
  text-align: center;
}
.kelly-kpi-label {
  font-size: 9px;
  letter-spacing: .8px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.kelly-kpi-val {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}
.kelly-kpi-sub {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}
.kelly-params {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.kelly-params-title {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.kelly-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}
.kelly-slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}
.kelly-sval {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}
.kelly-slider-row input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.kelly-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.kelly-lcard {
  background: var(--card-bg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: background .15s;
}
.kelly-lcard:hover { background: rgba(255,255,255,.03); }
.kelly-lcard.active { background: rgba(255,255,255,.06); box-shadow: inset 0 2px 0 var(--klcolor); }
.kelly-lcard-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.kelly-lcard-sub   { font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.kelly-lcard-desc  { font-size: 10px; color: var(--muted); margin-bottom: 12px; }
.kelly-lcard-ev    { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); }
.kelly-lcard-roi-label { font-size: 9px; color: var(--muted); margin-top: 4px; }
.kelly-lcard-roi   { font-size: 12px; font-weight: 700; margin-top: 2px; }
.kelly-bottom {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}
.kelly-bstat {
  background: var(--card-bg);
  padding: 12px 10px;
  text-align: center;
}
.kelly-bs-label {
  font-size: 8px;
  letter-spacing: .6px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.kelly-bs-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 768px) {
  .kelly-kpis    { grid-template-columns: repeat(2, 1fr); }
  .kelly-sliders { grid-template-columns: 1fr; }
  .kelly-bottom  { grid-template-columns: repeat(2, 1fr); }
}

/* ── Bettino Plan cards ─────────────────────────────────────────────────────── */
.kplan-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.kplan-card-legs {
  padding: 10px 14px 0;
}
.kplan-card-head {


  border-bottom: 1px solid var(--border);
  padding: 6px 14px 12px;


}
.kplan-scenarios {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
}
.kplan-scenario {
  background: var(--card-bg);
  padding: 12px 10px;
  text-align: center;
}
.kplan-sc-name  { font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.kplan-sc-desc  { font-size: 9px;  color: var(--muted); margin-bottom: 10px; }
.kplan-sc-stake { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--text); }
.kplan-sc-win   { font-family: var(--mono); font-size: 13px; font-weight: 700; margin-top: 4px; }

/* ── Proiezione Kelly ───────────────────────────────────────────────────── */
.kelly-proj {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.kelly-proj-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.kelly-proj-sub {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.kelly-proj-sub b { color: var(--text); }
.kelly-proj-grid {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 2fr;
  gap: 4px 8px;
  align-items: center;
}
.kelly-proj-hdr {
  font-size: 9px;
  letter-spacing: .8px;
  color: var(--muted);
  text-transform: uppercase;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.kelly-proj-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
}
.kelly-proj-val {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
}
.kelly-proj-pnl {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--green);
}
.kelly-proj-note {
  font-size: 9px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

/* ── Onboarding ─────────────────────────────────────────────────────────── */
#onb-spotlight {
  position: fixed;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.72);
  z-index: 9998;
  pointer-events: none;
  transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease;
}
#onb-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: none;
  transition: top .3s ease, left .3s ease;
}
.onb-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.onb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s;
}
.onb-dot.active { background: var(--accent); }
.onb-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.onb-body {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.onb-body b { color: var(--text); }
.onb-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.onb-skip {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.onb-next {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Feedback ricalcolo ──────────────────────────────────────────────────── */
@keyframes rowFlash {
  0%   { background: rgba(99,102,241,.25); }
  100% { background: transparent; }
}
@keyframes rowFade {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-12px); }
}
tr.row-flash    { animation: rowFlash   .12s ease forwards; }
tr.row-removing { animation: rowFade    .2s  ease forwards; pointer-events: none; }

/* ── Sparkline accuracy ──────────────────────────────────────────────────── */
.kelly-spark {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.spark-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 10px 0 6px;
  height: 48px;
}
.spark-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.spark-bar-wrap {
  height: 40px;
  display: flex;
  align-items: flex-end;
  width: 100%;
  justify-content: center;
}
.spark-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height .3s ease;
}
.spark-lbl {
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
}
.spark-legend {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

/* Griglia proiezione a 4 colonne */
.kelly-proj-grid {
  grid-template-columns: 36px 60px 1fr 1fr;
}
